@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/utils/es5",
3
- "version": "7.9.0-alpha-6470bbd8.0",
3
+ "version": "7.9.1",
4
4
  "description": "Common package containing utils and types for GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
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
- const type = typeMap[typeName];
3211
- if (graphql.isScalarType(type)) {
3212
- if (!graphql.isSpecifiedScalarType(type)) {
3213
- const config = type.toConfig();
3214
- delete config.astNode; // avoid AST duplication elsewhere
3215
- resolvers[typeName] = new graphql.GraphQLScalarType(config);
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
- else if (graphql.isEnumType(type)) {
3219
- resolvers[typeName] = {};
3220
- const values = type.getValues();
3221
- values.forEach(value => {
3222
- resolvers[typeName][value.name] = value.value;
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
- else if (graphql.isUnionType(type)) {
3233
- if (type.resolveType != null) {
3234
- resolvers[typeName] = {
3235
- __resolveType: type.resolveType,
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
- else if (graphql.isObjectType(type)) {
3240
- resolvers[typeName] = {};
3241
- if (type.isTypeOf != null) {
3242
- resolvers[typeName].__isTypeOf = type.isTypeOf;
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;