@abtnode/core 1.16.29-beta-1fb308f8 → 1.16.29-beta-bc7cae11
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/hooks.js +2 -0
- package/lib/blocklet/manager/disk.js +8 -7
- package/lib/blocklet/manager/helper/install-component-from-dev.js +4 -1
- package/lib/blocklet/manager/helper/upgrade-components.js +16 -10
- package/lib/blocklet/migration.js +4 -0
- package/lib/util/index.js +2 -1
- package/package.json +33 -33
package/lib/blocklet/hooks.js
CHANGED
|
@@ -18,6 +18,7 @@ const runUserHook = async (label, hookName, args) => {
|
|
|
18
18
|
silent = false,
|
|
19
19
|
notification,
|
|
20
20
|
did,
|
|
21
|
+
timeout,
|
|
21
22
|
output: outputFile,
|
|
22
23
|
error: errorFile,
|
|
23
24
|
} = args;
|
|
@@ -40,6 +41,7 @@ const runUserHook = async (label, hookName, args) => {
|
|
|
40
41
|
NODE_OPTIONS: getSecurityNodeOptions({ environmentObj: env, ...args }, nodeInfo.enableFileSystemIsolation),
|
|
41
42
|
},
|
|
42
43
|
silent,
|
|
44
|
+
timeout,
|
|
43
45
|
output: outputFile,
|
|
44
46
|
error: errorFile,
|
|
45
47
|
});
|
|
@@ -212,9 +212,10 @@ const { formatEnvironments, getBlockletMeta, validateOwner, isCLI } = util;
|
|
|
212
212
|
|
|
213
213
|
const statusLock = new Lock('blocklet-status-lock');
|
|
214
214
|
|
|
215
|
-
const
|
|
215
|
+
const getHookArgs = (blocklet) => ({
|
|
216
216
|
output: blocklet.mode === BLOCKLET_MODES.DEVELOPMENT ? '' : path.join(blocklet.env.logsDir, 'output.log'),
|
|
217
217
|
error: blocklet.mode === BLOCKLET_MODES.DEVELOPMENT ? '' : path.join(blocklet.env.logsDir, 'error.log'),
|
|
218
|
+
timeout: (get(blocklet, 'meta.timeout.script') || 120) * 1000,
|
|
218
219
|
});
|
|
219
220
|
|
|
220
221
|
const pm2StatusMap = {
|
|
@@ -766,7 +767,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
766
767
|
hooks: Object.assign(b.meta.hooks || {}, b.meta.scripts || {}),
|
|
767
768
|
env,
|
|
768
769
|
did, // root blocklet did,
|
|
769
|
-
...
|
|
770
|
+
...getHookArgs(b),
|
|
770
771
|
});
|
|
771
772
|
|
|
772
773
|
// start process
|
|
@@ -867,7 +868,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
867
868
|
context,
|
|
868
869
|
exitOnError: false,
|
|
869
870
|
silent,
|
|
870
|
-
...
|
|
871
|
+
...getHookArgs(b),
|
|
871
872
|
}),
|
|
872
873
|
componentDids,
|
|
873
874
|
});
|
|
@@ -1063,7 +1064,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
1063
1064
|
notification: states.notification,
|
|
1064
1065
|
context,
|
|
1065
1066
|
exitOnError: false,
|
|
1066
|
-
...
|
|
1067
|
+
...getHookArgs(b),
|
|
1067
1068
|
}),
|
|
1068
1069
|
});
|
|
1069
1070
|
|
|
@@ -1494,7 +1495,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
1494
1495
|
env: { ...getRuntimeEnvironments(blocklet, nodeEnvironments, ancestors), ...configObj },
|
|
1495
1496
|
did,
|
|
1496
1497
|
context,
|
|
1497
|
-
...
|
|
1498
|
+
...getHookArgs(blocklet),
|
|
1498
1499
|
});
|
|
1499
1500
|
}
|
|
1500
1501
|
|
|
@@ -3639,7 +3640,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
3639
3640
|
env: getRuntimeEnvironments(b, nodeEnvironments, [blocklet]),
|
|
3640
3641
|
oldVersion: oldVersions[b.meta.did],
|
|
3641
3642
|
newVersion: b.meta.version,
|
|
3642
|
-
...
|
|
3643
|
+
...getHookArgs(b),
|
|
3643
3644
|
});
|
|
3644
3645
|
} catch (error) {
|
|
3645
3646
|
logger.error('Failed to run migration scripts', { appDid: did, title: b.meta.title, error });
|
|
@@ -4033,7 +4034,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
4033
4034
|
did: blocklet.meta.did, // root blocklet did
|
|
4034
4035
|
notification: states.notification,
|
|
4035
4036
|
context,
|
|
4036
|
-
...
|
|
4037
|
+
...getHookArgs(b),
|
|
4037
4038
|
});
|
|
4038
4039
|
|
|
4039
4040
|
await forEachBlocklet(blocklet, hookFn, { parallel: true, concurrencyLimit: 4 });
|
|
@@ -13,7 +13,10 @@ const { formatName } = require('../../../util/get-domain-for-blocklet');
|
|
|
13
13
|
|
|
14
14
|
const needParseDependents = (meta, app) => {
|
|
15
15
|
const dependents = (meta.components || []).map((x) => x.source.name);
|
|
16
|
-
|
|
16
|
+
if (meta.engine?.interpreter === 'blocklet') {
|
|
17
|
+
dependents.push(meta.engine.source.name);
|
|
18
|
+
}
|
|
19
|
+
return !dependents.filter(Boolean).every((name) => app.children.some((x) => x.meta.name === name));
|
|
17
20
|
};
|
|
18
21
|
|
|
19
22
|
const installComponentFromDev = async ({ folder, meta, rootDid, mountPoint, manager, states, skipParseDependents }) => {
|
|
@@ -30,18 +30,24 @@ const check = async ({ did, states }) => {
|
|
|
30
30
|
const bundleSource = getFixedBundleSource(child);
|
|
31
31
|
|
|
32
32
|
if (bundleSource) {
|
|
33
|
-
const { dynamicComponents } = await parseComponents(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
const { dynamicComponents } = await parseComponents(
|
|
34
|
+
{
|
|
35
|
+
meta: {
|
|
36
|
+
components: [
|
|
37
|
+
{
|
|
38
|
+
source: bundleSource,
|
|
39
|
+
name: child.meta.name,
|
|
40
|
+
mountPoint: child.mountPoint,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
42
44
|
},
|
|
43
|
-
|
|
45
|
+
{ continueOnError: true }
|
|
46
|
+
);
|
|
44
47
|
const newChild = dynamicComponents.find((x) => x.meta.name === child.meta.name);
|
|
48
|
+
if (!newChild) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
45
51
|
newChild._dynamicComponents = dynamicComponents.filter((x) => x.meta.name !== child.meta.name);
|
|
46
52
|
newChildren.push(newChild);
|
|
47
53
|
} else {
|
|
@@ -22,6 +22,7 @@ async function runScripts({
|
|
|
22
22
|
printError,
|
|
23
23
|
output,
|
|
24
24
|
error,
|
|
25
|
+
timeout,
|
|
25
26
|
}) {
|
|
26
27
|
// 获取所有待执行的脚本
|
|
27
28
|
let scripts = [];
|
|
@@ -61,6 +62,7 @@ async function runScripts({
|
|
|
61
62
|
silent: false,
|
|
62
63
|
output,
|
|
63
64
|
error,
|
|
65
|
+
timeout,
|
|
64
66
|
});
|
|
65
67
|
printInfo(`Migration script executed: ${scriptPath}`);
|
|
66
68
|
} catch (migrationErr) {
|
|
@@ -107,6 +109,7 @@ module.exports = async ({
|
|
|
107
109
|
printError = logger.error,
|
|
108
110
|
output,
|
|
109
111
|
error,
|
|
112
|
+
timeout,
|
|
110
113
|
}) => {
|
|
111
114
|
if (!oldVersion) {
|
|
112
115
|
return;
|
|
@@ -136,6 +139,7 @@ module.exports = async ({
|
|
|
136
139
|
printSuccess,
|
|
137
140
|
output,
|
|
138
141
|
error,
|
|
142
|
+
timeout,
|
|
139
143
|
});
|
|
140
144
|
|
|
141
145
|
fs.removeSync(backupDir);
|
package/lib/util/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const shell = require('shelljs');
|
|
|
7
7
|
const camelCase = require('lodash/camelCase');
|
|
8
8
|
const get = require('lodash/get');
|
|
9
9
|
const pickBy = require('lodash/pickBy');
|
|
10
|
+
const uniq = require('lodash/uniq');
|
|
10
11
|
const { isFromPublicKey } = require('@arcblock/did');
|
|
11
12
|
const { joinURL } = require('ufo');
|
|
12
13
|
const { Certificate } = require('@fidm/x509');
|
|
@@ -195,7 +196,7 @@ const getBaseUrls = async (node, ips) => {
|
|
|
195
196
|
const info = await node.getNodeInfo();
|
|
196
197
|
const { https, httpPort, httpsPort } = info.routing;
|
|
197
198
|
const getPort = (port, defaultPort) => (port && port !== defaultPort ? `:${port}` : '');
|
|
198
|
-
const availableIps = ips.filter(Boolean);
|
|
199
|
+
const availableIps = uniq(ips.filter(Boolean));
|
|
199
200
|
|
|
200
201
|
const getHttpInfo = async (domain) => {
|
|
201
202
|
const certificate = https ? await node.certManager.getNormalByDomain(domain) : null;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.29-beta-
|
|
6
|
+
"version": "1.16.29-beta-bc7cae11",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,40 +19,40 @@
|
|
|
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.29-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.29-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.29-beta-
|
|
25
|
-
"@abtnode/constant": "1.16.29-beta-
|
|
26
|
-
"@abtnode/cron": "1.16.29-beta-
|
|
27
|
-
"@abtnode/logger": "1.16.29-beta-
|
|
28
|
-
"@abtnode/models": "1.16.29-beta-
|
|
29
|
-
"@abtnode/queue": "1.16.29-beta-
|
|
30
|
-
"@abtnode/rbac": "1.16.29-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.16.29-beta-
|
|
32
|
-
"@abtnode/static-server": "1.16.29-beta-
|
|
33
|
-
"@abtnode/timemachine": "1.16.29-beta-
|
|
34
|
-
"@abtnode/util": "1.16.29-beta-
|
|
35
|
-
"@arcblock/did": "1.18.
|
|
36
|
-
"@arcblock/did-auth": "1.18.
|
|
37
|
-
"@arcblock/did-ext": "^1.18.
|
|
22
|
+
"@abtnode/analytics": "1.16.29-beta-bc7cae11",
|
|
23
|
+
"@abtnode/auth": "1.16.29-beta-bc7cae11",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.29-beta-bc7cae11",
|
|
25
|
+
"@abtnode/constant": "1.16.29-beta-bc7cae11",
|
|
26
|
+
"@abtnode/cron": "1.16.29-beta-bc7cae11",
|
|
27
|
+
"@abtnode/logger": "1.16.29-beta-bc7cae11",
|
|
28
|
+
"@abtnode/models": "1.16.29-beta-bc7cae11",
|
|
29
|
+
"@abtnode/queue": "1.16.29-beta-bc7cae11",
|
|
30
|
+
"@abtnode/rbac": "1.16.29-beta-bc7cae11",
|
|
31
|
+
"@abtnode/router-provider": "1.16.29-beta-bc7cae11",
|
|
32
|
+
"@abtnode/static-server": "1.16.29-beta-bc7cae11",
|
|
33
|
+
"@abtnode/timemachine": "1.16.29-beta-bc7cae11",
|
|
34
|
+
"@abtnode/util": "1.16.29-beta-bc7cae11",
|
|
35
|
+
"@arcblock/did": "1.18.128",
|
|
36
|
+
"@arcblock/did-auth": "1.18.128",
|
|
37
|
+
"@arcblock/did-ext": "^1.18.128",
|
|
38
38
|
"@arcblock/did-motif": "^1.1.13",
|
|
39
|
-
"@arcblock/did-util": "1.18.
|
|
40
|
-
"@arcblock/event-hub": "1.18.
|
|
41
|
-
"@arcblock/jwt": "^1.18.
|
|
39
|
+
"@arcblock/did-util": "1.18.128",
|
|
40
|
+
"@arcblock/event-hub": "1.18.128",
|
|
41
|
+
"@arcblock/jwt": "^1.18.128",
|
|
42
42
|
"@arcblock/pm2-events": "^0.0.5",
|
|
43
|
-
"@arcblock/validator": "^1.18.
|
|
44
|
-
"@arcblock/vc": "1.18.
|
|
45
|
-
"@blocklet/constant": "1.16.29-beta-
|
|
46
|
-
"@blocklet/env": "1.16.29-beta-
|
|
47
|
-
"@blocklet/meta": "1.16.29-beta-
|
|
48
|
-
"@blocklet/resolver": "1.16.29-beta-
|
|
49
|
-
"@blocklet/sdk": "1.16.29-beta-
|
|
50
|
-
"@blocklet/store": "1.16.29-beta-
|
|
51
|
-
"@did-space/client": "^0.5.
|
|
43
|
+
"@arcblock/validator": "^1.18.128",
|
|
44
|
+
"@arcblock/vc": "1.18.128",
|
|
45
|
+
"@blocklet/constant": "1.16.29-beta-bc7cae11",
|
|
46
|
+
"@blocklet/env": "1.16.29-beta-bc7cae11",
|
|
47
|
+
"@blocklet/meta": "1.16.29-beta-bc7cae11",
|
|
48
|
+
"@blocklet/resolver": "1.16.29-beta-bc7cae11",
|
|
49
|
+
"@blocklet/sdk": "1.16.29-beta-bc7cae11",
|
|
50
|
+
"@blocklet/store": "1.16.29-beta-bc7cae11",
|
|
51
|
+
"@did-space/client": "^0.5.16",
|
|
52
52
|
"@fidm/x509": "^1.2.1",
|
|
53
|
-
"@ocap/mcrypto": "1.18.
|
|
54
|
-
"@ocap/util": "1.18.
|
|
55
|
-
"@ocap/wallet": "1.18.
|
|
53
|
+
"@ocap/mcrypto": "1.18.128",
|
|
54
|
+
"@ocap/util": "1.18.128",
|
|
55
|
+
"@ocap/wallet": "1.18.128",
|
|
56
56
|
"@slack/webhook": "^5.0.4",
|
|
57
57
|
"archiver": "^7.0.1",
|
|
58
58
|
"axios": "^1.7.2",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"jest": "^29.7.0",
|
|
104
104
|
"unzipper": "^0.10.11"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "bb2ff5fc40838a48a59db65871d5640f6b427f0e"
|
|
107
107
|
}
|