@abtnode/core 1.16.15-beta-a635f48d → 1.16.15-beta-58d50c9a
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 +17 -13
- package/lib/blocklet/migration.js +8 -0
- package/lib/locales/en.js +1 -1
- package/lib/locales/zh.js +1 -1
- package/lib/states/audit-log.js +5 -1
- package/lib/states/backup.js +4 -3
- package/package.json +20 -20
|
@@ -2690,25 +2690,29 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
2690
2690
|
await this._runPostInstallHook(blocklet, context);
|
|
2691
2691
|
|
|
2692
2692
|
logger.info('start migration');
|
|
2693
|
-
|
|
2693
|
+
{
|
|
2694
2694
|
const oldVersions = {};
|
|
2695
2695
|
forEachBlockletSync(oldBlocklet, (b, { id }) => {
|
|
2696
2696
|
oldVersions[id] = b.meta.version;
|
|
2697
2697
|
});
|
|
2698
2698
|
const nodeEnvironments = await states.node.getEnvironments();
|
|
2699
|
-
const runMigration = (b, { id, ancestors }) => {
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2699
|
+
const runMigration = async (b, { id, ancestors }) => {
|
|
2700
|
+
try {
|
|
2701
|
+
await runMigrationScripts({
|
|
2702
|
+
blocklet: b,
|
|
2703
|
+
appDir: b.env.appDir,
|
|
2704
|
+
env: getRuntimeEnvironments(b, nodeEnvironments, ancestors),
|
|
2705
|
+
oldVersion: oldVersions[id],
|
|
2706
|
+
newVersion: b.meta.version,
|
|
2707
|
+
...getHooksOutputFiles(b),
|
|
2708
|
+
});
|
|
2709
|
+
} catch (error) {
|
|
2710
|
+
logger.error('Failed to run migration scripts', { appDid: did, title: b.meta.title, error });
|
|
2711
|
+
error.message = `Failed to run migration scripts for ${b.meta.title}: ${error.message}`;
|
|
2712
|
+
throw error;
|
|
2713
|
+
}
|
|
2707
2714
|
};
|
|
2708
2715
|
await forEachBlocklet(blocklet, runMigration, { parallel: true });
|
|
2709
|
-
} catch (error) {
|
|
2710
|
-
logger.error('Failed to migrate blocklet', { did, error });
|
|
2711
|
-
throw error;
|
|
2712
2716
|
}
|
|
2713
2717
|
logger.info('end migration');
|
|
2714
2718
|
|
|
@@ -2798,7 +2802,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
2798
2802
|
: BlockletEvents.componentUpgradeFailed;
|
|
2799
2803
|
|
|
2800
2804
|
this.emit(notificationEvent, {
|
|
2801
|
-
blocklet: { ...
|
|
2805
|
+
blocklet: { ...newBlocklet, componentDids, error: { message: err.message } },
|
|
2802
2806
|
context,
|
|
2803
2807
|
});
|
|
2804
2808
|
|
|
@@ -20,6 +20,8 @@ async function runScripts({
|
|
|
20
20
|
printInfo,
|
|
21
21
|
printSuccess,
|
|
22
22
|
printError,
|
|
23
|
+
output,
|
|
24
|
+
error,
|
|
23
25
|
}) {
|
|
24
26
|
// 获取所有待执行的脚本
|
|
25
27
|
let scripts = [];
|
|
@@ -57,6 +59,8 @@ async function runScripts({
|
|
|
57
59
|
cwd: appDir,
|
|
58
60
|
env: getSafeEnv(env),
|
|
59
61
|
silent: false,
|
|
62
|
+
output,
|
|
63
|
+
error,
|
|
60
64
|
});
|
|
61
65
|
printInfo(`Migration script executed: ${scriptPath}`);
|
|
62
66
|
} catch (migrationErr) {
|
|
@@ -101,6 +105,8 @@ module.exports = async ({
|
|
|
101
105
|
printInfo = logger.info,
|
|
102
106
|
printSuccess = logger.info,
|
|
103
107
|
printError = logger.error,
|
|
108
|
+
output,
|
|
109
|
+
error,
|
|
104
110
|
}) => {
|
|
105
111
|
if (!oldVersion) {
|
|
106
112
|
return;
|
|
@@ -128,6 +134,8 @@ module.exports = async ({
|
|
|
128
134
|
printError,
|
|
129
135
|
printInfo,
|
|
130
136
|
printSuccess,
|
|
137
|
+
output,
|
|
138
|
+
error,
|
|
131
139
|
});
|
|
132
140
|
|
|
133
141
|
fs.removeSync(backupDir);
|
package/lib/locales/en.js
CHANGED
|
@@ -13,7 +13,7 @@ module.exports = flat({
|
|
|
13
13
|
},
|
|
14
14
|
isFull: 'The current Space storage space is full, please expand the space and back up again',
|
|
15
15
|
lackOfSpace:
|
|
16
|
-
'The current available space in the storage is insufficient
|
|
16
|
+
'The current available space in the storage is insufficient, Please expand the space and perform the backup again',
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
});
|
package/lib/locales/zh.js
CHANGED
package/lib/states/audit-log.js
CHANGED
|
@@ -124,7 +124,11 @@ const getLogContent = async (action, args, context, result, info, node) => {
|
|
|
124
124
|
case 'upgradeBlocklet':
|
|
125
125
|
const actionName = result.action || 'upgraded';
|
|
126
126
|
if (result.resultStatus === 'failed') {
|
|
127
|
-
|
|
127
|
+
const errMsg = result.error?.message ? `: ${result.error.message}` : '';
|
|
128
|
+
return `${actionName} component failed: **${getComponentNamesWithVersion(
|
|
129
|
+
result,
|
|
130
|
+
result.componentDids
|
|
131
|
+
)}**${errMsg}`;
|
|
128
132
|
}
|
|
129
133
|
return `${actionName} component: **${getComponentNamesWithVersion(result, result.componentDids)}**`;
|
|
130
134
|
case 'deleteComponent':
|
package/lib/states/backup.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { Joi } = require('@arcblock/validator');
|
|
2
|
+
const { BACKUPS } = require('@abtnode/constant');
|
|
2
3
|
const BaseState = require('./base');
|
|
3
4
|
const {
|
|
4
5
|
validateBackupSuccess,
|
|
@@ -29,7 +30,7 @@ const validateBackup = Joi.object({
|
|
|
29
30
|
updatedAt: Joi.string().optional().default('').allow(''),
|
|
30
31
|
|
|
31
32
|
// 0 表示成功了,建议使用常量表示,默认是 1 表示错误的, null 表示备份中
|
|
32
|
-
status: Joi.number().optional().allow(
|
|
33
|
+
status: Joi.number().optional().allow(BACKUPS.STATUS.PROGRESS),
|
|
33
34
|
// 发生错误的时候可以用来存储错误下信息
|
|
34
35
|
message: Joi.string().optional().default('').allow(''),
|
|
35
36
|
|
|
@@ -101,7 +102,7 @@ class BackupState extends BaseState {
|
|
|
101
102
|
{
|
|
102
103
|
$set: {
|
|
103
104
|
...value,
|
|
104
|
-
status:
|
|
105
|
+
status: BACKUPS.STATUS.SUCCEEDED,
|
|
105
106
|
updatedAt: new Date().toISOString(),
|
|
106
107
|
},
|
|
107
108
|
}
|
|
@@ -127,7 +128,7 @@ class BackupState extends BaseState {
|
|
|
127
128
|
{
|
|
128
129
|
$set: {
|
|
129
130
|
...value,
|
|
130
|
-
status:
|
|
131
|
+
status: BACKUPS.STATUS.FAILED,
|
|
131
132
|
updatedAt: new Date().toISOString(),
|
|
132
133
|
},
|
|
133
134
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.15-beta-
|
|
6
|
+
"version": "1.16.15-beta-58d50c9a",
|
|
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.15-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.15-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.15-beta-
|
|
25
|
-
"@abtnode/constant": "1.16.15-beta-
|
|
26
|
-
"@abtnode/cron": "1.16.15-beta-
|
|
27
|
-
"@abtnode/logger": "1.16.15-beta-
|
|
28
|
-
"@abtnode/models": "1.16.15-beta-
|
|
29
|
-
"@abtnode/queue": "1.16.15-beta-
|
|
30
|
-
"@abtnode/rbac": "1.16.15-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.16.15-beta-
|
|
32
|
-
"@abtnode/static-server": "1.16.15-beta-
|
|
33
|
-
"@abtnode/timemachine": "1.16.15-beta-
|
|
34
|
-
"@abtnode/util": "1.16.15-beta-
|
|
22
|
+
"@abtnode/analytics": "1.16.15-beta-58d50c9a",
|
|
23
|
+
"@abtnode/auth": "1.16.15-beta-58d50c9a",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.15-beta-58d50c9a",
|
|
25
|
+
"@abtnode/constant": "1.16.15-beta-58d50c9a",
|
|
26
|
+
"@abtnode/cron": "1.16.15-beta-58d50c9a",
|
|
27
|
+
"@abtnode/logger": "1.16.15-beta-58d50c9a",
|
|
28
|
+
"@abtnode/models": "1.16.15-beta-58d50c9a",
|
|
29
|
+
"@abtnode/queue": "1.16.15-beta-58d50c9a",
|
|
30
|
+
"@abtnode/rbac": "1.16.15-beta-58d50c9a",
|
|
31
|
+
"@abtnode/router-provider": "1.16.15-beta-58d50c9a",
|
|
32
|
+
"@abtnode/static-server": "1.16.15-beta-58d50c9a",
|
|
33
|
+
"@abtnode/timemachine": "1.16.15-beta-58d50c9a",
|
|
34
|
+
"@abtnode/util": "1.16.15-beta-58d50c9a",
|
|
35
35
|
"@arcblock/did": "1.18.89",
|
|
36
36
|
"@arcblock/did-auth": "1.18.89",
|
|
37
37
|
"@arcblock/did-ext": "^1.18.89",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"@arcblock/pm2-events": "^0.0.5",
|
|
43
43
|
"@arcblock/validator": "^1.18.89",
|
|
44
44
|
"@arcblock/vc": "1.18.89",
|
|
45
|
-
"@blocklet/constant": "1.16.15-beta-
|
|
46
|
-
"@blocklet/env": "1.16.15-beta-
|
|
47
|
-
"@blocklet/meta": "1.16.15-beta-
|
|
48
|
-
"@blocklet/resolver": "1.16.15-beta-
|
|
49
|
-
"@blocklet/sdk": "1.16.15-beta-
|
|
45
|
+
"@blocklet/constant": "1.16.15-beta-58d50c9a",
|
|
46
|
+
"@blocklet/env": "1.16.15-beta-58d50c9a",
|
|
47
|
+
"@blocklet/meta": "1.16.15-beta-58d50c9a",
|
|
48
|
+
"@blocklet/resolver": "1.16.15-beta-58d50c9a",
|
|
49
|
+
"@blocklet/sdk": "1.16.15-beta-58d50c9a",
|
|
50
50
|
"@did-space/client": "^0.2.165",
|
|
51
51
|
"@fidm/x509": "^1.2.1",
|
|
52
52
|
"@ocap/mcrypto": "1.18.89",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"jest": "^27.5.1",
|
|
101
101
|
"unzipper": "^0.10.11"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "c54236c1daace6451db561fa6b3eea21ba07bb4d"
|
|
104
104
|
}
|