@nocobase/database 1.4.0-alpha.20240910145333 → 1.4.0-alpha.20240911231734

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.
@@ -78,6 +78,7 @@ export declare class Collection<TModelAttributes extends {} = any, TCreationAttr
78
78
  repository: Repository<TModelAttributes, TCreationAttributes>;
79
79
  constructor(options: CollectionOptions, context: CollectionContext);
80
80
  get filterTargetKey(): string | string[];
81
+ isMultiFilterTargetKey(): boolean;
81
82
  get name(): string;
82
83
  get origin(): string;
83
84
  get titleField(): string;
package/lib/collection.js CHANGED
@@ -122,6 +122,9 @@ const _Collection = class _Collection extends import_events.EventEmitter {
122
122
  }
123
123
  return this.model.primaryKeyAttribute;
124
124
  }
125
+ isMultiFilterTargetKey() {
126
+ return Array.isArray(this.filterTargetKey) && this.filterTargetKey.length > 1;
127
+ }
125
128
  get name() {
126
129
  return this.options.name;
127
130
  }
package/lib/repository.js CHANGED
@@ -184,7 +184,7 @@ const _Repository = class _Repository {
184
184
  }
185
185
  const queryOptions = {
186
186
  ...options,
187
- distinct: Boolean(this.collection.model.primaryKeyAttribute)
187
+ distinct: Boolean(this.collection.model.primaryKeyAttribute) && !this.collection.isMultiFilterTargetKey()
188
188
  };
189
189
  if (((_a = queryOptions.include) == null ? void 0 : _a.length) === 0) {
190
190
  delete queryOptions.include;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "1.4.0-alpha.20240910145333",
3
+ "version": "1.4.0-alpha.20240911231734",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "AGPL-3.0",
8
8
  "dependencies": {
9
- "@nocobase/logger": "1.4.0-alpha.20240910145333",
10
- "@nocobase/utils": "1.4.0-alpha.20240910145333",
9
+ "@nocobase/logger": "1.4.0-alpha.20240911231734",
10
+ "@nocobase/utils": "1.4.0-alpha.20240911231734",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -38,5 +38,5 @@
38
38
  "url": "git+https://github.com/nocobase/nocobase.git",
39
39
  "directory": "packages/database"
40
40
  },
41
- "gitHead": "87807593da799e557718f8e69172244c28c08d98"
41
+ "gitHead": "93db249b4151b72c654daeaff6dd81da26544122"
42
42
  }