@nocobase/database 2.0.0-alpha.35 → 2.0.0-alpha.37

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.
Files changed (2) hide show
  1. package/lib/collection.js +12 -2
  2. package/package.json +4 -4
package/lib/collection.js CHANGED
@@ -668,11 +668,21 @@ const _Collection = class _Collection extends import_events.EventEmitter {
668
668
  */
669
669
  refreshIndexes() {
670
670
  const indexes = this.model._indexes;
671
+ const attributes = {};
672
+ for (const [name, field] of Object.entries(this.model.getAttributes())) {
673
+ attributes[this.normalizeFieldName(name)] = field;
674
+ }
671
675
  this.model._indexes = import_lodash.default.uniqBy(
672
676
  indexes.filter((item) => {
673
- return item.fields.every((field) => this.model.rawAttributes[field]);
677
+ return item.fields.every((field) => {
678
+ const name = this.normalizeFieldName(field);
679
+ return attributes[name];
680
+ });
674
681
  }).map((item) => {
675
- item.fields = item.fields.map((field) => this.model.rawAttributes[field].field);
682
+ item.fields = item.fields.map((field) => {
683
+ const name = this.normalizeFieldName(field);
684
+ return attributes[name].field;
685
+ });
676
686
  return item;
677
687
  }),
678
688
  "name"
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "2.0.0-alpha.35",
3
+ "version": "2.0.0-alpha.37",
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": "2.0.0-alpha.35",
10
- "@nocobase/utils": "2.0.0-alpha.35",
9
+ "@nocobase/logger": "2.0.0-alpha.37",
10
+ "@nocobase/utils": "2.0.0-alpha.37",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -39,5 +39,5 @@
39
39
  "url": "git+https://github.com/nocobase/nocobase.git",
40
40
  "directory": "packages/database"
41
41
  },
42
- "gitHead": "e60da9bab9fd4c8ba9457e9806d5428054cefa7a"
42
+ "gitHead": "56e2dc3a83b8ca7afa97cfa71b37a43f2ec10396"
43
43
  }