| 2 | import { Plugin, NavigationSection, NavigationItem } from '../lib/utility'; |
| 3 | |
| 4 | export default class NavigationSchema extends Plugin implements PluginInterface { |
| 5 | |
| 6 | getNavigations(buildFrom?: string): NavigationSectionInterface[] { |
| 7 | |
| 8 | const section = new NavigationSection('Schema', []); |
| 9 | |
| 10 | // Query |
| 11 | if (this.document.queryType) |
| 12 | section.items.push(new NavigationItem( |
| 13 | this.document.queryType.name, |
| 14 | this.url(this.document.queryType), |
| 15 | buildFrom === this.document.queryType.name |
| 16 | )); |
| 17 | |
| 18 | // Mutation |
| 19 | if (this.document.mutationType) |
| 20 | section.items.push(new NavigationItem( |
| 21 | this.document.mutationType.name, |
| 22 | this.url(this.document.mutationType), |
| 23 | buildFrom === this.document.mutationType.name |
| 24 | )); |
| 25 | |
| 26 | // Suscription |
| 27 | if (this.document.subscriptionType) |
| 28 | section.items.push(new NavigationItem( |
| 29 | this.document.subscriptionType.name, |
| 30 | this.url(this.document.subscriptionType), |
| 31 | buildFrom === this.document.subscriptionType.name |
| 32 | )); |
| 33 | |
| 34 | return [section]; |
| 35 | } |
| 36 | |
| 37 | } |
nothing calls this directly
no outgoing calls
no test coverage detected