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