@graphitation/supermassive 3.0.0-alpha.1 → 3.0.0-alpha.4
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/CHANGELOG.md +18 -2
- package/lib/__testUtils__/execute.d.ts +13 -0
- package/lib/__testUtils__/execute.d.ts.map +1 -0
- package/lib/__testUtils__/execute.js +203 -0
- package/lib/__testUtils__/execute.js.map +7 -0
- package/lib/__testUtils__/execute.mjs +181 -0
- package/lib/__testUtils__/execute.mjs.map +7 -0
- package/lib/__testUtils__/gql.d.ts +7 -0
- package/lib/__testUtils__/gql.d.ts.map +1 -0
- package/lib/{supermassive-ast/TypedAST.js → __testUtils__/gql.js} +8 -10
- package/lib/__testUtils__/gql.js.map +7 -0
- package/lib/__testUtils__/gql.mjs +8 -0
- package/lib/__testUtils__/gql.mjs.map +7 -0
- package/lib/benchmarks/index.js +15 -20
- package/lib/benchmarks/index.js.map +3 -3
- package/lib/benchmarks/index.mjs +16 -23
- package/lib/benchmarks/index.mjs.map +2 -2
- package/lib/collectFields.d.ts +4 -9
- package/lib/collectFields.d.ts.map +1 -1
- package/lib/collectFields.js +38 -99
- package/lib/collectFields.js.map +2 -2
- package/lib/collectFields.mjs +41 -100
- package/lib/collectFields.mjs.map +2 -2
- package/lib/executeWithSchema.d.ts +1 -1
- package/lib/executeWithSchema.d.ts.map +1 -1
- package/lib/executeWithSchema.js +27 -17
- package/lib/executeWithSchema.js.map +2 -2
- package/lib/executeWithSchema.mjs +32 -24
- package/lib/executeWithSchema.mjs.map +2 -2
- package/lib/executeWithoutSchema.d.ts +9 -5
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +217 -242
- package/lib/executeWithoutSchema.js.map +3 -3
- package/lib/executeWithoutSchema.mjs +225 -249
- package/lib/executeWithoutSchema.mjs.map +3 -3
- package/lib/index.d.ts +16 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +24 -11
- package/lib/index.js.map +2 -2
- package/lib/index.mjs +32 -11
- package/lib/index.mjs.map +2 -2
- package/lib/schema/definition.d.ts +100 -0
- package/lib/schema/definition.d.ts.map +1 -0
- package/lib/schema/definition.js +77 -0
- package/lib/schema/definition.js.map +7 -0
- package/lib/schema/definition.mjs +58 -0
- package/lib/schema/definition.mjs.map +7 -0
- package/lib/schema/directives.d.ts +42 -0
- package/lib/schema/directives.d.ts.map +1 -0
- package/lib/schema/directives.js +87 -0
- package/lib/schema/directives.js.map +7 -0
- package/lib/schema/directives.mjs +70 -0
- package/lib/schema/directives.mjs.map +7 -0
- package/lib/schema/fragment.d.ts +63 -0
- package/lib/schema/fragment.d.ts.map +1 -0
- package/lib/schema/fragment.js +295 -0
- package/lib/schema/fragment.js.map +7 -0
- package/lib/schema/fragment.mjs +292 -0
- package/lib/schema/fragment.mjs.map +7 -0
- package/lib/schema/reference.d.ts +12 -0
- package/lib/schema/reference.d.ts.map +1 -0
- package/lib/schema/reference.js +137 -0
- package/lib/schema/reference.js.map +7 -0
- package/lib/schema/reference.mjs +118 -0
- package/lib/schema/reference.mjs.map +7 -0
- package/lib/schema/resolvers.d.ts +9 -0
- package/lib/schema/resolvers.d.ts.map +1 -0
- package/lib/schema/resolvers.js +47 -0
- package/lib/schema/resolvers.js.map +7 -0
- package/lib/schema/resolvers.mjs +35 -0
- package/lib/schema/resolvers.mjs.map +7 -0
- package/lib/subscribeWithSchema.d.ts +1 -1
- package/lib/subscribeWithSchema.d.ts.map +1 -1
- package/lib/subscribeWithSchema.js +27 -17
- package/lib/subscribeWithSchema.js.map +2 -2
- package/lib/subscribeWithSchema.mjs +32 -24
- package/lib/subscribeWithSchema.mjs.map +2 -2
- package/lib/types.d.ts +16 -27
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +0 -14
- package/lib/types.js.map +2 -2
- package/lib/types.mjs +0 -11
- package/lib/types.mjs.map +3 -3
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.d.ts +12 -0
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.d.ts.map +1 -0
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.js +116 -0
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.js.map +7 -0
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.mjs +105 -0
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.mjs.map +7 -0
- package/lib/utilities/annotateDocumentGraphQLTransform.d.ts +4 -0
- package/lib/utilities/annotateDocumentGraphQLTransform.d.ts.map +1 -0
- package/lib/{supermassive-ast → utilities}/annotateDocumentGraphQLTransform.js +3 -10
- package/lib/utilities/annotateDocumentGraphQLTransform.js.map +7 -0
- package/lib/utilities/annotateDocumentGraphQLTransform.mjs +10 -0
- package/lib/utilities/annotateDocumentGraphQLTransform.mjs.map +7 -0
- package/lib/utilities/coerceInputValue.d.ts +10 -0
- package/lib/utilities/coerceInputValue.d.ts.map +1 -0
- package/lib/utilities/coerceInputValue.js +181 -0
- package/lib/utilities/coerceInputValue.js.map +7 -0
- package/lib/utilities/coerceInputValue.mjs +167 -0
- package/lib/utilities/coerceInputValue.mjs.map +7 -0
- package/lib/utilities/decodeASTSchema.d.ts +7 -0
- package/lib/utilities/decodeASTSchema.d.ts.map +1 -0
- package/lib/utilities/decodeASTSchema.js +246 -0
- package/lib/utilities/decodeASTSchema.js.map +7 -0
- package/lib/utilities/decodeASTSchema.mjs +245 -0
- package/lib/utilities/decodeASTSchema.mjs.map +7 -0
- package/lib/utilities/encodeASTSchema.d.ts +4 -0
- package/lib/utilities/encodeASTSchema.d.ts.map +1 -0
- package/lib/utilities/encodeASTSchema.js +151 -0
- package/lib/utilities/encodeASTSchema.js.map +7 -0
- package/lib/utilities/encodeASTSchema.mjs +134 -0
- package/lib/utilities/encodeASTSchema.mjs.map +7 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.d.ts +8 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.d.ts.map +1 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.js +238 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.js.map +7 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.mjs +245 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.mjs.map +7 -0
- package/lib/utilities/makeReadableErrorPath.d.ts +3 -0
- package/lib/utilities/makeReadableErrorPath.d.ts.map +1 -0
- package/lib/utilities/makeReadableErrorPath.js +47 -0
- package/lib/utilities/makeReadableErrorPath.js.map +7 -0
- package/lib/utilities/makeReadableErrorPath.mjs +28 -0
- package/lib/utilities/makeReadableErrorPath.mjs.map +7 -0
- package/lib/utilities/mergeResolvers.d.ts +2 -2
- package/lib/utilities/mergeResolvers.d.ts.map +1 -1
- package/lib/utilities/mergeResolvers.js +20 -22
- package/lib/utilities/mergeResolvers.js.map +2 -2
- package/lib/utilities/mergeResolvers.mjs +20 -25
- package/lib/utilities/mergeResolvers.mjs.map +2 -2
- package/lib/utilities/mergeSchemaDefinitions.d.ts +8 -0
- package/lib/utilities/mergeSchemaDefinitions.d.ts.map +1 -0
- package/lib/utilities/mergeSchemaDefinitions.js +126 -0
- package/lib/utilities/mergeSchemaDefinitions.js.map +7 -0
- package/lib/utilities/mergeSchemaDefinitions.mjs +114 -0
- package/lib/utilities/mergeSchemaDefinitions.mjs.map +7 -0
- package/lib/utilities/typeNameFromAST.d.ts +1 -1
- package/lib/utilities/typeNameFromAST.d.ts.map +1 -1
- package/lib/utilities/typeNameFromAST.js.map +2 -2
- package/lib/utilities/typeNameFromAST.mjs.map +2 -2
- package/lib/utilities/valueFromAST.d.ts +27 -0
- package/lib/utilities/valueFromAST.d.ts.map +1 -0
- package/lib/utilities/valueFromAST.js +139 -0
- package/lib/utilities/valueFromAST.js.map +7 -0
- package/lib/utilities/valueFromAST.mjs +125 -0
- package/lib/utilities/valueFromAST.mjs.map +7 -0
- package/lib/utilities/valueFromASTUntyped.d.ts +21 -0
- package/lib/utilities/valueFromASTUntyped.d.ts.map +1 -0
- package/lib/utilities/valueFromASTUntyped.js +51 -0
- package/lib/utilities/valueFromASTUntyped.js.map +7 -0
- package/lib/utilities/valueFromASTUntyped.mjs +32 -0
- package/lib/utilities/valueFromASTUntyped.mjs.map +7 -0
- package/lib/values.d.ts +8 -12
- package/lib/values.d.ts.map +1 -1
- package/lib/values.js +75 -63
- package/lib/values.js.map +2 -2
- package/lib/values.mjs +77 -71
- package/lib/values.mjs.map +2 -2
- package/package.json +8 -6
- package/lib/definition.d.ts +0 -7
- package/lib/definition.d.ts.map +0 -1
- package/lib/definition.js +0 -59
- package/lib/definition.js.map +0 -7
- package/lib/definition.mjs +0 -40
- package/lib/definition.mjs.map +0 -7
- package/lib/directives.d.ts +0 -8
- package/lib/directives.d.ts.map +0 -1
- package/lib/directives.js +0 -47
- package/lib/directives.js.map +0 -7
- package/lib/directives.mjs +0 -37
- package/lib/directives.mjs.map +0 -7
- package/lib/extractImplicitTypesRuntime.d.ts +0 -4
- package/lib/extractImplicitTypesRuntime.d.ts.map +0 -1
- package/lib/extractImplicitTypesRuntime.js +0 -123
- package/lib/extractImplicitTypesRuntime.js.map +0 -7
- package/lib/extractImplicitTypesRuntime.mjs +0 -114
- package/lib/extractImplicitTypesRuntime.mjs.map +0 -7
- package/lib/supermassive-ast/TypedAST.d.ts +0 -370
- package/lib/supermassive-ast/TypedAST.d.ts.map +0 -1
- package/lib/supermassive-ast/TypedAST.js.map +0 -7
- package/lib/supermassive-ast/TypedAST.mjs +0 -10
- package/lib/supermassive-ast/TypedAST.mjs.map +0 -7
- package/lib/supermassive-ast/addTypesToRequestDocument.d.ts +0 -56
- package/lib/supermassive-ast/addTypesToRequestDocument.d.ts.map +0 -1
- package/lib/supermassive-ast/addTypesToRequestDocument.js +0 -473
- package/lib/supermassive-ast/addTypesToRequestDocument.js.map +0 -7
- package/lib/supermassive-ast/addTypesToRequestDocument.mjs +0 -463
- package/lib/supermassive-ast/addTypesToRequestDocument.mjs.map +0 -7
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.d.ts +0 -3
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.d.ts.map +0 -1
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.js.map +0 -7
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs +0 -17
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs.map +0 -7
- package/lib/supermassive-ast/directives.d.ts +0 -36
- package/lib/supermassive-ast/directives.d.ts.map +0 -1
- package/lib/supermassive-ast/directives.js +0 -165
- package/lib/supermassive-ast/directives.js.map +0 -7
- package/lib/supermassive-ast/directives.mjs +0 -153
- package/lib/supermassive-ast/directives.mjs.map +0 -7
- package/lib/supermassive-ast/index.d.ts +0 -6
- package/lib/supermassive-ast/index.d.ts.map +0 -1
- package/lib/supermassive-ast/index.js +0 -37
- package/lib/supermassive-ast/index.js.map +0 -7
- package/lib/supermassive-ast/index.mjs +0 -27
- package/lib/supermassive-ast/index.mjs.map +0 -7
package/lib/values.js
CHANGED
|
@@ -20,19 +20,21 @@ var values_exports = {};
|
|
|
20
20
|
__export(values_exports, {
|
|
21
21
|
getArgumentValues: () => getArgumentValues,
|
|
22
22
|
getDirectiveValues: () => getDirectiveValues,
|
|
23
|
-
getVariableValues: () => getVariableValues
|
|
24
|
-
specifiedScalars: () => specifiedScalars
|
|
23
|
+
getVariableValues: () => getVariableValues
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(values_exports);
|
|
27
26
|
var import_graphql = require("graphql");
|
|
28
27
|
var import_inspect = require("./jsutils/inspect");
|
|
29
28
|
var import_printPathArray = require("./jsutils/printPathArray");
|
|
30
|
-
|
|
29
|
+
var import_valueFromAST = require("./utilities/valueFromAST");
|
|
30
|
+
var import_coerceInputValue = require("./utilities/coerceInputValue");
|
|
31
|
+
var import_reference = require("./schema/reference");
|
|
32
|
+
function getVariableValues(schemaTypes, varDefNodes, inputs, options) {
|
|
31
33
|
const errors = [];
|
|
32
34
|
const maxErrors = options == null ? void 0 : options.maxErrors;
|
|
33
35
|
try {
|
|
34
36
|
const coerced = coerceVariableValues(
|
|
35
|
-
|
|
37
|
+
schemaTypes,
|
|
36
38
|
varDefNodes,
|
|
37
39
|
inputs,
|
|
38
40
|
(error) => {
|
|
@@ -52,14 +54,13 @@ function getVariableValues(resolvers, varDefNodes, inputs, options) {
|
|
|
52
54
|
}
|
|
53
55
|
return { errors };
|
|
54
56
|
}
|
|
55
|
-
function coerceVariableValues(
|
|
57
|
+
function coerceVariableValues(schemaTypes, varDefNodes, inputs, onError) {
|
|
56
58
|
const coercedValues = {};
|
|
57
59
|
for (const varDefNode of varDefNodes) {
|
|
58
60
|
const varName = varDefNode.variable.name.value;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const varTypeStr = (0, import_inspect.inspect)(varType);
|
|
61
|
+
const varTypeReference = (0, import_reference.typeReferenceFromNode)(varDefNode.type);
|
|
62
|
+
if (!schemaTypes.isInputType(varTypeReference)) {
|
|
63
|
+
const varTypeStr = (0, import_reference.inspectTypeReference)(varTypeReference);
|
|
63
64
|
onError(
|
|
64
65
|
new import_graphql.GraphQLError(
|
|
65
66
|
`Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`,
|
|
@@ -70,12 +71,13 @@ function coerceVariableValues(resolvers, varDefNodes, inputs, onError) {
|
|
|
70
71
|
}
|
|
71
72
|
if (!hasOwnProperty(inputs, varName)) {
|
|
72
73
|
if (varDefNode.defaultValue) {
|
|
73
|
-
coercedValues[varName] = (0,
|
|
74
|
+
coercedValues[varName] = (0, import_valueFromAST.valueFromAST)(
|
|
74
75
|
varDefNode.defaultValue,
|
|
75
|
-
|
|
76
|
+
varTypeReference,
|
|
77
|
+
schemaTypes
|
|
76
78
|
);
|
|
77
|
-
} else if ((0,
|
|
78
|
-
const varTypeStr = (0,
|
|
79
|
+
} else if ((0, import_reference.isNonNullType)(varTypeReference)) {
|
|
80
|
+
const varTypeStr = (0, import_reference.inspectTypeReference)(varTypeReference);
|
|
79
81
|
onError(
|
|
80
82
|
new import_graphql.GraphQLError(
|
|
81
83
|
`Variable "$${varName}" of required type "${varTypeStr}" was not provided.`,
|
|
@@ -86,8 +88,8 @@ function coerceVariableValues(resolvers, varDefNodes, inputs, onError) {
|
|
|
86
88
|
continue;
|
|
87
89
|
}
|
|
88
90
|
const value = inputs[varName];
|
|
89
|
-
if (value === null && (0,
|
|
90
|
-
const varTypeStr = (0,
|
|
91
|
+
if (value === null && (0, import_reference.isNonNullType)(varTypeReference)) {
|
|
92
|
+
const varTypeStr = (0, import_reference.inspectTypeReference)(varTypeReference);
|
|
91
93
|
onError(
|
|
92
94
|
new import_graphql.GraphQLError(
|
|
93
95
|
`Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`,
|
|
@@ -96,9 +98,10 @@ function coerceVariableValues(resolvers, varDefNodes, inputs, onError) {
|
|
|
96
98
|
);
|
|
97
99
|
continue;
|
|
98
100
|
}
|
|
99
|
-
coercedValues[varName] = (0,
|
|
101
|
+
coercedValues[varName] = (0, import_coerceInputValue.coerceInputValue)(
|
|
100
102
|
value,
|
|
101
|
-
|
|
103
|
+
varTypeReference,
|
|
104
|
+
schemaTypes,
|
|
102
105
|
(path, invalidValue, error) => {
|
|
103
106
|
let prefix = `Variable "$${varName}" got invalid value ` + (0, import_inspect.inspect)(invalidValue);
|
|
104
107
|
if (path.length > 0) {
|
|
@@ -115,47 +118,72 @@ function coerceVariableValues(resolvers, varDefNodes, inputs, onError) {
|
|
|
115
118
|
}
|
|
116
119
|
return coercedValues;
|
|
117
120
|
}
|
|
118
|
-
function getArgumentValues(
|
|
121
|
+
function getArgumentValues(exeContext, def, node) {
|
|
119
122
|
var _a;
|
|
123
|
+
const schemaTypes = exeContext.partialSchema;
|
|
120
124
|
const coercedValues = {};
|
|
125
|
+
const argumentDefs = schemaTypes.resolveDefinitionArguments(def);
|
|
126
|
+
if (!argumentDefs) {
|
|
127
|
+
return coercedValues;
|
|
128
|
+
}
|
|
121
129
|
const argumentNodes = (_a = node.arguments) != null ? _a : [];
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
const argNodeMap = new Map(argumentNodes.map((arg) => [arg.name.value, arg]));
|
|
131
|
+
for (const [name, argumentDef] of Object.entries(argumentDefs)) {
|
|
132
|
+
const argumentNode = argNodeMap.get(name);
|
|
133
|
+
const argumentTypeRef = schemaTypes.getTypeReference(argumentDef);
|
|
134
|
+
const defaultValue = schemaTypes.getInputDefaultValue(argumentDef);
|
|
135
|
+
if (argumentNode == null) {
|
|
136
|
+
if (defaultValue !== void 0) {
|
|
137
|
+
coercedValues[name] = defaultValue;
|
|
138
|
+
} else if ((0, import_reference.isNonNullType)(argumentTypeRef)) {
|
|
139
|
+
const type = (0, import_reference.inspectTypeReference)(argumentTypeRef);
|
|
140
|
+
throw (0, import_graphql.locatedError)(
|
|
141
|
+
`Argument "${name}" of required type "${type}" was not provided.`,
|
|
142
|
+
[node]
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (!schemaTypes.isDefined(argumentTypeRef)) {
|
|
148
|
+
throw (0, import_graphql.locatedError)(
|
|
149
|
+
`Could not find type for argument ${name} in ${node.kind} ${node.name.value}`,
|
|
150
|
+
[argumentNode]
|
|
132
151
|
);
|
|
133
152
|
}
|
|
134
|
-
|
|
153
|
+
const valueNode = argumentNode.value;
|
|
154
|
+
let isNull = valueNode.kind === import_graphql.Kind.NULL;
|
|
135
155
|
if (valueNode.kind === import_graphql.Kind.VARIABLE) {
|
|
136
156
|
const variableName = valueNode.name.value;
|
|
137
|
-
if (variableValues == null || !hasOwnProperty(variableValues, variableName)) {
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
} else if ((0,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
{
|
|
157
|
+
if (exeContext.variableValues == null || !hasOwnProperty(exeContext.variableValues, variableName)) {
|
|
158
|
+
if (defaultValue !== void 0) {
|
|
159
|
+
coercedValues[name] = defaultValue;
|
|
160
|
+
} else if ((0, import_reference.isNonNullType)(argumentTypeRef)) {
|
|
161
|
+
const type = (0, import_reference.inspectTypeReference)(argumentTypeRef);
|
|
162
|
+
throw (0, import_graphql.locatedError)(
|
|
163
|
+
`Argument "${name}" of required type "${type}" was provided the variable "$${variableName}" which was not provided a runtime value.`,
|
|
164
|
+
[valueNode]
|
|
144
165
|
);
|
|
145
166
|
}
|
|
146
167
|
continue;
|
|
147
168
|
}
|
|
169
|
+
isNull = exeContext.variableValues[variableName] == null;
|
|
170
|
+
}
|
|
171
|
+
if (isNull && (0, import_reference.isNonNullType)(argumentTypeRef)) {
|
|
172
|
+
const type = (0, import_reference.inspectTypeReference)(argumentTypeRef);
|
|
173
|
+
throw (0, import_graphql.locatedError)(
|
|
174
|
+
`Argument "${name}" of non-null type "${type}" must not be null."`,
|
|
175
|
+
[valueNode]
|
|
176
|
+
);
|
|
148
177
|
}
|
|
149
|
-
const coercedValue = (0,
|
|
178
|
+
const coercedValue = (0, import_valueFromAST.valueFromAST)(
|
|
150
179
|
valueNode,
|
|
151
|
-
|
|
152
|
-
|
|
180
|
+
argumentTypeRef,
|
|
181
|
+
schemaTypes,
|
|
182
|
+
exeContext.variableValues
|
|
153
183
|
);
|
|
154
184
|
if (coercedValue === void 0) {
|
|
155
185
|
throw new import_graphql.GraphQLError(
|
|
156
|
-
`Argument "${name}" has invalid value ${(0, import_graphql.print)(
|
|
157
|
-
valueNode
|
|
158
|
-
)}.`,
|
|
186
|
+
`Argument "${name}" has invalid value ${(0, import_graphql.print)(valueNode)}.`,
|
|
159
187
|
{ nodes: valueNode }
|
|
160
188
|
);
|
|
161
189
|
}
|
|
@@ -163,33 +191,17 @@ function getArgumentValues(resolvers, node, variableValues) {
|
|
|
163
191
|
}
|
|
164
192
|
return coercedValues;
|
|
165
193
|
}
|
|
166
|
-
function getDirectiveValues(directiveDef, node
|
|
194
|
+
function getDirectiveValues(exeContext, directiveDef, node) {
|
|
167
195
|
var _a;
|
|
196
|
+
const schemaTypes = exeContext.partialSchema;
|
|
197
|
+
const name = schemaTypes.getDirectiveName(directiveDef);
|
|
168
198
|
const directiveNode = (_a = node.directives) == null ? void 0 : _a.find(
|
|
169
|
-
(directive) => directive.name.value ===
|
|
199
|
+
(directive) => directive.name.value === name
|
|
170
200
|
);
|
|
171
201
|
if (directiveNode) {
|
|
172
|
-
return getArgumentValues(
|
|
202
|
+
return getArgumentValues(exeContext, directiveDef, directiveNode);
|
|
173
203
|
}
|
|
174
204
|
}
|
|
175
205
|
function hasOwnProperty(obj, prop) {
|
|
176
206
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
177
207
|
}
|
|
178
|
-
const specifiedScalars = {
|
|
179
|
-
ID: import_graphql.GraphQLID,
|
|
180
|
-
String: import_graphql.GraphQLString,
|
|
181
|
-
Int: import_graphql.GraphQLInt,
|
|
182
|
-
Float: import_graphql.GraphQLFloat,
|
|
183
|
-
Boolean: import_graphql.GraphQLBoolean
|
|
184
|
-
};
|
|
185
|
-
function graphqlTypeFromTypeAst(resolvers, node) {
|
|
186
|
-
if (node.kind === import_graphql.Kind.NON_NULL_TYPE) {
|
|
187
|
-
return new import_graphql.GraphQLNonNull(graphqlTypeFromTypeAst(resolvers, node.type));
|
|
188
|
-
} else if (node.kind === import_graphql.Kind.LIST_TYPE) {
|
|
189
|
-
return new import_graphql.GraphQLList(graphqlTypeFromTypeAst(resolvers, node.type));
|
|
190
|
-
} else {
|
|
191
|
-
const typeName = node.name.value;
|
|
192
|
-
const type = specifiedScalars[typeName] || resolvers[typeName];
|
|
193
|
-
return type;
|
|
194
|
-
}
|
|
195
|
-
}
|
package/lib/values.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/values.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import {\n GraphQLError,\n Kind,\n print,\n locatedError,\n DirectiveNode,\n FieldNode,\n VariableDefinitionNode,\n} from \"graphql\";\nimport { inspect } from \"./jsutils/inspect\";\nimport { printPathArray } from \"./jsutils/printPathArray\";\nimport { ExecutionContext } from \"./executeWithoutSchema\";\nimport { DirectiveDefinitionTuple, FieldDefinition } from \"./schema/definition\";\nimport { valueFromAST } from \"./utilities/valueFromAST\";\nimport { PartialSchema } from \"./schema/fragment\";\nimport { coerceInputValue } from \"./utilities/coerceInputValue\";\nimport {\n inspectTypeReference,\n isNonNullType,\n typeReferenceFromNode,\n} from \"./schema/reference\";\n\ntype CoercedVariableValues =\n | { errors: Array<GraphQLError>; coerced?: never }\n | { coerced: { [variable: string]: unknown }; errors?: never };\n\n/**\n * Prepares an object map of variableValues of the correct type based on the\n * provided variable definitions and arbitrary input. If the input cannot be\n * parsed to match the variable definitions, a GraphQLError will be thrown.\n *\n * Note: The returned value is a plain Object with a prototype, since it is\n * exposed to user code. Care should be taken to not pull values from the\n * Object prototype.\n *\n * @internal\n */\nexport function getVariableValues(\n schemaTypes: PartialSchema,\n varDefNodes: ReadonlyArray<VariableDefinitionNode>,\n inputs: { [variable: string]: unknown },\n options?: { maxErrors?: number },\n): CoercedVariableValues {\n const errors: GraphQLError[] = [];\n const maxErrors = options?.maxErrors;\n try {\n const coerced = coerceVariableValues(\n schemaTypes,\n varDefNodes,\n inputs,\n (error) => {\n if (maxErrors != null && errors.length >= maxErrors) {\n throw new GraphQLError(\n \"Too many errors processing variables, error limit reached. Execution aborted.\",\n );\n }\n errors.push(error);\n },\n );\n\n if (errors.length === 0) {\n return { coerced };\n }\n } catch (error) {\n errors.push(error as GraphQLError);\n }\n\n return { errors: errors };\n}\n\nfunction coerceVariableValues(\n schemaTypes: PartialSchema,\n varDefNodes: ReadonlyArray<VariableDefinitionNode>,\n inputs: { [variable: string]: unknown },\n onError: (error: GraphQLError) => void,\n): { [variable: string]: unknown } {\n const coercedValues: { [variable: string]: unknown } = {};\n for (const varDefNode of varDefNodes) {\n const varName = varDefNode.variable.name.value;\n const varTypeReference = typeReferenceFromNode(varDefNode.type);\n\n if (!schemaTypes.isInputType(varTypeReference)) {\n // Must use input types for variables. This should be caught during\n // validation, however is checked again here for safety.\n const varTypeStr = inspectTypeReference(varTypeReference);\n onError(\n new GraphQLError(\n `Variable \"$${varName}\" expected value of type \"${varTypeStr}\" which cannot be used as an input type.`,\n { nodes: varDefNode.type },\n ),\n );\n continue;\n }\n\n if (!hasOwnProperty(inputs, varName)) {\n if (varDefNode.defaultValue) {\n coercedValues[varName] = valueFromAST(\n varDefNode.defaultValue,\n varTypeReference,\n schemaTypes,\n );\n } else if (isNonNullType(varTypeReference)) {\n const varTypeStr = inspectTypeReference(varTypeReference);\n onError(\n new GraphQLError(\n `Variable \"$${varName}\" of required type \"${varTypeStr}\" was not provided.`,\n { nodes: varDefNode },\n ),\n );\n }\n continue;\n }\n\n const value = inputs[varName];\n if (value === null && isNonNullType(varTypeReference)) {\n const varTypeStr = inspectTypeReference(varTypeReference);\n onError(\n new GraphQLError(\n `Variable \"$${varName}\" of non-null type \"${varTypeStr}\" must not be null.`,\n { nodes: varDefNode },\n ),\n );\n continue;\n }\n\n coercedValues[varName] = coerceInputValue(\n value,\n varTypeReference,\n schemaTypes,\n (path, invalidValue, error) => {\n let prefix =\n `Variable \"$${varName}\" got invalid value ` + inspect(invalidValue);\n if (path.length > 0) {\n prefix += ` at \"${varName}${printPathArray(path)}\"`;\n }\n onError(\n new GraphQLError(prefix + \"; \" + error.message, {\n nodes: varDefNode,\n originalError: error.originalError,\n }),\n );\n },\n );\n }\n\n return coercedValues;\n}\n\n/**\n * Prepares an object map of argument values given a list of argument\n * definitions and list of argument AST nodes.\n *\n * Note: The returned value is a plain Object with a prototype, since it is\n * exposed to user code. Care should be taken to not pull values from the\n * Object prototype.\n *\n * @internal\n */\nexport function getArgumentValues(\n exeContext: ExecutionContext,\n def: FieldDefinition | DirectiveDefinitionTuple,\n node: FieldNode | DirectiveNode,\n): { [argument: string]: unknown } {\n const schemaTypes = exeContext.partialSchema;\n const coercedValues: { [argument: string]: unknown } = {};\n const argumentDefs = schemaTypes.resolveDefinitionArguments(def);\n if (!argumentDefs) {\n return coercedValues;\n }\n // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n const argumentNodes = node.arguments ?? [];\n const argNodeMap = new Map(argumentNodes.map((arg) => [arg.name.value, arg]));\n\n for (const [name, argumentDef] of Object.entries(argumentDefs)) {\n const argumentNode = argNodeMap.get(name);\n const argumentTypeRef = schemaTypes.getTypeReference(argumentDef);\n const defaultValue = schemaTypes.getInputDefaultValue(argumentDef);\n\n if (argumentNode == null) {\n if (defaultValue !== undefined) {\n coercedValues[name] = defaultValue;\n } else if (isNonNullType(argumentTypeRef)) {\n const type = inspectTypeReference(argumentTypeRef);\n throw locatedError(\n `Argument \"${name}\" of required type \"${type}\" was not provided.`,\n [node],\n );\n }\n continue;\n }\n\n if (!schemaTypes.isDefined(argumentTypeRef)) {\n throw locatedError(\n `Could not find type for argument ${name} in ${node.kind} ${node.name.value}`,\n [argumentNode],\n );\n }\n\n // if (!schemaTypes.isInputType(argumentTypeRef)) {\n // const type = schemaTypes.printTypeRef(argumentTypeRef);\n // throw locatedError(\n // `Argument \"$${name}\" expected value of type \"${type}\" which cannot be used as an input type.`,\n // [argumentNode],\n // );\n // }\n\n const valueNode = argumentNode.value;\n let isNull = valueNode.kind === Kind.NULL;\n\n if (valueNode.kind === Kind.VARIABLE) {\n const variableName = valueNode.name.value;\n if (\n exeContext.variableValues == null ||\n !hasOwnProperty(exeContext.variableValues, variableName)\n ) {\n if (defaultValue !== undefined) {\n coercedValues[name] = defaultValue;\n } else if (isNonNullType(argumentTypeRef)) {\n const type = inspectTypeReference(argumentTypeRef);\n throw locatedError(\n `Argument \"${name}\" of required type \"${type}\" ` +\n `was provided the variable \"$${variableName}\" which was not provided a runtime value.`,\n [valueNode],\n );\n }\n continue;\n }\n isNull = exeContext.variableValues[variableName] == null;\n }\n\n if (isNull && isNonNullType(argumentTypeRef)) {\n const type = inspectTypeReference(argumentTypeRef);\n throw locatedError(\n `Argument \"${name}\" of non-null type \"${type}\" must not be null.\"`,\n [valueNode],\n );\n }\n\n const coercedValue = valueFromAST(\n valueNode,\n argumentTypeRef,\n schemaTypes,\n exeContext.variableValues,\n );\n if (coercedValue === undefined) {\n // Note: ValuesOfCorrectTypeRule validation should catch this before\n // execution. This is a runtime check to ensure execution does not\n // continue with an invalid argument value.\n throw new GraphQLError(\n `Argument \"${name}\" has invalid value ${print(valueNode)}.`,\n { nodes: valueNode },\n );\n }\n coercedValues[name] = coercedValue;\n }\n\n return coercedValues;\n}\n\n/**\n * Prepares an object map of argument values given a directive definition\n * and a AST node which may contain directives. Optionally also accepts a map\n * of variable values.\n *\n * If the directive does not exist on the node, returns undefined.\n *\n * Note: The returned value is a plain Object with a prototype, since it is\n * exposed to user code. Care should be taken to not pull values from the\n * Object prototype.\n */\nexport function getDirectiveValues(\n exeContext: ExecutionContext,\n directiveDef: DirectiveDefinitionTuple,\n node: { directives?: ReadonlyArray<DirectiveNode> },\n): undefined | { [argument: string]: unknown } {\n const schemaTypes = exeContext.partialSchema;\n const name = schemaTypes.getDirectiveName(directiveDef);\n\n // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n const directiveNode = node.directives?.find(\n (directive) => directive.name.value === name,\n );\n\n if (directiveNode) {\n return getArgumentValues(exeContext, directiveDef, directiveNode);\n }\n}\n\nfunction hasOwnProperty(obj: unknown, prop: string): boolean {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AAAA,EACxB;AAEA,SAAO;AACT;AAaO,SAAS,mBACd,YACA,cACA,MAC6C;AAlR/C;AAmRE,QAAM,cAAc,WAAW;AAC/B,QAAM,OAAO,YAAY,iBAAiB,YAAY;AAGtD,QAAM,iBAAgB,UAAK,eAAL,mBAAiB;AAAA,IACrC,CAAC,cAAc,UAAU,KAAK,UAAU;AAAA;AAG1C,MAAI,eAAe;AACjB,WAAO,kBAAkB,YAAY,cAAc,aAAa;AAAA,EAClE;AACF;AAEA,SAAS,eAAe,KAAc,MAAuB;AAC3D,SAAO,OAAO,UAAU,eAAe,KAAK,KAAK,IAAI;AACvD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/values.mjs
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
// src/values.ts
|
|
2
2
|
import {
|
|
3
|
-
GraphQLBoolean,
|
|
4
3
|
GraphQLError,
|
|
5
|
-
GraphQLFloat,
|
|
6
|
-
GraphQLID,
|
|
7
|
-
GraphQLInt,
|
|
8
|
-
GraphQLList,
|
|
9
|
-
GraphQLNonNull,
|
|
10
|
-
GraphQLString,
|
|
11
|
-
isInputType,
|
|
12
|
-
isNonNullType,
|
|
13
4
|
Kind,
|
|
14
5
|
print,
|
|
15
|
-
|
|
16
|
-
coerceInputValue
|
|
6
|
+
locatedError
|
|
17
7
|
} from "graphql";
|
|
18
8
|
import { inspect } from "./jsutils/inspect.mjs";
|
|
19
9
|
import { printPathArray } from "./jsutils/printPathArray.mjs";
|
|
20
|
-
|
|
10
|
+
import { valueFromAST } from "./utilities/valueFromAST.mjs";
|
|
11
|
+
import { coerceInputValue } from "./utilities/coerceInputValue.mjs";
|
|
12
|
+
import {
|
|
13
|
+
inspectTypeReference,
|
|
14
|
+
isNonNullType,
|
|
15
|
+
typeReferenceFromNode
|
|
16
|
+
} from "./schema/reference.mjs";
|
|
17
|
+
function getVariableValues(schemaTypes, varDefNodes, inputs, options) {
|
|
21
18
|
const errors = [];
|
|
22
19
|
const maxErrors = options == null ? void 0 : options.maxErrors;
|
|
23
20
|
try {
|
|
24
21
|
const coerced = coerceVariableValues(
|
|
25
|
-
|
|
22
|
+
schemaTypes,
|
|
26
23
|
varDefNodes,
|
|
27
24
|
inputs,
|
|
28
25
|
(error) => {
|
|
@@ -42,14 +39,13 @@ function getVariableValues(resolvers, varDefNodes, inputs, options) {
|
|
|
42
39
|
}
|
|
43
40
|
return { errors };
|
|
44
41
|
}
|
|
45
|
-
function coerceVariableValues(
|
|
42
|
+
function coerceVariableValues(schemaTypes, varDefNodes, inputs, onError) {
|
|
46
43
|
const coercedValues = {};
|
|
47
44
|
for (const varDefNode of varDefNodes) {
|
|
48
45
|
const varName = varDefNode.variable.name.value;
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const varTypeStr = inspect(varType);
|
|
46
|
+
const varTypeReference = typeReferenceFromNode(varDefNode.type);
|
|
47
|
+
if (!schemaTypes.isInputType(varTypeReference)) {
|
|
48
|
+
const varTypeStr = inspectTypeReference(varTypeReference);
|
|
53
49
|
onError(
|
|
54
50
|
new GraphQLError(
|
|
55
51
|
`Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`,
|
|
@@ -62,10 +58,11 @@ function coerceVariableValues(resolvers, varDefNodes, inputs, onError) {
|
|
|
62
58
|
if (varDefNode.defaultValue) {
|
|
63
59
|
coercedValues[varName] = valueFromAST(
|
|
64
60
|
varDefNode.defaultValue,
|
|
65
|
-
|
|
61
|
+
varTypeReference,
|
|
62
|
+
schemaTypes
|
|
66
63
|
);
|
|
67
|
-
} else if (isNonNullType(
|
|
68
|
-
const varTypeStr =
|
|
64
|
+
} else if (isNonNullType(varTypeReference)) {
|
|
65
|
+
const varTypeStr = inspectTypeReference(varTypeReference);
|
|
69
66
|
onError(
|
|
70
67
|
new GraphQLError(
|
|
71
68
|
`Variable "$${varName}" of required type "${varTypeStr}" was not provided.`,
|
|
@@ -76,8 +73,8 @@ function coerceVariableValues(resolvers, varDefNodes, inputs, onError) {
|
|
|
76
73
|
continue;
|
|
77
74
|
}
|
|
78
75
|
const value = inputs[varName];
|
|
79
|
-
if (value === null && isNonNullType(
|
|
80
|
-
const varTypeStr =
|
|
76
|
+
if (value === null && isNonNullType(varTypeReference)) {
|
|
77
|
+
const varTypeStr = inspectTypeReference(varTypeReference);
|
|
81
78
|
onError(
|
|
82
79
|
new GraphQLError(
|
|
83
80
|
`Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`,
|
|
@@ -88,7 +85,8 @@ function coerceVariableValues(resolvers, varDefNodes, inputs, onError) {
|
|
|
88
85
|
}
|
|
89
86
|
coercedValues[varName] = coerceInputValue(
|
|
90
87
|
value,
|
|
91
|
-
|
|
88
|
+
varTypeReference,
|
|
89
|
+
schemaTypes,
|
|
92
90
|
(path, invalidValue, error) => {
|
|
93
91
|
let prefix = `Variable "$${varName}" got invalid value ` + inspect(invalidValue);
|
|
94
92
|
if (path.length > 0) {
|
|
@@ -105,47 +103,72 @@ function coerceVariableValues(resolvers, varDefNodes, inputs, onError) {
|
|
|
105
103
|
}
|
|
106
104
|
return coercedValues;
|
|
107
105
|
}
|
|
108
|
-
function getArgumentValues(
|
|
106
|
+
function getArgumentValues(exeContext, def, node) {
|
|
109
107
|
var _a;
|
|
108
|
+
const schemaTypes = exeContext.partialSchema;
|
|
110
109
|
const coercedValues = {};
|
|
110
|
+
const argumentDefs = schemaTypes.resolveDefinitionArguments(def);
|
|
111
|
+
if (!argumentDefs) {
|
|
112
|
+
return coercedValues;
|
|
113
|
+
}
|
|
111
114
|
const argumentNodes = (_a = node.arguments) != null ? _a : [];
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
const argNodeMap = new Map(argumentNodes.map((arg) => [arg.name.value, arg]));
|
|
116
|
+
for (const [name, argumentDef] of Object.entries(argumentDefs)) {
|
|
117
|
+
const argumentNode = argNodeMap.get(name);
|
|
118
|
+
const argumentTypeRef = schemaTypes.getTypeReference(argumentDef);
|
|
119
|
+
const defaultValue = schemaTypes.getInputDefaultValue(argumentDef);
|
|
120
|
+
if (argumentNode == null) {
|
|
121
|
+
if (defaultValue !== void 0) {
|
|
122
|
+
coercedValues[name] = defaultValue;
|
|
123
|
+
} else if (isNonNullType(argumentTypeRef)) {
|
|
124
|
+
const type = inspectTypeReference(argumentTypeRef);
|
|
125
|
+
throw locatedError(
|
|
126
|
+
`Argument "${name}" of required type "${type}" was not provided.`,
|
|
127
|
+
[node]
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (!schemaTypes.isDefined(argumentTypeRef)) {
|
|
133
|
+
throw locatedError(
|
|
134
|
+
`Could not find type for argument ${name} in ${node.kind} ${node.name.value}`,
|
|
135
|
+
[argumentNode]
|
|
122
136
|
);
|
|
123
137
|
}
|
|
124
|
-
|
|
138
|
+
const valueNode = argumentNode.value;
|
|
139
|
+
let isNull = valueNode.kind === Kind.NULL;
|
|
125
140
|
if (valueNode.kind === Kind.VARIABLE) {
|
|
126
141
|
const variableName = valueNode.name.value;
|
|
127
|
-
if (variableValues == null || !hasOwnProperty(variableValues, variableName)) {
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
} else if (isNonNullType(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
{
|
|
142
|
+
if (exeContext.variableValues == null || !hasOwnProperty(exeContext.variableValues, variableName)) {
|
|
143
|
+
if (defaultValue !== void 0) {
|
|
144
|
+
coercedValues[name] = defaultValue;
|
|
145
|
+
} else if (isNonNullType(argumentTypeRef)) {
|
|
146
|
+
const type = inspectTypeReference(argumentTypeRef);
|
|
147
|
+
throw locatedError(
|
|
148
|
+
`Argument "${name}" of required type "${type}" was provided the variable "$${variableName}" which was not provided a runtime value.`,
|
|
149
|
+
[valueNode]
|
|
134
150
|
);
|
|
135
151
|
}
|
|
136
152
|
continue;
|
|
137
153
|
}
|
|
154
|
+
isNull = exeContext.variableValues[variableName] == null;
|
|
155
|
+
}
|
|
156
|
+
if (isNull && isNonNullType(argumentTypeRef)) {
|
|
157
|
+
const type = inspectTypeReference(argumentTypeRef);
|
|
158
|
+
throw locatedError(
|
|
159
|
+
`Argument "${name}" of non-null type "${type}" must not be null."`,
|
|
160
|
+
[valueNode]
|
|
161
|
+
);
|
|
138
162
|
}
|
|
139
163
|
const coercedValue = valueFromAST(
|
|
140
164
|
valueNode,
|
|
141
|
-
|
|
142
|
-
|
|
165
|
+
argumentTypeRef,
|
|
166
|
+
schemaTypes,
|
|
167
|
+
exeContext.variableValues
|
|
143
168
|
);
|
|
144
169
|
if (coercedValue === void 0) {
|
|
145
170
|
throw new GraphQLError(
|
|
146
|
-
`Argument "${name}" has invalid value ${print(
|
|
147
|
-
valueNode
|
|
148
|
-
)}.`,
|
|
171
|
+
`Argument "${name}" has invalid value ${print(valueNode)}.`,
|
|
149
172
|
{ nodes: valueNode }
|
|
150
173
|
);
|
|
151
174
|
}
|
|
@@ -153,39 +176,22 @@ function getArgumentValues(resolvers, node, variableValues) {
|
|
|
153
176
|
}
|
|
154
177
|
return coercedValues;
|
|
155
178
|
}
|
|
156
|
-
function getDirectiveValues(directiveDef, node
|
|
179
|
+
function getDirectiveValues(exeContext, directiveDef, node) {
|
|
157
180
|
var _a;
|
|
181
|
+
const schemaTypes = exeContext.partialSchema;
|
|
182
|
+
const name = schemaTypes.getDirectiveName(directiveDef);
|
|
158
183
|
const directiveNode = (_a = node.directives) == null ? void 0 : _a.find(
|
|
159
|
-
(directive) => directive.name.value ===
|
|
184
|
+
(directive) => directive.name.value === name
|
|
160
185
|
);
|
|
161
186
|
if (directiveNode) {
|
|
162
|
-
return getArgumentValues(
|
|
187
|
+
return getArgumentValues(exeContext, directiveDef, directiveNode);
|
|
163
188
|
}
|
|
164
189
|
}
|
|
165
190
|
function hasOwnProperty(obj, prop) {
|
|
166
191
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
167
192
|
}
|
|
168
|
-
var specifiedScalars = {
|
|
169
|
-
ID: GraphQLID,
|
|
170
|
-
String: GraphQLString,
|
|
171
|
-
Int: GraphQLInt,
|
|
172
|
-
Float: GraphQLFloat,
|
|
173
|
-
Boolean: GraphQLBoolean
|
|
174
|
-
};
|
|
175
|
-
function graphqlTypeFromTypeAst(resolvers, node) {
|
|
176
|
-
if (node.kind === Kind.NON_NULL_TYPE) {
|
|
177
|
-
return new GraphQLNonNull(graphqlTypeFromTypeAst(resolvers, node.type));
|
|
178
|
-
} else if (node.kind === Kind.LIST_TYPE) {
|
|
179
|
-
return new GraphQLList(graphqlTypeFromTypeAst(resolvers, node.type));
|
|
180
|
-
} else {
|
|
181
|
-
const typeName = node.name.value;
|
|
182
|
-
const type = specifiedScalars[typeName] || resolvers[typeName];
|
|
183
|
-
return type;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
193
|
export {
|
|
187
194
|
getArgumentValues,
|
|
188
195
|
getDirectiveValues,
|
|
189
|
-
getVariableValues
|
|
190
|
-
specifiedScalars
|
|
196
|
+
getVariableValues
|
|
191
197
|
};
|
package/lib/values.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/values.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n
|
|
5
|
-
"mappings": ";AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import {\n GraphQLError,\n Kind,\n print,\n locatedError,\n DirectiveNode,\n FieldNode,\n VariableDefinitionNode,\n} from \"graphql\";\nimport { inspect } from \"./jsutils/inspect\";\nimport { printPathArray } from \"./jsutils/printPathArray\";\nimport { ExecutionContext } from \"./executeWithoutSchema\";\nimport { DirectiveDefinitionTuple, FieldDefinition } from \"./schema/definition\";\nimport { valueFromAST } from \"./utilities/valueFromAST\";\nimport { PartialSchema } from \"./schema/fragment\";\nimport { coerceInputValue } from \"./utilities/coerceInputValue\";\nimport {\n inspectTypeReference,\n isNonNullType,\n typeReferenceFromNode,\n} from \"./schema/reference\";\n\ntype CoercedVariableValues =\n | { errors: Array<GraphQLError>; coerced?: never }\n | { coerced: { [variable: string]: unknown }; errors?: never };\n\n/**\n * Prepares an object map of variableValues of the correct type based on the\n * provided variable definitions and arbitrary input. If the input cannot be\n * parsed to match the variable definitions, a GraphQLError will be thrown.\n *\n * Note: The returned value is a plain Object with a prototype, since it is\n * exposed to user code. Care should be taken to not pull values from the\n * Object prototype.\n *\n * @internal\n */\nexport function getVariableValues(\n schemaTypes: PartialSchema,\n varDefNodes: ReadonlyArray<VariableDefinitionNode>,\n inputs: { [variable: string]: unknown },\n options?: { maxErrors?: number },\n): CoercedVariableValues {\n const errors: GraphQLError[] = [];\n const maxErrors = options?.maxErrors;\n try {\n const coerced = coerceVariableValues(\n schemaTypes,\n varDefNodes,\n inputs,\n (error) => {\n if (maxErrors != null && errors.length >= maxErrors) {\n throw new GraphQLError(\n \"Too many errors processing variables, error limit reached. Execution aborted.\",\n );\n }\n errors.push(error);\n },\n );\n\n if (errors.length === 0) {\n return { coerced };\n }\n } catch (error) {\n errors.push(error as GraphQLError);\n }\n\n return { errors: errors };\n}\n\nfunction coerceVariableValues(\n schemaTypes: PartialSchema,\n varDefNodes: ReadonlyArray<VariableDefinitionNode>,\n inputs: { [variable: string]: unknown },\n onError: (error: GraphQLError) => void,\n): { [variable: string]: unknown } {\n const coercedValues: { [variable: string]: unknown } = {};\n for (const varDefNode of varDefNodes) {\n const varName = varDefNode.variable.name.value;\n const varTypeReference = typeReferenceFromNode(varDefNode.type);\n\n if (!schemaTypes.isInputType(varTypeReference)) {\n // Must use input types for variables. This should be caught during\n // validation, however is checked again here for safety.\n const varTypeStr = inspectTypeReference(varTypeReference);\n onError(\n new GraphQLError(\n `Variable \"$${varName}\" expected value of type \"${varTypeStr}\" which cannot be used as an input type.`,\n { nodes: varDefNode.type },\n ),\n );\n continue;\n }\n\n if (!hasOwnProperty(inputs, varName)) {\n if (varDefNode.defaultValue) {\n coercedValues[varName] = valueFromAST(\n varDefNode.defaultValue,\n varTypeReference,\n schemaTypes,\n );\n } else if (isNonNullType(varTypeReference)) {\n const varTypeStr = inspectTypeReference(varTypeReference);\n onError(\n new GraphQLError(\n `Variable \"$${varName}\" of required type \"${varTypeStr}\" was not provided.`,\n { nodes: varDefNode },\n ),\n );\n }\n continue;\n }\n\n const value = inputs[varName];\n if (value === null && isNonNullType(varTypeReference)) {\n const varTypeStr = inspectTypeReference(varTypeReference);\n onError(\n new GraphQLError(\n `Variable \"$${varName}\" of non-null type \"${varTypeStr}\" must not be null.`,\n { nodes: varDefNode },\n ),\n );\n continue;\n }\n\n coercedValues[varName] = coerceInputValue(\n value,\n varTypeReference,\n schemaTypes,\n (path, invalidValue, error) => {\n let prefix =\n `Variable \"$${varName}\" got invalid value ` + inspect(invalidValue);\n if (path.length > 0) {\n prefix += ` at \"${varName}${printPathArray(path)}\"`;\n }\n onError(\n new GraphQLError(prefix + \"; \" + error.message, {\n nodes: varDefNode,\n originalError: error.originalError,\n }),\n );\n },\n );\n }\n\n return coercedValues;\n}\n\n/**\n * Prepares an object map of argument values given a list of argument\n * definitions and list of argument AST nodes.\n *\n * Note: The returned value is a plain Object with a prototype, since it is\n * exposed to user code. Care should be taken to not pull values from the\n * Object prototype.\n *\n * @internal\n */\nexport function getArgumentValues(\n exeContext: ExecutionContext,\n def: FieldDefinition | DirectiveDefinitionTuple,\n node: FieldNode | DirectiveNode,\n): { [argument: string]: unknown } {\n const schemaTypes = exeContext.partialSchema;\n const coercedValues: { [argument: string]: unknown } = {};\n const argumentDefs = schemaTypes.resolveDefinitionArguments(def);\n if (!argumentDefs) {\n return coercedValues;\n }\n // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n const argumentNodes = node.arguments ?? [];\n const argNodeMap = new Map(argumentNodes.map((arg) => [arg.name.value, arg]));\n\n for (const [name, argumentDef] of Object.entries(argumentDefs)) {\n const argumentNode = argNodeMap.get(name);\n const argumentTypeRef = schemaTypes.getTypeReference(argumentDef);\n const defaultValue = schemaTypes.getInputDefaultValue(argumentDef);\n\n if (argumentNode == null) {\n if (defaultValue !== undefined) {\n coercedValues[name] = defaultValue;\n } else if (isNonNullType(argumentTypeRef)) {\n const type = inspectTypeReference(argumentTypeRef);\n throw locatedError(\n `Argument \"${name}\" of required type \"${type}\" was not provided.`,\n [node],\n );\n }\n continue;\n }\n\n if (!schemaTypes.isDefined(argumentTypeRef)) {\n throw locatedError(\n `Could not find type for argument ${name} in ${node.kind} ${node.name.value}`,\n [argumentNode],\n );\n }\n\n // if (!schemaTypes.isInputType(argumentTypeRef)) {\n // const type = schemaTypes.printTypeRef(argumentTypeRef);\n // throw locatedError(\n // `Argument \"$${name}\" expected value of type \"${type}\" which cannot be used as an input type.`,\n // [argumentNode],\n // );\n // }\n\n const valueNode = argumentNode.value;\n let isNull = valueNode.kind === Kind.NULL;\n\n if (valueNode.kind === Kind.VARIABLE) {\n const variableName = valueNode.name.value;\n if (\n exeContext.variableValues == null ||\n !hasOwnProperty(exeContext.variableValues, variableName)\n ) {\n if (defaultValue !== undefined) {\n coercedValues[name] = defaultValue;\n } else if (isNonNullType(argumentTypeRef)) {\n const type = inspectTypeReference(argumentTypeRef);\n throw locatedError(\n `Argument \"${name}\" of required type \"${type}\" ` +\n `was provided the variable \"$${variableName}\" which was not provided a runtime value.`,\n [valueNode],\n );\n }\n continue;\n }\n isNull = exeContext.variableValues[variableName] == null;\n }\n\n if (isNull && isNonNullType(argumentTypeRef)) {\n const type = inspectTypeReference(argumentTypeRef);\n throw locatedError(\n `Argument \"${name}\" of non-null type \"${type}\" must not be null.\"`,\n [valueNode],\n );\n }\n\n const coercedValue = valueFromAST(\n valueNode,\n argumentTypeRef,\n schemaTypes,\n exeContext.variableValues,\n );\n if (coercedValue === undefined) {\n // Note: ValuesOfCorrectTypeRule validation should catch this before\n // execution. This is a runtime check to ensure execution does not\n // continue with an invalid argument value.\n throw new GraphQLError(\n `Argument \"${name}\" has invalid value ${print(valueNode)}.`,\n { nodes: valueNode },\n );\n }\n coercedValues[name] = coercedValue;\n }\n\n return coercedValues;\n}\n\n/**\n * Prepares an object map of argument values given a directive definition\n * and a AST node which may contain directives. Optionally also accepts a map\n * of variable values.\n *\n * If the directive does not exist on the node, returns undefined.\n *\n * Note: The returned value is a plain Object with a prototype, since it is\n * exposed to user code. Care should be taken to not pull values from the\n * Object prototype.\n */\nexport function getDirectiveValues(\n exeContext: ExecutionContext,\n directiveDef: DirectiveDefinitionTuple,\n node: { directives?: ReadonlyArray<DirectiveNode> },\n): undefined | { [argument: string]: unknown } {\n const schemaTypes = exeContext.partialSchema;\n const name = schemaTypes.getDirectiveName(directiveDef);\n\n // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n const directiveNode = node.directives?.find(\n (directive) => directive.name.value === name,\n );\n\n if (directiveNode) {\n return getArgumentValues(exeContext, directiveDef, directiveNode);\n }\n}\n\nfunction hasOwnProperty(obj: unknown, prop: string): boolean {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAG/B,SAAS,oBAAoB;AAE7B,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAiBA,SAAS,kBACd,aACA,aACA,QACA,SACuB;AACvB,QAAM,SAAyB,CAAC;AAChC,QAAM,YAAY,mCAAS;AAC3B,MAAI;AACF,UAAM,UAAU;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA,CAAC,UAAU;AACT,YAAI,aAAa,QAAQ,OAAO,UAAU,WAAW;AACnD,gBAAM,IAAI;AAAA,YACR;AAAA,UACF;AAAA,QACF;AACA,eAAO,KAAK,KAAK;AAAA,MACnB;AAAA,IACF;A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