@kiwano/core 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ import { Plugin } from "../common";
6
6
  import { BuildContext } from "../../Builder";
7
7
  export interface EqualsFilterPluginOptions {
8
8
  multi?: boolean;
9
+ manual?: boolean;
9
10
  fields?: EqualsFilterPluginFieldConfig[];
10
11
  exclude?: string[];
11
12
  include?: string[];
@@ -22,6 +23,8 @@ export declare class EqualsFilterPlugin implements Plugin {
22
23
  constructor(options?: EqualsFilterPluginOptions);
23
24
  multi(): this;
24
25
  multi(multi: boolean): this;
26
+ manual(): this;
27
+ manual(manual: boolean): this;
25
28
  field(name: string, type: InputFieldType): this;
26
29
  exclude(...fieldNames: string[]): this;
27
30
  include(...fieldNames: string[]): this;
@@ -11,6 +11,7 @@ const util_1 = require("../../util");
11
11
  const PluginError_1 = __importDefault(require("../PluginError"));
12
12
  exports.defaultEqualsFilterPluginOptions = {
13
13
  multi: false,
14
+ manual: false,
14
15
  argumentName: 'filter',
15
16
  inputName: typeName => `${typeName}EqualsFilter`,
16
17
  };
@@ -25,6 +26,10 @@ class EqualsFilterPlugin {
25
26
  this._options.multi = multi;
26
27
  return this;
27
28
  }
29
+ manual(manual = true) {
30
+ this._options.manual = manual;
31
+ return this;
32
+ }
28
33
  field(name, type) {
29
34
  if (!this._options.fields) {
30
35
  this._options.fields = [];
@@ -55,7 +60,7 @@ class EqualsFilterPlugin {
55
60
  const typeName = info.type.toString();
56
61
  const inputTypeName = this._options.inputName(typeName);
57
62
  let targetObjectType;
58
- if (!this._options.fields) {
63
+ if (!this._options.manual) {
59
64
  targetObjectType = context.rootSchema.findType(typeName, true);
60
65
  if (!targetObjectType) {
61
66
  throw new PluginError_1.default(`Filter target object ${typeName} not found`);
@@ -88,7 +93,7 @@ class EqualsFilterPlugin {
88
93
  });
89
94
  }
90
95
  }
91
- else if (this._options.fields) {
96
+ if (this._options.fields) {
92
97
  this._options.fields.forEach(field => fields.add(field));
93
98
  }
94
99
  const extraFields = this._getExtraFieldConfigs(context, name, targetObjectType);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiwano/core",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",