graphql-query-rewriter-rc
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -896,2 +896,3 @@ import { Kind, parse, print, isValueNode, parseType } from 'graphql'; | ||
FieldRewriter.prototype.rewriteResponse = function (response, key, index) { | ||
var _a; | ||
// Extract the element we are working on | ||
@@ -902,6 +903,11 @@ var element = _super.prototype.extractReponseElement.call(this, response, key, index); | ||
var originalKey = key; | ||
// if the key is found to be the renamed field | ||
// then change the name of such field in the response | ||
// and pass the new key (field name) down. | ||
if (key === this.newFieldName) { | ||
delete response[key]; | ||
if (this.fieldName) | ||
if (this.fieldName) { | ||
originalKey = this.fieldName; | ||
Object.assign(response, (_a = {}, _a[originalKey] = response[key], _a)); | ||
delete response[key]; | ||
} | ||
} | ||
@@ -908,0 +914,0 @@ // Undo the nesting in the response so it matches the original query |
@@ -900,2 +900,3 @@ (function (global, factory) { | ||
FieldRewriter.prototype.rewriteResponse = function (response, key, index) { | ||
var _a; | ||
// Extract the element we are working on | ||
@@ -906,6 +907,11 @@ var element = _super.prototype.extractReponseElement.call(this, response, key, index); | ||
var originalKey = key; | ||
// if the key is found to be the renamed field | ||
// then change the name of such field in the response | ||
// and pass the new key (field name) down. | ||
if (key === this.newFieldName) { | ||
delete response[key]; | ||
if (this.fieldName) | ||
if (this.fieldName) { | ||
originalKey = this.fieldName; | ||
Object.assign(response, (_a = {}, _a[originalKey] = response[key], _a)); | ||
delete response[key]; | ||
} | ||
} | ||
@@ -912,0 +918,0 @@ // Undo the nesting in the response so it matches the original query |
@@ -87,2 +87,3 @@ "use strict"; | ||
FieldRewriter.prototype.rewriteResponse = function (response, key, index) { | ||
var _a; | ||
// Extract the element we are working on | ||
@@ -93,6 +94,11 @@ var element = _super.prototype.extractReponseElement.call(this, response, key, index); | ||
var originalKey = key; | ||
// if the key is found to be the renamed field | ||
// then change the name of such field in the response | ||
// and pass the new key (field name) down. | ||
if (key === this.newFieldName) { | ||
delete response[key]; | ||
if (this.fieldName) | ||
if (this.fieldName) { | ||
originalKey = this.fieldName; | ||
Object.assign(response, (_a = {}, _a[originalKey] = response[key], _a)); | ||
delete response[key]; | ||
} | ||
} | ||
@@ -99,0 +105,0 @@ // Undo the nesting in the response so it matches the original query |
{ | ||
"name": "graphql-query-rewriter-rc", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"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
357740
3532