@nocobase/plugin-data-source-main 1.3.0-alpha.20240710155619 → 1.3.0-alpha.20240721030922
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.3.0-alpha.
|
|
12
|
-
"@nocobase/database": "1.3.0-alpha.
|
|
13
|
-
"@nocobase/plugin-error-handler": "1.3.0-alpha.
|
|
14
|
-
"@nocobase/server": "1.3.0-alpha.
|
|
11
|
+
"@nocobase/client": "1.3.0-alpha.20240721030922",
|
|
12
|
+
"@nocobase/database": "1.3.0-alpha.20240721030922",
|
|
13
|
+
"@nocobase/plugin-error-handler": "1.3.0-alpha.20240721030922",
|
|
14
|
+
"@nocobase/server": "1.3.0-alpha.20240721030922",
|
|
15
15
|
"async-mutex": "0.3.2",
|
|
16
16
|
"lodash": "4.17.21",
|
|
17
|
-
"@nocobase/test": "1.3.0-alpha.
|
|
18
|
-
"@nocobase/utils": "1.3.0-alpha.
|
|
17
|
+
"@nocobase/test": "1.3.0-alpha.20240721030922",
|
|
18
|
+
"@nocobase/utils": "1.3.0-alpha.20240721030922",
|
|
19
19
|
"sequelize": "6.35.2",
|
|
20
20
|
"dayjs": "1.11.10"
|
|
21
21
|
};
|
|
@@ -47,10 +47,16 @@ class CollectionModel extends import_database.MagicAttributeModel {
|
|
|
47
47
|
}
|
|
48
48
|
toJSON() {
|
|
49
49
|
const json = super.toJSON();
|
|
50
|
+
const collection = this.db.getCollection(json.name);
|
|
50
51
|
if (!json.filterTargetKey) {
|
|
51
|
-
const collection = this.db.getCollection(json.name);
|
|
52
52
|
json.filterTargetKey = collection == null ? void 0 : collection.filterTargetKey;
|
|
53
53
|
}
|
|
54
|
+
if (collection && collection.unavailableActions) {
|
|
55
|
+
json["unavailableActions"] = collection.unavailableActions();
|
|
56
|
+
}
|
|
57
|
+
if (collection && collection.availableActions) {
|
|
58
|
+
json["availableActions"] = collection.availableActions();
|
|
59
|
+
}
|
|
54
60
|
return json;
|
|
55
61
|
}
|
|
56
62
|
async load(loadOptions = {}) {
|
|
@@ -57,6 +57,11 @@ class FieldModel extends import_database.MagicAttributeModel {
|
|
|
57
57
|
fieldKey: this.get("key"),
|
|
58
58
|
transaction
|
|
59
59
|
});
|
|
60
|
+
if (transaction) {
|
|
61
|
+
this.db.on("transactionRollback:" + transaction["id"], async () => {
|
|
62
|
+
collection.removeField(name);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
60
65
|
return field;
|
|
61
66
|
}
|
|
62
67
|
async syncSortByField(options) {
|
package/dist/server/server.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class PluginDataSourceMainServer extends Plugin {
|
|
|
12
12
|
schema: string;
|
|
13
13
|
private loadFilter;
|
|
14
14
|
setLoadFilter(filter: Filter): void;
|
|
15
|
+
onSync(message: any): Promise<void>;
|
|
15
16
|
beforeLoad(): Promise<void>;
|
|
16
17
|
load(): Promise<void>;
|
|
17
18
|
install(): Promise<void>;
|
package/dist/server/server.js
CHANGED
|
@@ -62,6 +62,17 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
62
62
|
setLoadFilter(filter) {
|
|
63
63
|
this.loadFilter = filter;
|
|
64
64
|
}
|
|
65
|
+
async onSync(message) {
|
|
66
|
+
const { type, collectionName } = message;
|
|
67
|
+
if (type === "newCollection") {
|
|
68
|
+
const collectionModel = await this.app.db.getCollection("collections").repository.findOne({
|
|
69
|
+
filter: {
|
|
70
|
+
name: collectionName
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
await collectionModel.load();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
65
76
|
async beforeLoad() {
|
|
66
77
|
if (this.app.db.inDialect("postgres")) {
|
|
67
78
|
this.schema = process.env.COLLECTION_MANAGER_SCHEMA || this.db.options.schema || "public";
|
|
@@ -93,6 +104,10 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
93
104
|
await model.migrate({
|
|
94
105
|
transaction
|
|
95
106
|
});
|
|
107
|
+
this.app.syncManager.publish(this.name, {
|
|
108
|
+
type: "newCollection",
|
|
109
|
+
collectionName: model.get("name")
|
|
110
|
+
});
|
|
96
111
|
}
|
|
97
112
|
}
|
|
98
113
|
);
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "数据源:主数据库",
|
|
5
5
|
"description": "NocoBase main database, supports relational databases such as MySQL, PostgreSQL, SQLite and so on.",
|
|
6
6
|
"description.zh-CN": "NocoBase 主数据库,支持 MySQL、PostgreSQL、SQLite 等关系型数据库。",
|
|
7
|
-
"version": "1.3.0-alpha.
|
|
7
|
+
"version": "1.3.0-alpha.20240721030922",
|
|
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": "c4e4f6af1bed25628a54aa3eda316d95f6201f9e",
|
|
26
26
|
"keywords": [
|
|
27
27
|
"Data sources"
|
|
28
28
|
]
|