@abtnode/core 1.16.27-beta-426c1690 → 1.16.27-beta-d27e19fa

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.
@@ -810,9 +810,9 @@ class DiskBlockletManager extends BaseBlockletManager {
810
810
 
811
811
  const error = Array.isArray(err) ? err[0] : err;
812
812
  logger.error('Failed to start blocklet', { error, did, title: blocklet1.meta.title });
813
- const description = `${getComponentNamesWithVersion(blocklet1, componentDids)} start failed for ${
814
- blocklet1.meta.title
815
- }: ${error.message}`;
813
+ const description = `${getComponentNamesWithVersion(blocklet1, componentDids)} start failed for ${getDisplayName(
814
+ blocklet1
815
+ )}: ${error.message}`;
816
816
  this._createNotification(did, {
817
817
  title: 'Component start failed',
818
818
  description,
@@ -899,7 +899,7 @@ class DiskBlockletManager extends BaseBlockletManager {
899
899
 
900
900
  let description = `${
901
901
  componentDids?.length ? getComponentNamesWithVersion(blocklet, componentDids) : 'All components'
902
- } is successfully stopped for ${blocklet.meta.title}.`;
902
+ } is successfully stopped for ${getDisplayName(blocklet)}.`;
903
903
 
904
904
  if (reason === SUSPENDED_REASON.expired) {
905
905
  description = `${description} Reason: The subscription has expired.`;
@@ -998,9 +998,9 @@ class DiskBlockletManager extends BaseBlockletManager {
998
998
  const state = await states.blocklet.setBlockletStatus(did, BlockletStatus.stopped, { componentDids });
999
999
  this.emit(BlockletEvents.statusChange, state);
1000
1000
 
1001
- const description = `${getComponentNamesWithVersion(result, componentDids)} restart failed for ${
1002
- result.meta.title
1003
- }: ${err.message || 'queue exception'}`;
1001
+ const description = `${getComponentNamesWithVersion(result, componentDids)} restart failed for ${getDisplayName(
1002
+ result
1003
+ )}: ${err.message || 'queue exception'}`;
1004
1004
  this._createNotification(did, {
1005
1005
  title: 'Component restart failed',
1006
1006
  description,
@@ -1067,7 +1067,7 @@ class DiskBlockletManager extends BaseBlockletManager {
1067
1067
  const doc = await this._deleteBlocklet({ did, keepData, keepLogsDir, keepConfigs }, context);
1068
1068
  this._createNotification(doc.meta.did, {
1069
1069
  title: 'Blocklet Deleted',
1070
- description: `Blocklet ${doc.meta.title} is deleted.`,
1070
+ description: `Blocklet ${getDisplayName(blocklet)} is deleted.`,
1071
1071
  entityType: 'blocklet',
1072
1072
  entityId: doc.meta.did,
1073
1073
  severity: 'success',
@@ -1080,7 +1080,7 @@ class DiskBlockletManager extends BaseBlockletManager {
1080
1080
 
1081
1081
  this._createNotification(doc.meta.did, {
1082
1082
  title: 'Blocklet Deleted',
1083
- description: `Blocklet ${doc.meta.title} is deleted.`,
1083
+ description: `Blocklet ${getDisplayName(blocklet)} is deleted.`,
1084
1084
  entityType: 'blocklet',
1085
1085
  entityId: doc.meta.did,
1086
1086
  severity: 'success',
@@ -1239,7 +1239,7 @@ class DiskBlockletManager extends BaseBlockletManager {
1239
1239
 
1240
1240
  this._createNotification(newBlocklet.meta.did, {
1241
1241
  title: 'Component delete succeed',
1242
- description: `${child.meta.title} is successfully deleted for ${newBlocklet.meta.title}.`,
1242
+ description: `${child.meta.title} is successfully deleted for ${getDisplayName(newBlocklet)}.`,
1243
1243
  entityType: 'blocklet',
1244
1244
  entityId: newBlocklet.meta.did,
1245
1245
  severity: 'success',
@@ -1429,6 +1429,7 @@ class DiskBlockletManager extends BaseBlockletManager {
1429
1429
  }
1430
1430
 
1431
1431
  const configObj = {};
1432
+ const ignoredKeys = [];
1432
1433
  for (const x of newConfigs) {
1433
1434
  if (['CHAIN_TYPE', 'BLOCKLET_APP_CHAIN_TYPE'].includes(x.key)) {
1434
1435
  throw new Error(`${x.key} should not be changed`);
@@ -1445,14 +1446,16 @@ class DiskBlockletManager extends BaseBlockletManager {
1445
1446
  } else if (!BLOCKLET_CONFIGURABLE_KEY[x.key] && !isPreferenceKey(x)) {
1446
1447
  const hasEnvInMeta = (b) => (b.meta.environments || []).some((y) => y.name === x.key);
1447
1448
  if (!hasEnvInMeta(blocklet)) {
1448
- // forbid unknown format key
1449
+ // forbid unknown environment items
1449
1450
  if (
1450
1451
  // config should in component.meta.environments
1451
1452
  childDid ||
1452
1453
  // config should in app.meta.environments and or in one of component.meta.environments
1453
1454
  !(blocklet.children || []).some(hasEnvInMeta)
1454
1455
  ) {
1455
- throw new Error(`unknown format key: ${x.key}`);
1456
+ logger.warn(`unknown environment item: ${x.key}`, { rootDid, childDid, config: x });
1457
+ ignoredKeys.push(x.key);
1458
+ continue;
1456
1459
  }
1457
1460
  }
1458
1461
  }
@@ -1460,7 +1463,8 @@ class DiskBlockletManager extends BaseBlockletManager {
1460
1463
  configObj[x.key] = x.value;
1461
1464
  }
1462
1465
 
1463
- const willAppSkChange = isRotatingAppSk(newConfigs, blocklet.configs, blocklet.externalSk);
1466
+ const finalConfigs = newConfigs.filter((x) => !ignoredKeys.includes(x.key));
1467
+ const willAppSkChange = isRotatingAppSk(finalConfigs, blocklet.configs, blocklet.externalSk);
1464
1468
 
1465
1469
  // NOTICE: cannot use appDid as did param because appDid will become old appDid in alsoKnownAs and cannot get blocklet by the old appDid
1466
1470
  if (willAppSkChange && rootDid !== rootMetaDid) {
@@ -1486,7 +1490,7 @@ class DiskBlockletManager extends BaseBlockletManager {
1486
1490
 
1487
1491
  // update db
1488
1492
  if (childDid) {
1489
- const { sharedConfigs, selfConfigs } = getConfigsFromInput(newConfigs, blocklet.configs);
1493
+ const { sharedConfigs, selfConfigs } = getConfigsFromInput(finalConfigs, blocklet.configs);
1490
1494
 
1491
1495
  if (sharedConfigs.length) {
1492
1496
  await states.blockletExtras.setConfigs([rootMetaDid], sharedConfigs);
@@ -1495,7 +1499,7 @@ class DiskBlockletManager extends BaseBlockletManager {
1495
1499
  await states.blockletExtras.setConfigs([rootMetaDid, childDid], selfConfigs);
1496
1500
  }
1497
1501
  } else {
1498
- await states.blockletExtras.setConfigs([rootMetaDid], newConfigs);
1502
+ await states.blockletExtras.setConfigs([rootMetaDid], finalConfigs);
1499
1503
  }
1500
1504
 
1501
1505
  if (willAppSkChange) {
@@ -1511,14 +1515,14 @@ class DiskBlockletManager extends BaseBlockletManager {
1511
1515
  }
1512
1516
 
1513
1517
  // Reload nginx to make sure did-space can embed content from this app
1514
- if (newConfigs.find((x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT)?.value) {
1518
+ if (finalConfigs.find((x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT)?.value) {
1515
1519
  this.emit(BlockletEvents.spaceConnected, blocklet);
1516
1520
  }
1517
1521
 
1518
1522
  // update blocklet meta
1519
1523
  if (blocklet.structVersion && !childDid) {
1520
- const changedTitle = newConfigs.find((x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME)?.value;
1521
- const changedDescription = newConfigs.find(
1524
+ const changedTitle = finalConfigs.find((x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME)?.value;
1525
+ const changedDescription = finalConfigs.find(
1522
1526
  (x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION
1523
1527
  )?.value;
1524
1528
 
@@ -1534,7 +1538,7 @@ class DiskBlockletManager extends BaseBlockletManager {
1534
1538
  }
1535
1539
 
1536
1540
  // chain config
1537
- await this._ensureAppChainConfig(rootMetaDid, newConfigs);
1541
+ await this._ensureAppChainConfig(rootMetaDid, finalConfigs);
1538
1542
 
1539
1543
  await this._updateBlockletEnvironment(rootDid);
1540
1544
 
@@ -1546,10 +1550,10 @@ class DiskBlockletManager extends BaseBlockletManager {
1546
1550
  }
1547
1551
 
1548
1552
  if (!skipEmitEvents) {
1549
- if (!childDid && !newConfigs.some((x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK)) {
1553
+ if (!childDid && !finalConfigs.some((x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK)) {
1550
1554
  this.emit(BlockletInternalEvents.appConfigChanged, {
1551
1555
  appDid: rootDid,
1552
- configs: newConfigs.map((x) => ({ key: x.key, value: x.value })),
1556
+ configs: finalConfigs.map((x) => ({ key: x.key, value: x.value })),
1553
1557
  });
1554
1558
  this.configSynchronizer.throttledSyncAppConfig(blocklet.meta.did);
1555
1559
  }
@@ -1557,7 +1561,7 @@ class DiskBlockletManager extends BaseBlockletManager {
1557
1561
  this.emit(BlockletEvents.updated, { ...newState, context });
1558
1562
  const serverSk = (await states.node.read()).sk;
1559
1563
  if (childDid) {
1560
- const configs = JSON.stringify(newConfigs.map((x) => ({ key: x.key, value: x.value })));
1564
+ const configs = JSON.stringify(finalConfigs.map((x) => ({ key: x.key, value: x.value })));
1561
1565
  this.emit(BlockletInternalEvents.componentConfigChanged, {
1562
1566
  appDid: rootDid,
1563
1567
  componentDid: childDid,
@@ -1578,7 +1582,7 @@ class DiskBlockletManager extends BaseBlockletManager {
1578
1582
  BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON,
1579
1583
  ];
1580
1584
 
1581
- const shouldSendWalletNotification = observableConfigs.some((x) => newConfigs.some((y) => y.key === x));
1585
+ const shouldSendWalletNotification = observableConfigs.some((x) => finalConfigs.some((y) => y.key === x));
1582
1586
 
1583
1587
  if (shouldSendWalletNotification) {
1584
1588
  // notify launcher config changed
@@ -2425,7 +2429,7 @@ class DiskBlockletManager extends BaseBlockletManager {
2425
2429
  } = params;
2426
2430
  logger.info('_downloadAndInstall', { did: blocklet?.meta?.did });
2427
2431
  const { meta } = blocklet;
2428
- const { title, name, did, version } = meta;
2432
+ const { name, did, version } = meta;
2429
2433
 
2430
2434
  // check status
2431
2435
  if (!skipCheckStatusBeforeDownload) {
@@ -2499,7 +2503,7 @@ class DiskBlockletManager extends BaseBlockletManager {
2499
2503
  title: 'Component download failed',
2500
2504
  description: `${childrenToDownload
2501
2505
  .map((x) => `${x.meta.title}@${x.meta.version}`)
2502
- .join(', ')} download failed for ${title}: ${err.message}`,
2506
+ .join(', ')} download failed for ${getDisplayName(blocklet)}: ${err.message}`,
2503
2507
  entityType: 'blocklet',
2504
2508
  entityId: did,
2505
2509
  severity: 'error',
@@ -2647,7 +2651,7 @@ class DiskBlockletManager extends BaseBlockletManager {
2647
2651
  const blocklet = await this.getBlocklet(did);
2648
2652
 
2649
2653
  const { meta } = blocklet;
2650
- const { name, title } = meta;
2654
+ const { name } = meta;
2651
2655
 
2652
2656
  try {
2653
2657
  // healthy check
@@ -2674,7 +2678,9 @@ class DiskBlockletManager extends BaseBlockletManager {
2674
2678
 
2675
2679
  const componentNames = getComponentNamesWithVersion(blocklet, componentDids);
2676
2680
  const description = componentNames
2677
- ? `${getComponentNamesWithVersion(blocklet, componentDids)} is successfully started for ${blocklet.meta.title}.`
2681
+ ? `${getComponentNamesWithVersion(blocklet, componentDids)} is successfully started for ${getDisplayName(
2682
+ blocklet
2683
+ )}.`
2678
2684
  : `${blocklet.meta.title} is successfully started`;
2679
2685
  this._createNotification(did, {
2680
2686
  title: 'Component start succeed',
@@ -2701,7 +2707,9 @@ class DiskBlockletManager extends BaseBlockletManager {
2701
2707
 
2702
2708
  const componentNames = getComponentNamesWithVersion(blocklet, componentDids);
2703
2709
  const description = componentNames
2704
- ? `${getComponentNamesWithVersion(blocklet, componentDids)} start failed for ${title}: ${error.message}`
2710
+ ? `${getComponentNamesWithVersion(blocklet, componentDids)} start failed for ${getDisplayName(blocklet)}: ${
2711
+ error.message
2712
+ }`
2705
2713
  : `${blocklet.meta.title} start failed: ${error.message}`;
2706
2714
 
2707
2715
  this._createNotification(did, {
@@ -3505,7 +3513,8 @@ class DiskBlockletManager extends BaseBlockletManager {
3505
3513
 
3506
3514
  async _upgradeBlocklet({ newBlocklet, oldBlocklet, componentDids, action, context = {} }) {
3507
3515
  const { meta, source, deployedFrom, children } = newBlocklet;
3508
- const { did, version, name, title } = meta;
3516
+ const { did, version, name } = meta;
3517
+ const title = getDisplayName(newBlocklet);
3509
3518
 
3510
3519
  try {
3511
3520
  // delete old process
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.27-beta-426c1690",
6
+ "version": "1.16.27-beta-d27e19fa",
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-426c1690",
23
- "@abtnode/auth": "1.16.27-beta-426c1690",
24
- "@abtnode/certificate-manager": "1.16.27-beta-426c1690",
25
- "@abtnode/constant": "1.16.27-beta-426c1690",
26
- "@abtnode/cron": "1.16.27-beta-426c1690",
27
- "@abtnode/logger": "1.16.27-beta-426c1690",
28
- "@abtnode/models": "1.16.27-beta-426c1690",
29
- "@abtnode/queue": "1.16.27-beta-426c1690",
30
- "@abtnode/rbac": "1.16.27-beta-426c1690",
31
- "@abtnode/router-provider": "1.16.27-beta-426c1690",
32
- "@abtnode/static-server": "1.16.27-beta-426c1690",
33
- "@abtnode/timemachine": "1.16.27-beta-426c1690",
34
- "@abtnode/util": "1.16.27-beta-426c1690",
35
- "@arcblock/did": "1.18.121",
36
- "@arcblock/did-auth": "1.18.121",
37
- "@arcblock/did-ext": "^1.18.121",
22
+ "@abtnode/analytics": "1.16.27-beta-d27e19fa",
23
+ "@abtnode/auth": "1.16.27-beta-d27e19fa",
24
+ "@abtnode/certificate-manager": "1.16.27-beta-d27e19fa",
25
+ "@abtnode/constant": "1.16.27-beta-d27e19fa",
26
+ "@abtnode/cron": "1.16.27-beta-d27e19fa",
27
+ "@abtnode/logger": "1.16.27-beta-d27e19fa",
28
+ "@abtnode/models": "1.16.27-beta-d27e19fa",
29
+ "@abtnode/queue": "1.16.27-beta-d27e19fa",
30
+ "@abtnode/rbac": "1.16.27-beta-d27e19fa",
31
+ "@abtnode/router-provider": "1.16.27-beta-d27e19fa",
32
+ "@abtnode/static-server": "1.16.27-beta-d27e19fa",
33
+ "@abtnode/timemachine": "1.16.27-beta-d27e19fa",
34
+ "@abtnode/util": "1.16.27-beta-d27e19fa",
35
+ "@arcblock/did": "1.18.123",
36
+ "@arcblock/did-auth": "1.18.123",
37
+ "@arcblock/did-ext": "^1.18.123",
38
38
  "@arcblock/did-motif": "^1.1.13",
39
- "@arcblock/did-util": "1.18.121",
40
- "@arcblock/event-hub": "1.18.121",
41
- "@arcblock/jwt": "^1.18.121",
39
+ "@arcblock/did-util": "1.18.123",
40
+ "@arcblock/event-hub": "1.18.123",
41
+ "@arcblock/jwt": "^1.18.123",
42
42
  "@arcblock/pm2-events": "^0.0.5",
43
- "@arcblock/validator": "^1.18.121",
44
- "@arcblock/vc": "1.18.121",
45
- "@blocklet/constant": "1.16.27-beta-426c1690",
46
- "@blocklet/env": "1.16.27-beta-426c1690",
47
- "@blocklet/meta": "1.16.27-beta-426c1690",
48
- "@blocklet/resolver": "1.16.27-beta-426c1690",
49
- "@blocklet/sdk": "1.16.27-beta-426c1690",
50
- "@blocklet/store": "1.16.27-beta-426c1690",
51
- "@did-space/client": "^0.4.19",
43
+ "@arcblock/validator": "^1.18.123",
44
+ "@arcblock/vc": "1.18.123",
45
+ "@blocklet/constant": "1.16.27-beta-d27e19fa",
46
+ "@blocklet/env": "1.16.27-beta-d27e19fa",
47
+ "@blocklet/meta": "1.16.27-beta-d27e19fa",
48
+ "@blocklet/resolver": "1.16.27-beta-d27e19fa",
49
+ "@blocklet/sdk": "1.16.27-beta-d27e19fa",
50
+ "@blocklet/store": "1.16.27-beta-d27e19fa",
51
+ "@did-space/client": "^0.4.20",
52
52
  "@fidm/x509": "^1.2.1",
53
- "@ocap/mcrypto": "1.18.121",
54
- "@ocap/util": "1.18.121",
55
- "@ocap/wallet": "1.18.121",
53
+ "@ocap/mcrypto": "1.18.123",
54
+ "@ocap/util": "1.18.123",
55
+ "@ocap/wallet": "1.18.123",
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": "96208341e13a7fd959a7b99e7906fe441a63060b"
106
+ "gitHead": "7a83c248c1e5738e6d95e54fc26699f865479dab"
107
107
  }