@abtnode/core 1.16.53-beta-20251013-005429-ca3b05de → 1.16.53-beta-20251013-075536-64fcb94b

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.
@@ -20,6 +20,8 @@ class EnsureBlockletRunning {
20
20
  // 每次任务的最小间隔时间
21
21
  checkInterval = +process.env.ABT_NODE_ENSURE_RUNNING_CHECK_INTERVAL || 180 * 1000;
22
22
 
23
+ minCheckInterval = 30_000;
24
+
23
25
  everyBlockletCheckInterval = 2000;
24
26
 
25
27
  everyBlockletDoingInterval = 5000;
@@ -111,7 +113,7 @@ class EnsureBlockletRunning {
111
113
  return;
112
114
  }
113
115
  if (this.whenCycleCheck) {
114
- await sleep(this.checkInterval);
116
+ await sleep(Math.max(this.checkInterval, this.minCheckInterval));
115
117
  }
116
118
  try {
117
119
  await this.checkAndFix();
@@ -1251,6 +1251,28 @@ module.exports = function getRouterHelpers({
1251
1251
  nftDid,
1252
1252
  chainHost: context.domainChainHost,
1253
1253
  });
1254
+
1255
+ const appURL = `https://${domainAlias}`;
1256
+ blockletManager
1257
+ .config({
1258
+ did: blocklet.meta.did,
1259
+ configs: [{ key: 'BLOCKLET_APP_URL', value: appURL }],
1260
+ })
1261
+ .then(() => {
1262
+ logger.info('update blocklet app url', {
1263
+ did: blocklet.meta.did,
1264
+ domainAlias,
1265
+ appURL,
1266
+ });
1267
+ })
1268
+ .catch((error) => {
1269
+ logger.error('update blocklet app url failed', {
1270
+ error,
1271
+ did: blocklet.meta.did,
1272
+ domainAlias,
1273
+ appURL,
1274
+ });
1275
+ });
1254
1276
  })
1255
1277
  .catch((error) => {
1256
1278
  logger.error('bind domain alias failed', {
@@ -1037,6 +1037,7 @@ class AuditLogState extends BaseState {
1037
1037
  env: pick(uaInfo, ['browser', 'os', 'device']),
1038
1038
  ip,
1039
1039
  ua,
1040
+ componentDid: context?.user?.componentDid || null,
1040
1041
  });
1041
1042
 
1042
1043
  logger.info('create', data);
package/lib/states/org.js CHANGED
@@ -7,6 +7,7 @@ const { PASSPORT_STATUS } = require('@abtnode/constant');
7
7
  const BaseState = require('./base');
8
8
  const { formatPaging, isAdminUser, isAdmingPath, isOrgOwner } = require('../util/org');
9
9
 
10
+ const ACTIVE_STATUS = 'active';
10
11
  class OrgState extends BaseState {
11
12
  constructor(baseDir, config = {}, models) {
12
13
  super(baseDir, { filename: 'orgs.db', ...config });
@@ -36,7 +37,7 @@ class OrgState extends BaseState {
36
37
  const doc = await this.insert(orgData);
37
38
 
38
39
  // 创建成功后默认要向组织添加创建者
39
- await this.userOrgs.insert({ orgId: doc.id, userDid: orgData.ownerDid, status: 'active' });
40
+ await this.userOrgs.insert({ orgId: doc.id, userDid: orgData.ownerDid, status: ACTIVE_STATUS });
40
41
 
41
42
  return doc;
42
43
  }
@@ -119,11 +120,11 @@ class OrgState extends BaseState {
119
120
  payload.type = '';
120
121
  }
121
122
 
122
- const quertUserDid = payload.userDid || user.did;
123
+ const queryUserDid = payload.userDid || user.did;
123
124
 
124
125
  // 根据不同的 type 构建查询条件,同时合并 org 条件
125
126
  if (payload.type === 'owned') {
126
- where.ownerDid = quertUserDid;
127
+ where.ownerDid = queryUserDid;
127
128
  // 添加 org 条件作为 AND 条件
128
129
  if (orgConditions.length > 0) {
129
130
  where[Op.or] = orgConditions;
@@ -131,13 +132,14 @@ class OrgState extends BaseState {
131
132
  } else if (payload.type === 'joined') {
132
133
  where.id = {
133
134
  [Op.in]: Sequelize.literal(
134
- '(SELECT DISTINCT "orgId" FROM user_orgs WHERE "userDid" = :userDid and status = "active")'
135
+ '(SELECT DISTINCT "orgId" FROM user_orgs WHERE "userDid" = :userDid and status = :status)'
135
136
  ),
136
137
  };
137
138
  where.ownerDid = {
138
- [Op.ne]: quertUserDid,
139
+ [Op.ne]: queryUserDid,
139
140
  };
140
- replacements.userDid = quertUserDid;
141
+ replacements.userDid = queryUserDid;
142
+ replacements.status = ACTIVE_STATUS;
141
143
  // 添加 org 条件作为 AND 条件
142
144
  if (orgConditions.length > 0) {
143
145
  where[Op.or] = orgConditions;
@@ -145,11 +147,11 @@ class OrgState extends BaseState {
145
147
  } else if (!isAdmin && !payload.type) {
146
148
  // 查询所有的(包括我创建的和我加入的)
147
149
  const typeConditions = [
148
- { ownerDid: quertUserDid },
150
+ { ownerDid: queryUserDid },
149
151
  {
150
152
  id: {
151
153
  [Op.in]: Sequelize.literal(
152
- '(SELECT DISTINCT "orgId" FROM user_orgs WHERE "userDid" = :userDid and status = "active")'
154
+ '(SELECT DISTINCT "orgId" FROM user_orgs WHERE "userDid" = :userDid and status = :status)'
153
155
  ),
154
156
  },
155
157
  },
@@ -160,7 +162,8 @@ class OrgState extends BaseState {
160
162
  } else {
161
163
  where[Op.or] = typeConditions;
162
164
  }
163
- replacements.userDid = quertUserDid;
165
+ replacements.userDid = queryUserDid;
166
+ replacements.status = ACTIVE_STATUS;
164
167
  } else if (orgConditions.length > 0) {
165
168
  where[Op.or] = orgConditions;
166
169
  }
@@ -185,7 +188,7 @@ class OrgState extends BaseState {
185
188
  let passports = [];
186
189
  if (['joined', 'all'].includes(payload.type) && includePassports) {
187
190
  passports = await this.passport.find({
188
- where: { userDid: quertUserDid },
191
+ where: { userDid: queryUserDid },
189
192
  });
190
193
  }
191
194
 
@@ -268,7 +271,7 @@ class OrgState extends BaseState {
268
271
  throw new CustomError(400, 'User already in the org, cannot add again', { orgId, userDid });
269
272
  }
270
273
 
271
- return this.userOrgs.insert({ orgId, userDid, status: status || 'active' });
274
+ return this.userOrgs.insert({ orgId, userDid, status: status || ACTIVE_STATUS });
272
275
  }
273
276
 
274
277
  async removeOrgMember({ orgId, userDid }, context) {
@@ -339,7 +342,7 @@ class OrgState extends BaseState {
339
342
  };
340
343
  }
341
344
 
342
- async updateOrgMember({ orgId, userDid, status = 'active' }) {
345
+ async updateOrgMember({ orgId, userDid, status = ACTIVE_STATUS }) {
343
346
  const [orgIsExist, userIsExist] = await Promise.all([this.orgIsExist(orgId), this.userIsExist(userDid)]);
344
347
  if (!orgIsExist) {
345
348
  throw new CustomError(404, 'Org not found', { orgId });
@@ -351,7 +354,7 @@ class OrgState extends BaseState {
351
354
  if (!userOrg || status === userOrg.status) {
352
355
  throw new CustomError(400, 'User not in the org, cannot update', { orgId, userDid });
353
356
  }
354
- return this.userOrgs.update({ orgId, userDid }, { $set: { status: status || 'active' } });
357
+ return this.userOrgs.update({ orgId, userDid }, { $set: { status: status || ACTIVE_STATUS } });
355
358
  }
356
359
 
357
360
  /**
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.53-beta-20251013-005429-ca3b05de",
6
+ "version": "1.16.53-beta-20251013-075536-64fcb94b",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -21,21 +21,21 @@
21
21
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
22
22
  "license": "Apache-2.0",
23
23
  "dependencies": {
24
- "@abtnode/analytics": "1.16.53-beta-20251013-005429-ca3b05de",
25
- "@abtnode/auth": "1.16.53-beta-20251013-005429-ca3b05de",
26
- "@abtnode/certificate-manager": "1.16.53-beta-20251013-005429-ca3b05de",
27
- "@abtnode/constant": "1.16.53-beta-20251013-005429-ca3b05de",
28
- "@abtnode/cron": "1.16.53-beta-20251013-005429-ca3b05de",
29
- "@abtnode/db-cache": "1.16.53-beta-20251013-005429-ca3b05de",
30
- "@abtnode/docker-utils": "1.16.53-beta-20251013-005429-ca3b05de",
31
- "@abtnode/logger": "1.16.53-beta-20251013-005429-ca3b05de",
32
- "@abtnode/models": "1.16.53-beta-20251013-005429-ca3b05de",
33
- "@abtnode/queue": "1.16.53-beta-20251013-005429-ca3b05de",
34
- "@abtnode/rbac": "1.16.53-beta-20251013-005429-ca3b05de",
35
- "@abtnode/router-provider": "1.16.53-beta-20251013-005429-ca3b05de",
36
- "@abtnode/static-server": "1.16.53-beta-20251013-005429-ca3b05de",
37
- "@abtnode/timemachine": "1.16.53-beta-20251013-005429-ca3b05de",
38
- "@abtnode/util": "1.16.53-beta-20251013-005429-ca3b05de",
24
+ "@abtnode/analytics": "1.16.53-beta-20251013-075536-64fcb94b",
25
+ "@abtnode/auth": "1.16.53-beta-20251013-075536-64fcb94b",
26
+ "@abtnode/certificate-manager": "1.16.53-beta-20251013-075536-64fcb94b",
27
+ "@abtnode/constant": "1.16.53-beta-20251013-075536-64fcb94b",
28
+ "@abtnode/cron": "1.16.53-beta-20251013-075536-64fcb94b",
29
+ "@abtnode/db-cache": "1.16.53-beta-20251013-075536-64fcb94b",
30
+ "@abtnode/docker-utils": "1.16.53-beta-20251013-075536-64fcb94b",
31
+ "@abtnode/logger": "1.16.53-beta-20251013-075536-64fcb94b",
32
+ "@abtnode/models": "1.16.53-beta-20251013-075536-64fcb94b",
33
+ "@abtnode/queue": "1.16.53-beta-20251013-075536-64fcb94b",
34
+ "@abtnode/rbac": "1.16.53-beta-20251013-075536-64fcb94b",
35
+ "@abtnode/router-provider": "1.16.53-beta-20251013-075536-64fcb94b",
36
+ "@abtnode/static-server": "1.16.53-beta-20251013-075536-64fcb94b",
37
+ "@abtnode/timemachine": "1.16.53-beta-20251013-075536-64fcb94b",
38
+ "@abtnode/util": "1.16.53-beta-20251013-075536-64fcb94b",
39
39
  "@aigne/aigne-hub": "^0.10.0",
40
40
  "@arcblock/did": "1.25.6",
41
41
  "@arcblock/did-connect-js": "1.25.6",
@@ -47,15 +47,15 @@
47
47
  "@arcblock/pm2-events": "^0.0.5",
48
48
  "@arcblock/validator": "1.25.6",
49
49
  "@arcblock/vc": "1.25.6",
50
- "@blocklet/constant": "1.16.53-beta-20251013-005429-ca3b05de",
50
+ "@blocklet/constant": "1.16.53-beta-20251013-075536-64fcb94b",
51
51
  "@blocklet/did-space-js": "^1.1.29",
52
- "@blocklet/env": "1.16.53-beta-20251013-005429-ca3b05de",
52
+ "@blocklet/env": "1.16.53-beta-20251013-075536-64fcb94b",
53
53
  "@blocklet/error": "^0.2.5",
54
- "@blocklet/meta": "1.16.53-beta-20251013-005429-ca3b05de",
55
- "@blocklet/resolver": "1.16.53-beta-20251013-005429-ca3b05de",
56
- "@blocklet/sdk": "1.16.53-beta-20251013-005429-ca3b05de",
57
- "@blocklet/server-js": "1.16.53-beta-20251013-005429-ca3b05de",
58
- "@blocklet/store": "1.16.53-beta-20251013-005429-ca3b05de",
54
+ "@blocklet/meta": "1.16.53-beta-20251013-075536-64fcb94b",
55
+ "@blocklet/resolver": "1.16.53-beta-20251013-075536-64fcb94b",
56
+ "@blocklet/sdk": "1.16.53-beta-20251013-075536-64fcb94b",
57
+ "@blocklet/server-js": "1.16.53-beta-20251013-075536-64fcb94b",
58
+ "@blocklet/store": "1.16.53-beta-20251013-075536-64fcb94b",
59
59
  "@blocklet/theme": "^3.1.45",
60
60
  "@fidm/x509": "^1.2.1",
61
61
  "@ocap/mcrypto": "1.25.6",
@@ -120,5 +120,5 @@
120
120
  "jest": "^29.7.0",
121
121
  "unzipper": "^0.10.11"
122
122
  },
123
- "gitHead": "fa6cf9ee72911e51fb53cfbee9dfc0e781c60bd4"
123
+ "gitHead": "0c9fd57c3ffd075ed9f0ed365f76167f91f11f5a"
124
124
  }