Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions src/components/Voyager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getIntrospectionQuery } from 'graphql/utilities';

import { getSchema, extractTypeId } from '../introspection';
import { SVGRender, getTypeGraph } from '../graph/';
import { WorkerCallback } from '../utils/types';
import { WorkerCallback, VoyagerDisplayOptions } from '../utils/types';

import * as React from 'react';
import * as PropTypes from 'prop-types';
Expand All @@ -19,16 +19,7 @@ import './viewport.css';

type IntrospectionProvider = (query: string) => Promise<any>;

export interface VoyagerDisplayOptions {
rootType?: string;
skipRelay?: boolean;
skipDeprecated?: boolean;
showLeafFields?: boolean;
sortByAlphabet?: boolean;
hideRoot?: boolean;
}

const defaultDisplayOptions = {
const defaultDisplayOptions: VoyagerDisplayOptions = {
rootType: undefined,
skipRelay: true,
skipDeprecated: true,
Expand Down
3 changes: 2 additions & 1 deletion src/middleware/render-voyager-page.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const { version } = require('../package.json');
import { VoyagerDisplayOptions } from '../utils/types';

export interface MiddlewareOptions {
endpointUrl: string;
displayOptions?: object;
displayOptions?: VoyagerDisplayOptions;
headersJS?: string;
}

Expand Down
9 changes: 9 additions & 0 deletions src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,12 @@ export type WorkerCallback = (
path: string,
relative: boolean,
) => Promise<Worker>;

export interface VoyagerDisplayOptions {
rootType?: string;
skipRelay?: boolean;
skipDeprecated?: boolean;
showLeafFields?: boolean;
sortByAlphabet?: boolean;
hideRoot?: boolean;
}