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

Class NavigationObjects

plugins/navigation.object.ts:4–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import { PluginInterface, NavigationItemInterface } from '../lib/interface';
3
4export default class NavigationObjects extends Plugin implements PluginInterface {
5
6 getTypes(buildForType: string): NavigationItemInterface[] {
7
8 let objects = this.document.types
9 .filter(type => {
10 return type.kind === OBJECT &&
11 (!this.queryType || this.queryType.name !== type.name) &&
12 (!this.mutationType || this.mutationType.name !== type.name) &&
13 (!this.subscriptionType || this.subscriptionType.name !== type.name);
14 });
15
16 return objects
17 .map(type => new NavigationItem(
18 type.name,
19 this.url(type),
20 type.name === buildForType
21 ));
22 }
23
24 getNavigations(buildForType: string) {
25
26 const types: NavigationItemInterface[] = this.getTypes(buildForType);
27
28 if (types.length === 0)
29 return [];
30
31 return [
32 new NavigationSection('Objects', types)
33 ];
34 }
35}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected