@abtnode/core 1.16.8-beta-81db8efa → 1.16.8-beta-186fd5aa

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.
@@ -1227,14 +1227,26 @@ class BlockletManager extends BaseBlockletManager {
1227
1227
  }
1228
1228
 
1229
1229
  async configNotification({ did, notification = {} }) {
1230
- const newConfig = JSON.parse(notification);
1231
- const { error, value: validateConfig } = emailConfigSchema.validate(newConfig);
1232
- if (error) {
1233
- logger.error('configNotification validate error', { error });
1234
- throw new Error(error.message);
1230
+ let newConfig = {};
1231
+ try {
1232
+ newConfig = JSON.parse(notification);
1233
+ } catch (error) {
1234
+ logger.error('parse configNotification error', { error });
1235
+ throw new Error('parse configNotification error');
1236
+ }
1237
+ const enabled = newConfig?.email?.enabled;
1238
+ if (enabled) {
1239
+ const { error } = emailConfigSchema.validate(
1240
+ pick(newConfig?.email || {}, ['from', 'host', 'port', 'user', 'password'])
1241
+ );
1242
+ if (error) {
1243
+ logger.error('configNotification validate error', { error });
1244
+ throw new Error(error.message);
1245
+ }
1235
1246
  }
1236
1247
  const oldConfig = await states.blockletExtras.getSettings(did, 'notification', {});
1237
- const mergeConfig = { ...oldConfig, ...validateConfig };
1248
+ // NOTICE:validate 本身没有做任何字段规范化处理,所以处理后的结果跟处理前是一样的,最终结果的合并先使用原始值
1249
+ const mergeConfig = { ...oldConfig, ...newConfig };
1238
1250
  await states.blockletExtras.setSettings(did, { notification: mergeConfig });
1239
1251
  const newState = await this.getBlocklet(did);
1240
1252
  this.emit(BlockletEvents.updated, newState);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.8-beta-81db8efa",
6
+ "version": "1.16.8-beta-186fd5aa",
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.16.8-beta-81db8efa",
23
- "@abtnode/certificate-manager": "1.16.8-beta-81db8efa",
24
- "@abtnode/constant": "1.16.8-beta-81db8efa",
25
- "@abtnode/cron": "1.16.8-beta-81db8efa",
26
- "@abtnode/db": "1.16.8-beta-81db8efa",
27
- "@abtnode/logger": "1.16.8-beta-81db8efa",
28
- "@abtnode/queue": "1.16.8-beta-81db8efa",
29
- "@abtnode/rbac": "1.16.8-beta-81db8efa",
30
- "@abtnode/router-provider": "1.16.8-beta-81db8efa",
31
- "@abtnode/static-server": "1.16.8-beta-81db8efa",
32
- "@abtnode/timemachine": "1.16.8-beta-81db8efa",
33
- "@abtnode/util": "1.16.8-beta-81db8efa",
22
+ "@abtnode/auth": "1.16.8-beta-186fd5aa",
23
+ "@abtnode/certificate-manager": "1.16.8-beta-186fd5aa",
24
+ "@abtnode/constant": "1.16.8-beta-186fd5aa",
25
+ "@abtnode/cron": "1.16.8-beta-186fd5aa",
26
+ "@abtnode/db": "1.16.8-beta-186fd5aa",
27
+ "@abtnode/logger": "1.16.8-beta-186fd5aa",
28
+ "@abtnode/queue": "1.16.8-beta-186fd5aa",
29
+ "@abtnode/rbac": "1.16.8-beta-186fd5aa",
30
+ "@abtnode/router-provider": "1.16.8-beta-186fd5aa",
31
+ "@abtnode/static-server": "1.16.8-beta-186fd5aa",
32
+ "@abtnode/timemachine": "1.16.8-beta-186fd5aa",
33
+ "@abtnode/util": "1.16.8-beta-186fd5aa",
34
34
  "@arcblock/did": "1.18.78",
35
35
  "@arcblock/did-auth": "1.18.78",
36
36
  "@arcblock/did-ext": "^1.18.78",
@@ -41,9 +41,9 @@
41
41
  "@arcblock/pm2-events": "^0.0.5",
42
42
  "@arcblock/validator": "^1.18.78",
43
43
  "@arcblock/vc": "1.18.78",
44
- "@blocklet/constant": "1.16.8-beta-81db8efa",
45
- "@blocklet/meta": "1.16.8-beta-81db8efa",
46
- "@blocklet/sdk": "1.16.8-beta-81db8efa",
44
+ "@blocklet/constant": "1.16.8-beta-186fd5aa",
45
+ "@blocklet/meta": "1.16.8-beta-186fd5aa",
46
+ "@blocklet/sdk": "1.16.8-beta-186fd5aa",
47
47
  "@did-space/client": "^0.2.91",
48
48
  "@fidm/x509": "^1.2.1",
49
49
  "@ocap/mcrypto": "1.18.78",
@@ -95,5 +95,5 @@
95
95
  "express": "^4.18.2",
96
96
  "jest": "^27.5.1"
97
97
  },
98
- "gitHead": "8c4e3190de79a1fb2aaa14646255d938324cc5c2"
98
+ "gitHead": "3150c3a5c3e041fe7f5a3902418d9d62adee3173"
99
99
  }