@blocklet/meta 1.16.0-beta-1f8bf936 → 1.16.0-beta-58020de5

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/parse.js CHANGED
@@ -93,7 +93,7 @@ const parse = (dir, { ensureMain = false, ensureFiles = false, ensureDist = fals
93
93
  });
94
94
  const { value, error } = schema.validate(result);
95
95
  if (error) {
96
- throw new Error(`Invalid blocklet.yml: ${error.details
96
+ throw new Error(`Invalid blocklet.yml:\n${error.details
97
97
  .map((x) => {
98
98
  try {
99
99
  // 根据 navigation 校验规则定制特殊的错误消息显示
@@ -106,7 +106,7 @@ const parse = (dir, { ensureMain = false, ensureFiles = false, ensureDist = fals
106
106
  }
107
107
  return x.message;
108
108
  })
109
- .join(', ')}`);
109
+ .join('\n')}`);
110
110
  }
111
111
  return value;
112
112
  };
package/lib/schema.js CHANGED
@@ -59,7 +59,8 @@ const checkLinkHelper = (value, helper) => {
59
59
  A valid navigation link should be a relative url which start with '/' or a absolute url, such as:
60
60
  - /en/home
61
61
  - /zh/home
62
- - https://www.arcblock.io`);
62
+ - https://www.arcblock.io
63
+ `);
63
64
  };
64
65
  const checkId = (value, helper) => {
65
66
  if (!value || (0, is_var_name_1.default)(value)) {
@@ -73,7 +74,8 @@ A valid navigation id is should follow the rules of javascript variables, such a
73
74
  - fooBar
74
75
  - foo123
75
76
 
76
- see detail in https://www.npmjs.com/package/is-var-name`);
77
+ see detail in https://www.npmjs.com/package/is-var-name
78
+ `);
77
79
  };
78
80
  const titleSchema = Joi.string()
79
81
  .trim()
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-1f8bf936",
6
+ "version": "1.16.0-beta-58020de5",
7
7
  "description": "Library to parse/validate/fix blocklet meta",
8
8
  "main": "./lib/index.js",
9
9
  "typings": "./lib/index.d.ts",
@@ -24,19 +24,19 @@
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-1f8bf936",
28
- "@abtnode/constant": "1.16.0-beta-1f8bf936",
29
- "@abtnode/util": "1.16.0-beta-1f8bf936",
30
- "@arcblock/did": "1.18.63",
31
- "@arcblock/did-ext": "1.18.63",
32
- "@arcblock/did-util": "1.18.63",
33
- "@arcblock/jwt": "1.18.63",
34
- "@blocklet/constant": "1.16.0-beta-1f8bf936",
35
- "@ocap/asset": "1.18.63",
36
- "@ocap/mcrypto": "1.18.63",
37
- "@ocap/types": "1.18.63",
38
- "@ocap/util": "1.18.63",
39
- "@ocap/wallet": "1.18.63",
27
+ "@abtnode/client": "1.16.0-beta-58020de5",
28
+ "@abtnode/constant": "1.16.0-beta-58020de5",
29
+ "@abtnode/util": "1.16.0-beta-58020de5",
30
+ "@arcblock/did": "1.18.64",
31
+ "@arcblock/did-ext": "1.18.64",
32
+ "@arcblock/did-util": "1.18.64",
33
+ "@arcblock/jwt": "1.18.64",
34
+ "@blocklet/constant": "1.16.0-beta-58020de5",
35
+ "@ocap/asset": "1.18.64",
36
+ "@ocap/mcrypto": "1.18.64",
37
+ "@ocap/types": "1.18.64",
38
+ "@ocap/util": "1.18.64",
39
+ "@ocap/wallet": "1.18.64",
40
40
  "ajv": "^8.11.0",
41
41
  "axios": "^0.27.2",
42
42
  "cjk-length": "^1.0.0",
@@ -81,5 +81,5 @@
81
81
  "ts-node": "^10.9.1",
82
82
  "typescript": "^4.8.4"
83
83
  },
84
- "gitHead": "d832948cdc83e67ea42a2aefba3649fa73723b65"
84
+ "gitHead": "9d3f47f9827acf13e9efea38cd605d3b36f9f523"
85
85
  }