graphql 14.3.0 → 14.3.1

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 (272) hide show
  1. package/error/GraphQLError.js +12 -10
  2. package/error/GraphQLError.js.flow +7 -1
  3. package/error/GraphQLError.mjs +12 -2
  4. package/error/formatError.js +1 -1
  5. package/error/formatError.mjs +1 -1
  6. package/error/index.js +1 -1
  7. package/error/index.mjs +1 -1
  8. package/error/locatedError.js +1 -1
  9. package/error/locatedError.mjs +1 -1
  10. package/error/printError.js +1 -1
  11. package/error/printError.mjs +1 -1
  12. package/error/syntaxError.js +1 -1
  13. package/error/syntaxError.mjs +1 -1
  14. package/execution/execute.js +32 -26
  15. package/execution/execute.js.flow +6 -3
  16. package/execution/execute.mjs +32 -26
  17. package/execution/index.js +1 -1
  18. package/execution/index.mjs +1 -1
  19. package/execution/values.js +4 -4
  20. package/execution/values.js.flow +4 -3
  21. package/execution/values.mjs +4 -4
  22. package/graphql.js +6 -2
  23. package/graphql.js.flow +2 -1
  24. package/graphql.mjs +3 -2
  25. package/index.js +1 -1
  26. package/index.mjs +1 -1
  27. package/jsutils/ObjMap.js +1 -1
  28. package/jsutils/ObjMap.mjs +1 -0
  29. package/jsutils/PromiseOrValue.js +1 -1
  30. package/jsutils/PromiseOrValue.mjs +1 -0
  31. package/jsutils/dedent.js +1 -1
  32. package/jsutils/dedent.mjs +1 -1
  33. package/jsutils/defineToJSON.js +1 -1
  34. package/jsutils/defineToJSON.mjs +1 -1
  35. package/jsutils/defineToStringTag.js +1 -1
  36. package/jsutils/defineToStringTag.mjs +1 -1
  37. package/jsutils/inspect.js +2 -2
  38. package/jsutils/inspect.js.flow +1 -1
  39. package/jsutils/inspect.mjs +2 -2
  40. package/jsutils/instanceOf.js +1 -1
  41. package/jsutils/instanceOf.mjs +1 -1
  42. package/jsutils/invariant.js +4 -2
  43. package/jsutils/invariant.js.flow +2 -1
  44. package/jsutils/invariant.mjs +4 -2
  45. package/jsutils/isInvalid.js +1 -1
  46. package/jsutils/isInvalid.mjs +1 -1
  47. package/jsutils/isNullish.js +1 -1
  48. package/jsutils/isNullish.mjs +1 -1
  49. package/jsutils/isPromise.js +1 -1
  50. package/jsutils/isPromise.mjs +1 -1
  51. package/jsutils/keyMap.js +3 -2
  52. package/jsutils/keyMap.js.flow +4 -4
  53. package/jsutils/keyMap.mjs +3 -2
  54. package/jsutils/keyValMap.js +3 -2
  55. package/jsutils/keyValMap.js.flow +4 -4
  56. package/jsutils/keyValMap.mjs +3 -2
  57. package/jsutils/mapValue.js +1 -1
  58. package/jsutils/mapValue.mjs +1 -1
  59. package/jsutils/memoize3.js +2 -2
  60. package/jsutils/memoize3.js.flow +1 -1
  61. package/jsutils/memoize3.mjs +2 -2
  62. package/jsutils/nodejsCustomInspectSymbol.js +1 -1
  63. package/jsutils/nodejsCustomInspectSymbol.mjs +1 -1
  64. package/jsutils/orList.js +1 -1
  65. package/jsutils/orList.mjs +1 -1
  66. package/jsutils/promiseForObject.js +1 -1
  67. package/jsutils/promiseForObject.mjs +1 -1
  68. package/jsutils/promiseReduce.js +1 -1
  69. package/jsutils/promiseReduce.mjs +1 -1
  70. package/jsutils/quotedOrList.js +1 -1
  71. package/jsutils/quotedOrList.mjs +1 -1
  72. package/jsutils/suggestionList.js +1 -1
  73. package/jsutils/suggestionList.mjs +1 -1
  74. package/language/ast.js +1 -1
  75. package/language/ast.mjs +1 -0
  76. package/language/blockString.js +1 -1
  77. package/language/blockString.js.flow +1 -1
  78. package/language/blockString.mjs +1 -1
  79. package/language/directiveLocation.js +1 -1
  80. package/language/directiveLocation.mjs +1 -1
  81. package/language/index.js +1 -1
  82. package/language/index.mjs +1 -1
  83. package/language/kinds.js +1 -1
  84. package/language/kinds.mjs +1 -1
  85. package/language/lexer.js +11 -9
  86. package/language/lexer.js.flow +3 -1
  87. package/language/lexer.mjs +11 -9
  88. package/language/location.js +1 -1
  89. package/language/location.mjs +1 -1
  90. package/language/parser.js +2 -2
  91. package/language/parser.js.flow +1 -1
  92. package/language/parser.mjs +2 -2
  93. package/language/predicates.js +1 -1
  94. package/language/predicates.mjs +1 -1
  95. package/language/printer.js +1 -1
  96. package/language/printer.mjs +1 -1
  97. package/language/source.js +1 -1
  98. package/language/source.mjs +1 -1
  99. package/language/visitor.js +1 -1
  100. package/language/visitor.mjs +1 -1
  101. package/package.json +1 -1
  102. package/polyfills/find.js +1 -1
  103. package/polyfills/find.mjs +1 -1
  104. package/polyfills/flatMap.js +1 -1
  105. package/polyfills/flatMap.mjs +1 -1
  106. package/polyfills/isFinite.js +1 -1
  107. package/polyfills/isFinite.mjs +1 -1
  108. package/polyfills/isInteger.js +1 -1
  109. package/polyfills/isInteger.mjs +1 -1
  110. package/polyfills/objectEntries.js +1 -1
  111. package/polyfills/objectEntries.mjs +1 -1
  112. package/polyfills/objectValues.js +1 -1
  113. package/polyfills/objectValues.mjs +1 -1
  114. package/subscription/asyncIteratorReject.js +1 -1
  115. package/subscription/asyncIteratorReject.mjs +1 -1
  116. package/subscription/index.js +1 -1
  117. package/subscription/index.mjs +1 -1
  118. package/subscription/mapAsyncIterator.js +1 -1
  119. package/subscription/mapAsyncIterator.mjs +1 -1
  120. package/subscription/subscribe.js +1 -1
  121. package/subscription/subscribe.mjs +1 -1
  122. package/type/definition.js +8 -14
  123. package/type/definition.js.flow +4 -4
  124. package/type/definition.mjs +8 -14
  125. package/type/directives.js +1 -1
  126. package/type/directives.mjs +1 -1
  127. package/type/index.js +1 -1
  128. package/type/index.mjs +1 -1
  129. package/type/introspection.js +1 -1
  130. package/type/introspection.mjs +1 -1
  131. package/type/scalars.js +1 -1
  132. package/type/scalars.mjs +1 -1
  133. package/type/schema.js +3 -2
  134. package/type/schema.js.flow +4 -4
  135. package/type/schema.mjs +3 -2
  136. package/type/validate.js +1 -1
  137. package/type/validate.mjs +1 -1
  138. package/utilities/TypeInfo.js +92 -72
  139. package/utilities/TypeInfo.js.flow +18 -9
  140. package/utilities/TypeInfo.mjs +92 -72
  141. package/utilities/assertValidName.js +1 -1
  142. package/utilities/assertValidName.mjs +1 -1
  143. package/utilities/astFromValue.js +1 -1
  144. package/utilities/astFromValue.mjs +1 -1
  145. package/utilities/buildASTSchema.js +3 -1
  146. package/utilities/buildASTSchema.mjs +3 -1
  147. package/utilities/buildClientSchema.js +5 -2
  148. package/utilities/buildClientSchema.js.flow +3 -1
  149. package/utilities/buildClientSchema.mjs +5 -2
  150. package/utilities/coerceValue.js +1 -1
  151. package/utilities/coerceValue.mjs +1 -1
  152. package/utilities/concatAST.js +1 -1
  153. package/utilities/concatAST.mjs +1 -1
  154. package/utilities/extendSchema.js +1 -1
  155. package/utilities/extendSchema.mjs +1 -1
  156. package/utilities/findBreakingChanges.js +23 -34
  157. package/utilities/findBreakingChanges.js.flow +40 -34
  158. package/utilities/findBreakingChanges.mjs +49 -34
  159. package/utilities/findDeprecatedUsages.js +1 -1
  160. package/utilities/findDeprecatedUsages.mjs +1 -1
  161. package/utilities/getOperationAST.js +1 -1
  162. package/utilities/getOperationAST.mjs +1 -1
  163. package/utilities/getOperationRootType.js +23 -23
  164. package/utilities/getOperationRootType.js.flow +33 -30
  165. package/utilities/getOperationRootType.mjs +23 -23
  166. package/utilities/index.js +1 -1
  167. package/utilities/index.mjs +1 -1
  168. package/utilities/introspectionFromSchema.js +4 -2
  169. package/utilities/introspectionFromSchema.js.flow +2 -1
  170. package/utilities/introspectionFromSchema.mjs +3 -2
  171. package/utilities/introspectionQuery.js +1 -1
  172. package/utilities/introspectionQuery.mjs +1 -1
  173. package/utilities/isValidJSValue.js +1 -1
  174. package/utilities/isValidJSValue.mjs +1 -1
  175. package/utilities/isValidLiteralValue.js +1 -1
  176. package/utilities/isValidLiteralValue.mjs +1 -1
  177. package/utilities/lexicographicSortSchema.js +1 -1
  178. package/utilities/lexicographicSortSchema.mjs +1 -1
  179. package/utilities/schemaPrinter.js +1 -1
  180. package/utilities/schemaPrinter.mjs +1 -1
  181. package/utilities/separateOperations.js +1 -1
  182. package/utilities/separateOperations.mjs +1 -1
  183. package/utilities/stripIgnoredCharacters.js +7 -7
  184. package/utilities/stripIgnoredCharacters.js.flow +6 -6
  185. package/utilities/stripIgnoredCharacters.mjs +7 -7
  186. package/utilities/typeComparators.js +1 -1
  187. package/utilities/typeComparators.mjs +1 -1
  188. package/utilities/typeFromAST.js +1 -1
  189. package/utilities/typeFromAST.mjs +1 -1
  190. package/utilities/valueFromAST.js +1 -1
  191. package/utilities/valueFromAST.mjs +1 -1
  192. package/utilities/valueFromASTUntyped.js +5 -3
  193. package/utilities/valueFromASTUntyped.js.flow +2 -1
  194. package/utilities/valueFromASTUntyped.mjs +5 -3
  195. package/validation/ValidationContext.js +1 -1
  196. package/validation/ValidationContext.mjs +1 -1
  197. package/validation/index.js +1 -1
  198. package/validation/index.mjs +1 -1
  199. package/validation/rules/ExecutableDefinitions.js +1 -1
  200. package/validation/rules/ExecutableDefinitions.mjs +1 -1
  201. package/validation/rules/FieldsOnCorrectType.js +1 -1
  202. package/validation/rules/FieldsOnCorrectType.mjs +1 -1
  203. package/validation/rules/FragmentsOnCompositeTypes.js +1 -1
  204. package/validation/rules/FragmentsOnCompositeTypes.mjs +1 -1
  205. package/validation/rules/KnownArgumentNames.js +1 -1
  206. package/validation/rules/KnownArgumentNames.mjs +1 -1
  207. package/validation/rules/KnownDirectives.js +5 -3
  208. package/validation/rules/KnownDirectives.js.flow +2 -1
  209. package/validation/rules/KnownDirectives.mjs +5 -3
  210. package/validation/rules/KnownFragmentNames.js +1 -1
  211. package/validation/rules/KnownFragmentNames.mjs +1 -1
  212. package/validation/rules/KnownTypeNames.js +1 -1
  213. package/validation/rules/KnownTypeNames.mjs +1 -1
  214. package/validation/rules/LoneAnonymousOperation.js +1 -1
  215. package/validation/rules/LoneAnonymousOperation.mjs +1 -1
  216. package/validation/rules/LoneSchemaDefinition.js +1 -1
  217. package/validation/rules/LoneSchemaDefinition.mjs +1 -1
  218. package/validation/rules/NoFragmentCycles.js +1 -1
  219. package/validation/rules/NoFragmentCycles.mjs +1 -1
  220. package/validation/rules/NoUndefinedVariables.js +1 -1
  221. package/validation/rules/NoUndefinedVariables.mjs +1 -1
  222. package/validation/rules/NoUnusedFragments.js +1 -1
  223. package/validation/rules/NoUnusedFragments.mjs +1 -1
  224. package/validation/rules/NoUnusedVariables.js +1 -1
  225. package/validation/rules/NoUnusedVariables.mjs +1 -1
  226. package/validation/rules/OverlappingFieldsCanBeMerged.js +21 -16
  227. package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +4 -2
  228. package/validation/rules/OverlappingFieldsCanBeMerged.mjs +21 -16
  229. package/validation/rules/PossibleFragmentSpreads.js +1 -1
  230. package/validation/rules/PossibleFragmentSpreads.mjs +1 -1
  231. package/validation/rules/PossibleTypeExtensions.js +1 -1
  232. package/validation/rules/PossibleTypeExtensions.mjs +1 -1
  233. package/validation/rules/ProvidedRequiredArguments.js +1 -1
  234. package/validation/rules/ProvidedRequiredArguments.mjs +1 -1
  235. package/validation/rules/ScalarLeafs.js +1 -1
  236. package/validation/rules/ScalarLeafs.mjs +1 -1
  237. package/validation/rules/SingleFieldSubscriptions.js +1 -1
  238. package/validation/rules/SingleFieldSubscriptions.mjs +1 -1
  239. package/validation/rules/UniqueArgumentNames.js +1 -1
  240. package/validation/rules/UniqueArgumentNames.mjs +1 -1
  241. package/validation/rules/UniqueDirectiveNames.js +1 -1
  242. package/validation/rules/UniqueDirectiveNames.mjs +1 -1
  243. package/validation/rules/UniqueDirectivesPerLocation.js +2 -1
  244. package/validation/rules/UniqueDirectivesPerLocation.mjs +2 -1
  245. package/validation/rules/UniqueEnumValueNames.js +1 -1
  246. package/validation/rules/UniqueEnumValueNames.mjs +1 -1
  247. package/validation/rules/UniqueFieldDefinitionNames.js +1 -1
  248. package/validation/rules/UniqueFieldDefinitionNames.mjs +1 -1
  249. package/validation/rules/UniqueFragmentNames.js +1 -1
  250. package/validation/rules/UniqueFragmentNames.mjs +1 -1
  251. package/validation/rules/UniqueInputFieldNames.js +1 -1
  252. package/validation/rules/UniqueInputFieldNames.mjs +1 -1
  253. package/validation/rules/UniqueOperationNames.js +1 -1
  254. package/validation/rules/UniqueOperationNames.mjs +1 -1
  255. package/validation/rules/UniqueOperationTypes.js +1 -1
  256. package/validation/rules/UniqueOperationTypes.mjs +1 -1
  257. package/validation/rules/UniqueTypeNames.js +1 -1
  258. package/validation/rules/UniqueTypeNames.mjs +1 -1
  259. package/validation/rules/UniqueVariableNames.js +1 -1
  260. package/validation/rules/UniqueVariableNames.mjs +1 -1
  261. package/validation/rules/ValuesOfCorrectType.js +1 -1
  262. package/validation/rules/ValuesOfCorrectType.mjs +1 -1
  263. package/validation/rules/VariablesAreInputTypes.js +1 -1
  264. package/validation/rules/VariablesAreInputTypes.mjs +1 -1
  265. package/validation/rules/VariablesInAllowedPosition.js +2 -2
  266. package/validation/rules/VariablesInAllowedPosition.js.flow +1 -1
  267. package/validation/rules/VariablesInAllowedPosition.mjs +2 -2
  268. package/validation/specifiedRules.js +1 -1
  269. package/validation/specifiedRules.mjs +1 -1
  270. package/validation/validate.js +1 -1
  271. package/validation/validate.mjs +1 -1
  272. package/codecov.yml +0 -14
@@ -144,13 +144,14 @@ export class TypeInfo {
144
144
  // checked before continuing since TypeInfo is used as part of validation
145
145
  // which occurs before guarantees of schema and document validity.
146
146
  switch (node.kind) {
147
- case Kind.SELECTION_SET:
147
+ case Kind.SELECTION_SET: {
148
148
  const namedType: mixed = getNamedType(this.getType());
149
149
  this._parentTypeStack.push(
150
150
  isCompositeType(namedType) ? namedType : undefined,
151
151
  );
152
152
  break;
153
- case Kind.FIELD:
153
+ }
154
+ case Kind.FIELD: {
154
155
  const parentType = this.getParentType();
155
156
  let fieldDef;
156
157
  let fieldType: mixed;
@@ -163,10 +164,11 @@ export class TypeInfo {
163
164
  this._fieldDefStack.push(fieldDef);
164
165
  this._typeStack.push(isOutputType(fieldType) ? fieldType : undefined);
165
166
  break;
167
+ }
166
168
  case Kind.DIRECTIVE:
167
169
  this._directive = schema.getDirective(node.name.value);
168
170
  break;
169
- case Kind.OPERATION_DEFINITION:
171
+ case Kind.OPERATION_DEFINITION: {
170
172
  let type: mixed;
171
173
  if (node.operation === 'query') {
172
174
  type = schema.getQueryType();
@@ -177,21 +179,24 @@ export class TypeInfo {
177
179
  }
178
180
  this._typeStack.push(isObjectType(type) ? type : undefined);
179
181
  break;
182
+ }
180
183
  case Kind.INLINE_FRAGMENT:
181
- case Kind.FRAGMENT_DEFINITION:
184
+ case Kind.FRAGMENT_DEFINITION: {
182
185
  const typeConditionAST = node.typeCondition;
183
186
  const outputType: mixed = typeConditionAST
184
187
  ? typeFromAST(schema, typeConditionAST)
185
188
  : getNamedType(this.getType());
186
189
  this._typeStack.push(isOutputType(outputType) ? outputType : undefined);
187
190
  break;
188
- case Kind.VARIABLE_DEFINITION:
191
+ }
192
+ case Kind.VARIABLE_DEFINITION: {
189
193
  const inputType: mixed = typeFromAST(schema, node.type);
190
194
  this._inputTypeStack.push(
191
195
  isInputType(inputType) ? inputType : undefined,
192
196
  );
193
197
  break;
194
- case Kind.ARGUMENT:
198
+ }
199
+ case Kind.ARGUMENT: {
195
200
  let argDef;
196
201
  let argType: mixed;
197
202
  const fieldOrDirective = this.getDirective() || this.getFieldDef();
@@ -208,7 +213,8 @@ export class TypeInfo {
208
213
  this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined);
209
214
  this._inputTypeStack.push(isInputType(argType) ? argType : undefined);
210
215
  break;
211
- case Kind.LIST:
216
+ }
217
+ case Kind.LIST: {
212
218
  const listType: mixed = getNullableType(this.getInputType());
213
219
  const itemType: mixed = isListType(listType)
214
220
  ? listType.ofType
@@ -217,7 +223,8 @@ export class TypeInfo {
217
223
  this._defaultValueStack.push(undefined);
218
224
  this._inputTypeStack.push(isInputType(itemType) ? itemType : undefined);
219
225
  break;
220
- case Kind.OBJECT_FIELD:
226
+ }
227
+ case Kind.OBJECT_FIELD: {
221
228
  const objectType: mixed = getNamedType(this.getInputType());
222
229
  let inputFieldType: GraphQLInputType | void;
223
230
  let inputField: GraphQLInputField | void;
@@ -234,7 +241,8 @@ export class TypeInfo {
234
241
  isInputType(inputFieldType) ? inputFieldType : undefined,
235
242
  );
236
243
  break;
237
- case Kind.ENUM:
244
+ }
245
+ case Kind.ENUM: {
238
246
  const enumType: mixed = getNamedType(this.getInputType());
239
247
  let enumValue;
240
248
  if (isEnumType(enumType)) {
@@ -242,6 +250,7 @@ export class TypeInfo {
242
250
  }
243
251
  this._enumValue = enumValue;
244
252
  break;
253
+ }
245
254
  }
246
255
  }
247
256
 
@@ -22,7 +22,9 @@ export var TypeInfo =
22
22
  function () {
23
23
  function TypeInfo(schema, // NOTE: this experimental optional second parameter is only needed in order
24
24
  // to support non-spec-compliant codebases. You should never need to use it.
25
+ // It may disappear in the future.
25
26
  getFieldDefFn, // Initial type may be provided in rare cases to facilitate traversals
27
+ // beginning somewhere other than documents.
26
28
  initialType) {
27
29
  this._schema = schema;
28
30
  this._typeStack = [];
@@ -108,128 +110,146 @@ function () {
108
110
 
109
111
  switch (node.kind) {
110
112
  case Kind.SELECTION_SET:
111
- var namedType = getNamedType(this.getType());
113
+ {
114
+ var namedType = getNamedType(this.getType());
112
115
 
113
- this._parentTypeStack.push(isCompositeType(namedType) ? namedType : undefined);
116
+ this._parentTypeStack.push(isCompositeType(namedType) ? namedType : undefined);
114
117
 
115
- break;
118
+ break;
119
+ }
116
120
 
117
121
  case Kind.FIELD:
118
- var parentType = this.getParentType();
119
- var fieldDef;
120
- var fieldType;
122
+ {
123
+ var parentType = this.getParentType();
124
+ var fieldDef;
125
+ var fieldType;
121
126
 
122
- if (parentType) {
123
- fieldDef = this._getFieldDef(schema, parentType, node);
127
+ if (parentType) {
128
+ fieldDef = this._getFieldDef(schema, parentType, node);
124
129
 
125
- if (fieldDef) {
126
- fieldType = fieldDef.type;
130
+ if (fieldDef) {
131
+ fieldType = fieldDef.type;
132
+ }
127
133
  }
128
- }
129
134
 
130
- this._fieldDefStack.push(fieldDef);
135
+ this._fieldDefStack.push(fieldDef);
131
136
 
132
- this._typeStack.push(isOutputType(fieldType) ? fieldType : undefined);
137
+ this._typeStack.push(isOutputType(fieldType) ? fieldType : undefined);
133
138
 
134
- break;
139
+ break;
140
+ }
135
141
 
136
142
  case Kind.DIRECTIVE:
137
143
  this._directive = schema.getDirective(node.name.value);
138
144
  break;
139
145
 
140
146
  case Kind.OPERATION_DEFINITION:
141
- var type;
142
-
143
- if (node.operation === 'query') {
144
- type = schema.getQueryType();
145
- } else if (node.operation === 'mutation') {
146
- type = schema.getMutationType();
147
- } else if (node.operation === 'subscription') {
148
- type = schema.getSubscriptionType();
149
- }
147
+ {
148
+ var type;
149
+
150
+ if (node.operation === 'query') {
151
+ type = schema.getQueryType();
152
+ } else if (node.operation === 'mutation') {
153
+ type = schema.getMutationType();
154
+ } else if (node.operation === 'subscription') {
155
+ type = schema.getSubscriptionType();
156
+ }
150
157
 
151
- this._typeStack.push(isObjectType(type) ? type : undefined);
158
+ this._typeStack.push(isObjectType(type) ? type : undefined);
152
159
 
153
- break;
160
+ break;
161
+ }
154
162
 
155
163
  case Kind.INLINE_FRAGMENT:
156
164
  case Kind.FRAGMENT_DEFINITION:
157
- var typeConditionAST = node.typeCondition;
158
- var outputType = typeConditionAST ? typeFromAST(schema, typeConditionAST) : getNamedType(this.getType());
165
+ {
166
+ var typeConditionAST = node.typeCondition;
167
+ var outputType = typeConditionAST ? typeFromAST(schema, typeConditionAST) : getNamedType(this.getType());
159
168
 
160
- this._typeStack.push(isOutputType(outputType) ? outputType : undefined);
169
+ this._typeStack.push(isOutputType(outputType) ? outputType : undefined);
161
170
 
162
- break;
171
+ break;
172
+ }
163
173
 
164
174
  case Kind.VARIABLE_DEFINITION:
165
- var inputType = typeFromAST(schema, node.type);
175
+ {
176
+ var inputType = typeFromAST(schema, node.type);
166
177
 
167
- this._inputTypeStack.push(isInputType(inputType) ? inputType : undefined);
178
+ this._inputTypeStack.push(isInputType(inputType) ? inputType : undefined);
168
179
 
169
- break;
180
+ break;
181
+ }
170
182
 
171
183
  case Kind.ARGUMENT:
172
- var argDef;
173
- var argType;
174
- var fieldOrDirective = this.getDirective() || this.getFieldDef();
175
-
176
- if (fieldOrDirective) {
177
- argDef = find(fieldOrDirective.args, function (arg) {
178
- return arg.name === node.name.value;
179
- });
180
-
181
- if (argDef) {
182
- argType = argDef.type;
184
+ {
185
+ var argDef;
186
+ var argType;
187
+ var fieldOrDirective = this.getDirective() || this.getFieldDef();
188
+
189
+ if (fieldOrDirective) {
190
+ argDef = find(fieldOrDirective.args, function (arg) {
191
+ return arg.name === node.name.value;
192
+ });
193
+
194
+ if (argDef) {
195
+ argType = argDef.type;
196
+ }
183
197
  }
184
- }
185
198
 
186
- this._argument = argDef;
199
+ this._argument = argDef;
187
200
 
188
- this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined);
201
+ this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined);
189
202
 
190
- this._inputTypeStack.push(isInputType(argType) ? argType : undefined);
203
+ this._inputTypeStack.push(isInputType(argType) ? argType : undefined);
191
204
 
192
- break;
205
+ break;
206
+ }
193
207
 
194
208
  case Kind.LIST:
195
- var listType = getNullableType(this.getInputType());
196
- var itemType = isListType(listType) ? listType.ofType : listType; // List positions never have a default value.
209
+ {
210
+ var listType = getNullableType(this.getInputType());
211
+ var itemType = isListType(listType) ? listType.ofType : listType; // List positions never have a default value.
197
212
 
198
- this._defaultValueStack.push(undefined);
213
+ this._defaultValueStack.push(undefined);
199
214
 
200
- this._inputTypeStack.push(isInputType(itemType) ? itemType : undefined);
215
+ this._inputTypeStack.push(isInputType(itemType) ? itemType : undefined);
201
216
 
202
- break;
217
+ break;
218
+ }
203
219
 
204
220
  case Kind.OBJECT_FIELD:
205
- var objectType = getNamedType(this.getInputType());
206
- var inputFieldType;
207
- var inputField;
221
+ {
222
+ var objectType = getNamedType(this.getInputType());
223
+ var inputFieldType;
224
+ var inputField;
208
225
 
209
- if (isInputObjectType(objectType)) {
210
- inputField = objectType.getFields()[node.name.value];
226
+ if (isInputObjectType(objectType)) {
227
+ inputField = objectType.getFields()[node.name.value];
211
228
 
212
- if (inputField) {
213
- inputFieldType = inputField.type;
229
+ if (inputField) {
230
+ inputFieldType = inputField.type;
231
+ }
214
232
  }
215
- }
216
233
 
217
- this._defaultValueStack.push(inputField ? inputField.defaultValue : undefined);
234
+ this._defaultValueStack.push(inputField ? inputField.defaultValue : undefined);
218
235
 
219
- this._inputTypeStack.push(isInputType(inputFieldType) ? inputFieldType : undefined);
236
+ this._inputTypeStack.push(isInputType(inputFieldType) ? inputFieldType : undefined);
220
237
 
221
- break;
238
+ break;
239
+ }
222
240
 
223
241
  case Kind.ENUM:
224
- var enumType = getNamedType(this.getInputType());
225
- var enumValue;
242
+ {
243
+ var enumType = getNamedType(this.getInputType());
244
+ var enumValue;
226
245
 
227
- if (isEnumType(enumType)) {
228
- enumValue = enumType.getValue(node.value);
229
- }
246
+ if (isEnumType(enumType)) {
247
+ enumValue = enumType.getValue(node.value);
248
+ }
230
249
 
231
- this._enumValue = enumValue;
232
- break;
250
+ this._enumValue = enumValue;
251
+ break;
252
+ }
233
253
  }
234
254
  };
235
255
 
@@ -312,4 +332,4 @@ function getFieldDef(schema, parentType, fieldNode) {
312
332
  if (isObjectType(parentType) || isInterfaceType(parentType)) {
313
333
  return parentType.getFields()[name];
314
334
  }
315
- }
335
+ }
@@ -49,4 +49,4 @@ function isValidNameError(name, node) {
49
49
  if (!NAME_RX.test(name)) {
50
50
  return new _GraphQLError.GraphQLError("Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but \"".concat(name, "\" does not."), node);
51
51
  }
52
- }
52
+ }
@@ -36,4 +36,4 @@ export function isValidNameError(name, node) {
36
36
  if (!NAME_RX.test(name)) {
37
37
  return new GraphQLError("Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but \"".concat(name, "\" does not."), node);
38
38
  }
39
- }
39
+ }
@@ -205,4 +205,4 @@ function astFromValue(value, type) {
205
205
  */
206
206
 
207
207
 
208
- var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;
208
+ var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;
@@ -196,4 +196,4 @@ export function astFromValue(value, type) {
196
196
  * - NegativeSign? NonZeroDigit ( Digit+ )?
197
197
  */
198
198
 
199
- var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;
199
+ var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;
@@ -260,6 +260,7 @@ function () {
260
260
  _proto.buildArg = function buildArg(value) {
261
261
  // Note: While this could make assertions to get the correctly typed
262
262
  // value, that would throw immediately while type system validation
263
+ // with validateSchema() will produce more actionable results.
263
264
  var type = this.getWrappedType(value.type);
264
265
  return {
265
266
  type: type,
@@ -272,6 +273,7 @@ function () {
272
273
  _proto.buildInputField = function buildInputField(value) {
273
274
  // Note: While this could make assertions to get the correctly typed
274
275
  // value, that would throw immediately while type system validation
276
+ // with validateSchema() will produce more actionable results.
275
277
  var type = this.getWrappedType(value.type);
276
278
  return {
277
279
  type: type,
@@ -500,4 +502,4 @@ function getLeadingCommentBlock(node) {
500
502
 
501
503
  function buildSchema(source, options) {
502
504
  return buildASTSchema((0, _parser.parse)(source, options), options);
503
- }
505
+ }
@@ -228,6 +228,7 @@ function () {
228
228
  _proto.buildArg = function buildArg(value) {
229
229
  // Note: While this could make assertions to get the correctly typed
230
230
  // value, that would throw immediately while type system validation
231
+ // with validateSchema() will produce more actionable results.
231
232
  var type = this.getWrappedType(value.type);
232
233
  return {
233
234
  type: type,
@@ -240,6 +241,7 @@ function () {
240
241
  _proto.buildInputField = function buildInputField(value) {
241
242
  // Note: While this could make assertions to get the correctly typed
242
243
  // value, that would throw immediately while type system validation
244
+ // with validateSchema() will produce more actionable results.
243
245
  var type = this.getWrappedType(value.type);
244
246
  return {
245
247
  type: type,
@@ -466,4 +468,4 @@ function getLeadingCommentBlock(node) {
466
468
 
467
469
  export function buildSchema(source, options) {
468
470
  return buildASTSchema(parse(source, options), options);
469
- }
471
+ }
@@ -62,7 +62,10 @@ function buildClientSchema(introspection, options) {
62
62
 
63
63
  for (var _i = 0, _arr = [].concat(_scalars.specifiedScalarTypes, _introspection.introspectionTypes); _i < _arr.length; _i++) {
64
64
  var stdType = _arr[_i];
65
- typeMap[stdType.name] = stdType;
65
+
66
+ if (typeMap[stdType.name]) {
67
+ typeMap[stdType.name] = stdType;
68
+ }
66
69
  } // Get the root Query, Mutation, and Subscription types.
67
70
 
68
71
 
@@ -310,4 +313,4 @@ function buildClientSchema(introspection, options) {
310
313
  args: buildInputValueDefMap(directiveIntrospection.args)
311
314
  });
312
315
  }
313
- }
316
+ }
@@ -90,7 +90,9 @@ export function buildClientSchema(
90
90
  );
91
91
 
92
92
  for (const stdType of [...specifiedScalarTypes, ...introspectionTypes]) {
93
- typeMap[stdType.name] = stdType;
93
+ if (typeMap[stdType.name]) {
94
+ typeMap[stdType.name] = stdType;
95
+ }
94
96
  }
95
97
 
96
98
  // Get the root Query, Mutation, and Subscription types.
@@ -42,7 +42,10 @@ export function buildClientSchema(introspection, options) {
42
42
 
43
43
  for (var _i = 0, _arr = [].concat(specifiedScalarTypes, introspectionTypes); _i < _arr.length; _i++) {
44
44
  var stdType = _arr[_i];
45
- typeMap[stdType.name] = stdType;
45
+
46
+ if (typeMap[stdType.name]) {
47
+ typeMap[stdType.name] = stdType;
48
+ }
46
49
  } // Get the root Query, Mutation, and Subscription types.
47
50
 
48
51
 
@@ -290,4 +293,4 @@ export function buildClientSchema(introspection, options) {
290
293
  args: buildInputValueDefMap(directiveIntrospection.args)
291
294
  });
292
295
  }
293
- }
296
+ }
@@ -217,4 +217,4 @@ function printPath(path) {
217
217
  }
218
218
 
219
219
  return pathStr ? 'value' + pathStr : '';
220
- }
220
+ }
@@ -209,4 +209,4 @@ function printPath(path) {
209
209
  }
210
210
 
211
211
  return pathStr ? 'value' + pathStr : '';
212
- }
212
+ }
@@ -30,4 +30,4 @@ function concatAST(asts) {
30
30
  return ast.definitions;
31
31
  })
32
32
  };
33
- }
33
+ }
@@ -20,4 +20,4 @@ export function concatAST(asts) {
20
20
  return ast.definitions;
21
21
  })
22
22
  };
23
- }
23
+ }
@@ -415,4 +415,4 @@ function extendSchema(schema, documentAST, options) {
415
415
  type: replaceType(arg.type)
416
416
  });
417
417
  }
418
- }
418
+ }
@@ -400,4 +400,4 @@ export function extendSchema(schema, documentAST, options) {
400
400
  type: replaceType(arg.type)
401
401
  });
402
402
  }
403
- }
403
+ }
@@ -5,26 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.findBreakingChanges = findBreakingChanges;
7
7
  exports.findDangerousChanges = findDangerousChanges;
8
- exports.findRemovedTypes = findRemovedTypes;
9
- exports.findTypesThatChangedKind = findTypesThatChangedKind;
10
- exports.findArgChanges = findArgChanges;
11
- exports.findFieldsThatChangedTypeOnObjectOrInterfaceTypes = findFieldsThatChangedTypeOnObjectOrInterfaceTypes;
12
- exports.findFieldsThatChangedTypeOnInputObjectTypes = findFieldsThatChangedTypeOnInputObjectTypes;
13
- exports.findTypesRemovedFromUnions = findTypesRemovedFromUnions;
14
- exports.findTypesAddedToUnions = findTypesAddedToUnions;
15
- exports.findValuesRemovedFromEnums = findValuesRemovedFromEnums;
16
- exports.findValuesAddedToEnums = findValuesAddedToEnums;
17
- exports.findInterfacesRemovedFromObjectTypes = findInterfacesRemovedFromObjectTypes;
18
- exports.findInterfacesAddedToObjectTypes = findInterfacesAddedToObjectTypes;
19
- exports.findRemovedDirectives = findRemovedDirectives;
20
- exports.findRemovedDirectiveArgs = findRemovedDirectiveArgs;
21
- exports.findAddedNonNullDirectiveArgs = findAddedNonNullDirectiveArgs;
22
- exports.findRemovedLocationsForDirective = findRemovedLocationsForDirective;
23
- exports.findRemovedDirectiveLocations = findRemovedDirectiveLocations;
24
8
  exports.DangerousChangeType = exports.BreakingChangeType = void 0;
25
9
 
26
10
  var _find = _interopRequireDefault(require("../polyfills/find"));
27
11
 
12
+ var _inspect = _interopRequireDefault(require("../jsutils/inspect"));
13
+
28
14
  var _definition = require("../type/definition");
29
15
 
30
16
  var _keyMap = _interopRequireDefault(require("../jsutils/keyMap"));
@@ -302,9 +288,12 @@ function typeKindName(type) {
302
288
 
303
289
  if ((0, _definition.isInputObjectType)(type)) {
304
290
  return 'an Input type';
305
- }
291
+ } // Not reachable. All possible named types have been considered.
292
+
293
+ /* istanbul ignore next */
294
+
306
295
 
307
- throw new TypeError('Unknown type ' + type.constructor.name);
296
+ throw new TypeError("Unexpected type: ".concat((0, _inspect.default)(type), "."));
308
297
  }
309
298
 
310
299
  function findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema) {
@@ -423,40 +412,40 @@ function findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema) {
423
412
  }
424
413
 
425
414
  function isChangeSafeForObjectOrInterfaceField(oldType, newType) {
426
- if ((0, _definition.isNamedType)(oldType)) {
427
- return (// if they're both named types, see if their names are equivalent
428
- (0, _definition.isNamedType)(newType) && oldType.name === newType.name || // moving from nullable to non-null of the same underlying type is safe
429
- (0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)
430
- );
431
- } else if ((0, _definition.isListType)(oldType)) {
415
+ if ((0, _definition.isListType)(oldType)) {
432
416
  return (// if they're both lists, make sure the underlying types are compatible
433
417
  (0, _definition.isListType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType) || // moving from nullable to non-null of the same underlying type is safe
434
418
  (0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)
435
419
  );
436
- } else if ((0, _definition.isNonNullType)(oldType)) {
420
+ }
421
+
422
+ if ((0, _definition.isNonNullType)(oldType)) {
437
423
  // if they're both non-null, make sure the underlying types are compatible
438
424
  return (0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType);
439
425
  }
440
426
 
441
- return false;
427
+ return (// if they're both named types, see if their names are equivalent
428
+ (0, _definition.isNamedType)(newType) && oldType.name === newType.name || // moving from nullable to non-null of the same underlying type is safe
429
+ (0, _definition.isNonNullType)(newType) && isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)
430
+ );
442
431
  }
443
432
 
444
433
  function isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) {
445
- if ((0, _definition.isNamedType)(oldType)) {
446
- // if they're both named types, see if their names are equivalent
447
- return (0, _definition.isNamedType)(newType) && oldType.name === newType.name;
448
- } else if ((0, _definition.isListType)(oldType)) {
434
+ if ((0, _definition.isListType)(oldType)) {
449
435
  // if they're both lists, make sure the underlying types are compatible
450
436
  return (0, _definition.isListType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType);
451
- } else if ((0, _definition.isNonNullType)(oldType)) {
437
+ }
438
+
439
+ if ((0, _definition.isNonNullType)(oldType)) {
452
440
  return (// if they're both non-null, make sure the underlying types are
453
441
  // compatible
454
442
  (0, _definition.isNonNullType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType) || // moving from non-null to nullable of the same underlying type is safe
455
443
  !(0, _definition.isNonNullType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType)
456
444
  );
457
- }
445
+ } // if they're both named types, see if their names are equivalent
446
+
458
447
 
459
- return false;
448
+ return (0, _definition.isNamedType)(newType) && oldType.name === newType.name;
460
449
  }
461
450
  /**
462
451
  * Given two schemas, returns an Array containing descriptions of any breaking
@@ -1214,4 +1203,4 @@ function getArgumentMapForDirective(directive) {
1214
1203
  return (0, _keyMap.default)(directive.args, function (arg) {
1215
1204
  return arg.name;
1216
1205
  });
1217
- }
1206
+ }