@abtnode/core 1.6.9 → 1.6.10

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.
@@ -24,7 +24,7 @@ const { updateBlocklet: updateDidDocument } = require('@abtnode/util/lib/did-doc
24
24
  const { BLOCKLET_PURCHASE_NFT_TYPE } = require('@abtnode/constant');
25
25
 
26
26
  const getBlockletEngine = require('@blocklet/meta/lib/engine');
27
- const { isFreeBlocklet, getRequiredMissingConfigs } = require('@blocklet/meta/lib/util');
27
+ const { isFreeBlocklet, isDeletableBlocklet, getRequiredMissingConfigs } = require('@blocklet/meta/lib/util');
28
28
  const validateBlockletEntry = require('@blocklet/meta/lib/entry');
29
29
  const { getBlockletInfo } = require('@blocklet/meta/lib');
30
30
 
@@ -381,6 +381,9 @@ class BlockletManager extends BaseBlockletManager {
381
381
 
382
382
  try {
383
383
  const blocklet = await this.ensureBlocklet(did);
384
+ if (isDeletableBlocklet(blocklet) === false) {
385
+ throw new Error('Blocklet is protected from accidental deletion');
386
+ }
384
387
 
385
388
  const nodeEnvironments = await states.node.getEnvironments();
386
389
 
@@ -540,6 +543,12 @@ class BlockletManager extends BaseBlockletManager {
540
543
  }
541
544
  }
542
545
 
546
+ if (x.key === 'BLOCKLET_DELETABLE') {
547
+ if (['yes', 'no'].includes(x.value) === false) {
548
+ throw new Error('BLOCKLET_DELETABLE must be either "yes" or "no"');
549
+ }
550
+ }
551
+
543
552
  blocklet.configObj[x.key] = x.value;
544
553
  }
545
554
 
@@ -1506,6 +1515,15 @@ class BlockletManager extends BaseBlockletManager {
1506
1515
  return null;
1507
1516
  }
1508
1517
 
1518
+ // When new version found from the store where the blocklet was installed from, we should use that store first
1519
+ if (blocklet.source === BlockletSource.registry && blocklet.deployedFrom) {
1520
+ const latestFromSameRegistry = versions.find((x) => x.registryUrl === blocklet.deployedFrom);
1521
+ if (latestFromSameRegistry) {
1522
+ return latestFromSameRegistry;
1523
+ }
1524
+ }
1525
+
1526
+ // Otherwise try upgrading from other store
1509
1527
  let latestBlockletVersion = versions[0];
1510
1528
  versions.forEach((item) => {
1511
1529
  if (semver.lt(latestBlockletVersion.version, item.version)) {
package/lib/util/ready.js CHANGED
@@ -33,7 +33,7 @@ const createStateReadyHandler =
33
33
  console.error('Sharing data dir between Blocklet Server instances may break things!');
34
34
  console.error('======================================================\x1b[0m');
35
35
  console.log('\nIf you intend to use this dir:');
36
- console.log(` 1. Stop Blocklet Server by ${chalk.cyan('abtnode stop --force')}`);
36
+ console.log(` 1. Stop Blocklet Server by ${chalk.cyan('blocklet server stop --force')}`);
37
37
  console.log(` 2. Clear data dir by ${chalk.cyan(`rm -r ${options.dataDir}`)}`);
38
38
  console.log(' 3. Reinitialize and start Blocklet Server');
39
39
  process.exit(1);
@@ -76,8 +76,8 @@ module.exports = ({ events, dataDirs, instance }) => {
76
76
  const senderInstance = WebHookSender.getMessageSender(item.type);
77
77
  senderFns[item.type] = senderInstance.send.bind(senderInstance);
78
78
  }
79
- const { description } = nodeInfo;
80
- const options = { ...message, nodeInfo: `*${description}*` };
79
+ const { name } = nodeInfo;
80
+ const options = { ...message, nodeInfo: `*${name}*` };
81
81
  if (item.type === 'slack') {
82
82
  options.urlInfo = getSlackUrlInfo(message.action, baseUrls);
83
83
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.6.9",
6
+ "version": "1.6.10",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,22 +19,22 @@
19
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@abtnode/certificate-manager": "1.6.9",
23
- "@abtnode/constant": "1.6.9",
24
- "@abtnode/cron": "1.6.9",
25
- "@abtnode/db": "1.6.9",
26
- "@abtnode/logger": "1.6.9",
27
- "@abtnode/queue": "1.6.9",
28
- "@abtnode/rbac": "1.6.9",
29
- "@abtnode/router-provider": "1.6.9",
30
- "@abtnode/static-server": "1.6.9",
31
- "@abtnode/timemachine": "1.6.9",
32
- "@abtnode/util": "1.6.9",
22
+ "@abtnode/certificate-manager": "1.6.10",
23
+ "@abtnode/constant": "1.6.10",
24
+ "@abtnode/cron": "1.6.10",
25
+ "@abtnode/db": "1.6.10",
26
+ "@abtnode/logger": "1.6.10",
27
+ "@abtnode/queue": "1.6.10",
28
+ "@abtnode/rbac": "1.6.10",
29
+ "@abtnode/router-provider": "1.6.10",
30
+ "@abtnode/static-server": "1.6.10",
31
+ "@abtnode/timemachine": "1.6.10",
32
+ "@abtnode/util": "1.6.10",
33
33
  "@arcblock/did": "^1.13.79",
34
34
  "@arcblock/event-hub": "1.13.79",
35
35
  "@arcblock/pm2-events": "^0.0.5",
36
36
  "@arcblock/vc": "^1.13.79",
37
- "@blocklet/meta": "1.6.9",
37
+ "@blocklet/meta": "1.6.10",
38
38
  "@fidm/x509": "^1.2.1",
39
39
  "@nedb/core": "^1.2.2",
40
40
  "@nedb/multi": "^1.2.2",
@@ -75,5 +75,5 @@
75
75
  "express": "^4.17.1",
76
76
  "jest": "^27.4.5"
77
77
  },
78
- "gitHead": "372e95513bd9a510702d93650c0c004589579cb3"
78
+ "gitHead": "90aa29d892f9f54c87faa3041daec042997fffcc"
79
79
  }