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.
- package/error/GraphQLError.js +12 -10
- package/error/GraphQLError.js.flow +7 -1
- package/error/GraphQLError.mjs +12 -2
- package/error/formatError.js +1 -1
- package/error/formatError.mjs +1 -1
- package/error/index.js +1 -1
- package/error/index.mjs +1 -1
- package/error/locatedError.js +1 -1
- package/error/locatedError.mjs +1 -1
- package/error/printError.js +1 -1
- package/error/printError.mjs +1 -1
- package/error/syntaxError.js +1 -1
- package/error/syntaxError.mjs +1 -1
- package/execution/execute.js +32 -26
- package/execution/execute.js.flow +6 -3
- package/execution/execute.mjs +32 -26
- package/execution/index.js +1 -1
- package/execution/index.mjs +1 -1
- package/execution/values.js +4 -4
- package/execution/values.js.flow +4 -3
- package/execution/values.mjs +4 -4
- package/graphql.js +6 -2
- package/graphql.js.flow +2 -1
- package/graphql.mjs +3 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/jsutils/ObjMap.js +1 -1
- package/jsutils/ObjMap.mjs +1 -0
- package/jsutils/PromiseOrValue.js +1 -1
- package/jsutils/PromiseOrValue.mjs +1 -0
- package/jsutils/dedent.js +1 -1
- package/jsutils/dedent.mjs +1 -1
- package/jsutils/defineToJSON.js +1 -1
- package/jsutils/defineToJSON.mjs +1 -1
- package/jsutils/defineToStringTag.js +1 -1
- package/jsutils/defineToStringTag.mjs +1 -1
- package/jsutils/inspect.js +2 -2
- package/jsutils/inspect.js.flow +1 -1
- package/jsutils/inspect.mjs +2 -2
- package/jsutils/instanceOf.js +1 -1
- package/jsutils/instanceOf.mjs +1 -1
- package/jsutils/invariant.js +4 -2
- package/jsutils/invariant.js.flow +2 -1
- package/jsutils/invariant.mjs +4 -2
- package/jsutils/isInvalid.js +1 -1
- package/jsutils/isInvalid.mjs +1 -1
- package/jsutils/isNullish.js +1 -1
- package/jsutils/isNullish.mjs +1 -1
- package/jsutils/isPromise.js +1 -1
- package/jsutils/isPromise.mjs +1 -1
- package/jsutils/keyMap.js +3 -2
- package/jsutils/keyMap.js.flow +4 -4
- package/jsutils/keyMap.mjs +3 -2
- package/jsutils/keyValMap.js +3 -2
- package/jsutils/keyValMap.js.flow +4 -4
- package/jsutils/keyValMap.mjs +3 -2
- package/jsutils/mapValue.js +1 -1
- package/jsutils/mapValue.mjs +1 -1
- package/jsutils/memoize3.js +2 -2
- package/jsutils/memoize3.js.flow +1 -1
- package/jsutils/memoize3.mjs +2 -2
- package/jsutils/nodejsCustomInspectSymbol.js +1 -1
- package/jsutils/nodejsCustomInspectSymbol.mjs +1 -1
- package/jsutils/orList.js +1 -1
- package/jsutils/orList.mjs +1 -1
- package/jsutils/promiseForObject.js +1 -1
- package/jsutils/promiseForObject.mjs +1 -1
- package/jsutils/promiseReduce.js +1 -1
- package/jsutils/promiseReduce.mjs +1 -1
- package/jsutils/quotedOrList.js +1 -1
- package/jsutils/quotedOrList.mjs +1 -1
- package/jsutils/suggestionList.js +1 -1
- package/jsutils/suggestionList.mjs +1 -1
- package/language/ast.js +1 -1
- package/language/ast.mjs +1 -0
- package/language/blockString.js +1 -1
- package/language/blockString.js.flow +1 -1
- package/language/blockString.mjs +1 -1
- package/language/directiveLocation.js +1 -1
- package/language/directiveLocation.mjs +1 -1
- package/language/index.js +1 -1
- package/language/index.mjs +1 -1
- package/language/kinds.js +1 -1
- package/language/kinds.mjs +1 -1
- package/language/lexer.js +11 -9
- package/language/lexer.js.flow +3 -1
- package/language/lexer.mjs +11 -9
- package/language/location.js +1 -1
- package/language/location.mjs +1 -1
- package/language/parser.js +2 -2
- package/language/parser.js.flow +1 -1
- package/language/parser.mjs +2 -2
- package/language/predicates.js +1 -1
- package/language/predicates.mjs +1 -1
- package/language/printer.js +1 -1
- package/language/printer.mjs +1 -1
- package/language/source.js +1 -1
- package/language/source.mjs +1 -1
- package/language/visitor.js +1 -1
- package/language/visitor.mjs +1 -1
- package/package.json +1 -1
- package/polyfills/find.js +1 -1
- package/polyfills/find.mjs +1 -1
- package/polyfills/flatMap.js +1 -1
- package/polyfills/flatMap.mjs +1 -1
- package/polyfills/isFinite.js +1 -1
- package/polyfills/isFinite.mjs +1 -1
- package/polyfills/isInteger.js +1 -1
- package/polyfills/isInteger.mjs +1 -1
- package/polyfills/objectEntries.js +1 -1
- package/polyfills/objectEntries.mjs +1 -1
- package/polyfills/objectValues.js +1 -1
- package/polyfills/objectValues.mjs +1 -1
- package/subscription/asyncIteratorReject.js +1 -1
- package/subscription/asyncIteratorReject.mjs +1 -1
- package/subscription/index.js +1 -1
- package/subscription/index.mjs +1 -1
- package/subscription/mapAsyncIterator.js +1 -1
- package/subscription/mapAsyncIterator.mjs +1 -1
- package/subscription/subscribe.js +1 -1
- package/subscription/subscribe.mjs +1 -1
- package/type/definition.js +8 -14
- package/type/definition.js.flow +4 -4
- package/type/definition.mjs +8 -14
- package/type/directives.js +1 -1
- package/type/directives.mjs +1 -1
- package/type/index.js +1 -1
- package/type/index.mjs +1 -1
- package/type/introspection.js +1 -1
- package/type/introspection.mjs +1 -1
- package/type/scalars.js +1 -1
- package/type/scalars.mjs +1 -1
- package/type/schema.js +3 -2
- package/type/schema.js.flow +4 -4
- package/type/schema.mjs +3 -2
- package/type/validate.js +1 -1
- package/type/validate.mjs +1 -1
- package/utilities/TypeInfo.js +92 -72
- package/utilities/TypeInfo.js.flow +18 -9
- package/utilities/TypeInfo.mjs +92 -72
- package/utilities/assertValidName.js +1 -1
- package/utilities/assertValidName.mjs +1 -1
- package/utilities/astFromValue.js +1 -1
- package/utilities/astFromValue.mjs +1 -1
- package/utilities/buildASTSchema.js +3 -1
- package/utilities/buildASTSchema.mjs +3 -1
- package/utilities/buildClientSchema.js +5 -2
- package/utilities/buildClientSchema.js.flow +3 -1
- package/utilities/buildClientSchema.mjs +5 -2
- package/utilities/coerceValue.js +1 -1
- package/utilities/coerceValue.mjs +1 -1
- package/utilities/concatAST.js +1 -1
- package/utilities/concatAST.mjs +1 -1
- package/utilities/extendSchema.js +1 -1
- package/utilities/extendSchema.mjs +1 -1
- package/utilities/findBreakingChanges.js +23 -34
- package/utilities/findBreakingChanges.js.flow +40 -34
- package/utilities/findBreakingChanges.mjs +49 -34
- package/utilities/findDeprecatedUsages.js +1 -1
- package/utilities/findDeprecatedUsages.mjs +1 -1
- package/utilities/getOperationAST.js +1 -1
- package/utilities/getOperationAST.mjs +1 -1
- package/utilities/getOperationRootType.js +23 -23
- package/utilities/getOperationRootType.js.flow +33 -30
- package/utilities/getOperationRootType.mjs +23 -23
- package/utilities/index.js +1 -1
- package/utilities/index.mjs +1 -1
- package/utilities/introspectionFromSchema.js +4 -2
- package/utilities/introspectionFromSchema.js.flow +2 -1
- package/utilities/introspectionFromSchema.mjs +3 -2
- package/utilities/introspectionQuery.js +1 -1
- package/utilities/introspectionQuery.mjs +1 -1
- package/utilities/isValidJSValue.js +1 -1
- package/utilities/isValidJSValue.mjs +1 -1
- package/utilities/isValidLiteralValue.js +1 -1
- package/utilities/isValidLiteralValue.mjs +1 -1
- package/utilities/lexicographicSortSchema.js +1 -1
- package/utilities/lexicographicSortSchema.mjs +1 -1
- package/utilities/schemaPrinter.js +1 -1
- package/utilities/schemaPrinter.mjs +1 -1
- package/utilities/separateOperations.js +1 -1
- package/utilities/separateOperations.mjs +1 -1
- package/utilities/stripIgnoredCharacters.js +7 -7
- package/utilities/stripIgnoredCharacters.js.flow +6 -6
- package/utilities/stripIgnoredCharacters.mjs +7 -7
- package/utilities/typeComparators.js +1 -1
- package/utilities/typeComparators.mjs +1 -1
- package/utilities/typeFromAST.js +1 -1
- package/utilities/typeFromAST.mjs +1 -1
- package/utilities/valueFromAST.js +1 -1
- package/utilities/valueFromAST.mjs +1 -1
- package/utilities/valueFromASTUntyped.js +5 -3
- package/utilities/valueFromASTUntyped.js.flow +2 -1
- package/utilities/valueFromASTUntyped.mjs +5 -3
- package/validation/ValidationContext.js +1 -1
- package/validation/ValidationContext.mjs +1 -1
- package/validation/index.js +1 -1
- package/validation/index.mjs +1 -1
- package/validation/rules/ExecutableDefinitions.js +1 -1
- package/validation/rules/ExecutableDefinitions.mjs +1 -1
- package/validation/rules/FieldsOnCorrectType.js +1 -1
- package/validation/rules/FieldsOnCorrectType.mjs +1 -1
- package/validation/rules/FragmentsOnCompositeTypes.js +1 -1
- package/validation/rules/FragmentsOnCompositeTypes.mjs +1 -1
- package/validation/rules/KnownArgumentNames.js +1 -1
- package/validation/rules/KnownArgumentNames.mjs +1 -1
- package/validation/rules/KnownDirectives.js +5 -3
- package/validation/rules/KnownDirectives.js.flow +2 -1
- package/validation/rules/KnownDirectives.mjs +5 -3
- package/validation/rules/KnownFragmentNames.js +1 -1
- package/validation/rules/KnownFragmentNames.mjs +1 -1
- package/validation/rules/KnownTypeNames.js +1 -1
- package/validation/rules/KnownTypeNames.mjs +1 -1
- package/validation/rules/LoneAnonymousOperation.js +1 -1
- package/validation/rules/LoneAnonymousOperation.mjs +1 -1
- package/validation/rules/LoneSchemaDefinition.js +1 -1
- package/validation/rules/LoneSchemaDefinition.mjs +1 -1
- package/validation/rules/NoFragmentCycles.js +1 -1
- package/validation/rules/NoFragmentCycles.mjs +1 -1
- package/validation/rules/NoUndefinedVariables.js +1 -1
- package/validation/rules/NoUndefinedVariables.mjs +1 -1
- package/validation/rules/NoUnusedFragments.js +1 -1
- package/validation/rules/NoUnusedFragments.mjs +1 -1
- package/validation/rules/NoUnusedVariables.js +1 -1
- package/validation/rules/NoUnusedVariables.mjs +1 -1
- package/validation/rules/OverlappingFieldsCanBeMerged.js +21 -16
- package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +4 -2
- package/validation/rules/OverlappingFieldsCanBeMerged.mjs +21 -16
- package/validation/rules/PossibleFragmentSpreads.js +1 -1
- package/validation/rules/PossibleFragmentSpreads.mjs +1 -1
- package/validation/rules/PossibleTypeExtensions.js +1 -1
- package/validation/rules/PossibleTypeExtensions.mjs +1 -1
- package/validation/rules/ProvidedRequiredArguments.js +1 -1
- package/validation/rules/ProvidedRequiredArguments.mjs +1 -1
- package/validation/rules/ScalarLeafs.js +1 -1
- package/validation/rules/ScalarLeafs.mjs +1 -1
- package/validation/rules/SingleFieldSubscriptions.js +1 -1
- package/validation/rules/SingleFieldSubscriptions.mjs +1 -1
- package/validation/rules/UniqueArgumentNames.js +1 -1
- package/validation/rules/UniqueArgumentNames.mjs +1 -1
- package/validation/rules/UniqueDirectiveNames.js +1 -1
- package/validation/rules/UniqueDirectiveNames.mjs +1 -1
- package/validation/rules/UniqueDirectivesPerLocation.js +2 -1
- package/validation/rules/UniqueDirectivesPerLocation.mjs +2 -1
- package/validation/rules/UniqueEnumValueNames.js +1 -1
- package/validation/rules/UniqueEnumValueNames.mjs +1 -1
- package/validation/rules/UniqueFieldDefinitionNames.js +1 -1
- package/validation/rules/UniqueFieldDefinitionNames.mjs +1 -1
- package/validation/rules/UniqueFragmentNames.js +1 -1
- package/validation/rules/UniqueFragmentNames.mjs +1 -1
- package/validation/rules/UniqueInputFieldNames.js +1 -1
- package/validation/rules/UniqueInputFieldNames.mjs +1 -1
- package/validation/rules/UniqueOperationNames.js +1 -1
- package/validation/rules/UniqueOperationNames.mjs +1 -1
- package/validation/rules/UniqueOperationTypes.js +1 -1
- package/validation/rules/UniqueOperationTypes.mjs +1 -1
- package/validation/rules/UniqueTypeNames.js +1 -1
- package/validation/rules/UniqueTypeNames.mjs +1 -1
- package/validation/rules/UniqueVariableNames.js +1 -1
- package/validation/rules/UniqueVariableNames.mjs +1 -1
- package/validation/rules/ValuesOfCorrectType.js +1 -1
- package/validation/rules/ValuesOfCorrectType.mjs +1 -1
- package/validation/rules/VariablesAreInputTypes.js +1 -1
- package/validation/rules/VariablesAreInputTypes.mjs +1 -1
- package/validation/rules/VariablesInAllowedPosition.js +2 -2
- package/validation/rules/VariablesInAllowedPosition.js.flow +1 -1
- package/validation/rules/VariablesInAllowedPosition.mjs +2 -2
- package/validation/specifiedRules.js +1 -1
- package/validation/specifiedRules.mjs +1 -1
- package/validation/validate.js +1 -1
- package/validation/validate.mjs +1 -1
- 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
package/utilities/TypeInfo.mjs
CHANGED
|
@@ -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
|
-
|
|
113
|
+
{
|
|
114
|
+
var namedType = getNamedType(this.getType());
|
|
112
115
|
|
|
113
|
-
|
|
116
|
+
this._parentTypeStack.push(isCompositeType(namedType) ? namedType : undefined);
|
|
114
117
|
|
|
115
|
-
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
116
120
|
|
|
117
121
|
case Kind.FIELD:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
122
|
+
{
|
|
123
|
+
var parentType = this.getParentType();
|
|
124
|
+
var fieldDef;
|
|
125
|
+
var fieldType;
|
|
121
126
|
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
if (parentType) {
|
|
128
|
+
fieldDef = this._getFieldDef(schema, parentType, node);
|
|
124
129
|
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
if (fieldDef) {
|
|
131
|
+
fieldType = fieldDef.type;
|
|
132
|
+
}
|
|
127
133
|
}
|
|
128
|
-
}
|
|
129
134
|
|
|
130
|
-
|
|
135
|
+
this._fieldDefStack.push(fieldDef);
|
|
131
136
|
|
|
132
|
-
|
|
137
|
+
this._typeStack.push(isOutputType(fieldType) ? fieldType : undefined);
|
|
133
138
|
|
|
134
|
-
|
|
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
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
158
|
+
this._typeStack.push(isObjectType(type) ? type : undefined);
|
|
152
159
|
|
|
153
|
-
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
154
162
|
|
|
155
163
|
case Kind.INLINE_FRAGMENT:
|
|
156
164
|
case Kind.FRAGMENT_DEFINITION:
|
|
157
|
-
|
|
158
|
-
|
|
165
|
+
{
|
|
166
|
+
var typeConditionAST = node.typeCondition;
|
|
167
|
+
var outputType = typeConditionAST ? typeFromAST(schema, typeConditionAST) : getNamedType(this.getType());
|
|
159
168
|
|
|
160
|
-
|
|
169
|
+
this._typeStack.push(isOutputType(outputType) ? outputType : undefined);
|
|
161
170
|
|
|
162
|
-
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
163
173
|
|
|
164
174
|
case Kind.VARIABLE_DEFINITION:
|
|
165
|
-
|
|
175
|
+
{
|
|
176
|
+
var inputType = typeFromAST(schema, node.type);
|
|
166
177
|
|
|
167
|
-
|
|
178
|
+
this._inputTypeStack.push(isInputType(inputType) ? inputType : undefined);
|
|
168
179
|
|
|
169
|
-
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
170
182
|
|
|
171
183
|
case Kind.ARGUMENT:
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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
|
-
|
|
199
|
+
this._argument = argDef;
|
|
187
200
|
|
|
188
|
-
|
|
201
|
+
this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined);
|
|
189
202
|
|
|
190
|
-
|
|
203
|
+
this._inputTypeStack.push(isInputType(argType) ? argType : undefined);
|
|
191
204
|
|
|
192
|
-
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
193
207
|
|
|
194
208
|
case Kind.LIST:
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
|
|
213
|
+
this._defaultValueStack.push(undefined);
|
|
199
214
|
|
|
200
|
-
|
|
215
|
+
this._inputTypeStack.push(isInputType(itemType) ? itemType : undefined);
|
|
201
216
|
|
|
202
|
-
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
203
219
|
|
|
204
220
|
case Kind.OBJECT_FIELD:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
221
|
+
{
|
|
222
|
+
var objectType = getNamedType(this.getInputType());
|
|
223
|
+
var inputFieldType;
|
|
224
|
+
var inputField;
|
|
208
225
|
|
|
209
|
-
|
|
210
|
-
|
|
226
|
+
if (isInputObjectType(objectType)) {
|
|
227
|
+
inputField = objectType.getFields()[node.name.value];
|
|
211
228
|
|
|
212
|
-
|
|
213
|
-
|
|
229
|
+
if (inputField) {
|
|
230
|
+
inputFieldType = inputField.type;
|
|
231
|
+
}
|
|
214
232
|
}
|
|
215
|
-
}
|
|
216
233
|
|
|
217
|
-
|
|
234
|
+
this._defaultValueStack.push(inputField ? inputField.defaultValue : undefined);
|
|
218
235
|
|
|
219
|
-
|
|
236
|
+
this._inputTypeStack.push(isInputType(inputFieldType) ? inputFieldType : undefined);
|
|
220
237
|
|
|
221
|
-
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
222
240
|
|
|
223
241
|
case Kind.ENUM:
|
|
224
|
-
|
|
225
|
-
|
|
242
|
+
{
|
|
243
|
+
var enumType = getNamedType(this.getInputType());
|
|
244
|
+
var enumValue;
|
|
226
245
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
246
|
+
if (isEnumType(enumType)) {
|
|
247
|
+
enumValue = enumType.getValue(node.value);
|
|
248
|
+
}
|
|
230
249
|
|
|
231
|
-
|
|
232
|
-
|
|
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
|
+
}
|
|
@@ -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
|
-
|
|
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]
|
|
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
|
-
|
|
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
|
+
}
|
package/utilities/coerceValue.js
CHANGED
package/utilities/concatAST.js
CHANGED
package/utilities/concatAST.mjs
CHANGED
|
@@ -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(
|
|
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.
|
|
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
|
-
}
|
|
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
|
|
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.
|
|
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
|
-
}
|
|
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
|
|
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
|
+
}
|