@blocklet/meta 1.8.30 → 1.8.32

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/did.js CHANGED
@@ -7,4 +7,23 @@ const toBlockletDid = (name) => {
7
7
  return fromPublicKey(pk, { role: types.RoleType.ROLE_ANY });
8
8
  };
9
9
 
10
+ toBlockletDid.toExternalBlocklet = (name, userDid, { didOnly, nameOnly } = {}) => {
11
+ const blockletName = `${name}-${userDid.toLowerCase().substring(userDid.length - 6)}`;
12
+
13
+ if (nameOnly) {
14
+ return blockletName;
15
+ }
16
+
17
+ const blockletDid = toBlockletDid(blockletName);
18
+
19
+ if (didOnly) {
20
+ return blockletDid;
21
+ }
22
+
23
+ return {
24
+ name: blockletName,
25
+ did: blockletDid,
26
+ };
27
+ };
28
+
10
29
  module.exports = toBlockletDid;
@@ -162,7 +162,7 @@ const doParseNavigation = (navigation, blocklet, prefix = '/', _level = 1) => {
162
162
  _level + 1
163
163
  );
164
164
 
165
- if (_level === 1) { // eslint-disable-line
165
+ if (_level === 1) {
166
166
  // primary menu
167
167
  const item = cloneDeep(itemProto);
168
168
 
@@ -223,7 +223,7 @@ const uniq = (navigation) => {
223
223
  const parseNavigation = (...args) => {
224
224
  const res = doParseNavigation(...args);
225
225
 
226
- return uniq(res);
226
+ return uniq(res).filter((x) => x.link || (x.items && x.items.length));
227
227
  };
228
228
 
229
229
  module.exports = parseNavigation;
package/lib/parse.js CHANGED
@@ -86,7 +86,7 @@ const parse = (
86
86
  const schema = createBlockletSchema(dir, { ensureMain, ensureFiles, ensureDist, ...schemaOptions });
87
87
  const { value, error } = schema.validate(result);
88
88
  if (error) {
89
- throw new Error(`Invalid blocklet meta: ${error.details.map((x) => x.message).join(', ')}`);
89
+ throw new Error(`Invalid blocklet.yml: ${error.details.map((x) => x.message).join(', ')}`);
90
90
  }
91
91
 
92
92
  return value;
package/lib/schema.js CHANGED
@@ -425,7 +425,8 @@ const createBlockletSchema = (
425
425
  reason: Joi.string().trim().required(),
426
426
  })
427
427
  ),
428
- }).default({ server: BLOCKLET_LATEST_REQUIREMENT_SERVER, os: '*', cpu: '*' }),
428
+ nodejs: Joi.semverRange().valid(),
429
+ }).default({ server: BLOCKLET_LATEST_REQUIREMENT_SERVER, os: '*', cpu: '*', nodejs: '*' }),
429
430
 
430
431
  // interfaces: https://github.com/blocklet/blocklet-specification/issues/2
431
432
  interfaces: Joi.array()
package/lib/util.js CHANGED
@@ -461,6 +461,8 @@ const getChainInfo = (env) =>
461
461
  return info;
462
462
  }, {});
463
463
 
464
+ const isExternalBlocklet = (blocklet) => !!blocklet?.controller;
465
+
464
466
  module.exports = {
465
467
  isFreeBlocklet,
466
468
  isFreeComponent,
@@ -490,4 +492,5 @@ module.exports = {
490
492
  getParentComponentName,
491
493
  getConnectAppUrl,
492
494
  getChainInfo,
495
+ isExternalBlocklet,
493
496
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.30",
6
+ "version": "1.8.32",
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.30",
22
- "@abtnode/util": "1.8.30",
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.30",
28
- "@ocap/asset": "1.17.23",
29
- "@ocap/mcrypto": "1.17.23",
30
- "@ocap/util": "1.17.23",
31
- "@ocap/wallet": "1.17.23",
21
+ "@abtnode/constant": "1.8.32",
22
+ "@abtnode/util": "1.8.32",
23
+ "@arcblock/did": "1.18.1",
24
+ "@arcblock/did-ext": "1.18.1",
25
+ "@arcblock/did-util": "1.18.1",
26
+ "@arcblock/jwt": "1.18.1",
27
+ "@blocklet/constant": "1.8.32",
28
+ "@ocap/asset": "1.18.1",
29
+ "@ocap/mcrypto": "1.18.1",
30
+ "@ocap/util": "1.18.1",
31
+ "@ocap/wallet": "1.18.1",
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.2",
39
+ "joi": "17.6.3",
40
40
  "joi-extension-semver": "^5.0.0",
41
41
  "js-yaml": "^4.1.0",
42
42
  "json-stable-stringify": "^1.0.1",
@@ -54,5 +54,5 @@
54
54
  "express": "^4.18.2",
55
55
  "jest": "^27.5.1"
56
56
  },
57
- "gitHead": "cb294f4ee7382c6ef7692b6c2c33ad080fced13e"
57
+ "gitHead": "8502244aeda5926b3433c1dd9142e63233e3c23c"
58
58
  }