@abtnode/core 1.16.14-beta-3127f514 → 1.16.14-beta-c2843ec5
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 +4 -1
- package/lib/index.js +2 -1
- package/lib/router/helper.js +12 -2
- package/lib/router/index.js +1 -0
- package/package.json +19 -19
package/lib/api/node.js
CHANGED
|
@@ -24,7 +24,8 @@ class NodeAPI {
|
|
|
24
24
|
* @param {object} states StateDB
|
|
25
25
|
* @param {string} nodeDid
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
// eslint-disable-next-line no-unused-vars
|
|
28
|
+
constructor(states, nodeDid, getRouterCapabilities = (_) => ({})) {
|
|
28
29
|
assert.notStrictEqual(states, undefined, 'argument states can not be undefined');
|
|
29
30
|
assert.notStrictEqual(states, null, 'argument states can not be null');
|
|
30
31
|
|
|
@@ -39,6 +40,7 @@ class NodeAPI {
|
|
|
39
40
|
});
|
|
40
41
|
|
|
41
42
|
this.state = states.node;
|
|
43
|
+
this.getRouterCapabilities = getRouterCapabilities;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
async updateNodeInfo(entity = {}, context) {
|
|
@@ -73,6 +75,7 @@ class NodeAPI {
|
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
info.uptime = process.uptime() * 1000;
|
|
78
|
+
info.capabilities = this.getRouterCapabilities(info);
|
|
76
79
|
|
|
77
80
|
return info;
|
|
78
81
|
}
|
package/lib/index.js
CHANGED
|
@@ -206,9 +206,10 @@ function ABTNode(options) {
|
|
|
206
206
|
deleteRoutingRule,
|
|
207
207
|
addDomainAlias,
|
|
208
208
|
deleteDomainAlias,
|
|
209
|
+
getRouterCapabilities,
|
|
209
210
|
} = getRouterHelpers({ dataDirs, routingSnapshot, routerManager, blockletManager, certManager });
|
|
210
211
|
|
|
211
|
-
const nodeAPI = new NodeAPI(states, options.nodeDid);
|
|
212
|
+
const nodeAPI = new NodeAPI(states, options.nodeDid, getRouterCapabilities);
|
|
212
213
|
const teamAPI = new TeamAPI({ states, teamManager, dataDirs });
|
|
213
214
|
|
|
214
215
|
blockletManager.resetSiteByDid = resetSiteByDid;
|
package/lib/router/helper.js
CHANGED
|
@@ -7,6 +7,7 @@ const UUID = require('uuid');
|
|
|
7
7
|
const dayjs = require('@abtnode/util/lib/dayjs');
|
|
8
8
|
const isUrl = require('is-url');
|
|
9
9
|
const get = require('lodash/get');
|
|
10
|
+
const pick = require('lodash/pick');
|
|
10
11
|
const cloneDeep = require('lodash/cloneDeep');
|
|
11
12
|
const groupBy = require('lodash/groupBy');
|
|
12
13
|
const isEqual = require('lodash/isEqual');
|
|
@@ -676,8 +677,6 @@ module.exports = function getRouterHelpers({ dataDirs, routingSnapshot, routerMa
|
|
|
676
677
|
const notification = states.notification;
|
|
677
678
|
const trafficInsight = states.trafficInsight;
|
|
678
679
|
|
|
679
|
-
// site level duplication detection
|
|
680
|
-
|
|
681
680
|
const downloadCert = async ({ domain, url }) => {
|
|
682
681
|
const destFolder = getTmpDir(path.join(`certificate-${Date.now()}`));
|
|
683
682
|
try {
|
|
@@ -1283,6 +1282,16 @@ module.exports = function getRouterHelpers({ dataDirs, routingSnapshot, routerMa
|
|
|
1283
1282
|
}
|
|
1284
1283
|
};
|
|
1285
1284
|
|
|
1285
|
+
const getRouterCapabilities = (info) => {
|
|
1286
|
+
const providerName = get(info, 'routing.provider', null);
|
|
1287
|
+
|
|
1288
|
+
if (providerName && providers[providerName]) {
|
|
1289
|
+
return pick(providers[providerName].capabilities || {}, ['httpImageFilter']);
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
return {};
|
|
1293
|
+
};
|
|
1294
|
+
|
|
1286
1295
|
const analyzeRouterLog = async () => {
|
|
1287
1296
|
const info = await nodeState.read();
|
|
1288
1297
|
const sites = await getRoutingSites({});
|
|
@@ -1593,6 +1602,7 @@ module.exports = function getRouterHelpers({ dataDirs, routingSnapshot, routerMa
|
|
|
1593
1602
|
deleteDomainAlias,
|
|
1594
1603
|
|
|
1595
1604
|
isGatewayCacheEnabled,
|
|
1605
|
+
getRouterCapabilities,
|
|
1596
1606
|
};
|
|
1597
1607
|
};
|
|
1598
1608
|
|
package/lib/router/index.js
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.14-beta-
|
|
6
|
+
"version": "1.16.14-beta-c2843ec5",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/analytics": "1.16.14-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.14-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.14-beta-
|
|
25
|
-
"@abtnode/constant": "1.16.14-beta-
|
|
26
|
-
"@abtnode/cron": "1.16.14-beta-
|
|
27
|
-
"@abtnode/logger": "1.16.14-beta-
|
|
28
|
-
"@abtnode/models": "1.16.14-beta-
|
|
29
|
-
"@abtnode/queue": "1.16.14-beta-
|
|
30
|
-
"@abtnode/rbac": "1.16.14-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.16.14-beta-
|
|
32
|
-
"@abtnode/static-server": "1.16.14-beta-
|
|
33
|
-
"@abtnode/timemachine": "1.16.14-beta-
|
|
34
|
-
"@abtnode/util": "1.16.14-beta-
|
|
22
|
+
"@abtnode/analytics": "1.16.14-beta-c2843ec5",
|
|
23
|
+
"@abtnode/auth": "1.16.14-beta-c2843ec5",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.14-beta-c2843ec5",
|
|
25
|
+
"@abtnode/constant": "1.16.14-beta-c2843ec5",
|
|
26
|
+
"@abtnode/cron": "1.16.14-beta-c2843ec5",
|
|
27
|
+
"@abtnode/logger": "1.16.14-beta-c2843ec5",
|
|
28
|
+
"@abtnode/models": "1.16.14-beta-c2843ec5",
|
|
29
|
+
"@abtnode/queue": "1.16.14-beta-c2843ec5",
|
|
30
|
+
"@abtnode/rbac": "1.16.14-beta-c2843ec5",
|
|
31
|
+
"@abtnode/router-provider": "1.16.14-beta-c2843ec5",
|
|
32
|
+
"@abtnode/static-server": "1.16.14-beta-c2843ec5",
|
|
33
|
+
"@abtnode/timemachine": "1.16.14-beta-c2843ec5",
|
|
34
|
+
"@abtnode/util": "1.16.14-beta-c2843ec5",
|
|
35
35
|
"@arcblock/did": "1.18.87",
|
|
36
36
|
"@arcblock/did-auth": "1.18.87",
|
|
37
37
|
"@arcblock/did-ext": "^1.18.87",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"@arcblock/pm2-events": "^0.0.5",
|
|
43
43
|
"@arcblock/validator": "^1.18.87",
|
|
44
44
|
"@arcblock/vc": "1.18.87",
|
|
45
|
-
"@blocklet/constant": "1.16.14-beta-
|
|
46
|
-
"@blocklet/meta": "1.16.14-beta-
|
|
47
|
-
"@blocklet/resolver": "1.16.14-beta-
|
|
48
|
-
"@blocklet/sdk": "1.16.14-beta-
|
|
45
|
+
"@blocklet/constant": "1.16.14-beta-c2843ec5",
|
|
46
|
+
"@blocklet/meta": "1.16.14-beta-c2843ec5",
|
|
47
|
+
"@blocklet/resolver": "1.16.14-beta-c2843ec5",
|
|
48
|
+
"@blocklet/sdk": "1.16.14-beta-c2843ec5",
|
|
49
49
|
"@did-space/client": "^0.2.141",
|
|
50
50
|
"@fidm/x509": "^1.2.1",
|
|
51
51
|
"@ocap/mcrypto": "1.18.87",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"jest": "^27.5.1",
|
|
100
100
|
"unzipper": "^0.10.11"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "968bfad93779a21dd1374eede3ac7d4d6d40822b"
|
|
103
103
|
}
|