@abtnode/core 1.16.27-beta-91ff0d1b → 1.16.27-beta-725ce3a6

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
@@ -282,8 +282,9 @@ class TeamAPI extends EventEmitter {
282
282
  }
283
283
  const now = Date.now();
284
284
  let sessionTtl = SESSION_TTL;
285
+ let blocklet;
285
286
  if (teamDid !== nodeInfo.did) {
286
- const blocklet = await getBlocklet({ did: teamDid, states: this.states, dataDirs: this.dataDirs });
287
+ blocklet = await getBlocklet({ did: teamDid, states: this.states, dataDirs: this.dataDirs });
287
288
  sessionTtl = blocklet.settings?.session?.ttl || SESSION_TTL;
288
289
  }
289
290
 
@@ -314,11 +315,17 @@ class TeamAPI extends EventEmitter {
314
315
  'sourceAppPid',
315
316
  'connectedAccounts',
316
317
  ]);
317
- if (pickData?.userSessions) {
318
- pickData.userSessions = pickData.userSessions.map((x) => {
319
- const status = now - new Date(x.updatedAt).getTime() > sessionTtl * 1000 ? 'expired' : x.status;
320
- return { ...x, status };
321
- });
318
+ if (teamDid !== nodeInfo.did) {
319
+ if (pickData?.userSessions) {
320
+ pickData.userSessions = pickData.userSessions
321
+ .filter((x) => {
322
+ return x.appPid === blocklet?.appPid;
323
+ })
324
+ .map((x) => {
325
+ const status = now - new Date(x.updatedAt).getTime() > sessionTtl * 1000 ? 'expired' : x.status;
326
+ return { ...x, status };
327
+ });
328
+ }
322
329
  }
323
330
  return pickData;
324
331
  }
@@ -1338,8 +1345,6 @@ class TeamAPI extends EventEmitter {
1338
1345
  throw new Error(`Blocklet registry already exist: ${sanitized}`);
1339
1346
  }
1340
1347
 
1341
- await StoreUtil.validateStoreUrl(sanitized);
1342
-
1343
1348
  const store = await StoreUtil.getStoreMeta(sanitized);
1344
1349
 
1345
1350
  const existById = storeList.find((x) => x.id === store.id);
@@ -72,6 +72,7 @@ const {
72
72
  BLOCKLET_PREFERENCE_FILE,
73
73
  BLOCKLET_PREFERENCE_PREFIX,
74
74
  BLOCKLET_RESOURCE_DIR,
75
+ BLOCKLET_TENANT_MODES,
75
76
  } = require('@blocklet/constant');
76
77
  const validateBlockletEntry = require('@blocklet/meta/lib/entry');
77
78
  const getBlockletEngine = require('@blocklet/meta/lib/engine');
@@ -333,6 +334,7 @@ const getAppSystemEnvironments = (blocklet, nodeInfo, dataDirs) => {
333
334
  BLOCKLET_APP_DESCRIPTION: appDescription,
334
335
  BLOCKLET_APP_URL: appUrl,
335
336
  BLOCKLET_APP_DATA_DIR: path.join(dataDirs.data, blocklet.meta.name),
337
+ BLOCKLET_APP_TENANT_MODE: result.tenantMode || BLOCKLET_TENANT_MODES.SINGLE,
336
338
  };
337
339
  };
338
340
 
package/lib/util/store.js CHANGED
@@ -46,22 +46,6 @@ const fixAndVerifyMetaFromStore = (meta) => {
46
46
  return fixAndValidateService(meta);
47
47
  };
48
48
 
49
- const validateStoreUrl = async (registry) => {
50
- const url = joinUrl(registry, BLOCKLET_STORE_API_PREFIX, `/blocklets.json?__t__=${Date.now()}`);
51
- try {
52
- const res = await request.get(url);
53
- if (Array.isArray(res.data)) {
54
- return res.data;
55
- }
56
-
57
- logger.error('Blocklet list fetch failed ', { url, data: res.data });
58
- throw new Error('blocklet list fetch failed');
59
- } catch (error) {
60
- logger.error('Blocklet registry refresh failed', { url, error });
61
- throw new Error(`Invalid Blocklet Registry URL ${registry}: ${error.message}`);
62
- }
63
- };
64
-
65
49
  const getStoreMeta = async (registry) => {
66
50
  try {
67
51
  const url = joinUrl(registry, BLOCKLET_STORE_META_PATH, `?__t__=${Date.now()}`);
@@ -71,14 +55,13 @@ const getStoreMeta = async (registry) => {
71
55
  return {};
72
56
  }
73
57
 
74
- const requiredFields = ['name', 'description', 'maintainer'];
75
-
58
+ const requiredFields = ['name', 'description'];
76
59
  const missingFields = requiredFields.filter((x) => !data[x]);
77
60
  if (missingFields.length > 0) {
78
- throw new Error(`the registry missing required information: ${missingFields.join(', ')}`);
61
+ throw new Error(`the store missing required information: ${missingFields.join(', ')}`);
79
62
  }
80
63
 
81
- const result = pick(data, ['id', 'name', 'description', 'maintainer', 'cdnUrl', 'chainHost']);
64
+ const result = pick(data, ['id', 'name', 'description', 'cdnUrl', 'chainHost']);
82
65
  const { logoUrl } = data;
83
66
  if (logoUrl) {
84
67
  if (logoUrl.startsWith('http') === true) {
@@ -92,7 +75,7 @@ const getStoreMeta = async (registry) => {
92
75
 
93
76
  return result;
94
77
  } catch (err) {
95
- throw new Error(`Can not get meta info for registry [${registry}]: ${err.message}`);
78
+ throw new Error(`Can not get meta info for store [${registry}]: ${err.message}`);
96
79
  }
97
80
  };
98
81
 
@@ -172,7 +155,6 @@ const getBlockletMeta = async ({ did, storeUrl }) => {
172
155
  };
173
156
 
174
157
  module.exports = {
175
- validateStoreUrl,
176
158
  getStoreMeta,
177
159
  parseSourceUrl,
178
160
  getBlockletMeta,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.27-beta-91ff0d1b",
6
+ "version": "1.16.27-beta-725ce3a6",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,40 +19,40 @@
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.27-beta-91ff0d1b",
23
- "@abtnode/auth": "1.16.27-beta-91ff0d1b",
24
- "@abtnode/certificate-manager": "1.16.27-beta-91ff0d1b",
25
- "@abtnode/constant": "1.16.27-beta-91ff0d1b",
26
- "@abtnode/cron": "1.16.27-beta-91ff0d1b",
27
- "@abtnode/logger": "1.16.27-beta-91ff0d1b",
28
- "@abtnode/models": "1.16.27-beta-91ff0d1b",
29
- "@abtnode/queue": "1.16.27-beta-91ff0d1b",
30
- "@abtnode/rbac": "1.16.27-beta-91ff0d1b",
31
- "@abtnode/router-provider": "1.16.27-beta-91ff0d1b",
32
- "@abtnode/static-server": "1.16.27-beta-91ff0d1b",
33
- "@abtnode/timemachine": "1.16.27-beta-91ff0d1b",
34
- "@abtnode/util": "1.16.27-beta-91ff0d1b",
35
- "@arcblock/did": "1.18.115",
36
- "@arcblock/did-auth": "1.18.115",
37
- "@arcblock/did-ext": "^1.18.115",
22
+ "@abtnode/analytics": "1.16.27-beta-725ce3a6",
23
+ "@abtnode/auth": "1.16.27-beta-725ce3a6",
24
+ "@abtnode/certificate-manager": "1.16.27-beta-725ce3a6",
25
+ "@abtnode/constant": "1.16.27-beta-725ce3a6",
26
+ "@abtnode/cron": "1.16.27-beta-725ce3a6",
27
+ "@abtnode/logger": "1.16.27-beta-725ce3a6",
28
+ "@abtnode/models": "1.16.27-beta-725ce3a6",
29
+ "@abtnode/queue": "1.16.27-beta-725ce3a6",
30
+ "@abtnode/rbac": "1.16.27-beta-725ce3a6",
31
+ "@abtnode/router-provider": "1.16.27-beta-725ce3a6",
32
+ "@abtnode/static-server": "1.16.27-beta-725ce3a6",
33
+ "@abtnode/timemachine": "1.16.27-beta-725ce3a6",
34
+ "@abtnode/util": "1.16.27-beta-725ce3a6",
35
+ "@arcblock/did": "1.18.120",
36
+ "@arcblock/did-auth": "1.18.120",
37
+ "@arcblock/did-ext": "^1.18.120",
38
38
  "@arcblock/did-motif": "^1.1.13",
39
- "@arcblock/did-util": "1.18.115",
40
- "@arcblock/event-hub": "1.18.115",
41
- "@arcblock/jwt": "^1.18.115",
39
+ "@arcblock/did-util": "1.18.120",
40
+ "@arcblock/event-hub": "1.18.120",
41
+ "@arcblock/jwt": "^1.18.120",
42
42
  "@arcblock/pm2-events": "^0.0.5",
43
- "@arcblock/validator": "^1.18.115",
44
- "@arcblock/vc": "1.18.115",
45
- "@blocklet/constant": "1.16.27-beta-91ff0d1b",
46
- "@blocklet/env": "1.16.27-beta-91ff0d1b",
47
- "@blocklet/meta": "1.16.27-beta-91ff0d1b",
48
- "@blocklet/resolver": "1.16.27-beta-91ff0d1b",
49
- "@blocklet/sdk": "1.16.27-beta-91ff0d1b",
50
- "@blocklet/store": "1.16.27-beta-91ff0d1b",
51
- "@did-space/client": "^0.4.3",
43
+ "@arcblock/validator": "^1.18.120",
44
+ "@arcblock/vc": "1.18.120",
45
+ "@blocklet/constant": "1.16.27-beta-725ce3a6",
46
+ "@blocklet/env": "1.16.27-beta-725ce3a6",
47
+ "@blocklet/meta": "1.16.27-beta-725ce3a6",
48
+ "@blocklet/resolver": "1.16.27-beta-725ce3a6",
49
+ "@blocklet/sdk": "1.16.27-beta-725ce3a6",
50
+ "@blocklet/store": "1.16.27-beta-725ce3a6",
51
+ "@did-space/client": "^0.4.5",
52
52
  "@fidm/x509": "^1.2.1",
53
- "@ocap/mcrypto": "1.18.115",
54
- "@ocap/util": "1.18.115",
55
- "@ocap/wallet": "1.18.115",
53
+ "@ocap/mcrypto": "1.18.120",
54
+ "@ocap/util": "1.18.120",
55
+ "@ocap/wallet": "1.18.120",
56
56
  "@slack/webhook": "^5.0.4",
57
57
  "archiver": "^7.0.1",
58
58
  "axios": "^0.27.2",
@@ -103,5 +103,5 @@
103
103
  "jest": "^29.7.0",
104
104
  "unzipper": "^0.10.11"
105
105
  },
106
- "gitHead": "5c8d1719acb88ae62298293030860c79b0124692"
106
+ "gitHead": "6110607f520136996b78b8d9c05a0744016dfa21"
107
107
  }