graphql-query-rewriter
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -92,4 +92,4 @@ import { parse, print, parseType } from 'graphql'; | ||
var next = { | ||
node: elm, | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: elm | ||
}; | ||
@@ -103,4 +103,4 @@ return walkRecursive(next, nextParents); | ||
var next = { | ||
node: val, | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: val | ||
}; | ||
@@ -113,4 +113,4 @@ node[key] = walkRecursive(next, nextParents); | ||
var root = { | ||
node: doc, | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: doc | ||
}; | ||
@@ -244,3 +244,3 @@ var rewrittenDoc = walkRecursive(root, []); | ||
}; | ||
Rewriter.prototype.rewriteVariables = function (_nodeAndVarDefs, variables) { | ||
Rewriter.prototype.rewriteVariables = function (nodeAndVarDefs, variables) { | ||
return variables; | ||
@@ -286,3 +286,3 @@ }; | ||
}); | ||
return { node: __assign({}, node, { arguments: newArguments }), variableDefinitions: variableDefinitions }; | ||
return { variableDefinitions: variableDefinitions, node: __assign({}, node, { arguments: newArguments }) }; | ||
}; | ||
@@ -340,3 +340,3 @@ return FieldArgNameRewriter; | ||
newArguments.push(inputArgument); | ||
return { node: __assign({}, node, { arguments: newArguments }), variableDefinitions: variableDefinitions }; | ||
return { variableDefinitions: variableDefinitions, node: __assign({}, node, { arguments: newArguments }) }; | ||
}; | ||
@@ -399,4 +399,4 @@ return FieldArgsToInputTypeRewriter; | ||
FieldArgTypeRewriter.prototype.rewriteVariables = function (_a, variables) { | ||
var node = _a.node; | ||
var _b; | ||
var node = _a.node; | ||
if (!variables) | ||
@@ -460,4 +460,4 @@ return variables; | ||
return { | ||
node: __assign({}, node, { selectionSet: __assign({}, node.selectionSet, { selections: newOutputs }) }), | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: __assign({}, node, { selectionSet: __assign({}, node.selectionSet, { selections: newOutputs }) }) | ||
}; | ||
@@ -464,0 +464,0 @@ }; |
@@ -96,4 +96,4 @@ (function (global, factory) { | ||
var next = { | ||
node: elm, | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: elm | ||
}; | ||
@@ -107,4 +107,4 @@ return walkRecursive(next, nextParents); | ||
var next = { | ||
node: val, | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: val | ||
}; | ||
@@ -117,4 +117,4 @@ node[key] = walkRecursive(next, nextParents); | ||
var root = { | ||
node: doc, | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: doc | ||
}; | ||
@@ -248,3 +248,3 @@ var rewrittenDoc = walkRecursive(root, []); | ||
}; | ||
Rewriter.prototype.rewriteVariables = function (_nodeAndVarDefs, variables) { | ||
Rewriter.prototype.rewriteVariables = function (nodeAndVarDefs, variables) { | ||
return variables; | ||
@@ -290,3 +290,3 @@ }; | ||
}); | ||
return { node: __assign({}, node, { arguments: newArguments }), variableDefinitions: variableDefinitions }; | ||
return { variableDefinitions: variableDefinitions, node: __assign({}, node, { arguments: newArguments }) }; | ||
}; | ||
@@ -344,3 +344,3 @@ return FieldArgNameRewriter; | ||
newArguments.push(inputArgument); | ||
return { node: __assign({}, node, { arguments: newArguments }), variableDefinitions: variableDefinitions }; | ||
return { variableDefinitions: variableDefinitions, node: __assign({}, node, { arguments: newArguments }) }; | ||
}; | ||
@@ -403,4 +403,4 @@ return FieldArgsToInputTypeRewriter; | ||
FieldArgTypeRewriter.prototype.rewriteVariables = function (_a, variables) { | ||
var node = _a.node; | ||
var _b; | ||
var node = _a.node; | ||
if (!variables) | ||
@@ -464,4 +464,4 @@ return variables; | ||
return { | ||
node: __assign({}, node, { selectionSet: __assign({}, node.selectionSet, { selections: newOutputs }) }), | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: __assign({}, node, { selectionSet: __assign({}, node.selectionSet, { selections: newOutputs }) }) | ||
}; | ||
@@ -468,0 +468,0 @@ }; |
@@ -63,4 +63,4 @@ "use strict"; | ||
var next = { | ||
node: elm, | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: elm | ||
}; | ||
@@ -74,4 +74,4 @@ return walkRecursive(next, nextParents); | ||
var next = { | ||
node: val, | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: val | ||
}; | ||
@@ -84,4 +84,4 @@ node[key] = walkRecursive(next, nextParents); | ||
var root = { | ||
node: doc, | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: doc | ||
}; | ||
@@ -88,0 +88,0 @@ var rewrittenDoc = walkRecursive(root, []); |
@@ -60,3 +60,3 @@ "use strict"; | ||
}); | ||
return { node: __assign({}, node, { arguments: newArguments }), variableDefinitions: variableDefinitions }; | ||
return { variableDefinitions: variableDefinitions, node: __assign({}, node, { arguments: newArguments }) }; | ||
}; | ||
@@ -63,0 +63,0 @@ return FieldArgNameRewriter; |
@@ -76,3 +76,3 @@ "use strict"; | ||
newArguments.push(inputArgument); | ||
return { node: __assign({}, node, { arguments: newArguments }), variableDefinitions: variableDefinitions }; | ||
return { variableDefinitions: variableDefinitions, node: __assign({}, node, { arguments: newArguments }) }; | ||
}; | ||
@@ -79,0 +79,0 @@ return FieldArgsToInputTypeRewriter; |
@@ -27,6 +27,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Rewriter_1 = require("./Rewriter"); | ||
var graphql_1 = require("graphql"); | ||
var ast_1 = require("../ast"); | ||
var utils_1 = require("../utils"); | ||
var Rewriter_1 = require("./Rewriter"); | ||
/** | ||
@@ -83,4 +83,4 @@ * Rewriter which replaces the type of a single argument of a field | ||
FieldArgTypeRewriter.prototype.rewriteVariables = function (_a, variables) { | ||
var node = _a.node; | ||
var _b; | ||
var node = _a.node; | ||
if (!variables) | ||
@@ -87,0 +87,0 @@ return variables; |
@@ -73,4 +73,4 @@ "use strict"; | ||
return { | ||
node: __assign({}, node, { selectionSet: __assign({}, node.selectionSet, { selections: newOutputs }) }), | ||
variableDefinitions: variableDefinitions | ||
variableDefinitions: variableDefinitions, | ||
node: __assign({}, node, { selectionSet: __assign({}, node.selectionSet, { selections: newOutputs }) }) | ||
}; | ||
@@ -77,0 +77,0 @@ }; |
@@ -28,3 +28,3 @@ "use strict"; | ||
}; | ||
Rewriter.prototype.rewriteVariables = function (_nodeAndVarDefs, variables) { | ||
Rewriter.prototype.rewriteVariables = function (nodeAndVarDefs, variables) { | ||
return variables; | ||
@@ -31,0 +31,0 @@ }; |
@@ -12,13 +12,13 @@ import { ASTNode, DocumentNode, VariableDefinitionNode } from 'graphql'; | ||
*/ | ||
export declare const rewriteDoc: (doc: DocumentNode, callback: (nodeAndVars: NodeAndVarDefs, parents: readonly ASTNode[]) => NodeAndVarDefs) => DocumentNode; | ||
export declare const extractVariableDefinitions: (doc: DocumentNode) => readonly VariableDefinitionNode[]; | ||
export declare const replaceVariableDefinitions: (doc: DocumentNode, variableDefinitions: readonly VariableDefinitionNode[]) => DocumentNode; | ||
export declare const rewriteDoc: (doc: DocumentNode, callback: (nodeAndVars: NodeAndVarDefs, parents: ReadonlyArray<ASTNode>) => NodeAndVarDefs) => DocumentNode; | ||
export declare const extractVariableDefinitions: (doc: DocumentNode) => ReadonlyArray<VariableDefinitionNode>; | ||
export declare const replaceVariableDefinitions: (doc: DocumentNode, variableDefinitions: ReadonlyArray<VariableDefinitionNode>) => DocumentNode; | ||
/** | ||
* return the path that will be returned in the response from from the chain of parents | ||
*/ | ||
export declare const extractPath: (parents: readonly ASTNode[]) => readonly string[]; | ||
declare type ResultObj = { | ||
export declare const extractPath: (parents: ReadonlyArray<ASTNode>) => ReadonlyArray<string>; | ||
interface ResultObj { | ||
[key: string]: any; | ||
}; | ||
export declare const rewriteResultsAtPath: (results: ResultObj, path: readonly string[], callback: (resultsAtPath: any) => any) => ResultObj; | ||
} | ||
export declare const rewriteResultsAtPath: (results: ResultObj, path: ReadonlyArray<string>, callback: (resultsAtPath: any) => any) => ResultObj; | ||
export {}; |
@@ -1,4 +0,4 @@ | ||
import Rewriter, { RewriterOpts } from './Rewriter'; | ||
import { ASTNode } from 'graphql'; | ||
import { NodeAndVarDefs } from '../ast'; | ||
import Rewriter, { RewriterOpts } from './Rewriter'; | ||
interface IFieldArgNameRewriterOpts extends RewriterOpts { | ||
@@ -5,0 +5,0 @@ oldArgName: string; |
@@ -1,4 +0,4 @@ | ||
import Rewriter, { RewriterOpts } from './Rewriter'; | ||
import { ASTNode } from 'graphql'; | ||
import { NodeAndVarDefs } from '../ast'; | ||
import Rewriter, { RewriterOpts } from './Rewriter'; | ||
interface FieldArgsToInputTypeRewriterOpts extends RewriterOpts { | ||
@@ -5,0 +5,0 @@ argNames: string[]; |
@@ -1,4 +0,4 @@ | ||
import Rewriter, { Variables, RewriterOpts } from './Rewriter'; | ||
import { ASTNode, TypeNode } from 'graphql'; | ||
import { NodeAndVarDefs } from '../ast'; | ||
import Rewriter, { RewriterOpts, Variables } from './Rewriter'; | ||
interface FieldArgTypeRewriterOpts extends RewriterOpts { | ||
@@ -5,0 +5,0 @@ argName: string; |
@@ -1,4 +0,4 @@ | ||
import Rewriter, { RewriterOpts } from './Rewriter'; | ||
import { ASTNode } from 'graphql'; | ||
import { NodeAndVarDefs } from '../ast'; | ||
import Rewriter, { RewriterOpts } from './Rewriter'; | ||
interface NestFieldOutputsRewriterOpts extends RewriterOpts { | ||
@@ -5,0 +5,0 @@ newOutputName: string; |
@@ -17,5 +17,5 @@ import { ASTNode } from 'graphql'; | ||
rewriteQuery(nodeAndVarDefs: NodeAndVarDefs): NodeAndVarDefs; | ||
rewriteVariables(_nodeAndVarDefs: NodeAndVarDefs, variables: Variables): Variables; | ||
rewriteVariables(nodeAndVarDefs: NodeAndVarDefs, variables: Variables): Variables; | ||
rewriteResponse(response: any): any; | ||
} | ||
export default Rewriter; |
{ | ||
"name": "graphql-query-rewriter", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "", | ||
@@ -119,6 +119,6 @@ "keywords": [], | ||
"tslint": "^5.11.0", | ||
"tslint-config-airbnb": "^5.11.1", | ||
"tslint-config-prettier": "^1.15.0", | ||
"tslint-config-standard": "^8.0.1", | ||
"typedoc": "^0.12.0", | ||
"typescript": "^3.0.3" | ||
"typescript": "~3.3.0" | ||
}, | ||
@@ -125,0 +125,0 @@ "peerDependencies": { |
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
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158470