@blocklet/meta 1.16.0-beta-ad6df3ae → 1.16.0-beta-7a7d5d97

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/util.d.ts CHANGED
@@ -105,7 +105,12 @@ declare const getConnectAppUrl: ({ request, baseUrl }: {
105
105
  baseUrl: string;
106
106
  }) => string;
107
107
  declare const replaceSlotToIp: (url?: string, ip?: string) => string;
108
- declare const getChainInfo: (env: Record<string, string>) => Record<string, string>;
108
+ type ChainInfo = {
109
+ type: 'arcblock' | 'ethereum' | 'solona';
110
+ id: string;
111
+ host: string;
112
+ };
113
+ declare const getChainInfo: (env: Record<string, string>) => ChainInfo;
109
114
  declare const isExternalBlocklet: (blocklet?: BlockletState) => boolean;
110
115
  declare const getRolesFromAuthConfig: (config: {
111
116
  whoCanAccess: string;
@@ -191,7 +196,7 @@ declare const _default: {
191
196
  request: Partial<Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>>;
192
197
  baseUrl: string;
193
198
  }) => string;
194
- getChainInfo: (env: Record<string, string>) => Record<string, string>;
199
+ getChainInfo: (env: Record<string, string>) => ChainInfo;
195
200
  isExternalBlocklet: (blocklet?: BlockletState) => boolean;
196
201
  isPreferenceKey: (x: TConfig) => Boolean;
197
202
  getRolesFromAuthConfig: (config: {
package/lib/util.js CHANGED
@@ -448,13 +448,18 @@ const getConnectAppUrl = ({ request, baseUrl }) => {
448
448
  exports.getConnectAppUrl = getConnectAppUrl;
449
449
  const replaceSlotToIp = (url, ip) => (url || '').replace(SLOT_FOR_IP_DNS_SITE, (ip || '').replace(/\./g, '-'));
450
450
  exports.replaceSlotToIp = replaceSlotToIp;
451
- // transform process.env.CHAIN_x => { x: v }
452
- const getChainInfo = (env) => Object.entries(CHAIN_INFO_CONFIG).reduce((info, x) => {
453
- // @ts-expect-error TS(2488) FIXME: Type 'unknown' must have a '[Symbol.iterator]()' m... Remove this comment to see the full error message
454
- const [envName, [key, value]] = x;
455
- info[key] = (0, get_1.default)(env, envName) || value;
456
- return info;
457
- }, {});
451
+ const getChainInfo = (env) => {
452
+ // @ts-ignore
453
+ const result = Object.entries(CHAIN_INFO_CONFIG).reduce((info, x) => {
454
+ const [envName, [key, value]] = x;
455
+ info[key] = (0, get_1.default)(env, envName) || value;
456
+ return info;
457
+ }, {});
458
+ if (result.type === 'ethereum' && result.id === 'none') {
459
+ result.id = '1';
460
+ }
461
+ return result;
462
+ };
458
463
  exports.getChainInfo = getChainInfo;
459
464
  const isExternalBlocklet = (blocklet) => !!blocklet?.controller;
460
465
  exports.isExternalBlocklet = isExternalBlocklet;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.0-beta-ad6df3ae",
6
+ "version": "1.16.0-beta-7a7d5d97",
7
7
  "description": "Library to parse/validate/fix blocklet meta",
8
8
  "main": "./lib/index.js",
9
9
  "typings": "./lib/index.d.ts",
@@ -24,14 +24,14 @@
24
24
  "author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
- "@abtnode/client": "1.16.0-beta-ad6df3ae",
28
- "@abtnode/constant": "1.16.0-beta-ad6df3ae",
29
- "@abtnode/util": "1.16.0-beta-ad6df3ae",
27
+ "@abtnode/client": "1.16.0-beta-7a7d5d97",
28
+ "@abtnode/constant": "1.16.0-beta-7a7d5d97",
29
+ "@abtnode/util": "1.16.0-beta-7a7d5d97",
30
30
  "@arcblock/did": "1.18.64",
31
31
  "@arcblock/did-ext": "1.18.64",
32
32
  "@arcblock/did-util": "1.18.64",
33
33
  "@arcblock/jwt": "1.18.64",
34
- "@blocklet/constant": "1.16.0-beta-ad6df3ae",
34
+ "@blocklet/constant": "1.16.0-beta-7a7d5d97",
35
35
  "@ocap/asset": "1.18.64",
36
36
  "@ocap/mcrypto": "1.18.64",
37
37
  "@ocap/types": "1.18.64",
@@ -81,5 +81,5 @@
81
81
  "ts-node": "^10.9.1",
82
82
  "typescript": "^4.8.4"
83
83
  },
84
- "gitHead": "8fa60176a00400cd412b308df3c7d6dcd9af2db1"
84
+ "gitHead": "c25ddcc371454b2e2f7038aa5e64c7b7c27763cb"
85
85
  }