graphql-compose-modules
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -1,2 +0,2 @@ | ||
import { AstRootTypeNode, AstDirNode, AstFileNode, AstRootNode } from './directoryToAst'; | ||
import { AstRootTypeNode, AstDirNode, AstFileNode, AstRootNode, RootTypeNames } from './directoryToAst'; | ||
/** | ||
@@ -18,2 +18,3 @@ * Do not traverse children | ||
export interface VisitInfo { | ||
operation: RootTypeNames; | ||
parent: AstDirNode | AstRootTypeNode | AstRootNode; | ||
@@ -20,0 +21,0 @@ name: string; |
@@ -19,5 +19,12 @@ "use strict"; | ||
function astVisitor(ast, visitor) { | ||
forEachKey(ast.children, function (childNode, name) { | ||
if (childNode) | ||
visitNode(childNode, visitor, { parent: ast, name: name, path: [] }); | ||
Object.keys(ast.children).forEach(function (operation) { | ||
var rootNode = ast.children[operation]; | ||
if (!rootNode) | ||
return; | ||
visitNode(rootNode, visitor, { | ||
parent: ast, | ||
name: operation, | ||
path: [], | ||
operation: operation, | ||
}); | ||
}); | ||
@@ -63,2 +70,3 @@ } | ||
path: __spreadArrays(info.path, [info.name]), | ||
operation: info.operation, | ||
}); | ||
@@ -65,0 +73,0 @@ }); |
@@ -36,5 +36,3 @@ /// <reference types="node" /> | ||
kind: 'root'; | ||
children: { | ||
[T in RootTypeNames]?: AstRootTypeNode; | ||
}; | ||
children: Record<RootTypeNames, AstRootTypeNode>; | ||
} | ||
@@ -41,0 +39,0 @@ export declare const defaultOptions: DirectoryToAstOptions; |
@@ -24,3 +24,3 @@ "use strict"; | ||
if (options === void 0) { options = exports.defaultOptions; } | ||
// if no path was passed in, assume the equivelant of __dirname from caller | ||
// if no path was passed in, assume the equivalent of __dirname from caller | ||
// otherwise, resolve path relative to the equivalent of __dirname | ||
@@ -27,0 +27,0 @@ var schemaPath = (options === null || options === void 0 ? void 0 : options.relativePath) ? path_1.resolve(path_1.dirname(m.filename), options.relativePath) |
{ | ||
"name": "graphql-compose-modules", | ||
"license": "MIT", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "A toolset for construction GraphQL Schema via file structure", | ||
@@ -23,2 +23,3 @@ "repository": "https://github.com/graphql-compose/graphql-compose-modules", | ||
"@types/jest": "25.2.1", | ||
"@types/lodash.sortby": "^4.7.6", | ||
"@types/node": "13.11.0", | ||
@@ -34,2 +35,3 @@ "@typescript-eslint/eslint-plugin": "2.26.0", | ||
"jest": "25.2.7", | ||
"lodash.sortby": "^4.7.0", | ||
"prettier": "2.0.2", | ||
@@ -36,0 +38,0 @@ "rimraf": "3.0.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
64648
812
21