@blocklet/meta 1.8.31 → 1.8.33
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 +19 -0
- package/lib/parse.js +1 -1
- package/lib/schema.js +2 -1
- package/lib/util.js +3 -0
- package/package.json +13 -13
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;
|
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
|
|
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
|
-
|
|
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.
|
|
6
|
+
"version": "1.8.33",
|
|
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.
|
|
22
|
-
"@abtnode/util": "1.8.
|
|
23
|
-
"@arcblock/did": "1.
|
|
24
|
-
"@arcblock/did-ext": "1.
|
|
25
|
-
"@arcblock/did-util": "1.
|
|
26
|
-
"@arcblock/jwt": "1.
|
|
27
|
-
"@blocklet/constant": "1.8.
|
|
28
|
-
"@ocap/asset": "1.
|
|
29
|
-
"@ocap/mcrypto": "1.
|
|
30
|
-
"@ocap/util": "1.
|
|
31
|
-
"@ocap/wallet": "1.
|
|
21
|
+
"@abtnode/constant": "1.8.33",
|
|
22
|
+
"@abtnode/util": "1.8.33",
|
|
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.33",
|
|
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",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"express": "^4.18.2",
|
|
55
55
|
"jest": "^27.5.1"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "bb8223a5dd84536f2843391c59c0a8ac4398c6f2"
|
|
58
58
|
}
|