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