@abtnode/core 1.7.9 → 1.7.12
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/api/node.js +7 -1
- package/lib/api/team.js +2 -2
- package/lib/blocklet/manager/disk.js +153 -91
- package/lib/blocklet/registry.js +6 -2
- package/lib/cert.js +14 -0
- package/lib/event.js +9 -0
- package/lib/index.js +41 -9
- package/lib/migrations/1.7.12-blocklet-meta.js +51 -0
- package/lib/router/index.js +8 -1
- package/lib/router/manager.js +3 -3
- package/lib/states/README.md +31 -1
- package/lib/states/audit-log.js +382 -0
- package/lib/states/blocklet.js +9 -7
- package/lib/states/index.js +3 -0
- package/lib/states/node.js +8 -0
- package/lib/util/blocklet.js +103 -45
- package/lib/util/index.js +37 -7
- package/lib/util/ip.js +6 -0
- package/lib/util/rpc.js +16 -0
- package/lib/util/ua.js +54 -0
- package/lib/util/upgrade.js +3 -15
- package/lib/validators/node.js +13 -0
- package/package.json +21 -21
- package/lib/util/service.js +0 -81
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.7.
|
|
6
|
+
"version": "1.7.12",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,31 +19,30 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/certificate-manager": "1.7.
|
|
23
|
-
"@abtnode/constant": "1.7.
|
|
24
|
-
"@abtnode/cron": "1.7.
|
|
25
|
-
"@abtnode/db": "1.7.
|
|
26
|
-
"@abtnode/logger": "1.7.
|
|
27
|
-
"@abtnode/queue": "1.7.
|
|
28
|
-
"@abtnode/rbac": "1.7.
|
|
29
|
-
"@abtnode/router-provider": "1.7.
|
|
30
|
-
"@abtnode/static-server": "1.7.
|
|
31
|
-
"@abtnode/timemachine": "1.7.
|
|
32
|
-
"@abtnode/util": "1.7.
|
|
33
|
-
"@arcblock/did": "^1.16.
|
|
22
|
+
"@abtnode/certificate-manager": "1.7.12",
|
|
23
|
+
"@abtnode/constant": "1.7.12",
|
|
24
|
+
"@abtnode/cron": "1.7.12",
|
|
25
|
+
"@abtnode/db": "1.7.12",
|
|
26
|
+
"@abtnode/logger": "1.7.12",
|
|
27
|
+
"@abtnode/queue": "1.7.12",
|
|
28
|
+
"@abtnode/rbac": "1.7.12",
|
|
29
|
+
"@abtnode/router-provider": "1.7.12",
|
|
30
|
+
"@abtnode/static-server": "1.7.12",
|
|
31
|
+
"@abtnode/timemachine": "1.7.12",
|
|
32
|
+
"@abtnode/util": "1.7.12",
|
|
33
|
+
"@arcblock/did": "^1.16.6",
|
|
34
34
|
"@arcblock/did-motif": "^1.1.5",
|
|
35
|
-
"@arcblock/event-hub": "1.16.
|
|
35
|
+
"@arcblock/event-hub": "1.16.6",
|
|
36
36
|
"@arcblock/pm2-events": "^0.0.5",
|
|
37
|
-
"@arcblock/vc": "^1.16.
|
|
38
|
-
"@blocklet/meta": "1.7.
|
|
37
|
+
"@arcblock/vc": "^1.16.6",
|
|
38
|
+
"@blocklet/meta": "1.7.12",
|
|
39
39
|
"@fidm/x509": "^1.2.1",
|
|
40
40
|
"@nedb/core": "^1.2.2",
|
|
41
41
|
"@nedb/multi": "^1.2.2",
|
|
42
|
-
"@ocap/mcrypto": "^1.16.
|
|
43
|
-
"@ocap/util": "^1.16.
|
|
44
|
-
"@ocap/wallet": "^1.16.
|
|
42
|
+
"@ocap/mcrypto": "^1.16.6",
|
|
43
|
+
"@ocap/util": "^1.16.6",
|
|
44
|
+
"@ocap/wallet": "^1.16.6",
|
|
45
45
|
"@slack/webhook": "^5.0.3",
|
|
46
|
-
"ajv": "^7.0.3",
|
|
47
46
|
"axios": "^0.26.1",
|
|
48
47
|
"axon": "^2.0.3",
|
|
49
48
|
"chalk": "^4.0.0",
|
|
@@ -68,6 +67,7 @@
|
|
|
68
67
|
"stream-to-promise": "^3.0.0",
|
|
69
68
|
"systeminformation": "^5.11.5",
|
|
70
69
|
"tar": "^6.1.0",
|
|
70
|
+
"ua-parser-js": "^1.0.2",
|
|
71
71
|
"unzipper": "^0.10.11",
|
|
72
72
|
"url-join": "^4.0.1",
|
|
73
73
|
"uuid": "7.0.3"
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"express": "^4.17.1",
|
|
79
79
|
"jest": "^27.4.5"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "afc78b9cb92448676149262fb02432bc256a5524"
|
|
82
82
|
}
|
package/lib/util/service.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
const fs = require('fs-extra');
|
|
2
|
-
const cloneDeep = require('lodash/cloneDeep');
|
|
3
|
-
const Ajv = require('ajv').default;
|
|
4
|
-
|
|
5
|
-
const { NODE_SERVICES } = require('@abtnode/constant');
|
|
6
|
-
|
|
7
|
-
const ajv = new Ajv({
|
|
8
|
-
useDefaults: true,
|
|
9
|
-
removeAdditional: 'all',
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const SERVICES = {
|
|
13
|
-
AUTH: fs.readJSONSync(require.resolve('@abtnode/blocklet-services/configs/auth.json')),
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const getServices = ({ stringifySchema = false } = {}) => {
|
|
17
|
-
const list = Object.values(SERVICES).map((x) => {
|
|
18
|
-
const data = cloneDeep(x);
|
|
19
|
-
if (stringifySchema) {
|
|
20
|
-
data.schema = JSON.stringify(x.schema);
|
|
21
|
-
}
|
|
22
|
-
return data;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// backward compatible
|
|
26
|
-
const authService = cloneDeep(list.find((x) => x.name === NODE_SERVICES.AUTH));
|
|
27
|
-
authService.name = NODE_SERVICES.AUTH_SERVICE;
|
|
28
|
-
list.push(authService);
|
|
29
|
-
|
|
30
|
-
return list;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const getServiceMeta = (serviceName) => {
|
|
34
|
-
if (!serviceName) {
|
|
35
|
-
throw new Error('service name should not be empty');
|
|
36
|
-
}
|
|
37
|
-
const metas = getServices();
|
|
38
|
-
const meta = metas.find((x) => x.name === serviceName);
|
|
39
|
-
if (!meta) {
|
|
40
|
-
throw new Error(`service ${serviceName} does not exist`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return meta;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const getServiceConfig = (service, customConfig) => {
|
|
47
|
-
const serviceMeta = typeof service === 'string' ? getServiceMeta(service) : service;
|
|
48
|
-
|
|
49
|
-
const validate = ajv.compile(serviceMeta.schema.JSONSchema);
|
|
50
|
-
|
|
51
|
-
const data = cloneDeep(customConfig || {});
|
|
52
|
-
// this method may have side effect thar will fill default value to customConfig
|
|
53
|
-
validate(data || {});
|
|
54
|
-
|
|
55
|
-
return data;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const getDefaultServiceConfig = (service) => {
|
|
59
|
-
const serviceMeta = typeof service === 'string' ? getServiceMeta(service) : service;
|
|
60
|
-
|
|
61
|
-
// parse empty custom config to get default config
|
|
62
|
-
return getServiceConfig(serviceMeta, {});
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const findService = (services, name) => {
|
|
66
|
-
const names = [name];
|
|
67
|
-
|
|
68
|
-
// backward compatible
|
|
69
|
-
if (name === NODE_SERVICES.AUTH) {
|
|
70
|
-
names.push(NODE_SERVICES.AUTH_SERVICE);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return (services || []).find((x) => names.includes(x.name));
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
module.exports = {
|
|
77
|
-
getServices,
|
|
78
|
-
getServiceConfig,
|
|
79
|
-
getDefaultServiceConfig,
|
|
80
|
-
findService,
|
|
81
|
-
};
|