7
7
* of patent rights can be found in the PATENTS file in the same directory.
8
8
*/
9
9
10
- import { getIntrospectionResult }
11
- from '../../../language/schema/printer' ;
10
+ import { parseSchemaIntoAST }
11
+ from '../../../language/schema/' ;
12
+ import { buildASTSchema , introspectionQuery }
13
+ from '../../../utilities/' ;
14
+ import { graphql }
15
+ from '../../../' ;
12
16
13
17
var Promise = require ( 'bluebird' ) ;
14
18
var parseArgs = require ( 'minimist' ) ;
@@ -38,7 +42,9 @@ export async function executeTool() {
38
42
}
39
43
40
44
var body = await fs . readFileAsync ( argDict . file , 'utf8' ) ;
41
- var result = await getIntrospectionResult ( body , argDict . query ) ;
45
+ var ast = parseSchemaIntoAST ( body ) ;
46
+ var astSchema = buildASTSchema ( ast , argDict . query , argDict . mutation ) ;
47
+ var result = await graphql ( astSchema , introspectionQuery ) ;
42
48
var out = await JSON . stringify ( result , null , 2 ) ;
43
49
console . log ( out ) ;
44
50
} catch ( error ) {
@@ -54,4 +60,8 @@ introspection query result from querying that schema.
54
60
Required:
55
61
56
62
--file <path>: The path to the input schema definition file.
57
- --query <queryType>: The query type (root type) of the schema.` ;
63
+ --query <queryType>: The query type (root type) of the schema.
64
+
65
+ Optional:
66
+
67
+ --mutation <mutationType>: The mutation type (root type) of the schema.` ;
0 commit comments