graphql 16.2.0 → 16.3.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/error/GraphQLError.d.ts +17 -1
- package/error/GraphQLError.js +24 -9
- package/error/GraphQLError.mjs +24 -18
- package/execution/collectFields.d.ts +2 -2
- package/execution/collectFields.js +2 -2
- package/execution/collectFields.mjs +1 -1
- package/execution/execute.d.ts +5 -5
- package/execution/execute.js +12 -12
- package/execution/execute.mjs +14 -14
- package/execution/index.d.ts +1 -1
- package/execution/index.js +6 -0
- package/execution/index.mjs +1 -1
- package/execution/subscribe.d.ts +1 -1
- package/execution/subscribe.js +4 -4
- package/execution/subscribe.mjs +2 -2
- package/execution/values.d.ts +3 -5
- package/execution/values.js +4 -6
- package/execution/values.mjs +2 -4
- package/graphql.js +4 -4
- package/graphql.mjs +1 -1
- package/index.d.ts +3 -62
- package/index.js +6 -0
- package/index.mjs +60 -114
- package/jsutils/promiseReduce.mjs +1 -1
- package/language/index.d.ts +0 -1
- package/language/lexer.d.ts +1 -1
- package/language/lexer.js +2 -2
- package/language/lexer.mjs +2 -2
- package/language/parser.d.ts +40 -40
- package/language/parser.js +6 -6
- package/language/parser.mjs +4 -4
- package/language/predicates.d.ts +4 -4
- package/language/printLocation.d.ts +1 -1
- package/language/printLocation.mjs +1 -1
- package/language/printer.js +2 -2
- package/language/printer.mjs +1 -1
- package/language/source.js +2 -2
- package/language/source.mjs +1 -1
- package/language/visitor.js +10 -12
- package/language/visitor.mjs +9 -11
- package/package.json +1 -1
- package/type/assertName.mjs +1 -1
- package/type/definition.d.ts +14 -14
- package/type/definition.js +11 -11
- package/type/definition.mjs +8 -13
- package/type/directives.js +6 -6
- package/type/directives.mjs +4 -4
- package/type/index.d.ts +1 -28
- package/type/index.mjs +23 -42
- package/type/introspection.d.ts +2 -2
- package/type/introspection.js +4 -4
- package/type/introspection.mjs +8 -8
- package/type/scalars.js +2 -2
- package/type/scalars.mjs +1 -1
- package/type/schema.d.ts +3 -3
- package/type/schema.js +6 -6
- package/type/schema.mjs +7 -7
- package/type/validate.js +4 -4
- package/type/validate.mjs +7 -7
- package/utilities/TypeInfo.d.ts +9 -9
- package/utilities/TypeInfo.js +2 -2
- package/utilities/TypeInfo.mjs +7 -7
- package/utilities/astFromValue.js +4 -4
- package/utilities/astFromValue.mjs +3 -3
- package/utilities/buildASTSchema.d.ts +1 -1
- package/utilities/buildASTSchema.js +2 -2
- package/utilities/buildASTSchema.mjs +2 -2
- package/utilities/buildClientSchema.js +7 -7
- package/utilities/buildClientSchema.mjs +15 -15
- package/utilities/coerceInputValue.js +5 -5
- package/utilities/coerceInputValue.mjs +5 -5
- package/utilities/extendSchema.d.ts +1 -1
- package/utilities/extendSchema.js +10 -10
- package/utilities/extendSchema.mjs +31 -31
- package/utilities/findBreakingChanges.js +5 -20
- package/utilities/findBreakingChanges.mjs +9 -20
- package/utilities/getIntrospectionQuery.d.ts +4 -0
- package/utilities/getIntrospectionQuery.js +4 -0
- package/utilities/getIntrospectionQuery.mjs +4 -0
- package/utilities/getOperationRootType.d.ts +1 -1
- package/utilities/index.d.ts +0 -25
- package/utilities/index.mjs +21 -44
- package/utilities/introspectionFromSchema.d.ts +1 -1
- package/utilities/lexicographicSortSchema.js +2 -2
- package/utilities/lexicographicSortSchema.mjs +10 -10
- package/utilities/printSchema.d.ts +1 -1
- package/utilities/printSchema.js +5 -5
- package/utilities/printSchema.mjs +11 -11
- package/utilities/sortValueNode.d.ts +9 -0
- package/utilities/sortValueNode.js +47 -0
- package/utilities/sortValueNode.mjs +39 -0
- package/utilities/stripIgnoredCharacters.js +4 -4
- package/utilities/stripIgnoredCharacters.mjs +3 -3
- package/utilities/typeComparators.d.ts +1 -1
- package/utilities/typeComparators.mjs +3 -3
- package/utilities/typeFromAST.d.ts +4 -4
- package/utilities/typeFromAST.mjs +0 -8
- package/utilities/valueFromAST.d.ts +1 -1
- package/utilities/valueFromAST.js +2 -2
- package/utilities/valueFromAST.mjs +3 -3
- package/utilities/valueFromASTUntyped.d.ts +1 -1
- package/utilities/valueFromASTUntyped.mjs +1 -1
- package/validation/ValidationContext.d.ts +10 -10
- package/validation/index.d.ts +0 -29
- package/validation/index.mjs +29 -58
- package/validation/rules/FieldsOnCorrectTypeRule.js +2 -2
- package/validation/rules/FieldsOnCorrectTypeRule.mjs +3 -3
- package/validation/rules/KnownArgumentNamesRule.d.ts +1 -1
- package/validation/rules/KnownDirectivesRule.d.ts +1 -1
- package/validation/rules/KnownDirectivesRule.js +2 -2
- package/validation/rules/KnownDirectivesRule.mjs +1 -1
- package/validation/rules/KnownTypeNamesRule.d.ts +1 -1
- package/validation/rules/KnownTypeNamesRule.js +2 -2
- package/validation/rules/KnownTypeNamesRule.mjs +1 -1
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js +42 -38
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +42 -41
- package/validation/rules/PossibleFragmentSpreadsRule.js +2 -2
- package/validation/rules/PossibleFragmentSpreadsRule.mjs +1 -1
- package/validation/rules/PossibleTypeExtensionsRule.js +2 -2
- package/validation/rules/PossibleTypeExtensionsRule.mjs +5 -5
- package/validation/rules/ProvidedRequiredArgumentsRule.d.ts +1 -1
- package/validation/rules/ProvidedRequiredArgumentsRule.js +2 -2
- package/validation/rules/ProvidedRequiredArgumentsRule.mjs +1 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +2 -2
- package/validation/rules/ValuesOfCorrectTypeRule.js +2 -2
- package/validation/rules/ValuesOfCorrectTypeRule.mjs +5 -5
- package/validation/rules/VariablesInAllowedPositionRule.js +2 -2
- package/validation/rules/VariablesInAllowedPositionRule.mjs +1 -1
- package/validation/specifiedRules.d.ts +1 -1
- package/validation/specifiedRules.js +47 -47
- package/validation/specifiedRules.mjs +41 -41
- package/version.js +2 -2
- package/version.mjs +2 -2
|
@@ -6,33 +6,33 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
exports.extendSchema = extendSchema;
|
|
7
7
|
exports.extendSchemaImpl = extendSchemaImpl;
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _devAssert = require('../jsutils/devAssert.js');
|
|
10
10
|
|
|
11
11
|
var _inspect = require('../jsutils/inspect.js');
|
|
12
12
|
|
|
13
|
-
var _mapValue = require('../jsutils/mapValue.js');
|
|
14
|
-
|
|
15
13
|
var _invariant = require('../jsutils/invariant.js');
|
|
16
14
|
|
|
17
|
-
var
|
|
15
|
+
var _keyMap = require('../jsutils/keyMap.js');
|
|
16
|
+
|
|
17
|
+
var _mapValue = require('../jsutils/mapValue.js');
|
|
18
18
|
|
|
19
19
|
var _kinds = require('../language/kinds.js');
|
|
20
20
|
|
|
21
21
|
var _predicates = require('../language/predicates.js');
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _definition = require('../type/definition.js');
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var _directives = require('../type/directives.js');
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _introspection = require('../type/introspection.js');
|
|
28
28
|
|
|
29
29
|
var _scalars = require('../type/scalars.js');
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _schema = require('../type/schema.js');
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _validate = require('../validation/validate.js');
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _values = require('../execution/values.js');
|
|
36
36
|
|
|
37
37
|
var _valueFromAST = require('./valueFromAST.js');
|
|
38
38
|
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { devAssert } from '../jsutils/devAssert.mjs';
|
|
2
2
|
import { inspect } from '../jsutils/inspect.mjs';
|
|
3
|
-
import { mapValue } from '../jsutils/mapValue.mjs';
|
|
4
3
|
import { invariant } from '../jsutils/invariant.mjs';
|
|
5
|
-
import {
|
|
4
|
+
import { keyMap } from '../jsutils/keyMap.mjs';
|
|
5
|
+
import { mapValue } from '../jsutils/mapValue.mjs';
|
|
6
6
|
import { Kind } from '../language/kinds.mjs';
|
|
7
7
|
import {
|
|
8
8
|
isTypeDefinitionNode,
|
|
9
9
|
isTypeExtensionNode,
|
|
10
10
|
} from '../language/predicates.mjs';
|
|
11
|
-
import { assertValidSDLExtension } from '../validation/validate.mjs';
|
|
12
|
-
import { getDirectiveValues } from '../execution/values.mjs';
|
|
13
|
-
import { assertSchema, GraphQLSchema } from '../type/schema.mjs';
|
|
14
|
-
import {
|
|
15
|
-
specifiedScalarTypes,
|
|
16
|
-
isSpecifiedScalarType,
|
|
17
|
-
} from '../type/scalars.mjs';
|
|
18
11
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import {
|
|
23
|
-
GraphQLDirective,
|
|
24
|
-
GraphQLDeprecatedDirective,
|
|
25
|
-
GraphQLSpecifiedByDirective,
|
|
26
|
-
} from '../type/directives.mjs';
|
|
27
|
-
import {
|
|
28
|
-
isScalarType,
|
|
29
|
-
isObjectType,
|
|
30
|
-
isInterfaceType,
|
|
31
|
-
isUnionType,
|
|
32
|
-
isListType,
|
|
33
|
-
isNonNullType,
|
|
34
|
-
isEnumType,
|
|
35
|
-
isInputObjectType,
|
|
12
|
+
GraphQLEnumType,
|
|
13
|
+
GraphQLInputObjectType,
|
|
14
|
+
GraphQLInterfaceType,
|
|
36
15
|
GraphQLList,
|
|
37
16
|
GraphQLNonNull,
|
|
38
|
-
GraphQLScalarType,
|
|
39
17
|
GraphQLObjectType,
|
|
40
|
-
|
|
18
|
+
GraphQLScalarType,
|
|
41
19
|
GraphQLUnionType,
|
|
42
|
-
|
|
43
|
-
|
|
20
|
+
isEnumType,
|
|
21
|
+
isInputObjectType,
|
|
22
|
+
isInterfaceType,
|
|
23
|
+
isListType,
|
|
24
|
+
isNonNullType,
|
|
25
|
+
isObjectType,
|
|
26
|
+
isScalarType,
|
|
27
|
+
isUnionType,
|
|
44
28
|
} from '../type/definition.mjs';
|
|
29
|
+
import {
|
|
30
|
+
GraphQLDeprecatedDirective,
|
|
31
|
+
GraphQLDirective,
|
|
32
|
+
GraphQLSpecifiedByDirective,
|
|
33
|
+
} from '../type/directives.mjs';
|
|
34
|
+
import {
|
|
35
|
+
introspectionTypes,
|
|
36
|
+
isIntrospectionType,
|
|
37
|
+
} from '../type/introspection.mjs';
|
|
38
|
+
import {
|
|
39
|
+
isSpecifiedScalarType,
|
|
40
|
+
specifiedScalarTypes,
|
|
41
|
+
} from '../type/scalars.mjs';
|
|
42
|
+
import { assertSchema, GraphQLSchema } from '../type/schema.mjs';
|
|
43
|
+
import { assertValidSDLExtension } from '../validation/validate.mjs';
|
|
44
|
+
import { getDirectiveValues } from '../execution/values.mjs';
|
|
45
45
|
import { valueFromAST } from './valueFromAST.mjs';
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -7,24 +7,22 @@ exports.DangerousChangeType = exports.BreakingChangeType = void 0;
|
|
|
7
7
|
exports.findBreakingChanges = findBreakingChanges;
|
|
8
8
|
exports.findDangerousChanges = findDangerousChanges;
|
|
9
9
|
|
|
10
|
-
var _keyMap = require('../jsutils/keyMap.js');
|
|
11
|
-
|
|
12
10
|
var _inspect = require('../jsutils/inspect.js');
|
|
13
11
|
|
|
14
12
|
var _invariant = require('../jsutils/invariant.js');
|
|
15
13
|
|
|
16
|
-
var
|
|
14
|
+
var _keyMap = require('../jsutils/keyMap.js');
|
|
17
15
|
|
|
18
16
|
var _printer = require('../language/printer.js');
|
|
19
17
|
|
|
20
|
-
var
|
|
18
|
+
var _definition = require('../type/definition.js');
|
|
21
19
|
|
|
22
20
|
var _scalars = require('../type/scalars.js');
|
|
23
21
|
|
|
24
|
-
var _definition = require('../type/definition.js');
|
|
25
|
-
|
|
26
22
|
var _astFromValue = require('./astFromValue.js');
|
|
27
23
|
|
|
24
|
+
var _sortValueNode = require('./sortValueNode.js');
|
|
25
|
+
|
|
28
26
|
let BreakingChangeType;
|
|
29
27
|
exports.BreakingChangeType = BreakingChangeType;
|
|
30
28
|
|
|
@@ -515,20 +513,7 @@ function typeKindName(type) {
|
|
|
515
513
|
function stringifyValue(value, type) {
|
|
516
514
|
const ast = (0, _astFromValue.astFromValue)(value, type);
|
|
517
515
|
ast != null || (0, _invariant.invariant)(false);
|
|
518
|
-
|
|
519
|
-
ObjectValue(objectNode) {
|
|
520
|
-
// Make a copy since sort mutates array
|
|
521
|
-
const fields = [...objectNode.fields];
|
|
522
|
-
fields.sort((fieldA, fieldB) =>
|
|
523
|
-
(0, _naturalCompare.naturalCompare)(
|
|
524
|
-
fieldA.name.value,
|
|
525
|
-
fieldB.name.value,
|
|
526
|
-
),
|
|
527
|
-
);
|
|
528
|
-
return { ...objectNode, fields };
|
|
529
|
-
},
|
|
530
|
-
});
|
|
531
|
-
return (0, _printer.print)(sortedAST);
|
|
516
|
+
return (0, _printer.print)((0, _sortValueNode.sortValueNode)(ast));
|
|
532
517
|
}
|
|
533
518
|
|
|
534
519
|
function diff(oldArray, newArray) {
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { keyMap } from '../jsutils/keyMap.mjs';
|
|
2
1
|
import { inspect } from '../jsutils/inspect.mjs';
|
|
3
2
|
import { invariant } from '../jsutils/invariant.mjs';
|
|
4
|
-
import {
|
|
3
|
+
import { keyMap } from '../jsutils/keyMap.mjs';
|
|
5
4
|
import { print } from '../language/printer.mjs';
|
|
6
|
-
import { visit } from '../language/visitor.mjs';
|
|
7
|
-
import { isSpecifiedScalarType } from '../type/scalars.mjs';
|
|
8
5
|
import {
|
|
9
|
-
isScalarType,
|
|
10
|
-
isObjectType,
|
|
11
|
-
isInterfaceType,
|
|
12
|
-
isUnionType,
|
|
13
6
|
isEnumType,
|
|
14
7
|
isInputObjectType,
|
|
15
|
-
|
|
8
|
+
isInterfaceType,
|
|
16
9
|
isListType,
|
|
17
10
|
isNamedType,
|
|
11
|
+
isNonNullType,
|
|
12
|
+
isObjectType,
|
|
18
13
|
isRequiredArgument,
|
|
19
14
|
isRequiredInputField,
|
|
15
|
+
isScalarType,
|
|
16
|
+
isUnionType,
|
|
20
17
|
} from '../type/definition.mjs';
|
|
18
|
+
import { isSpecifiedScalarType } from '../type/scalars.mjs';
|
|
21
19
|
import { astFromValue } from './astFromValue.mjs';
|
|
20
|
+
import { sortValueNode } from './sortValueNode.mjs';
|
|
22
21
|
export let BreakingChangeType;
|
|
23
22
|
|
|
24
23
|
(function (BreakingChangeType) {
|
|
@@ -483,17 +482,7 @@ function typeKindName(type) {
|
|
|
483
482
|
function stringifyValue(value, type) {
|
|
484
483
|
const ast = astFromValue(value, type);
|
|
485
484
|
ast != null || invariant(false);
|
|
486
|
-
|
|
487
|
-
ObjectValue(objectNode) {
|
|
488
|
-
// Make a copy since sort mutates array
|
|
489
|
-
const fields = [...objectNode.fields];
|
|
490
|
-
fields.sort((fieldA, fieldB) =>
|
|
491
|
-
naturalCompare(fieldA.name.value, fieldB.name.value),
|
|
492
|
-
);
|
|
493
|
-
return { ...objectNode, fields };
|
|
494
|
-
},
|
|
495
|
-
});
|
|
496
|
-
return print(sortedAST);
|
|
485
|
+
return print(sortValueNode(ast));
|
|
497
486
|
}
|
|
498
487
|
|
|
499
488
|
function diff(oldArray, newArray) {
|
|
@@ -27,6 +27,10 @@ export interface IntrospectionOptions {
|
|
|
27
27
|
*/
|
|
28
28
|
inputValueDeprecation?: boolean;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Produce the GraphQL query recommended for a full schema introspection.
|
|
32
|
+
* Accepts optional IntrospectionOptions.
|
|
33
|
+
*/
|
|
30
34
|
export declare function getIntrospectionQuery(
|
|
31
35
|
options?: IntrospectionOptions,
|
|
32
36
|
): string;
|
|
@@ -5,6 +5,10 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getIntrospectionQuery = getIntrospectionQuery;
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Produce the GraphQL query recommended for a full schema introspection.
|
|
10
|
+
* Accepts optional IntrospectionOptions.
|
|
11
|
+
*/
|
|
8
12
|
function getIntrospectionQuery(options) {
|
|
9
13
|
const optionsWithDefault = {
|
|
10
14
|
descriptions: true,
|
|
@@ -2,8 +2,8 @@ import type {
|
|
|
2
2
|
OperationDefinitionNode,
|
|
3
3
|
OperationTypeDefinitionNode,
|
|
4
4
|
} from '../language/ast';
|
|
5
|
-
import type { GraphQLSchema } from '../type/schema';
|
|
6
5
|
import type { GraphQLObjectType } from '../type/definition';
|
|
6
|
+
import type { GraphQLSchema } from '../type/schema';
|
|
7
7
|
/**
|
|
8
8
|
* Extracts the root type of the operation from the schema.
|
|
9
9
|
*
|
package/utilities/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Produce the GraphQL query recommended for a full schema introspection.
|
|
3
|
-
* Accepts optional IntrospectionOptions.
|
|
4
|
-
*/
|
|
5
1
|
export { getIntrospectionQuery } from './getIntrospectionQuery';
|
|
6
2
|
export type {
|
|
7
3
|
IntrospectionOptions,
|
|
@@ -27,54 +23,34 @@ export type {
|
|
|
27
23
|
IntrospectionEnumValue,
|
|
28
24
|
IntrospectionDirective,
|
|
29
25
|
} from './getIntrospectionQuery';
|
|
30
|
-
/** Gets the target Operation from a Document. */
|
|
31
26
|
export { getOperationAST } from './getOperationAST';
|
|
32
|
-
/** Gets the Type for the target Operation AST. */
|
|
33
27
|
export { getOperationRootType } from './getOperationRootType';
|
|
34
|
-
/** Convert a GraphQLSchema to an IntrospectionQuery. */
|
|
35
28
|
export { introspectionFromSchema } from './introspectionFromSchema';
|
|
36
|
-
/** Build a GraphQLSchema from an introspection result. */
|
|
37
29
|
export { buildClientSchema } from './buildClientSchema';
|
|
38
|
-
/** Build a GraphQLSchema from GraphQL Schema language. */
|
|
39
30
|
export { buildASTSchema, buildSchema } from './buildASTSchema';
|
|
40
31
|
export type { BuildSchemaOptions } from './buildASTSchema';
|
|
41
|
-
/** Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. */
|
|
42
32
|
export { extendSchema } from './extendSchema';
|
|
43
|
-
/** Sort a GraphQLSchema. */
|
|
44
33
|
export { lexicographicSortSchema } from './lexicographicSortSchema';
|
|
45
|
-
/** Print a GraphQLSchema to GraphQL Schema language. */
|
|
46
34
|
export {
|
|
47
35
|
printSchema,
|
|
48
36
|
printType,
|
|
49
37
|
printIntrospectionSchema,
|
|
50
38
|
} from './printSchema';
|
|
51
|
-
/** Create a GraphQLType from a GraphQL language AST. */
|
|
52
39
|
export { typeFromAST } from './typeFromAST';
|
|
53
|
-
/** Create a JavaScript value from a GraphQL language AST with a type. */
|
|
54
40
|
export { valueFromAST } from './valueFromAST';
|
|
55
|
-
/** Create a JavaScript value from a GraphQL language AST without a type. */
|
|
56
41
|
export { valueFromASTUntyped } from './valueFromASTUntyped';
|
|
57
|
-
/** Create a GraphQL language AST from a JavaScript value. */
|
|
58
42
|
export { astFromValue } from './astFromValue';
|
|
59
|
-
/** A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system. */
|
|
60
43
|
export { TypeInfo, visitWithTypeInfo } from './TypeInfo';
|
|
61
|
-
/** Coerces a JavaScript value to a GraphQL type, or produces errors. */
|
|
62
44
|
export { coerceInputValue } from './coerceInputValue';
|
|
63
|
-
/** Concatenates multiple AST together. */
|
|
64
45
|
export { concatAST } from './concatAST';
|
|
65
|
-
/** Separates an AST into an AST per Operation. */
|
|
66
46
|
export { separateOperations } from './separateOperations';
|
|
67
|
-
/** Strips characters that are not significant to the validity or execution of a GraphQL document. */
|
|
68
47
|
export { stripIgnoredCharacters } from './stripIgnoredCharacters';
|
|
69
|
-
/** Comparators for types */
|
|
70
48
|
export {
|
|
71
49
|
isEqualType,
|
|
72
50
|
isTypeSubTypeOf,
|
|
73
51
|
doTypesOverlap,
|
|
74
52
|
} from './typeComparators';
|
|
75
|
-
/** Asserts that a string is a valid GraphQL name */
|
|
76
53
|
export { assertValidName, isValidNameError } from './assertValidName';
|
|
77
|
-
/** Compares two GraphQLSchemas and detects breaking changes. */
|
|
78
54
|
export {
|
|
79
55
|
BreakingChangeType,
|
|
80
56
|
DangerousChangeType,
|
|
@@ -82,5 +58,4 @@ export {
|
|
|
82
58
|
findDangerousChanges,
|
|
83
59
|
} from './findBreakingChanges';
|
|
84
60
|
export type { BreakingChange, DangerousChange } from './findBreakingChanges';
|
|
85
|
-
/** Wrapper type that contains DocumentNode and types that can be deduced from it. */
|
|
86
61
|
export type { TypedQueryDocumentNode } from './typedQueryDocumentNode';
|
package/utilities/index.mjs
CHANGED
|
@@ -1,74 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
* Produce the GraphQL query recommended for a full schema introspection.
|
|
3
|
-
* Accepts optional IntrospectionOptions.
|
|
4
|
-
*/
|
|
1
|
+
// Produce the GraphQL query recommended for a full schema introspection.
|
|
5
2
|
export { getIntrospectionQuery } from './getIntrospectionQuery.mjs';
|
|
3
|
+
// Gets the target Operation from a Document.
|
|
4
|
+
export { getOperationAST } from './getOperationAST.mjs'; // Gets the Type for the target Operation AST.
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
export { getOperationAST } from './getOperationAST.mjs';
|
|
9
|
-
/** Gets the Type for the target Operation AST. */
|
|
6
|
+
export { getOperationRootType } from './getOperationRootType.mjs'; // Convert a GraphQLSchema to an IntrospectionQuery.
|
|
10
7
|
|
|
11
|
-
export {
|
|
12
|
-
/** Convert a GraphQLSchema to an IntrospectionQuery. */
|
|
8
|
+
export { introspectionFromSchema } from './introspectionFromSchema.mjs'; // Build a GraphQLSchema from an introspection result.
|
|
13
9
|
|
|
14
|
-
export {
|
|
15
|
-
/** Build a GraphQLSchema from an introspection result. */
|
|
16
|
-
|
|
17
|
-
export { buildClientSchema } from './buildClientSchema.mjs';
|
|
18
|
-
/** Build a GraphQLSchema from GraphQL Schema language. */
|
|
10
|
+
export { buildClientSchema } from './buildClientSchema.mjs'; // Build a GraphQLSchema from GraphQL Schema language.
|
|
19
11
|
|
|
20
12
|
export { buildASTSchema, buildSchema } from './buildASTSchema.mjs';
|
|
13
|
+
// Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST.
|
|
14
|
+
export { extendSchema } from './extendSchema.mjs'; // Sort a GraphQLSchema.
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
export { extendSchema } from './extendSchema.mjs';
|
|
24
|
-
/** Sort a GraphQLSchema. */
|
|
25
|
-
|
|
26
|
-
export { lexicographicSortSchema } from './lexicographicSortSchema.mjs';
|
|
27
|
-
/** Print a GraphQLSchema to GraphQL Schema language. */
|
|
16
|
+
export { lexicographicSortSchema } from './lexicographicSortSchema.mjs'; // Print a GraphQLSchema to GraphQL Schema language.
|
|
28
17
|
|
|
29
18
|
export {
|
|
30
19
|
printSchema,
|
|
31
20
|
printType,
|
|
32
21
|
printIntrospectionSchema,
|
|
33
|
-
} from './printSchema.mjs';
|
|
34
|
-
/** Create a GraphQLType from a GraphQL language AST. */
|
|
22
|
+
} from './printSchema.mjs'; // Create a GraphQLType from a GraphQL language AST.
|
|
35
23
|
|
|
36
|
-
export { typeFromAST } from './typeFromAST.mjs';
|
|
37
|
-
/** Create a JavaScript value from a GraphQL language AST with a type. */
|
|
24
|
+
export { typeFromAST } from './typeFromAST.mjs'; // Create a JavaScript value from a GraphQL language AST with a type.
|
|
38
25
|
|
|
39
|
-
export { valueFromAST } from './valueFromAST.mjs';
|
|
40
|
-
/** Create a JavaScript value from a GraphQL language AST without a type. */
|
|
26
|
+
export { valueFromAST } from './valueFromAST.mjs'; // Create a JavaScript value from a GraphQL language AST without a type.
|
|
41
27
|
|
|
42
|
-
export { valueFromASTUntyped } from './valueFromASTUntyped.mjs';
|
|
43
|
-
/** Create a GraphQL language AST from a JavaScript value. */
|
|
28
|
+
export { valueFromASTUntyped } from './valueFromASTUntyped.mjs'; // Create a GraphQL language AST from a JavaScript value.
|
|
44
29
|
|
|
45
|
-
export { astFromValue } from './astFromValue.mjs';
|
|
46
|
-
/** A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system. */
|
|
30
|
+
export { astFromValue } from './astFromValue.mjs'; // A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system.
|
|
47
31
|
|
|
48
|
-
export { TypeInfo, visitWithTypeInfo } from './TypeInfo.mjs';
|
|
49
|
-
/** Coerces a JavaScript value to a GraphQL type, or produces errors. */
|
|
32
|
+
export { TypeInfo, visitWithTypeInfo } from './TypeInfo.mjs'; // Coerces a JavaScript value to a GraphQL type, or produces errors.
|
|
50
33
|
|
|
51
|
-
export { coerceInputValue } from './coerceInputValue.mjs';
|
|
52
|
-
/** Concatenates multiple AST together. */
|
|
34
|
+
export { coerceInputValue } from './coerceInputValue.mjs'; // Concatenates multiple AST together.
|
|
53
35
|
|
|
54
|
-
export { concatAST } from './concatAST.mjs';
|
|
55
|
-
/** Separates an AST into an AST per Operation. */
|
|
36
|
+
export { concatAST } from './concatAST.mjs'; // Separates an AST into an AST per Operation.
|
|
56
37
|
|
|
57
|
-
export { separateOperations } from './separateOperations.mjs';
|
|
58
|
-
/** Strips characters that are not significant to the validity or execution of a GraphQL document. */
|
|
38
|
+
export { separateOperations } from './separateOperations.mjs'; // Strips characters that are not significant to the validity or execution of a GraphQL document.
|
|
59
39
|
|
|
60
|
-
export { stripIgnoredCharacters } from './stripIgnoredCharacters.mjs';
|
|
61
|
-
/** Comparators for types */
|
|
40
|
+
export { stripIgnoredCharacters } from './stripIgnoredCharacters.mjs'; // Comparators for types
|
|
62
41
|
|
|
63
42
|
export {
|
|
64
43
|
isEqualType,
|
|
65
44
|
isTypeSubTypeOf,
|
|
66
45
|
doTypesOverlap,
|
|
67
|
-
} from './typeComparators.mjs';
|
|
68
|
-
/** Asserts that a string is a valid GraphQL name */
|
|
46
|
+
} from './typeComparators.mjs'; // Asserts that a string is a valid GraphQL name
|
|
69
47
|
|
|
70
|
-
export { assertValidName, isValidNameError } from './assertValidName.mjs';
|
|
71
|
-
/** Compares two GraphQLSchemas and detects breaking changes. */
|
|
48
|
+
export { assertValidName, isValidNameError } from './assertValidName.mjs'; // Compares two GraphQLSchemas and detects breaking changes.
|
|
72
49
|
|
|
73
50
|
export {
|
|
74
51
|
BreakingChangeType,
|
|
@@ -13,13 +13,13 @@ var _keyValMap = require('../jsutils/keyValMap.js');
|
|
|
13
13
|
|
|
14
14
|
var _naturalCompare = require('../jsutils/naturalCompare.js');
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _definition = require('../type/definition.js');
|
|
17
17
|
|
|
18
18
|
var _directives = require('../type/directives.js');
|
|
19
19
|
|
|
20
20
|
var _introspection = require('../type/introspection.js');
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _schema = require('../type/schema.js');
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Sort GraphQLSchema.
|
|
@@ -2,26 +2,26 @@ import { inspect } from '../jsutils/inspect.mjs';
|
|
|
2
2
|
import { invariant } from '../jsutils/invariant.mjs';
|
|
3
3
|
import { keyValMap } from '../jsutils/keyValMap.mjs';
|
|
4
4
|
import { naturalCompare } from '../jsutils/naturalCompare.mjs';
|
|
5
|
-
import { GraphQLSchema } from '../type/schema.mjs';
|
|
6
|
-
import { GraphQLDirective } from '../type/directives.mjs';
|
|
7
|
-
import { isIntrospectionType } from '../type/introspection.mjs';
|
|
8
5
|
import {
|
|
6
|
+
GraphQLEnumType,
|
|
7
|
+
GraphQLInputObjectType,
|
|
8
|
+
GraphQLInterfaceType,
|
|
9
9
|
GraphQLList,
|
|
10
10
|
GraphQLNonNull,
|
|
11
11
|
GraphQLObjectType,
|
|
12
|
-
GraphQLInterfaceType,
|
|
13
12
|
GraphQLUnionType,
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
isEnumType,
|
|
14
|
+
isInputObjectType,
|
|
15
|
+
isInterfaceType,
|
|
16
16
|
isListType,
|
|
17
17
|
isNonNullType,
|
|
18
|
-
isScalarType,
|
|
19
18
|
isObjectType,
|
|
20
|
-
|
|
19
|
+
isScalarType,
|
|
21
20
|
isUnionType,
|
|
22
|
-
isEnumType,
|
|
23
|
-
isInputObjectType,
|
|
24
21
|
} from '../type/definition.mjs';
|
|
22
|
+
import { GraphQLDirective } from '../type/directives.mjs';
|
|
23
|
+
import { isIntrospectionType } from '../type/introspection.mjs';
|
|
24
|
+
import { GraphQLSchema } from '../type/schema.mjs';
|
|
25
25
|
/**
|
|
26
26
|
* Sort GraphQLSchema.
|
|
27
27
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GraphQLSchema } from '../type/schema';
|
|
2
1
|
import type { GraphQLNamedType } from '../type/definition';
|
|
2
|
+
import type { GraphQLSchema } from '../type/schema';
|
|
3
3
|
export declare function printSchema(schema: GraphQLSchema): string;
|
|
4
4
|
export declare function printIntrospectionSchema(schema: GraphQLSchema): string;
|
|
5
5
|
export declare function printType(type: GraphQLNamedType): string;
|
package/utilities/printSchema.js
CHANGED
|
@@ -11,20 +11,20 @@ var _inspect = require('../jsutils/inspect.js');
|
|
|
11
11
|
|
|
12
12
|
var _invariant = require('../jsutils/invariant.js');
|
|
13
13
|
|
|
14
|
+
var _blockString = require('../language/blockString.js');
|
|
15
|
+
|
|
14
16
|
var _kinds = require('../language/kinds.js');
|
|
15
17
|
|
|
16
18
|
var _printer = require('../language/printer.js');
|
|
17
19
|
|
|
18
|
-
var
|
|
20
|
+
var _definition = require('../type/definition.js');
|
|
21
|
+
|
|
22
|
+
var _directives = require('../type/directives.js');
|
|
19
23
|
|
|
20
24
|
var _introspection = require('../type/introspection.js');
|
|
21
25
|
|
|
22
26
|
var _scalars = require('../type/scalars.js');
|
|
23
27
|
|
|
24
|
-
var _directives = require('../type/directives.js');
|
|
25
|
-
|
|
26
|
-
var _definition = require('../type/definition.js');
|
|
27
|
-
|
|
28
28
|
var _astFromValue = require('./astFromValue.js');
|
|
29
29
|
|
|
30
30
|
function printSchema(schema) {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { inspect } from '../jsutils/inspect.mjs';
|
|
2
2
|
import { invariant } from '../jsutils/invariant.mjs';
|
|
3
|
+
import { isPrintableAsBlockString } from '../language/blockString.mjs';
|
|
3
4
|
import { Kind } from '../language/kinds.mjs';
|
|
4
5
|
import { print } from '../language/printer.mjs';
|
|
5
|
-
import { isPrintableAsBlockString } from '../language/blockString.mjs';
|
|
6
|
-
import { isIntrospectionType } from '../type/introspection.mjs';
|
|
7
|
-
import { isSpecifiedScalarType } from '../type/scalars.mjs';
|
|
8
6
|
import {
|
|
9
|
-
DEFAULT_DEPRECATION_REASON,
|
|
10
|
-
isSpecifiedDirective,
|
|
11
|
-
} from '../type/directives.mjs';
|
|
12
|
-
import {
|
|
13
|
-
isScalarType,
|
|
14
|
-
isObjectType,
|
|
15
|
-
isInterfaceType,
|
|
16
|
-
isUnionType,
|
|
17
7
|
isEnumType,
|
|
18
8
|
isInputObjectType,
|
|
9
|
+
isInterfaceType,
|
|
10
|
+
isObjectType,
|
|
11
|
+
isScalarType,
|
|
12
|
+
isUnionType,
|
|
19
13
|
} from '../type/definition.mjs';
|
|
14
|
+
import {
|
|
15
|
+
DEFAULT_DEPRECATION_REASON,
|
|
16
|
+
isSpecifiedDirective,
|
|
17
|
+
} from '../type/directives.mjs';
|
|
18
|
+
import { isIntrospectionType } from '../type/introspection.mjs';
|
|
19
|
+
import { isSpecifiedScalarType } from '../type/scalars.mjs';
|
|
20
20
|
import { astFromValue } from './astFromValue.mjs';
|
|
21
21
|
export function printSchema(schema) {
|
|
22
22
|
return printFilteredSchema(
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
exports.sortValueNode = sortValueNode;
|
|
7
|
+
|
|
8
|
+
var _naturalCompare = require('../jsutils/naturalCompare.js');
|
|
9
|
+
|
|
10
|
+
var _kinds = require('../language/kinds.js');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Sort ValueNode.
|
|
14
|
+
*
|
|
15
|
+
* This function returns a sorted copy of the given ValueNode.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
function sortValueNode(valueNode) {
|
|
20
|
+
switch (valueNode.kind) {
|
|
21
|
+
case _kinds.Kind.OBJECT:
|
|
22
|
+
return { ...valueNode, fields: sortFields(valueNode.fields) };
|
|
23
|
+
|
|
24
|
+
case _kinds.Kind.LIST:
|
|
25
|
+
return { ...valueNode, values: valueNode.values.map(sortValueNode) };
|
|
26
|
+
|
|
27
|
+
case _kinds.Kind.INT:
|
|
28
|
+
case _kinds.Kind.FLOAT:
|
|
29
|
+
case _kinds.Kind.STRING:
|
|
30
|
+
case _kinds.Kind.BOOLEAN:
|
|
31
|
+
case _kinds.Kind.NULL:
|
|
32
|
+
case _kinds.Kind.ENUM:
|
|
33
|
+
case _kinds.Kind.VARIABLE:
|
|
34
|
+
return valueNode;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function sortFields(fields) {
|
|
39
|
+
return fields
|
|
40
|
+
.map((fieldNode) => ({
|
|
41
|
+
...fieldNode,
|
|
42
|
+
value: sortValueNode(fieldNode.value),
|
|
43
|
+
}))
|
|
44
|
+
.sort((fieldA, fieldB) =>
|
|
45
|
+
(0, _naturalCompare.naturalCompare)(fieldA.name.value, fieldB.name.value),
|
|
46
|
+
);
|
|
47
|
+
}
|