@graphql-tools/utils 8.6.10 → 8.6.12-alpha-cdfcad8a.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/createGraphQLError.d.ts +14 -0
- package/errors.d.ts +14 -1
- package/index.js +82 -7
- package/index.mjs +83 -8
- package/package.json +1 -1
- package/types.d.ts +24 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ASTNode, GraphQLError, GraphQLErrorExtensions, Source } from 'graphql';
|
|
2
|
+
import { Maybe } from './types';
|
|
3
|
+
interface GraphQLErrorOptions {
|
|
4
|
+
nodes?: ReadonlyArray<ASTNode> | ASTNode | null;
|
|
5
|
+
source?: Maybe<Source>;
|
|
6
|
+
positions?: Maybe<ReadonlyArray<number>>;
|
|
7
|
+
path?: Maybe<ReadonlyArray<string | number>>;
|
|
8
|
+
originalError?: Maybe<Error & {
|
|
9
|
+
readonly extensions?: unknown;
|
|
10
|
+
}>;
|
|
11
|
+
extensions?: Maybe<GraphQLErrorExtensions>;
|
|
12
|
+
}
|
|
13
|
+
export declare function createGraphQLError(message: string, options: GraphQLErrorOptions): GraphQLError;
|
|
14
|
+
export {};
|
package/errors.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import { GraphQLError } from 'graphql';
|
|
1
|
+
import { ASTNode, GraphQLError, GraphQLErrorExtensions, Source } from 'graphql';
|
|
2
|
+
import { Maybe } from './types';
|
|
3
|
+
interface GraphQLErrorOptions {
|
|
4
|
+
nodes?: ReadonlyArray<ASTNode> | ASTNode | null;
|
|
5
|
+
source?: Maybe<Source>;
|
|
6
|
+
positions?: Maybe<ReadonlyArray<number>>;
|
|
7
|
+
path?: Maybe<ReadonlyArray<string | number>>;
|
|
8
|
+
originalError?: Maybe<Error & {
|
|
9
|
+
readonly extensions?: unknown;
|
|
10
|
+
}>;
|
|
11
|
+
extensions?: Maybe<GraphQLErrorExtensions>;
|
|
12
|
+
}
|
|
13
|
+
export declare function createGraphQLError(message: string, options: GraphQLErrorOptions): GraphQLError;
|
|
2
14
|
export declare function relocatedError(originalError: GraphQLError, path?: ReadonlyArray<string | number>): GraphQLError;
|
|
15
|
+
export {};
|
package/index.js
CHANGED
|
@@ -69,6 +69,19 @@ function assertSome(input, message = 'Value should be something') {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
function createGraphQLError(message, options) {
|
|
73
|
+
if (graphql.versionInfo.major > 15) {
|
|
74
|
+
const error = new graphql.GraphQLError(message, options);
|
|
75
|
+
Object.defineProperty(error, 'extensions', {
|
|
76
|
+
value: options.extensions || {},
|
|
77
|
+
});
|
|
78
|
+
return error;
|
|
79
|
+
}
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
return new graphql.GraphQLError(message, options.nodes, options.source, options.positions, options.path, options.originalError, options.extensions);
|
|
83
|
+
}
|
|
84
|
+
|
|
72
85
|
if (typeof AggregateError === 'undefined') {
|
|
73
86
|
class AggregateErrorClass extends Error {
|
|
74
87
|
constructor(errors, message = '') {
|
|
@@ -217,7 +230,9 @@ function getArgumentValues(def, node, variableValues = {}) {
|
|
|
217
230
|
coercedValues[name] = defaultValue;
|
|
218
231
|
}
|
|
219
232
|
else if (graphql.isNonNullType(argType)) {
|
|
220
|
-
throw
|
|
233
|
+
throw createGraphQLError(`Argument "${name}" of required type "${inspect(argType)}" ` + 'was not provided.', {
|
|
234
|
+
nodes: [node],
|
|
235
|
+
});
|
|
221
236
|
}
|
|
222
237
|
continue;
|
|
223
238
|
}
|
|
@@ -230,22 +245,28 @@ function getArgumentValues(def, node, variableValues = {}) {
|
|
|
230
245
|
coercedValues[name] = defaultValue;
|
|
231
246
|
}
|
|
232
247
|
else if (graphql.isNonNullType(argType)) {
|
|
233
|
-
throw
|
|
234
|
-
`was provided the variable "$${variableName}" which was not provided a runtime value.`,
|
|
248
|
+
throw createGraphQLError(`Argument "${name}" of required type "${inspect(argType)}" ` +
|
|
249
|
+
`was provided the variable "$${variableName}" which was not provided a runtime value.`, {
|
|
250
|
+
nodes: [valueNode],
|
|
251
|
+
});
|
|
235
252
|
}
|
|
236
253
|
continue;
|
|
237
254
|
}
|
|
238
255
|
isNull = variableValues[variableName] == null;
|
|
239
256
|
}
|
|
240
257
|
if (isNull && graphql.isNonNullType(argType)) {
|
|
241
|
-
throw
|
|
258
|
+
throw createGraphQLError(`Argument "${name}" of non-null type "${inspect(argType)}" ` + 'must not be null.', {
|
|
259
|
+
nodes: [valueNode],
|
|
260
|
+
});
|
|
242
261
|
}
|
|
243
262
|
const coercedValue = graphql.valueFromAST(valueNode, argType, variableValues);
|
|
244
263
|
if (coercedValue === undefined) {
|
|
245
264
|
// Note: ValuesOfCorrectTypeRule validation should catch this before
|
|
246
265
|
// execution. This is a runtime check to ensure execution does not
|
|
247
266
|
// continue with an invalid argument value.
|
|
248
|
-
throw
|
|
267
|
+
throw createGraphQLError(`Argument "${name}" has invalid value ${graphql.print(valueNode)}.`, {
|
|
268
|
+
nodes: [valueNode],
|
|
269
|
+
});
|
|
249
270
|
}
|
|
250
271
|
coercedValues[name] = coercedValue;
|
|
251
272
|
}
|
|
@@ -2091,6 +2112,30 @@ function hasCircularRef(types, config = {
|
|
|
2091
2112
|
return size > config.depth;
|
|
2092
2113
|
}
|
|
2093
2114
|
|
|
2115
|
+
(function (DirectiveLocation) {
|
|
2116
|
+
/** Request Definitions */
|
|
2117
|
+
DirectiveLocation["QUERY"] = "QUERY";
|
|
2118
|
+
DirectiveLocation["MUTATION"] = "MUTATION";
|
|
2119
|
+
DirectiveLocation["SUBSCRIPTION"] = "SUBSCRIPTION";
|
|
2120
|
+
DirectiveLocation["FIELD"] = "FIELD";
|
|
2121
|
+
DirectiveLocation["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION";
|
|
2122
|
+
DirectiveLocation["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD";
|
|
2123
|
+
DirectiveLocation["INLINE_FRAGMENT"] = "INLINE_FRAGMENT";
|
|
2124
|
+
DirectiveLocation["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION";
|
|
2125
|
+
/** Type System Definitions */
|
|
2126
|
+
DirectiveLocation["SCHEMA"] = "SCHEMA";
|
|
2127
|
+
DirectiveLocation["SCALAR"] = "SCALAR";
|
|
2128
|
+
DirectiveLocation["OBJECT"] = "OBJECT";
|
|
2129
|
+
DirectiveLocation["FIELD_DEFINITION"] = "FIELD_DEFINITION";
|
|
2130
|
+
DirectiveLocation["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION";
|
|
2131
|
+
DirectiveLocation["INTERFACE"] = "INTERFACE";
|
|
2132
|
+
DirectiveLocation["UNION"] = "UNION";
|
|
2133
|
+
DirectiveLocation["ENUM"] = "ENUM";
|
|
2134
|
+
DirectiveLocation["ENUM_VALUE"] = "ENUM_VALUE";
|
|
2135
|
+
DirectiveLocation["INPUT_OBJECT"] = "INPUT_OBJECT";
|
|
2136
|
+
DirectiveLocation["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
|
|
2137
|
+
})(exports.DirectiveLocation || (exports.DirectiveLocation = {}));
|
|
2138
|
+
|
|
2094
2139
|
(function (MapperKind) {
|
|
2095
2140
|
MapperKind["TYPE"] = "MapperKind.TYPE";
|
|
2096
2141
|
MapperKind["SCALAR_TYPE"] = "MapperKind.SCALAR_TYPE";
|
|
@@ -3758,8 +3803,27 @@ function implementsAbstractType(schema, typeA, typeB) {
|
|
|
3758
3803
|
return false;
|
|
3759
3804
|
}
|
|
3760
3805
|
|
|
3806
|
+
function createGraphQLError$1(message, options) {
|
|
3807
|
+
if (graphql.versionInfo.major > 15) {
|
|
3808
|
+
const error = new graphql.GraphQLError(message, options);
|
|
3809
|
+
Object.defineProperty(error, 'extensions', {
|
|
3810
|
+
value: options.extensions || {},
|
|
3811
|
+
});
|
|
3812
|
+
return error;
|
|
3813
|
+
}
|
|
3814
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3815
|
+
// @ts-ignore
|
|
3816
|
+
return new graphql.GraphQLError(message, options.nodes, options.source, options.positions, options.path, options.originalError, options.extensions);
|
|
3817
|
+
}
|
|
3761
3818
|
function relocatedError(originalError, path) {
|
|
3762
|
-
return
|
|
3819
|
+
return createGraphQLError$1(originalError.message, {
|
|
3820
|
+
nodes: originalError.nodes,
|
|
3821
|
+
source: originalError.source,
|
|
3822
|
+
positions: originalError.positions,
|
|
3823
|
+
path: path == null ? originalError.path : path,
|
|
3824
|
+
originalError,
|
|
3825
|
+
extensions: originalError.extensions,
|
|
3826
|
+
});
|
|
3763
3827
|
}
|
|
3764
3828
|
|
|
3765
3829
|
function observableToAsyncIterable(observable) {
|
|
@@ -4016,8 +4080,18 @@ function visitErrorsByType(errors, errorVisitorMap, errorInfo) {
|
|
|
4016
4080
|
return newError;
|
|
4017
4081
|
});
|
|
4018
4082
|
}
|
|
4083
|
+
function getOperationRootType(schema, operationDef) {
|
|
4084
|
+
switch (operationDef.operation) {
|
|
4085
|
+
case 'query':
|
|
4086
|
+
return schema.getQueryType();
|
|
4087
|
+
case 'mutation':
|
|
4088
|
+
return schema.getMutationType();
|
|
4089
|
+
case 'subscription':
|
|
4090
|
+
return schema.getSubscriptionType();
|
|
4091
|
+
}
|
|
4092
|
+
}
|
|
4019
4093
|
function visitRoot(root, operation, schema, fragments, variableValues, resultVisitorMap, errors, errorInfo) {
|
|
4020
|
-
const operationRootType =
|
|
4094
|
+
const operationRootType = getOperationRootType(schema, operation);
|
|
4021
4095
|
const collectedFields = collectFields(schema, fragments, variableValues, operationRootType, operation.selectionSet, new Map(), new Set());
|
|
4022
4096
|
return visitObjectValue(root, operationRootType, collectedFields, schema, fragments, variableValues, resultVisitorMap, 0, errors, errorInfo);
|
|
4023
4097
|
}
|
|
@@ -4275,6 +4349,7 @@ exports.compareNodes = compareNodes;
|
|
|
4275
4349
|
exports.compareStrings = compareStrings;
|
|
4276
4350
|
exports.correctASTNodes = correctASTNodes;
|
|
4277
4351
|
exports.createDefaultRules = createDefaultRules;
|
|
4352
|
+
exports.createGraphQLError = createGraphQLError$1;
|
|
4278
4353
|
exports.createNamedStub = createNamedStub;
|
|
4279
4354
|
exports.createStub = createStub;
|
|
4280
4355
|
exports.createVariableNameGenerator = createVariableNameGenerator;
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parse, GraphQLError, isNonNullType, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedDirective, astFromValue, isSpecifiedScalarType, isIntrospectionType, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, GraphQLDeprecatedDirective, specifiedRules, concatAST, validate,
|
|
1
|
+
import { parse, versionInfo, GraphQLError, isNonNullType, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedDirective, astFromValue, isSpecifiedScalarType, isIntrospectionType, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, GraphQLDeprecatedDirective, specifiedRules, concatAST, validate, buildClientSchema, visit, TokenKind, Source, isTypeSystemDefinitionNode, getNamedType, GraphQLString, GraphQLNonNull, GraphQLList, GraphQLID, GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLDirective, GraphQLUnionType, GraphQLEnumType, GraphQLScalarType, isNamedType, getNullableType, isLeafType, GraphQLSchema, isDirective, isCompositeType, doTypesOverlap, getOperationAST, getDirectiveValues, GraphQLSkipDirective, GraphQLIncludeDirective, typeFromAST, isAbstractType, TypeNameMetaFieldDef, buildASTSchema } from 'graphql';
|
|
2
2
|
|
|
3
3
|
const asArray = (fns) => (Array.isArray(fns) ? fns : fns ? [fns] : []);
|
|
4
4
|
const invalidDocRegex = /\.[a-z0-9]+$/i;
|
|
@@ -65,6 +65,19 @@ function assertSome(input, message = 'Value should be something') {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
function createGraphQLError(message, options) {
|
|
69
|
+
if (versionInfo.major > 15) {
|
|
70
|
+
const error = new GraphQLError(message, options);
|
|
71
|
+
Object.defineProperty(error, 'extensions', {
|
|
72
|
+
value: options.extensions || {},
|
|
73
|
+
});
|
|
74
|
+
return error;
|
|
75
|
+
}
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
return new GraphQLError(message, options.nodes, options.source, options.positions, options.path, options.originalError, options.extensions);
|
|
79
|
+
}
|
|
80
|
+
|
|
68
81
|
let AggregateErrorImpl;
|
|
69
82
|
if (typeof AggregateError === 'undefined') {
|
|
70
83
|
class AggregateErrorClass extends Error {
|
|
@@ -214,7 +227,9 @@ function getArgumentValues(def, node, variableValues = {}) {
|
|
|
214
227
|
coercedValues[name] = defaultValue;
|
|
215
228
|
}
|
|
216
229
|
else if (isNonNullType(argType)) {
|
|
217
|
-
throw
|
|
230
|
+
throw createGraphQLError(`Argument "${name}" of required type "${inspect(argType)}" ` + 'was not provided.', {
|
|
231
|
+
nodes: [node],
|
|
232
|
+
});
|
|
218
233
|
}
|
|
219
234
|
continue;
|
|
220
235
|
}
|
|
@@ -227,22 +242,28 @@ function getArgumentValues(def, node, variableValues = {}) {
|
|
|
227
242
|
coercedValues[name] = defaultValue;
|
|
228
243
|
}
|
|
229
244
|
else if (isNonNullType(argType)) {
|
|
230
|
-
throw
|
|
231
|
-
`was provided the variable "$${variableName}" which was not provided a runtime value.`,
|
|
245
|
+
throw createGraphQLError(`Argument "${name}" of required type "${inspect(argType)}" ` +
|
|
246
|
+
`was provided the variable "$${variableName}" which was not provided a runtime value.`, {
|
|
247
|
+
nodes: [valueNode],
|
|
248
|
+
});
|
|
232
249
|
}
|
|
233
250
|
continue;
|
|
234
251
|
}
|
|
235
252
|
isNull = variableValues[variableName] == null;
|
|
236
253
|
}
|
|
237
254
|
if (isNull && isNonNullType(argType)) {
|
|
238
|
-
throw
|
|
255
|
+
throw createGraphQLError(`Argument "${name}" of non-null type "${inspect(argType)}" ` + 'must not be null.', {
|
|
256
|
+
nodes: [valueNode],
|
|
257
|
+
});
|
|
239
258
|
}
|
|
240
259
|
const coercedValue = valueFromAST(valueNode, argType, variableValues);
|
|
241
260
|
if (coercedValue === undefined) {
|
|
242
261
|
// Note: ValuesOfCorrectTypeRule validation should catch this before
|
|
243
262
|
// execution. This is a runtime check to ensure execution does not
|
|
244
263
|
// continue with an invalid argument value.
|
|
245
|
-
throw
|
|
264
|
+
throw createGraphQLError(`Argument "${name}" has invalid value ${print(valueNode)}.`, {
|
|
265
|
+
nodes: [valueNode],
|
|
266
|
+
});
|
|
246
267
|
}
|
|
247
268
|
coercedValues[name] = coercedValue;
|
|
248
269
|
}
|
|
@@ -2088,6 +2109,31 @@ function hasCircularRef(types, config = {
|
|
|
2088
2109
|
return size > config.depth;
|
|
2089
2110
|
}
|
|
2090
2111
|
|
|
2112
|
+
var DirectiveLocation;
|
|
2113
|
+
(function (DirectiveLocation) {
|
|
2114
|
+
/** Request Definitions */
|
|
2115
|
+
DirectiveLocation["QUERY"] = "QUERY";
|
|
2116
|
+
DirectiveLocation["MUTATION"] = "MUTATION";
|
|
2117
|
+
DirectiveLocation["SUBSCRIPTION"] = "SUBSCRIPTION";
|
|
2118
|
+
DirectiveLocation["FIELD"] = "FIELD";
|
|
2119
|
+
DirectiveLocation["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION";
|
|
2120
|
+
DirectiveLocation["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD";
|
|
2121
|
+
DirectiveLocation["INLINE_FRAGMENT"] = "INLINE_FRAGMENT";
|
|
2122
|
+
DirectiveLocation["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION";
|
|
2123
|
+
/** Type System Definitions */
|
|
2124
|
+
DirectiveLocation["SCHEMA"] = "SCHEMA";
|
|
2125
|
+
DirectiveLocation["SCALAR"] = "SCALAR";
|
|
2126
|
+
DirectiveLocation["OBJECT"] = "OBJECT";
|
|
2127
|
+
DirectiveLocation["FIELD_DEFINITION"] = "FIELD_DEFINITION";
|
|
2128
|
+
DirectiveLocation["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION";
|
|
2129
|
+
DirectiveLocation["INTERFACE"] = "INTERFACE";
|
|
2130
|
+
DirectiveLocation["UNION"] = "UNION";
|
|
2131
|
+
DirectiveLocation["ENUM"] = "ENUM";
|
|
2132
|
+
DirectiveLocation["ENUM_VALUE"] = "ENUM_VALUE";
|
|
2133
|
+
DirectiveLocation["INPUT_OBJECT"] = "INPUT_OBJECT";
|
|
2134
|
+
DirectiveLocation["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
|
|
2135
|
+
})(DirectiveLocation || (DirectiveLocation = {}));
|
|
2136
|
+
|
|
2091
2137
|
var MapperKind;
|
|
2092
2138
|
(function (MapperKind) {
|
|
2093
2139
|
MapperKind["TYPE"] = "MapperKind.TYPE";
|
|
@@ -3756,8 +3802,27 @@ function implementsAbstractType(schema, typeA, typeB) {
|
|
|
3756
3802
|
return false;
|
|
3757
3803
|
}
|
|
3758
3804
|
|
|
3805
|
+
function createGraphQLError$1(message, options) {
|
|
3806
|
+
if (versionInfo.major > 15) {
|
|
3807
|
+
const error = new GraphQLError(message, options);
|
|
3808
|
+
Object.defineProperty(error, 'extensions', {
|
|
3809
|
+
value: options.extensions || {},
|
|
3810
|
+
});
|
|
3811
|
+
return error;
|
|
3812
|
+
}
|
|
3813
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3814
|
+
// @ts-ignore
|
|
3815
|
+
return new GraphQLError(message, options.nodes, options.source, options.positions, options.path, options.originalError, options.extensions);
|
|
3816
|
+
}
|
|
3759
3817
|
function relocatedError(originalError, path) {
|
|
3760
|
-
return
|
|
3818
|
+
return createGraphQLError$1(originalError.message, {
|
|
3819
|
+
nodes: originalError.nodes,
|
|
3820
|
+
source: originalError.source,
|
|
3821
|
+
positions: originalError.positions,
|
|
3822
|
+
path: path == null ? originalError.path : path,
|
|
3823
|
+
originalError,
|
|
3824
|
+
extensions: originalError.extensions,
|
|
3825
|
+
});
|
|
3761
3826
|
}
|
|
3762
3827
|
|
|
3763
3828
|
function observableToAsyncIterable(observable) {
|
|
@@ -4014,6 +4079,16 @@ function visitErrorsByType(errors, errorVisitorMap, errorInfo) {
|
|
|
4014
4079
|
return newError;
|
|
4015
4080
|
});
|
|
4016
4081
|
}
|
|
4082
|
+
function getOperationRootType(schema, operationDef) {
|
|
4083
|
+
switch (operationDef.operation) {
|
|
4084
|
+
case 'query':
|
|
4085
|
+
return schema.getQueryType();
|
|
4086
|
+
case 'mutation':
|
|
4087
|
+
return schema.getMutationType();
|
|
4088
|
+
case 'subscription':
|
|
4089
|
+
return schema.getSubscriptionType();
|
|
4090
|
+
}
|
|
4091
|
+
}
|
|
4017
4092
|
function visitRoot(root, operation, schema, fragments, variableValues, resultVisitorMap, errors, errorInfo) {
|
|
4018
4093
|
const operationRootType = getOperationRootType(schema, operation);
|
|
4019
4094
|
const collectedFields = collectFields(schema, fragments, variableValues, operationRootType, operation.selectionSet, new Map(), new Set());
|
|
@@ -4247,4 +4322,4 @@ function fixSchemaAst(schema, options) {
|
|
|
4247
4322
|
return schema;
|
|
4248
4323
|
}
|
|
4249
4324
|
|
|
4250
|
-
export { AggregateErrorImpl as AggregateError, MapperKind, addTypes, appendObjectFields, asArray, assertSome, astFromArg, astFromDirective, astFromEnumType, astFromEnumValue, astFromField, astFromInputField, astFromInputObjectType, astFromInterfaceType, astFromObjectType, astFromScalarType, astFromSchema, astFromUnionType, astFromValueUntyped, buildOperationNodeForField, checkValidationErrors, collectComment, collectFields, collectSubFields, compareNodes, compareStrings, correctASTNodes, createDefaultRules, createNamedStub, createStub, createVariableNameGenerator, dedentBlockStringValue, filterSchema, fixSchemaAst, forEachDefaultValue, forEachField, getArgumentValues, getAsyncIterableWithCancel, getAsyncIteratorWithCancel, getBlockStringIndentation, getBuiltInForStub, getComment, getDefinedRootType, getDeprecatableDirectiveNodes, getDescription, getDirective, getDirectiveInExtensions, getDirectiveNodes, getDirectives, getDirectivesInExtensions, getDocumentNodeFromSchema, getFieldsWithDirectives, getImplementingTypes, getLeadingCommentBlock, getOperationASTFromDocument, getOperationASTFromRequest, getResolversFromSchema, getResponseKeyFromInfo, getRootTypeMap, getRootTypeNames, getRootTypes, healSchema, healTypes, implementsAbstractType, inspect, isAggregateError, isAsyncIterable, isDescribable, isDocumentNode, isDocumentString, isNamedStub, isSome, isValidPath, makeDeprecatedDirective, makeDirectiveNode, makeDirectiveNodes, mapAsyncIterator, mapSchema, memoize1, memoize2, memoize2of4, memoize3, memoize4, memoize5, mergeDeep, modifyObjectFields, nodeToString, observableToAsyncIterable, parseGraphQLJSON, parseGraphQLSDL, parseInputValue, parseInputValueLiteral, parseSelectionSet, printComment, printSchemaWithDirectives, printWithComments, pruneSchema, pushComment, relocatedError, removeObjectFields, renameType, resetComments, rewireTypes, selectObjectFields, serializeInputValue, transformCommentsToDescriptions, transformInputValue, updateArgument, validateGraphQlDocuments, valueMatchesCriteria, visitData, visitErrors, visitResult, getAsyncIterableWithCancel as withCancel };
|
|
4325
|
+
export { AggregateErrorImpl as AggregateError, DirectiveLocation, MapperKind, addTypes, appendObjectFields, asArray, assertSome, astFromArg, astFromDirective, astFromEnumType, astFromEnumValue, astFromField, astFromInputField, astFromInputObjectType, astFromInterfaceType, astFromObjectType, astFromScalarType, astFromSchema, astFromUnionType, astFromValueUntyped, buildOperationNodeForField, checkValidationErrors, collectComment, collectFields, collectSubFields, compareNodes, compareStrings, correctASTNodes, createDefaultRules, createGraphQLError$1 as createGraphQLError, createNamedStub, createStub, createVariableNameGenerator, dedentBlockStringValue, filterSchema, fixSchemaAst, forEachDefaultValue, forEachField, getArgumentValues, getAsyncIterableWithCancel, getAsyncIteratorWithCancel, getBlockStringIndentation, getBuiltInForStub, getComment, getDefinedRootType, getDeprecatableDirectiveNodes, getDescription, getDirective, getDirectiveInExtensions, getDirectiveNodes, getDirectives, getDirectivesInExtensions, getDocumentNodeFromSchema, getFieldsWithDirectives, getImplementingTypes, getLeadingCommentBlock, getOperationASTFromDocument, getOperationASTFromRequest, getResolversFromSchema, getResponseKeyFromInfo, getRootTypeMap, getRootTypeNames, getRootTypes, healSchema, healTypes, implementsAbstractType, inspect, isAggregateError, isAsyncIterable, isDescribable, isDocumentNode, isDocumentString, isNamedStub, isSome, isValidPath, makeDeprecatedDirective, makeDirectiveNode, makeDirectiveNodes, mapAsyncIterator, mapSchema, memoize1, memoize2, memoize2of4, memoize3, memoize4, memoize5, mergeDeep, modifyObjectFields, nodeToString, observableToAsyncIterable, parseGraphQLJSON, parseGraphQLSDL, parseInputValue, parseInputValueLiteral, parseSelectionSet, printComment, printSchemaWithDirectives, printWithComments, pruneSchema, pushComment, relocatedError, removeObjectFields, renameType, resetComments, rewireTypes, selectObjectFields, serializeInputValue, transformCommentsToDescriptions, transformInputValue, updateArgument, validateGraphQlDocuments, valueMatchesCriteria, visitData, visitErrors, visitResult, getAsyncIterableWithCancel as withCancel };
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -48,3 +48,27 @@ export interface PruneSchemaOptions {
|
|
|
48
48
|
export declare type InputLeafValueTransformer = (type: GraphQLEnumType | GraphQLScalarType, originalValue: any) => any;
|
|
49
49
|
export declare type InputObjectValueTransformer = (type: GraphQLInputObjectType, originalValue: Record<string, any>) => Record<string, any>;
|
|
50
50
|
export declare type ASTVisitorKeyMap = Partial<Parameters<typeof visit>[2]>;
|
|
51
|
+
export declare type DirectiveLocationEnum = typeof DirectiveLocation;
|
|
52
|
+
export declare enum DirectiveLocation {
|
|
53
|
+
/** Request Definitions */
|
|
54
|
+
QUERY = "QUERY",
|
|
55
|
+
MUTATION = "MUTATION",
|
|
56
|
+
SUBSCRIPTION = "SUBSCRIPTION",
|
|
57
|
+
FIELD = "FIELD",
|
|
58
|
+
FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION",
|
|
59
|
+
FRAGMENT_SPREAD = "FRAGMENT_SPREAD",
|
|
60
|
+
INLINE_FRAGMENT = "INLINE_FRAGMENT",
|
|
61
|
+
VARIABLE_DEFINITION = "VARIABLE_DEFINITION",
|
|
62
|
+
/** Type System Definitions */
|
|
63
|
+
SCHEMA = "SCHEMA",
|
|
64
|
+
SCALAR = "SCALAR",
|
|
65
|
+
OBJECT = "OBJECT",
|
|
66
|
+
FIELD_DEFINITION = "FIELD_DEFINITION",
|
|
67
|
+
ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION",
|
|
68
|
+
INTERFACE = "INTERFACE",
|
|
69
|
+
UNION = "UNION",
|
|
70
|
+
ENUM = "ENUM",
|
|
71
|
+
ENUM_VALUE = "ENUM_VALUE",
|
|
72
|
+
INPUT_OBJECT = "INPUT_OBJECT",
|
|
73
|
+
INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION"
|
|
74
|
+
}
|