UNPKG

764 BJavaScriptView Raw
1Object.defineProperty(exports, "__esModule", { value: true });
2var graphql_1 = require("graphql");
3function 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}
18exports.default = forEachField;
19//# sourceMappingURL=forEachField.js.map
\No newline at end of file