@tachybase/plugin-api-logs 1.6.0 → 1.6.1
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 +5 -5
- package/dist/server/actions/apiLogsController.js +2 -2
- package/dist/server/hooks/afterCreate.js +1 -1
- package/dist/server/hooks/afterDestroy.js +2 -2
- package/dist/server/hooks/afterUpdate.js +1 -1
- package/dist/server/hooks/getFieldChange.js +2 -2
- package/package.json +7 -7
package/dist/externalVersion.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.6.
|
|
4
|
-
"@tachybase/schema": "1.
|
|
5
|
-
"@ant-design/icons": "
|
|
3
|
+
"@tachybase/client": "1.6.1",
|
|
4
|
+
"@tachybase/schema": "1.6.0-alpha.9",
|
|
5
|
+
"@ant-design/icons": "6.1.0",
|
|
6
6
|
"react-i18next": "16.2.1",
|
|
7
|
-
"@tego/server": "1.
|
|
8
|
-
"@tego/client": "1.
|
|
7
|
+
"@tego/server": "1.6.0-alpha.9",
|
|
8
|
+
"@tego/client": "1.6.0-alpha.9",
|
|
9
9
|
"antd": "5.22.5",
|
|
10
10
|
"lodash": "4.17.21"
|
|
11
11
|
};
|
|
@@ -99,8 +99,8 @@ class ApiLogsController {
|
|
|
99
99
|
}
|
|
100
100
|
try {
|
|
101
101
|
await apiLogsRepo.createMany({ records: collectionsToInsert, hooks: false });
|
|
102
|
-
const plugin = ctx.
|
|
103
|
-
await ((_b = plugin.apiFilter) == null ? void 0 : _b.load());
|
|
102
|
+
const plugin = ctx.tego.pm.get("api-logs");
|
|
103
|
+
await ((_b = plugin == null ? void 0 : plugin.apiFilter) == null ? void 0 : _b.load());
|
|
104
104
|
} catch (error) {
|
|
105
105
|
ctx.throw(((_e = (_d = (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.data) == null ? void 0 : _d.error) == null ? void 0 : _e.message) || "request error");
|
|
106
106
|
}
|
|
@@ -27,7 +27,7 @@ async function handleCreate(ctx, next) {
|
|
|
27
27
|
const currentTime = (/* @__PURE__ */ new Date()).toISOString();
|
|
28
28
|
const apilogsRepo = ctx.db.getRepository("apiLogs");
|
|
29
29
|
const currentUserId = (_a = ctx.auth) == null ? void 0 : _a.user.id;
|
|
30
|
-
const app = ctx.
|
|
30
|
+
const app = ctx.tego;
|
|
31
31
|
const collection = app.mainDataSource.collectionManager.getCollection(ctx.action.resourceName);
|
|
32
32
|
const currentRecordId = (_b = ctx.body) == null ? void 0 : _b[collection.filterTargetKey];
|
|
33
33
|
const changes = [];
|
|
@@ -40,7 +40,7 @@ async function handleGetInsertValues(ctx, tk, insertValues) {
|
|
|
40
40
|
const values = await getInsertValues(ctx, tk);
|
|
41
41
|
insertValues.push(values);
|
|
42
42
|
} catch (error) {
|
|
43
|
-
ctx.
|
|
43
|
+
ctx.tego.logger.error("handleDestroy error, getInsertValues: ", {
|
|
44
44
|
param: ctx.action.params,
|
|
45
45
|
error
|
|
46
46
|
});
|
|
@@ -51,7 +51,7 @@ async function getInsertValues(ctx, tk) {
|
|
|
51
51
|
const { actionName, resourceName, params } = ctx.action;
|
|
52
52
|
const apilogsRepo = ctx.db.getRepository("apiLogs");
|
|
53
53
|
const currentUserId = (_a = ctx.auth) == null ? void 0 : _a.user.id;
|
|
54
|
-
const app = ctx.
|
|
54
|
+
const app = ctx.tego;
|
|
55
55
|
const collection = app.mainDataSource.collectionManager.getCollection(ctx.action.resourceName);
|
|
56
56
|
const changes = [];
|
|
57
57
|
const { changed, data: dataBefore } = await (0, import_getFieldChange.getChanged)(ctx, tk);
|
|
@@ -27,7 +27,7 @@ async function handleUpdate(ctx, next) {
|
|
|
27
27
|
const currentTime = (/* @__PURE__ */ new Date()).toISOString();
|
|
28
28
|
const apilogsRepo = ctx.db.getRepository("apiLogs");
|
|
29
29
|
const currentUserId = (_a = ctx.auth) == null ? void 0 : _a.user.id;
|
|
30
|
-
const app = ctx.
|
|
30
|
+
const app = ctx.tego;
|
|
31
31
|
const collection = app.mainDataSource.collectionManager.getCollection(ctx.action.resourceName);
|
|
32
32
|
const changes = [];
|
|
33
33
|
const { changed, data: dataBefore } = await (0, import_getFieldChange.getChanged)(ctx, params.filterByTk);
|
|
@@ -106,7 +106,7 @@ async function getChanged(ctx, filterByTk) {
|
|
|
106
106
|
filterByTk = params.filterByTk;
|
|
107
107
|
}
|
|
108
108
|
const fieldsObj = {};
|
|
109
|
-
const app = ctx.
|
|
109
|
+
const app = ctx.tego;
|
|
110
110
|
const collection = app.mainDataSource.collectionManager.getCollection(ctx.action.resourceName);
|
|
111
111
|
const repo = ctx.db.getRepository(collection.name);
|
|
112
112
|
const fields = collection.getFields();
|
|
@@ -148,7 +148,7 @@ async function getChanged(ctx, filterByTk) {
|
|
|
148
148
|
changed
|
|
149
149
|
};
|
|
150
150
|
} catch (err) {
|
|
151
|
-
ctx.
|
|
151
|
+
ctx.logger.error(err);
|
|
152
152
|
return {
|
|
153
153
|
error: err.stack
|
|
154
154
|
};
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-api-logs",
|
|
3
3
|
"displayName": "Api Logs",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"description": "Provides seamless tracking of API actions through enhanced user interface components, configuration panels, and dashboards",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Logging and monitoring"
|
|
8
8
|
],
|
|
9
9
|
"main": "dist/server/index.js",
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@ant-design/icons": "^
|
|
12
|
-
"@tachybase/schema": "1.
|
|
13
|
-
"@tachybase/test": "1.
|
|
14
|
-
"@tego/client": "1.
|
|
15
|
-
"@tego/server": "1.
|
|
11
|
+
"@ant-design/icons": "^6.1.0",
|
|
12
|
+
"@tachybase/schema": "1.6.0-alpha.9",
|
|
13
|
+
"@tachybase/test": "1.6.0-alpha.9",
|
|
14
|
+
"@tego/client": "1.6.0-alpha.9",
|
|
15
|
+
"@tego/server": "1.6.0-alpha.9",
|
|
16
16
|
"antd": "5.22.5",
|
|
17
17
|
"lodash": "4.17.21",
|
|
18
18
|
"react-i18next": "16.2.1",
|
|
19
19
|
"react-router-dom": "6.28.1",
|
|
20
|
-
"@tachybase/client": "1.6.
|
|
20
|
+
"@tachybase/client": "1.6.1"
|
|
21
21
|
},
|
|
22
22
|
"description.zh-CN": "Api Logs通过增强的用户界面组件、配置面板和仪表板提供对 API 操作的无缝跟踪",
|
|
23
23
|
"displayName.zh-CN": "Api 日志"
|