@abtnode/core 1.17.2-beta-20251113-233643-ab2254af → 1.17.2-beta-20251114-122922-4319f1ac
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
CHANGED
|
@@ -20,6 +20,7 @@ const {
|
|
|
20
20
|
SESSION_TTL,
|
|
21
21
|
EVENTS,
|
|
22
22
|
NOTIFICATION_SEND_CHANNEL,
|
|
23
|
+
USER_SESSION_STATUS,
|
|
23
24
|
} = require('@abtnode/constant');
|
|
24
25
|
const { isValid: isValidDid } = require('@arcblock/did');
|
|
25
26
|
const { BlockletEvents, TeamEvents, BlockletInternalEvents } = require('@blocklet/constant');
|
|
@@ -179,29 +180,29 @@ const validatePassportDisplay = async (role, display) => {
|
|
|
179
180
|
const getUserSessionWhere = ({ status, blocklet }) => {
|
|
180
181
|
const now = Date.now();
|
|
181
182
|
const sessionTtl = blocklet.settings?.session?.ttl || SESSION_TTL;
|
|
182
|
-
if (status ===
|
|
183
|
+
if (status === USER_SESSION_STATUS.ONLINE) {
|
|
183
184
|
return {
|
|
184
185
|
updatedAt: {
|
|
185
186
|
[Op.gt]: new Date(now - sessionTtl * 1000),
|
|
186
187
|
},
|
|
187
188
|
status: {
|
|
188
|
-
[Op.ne]:
|
|
189
|
+
[Op.ne]: USER_SESSION_STATUS.OFFLINE,
|
|
189
190
|
},
|
|
190
191
|
};
|
|
191
192
|
}
|
|
192
|
-
if (status ===
|
|
193
|
+
if (status === USER_SESSION_STATUS.EXPIRED) {
|
|
193
194
|
return {
|
|
194
195
|
updatedAt: {
|
|
195
196
|
[Op.lt]: new Date(now - sessionTtl * 1000),
|
|
196
197
|
},
|
|
197
198
|
status: {
|
|
198
|
-
[Op.ne]:
|
|
199
|
+
[Op.ne]: USER_SESSION_STATUS.OFFLINE,
|
|
199
200
|
},
|
|
200
201
|
};
|
|
201
202
|
}
|
|
202
|
-
if (status ===
|
|
203
|
+
if (status === USER_SESSION_STATUS.OFFLINE) {
|
|
203
204
|
return {
|
|
204
|
-
status:
|
|
205
|
+
status: USER_SESSION_STATUS.OFFLINE,
|
|
205
206
|
};
|
|
206
207
|
}
|
|
207
208
|
return {};
|
|
@@ -2264,7 +2265,7 @@ class TeamAPI extends EventEmitter {
|
|
|
2264
2265
|
const userState = await this.getUserState(teamDid);
|
|
2265
2266
|
|
|
2266
2267
|
const where = {
|
|
2267
|
-
status:
|
|
2268
|
+
status: USER_SESSION_STATUS.ONLINE,
|
|
2268
2269
|
id,
|
|
2269
2270
|
};
|
|
2270
2271
|
const include = [];
|
|
@@ -2303,7 +2304,7 @@ class TeamAPI extends EventEmitter {
|
|
|
2303
2304
|
],
|
|
2304
2305
|
include,
|
|
2305
2306
|
});
|
|
2306
|
-
return userSession
|
|
2307
|
+
return userSession?.toJSON?.();
|
|
2307
2308
|
}
|
|
2308
2309
|
|
|
2309
2310
|
// query, paging: inputPaging, sort
|
|
@@ -2321,7 +2322,7 @@ class TeamAPI extends EventEmitter {
|
|
|
2321
2322
|
};
|
|
2322
2323
|
}
|
|
2323
2324
|
|
|
2324
|
-
const { userDid, visitorId, appPid, includeUser = false, status =
|
|
2325
|
+
const { userDid, visitorId, appPid, includeUser = false, status = USER_SESSION_STATUS.ONLINE } = query;
|
|
2325
2326
|
const state = await this.getUserSessionState(teamDid);
|
|
2326
2327
|
const userState = await this.getUserState(teamDid);
|
|
2327
2328
|
const where = {};
|
|
@@ -2387,7 +2388,7 @@ class TeamAPI extends EventEmitter {
|
|
|
2387
2388
|
count: 0,
|
|
2388
2389
|
};
|
|
2389
2390
|
}
|
|
2390
|
-
const { userDid, visitorId, appPid, status =
|
|
2391
|
+
const { userDid, visitorId, appPid, status = USER_SESSION_STATUS.ONLINE } = query;
|
|
2391
2392
|
const state = await this.getUserSessionState(teamDid);
|
|
2392
2393
|
const where = {};
|
|
2393
2394
|
if (userDid) where.userDid = userDid;
|
|
@@ -2670,7 +2671,7 @@ class TeamAPI extends EventEmitter {
|
|
|
2670
2671
|
if (remove) {
|
|
2671
2672
|
result = await userSessionState.remove(where);
|
|
2672
2673
|
} else {
|
|
2673
|
-
result = await userSessionState.update(where, { $set: { status:
|
|
2674
|
+
result = await userSessionState.update(where, { $set: { status: USER_SESSION_STATUS.OFFLINE } });
|
|
2674
2675
|
}
|
|
2675
2676
|
const { permanentWallet } = getBlockletInfo(blocklet, nodeInfo.sk);
|
|
2676
2677
|
const masterSite = getFederatedMaster(blocklet);
|
|
@@ -2090,7 +2090,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
2090
2090
|
if (shouldSendWalletNotification) {
|
|
2091
2091
|
// notify launcher config changed
|
|
2092
2092
|
launcher.notifyBlockletUpdated(blocklet);
|
|
2093
|
-
if (shouldSyncFederated(
|
|
2093
|
+
if (shouldSyncFederated(blocklet)) {
|
|
2094
2094
|
try {
|
|
2095
2095
|
// 通知站点群更新信息
|
|
2096
2096
|
this.syncFederatedConfig({ did });
|
|
@@ -6032,7 +6032,7 @@ class FederatedBlockletManager extends DiskBlockletManager {
|
|
|
6032
6032
|
const blocklet = await this.getBlocklet(teamDid);
|
|
6033
6033
|
|
|
6034
6034
|
const masterSite = getFederatedMaster(blocklet);
|
|
6035
|
-
if (shouldSyncFederated(
|
|
6035
|
+
if (shouldSyncFederated(blocklet, sourceAppPid)) {
|
|
6036
6036
|
const data = pick(updated, USER_PROFILE_SYNC_FIELDS);
|
|
6037
6037
|
if (data.avatar) {
|
|
6038
6038
|
data.avatar = getUserAvatarUrl(data.avatar, blocklet);
|
|
@@ -441,6 +441,13 @@ const EVENT_BUS_EVENT = 'event-bus';
|
|
|
441
441
|
|
|
442
442
|
const NAVIGATION_I18N_FIELDS = Object.freeze(['title', 'description', 'link']);
|
|
443
443
|
|
|
444
|
+
// NOTICE: keep sync with @blocklet/constant
|
|
445
|
+
const USER_SESSION_STATUS = {
|
|
446
|
+
ONLINE: 'online',
|
|
447
|
+
OFFLINE: 'offline',
|
|
448
|
+
EXPIRED: 'expired',
|
|
449
|
+
};
|
|
450
|
+
|
|
444
451
|
module.exports = Object.freeze({
|
|
445
452
|
// Blocklet Server
|
|
446
453
|
NODE_MODES: Object.freeze({
|
|
@@ -933,6 +940,7 @@ module.exports = Object.freeze({
|
|
|
933
940
|
'isMaster',
|
|
934
941
|
'status',
|
|
935
942
|
],
|
|
943
|
+
USER_SESSION_STATUS,
|
|
936
944
|
});
|
|
937
945
|
|
|
938
946
|
|
|
@@ -39024,7 +39032,7 @@ module.exports = require("zlib");
|
|
|
39024
39032
|
/***/ ((module) => {
|
|
39025
39033
|
|
|
39026
39034
|
"use strict";
|
|
39027
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.17.1","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.17.1","@abtnode/auth":"1.17.1","@abtnode/certificate-manager":"1.17.1","@abtnode/constant":"1.17.1","@abtnode/cron":"1.17.1","@abtnode/db-cache":"1.17.1","@abtnode/docker-utils":"1.17.1","@abtnode/logger":"1.17.1","@abtnode/models":"1.17.1","@abtnode/queue":"1.17.1","@abtnode/rbac":"1.17.1","@abtnode/router-provider":"1.17.1","@abtnode/static-server":"1.17.1","@abtnode/timemachine":"1.17.1","@abtnode/util":"1.17.1","@aigne/aigne-hub":"^0.10.
|
|
39035
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.17.1","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.17.1","@abtnode/auth":"1.17.1","@abtnode/certificate-manager":"1.17.1","@abtnode/constant":"1.17.1","@abtnode/cron":"1.17.1","@abtnode/db-cache":"1.17.1","@abtnode/docker-utils":"1.17.1","@abtnode/logger":"1.17.1","@abtnode/models":"1.17.1","@abtnode/queue":"1.17.1","@abtnode/rbac":"1.17.1","@abtnode/router-provider":"1.17.1","@abtnode/static-server":"1.17.1","@abtnode/timemachine":"1.17.1","@abtnode/util":"1.17.1","@aigne/aigne-hub":"^0.10.6","@arcblock/did":"^1.27.6","@arcblock/did-connect-js":"^1.27.6","@arcblock/did-ext":"^1.27.6","@arcblock/did-motif":"^1.1.14","@arcblock/did-util":"^1.27.6","@arcblock/event-hub":"^1.27.6","@arcblock/jwt":"^1.27.6","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"^1.27.6","@arcblock/vc":"^1.27.6","@blocklet/constant":"1.17.1","@blocklet/did-space-js":"^1.2.3","@blocklet/env":"1.17.1","@blocklet/error":"^0.3.2","@blocklet/meta":"1.17.1","@blocklet/resolver":"1.17.1","@blocklet/sdk":"1.17.1","@blocklet/server-js":"1.17.1","@blocklet/store":"1.17.1","@blocklet/theme":"^3.2.5","@fidm/x509":"^1.2.1","@ocap/mcrypto":"^1.27.6","@ocap/util":"^1.27.6","@ocap/wallet":"^1.27.6","@slack/webhook":"^7.0.6","archiver":"^7.0.1","axios":"^1.7.9","axon":"^2.0.3","chalk":"^4.1.2","cross-spawn":"^7.0.3","dayjs":"^1.11.13","deep-diff":"^1.0.2","detect-port":"^1.5.1","envfile":"^7.1.0","escape-string-regexp":"^4.0.0","fast-glob":"^3.3.2","filesize":"^10.1.1","flat":"^5.0.2","fs-extra":"^11.2.0","get-port":"^5.1.1","hasha":"^5.2.2","is-base64":"^1.1.0","is-cidr":"4","is-ip":"3","is-url":"^1.2.4","joi":"17.12.2","joi-extension-semver":"^5.0.0","js-yaml":"^4.1.0","kill-port":"^2.0.1","lodash":"^4.17.21","node-stream-zip":"^1.15.0","p-all":"^3.0.0","p-limit":"^3.1.0","p-map":"^4.0.0","p-retry":"^4.6.2","p-wait-for":"^3.2.0","private-ip":"^2.3.4","rate-limiter-flexible":"^5.0.5","read-last-lines":"^1.8.0","semver":"^7.6.3","sequelize":"^6.35.0","shelljs":"^0.8.5","slugify":"^1.6.6","ssri":"^8.0.1","stream-throttle":"^0.1.3","stream-to-promise":"^3.0.0","systeminformation":"^5.23.3","tail":"^2.2.4","tar":"^6.1.11","transliteration":"^2.3.5","ua-parser-js":"^1.0.2","ufo":"^1.5.3","uuid":"^11.1.0","valid-url":"^1.0.9","which":"^2.0.2","xbytes":"^1.8.0"},"devDependencies":{"axios-mock-adapter":"^2.1.0","expand-tilde":"^2.0.2","express":"^4.18.2","unzipper":"^0.10.11"},"gitHead":"e5764f753181ed6a7c615cd4fc6682aacf0cb7cd"}');
|
|
39028
39036
|
|
|
39029
39037
|
/***/ }),
|
|
39030
39038
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.17.2-beta-
|
|
6
|
+
"version": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -17,46 +17,46 @@
|
|
|
17
17
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@abtnode/analytics": "1.17.2-beta-
|
|
21
|
-
"@abtnode/auth": "1.17.2-beta-
|
|
22
|
-
"@abtnode/certificate-manager": "1.17.2-beta-
|
|
23
|
-
"@abtnode/constant": "1.17.2-beta-
|
|
24
|
-
"@abtnode/cron": "1.17.2-beta-
|
|
25
|
-
"@abtnode/db-cache": "1.17.2-beta-
|
|
26
|
-
"@abtnode/docker-utils": "1.17.2-beta-
|
|
27
|
-
"@abtnode/logger": "1.17.2-beta-
|
|
28
|
-
"@abtnode/models": "1.17.2-beta-
|
|
29
|
-
"@abtnode/queue": "1.17.2-beta-
|
|
30
|
-
"@abtnode/rbac": "1.17.2-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.17.2-beta-
|
|
32
|
-
"@abtnode/static-server": "1.17.2-beta-
|
|
33
|
-
"@abtnode/timemachine": "1.17.2-beta-
|
|
34
|
-
"@abtnode/util": "1.17.2-beta-
|
|
35
|
-
"@aigne/aigne-hub": "^0.10.
|
|
36
|
-
"@arcblock/did": "^1.27.
|
|
37
|
-
"@arcblock/did-connect-js": "^1.27.
|
|
38
|
-
"@arcblock/did-ext": "^1.27.
|
|
20
|
+
"@abtnode/analytics": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
21
|
+
"@abtnode/auth": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
22
|
+
"@abtnode/certificate-manager": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
23
|
+
"@abtnode/constant": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
24
|
+
"@abtnode/cron": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
25
|
+
"@abtnode/db-cache": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
26
|
+
"@abtnode/docker-utils": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
27
|
+
"@abtnode/logger": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
28
|
+
"@abtnode/models": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
29
|
+
"@abtnode/queue": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
30
|
+
"@abtnode/rbac": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
31
|
+
"@abtnode/router-provider": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
32
|
+
"@abtnode/static-server": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
33
|
+
"@abtnode/timemachine": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
34
|
+
"@abtnode/util": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
35
|
+
"@aigne/aigne-hub": "^0.10.6",
|
|
36
|
+
"@arcblock/did": "^1.27.6",
|
|
37
|
+
"@arcblock/did-connect-js": "^1.27.6",
|
|
38
|
+
"@arcblock/did-ext": "^1.27.6",
|
|
39
39
|
"@arcblock/did-motif": "^1.1.14",
|
|
40
|
-
"@arcblock/did-util": "^1.27.
|
|
41
|
-
"@arcblock/event-hub": "^1.27.
|
|
42
|
-
"@arcblock/jwt": "^1.27.
|
|
40
|
+
"@arcblock/did-util": "^1.27.6",
|
|
41
|
+
"@arcblock/event-hub": "^1.27.6",
|
|
42
|
+
"@arcblock/jwt": "^1.27.6",
|
|
43
43
|
"@arcblock/pm2-events": "^0.0.5",
|
|
44
|
-
"@arcblock/validator": "^1.27.
|
|
45
|
-
"@arcblock/vc": "^1.27.
|
|
46
|
-
"@blocklet/constant": "1.17.2-beta-
|
|
47
|
-
"@blocklet/did-space-js": "^1.2.
|
|
48
|
-
"@blocklet/env": "1.17.2-beta-
|
|
44
|
+
"@arcblock/validator": "^1.27.6",
|
|
45
|
+
"@arcblock/vc": "^1.27.6",
|
|
46
|
+
"@blocklet/constant": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
47
|
+
"@blocklet/did-space-js": "^1.2.3",
|
|
48
|
+
"@blocklet/env": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
49
49
|
"@blocklet/error": "^0.3.2",
|
|
50
|
-
"@blocklet/meta": "1.17.2-beta-
|
|
51
|
-
"@blocklet/resolver": "1.17.2-beta-
|
|
52
|
-
"@blocklet/sdk": "1.17.2-beta-
|
|
53
|
-
"@blocklet/server-js": "1.17.2-beta-
|
|
54
|
-
"@blocklet/store": "1.17.2-beta-
|
|
55
|
-
"@blocklet/theme": "^3.2.
|
|
50
|
+
"@blocklet/meta": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
51
|
+
"@blocklet/resolver": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
52
|
+
"@blocklet/sdk": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
53
|
+
"@blocklet/server-js": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
54
|
+
"@blocklet/store": "1.17.2-beta-20251114-122922-4319f1ac",
|
|
55
|
+
"@blocklet/theme": "^3.2.5",
|
|
56
56
|
"@fidm/x509": "^1.2.1",
|
|
57
|
-
"@ocap/mcrypto": "^1.27.
|
|
58
|
-
"@ocap/util": "^1.27.
|
|
59
|
-
"@ocap/wallet": "^1.27.
|
|
57
|
+
"@ocap/mcrypto": "^1.27.6",
|
|
58
|
+
"@ocap/util": "^1.27.6",
|
|
59
|
+
"@ocap/wallet": "^1.27.6",
|
|
60
60
|
"@slack/webhook": "^7.0.6",
|
|
61
61
|
"archiver": "^7.0.1",
|
|
62
62
|
"axios": "^1.7.9",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"express": "^4.18.2",
|
|
117
117
|
"unzipper": "^0.10.11"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "eb484ccabce50c438b8eec1be3738da18cd28f75"
|
|
120
120
|
}
|