@abtnode/core 1.8.45 → 1.8.47

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.
@@ -3,19 +3,21 @@ const cloneDeep = require('lodash/cloneDeep');
3
3
  const security = require('@abtnode/util/lib/security');
4
4
  const { BLOCKLET_CONFIGURABLE_KEY } = require('@blocklet/constant');
5
5
 
6
- const mergeConfigs = ({ old: oldConfigs, cur: newConfigs = [], did = '', dek = '' }) => {
7
- const metaConfigs = (oldConfigs || []).filter((x) => !x.custom);
8
- const customConfigs = (oldConfigs || []).filter((x) => x.custom);
9
-
10
- const metaConfigsToKeep = metaConfigs.filter((x) => newConfigs.find((n) => n.key === x.key || n.name === x.key));
6
+ const removeDeletedMetaConfigs = (oldConfigs, newConfigs) =>
7
+ oldConfigs.filter((old) => newConfigs.some(({ key, name }) => [key, name].includes(old.key)));
11
8
 
9
+ const mergeConfigs = ({ old: oldConfigs, cur: newConfigs = [], did = '', dek = '' }) => {
10
+ const enableSecurity = dek && did;
12
11
  const isUpdatingCustomConfig = newConfigs.every((x) => x.key);
13
- const configs = isUpdatingCustomConfig ? metaConfigs : metaConfigsToKeep;
14
12
 
15
- const enableSecurity = dek && did;
13
+ const customConfigs = (oldConfigs || []).filter((x) => x.custom);
14
+ const appConfigs = (oldConfigs || []).filter((x) => !x.custom && !!BLOCKLET_CONFIGURABLE_KEY[x.key]);
15
+
16
+ const allMetaConfigs = (oldConfigs || []).filter((x) => !x.custom && !BLOCKLET_CONFIGURABLE_KEY[x.key]);
17
+ const metaConfigs = isUpdatingCustomConfig ? allMetaConfigs : removeDeletedMetaConfigs(allMetaConfigs, newConfigs);
16
18
 
17
19
  // oldConfig 表示从数据库中可以用的字段
18
- const oldConfig = [...configs, ...customConfigs].reduce((acc, x) => {
20
+ const oldConfig = [...metaConfigs, ...appConfigs, ...customConfigs].reduce((acc, x) => {
19
21
  acc[x.key] = {
20
22
  value: x.value,
21
23
  required: x.required,
@@ -677,14 +677,12 @@ const getProcessInfo = (processId) =>
677
677
 
678
678
  const deleteProcess = (processId) =>
679
679
  new Promise((resolve, reject) => {
680
- pm2.connect(() => {
681
- pm2.delete(processId, async (err) => {
682
- if (isUsefulError(err)) {
683
- logger.error('blocklet process delete failed', { error: err });
684
- return reject(err);
685
- }
686
- return resolve();
687
- });
680
+ pm2.delete(processId, async (err) => {
681
+ if (isUsefulError(err)) {
682
+ logger.error('blocklet process delete failed', { error: err });
683
+ return reject(err);
684
+ }
685
+ return resolve();
688
686
  });
689
687
  });
690
688
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.45",
6
+ "version": "1.8.47",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,18 +19,18 @@
19
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@abtnode/auth": "1.8.45",
23
- "@abtnode/certificate-manager": "1.8.45",
24
- "@abtnode/constant": "1.8.45",
25
- "@abtnode/cron": "1.8.45",
26
- "@abtnode/db": "1.8.45",
27
- "@abtnode/logger": "1.8.45",
28
- "@abtnode/queue": "1.8.45",
29
- "@abtnode/rbac": "1.8.45",
30
- "@abtnode/router-provider": "1.8.45",
31
- "@abtnode/static-server": "1.8.45",
32
- "@abtnode/timemachine": "1.8.45",
33
- "@abtnode/util": "1.8.45",
22
+ "@abtnode/auth": "1.8.47",
23
+ "@abtnode/certificate-manager": "1.8.47",
24
+ "@abtnode/constant": "1.8.47",
25
+ "@abtnode/cron": "1.8.47",
26
+ "@abtnode/db": "1.8.47",
27
+ "@abtnode/logger": "1.8.47",
28
+ "@abtnode/queue": "1.8.47",
29
+ "@abtnode/rbac": "1.8.47",
30
+ "@abtnode/router-provider": "1.8.47",
31
+ "@abtnode/static-server": "1.8.47",
32
+ "@abtnode/timemachine": "1.8.47",
33
+ "@abtnode/util": "1.8.47",
34
34
  "@arcblock/did": "1.18.31",
35
35
  "@arcblock/did-motif": "^1.1.10",
36
36
  "@arcblock/did-util": "1.18.31",
@@ -38,9 +38,9 @@
38
38
  "@arcblock/jwt": "^1.18.31",
39
39
  "@arcblock/pm2-events": "^0.0.5",
40
40
  "@arcblock/vc": "1.18.31",
41
- "@blocklet/constant": "1.8.45",
42
- "@blocklet/meta": "1.8.45",
43
- "@blocklet/sdk": "1.8.45",
41
+ "@blocklet/constant": "1.8.47",
42
+ "@blocklet/meta": "1.8.47",
43
+ "@blocklet/sdk": "1.8.47",
44
44
  "@fidm/x509": "^1.2.1",
45
45
  "@ocap/mcrypto": "1.18.31",
46
46
  "@ocap/util": "1.18.31",
@@ -82,5 +82,5 @@
82
82
  "express": "^4.18.2",
83
83
  "jest": "^27.5.1"
84
84
  },
85
- "gitHead": "a84232c1a3bb713e3b9de41092d01694420cd8b5"
85
+ "gitHead": "87f368c3add9af5ae5c9db3b34682b743032acb4"
86
86
  }