Skip to content

Commit

Permalink
chore: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
phortx committed May 29, 2020
1 parent 01a927f commit 68fe20f
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 63 deletions.
62 changes: 36 additions & 26 deletions dist/vuex-orm-graphql.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14297,7 +14297,7 @@ var Transformer = /** @class */ (function () {
var inputType = Context.getInstance().schema.getType(inputTypeName, false);
if (inputType === null)
throw new Error("Type " + inputType + " doesn't exist.");
return inputType.inputFields.find(function (f) { return f.name === fieldName; }) != null;
return inputType.inputFields.find(function (f) { return f.name === fieldName; }) !== undefined;
};
/**
* Registers a record for recursion detection.
Expand Down Expand Up @@ -15148,8 +15148,9 @@ var QueryBuilder = /** @class */ (function () {
if (!first) {
if (!signature &&
filter &&
Context.getInstance().adapter.getArgumentMode() === exports.ArgumentMode.TYPE)
Context.getInstance().adapter.getArgumentMode() === exports.ArgumentMode.TYPE) {
returnValue = "filter: { " + returnValue + " }";
}
returnValue = "(" + returnValue + ")";
}
}
Expand Down Expand Up @@ -15633,7 +15634,7 @@ var Mutate = /** @class */ (function (_super) {
var state = _a.state, dispatch = _a.dispatch;
var args = _b.args, name = _b.name;
return __awaiter(this, void 0, void 0, function () {
var context, model, mockReturnValue, schema;
var context, model, mockReturnValue;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
Expand All @@ -15649,7 +15650,7 @@ var Mutate = /** @class */ (function (_super) {
}
return [4 /*yield*/, context.loadSchema()];
case 1:
schema = _c.sent();
_c.sent();
args = this.prepareArgs(args);
// There could be anything in the args, but we have to be sure that all records are gone through
// transformOutgoingData()
Expand Down Expand Up @@ -15703,7 +15704,7 @@ var Persist = /** @class */ (function (_super) {
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
if (!id) return [3 /*break*/, 6];
if (!id) return [3 /*break*/, 7];
model = this.getModelFromState(state);
mutationName = Context.getInstance().adapter.getNameForPersist(model);
oldRecord = model.getRecordWithId(id);
Expand All @@ -15719,20 +15720,24 @@ var Persist = /** @class */ (function (_super) {
case 2:
_c.sent();
return [2 /*return*/, newRecord_1];
case 3:
case 3:
// Arguments
return [4 /*yield*/, Context.getInstance().loadSchema()];
case 4:
// Arguments
_c.sent();
args = this.prepareArgs(args);
this.addRecordToArgs(args, model, oldRecord);
return [4 /*yield*/, Action.mutation(mutationName, args, dispatch, model)];
case 4:
case 5:
newRecord = _c.sent();
// Delete the old record if necessary
return [4 /*yield*/, this.deleteObsoleteRecord(model, newRecord, oldRecord)];
case 5:
case 6:
// Delete the old record if necessary
_c.sent();
return [2 /*return*/, newRecord];
case 6:
case 7:
/* istanbul ignore next */
throw new Error("The persist action requires the 'id' to be set");
}
Expand Down Expand Up @@ -15797,23 +15802,28 @@ var Push = /** @class */ (function (_super) {
return __awaiter(this, void 0, void 0, function () {
var model, mutationName, mockReturnValue;
return __generator(this, function (_c) {
if (data) {
model = this.getModelFromState(state);
mutationName = Context.getInstance().adapter.getNameForPush(model);
mockReturnValue = model.$mockHook("push", {
data: data,
args: args || {}
});
if (mockReturnValue) {
return [2 /*return*/, Store.insertData(mockReturnValue, dispatch)];
}
// Arguments
args = this.prepareArgs(args, data.id);
this.addRecordToArgs(args, model, data);
// Send the mutation
return [2 /*return*/, Action.mutation(mutationName, args, dispatch, model)];
}
else {
switch (_c.label) {
case 0:
if (!data) return [3 /*break*/, 2];
model = this.getModelFromState(state);
mutationName = Context.getInstance().adapter.getNameForPush(model);
mockReturnValue = model.$mockHook("push", {
data: data,
args: args || {}
});
if (mockReturnValue) {
return [2 /*return*/, Store.insertData(mockReturnValue, dispatch)];
}
// Arguments
return [4 /*yield*/, Context.getInstance().loadSchema()];
case 1:
// Arguments
_c.sent();
args = this.prepareArgs(args, data.id);
this.addRecordToArgs(args, model, data);
// Send the mutation
return [2 /*return*/, Action.mutation(mutationName, args, dispatch, model)];
case 2:
/* istanbul ignore next */
throw new Error("The persist action requires the 'data' to be set");
}
Expand Down
9 changes: 6 additions & 3 deletions dist/vuex-orm-graphql.esm-bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -14271,7 +14271,7 @@ class Transformer {
const inputType = Context.getInstance().schema.getType(inputTypeName, false);
if (inputType === null)
throw new Error(`Type ${inputType} doesn't exist.`);
return inputType.inputFields.find(f => f.name === fieldName) != null;
return inputType.inputFields.find(f => f.name === fieldName) !== undefined;
}
/**
* Registers a record for recursion detection.
Expand Down Expand Up @@ -15161,8 +15161,9 @@ class QueryBuilder {
if (!first) {
if (!signature &&
filter &&
Context.getInstance().adapter.getArgumentMode() === ArgumentMode.TYPE)
Context.getInstance().adapter.getArgumentMode() === ArgumentMode.TYPE) {
returnValue = `filter: { ${returnValue} }`;
}
returnValue = `(${returnValue})`;
}
}
Expand Down Expand Up @@ -15550,7 +15551,7 @@ class Mutate extends Action {
if (mockReturnValue) {
return Store.insertData(mockReturnValue, dispatch);
}
const schema = await context.loadSchema();
await context.loadSchema();
args = this.prepareArgs(args);
// There could be anything in the args, but we have to be sure that all records are gone through
// transformOutgoingData()
Expand Down Expand Up @@ -15601,6 +15602,7 @@ class Persist extends Action {
return newRecord;
}
// Arguments
await Context.getInstance().loadSchema();
args = this.prepareArgs(args);
this.addRecordToArgs(args, model, oldRecord);
// Send mutation
Expand Down Expand Up @@ -15665,6 +15667,7 @@ class Push extends Action {
return Store.insertData(mockReturnValue, dispatch);
}
// Arguments
await Context.getInstance().loadSchema();
args = this.prepareArgs(args, data.id);
this.addRecordToArgs(args, model, data);
// Send the mutation
Expand Down
9 changes: 6 additions & 3 deletions dist/vuex-orm-graphql.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -14271,7 +14271,7 @@ class Transformer {
const inputType = Context.getInstance().schema.getType(inputTypeName, false);
if (inputType === null)
throw new Error(`Type ${inputType} doesn't exist.`);
return inputType.inputFields.find(f => f.name === fieldName) != null;
return inputType.inputFields.find(f => f.name === fieldName) !== undefined;
}
/**
* Registers a record for recursion detection.
Expand Down Expand Up @@ -15161,8 +15161,9 @@ class QueryBuilder {
if (!first) {
if (!signature &&
filter &&
Context.getInstance().adapter.getArgumentMode() === ArgumentMode.TYPE)
Context.getInstance().adapter.getArgumentMode() === ArgumentMode.TYPE) {
returnValue = `filter: { ${returnValue} }`;
}
returnValue = `(${returnValue})`;
}
}
Expand Down Expand Up @@ -15550,7 +15551,7 @@ class Mutate extends Action {
if (mockReturnValue) {
return Store.insertData(mockReturnValue, dispatch);
}
const schema = await context.loadSchema();
await context.loadSchema();
args = this.prepareArgs(args);
// There could be anything in the args, but we have to be sure that all records are gone through
// transformOutgoingData()
Expand Down Expand Up @@ -15601,6 +15602,7 @@ class Persist extends Action {
return newRecord;
}
// Arguments
await Context.getInstance().loadSchema();
args = this.prepareArgs(args);
this.addRecordToArgs(args, model, oldRecord);
// Send mutation
Expand Down Expand Up @@ -15665,6 +15667,7 @@ class Push extends Action {
return Store.insertData(mockReturnValue, dispatch);
}
// Arguments
await Context.getInstance().loadSchema();
args = this.prepareArgs(args, data.id);
this.addRecordToArgs(args, model, data);
// Send the mutation
Expand Down
9 changes: 6 additions & 3 deletions dist/vuex-orm-graphql.esm.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -14271,7 +14271,7 @@ class Transformer {
const inputType = Context.getInstance().schema.getType(inputTypeName, false);
if (inputType === null)
throw new Error(`Type ${inputType} doesn't exist.`);
return inputType.inputFields.find(f => f.name === fieldName) != null;
return inputType.inputFields.find(f => f.name === fieldName) !== undefined;
}
/**
* Registers a record for recursion detection.
Expand Down Expand Up @@ -15161,8 +15161,9 @@ class QueryBuilder {
if (!first) {
if (!signature &&
filter &&
Context.getInstance().adapter.getArgumentMode() === ArgumentMode.TYPE)
Context.getInstance().adapter.getArgumentMode() === ArgumentMode.TYPE) {
returnValue = `filter: { ${returnValue} }`;
}
returnValue = `(${returnValue})`;
}
}
Expand Down Expand Up @@ -15550,7 +15551,7 @@ class Mutate extends Action {
if (mockReturnValue) {
return Store.insertData(mockReturnValue, dispatch);
}
const schema = await context.loadSchema();
await context.loadSchema();
args = this.prepareArgs(args);
// There could be anything in the args, but we have to be sure that all records are gone through
// transformOutgoingData()
Expand Down Expand Up @@ -15601,6 +15602,7 @@ class Persist extends Action {
return newRecord;
}
// Arguments
await Context.getInstance().loadSchema();
args = this.prepareArgs(args);
this.addRecordToArgs(args, model, oldRecord);
// Send mutation
Expand Down Expand Up @@ -15665,6 +15667,7 @@ class Push extends Action {
return Store.insertData(mockReturnValue, dispatch);
}
// Arguments
await Context.getInstance().loadSchema();
args = this.prepareArgs(args, data.id);
this.addRecordToArgs(args, model, data);
// Send the mutation
Expand Down
62 changes: 36 additions & 26 deletions dist/vuex-orm-graphql.global.js
Original file line number Diff line number Diff line change
Expand Up @@ -14296,7 +14296,7 @@ var VuexORMGraphQLPlugin = (function (exports) {
var inputType = Context.getInstance().schema.getType(inputTypeName, false);
if (inputType === null)
throw new Error("Type " + inputType + " doesn't exist.");
return inputType.inputFields.find(function (f) { return f.name === fieldName; }) != null;
return inputType.inputFields.find(function (f) { return f.name === fieldName; }) !== undefined;
};
/**
* Registers a record for recursion detection.
Expand Down Expand Up @@ -15147,8 +15147,9 @@ var VuexORMGraphQLPlugin = (function (exports) {
if (!first) {
if (!signature &&
filter &&
Context.getInstance().adapter.getArgumentMode() === exports.ArgumentMode.TYPE)
Context.getInstance().adapter.getArgumentMode() === exports.ArgumentMode.TYPE) {
returnValue = "filter: { " + returnValue + " }";
}
returnValue = "(" + returnValue + ")";
}
}
Expand Down Expand Up @@ -15632,7 +15633,7 @@ var VuexORMGraphQLPlugin = (function (exports) {
var state = _a.state, dispatch = _a.dispatch;
var args = _b.args, name = _b.name;
return __awaiter(this, void 0, void 0, function () {
var context, model, mockReturnValue, schema;
var context, model, mockReturnValue;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
Expand All @@ -15648,7 +15649,7 @@ var VuexORMGraphQLPlugin = (function (exports) {
}
return [4 /*yield*/, context.loadSchema()];
case 1:
schema = _c.sent();
_c.sent();
args = this.prepareArgs(args);
// There could be anything in the args, but we have to be sure that all records are gone through
// transformOutgoingData()
Expand Down Expand Up @@ -15702,7 +15703,7 @@ var VuexORMGraphQLPlugin = (function (exports) {
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
if (!id) return [3 /*break*/, 6];
if (!id) return [3 /*break*/, 7];
model = this.getModelFromState(state);
mutationName = Context.getInstance().adapter.getNameForPersist(model);
oldRecord = model.getRecordWithId(id);
Expand All @@ -15718,20 +15719,24 @@ var VuexORMGraphQLPlugin = (function (exports) {
case 2:
_c.sent();
return [2 /*return*/, newRecord_1];
case 3:
case 3:
// Arguments
return [4 /*yield*/, Context.getInstance().loadSchema()];
case 4:
// Arguments
_c.sent();
args = this.prepareArgs(args);
this.addRecordToArgs(args, model, oldRecord);
return [4 /*yield*/, Action.mutation(mutationName, args, dispatch, model)];
case 4:
case 5:
newRecord = _c.sent();
// Delete the old record if necessary
return [4 /*yield*/, this.deleteObsoleteRecord(model, newRecord, oldRecord)];
case 5:
case 6:
// Delete the old record if necessary
_c.sent();
return [2 /*return*/, newRecord];
case 6:
case 7:
/* istanbul ignore next */
throw new Error("The persist action requires the 'id' to be set");
}
Expand Down Expand Up @@ -15796,23 +15801,28 @@ var VuexORMGraphQLPlugin = (function (exports) {
return __awaiter(this, void 0, void 0, function () {
var model, mutationName, mockReturnValue;
return __generator(this, function (_c) {
if (data) {
model = this.getModelFromState(state);
mutationName = Context.getInstance().adapter.getNameForPush(model);
mockReturnValue = model.$mockHook("push", {
data: data,
args: args || {}
});
if (mockReturnValue) {
return [2 /*return*/, Store.insertData(mockReturnValue, dispatch)];
}
// Arguments
args = this.prepareArgs(args, data.id);
this.addRecordToArgs(args, model, data);
// Send the mutation
return [2 /*return*/, Action.mutation(mutationName, args, dispatch, model)];
}
else {
switch (_c.label) {
case 0:
if (!data) return [3 /*break*/, 2];
model = this.getModelFromState(state);
mutationName = Context.getInstance().adapter.getNameForPush(model);
mockReturnValue = model.$mockHook("push", {
data: data,
args: args || {}
});
if (mockReturnValue) {
return [2 /*return*/, Store.insertData(mockReturnValue, dispatch)];
}
// Arguments
return [4 /*yield*/, Context.getInstance().loadSchema()];
case 1:
// Arguments
_c.sent();
args = this.prepareArgs(args, data.id);
this.addRecordToArgs(args, model, data);
// Send the mutation
return [2 /*return*/, Action.mutation(mutationName, args, dispatch, model)];
case 2:
/* istanbul ignore next */
throw new Error("The persist action requires the 'data' to be set");
}
Expand Down
2 changes: 1 addition & 1 deletion dist/vuex-orm-graphql.global.prod.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/actions/mutate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class Mutate extends Action {
return Store.insertData(mockReturnValue, dispatch!);
}

const schema: Schema = await context.loadSchema();
await context.loadSchema();
args = this.prepareArgs(args);

// There could be anything in the args, but we have to be sure that all records are gone through
Expand Down
Loading

0 comments on commit 68fe20f

Please sign in to comment.