@@ -14268,6 +14268,9 @@ var VuexORMGraphQLPlugin = (function (exports) {
14268
14268
// Ignore empty fields
14269
14269
if (value === null || value === undefined)
14270
14270
return false;
14271
+ // Ignore fields that don't exist in the input type
14272
+ if (!this.inputTypeContainsField(model, fieldName))
14273
+ return false;
14271
14274
// Include all eager save connections
14272
14275
if (model.getRelations().has(fieldName)) {
14273
14276
// We never add relations to filters.
@@ -14283,6 +14286,18 @@ var VuexORMGraphQLPlugin = (function (exports) {
14283
14286
// Everything else is ok
14284
14287
return true;
14285
14288
};
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
+ };
14286
14301
/**
14287
14302
* Registers a record for recursion detection.
14288
14303
* @param {Map<string, Array<string>>} records Map of IDs.
@@ -15130,7 +15145,9 @@ var VuexORMGraphQLPlugin = (function (exports) {
15130
15145
}
15131
15146
});
15132
15147
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)
15134
15151
returnValue = "filter: { " + returnValue + " }";
15135
15152
returnValue = "(" + returnValue + ")";
15136
15153
}
0 commit comments