@qingfu/core-env 0.1.41 → 0.1.43
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/lib/helper.js +2 -2
- package/lib/utils.js +1 -1
- package/package.json +7 -7
package/lib/helper.js
CHANGED
|
@@ -3,14 +3,14 @@ const stream = require( 'stream' );
|
|
|
3
3
|
const WXEncrypt = require( 'wechat-encrypt' );
|
|
4
4
|
const helper = global.helper = module.exports = {};
|
|
5
5
|
|
|
6
|
-
helper.recordTime = ({ fields, threshold = ms( '
|
|
6
|
+
helper.recordTime = ({ fields, threshold = ms( '500ms' )} = {}) => {
|
|
7
7
|
return async ( ctx, next ) => {
|
|
8
8
|
let body = Object.assign({}, ctx.query, ctx.request.body );
|
|
9
9
|
let headerFields = [ 'select', 'sort', 'skip', 'limit', 'group', 'format', 'timezone' ];
|
|
10
10
|
let timeStart = Date.now();
|
|
11
11
|
await next();
|
|
12
12
|
let timeFinish = Date.now();
|
|
13
|
-
let _threshold = _.isFunction( threshold ) ? threshold( body ) : threshold;
|
|
13
|
+
let _threshold = _.isFunction( threshold ) ? threshold( body, ctx.body ) : threshold;
|
|
14
14
|
if ( timeFinish - timeStart > _threshold )
|
|
15
15
|
( global.logger || global.console ).error( 'recordTime', {
|
|
16
16
|
url: ctx.path, method: ctx.method,
|
package/lib/utils.js
CHANGED
|
@@ -196,7 +196,7 @@ utils.getBorn = identity => {
|
|
|
196
196
|
);
|
|
197
197
|
};
|
|
198
198
|
|
|
199
|
-
utils.getAge = ( identity, start )=> {
|
|
199
|
+
utils.getAge = ( identity, start ) => {
|
|
200
200
|
let born = utils.getBorn( identity );
|
|
201
201
|
start = new Date(( start ? new Date( start ) : new Date() ).setHours( 0, 0, 0, 0 ));
|
|
202
202
|
return born && start.getFullYear() - born.getFullYear() +
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qingfu/core-env",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.43",
|
|
4
4
|
"readmeFilename": "README.md",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@koa/cors": "4.0.0",
|
|
7
7
|
"@koa/router": "12.0.0",
|
|
8
|
-
"bull": "4.10.
|
|
8
|
+
"bull": "4.10.2",
|
|
9
9
|
"busboy": "1.6.0",
|
|
10
10
|
"cookie": "0.5.0",
|
|
11
11
|
"dotenv-extended": "2.9.0",
|
|
12
12
|
"glob": "8.0.3",
|
|
13
13
|
"ioredis": "4.28.5",
|
|
14
|
-
"jsonwebtoken": "
|
|
15
|
-
"koa": "2.
|
|
14
|
+
"jsonwebtoken": "9.0.0",
|
|
15
|
+
"koa": "2.14.1",
|
|
16
16
|
"koa-bodyparser": "4.3.0",
|
|
17
17
|
"koa-favicon": "2.1.0",
|
|
18
18
|
"koa-helmet": "6.1.0",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"koa-methodoverride": "2.0.0",
|
|
21
21
|
"koa-qs": "3.0.0",
|
|
22
22
|
"lodash": "4.17.21",
|
|
23
|
-
"moleculer": "0.14.
|
|
24
|
-
"mongoose": "6.
|
|
23
|
+
"moleculer": "0.14.27",
|
|
24
|
+
"mongoose": "6.8.1",
|
|
25
25
|
"mongoose-cast-aggregation": "0.3.1",
|
|
26
26
|
"mongoose-geojson-schema": "2.2.3",
|
|
27
27
|
"mongoose-lean-defaults": "2.2.1",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"primus": "8.0.6",
|
|
34
34
|
"primus-rooms": "3.4.3",
|
|
35
35
|
"qr-image": "3.2.0",
|
|
36
|
-
"superagent": "8.0.
|
|
36
|
+
"superagent": "8.0.6",
|
|
37
37
|
"wechat-encrypt": "1.1.1",
|
|
38
38
|
"winston": "3.8.2",
|
|
39
39
|
"winston-mongodb": "5.1.0",
|