MCPcopy Create free account
hub / github.com/2fd/graphdoc / NavigationSchema

Class NavigationSchema

plugins/navigation.schema.ts:4–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import { Plugin, NavigationSection, NavigationItem } from '../lib/utility';
3
4export 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected