@abtnode/core 1.6.29 → 1.7.0

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.
@@ -252,8 +252,9 @@ class BlockletManager extends BaseBlockletManager {
252
252
  }
253
253
 
254
254
  const blocklet = await states.blocklet.getBlocklet(meta.did);
255
+ const isRunning = blocklet?.status === BlockletStatus.running;
255
256
 
256
- return { meta, isFree, isInstalled: !!blocklet };
257
+ return { meta, isFree, isInstalled: !!blocklet, isRunning };
257
258
  }
258
259
 
259
260
  async installBlockletFromVc({ vcPresentation, challenge }, context) {
@@ -1594,7 +1595,7 @@ class BlockletManager extends BaseBlockletManager {
1594
1595
  const newBlocklet = await states.blocklet.getBlocklet(did);
1595
1596
  newBlocklet.meta = meta;
1596
1597
  newBlocklet.source = BlockletSource.upload;
1597
- newBlocklet.deployedFrom = `Upload by ${context.user.did}`;
1598
+ newBlocklet.deployedFrom = `Upload by ${context.user.fullName}`;
1598
1599
  newBlocklet.children = await this._getChildren(meta);
1599
1600
  await validateBlocklet(newBlocklet);
1600
1601
  await this._downloadBlocklet(newBlocklet, oldBlocklet);
@@ -1620,7 +1621,7 @@ class BlockletManager extends BaseBlockletManager {
1620
1621
  const newBlocklet = await states.blocklet.getBlocklet(meta.did);
1621
1622
  newBlocklet.meta = meta;
1622
1623
  newBlocklet.source = BlockletSource.upload;
1623
- newBlocklet.deployedFrom = `Upload by ${context.user.did}`;
1624
+ newBlocklet.deployedFrom = `Upload by ${context.user.fullName}`;
1624
1625
  newBlocklet.children = await this._getChildren(meta);
1625
1626
 
1626
1627
  await validateBlocklet(newBlocklet);
@@ -1639,7 +1640,7 @@ class BlockletManager extends BaseBlockletManager {
1639
1640
  did: meta.did,
1640
1641
  meta,
1641
1642
  source: BlockletSource.upload,
1642
- deployedFrom: `Upload by ${context.user.did}`,
1643
+ deployedFrom: `Upload by ${context.user.fullName}`,
1643
1644
  children,
1644
1645
  });
1645
1646
 
@@ -1,3 +1,4 @@
1
+ const get = require('lodash/get');
1
2
  const { fromRandom } = require('@ocap/wallet');
2
3
  const { toBase58 } = require('@ocap/util');
3
4
  const logger = require('@abtnode/logger')('@abtnode/core:access-key');
@@ -15,6 +16,8 @@ const validatePassport = (passport) => {
15
16
  }
16
17
  };
17
18
 
19
+ const getUserName = (context) => get(context, 'user.fullName', '');
20
+
18
21
  class AccessKeyState extends BaseState {
19
22
  constructor(baseDir, options = {}) {
20
23
  super(baseDir, { filename: 'access_key.db', ...options });
@@ -26,7 +29,6 @@ class AccessKeyState extends BaseState {
26
29
  });
27
30
  }
28
31
 
29
- // eslint-disable-next-line no-unused-vars
30
32
  async create(input = {}, context) {
31
33
  const { remark, passport } = input;
32
34
 
@@ -42,6 +44,10 @@ class AccessKeyState extends BaseState {
42
44
  if (remark) {
43
45
  data.remark = remark;
44
46
  }
47
+
48
+ data.createdBy = getUserName(context);
49
+ data.updatedBy = getUserName(context);
50
+
45
51
  const doc = await this.asyncDB.insert(data);
46
52
  return {
47
53
  ...doc,
@@ -84,6 +90,7 @@ class AccessKeyState extends BaseState {
84
90
  doc.remark = remark;
85
91
  }
86
92
  doc.passport = passport;
93
+ doc.updatedBy = getUserName(context);
87
94
 
88
95
  await this.asyncDB.update({ accessKeyId }, { $set: doc });
89
96
  return doc;
@@ -338,7 +338,7 @@ const getRuntimeEnvironments = (blocklet, nodeEnvironments, parent) => {
338
338
  const getSharedConfigs = (child, parent) => {
339
339
  const sharedConfigs = {};
340
340
  if (parent && Array.isArray(parent.configs) && child.meta.did !== parent.meta.did) {
341
- const parentKeys = parent.configs.filter((x) => x.secure === false).map((x) => x.key);
341
+ const parentKeys = parent.configs.filter((x) => x.secure === false && x.shared !== false).map((x) => x.key);
342
342
  const childKeys = child.configs.map((x) => x.key);
343
343
  const sharedKeys = intersection(parentKeys, childKeys);
344
344
  sharedKeys.forEach((key) => {
@@ -1,5 +1,5 @@
1
1
  const slugify = require('slugify');
2
- const { DEFAULT_IP_DNS_DOMAIN_SUFFIX } = require('@abtnode/constant');
2
+ const { DEFAULT_IP_DOMAIN_SUFFIX } = require('@abtnode/constant');
3
3
  const md5 = require('@abtnode/util/lib/md5');
4
4
 
5
5
  const SLOT_FOR_IP_DNS_SITE = '888-888-888-888';
@@ -14,7 +14,7 @@ const getIpDnsDomainForBlocklet = (blocklet, blockletInterface) => {
14
14
 
15
15
  return `${formatName(blocklet.meta.name)}-${nameSuffix}${
16
16
  iName ? '-' : ''
17
- }${iName}-${SLOT_FOR_IP_DNS_SITE}.${DEFAULT_IP_DNS_DOMAIN_SUFFIX}`;
17
+ }${iName}-${SLOT_FOR_IP_DNS_SITE}.${DEFAULT_IP_DOMAIN_SUFFIX}`;
18
18
  };
19
19
 
20
20
  const getDidDomainForBlocklet = ({ name, daemonDid, didDomain }) => {
package/lib/util/index.js CHANGED
@@ -26,7 +26,7 @@ const {
26
26
  DEFAULT_HTTPS_PORT,
27
27
  ROUTING_RULE_TYPES,
28
28
  SLOT_FOR_IP_DNS_SITE,
29
- DEFAULT_IP_DNS_DOMAIN_SUFFIX,
29
+ DEFAULT_IP_DOMAIN_SUFFIX,
30
30
  BLOCKLET_SITE_GROUP_SUFFIX,
31
31
  } = require('@abtnode/constant');
32
32
 
@@ -115,7 +115,7 @@ const getBlockletBaseUrls = ({ rules = [], context = {}, nodeIp }) => {
115
115
  const host = getBlockletHost({ domain: rule.from.domain, context, nodeIp });
116
116
  if (host) {
117
117
  let protocol = 'http'; // TODO: 这里固定为 http, 因为判断 url 是不是 https 和证书相关,这里实现的话比较复杂
118
- if (host.includes(DEFAULT_IP_DNS_DOMAIN_SUFFIX)) {
118
+ if (host.includes(DEFAULT_IP_DOMAIN_SUFFIX)) {
119
119
  protocol = 'https';
120
120
  }
121
121
 
@@ -28,7 +28,7 @@ const isSatisfied = (requirements, throwOnUnsatisfied = true) => {
28
28
  throw new Error(`Your blocklet is not supported on architecture ${actualCpu}`);
29
29
  }
30
30
  if (isVersionSatisfied === false) {
31
- throw new Error(`Your blocklet is not supported on abtnode version v${actualVersion}`);
31
+ throw new Error(`Your blocklet is not supported on server version v${actualVersion}`);
32
32
  }
33
33
  }
34
34
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.6.29",
6
+ "version": "1.7.0",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,28 +19,28 @@
19
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@abtnode/certificate-manager": "1.6.29",
23
- "@abtnode/constant": "1.6.29",
24
- "@abtnode/cron": "1.6.29",
25
- "@abtnode/db": "1.6.29",
26
- "@abtnode/logger": "1.6.29",
27
- "@abtnode/queue": "1.6.29",
28
- "@abtnode/rbac": "1.6.29",
29
- "@abtnode/router-provider": "1.6.29",
30
- "@abtnode/static-server": "1.6.29",
31
- "@abtnode/timemachine": "1.6.29",
32
- "@abtnode/util": "1.6.29",
33
- "@arcblock/did": "^1.14.20",
34
- "@arcblock/event-hub": "1.14.20",
22
+ "@abtnode/certificate-manager": "1.7.0",
23
+ "@abtnode/constant": "1.7.0",
24
+ "@abtnode/cron": "1.7.0",
25
+ "@abtnode/db": "1.7.0",
26
+ "@abtnode/logger": "1.7.0",
27
+ "@abtnode/queue": "1.7.0",
28
+ "@abtnode/rbac": "1.7.0",
29
+ "@abtnode/router-provider": "1.7.0",
30
+ "@abtnode/static-server": "1.7.0",
31
+ "@abtnode/timemachine": "1.7.0",
32
+ "@abtnode/util": "1.7.0",
33
+ "@arcblock/did": "^1.14.25",
34
+ "@arcblock/event-hub": "1.14.25",
35
35
  "@arcblock/pm2-events": "^0.0.5",
36
- "@arcblock/vc": "^1.14.20",
37
- "@blocklet/meta": "1.6.29",
36
+ "@arcblock/vc": "^1.14.25",
37
+ "@blocklet/meta": "1.7.0",
38
38
  "@fidm/x509": "^1.2.1",
39
39
  "@nedb/core": "^1.2.2",
40
40
  "@nedb/multi": "^1.2.2",
41
- "@ocap/mcrypto": "^1.14.20",
42
- "@ocap/util": "^1.14.20",
43
- "@ocap/wallet": "^1.14.20",
41
+ "@ocap/mcrypto": "^1.14.25",
42
+ "@ocap/util": "^1.14.25",
43
+ "@ocap/wallet": "^1.14.25",
44
44
  "@slack/webhook": "^5.0.3",
45
45
  "ajv": "^7.0.3",
46
46
  "axios": "^0.25.0",
@@ -77,5 +77,5 @@
77
77
  "express": "^4.17.1",
78
78
  "jest": "^27.4.5"
79
79
  },
80
- "gitHead": "0d02246307d364e952990b3e64b608dfefc80efe"
80
+ "gitHead": "fc949a5e8a1017fbe17533d3bd78b166c7dad132"
81
81
  }