@blocklet/meta 1.4.11 → 1.5.0

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/info.js CHANGED
@@ -2,9 +2,12 @@ const get = require('lodash/get');
2
2
  const getBlockletWallet = require('./wallet');
3
3
 
4
4
  module.exports = (state, nodeSk) => {
5
- if (!state || typeof state !== 'object' || !Array.isArray(state.environments)) {
5
+ if (!state || typeof state !== 'object' || !Array.isArray(state.environments) || !get(state, 'meta.did')) {
6
6
  throw new Error('Blocklet state must be an object');
7
7
  }
8
+ if (!nodeSk || typeof nodeSk !== 'string') {
9
+ throw new Error('Node secret key must be a string');
10
+ }
8
11
 
9
12
  const customName = state.environments.find((x) => x.key === 'BLOCKLET_APP_NAME');
10
13
  const customDescription = state.environments.find((x) => x.key === 'BLOCKLET_APP_DESCRIPTION');
@@ -17,9 +20,9 @@ module.exports = (state, nodeSk) => {
17
20
  }
18
21
 
19
22
  let wallet = null;
20
- if (customSk && customType) {
23
+ if (customSk && customSk.value && customType) {
21
24
  wallet = getBlockletWallet(customSk.value, null, type);
22
- } else if (customSk) {
25
+ } else if (customSk && customSk.value) {
23
26
  wallet = getBlockletWallet(customSk.value);
24
27
  } else if (customType) {
25
28
  wallet = getBlockletWallet(state.meta.did, nodeSk, type);
package/lib/schema.js CHANGED
@@ -56,6 +56,19 @@ const serviceSchema = Joi.object({
56
56
  config: Joi.object().optional().default({}),
57
57
  }).unknown(true);
58
58
 
59
+ const endpointSchema = Joi.object({
60
+ type: Joi.string().trim(true).min(1).required(),
61
+ path: Joi.string().required(),
62
+ meta: Joi.object({
63
+ vcType: Joi.string(),
64
+ payable: Joi.boolean(),
65
+ params: Joi.array().items({
66
+ name: Joi.string().required().trim(),
67
+ description: Joi.string().required().trim(),
68
+ }),
69
+ }),
70
+ });
71
+
59
72
  const interfaceSchema = Joi.object({
60
73
  type: Joi.string()
61
74
  .lowercase()
@@ -88,6 +101,7 @@ const interfaceSchema = Joi.object({
88
101
  .default(BLOCKLET_DEFAULT_PORT_NAME),
89
102
 
90
103
  services: Joi.array().items(serviceSchema).unique('name'),
104
+ endpoints: Joi.array().items(endpointSchema).unique('type'),
91
105
  });
92
106
 
93
107
  const engineSchema = Joi.object({
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.4.11",
6
+ "version": "1.5.0",
7
7
  "description": "Library to parse/validate/fix blocklet meta",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -18,16 +18,16 @@
18
18
  "author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@arcblock/did": "^1.13.2",
22
- "@arcblock/did-ext": "^1.13.2",
23
- "@arcblock/did-util": "^1.13.2",
24
- "@arcblock/nft": "^1.13.2",
25
- "@ocap/asset": "^1.13.2",
26
- "@ocap/mcrypto": "^1.13.2",
27
- "@ocap/util": "^1.13.2",
28
- "@ocap/wallet": "^1.13.2",
21
+ "@arcblock/did": "^1.13.16",
22
+ "@arcblock/did-ext": "^1.13.16",
23
+ "@arcblock/did-util": "^1.13.16",
24
+ "@arcblock/nft": "^1.13.16",
25
+ "@ocap/asset": "^1.13.16",
26
+ "@ocap/mcrypto": "^1.13.16",
27
+ "@ocap/util": "^1.13.16",
28
+ "@ocap/wallet": "^1.13.16",
29
29
  "ajv": "^7.0.3",
30
- "debug": "^4.3.1",
30
+ "debug": "^4.3.2",
31
31
  "fs-extra": "^10.0.0",
32
32
  "hosted-git-info": "3.0.8",
33
33
  "joi": "^17.4.0",
@@ -41,5 +41,5 @@
41
41
  "devDependencies": {
42
42
  "jest": "^26.4.2"
43
43
  },
44
- "gitHead": "bc792eb664a3c387f96df361dff22b283d28fc8a"
44
+ "gitHead": "bc78f2a10de0ccc7ae23b6b6f259c05606bad8f5"
45
45
  }