zenweb 4.2.1 → 4.2.3
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/dist/index.js +2 -2
- package/package.json +11 -11
- package/CHANGELOG.md +0 -251
package/dist/index.js
CHANGED
|
@@ -69,10 +69,10 @@ function create(options) {
|
|
|
69
69
|
core.setup((0, log_1.default)(options.log));
|
|
70
70
|
if (options.router !== false)
|
|
71
71
|
core.setup((0, router_1.default)());
|
|
72
|
-
if (options.messagecode !== false)
|
|
73
|
-
core.setup((0, messagecode_1.default)(options.messagecode));
|
|
74
72
|
if (options.result !== false)
|
|
75
73
|
core.setup((0, result_1.default)(options.result));
|
|
74
|
+
if (options.messagecode !== false)
|
|
75
|
+
core.setup((0, messagecode_1.default)(options.messagecode));
|
|
76
76
|
if (options.helper !== false)
|
|
77
77
|
core.setup((0, helper_1.default)(options.helper));
|
|
78
78
|
if (options.body !== false)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zenweb",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.3",
|
|
4
4
|
"description": "Modular lightweight web framework based on Koa",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -28,21 +28,21 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"homepage": "https://zenweb.node.ltd",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@zenweb/body": "^4.0.
|
|
32
|
-
"@zenweb/controller": "^3.
|
|
33
|
-
"@zenweb/core": "^4.1.
|
|
34
|
-
"@zenweb/helper": "^4.1.
|
|
35
|
-
"@zenweb/inject": "^4.0.
|
|
36
|
-
"@zenweb/log": "^4.1.
|
|
37
|
-
"@zenweb/messagecode": "^3.6.
|
|
31
|
+
"@zenweb/body": "^4.0.4",
|
|
32
|
+
"@zenweb/controller": "^3.16.3",
|
|
33
|
+
"@zenweb/core": "^4.1.4",
|
|
34
|
+
"@zenweb/helper": "^4.1.4",
|
|
35
|
+
"@zenweb/inject": "^4.0.3",
|
|
36
|
+
"@zenweb/log": "^4.1.2",
|
|
37
|
+
"@zenweb/messagecode": "^3.6.2",
|
|
38
38
|
"@zenweb/meta": "^2.6.3",
|
|
39
|
-
"@zenweb/result": "^3.12.
|
|
40
|
-
"@zenweb/router": "^3.3.
|
|
39
|
+
"@zenweb/result": "^3.12.3",
|
|
40
|
+
"@zenweb/router": "^3.3.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"cross-env": "^7.0.3",
|
|
44
44
|
"rimraf": "^4.1.2",
|
|
45
45
|
"ts-node": "^10.9.1",
|
|
46
|
-
"typescript": "^5.
|
|
46
|
+
"typescript": "^5.3.3"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [4.2.1] - 2023-9-20
|
|
4
|
-
- 导出 $core, $ctx
|
|
5
|
-
|
|
6
|
-
## [4.2.0] - 2023-8-25
|
|
7
|
-
- result 模块不再内置 messagecode 支持
|
|
8
|
-
- 更新 @zenweb/helper @zenweb/messagecode @zenweb/result
|
|
9
|
-
|
|
10
|
-
## [4.1.0] - 2023-8-3
|
|
11
|
-
- 更新 @zenweb/core@4.1.1 callProxy
|
|
12
|
-
|
|
13
|
-
## [4.0.0] - 2023-8-3
|
|
14
|
-
- core@v4 支持,全局应用实例,asyncLocalStorage 开启
|
|
15
|
-
|
|
16
|
-
## [3.33.0] - 2023-7-13
|
|
17
|
-
- 更新: @zenweb/body: 3.10.0 新增 useBodyParser 方法,支持指定内容解析器
|
|
18
|
-
|
|
19
|
-
## [3.32.0] - 2023-7-10
|
|
20
|
-
- 更新: @zenweb/result: 3.9.0 支持配置 exposeUnexpected 显示意外错误信息
|
|
21
|
-
|
|
22
|
-
## [3.31.3] - 2023-5-30
|
|
23
|
-
- 导出: SetupHelper
|
|
24
|
-
- 更新: @zenweb/log: 3.5.1
|
|
25
|
-
|
|
26
|
-
## [3.31.1] - 2023-5-29
|
|
27
|
-
- 更新: @zenweb/meta: 2.6.2 trackId 头信息获取
|
|
28
|
-
|
|
29
|
-
## [3.31.0] - 2023-5-29
|
|
30
|
-
- meta 模块新增 trackId 支持
|
|
31
|
-
- 更新: @zenweb/meta: 2.6.1 trackId 支持
|
|
32
|
-
- 更新: @zenweb/log: 3.5.0 记录 trackId
|
|
33
|
-
|
|
34
|
-
## [3.30.0] - 2023-5-25
|
|
35
|
-
- 更新: @zenweb/result: 3.8.0 支持 Stream Buffer Promise 类型
|
|
36
|
-
|
|
37
|
-
## [3.29.0] - 2023-5-8
|
|
38
|
-
- 更新: @zenweb/log: 3.4.0 @zenweb/meta: 2.5.0 统一 ctx.requestId
|
|
39
|
-
|
|
40
|
-
## [3.28.0] - 2023-5-8
|
|
41
|
-
- 更新: @zenweb/log: 3.3.0 支持 writeLevel 和 x-request-id,Error 对象支持记录更多字段
|
|
42
|
-
|
|
43
|
-
## [3.27.1] - 2023-5-5
|
|
44
|
-
- 更新: @zenweb/helper: 3.12.1 notNull message
|
|
45
|
-
|
|
46
|
-
## [3.27.0] - 2023-4-27
|
|
47
|
-
- 更新: @zenweb/result: 3.7.1 外部 fail() 方法,去除 ctx.result,获取 success 数据请使用 ctx.successData 属性
|
|
48
|
-
|
|
49
|
-
## [3.26.1] - 2023-4-20
|
|
50
|
-
- 更新: @zenweb/result: ^3.6.2 使用 ctx.result 可统一获取 success 或 fail 结果
|
|
51
|
-
|
|
52
|
-
## [3.26.0] - 2023-4-19
|
|
53
|
-
- 更新: @zenweb/controller: ^3.14.0
|
|
54
|
-
- 更新: @zenweb/result: ^3.6.1
|
|
55
|
-
- 本次更新主要解决控制器方法返回结果无法被中间件获取问题
|
|
56
|
-
|
|
57
|
-
## [3.25.1] - 2023-4-11
|
|
58
|
-
- 更新: @zenweb/helper@3.11.1
|
|
59
|
-
fix: page 方法返回结果缺少输入选项
|
|
60
|
-
|
|
61
|
-
## [3.25.0] - 2023-4-11
|
|
62
|
-
- 更新: @zenweb/helper@3.11.0 page 方法新增 `page` 和 `total` 参数,严格模式开关
|
|
63
|
-
|
|
64
|
-
## [3.24.0] - 2023-4-10
|
|
65
|
-
- 更新: @zenweb/helper@3.10.0 page 方法返回结果包含 PageOption
|
|
66
|
-
|
|
67
|
-
## [3.23.1] - 2023-4-10
|
|
68
|
-
- 更新: @zenweb/helper@3.9.1
|
|
69
|
-
|
|
70
|
-
## [3.23.0] - 2023-4-10
|
|
71
|
-
- 更新: @zenweb/helper@3.9.0
|
|
72
|
-
- 更新: @zenweb/body@3.9.0
|
|
73
|
-
- 统一 HelperBase
|
|
74
|
-
|
|
75
|
-
## [3.22.0] - 2023-4-10
|
|
76
|
-
- update: @zenweb/result@3.3.2 支持 failCodeHeader, failCodeMessage
|
|
77
|
-
|
|
78
|
-
## [3.21.3] - 2023-4-9
|
|
79
|
-
- update: typecasts@3.0.5
|
|
80
|
-
|
|
81
|
-
## [3.21.2] - 2023-4-9
|
|
82
|
-
- update: typecasts@3.0.4
|
|
83
|
-
|
|
84
|
-
## [3.21.1] - 2023-4-9
|
|
85
|
-
- update: typecasts@3.0.3
|
|
86
|
-
|
|
87
|
-
## [3.21.0] - 2023-4-8
|
|
88
|
-
- 更新: @zenweb/helper: ^3.8.0 增加 TypeCastHelper.page 方法
|
|
89
|
-
- 更新: @zenweb/body: ^3.8.0 增加 BodyHelper.page 方法
|
|
90
|
-
|
|
91
|
-
## [3.20.0] - 2023-4-7
|
|
92
|
-
- 更新: @zenweb/helper: ^3.7.0
|
|
93
|
-
- 更新: @zenweb/inject: ^3.19.0
|
|
94
|
-
|
|
95
|
-
## [3.19.1] - 2023-4-1
|
|
96
|
-
- 更新: @zenweb/helper: ^3.6.1
|
|
97
|
-
|
|
98
|
-
## [3.19.0] - 2023-4-1
|
|
99
|
-
- 更新: typecasts: 3.0.0
|
|
100
|
-
- 更新: @zenweb/body: ^3.7.0
|
|
101
|
-
- 更新: @zenweb/helper: ^3.6.0
|
|
102
|
-
```ts
|
|
103
|
-
export class DemoController {
|
|
104
|
-
@mapping({ method: 'POST' })
|
|
105
|
-
typecast(body: BodyHelper) {
|
|
106
|
-
return body.get({
|
|
107
|
-
kw: 'trim',
|
|
108
|
-
news: {
|
|
109
|
-
// 嵌套对象 news
|
|
110
|
-
// 嵌套用法与 get({}) 用法一致,可以无限嵌套
|
|
111
|
-
type: 'object',
|
|
112
|
-
pick: {
|
|
113
|
-
id: '!int',
|
|
114
|
-
title: '!string',
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## [3.18.1] - 2023-4-1
|
|
123
|
-
- 更新: typecasts: 2.8.0
|
|
124
|
-
- 更新: @zenweb/body: ^3.6.2
|
|
125
|
-
- 更新: @zenweb/helper: ^3.5.2
|
|
126
|
-
|
|
127
|
-
## [3.18.0] - 2023-3-30
|
|
128
|
-
- 更新: @zenweb/result: ^3.2.1
|
|
129
|
-
- 支持自定义结果渲染器
|
|
130
|
-
- 支持 return 结果自动设置到 ctx.success 中
|
|
131
|
-
- 更新: @zenweb/controller: ^3.13.0
|
|
132
|
-
- 不再主动调用 ctx.success 方法,使用新的 @zenweb/result 来管理结果
|
|
133
|
-
- 新增 ControllerRegister 管理控制器注册
|
|
134
|
-
|
|
135
|
-
## [3.17.1] - 2023-3-29
|
|
136
|
-
- 更新: @zenweb/helper@3.5.1
|
|
137
|
-
|
|
138
|
-
## [3.17.0] - 2023-3-29
|
|
139
|
-
- 更新: @zenweb/controller 新增 Core.controllerRegister
|
|
140
|
-
|
|
141
|
-
## [3.16.0] - 2023-3-28
|
|
142
|
-
- 更新: @zenweb/helper@3.5.0 对象嵌套
|
|
143
|
-
```ts
|
|
144
|
-
export class DemoController {
|
|
145
|
-
@mapping({ method: 'POST' })
|
|
146
|
-
typecast(body: BodyHelper) {
|
|
147
|
-
return body.get({
|
|
148
|
-
kw: 'trim',
|
|
149
|
-
news: {
|
|
150
|
-
// 嵌套对象 news
|
|
151
|
-
// 嵌套用法与 get({}) 用法一致,可以无限嵌套
|
|
152
|
-
type: {
|
|
153
|
-
id: '!int',
|
|
154
|
-
title: '!string',
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
提交数据:
|
|
163
|
-
```json
|
|
164
|
-
{
|
|
165
|
-
"kw": "keyword",
|
|
166
|
-
"news": {
|
|
167
|
-
"id": "1234",
|
|
168
|
-
"title": "news title"
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## [3.15.3] - 2023-3-27
|
|
174
|
-
- 新增 tsconfig-app.json, tsconfig-module.json 文件
|
|
175
|
-
|
|
176
|
-
## [3.15.2] - 2023-3-27
|
|
177
|
-
- 新增 tsconfig-base.json 文件
|
|
178
|
-
|
|
179
|
-
## [3.15.1] - 2023-3-23
|
|
180
|
-
- 更新: @zenweb/body@3.6.1 错误的使用了 node16 的包导入规则,导致低于 16 版本的 node 无法使用
|
|
181
|
-
- 更新说明文档
|
|
182
|
-
|
|
183
|
-
## [3.15.0] - 2023-3-21
|
|
184
|
-
- 更新: @zenweb/messagecode: ^3.4.0
|
|
185
|
-
- number 类型支持,如果为 number 则直接获取不进行递归查找
|
|
186
|
-
- 可以格式化不在配置项中的字符串
|
|
187
|
-
- 增加 has 方法用于判断配置项是否存在
|
|
188
|
-
- 更新: @zenweb/result: ^3.1.0
|
|
189
|
-
- 使用 messagecode 统一处理错误代码消息
|
|
190
|
-
- 更新: @zenweb/helper: ^3.4.0
|
|
191
|
-
- 使用新的 result.fail 简化错误输出代码
|
|
192
|
-
- 去除配置项中的 requiredErrorCode 和 validateErrorCode
|
|
193
|
-
- 增加全局配置 page 选项
|
|
194
|
-
- 更新: @zenweb/controller: ^3.10.0
|
|
195
|
-
- discoverPaths 支持使用 "./" 开头的相对路径
|
|
196
|
-
- 增加 debug 信息
|
|
197
|
-
|
|
198
|
-
## [3.14.0] - 2023-3-19
|
|
199
|
-
- 更新: @zenweb/body: ^3.6.0
|
|
200
|
-
|
|
201
|
-
## [3.13.1] - 2023-3-18
|
|
202
|
-
- 导出: RawBody, TextBody
|
|
203
|
-
|
|
204
|
-
## [3.13.0] - 2023-3-17
|
|
205
|
-
- 更新: @zenweb/body: ^3.5.0
|
|
206
|
-
- 重构数据流读取, 新增 RawBody 和 TextBody,可扩展的解析器
|
|
207
|
-
|
|
208
|
-
## [3.12.2] - 2023-3-15
|
|
209
|
-
- 更新:@zenweb/body: ^3.2.2 xml 类型
|
|
210
|
-
|
|
211
|
-
## 3.12.1
|
|
212
|
-
- 导出: ParamHelper
|
|
213
|
-
|
|
214
|
-
## 3.12.0
|
|
215
|
-
- 更新: @zenweb/body: ^3.2.0 ObjectBody
|
|
216
|
-
|
|
217
|
-
## 3.11.1
|
|
218
|
-
> null 大检查! 所有项目强制开启 TS strict 模式,不再忽略 null 检查
|
|
219
|
-
- 更新:
|
|
220
|
-
- @zenweb/body: ^3.1.1
|
|
221
|
-
- @zenweb/controller: ^3.9.1
|
|
222
|
-
- @zenweb/core: ^3.5.1
|
|
223
|
-
- @zenweb/helper: ^3.3.1
|
|
224
|
-
- @zenweb/log: ^3.2.1
|
|
225
|
-
- @zenweb/messagecode: ^3.2.1
|
|
226
|
-
- @zenweb/meta: ^2.4.1
|
|
227
|
-
- @zenweb/result: ^3.0.1
|
|
228
|
-
|
|
229
|
-
## 3.11.0
|
|
230
|
-
- @zenweb/helper: ^3.3.0
|
|
231
|
-
- 去除 Helper
|
|
232
|
-
- 新增 QueryHelper, ParamHelper, TypeCastHelper
|
|
233
|
-
- @zenweb/body: ^3.1.0
|
|
234
|
-
- 新增 BodyHelper 数据类型转换&校验
|
|
235
|
-
|
|
236
|
-
## 3.10.0
|
|
237
|
-
- update:
|
|
238
|
-
- @zenweb/core: ^3.5.0
|
|
239
|
-
- 新增: Core.moduleExists
|
|
240
|
-
- 新增: SetupHelper.assertModuleExists
|
|
241
|
-
- 修改: Core.setup 方法增加 name 参数
|
|
242
|
-
- 删除: SetupHelper.checkCoreProperty
|
|
243
|
-
- 删除: SetupHelper.checkContextProperty
|
|
244
|
-
- @zenweb/body: ^3.0.0
|
|
245
|
-
- 使用依赖注入重构,去除 xml 和 文件上传表单支持,取消的这两个作为独立模块分离。
|
|
246
|
-
- @zenweb/helper: ^3.1.0
|
|
247
|
-
- 使用依赖注入重构,不再支持 ctx.helper 调用
|
|
248
|
-
- @zenweb/router: ^3.3.0
|
|
249
|
-
- @zenweb/controller: ^3.9.0
|
|
250
|
-
- @zenweb/messagecode: ^3.2.0
|
|
251
|
-
- @zenweb/inject: ^3.18.0
|