Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-query-rewriter-rc

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-query-rewriter-rc - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

12

dist/index.es5.js

@@ -335,10 +335,7 @@ import { Kind, parse, print, isValueNode, parseType } from 'graphql';

var RewriteHandler = /** @class */ (function () {
function RewriteHandler(rewriters, matchAnyPath) {
if (matchAnyPath === void 0) { matchAnyPath = false; }
function RewriteHandler(rewriters) {
this.matches = [];
this.hasProcessedRequest = false;
this.hasProcessedResponse = false;
this.matchAnyPath = false;
this.rewriters = rewriters;
this.matchAnyPath = matchAnyPath;
}

@@ -395,3 +392,2 @@ /**

RewriteHandler.prototype.rewriteResponse = function (response) {
var _this = this;
if (this.hasProcessedResponse)

@@ -403,3 +399,3 @@ throw new Error('This handler has already returned a response');

var rewriter = _a.rewriter, fieldPaths = _a.fieldPaths, allPaths = _a.allPaths;
var paths = _this.matchAnyPath ? allPaths : fieldPaths;
var paths = rewriter.matchAnyPath ? allPaths : fieldPaths;
paths.forEach(function (path) {

@@ -420,6 +416,8 @@ rewrittenResponse = rewriteResultsAtPath(rewrittenResponse, path, function (parentResponse, key, index) { return rewriter.rewriteResponse(parentResponse, key, index); });

function Rewriter(_a) {
var fieldName = _a.fieldName, rootTypes = _a.rootTypes, matchConditions = _a.matchConditions;
var fieldName = _a.fieldName, rootTypes = _a.rootTypes, matchConditions = _a.matchConditions, _b = _a.matchAnyPath, matchAnyPath = _b === void 0 ? false : _b;
this.matchAnyPath = false;
this.rootTypes = ['query', 'mutation', 'fragment'];
this.fieldName = fieldName;
this.matchConditions = matchConditions;
this.matchAnyPath = matchAnyPath;
if (!this.fieldName && !this.matchConditions) {

@@ -426,0 +424,0 @@ throw new Error('Neither a fieldName or matchConditions were provided. Please choose to pass either one in order to be able to detect which fields to rewrite.');

@@ -339,10 +339,7 @@ (function (global, factory) {

var RewriteHandler = /** @class */ (function () {
function RewriteHandler(rewriters, matchAnyPath) {
if (matchAnyPath === void 0) { matchAnyPath = false; }
function RewriteHandler(rewriters) {
this.matches = [];
this.hasProcessedRequest = false;
this.hasProcessedResponse = false;
this.matchAnyPath = false;
this.rewriters = rewriters;
this.matchAnyPath = matchAnyPath;
}

@@ -399,3 +396,2 @@ /**

RewriteHandler.prototype.rewriteResponse = function (response) {
var _this = this;
if (this.hasProcessedResponse)

@@ -407,3 +403,3 @@ throw new Error('This handler has already returned a response');

var rewriter = _a.rewriter, fieldPaths = _a.fieldPaths, allPaths = _a.allPaths;
var paths = _this.matchAnyPath ? allPaths : fieldPaths;
var paths = rewriter.matchAnyPath ? allPaths : fieldPaths;
paths.forEach(function (path) {

@@ -424,6 +420,8 @@ rewrittenResponse = rewriteResultsAtPath(rewrittenResponse, path, function (parentResponse, key, index) { return rewriter.rewriteResponse(parentResponse, key, index); });

function Rewriter(_a) {
var fieldName = _a.fieldName, rootTypes = _a.rootTypes, matchConditions = _a.matchConditions;
var fieldName = _a.fieldName, rootTypes = _a.rootTypes, matchConditions = _a.matchConditions, _b = _a.matchAnyPath, matchAnyPath = _b === void 0 ? false : _b;
this.matchAnyPath = false;
this.rootTypes = ['query', 'mutation', 'fragment'];
this.fieldName = fieldName;
this.matchConditions = matchConditions;
this.matchAnyPath = matchAnyPath;
if (!this.fieldName && !this.matchConditions) {

@@ -430,0 +428,0 @@ throw new Error('Neither a fieldName or matchConditions were provided. Please choose to pass either one in order to be able to detect which fields to rewrite.');

@@ -10,10 +10,7 @@ "use strict";

var RewriteHandler = /** @class */ (function () {
function RewriteHandler(rewriters, matchAnyPath) {
if (matchAnyPath === void 0) { matchAnyPath = false; }
function RewriteHandler(rewriters) {
this.matches = [];
this.hasProcessedRequest = false;
this.hasProcessedResponse = false;
this.matchAnyPath = false;
this.rewriters = rewriters;
this.matchAnyPath = matchAnyPath;
}

@@ -70,3 +67,2 @@ /**

RewriteHandler.prototype.rewriteResponse = function (response) {
var _this = this;
if (this.hasProcessedResponse)

@@ -78,3 +74,3 @@ throw new Error('This handler has already returned a response');

var rewriter = _a.rewriter, fieldPaths = _a.fieldPaths, allPaths = _a.allPaths;
var paths = _this.matchAnyPath ? allPaths : fieldPaths;
var paths = rewriter.matchAnyPath ? allPaths : fieldPaths;
paths.forEach(function (path) {

@@ -81,0 +77,0 @@ rewrittenResponse = ast_1.rewriteResultsAtPath(rewrittenResponse, path, function (parentResponse, key, index) { return rewriter.rewriteResponse(parentResponse, key, index); });

@@ -9,6 +9,8 @@ "use strict";

function Rewriter(_a) {
var fieldName = _a.fieldName, rootTypes = _a.rootTypes, matchConditions = _a.matchConditions;
var fieldName = _a.fieldName, rootTypes = _a.rootTypes, matchConditions = _a.matchConditions, _b = _a.matchAnyPath, matchAnyPath = _b === void 0 ? false : _b;
this.matchAnyPath = false;
this.rootTypes = ['query', 'mutation', 'fragment'];
this.fieldName = fieldName;
this.matchConditions = matchConditions;
this.matchAnyPath = matchAnyPath;
if (!this.fieldName && !this.matchConditions) {

@@ -15,0 +17,0 @@ throw new Error('Neither a fieldName or matchConditions were provided. Please choose to pass either one in order to be able to detect which fields to rewrite.');

@@ -16,4 +16,3 @@ import Rewriter, { Variables } from './rewriters/Rewriter';

private hasProcessedResponse;
private matchAnyPath;
constructor(rewriters: Rewriter[], matchAnyPath?: boolean);
constructor(rewriters: Rewriter[]);
/**

@@ -20,0 +19,0 @@ * Call this on a graphQL request in middleware before passing on to the real graphql processor

@@ -12,2 +12,3 @@ import { ASTNode } from 'graphql';

matchConditions?: matchCondition[];
matchAnyPath?: boolean;
}

@@ -19,6 +20,7 @@ /**

declare abstract class Rewriter {
matchAnyPath: boolean;
protected rootTypes: RootType[];
protected fieldName?: string;
protected matchConditions?: matchCondition[];
constructor({ fieldName, rootTypes, matchConditions }: RewriterOpts);
constructor({ fieldName, rootTypes, matchConditions, matchAnyPath }: RewriterOpts);
matches(nodeAndVarDefs: NodeAndVarDefs, parents: ReadonlyArray<ASTNode>): boolean;

@@ -25,0 +27,0 @@ rewriteQuery(nodeAndVarDefs: NodeAndVarDefs, variables: Variables): NodeAndVarDefs;

{
"name": "graphql-query-rewriter-rc",
"version": "0.0.8",
"version": "0.0.9",
"description": "",

@@ -5,0 +5,0 @@ "keywords": [],

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc