@paralect/hive 0.1.44-beta.4 → 0.1.45
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paralect/hive",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@koa/cors": "3.1.0",
|
|
14
14
|
"@koa/multer": "3.0.0",
|
|
15
15
|
"@koa/router": "10.1.1",
|
|
16
|
-
"@paralect/hive": "
|
|
16
|
+
"@paralect/hive": "0.1.44-beta.4",
|
|
17
17
|
"@paralect/node-mongo": "2.1.1",
|
|
18
18
|
"@react-email/components": "^0.0.20",
|
|
19
19
|
"@react-email/render": "^0.0.16",
|
|
@@ -18,6 +18,10 @@ const logRequestToMongo = async (ctx, next) => {
|
|
|
18
18
|
const startedOn = new Date();
|
|
19
19
|
|
|
20
20
|
const saveLog = async ({ error = null } = {}) => {
|
|
21
|
+
if (ctx.state.isSkipLog) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
if (ctx.state.resourceName && ctx.state.endpoint) {
|
|
22
26
|
const requestLog = {
|
|
23
27
|
isSuccess: true,
|
|
@@ -50,7 +54,9 @@ const logRequestToMongo = async (ctx, next) => {
|
|
|
50
54
|
|
|
51
55
|
try {
|
|
52
56
|
await next();
|
|
57
|
+
|
|
53
58
|
await saveLog({ error: ctx.state.error });
|
|
59
|
+
|
|
54
60
|
} catch (err) {
|
|
55
61
|
await saveLog({ error: err });
|
|
56
62
|
throw err;
|
|
@@ -92,7 +98,7 @@ export default async (app) => {
|
|
|
92
98
|
}
|
|
93
99
|
return -1;
|
|
94
100
|
}));
|
|
95
|
-
|
|
101
|
+
|
|
96
102
|
endpoints.forEach(({ endpoint, requestSchema, middlewares = [], handler }) => {
|
|
97
103
|
let targetRouter;
|
|
98
104
|
console.log('[routes] Register endpoint', resourceName, endpoint?.method || 'GET', endpoint?.url);
|