@abtnode/util 1.16.8-beta-ca58a421 → 1.16.8-beta-0c0c5eb2
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/format-context.js +7 -4
- package/package.json +5 -5
package/lib/format-context.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
const omit = require('lodash/omit');
|
|
1
2
|
const get = require('lodash/get');
|
|
2
3
|
|
|
3
4
|
// Format context: https://github.com/graphql/express-graphql
|
|
4
5
|
module.exports = (ctx = {}) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// 不要更改入参的值,base case
|
|
7
|
+
// if (ctx && ctx.user) {
|
|
8
|
+
// delete ctx.user.avatar;
|
|
9
|
+
// }
|
|
10
|
+
const contextUser = omit(ctx?.user || {}, 'avatar');
|
|
8
11
|
|
|
9
12
|
const safeGet = (key, _default = '') =>
|
|
10
13
|
(typeof ctx.get === 'function' ? ctx.get(key) : get(ctx, `headers[${key}]`)) || _default;
|
|
@@ -13,7 +16,7 @@ module.exports = (ctx = {}) => {
|
|
|
13
16
|
ip: safeGet('x-real-ip', '127.0.0.1'),
|
|
14
17
|
ua: safeGet('user-agent'),
|
|
15
18
|
protocol: safeGet('x-real-protocol').replace(/:$/, '') || 'http',
|
|
16
|
-
user:
|
|
19
|
+
user: contextUser,
|
|
17
20
|
url: ctx.originalUrl,
|
|
18
21
|
query: ctx.query,
|
|
19
22
|
hostname: safeGet('x-real-hostname'),
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.8-beta-
|
|
6
|
+
"version": "1.16.8-beta-0c0c5eb2",
|
|
7
7
|
"description": "ArcBlock's JavaScript utility",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@abtnode/constant": "1.16.8-beta-
|
|
22
|
-
"@abtnode/logger": "1.16.8-beta-
|
|
23
|
-
"@blocklet/constant": "1.16.8-beta-
|
|
21
|
+
"@abtnode/constant": "1.16.8-beta-0c0c5eb2",
|
|
22
|
+
"@abtnode/logger": "1.16.8-beta-0c0c5eb2",
|
|
23
|
+
"@blocklet/constant": "1.16.8-beta-0c0c5eb2",
|
|
24
24
|
"@ocap/client": "1.18.78",
|
|
25
25
|
"@ocap/mcrypto": "1.18.78",
|
|
26
26
|
"@ocap/util": "1.18.78",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"jest": "^27.5.1",
|
|
72
72
|
"unzipper": "^0.10.11"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "0d8ec3154caf670770284dbdabc61a5f4e8b205f"
|
|
75
75
|
}
|