@abtnode/core 1.17.7-beta-20251225-073259-cb6ecf68 → 1.17.7-beta-20251229-085620-84f09930
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/manager/disk.js +150 -36
- package/lib/blocklet/manager/ensure-blocklet-running.js +1 -1
- package/lib/blocklet/manager/helper/blue-green-start-blocklet.js +1 -1
- package/lib/blocklet/manager/helper/install-application-from-general.js +2 -3
- package/lib/blocklet/manager/helper/install-component-from-url.js +7 -4
- package/lib/blocklet/migration-dist/migration.cjs +5 -4
- package/lib/blocklet/passport/index.js +10 -3
- package/lib/blocklet/project/index.js +7 -2
- package/lib/blocklet/security/index.js +2 -2
- package/lib/cert.js +6 -3
- package/lib/event/index.js +98 -87
- package/lib/event/util.js +7 -13
- package/lib/index.js +18 -27
- package/lib/migrations/1.17.7-beta-2025122601-settings-authentication.js +19 -0
- package/lib/migrations/1.5.0-site.js +3 -7
- package/lib/migrations/1.5.15-site.js +3 -7
- package/lib/monitor/blocklet-runtime-monitor.js +37 -5
- package/lib/monitor/node-runtime-monitor.js +4 -4
- package/lib/router/helper.js +525 -452
- package/lib/router/index.js +280 -104
- package/lib/router/manager.js +14 -28
- package/lib/states/audit-log.js +6 -3
- package/lib/states/blocklet-child.js +93 -1
- package/lib/states/blocklet-extras.js +1 -1
- package/lib/states/blocklet.js +429 -197
- package/lib/states/node.js +0 -10
- package/lib/states/site.js +87 -4
- package/lib/team/manager.js +2 -21
- package/lib/util/blocklet.js +71 -37
- package/lib/util/get-accessible-external-node-ip.js +21 -6
- package/lib/util/index.js +3 -3
- package/lib/util/ip.js +15 -1
- package/lib/util/launcher.js +11 -11
- package/lib/util/ready.js +2 -9
- package/lib/util/reset-node.js +6 -5
- package/lib/validators/router.js +0 -3
- package/lib/webhook/sender/api/index.js +5 -0
- package/package.json +35 -37
- package/lib/migrations/1.0.36-snapshot.js +0 -10
- package/lib/migrations/1.1.9-snapshot.js +0 -7
- package/lib/states/routing-snapshot.js +0 -146
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.17.7-beta-
|
|
6
|
+
"version": "1.17.7-beta-20251229-085620-84f09930",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -17,46 +17,44 @@
|
|
|
17
17
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@abtnode/analytics": "1.17.7-beta-
|
|
21
|
-
"@abtnode/auth": "1.17.7-beta-
|
|
22
|
-
"@abtnode/certificate-manager": "1.17.7-beta-
|
|
23
|
-
"@abtnode/constant": "1.17.7-beta-
|
|
24
|
-
"@abtnode/cron": "1.17.7-beta-
|
|
25
|
-
"@abtnode/db-cache": "1.17.7-beta-
|
|
26
|
-
"@abtnode/docker-utils": "1.17.7-beta-
|
|
27
|
-
"@abtnode/logger": "1.17.7-beta-
|
|
28
|
-
"@abtnode/models": "1.17.7-beta-
|
|
29
|
-
"@abtnode/queue": "1.17.7-beta-
|
|
30
|
-
"@abtnode/rbac": "1.17.7-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.17.7-beta-
|
|
32
|
-
"@abtnode/
|
|
33
|
-
"@abtnode/timemachine": "1.17.7-beta-20251225-073259-cb6ecf68",
|
|
34
|
-
"@abtnode/util": "1.17.7-beta-20251225-073259-cb6ecf68",
|
|
20
|
+
"@abtnode/analytics": "1.17.7-beta-20251229-085620-84f09930",
|
|
21
|
+
"@abtnode/auth": "1.17.7-beta-20251229-085620-84f09930",
|
|
22
|
+
"@abtnode/certificate-manager": "1.17.7-beta-20251229-085620-84f09930",
|
|
23
|
+
"@abtnode/constant": "1.17.7-beta-20251229-085620-84f09930",
|
|
24
|
+
"@abtnode/cron": "1.17.7-beta-20251229-085620-84f09930",
|
|
25
|
+
"@abtnode/db-cache": "1.17.7-beta-20251229-085620-84f09930",
|
|
26
|
+
"@abtnode/docker-utils": "1.17.7-beta-20251229-085620-84f09930",
|
|
27
|
+
"@abtnode/logger": "1.17.7-beta-20251229-085620-84f09930",
|
|
28
|
+
"@abtnode/models": "1.17.7-beta-20251229-085620-84f09930",
|
|
29
|
+
"@abtnode/queue": "1.17.7-beta-20251229-085620-84f09930",
|
|
30
|
+
"@abtnode/rbac": "1.17.7-beta-20251229-085620-84f09930",
|
|
31
|
+
"@abtnode/router-provider": "1.17.7-beta-20251229-085620-84f09930",
|
|
32
|
+
"@abtnode/util": "1.17.7-beta-20251229-085620-84f09930",
|
|
35
33
|
"@aigne/aigne-hub": "^0.10.15",
|
|
36
|
-
"@arcblock/did": "^1.27.
|
|
37
|
-
"@arcblock/did-connect-js": "^1.27.
|
|
38
|
-
"@arcblock/did-ext": "^1.27.
|
|
34
|
+
"@arcblock/did": "^1.27.16",
|
|
35
|
+
"@arcblock/did-connect-js": "^1.27.16",
|
|
36
|
+
"@arcblock/did-ext": "^1.27.16",
|
|
39
37
|
"@arcblock/did-motif": "^1.1.14",
|
|
40
|
-
"@arcblock/did-util": "^1.27.
|
|
41
|
-
"@arcblock/event-hub": "^1.27.
|
|
42
|
-
"@arcblock/jwt": "^1.27.
|
|
38
|
+
"@arcblock/did-util": "^1.27.16",
|
|
39
|
+
"@arcblock/event-hub": "^1.27.16",
|
|
40
|
+
"@arcblock/jwt": "^1.27.16",
|
|
43
41
|
"@arcblock/pm2-events": "^0.0.5",
|
|
44
|
-
"@arcblock/validator": "^1.27.
|
|
45
|
-
"@arcblock/vc": "^1.27.
|
|
46
|
-
"@blocklet/constant": "1.17.7-beta-
|
|
47
|
-
"@blocklet/did-space-js": "^1.2.
|
|
48
|
-
"@blocklet/env": "1.17.7-beta-
|
|
42
|
+
"@arcblock/validator": "^1.27.16",
|
|
43
|
+
"@arcblock/vc": "^1.27.16",
|
|
44
|
+
"@blocklet/constant": "1.17.7-beta-20251229-085620-84f09930",
|
|
45
|
+
"@blocklet/did-space-js": "^1.2.12",
|
|
46
|
+
"@blocklet/env": "1.17.7-beta-20251229-085620-84f09930",
|
|
49
47
|
"@blocklet/error": "^0.3.5",
|
|
50
|
-
"@blocklet/meta": "1.17.7-beta-
|
|
51
|
-
"@blocklet/resolver": "1.17.7-beta-
|
|
52
|
-
"@blocklet/sdk": "1.17.7-beta-
|
|
53
|
-
"@blocklet/server-js": "1.17.7-beta-
|
|
54
|
-
"@blocklet/store": "1.17.7-beta-
|
|
55
|
-
"@blocklet/theme": "^3.
|
|
48
|
+
"@blocklet/meta": "1.17.7-beta-20251229-085620-84f09930",
|
|
49
|
+
"@blocklet/resolver": "1.17.7-beta-20251229-085620-84f09930",
|
|
50
|
+
"@blocklet/sdk": "1.17.7-beta-20251229-085620-84f09930",
|
|
51
|
+
"@blocklet/server-js": "1.17.7-beta-20251229-085620-84f09930",
|
|
52
|
+
"@blocklet/store": "1.17.7-beta-20251229-085620-84f09930",
|
|
53
|
+
"@blocklet/theme": "^3.3.1",
|
|
56
54
|
"@fidm/x509": "^1.2.1",
|
|
57
|
-
"@ocap/mcrypto": "^1.27.
|
|
58
|
-
"@ocap/util": "^1.27.
|
|
59
|
-
"@ocap/wallet": "^1.27.
|
|
55
|
+
"@ocap/mcrypto": "^1.27.16",
|
|
56
|
+
"@ocap/util": "^1.27.16",
|
|
57
|
+
"@ocap/wallet": "^1.27.16",
|
|
60
58
|
"@slack/webhook": "^7.0.6",
|
|
61
59
|
"archiver": "^7.0.1",
|
|
62
60
|
"axios": "^1.7.9",
|
|
@@ -116,5 +114,5 @@
|
|
|
116
114
|
"express": "^4.18.2",
|
|
117
115
|
"unzipper": "^0.10.11"
|
|
118
116
|
},
|
|
119
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "fe2ffc3cf431bbaa89ac802bed793aa1188da4c3"
|
|
120
118
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-await-in-loop */
|
|
2
|
-
/* eslint-disable no-underscore-dangle */
|
|
3
|
-
module.exports = async ({ node, printInfo }) => {
|
|
4
|
-
printInfo('Try to update routing snapshot to 1.0.36...');
|
|
5
|
-
const hash = await node.takeRoutingSnapshot(
|
|
6
|
-
{ message: 'Migrate routing snapshot to pretty format', dryRun: false },
|
|
7
|
-
{}
|
|
8
|
-
);
|
|
9
|
-
printInfo('take routing snapshot on pretty format', { hash });
|
|
10
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-await-in-loop */
|
|
2
|
-
/* eslint-disable no-underscore-dangle */
|
|
3
|
-
module.exports = async ({ node, printInfo }) => {
|
|
4
|
-
printInfo('Try to update routing snapshot to 1.1.9...');
|
|
5
|
-
const hash = await node.takeRoutingSnapshot({ message: 'Migrate routing snapshot to 1.1.9', dryRun: false }, {});
|
|
6
|
-
printInfo('take routing snapshot on new keys', { hash });
|
|
7
|
-
};
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
const fs = require('fs-extra');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const get = require('lodash/get');
|
|
4
|
-
const TimeMachine = require('@abtnode/timemachine');
|
|
5
|
-
const logger = require('@abtnode/logger')('@abtnode/core:states:routing-snapshot');
|
|
6
|
-
|
|
7
|
-
module.exports = class RoutingSnapshot {
|
|
8
|
-
constructor({ baseDir, getRoutingData }) {
|
|
9
|
-
if (typeof getRoutingData !== 'function') {
|
|
10
|
-
throw new Error('Must provide a valid getRoutingData function when create new RoutingSnapshot');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
this.metaFile = path.join(baseDir, 'routing_snapshots_tag');
|
|
14
|
-
this.getRoutingData = getRoutingData;
|
|
15
|
-
this.timemachine = new TimeMachine({
|
|
16
|
-
sources: async () => {
|
|
17
|
-
const { sites = [] } = await this.getRoutingData();
|
|
18
|
-
|
|
19
|
-
sites.forEach((r) => delete r.updatedAt);
|
|
20
|
-
sites.sort((x, y) => {
|
|
21
|
-
try {
|
|
22
|
-
return new Date(x.createdAt).getTime() - new Date(y.createdAt).getTime();
|
|
23
|
-
} catch (error) {
|
|
24
|
-
logger.error('compare routing rule failed', { error });
|
|
25
|
-
return 0;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// Note: we should keep lines indented
|
|
30
|
-
return JSON.stringify(
|
|
31
|
-
{
|
|
32
|
-
meta: {
|
|
33
|
-
tag: fs.readFileSync(this.metaFile).toString(),
|
|
34
|
-
},
|
|
35
|
-
sites,
|
|
36
|
-
},
|
|
37
|
-
null,
|
|
38
|
-
2
|
|
39
|
-
);
|
|
40
|
-
},
|
|
41
|
-
targetDir: path.join(baseDir, 'routing_snapshots'),
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
if (!fs.existsSync(this.metaFile)) {
|
|
45
|
-
fs.createFileSync(this.metaFile);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
init() {
|
|
50
|
-
return this.timemachine
|
|
51
|
-
.getLastSnapshot(true)
|
|
52
|
-
.then((hash) => {
|
|
53
|
-
if (hash) {
|
|
54
|
-
return hash;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return this.timemachine
|
|
58
|
-
.takeSnapshot('Initial snapshot')
|
|
59
|
-
.then((initialHash) => {
|
|
60
|
-
logger.info('initial snapshot for routing rules', { initialHash });
|
|
61
|
-
return initialHash;
|
|
62
|
-
})
|
|
63
|
-
.catch((err) => {
|
|
64
|
-
logger.error('Cannot take initial routing snapshot', { error: err });
|
|
65
|
-
return null;
|
|
66
|
-
});
|
|
67
|
-
})
|
|
68
|
-
.catch((err) => {
|
|
69
|
-
logger.error('Cannot get latest routing snapshot', { error: err });
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
getLastSnapshot(shallow = true) {
|
|
74
|
-
return this.timemachine.getLastSnapshot(shallow);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
hasSnapshot(hash) {
|
|
78
|
-
return this.timemachine.hasSnapshot(hash);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
async readSnapshot(hash) {
|
|
82
|
-
if (!hash || !(await this.hasSnapshot(hash))) {
|
|
83
|
-
return {};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const result = await this.timemachine.exportSnapshot(hash).then((content) => JSON.parse(content));
|
|
87
|
-
if (!result) {
|
|
88
|
-
return {};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return result;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async readSnapshotSites(hash) {
|
|
95
|
-
const { sites = [] } = await this.readSnapshot(hash);
|
|
96
|
-
return sites;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
takeSnapshot(message, dryRun = true) {
|
|
100
|
-
if (!dryRun) {
|
|
101
|
-
fs.writeFileSync(this.metaFile, Date.now().toString());
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return this.timemachine.takeSnapshot(message, undefined, dryRun);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @deprecated
|
|
109
|
-
* @param {string} hash
|
|
110
|
-
*/
|
|
111
|
-
exportSnapshot(hash) {
|
|
112
|
-
return this.timemachine.exportSnapshot(hash).then((content) => JSON.parse(content));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// eslint-disable-next-line no-unused-vars
|
|
116
|
-
listSnapshots({ limit = 5, trimFirst = true } = {}, context) {
|
|
117
|
-
return new Promise((resolve) => {
|
|
118
|
-
this.timemachine.listSnapshots(limit + 1).then((stream) => {
|
|
119
|
-
const snapshots = [];
|
|
120
|
-
|
|
121
|
-
stream.on('data', (snapshot) => {
|
|
122
|
-
snapshots.push({
|
|
123
|
-
hash: snapshot.hash,
|
|
124
|
-
tree: snapshot.tree,
|
|
125
|
-
message: snapshot.message,
|
|
126
|
-
author: snapshot.author.name,
|
|
127
|
-
createdAt: new Date(snapshot.author.date.seconds * 1000),
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
stream.on('end', () => {
|
|
132
|
-
if (snapshots.length > 0 && trimFirst) {
|
|
133
|
-
snapshots.pop();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return resolve(snapshots);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
restoreMetaData(meta) {
|
|
143
|
-
logger.info('restore meta data');
|
|
144
|
-
fs.writeFileSync(this.metaFile, get(meta, 'tag') || '');
|
|
145
|
-
}
|
|
146
|
-
};
|