@nocobase/database 0.21.0-alpha.2 → 0.21.0-alpha.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.
package/lib/collection.js
CHANGED
|
@@ -234,12 +234,14 @@ const _Collection = class _Collection extends import_events.EventEmitter {
|
|
|
234
234
|
this.db.logger.warn(
|
|
235
235
|
`source collection "${sourceCollectionName}" not found for field "${name}" at collection "${this.name}"`
|
|
236
236
|
);
|
|
237
|
+
return null;
|
|
237
238
|
} else {
|
|
238
239
|
const sourceField = sourceCollection.fields.get(sourceFieldName);
|
|
239
240
|
if (!sourceField) {
|
|
240
241
|
this.db.logger.warn(
|
|
241
|
-
`
|
|
242
|
+
`Source field "${sourceFieldName}" not found for field "${name}" at collection "${this.name}". Source collection: "${sourceCollectionName}"`
|
|
242
243
|
);
|
|
244
|
+
return null;
|
|
243
245
|
} else {
|
|
244
246
|
options = { ...import_lodash.default.omit(sourceField.options, ["name", "primaryKey"]), ...options };
|
|
245
247
|
}
|
|
@@ -36,6 +36,17 @@ const _SqlCollection = class _SqlCollection extends import_collection.Collection
|
|
|
36
36
|
collectionSchema() {
|
|
37
37
|
return void 0;
|
|
38
38
|
}
|
|
39
|
+
get filterTargetKey() {
|
|
40
|
+
var _a;
|
|
41
|
+
const targetKey = ((_a = this.options) == null ? void 0 : _a.filterTargetKey) || "id";
|
|
42
|
+
if (targetKey && this.model.getAttributes()[targetKey]) {
|
|
43
|
+
return targetKey;
|
|
44
|
+
}
|
|
45
|
+
if (this.model.primaryKeyAttributes.length > 1) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return this.model.primaryKeyAttribute;
|
|
49
|
+
}
|
|
39
50
|
modelInit() {
|
|
40
51
|
var _a;
|
|
41
52
|
const { autoGenId, sql } = this.options;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/database",
|
|
3
|
-
"version": "0.21.0-alpha.
|
|
3
|
+
"version": "0.21.0-alpha.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/logger": "0.21.0-alpha.
|
|
10
|
-
"@nocobase/utils": "0.21.0-alpha.
|
|
9
|
+
"@nocobase/logger": "0.21.0-alpha.3",
|
|
10
|
+
"@nocobase/utils": "0.21.0-alpha.3",
|
|
11
11
|
"async-mutex": "^0.3.2",
|
|
12
12
|
"chalk": "^4.1.1",
|
|
13
13
|
"cron-parser": "4.4.0",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
37
37
|
"directory": "packages/database"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "f7276aff14063a2cf825191a0c83aeacde05a912"
|
|
40
40
|
}
|