@@ -14268,6 +14268,9 @@ var VuexORMGraphQLPlugin = (function (exports) {
1426814268 // Ignore empty fields
1426914269 if (value === null || value === undefined)
1427014270 return false;
14271+ // Ignore fields that don't exist in the input type
14272+ if (!this.inputTypeContainsField(model, fieldName))
14273+ return false;
1427114274 // Include all eager save connections
1427214275 if (model.getRelations().has(fieldName)) {
1427314276 // We never add relations to filters.
@@ -14283,6 +14286,18 @@ var VuexORMGraphQLPlugin = (function (exports) {
1428314286 // Everything else is ok
1428414287 return true;
1428514288 };
14289+ /**
14290+ * Tells whether a field is in the input type.
14291+ * @param {Model} model
14292+ * @param {string} fieldName
14293+ */
14294+ Transformer.inputTypeContainsField = function (model, fieldName) {
14295+ var inputTypeName = model.singularName + "Input";
14296+ var inputType = Context.getInstance().schema.getType(inputTypeName, false);
14297+ if (inputType === null)
14298+ throw new Error("Type " + inputType + " doesn't exist.");
14299+ return inputType.inputFields.find(function (f) { return f.name === fieldName; }) != null;
14300+ };
1428614301 /**
1428714302 * Registers a record for recursion detection.
1428814303 * @param {Map<string, Array<string>>} records Map of IDs.
@@ -15130,7 +15145,9 @@ var VuexORMGraphQLPlugin = (function (exports) {
1513015145 }
1513115146 });
1513215147 if (!first) {
15133- if (!signature && filter && Context.getInstance().adapter.getArgumentMode() === exports.ArgumentMode.TYPE)
15148+ if (!signature &&
15149+ filter &&
15150+ Context.getInstance().adapter.getArgumentMode() === exports.ArgumentMode.TYPE)
1513415151 returnValue = "filter: { " + returnValue + " }";
1513515152 returnValue = "(" + returnValue + ")";
1513615153 }
0 commit comments