@blocklet/meta 1.5.13 → 1.15.17
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/constants.js +13 -3
- package/lib/schema.js +24 -1
- package/package.json +10 -10
package/lib/constants.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
const BLOCKLET_INTERFACE_TYPE_WEB = 'web';
|
|
2
2
|
const BLOCKLET_INTERFACE_TYPE_SERVICE = 'service';
|
|
3
3
|
|
|
4
|
+
// Wellknown interface declares an sub-interface under web interface
|
|
5
|
+
// The path of the wellknown interface must starts with /.well-known, e.g. /.well-known/acme-challenge)
|
|
6
|
+
// The wellknown interface can be mounted to every endpoint of the abtnode and all blocklets on the abtnode
|
|
7
|
+
const BLOCKLET_INTERFACE_TYPE_WELLKNOWN = 'wellknown';
|
|
8
|
+
|
|
4
9
|
const BlockletStatus = Object.freeze({
|
|
5
10
|
added: 0,
|
|
6
11
|
downloading: 1,
|
|
@@ -60,7 +65,7 @@ const BLOCKLET_INTERFACE_PUBLIC = 'publicUrl';
|
|
|
60
65
|
const BLOCKLET_INTERFACE_ADMIN = 'adminUrl';
|
|
61
66
|
const BLOCKLET_INTERFACE_CONFIG = 'configUrl';
|
|
62
67
|
const BLOCKLET_INTERFACE_DOC = 'docUrl';
|
|
63
|
-
const BLOCKLET_INTERFACE_WELLKNOWN = 'wellknownUrl';
|
|
68
|
+
const BLOCKLET_INTERFACE_WELLKNOWN = 'wellknownUrl'; // Deprecated
|
|
64
69
|
|
|
65
70
|
module.exports = Object.freeze({
|
|
66
71
|
BlockletStatus,
|
|
@@ -87,7 +92,7 @@ module.exports = Object.freeze({
|
|
|
87
92
|
DEVELOPMENT: 'development',
|
|
88
93
|
}),
|
|
89
94
|
|
|
90
|
-
BLOCKLET_FACTORY_SHARES: { developer: 0.7,
|
|
95
|
+
BLOCKLET_FACTORY_SHARES: { developer: 0.7, store: 0.3 },
|
|
91
96
|
|
|
92
97
|
BLOCKLET_DYNAMIC_PATH_PREFIX: '*',
|
|
93
98
|
|
|
@@ -114,7 +119,12 @@ module.exports = Object.freeze({
|
|
|
114
119
|
|
|
115
120
|
BLOCKLET_INTERFACE_TYPE_WEB,
|
|
116
121
|
BLOCKLET_INTERFACE_TYPE_SERVICE,
|
|
117
|
-
|
|
122
|
+
BLOCKLET_INTERFACE_TYPE_WELLKNOWN,
|
|
123
|
+
BLOCKLET_INTERFACE_TYPES: [
|
|
124
|
+
BLOCKLET_INTERFACE_TYPE_WEB,
|
|
125
|
+
BLOCKLET_INTERFACE_TYPE_SERVICE,
|
|
126
|
+
BLOCKLET_INTERFACE_TYPE_WELLKNOWN,
|
|
127
|
+
],
|
|
118
128
|
|
|
119
129
|
BLOCKLET_INTERFACE_PROTOCOLS: ['tcp', 'udp', 'http'],
|
|
120
130
|
|
package/lib/schema.js
CHANGED
|
@@ -18,8 +18,12 @@ const {
|
|
|
18
18
|
BLOCKLET_DYNAMIC_PATH_PREFIX,
|
|
19
19
|
BlockletGroup,
|
|
20
20
|
BLOCKLET_LATEST_REQUIREMENT_ABTNODE,
|
|
21
|
+
BLOCKLET_INTERFACE_TYPE_WEB,
|
|
22
|
+
BLOCKLET_INTERFACE_TYPE_WELLKNOWN,
|
|
21
23
|
} = require('./constants');
|
|
22
24
|
|
|
25
|
+
const WELLKNOWN_PATH_PREFIX = '/.well-known';
|
|
26
|
+
|
|
23
27
|
const Joi = JOI.extend(semver).extend(semverRange).extend(fileExtension).extend(didExtension);
|
|
24
28
|
|
|
25
29
|
const environmentSchema = Joi.object({
|
|
@@ -277,7 +281,26 @@ const createBlockletSchema = (
|
|
|
277
281
|
}).default({ abtnode: BLOCKLET_LATEST_REQUIREMENT_ABTNODE, os: '*', cpu: '*' }),
|
|
278
282
|
|
|
279
283
|
// interfaces: https://github.com/blocklet/blocklet-specification/issues/2
|
|
280
|
-
interfaces: Joi.array()
|
|
284
|
+
interfaces: Joi.array()
|
|
285
|
+
.items(interfaceSchema)
|
|
286
|
+
.unique('name')
|
|
287
|
+
.min(1)
|
|
288
|
+
.custom((value, helper) => {
|
|
289
|
+
const webItems = value.filter((x) => x.type === BLOCKLET_INTERFACE_TYPE_WEB);
|
|
290
|
+
if (webItems.length > 1) {
|
|
291
|
+
return helper.message(`Only one ${BLOCKLET_INTERFACE_TYPE_WEB} interface can be declared`);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const wellknownItems = value.filter((x) => x.type === BLOCKLET_INTERFACE_TYPE_WELLKNOWN);
|
|
295
|
+
for (const x of wellknownItems) {
|
|
296
|
+
if (!x.prefix.startsWith(WELLKNOWN_PATH_PREFIX)) {
|
|
297
|
+
return helper.message(`Wellknown path prefix must start with: ${WELLKNOWN_PATH_PREFIX}`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return value;
|
|
302
|
+
})
|
|
303
|
+
.default([]),
|
|
281
304
|
|
|
282
305
|
// environments
|
|
283
306
|
environments: Joi.array().items(environmentSchema).default([]).optional(),
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.15.17",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@arcblock/did": "^1.13.
|
|
22
|
-
"@arcblock/did-ext": "^1.13.
|
|
23
|
-
"@arcblock/did-util": "^1.13.
|
|
24
|
-
"@arcblock/nft": "^1.13.
|
|
25
|
-
"@ocap/asset": "^1.13.
|
|
26
|
-
"@ocap/mcrypto": "^1.13.
|
|
27
|
-
"@ocap/util": "^1.13.
|
|
28
|
-
"@ocap/wallet": "^1.13.
|
|
21
|
+
"@arcblock/did": "^1.13.61",
|
|
22
|
+
"@arcblock/did-ext": "^1.13.61",
|
|
23
|
+
"@arcblock/did-util": "^1.13.61",
|
|
24
|
+
"@arcblock/nft": "^1.13.61",
|
|
25
|
+
"@ocap/asset": "^1.13.61",
|
|
26
|
+
"@ocap/mcrypto": "^1.13.61",
|
|
27
|
+
"@ocap/util": "^1.13.61",
|
|
28
|
+
"@ocap/wallet": "^1.13.61",
|
|
29
29
|
"ajv": "^7.0.3",
|
|
30
30
|
"debug": "^4.3.2",
|
|
31
31
|
"fs-extra": "^10.0.0",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"jest": "^27.3.1"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "22715c3ea74d0230f3413162a17f491614b6735a"
|
|
46
46
|
}
|