graphql 16.0.1 → 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/README.md +4 -4
- package/error/GraphQLError.d.ts +17 -1
- package/error/GraphQLError.js +28 -10
- package/error/GraphQLError.mjs +28 -19
- package/error/locatedError.js +2 -8
- package/error/locatedError.mjs +2 -6
- package/execution/collectFields.d.ts +8 -8
- package/execution/collectFields.js +8 -8
- package/execution/collectFields.mjs +7 -7
- package/execution/execute.d.ts +5 -5
- package/execution/execute.js +28 -17
- package/execution/execute.mjs +30 -19
- package/execution/index.d.ts +1 -1
- package/execution/index.js +6 -0
- package/execution/index.mjs +1 -1
- package/execution/mapAsyncIterator.js +3 -1
- package/execution/mapAsyncIterator.mjs +3 -1
- package/execution/subscribe.d.ts +1 -1
- package/execution/subscribe.js +10 -2
- package/execution/subscribe.mjs +8 -1
- package/execution/values.d.ts +3 -5
- package/execution/values.js +7 -8
- package/execution/values.mjs +5 -6
- package/graphql.js +12 -4
- package/graphql.mjs +8 -1
- package/index.d.ts +7 -61
- package/index.js +30 -0
- package/index.mjs +62 -111
- package/jsutils/devAssert.js +1 -1
- package/jsutils/devAssert.mjs +1 -1
- package/jsutils/instanceOf.js +3 -1
- package/jsutils/instanceOf.mjs +3 -1
- package/jsutils/invariant.js +1 -1
- package/jsutils/invariant.mjs +1 -1
- package/jsutils/mapValue.js +2 -2
- package/jsutils/mapValue.mjs +2 -2
- package/jsutils/promiseReduce.mjs +1 -1
- package/jsutils/toError.d.ts +4 -0
- package/jsutils/toError.js +25 -0
- package/jsutils/toError.mjs +18 -0
- package/language/blockString.d.ts +7 -3
- package/language/blockString.js +121 -64
- package/language/blockString.mjs +111 -62
- package/language/characterClasses.d.ts +9 -0
- package/language/characterClasses.js +13 -0
- package/language/characterClasses.mjs +12 -0
- package/language/index.d.ts +0 -1
- package/language/lexer.d.ts +1 -1
- package/language/lexer.js +23 -15
- package/language/lexer.mjs +23 -15
- package/language/parser.d.ts +40 -40
- package/language/parser.js +9 -8
- package/language/parser.mjs +7 -6
- package/language/predicates.d.ts +4 -4
- package/language/printLocation.d.ts +1 -1
- package/language/printLocation.mjs +1 -1
- package/language/printer.js +5 -3
- package/language/printer.mjs +4 -2
- package/language/source.js +2 -2
- package/language/source.mjs +1 -1
- package/language/visitor.js +12 -13
- package/language/visitor.mjs +11 -12
- package/package.json +4 -1
- package/type/assertName.mjs +1 -1
- package/type/definition.d.ts +18 -14
- package/type/definition.js +13 -11
- package/type/definition.mjs +10 -16
- package/type/directives.d.ts +1 -1
- package/type/directives.js +9 -9
- package/type/directives.mjs +7 -7
- package/type/index.d.ts +5 -27
- package/type/index.js +24 -0
- package/type/index.mjs +26 -40
- package/type/introspection.d.ts +2 -2
- package/type/introspection.js +12 -8
- package/type/introspection.mjs +16 -12
- package/type/scalars.d.ts +10 -0
- package/type/scalars.js +20 -12
- package/type/scalars.mjs +17 -12
- package/type/schema.d.ts +4 -4
- package/type/schema.js +11 -9
- package/type/schema.mjs +11 -10
- package/type/validate.js +39 -30
- package/type/validate.mjs +42 -33
- package/utilities/TypeInfo.d.ts +9 -9
- package/utilities/TypeInfo.js +6 -2
- package/utilities/TypeInfo.mjs +11 -7
- package/utilities/assertValidName.js +3 -2
- package/utilities/assertValidName.mjs +3 -2
- package/utilities/astFromValue.js +8 -6
- package/utilities/astFromValue.mjs +7 -5
- package/utilities/buildASTSchema.d.ts +1 -1
- package/utilities/buildASTSchema.js +2 -2
- package/utilities/buildASTSchema.mjs +2 -2
- package/utilities/buildClientSchema.js +9 -7
- package/utilities/buildClientSchema.mjs +17 -15
- package/utilities/coerceInputValue.js +9 -7
- package/utilities/coerceInputValue.mjs +9 -7
- package/utilities/extendSchema.d.ts +1 -1
- package/utilities/extendSchema.js +50 -42
- package/utilities/extendSchema.mjs +71 -60
- package/utilities/findBreakingChanges.js +9 -22
- package/utilities/findBreakingChanges.mjs +13 -22
- 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 +8 -7
- package/utilities/lexicographicSortSchema.mjs +16 -15
- package/utilities/printSchema.d.ts +1 -1
- package/utilities/printSchema.js +14 -12
- package/utilities/printSchema.mjs +20 -15
- package/utilities/separateOperations.js +2 -0
- package/utilities/separateOperations.mjs +2 -0
- package/utilities/sortValueNode.d.ts +9 -0
- package/utilities/sortValueNode.js +47 -0
- package/utilities/sortValueNode.mjs +39 -0
- package/utilities/stripIgnoredCharacters.js +7 -23
- package/utilities/stripIgnoredCharacters.mjs +6 -25
- package/utilities/typeComparators.d.ts +1 -1
- package/utilities/typeComparators.mjs +3 -3
- package/utilities/typeFromAST.d.ts +4 -4
- package/utilities/typeFromAST.js +13 -24
- package/utilities/typeFromAST.mjs +12 -25
- package/utilities/valueFromAST.d.ts +1 -1
- package/utilities/valueFromAST.js +6 -4
- package/utilities/valueFromAST.mjs +7 -5
- package/utilities/valueFromASTUntyped.d.ts +1 -1
- package/utilities/valueFromASTUntyped.js +1 -11
- package/utilities/valueFromASTUntyped.mjs +2 -6
- 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/KnownArgumentNamesRule.js +3 -1
- package/validation/rules/KnownArgumentNamesRule.mjs +3 -1
- package/validation/rules/KnownDirectivesRule.d.ts +1 -1
- package/validation/rules/KnownDirectivesRule.js +13 -9
- package/validation/rules/KnownDirectivesRule.mjs +8 -4
- 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 +41 -36
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +41 -39
- package/validation/rules/PossibleFragmentSpreadsRule.js +2 -2
- package/validation/rules/PossibleFragmentSpreadsRule.mjs +1 -1
- package/validation/rules/PossibleTypeExtensionsRule.js +16 -10
- package/validation/rules/PossibleTypeExtensionsRule.mjs +15 -9
- package/validation/rules/ProvidedRequiredArgumentsRule.d.ts +1 -1
- package/validation/rules/ProvidedRequiredArgumentsRule.js +10 -5
- package/validation/rules/ProvidedRequiredArgumentsRule.mjs +9 -4
- package/validation/rules/UniqueArgumentDefinitionNamesRule.js +9 -3
- package/validation/rules/UniqueArgumentDefinitionNamesRule.mjs +9 -3
- package/validation/rules/UniqueArgumentNamesRule.js +3 -1
- package/validation/rules/UniqueArgumentNamesRule.mjs +3 -1
- package/validation/rules/UniqueEnumValueNamesRule.js +3 -1
- package/validation/rules/UniqueEnumValueNamesRule.mjs +3 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.js +3 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +5 -3
- package/validation/rules/UniqueOperationTypesRule.js +3 -1
- package/validation/rules/UniqueOperationTypesRule.mjs +3 -1
- package/validation/rules/UniqueVariableNamesRule.js +3 -1
- package/validation/rules/UniqueVariableNamesRule.mjs +3 -1
- 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 +3 -3
- package/version.mjs +3 -3
package/index.mjs
CHANGED
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
* import { parse } from 'graphql';
|
|
23
23
|
* import { parse } from 'graphql/language';
|
|
24
24
|
* ```
|
|
25
|
+
*
|
|
26
|
+
* @packageDocumentation
|
|
25
27
|
*/
|
|
28
|
+
// The GraphQL.js version info.
|
|
29
|
+
export { version, versionInfo } from './version.mjs'; // The primary entry point into fulfilling a GraphQL request.
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
export { version, versionInfo } from './version.mjs';
|
|
29
|
-
/** The primary entry point into fulfilling a GraphQL request. */
|
|
30
|
-
|
|
31
|
-
export { graphql, graphqlSync } from './graphql.mjs';
|
|
32
|
-
/** Create and operate on GraphQL type definitions and schema. */
|
|
31
|
+
export { graphql, graphqlSync } from './graphql.mjs'; // Create and operate on GraphQL type definitions and schema.
|
|
33
32
|
|
|
34
33
|
export {
|
|
35
|
-
|
|
34
|
+
resolveObjMapThunk,
|
|
35
|
+
resolveReadonlyArrayThunk, // Definitions
|
|
36
36
|
GraphQLSchema,
|
|
37
37
|
GraphQLDirective,
|
|
38
38
|
GraphQLScalarType,
|
|
@@ -42,25 +42,22 @@ export {
|
|
|
42
42
|
GraphQLEnumType,
|
|
43
43
|
GraphQLInputObjectType,
|
|
44
44
|
GraphQLList,
|
|
45
|
-
GraphQLNonNull,
|
|
46
|
-
/** Standard GraphQL Scalars */
|
|
45
|
+
GraphQLNonNull, // Standard GraphQL Scalars
|
|
47
46
|
specifiedScalarTypes,
|
|
48
47
|
GraphQLInt,
|
|
49
48
|
GraphQLFloat,
|
|
50
49
|
GraphQLString,
|
|
51
50
|
GraphQLBoolean,
|
|
52
|
-
GraphQLID,
|
|
53
|
-
|
|
51
|
+
GraphQLID, // Int boundaries constants
|
|
52
|
+
GRAPHQL_MAX_INT,
|
|
53
|
+
GRAPHQL_MIN_INT, // Built-in Directives defined by the Spec
|
|
54
54
|
specifiedDirectives,
|
|
55
55
|
GraphQLIncludeDirective,
|
|
56
56
|
GraphQLSkipDirective,
|
|
57
57
|
GraphQLDeprecatedDirective,
|
|
58
|
-
GraphQLSpecifiedByDirective,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/** Constant Deprecation Reason */
|
|
62
|
-
DEFAULT_DEPRECATION_REASON,
|
|
63
|
-
/** GraphQL Types for introspection. */
|
|
58
|
+
GraphQLSpecifiedByDirective, // "Enum" of Type Kinds
|
|
59
|
+
TypeKind, // Constant Deprecation Reason
|
|
60
|
+
DEFAULT_DEPRECATION_REASON, // GraphQL Types for introspection.
|
|
64
61
|
introspectionTypes,
|
|
65
62
|
__Schema,
|
|
66
63
|
__Directive,
|
|
@@ -69,12 +66,10 @@ export {
|
|
|
69
66
|
__Field,
|
|
70
67
|
__InputValue,
|
|
71
68
|
__EnumValue,
|
|
72
|
-
__TypeKind,
|
|
73
|
-
/** Meta-field definitions. */
|
|
69
|
+
__TypeKind, // Meta-field definitions.
|
|
74
70
|
SchemaMetaFieldDef,
|
|
75
71
|
TypeMetaFieldDef,
|
|
76
|
-
TypeNameMetaFieldDef,
|
|
77
|
-
/** Predicates */
|
|
72
|
+
TypeNameMetaFieldDef, // Predicates
|
|
78
73
|
isSchema,
|
|
79
74
|
isDirective,
|
|
80
75
|
isType,
|
|
@@ -98,8 +93,7 @@ export {
|
|
|
98
93
|
isRequiredInputField,
|
|
99
94
|
isSpecifiedScalarType,
|
|
100
95
|
isIntrospectionType,
|
|
101
|
-
isSpecifiedDirective,
|
|
102
|
-
/** Assertions */
|
|
96
|
+
isSpecifiedDirective, // Assertions
|
|
103
97
|
assertSchema,
|
|
104
98
|
assertDirective,
|
|
105
99
|
assertType,
|
|
@@ -118,47 +112,37 @@ export {
|
|
|
118
112
|
assertAbstractType,
|
|
119
113
|
assertWrappingType,
|
|
120
114
|
assertNullableType,
|
|
121
|
-
assertNamedType,
|
|
122
|
-
/** Un-modifiers */
|
|
115
|
+
assertNamedType, // Un-modifiers
|
|
123
116
|
getNullableType,
|
|
124
|
-
getNamedType,
|
|
125
|
-
/** Validate GraphQL schema. */
|
|
117
|
+
getNamedType, // Validate GraphQL schema.
|
|
126
118
|
validateSchema,
|
|
127
|
-
assertValidSchema,
|
|
128
|
-
/** Upholds the spec rules about naming. */
|
|
119
|
+
assertValidSchema, // Upholds the spec rules about naming.
|
|
129
120
|
assertName,
|
|
130
121
|
assertEnumValueName,
|
|
131
122
|
} from './type/index.mjs';
|
|
132
|
-
|
|
133
|
-
/** Parse and operate on GraphQL language source files. */
|
|
123
|
+
// Parse and operate on GraphQL language source files.
|
|
134
124
|
export {
|
|
135
125
|
Token,
|
|
136
126
|
Source,
|
|
137
127
|
Location,
|
|
138
128
|
OperationTypeNode,
|
|
139
|
-
getLocation,
|
|
140
|
-
/** Print source location */
|
|
129
|
+
getLocation, // Print source location.
|
|
141
130
|
printLocation,
|
|
142
|
-
printSourceLocation,
|
|
143
|
-
/** Lex */
|
|
131
|
+
printSourceLocation, // Lex
|
|
144
132
|
Lexer,
|
|
145
|
-
TokenKind,
|
|
146
|
-
/** Parse */
|
|
133
|
+
TokenKind, // Parse
|
|
147
134
|
parse,
|
|
148
135
|
parseValue,
|
|
149
136
|
parseConstValue,
|
|
150
|
-
parseType,
|
|
151
|
-
|
|
152
|
-
print,
|
|
153
|
-
/** Visit */
|
|
137
|
+
parseType, // Print
|
|
138
|
+
print, // Visit
|
|
154
139
|
visit,
|
|
155
140
|
visitInParallel,
|
|
156
141
|
getVisitFn,
|
|
157
142
|
getEnterLeaveForKind,
|
|
158
143
|
BREAK,
|
|
159
144
|
Kind,
|
|
160
|
-
DirectiveLocation,
|
|
161
|
-
/** Predicates */
|
|
145
|
+
DirectiveLocation, // Predicates
|
|
162
146
|
isDefinitionNode,
|
|
163
147
|
isExecutableDefinitionNode,
|
|
164
148
|
isSelectionNode,
|
|
@@ -170,26 +154,23 @@ export {
|
|
|
170
154
|
isTypeSystemExtensionNode,
|
|
171
155
|
isTypeExtensionNode,
|
|
172
156
|
} from './language/index.mjs';
|
|
173
|
-
|
|
174
|
-
/** Execute GraphQL queries. */
|
|
157
|
+
// Execute GraphQL queries.
|
|
175
158
|
export {
|
|
176
159
|
execute,
|
|
177
160
|
executeSync,
|
|
178
161
|
defaultFieldResolver,
|
|
179
162
|
defaultTypeResolver,
|
|
180
163
|
responsePathAsArray,
|
|
164
|
+
getVariableValues,
|
|
181
165
|
getDirectiveValues,
|
|
182
166
|
subscribe,
|
|
183
167
|
createSourceEventStream,
|
|
184
168
|
} from './execution/index.mjs';
|
|
185
|
-
|
|
186
|
-
/** Validate GraphQL documents. */
|
|
169
|
+
// Validate GraphQL documents.
|
|
187
170
|
export {
|
|
188
171
|
validate,
|
|
189
|
-
ValidationContext,
|
|
190
|
-
|
|
191
|
-
specifiedRules,
|
|
192
|
-
/** Individual validation rules. */
|
|
172
|
+
ValidationContext, // All validation rules in the GraphQL Specification.
|
|
173
|
+
specifiedRules, // Individual validation rules.
|
|
193
174
|
ExecutableDefinitionsRule,
|
|
194
175
|
FieldsOnCorrectTypeRule,
|
|
195
176
|
FragmentsOnCompositeTypesRule,
|
|
@@ -215,8 +196,7 @@ export {
|
|
|
215
196
|
UniqueVariableNamesRule,
|
|
216
197
|
ValuesOfCorrectTypeRule,
|
|
217
198
|
VariablesAreInputTypesRule,
|
|
218
|
-
VariablesInAllowedPositionRule,
|
|
219
|
-
/** SDL-specific validation rules */
|
|
199
|
+
VariablesInAllowedPositionRule, // SDL-specific validation rules
|
|
220
200
|
LoneSchemaDefinitionRule,
|
|
221
201
|
UniqueOperationTypesRule,
|
|
222
202
|
UniqueTypeNamesRule,
|
|
@@ -224,13 +204,11 @@ export {
|
|
|
224
204
|
UniqueFieldDefinitionNamesRule,
|
|
225
205
|
UniqueArgumentDefinitionNamesRule,
|
|
226
206
|
UniqueDirectiveNamesRule,
|
|
227
|
-
PossibleTypeExtensionsRule,
|
|
228
|
-
/** Custom validation rules */
|
|
207
|
+
PossibleTypeExtensionsRule, // Custom validation rules
|
|
229
208
|
NoDeprecatedCustomRule,
|
|
230
209
|
NoSchemaIntrospectionCustomRule,
|
|
231
210
|
} from './validation/index.mjs';
|
|
232
|
-
|
|
233
|
-
/** Create, format, and print GraphQL errors. */
|
|
211
|
+
// Create, format, and print GraphQL errors.
|
|
234
212
|
export {
|
|
235
213
|
GraphQLError,
|
|
236
214
|
syntaxError,
|
|
@@ -238,64 +216,37 @@ export {
|
|
|
238
216
|
printError,
|
|
239
217
|
formatError,
|
|
240
218
|
} from './error/index.mjs';
|
|
241
|
-
|
|
242
|
-
/** Utilities for operating on GraphQL type schema and parsed sources. */
|
|
219
|
+
// Utilities for operating on GraphQL type schema and parsed sources.
|
|
243
220
|
export {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
extendSchema,
|
|
263
|
-
/** Sort a GraphQLSchema. */
|
|
264
|
-
lexicographicSortSchema,
|
|
265
|
-
/** Print a GraphQLSchema to GraphQL Schema language. */
|
|
266
|
-
printSchema,
|
|
267
|
-
/** Print a GraphQLType to GraphQL Schema language. */
|
|
268
|
-
printType,
|
|
269
|
-
/** Prints the built-in introspection schema in the Schema Language format. */
|
|
270
|
-
printIntrospectionSchema,
|
|
271
|
-
/** Create a GraphQLType from a GraphQL language AST. */
|
|
272
|
-
typeFromAST,
|
|
273
|
-
/** Create a JavaScript value from a GraphQL language AST with a Type. */
|
|
274
|
-
valueFromAST,
|
|
275
|
-
/** Create a JavaScript value from a GraphQL language AST without a Type. */
|
|
276
|
-
valueFromASTUntyped,
|
|
277
|
-
/** Create a GraphQL language AST from a JavaScript value. */
|
|
278
|
-
astFromValue,
|
|
279
|
-
/** A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system. */
|
|
221
|
+
// Produce the GraphQL query recommended for a full schema introspection.
|
|
222
|
+
// Accepts optional IntrospectionOptions.
|
|
223
|
+
getIntrospectionQuery, // Gets the target Operation from a Document.
|
|
224
|
+
getOperationAST, // Gets the Type for the target Operation AST.
|
|
225
|
+
getOperationRootType, // Convert a GraphQLSchema to an IntrospectionQuery.
|
|
226
|
+
introspectionFromSchema, // Build a GraphQLSchema from an introspection result.
|
|
227
|
+
buildClientSchema, // Build a GraphQLSchema from a parsed GraphQL Schema language AST.
|
|
228
|
+
buildASTSchema, // Build a GraphQLSchema from a GraphQL schema language document.
|
|
229
|
+
buildSchema, // Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST.
|
|
230
|
+
extendSchema, // Sort a GraphQLSchema.
|
|
231
|
+
lexicographicSortSchema, // Print a GraphQLSchema to GraphQL Schema language.
|
|
232
|
+
printSchema, // Print a GraphQLType to GraphQL Schema language.
|
|
233
|
+
printType, // Prints the built-in introspection schema in the Schema Language format.
|
|
234
|
+
printIntrospectionSchema, // Create a GraphQLType from a GraphQL language AST.
|
|
235
|
+
typeFromAST, // Create a JavaScript value from a GraphQL language AST with a Type.
|
|
236
|
+
valueFromAST, // Create a JavaScript value from a GraphQL language AST without a Type.
|
|
237
|
+
valueFromASTUntyped, // Create a GraphQL language AST from a JavaScript value.
|
|
238
|
+
astFromValue, // A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system.
|
|
280
239
|
TypeInfo,
|
|
281
|
-
visitWithTypeInfo,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
/** Separates an AST into an AST per Operation. */
|
|
287
|
-
separateOperations,
|
|
288
|
-
/** Strips characters that are not significant to the validity or execution of a GraphQL document. */
|
|
289
|
-
stripIgnoredCharacters,
|
|
290
|
-
/** Comparators for types */
|
|
240
|
+
visitWithTypeInfo, // Coerces a JavaScript value to a GraphQL type, or produces errors.
|
|
241
|
+
coerceInputValue, // Concatenates multiple AST together.
|
|
242
|
+
concatAST, // Separates an AST into an AST per Operation.
|
|
243
|
+
separateOperations, // Strips characters that are not significant to the validity or execution of a GraphQL document.
|
|
244
|
+
stripIgnoredCharacters, // Comparators for types
|
|
291
245
|
isEqualType,
|
|
292
246
|
isTypeSubTypeOf,
|
|
293
|
-
doTypesOverlap,
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
/** Determine if a string is a valid GraphQL name. */
|
|
297
|
-
isValidNameError,
|
|
298
|
-
/** Compares two GraphQLSchemas and detects breaking changes. */
|
|
247
|
+
doTypesOverlap, // Asserts a string is a valid GraphQL name.
|
|
248
|
+
assertValidName, // Determine if a string is a valid GraphQL name.
|
|
249
|
+
isValidNameError, // Compares two GraphQLSchemas and detects breaking changes.
|
|
299
250
|
BreakingChangeType,
|
|
300
251
|
DangerousChangeType,
|
|
301
252
|
findBreakingChanges,
|
package/jsutils/devAssert.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
exports.devAssert = devAssert;
|
|
7
7
|
|
|
8
8
|
function devAssert(condition, message) {
|
|
9
|
-
const booleanCondition = Boolean(condition);
|
|
9
|
+
const booleanCondition = Boolean(condition);
|
|
10
10
|
|
|
11
11
|
if (!booleanCondition) {
|
|
12
12
|
throw new Error(message);
|
package/jsutils/devAssert.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function devAssert(condition, message) {
|
|
2
|
-
const booleanCondition = Boolean(condition);
|
|
2
|
+
const booleanCondition = Boolean(condition);
|
|
3
3
|
|
|
4
4
|
if (!booleanCondition) {
|
|
5
5
|
throw new Error(message);
|
package/jsutils/instanceOf.js
CHANGED
|
@@ -14,7 +14,9 @@ var _inspect = require('./inspect.js');
|
|
|
14
14
|
* See: https://webpack.js.org/guides/production/
|
|
15
15
|
*/
|
|
16
16
|
const instanceOf =
|
|
17
|
-
|
|
17
|
+
/* c8 ignore next 5 */
|
|
18
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
19
|
+
process.env.NODE_ENV === 'production'
|
|
18
20
|
? function instanceOf(value, constructor) {
|
|
19
21
|
return value instanceof constructor;
|
|
20
22
|
}
|
package/jsutils/instanceOf.mjs
CHANGED
|
@@ -7,7 +7,9 @@ import { inspect } from './inspect.mjs';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export const instanceOf =
|
|
10
|
-
|
|
10
|
+
/* c8 ignore next 5 */
|
|
11
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
12
|
+
process.env.NODE_ENV === 'production'
|
|
11
13
|
? function instanceOf(value, constructor) {
|
|
12
14
|
return value instanceof constructor;
|
|
13
15
|
}
|
package/jsutils/invariant.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
exports.invariant = invariant;
|
|
7
7
|
|
|
8
8
|
function invariant(condition, message) {
|
|
9
|
-
const booleanCondition = Boolean(condition);
|
|
9
|
+
const booleanCondition = Boolean(condition);
|
|
10
10
|
|
|
11
11
|
if (!booleanCondition) {
|
|
12
12
|
throw new Error(
|
package/jsutils/invariant.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function invariant(condition, message) {
|
|
2
|
-
const booleanCondition = Boolean(condition);
|
|
2
|
+
const booleanCondition = Boolean(condition);
|
|
3
3
|
|
|
4
4
|
if (!booleanCondition) {
|
|
5
5
|
throw new Error(
|
package/jsutils/mapValue.js
CHANGED
|
@@ -12,8 +12,8 @@ exports.mapValue = mapValue;
|
|
|
12
12
|
function mapValue(map, fn) {
|
|
13
13
|
const result = Object.create(null);
|
|
14
14
|
|
|
15
|
-
for (const
|
|
16
|
-
result[key] = fn(
|
|
15
|
+
for (const key of Object.keys(map)) {
|
|
16
|
+
result[key] = fn(map[key], key);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
return result;
|
package/jsutils/mapValue.mjs
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
export function mapValue(map, fn) {
|
|
6
6
|
const result = Object.create(null);
|
|
7
7
|
|
|
8
|
-
for (const
|
|
9
|
-
result[key] = fn(
|
|
8
|
+
for (const key of Object.keys(map)) {
|
|
9
|
+
result[key] = fn(map[key], key);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
return result;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isPromise } from './isPromise.mjs';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* Similar to Array.prototype.reduce(), however the reducing callback may return
|
|
4
5
|
* a Promise, in which case reduction will continue after each promise resolves.
|
|
@@ -6,7 +7,6 @@ import { isPromise } from './isPromise.mjs';
|
|
|
6
7
|
* If the callback does not return a Promise, then this function will also not
|
|
7
8
|
* return a Promise.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
10
|
export function promiseReduce(values, callbackFn, initialValue) {
|
|
11
11
|
let accumulator = initialValue;
|
|
12
12
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
exports.toError = toError;
|
|
7
|
+
|
|
8
|
+
var _inspect = require('./inspect.js');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface.
|
|
12
|
+
*/
|
|
13
|
+
function toError(thrownValue) {
|
|
14
|
+
return thrownValue instanceof Error
|
|
15
|
+
? thrownValue
|
|
16
|
+
: new NonErrorThrown(thrownValue);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class NonErrorThrown extends Error {
|
|
20
|
+
constructor(thrownValue) {
|
|
21
|
+
super('Unexpected error value: ' + (0, _inspect.inspect)(thrownValue));
|
|
22
|
+
this.name = 'NonErrorThrown';
|
|
23
|
+
this.thrownValue = thrownValue;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { inspect } from './inspect.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export function toError(thrownValue) {
|
|
7
|
+
return thrownValue instanceof Error
|
|
8
|
+
? thrownValue
|
|
9
|
+
: new NonErrorThrown(thrownValue);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
class NonErrorThrown extends Error {
|
|
13
|
+
constructor(thrownValue) {
|
|
14
|
+
super('Unexpected error value: ' + inspect(thrownValue));
|
|
15
|
+
this.name = 'NonErrorThrown';
|
|
16
|
+
this.thrownValue = thrownValue;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function dedentBlockStringLines(
|
|
10
|
+
lines: ReadonlyArray<string>,
|
|
11
|
+
): Array<string>;
|
|
10
12
|
/**
|
|
11
13
|
* @internal
|
|
12
14
|
*/
|
|
13
|
-
export declare function
|
|
15
|
+
export declare function isPrintableAsBlockString(value: string): boolean;
|
|
14
16
|
/**
|
|
15
17
|
* Print a block string in the indented block form by adding a leading and
|
|
16
18
|
* trailing blank line. However, if a block string starts with whitespace and is
|
|
@@ -20,5 +22,7 @@ export declare function getBlockStringIndentation(value: string): number;
|
|
|
20
22
|
*/
|
|
21
23
|
export declare function printBlockString(
|
|
22
24
|
value: string,
|
|
23
|
-
|
|
25
|
+
options?: {
|
|
26
|
+
minimize?: boolean;
|
|
27
|
+
},
|
|
24
28
|
): string;
|