UNPKG

graphqldoc

Version:
26 lines (25 loc) 995 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utility_1 = require("../lib/utility"); class NavigationObjects extends utility_1.Plugin { getTypes(buildForType) { let objects = this.document.types .filter(type => { return type.kind === utility_1.OBJECT && (!this.queryType || this.queryType.name !== type.name) && (!this.mutationType || this.mutationType.name !== type.name) && (!this.subscriptionType || this.subscriptionType.name !== type.name); }); return objects .map(type => new utility_1.NavigationItem(type.name, this.url(type), type.name === buildForType)); } getNavigations(buildForType) { const types = this.getTypes(buildForType); if (types.length === 0) return []; return [ new utility_1.NavigationSection('Objects', types) ]; } } exports.default = NavigationObjects;