@blocklet/meta 1.8.27 → 1.8.28

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/payment/v2.js CHANGED
@@ -2,11 +2,11 @@
2
2
  const crypto = require('crypto');
3
3
  const debug = require('debug')('@blocklet/meta:payment');
4
4
  const joinURL = require('url-join');
5
- const axios = require('axios').create();
6
5
  const stableStringify = require('json-stable-stringify');
7
6
  const get = require('lodash/get');
8
7
  const pick = require('lodash/pick');
9
8
  const cloneDeep = require('lodash/cloneDeep');
9
+ const axios = require('@abtnode/util/lib/axios');
10
10
  const { BN, fromTokenToUnit, fromUnitToToken } = require('@ocap/util');
11
11
  const { isValidFactory } = require('@ocap/asset');
12
12
  const { fromPublicKey } = require('@ocap/wallet');
package/lib/util-meta.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const fs = require('fs');
2
- const axios = require('axios');
2
+ const axios = require('@abtnode/util/lib/axios');
3
3
  const any = require('promise.any');
4
4
  const joinUrl = require('url-join');
5
5
 
package/lib/util.js CHANGED
@@ -11,6 +11,7 @@ const {
11
11
  fromBlockletSource,
12
12
  BLOCKLET_INTERFACE_TYPE_WEB,
13
13
  BLOCKLET_CONFIGURABLE_KEY,
14
+ CHAIN_INFO_CONFIG,
14
15
  } = require('./constants');
15
16
 
16
17
  const getComponentId = (component, ancestors = []) =>
@@ -189,6 +190,16 @@ const findComponentById = (blocklet, componentId, { _ancestors = [], returnAnces
189
190
  return null;
190
191
  };
191
192
 
193
+ const isEnvShareable = (env) => {
194
+ return (
195
+ !!env &&
196
+ !!(env.key || env.name) &&
197
+ !env.secure &&
198
+ env.shared !== false &&
199
+ !BLOCKLET_CONFIGURABLE_KEY[env.key || env.name]
200
+ );
201
+ };
202
+
192
203
  const getSharedConfigObj = (component, ancestors) => {
193
204
  const res = {};
194
205
  if (!ancestors) {
@@ -442,6 +453,14 @@ const replaceSlotToIp = (url, ip) => (url || '').replace(SLOT_FOR_IP_DNS_SITE, (
442
453
 
443
454
  const urlFriendly = (name) => slugify(name.replace(/^[@./-]/, '').replace(/[@./_]/g, '-'));
444
455
 
456
+ // transform process.env.CHAIN_x => { x: v }
457
+ const getChainInfo = (env) =>
458
+ Object.entries(CHAIN_INFO_CONFIG).reduce((info, x) => {
459
+ const [envName, [key, value]] = x;
460
+ info[key] = get(env, envName) || value;
461
+ return info;
462
+ }, {});
463
+
445
464
  module.exports = {
446
465
  isFreeBlocklet,
447
466
  isFreeComponent,
@@ -454,6 +473,7 @@ module.exports = {
454
473
  getSharedConfigObj,
455
474
  getAppMissingConfigs,
456
475
  getComponentMissingConfigs,
476
+ isEnvShareable,
457
477
  wipeSensitiveData,
458
478
  hasRunnableComponent,
459
479
  getDisplayName,
@@ -469,4 +489,5 @@ module.exports = {
469
489
  findComponentById,
470
490
  getParentComponentName,
471
491
  getConnectAppUrl,
492
+ getChainInfo,
472
493
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.27",
6
+ "version": "1.8.28",
7
7
  "description": "Library to parse/validate/fix blocklet meta",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -18,17 +18,17 @@
18
18
  "author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@abtnode/constant": "1.8.27",
22
- "@abtnode/util": "1.8.27",
23
- "@arcblock/did": "1.17.20",
24
- "@arcblock/did-ext": "1.17.20",
25
- "@arcblock/did-util": "1.17.20",
26
- "@arcblock/jwt": "1.17.20",
27
- "@blocklet/constant": "1.8.27",
28
- "@ocap/asset": "1.17.20",
29
- "@ocap/mcrypto": "1.17.20",
30
- "@ocap/util": "1.17.20",
31
- "@ocap/wallet": "1.17.20",
21
+ "@abtnode/constant": "1.8.28",
22
+ "@abtnode/util": "1.8.28",
23
+ "@arcblock/did": "1.17.23",
24
+ "@arcblock/did-ext": "1.17.23",
25
+ "@arcblock/did-util": "1.17.23",
26
+ "@arcblock/jwt": "1.17.23",
27
+ "@blocklet/constant": "1.8.28",
28
+ "@ocap/asset": "1.17.23",
29
+ "@ocap/mcrypto": "1.17.23",
30
+ "@ocap/util": "1.17.23",
31
+ "@ocap/wallet": "1.17.23",
32
32
  "ajv": "^8.11.0",
33
33
  "axios": "^0.27.2",
34
34
  "cjk-length": "^1.0.0",
@@ -36,7 +36,7 @@
36
36
  "fs-extra": "^10.1.0",
37
37
  "hosted-git-info": "3.0.8",
38
38
  "is-glob": "^4.0.3",
39
- "joi": "^17.6.0",
39
+ "joi": "^17.6.2",
40
40
  "joi-extension-semver": "^5.0.0",
41
41
  "js-yaml": "^4.1.0",
42
42
  "json-stable-stringify": "^1.0.1",
@@ -47,12 +47,12 @@
47
47
  "validate-npm-package-name": "^3.0.0"
48
48
  },
49
49
  "devDependencies": {
50
- "body-parser": "^1.20.0",
50
+ "body-parser": "^1.20.1",
51
51
  "compression": "^1.7.4",
52
- "detect-port": "^1.3.0",
52
+ "detect-port": "^1.5.1",
53
53
  "expand-tilde": "^2.0.2",
54
- "express": "^4.18.1",
54
+ "express": "^4.18.2",
55
55
  "jest": "^27.5.1"
56
56
  },
57
- "gitHead": "84b2cb3ee703479f17e88c91650ecf3015cbf6af"
57
+ "gitHead": "af7aacf5507177600ae563ab597cb42d7223b113"
58
58
  }