1 | import invariant from '../jsutils/invariant';
|
2 | import isPromise from '../jsutils/isPromise';
|
3 | import { parse } from '../language/parser';
|
4 | import { execute } from '../execution/execute';
|
5 | import { getIntrospectionQuery } from './introspectionQuery';
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export function introspectionFromSchema(schema, options) {
|
17 | var queryAST = parse(getIntrospectionQuery(options));
|
18 | var result = execute(schema, queryAST);
|
19 |
|
20 |
|
21 | !isPromise(result) && !result.errors && result.data || invariant(0);
|
22 | return result.data;
|
23 | }
|