@@ -14296,7 +14296,7 @@ var VuexORMGraphQLPlugin = (function (exports) {
1429614296 var inputType = Context.getInstance().schema.getType(inputTypeName, false);
1429714297 if (inputType === null)
1429814298 throw new Error("Type " + inputType + " doesn't exist.");
14299- return inputType.inputFields.find(function (f) { return f.name === fieldName; }) != null ;
14299+ return inputType.inputFields.find(function (f) { return f.name === fieldName; }) !== undefined ;
1430014300 };
1430114301 /**
1430214302 * Registers a record for recursion detection.
@@ -15147,8 +15147,9 @@ var VuexORMGraphQLPlugin = (function (exports) {
1514715147 if (!first) {
1514815148 if (!signature &&
1514915149 filter &&
15150- Context.getInstance().adapter.getArgumentMode() === exports.ArgumentMode.TYPE)
15150+ Context.getInstance().adapter.getArgumentMode() === exports.ArgumentMode.TYPE) {
1515115151 returnValue = "filter: { " + returnValue + " }";
15152+ }
1515215153 returnValue = "(" + returnValue + ")";
1515315154 }
1515415155 }
@@ -15632,7 +15633,7 @@ var VuexORMGraphQLPlugin = (function (exports) {
1563215633 var state = _a.state, dispatch = _a.dispatch;
1563315634 var args = _b.args, name = _b.name;
1563415635 return __awaiter(this, void 0, void 0, function () {
15635- var context, model, mockReturnValue, schema ;
15636+ var context, model, mockReturnValue;
1563615637 return __generator(this, function (_c) {
1563715638 switch (_c.label) {
1563815639 case 0:
@@ -15648,7 +15649,7 @@ var VuexORMGraphQLPlugin = (function (exports) {
1564815649 }
1564915650 return [4 /*yield*/, context.loadSchema()];
1565015651 case 1:
15651- schema = _c.sent();
15652+ _c.sent();
1565215653 args = this.prepareArgs(args);
1565315654 // There could be anything in the args, but we have to be sure that all records are gone through
1565415655 // transformOutgoingData()
@@ -15702,7 +15703,7 @@ var VuexORMGraphQLPlugin = (function (exports) {
1570215703 return __generator(this, function (_c) {
1570315704 switch (_c.label) {
1570415705 case 0:
15705- if (!id) return [3 /*break*/, 6 ];
15706+ if (!id) return [3 /*break*/, 7 ];
1570615707 model = this.getModelFromState(state);
1570715708 mutationName = Context.getInstance().adapter.getNameForPersist(model);
1570815709 oldRecord = model.getRecordWithId(id);
@@ -15718,20 +15719,24 @@ var VuexORMGraphQLPlugin = (function (exports) {
1571815719 case 2:
1571915720 _c.sent();
1572015721 return [2 /*return*/, newRecord_1];
15721- case 3:
15722+ case 3:
15723+ // Arguments
15724+ return [4 /*yield*/, Context.getInstance().loadSchema()];
15725+ case 4:
1572215726 // Arguments
15727+ _c.sent();
1572315728 args = this.prepareArgs(args);
1572415729 this.addRecordToArgs(args, model, oldRecord);
1572515730 return [4 /*yield*/, Action.mutation(mutationName, args, dispatch, model)];
15726- case 4 :
15731+ case 5 :
1572715732 newRecord = _c.sent();
1572815733 // Delete the old record if necessary
1572915734 return [4 /*yield*/, this.deleteObsoleteRecord(model, newRecord, oldRecord)];
15730- case 5 :
15735+ case 6 :
1573115736 // Delete the old record if necessary
1573215737 _c.sent();
1573315738 return [2 /*return*/, newRecord];
15734- case 6 :
15739+ case 7 :
1573515740 /* istanbul ignore next */
1573615741 throw new Error("The persist action requires the 'id' to be set");
1573715742 }
@@ -15796,23 +15801,28 @@ var VuexORMGraphQLPlugin = (function (exports) {
1579615801 return __awaiter(this, void 0, void 0, function () {
1579715802 var model, mutationName, mockReturnValue;
1579815803 return __generator(this, function (_c) {
15799- if (data) {
15800- model = this.getModelFromState(state);
15801- mutationName = Context.getInstance().adapter.getNameForPush(model);
15802- mockReturnValue = model.$mockHook("push", {
15803- data: data,
15804- args: args || {}
15805- });
15806- if (mockReturnValue) {
15807- return [2 /*return*/, Store.insertData(mockReturnValue, dispatch)];
15808- }
15809- // Arguments
15810- args = this.prepareArgs(args, data.id);
15811- this.addRecordToArgs(args, model, data);
15812- // Send the mutation
15813- return [2 /*return*/, Action.mutation(mutationName, args, dispatch, model)];
15814- }
15815- else {
15804+ switch (_c.label) {
15805+ case 0:
15806+ if (!data) return [3 /*break*/, 2];
15807+ model = this.getModelFromState(state);
15808+ mutationName = Context.getInstance().adapter.getNameForPush(model);
15809+ mockReturnValue = model.$mockHook("push", {
15810+ data: data,
15811+ args: args || {}
15812+ });
15813+ if (mockReturnValue) {
15814+ return [2 /*return*/, Store.insertData(mockReturnValue, dispatch)];
15815+ }
15816+ // Arguments
15817+ return [4 /*yield*/, Context.getInstance().loadSchema()];
15818+ case 1:
15819+ // Arguments
15820+ _c.sent();
15821+ args = this.prepareArgs(args, data.id);
15822+ this.addRecordToArgs(args, model, data);
15823+ // Send the mutation
15824+ return [2 /*return*/, Action.mutation(mutationName, args, dispatch, model)];
15825+ case 2:
1581615826 /* istanbul ignore next */
1581715827 throw new Error("The persist action requires the 'data' to be set");
1581815828 }
0 commit comments