graphql 15.0.0 → 15.1.0
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/README.md +5 -5
- package/error/GraphQLError.d.ts +2 -2
- package/error/GraphQLError.js +4 -5
- package/error/GraphQLError.js.flow +1 -1
- package/error/GraphQLError.mjs +4 -5
- package/error/locatedError.d.ts +1 -1
- package/execution/execute.d.ts +8 -6
- package/execution/execute.js +4 -6
- package/execution/execute.js.flow +3 -2
- package/execution/execute.mjs +4 -6
- package/execution/values.d.ts +2 -1
- package/execution/values.js +1 -2
- package/execution/values.js.flow +1 -1
- package/execution/values.mjs +1 -2
- package/graphql.d.ts +2 -1
- package/index.d.ts +3 -2
- package/index.js +18 -0
- package/index.js.flow +3 -2
- package/index.mjs +2 -2
- package/jsutils/Maybe.d.ts +2 -0
- package/jsutils/Path.d.ts +2 -2
- package/jsutils/defineInspect.js +25 -0
- package/jsutils/defineInspect.js.flow +21 -0
- package/jsutils/defineInspect.mjs +15 -0
- package/jsutils/devAssert.js +1 -2
- package/jsutils/devAssert.js.flow +1 -1
- package/jsutils/devAssert.mjs +1 -2
- package/jsutils/instanceOf.js +1 -2
- package/jsutils/instanceOf.js.flow +1 -1
- package/jsutils/instanceOf.mjs +1 -2
- package/jsutils/invariant.js +1 -2
- package/jsutils/invariant.js.flow +1 -1
- package/jsutils/invariant.mjs +1 -2
- package/jsutils/nodejsCustomInspectSymbol.js +1 -2
- package/jsutils/nodejsCustomInspectSymbol.js.flow +1 -1
- package/jsutils/nodejsCustomInspectSymbol.mjs +1 -1
- package/language/ast.d.ts +11 -2
- package/language/ast.js +94 -80
- package/language/ast.js.flow +23 -14
- package/language/ast.mjs +86 -72
- package/language/blockString.js +2 -1
- package/language/blockString.js.flow +5 -1
- package/language/blockString.mjs +2 -1
- package/language/directiveLocation.d.ts +2 -7
- package/language/index.js +14 -0
- package/language/index.js.flow +1 -2
- package/language/index.mjs +1 -0
- package/language/kinds.d.ts +2 -7
- package/language/lexer.d.ts +6 -0
- package/language/tokenKind.d.ts +2 -4
- package/language/visitor.d.ts +4 -3
- package/package.json +2 -2
- package/polyfills/arrayFrom.js +1 -2
- package/polyfills/arrayFrom.js.flow +1 -1
- package/polyfills/arrayFrom.mjs +1 -2
- package/polyfills/symbols.js +3 -6
- package/polyfills/symbols.js.flow +3 -3
- package/polyfills/symbols.mjs +3 -6
- package/subscription/subscribe.d.ts +2 -1
- package/type/definition.d.ts +30 -21
- package/type/definition.js +60 -17
- package/type/definition.js.flow +61 -9
- package/type/definition.mjs +60 -17
- package/type/directives.d.ts +6 -1
- package/type/directives.js +28 -7
- package/type/directives.js.flow +23 -2
- package/type/directives.mjs +24 -4
- package/type/index.d.ts +1 -0
- package/type/index.js +6 -0
- package/type/index.js.flow +1 -0
- package/type/index.mjs +1 -1
- package/type/introspection.js +11 -6
- package/type/introspection.js.flow +8 -2
- package/type/introspection.mjs +11 -6
- package/type/schema.d.ts +7 -5
- package/type/validate.js +22 -8
- package/type/validate.js.flow +23 -11
- package/type/validate.mjs +22 -8
- package/utilities/TypeInfo.d.ts +2 -1
- package/utilities/astFromValue.d.ts +2 -1
- package/utilities/astFromValue.js +4 -5
- package/utilities/astFromValue.js.flow +2 -1
- package/utilities/astFromValue.mjs +4 -5
- package/utilities/buildASTSchema.js +15 -4
- package/utilities/buildASTSchema.js.flow +13 -2
- package/utilities/buildASTSchema.mjs +15 -4
- package/utilities/buildClientSchema.js +2 -1
- package/utilities/buildClientSchema.js.flow +1 -0
- package/utilities/buildClientSchema.mjs +2 -1
- package/utilities/coerceInputValue.js +4 -5
- package/utilities/coerceInputValue.js.flow +2 -1
- package/utilities/coerceInputValue.mjs +4 -5
- package/utilities/extendSchema.d.ts +2 -1
- package/utilities/extendSchema.js +78 -66
- package/utilities/extendSchema.js.flow +30 -9
- package/utilities/extendSchema.mjs +79 -67
- package/utilities/findBreakingChanges.d.ts +6 -16
- package/utilities/findBreakingChanges.js +5 -8
- package/utilities/findBreakingChanges.js.flow +2 -1
- package/utilities/findBreakingChanges.mjs +5 -8
- package/utilities/getIntrospectionQuery.d.ts +12 -2
- package/utilities/getIntrospectionQuery.js +3 -1
- package/utilities/getIntrospectionQuery.js.flow +10 -0
- package/utilities/getIntrospectionQuery.mjs +3 -1
- package/utilities/getOperationAST.d.ts +3 -2
- package/utilities/getOperationAST.js.flow +1 -1
- package/utilities/introspectionFromSchema.js +0 -2
- package/utilities/introspectionFromSchema.mjs +0 -2
- package/utilities/lexicographicSortSchema.js +14 -15
- package/utilities/lexicographicSortSchema.js.flow +2 -1
- package/utilities/lexicographicSortSchema.mjs +14 -15
- package/utilities/printSchema.js +16 -6
- package/utilities/printSchema.js.flow +20 -2
- package/utilities/printSchema.mjs +16 -6
- package/utilities/typeFromAST.js +4 -5
- package/utilities/typeFromAST.js.flow +2 -1
- package/utilities/typeFromAST.mjs +4 -5
- package/utilities/valueFromAST.d.ts +2 -1
- package/utilities/valueFromAST.js +4 -5
- package/utilities/valueFromAST.js.flow +2 -1
- package/utilities/valueFromAST.mjs +4 -5
- package/utilities/valueFromASTUntyped.d.ts +2 -1
- package/utilities/valueFromASTUntyped.js +2 -3
- package/utilities/valueFromASTUntyped.js.flow +1 -1
- package/utilities/valueFromASTUntyped.mjs +2 -3
- package/validation/ValidationContext.d.ts +4 -3
- package/validation/ValidationContext.js +0 -16
- package/validation/ValidationContext.mjs +0 -16
- package/validation/rules/KnownArgumentNamesRule.js +2 -2
- package/validation/rules/KnownArgumentNamesRule.js.flow +1 -1
- package/validation/rules/KnownArgumentNamesRule.mjs +2 -2
- package/validation/rules/KnownDirectivesRule.js +2 -5
- package/validation/rules/KnownDirectivesRule.js.flow +1 -1
- package/validation/rules/KnownDirectivesRule.mjs +2 -5
- package/validation/rules/KnownTypeNamesRule.d.ts +4 -2
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js +2 -4
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow +2 -2
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +2 -4
- package/validation/rules/PossibleTypeExtensionsRule.js +6 -8
- package/validation/rules/PossibleTypeExtensionsRule.js.flow +3 -2
- package/validation/rules/PossibleTypeExtensionsRule.mjs +6 -8
- package/validation/rules/ProvidedRequiredArgumentsRule.js +4 -5
- package/validation/rules/ProvidedRequiredArgumentsRule.js.flow +3 -3
- package/validation/rules/ProvidedRequiredArgumentsRule.mjs +4 -5
- package/validation/rules/UniqueEnumValueNamesRule.js +1 -2
- package/validation/rules/UniqueEnumValueNamesRule.js.flow +1 -1
- package/validation/rules/UniqueEnumValueNamesRule.mjs +1 -2
- package/validation/rules/UniqueFieldDefinitionNamesRule.js +1 -2
- package/validation/rules/UniqueFieldDefinitionNamesRule.js.flow +1 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +1 -2
- package/validation/rules/UniqueOperationTypesRule.js +1 -1
- package/validation/rules/UniqueOperationTypesRule.js.flow +1 -1
- package/validation/rules/UniqueOperationTypesRule.mjs +1 -1
- package/validation/validate.d.ts +3 -3
- package/version.js +3 -3
- package/version.js.flow +3 -3
- package/version.mjs +3 -3
- package/jsutils/dedent.js +0 -50
- package/jsutils/dedent.js.flow +0 -44
- package/jsutils/dedent.mjs +0 -43
- package/jsutils/defineToJSON.js +0 -25
- package/jsutils/defineToJSON.js.flow +0 -20
- package/jsutils/defineToJSON.mjs +0 -16
- package/tsutils/Maybe.d.ts +0 -6
|
@@ -18,7 +18,7 @@ import { assertValidSDLExtension } from "../validation/validate.mjs";
|
|
|
18
18
|
import { getDirectiveValues } from "../execution/values.mjs";
|
|
19
19
|
import { specifiedScalarTypes, isSpecifiedScalarType } from "../type/scalars.mjs";
|
|
20
20
|
import { introspectionTypes, isIntrospectionType } from "../type/introspection.mjs";
|
|
21
|
-
import { GraphQLDirective, GraphQLDeprecatedDirective } from "../type/directives.mjs";
|
|
21
|
+
import { GraphQLDirective, GraphQLDeprecatedDirective, GraphQLSpecifiedByDirective } from "../type/directives.mjs";
|
|
22
22
|
import { assertSchema, GraphQLSchema } from "../type/schema.mjs";
|
|
23
23
|
import { isScalarType, isObjectType, isInterfaceType, isUnionType, isListType, isNonNullType, isEnumType, isInputObjectType, GraphQLList, GraphQLNonNull, GraphQLScalarType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType } from "../type/definition.mjs";
|
|
24
24
|
import { valueFromAST } from "./valueFromAST.mjs";
|
|
@@ -109,17 +109,17 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
109
109
|
typeMap[name] = (_stdTypeMap$name = stdTypeMap[name]) !== null && _stdTypeMap$name !== void 0 ? _stdTypeMap$name : buildType(typeNode);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
var operationTypes = _objectSpread({
|
|
112
|
+
var operationTypes = _objectSpread(_objectSpread({
|
|
113
113
|
// Get the extended root operation types.
|
|
114
114
|
query: schemaConfig.query && replaceNamedType(schemaConfig.query),
|
|
115
115
|
mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation),
|
|
116
116
|
subscription: schemaConfig.subscription && replaceNamedType(schemaConfig.subscription)
|
|
117
|
-
}, schemaDef && getOperationTypes([schemaDef]),
|
|
117
|
+
}, schemaDef && getOperationTypes([schemaDef])), getOperationTypes(schemaExtensions)); // Then produce and return a Schema config with these types.
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
return _objectSpread({
|
|
120
|
+
return _objectSpread(_objectSpread({
|
|
121
121
|
description: (_schemaDef = schemaDef) === null || _schemaDef === void 0 ? void 0 : (_schemaDef$descriptio = _schemaDef.description) === null || _schemaDef$descriptio === void 0 ? void 0 : _schemaDef$descriptio.value
|
|
122
|
-
}, operationTypes, {
|
|
122
|
+
}, operationTypes), {}, {
|
|
123
123
|
types: objectValues(typeMap),
|
|
124
124
|
directives: [].concat(schemaConfig.directives.map(replaceDirective), directiveDefs.map(buildDirective)),
|
|
125
125
|
extensions: undefined,
|
|
@@ -148,7 +148,7 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
148
148
|
|
|
149
149
|
function replaceDirective(directive) {
|
|
150
150
|
var config = directive.toConfig();
|
|
151
|
-
return new GraphQLDirective(_objectSpread({}, config, {
|
|
151
|
+
return new GraphQLDirective(_objectSpread(_objectSpread({}, config), {}, {
|
|
152
152
|
args: mapValue(config.args, extendArg)
|
|
153
153
|
}));
|
|
154
154
|
}
|
|
@@ -177,16 +177,15 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
177
177
|
|
|
178
178
|
if (isEnumType(type)) {
|
|
179
179
|
return extendEnumType(type);
|
|
180
|
-
}
|
|
180
|
+
} // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
|
|
181
|
+
|
|
181
182
|
|
|
182
|
-
/* istanbul ignore else */
|
|
183
183
|
if (isInputObjectType(type)) {
|
|
184
184
|
return extendInputObjectType(type);
|
|
185
|
-
} // Not reachable. All possible types have been considered
|
|
185
|
+
} // istanbul ignore next (Not reachable. All possible types have been considered)
|
|
186
186
|
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
invariant(false, 'Unexpected type: ' + inspect(type));
|
|
188
|
+
false || invariant(0, 'Unexpected type: ' + inspect(type));
|
|
190
189
|
}
|
|
191
190
|
|
|
192
191
|
function extendInputObjectType(type) {
|
|
@@ -194,13 +193,13 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
194
193
|
|
|
195
194
|
var config = type.toConfig();
|
|
196
195
|
var extensions = (_typeExtensionsMap$co = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co !== void 0 ? _typeExtensionsMap$co : [];
|
|
197
|
-
return new GraphQLInputObjectType(_objectSpread({}, config, {
|
|
196
|
+
return new GraphQLInputObjectType(_objectSpread(_objectSpread({}, config), {}, {
|
|
198
197
|
fields: function fields() {
|
|
199
|
-
return _objectSpread({}, mapValue(config.fields, function (field) {
|
|
200
|
-
return _objectSpread({}, field, {
|
|
198
|
+
return _objectSpread(_objectSpread({}, mapValue(config.fields, function (field) {
|
|
199
|
+
return _objectSpread(_objectSpread({}, field), {}, {
|
|
201
200
|
type: replaceType(field.type)
|
|
202
201
|
});
|
|
203
|
-
}),
|
|
202
|
+
})), buildInputFieldMap(extensions));
|
|
204
203
|
},
|
|
205
204
|
extensionASTNodes: config.extensionASTNodes.concat(extensions)
|
|
206
205
|
}));
|
|
@@ -211,8 +210,8 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
211
210
|
|
|
212
211
|
var config = type.toConfig();
|
|
213
212
|
var extensions = (_typeExtensionsMap$ty = typeExtensionsMap[type.name]) !== null && _typeExtensionsMap$ty !== void 0 ? _typeExtensionsMap$ty : [];
|
|
214
|
-
return new GraphQLEnumType(_objectSpread({}, config, {
|
|
215
|
-
values: _objectSpread({}, config.values,
|
|
213
|
+
return new GraphQLEnumType(_objectSpread(_objectSpread({}, config), {}, {
|
|
214
|
+
values: _objectSpread(_objectSpread({}, config.values), buildEnumValueMap(extensions)),
|
|
216
215
|
extensionASTNodes: config.extensionASTNodes.concat(extensions)
|
|
217
216
|
}));
|
|
218
217
|
}
|
|
@@ -222,7 +221,17 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
222
221
|
|
|
223
222
|
var config = type.toConfig();
|
|
224
223
|
var extensions = (_typeExtensionsMap$co2 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co2 !== void 0 ? _typeExtensionsMap$co2 : [];
|
|
225
|
-
|
|
224
|
+
var specifiedByUrl = config.specifiedByUrl;
|
|
225
|
+
|
|
226
|
+
for (var _i8 = 0; _i8 < extensions.length; _i8++) {
|
|
227
|
+
var _getSpecifiedByUrl;
|
|
228
|
+
|
|
229
|
+
var extensionNode = extensions[_i8];
|
|
230
|
+
specifiedByUrl = (_getSpecifiedByUrl = getSpecifiedByUrl(extensionNode)) !== null && _getSpecifiedByUrl !== void 0 ? _getSpecifiedByUrl : specifiedByUrl;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return new GraphQLScalarType(_objectSpread(_objectSpread({}, config), {}, {
|
|
234
|
+
specifiedByUrl: specifiedByUrl,
|
|
226
235
|
extensionASTNodes: config.extensionASTNodes.concat(extensions)
|
|
227
236
|
}));
|
|
228
237
|
}
|
|
@@ -232,12 +241,12 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
232
241
|
|
|
233
242
|
var config = type.toConfig();
|
|
234
243
|
var extensions = (_typeExtensionsMap$co3 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co3 !== void 0 ? _typeExtensionsMap$co3 : [];
|
|
235
|
-
return new GraphQLObjectType(_objectSpread({}, config, {
|
|
244
|
+
return new GraphQLObjectType(_objectSpread(_objectSpread({}, config), {}, {
|
|
236
245
|
interfaces: function interfaces() {
|
|
237
246
|
return [].concat(type.getInterfaces().map(replaceNamedType), buildInterfaces(extensions));
|
|
238
247
|
},
|
|
239
248
|
fields: function fields() {
|
|
240
|
-
return _objectSpread({}, mapValue(config.fields, extendField),
|
|
249
|
+
return _objectSpread(_objectSpread({}, mapValue(config.fields, extendField)), buildFieldMap(extensions));
|
|
241
250
|
},
|
|
242
251
|
extensionASTNodes: config.extensionASTNodes.concat(extensions)
|
|
243
252
|
}));
|
|
@@ -248,12 +257,12 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
248
257
|
|
|
249
258
|
var config = type.toConfig();
|
|
250
259
|
var extensions = (_typeExtensionsMap$co4 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co4 !== void 0 ? _typeExtensionsMap$co4 : [];
|
|
251
|
-
return new GraphQLInterfaceType(_objectSpread({}, config, {
|
|
260
|
+
return new GraphQLInterfaceType(_objectSpread(_objectSpread({}, config), {}, {
|
|
252
261
|
interfaces: function interfaces() {
|
|
253
262
|
return [].concat(type.getInterfaces().map(replaceNamedType), buildInterfaces(extensions));
|
|
254
263
|
},
|
|
255
264
|
fields: function fields() {
|
|
256
|
-
return _objectSpread({}, mapValue(config.fields, extendField),
|
|
265
|
+
return _objectSpread(_objectSpread({}, mapValue(config.fields, extendField)), buildFieldMap(extensions));
|
|
257
266
|
},
|
|
258
267
|
extensionASTNodes: config.extensionASTNodes.concat(extensions)
|
|
259
268
|
}));
|
|
@@ -264,7 +273,7 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
264
273
|
|
|
265
274
|
var config = type.toConfig();
|
|
266
275
|
var extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : [];
|
|
267
|
-
return new GraphQLUnionType(_objectSpread({}, config, {
|
|
276
|
+
return new GraphQLUnionType(_objectSpread(_objectSpread({}, config), {}, {
|
|
268
277
|
types: function types() {
|
|
269
278
|
return [].concat(type.getTypes().map(replaceNamedType), buildUnionTypes(extensions));
|
|
270
279
|
},
|
|
@@ -273,14 +282,14 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
273
282
|
}
|
|
274
283
|
|
|
275
284
|
function extendField(field) {
|
|
276
|
-
return _objectSpread({}, field, {
|
|
285
|
+
return _objectSpread(_objectSpread({}, field), {}, {
|
|
277
286
|
type: replaceType(field.type),
|
|
278
287
|
args: mapValue(field.args, extendArg)
|
|
279
288
|
});
|
|
280
289
|
}
|
|
281
290
|
|
|
282
291
|
function extendArg(arg) {
|
|
283
|
-
return _objectSpread({}, arg, {
|
|
292
|
+
return _objectSpread(_objectSpread({}, arg), {}, {
|
|
284
293
|
type: replaceType(arg.type)
|
|
285
294
|
});
|
|
286
295
|
}
|
|
@@ -288,16 +297,15 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
288
297
|
function getOperationTypes(nodes) {
|
|
289
298
|
var opTypes = {};
|
|
290
299
|
|
|
291
|
-
for (var
|
|
300
|
+
for (var _i10 = 0; _i10 < nodes.length; _i10++) {
|
|
292
301
|
var _node$operationTypes;
|
|
293
302
|
|
|
294
|
-
var node = nodes[
|
|
295
|
-
|
|
296
|
-
/* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
|
|
303
|
+
var node = nodes[_i10];
|
|
304
|
+
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
297
305
|
var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];
|
|
298
306
|
|
|
299
|
-
for (var
|
|
300
|
-
var operationType = operationTypesNodes[
|
|
307
|
+
for (var _i12 = 0; _i12 < operationTypesNodes.length; _i12++) {
|
|
308
|
+
var operationType = operationTypesNodes[_i12];
|
|
301
309
|
opTypes[operationType.operation] = getNamedType(operationType.type);
|
|
302
310
|
}
|
|
303
311
|
} // Note: While this could make early assertions to get the correctly
|
|
@@ -351,16 +359,15 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
351
359
|
function buildFieldMap(nodes) {
|
|
352
360
|
var fieldConfigMap = Object.create(null);
|
|
353
361
|
|
|
354
|
-
for (var
|
|
362
|
+
for (var _i14 = 0; _i14 < nodes.length; _i14++) {
|
|
355
363
|
var _node$fields;
|
|
356
364
|
|
|
357
|
-
var node = nodes[
|
|
358
|
-
|
|
359
|
-
/* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
|
|
365
|
+
var node = nodes[_i14];
|
|
366
|
+
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
360
367
|
var nodeFields = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : [];
|
|
361
368
|
|
|
362
|
-
for (var
|
|
363
|
-
var field = nodeFields[
|
|
369
|
+
for (var _i16 = 0; _i16 < nodeFields.length; _i16++) {
|
|
370
|
+
var field = nodeFields[_i16];
|
|
364
371
|
fieldConfigMap[field.name.value] = {
|
|
365
372
|
// Note: While this could make assertions to get the correctly typed
|
|
366
373
|
// value, that would throw immediately while type system validation
|
|
@@ -378,12 +385,12 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
378
385
|
}
|
|
379
386
|
|
|
380
387
|
function buildArgumentMap(args) {
|
|
381
|
-
|
|
388
|
+
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
382
389
|
var argsNodes = args !== null && args !== void 0 ? args : [];
|
|
383
390
|
var argConfigMap = Object.create(null);
|
|
384
391
|
|
|
385
|
-
for (var
|
|
386
|
-
var arg = argsNodes[
|
|
392
|
+
for (var _i18 = 0; _i18 < argsNodes.length; _i18++) {
|
|
393
|
+
var arg = argsNodes[_i18];
|
|
387
394
|
// Note: While this could make assertions to get the correctly typed
|
|
388
395
|
// value, that would throw immediately while type system validation
|
|
389
396
|
// with validateSchema() will produce more actionable results.
|
|
@@ -402,16 +409,15 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
402
409
|
function buildInputFieldMap(nodes) {
|
|
403
410
|
var inputFieldMap = Object.create(null);
|
|
404
411
|
|
|
405
|
-
for (var
|
|
412
|
+
for (var _i20 = 0; _i20 < nodes.length; _i20++) {
|
|
406
413
|
var _node$fields2;
|
|
407
414
|
|
|
408
|
-
var node = nodes[
|
|
409
|
-
|
|
410
|
-
/* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
|
|
415
|
+
var node = nodes[_i20];
|
|
416
|
+
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
411
417
|
var fieldsNodes = (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0 ? _node$fields2 : [];
|
|
412
418
|
|
|
413
|
-
for (var
|
|
414
|
-
var field = fieldsNodes[
|
|
419
|
+
for (var _i22 = 0; _i22 < fieldsNodes.length; _i22++) {
|
|
420
|
+
var field = fieldsNodes[_i22];
|
|
415
421
|
// Note: While this could make assertions to get the correctly typed
|
|
416
422
|
// value, that would throw immediately while type system validation
|
|
417
423
|
// with validateSchema() will produce more actionable results.
|
|
@@ -431,16 +437,15 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
431
437
|
function buildEnumValueMap(nodes) {
|
|
432
438
|
var enumValueMap = Object.create(null);
|
|
433
439
|
|
|
434
|
-
for (var
|
|
440
|
+
for (var _i24 = 0; _i24 < nodes.length; _i24++) {
|
|
435
441
|
var _node$values;
|
|
436
442
|
|
|
437
|
-
var node = nodes[
|
|
438
|
-
|
|
439
|
-
/* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
|
|
443
|
+
var node = nodes[_i24];
|
|
444
|
+
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
440
445
|
var valuesNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : [];
|
|
441
446
|
|
|
442
|
-
for (var
|
|
443
|
-
var value = valuesNodes[
|
|
447
|
+
for (var _i26 = 0; _i26 < valuesNodes.length; _i26++) {
|
|
448
|
+
var value = valuesNodes[_i26];
|
|
444
449
|
enumValueMap[value.name.value] = {
|
|
445
450
|
description: getDescription(value, options),
|
|
446
451
|
deprecationReason: getDeprecationReason(value),
|
|
@@ -455,16 +460,15 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
455
460
|
function buildInterfaces(nodes) {
|
|
456
461
|
var interfaces = [];
|
|
457
462
|
|
|
458
|
-
for (var
|
|
463
|
+
for (var _i28 = 0; _i28 < nodes.length; _i28++) {
|
|
459
464
|
var _node$interfaces;
|
|
460
465
|
|
|
461
|
-
var node = nodes[
|
|
462
|
-
|
|
463
|
-
/* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
|
|
466
|
+
var node = nodes[_i28];
|
|
467
|
+
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
464
468
|
var interfacesNodes = (_node$interfaces = node.interfaces) !== null && _node$interfaces !== void 0 ? _node$interfaces : [];
|
|
465
469
|
|
|
466
|
-
for (var
|
|
467
|
-
var type = interfacesNodes[
|
|
470
|
+
for (var _i30 = 0; _i30 < interfacesNodes.length; _i30++) {
|
|
471
|
+
var type = interfacesNodes[_i30];
|
|
468
472
|
// Note: While this could make assertions to get the correctly typed
|
|
469
473
|
// values below, that would throw immediately while type system
|
|
470
474
|
// validation with validateSchema() will produce more actionable
|
|
@@ -479,16 +483,15 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
479
483
|
function buildUnionTypes(nodes) {
|
|
480
484
|
var types = [];
|
|
481
485
|
|
|
482
|
-
for (var
|
|
486
|
+
for (var _i32 = 0; _i32 < nodes.length; _i32++) {
|
|
483
487
|
var _node$types;
|
|
484
488
|
|
|
485
|
-
var node = nodes[
|
|
486
|
-
|
|
487
|
-
/* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
|
|
489
|
+
var node = nodes[_i32];
|
|
490
|
+
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
488
491
|
var typeNodes = (_node$types = node.types) !== null && _node$types !== void 0 ? _node$types : [];
|
|
489
492
|
|
|
490
|
-
for (var
|
|
491
|
-
var type = typeNodes[
|
|
493
|
+
for (var _i34 = 0; _i34 < typeNodes.length; _i34++) {
|
|
494
|
+
var type = typeNodes[_i34];
|
|
492
495
|
// Note: While this could make assertions to get the correctly typed
|
|
493
496
|
// values below, that would throw immediately while type system
|
|
494
497
|
// validation with validateSchema() will produce more actionable
|
|
@@ -584,6 +587,7 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
584
587
|
return new GraphQLScalarType({
|
|
585
588
|
name: name,
|
|
586
589
|
description: description,
|
|
590
|
+
specifiedByUrl: getSpecifiedByUrl(astNode),
|
|
587
591
|
astNode: astNode,
|
|
588
592
|
extensionASTNodes: _extensionASTNodes4
|
|
589
593
|
});
|
|
@@ -605,11 +609,10 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
605
609
|
extensionASTNodes: _extensionASTNodes5
|
|
606
610
|
});
|
|
607
611
|
}
|
|
608
|
-
} // Not reachable. All possible type definition nodes have been considered
|
|
612
|
+
} // istanbul ignore next (Not reachable. All possible type definition nodes have been considered)
|
|
609
613
|
|
|
610
614
|
|
|
611
|
-
|
|
612
|
-
invariant(false, 'Unexpected type definition node: ' + inspect(astNode));
|
|
615
|
+
false || invariant(0, 'Unexpected type definition node: ' + inspect(astNode));
|
|
613
616
|
}
|
|
614
617
|
}
|
|
615
618
|
var stdTypeMap = keyMap(specifiedScalarTypes.concat(introspectionTypes), function (type) {
|
|
@@ -624,6 +627,15 @@ function getDeprecationReason(node) {
|
|
|
624
627
|
var deprecated = getDirectiveValues(GraphQLDeprecatedDirective, node);
|
|
625
628
|
return deprecated === null || deprecated === void 0 ? void 0 : deprecated.reason;
|
|
626
629
|
}
|
|
630
|
+
/**
|
|
631
|
+
* Given a scalar node, returns the string value for the specifiedByUrl.
|
|
632
|
+
*/
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
function getSpecifiedByUrl(node) {
|
|
636
|
+
var specifiedBy = getDirectiveValues(GraphQLSpecifiedByDirective, node);
|
|
637
|
+
return specifiedBy === null || specifiedBy === void 0 ? void 0 : specifiedBy.url;
|
|
638
|
+
}
|
|
627
639
|
/**
|
|
628
640
|
* Given an ast node, returns its string description.
|
|
629
641
|
* @deprecated: provided to ease adoption and will be removed in v16.
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { GraphQLSchema } from '../type/schema';
|
|
2
2
|
|
|
3
|
-
export const BreakingChangeType:
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
type _BreakingChangeType = {
|
|
3
|
+
export const BreakingChangeType: {
|
|
9
4
|
TYPE_REMOVED: 'TYPE_REMOVED';
|
|
10
5
|
TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND';
|
|
11
6
|
TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION';
|
|
12
7
|
VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM';
|
|
13
8
|
REQUIRED_INPUT_FIELD_ADDED: 'REQUIRED_INPUT_FIELD_ADDED';
|
|
14
|
-
|
|
9
|
+
IMPLEMENTED_INTERFACE_REMOVED: 'IMPLEMENTED_INTERFACE_REMOVED';
|
|
15
10
|
FIELD_REMOVED: 'FIELD_REMOVED';
|
|
16
11
|
FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND';
|
|
17
12
|
REQUIRED_ARG_ADDED: 'REQUIRED_ARG_ADDED';
|
|
@@ -24,27 +19,22 @@ type _BreakingChangeType = {
|
|
|
24
19
|
DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED';
|
|
25
20
|
};
|
|
26
21
|
|
|
27
|
-
export const DangerousChangeType:
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @internal
|
|
31
|
-
*/
|
|
32
|
-
type _DangerousChangeType = {
|
|
22
|
+
export const DangerousChangeType: {
|
|
33
23
|
VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM';
|
|
34
24
|
TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION';
|
|
35
25
|
OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED';
|
|
36
26
|
OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED';
|
|
37
|
-
|
|
27
|
+
IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED';
|
|
38
28
|
ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE';
|
|
39
29
|
};
|
|
40
30
|
|
|
41
31
|
export interface BreakingChange {
|
|
42
|
-
type: keyof
|
|
32
|
+
type: keyof typeof BreakingChangeType;
|
|
43
33
|
description: string;
|
|
44
34
|
}
|
|
45
35
|
|
|
46
36
|
export interface DangerousChange {
|
|
47
|
-
type: keyof
|
|
37
|
+
type: keyof typeof DangerousChangeType;
|
|
48
38
|
description: string;
|
|
49
39
|
}
|
|
50
40
|
|
|
@@ -451,29 +451,26 @@ function typeKindName(type) {
|
|
|
451
451
|
|
|
452
452
|
if ((0, _definition.isEnumType)(type)) {
|
|
453
453
|
return 'an Enum type';
|
|
454
|
-
}
|
|
454
|
+
} // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
|
|
455
|
+
|
|
455
456
|
|
|
456
|
-
/* istanbul ignore else */
|
|
457
457
|
if ((0, _definition.isInputObjectType)(type)) {
|
|
458
458
|
return 'an Input type';
|
|
459
|
-
} // Not reachable. All possible named types have been considered
|
|
459
|
+
} // istanbul ignore next (Not reachable. All possible named types have been considered)
|
|
460
460
|
|
|
461
461
|
|
|
462
|
-
|
|
463
|
-
(0, _invariant.default)(false, 'Unexpected type: ' + (0, _inspect.default)(type));
|
|
462
|
+
false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type));
|
|
464
463
|
}
|
|
465
464
|
|
|
466
465
|
function stringifyValue(value, type) {
|
|
467
466
|
var ast = (0, _astFromValue.astFromValue)(value, type);
|
|
468
|
-
|
|
469
|
-
/* istanbul ignore next */
|
|
470
467
|
ast != null || (0, _invariant.default)(0);
|
|
471
468
|
var sortedAST = (0, _visitor.visit)(ast, {
|
|
472
469
|
ObjectValue: function ObjectValue(objectNode) {
|
|
473
470
|
var fields = [].concat(objectNode.fields).sort(function (fieldA, fieldB) {
|
|
474
471
|
return fieldA.name.value.localeCompare(fieldB.name.value);
|
|
475
472
|
});
|
|
476
|
-
return _objectSpread({}, objectNode, {
|
|
473
|
+
return _objectSpread(_objectSpread({}, objectNode), {}, {
|
|
477
474
|
fields: fields
|
|
478
475
|
});
|
|
479
476
|
}
|
|
@@ -526,11 +526,12 @@ function typeKindName(type: GraphQLNamedType): string {
|
|
|
526
526
|
if (isEnumType(type)) {
|
|
527
527
|
return 'an Enum type';
|
|
528
528
|
}
|
|
529
|
+
// istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
|
|
529
530
|
if (isInputObjectType(type)) {
|
|
530
531
|
return 'an Input type';
|
|
531
532
|
}
|
|
532
533
|
|
|
533
|
-
// Not reachable. All possible named types have been considered
|
|
534
|
+
// istanbul ignore next (Not reachable. All possible named types have been considered)
|
|
534
535
|
invariant(false, 'Unexpected type: ' + inspect((type: empty)));
|
|
535
536
|
}
|
|
536
537
|
|
|
@@ -428,29 +428,26 @@ function typeKindName(type) {
|
|
|
428
428
|
|
|
429
429
|
if (isEnumType(type)) {
|
|
430
430
|
return 'an Enum type';
|
|
431
|
-
}
|
|
431
|
+
} // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
|
|
432
|
+
|
|
432
433
|
|
|
433
|
-
/* istanbul ignore else */
|
|
434
434
|
if (isInputObjectType(type)) {
|
|
435
435
|
return 'an Input type';
|
|
436
|
-
} // Not reachable. All possible named types have been considered
|
|
436
|
+
} // istanbul ignore next (Not reachable. All possible named types have been considered)
|
|
437
437
|
|
|
438
438
|
|
|
439
|
-
|
|
440
|
-
invariant(false, 'Unexpected type: ' + inspect(type));
|
|
439
|
+
false || invariant(0, 'Unexpected type: ' + inspect(type));
|
|
441
440
|
}
|
|
442
441
|
|
|
443
442
|
function stringifyValue(value, type) {
|
|
444
443
|
var ast = astFromValue(value, type);
|
|
445
|
-
|
|
446
|
-
/* istanbul ignore next */
|
|
447
444
|
ast != null || invariant(0);
|
|
448
445
|
var sortedAST = visit(ast, {
|
|
449
446
|
ObjectValue: function ObjectValue(objectNode) {
|
|
450
447
|
var fields = [].concat(objectNode.fields).sort(function (fieldA, fieldB) {
|
|
451
448
|
return fieldA.name.value.localeCompare(fieldB.name.value);
|
|
452
449
|
});
|
|
453
|
-
return _objectSpread({}, objectNode, {
|
|
450
|
+
return _objectSpread(_objectSpread({}, objectNode), {}, {
|
|
454
451
|
fields: fields
|
|
455
452
|
});
|
|
456
453
|
}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import Maybe from '../
|
|
1
|
+
import { Maybe } from '../jsutils/Maybe';
|
|
2
|
+
|
|
2
3
|
import { DirectiveLocationEnum } from '../language/directiveLocation';
|
|
3
4
|
|
|
4
5
|
export interface IntrospectionOptions {
|
|
5
6
|
// Whether to include descriptions in the introspection result.
|
|
6
7
|
// Default: true
|
|
7
|
-
descriptions
|
|
8
|
+
descriptions?: boolean;
|
|
9
|
+
|
|
10
|
+
// Whether to include `specifiedByUrl` in the introspection result.
|
|
11
|
+
// Default: false
|
|
12
|
+
specifiedByUrl?: boolean;
|
|
8
13
|
|
|
9
14
|
// Whether to include `isRepeatable` flag on directives.
|
|
10
15
|
// Default: false
|
|
11
16
|
directiveIsRepeatable?: boolean;
|
|
17
|
+
|
|
18
|
+
// Whether to include `description` field on schema.
|
|
19
|
+
// Default: false
|
|
20
|
+
schemaDescription?: boolean;
|
|
12
21
|
}
|
|
13
22
|
|
|
14
23
|
export function getIntrospectionQuery(options?: IntrospectionOptions): string;
|
|
@@ -53,6 +62,7 @@ export interface IntrospectionScalarType {
|
|
|
53
62
|
readonly kind: 'SCALAR';
|
|
54
63
|
readonly name: string;
|
|
55
64
|
readonly description?: Maybe<string>;
|
|
65
|
+
readonly specifiedByUrl?: Maybe<string>;
|
|
56
66
|
}
|
|
57
67
|
|
|
58
68
|
export interface IntrospectionObjectType {
|
|
@@ -14,12 +14,14 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
14
14
|
function getIntrospectionQuery(options) {
|
|
15
15
|
var optionsWithDefault = _objectSpread({
|
|
16
16
|
descriptions: true,
|
|
17
|
+
specifiedByUrl: false,
|
|
17
18
|
directiveIsRepeatable: false,
|
|
18
19
|
schemaDescription: false
|
|
19
20
|
}, options);
|
|
20
21
|
|
|
21
22
|
var descriptions = optionsWithDefault.descriptions ? 'description' : '';
|
|
23
|
+
var specifiedByUrl = optionsWithDefault.specifiedByUrl ? 'specifiedByUrl' : '';
|
|
22
24
|
var directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable ? 'isRepeatable' : '';
|
|
23
25
|
var schemaDescription = optionsWithDefault.schemaDescription ? descriptions : '';
|
|
24
|
-
return "\n query IntrospectionQuery {\n __schema {\n ".concat(schemaDescription, "\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n ").concat(descriptions, "\n ").concat(directiveIsRepeatable, "\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n ").concat(descriptions, "\n fields(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n ").concat(descriptions, "\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n ");
|
|
26
|
+
return "\n query IntrospectionQuery {\n __schema {\n ".concat(schemaDescription, "\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n ").concat(descriptions, "\n ").concat(directiveIsRepeatable, "\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n ").concat(descriptions, "\n ").concat(specifiedByUrl, "\n fields(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n ").concat(descriptions, "\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n ");
|
|
25
27
|
}
|
|
@@ -7,6 +7,10 @@ export type IntrospectionOptions = {|
|
|
|
7
7
|
// Default: true
|
|
8
8
|
descriptions?: boolean,
|
|
9
9
|
|
|
10
|
+
// Whether to include `specifiedByUrl` in the introspection result.
|
|
11
|
+
// Default: false
|
|
12
|
+
specifiedByUrl?: boolean,
|
|
13
|
+
|
|
10
14
|
// Whether to include `isRepeatable` field on directives.
|
|
11
15
|
// Default: false
|
|
12
16
|
directiveIsRepeatable?: boolean,
|
|
@@ -19,12 +23,16 @@ export type IntrospectionOptions = {|
|
|
|
19
23
|
export function getIntrospectionQuery(options?: IntrospectionOptions): string {
|
|
20
24
|
const optionsWithDefault = {
|
|
21
25
|
descriptions: true,
|
|
26
|
+
specifiedByUrl: false,
|
|
22
27
|
directiveIsRepeatable: false,
|
|
23
28
|
schemaDescription: false,
|
|
24
29
|
...options,
|
|
25
30
|
};
|
|
26
31
|
|
|
27
32
|
const descriptions = optionsWithDefault.descriptions ? 'description' : '';
|
|
33
|
+
const specifiedByUrl = optionsWithDefault.specifiedByUrl
|
|
34
|
+
? 'specifiedByUrl'
|
|
35
|
+
: '';
|
|
28
36
|
const directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable
|
|
29
37
|
? 'isRepeatable'
|
|
30
38
|
: '';
|
|
@@ -58,6 +66,7 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
|
|
|
58
66
|
kind
|
|
59
67
|
name
|
|
60
68
|
${descriptions}
|
|
69
|
+
${specifiedByUrl}
|
|
61
70
|
fields(includeDeprecated: true) {
|
|
62
71
|
name
|
|
63
72
|
${descriptions}
|
|
@@ -166,6 +175,7 @@ export type IntrospectionScalarType = {|
|
|
|
166
175
|
+kind: 'SCALAR',
|
|
167
176
|
+name: string,
|
|
168
177
|
+description?: ?string,
|
|
178
|
+
+specifiedByUrl: ?string,
|
|
169
179
|
|};
|
|
170
180
|
|
|
171
181
|
export type IntrospectionObjectType = {|
|
|
@@ -7,12 +7,14 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7
7
|
export function getIntrospectionQuery(options) {
|
|
8
8
|
var optionsWithDefault = _objectSpread({
|
|
9
9
|
descriptions: true,
|
|
10
|
+
specifiedByUrl: false,
|
|
10
11
|
directiveIsRepeatable: false,
|
|
11
12
|
schemaDescription: false
|
|
12
13
|
}, options);
|
|
13
14
|
|
|
14
15
|
var descriptions = optionsWithDefault.descriptions ? 'description' : '';
|
|
16
|
+
var specifiedByUrl = optionsWithDefault.specifiedByUrl ? 'specifiedByUrl' : '';
|
|
15
17
|
var directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable ? 'isRepeatable' : '';
|
|
16
18
|
var schemaDescription = optionsWithDefault.schemaDescription ? descriptions : '';
|
|
17
|
-
return "\n query IntrospectionQuery {\n __schema {\n ".concat(schemaDescription, "\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n ").concat(descriptions, "\n ").concat(directiveIsRepeatable, "\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n ").concat(descriptions, "\n fields(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n ").concat(descriptions, "\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n ");
|
|
19
|
+
return "\n query IntrospectionQuery {\n __schema {\n ".concat(schemaDescription, "\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n ").concat(descriptions, "\n ").concat(directiveIsRepeatable, "\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n ").concat(descriptions, "\n ").concat(specifiedByUrl, "\n fields(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n ").concat(descriptions, "\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n ").concat(descriptions, "\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n ");
|
|
18
20
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import Maybe from '../
|
|
1
|
+
import { Maybe } from '../jsutils/Maybe';
|
|
2
|
+
|
|
2
3
|
import { DocumentNode, OperationDefinitionNode } from '../language/ast';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -8,5 +9,5 @@ import { DocumentNode, OperationDefinitionNode } from '../language/ast';
|
|
|
8
9
|
*/
|
|
9
10
|
export function getOperationAST(
|
|
10
11
|
documentAST: DocumentNode,
|
|
11
|
-
operationName
|
|
12
|
+
operationName?: Maybe<string>,
|
|
12
13
|
): Maybe<OperationDefinitionNode>;
|
|
@@ -43,8 +43,6 @@ function introspectionFromSchema(schema, options) {
|
|
|
43
43
|
schema: schema,
|
|
44
44
|
document: document
|
|
45
45
|
});
|
|
46
|
-
|
|
47
|
-
/* istanbul ignore next */
|
|
48
46
|
!(0, _isPromise.default)(result) && !result.errors && result.data || (0, _invariant.default)(0);
|
|
49
47
|
return result.data;
|
|
50
48
|
}
|