@graphitation/supermassive 2.2.2 → 2.2.3
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/.eslintcache +1 -1
- package/lib/ast/TypedAST.js +1 -0
- package/lib/ast/addTypesToRequestDocument.js +48 -42
- package/lib/ast/addTypesToRequestDocument.mjs +47 -42
- package/lib/benchmarks/index.js +15 -4
- package/lib/benchmarks/index.mjs +6 -3
- package/lib/benchmarks/nice-benchmark.js +1 -0
- package/lib/benchmarks/swapi-schema/index.js +14 -4
- package/lib/benchmarks/swapi-schema/index.mjs +5 -3
- package/lib/benchmarks/swapi-schema/models.js +9 -1
- package/lib/benchmarks/swapi-schema/resolvers.js +22 -7
- package/lib/benchmarks/swapi-schema/resolvers.mjs +21 -7
- package/lib/collectFields.js +41 -11
- package/lib/collectFields.mjs +40 -11
- package/lib/compiledQuery.js +1 -0
- package/lib/definition.js +13 -8
- package/lib/definition.mjs +12 -8
- package/lib/directives.js +48 -33
- package/lib/directives.mjs +47 -33
- package/lib/executeWithSchema.js +1 -0
- package/lib/executeWithoutSchema.js +231 -49
- package/lib/executeWithoutSchema.mjs +224 -46
- package/lib/extractImplicitTypesRuntime.js +4 -1
- package/lib/extractImplicitTypesRuntime.mjs +3 -1
- package/lib/index.js +1 -0
- package/lib/jsutils/Maybe.js +1 -0
- package/lib/jsutils/ObjMap.js +1 -0
- package/lib/jsutils/Path.js +1 -0
- package/lib/jsutils/PromiseOrValue.js +1 -0
- package/lib/jsutils/devAssert.js +1 -0
- package/lib/jsutils/didYouMean.js +1 -0
- package/lib/jsutils/identityFunc.js +1 -0
- package/lib/jsutils/inspect.js +4 -1
- package/lib/jsutils/inspect.mjs +3 -1
- package/lib/jsutils/instanceOf.js +18 -6
- package/lib/jsutils/instanceOf.mjs +17 -6
- package/lib/jsutils/invariant.js +4 -1
- package/lib/jsutils/invariant.mjs +3 -1
- package/lib/jsutils/isAsyncIterable.js +1 -0
- package/lib/jsutils/isIterableObject.js +1 -0
- package/lib/jsutils/isObjectLike.js +1 -0
- package/lib/jsutils/isPromise.js +1 -0
- package/lib/jsutils/keyMap.js +1 -0
- package/lib/jsutils/keyValMap.js +1 -0
- package/lib/jsutils/mapValue.js +1 -0
- package/lib/jsutils/memoize3.js +1 -0
- package/lib/jsutils/naturalCompare.js +1 -0
- package/lib/jsutils/printPathArray.js +4 -1
- package/lib/jsutils/printPathArray.mjs +3 -1
- package/lib/jsutils/promiseForObject.js +1 -0
- package/lib/jsutils/promiseReduce.js +1 -0
- package/lib/jsutils/suggestionList.js +9 -1
- package/lib/jsutils/suggestionList.mjs +8 -1
- package/lib/jsutils/toObjMap.js +1 -0
- package/lib/subscribeWithSchema.js +1 -0
- package/lib/subscribeWithoutSchema.js +45 -6
- package/lib/subscribeWithoutSchema.mjs +44 -6
- package/lib/transforms/annotateDocumentGraphQLTransform.js +1 -0
- package/lib/types.js +1 -0
- package/lib/utilities/blankGraphQLTag.js +1 -0
- package/lib/utilities/mapAsyncIterator.js +1 -0
- package/lib/utilities/mergeResolvers.js +1 -0
- package/lib/utilities/typeNameFromAST.js +1 -0
- package/lib/values.js +82 -21
- package/lib/values.mjs +81 -21
- package/package.json +1 -1
package/lib/jsutils/keyMap.js
CHANGED
package/lib/jsutils/keyValMap.js
CHANGED
package/lib/jsutils/mapValue.js
CHANGED
package/lib/jsutils/memoize3.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -21,5 +22,7 @@ __export(printPathArray_exports, {
|
|
|
21
22
|
});
|
|
22
23
|
module.exports = __toCommonJS(printPathArray_exports);
|
|
23
24
|
function printPathArray(path) {
|
|
24
|
-
return path.map(
|
|
25
|
+
return path.map(
|
|
26
|
+
(key) => typeof key === "number" ? "[" + key.toString() + "]" : "." + key
|
|
27
|
+
).join("");
|
|
25
28
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// src/jsutils/printPathArray.ts
|
|
2
2
|
function printPathArray(path) {
|
|
3
|
-
return path.map(
|
|
3
|
+
return path.map(
|
|
4
|
+
(key) => typeof key === "number" ? "[" + key.toString() + "]" : "." + key
|
|
5
|
+
).join("");
|
|
4
6
|
}
|
|
5
7
|
export {
|
|
6
8
|
printPathArray
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -77,7 +78,14 @@ class LexicalDistance {
|
|
|
77
78
|
let smallestCell = currentRow[0] = i;
|
|
78
79
|
for (let j = 1; j <= bLength; j++) {
|
|
79
80
|
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
80
|
-
let currentCell = Math.min(
|
|
81
|
+
let currentCell = Math.min(
|
|
82
|
+
upRow[j] + 1,
|
|
83
|
+
// delete
|
|
84
|
+
currentRow[j - 1] + 1,
|
|
85
|
+
// insert
|
|
86
|
+
upRow[j - 1] + cost
|
|
87
|
+
// substitute
|
|
88
|
+
);
|
|
81
89
|
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
82
90
|
const doubleDiagonalCell = rows[(i - 2) % 3][j - 2];
|
|
83
91
|
currentCell = Math.min(currentCell, doubleDiagonalCell + 1);
|
|
@@ -56,7 +56,14 @@ var LexicalDistance = class {
|
|
|
56
56
|
let smallestCell = currentRow[0] = i;
|
|
57
57
|
for (let j = 1; j <= bLength; j++) {
|
|
58
58
|
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
59
|
-
let currentCell = Math.min(
|
|
59
|
+
let currentCell = Math.min(
|
|
60
|
+
upRow[j] + 1,
|
|
61
|
+
// delete
|
|
62
|
+
currentRow[j - 1] + 1,
|
|
63
|
+
// insert
|
|
64
|
+
upRow[j - 1] + cost
|
|
65
|
+
// substitute
|
|
66
|
+
);
|
|
60
67
|
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
61
68
|
const doubleDiagonalCell = rows[(i - 2) % 3][j - 2];
|
|
62
69
|
currentCell = Math.min(currentCell, doubleDiagonalCell + 1);
|
package/lib/jsutils/toObjMap.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -65,7 +66,15 @@ function subscribeWithoutSchema(args) {
|
|
|
65
66
|
subscribeFieldResolver
|
|
66
67
|
} = args;
|
|
67
68
|
const combinedResolvers = (0, import_mergeResolvers.mergeResolvers)(resolvers, schemaResolvers);
|
|
68
|
-
const resultOrStream = yield createSourceEventStream(
|
|
69
|
+
const resultOrStream = yield createSourceEventStream(
|
|
70
|
+
combinedResolvers,
|
|
71
|
+
document,
|
|
72
|
+
rootValue,
|
|
73
|
+
contextValue,
|
|
74
|
+
variableValues,
|
|
75
|
+
operationName,
|
|
76
|
+
subscribeFieldResolver
|
|
77
|
+
);
|
|
69
78
|
if (!(0, import_isAsyncIterable.isAsyncIterable)(resultOrStream)) {
|
|
70
79
|
return resultOrStream;
|
|
71
80
|
}
|
|
@@ -86,13 +95,23 @@ function createSourceEventStream(resolvers, document, rootValue, contextValue, v
|
|
|
86
95
|
return __async(this, null, function* () {
|
|
87
96
|
(0, import_executeWithoutSchema.assertValidExecutionArguments)(document, variableValues);
|
|
88
97
|
try {
|
|
89
|
-
const exeContext = (0, import_executeWithoutSchema.buildExecutionContext)(
|
|
98
|
+
const exeContext = (0, import_executeWithoutSchema.buildExecutionContext)(
|
|
99
|
+
resolvers,
|
|
100
|
+
document,
|
|
101
|
+
rootValue,
|
|
102
|
+
contextValue,
|
|
103
|
+
variableValues,
|
|
104
|
+
operationName,
|
|
105
|
+
fieldResolver
|
|
106
|
+
);
|
|
90
107
|
if (!("resolvers" in exeContext)) {
|
|
91
108
|
return { errors: exeContext };
|
|
92
109
|
}
|
|
93
110
|
const eventStream = yield executeSubscription(exeContext);
|
|
94
111
|
if (!(0, import_isAsyncIterable.isAsyncIterable)(eventStream)) {
|
|
95
|
-
throw new Error(
|
|
112
|
+
throw new Error(
|
|
113
|
+
`Subscription field must return Async Iterable. Received: ${(0, import_inspect.inspect)(eventStream)}.`
|
|
114
|
+
);
|
|
96
115
|
}
|
|
97
116
|
return eventStream;
|
|
98
117
|
} catch (error) {
|
|
@@ -113,7 +132,15 @@ function executeSubscription(exeContext) {
|
|
|
113
132
|
rootValue
|
|
114
133
|
} = exeContext;
|
|
115
134
|
const typeName = (0, import_executeWithoutSchema.getOperationRootTypeName)(operation);
|
|
116
|
-
const fields = (0, import_collectFields.collectFields)(
|
|
135
|
+
const fields = (0, import_collectFields.collectFields)(
|
|
136
|
+
resolvers,
|
|
137
|
+
fragments,
|
|
138
|
+
variableValues,
|
|
139
|
+
typeName,
|
|
140
|
+
operation.selectionSet,
|
|
141
|
+
/* @__PURE__ */ new Map(),
|
|
142
|
+
/* @__PURE__ */ new Set()
|
|
143
|
+
);
|
|
117
144
|
const [responseName, fieldNodes] = [...fields.entries()][0];
|
|
118
145
|
const fieldName = fieldNodes[0].name.value;
|
|
119
146
|
let resolveFn;
|
|
@@ -139,7 +166,15 @@ function executeSubscription(exeContext) {
|
|
|
139
166
|
resolveFn = exeContext.fieldResolver;
|
|
140
167
|
}
|
|
141
168
|
const path = (0, import_Path.addPath)(void 0, responseName, typeName);
|
|
142
|
-
const info = (0, import_executeWithoutSchema.buildResolveInfo)(
|
|
169
|
+
const info = (0, import_executeWithoutSchema.buildResolveInfo)(
|
|
170
|
+
exeContext,
|
|
171
|
+
fieldName,
|
|
172
|
+
fieldNodes,
|
|
173
|
+
typeName,
|
|
174
|
+
returnTypeName,
|
|
175
|
+
returnTypeNode,
|
|
176
|
+
path
|
|
177
|
+
);
|
|
143
178
|
try {
|
|
144
179
|
const args = (0, import_values.getArgumentValues)(resolvers, fieldNodes[0], variableValues);
|
|
145
180
|
const contextValue = exeContext.contextValue;
|
|
@@ -149,7 +184,11 @@ function executeSubscription(exeContext) {
|
|
|
149
184
|
}
|
|
150
185
|
return eventStream;
|
|
151
186
|
} catch (error) {
|
|
152
|
-
throw (0, import_graphql.locatedError)(
|
|
187
|
+
throw (0, import_graphql.locatedError)(
|
|
188
|
+
error,
|
|
189
|
+
fieldNodes,
|
|
190
|
+
(0, import_Path.pathToArray)(path)
|
|
191
|
+
);
|
|
153
192
|
}
|
|
154
193
|
});
|
|
155
194
|
}
|
|
@@ -54,7 +54,15 @@ function subscribeWithoutSchema(args) {
|
|
|
54
54
|
subscribeFieldResolver
|
|
55
55
|
} = args;
|
|
56
56
|
const combinedResolvers = mergeResolvers(resolvers, schemaResolvers);
|
|
57
|
-
const resultOrStream = yield createSourceEventStream(
|
|
57
|
+
const resultOrStream = yield createSourceEventStream(
|
|
58
|
+
combinedResolvers,
|
|
59
|
+
document,
|
|
60
|
+
rootValue,
|
|
61
|
+
contextValue,
|
|
62
|
+
variableValues,
|
|
63
|
+
operationName,
|
|
64
|
+
subscribeFieldResolver
|
|
65
|
+
);
|
|
58
66
|
if (!isAsyncIterable(resultOrStream)) {
|
|
59
67
|
return resultOrStream;
|
|
60
68
|
}
|
|
@@ -75,13 +83,23 @@ function createSourceEventStream(resolvers, document, rootValue, contextValue, v
|
|
|
75
83
|
return __async(this, null, function* () {
|
|
76
84
|
assertValidExecutionArguments(document, variableValues);
|
|
77
85
|
try {
|
|
78
|
-
const exeContext = buildExecutionContext(
|
|
86
|
+
const exeContext = buildExecutionContext(
|
|
87
|
+
resolvers,
|
|
88
|
+
document,
|
|
89
|
+
rootValue,
|
|
90
|
+
contextValue,
|
|
91
|
+
variableValues,
|
|
92
|
+
operationName,
|
|
93
|
+
fieldResolver
|
|
94
|
+
);
|
|
79
95
|
if (!("resolvers" in exeContext)) {
|
|
80
96
|
return { errors: exeContext };
|
|
81
97
|
}
|
|
82
98
|
const eventStream = yield executeSubscription(exeContext);
|
|
83
99
|
if (!isAsyncIterable(eventStream)) {
|
|
84
|
-
throw new Error(
|
|
100
|
+
throw new Error(
|
|
101
|
+
`Subscription field must return Async Iterable. Received: ${inspect(eventStream)}.`
|
|
102
|
+
);
|
|
85
103
|
}
|
|
86
104
|
return eventStream;
|
|
87
105
|
} catch (error) {
|
|
@@ -102,7 +120,15 @@ function executeSubscription(exeContext) {
|
|
|
102
120
|
rootValue
|
|
103
121
|
} = exeContext;
|
|
104
122
|
const typeName = getOperationRootTypeName(operation);
|
|
105
|
-
const fields = collectFields(
|
|
123
|
+
const fields = collectFields(
|
|
124
|
+
resolvers,
|
|
125
|
+
fragments,
|
|
126
|
+
variableValues,
|
|
127
|
+
typeName,
|
|
128
|
+
operation.selectionSet,
|
|
129
|
+
/* @__PURE__ */ new Map(),
|
|
130
|
+
/* @__PURE__ */ new Set()
|
|
131
|
+
);
|
|
106
132
|
const [responseName, fieldNodes] = [...fields.entries()][0];
|
|
107
133
|
const fieldName = fieldNodes[0].name.value;
|
|
108
134
|
let resolveFn;
|
|
@@ -128,7 +154,15 @@ function executeSubscription(exeContext) {
|
|
|
128
154
|
resolveFn = exeContext.fieldResolver;
|
|
129
155
|
}
|
|
130
156
|
const path = addPath(void 0, responseName, typeName);
|
|
131
|
-
const info = buildResolveInfo(
|
|
157
|
+
const info = buildResolveInfo(
|
|
158
|
+
exeContext,
|
|
159
|
+
fieldName,
|
|
160
|
+
fieldNodes,
|
|
161
|
+
typeName,
|
|
162
|
+
returnTypeName,
|
|
163
|
+
returnTypeNode,
|
|
164
|
+
path
|
|
165
|
+
);
|
|
132
166
|
try {
|
|
133
167
|
const args = getArgumentValues(resolvers, fieldNodes[0], variableValues);
|
|
134
168
|
const contextValue = exeContext.contextValue;
|
|
@@ -138,7 +172,11 @@ function executeSubscription(exeContext) {
|
|
|
138
172
|
}
|
|
139
173
|
return eventStream;
|
|
140
174
|
} catch (error) {
|
|
141
|
-
throw locatedError(
|
|
175
|
+
throw locatedError(
|
|
176
|
+
error,
|
|
177
|
+
fieldNodes,
|
|
178
|
+
pathToArray(path)
|
|
179
|
+
);
|
|
142
180
|
}
|
|
143
181
|
});
|
|
144
182
|
}
|
package/lib/types.js
CHANGED
package/lib/values.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -31,12 +32,19 @@ function getVariableValues(resolvers, varDefNodes, inputs, options) {
|
|
|
31
32
|
const errors = [];
|
|
32
33
|
const maxErrors = options == null ? void 0 : options.maxErrors;
|
|
33
34
|
try {
|
|
34
|
-
const coerced = coerceVariableValues(
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const coerced = coerceVariableValues(
|
|
36
|
+
resolvers,
|
|
37
|
+
varDefNodes,
|
|
38
|
+
inputs,
|
|
39
|
+
(error) => {
|
|
40
|
+
if (maxErrors != null && errors.length >= maxErrors) {
|
|
41
|
+
throw new import_graphql.GraphQLError(
|
|
42
|
+
"Too many errors processing variables, error limit reached. Execution aborted."
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
errors.push(error);
|
|
37
46
|
}
|
|
38
|
-
|
|
39
|
-
});
|
|
47
|
+
);
|
|
40
48
|
if (errors.length === 0) {
|
|
41
49
|
return { coerced };
|
|
42
50
|
}
|
|
@@ -53,31 +61,62 @@ function coerceVariableValues(resolvers, varDefNodes, inputs, onError) {
|
|
|
53
61
|
const varType = graphqlTypeFromTypeAst(resolvers, varTypeAst);
|
|
54
62
|
if (!(0, import_graphql.isInputType)(varType)) {
|
|
55
63
|
const varTypeStr = (0, import_inspect.inspect)(varType);
|
|
56
|
-
onError(
|
|
64
|
+
onError(
|
|
65
|
+
new import_graphql.GraphQLError(
|
|
66
|
+
`Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`,
|
|
67
|
+
varDefNode.type
|
|
68
|
+
)
|
|
69
|
+
);
|
|
57
70
|
continue;
|
|
58
71
|
}
|
|
59
72
|
if (!hasOwnProperty(inputs, varName)) {
|
|
60
73
|
if (varDefNode.defaultValue) {
|
|
61
|
-
coercedValues[varName] = (0, import_graphql.valueFromAST)(
|
|
74
|
+
coercedValues[varName] = (0, import_graphql.valueFromAST)(
|
|
75
|
+
varDefNode.defaultValue,
|
|
76
|
+
varType
|
|
77
|
+
);
|
|
62
78
|
} else if ((0, import_graphql.isNonNullType)(varType)) {
|
|
63
79
|
const varTypeStr = (0, import_graphql.print)(varDefNode.type);
|
|
64
|
-
onError(
|
|
80
|
+
onError(
|
|
81
|
+
new import_graphql.GraphQLError(
|
|
82
|
+
`Variable "$${varName}" of required type "${varTypeStr}" was not provided.`,
|
|
83
|
+
varDefNode
|
|
84
|
+
)
|
|
85
|
+
);
|
|
65
86
|
}
|
|
66
87
|
continue;
|
|
67
88
|
}
|
|
68
89
|
const value = inputs[varName];
|
|
69
90
|
if (value === null && (0, import_graphql.isNonNullType)(varType)) {
|
|
70
91
|
const varTypeStr = (0, import_inspect.inspect)(varType);
|
|
71
|
-
onError(
|
|
92
|
+
onError(
|
|
93
|
+
new import_graphql.GraphQLError(
|
|
94
|
+
`Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`,
|
|
95
|
+
varDefNode
|
|
96
|
+
)
|
|
97
|
+
);
|
|
72
98
|
continue;
|
|
73
99
|
}
|
|
74
|
-
coercedValues[varName] = (0, import_graphql.coerceInputValue)(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
100
|
+
coercedValues[varName] = (0, import_graphql.coerceInputValue)(
|
|
101
|
+
value,
|
|
102
|
+
varType,
|
|
103
|
+
(path, invalidValue, error) => {
|
|
104
|
+
let prefix = `Variable "$${varName}" got invalid value ` + (0, import_inspect.inspect)(invalidValue);
|
|
105
|
+
if (path.length > 0) {
|
|
106
|
+
prefix += ` at "${varName}${(0, import_printPathArray.printPathArray)(path)}"`;
|
|
107
|
+
}
|
|
108
|
+
onError(
|
|
109
|
+
new import_graphql.GraphQLError(
|
|
110
|
+
prefix + "; " + error.message,
|
|
111
|
+
varDefNode,
|
|
112
|
+
void 0,
|
|
113
|
+
void 0,
|
|
114
|
+
void 0,
|
|
115
|
+
error.originalError
|
|
116
|
+
)
|
|
117
|
+
);
|
|
78
118
|
}
|
|
79
|
-
|
|
80
|
-
});
|
|
119
|
+
);
|
|
81
120
|
}
|
|
82
121
|
return coercedValues;
|
|
83
122
|
}
|
|
@@ -85,14 +124,22 @@ function getArgumentValues(resolvers, node, variableValues) {
|
|
|
85
124
|
var _a;
|
|
86
125
|
const coercedValues = {};
|
|
87
126
|
const argumentNodes = (_a = node.arguments) != null ? _a : [];
|
|
88
|
-
const argNodeMap = (0, import_keyMap.keyMap)(
|
|
127
|
+
const argNodeMap = (0, import_keyMap.keyMap)(
|
|
128
|
+
argumentNodes,
|
|
129
|
+
(arg) => arg.name.value
|
|
130
|
+
);
|
|
89
131
|
for (const argumentNode of argumentNodes) {
|
|
90
132
|
const name = argumentNode.name.value;
|
|
91
133
|
const argTypeNode = argumentNode.__type;
|
|
92
134
|
const argType = graphqlTypeFromTypeAst(resolvers, argTypeNode);
|
|
93
135
|
if (!(0, import_graphql.isInputType)(argType)) {
|
|
94
136
|
console.log(argType, (0, import_graphql.isInputType)(argType));
|
|
95
|
-
throw new import_graphql.GraphQLError(
|
|
137
|
+
throw new import_graphql.GraphQLError(
|
|
138
|
+
`Argument "$${name}" expected value of type "${(0, import_inspect.inspect)(
|
|
139
|
+
argType
|
|
140
|
+
)}" which cannot be used as an input type.`,
|
|
141
|
+
argumentNode
|
|
142
|
+
);
|
|
96
143
|
}
|
|
97
144
|
let valueNode = argumentNode.value;
|
|
98
145
|
let isNull = valueNode.kind === import_graphql.Kind.NULL;
|
|
@@ -102,15 +149,27 @@ function getArgumentValues(resolvers, node, variableValues) {
|
|
|
102
149
|
if (argumentNode.__defaultValue != void 0) {
|
|
103
150
|
valueNode = argumentNode.__defaultValue;
|
|
104
151
|
} else if ((0, import_graphql.isNonNullType)(argType)) {
|
|
105
|
-
throw new import_graphql.GraphQLError(
|
|
152
|
+
throw new import_graphql.GraphQLError(
|
|
153
|
+
`Argument "${name}" of required type "${(0, import_inspect.inspect)(argType)}" was provided the variable "$${variableName}" which was not provided a runtime value.`,
|
|
154
|
+
valueNode
|
|
155
|
+
);
|
|
106
156
|
}
|
|
107
157
|
continue;
|
|
108
158
|
}
|
|
109
159
|
isNull = !variableValues || variableValues[variableName] == null;
|
|
110
160
|
}
|
|
111
|
-
const coercedValue = (0, import_graphql.valueFromAST)(
|
|
161
|
+
const coercedValue = (0, import_graphql.valueFromAST)(
|
|
162
|
+
valueNode,
|
|
163
|
+
argType,
|
|
164
|
+
variableValues
|
|
165
|
+
);
|
|
112
166
|
if (coercedValue === void 0) {
|
|
113
|
-
throw new import_graphql.GraphQLError(
|
|
167
|
+
throw new import_graphql.GraphQLError(
|
|
168
|
+
`Argument "${name}" has invalid value ${(0, import_graphql.print)(
|
|
169
|
+
valueNode
|
|
170
|
+
)}.`,
|
|
171
|
+
valueNode
|
|
172
|
+
);
|
|
114
173
|
}
|
|
115
174
|
coercedValues[name] = coercedValue;
|
|
116
175
|
}
|
|
@@ -118,7 +177,9 @@ function getArgumentValues(resolvers, node, variableValues) {
|
|
|
118
177
|
}
|
|
119
178
|
function getDirectiveValues(directiveDef, node, resolvers, variableValues) {
|
|
120
179
|
var _a;
|
|
121
|
-
const directiveNode = (_a = node.directives) == null ? void 0 : _a.find(
|
|
180
|
+
const directiveNode = (_a = node.directives) == null ? void 0 : _a.find(
|
|
181
|
+
(directive) => directive.name.value === directiveDef.name
|
|
182
|
+
);
|
|
122
183
|
if (directiveNode) {
|
|
123
184
|
return getArgumentValues(resolvers, directiveNode, variableValues);
|
|
124
185
|
}
|