@zhin.js/adapter-email 3.0.3 → 4.0.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @zhin.js/adapter-email
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 7db69c1: 命令前缀改为适配器配置项:`MessageDispatcher` 不再硬编码 `/`,默认按消息所属适配器实例 config 的 `commandPrefix` 解析(默认 `''` 无前缀,任意文本按命令匹配),`endpoints[i].commandPrefix` 逐项覆盖;`ImRuntime({ commandPrefix })` 仍可设全局静态前缀。全部 20 个平台适配器 schema 新增 `commandPrefix` 属性。
8
+
9
+ BREAKING(行为变化):未配置时命令不再需要 `/` 前缀——原 `/zt` 写法不再命中,直接发 `zt` 即可;需要斜杠风格的适配器请在配置里显式设 `commandPrefix: '/'`。
10
+
11
+ - 713445c: 适配器配置格式定稿(不兼容旧格式):`plugins.<adapter>` 顶层仅共享字段 + `commandPrefix`,`endpoints[i]` 携带 endpoint 级字段(`name` + 凭据,各 schema 已类型化),`endpoints` 为必填(icqq 另需顶层 `master`);icqq 新增 `trusted` 列表(顶层/逐项均可)。scaffold-wizard 全部字段式与自定义 configure() 产出改为新格式,examples(full-bot / qq-games-bot)与 20 个适配器 README 同步迁移。
12
+ - Updated dependencies [7db69c1]
13
+ - Updated dependencies [e5c84ed]
14
+ - Updated dependencies [3ea84a0]
15
+ - Updated dependencies [1ddcd70]
16
+ - Updated dependencies [ac9da66]
17
+ - @zhin.js/core@1.4.0
18
+ - @zhin.js/adapter@1.1.0
19
+ - @zhin.js/plugin-runtime@1.1.0
20
+ - zhin.js@5.0.0
21
+
3
22
  ## 3.0.3
4
23
 
5
24
  ### Patch Changes
package/README.md CHANGED
@@ -41,20 +41,21 @@ pnpm add @zhin.js/adapter-email
41
41
  # zhin.config.yml(Plugin Runtime)
42
42
  plugins:
43
43
  email:
44
- name: my-email-bot
45
- smtp:
46
- host: smtp.example.com
47
- port: 465
48
- secure: true
49
- auth:
50
- user: bot@example.com
51
- pass: "${EMAIL_PASSWORD}"
52
- imap:
53
- host: imap.example.com
54
- port: 993
55
- tls: true
56
- user: bot@example.com
57
- password: "${EMAIL_PASSWORD}"
44
+ endpoints:
45
+ - name: my-email-bot
46
+ smtp:
47
+ host: smtp.example.com
48
+ port: 465
49
+ secure: true
50
+ auth:
51
+ user: bot@example.com
52
+ pass: "${EMAIL_PASSWORD}"
53
+ imap:
54
+ host: imap.example.com
55
+ port: 993
56
+ tls: true
57
+ user: bot@example.com
58
+ password: "${EMAIL_PASSWORD}"
58
59
  ```
59
60
 
60
61
  根插件 `zhin.plugins`(或项目图)需引用 `@zhin.js/adapter-email`(`instanceKey: email`)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-email",
3
- "version": "3.0.3",
3
+ "version": "4.0.0",
4
4
  "type": "module",
5
5
  "description": "Zhin.js Email adapter for Plugin Runtime (SMTP/IMAP)",
6
6
  "main": "./lib/index.js",
@@ -9,16 +9,16 @@
9
9
  "imap": "^0.8.19",
10
10
  "mailparser": "^3.9.14",
11
11
  "nodemailer": "^9.0.3",
12
- "@zhin.js/adapter": "1.0.1",
13
- "@zhin.js/core": "1.3.5",
12
+ "@zhin.js/adapter": "1.1.0",
13
+ "@zhin.js/core": "1.4.0",
14
14
  "@zhin.js/logger": "1.0.75",
15
- "@zhin.js/plugin-runtime": "1.0.1"
15
+ "@zhin.js/plugin-runtime": "1.1.0"
16
16
  },
17
17
  "peerDependencies": {
18
- "@zhin.js/adapter": "1.0.1",
19
- "@zhin.js/core": "1.3.5",
20
- "@zhin.js/plugin-runtime": "1.0.1",
21
- "zhin.js": "4.1.3"
18
+ "@zhin.js/adapter": "1.1.0",
19
+ "@zhin.js/core": "1.4.0",
20
+ "@zhin.js/plugin-runtime": "1.1.0",
21
+ "zhin.js": "5.0.0"
22
22
  },
23
23
  "peerDependenciesMeta": {
24
24
  "zhin.js": {
package/schema.json CHANGED
@@ -3,56 +3,131 @@
3
3
  "type": "object",
4
4
  "additionalProperties": false,
5
5
  "properties": {
6
- "name": {
7
- "type": "string",
8
- "default": "email-bot"
9
- },
10
- "smtp": {
11
- "type": "object",
12
- "additionalProperties": false,
13
- "properties": {
14
- "host": { "type": "string" },
15
- "port": { "type": "number" },
16
- "secure": { "type": "boolean" },
17
- "auth": {
18
- "type": "object",
19
- "additionalProperties": false,
20
- "properties": {
21
- "user": { "type": "string" },
22
- "pass": { "type": "string" }
6
+ "endpoints": {
7
+ "type": "array",
8
+ "description": "多账号:一个插件实例挂多个 endpoint。每项与顶层字段同构(name 必填,其余覆盖顶层)",
9
+ "items": {
10
+ "type": "object",
11
+ "additionalProperties": true,
12
+ "properties": {
13
+ "name": {
14
+ "type": "string",
15
+ "description": "Email bot name"
23
16
  },
24
- "required": ["user", "pass"]
25
- }
26
- },
27
- "required": ["host", "port", "secure", "auth"]
28
- },
29
- "imap": {
30
- "type": "object",
31
- "additionalProperties": false,
32
- "properties": {
33
- "host": { "type": "string" },
34
- "port": { "type": "number" },
35
- "tls": { "type": "boolean" },
36
- "user": { "type": "string" },
37
- "password": { "type": "string" },
38
- "checkInterval": { "type": "number", "default": 60000 },
39
- "mailbox": { "type": "string", "default": "INBOX" },
40
- "markSeen": { "type": "boolean", "default": true }
41
- },
42
- "required": ["host", "port", "tls", "user", "password"]
43
- },
44
- "attachments": {
45
- "type": "object",
46
- "additionalProperties": false,
47
- "properties": {
48
- "enabled": { "type": "boolean", "default": false },
49
- "downloadPath": { "type": "string" },
50
- "maxFileSize": { "type": "number" },
51
- "allowedTypes": {
52
- "type": "array",
53
- "items": { "type": "string" }
54
- }
17
+ "smtp": {
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "properties": {
21
+ "host": {
22
+ "type": "string"
23
+ },
24
+ "port": {
25
+ "type": "number"
26
+ },
27
+ "secure": {
28
+ "type": "boolean"
29
+ },
30
+ "auth": {
31
+ "type": "object",
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "user": {
35
+ "type": "string"
36
+ },
37
+ "pass": {
38
+ "type": "string"
39
+ }
40
+ },
41
+ "required": [
42
+ "user",
43
+ "pass"
44
+ ]
45
+ }
46
+ },
47
+ "required": [
48
+ "host",
49
+ "port",
50
+ "secure",
51
+ "auth"
52
+ ]
53
+ },
54
+ "imap": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "properties": {
58
+ "host": {
59
+ "type": "string"
60
+ },
61
+ "port": {
62
+ "type": "number"
63
+ },
64
+ "tls": {
65
+ "type": "boolean"
66
+ },
67
+ "user": {
68
+ "type": "string"
69
+ },
70
+ "password": {
71
+ "type": "string"
72
+ },
73
+ "checkInterval": {
74
+ "type": "number",
75
+ "default": 60000
76
+ },
77
+ "mailbox": {
78
+ "type": "string",
79
+ "default": "INBOX"
80
+ },
81
+ "markSeen": {
82
+ "type": "boolean",
83
+ "default": true
84
+ }
85
+ },
86
+ "required": [
87
+ "host",
88
+ "port",
89
+ "tls",
90
+ "user",
91
+ "password"
92
+ ]
93
+ },
94
+ "attachments": {
95
+ "type": "object",
96
+ "additionalProperties": false,
97
+ "properties": {
98
+ "enabled": {
99
+ "type": "boolean",
100
+ "default": false
101
+ },
102
+ "downloadPath": {
103
+ "type": "string"
104
+ },
105
+ "maxFileSize": {
106
+ "type": "number"
107
+ },
108
+ "allowedTypes": {
109
+ "type": "array",
110
+ "items": {
111
+ "type": "string"
112
+ }
113
+ }
114
+ }
115
+ }
116
+ },
117
+ "required": [
118
+ "name",
119
+ "smtp",
120
+ "imap"
121
+ ]
55
122
  }
123
+ },
124
+ "commandPrefix": {
125
+ "type": "string",
126
+ "default": "",
127
+ "description": "命令前缀(默认 '' 无前缀,任意文本按命令匹配;如 '/' 要求 / 开头)。endpoints[i] 可逐项覆盖"
56
128
  }
57
- }
129
+ },
130
+ "required": [
131
+ "endpoints"
132
+ ]
58
133
  }