@graphql-tools/utils 7.9.0-alpha-6470bbd8.0 → 7.9.1
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/es5/index.cjs.js +45 -38
- package/es5/index.cjs.js.map +1 -1
- package/es5/index.esm.js +45 -38
- package/es5/index.esm.js.map +1 -1
- package/es5/package.json +1 -1
- package/index.cjs.js +45 -38
- package/index.cjs.js.map +1 -1
- package/index.esm.js +45 -38
- package/index.esm.js.map +1 -1
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -3203,48 +3203,55 @@ function getResolversFromSchema(schema) {
|
|
|
3203
3203
|
const resolvers = Object.create({});
|
|
3204
3204
|
const typeMap = schema.getTypeMap();
|
|
3205
3205
|
Object.keys(typeMap).forEach(typeName => {
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
if (
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3206
|
+
if (!typeName.startsWith('_')) {
|
|
3207
|
+
const type = typeMap[typeName];
|
|
3208
|
+
if (isScalarType(type)) {
|
|
3209
|
+
if (!isSpecifiedScalarType(type)) {
|
|
3210
|
+
const config = type.toConfig();
|
|
3211
|
+
delete config.astNode; // avoid AST duplication elsewhere
|
|
3212
|
+
resolvers[typeName] = new GraphQLScalarType(config);
|
|
3213
|
+
}
|
|
3212
3214
|
}
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
});
|
|
3220
|
-
}
|
|
3221
|
-
else if (isInterfaceType(type)) {
|
|
3222
|
-
if (type.resolveType != null) {
|
|
3223
|
-
resolvers[typeName] = {
|
|
3224
|
-
__resolveType: type.resolveType,
|
|
3225
|
-
};
|
|
3215
|
+
else if (isEnumType(type)) {
|
|
3216
|
+
resolvers[typeName] = {};
|
|
3217
|
+
const values = type.getValues();
|
|
3218
|
+
values.forEach(value => {
|
|
3219
|
+
resolvers[typeName][value.name] = value.value;
|
|
3220
|
+
});
|
|
3226
3221
|
}
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
}
|
|
3222
|
+
else if (isInterfaceType(type)) {
|
|
3223
|
+
if (type.resolveType != null) {
|
|
3224
|
+
resolvers[typeName] = {
|
|
3225
|
+
__resolveType: type.resolveType,
|
|
3226
|
+
};
|
|
3227
|
+
}
|
|
3233
3228
|
}
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3229
|
+
else if (isUnionType(type)) {
|
|
3230
|
+
if (type.resolveType != null) {
|
|
3231
|
+
resolvers[typeName] = {
|
|
3232
|
+
__resolveType: type.resolveType,
|
|
3233
|
+
};
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
else if (isObjectType(type)) {
|
|
3237
|
+
resolvers[typeName] = {};
|
|
3238
|
+
if (type.isTypeOf != null) {
|
|
3239
|
+
resolvers[typeName].__isTypeOf = type.isTypeOf;
|
|
3240
|
+
}
|
|
3241
|
+
const fields = type.getFields();
|
|
3242
|
+
Object.keys(fields).forEach(fieldName => {
|
|
3243
|
+
var _a, _b;
|
|
3244
|
+
const field = fields[fieldName];
|
|
3245
|
+
if (field.subscribe != null) {
|
|
3246
|
+
resolvers[typeName][fieldName] = resolvers[typeName][fieldName] || {};
|
|
3247
|
+
resolvers[typeName][fieldName].subscribe = field.subscribe;
|
|
3248
|
+
}
|
|
3249
|
+
if (field.resolve != null && ((_a = field.resolve) === null || _a === void 0 ? void 0 : _a.name) !== 'defaultFieldResolver' && ((_b = field.resolve) === null || _b === void 0 ? void 0 : _b.name) !== 'defaultMergedResolver') {
|
|
3250
|
+
resolvers[typeName][fieldName] = resolvers[typeName][fieldName] || {};
|
|
3251
|
+
resolvers[typeName][fieldName].resolve = field.resolve;
|
|
3252
|
+
}
|
|
3253
|
+
});
|
|
3239
3254
|
}
|
|
3240
|
-
const fields = type.getFields();
|
|
3241
|
-
Object.keys(fields).forEach(fieldName => {
|
|
3242
|
-
const field = fields[fieldName];
|
|
3243
|
-
resolvers[typeName][fieldName] = {
|
|
3244
|
-
resolve: field.resolve,
|
|
3245
|
-
subscribe: field.subscribe,
|
|
3246
|
-
};
|
|
3247
|
-
});
|
|
3248
3255
|
}
|
|
3249
3256
|
});
|
|
3250
3257
|
return resolvers;
|