@abtnode/core 1.16.52-beta-20251003-083412-fdfc4e36 → 1.16.52-beta-20251005-235515-42ad5caf
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/team.js +579 -47
- package/lib/blocklet/downloader/blocklet-downloader.js +2 -2
- package/lib/blocklet/downloader/bundle-downloader.js +13 -38
- package/lib/blocklet/manager/disk.js +200 -84
- package/lib/blocklet/manager/ensure-blocklet-running.js +3 -2
- package/lib/blocklet/manager/helper/blue-green-get-componentids.js +59 -0
- package/lib/blocklet/manager/helper/blue-green-start-blocklet.js +292 -0
- package/lib/blocklet/manager/helper/blue-green-update-blocklet-status.js +18 -0
- package/lib/blocklet/manager/helper/blue-green-upgrade-blocklet.js +191 -0
- package/lib/blocklet/manager/helper/upgrade-components.js +2 -9
- package/lib/blocklet/migration-dist/migration.cjs +458 -456
- package/lib/blocklet/passport/index.js +8 -2
- package/lib/index.js +18 -0
- package/lib/monitor/blocklet-runtime-monitor.js +12 -7
- package/lib/states/audit-log.js +54 -2
- package/lib/states/blocklet.js +23 -8
- package/lib/states/index.js +3 -0
- package/lib/states/org.js +661 -0
- package/lib/team/manager.js +10 -3
- package/lib/util/blocklet.js +190 -115
- package/lib/util/docker/is-docker-only-single-instances.js +17 -0
- package/lib/util/org.js +99 -0
- package/lib/validators/org.js +19 -0
- package/package.json +26 -26
|
@@ -153,7 +153,7 @@ class BlockletDownloader extends EventEmitter {
|
|
|
153
153
|
bundles: downloadList.map((x) => get(x, 'dist.tarball')),
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
await Promise.all(
|
|
157
157
|
downloadList.map((meta) => {
|
|
158
158
|
const url = meta.dist.tarball;
|
|
159
159
|
return this.bundleDownloader.download(meta, did, url, {
|
|
@@ -165,7 +165,7 @@ class BlockletDownloader extends EventEmitter {
|
|
|
165
165
|
})
|
|
166
166
|
);
|
|
167
167
|
|
|
168
|
-
const isCancelled =
|
|
168
|
+
const isCancelled = await this.bundleDownloader.isCanceled(did);
|
|
169
169
|
|
|
170
170
|
await postDownload({ downloadList, downloadComponentIds, isCancelled });
|
|
171
171
|
|
|
@@ -40,11 +40,6 @@ class BundleDownloader extends EventEmitter {
|
|
|
40
40
|
this.cache = cache;
|
|
41
41
|
this.logger = logger;
|
|
42
42
|
this.getNodeInfo = getNodeInfo;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* { did: Map({ <childDid>: <downloadFile.cancelCtrl> }) }
|
|
46
|
-
*/
|
|
47
|
-
this.downloadCtrls = {};
|
|
48
43
|
/**
|
|
49
44
|
* { [download-did-version]: Lock }
|
|
50
45
|
*/
|
|
@@ -86,18 +81,17 @@ class BundleDownloader extends EventEmitter {
|
|
|
86
81
|
tarball,
|
|
87
82
|
integrity,
|
|
88
83
|
verify: true,
|
|
89
|
-
ctrlStore: this.downloadCtrls,
|
|
90
|
-
rootDid,
|
|
91
84
|
url,
|
|
92
85
|
context,
|
|
93
86
|
onProgress,
|
|
87
|
+
rootDid,
|
|
94
88
|
});
|
|
95
89
|
} catch (error) {
|
|
96
90
|
this.logger.error('download bundle failed', { did, title, version, url, error });
|
|
97
91
|
throw error;
|
|
98
92
|
}
|
|
99
93
|
this.logger.info('downloaded blocklet tar file', { name, version, tarballPath });
|
|
100
|
-
if (
|
|
94
|
+
if (await this.isCanceled(rootDid)) {
|
|
101
95
|
return { isCancelled: true };
|
|
102
96
|
}
|
|
103
97
|
|
|
@@ -121,13 +115,14 @@ class BundleDownloader extends EventEmitter {
|
|
|
121
115
|
}
|
|
122
116
|
|
|
123
117
|
// eslint-disable-next-line no-unused-vars
|
|
124
|
-
cancelDownload(rootDid) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
118
|
+
cancelDownload = async (rootDid) => {
|
|
119
|
+
await lock.groupSet('download-ctrl', rootDid, 'canceled');
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
isCanceled = async (rootDid) => {
|
|
123
|
+
const canceled = await lock.groupGet('download-ctrl', rootDid);
|
|
124
|
+
return canceled === 'canceled';
|
|
125
|
+
};
|
|
131
126
|
|
|
132
127
|
/**
|
|
133
128
|
*
|
|
@@ -139,10 +134,9 @@ class BundleDownloader extends EventEmitter {
|
|
|
139
134
|
* did: string,
|
|
140
135
|
* integrity: string,
|
|
141
136
|
* verify: boolean = true,
|
|
142
|
-
* ctrlStore: {},
|
|
143
137
|
* rootDid: string,
|
|
144
138
|
* context: {} = {},
|
|
145
|
-
* }} { url, cwd, tarball, did, integrity, verify = true,
|
|
139
|
+
* }} { url, cwd, tarball, did, integrity, verify = true, rootDid, context = {} }
|
|
146
140
|
* @return {*}
|
|
147
141
|
* @memberof BlockletManager
|
|
148
142
|
*/
|
|
@@ -153,10 +147,9 @@ class BundleDownloader extends EventEmitter {
|
|
|
153
147
|
did,
|
|
154
148
|
integrity,
|
|
155
149
|
verify = true,
|
|
156
|
-
ctrlStore = {},
|
|
157
|
-
rootDid,
|
|
158
150
|
context = {},
|
|
159
151
|
onProgress = () => {},
|
|
152
|
+
rootDid,
|
|
160
153
|
}) {
|
|
161
154
|
fs.mkdirSync(cwd, { recursive: true });
|
|
162
155
|
|
|
@@ -182,13 +175,6 @@ class BundleDownloader extends EventEmitter {
|
|
|
182
175
|
} else if (protocol.startsWith('file')) {
|
|
183
176
|
await fs.copy(decodeURIComponent(fileURLToPath(url)), tarballPath);
|
|
184
177
|
} else {
|
|
185
|
-
const cancelCtrl = new downloadFile.CancelCtrl();
|
|
186
|
-
|
|
187
|
-
if (!ctrlStore[rootDid]) {
|
|
188
|
-
ctrlStore[rootDid] = new Map();
|
|
189
|
-
}
|
|
190
|
-
ctrlStore[rootDid].set(did, cancelCtrl);
|
|
191
|
-
|
|
192
178
|
const headers = pick(context.headers ? cloneDeep(context.headers) : {}, [
|
|
193
179
|
'x-server-did',
|
|
194
180
|
'x-server-public-key',
|
|
@@ -203,7 +189,7 @@ class BundleDownloader extends EventEmitter {
|
|
|
203
189
|
url,
|
|
204
190
|
path.join(cwd, tarballName),
|
|
205
191
|
{
|
|
206
|
-
|
|
192
|
+
checkCanceled: () => this.isCanceled(rootDid),
|
|
207
193
|
onProgress: ({ total, current }) => {
|
|
208
194
|
onProgress({ status: 'downloading', total, current });
|
|
209
195
|
},
|
|
@@ -213,17 +199,6 @@ class BundleDownloader extends EventEmitter {
|
|
|
213
199
|
headers,
|
|
214
200
|
}
|
|
215
201
|
);
|
|
216
|
-
|
|
217
|
-
if (ctrlStore[rootDid]) {
|
|
218
|
-
ctrlStore[rootDid].delete(did);
|
|
219
|
-
if (!ctrlStore[rootDid].size) {
|
|
220
|
-
delete ctrlStore[rootDid];
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (cancelCtrl.isCancelled) {
|
|
225
|
-
return downloadFile.CANCEL;
|
|
226
|
-
}
|
|
227
202
|
}
|
|
228
203
|
|
|
229
204
|
if (verify) {
|