@nocobase/plugin-data-source-manager 1.6.0-alpha.7 → 1.6.0-alpha.8
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 +8 -8
- package/dist/server/models/data-source.d.ts +1 -0
- package/dist/server/models/data-source.js +17 -3
- package/dist/server/models/data-sources-field-model.d.ts +1 -0
- package/dist/server/models/data-sources-field-model.js +20 -2
- package/dist/server/plugin.js +2 -1
- package/package.json +2 -2
package/dist/externalVersion.js
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.6.0-alpha.
|
|
11
|
+
"@nocobase/client": "1.6.0-alpha.8",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@nocobase/plugin-acl": "1.6.0-alpha.
|
|
14
|
-
"@nocobase/utils": "1.6.0-alpha.
|
|
15
|
-
"@nocobase/server": "1.6.0-alpha.
|
|
13
|
+
"@nocobase/plugin-acl": "1.6.0-alpha.8",
|
|
14
|
+
"@nocobase/utils": "1.6.0-alpha.8",
|
|
15
|
+
"@nocobase/server": "1.6.0-alpha.8",
|
|
16
16
|
"lodash": "4.17.21",
|
|
17
|
-
"@nocobase/data-source-manager": "1.6.0-alpha.
|
|
17
|
+
"@nocobase/data-source-manager": "1.6.0-alpha.8",
|
|
18
18
|
"@ant-design/icons": "5.2.6",
|
|
19
19
|
"antd": "5.12.8",
|
|
20
20
|
"react-router-dom": "6.21.0",
|
|
@@ -22,10 +22,10 @@ module.exports = {
|
|
|
22
22
|
"react-i18next": "11.18.6",
|
|
23
23
|
"@formily/react": "2.3.0",
|
|
24
24
|
"@emotion/css": "11.13.0",
|
|
25
|
-
"@nocobase/database": "1.6.0-alpha.
|
|
26
|
-
"@nocobase/acl": "1.6.0-alpha.
|
|
25
|
+
"@nocobase/database": "1.6.0-alpha.8",
|
|
26
|
+
"@nocobase/acl": "1.6.0-alpha.8",
|
|
27
27
|
"sequelize": "6.35.2",
|
|
28
|
-
"@nocobase/test": "1.6.0-alpha.
|
|
28
|
+
"@nocobase/test": "1.6.0-alpha.8",
|
|
29
29
|
"@formily/antd-v5": "1.1.9",
|
|
30
30
|
"@formily/core": "2.3.0",
|
|
31
31
|
"@formily/reactive": "2.3.0",
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var data_source_exports = {};
|
|
28
38
|
__export(data_source_exports, {
|
|
@@ -31,6 +41,7 @@ __export(data_source_exports, {
|
|
|
31
41
|
module.exports = __toCommonJS(data_source_exports);
|
|
32
42
|
var import_database = require("@nocobase/database");
|
|
33
43
|
var import_plugin_acl = require("@nocobase/plugin-acl");
|
|
44
|
+
var path = __toESM(require("path"));
|
|
34
45
|
const availableActions = {
|
|
35
46
|
create: {
|
|
36
47
|
displayName: '{{t("Add new")}}',
|
|
@@ -87,7 +98,7 @@ class DataSourceModel extends import_database.Model {
|
|
|
87
98
|
}
|
|
88
99
|
}
|
|
89
100
|
async loadIntoApplication(options) {
|
|
90
|
-
const { app, loadAtAfterStart } = options;
|
|
101
|
+
const { app, loadAtAfterStart, refresh } = options;
|
|
91
102
|
const dataSourceKey = this.get("key");
|
|
92
103
|
const pluginDataSourceManagerServer = app.pm.get("data-source-manager");
|
|
93
104
|
if (pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] === "loaded") {
|
|
@@ -102,7 +113,9 @@ class DataSourceModel extends import_database.Model {
|
|
|
102
113
|
...createOptions,
|
|
103
114
|
name: dataSourceKey,
|
|
104
115
|
logger: app.logger.child({ dataSourceKey }),
|
|
105
|
-
sqlLogger: app.sqlLogger.child({ dataSourceKey })
|
|
116
|
+
sqlLogger: app.sqlLogger.child({ dataSourceKey }),
|
|
117
|
+
cache: app.cache,
|
|
118
|
+
storagePath: path.join(process.cwd(), "storage", "cache", "apps", app.name)
|
|
106
119
|
});
|
|
107
120
|
dataSource.on("loadingProgress", (progress) => {
|
|
108
121
|
pluginDataSourceManagerServer.dataSourceLoadingProgress[dataSourceKey] = progress;
|
|
@@ -122,7 +135,8 @@ class DataSourceModel extends import_database.Model {
|
|
|
122
135
|
dataSource.resourceManager.use(import_plugin_acl.setCurrentRole, { tag: "setCurrentRole", before: "acl", after: "auth" });
|
|
123
136
|
await this.loadIntoACL({ app, acl, transaction: options.transaction });
|
|
124
137
|
await app.dataSourceManager.add(dataSource, {
|
|
125
|
-
localData: await this.loadLocalData()
|
|
138
|
+
localData: await this.loadLocalData(),
|
|
139
|
+
refresh
|
|
126
140
|
});
|
|
127
141
|
} catch (e) {
|
|
128
142
|
app.logger.error(`load data source failed`, { cause: e });
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __export = (target, all) => {
|
|
15
17
|
for (var name in all)
|
|
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
var data_sources_field_model_exports = {};
|
|
28
38
|
__export(data_sources_field_model_exports, {
|
|
@@ -30,11 +40,12 @@ __export(data_sources_field_model_exports, {
|
|
|
30
40
|
});
|
|
31
41
|
module.exports = __toCommonJS(data_sources_field_model_exports);
|
|
32
42
|
var import_database = require("@nocobase/database");
|
|
43
|
+
var import_lodash = __toESM(require("lodash"));
|
|
33
44
|
var import_utils = require("../utils");
|
|
34
45
|
class DataSourcesFieldModel extends import_database.MagicAttributeModel {
|
|
35
46
|
load(loadOptions) {
|
|
36
47
|
const { app } = loadOptions;
|
|
37
|
-
const options = this.
|
|
48
|
+
const options = this.toJSON();
|
|
38
49
|
const { collectionName, name, dataSourceKey, field } = options;
|
|
39
50
|
const dataSource = app.dataSourceManager.dataSources.get(dataSourceKey);
|
|
40
51
|
const collection = dataSource.collectionManager.getCollection(collectionName);
|
|
@@ -52,7 +63,7 @@ class DataSourcesFieldModel extends import_database.MagicAttributeModel {
|
|
|
52
63
|
}
|
|
53
64
|
unload(loadOptions) {
|
|
54
65
|
const { app } = loadOptions;
|
|
55
|
-
const options = this.
|
|
66
|
+
const options = this.toJSON();
|
|
56
67
|
const { collectionName, name, dataSourceKey } = options;
|
|
57
68
|
const dataSource = app.dataSourceManager.dataSources.get(dataSourceKey);
|
|
58
69
|
if (!dataSource) {
|
|
@@ -64,6 +75,13 @@ class DataSourcesFieldModel extends import_database.MagicAttributeModel {
|
|
|
64
75
|
}
|
|
65
76
|
collection.removeField(name);
|
|
66
77
|
}
|
|
78
|
+
toJSON() {
|
|
79
|
+
const json = super.toJSON();
|
|
80
|
+
if (json.interface === "unixTimestamp" && json.accuracy) {
|
|
81
|
+
import_lodash.default.set(json, "uiSchema.x-component-props.accuracy", json.accuracy);
|
|
82
|
+
}
|
|
83
|
+
return json;
|
|
84
|
+
}
|
|
67
85
|
}
|
|
68
86
|
// Annotate the CommonJS export names for ESM import in node:
|
|
69
87
|
0 && (module.exports = {
|
package/dist/server/plugin.js
CHANGED
|
@@ -363,7 +363,8 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
|
|
|
363
363
|
const currentStatus = plugin.dataSourceStatus[filterByTk];
|
|
364
364
|
if (canRefreshStatus.includes(currentStatus) && (clientStatus ? clientStatus && canRefreshStatus.includes(clientStatus) : true)) {
|
|
365
365
|
dataSourceModel.loadIntoApplication({
|
|
366
|
-
app: ctx.app
|
|
366
|
+
app: ctx.app,
|
|
367
|
+
refresh: true
|
|
367
368
|
});
|
|
368
369
|
ctx.app.syncMessageManager.publish(self.name, {
|
|
369
370
|
type: "loadDataSource",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-data-source-manager",
|
|
3
|
-
"version": "1.6.0-alpha.
|
|
3
|
+
"version": "1.6.0-alpha.8",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"displayName": "Data source manager",
|
|
6
6
|
"displayName.zh-CN": "数据源管理",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"keywords": [
|
|
18
18
|
"Data model tools"
|
|
19
19
|
],
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "f7ab757a5d7fb723c96bc9c1340291e4deec03ea"
|
|
21
21
|
}
|