befly 3.21.1 → 3.21.2
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/README.md +7 -0
- package/apis/dict/all.js +1 -1
- package/apis/dict/detail.js +1 -1
- package/apis/dict/list.js +1 -1
- package/checks/config.js +1 -3
- package/checks/table.js +2 -15
- package/configs/beflyConfig.json +1 -3
- package/index.js +5 -10
- package/lib/dbHelper.js +73 -27
- package/lib/dbUtil.js +136 -35
- package/lib/logger.js +21 -45
- package/package.json +2 -2
- package/plugins/mysql.js +2 -1
- package/scripts/syncDb/context.js +62 -47
- package/scripts/syncDb/diff.js +78 -15
- package/scripts/syncDb/index.js +16 -46
- package/scripts/syncDb/report.js +97 -98
- package/tables/admin.json +24 -0
- package/tables/api.json +24 -0
- package/tables/dict.json +24 -0
- package/tables/dictType.json +24 -0
- package/tables/emailLog.json +24 -0
- package/tables/errorReport.json +140 -0
- package/tables/infoReport.json +123 -0
- package/tables/loginLog.json +24 -0
- package/tables/menu.json +24 -0
- package/tables/operateLog.json +24 -0
- package/tables/role.json +24 -0
- package/tables/sysConfig.json +24 -0
- package/utils/loggerUtils.js +9 -14
- package/utils/scanSources.js +3 -3
- package/scripts/syncDb/query.js +0 -26
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": {
|
|
3
|
+
"name": "ID",
|
|
4
|
+
"input": "integer",
|
|
5
|
+
"min": 1,
|
|
6
|
+
"max": null
|
|
7
|
+
},
|
|
8
|
+
"reportTime": {
|
|
9
|
+
"name": "上报时间",
|
|
10
|
+
"input": "number"
|
|
11
|
+
},
|
|
12
|
+
"reportDate": {
|
|
13
|
+
"name": "上报日期",
|
|
14
|
+
"input": "number"
|
|
15
|
+
},
|
|
16
|
+
"memberKey": {
|
|
17
|
+
"name": "成员标识",
|
|
18
|
+
"input": "string",
|
|
19
|
+
"max": 100
|
|
20
|
+
},
|
|
21
|
+
"source": {
|
|
22
|
+
"name": "来源",
|
|
23
|
+
"input": "string",
|
|
24
|
+
"max": 50
|
|
25
|
+
},
|
|
26
|
+
"productName": {
|
|
27
|
+
"name": "产品名称",
|
|
28
|
+
"input": "string",
|
|
29
|
+
"max": 100
|
|
30
|
+
},
|
|
31
|
+
"productCode": {
|
|
32
|
+
"name": "产品代号",
|
|
33
|
+
"input": "string",
|
|
34
|
+
"max": 100
|
|
35
|
+
},
|
|
36
|
+
"productVersion": {
|
|
37
|
+
"name": "产品版本",
|
|
38
|
+
"input": "string",
|
|
39
|
+
"max": 100
|
|
40
|
+
},
|
|
41
|
+
"pagePath": {
|
|
42
|
+
"name": "页面路径",
|
|
43
|
+
"input": "string",
|
|
44
|
+
"max": 200
|
|
45
|
+
},
|
|
46
|
+
"pageName": {
|
|
47
|
+
"name": "页面名称",
|
|
48
|
+
"input": "string",
|
|
49
|
+
"max": 100
|
|
50
|
+
},
|
|
51
|
+
"detail": {
|
|
52
|
+
"name": "扩展详情",
|
|
53
|
+
"input": "string"
|
|
54
|
+
},
|
|
55
|
+
"userAgent": {
|
|
56
|
+
"name": "用户代理",
|
|
57
|
+
"input": "string",
|
|
58
|
+
"max": 500
|
|
59
|
+
},
|
|
60
|
+
"browserName": {
|
|
61
|
+
"name": "浏览器名称",
|
|
62
|
+
"input": "string",
|
|
63
|
+
"max": 100
|
|
64
|
+
},
|
|
65
|
+
"browserVersion": {
|
|
66
|
+
"name": "浏览器版本",
|
|
67
|
+
"input": "string",
|
|
68
|
+
"max": 100
|
|
69
|
+
},
|
|
70
|
+
"osName": {
|
|
71
|
+
"name": "操作系统名称",
|
|
72
|
+
"input": "string",
|
|
73
|
+
"max": 100
|
|
74
|
+
},
|
|
75
|
+
"osVersion": {
|
|
76
|
+
"name": "操作系统版本",
|
|
77
|
+
"input": "string",
|
|
78
|
+
"max": 100
|
|
79
|
+
},
|
|
80
|
+
"deviceType": {
|
|
81
|
+
"name": "设备类型",
|
|
82
|
+
"input": "string",
|
|
83
|
+
"max": 50
|
|
84
|
+
},
|
|
85
|
+
"deviceVendor": {
|
|
86
|
+
"name": "设备厂商",
|
|
87
|
+
"input": "string",
|
|
88
|
+
"max": 100
|
|
89
|
+
},
|
|
90
|
+
"deviceModel": {
|
|
91
|
+
"name": "设备型号",
|
|
92
|
+
"input": "string",
|
|
93
|
+
"max": 100
|
|
94
|
+
},
|
|
95
|
+
"engineName": {
|
|
96
|
+
"name": "引擎名称",
|
|
97
|
+
"input": "string",
|
|
98
|
+
"max": 100
|
|
99
|
+
},
|
|
100
|
+
"cpuArchitecture": {
|
|
101
|
+
"name": "CPU架构",
|
|
102
|
+
"input": "string",
|
|
103
|
+
"max": 100
|
|
104
|
+
},
|
|
105
|
+
"state": {
|
|
106
|
+
"name": "状态",
|
|
107
|
+
"input": "integer",
|
|
108
|
+
"min": 0,
|
|
109
|
+
"max": 2
|
|
110
|
+
},
|
|
111
|
+
"createdAt": {
|
|
112
|
+
"name": "创建时间",
|
|
113
|
+
"input": "number"
|
|
114
|
+
},
|
|
115
|
+
"updatedAt": {
|
|
116
|
+
"name": "更新时间",
|
|
117
|
+
"input": "number"
|
|
118
|
+
},
|
|
119
|
+
"deletedAt": {
|
|
120
|
+
"name": "删除时间",
|
|
121
|
+
"input": "number"
|
|
122
|
+
}
|
|
123
|
+
}
|
package/tables/loginLog.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"id": {
|
|
3
|
+
"name": "ID",
|
|
4
|
+
"input": "integer",
|
|
5
|
+
"min": 1,
|
|
6
|
+
"max": null
|
|
7
|
+
},
|
|
2
8
|
"adminId": {
|
|
3
9
|
"name": "管理员ID",
|
|
4
10
|
"input": "number"
|
|
@@ -82,5 +88,23 @@
|
|
|
82
88
|
"name": "失败原因",
|
|
83
89
|
"input": "string",
|
|
84
90
|
"max": 200
|
|
91
|
+
},
|
|
92
|
+
"state": {
|
|
93
|
+
"name": "状态",
|
|
94
|
+
"input": "integer",
|
|
95
|
+
"min": 0,
|
|
96
|
+
"max": 2
|
|
97
|
+
},
|
|
98
|
+
"createdAt": {
|
|
99
|
+
"name": "创建时间",
|
|
100
|
+
"input": "number"
|
|
101
|
+
},
|
|
102
|
+
"updatedAt": {
|
|
103
|
+
"name": "更新时间",
|
|
104
|
+
"input": "number"
|
|
105
|
+
},
|
|
106
|
+
"deletedAt": {
|
|
107
|
+
"name": "删除时间",
|
|
108
|
+
"input": "number"
|
|
85
109
|
}
|
|
86
110
|
}
|
package/tables/menu.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"id": {
|
|
3
|
+
"name": "ID",
|
|
4
|
+
"input": "integer",
|
|
5
|
+
"min": 1,
|
|
6
|
+
"max": null
|
|
7
|
+
},
|
|
2
8
|
"name": {
|
|
3
9
|
"name": "菜单名称",
|
|
4
10
|
"input": "string",
|
|
@@ -20,5 +26,23 @@
|
|
|
20
26
|
"name": "父级路径",
|
|
21
27
|
"input": "string",
|
|
22
28
|
"max": 200
|
|
29
|
+
},
|
|
30
|
+
"state": {
|
|
31
|
+
"name": "状态",
|
|
32
|
+
"input": "integer",
|
|
33
|
+
"min": 0,
|
|
34
|
+
"max": 2
|
|
35
|
+
},
|
|
36
|
+
"createdAt": {
|
|
37
|
+
"name": "创建时间",
|
|
38
|
+
"input": "number"
|
|
39
|
+
},
|
|
40
|
+
"updatedAt": {
|
|
41
|
+
"name": "更新时间",
|
|
42
|
+
"input": "number"
|
|
43
|
+
},
|
|
44
|
+
"deletedAt": {
|
|
45
|
+
"name": "删除时间",
|
|
46
|
+
"input": "number"
|
|
23
47
|
}
|
|
24
48
|
}
|
package/tables/operateLog.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"id": {
|
|
3
|
+
"name": "ID",
|
|
4
|
+
"input": "integer",
|
|
5
|
+
"min": 1,
|
|
6
|
+
"max": null
|
|
7
|
+
},
|
|
2
8
|
"adminId": {
|
|
3
9
|
"name": "管理员ID",
|
|
4
10
|
"input": "number"
|
|
@@ -64,5 +70,23 @@
|
|
|
64
70
|
"name": "备注",
|
|
65
71
|
"input": "string",
|
|
66
72
|
"max": 500
|
|
73
|
+
},
|
|
74
|
+
"state": {
|
|
75
|
+
"name": "状态",
|
|
76
|
+
"input": "integer",
|
|
77
|
+
"min": 0,
|
|
78
|
+
"max": 2
|
|
79
|
+
},
|
|
80
|
+
"createdAt": {
|
|
81
|
+
"name": "创建时间",
|
|
82
|
+
"input": "number"
|
|
83
|
+
},
|
|
84
|
+
"updatedAt": {
|
|
85
|
+
"name": "更新时间",
|
|
86
|
+
"input": "number"
|
|
87
|
+
},
|
|
88
|
+
"deletedAt": {
|
|
89
|
+
"name": "删除时间",
|
|
90
|
+
"input": "number"
|
|
67
91
|
}
|
|
68
92
|
}
|
package/tables/role.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"id": {
|
|
3
|
+
"name": "ID",
|
|
4
|
+
"input": "integer",
|
|
5
|
+
"min": 1,
|
|
6
|
+
"max": null
|
|
7
|
+
},
|
|
2
8
|
"name": {
|
|
3
9
|
"name": "角色名称",
|
|
4
10
|
"input": "string",
|
|
@@ -29,5 +35,23 @@
|
|
|
29
35
|
"name": "排序",
|
|
30
36
|
"input": "number",
|
|
31
37
|
"max": 9999
|
|
38
|
+
},
|
|
39
|
+
"state": {
|
|
40
|
+
"name": "状态",
|
|
41
|
+
"input": "integer",
|
|
42
|
+
"min": 0,
|
|
43
|
+
"max": 2
|
|
44
|
+
},
|
|
45
|
+
"createdAt": {
|
|
46
|
+
"name": "创建时间",
|
|
47
|
+
"input": "number"
|
|
48
|
+
},
|
|
49
|
+
"updatedAt": {
|
|
50
|
+
"name": "更新时间",
|
|
51
|
+
"input": "number"
|
|
52
|
+
},
|
|
53
|
+
"deletedAt": {
|
|
54
|
+
"name": "删除时间",
|
|
55
|
+
"input": "number"
|
|
32
56
|
}
|
|
33
57
|
}
|
package/tables/sysConfig.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"id": {
|
|
3
|
+
"name": "ID",
|
|
4
|
+
"input": "integer",
|
|
5
|
+
"min": 1,
|
|
6
|
+
"max": null
|
|
7
|
+
},
|
|
2
8
|
"name": {
|
|
3
9
|
"name": "配置名称",
|
|
4
10
|
"min": 2,
|
|
@@ -41,5 +47,23 @@
|
|
|
41
47
|
"name": "描述说明",
|
|
42
48
|
"input": "string",
|
|
43
49
|
"max": 500
|
|
50
|
+
},
|
|
51
|
+
"state": {
|
|
52
|
+
"name": "状态",
|
|
53
|
+
"input": "integer",
|
|
54
|
+
"min": 0,
|
|
55
|
+
"max": 2
|
|
56
|
+
},
|
|
57
|
+
"createdAt": {
|
|
58
|
+
"name": "创建时间",
|
|
59
|
+
"input": "number"
|
|
60
|
+
},
|
|
61
|
+
"updatedAt": {
|
|
62
|
+
"name": "更新时间",
|
|
63
|
+
"input": "number"
|
|
64
|
+
},
|
|
65
|
+
"deletedAt": {
|
|
66
|
+
"name": "删除时间",
|
|
67
|
+
"input": "number"
|
|
44
68
|
}
|
|
45
69
|
}
|
package/utils/loggerUtils.js
CHANGED
|
@@ -31,15 +31,10 @@ export function buildSensitiveKeyMatcher(options) {
|
|
|
31
31
|
return { exactSet: exactSet, contains: contains };
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function truncateString(value, maxLen) {
|
|
35
|
-
if (value.length <= maxLen) return value;
|
|
36
|
-
return value.slice(0, maxLen);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
34
|
function sanitizeErrorValue(err, options) {
|
|
40
35
|
const out = {
|
|
41
36
|
name: err.name || "Error",
|
|
42
|
-
message:
|
|
37
|
+
message: err.message || ""
|
|
43
38
|
};
|
|
44
39
|
const state = { nodes: 0 };
|
|
45
40
|
const visited = new WeakSet();
|
|
@@ -47,7 +42,7 @@ function sanitizeErrorValue(err, options) {
|
|
|
47
42
|
visited.add(err);
|
|
48
43
|
|
|
49
44
|
if (isString(err.stack)) {
|
|
50
|
-
out["stack"] =
|
|
45
|
+
out["stack"] = err.stack;
|
|
51
46
|
}
|
|
52
47
|
|
|
53
48
|
if (!isNullable(err.cause)) {
|
|
@@ -67,13 +62,13 @@ function sanitizeErrorValue(err, options) {
|
|
|
67
62
|
}
|
|
68
63
|
|
|
69
64
|
function safeToStringMasked(value, options, visited) {
|
|
70
|
-
if (isString(value)) return
|
|
65
|
+
if (isString(value)) return value;
|
|
71
66
|
|
|
72
67
|
if (value instanceof Error) {
|
|
73
68
|
try {
|
|
74
|
-
return
|
|
69
|
+
return JSON.stringify(sanitizeErrorValue(value, options));
|
|
75
70
|
} catch {
|
|
76
|
-
return
|
|
71
|
+
return `${value.name || "Error"}: ${value.message || ""}`;
|
|
77
72
|
}
|
|
78
73
|
}
|
|
79
74
|
|
|
@@ -100,10 +95,10 @@ function safeToStringMasked(value, options, visited) {
|
|
|
100
95
|
return v;
|
|
101
96
|
};
|
|
102
97
|
|
|
103
|
-
return
|
|
98
|
+
return JSON.stringify(value, replacer);
|
|
104
99
|
} catch {
|
|
105
100
|
try {
|
|
106
|
-
return
|
|
101
|
+
return String(value);
|
|
107
102
|
} catch {
|
|
108
103
|
return "[Unserializable]";
|
|
109
104
|
}
|
|
@@ -114,7 +109,7 @@ function sanitizeAny(value, options, state, depth, visited) {
|
|
|
114
109
|
if (isNullable(value)) return value;
|
|
115
110
|
|
|
116
111
|
if (isString(value)) {
|
|
117
|
-
return
|
|
112
|
+
return value;
|
|
118
113
|
}
|
|
119
114
|
|
|
120
115
|
if (isNumber(value) || isBoolean(value) || typeof value === "bigint") {
|
|
@@ -151,7 +146,7 @@ function sanitizeAny(value, options, state, depth, visited) {
|
|
|
151
146
|
const arr = value;
|
|
152
147
|
const out = [];
|
|
153
148
|
|
|
154
|
-
const limit = arr.length
|
|
149
|
+
const limit = arr.length;
|
|
155
150
|
for (let i = 0; i < limit; i++) {
|
|
156
151
|
out[i] = sanitizeAny(arr[i], options, state, depth + 1, visited);
|
|
157
152
|
}
|
package/utils/scanSources.js
CHANGED
|
@@ -15,16 +15,16 @@ export const scanSources = async () => {
|
|
|
15
15
|
const apis = [];
|
|
16
16
|
const plugins = [];
|
|
17
17
|
const hooks = [];
|
|
18
|
-
const tables =
|
|
18
|
+
const tables = {};
|
|
19
19
|
|
|
20
20
|
// 处理表格
|
|
21
21
|
const allCoreTables = await scanFiles(coreTableDir, "core", "table", "*.json");
|
|
22
22
|
for (const item of allCoreTables) {
|
|
23
|
-
tables.
|
|
23
|
+
tables[`befly${item.fileName.charAt(0).toUpperCase()}${item.fileName.slice(1)}`] = item.fieldsDef;
|
|
24
24
|
}
|
|
25
25
|
const allAppTables = await scanFiles(appTableDir, "app", "table", "*.json");
|
|
26
26
|
for (const item of allAppTables) {
|
|
27
|
-
tables.
|
|
27
|
+
tables[item.fileName] = item.fieldsDef;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// 处理插件
|
package/scripts/syncDb/query.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const SYNC_DB_COLUMNS_SQL = `
|
|
2
|
-
SELECT
|
|
3
|
-
c.TABLE_NAME AS tableName,
|
|
4
|
-
t.TABLE_COMMENT AS tableComment,
|
|
5
|
-
c.COLUMN_NAME AS columnName,
|
|
6
|
-
c.DATA_TYPE AS dataType,
|
|
7
|
-
c.COLUMN_TYPE AS columnType,
|
|
8
|
-
c.CHARACTER_MAXIMUM_LENGTH AS charLength,
|
|
9
|
-
c.COLUMN_COMMENT AS columnComment,
|
|
10
|
-
c.ORDINAL_POSITION AS ordinalPosition
|
|
11
|
-
FROM information_schema.COLUMNS AS c
|
|
12
|
-
LEFT JOIN information_schema.TABLES AS t
|
|
13
|
-
ON t.TABLE_SCHEMA = c.TABLE_SCHEMA
|
|
14
|
-
AND t.TABLE_NAME = c.TABLE_NAME
|
|
15
|
-
WHERE c.TABLE_SCHEMA = DATABASE()
|
|
16
|
-
ORDER BY c.TABLE_NAME ASC, c.ORDINAL_POSITION ASC
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
export async function querySyncDbColumns(mysql) {
|
|
20
|
-
const queryRes = await mysql.execute(SYNC_DB_COLUMNS_SQL);
|
|
21
|
-
if (!Array.isArray(queryRes.data)) {
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return queryRes.data;
|
|
26
|
-
}
|