@nocobase/plugin-data-source-main 2.0.48 → 2.0.50
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/dist/externalVersion.js
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.0.
|
|
11
|
+
"@nocobase/client": "2.0.50",
|
|
12
12
|
"lodash": "4.18.1",
|
|
13
|
-
"@nocobase/database": "2.0.
|
|
14
|
-
"@nocobase/plugin-error-handler": "2.0.
|
|
15
|
-
"@nocobase/server": "2.0.
|
|
13
|
+
"@nocobase/database": "2.0.50",
|
|
14
|
+
"@nocobase/plugin-error-handler": "2.0.50",
|
|
15
|
+
"@nocobase/server": "2.0.50",
|
|
16
16
|
"sequelize": "6.35.2",
|
|
17
17
|
"@formily/json-schema": "2.3.7",
|
|
18
|
-
"@nocobase/test": "2.0.
|
|
19
|
-
"@nocobase/utils": "2.0.
|
|
20
|
-
"@nocobase/actions": "2.0.
|
|
18
|
+
"@nocobase/test": "2.0.50",
|
|
19
|
+
"@nocobase/utils": "2.0.50",
|
|
20
|
+
"@nocobase/actions": "2.0.50",
|
|
21
21
|
"dayjs": "1.11.13"
|
|
22
22
|
};
|
|
@@ -41,6 +41,7 @@ __export(collection_exports, {
|
|
|
41
41
|
module.exports = __toCommonJS(collection_exports);
|
|
42
42
|
var import_database = require("@nocobase/database");
|
|
43
43
|
var import_lodash = __toESM(require("lodash"));
|
|
44
|
+
const databaseSyncedCollectionSources = ["db2cm", "dbsync"];
|
|
44
45
|
class CollectionModel extends import_database.MagicAttributeModel {
|
|
45
46
|
get db() {
|
|
46
47
|
return this.constructor.database;
|
|
@@ -72,7 +73,7 @@ class CollectionModel extends import_database.MagicAttributeModel {
|
|
|
72
73
|
if (!this.db.inDialect("postgres") && collectionOptions.schema) {
|
|
73
74
|
delete collectionOptions.schema;
|
|
74
75
|
}
|
|
75
|
-
if (this.db.inDialect("postgres") && !collectionOptions.schema && collectionOptions.from
|
|
76
|
+
if (this.db.inDialect("postgres") && !collectionOptions.schema && !databaseSyncedCollectionSources.includes(collectionOptions.from)) {
|
|
76
77
|
collectionOptions.schema = process.env.COLLECTION_MANAGER_SCHEMA || this.db.options.schema || "public";
|
|
77
78
|
}
|
|
78
79
|
if (this.db.hasCollection(name)) {
|
|
@@ -85,6 +85,9 @@ class CollectionRepository extends import_database.Repository {
|
|
|
85
85
|
return true;
|
|
86
86
|
}
|
|
87
87
|
const fields = nameMap[instanceName].get("fields");
|
|
88
|
+
if (!Array.isArray(fields)) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
88
91
|
return fields.filter((field) => field["type"] === "belongsTo" || field["type"] === "belongsToMany").map((field) => field.get("name"));
|
|
89
92
|
})();
|
|
90
93
|
if (import_lodash.default.isArray(skipField) && skipField.length) {
|
|
@@ -106,6 +109,9 @@ class CollectionRepository extends import_database.Repository {
|
|
|
106
109
|
});
|
|
107
110
|
const skipField = (() => {
|
|
108
111
|
const fields = nameMap[viewCollectionName].get("fields");
|
|
112
|
+
if (!Array.isArray(fields)) {
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
109
115
|
return fields.filter((field) => {
|
|
110
116
|
var _a;
|
|
111
117
|
if (((_a = field.options) == null ? void 0 : _a.source) && (field["type"] === "belongsTo" || field["type"] === "belongsToMany")) {
|
package/dist/server/server.js
CHANGED
|
@@ -109,7 +109,7 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
109
109
|
});
|
|
110
110
|
this.app.db.on("collections.beforeCreate", (0, import_beforeCreateForViewCollection.beforeCreateForViewCollection)(this.db));
|
|
111
111
|
this.app.db.on("collections.beforeCreate", async (model, options) => {
|
|
112
|
-
if (this.app.db.getCollection(model.get("name")) && model.get("from")
|
|
112
|
+
if (this.app.db.getCollection(model.get("name")) && !["db2cm", "dbsync"].includes(model.get("from")) && !model.get("isThrough")) {
|
|
113
113
|
throw new Error(`Collection named ${model.get("name")} already exists`);
|
|
114
114
|
}
|
|
115
115
|
});
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "NocoBase main database, supports relational databases such as PostgreSQL, MySQL, MariaDB and so on.",
|
|
7
7
|
"description.ru-RU": "Основная база данных NocoBase: поддерживает реляционные СУБД, включая PostgreSQL, MySQL, MariaDB и другие.",
|
|
8
8
|
"description.zh-CN": "NocoBase 主数据库,支持 PostgreSQL、MySQL、MariaDB 等关系型数据库。",
|
|
9
|
-
"version": "2.0.
|
|
9
|
+
"version": "2.0.50",
|
|
10
10
|
"main": "./dist/server/index.js",
|
|
11
11
|
"homepage": "https://docs.nocobase.com/handbook/data-source-main",
|
|
12
12
|
"homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/data-source-main",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@nocobase/test": "2.x",
|
|
26
26
|
"@nocobase/utils": "2.x"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "cd183287e7be7bb75349ad91a006f5fa53993962",
|
|
29
29
|
"keywords": [
|
|
30
30
|
"Data sources"
|
|
31
31
|
]
|