1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', {
|
4 | value: true,
|
5 | });
|
6 | exports.introspectionFromSchema = introspectionFromSchema;
|
7 |
|
8 | var _invariant = require('../jsutils/invariant.js');
|
9 |
|
10 | var _parser = require('../language/parser.js');
|
11 |
|
12 | var _execute = require('../execution/execute.js');
|
13 |
|
14 | var _getIntrospectionQuery = require('./getIntrospectionQuery.js');
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | function introspectionFromSchema(schema, options) {
|
26 | const optionsWithDefaults = {
|
27 | specifiedByUrl: true,
|
28 | directiveIsRepeatable: true,
|
29 | schemaDescription: true,
|
30 | inputValueDeprecation: true,
|
31 | ...options,
|
32 | };
|
33 | const document = (0, _parser.parse)(
|
34 | (0, _getIntrospectionQuery.getIntrospectionQuery)(optionsWithDefaults),
|
35 | );
|
36 | const result = (0, _execute.executeSync)({
|
37 | schema,
|
38 | document,
|
39 | });
|
40 | (!result.errors && result.data) || (0, _invariant.invariant)(false);
|
41 | return result.data;
|
42 | }
|