jj.js 0.19.0 → 0.20.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/README.md +243 -173
- package/jj.js +14 -14
- package/lib/app.js +52 -17
- package/lib/cache.js +96 -30
- package/lib/config.js +14 -4
- package/lib/context.js +18 -22
- package/lib/controller.js +36 -5
- package/lib/cookie.js +11 -15
- package/lib/ctx.js +28 -28
- package/lib/db/mongodb.js +564 -0
- package/lib/db/mysql.js +32 -28
- package/lib/db/sql.js +13 -3
- package/lib/db/sqlite.js +32 -24
- package/lib/db.js +230 -112
- package/lib/loader.js +79 -44
- package/lib/logger.js +124 -126
- package/lib/middleware.js +39 -6
- package/lib/model.js +23 -9
- package/lib/{run.js → mvc.js} +29 -22
- package/lib/pagination.js +68 -14
- package/lib/request.js +4 -4
- package/lib/response.js +70 -6
- package/lib/router.js +4 -3
- package/lib/types.js +363 -196
- package/lib/upload.js +15 -15
- package/lib/url.js +10 -2
- package/lib/utils/error.js +9 -5
- package/lib/utils/utils.js +2 -0
- package/lib/utils/validate.js +13 -0
- package/lib/view.js +54 -8
- package/logo.png +0 -0
- package/package.json +8 -4
- package/types.js +177 -83
- package/CHANGELOG.md +0 -58
- package/jsdoc.conf.js +0 -17
package/types.js
CHANGED
|
@@ -1,28 +1,42 @@
|
|
|
1
1
|
//------------------系统核心库------------------
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {import('koa').Middleware} KoaMiddleware - Koa中间件函数
|
|
4
|
+
* @typedef {Object} AppOptions
|
|
5
|
+
* @property {string} [env] - Environment,默认为 'development'
|
|
6
|
+
* @property {string[]} [keys] - Signed cookie keys
|
|
7
|
+
* @property {boolean} [proxy] - Trust proxy headers
|
|
8
|
+
* @property {number} [subdomainOffset] - Subdomain offset
|
|
9
|
+
* @property {string} [proxyIpHeader] - Proxy IP header,默认为 'X-Forwarded-For'
|
|
10
|
+
* @property {number} [maxIpsCount] - Max IPs read from proxy IP header,默认为 0(表示无限)
|
|
11
|
+
* @property {function} [compose] - Function to handle middleware composition
|
|
12
|
+
* @property {boolean} [asyncLocalStorage] - Enable AsyncLocalStorage,默认为 false
|
|
13
|
+
* @property {KoaMiddleware|KoaMiddleware[]} [middleware] - Middleware,will be used before other app.use()
|
|
14
|
+
*/
|
|
15
|
+
|
|
2
16
|
/**
|
|
3
17
|
* @typedef {typeof import('./lib/app')} App
|
|
18
|
+
* @typedef {typeof import('./lib/storage')} Storage
|
|
4
19
|
* @typedef {typeof import('./lib/cache')} Cache
|
|
20
|
+
* @typedef {typeof import('./lib/logger')} Logger
|
|
5
21
|
* @typedef {typeof import('./lib/context')} Context
|
|
6
22
|
* @typedef {typeof import('./lib/controller')} Controller
|
|
7
23
|
* @typedef {typeof import('./lib/cookie')} Cookie
|
|
8
24
|
* @typedef {typeof import('./lib/db')} Db
|
|
9
|
-
* @typedef {typeof import('./lib/logger')} Logger
|
|
10
25
|
* @typedef {typeof import('./lib/middleware')} Middleware
|
|
11
26
|
* @typedef {typeof import('./lib/model')} Model
|
|
12
27
|
* @typedef {typeof import('./lib/pagination')} Pagination
|
|
13
28
|
* @typedef {typeof import('./lib/request')} Request
|
|
14
29
|
* @typedef {typeof import('./lib/response')} Response
|
|
15
|
-
* @typedef {typeof import('./lib/storage')} Storage
|
|
16
30
|
* @typedef {typeof import('./lib/upload')} Upload
|
|
17
31
|
* @typedef {typeof import('./lib/url')} Url
|
|
18
32
|
* @typedef {typeof import('./lib/view')} View
|
|
19
33
|
*/
|
|
20
34
|
|
|
21
35
|
/**
|
|
36
|
+
* @typedef {typeof Ctx.prototype} CtxInstance
|
|
22
37
|
* @typedef {typeof import('./lib/context').prototype} ContextInstance
|
|
23
38
|
* @typedef {typeof import('./lib/controller').prototype} ControllerInstance
|
|
24
39
|
* @typedef {typeof import('./lib/cookie').prototype} CookieInstance
|
|
25
|
-
* @typedef {typeof Ctx.prototype} CtxInstance
|
|
26
40
|
* @typedef {typeof import('./lib/db').prototype} DbInstance
|
|
27
41
|
* @typedef {typeof import('./lib/middleware').prototype} MiddlewareInstance
|
|
28
42
|
* @typedef {typeof import('./lib/model').prototype} ModelInstance
|
|
@@ -81,38 +95,42 @@
|
|
|
81
95
|
|
|
82
96
|
//------------------系统App配置---------------------
|
|
83
97
|
/**
|
|
98
|
+
* @typedef {import('koa-body').KoaBodyMiddlewareOptions} KoaBodyMiddlewareOptions - koa-body配置参数
|
|
84
99
|
* @typedef {Object} AppConfig - 系统配置
|
|
85
|
-
* @property {boolean}
|
|
86
|
-
* @property {boolean}
|
|
87
|
-
* @property {string}
|
|
88
|
-
* @property {string}
|
|
89
|
-
* @property {string}
|
|
90
|
-
* @property {string}
|
|
91
|
-
* @property {string}
|
|
92
|
-
* @property {string}
|
|
93
|
-
* @property {
|
|
94
|
-
* @property {string}
|
|
100
|
+
* @property {boolean} app_debug - 调试模式,默认为 false
|
|
101
|
+
* @property {boolean} app_multi - 是否开启多应用,默认为 false
|
|
102
|
+
* @property {string} default_app - 默认应用,默认为 'app'
|
|
103
|
+
* @property {string} default_controller - 默认控制器,默认为 'index'
|
|
104
|
+
* @property {string} default_action - 默认方法,默认为 'index'
|
|
105
|
+
* @property {string} common_app - 公共应用,存放公共模型及逻辑,默认为 'common'
|
|
106
|
+
* @property {string} controller_folder - 控制器目录名,默认为 'controller'
|
|
107
|
+
* @property {string} static_dir - 静态文件目录,相对于应用根目录,为空时,关闭静态访问,默认为 ''
|
|
108
|
+
* @property {KoaBodyMiddlewareOptions?} koa_body - koa-body配置参数,为null或空时,关闭koa-body,默认为 null
|
|
109
|
+
* @property {string} base_dir - 应用根目录(会自动计算)
|
|
95
110
|
*/
|
|
96
111
|
|
|
97
112
|
/**
|
|
113
|
+
* @typedef {typeof import('art-template')} ViewEngine - 模版引擎
|
|
114
|
+
* @typedef {Object.<string, function>} ViewFilter - 模版函数
|
|
98
115
|
* @typedef {Object} ViewConfig - 模板配置
|
|
99
|
-
* @property {string}
|
|
100
|
-
* @property {string}
|
|
101
|
-
* @property {string}
|
|
102
|
-
* @property {string}
|
|
103
|
-
* @property {
|
|
116
|
+
* @property {string} view_folder - 模板目录名,默认为 'view'
|
|
117
|
+
* @property {string} view_depr - 模版文件名分割符,'/'代表二级目录,默认为 '/'
|
|
118
|
+
* @property {string} view_ext - 模版文件后缀,默认为 '.htm'
|
|
119
|
+
* @property {string|ViewEngine} view_engine - 默认模版引擎,字符串或引擎类,默认为 'art-template'
|
|
120
|
+
* @property {ViewFilter} view_filter - 模版函数,系统已内置url函数,默认为 {}
|
|
104
121
|
*/
|
|
105
122
|
|
|
106
123
|
/**
|
|
107
124
|
* @typedef {Object} DbConfigItem - 数据库参数
|
|
108
|
-
* @property {string}
|
|
109
|
-
* @property {string}
|
|
110
|
-
* @property {string}
|
|
111
|
-
* @property {string}
|
|
112
|
-
* @property {string}
|
|
113
|
-
* @property {string}
|
|
114
|
-
* @property {string}
|
|
115
|
-
* @property {string}
|
|
125
|
+
* @property {string} type - 数据库类型,默认为 'mysql'
|
|
126
|
+
* @property {string} host - 服务器地址,默认为 '127.0.0.1'
|
|
127
|
+
* @property {string} database - 数据库名,默认为 'jj'
|
|
128
|
+
* @property {string} user - 数据库用户名,默认为 'root'
|
|
129
|
+
* @property {string} password - 数据库密码,默认为 ''
|
|
130
|
+
* @property {string} port - 数据库连接端口,默认为 ''
|
|
131
|
+
* @property {string} charset - 数据库编码,默认为 'utf8'
|
|
132
|
+
* @property {string} prefix - 数据库表前缀,默认为 'jj_'
|
|
133
|
+
* @property {function} [connect] - 自定义连接器
|
|
116
134
|
*/
|
|
117
135
|
|
|
118
136
|
/**
|
|
@@ -120,48 +138,52 @@
|
|
|
120
138
|
* @property {DbConfigItem} default - 数据库参数
|
|
121
139
|
*/
|
|
122
140
|
|
|
141
|
+
/**
|
|
142
|
+
* @typedef {('system' | 'error' | 'warning' | 'info' | 'debug' | 'http' | 'sql')} LogLevel - 日志级别
|
|
143
|
+
*/
|
|
123
144
|
/**
|
|
124
145
|
* @callback LogHandle - 日志驱动
|
|
125
|
-
* @param {
|
|
146
|
+
* @param {LogLevel} level - 日志级别
|
|
126
147
|
* @param {...any} args - 日志数据,支持多个,支持对象
|
|
127
148
|
*/
|
|
128
149
|
|
|
129
150
|
/**
|
|
130
151
|
* @typedef {Object} LogConfig - 日志配置
|
|
131
|
-
* @property {
|
|
132
|
-
* @property {LogHandle}
|
|
152
|
+
* @property {Array<LogLevel>} log_level - 允许输出的日志级别
|
|
153
|
+
* @property {LogHandle} log_handle - 日志驱动
|
|
133
154
|
*/
|
|
134
155
|
|
|
135
156
|
/**
|
|
136
157
|
* @typedef {Object} CacheConfig - 缓存配置
|
|
137
|
-
* @property {number}
|
|
138
|
-
* @property {number}
|
|
158
|
+
* @property {number} cache_time - 缓存时间,默认1天(60 * 60 * 24秒),为空或false则为10年
|
|
159
|
+
* @property {number} clear_time - 缓存自动清理周期,undefined: 清理一次, 0: 关闭自动清理, >0: 为周期时间(单位秒)
|
|
139
160
|
*/
|
|
140
161
|
|
|
141
162
|
/**
|
|
142
163
|
* @typedef {Object} PageConfig - 分页配置
|
|
143
|
-
* @property {string}
|
|
144
|
-
* @property {string}
|
|
145
|
-
* @property {number}
|
|
146
|
-
* @property {number}
|
|
147
|
-
* @property {string}
|
|
148
|
-
* @property {string}
|
|
149
|
-
* @property {string}
|
|
150
|
-
* @property {string}
|
|
151
|
-
* @property {string}
|
|
152
|
-
* @property {string}
|
|
153
|
-
* @property {string}
|
|
154
|
-
* @property {string}
|
|
155
|
-
* @property {string}
|
|
156
|
-
* @property {string}
|
|
164
|
+
* @property {string} page_key - 分页标识,默认为 'page'
|
|
165
|
+
* @property {string} key_origin - page_key来源,默认为 'query'
|
|
166
|
+
* @property {number} page_size - 分页大小,默认为 10
|
|
167
|
+
* @property {number} page_length - 分页长度,默认为 5
|
|
168
|
+
* @property {string} url_page - 分页URL模板,可为路由名字,可用参数:页码${page},样例1:':name',样例2:'/list_${page}.html',默认为 空
|
|
169
|
+
* @property {string} url_index - 首页URL模板,可为路由名字,可用参数:页码${page},样例1:':name',样例2:'/list_${page}.html',默认为 空
|
|
170
|
+
* @property {string} index_tpl - 首页模板,默认为 '<li class="index"><a href="${url}">首页</a></li>'
|
|
171
|
+
* @property {string} end_tpl - 末页模板,默认为 '<li class="end"><a href="${url}">末页</a></li>'
|
|
172
|
+
* @property {string} prev_tpl - 上一页模板,默认为 '<li class="prev"><a href="${url}">上一页</a></li>'
|
|
173
|
+
* @property {string} next_tpl - 下一页模板,默认为 '<li class="next"><a href="${url}">下一页</a></li>'
|
|
174
|
+
* @property {string} list_tpl - 数字页模板,默认为 '<li><a href="${url}">${page}</a></li>'
|
|
175
|
+
* @property {string} active_tpl - 当前页模板,默认为 '<li class="active"><a href="${url}">${page}</a></li>'
|
|
176
|
+
* @property {string} info_tpl - 分页信息模板,默认为 '<span class="info">共${total_page}页,${total}条记录</span>'
|
|
177
|
+
* @property {string} template - 渲染模板,默认为 '<div class="pagination"><ul class="page">${index}${prev}${list}${next}${end}</ul>${info}</div>'
|
|
157
178
|
*/
|
|
158
179
|
|
|
159
180
|
/**
|
|
181
|
+
* @typedef {('all' | 'get' | 'put' | 'post' | 'patch' | 'delete' | 'del')} RouteMethod - 请求方法
|
|
160
182
|
* @typedef {Object} RouteConfigItem - 路由配置
|
|
161
|
-
* @property {
|
|
183
|
+
* @property {RouteMethod} [method] - 请求方法,支持['all', 'get', 'put', 'post', 'patch', 'delete', 'del'],默认为 'all'
|
|
162
184
|
* @property {string} url - 请求url,支持变量正则,详细参考@koa/router
|
|
163
|
-
* @property {(string|
|
|
164
|
-
* @property {string} [type
|
|
185
|
+
* @property {(string|KoaMiddleware)} path - 响应地址(支持智能解析)或中间件函数,如果为中间件函数,则不会再执行后续代码
|
|
186
|
+
* @property {string} [type] - 响应类型,即path对应的类型,支持controller、middleware、view,默认为controller
|
|
165
187
|
* @property {string} [name] - 路由命名,命一个名字后,可以使用Url类反向编译路由url
|
|
166
188
|
*/
|
|
167
189
|
|
|
@@ -176,21 +198,21 @@
|
|
|
176
198
|
|
|
177
199
|
/**
|
|
178
200
|
* @typedef {Object} TplConfig - 跳转、调试模板配置
|
|
179
|
-
* @property {string}
|
|
180
|
-
* @property {string}
|
|
201
|
+
* @property {string} jump - 跳转模板,默认require('./tpl/jump')
|
|
202
|
+
* @property {string} exception - 调试异常输出模板,默认require('./tpl/exception')
|
|
181
203
|
*/
|
|
182
204
|
|
|
183
205
|
/**
|
|
184
206
|
* @typedef {Object} Config - 系统配置
|
|
185
|
-
* @property {AppConfig}
|
|
186
|
-
* @property {ViewConfig}
|
|
187
|
-
* @property {DbConfig}
|
|
188
|
-
* @property {LogConfig}
|
|
189
|
-
* @property {CacheConfig}
|
|
190
|
-
* @property {PageConfig}
|
|
191
|
-
* @property {RouteConfig}
|
|
192
|
-
* @property {CookieConfig & {keys?: String[] | Keygrip | undefined}}
|
|
193
|
-
* @property {TplConfig}
|
|
207
|
+
* @property {AppConfig} app
|
|
208
|
+
* @property {ViewConfig} view
|
|
209
|
+
* @property {DbConfig} db
|
|
210
|
+
* @property {LogConfig} log
|
|
211
|
+
* @property {CacheConfig} cache
|
|
212
|
+
* @property {PageConfig} page
|
|
213
|
+
* @property {RouteConfig} routes
|
|
214
|
+
* @property {CookieConfig & {keys?: String[] | Keygrip | undefined}} cookie
|
|
215
|
+
* @property {TplConfig} tpl
|
|
194
216
|
*/
|
|
195
217
|
|
|
196
218
|
|
|
@@ -201,8 +223,15 @@
|
|
|
201
223
|
* @typedef {import('mysql').PoolConnection} PoolConnection - 连接池连接
|
|
202
224
|
* @typedef {import('mysql').QueryOptions} QueryOptions - 查询参数
|
|
203
225
|
* @typedef {import('mysql').OkPacket} OkPacket - 数据库查询结果
|
|
204
|
-
* @typedef {Object} RowData - 单条数据
|
|
226
|
+
* @typedef {Object.<string, any>} RowData - 单条数据
|
|
205
227
|
* @typedef {Array<RowData>} ListData - 多条数据
|
|
228
|
+
* @typedef {('and' | 'or' | undefined)} Link - where连接条件
|
|
229
|
+
* @typedef {('=' | '<>' | '!=' | '>' | '>=' | '<' | '<=' | 'like' | 'not like' | 'in' | 'not in' | 'between' | 'not between' | 'is' | 'is not' | 'exp')} Operator - where字段操作符
|
|
230
|
+
* @typedef {Object.<string, (string | number | [Operator, any])>} Where - where条件数据
|
|
231
|
+
* @typedef {Object.<string, any>} DbData - Db数据
|
|
232
|
+
*/
|
|
233
|
+
|
|
234
|
+
/**
|
|
206
235
|
* @typedef {Object} FieldInfo - 字段信息
|
|
207
236
|
* @property {string} Field
|
|
208
237
|
* @property {string} Type
|
|
@@ -213,6 +242,25 @@
|
|
|
213
242
|
*/
|
|
214
243
|
|
|
215
244
|
/**
|
|
245
|
+
* @typedef {Object} _DbOptions - 数据库查询选项
|
|
246
|
+
* @property {string} distinct - DISTINCT关键字
|
|
247
|
+
* @property {string[]} field - 查询字段列表
|
|
248
|
+
* @property {Object.<string, {on: string, type: string}>} join - 表连接配置
|
|
249
|
+
* @property {Array.<[Where, Link?]>} where - 查询条件数组
|
|
250
|
+
* @property {string} group - GROUP BY子句
|
|
251
|
+
* @property {string} having - HAVING子句
|
|
252
|
+
* @property {Object.<string, string>} order - 排序配置
|
|
253
|
+
* @property {string} limit - LIMIT子句
|
|
254
|
+
* @property {Object.<string, number>} page - 分页配置
|
|
255
|
+
* @property {boolean} getSql - 是否返回SQL语句
|
|
256
|
+
* @property {Object.<string, any>} data - 数据对象
|
|
257
|
+
* @property {boolean|string|string[]} allowField - 允许的字段
|
|
258
|
+
* @property {string} prefix - 表前缀
|
|
259
|
+
* @property {number} [cache_time] - 缓存时间
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* @typedef {import('./lib/db/sql')} Sql - Sql类
|
|
216
264
|
* @typedef {import('./lib/db/sql').prototype} SqlInstance - Sql实例
|
|
217
265
|
*/
|
|
218
266
|
|
|
@@ -226,8 +274,8 @@
|
|
|
226
274
|
* @property {string} [filepath]
|
|
227
275
|
* @property {string} [name]
|
|
228
276
|
* @property {number} [size]
|
|
229
|
-
* @property {string} [mimetype]
|
|
230
|
-
* @property {string} [hash]
|
|
277
|
+
* @property {string?} [mimetype]
|
|
278
|
+
* @property {string?} [hash]
|
|
231
279
|
* /
|
|
232
280
|
*
|
|
233
281
|
/**
|
|
@@ -238,6 +286,20 @@
|
|
|
238
286
|
*/
|
|
239
287
|
|
|
240
288
|
|
|
289
|
+
//------------------Response类--------------------
|
|
290
|
+
/**
|
|
291
|
+
* @typedef {Object} ExceptionData
|
|
292
|
+
* @property {string} msg - 错误消息
|
|
293
|
+
* @property {string[]} code - 错误上下文代码片段
|
|
294
|
+
* @property {string[]} stack - 调用栈信息
|
|
295
|
+
* @property {number} begin - 代码片段起始行号
|
|
296
|
+
* @property {number} row - 错误所在行号
|
|
297
|
+
* @property {number} end - 代码片段结束行号
|
|
298
|
+
* @property {number} column - 错误所在列号
|
|
299
|
+
* @property {number} nth - 代码片段中错误行的相对位置
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
|
|
241
303
|
//------------------系统工具--------------------
|
|
242
304
|
/**
|
|
243
305
|
* @typedef {Object} Utils
|
|
@@ -255,6 +317,21 @@
|
|
|
255
317
|
* @callback AsyncNext - 中间件函数
|
|
256
318
|
*/
|
|
257
319
|
|
|
320
|
+
//------------------loader节点--------------------
|
|
321
|
+
/**
|
|
322
|
+
* @typedef {('file' | 'class' | 'json' | 'dir' | '')} NodeType - loader节点类型
|
|
323
|
+
* @typedef {Object} NodeInfo - loader节点信息
|
|
324
|
+
* @property {string} path - 节点绝对路径
|
|
325
|
+
* @property {NodeType} type - 节点类型
|
|
326
|
+
* @property {Object.<string, any>} [instance] - class节点实例
|
|
327
|
+
* @typedef {Object} NodeProperty - 节点属性
|
|
328
|
+
* @property {NodeInfo} __NODE__ - 节点信息
|
|
329
|
+
* @property {Boolean} __ISCLASS__ - 是否class节点
|
|
330
|
+
* @typedef {function(new: any, ...any): any} ClassNode
|
|
331
|
+
* @typedef {Object.<string, any>} ObjectNode
|
|
332
|
+
* @typedef {ClassNode & ObjectNode & NodeProperty} Node
|
|
333
|
+
*/
|
|
334
|
+
|
|
258
335
|
|
|
259
336
|
//------------------Ctx系统基类--------------------
|
|
260
337
|
/**
|
|
@@ -262,55 +339,72 @@
|
|
|
262
339
|
*/
|
|
263
340
|
class Ctx {
|
|
264
341
|
/** @type {$} */
|
|
342
|
+
// @ts-ignore
|
|
265
343
|
$;
|
|
266
344
|
|
|
345
|
+
/** @type {Utils} */
|
|
346
|
+
// @ts-ignore
|
|
347
|
+
$utils;
|
|
348
|
+
|
|
349
|
+
/** @type {Config} */
|
|
350
|
+
// @ts-ignore
|
|
351
|
+
$config;
|
|
352
|
+
|
|
267
353
|
/** @type {Cache} */
|
|
354
|
+
// @ts-ignore
|
|
268
355
|
$cache;
|
|
269
356
|
|
|
270
|
-
/** @type {
|
|
357
|
+
/** @type {Logger} */
|
|
358
|
+
// @ts-ignore
|
|
359
|
+
$logger;
|
|
360
|
+
|
|
361
|
+
/** @type {Context & ContextInstance} */
|
|
362
|
+
// @ts-ignore
|
|
271
363
|
$context;
|
|
272
364
|
|
|
273
|
-
/** @type {
|
|
365
|
+
/** @type {Controller & ControllerInstance} */
|
|
366
|
+
// @ts-ignore
|
|
274
367
|
$controller;
|
|
275
368
|
|
|
276
|
-
/** @type {
|
|
369
|
+
/** @type {Cookie & CookieInstance} */
|
|
370
|
+
// @ts-ignore
|
|
277
371
|
$cookie;
|
|
278
372
|
|
|
279
|
-
/** @type {
|
|
373
|
+
/** @type {Db & DbInstance} */
|
|
374
|
+
// @ts-ignore
|
|
280
375
|
$db;
|
|
281
376
|
|
|
282
|
-
/** @type {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
/** @type {(Middleware & MiddlewareInstance)} */
|
|
377
|
+
/** @type {Middleware & MiddlewareInstance} */
|
|
378
|
+
// @ts-ignore
|
|
286
379
|
$middleware;
|
|
287
380
|
|
|
288
|
-
/** @type {
|
|
381
|
+
/** @type {Model & ModelInstance} */
|
|
382
|
+
// @ts-ignore
|
|
289
383
|
$model;
|
|
290
384
|
|
|
291
|
-
/** @type {
|
|
385
|
+
/** @type {Pagination & PaginationInstance} */
|
|
386
|
+
// @ts-ignore
|
|
292
387
|
$pagination;
|
|
293
388
|
|
|
294
|
-
/** @type {
|
|
389
|
+
/** @type {Request & RequestInstance} */
|
|
390
|
+
// @ts-ignore
|
|
295
391
|
$request;
|
|
296
392
|
|
|
297
|
-
/** @type {
|
|
393
|
+
/** @type {Response & ResponseInstance} */
|
|
394
|
+
// @ts-ignore
|
|
298
395
|
$response;
|
|
299
396
|
|
|
300
|
-
/** @type {
|
|
397
|
+
/** @type {Upload & UploadInstance} */
|
|
398
|
+
// @ts-ignore
|
|
301
399
|
$upload;
|
|
302
400
|
|
|
303
|
-
/** @type {
|
|
401
|
+
/** @type {Url & UrlInstance} */
|
|
402
|
+
// @ts-ignore
|
|
304
403
|
$url;
|
|
305
404
|
|
|
306
|
-
/** @type {
|
|
405
|
+
/** @type {View & ViewInstance} */
|
|
406
|
+
// @ts-ignore
|
|
307
407
|
$view;
|
|
308
|
-
|
|
309
|
-
/** @type {Utils} */
|
|
310
|
-
$utils;
|
|
311
|
-
|
|
312
|
-
/** @type {Config} */
|
|
313
|
-
$config;
|
|
314
408
|
}
|
|
315
409
|
|
|
316
410
|
/**
|
package/CHANGELOG.md
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# v0.19.0 / 2025-12-11
|
|
2
|
-
1. 修改app.listen监听逻辑
|
|
3
|
-
2. 新增支持sqlite数据库
|
|
4
|
-
3. 新增test代码
|
|
5
|
-
|
|
6
|
-
# v0.18.0 / 2025-03-20
|
|
7
|
-
1. 升级依赖koa版本到v2.16.0
|
|
8
|
-
2. 修复模板路径解析bug
|
|
9
|
-
|
|
10
|
-
# v0.17.0 / 2024-09-19
|
|
11
|
-
1. 升级依赖,修复bug
|
|
12
|
-
|
|
13
|
-
# v0.16.0 / 2024-09-14
|
|
14
|
-
1. 修复v0.15.0升级依赖后bug
|
|
15
|
-
|
|
16
|
-
# v0.15.0 / 2024-09-14
|
|
17
|
-
1. 升级依赖
|
|
18
|
-
2. 优化日志输出
|
|
19
|
-
3. 优化路由请求
|
|
20
|
-
|
|
21
|
-
# v0.14.0 / 2024-03-07
|
|
22
|
-
1. 优化类型文件生成
|
|
23
|
-
2. 修复优化url生成
|
|
24
|
-
3. 自动加载功能,不缓存空文件
|
|
25
|
-
4. 修复优化Resquest类请求方法判断
|
|
26
|
-
5. 默认开启cookie签名机制
|
|
27
|
-
|
|
28
|
-
# v0.13.0 / 2024-02-27
|
|
29
|
-
1. 新增request系统类库
|
|
30
|
-
2. response类isAjax方法迁移到request类
|
|
31
|
-
3. 优化应用端types类型文件生成逻辑,启动服务时生成一次
|
|
32
|
-
|
|
33
|
-
# v0.12.0 / 2024-02-26
|
|
34
|
-
1. 添加依赖`watch`
|
|
35
|
-
|
|
36
|
-
# v0.11.0 / 2024-02-26
|
|
37
|
-
1. 基于`AsyncLocalStorage`重构核心类
|
|
38
|
-
2. 空控制器和空方法名改为`_empty`
|
|
39
|
-
|
|
40
|
-
# v0.10.0 / 2024-02-26
|
|
41
|
-
1. 类型文件位置调整及优化
|
|
42
|
-
2. 自动生成应用端类型文件(开启app_debug,并且根目录下存在jsconfig.json文件)
|
|
43
|
-
3. utils工具fs库方法优化,保留部分,其他方法建议使用fs.promises库
|
|
44
|
-
4. 系统级别调整,app类改为system,默认输出['system', 'error']级别的日志
|
|
45
|
-
|
|
46
|
-
# v0.9.0 / 2024-02-06
|
|
47
|
-
1. 支持jsdoc,完善vscode代码提示
|
|
48
|
-
2. 系统核心库app由对象改为class,使用const app = new App()
|
|
49
|
-
3. 修复Logger类输出格式化bug,log函数参数调换
|
|
50
|
-
4. 系统日志配置,默认输出['app', 'error']级别的日志
|
|
51
|
-
5. 系统级屏蔽favicon.ico请求
|
|
52
|
-
6. 系统loader支持并优先加载文件
|
|
53
|
-
7. 依赖升级@koa/router v10.1.1 -> v12.0.1
|
|
54
|
-
8. 依赖升级koa v2.13.4 -> v2.15.0
|
|
55
|
-
9. node版本要求 >= v12.7.0
|
|
56
|
-
|
|
57
|
-
# v0.8.8 / 2022-09-07
|
|
58
|
-
1. 第一个tag
|
package/jsdoc.conf.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
source: {
|
|
3
|
-
include: ['./jj.js', './lib'],
|
|
4
|
-
includePattern: '.+\\.js(doc)?$',
|
|
5
|
-
},
|
|
6
|
-
plugins: [
|
|
7
|
-
"jsdoc-tsimport-plugin"
|
|
8
|
-
],
|
|
9
|
-
templates: {
|
|
10
|
-
cleverLinks: true,
|
|
11
|
-
monospaceLinks: true,
|
|
12
|
-
},
|
|
13
|
-
opts: {
|
|
14
|
-
recurse: true,
|
|
15
|
-
destination: './docs',
|
|
16
|
-
}
|
|
17
|
-
};
|