graphql-genie
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -272,3 +272,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
this.generateUpdates = (fortuneTypeName, record, options = {}) => { | ||
const updates = { id: this.getFortuneId(record['id']), replace: {}, push: {}, pull: {} }; | ||
const updates = { id: this.getFortuneId(record['id']) }; | ||
for (const argName in record) { | ||
@@ -285,5 +285,11 @@ const link = get(this.store, `recordTypes.${fortuneTypeName}.${argName}.link`); | ||
if (options['pull']) { | ||
if (!updates.pull) { | ||
updates.pull = {}; | ||
} | ||
updates.pull[argName] = arg; | ||
} | ||
else { | ||
if (!updates.push) { | ||
updates.push = {}; | ||
} | ||
updates.push[argName] = arg; | ||
@@ -296,2 +302,5 @@ } | ||
} | ||
if (!updates.replace) { | ||
updates.replace = {}; | ||
} | ||
updates.replace[argName] = arg; | ||
@@ -298,0 +307,0 @@ } |
{ | ||
"name": "graphql-genie", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "GraphQL Genie", | ||
@@ -5,0 +5,0 @@ "browser": "./lib/browser.umd.js", |
@@ -8,2 +8,9 @@ import { atob, btoa } from 'abab'; | ||
import { computeRelations } from './TypeGeneratorUtilities'; | ||
interface FortuneUpdate { | ||
id: string; | ||
push?: object; | ||
replace?: object; | ||
pull?: object; | ||
} | ||
export default class FortuneGraph implements DataResolver { | ||
@@ -302,4 +309,4 @@ | ||
private generateUpdates = (fortuneTypeName: string, record, options: object = {}) => { | ||
const updates = { id: this.getFortuneId(record['id']), replace: {}, push: {}, pull: {} }; | ||
private generateUpdates = (fortuneTypeName: string, record, options: object = {}): FortuneUpdate => { | ||
const updates: FortuneUpdate = { id: this.getFortuneId(record['id']) }; | ||
for (const argName in record) { | ||
@@ -316,4 +323,10 @@ const link = get(this.store, `recordTypes.${fortuneTypeName}.${argName}.link`); | ||
if (options['pull']) { | ||
if (!updates.pull) { | ||
updates.pull = {}; | ||
} | ||
updates.pull[argName] = arg; | ||
} else { | ||
if (!updates.push) { | ||
updates.push = {}; | ||
} | ||
updates.push[argName] = arg; | ||
@@ -325,2 +338,5 @@ } | ||
} | ||
if (!updates.replace) { | ||
updates.replace = {}; | ||
} | ||
updates.replace[argName] = arg; | ||
@@ -327,0 +343,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
862494
20165