@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/index.esm.js
CHANGED
|
@@ -3340,48 +3340,55 @@ function getResolversFromSchema(schema) {
|
|
|
3340
3340
|
var resolvers = Object.create({});
|
|
3341
3341
|
var typeMap = schema.getTypeMap();
|
|
3342
3342
|
Object.keys(typeMap).forEach(function (typeName) {
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
if (
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3343
|
+
if (!typeName.startsWith('_')) {
|
|
3344
|
+
var type = typeMap[typeName];
|
|
3345
|
+
if (isScalarType(type)) {
|
|
3346
|
+
if (!isSpecifiedScalarType(type)) {
|
|
3347
|
+
var config = type.toConfig();
|
|
3348
|
+
delete config.astNode; // avoid AST duplication elsewhere
|
|
3349
|
+
resolvers[typeName] = new GraphQLScalarType(config);
|
|
3350
|
+
}
|
|
3349
3351
|
}
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
});
|
|
3357
|
-
}
|
|
3358
|
-
else if (isInterfaceType(type)) {
|
|
3359
|
-
if (type.resolveType != null) {
|
|
3360
|
-
resolvers[typeName] = {
|
|
3361
|
-
__resolveType: type.resolveType,
|
|
3362
|
-
};
|
|
3352
|
+
else if (isEnumType(type)) {
|
|
3353
|
+
resolvers[typeName] = {};
|
|
3354
|
+
var values = type.getValues();
|
|
3355
|
+
values.forEach(function (value) {
|
|
3356
|
+
resolvers[typeName][value.name] = value.value;
|
|
3357
|
+
});
|
|
3363
3358
|
}
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
}
|
|
3359
|
+
else if (isInterfaceType(type)) {
|
|
3360
|
+
if (type.resolveType != null) {
|
|
3361
|
+
resolvers[typeName] = {
|
|
3362
|
+
__resolveType: type.resolveType,
|
|
3363
|
+
};
|
|
3364
|
+
}
|
|
3370
3365
|
}
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3366
|
+
else if (isUnionType(type)) {
|
|
3367
|
+
if (type.resolveType != null) {
|
|
3368
|
+
resolvers[typeName] = {
|
|
3369
|
+
__resolveType: type.resolveType,
|
|
3370
|
+
};
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
else if (isObjectType(type)) {
|
|
3374
|
+
resolvers[typeName] = {};
|
|
3375
|
+
if (type.isTypeOf != null) {
|
|
3376
|
+
resolvers[typeName].__isTypeOf = type.isTypeOf;
|
|
3377
|
+
}
|
|
3378
|
+
var fields_1 = type.getFields();
|
|
3379
|
+
Object.keys(fields_1).forEach(function (fieldName) {
|
|
3380
|
+
var _a, _b;
|
|
3381
|
+
var field = fields_1[fieldName];
|
|
3382
|
+
if (field.subscribe != null) {
|
|
3383
|
+
resolvers[typeName][fieldName] = resolvers[typeName][fieldName] || {};
|
|
3384
|
+
resolvers[typeName][fieldName].subscribe = field.subscribe;
|
|
3385
|
+
}
|
|
3386
|
+
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') {
|
|
3387
|
+
resolvers[typeName][fieldName] = resolvers[typeName][fieldName] || {};
|
|
3388
|
+
resolvers[typeName][fieldName].resolve = field.resolve;
|
|
3389
|
+
}
|
|
3390
|
+
});
|
|
3376
3391
|
}
|
|
3377
|
-
var fields_1 = type.getFields();
|
|
3378
|
-
Object.keys(fields_1).forEach(function (fieldName) {
|
|
3379
|
-
var field = fields_1[fieldName];
|
|
3380
|
-
resolvers[typeName][fieldName] = {
|
|
3381
|
-
resolve: field.resolve,
|
|
3382
|
-
subscribe: field.subscribe,
|
|
3383
|
-
};
|
|
3384
|
-
});
|
|
3385
3392
|
}
|
|
3386
3393
|
});
|
|
3387
3394
|
return resolvers;
|