@abtnode/core 1.16.54-beta-20251021-070951-25e3083c → 1.16.54-beta-20251024-030947-6f2889bf
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 +27 -4
- package/lib/blocklet/manager/disk.js +20 -90
- package/lib/blocklet/migration-dist/migration.cjs +1 -1
- package/lib/util/blocklet.js +4 -0
- package/package.json +36 -36
package/lib/api/team.js
CHANGED
|
@@ -37,6 +37,7 @@ const {
|
|
|
37
37
|
getFederatedMaster,
|
|
38
38
|
findFederatedSite,
|
|
39
39
|
getUserAvatarUrl: getFederatedUserAvatarUrl,
|
|
40
|
+
syncFederated,
|
|
40
41
|
} = require('@abtnode/auth/lib/util/federated');
|
|
41
42
|
const { hasActiveOwnerPassport } = require('@abtnode/util/lib/passport');
|
|
42
43
|
const { getBlockletInfo } = require('@blocklet/meta/lib/info');
|
|
@@ -919,15 +920,15 @@ class TeamAPI extends EventEmitter {
|
|
|
919
920
|
return { did };
|
|
920
921
|
}
|
|
921
922
|
|
|
922
|
-
async updateUserApproval({ teamDid, user }) {
|
|
923
|
+
async updateUserApproval({ teamDid, user, options: { includeFederated = true } = {} }) {
|
|
923
924
|
const state = await this.getUserState(teamDid);
|
|
924
|
-
const
|
|
925
|
+
const userDoc = await state.getUser(user.did);
|
|
925
926
|
|
|
926
|
-
if (!
|
|
927
|
+
if (!userDoc) {
|
|
927
928
|
throw new Error('User does not exist');
|
|
928
929
|
}
|
|
929
930
|
|
|
930
|
-
if (hasActiveOwnerPassport(
|
|
931
|
+
if (hasActiveOwnerPassport(userDoc)) {
|
|
931
932
|
throw new Error('Cannot update owner\'s approval'); // prettier-ignore
|
|
932
933
|
}
|
|
933
934
|
|
|
@@ -944,6 +945,28 @@ class TeamAPI extends EventEmitter {
|
|
|
944
945
|
// 需要禁用用户的所有 passport
|
|
945
946
|
await state.revokePassportByUserDid({ did: user.did });
|
|
946
947
|
}
|
|
948
|
+
if (includeFederated) {
|
|
949
|
+
const nodeInfo = await this.node.read();
|
|
950
|
+
const blocklet = await getBlocklet({
|
|
951
|
+
did: teamDid,
|
|
952
|
+
states: this.states,
|
|
953
|
+
dataDirs: this.dataDirs,
|
|
954
|
+
useCache: true,
|
|
955
|
+
});
|
|
956
|
+
syncFederated({
|
|
957
|
+
nodeInfo,
|
|
958
|
+
blocklet,
|
|
959
|
+
data: {
|
|
960
|
+
users: [
|
|
961
|
+
{
|
|
962
|
+
action: user.approved ? 'unban' : 'ban',
|
|
963
|
+
did: user.did,
|
|
964
|
+
sourceAppPid: userDoc.sourceAppPid,
|
|
965
|
+
},
|
|
966
|
+
],
|
|
967
|
+
},
|
|
968
|
+
});
|
|
969
|
+
}
|
|
947
970
|
this.emit(TeamEvents.userUpdated, { teamDid, user: result });
|
|
948
971
|
this.emit(TeamEvents.userPermissionUpdated, { teamDid, user: result });
|
|
949
972
|
|
|
@@ -115,6 +115,7 @@ const formatContext = require('@abtnode/util/lib/format-context');
|
|
|
115
115
|
const md5 = require('@abtnode/util/lib/md5');
|
|
116
116
|
const {
|
|
117
117
|
callFederated,
|
|
118
|
+
syncFederated: _syncFederated,
|
|
118
119
|
getFederatedMaster,
|
|
119
120
|
generateSiteInfo,
|
|
120
121
|
findFederatedSite,
|
|
@@ -5962,7 +5963,7 @@ class FederatedBlockletManager extends DiskBlockletManager {
|
|
|
5962
5963
|
|
|
5963
5964
|
await this.syncFederated({
|
|
5964
5965
|
did: blocklet.appPid,
|
|
5965
|
-
|
|
5966
|
+
userFields: [...USER_PROFILE_SYNC_FIELDS, 'metadata', 'address'],
|
|
5966
5967
|
data: {
|
|
5967
5968
|
users: [
|
|
5968
5969
|
{
|
|
@@ -6020,99 +6021,28 @@ class FederatedBlockletManager extends DiskBlockletManager {
|
|
|
6020
6021
|
* @param {Array} [options.data.sites] - 需要同步的数据(站点)
|
|
6021
6022
|
* @returns
|
|
6022
6023
|
*/
|
|
6023
|
-
async syncFederated({
|
|
6024
|
-
did
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
fields = USER_PROFILE_SYNC_FIELDS,
|
|
6029
|
-
} = {}) {
|
|
6024
|
+
async syncFederated({ did, data, syncSites, allowStatus, userFields, siteFields } = {}) {
|
|
6025
|
+
if (!did) {
|
|
6026
|
+
logger.error('SyncFederated failed: did is required');
|
|
6027
|
+
return [];
|
|
6028
|
+
}
|
|
6030
6029
|
const blocklet = await this.getBlocklet(did);
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
const safeData = {};
|
|
6035
|
-
const { users, sites } = data;
|
|
6036
|
-
if (users && Array.isArray(users)) {
|
|
6037
|
-
safeData.users = users.map((item) => pick(item, fields));
|
|
6038
|
-
}
|
|
6039
|
-
|
|
6040
|
-
if (sites && Array.isArray(sites)) {
|
|
6041
|
-
safeData.sites = sites.map((item) =>
|
|
6042
|
-
pick(item, [
|
|
6043
|
-
'action',
|
|
6044
|
-
'appId',
|
|
6045
|
-
'appPid',
|
|
6046
|
-
'aliasDid',
|
|
6047
|
-
'appName',
|
|
6048
|
-
'appDescription',
|
|
6049
|
-
'appUrl',
|
|
6050
|
-
'aliasDomain',
|
|
6051
|
-
'appLogo',
|
|
6052
|
-
'appLogoRect',
|
|
6053
|
-
'appliedAt',
|
|
6054
|
-
'did',
|
|
6055
|
-
'pk',
|
|
6056
|
-
'serverId',
|
|
6057
|
-
'serverVersion',
|
|
6058
|
-
'version',
|
|
6059
|
-
'isMaster',
|
|
6060
|
-
'status',
|
|
6061
|
-
])
|
|
6062
|
-
);
|
|
6030
|
+
if (!blocklet) {
|
|
6031
|
+
logger.error(`SyncFederated failed: Blocklet not found for did: ${did}`);
|
|
6032
|
+
return [];
|
|
6063
6033
|
}
|
|
6064
6034
|
|
|
6065
6035
|
const nodeInfo = await states.node.read();
|
|
6066
|
-
const
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
}
|
|
6077
|
-
// 如果指定了要通知的站点,则按指定的站点来过滤
|
|
6078
|
-
if (Array.isArray(syncSites)) {
|
|
6079
|
-
return syncSites.some((x) => x.appPid === item.appPid);
|
|
6080
|
-
}
|
|
6081
|
-
return false;
|
|
6082
|
-
})
|
|
6083
|
-
.map(async (item) => {
|
|
6084
|
-
const resultItem = await limitSync(async () => {
|
|
6085
|
-
try {
|
|
6086
|
-
// NOTICE: 即使通知某个站点失败了,也不影响其他站点接收同步结果
|
|
6087
|
-
const result = await callFederated({
|
|
6088
|
-
action: 'sync',
|
|
6089
|
-
permanentWallet,
|
|
6090
|
-
site: item,
|
|
6091
|
-
data: safeData,
|
|
6092
|
-
});
|
|
6093
|
-
logger.info('Sync federated sites successfully', {
|
|
6094
|
-
action: 'sync',
|
|
6095
|
-
site: item,
|
|
6096
|
-
data: safeData,
|
|
6097
|
-
});
|
|
6098
|
-
return result;
|
|
6099
|
-
} catch (error) {
|
|
6100
|
-
logger.error('Failed to sync federated sites', {
|
|
6101
|
-
error,
|
|
6102
|
-
action: 'sync',
|
|
6103
|
-
site: item,
|
|
6104
|
-
data: safeData,
|
|
6105
|
-
});
|
|
6106
|
-
return null;
|
|
6107
|
-
}
|
|
6108
|
-
});
|
|
6109
|
-
return {
|
|
6110
|
-
site: item,
|
|
6111
|
-
result: resultItem,
|
|
6112
|
-
};
|
|
6113
|
-
});
|
|
6114
|
-
const resultList = await Promise.all(waitingList);
|
|
6115
|
-
return resultList;
|
|
6036
|
+
const result = await _syncFederated({
|
|
6037
|
+
blocklet,
|
|
6038
|
+
data,
|
|
6039
|
+
syncSites,
|
|
6040
|
+
allowStatus,
|
|
6041
|
+
userFields,
|
|
6042
|
+
siteFields,
|
|
6043
|
+
nodeInfo,
|
|
6044
|
+
});
|
|
6045
|
+
return result;
|
|
6116
6046
|
}
|
|
6117
6047
|
|
|
6118
6048
|
async loginFederated({ did, site, data }) {
|
|
@@ -38963,7 +38963,7 @@ module.exports = require("zlib");
|
|
|
38963
38963
|
/***/ ((module) => {
|
|
38964
38964
|
|
|
38965
38965
|
"use strict";
|
|
38966
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.53","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib","test":"bun test","coverage":"bun test --coverage"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.16.53","@abtnode/auth":"1.16.53","@abtnode/certificate-manager":"1.16.53","@abtnode/constant":"1.16.53","@abtnode/cron":"1.16.53","@abtnode/db-cache":"1.16.53","@abtnode/docker-utils":"1.16.53","@abtnode/logger":"1.16.53","@abtnode/models":"1.16.53","@abtnode/queue":"1.16.53","@abtnode/rbac":"1.16.53","@abtnode/router-provider":"1.16.53","@abtnode/static-server":"1.16.53","@abtnode/timemachine":"1.16.53","@abtnode/util":"1.16.53","@aigne/aigne-hub":"^0.10.
|
|
38966
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.53","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib","test":"bun test","coverage":"bun test --coverage"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.16.53","@abtnode/auth":"1.16.53","@abtnode/certificate-manager":"1.16.53","@abtnode/constant":"1.16.53","@abtnode/cron":"1.16.53","@abtnode/db-cache":"1.16.53","@abtnode/docker-utils":"1.16.53","@abtnode/logger":"1.16.53","@abtnode/models":"1.16.53","@abtnode/queue":"1.16.53","@abtnode/rbac":"1.16.53","@abtnode/router-provider":"1.16.53","@abtnode/static-server":"1.16.53","@abtnode/timemachine":"1.16.53","@abtnode/util":"1.16.53","@aigne/aigne-hub":"^0.10.3","@arcblock/did":"^1.26.3","@arcblock/did-connect-js":"^1.26.3","@arcblock/did-ext":"^1.26.3","@arcblock/did-motif":"^1.1.14","@arcblock/did-util":"^1.26.3","@arcblock/event-hub":"^1.26.3","@arcblock/jwt":"^1.26.3","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"^1.26.3","@arcblock/vc":"^1.26.3","@blocklet/constant":"1.16.53","@blocklet/did-space-js":"^1.1.34","@blocklet/env":"1.16.53","@blocklet/error":"^0.2.5","@blocklet/meta":"1.16.53","@blocklet/resolver":"1.16.53","@blocklet/sdk":"1.16.53","@blocklet/server-js":"1.16.53","@blocklet/store":"1.16.53","@blocklet/theme":"^3.1.51","@fidm/x509":"^1.2.1","@ocap/mcrypto":"^1.26.3","@ocap/util":"^1.26.3","@ocap/wallet":"^1.26.3","@slack/webhook":"^5.0.4","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","jest":"^29.7.0","unzipper":"^0.10.11"},"gitHead":"e5764f753181ed6a7c615cd4fc6682aacf0cb7cd"}');
|
|
38967
38967
|
|
|
38968
38968
|
/***/ }),
|
|
38969
38969
|
|
package/lib/util/blocklet.js
CHANGED
|
@@ -376,6 +376,9 @@ const getAppSystemEnvironments = (blocklet, nodeInfo, dataDirs) => {
|
|
|
376
376
|
const appPid = blocklet.appPid || appId;
|
|
377
377
|
const appPsk = isMigrated ? blocklet.migratedFrom[0].appSk : appSk;
|
|
378
378
|
|
|
379
|
+
// Calculate permanent public key (PPK)
|
|
380
|
+
const appPpk = isMigrated ? toHex(fromSecretKey(appPsk, wallet.type).publicKey) : appPk;
|
|
381
|
+
|
|
379
382
|
/* 获取 did domain 方式:
|
|
380
383
|
* 1. 先从 site 里读
|
|
381
384
|
* 2. 如果没有,再拼接
|
|
@@ -400,6 +403,7 @@ const getAppSystemEnvironments = (blocklet, nodeInfo, dataDirs) => {
|
|
|
400
403
|
BLOCKLET_APP_SK: appSk,
|
|
401
404
|
BLOCKLET_APP_ID: appId,
|
|
402
405
|
BLOCKLET_APP_PSK: appPsk, // permanent sk even the blocklet has been migrated
|
|
406
|
+
BLOCKLET_APP_PPK: appPpk, // permanent pk corresponding to PSK
|
|
403
407
|
BLOCKLET_APP_PID: appPid, // permanent did even the blocklet has been migrated
|
|
404
408
|
BLOCKLET_APP_NAME: appName,
|
|
405
409
|
BLOCKLET_APP_NAME_SLUG: urlPathFriendly(slugify(appName)),
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.54-beta-
|
|
6
|
+
"version": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,46 +19,46 @@
|
|
|
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.54-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.54-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.54-beta-
|
|
25
|
-
"@abtnode/constant": "1.16.54-beta-
|
|
26
|
-
"@abtnode/cron": "1.16.54-beta-
|
|
27
|
-
"@abtnode/db-cache": "1.16.54-beta-
|
|
28
|
-
"@abtnode/docker-utils": "1.16.54-beta-
|
|
29
|
-
"@abtnode/logger": "1.16.54-beta-
|
|
30
|
-
"@abtnode/models": "1.16.54-beta-
|
|
31
|
-
"@abtnode/queue": "1.16.54-beta-
|
|
32
|
-
"@abtnode/rbac": "1.16.54-beta-
|
|
33
|
-
"@abtnode/router-provider": "1.16.54-beta-
|
|
34
|
-
"@abtnode/static-server": "1.16.54-beta-
|
|
35
|
-
"@abtnode/timemachine": "1.16.54-beta-
|
|
36
|
-
"@abtnode/util": "1.16.54-beta-
|
|
37
|
-
"@aigne/aigne-hub": "^0.10.
|
|
38
|
-
"@arcblock/did": "^1.26.
|
|
39
|
-
"@arcblock/did-connect-js": "^1.26.
|
|
40
|
-
"@arcblock/did-ext": "^1.26.
|
|
22
|
+
"@abtnode/analytics": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
23
|
+
"@abtnode/auth": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
25
|
+
"@abtnode/constant": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
26
|
+
"@abtnode/cron": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
27
|
+
"@abtnode/db-cache": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
28
|
+
"@abtnode/docker-utils": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
29
|
+
"@abtnode/logger": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
30
|
+
"@abtnode/models": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
31
|
+
"@abtnode/queue": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
32
|
+
"@abtnode/rbac": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
33
|
+
"@abtnode/router-provider": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
34
|
+
"@abtnode/static-server": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
35
|
+
"@abtnode/timemachine": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
36
|
+
"@abtnode/util": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
37
|
+
"@aigne/aigne-hub": "^0.10.3",
|
|
38
|
+
"@arcblock/did": "^1.26.3",
|
|
39
|
+
"@arcblock/did-connect-js": "^1.26.3",
|
|
40
|
+
"@arcblock/did-ext": "^1.26.3",
|
|
41
41
|
"@arcblock/did-motif": "^1.1.14",
|
|
42
|
-
"@arcblock/did-util": "^1.26.
|
|
43
|
-
"@arcblock/event-hub": "^1.26.
|
|
44
|
-
"@arcblock/jwt": "^1.26.
|
|
42
|
+
"@arcblock/did-util": "^1.26.3",
|
|
43
|
+
"@arcblock/event-hub": "^1.26.3",
|
|
44
|
+
"@arcblock/jwt": "^1.26.3",
|
|
45
45
|
"@arcblock/pm2-events": "^0.0.5",
|
|
46
|
-
"@arcblock/validator": "^1.26.
|
|
47
|
-
"@arcblock/vc": "^1.26.
|
|
48
|
-
"@blocklet/constant": "1.16.54-beta-
|
|
46
|
+
"@arcblock/validator": "^1.26.3",
|
|
47
|
+
"@arcblock/vc": "^1.26.3",
|
|
48
|
+
"@blocklet/constant": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
49
49
|
"@blocklet/did-space-js": "^1.1.34",
|
|
50
|
-
"@blocklet/env": "1.16.54-beta-
|
|
50
|
+
"@blocklet/env": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
51
51
|
"@blocklet/error": "^0.2.5",
|
|
52
|
-
"@blocklet/meta": "1.16.54-beta-
|
|
53
|
-
"@blocklet/resolver": "1.16.54-beta-
|
|
54
|
-
"@blocklet/sdk": "1.16.54-beta-
|
|
55
|
-
"@blocklet/server-js": "1.16.54-beta-
|
|
56
|
-
"@blocklet/store": "1.16.54-beta-
|
|
52
|
+
"@blocklet/meta": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
53
|
+
"@blocklet/resolver": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
54
|
+
"@blocklet/sdk": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
55
|
+
"@blocklet/server-js": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
56
|
+
"@blocklet/store": "1.16.54-beta-20251024-030947-6f2889bf",
|
|
57
57
|
"@blocklet/theme": "^3.1.51",
|
|
58
58
|
"@fidm/x509": "^1.2.1",
|
|
59
|
-
"@ocap/mcrypto": "^1.26.
|
|
60
|
-
"@ocap/util": "^1.26.
|
|
61
|
-
"@ocap/wallet": "^1.26.
|
|
59
|
+
"@ocap/mcrypto": "^1.26.3",
|
|
60
|
+
"@ocap/util": "^1.26.3",
|
|
61
|
+
"@ocap/wallet": "^1.26.3",
|
|
62
62
|
"@slack/webhook": "^5.0.4",
|
|
63
63
|
"archiver": "^7.0.1",
|
|
64
64
|
"axios": "^1.7.9",
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
"jest": "^29.7.0",
|
|
120
120
|
"unzipper": "^0.10.11"
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "73e5a3a80b82a2a7c62d42fdc08207b28e67633e"
|
|
123
123
|
}
|