@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/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
- const type = typeMap[typeName];
3207
- if (isScalarType(type)) {
3208
- if (!isSpecifiedScalarType(type)) {
3209
- const config = type.toConfig();
3210
- delete config.astNode; // avoid AST duplication elsewhere
3211
- resolvers[typeName] = new GraphQLScalarType(config);
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
- else if (isEnumType(type)) {
3215
- resolvers[typeName] = {};
3216
- const values = type.getValues();
3217
- values.forEach(value => {
3218
- resolvers[typeName][value.name] = value.value;
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
- else if (isUnionType(type)) {
3229
- if (type.resolveType != null) {
3230
- resolvers[typeName] = {
3231
- __resolveType: type.resolveType,
3232
- };
3222
+ else if (isInterfaceType(type)) {
3223
+ if (type.resolveType != null) {
3224
+ resolvers[typeName] = {
3225
+ __resolveType: type.resolveType,
3226
+ };
3227
+ }
3233
3228
  }
3234
- }
3235
- else if (isObjectType(type)) {
3236
- resolvers[typeName] = {};
3237
- if (type.isTypeOf != null) {
3238
- resolvers[typeName].__isTypeOf = type.isTypeOf;
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;