@abtnode/core 1.6.14 → 1.6.18
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/blocklet/hooks.js +16 -63
- package/lib/blocklet/manager/disk.js +426 -144
- package/lib/blocklet/migration.js +16 -52
- package/lib/event.js +1 -1
- package/lib/index.js +3 -11
- package/lib/migrations/1.6.17-blocklet-children.js +48 -0
- package/lib/router/helper.js +33 -19
- package/lib/router/manager.js +64 -42
- package/lib/states/blocklet-extras.js +39 -3
- package/lib/states/blocklet.js +18 -20
- package/lib/states/node.js +17 -2
- package/lib/util/blocklet.js +276 -67
- package/lib/util/default-node-config.js +1 -1
- package/lib/util/get-domain-for-blocklet.js +2 -2
- package/lib/util/router.js +13 -0
- package/lib/validators/node.js +11 -12
- package/lib/validators/permission.js +16 -1
- package/package.json +21 -21
|
@@ -16,8 +16,8 @@ const getIpDnsDomainForBlocklet = (blocklet, blockletInterface) => {
|
|
|
16
16
|
}${iName}-${SLOT_FOR_IP_DNS_SITE}.${DEFAULT_IP_DNS_DOMAIN_SUFFIX}`;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const getDidDomainForBlocklet = ({
|
|
20
|
-
return `${
|
|
19
|
+
const getDidDomainForBlocklet = ({ name, daemonDid, didDomain }) => {
|
|
20
|
+
return `${formatName(name)}-${daemonDid.toLowerCase()}.${didDomain}`;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
module.exports = { getIpDnsDomainForBlocklet, getDidDomainForBlocklet };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { BLOCKLET_SITE_GROUP_SUFFIX } = require('@abtnode/constant');
|
|
2
|
+
|
|
3
|
+
const getBlockletDomainGroupName = (did) => `${did}${BLOCKLET_SITE_GROUP_SUFFIX}`;
|
|
4
|
+
|
|
5
|
+
const getDidFromDomainGroupName = (name) => {
|
|
6
|
+
const did = name.replace(BLOCKLET_SITE_GROUP_SUFFIX, '');
|
|
7
|
+
return did;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
getBlockletDomainGroupName,
|
|
12
|
+
getDidFromDomainGroupName,
|
|
13
|
+
};
|
package/lib/validators/node.js
CHANGED
|
@@ -9,14 +9,23 @@ const nodeInfoSchema = Joi.object({
|
|
|
9
9
|
description: Joi.string()
|
|
10
10
|
.required()
|
|
11
11
|
.messages({ zh: { 'string.empty': '描述不能为空' }, en: { 'string.empty': 'Description cannot be empty' } }),
|
|
12
|
+
registerUrl: Joi.string()
|
|
13
|
+
.uri({ scheme: [/https?/] })
|
|
14
|
+
.label('register url')
|
|
15
|
+
.allow('')
|
|
16
|
+
.optional()
|
|
17
|
+
.messages({
|
|
18
|
+
zh: { 'string.uriCustomScheme': '应用启动器必须是合法的 URL' },
|
|
19
|
+
en: { 'string.uriCustomScheme': 'Blocklet Launcher must be a valid URL' },
|
|
20
|
+
}),
|
|
12
21
|
webWalletUrl: Joi.string()
|
|
13
22
|
.uri({ scheme: [/https?/] })
|
|
14
23
|
.label('web wallet url')
|
|
15
24
|
.allow('')
|
|
16
25
|
.optional()
|
|
17
26
|
.messages({
|
|
18
|
-
zh: { 'string.uriCustomScheme': 'Web
|
|
19
|
-
en: { 'string.uriCustomScheme': 'Web
|
|
27
|
+
zh: { 'string.uriCustomScheme': 'Web Wallet 必须是合法的 URL' },
|
|
28
|
+
en: { 'string.uriCustomScheme': 'Web Wallet must be a valid URL' },
|
|
20
29
|
}),
|
|
21
30
|
autoUpgrade: Joi.boolean(),
|
|
22
31
|
enableWelcomePage: Joi.boolean(),
|
|
@@ -31,16 +40,6 @@ const nodeInfoSchema = Joi.object({
|
|
|
31
40
|
'number.max': 'Disk usage alert threshold cannot be higher than 99%',
|
|
32
41
|
},
|
|
33
42
|
}),
|
|
34
|
-
// removed in 1.5.1
|
|
35
|
-
registerUrl: Joi.string()
|
|
36
|
-
.uri({ scheme: [/https?/] })
|
|
37
|
-
.label('register url')
|
|
38
|
-
.allow('')
|
|
39
|
-
.optional()
|
|
40
|
-
.messages({
|
|
41
|
-
zh: { 'string.uriCustomScheme': '注册地址必须是合法的 URL' },
|
|
42
|
-
en: { 'string.uriCustomScheme': 'Registry URL must be a valid URL' },
|
|
43
|
-
}),
|
|
44
43
|
}).options({ stripUnknown: true });
|
|
45
44
|
|
|
46
45
|
module.exports = {
|
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
const JOI = require('joi');
|
|
3
3
|
const { getMultipleLangParams } = require('./util');
|
|
4
4
|
|
|
5
|
-
const nameSchema = JOI.string()
|
|
5
|
+
const nameSchema = JOI.string()
|
|
6
|
+
.trim()
|
|
7
|
+
.max(64)
|
|
8
|
+
.custom((name) => {
|
|
9
|
+
const arr = name.split('_');
|
|
10
|
+
const formatTip = 'The format of permission name should be "{action}_{resource}", e.g. query_data';
|
|
11
|
+
if (arr.length > 2) {
|
|
12
|
+
throw new Error(`Too much "_". ${formatTip}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (arr.length < 2) {
|
|
16
|
+
throw new Error(formatTip);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return name;
|
|
20
|
+
});
|
|
6
21
|
const descriptionSchema = JOI.string().trim().max(600);
|
|
7
22
|
|
|
8
23
|
const createPermissionSchema = JOI.object({
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.6.
|
|
6
|
+
"version": "1.6.18",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,28 +19,28 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/certificate-manager": "1.6.
|
|
23
|
-
"@abtnode/constant": "1.6.
|
|
24
|
-
"@abtnode/cron": "1.6.
|
|
25
|
-
"@abtnode/db": "1.6.
|
|
26
|
-
"@abtnode/logger": "1.6.
|
|
27
|
-
"@abtnode/queue": "1.6.
|
|
28
|
-
"@abtnode/rbac": "1.6.
|
|
29
|
-
"@abtnode/router-provider": "1.6.
|
|
30
|
-
"@abtnode/static-server": "1.6.
|
|
31
|
-
"@abtnode/timemachine": "1.6.
|
|
32
|
-
"@abtnode/util": "1.6.
|
|
33
|
-
"@arcblock/did": "^1.
|
|
34
|
-
"@arcblock/event-hub": "1.
|
|
22
|
+
"@abtnode/certificate-manager": "1.6.18",
|
|
23
|
+
"@abtnode/constant": "1.6.18",
|
|
24
|
+
"@abtnode/cron": "1.6.18",
|
|
25
|
+
"@abtnode/db": "1.6.18",
|
|
26
|
+
"@abtnode/logger": "1.6.18",
|
|
27
|
+
"@abtnode/queue": "1.6.18",
|
|
28
|
+
"@abtnode/rbac": "1.6.18",
|
|
29
|
+
"@abtnode/router-provider": "1.6.18",
|
|
30
|
+
"@abtnode/static-server": "1.6.18",
|
|
31
|
+
"@abtnode/timemachine": "1.6.18",
|
|
32
|
+
"@abtnode/util": "1.6.18",
|
|
33
|
+
"@arcblock/did": "^1.14.8",
|
|
34
|
+
"@arcblock/event-hub": "1.14.8",
|
|
35
35
|
"@arcblock/pm2-events": "^0.0.5",
|
|
36
|
-
"@arcblock/vc": "^1.
|
|
37
|
-
"@blocklet/meta": "1.6.
|
|
36
|
+
"@arcblock/vc": "^1.14.8",
|
|
37
|
+
"@blocklet/meta": "1.6.18",
|
|
38
38
|
"@fidm/x509": "^1.2.1",
|
|
39
39
|
"@nedb/core": "^1.2.2",
|
|
40
40
|
"@nedb/multi": "^1.2.2",
|
|
41
|
-
"@ocap/mcrypto": "^1.
|
|
42
|
-
"@ocap/util": "^1.
|
|
43
|
-
"@ocap/wallet": "^1.
|
|
41
|
+
"@ocap/mcrypto": "^1.14.8",
|
|
42
|
+
"@ocap/util": "^1.14.8",
|
|
43
|
+
"@ocap/wallet": "^1.14.8",
|
|
44
44
|
"@slack/webhook": "^5.0.3",
|
|
45
45
|
"axios": "^0.21.4",
|
|
46
46
|
"axon": "^2.0.3",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"js-yaml": "^3.14.0",
|
|
58
58
|
"lodash": "^4.17.21",
|
|
59
59
|
"lru-cache": "^6.0.0",
|
|
60
|
-
"pm2": "^
|
|
60
|
+
"pm2": "^5.1.2",
|
|
61
61
|
"semver": "^7.3.2",
|
|
62
62
|
"shelljs": "^0.8.4",
|
|
63
63
|
"slugify": "^1.4.6",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"express": "^4.17.1",
|
|
76
76
|
"jest": "^27.4.5"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "2f02f166869d8ebedc0466068f6ed90ab3e07b87"
|
|
79
79
|
}
|