zenweb 3.26.0 → 3.27.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,202 +1,208 @@
1
- # Changelog
2
-
3
- ## [3.26.0] - 2023-4-19
4
- - 更新: @zenweb/controller: ^3.14.0
5
- - 更新: @zenweb/result: ^3.6.1
6
- - 本次更新主要解决控制器方法返回结果无法被中间件获取问题
7
-
8
- ## [3.25.1] - 2023-4-11
9
- - 更新: @zenweb/helper@3.11.1
10
- fix: page 方法返回结果缺少输入选项
11
-
12
- ## [3.25.0] - 2023-4-11
13
- - 更新: @zenweb/helper@3.11.0 page 方法新增 `page` 和 `total` 参数,严格模式开关
14
-
15
- ## [3.24.0] - 2023-4-10
16
- - 更新: @zenweb/helper@3.10.0 page 方法返回结果包含 PageOption
17
-
18
- ## [3.23.1] - 2023-4-10
19
- - 更新: @zenweb/helper@3.9.1
20
-
21
- ## [3.23.0] - 2023-4-10
22
- - 更新: @zenweb/helper@3.9.0
23
- - 更新: @zenweb/body@3.9.0
24
- - 统一 HelperBase
25
-
26
- ## [3.22.0] - 2023-4-10
27
- - update: @zenweb/result@3.3.2 支持 failCodeHeader, failCodeMessage
28
-
29
- ## [3.21.3] - 2023-4-9
30
- - update: typecasts@3.0.5
31
-
32
- ## [3.21.2] - 2023-4-9
33
- - update: typecasts@3.0.4
34
-
35
- ## [3.21.1] - 2023-4-9
36
- - update: typecasts@3.0.3
37
-
38
- ## [3.21.0] - 2023-4-8
39
- - 更新: @zenweb/helper: ^3.8.0 增加 TypeCastHelper.page 方法
40
- - 更新: @zenweb/body: ^3.8.0 增加 BodyHelper.page 方法
41
-
42
- ## [3.20.0] - 2023-4-7
43
- - 更新: @zenweb/helper: ^3.7.0
44
- - 更新: @zenweb/inject: ^3.19.0
45
-
46
- ## [3.19.1] - 2023-4-1
47
- - 更新: @zenweb/helper: ^3.6.1
48
-
49
- ## [3.19.0] - 2023-4-1
50
- - 更新: typecasts: 3.0.0
51
- - 更新: @zenweb/body: ^3.7.0
52
- - 更新: @zenweb/helper: ^3.6.0
53
- ```ts
54
- export class DemoController {
55
- @mapping({ method: 'POST' })
56
- typecast(body: BodyHelper) {
57
- return body.get({
58
- kw: 'trim',
59
- news: {
60
- // 嵌套对象 news
61
- // 嵌套用法与 get({}) 用法一致,可以无限嵌套
62
- type: 'object',
63
- pick: {
64
- id: '!int',
65
- title: '!string',
66
- }
67
- }
68
- });
69
- }
70
- }
71
- ```
72
-
73
- ## [3.18.1] - 2023-4-1
74
- - 更新: typecasts: 2.8.0
75
- - 更新: @zenweb/body: ^3.6.2
76
- - 更新: @zenweb/helper: ^3.5.2
77
-
78
- ## [3.18.0] - 2023-3-30
79
- - 更新: @zenweb/result: ^3.2.1
80
- - 支持自定义结果渲染器
81
- - 支持 return 结果自动设置到 ctx.success 中
82
- - 更新: @zenweb/controller: ^3.13.0
83
- - 不再主动调用 ctx.success 方法,使用新的 @zenweb/result 来管理结果
84
- - 新增 ControllerRegister 管理控制器注册
85
-
86
- ## [3.17.1] - 2023-3-29
87
- - 更新: @zenweb/helper@3.5.1
88
-
89
- ## [3.17.0] - 2023-3-29
90
- - 更新: @zenweb/controller 新增 Core.controllerRegister
91
-
92
- ## [3.16.0] - 2023-3-28
93
- - 更新: @zenweb/helper@3.5.0 对象嵌套
94
- ```ts
95
- export class DemoController {
96
- @mapping({ method: 'POST' })
97
- typecast(body: BodyHelper) {
98
- return body.get({
99
- kw: 'trim',
100
- news: {
101
- // 嵌套对象 news
102
- // 嵌套用法与 get({}) 用法一致,可以无限嵌套
103
- type: {
104
- id: '!int',
105
- title: '!string',
106
- }
107
- }
108
- });
109
- }
110
- }
111
- ```
112
-
113
- 提交数据:
114
- ```json
115
- {
116
- "kw": "keyword",
117
- "news": {
118
- "id": "1234",
119
- "title": "news title"
120
- }
121
- }
122
- ```
123
-
124
- ## [3.15.3] - 2023-3-27
125
- - 新增 tsconfig-app.json, tsconfig-module.json 文件
126
-
127
- ## [3.15.2] - 2023-3-27
128
- - 新增 tsconfig-base.json 文件
129
-
130
- ## [3.15.1] - 2023-3-23
131
- - 更新: @zenweb/body@3.6.1 错误的使用了 node16 的包导入规则,导致低于 16 版本的 node 无法使用
132
- - 更新说明文档
133
-
134
- ## [3.15.0] - 2023-3-21
135
- - 更新: @zenweb/messagecode: ^3.4.0
136
- - number 类型支持,如果为 number 则直接获取不进行递归查找
137
- - 可以格式化不在配置项中的字符串
138
- - 增加 has 方法用于判断配置项是否存在
139
- - 更新: @zenweb/result: ^3.1.0
140
- - 使用 messagecode 统一处理错误代码消息
141
- - 更新: @zenweb/helper: ^3.4.0
142
- - 使用新的 result.fail 简化错误输出代码
143
- - 去除配置项中的 requiredErrorCode 和 validateErrorCode
144
- - 增加全局配置 page 选项
145
- - 更新: @zenweb/controller: ^3.10.0
146
- - discoverPaths 支持使用 "./" 开头的相对路径
147
- - 增加 debug 信息
148
-
149
- ## [3.14.0] - 2023-3-19
150
- - 更新: @zenweb/body: ^3.6.0
151
-
152
- ## [3.13.1] - 2023-3-18
153
- - 导出: RawBody, TextBody
154
-
155
- ## [3.13.0] - 2023-3-17
156
- - 更新: @zenweb/body: ^3.5.0
157
- - 重构数据流读取, 新增 RawBody 和 TextBody,可扩展的解析器
158
-
159
- ## [3.12.2] - 2023-3-15
160
- - 更新:@zenweb/body: ^3.2.2 xml 类型
161
-
162
- ## 3.12.1
163
- - 导出: ParamHelper
164
-
165
- ## 3.12.0
166
- - 更新: @zenweb/body: ^3.2.0 ObjectBody
167
-
168
- ## 3.11.1
169
- > null 大检查! 所有项目强制开启 TS strict 模式,不再忽略 null 检查
170
- - 更新:
171
- - @zenweb/body: ^3.1.1
172
- - @zenweb/controller: ^3.9.1
173
- - @zenweb/core: ^3.5.1
174
- - @zenweb/helper: ^3.3.1
175
- - @zenweb/log: ^3.2.1
176
- - @zenweb/messagecode: ^3.2.1
177
- - @zenweb/meta: ^2.4.1
178
- - @zenweb/result: ^3.0.1
179
-
180
- ## 3.11.0
181
- - @zenweb/helper: ^3.3.0
182
- - 去除 Helper
183
- - 新增 QueryHelper, ParamHelper, TypeCastHelper
184
- - @zenweb/body: ^3.1.0
185
- - 新增 BodyHelper 数据类型转换&校验
186
-
187
- ## 3.10.0
188
- - update:
189
- - @zenweb/core: ^3.5.0
190
- - 新增: Core.moduleExists
191
- - 新增: SetupHelper.assertModuleExists
192
- - 修改: Core.setup 方法增加 name 参数
193
- - 删除: SetupHelper.checkCoreProperty
194
- - 删除: SetupHelper.checkContextProperty
195
- - @zenweb/body: ^3.0.0
196
- - 使用依赖注入重构,去除 xml 和 文件上传表单支持,取消的这两个作为独立模块分离。
197
- - @zenweb/helper: ^3.1.0
198
- - 使用依赖注入重构,不再支持 ctx.helper 调用
199
- - @zenweb/router: ^3.3.0
200
- - @zenweb/controller: ^3.9.0
201
- - @zenweb/messagecode: ^3.2.0
202
- - @zenweb/inject: ^3.18.0
1
+ # Changelog
2
+
3
+ ## [3.27.0] - 2023-4-27
4
+ - 更新: @zenweb/result: 3.7.1 外部 fail() 方法,去除 ctx.result,获取 success 数据请使用 ctx.successData 属性
5
+
6
+ ## [3.26.1] - 2023-4-20
7
+ - 更新: @zenweb/result: ^3.6.2 使用 ctx.result 可统一获取 success 或 fail 结果
8
+
9
+ ## [3.26.0] - 2023-4-19
10
+ - 更新: @zenweb/controller: ^3.14.0
11
+ - 更新: @zenweb/result: ^3.6.1
12
+ - 本次更新主要解决控制器方法返回结果无法被中间件获取问题
13
+
14
+ ## [3.25.1] - 2023-4-11
15
+ - 更新: @zenweb/helper@3.11.1
16
+ fix: page 方法返回结果缺少输入选项
17
+
18
+ ## [3.25.0] - 2023-4-11
19
+ - 更新: @zenweb/helper@3.11.0 page 方法新增 `page` 和 `total` 参数,严格模式开关
20
+
21
+ ## [3.24.0] - 2023-4-10
22
+ - 更新: @zenweb/helper@3.10.0 page 方法返回结果包含 PageOption
23
+
24
+ ## [3.23.1] - 2023-4-10
25
+ - 更新: @zenweb/helper@3.9.1
26
+
27
+ ## [3.23.0] - 2023-4-10
28
+ - 更新: @zenweb/helper@3.9.0
29
+ - 更新: @zenweb/body@3.9.0
30
+ - 统一 HelperBase
31
+
32
+ ## [3.22.0] - 2023-4-10
33
+ - update: @zenweb/result@3.3.2 支持 failCodeHeader, failCodeMessage
34
+
35
+ ## [3.21.3] - 2023-4-9
36
+ - update: typecasts@3.0.5
37
+
38
+ ## [3.21.2] - 2023-4-9
39
+ - update: typecasts@3.0.4
40
+
41
+ ## [3.21.1] - 2023-4-9
42
+ - update: typecasts@3.0.3
43
+
44
+ ## [3.21.0] - 2023-4-8
45
+ - 更新: @zenweb/helper: ^3.8.0 增加 TypeCastHelper.page 方法
46
+ - 更新: @zenweb/body: ^3.8.0 增加 BodyHelper.page 方法
47
+
48
+ ## [3.20.0] - 2023-4-7
49
+ - 更新: @zenweb/helper: ^3.7.0
50
+ - 更新: @zenweb/inject: ^3.19.0
51
+
52
+ ## [3.19.1] - 2023-4-1
53
+ - 更新: @zenweb/helper: ^3.6.1
54
+
55
+ ## [3.19.0] - 2023-4-1
56
+ - 更新: typecasts: 3.0.0
57
+ - 更新: @zenweb/body: ^3.7.0
58
+ - 更新: @zenweb/helper: ^3.6.0
59
+ ```ts
60
+ export class DemoController {
61
+ @mapping({ method: 'POST' })
62
+ typecast(body: BodyHelper) {
63
+ return body.get({
64
+ kw: 'trim',
65
+ news: {
66
+ // 嵌套对象 news
67
+ // 嵌套用法与 get({}) 用法一致,可以无限嵌套
68
+ type: 'object',
69
+ pick: {
70
+ id: '!int',
71
+ title: '!string',
72
+ }
73
+ }
74
+ });
75
+ }
76
+ }
77
+ ```
78
+
79
+ ## [3.18.1] - 2023-4-1
80
+ - 更新: typecasts: 2.8.0
81
+ - 更新: @zenweb/body: ^3.6.2
82
+ - 更新: @zenweb/helper: ^3.5.2
83
+
84
+ ## [3.18.0] - 2023-3-30
85
+ - 更新: @zenweb/result: ^3.2.1
86
+ - 支持自定义结果渲染器
87
+ - 支持 return 结果自动设置到 ctx.success 中
88
+ - 更新: @zenweb/controller: ^3.13.0
89
+ - 不再主动调用 ctx.success 方法,使用新的 @zenweb/result 来管理结果
90
+ - 新增 ControllerRegister 管理控制器注册
91
+
92
+ ## [3.17.1] - 2023-3-29
93
+ - 更新: @zenweb/helper@3.5.1
94
+
95
+ ## [3.17.0] - 2023-3-29
96
+ - 更新: @zenweb/controller 新增 Core.controllerRegister
97
+
98
+ ## [3.16.0] - 2023-3-28
99
+ - 更新: @zenweb/helper@3.5.0 对象嵌套
100
+ ```ts
101
+ export class DemoController {
102
+ @mapping({ method: 'POST' })
103
+ typecast(body: BodyHelper) {
104
+ return body.get({
105
+ kw: 'trim',
106
+ news: {
107
+ // 嵌套对象 news
108
+ // 嵌套用法与 get({}) 用法一致,可以无限嵌套
109
+ type: {
110
+ id: '!int',
111
+ title: '!string',
112
+ }
113
+ }
114
+ });
115
+ }
116
+ }
117
+ ```
118
+
119
+ 提交数据:
120
+ ```json
121
+ {
122
+ "kw": "keyword",
123
+ "news": {
124
+ "id": "1234",
125
+ "title": "news title"
126
+ }
127
+ }
128
+ ```
129
+
130
+ ## [3.15.3] - 2023-3-27
131
+ - 新增 tsconfig-app.json, tsconfig-module.json 文件
132
+
133
+ ## [3.15.2] - 2023-3-27
134
+ - 新增 tsconfig-base.json 文件
135
+
136
+ ## [3.15.1] - 2023-3-23
137
+ - 更新: @zenweb/body@3.6.1 错误的使用了 node16 的包导入规则,导致低于 16 版本的 node 无法使用
138
+ - 更新说明文档
139
+
140
+ ## [3.15.0] - 2023-3-21
141
+ - 更新: @zenweb/messagecode: ^3.4.0
142
+ - number 类型支持,如果为 number 则直接获取不进行递归查找
143
+ - 可以格式化不在配置项中的字符串
144
+ - 增加 has 方法用于判断配置项是否存在
145
+ - 更新: @zenweb/result: ^3.1.0
146
+ - 使用 messagecode 统一处理错误代码消息
147
+ - 更新: @zenweb/helper: ^3.4.0
148
+ - 使用新的 result.fail 简化错误输出代码
149
+ - 去除配置项中的 requiredErrorCode 和 validateErrorCode
150
+ - 增加全局配置 page 选项
151
+ - 更新: @zenweb/controller: ^3.10.0
152
+ - discoverPaths 支持使用 "./" 开头的相对路径
153
+ - 增加 debug 信息
154
+
155
+ ## [3.14.0] - 2023-3-19
156
+ - 更新: @zenweb/body: ^3.6.0
157
+
158
+ ## [3.13.1] - 2023-3-18
159
+ - 导出: RawBody, TextBody
160
+
161
+ ## [3.13.0] - 2023-3-17
162
+ - 更新: @zenweb/body: ^3.5.0
163
+ - 重构数据流读取, 新增 RawBody 和 TextBody,可扩展的解析器
164
+
165
+ ## [3.12.2] - 2023-3-15
166
+ - 更新:@zenweb/body: ^3.2.2 xml 类型
167
+
168
+ ## 3.12.1
169
+ - 导出: ParamHelper
170
+
171
+ ## 3.12.0
172
+ - 更新: @zenweb/body: ^3.2.0 ObjectBody
173
+
174
+ ## 3.11.1
175
+ > null 大检查! 所有项目强制开启 TS strict 模式,不再忽略 null 检查
176
+ - 更新:
177
+ - @zenweb/body: ^3.1.1
178
+ - @zenweb/controller: ^3.9.1
179
+ - @zenweb/core: ^3.5.1
180
+ - @zenweb/helper: ^3.3.1
181
+ - @zenweb/log: ^3.2.1
182
+ - @zenweb/messagecode: ^3.2.1
183
+ - @zenweb/meta: ^2.4.1
184
+ - @zenweb/result: ^3.0.1
185
+
186
+ ## 3.11.0
187
+ - @zenweb/helper: ^3.3.0
188
+ - 去除 Helper
189
+ - 新增 QueryHelper, ParamHelper, TypeCastHelper
190
+ - @zenweb/body: ^3.1.0
191
+ - 新增 BodyHelper 数据类型转换&校验
192
+
193
+ ## 3.10.0
194
+ - update:
195
+ - @zenweb/core: ^3.5.0
196
+ - 新增: Core.moduleExists
197
+ - 新增: SetupHelper.assertModuleExists
198
+ - 修改: Core.setup 方法增加 name 参数
199
+ - 删除: SetupHelper.checkCoreProperty
200
+ - 删除: SetupHelper.checkContextProperty
201
+ - @zenweb/body: ^3.0.0
202
+ - 使用依赖注入重构,去除 xml 和 文件上传表单支持,取消的这两个作为独立模块分离。
203
+ - @zenweb/helper: ^3.1.0
204
+ - 使用依赖注入重构,不再支持 ctx.helper 调用
205
+ - @zenweb/router: ^3.3.0
206
+ - @zenweb/controller: ^3.9.0
207
+ - @zenweb/messagecode: ^3.2.0
208
+ - @zenweb/inject: ^3.18.0
package/README.md CHANGED
@@ -1,119 +1,119 @@
1
- # ZenWeb
2
-
3
- Modular lightweight web framework based on Koa
4
-
5
- ## Document
6
-
7
- [ZenWeb 文档](https://zenweb.node.ltd)
8
-
9
- ## Install
10
-
11
- ```bash
12
- # for production
13
- npm install zenweb
14
-
15
- # for development
16
- npm install dotenv typescript rimraf tsc-watch --save-dev
17
- ```
18
-
19
- ## Project Code
20
-
21
- edit `package.json` file at `scripts`:
22
-
23
- ```json
24
- "scripts": {
25
- "start": "node --enable-source-maps app",
26
- "dev": "rimraf app && tsc-watch --onSuccess \"npm run dev-start\"",
27
- "dev-start": "node -r dotenv/config --enable-source-maps app",
28
- "build": "rimraf app && tsc"
29
- }
30
- ```
31
-
32
- create `tsconfig.json` file
33
-
34
- ```json
35
- {
36
- "extends": "zenweb/tsconfig-app",
37
- "compilerOptions": {
38
- "outDir": "./app"
39
- },
40
- "include": ["src/**/*"]
41
- }
42
- ```
43
-
44
- create `.env` file
45
-
46
- ```bash
47
- APP_NAME=myweb
48
- NODE_ENV=development
49
- DEBUG=*
50
- ```
51
-
52
- create `src/index.ts` file
53
-
54
- ```ts
55
- import { create } from 'zenweb';
56
- create().start();
57
- ```
58
-
59
- create `src/service/hello.ts` file
60
-
61
- ```ts
62
- import { inject } from 'zenweb';
63
-
64
- export class HelloService {
65
- @inject ctx!: Context;
66
-
67
- getIp() {
68
- return this.ctx.ip;
69
- }
70
- }
71
- ```
72
-
73
- create `src/controller/hello.ts` file
74
-
75
- ```ts
76
- import { mapping } from 'zenweb';
77
- import { HelloService } from '../service/hello';
78
-
79
- export class HelloController {
80
- @mapping()
81
- index(service: HelloService) {
82
- const ip = service.getIp();
83
- return `Hello ZenWeb! ${ip}`;
84
- }
85
- }
86
- ```
87
-
88
- start server:
89
-
90
- ```bash
91
- npm run dev
92
- ```
93
-
94
- ## 内置模块
95
- - [meta](https://www.npmjs.com/package/@zenweb/meta) 运行基本信息,例如:请求耗时
96
- - [log](https://www.npmjs.com/package/@zenweb/log) 日志支持
97
- - [router](https://www.npmjs.com/package/@zenweb/router) 路由支持
98
- - [messagecode](https://www.npmjs.com/package/@zenweb/messagecode) 统一错误消息格式化
99
- - [body](https://www.npmjs.com/package/@zenweb/body) 请求主体解析,JSON、Form
100
- - [result](https://www.npmjs.com/package/@zenweb/result) 统一结果返回,成功或失败
101
- - [helper](https://www.npmjs.com/package/@zenweb/helper) 输入数据验证
102
- - [inject](https://www.npmjs.com/package/@zenweb/inject) 注入支持
103
-
104
- 内置模块默认开启,可以通过设置配置项为 **false** 关闭
105
-
106
-
107
- ## 可选模块
108
- - [cors](https://www.npmjs.com/package/@zenweb/cors) 跨域支持
109
- - [sentry](https://www.npmjs.com/package/@zenweb/sentry) sentry 错误收集
110
- - [metric](https://www.npmjs.com/package/@zenweb/metric) 生产运行健康信息收集
111
- - [validation](https://www.npmjs.com/package/@zenweb/validation) JSONSchema 验证
112
- - [mysql](https://www.npmjs.com/package/@zenweb/mysql) MySQL 数据库支持
113
- - [orm](https://www.npmjs.com/package/@zenweb/orm) ORM 支持
114
- - [template](https://www.npmjs.com/package/@zenweb/template) 模版渲染
115
- - [schedule](https://www.npmjs.com/package/@zenweb/schedule) 定时任务
116
- - [form](https://www.npmjs.com/package/@zenweb/form) 统一表单(多用于后台)
117
- - [grid](https://www.npmjs.com/package/@zenweb/grid) 统一表格(多用于后台)
118
- - [upload](https://www.npmjs.com/package/@zenweb/upload) 文件上传支持
119
- - [xmlBody](https://www.npmjs.com/package/@zenweb/xml-body) XML Body 解析
1
+ # ZenWeb
2
+
3
+ Modular lightweight web framework based on Koa
4
+
5
+ ## Document
6
+
7
+ [ZenWeb 文档](https://zenweb.node.ltd)
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ # for production
13
+ npm install zenweb
14
+
15
+ # for development
16
+ npm install dotenv typescript rimraf tsc-watch --save-dev
17
+ ```
18
+
19
+ ## Project Code
20
+
21
+ edit `package.json` file at `scripts`:
22
+
23
+ ```json
24
+ "scripts": {
25
+ "start": "node --enable-source-maps app",
26
+ "dev": "rimraf app && tsc-watch --onSuccess \"npm run dev-start\"",
27
+ "dev-start": "node -r dotenv/config --enable-source-maps app",
28
+ "build": "rimraf app && tsc"
29
+ }
30
+ ```
31
+
32
+ create `tsconfig.json` file
33
+
34
+ ```json
35
+ {
36
+ "extends": "zenweb/tsconfig-app",
37
+ "compilerOptions": {
38
+ "outDir": "./app"
39
+ },
40
+ "include": ["src/**/*"]
41
+ }
42
+ ```
43
+
44
+ create `.env` file
45
+
46
+ ```bash
47
+ APP_NAME=myweb
48
+ NODE_ENV=development
49
+ DEBUG=*
50
+ ```
51
+
52
+ create `src/index.ts` file
53
+
54
+ ```ts
55
+ import { create } from 'zenweb';
56
+ create().start();
57
+ ```
58
+
59
+ create `src/service/hello.ts` file
60
+
61
+ ```ts
62
+ import { inject } from 'zenweb';
63
+
64
+ export class HelloService {
65
+ @inject ctx!: Context;
66
+
67
+ getIp() {
68
+ return this.ctx.ip;
69
+ }
70
+ }
71
+ ```
72
+
73
+ create `src/controller/hello.ts` file
74
+
75
+ ```ts
76
+ import { mapping } from 'zenweb';
77
+ import { HelloService } from '../service/hello';
78
+
79
+ export class HelloController {
80
+ @mapping()
81
+ index(service: HelloService) {
82
+ const ip = service.getIp();
83
+ return `Hello ZenWeb! ${ip}`;
84
+ }
85
+ }
86
+ ```
87
+
88
+ start server:
89
+
90
+ ```bash
91
+ npm run dev
92
+ ```
93
+
94
+ ## 内置模块
95
+ - [meta](https://www.npmjs.com/package/@zenweb/meta) 运行基本信息,例如:请求耗时
96
+ - [log](https://www.npmjs.com/package/@zenweb/log) 日志支持
97
+ - [router](https://www.npmjs.com/package/@zenweb/router) 路由支持
98
+ - [messagecode](https://www.npmjs.com/package/@zenweb/messagecode) 统一错误消息格式化
99
+ - [body](https://www.npmjs.com/package/@zenweb/body) 请求主体解析,JSON、Form
100
+ - [result](https://www.npmjs.com/package/@zenweb/result) 统一结果返回,成功或失败
101
+ - [helper](https://www.npmjs.com/package/@zenweb/helper) 输入数据验证
102
+ - [inject](https://www.npmjs.com/package/@zenweb/inject) 注入支持
103
+
104
+ 内置模块默认开启,可以通过设置配置项为 **false** 关闭
105
+
106
+
107
+ ## 可选模块
108
+ - [cors](https://www.npmjs.com/package/@zenweb/cors) 跨域支持
109
+ - [sentry](https://www.npmjs.com/package/@zenweb/sentry) sentry 错误收集
110
+ - [metric](https://www.npmjs.com/package/@zenweb/metric) 生产运行健康信息收集
111
+ - [validation](https://www.npmjs.com/package/@zenweb/validation) JSONSchema 验证
112
+ - [mysql](https://www.npmjs.com/package/@zenweb/mysql) MySQL 数据库支持
113
+ - [orm](https://www.npmjs.com/package/@zenweb/orm) ORM 支持
114
+ - [template](https://www.npmjs.com/package/@zenweb/template) 模版渲染
115
+ - [schedule](https://www.npmjs.com/package/@zenweb/schedule) 定时任务
116
+ - [form](https://www.npmjs.com/package/@zenweb/form) 统一表单(多用于后台)
117
+ - [grid](https://www.npmjs.com/package/@zenweb/grid) 统一表格(多用于后台)
118
+ - [upload](https://www.npmjs.com/package/@zenweb/upload) 文件上传支持
119
+ - [xmlBody](https://www.npmjs.com/package/@zenweb/xml-body) XML Body 解析
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Core } from '@zenweb/core';
2
2
  import { CreateOptions } from './types';
3
3
  export { init, inject, factory, scope } from '@zenweb/inject';
4
4
  export { Router } from '@zenweb/router';
5
- export { ResultFail } from '@zenweb/result';
5
+ export { ResultFail, fail } from '@zenweb/result';
6
6
  export { controller, mapping } from '@zenweb/controller';
7
7
  export { Next, SetupFunction, Context, Middleware } from '@zenweb/core';
8
8
  export { Body, ObjectBody, BodyHelper, RawBody, TextBody } from '@zenweb/body';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.create = exports.Core = exports.ParamHelper = exports.TypeCastHelper = exports.QueryHelper = exports.TextBody = exports.RawBody = exports.BodyHelper = exports.ObjectBody = exports.Body = exports.Context = exports.mapping = exports.controller = exports.ResultFail = exports.Router = exports.scope = exports.factory = exports.inject = exports.init = void 0;
3
+ exports.create = exports.Core = exports.ParamHelper = exports.TypeCastHelper = exports.QueryHelper = exports.TextBody = exports.RawBody = exports.BodyHelper = exports.ObjectBody = exports.Body = exports.Context = exports.mapping = exports.controller = exports.fail = exports.ResultFail = exports.Router = exports.scope = exports.factory = exports.inject = exports.init = void 0;
4
4
  const inject_1 = require("@zenweb/inject");
5
5
  const meta_1 = require("@zenweb/meta");
6
6
  const log_1 = require("@zenweb/log");
@@ -21,6 +21,7 @@ var router_2 = require("@zenweb/router");
21
21
  Object.defineProperty(exports, "Router", { enumerable: true, get: function () { return router_2.Router; } });
22
22
  var result_2 = require("@zenweb/result");
23
23
  Object.defineProperty(exports, "ResultFail", { enumerable: true, get: function () { return result_2.ResultFail; } });
24
+ Object.defineProperty(exports, "fail", { enumerable: true, get: function () { return result_2.fail; } });
24
25
  var controller_2 = require("@zenweb/controller");
25
26
  Object.defineProperty(exports, "controller", { enumerable: true, get: function () { return controller_2.controller; } });
26
27
  Object.defineProperty(exports, "mapping", { enumerable: true, get: function () { return controller_2.mapping; } });
package/package.json CHANGED
@@ -1,48 +1,48 @@
1
- {
2
- "name": "zenweb",
3
- "version": "3.26.0",
4
- "description": "Modular lightweight web framework based on Koa",
5
- "main": "dist/index.js",
6
- "typings": "./dist/index.d.ts",
7
- "files": [
8
- "tsconfig-*.json",
9
- "dist"
10
- ],
11
- "scripts": {
12
- "build": "rimraf dist && tsc",
13
- "prepublishOnly": "npm run build",
14
- "dev": "cd example && cross-env APP_NAME=testapp DEBUG=* NODE_ENV=development ts-node src"
15
- },
16
- "author": {
17
- "name": "YeFei",
18
- "email": "316606233@qq.com"
19
- },
20
- "keywords": [
21
- "web",
22
- "webapp",
23
- "http",
24
- "framework",
25
- "koa",
26
- "zenweb"
27
- ],
28
- "license": "MIT",
29
- "homepage": "https://zenweb.node.ltd",
30
- "dependencies": {
31
- "@zenweb/body": "^3.9.0",
32
- "@zenweb/controller": "^3.14.0",
33
- "@zenweb/core": "^3.5.5",
34
- "@zenweb/helper": "^3.11.1",
35
- "@zenweb/inject": "^3.19.0",
36
- "@zenweb/log": "^3.2.1",
37
- "@zenweb/messagecode": "^3.4.0",
38
- "@zenweb/meta": "^2.4.1",
39
- "@zenweb/result": "^3.6.1",
40
- "@zenweb/router": "^3.3.0"
41
- },
42
- "devDependencies": {
43
- "cross-env": "^7.0.3",
44
- "rimraf": "^4.1.2",
45
- "ts-node": "^10.9.1",
46
- "typescript": "^5.0.3"
47
- }
48
- }
1
+ {
2
+ "name": "zenweb",
3
+ "version": "3.27.0",
4
+ "description": "Modular lightweight web framework based on Koa",
5
+ "main": "dist/index.js",
6
+ "typings": "./dist/index.d.ts",
7
+ "files": [
8
+ "tsconfig-*.json",
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "rimraf dist && tsc",
13
+ "prepublishOnly": "npm run build",
14
+ "dev": "cd example && cross-env APP_NAME=testapp DEBUG=* NODE_ENV=development ts-node src"
15
+ },
16
+ "author": {
17
+ "name": "YeFei",
18
+ "email": "316606233@qq.com"
19
+ },
20
+ "keywords": [
21
+ "web",
22
+ "webapp",
23
+ "http",
24
+ "framework",
25
+ "koa",
26
+ "zenweb"
27
+ ],
28
+ "license": "MIT",
29
+ "homepage": "https://zenweb.node.ltd",
30
+ "dependencies": {
31
+ "@zenweb/body": "^3.9.0",
32
+ "@zenweb/controller": "^3.14.0",
33
+ "@zenweb/core": "^3.5.5",
34
+ "@zenweb/helper": "^3.12.0",
35
+ "@zenweb/inject": "^3.19.0",
36
+ "@zenweb/log": "^3.2.1",
37
+ "@zenweb/messagecode": "^3.4.0",
38
+ "@zenweb/meta": "^2.4.1",
39
+ "@zenweb/result": "^3.7.1",
40
+ "@zenweb/router": "^3.3.0"
41
+ },
42
+ "devDependencies": {
43
+ "cross-env": "^7.0.3",
44
+ "rimraf": "^4.1.2",
45
+ "ts-node": "^10.9.1",
46
+ "typescript": "^5.0.4"
47
+ }
48
+ }
package/tsconfig-app.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "extends": "./tsconfig-base",
3
- "compilerOptions": {
4
- "sourceMap": true
5
- }
1
+ {
2
+ "extends": "./tsconfig-base",
3
+ "compilerOptions": {
4
+ "sourceMap": true
5
+ }
6
6
  }
@@ -1,11 +1,11 @@
1
- {
2
- "compilerOptions": {
3
- "experimentalDecorators": true,
4
- "emitDecoratorMetadata": true,
5
- "target": "ES2019",
6
- "lib": [ "ES2019" ],
7
- "module": "commonjs",
8
- "strict": true,
9
- "newLine": "lf"
10
- }
1
+ {
2
+ "compilerOptions": {
3
+ "experimentalDecorators": true,
4
+ "emitDecoratorMetadata": true,
5
+ "target": "ES2019",
6
+ "lib": [ "ES2019" ],
7
+ "module": "commonjs",
8
+ "strict": true,
9
+ "newLine": "lf"
10
+ }
11
11
  }
@@ -1,6 +1,6 @@
1
- {
2
- "extends": "./tsconfig-base",
3
- "compilerOptions": {
4
- "declaration": true
5
- }
1
+ {
2
+ "extends": "./tsconfig-base",
3
+ "compilerOptions": {
4
+ "declaration": true
5
+ }
6
6
  }