@nocobase/database 1.4.0-alpha.20241027230531 → 1.4.0-alpha.20241104151643
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.
- package/lib/collection.d.ts +1 -1
- package/lib/collection.js +17 -3
- package/package.json +4 -4
package/lib/collection.d.ts
CHANGED
|
@@ -78,13 +78,13 @@ 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;
|
|
82
81
|
get name(): string;
|
|
83
82
|
get origin(): string;
|
|
84
83
|
get titleField(): string;
|
|
85
84
|
get db(): Database;
|
|
86
85
|
get treeParentField(): BelongsToField | null;
|
|
87
86
|
get treeChildrenField(): HasManyField | null;
|
|
87
|
+
isMultiFilterTargetKey(): boolean;
|
|
88
88
|
tableName(): any;
|
|
89
89
|
/**
|
|
90
90
|
* @internal
|
package/lib/collection.js
CHANGED
|
@@ -123,9 +123,6 @@ const _Collection = class _Collection extends import_events.EventEmitter {
|
|
|
123
123
|
}
|
|
124
124
|
return this.model.primaryKeyAttribute;
|
|
125
125
|
}
|
|
126
|
-
isMultiFilterTargetKey() {
|
|
127
|
-
return Array.isArray(this.filterTargetKey) && this.filterTargetKey.length > 1;
|
|
128
|
-
}
|
|
129
126
|
get name() {
|
|
130
127
|
return this.options.name;
|
|
131
128
|
}
|
|
@@ -152,6 +149,9 @@ const _Collection = class _Collection extends import_events.EventEmitter {
|
|
|
152
149
|
}
|
|
153
150
|
}
|
|
154
151
|
}
|
|
152
|
+
isMultiFilterTargetKey() {
|
|
153
|
+
return Array.isArray(this.filterTargetKey) && this.filterTargetKey.length > 1;
|
|
154
|
+
}
|
|
155
155
|
tableName() {
|
|
156
156
|
const { name, tableName } = this.options;
|
|
157
157
|
const tName = tableName || name;
|
|
@@ -220,6 +220,17 @@ const _Collection = class _Collection extends import_events.EventEmitter {
|
|
|
220
220
|
this._primaryKeyAttributes = value;
|
|
221
221
|
}
|
|
222
222
|
});
|
|
223
|
+
Object.defineProperty(this.model, "primaryKeyField", {
|
|
224
|
+
get: function() {
|
|
225
|
+
if (this.primaryKeyAttribute) {
|
|
226
|
+
return this.rawAttributes[this.primaryKeyAttribute].field || this.primaryKeyAttribute;
|
|
227
|
+
}
|
|
228
|
+
return null;
|
|
229
|
+
}.bind(this.model),
|
|
230
|
+
set(val) {
|
|
231
|
+
this._primaryKeyField = val;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
223
234
|
this.model.init(null, this.sequelizeModelOptions());
|
|
224
235
|
this.model.options.modelName = this.options.name;
|
|
225
236
|
if (!autoGenId) {
|
|
@@ -471,6 +482,9 @@ const _Collection = class _Collection extends import_events.EventEmitter {
|
|
|
471
482
|
updateOptions(options, mergeOptions) {
|
|
472
483
|
let newOptions = import_lodash.default.cloneDeep(options);
|
|
473
484
|
newOptions = (0, import_deepmerge.default)(this.options, newOptions, mergeOptions);
|
|
485
|
+
if (options.filterTargetKey) {
|
|
486
|
+
newOptions.filterTargetKey = options.filterTargetKey;
|
|
487
|
+
}
|
|
474
488
|
this.context.database.emit("beforeUpdateCollection", this, newOptions);
|
|
475
489
|
this.options = newOptions;
|
|
476
490
|
this.setFields(options.fields, false);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/database",
|
|
3
|
-
"version": "1.4.0-alpha.
|
|
3
|
+
"version": "1.4.0-alpha.20241104151643",
|
|
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.
|
|
10
|
-
"@nocobase/utils": "1.4.0-alpha.
|
|
9
|
+
"@nocobase/logger": "1.4.0-alpha.20241104151643",
|
|
10
|
+
"@nocobase/utils": "1.4.0-alpha.20241104151643",
|
|
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": "
|
|
41
|
+
"gitHead": "7596b7bb7568b6de5a8fc062eab2b1b7ecc09054"
|
|
42
42
|
}
|