@abtnode/core 1.17.0-beta-20251103-104515-e4795f0f → 1.17.0-beta-20251105-000053-53e6e3e9

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
@@ -873,18 +873,6 @@ class TeamAPI extends EventEmitter {
873
873
  return updated;
874
874
  }
875
875
 
876
- updateUserExtra(args) {
877
- if (args.extra) {
878
- try {
879
- args.extra = JSON.parse(args.extra);
880
- } catch (err) {
881
- throw new Error('extra should be a valid json string');
882
- }
883
- }
884
-
885
- return this.updateUser({ teamDid: args.teamDid, user: pick(args, ['did', 'remark', 'extra']) });
886
- }
887
-
888
876
  updateUserAddress(args) {
889
877
  if (!args.address) {
890
878
  throw new Error('address should not be empty');
@@ -43,6 +43,7 @@ const {
43
43
  NOTIFICATION_SEND_CHANNEL,
44
44
  NOTIFICATION_SEND_STATUS,
45
45
  EVENTS,
46
+ USER_PROFILE_SYNC_FIELDS,
46
47
  } = require('@abtnode/constant');
47
48
 
48
49
  const { getBlockletEngine } = require('@blocklet/meta/lib/engine');
@@ -262,22 +263,6 @@ const statusLock = new DBCache(() => ({
262
263
  ...getAbtNodeRedisAndSQLiteUrl(),
263
264
  }));
264
265
 
265
- const USER_PROFILE_SYNC_FIELDS = [
266
- 'action', // 表示对该 user 的操作
267
- 'did',
268
- 'pk',
269
- 'avatar',
270
- 'fullName',
271
- 'email',
272
- 'connectedAccount',
273
- 'disconnectedAccount',
274
- 'sourceAppPid',
275
- 'inviter',
276
- 'generation',
277
- 'emailVerified',
278
- 'phoneVerified',
279
- ];
280
-
281
266
  const pm2StatusMap = {
282
267
  online: BlockletStatus.running,
283
268
  stop: BlockletStatus.stopped,
@@ -837,7 +822,20 @@ class DiskBlockletManager extends BaseBlockletManager {
837
822
  });
838
823
 
839
824
  if (atomic || !blocklet.structVersion) {
840
- return this._start({ blocklet, throwOnError, checkHealthImmediately, e2eMode, componentDids, operator }, context);
825
+ const nextBlocklet = await this._start(
826
+ { blocklet, throwOnError, checkHealthImmediately, e2eMode, componentDids, operator },
827
+ context
828
+ );
829
+
830
+ // 根据情况更新 route table, 会判断只有包含多 interfaces 的 DID 才会更新 route table
831
+ if (!['true', '1'].includes(process.env.ABT_NODE_DISABLE_BLUE_GREEN)) {
832
+ this.emit(BlockletEvents.blurOrGreenStarted, {
833
+ blocklet: nextBlocklet,
834
+ componentDids: inputComponentDids,
835
+ context,
836
+ });
837
+ }
838
+ return nextBlocklet;
841
839
  }
842
840
 
843
841
  const tasks = componentDids.map(
@@ -859,6 +857,7 @@ class DiskBlockletManager extends BaseBlockletManager {
859
857
 
860
858
  const nextBlocklet = await this.ensureBlocklet(did, { e2eMode });
861
859
 
860
+ // 根据情况更新 route table, 会判断只有包含多 interfaces 的 DID 才会更新 route table
862
861
  if (!['true', '1'].includes(process.env.ABT_NODE_DISABLE_BLUE_GREEN)) {
863
862
  this.emit(BlockletEvents.blurOrGreenStarted, {
864
863
  blocklet: nextBlocklet,
@@ -5988,28 +5987,14 @@ class FederatedBlockletManager extends DiskBlockletManager {
5988
5987
 
5989
5988
  const masterSite = getFederatedMaster(blocklet);
5990
5989
  if (shouldSyncFederated(sourceAppPid, blocklet)) {
5991
- const data = pick(updated, [
5992
- 'did',
5993
- 'pk',
5994
- 'avatar',
5995
- 'fullName',
5996
- 'email',
5997
- 'phone',
5998
- 'url',
5999
- 'inviter',
6000
- 'generation',
6001
- 'emailVerified',
6002
- 'phoneVerified',
6003
- 'metadata',
6004
- 'address',
6005
- ]);
5990
+ const data = pick(updated, USER_PROFILE_SYNC_FIELDS);
6006
5991
  if (data.avatar) {
6007
5992
  data.avatar = getUserAvatarUrl(data.avatar, blocklet);
6008
5993
  }
6009
5994
 
6010
5995
  await this.syncFederated({
6011
5996
  did: blocklet.appPid,
6012
- userFields: [...USER_PROFILE_SYNC_FIELDS, 'metadata', 'address'],
5997
+ userFields: USER_PROFILE_SYNC_FIELDS,
6013
5998
  data: {
6014
5999
  users: [
6015
6000
  {
@@ -6031,6 +6016,31 @@ class FederatedBlockletManager extends DiskBlockletManager {
6031
6016
  }
6032
6017
  }
6033
6018
 
6019
+ async updateUserExtra(args) {
6020
+ try {
6021
+ if (args.extra) {
6022
+ try {
6023
+ args.extra = JSON.parse(args.extra);
6024
+ } catch (err) {
6025
+ throw new Error('extra should be a valid json string');
6026
+ }
6027
+ }
6028
+
6029
+ const updated = await this.teamAPI.updateUser({
6030
+ teamDid: args.teamDid,
6031
+ user: pick(args, ['did', 'remark', 'extra']),
6032
+ });
6033
+
6034
+ // 异步更新站点群其他站点的用户信息
6035
+ this.updateUserInfoAndSyncFederated({ teamDid: args.teamDid, updated });
6036
+
6037
+ return updated;
6038
+ } catch (err) {
6039
+ logger.error('Failed to update user extra', { err });
6040
+ throw err;
6041
+ }
6042
+ }
6043
+
6034
6044
  /**
6035
6045
  * 调用来源有两种
6036
6046
  * 1. js-sdk: 调用时,会处理好 user.phone 与 user.metadata.phone 的同步,已经 user.metadata.location 与 user.address.city 的同步
@@ -892,6 +892,47 @@ module.exports = Object.freeze({
892
892
  'https://unpkg.com',
893
893
  ],
894
894
  CSP_ICONIFY_SOURCES: ['https://*.simplesvg.com', 'https://*.iconify.design', 'https://*.unisvg.com'],
895
+
896
+ USER_PROFILE_SYNC_FIELDS: [
897
+ 'action', // 表示对该 user 的操作
898
+ 'did',
899
+ 'pk',
900
+ 'avatar',
901
+ 'fullName',
902
+ 'locale',
903
+ 'email',
904
+ 'connectedAccount',
905
+ 'disconnectedAccount',
906
+ 'sourceAppPid',
907
+ 'inviter',
908
+ 'generation',
909
+ 'emailVerified',
910
+ 'phoneVerified',
911
+ 'metadata',
912
+ 'address',
913
+ 'extra',
914
+ ],
915
+
916
+ SITE_SYNC_FIELDS: [
917
+ 'action',
918
+ 'appId',
919
+ 'appPid',
920
+ 'aliasDid',
921
+ 'appName',
922
+ 'appDescription',
923
+ 'appUrl',
924
+ 'aliasDomain',
925
+ 'appLogo',
926
+ 'appLogoRect',
927
+ 'appliedAt',
928
+ 'did',
929
+ 'pk',
930
+ 'serverId',
931
+ 'serverVersion',
932
+ 'version',
933
+ 'isMaster',
934
+ 'status',
935
+ ],
895
936
  });
896
937
 
897
938
 
package/lib/index.js CHANGED
@@ -535,7 +535,7 @@ function ABTNode(options) {
535
535
  updateUser: teamAPI.updateUser.bind(teamAPI),
536
536
  updateUserInfoAndSync: blockletManager.updateUserInfoAndSync.bind(blockletManager),
537
537
  updateUserTags: teamAPI.updateUserTags.bind(teamAPI),
538
- updateUserExtra: teamAPI.updateUserExtra.bind(teamAPI),
538
+ updateUserExtra: blockletManager.updateUserExtra.bind(blockletManager),
539
539
  updateUserApproval: teamAPI.updateUserApproval.bind(teamAPI),
540
540
  getUserByDid: teamAPI.getUserByDid.bind(teamAPI),
541
541
  isPassportValid: teamAPI.isPassportValid.bind(teamAPI),
@@ -2084,7 +2084,13 @@ module.exports = function getRouterHelpers({
2084
2084
  };
2085
2085
 
2086
2086
  const ensureBlockletHasMultipleInterfaces = (blocklet, componentDids) => {
2087
+ if (!componentDids?.length) {
2088
+ return false;
2089
+ }
2087
2090
  for (const child of blocklet.children) {
2091
+ if (!child?.meta) {
2092
+ continue;
2093
+ }
2088
2094
  const interfaces = (child.meta.interfaces || []).filter((x) => !!x.port);
2089
2095
  if (componentDids.includes(child.meta.did) && interfaces.length > 1) {
2090
2096
  return true;
@@ -446,7 +446,9 @@ SELECT did,inviter,generation FROM UserTree`.trim();
446
446
  sorting.push(['createdAt', 'DESC']);
447
447
  }
448
448
 
449
- const result = await this.paginate({ where, include, replacements }, sorting, paging);
449
+ const result = await this.paginate({ where, include, replacements }, sorting, paging, undefined, {
450
+ countInclude: true,
451
+ });
450
452
 
451
453
  if (includeFollowStatus && user?.did) {
452
454
  result.list = await this._enrichWithFollowStatus(result.list, user.did);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.17.0-beta-20251103-104515-e4795f0f",
6
+ "version": "1.17.0-beta-20251105-000053-53e6e3e9",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -17,21 +17,21 @@
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.0-beta-20251103-104515-e4795f0f",
21
- "@abtnode/auth": "1.17.0-beta-20251103-104515-e4795f0f",
22
- "@abtnode/certificate-manager": "1.17.0-beta-20251103-104515-e4795f0f",
23
- "@abtnode/constant": "1.17.0-beta-20251103-104515-e4795f0f",
24
- "@abtnode/cron": "1.17.0-beta-20251103-104515-e4795f0f",
25
- "@abtnode/db-cache": "1.17.0-beta-20251103-104515-e4795f0f",
26
- "@abtnode/docker-utils": "1.17.0-beta-20251103-104515-e4795f0f",
27
- "@abtnode/logger": "1.17.0-beta-20251103-104515-e4795f0f",
28
- "@abtnode/models": "1.17.0-beta-20251103-104515-e4795f0f",
29
- "@abtnode/queue": "1.17.0-beta-20251103-104515-e4795f0f",
30
- "@abtnode/rbac": "1.17.0-beta-20251103-104515-e4795f0f",
31
- "@abtnode/router-provider": "1.17.0-beta-20251103-104515-e4795f0f",
32
- "@abtnode/static-server": "1.17.0-beta-20251103-104515-e4795f0f",
33
- "@abtnode/timemachine": "1.17.0-beta-20251103-104515-e4795f0f",
34
- "@abtnode/util": "1.17.0-beta-20251103-104515-e4795f0f",
20
+ "@abtnode/analytics": "1.17.0-beta-20251105-000053-53e6e3e9",
21
+ "@abtnode/auth": "1.17.0-beta-20251105-000053-53e6e3e9",
22
+ "@abtnode/certificate-manager": "1.17.0-beta-20251105-000053-53e6e3e9",
23
+ "@abtnode/constant": "1.17.0-beta-20251105-000053-53e6e3e9",
24
+ "@abtnode/cron": "1.17.0-beta-20251105-000053-53e6e3e9",
25
+ "@abtnode/db-cache": "1.17.0-beta-20251105-000053-53e6e3e9",
26
+ "@abtnode/docker-utils": "1.17.0-beta-20251105-000053-53e6e3e9",
27
+ "@abtnode/logger": "1.17.0-beta-20251105-000053-53e6e3e9",
28
+ "@abtnode/models": "1.17.0-beta-20251105-000053-53e6e3e9",
29
+ "@abtnode/queue": "1.17.0-beta-20251105-000053-53e6e3e9",
30
+ "@abtnode/rbac": "1.17.0-beta-20251105-000053-53e6e3e9",
31
+ "@abtnode/router-provider": "1.17.0-beta-20251105-000053-53e6e3e9",
32
+ "@abtnode/static-server": "1.17.0-beta-20251105-000053-53e6e3e9",
33
+ "@abtnode/timemachine": "1.17.0-beta-20251105-000053-53e6e3e9",
34
+ "@abtnode/util": "1.17.0-beta-20251105-000053-53e6e3e9",
35
35
  "@aigne/aigne-hub": "^0.10.4",
36
36
  "@arcblock/did": "^1.27.1",
37
37
  "@arcblock/did-connect-js": "^1.27.1",
@@ -43,15 +43,15 @@
43
43
  "@arcblock/pm2-events": "^0.0.5",
44
44
  "@arcblock/validator": "^1.27.1",
45
45
  "@arcblock/vc": "^1.27.1",
46
- "@blocklet/constant": "1.17.0-beta-20251103-104515-e4795f0f",
46
+ "@blocklet/constant": "1.17.0-beta-20251105-000053-53e6e3e9",
47
47
  "@blocklet/did-space-js": "^1.2.0",
48
- "@blocklet/env": "1.17.0-beta-20251103-104515-e4795f0f",
48
+ "@blocklet/env": "1.17.0-beta-20251105-000053-53e6e3e9",
49
49
  "@blocklet/error": "^0.3.0",
50
- "@blocklet/meta": "1.17.0-beta-20251103-104515-e4795f0f",
51
- "@blocklet/resolver": "1.17.0-beta-20251103-104515-e4795f0f",
52
- "@blocklet/sdk": "1.17.0-beta-20251103-104515-e4795f0f",
53
- "@blocklet/server-js": "1.17.0-beta-20251103-104515-e4795f0f",
54
- "@blocklet/store": "1.17.0-beta-20251103-104515-e4795f0f",
50
+ "@blocklet/meta": "1.17.0-beta-20251105-000053-53e6e3e9",
51
+ "@blocklet/resolver": "1.17.0-beta-20251105-000053-53e6e3e9",
52
+ "@blocklet/sdk": "1.17.0-beta-20251105-000053-53e6e3e9",
53
+ "@blocklet/server-js": "1.17.0-beta-20251105-000053-53e6e3e9",
54
+ "@blocklet/store": "1.17.0-beta-20251105-000053-53e6e3e9",
55
55
  "@blocklet/theme": "^3.1.54",
56
56
  "@fidm/x509": "^1.2.1",
57
57
  "@ocap/mcrypto": "^1.27.1",
@@ -116,5 +116,5 @@
116
116
  "express": "^4.18.2",
117
117
  "unzipper": "^0.10.11"
118
118
  },
119
- "gitHead": "2fb9b7f6dbf45b407a82ac676955b4ede1c6b347"
119
+ "gitHead": "61a1b994cca350a1c7cd12debc39416ac3af1a5d"
120
120
  }