forEachField.js 764 B

12345678910111213141516171819
  1. Object.defineProperty(exports, "__esModule", { value: true });
  2. var graphql_1 = require("graphql");
  3. function forEachField(schema, fn) {
  4. var typeMap = schema.getTypeMap();
  5. Object.keys(typeMap).forEach(function (typeName) {
  6. var type = typeMap[typeName];
  7. // TODO: maybe have an option to include these?
  8. if (!graphql_1.getNamedType(type).name.startsWith('__') &&
  9. type instanceof graphql_1.GraphQLObjectType) {
  10. var fields_1 = type.getFields();
  11. Object.keys(fields_1).forEach(function (fieldName) {
  12. var field = fields_1[fieldName];
  13. fn(field, typeName, fieldName);
  14. });
  15. }
  16. });
  17. }
  18. exports.default = forEachField;
  19. //# sourceMappingURL=forEachField.js.map