@abtnode/core 1.16.25-beta-e3dbef52 → 1.16.25-beta-44800645
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/api/team.js +12 -2
- package/lib/states/audit-log.js +1 -0
- package/lib/states/user.js +13 -3
- package/lib/validators/router.js +5 -1
- package/package.json +21 -21
package/lib/api/team.js
CHANGED
|
@@ -233,6 +233,14 @@ class TeamAPI extends EventEmitter {
|
|
|
233
233
|
|
|
234
234
|
async getUsers({ teamDid, query, paging: inputPaging, sort, dids }) {
|
|
235
235
|
const state = await this.getUserState(teamDid);
|
|
236
|
+
const nodeInfo = await this.node.read();
|
|
237
|
+
|
|
238
|
+
// HACK: 如果查询的是 server 的数据库,则不应该查询 userSession 表
|
|
239
|
+
if (teamDid === nodeInfo.did) {
|
|
240
|
+
if (query) {
|
|
241
|
+
delete query.includeUserSessions;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
236
244
|
|
|
237
245
|
if (inputPaging?.pageSize > MAX_USER_PAGE_SIZE) {
|
|
238
246
|
throw new Error(`Length of users should not exceed ${MAX_USER_PAGE_SIZE} per page`);
|
|
@@ -260,6 +268,7 @@ class TeamAPI extends EventEmitter {
|
|
|
260
268
|
}
|
|
261
269
|
|
|
262
270
|
return {
|
|
271
|
+
// FIXME: @zhanghan 这里做字段过滤的目的是?gql 本身已经对字段做了过滤了
|
|
263
272
|
users: list.map(
|
|
264
273
|
(d) =>
|
|
265
274
|
pick(d, [
|
|
@@ -279,6 +288,7 @@ class TeamAPI extends EventEmitter {
|
|
|
279
288
|
'avatar',
|
|
280
289
|
'locale',
|
|
281
290
|
'tags',
|
|
291
|
+
'userSessions',
|
|
282
292
|
// oauth relate fields
|
|
283
293
|
'sourceProvider',
|
|
284
294
|
'sourceAppPid',
|
|
@@ -1393,7 +1403,7 @@ class TeamAPI extends EventEmitter {
|
|
|
1393
1403
|
|
|
1394
1404
|
const userSessions = await state.model.findAll({
|
|
1395
1405
|
where,
|
|
1396
|
-
attributes: ['id', 'appPid', 'userDid', 'visitorId', 'passportId', 'updatedAt', 'extra'],
|
|
1406
|
+
attributes: ['id', 'appPid', 'userDid', 'visitorId', 'passportId', 'updatedAt', 'extra', 'ua', 'lastLoginIp'],
|
|
1397
1407
|
include: {
|
|
1398
1408
|
model: userState.model,
|
|
1399
1409
|
as: 'user',
|
|
@@ -1574,7 +1584,7 @@ class TeamAPI extends EventEmitter {
|
|
|
1574
1584
|
|
|
1575
1585
|
async logoutUser({ teamDid, userDid, visitorId, appPid }) {
|
|
1576
1586
|
const state = await this.getUserSessionState(teamDid);
|
|
1577
|
-
const data = await state.
|
|
1587
|
+
const data = await state.remove({ userDid, visitorId, appPid });
|
|
1578
1588
|
const nodeInfo = await this.node.read();
|
|
1579
1589
|
const blocklet = await getBlocklet({ did: teamDid, states: this.states, dataDirs: this.dataDirs });
|
|
1580
1590
|
const { permanentWallet } = getBlockletInfo(blocklet, nodeInfo.sk);
|
package/lib/states/audit-log.js
CHANGED
package/lib/states/user.js
CHANGED
|
@@ -188,7 +188,7 @@ class User extends ExtendBase {
|
|
|
188
188
|
// eslint-disable-next-line require-await
|
|
189
189
|
async getUsers({ query, sort, paging } = {}) {
|
|
190
190
|
const where = {};
|
|
191
|
-
const { approved, role, search, tags, includeTags, includePassports } = query || {};
|
|
191
|
+
const { approved, role, search, tags, includeTags, includePassports, includeUserSessions } = query || {};
|
|
192
192
|
const shouldIncludeTag = (tags && tags.length) || includeTags;
|
|
193
193
|
|
|
194
194
|
if (isNullOrUndefined(approved) === false) {
|
|
@@ -236,8 +236,18 @@ class User extends ExtendBase {
|
|
|
236
236
|
as: 'passports',
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
if (includeUserSessions) {
|
|
240
|
+
include.push({
|
|
241
|
+
model: this.models.UserSession,
|
|
242
|
+
as: 'userSessions',
|
|
243
|
+
where: {
|
|
244
|
+
status: 'online',
|
|
245
|
+
},
|
|
246
|
+
required: false,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
const result = await this.paginate({ where, include }, sorting, paging);
|
|
250
|
+
return result;
|
|
241
251
|
}
|
|
242
252
|
|
|
243
253
|
// eslint-disable-next-line require-await
|
package/lib/validators/router.js
CHANGED
|
@@ -71,7 +71,11 @@ const ruleSchema = {
|
|
|
71
71
|
interfaceName: Joi.string() // root interface
|
|
72
72
|
.label('interface name')
|
|
73
73
|
.when('type', { is: ROUTING_RULE_TYPES.BLOCKLET, then: Joi.required() }),
|
|
74
|
-
response: Joi.object({
|
|
74
|
+
response: Joi.object({
|
|
75
|
+
status: Joi.number().required(),
|
|
76
|
+
contentType: Joi.string(),
|
|
77
|
+
body: Joi.string().max(4096).required(),
|
|
78
|
+
})
|
|
75
79
|
.label('response')
|
|
76
80
|
.when('type', {
|
|
77
81
|
is: ROUTING_RULE_TYPES.DIRECT_RESPONSE,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.25-beta-
|
|
6
|
+
"version": "1.16.25-beta-44800645",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/analytics": "1.16.25-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.25-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.25-beta-
|
|
25
|
-
"@abtnode/constant": "1.16.25-beta-
|
|
26
|
-
"@abtnode/cron": "1.16.25-beta-
|
|
27
|
-
"@abtnode/logger": "1.16.25-beta-
|
|
28
|
-
"@abtnode/models": "1.16.25-beta-
|
|
29
|
-
"@abtnode/queue": "1.16.25-beta-
|
|
30
|
-
"@abtnode/rbac": "1.16.25-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.16.25-beta-
|
|
32
|
-
"@abtnode/static-server": "1.16.25-beta-
|
|
33
|
-
"@abtnode/timemachine": "1.16.25-beta-
|
|
34
|
-
"@abtnode/util": "1.16.25-beta-
|
|
22
|
+
"@abtnode/analytics": "1.16.25-beta-44800645",
|
|
23
|
+
"@abtnode/auth": "1.16.25-beta-44800645",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.25-beta-44800645",
|
|
25
|
+
"@abtnode/constant": "1.16.25-beta-44800645",
|
|
26
|
+
"@abtnode/cron": "1.16.25-beta-44800645",
|
|
27
|
+
"@abtnode/logger": "1.16.25-beta-44800645",
|
|
28
|
+
"@abtnode/models": "1.16.25-beta-44800645",
|
|
29
|
+
"@abtnode/queue": "1.16.25-beta-44800645",
|
|
30
|
+
"@abtnode/rbac": "1.16.25-beta-44800645",
|
|
31
|
+
"@abtnode/router-provider": "1.16.25-beta-44800645",
|
|
32
|
+
"@abtnode/static-server": "1.16.25-beta-44800645",
|
|
33
|
+
"@abtnode/timemachine": "1.16.25-beta-44800645",
|
|
34
|
+
"@abtnode/util": "1.16.25-beta-44800645",
|
|
35
35
|
"@arcblock/did": "1.18.113",
|
|
36
36
|
"@arcblock/did-auth": "1.18.113",
|
|
37
37
|
"@arcblock/did-ext": "^1.18.113",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"@arcblock/pm2-events": "^0.0.5",
|
|
43
43
|
"@arcblock/validator": "^1.18.113",
|
|
44
44
|
"@arcblock/vc": "1.18.113",
|
|
45
|
-
"@blocklet/constant": "1.16.25-beta-
|
|
46
|
-
"@blocklet/env": "1.16.25-beta-
|
|
47
|
-
"@blocklet/meta": "1.16.25-beta-
|
|
48
|
-
"@blocklet/resolver": "1.16.25-beta-
|
|
49
|
-
"@blocklet/sdk": "1.16.25-beta-
|
|
50
|
-
"@did-space/client": "^0.3.
|
|
45
|
+
"@blocklet/constant": "1.16.25-beta-44800645",
|
|
46
|
+
"@blocklet/env": "1.16.25-beta-44800645",
|
|
47
|
+
"@blocklet/meta": "1.16.25-beta-44800645",
|
|
48
|
+
"@blocklet/resolver": "1.16.25-beta-44800645",
|
|
49
|
+
"@blocklet/sdk": "1.16.25-beta-44800645",
|
|
50
|
+
"@did-space/client": "^0.3.69",
|
|
51
51
|
"@fidm/x509": "^1.2.1",
|
|
52
52
|
"@ocap/mcrypto": "1.18.113",
|
|
53
53
|
"@ocap/util": "1.18.113",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"jest": "^29.7.0",
|
|
103
103
|
"unzipper": "^0.10.11"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "1352ebbd41c052c8d369f95570e97b30ecb5f4f0"
|
|
106
106
|
}
|