@nocobase/plugin-data-source-main 1.3.44-beta → 1.4.0-alpha.0
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,14 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.
|
|
12
|
-
"@nocobase/database": "1.
|
|
13
|
-
"@nocobase/plugin-error-handler": "1.
|
|
14
|
-
"@nocobase/server": "1.
|
|
11
|
+
"@nocobase/client": "1.4.0-alpha.0",
|
|
12
|
+
"@nocobase/database": "1.4.0-alpha.0",
|
|
13
|
+
"@nocobase/plugin-error-handler": "1.4.0-alpha.0",
|
|
14
|
+
"@nocobase/server": "1.4.0-alpha.0",
|
|
15
15
|
"async-mutex": "0.3.2",
|
|
16
16
|
"lodash": "4.17.21",
|
|
17
|
-
"@nocobase/test": "1.
|
|
18
|
-
"@nocobase/utils": "1.
|
|
17
|
+
"@nocobase/test": "1.4.0-alpha.0",
|
|
18
|
+
"@nocobase/utils": "1.4.0-alpha.0",
|
|
19
19
|
"sequelize": "6.35.2",
|
|
20
20
|
"dayjs": "1.11.10"
|
|
21
21
|
};
|
|
@@ -72,6 +72,9 @@ class CollectionModel extends import_database.MagicAttributeModel {
|
|
|
72
72
|
if (!this.db.inDialect("postgres") && collectionOptions.schema) {
|
|
73
73
|
delete collectionOptions.schema;
|
|
74
74
|
}
|
|
75
|
+
if (this.db.inDialect("postgres") && !collectionOptions.schema && collectionOptions.from !== "db2cm") {
|
|
76
|
+
collectionOptions.schema = process.env.COLLECTION_MANAGER_SCHEMA || this.db.options.schema || "public";
|
|
77
|
+
}
|
|
75
78
|
if (this.db.hasCollection(name)) {
|
|
76
79
|
collection = this.db.getCollection(name);
|
|
77
80
|
if (skipExist) {
|
package/dist/server/server.d.ts
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import { Filter } from '@nocobase/database';
|
|
10
10
|
import { Plugin } from '@nocobase/server';
|
|
11
11
|
export declare class PluginDataSourceMainServer extends Plugin {
|
|
12
|
-
schema: string;
|
|
13
12
|
private loadFilter;
|
|
14
13
|
setLoadFilter(filter: Filter): void;
|
|
15
14
|
onSync(message: any): Promise<void>;
|
package/dist/server/server.js
CHANGED
|
@@ -45,7 +45,6 @@ var import_server = require("@nocobase/server");
|
|
|
45
45
|
var import_async_mutex = require("async-mutex");
|
|
46
46
|
var import_lodash = __toESM(require("lodash"));
|
|
47
47
|
var import_path = __toESM(require("path"));
|
|
48
|
-
var process = __toESM(require("process"));
|
|
49
48
|
var import__ = require(".");
|
|
50
49
|
var import_hooks = require("./hooks");
|
|
51
50
|
var import_beforeCreateForValidateField = require("./hooks/beforeCreateForValidateField");
|
|
@@ -58,7 +57,6 @@ var import_beforeDestoryField = require("./hooks/beforeDestoryField");
|
|
|
58
57
|
var import_field_is_depended_on_by_other = require("./errors/field-is-depended-on-by-other");
|
|
59
58
|
var import_beforeCreateCheckFieldInMySQL = require("./hooks/beforeCreateCheckFieldInMySQL");
|
|
60
59
|
class PluginDataSourceMainServer extends import_server.Plugin {
|
|
61
|
-
schema;
|
|
62
60
|
loadFilter = {};
|
|
63
61
|
setLoadFilter(filter) {
|
|
64
62
|
this.loadFilter = filter;
|
|
@@ -75,9 +73,6 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
75
73
|
}
|
|
76
74
|
}
|
|
77
75
|
async beforeLoad() {
|
|
78
|
-
if (this.app.db.inDialect("postgres")) {
|
|
79
|
-
this.schema = process.env.COLLECTION_MANAGER_SCHEMA || this.db.options.schema || "public";
|
|
80
|
-
}
|
|
81
76
|
this.app.db.registerRepositories({
|
|
82
77
|
CollectionRepository: import__.CollectionRepository
|
|
83
78
|
});
|
|
@@ -92,11 +87,6 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
92
87
|
plugin: this
|
|
93
88
|
}
|
|
94
89
|
});
|
|
95
|
-
this.app.db.on("collections.beforeCreate", async (model) => {
|
|
96
|
-
if (this.app.db.inDialect("postgres") && this.schema && model.get("from") != "db2cm" && !model.get("schema")) {
|
|
97
|
-
model.set("schema", this.schema);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
90
|
this.app.db.on("collections.beforeCreate", (0, import_beforeCreateForViewCollection.beforeCreateForViewCollection)(this.db));
|
|
101
91
|
this.app.db.on(
|
|
102
92
|
"collections.afterSaveWithAssociations",
|
|
@@ -275,7 +265,7 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
275
265
|
});
|
|
276
266
|
};
|
|
277
267
|
this.app.on("beforeStart", loadCollections);
|
|
278
|
-
this.app.
|
|
268
|
+
this.app.resourceManager.use(async function pushUISchemaWhenUpdateCollectionField(ctx, next) {
|
|
279
269
|
const { resourceName, actionName } = ctx.action;
|
|
280
270
|
if (resourceName === "collections.fields" && actionName === "update") {
|
|
281
271
|
const { updateAssociationValues = [] } = ctx.action.params;
|
|
@@ -346,7 +336,7 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
346
336
|
};
|
|
347
337
|
}
|
|
348
338
|
);
|
|
349
|
-
this.app.
|
|
339
|
+
this.app.resourceManager.use(async function mergeReverseFieldWhenSaveCollectionField(ctx, next) {
|
|
350
340
|
if (ctx.action.resourceName === "collections.fields" && ["create", "update"].includes(ctx.action.actionName)) {
|
|
351
341
|
ctx.action.mergeParams({
|
|
352
342
|
updateAssociationValues: ["reverseField"]
|
|
@@ -376,7 +366,7 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
376
366
|
}
|
|
377
367
|
}
|
|
378
368
|
};
|
|
379
|
-
this.app.
|
|
369
|
+
this.app.resourceManager.use(async function handleFieldSourceMiddleware(ctx, next) {
|
|
380
370
|
var _a, _b;
|
|
381
371
|
await next();
|
|
382
372
|
if (ctx.action.resourceName === "collections" && ctx.action.actionName == "list" && ((_a = ctx.action.params) == null ? void 0 : _a.paginate) == "false") {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "数据源:主数据库",
|
|
5
5
|
"description": "NocoBase main database, supports relational databases such as PostgreSQL, MySQL, MariaDB and so on.",
|
|
6
6
|
"description.zh-CN": "NocoBase 主数据库,支持 PostgreSQL、MySQL、MariaDB 等关系型数据库。",
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.4.0-alpha.0",
|
|
8
8
|
"main": "./dist/server/index.js",
|
|
9
9
|
"homepage": "https://docs.nocobase.com/handbook/data-source-main",
|
|
10
10
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/data-source-main",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@nocobase/test": "1.x",
|
|
23
23
|
"@nocobase/utils": "1.x"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "8ffa7b54bbaf720c0c9857da4b19a99110dffc4b",
|
|
26
26
|
"keywords": [
|
|
27
27
|
"Data sources"
|
|
28
28
|
]
|
|
File without changes
|