vona 5.0.4 → 5.0.8

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.
Files changed (328) hide show
  1. package/LICENSE +8 -0
  2. package/README.en-US.md +63 -0
  3. package/README.md +63 -1
  4. package/package.json +6 -76
  5. package/LICENSE.en-US +0 -3
  6. package/README.zh-CN.md +0 -1
  7. package/dist/app/extend/context.d.ts +0 -4
  8. package/dist/app/extend/context.js +0 -152
  9. package/dist/index.d.ts +0 -11
  10. package/dist/index.js +0 -35
  11. package/dist/lib/base/dbTransaction.d.ts +0 -12
  12. package/dist/lib/base/dbTransaction.js +0 -55
  13. package/dist/lib/base/error.d.ts +0 -18
  14. package/dist/lib/base/error.js +0 -70
  15. package/dist/lib/base/model.d.ts +0 -22
  16. package/dist/lib/base/model.js +0 -253
  17. package/dist/lib/bean/_beanLocal_.d.ts +0 -6
  18. package/dist/lib/bean/_beanLocal_.js +0 -16
  19. package/dist/lib/bean/beanBase.d.ts +0 -11
  20. package/dist/lib/bean/beanBase.js +0 -34
  21. package/dist/lib/bean/beanBaseSimple.d.ts +0 -8
  22. package/dist/lib/bean/beanBaseSimple.js +0 -31
  23. package/dist/lib/bean/beanContainer.d.ts +0 -39
  24. package/dist/lib/bean/beanContainer.js +0 -514
  25. package/dist/lib/bean/beanLocal.d.ts +0 -6
  26. package/dist/lib/bean/beanLocal.js +0 -16
  27. package/dist/lib/bean/beanModuleScopeBase.d.ts +0 -10
  28. package/dist/lib/bean/beanModuleScopeBase.js +0 -28
  29. package/dist/lib/bean/beanScopeBase.d.ts +0 -6
  30. package/dist/lib/bean/beanScopeBase.js +0 -19
  31. package/dist/lib/bean/beanScopeScene.d.ts +0 -12
  32. package/dist/lib/bean/beanScopeScene.js +0 -23
  33. package/dist/lib/bean/beanSimple.d.ts +0 -7
  34. package/dist/lib/bean/beanSimple.js +0 -24
  35. package/dist/lib/bean/index.d.ts +0 -8
  36. package/dist/lib/bean/index.js +0 -24
  37. package/dist/lib/bean/resource/config/broadcast.d.ts +0 -7
  38. package/dist/lib/bean/resource/config/broadcast.js +0 -3
  39. package/dist/lib/bean/resource/config/index.d.ts +0 -2
  40. package/dist/lib/bean/resource/config/index.js +0 -18
  41. package/dist/lib/bean/resource/config/middleware.d.ts +0 -9
  42. package/dist/lib/bean/resource/config/middleware.js +0 -3
  43. package/dist/lib/bean/resource/config/startup.d.ts +0 -9
  44. package/dist/lib/bean/resource/config/startup.js +0 -3
  45. package/dist/lib/bean/resource/config/type.d.ts +0 -43
  46. package/dist/lib/bean/resource/config/type.js +0 -3
  47. package/dist/lib/bean/resource/constant/index.d.ts +0 -2
  48. package/dist/lib/bean/resource/constant/index.js +0 -18
  49. package/dist/lib/bean/resource/constant/type.d.ts +0 -2
  50. package/dist/lib/bean/resource/constant/type.js +0 -3
  51. package/dist/lib/bean/resource/entity/entityBase.d.ts +0 -21
  52. package/dist/lib/bean/resource/entity/entityBase.js +0 -20
  53. package/dist/lib/bean/resource/entity/index.d.ts +0 -2
  54. package/dist/lib/bean/resource/entity/index.js +0 -18
  55. package/dist/lib/bean/resource/error/beanScopeError.d.ts +0 -11
  56. package/dist/lib/bean/resource/error/beanScopeError.js +0 -34
  57. package/dist/lib/bean/resource/error/beanScopeErrorImpl.d.ts +0 -14
  58. package/dist/lib/bean/resource/error/beanScopeErrorImpl.js +0 -35
  59. package/dist/lib/bean/resource/error/errorClass.d.ts +0 -18
  60. package/dist/lib/bean/resource/error/errorClass.js +0 -78
  61. package/dist/lib/bean/resource/error/errorContext.d.ts +0 -38
  62. package/dist/lib/bean/resource/error/errorContext.js +0 -3
  63. package/dist/lib/bean/resource/error/errorGlobal.d.ts +0 -8
  64. package/dist/lib/bean/resource/error/errorGlobal.js +0 -3
  65. package/dist/lib/bean/resource/error/errorInternal.d.ts +0 -67
  66. package/dist/lib/bean/resource/error/errorInternal.js +0 -70
  67. package/dist/lib/bean/resource/error/errorObject.d.ts +0 -5
  68. package/dist/lib/bean/resource/error/errorObject.js +0 -3
  69. package/dist/lib/bean/resource/error/index.d.ts +0 -9
  70. package/dist/lib/bean/resource/error/index.js +0 -25
  71. package/dist/lib/bean/resource/error/type.d.ts +0 -9
  72. package/dist/lib/bean/resource/error/type.js +0 -3
  73. package/dist/lib/bean/resource/index.d.ts +0 -8
  74. package/dist/lib/bean/resource/index.js +0 -24
  75. package/dist/lib/bean/resource/locale/beanScopeLocale.d.ts +0 -11
  76. package/dist/lib/bean/resource/locale/beanScopeLocale.js +0 -33
  77. package/dist/lib/bean/resource/locale/beanScopeLocaleImpl.d.ts +0 -3
  78. package/dist/lib/bean/resource/locale/beanScopeLocaleImpl.js +0 -14
  79. package/dist/lib/bean/resource/locale/index.d.ts +0 -4
  80. package/dist/lib/bean/resource/locale/index.js +0 -20
  81. package/dist/lib/bean/resource/locale/localeCtx.d.ts +0 -8
  82. package/dist/lib/bean/resource/locale/localeCtx.js +0 -63
  83. package/dist/lib/bean/resource/locale/type.d.ts +0 -19
  84. package/dist/lib/bean/resource/locale/type.js +0 -3
  85. package/dist/lib/bean/resource/model/beanModelBase.d.ts +0 -24
  86. package/dist/lib/bean/resource/model/beanModelBase.js +0 -165
  87. package/dist/lib/bean/resource/model/beanModelBaseInner.d.ts +0 -29
  88. package/dist/lib/bean/resource/model/beanModelBaseInner.js +0 -86
  89. package/dist/lib/bean/resource/model/index.d.ts +0 -2
  90. package/dist/lib/bean/resource/model/index.js +0 -18
  91. package/dist/lib/bean/resource/model/type.d.ts +0 -12
  92. package/dist/lib/bean/resource/model/type.js +0 -3
  93. package/dist/lib/bean/resource/route/index.d.ts +0 -2
  94. package/dist/lib/bean/resource/route/index.js +0 -18
  95. package/dist/lib/bean/resource/route/type.d.ts +0 -60
  96. package/dist/lib/bean/resource/route/type.js +0 -3
  97. package/dist/lib/bean/scope/beanScopeBase.d.ts +0 -19
  98. package/dist/lib/bean/scope/beanScopeBase.js +0 -104
  99. package/dist/lib/bean/scope/beanScopeBean.d.ts +0 -10
  100. package/dist/lib/bean/scope/beanScopeBean.js +0 -34
  101. package/dist/lib/bean/scope/beanScopeError.d.ts +0 -11
  102. package/dist/lib/bean/scope/beanScopeError.js +0 -21
  103. package/dist/lib/bean/scope/beanScopeErrorImpl.d.ts +0 -14
  104. package/dist/lib/bean/scope/beanScopeErrorImpl.js +0 -21
  105. package/dist/lib/bean/scope/beanScopeScene.d.ts +0 -12
  106. package/dist/lib/bean/scope/beanScopeScene.js +0 -42
  107. package/dist/lib/bean/scope/index.d.ts +0 -5
  108. package/dist/lib/bean/scope/index.js +0 -21
  109. package/dist/lib/bean/scope/type.d.ts +0 -21
  110. package/dist/lib/bean/scope/type.js +0 -3
  111. package/dist/lib/bean/type.d.ts +0 -17
  112. package/dist/lib/bean/type.js +0 -4
  113. package/dist/lib/core/index.d.ts +0 -5
  114. package/dist/lib/core/index.js +0 -21
  115. package/dist/lib/core/meta.d.ts +0 -65
  116. package/dist/lib/core/meta.js +0 -335
  117. package/dist/lib/core/metaCtx.d.ts +0 -16
  118. package/dist/lib/core/metaCtx.js +0 -71
  119. package/dist/lib/core/metadata.d.ts +0 -12
  120. package/dist/lib/core/metadata.js +0 -52
  121. package/dist/lib/core/resource.d.ts +0 -29
  122. package/dist/lib/core/resource.js +0 -172
  123. package/dist/lib/decorator/class/aop.d.ts +0 -3
  124. package/dist/lib/decorator/class/aop.js +0 -23
  125. package/dist/lib/decorator/class/atom.d.ts +0 -3
  126. package/dist/lib/decorator/class/atom.js +0 -22
  127. package/dist/lib/decorator/class/bean.d.ts +0 -3
  128. package/dist/lib/decorator/class/bean.js +0 -23
  129. package/dist/lib/decorator/class/controller.d.ts +0 -3
  130. package/dist/lib/decorator/class/controller.js +0 -22
  131. package/dist/lib/decorator/class/index.d.ts +0 -10
  132. package/dist/lib/decorator/class/index.js +0 -26
  133. package/dist/lib/decorator/class/local.d.ts +0 -3
  134. package/dist/lib/decorator/class/local.js +0 -23
  135. package/dist/lib/decorator/class/model.d.ts +0 -3
  136. package/dist/lib/decorator/class/model.js +0 -28
  137. package/dist/lib/decorator/class/scope.d.ts +0 -2
  138. package/dist/lib/decorator/class/scope.js +0 -20
  139. package/dist/lib/decorator/class/service.d.ts +0 -3
  140. package/dist/lib/decorator/class/service.js +0 -23
  141. package/dist/lib/decorator/class/use.d.ts +0 -5
  142. package/dist/lib/decorator/class/use.js +0 -43
  143. package/dist/lib/decorator/class/util.d.ts +0 -3
  144. package/dist/lib/decorator/class/util.js +0 -10
  145. package/dist/lib/decorator/class/virtual.d.ts +0 -3
  146. package/dist/lib/decorator/class/virtual.js +0 -24
  147. package/dist/lib/decorator/index.d.ts +0 -7
  148. package/dist/lib/decorator/index.js +0 -23
  149. package/dist/lib/decorator/interface/beanOptions.d.ts +0 -55
  150. package/dist/lib/decorator/interface/beanOptions.js +0 -8
  151. package/dist/lib/decorator/interface/useOptions.d.ts +0 -14
  152. package/dist/lib/decorator/interface/useOptions.js +0 -3
  153. package/dist/lib/decorator/type/constructable.d.ts +0 -2
  154. package/dist/lib/decorator/type/constructable.js +0 -3
  155. package/dist/lib/decorator/type/containerScope.d.ts +0 -2
  156. package/dist/lib/decorator/type/containerScope.js +0 -3
  157. package/dist/lib/decorator/type/injectionScope.d.ts +0 -2
  158. package/dist/lib/decorator/type/injectionScope.js +0 -3
  159. package/dist/lib/error/error.d.ts +0 -18
  160. package/dist/lib/error/error.js +0 -71
  161. package/dist/lib/error/errorClass.d.ts +0 -18
  162. package/dist/lib/error/errorClass.js +0 -72
  163. package/dist/lib/error/errorContext.d.ts +0 -38
  164. package/dist/lib/error/errorContext.js +0 -3
  165. package/dist/lib/error/errorGlobal.d.ts +0 -8
  166. package/dist/lib/error/errorGlobal.js +0 -3
  167. package/dist/lib/error/errorInternal.d.ts +0 -67
  168. package/dist/lib/error/errorInternal.js +0 -70
  169. package/dist/lib/error/errorObject.d.ts +0 -5
  170. package/dist/lib/error/errorObject.js +0 -3
  171. package/dist/lib/error/index.d.ts +0 -5
  172. package/dist/lib/error/index.js +0 -21
  173. package/dist/lib/framework/bootstrap.d.ts +0 -9
  174. package/dist/lib/framework/bootstrap.js +0 -35
  175. package/dist/lib/framework/framework.d.ts +0 -11
  176. package/dist/lib/framework/framework.js +0 -28
  177. package/dist/lib/framework/loader.d.ts +0 -21
  178. package/dist/lib/framework/loader.js +0 -57
  179. package/dist/lib/framework/meta.d.ts +0 -2
  180. package/dist/lib/framework/meta.js +0 -23
  181. package/dist/lib/framework/metaClass.d.ts +0 -2
  182. package/dist/lib/framework/metaClass.js +0 -26
  183. package/dist/lib/framework/moduleInfo.d.ts +0 -3
  184. package/dist/lib/framework/moduleInfo.js +0 -67
  185. package/dist/lib/framework/util.d.ts +0 -4
  186. package/dist/lib/framework/util.js +0 -15
  187. package/dist/lib/module/asset/errors.d.ts +0 -68
  188. package/dist/lib/module/asset/errors.js +0 -69
  189. package/dist/lib/module/bean/index.d.ts +0 -4
  190. package/dist/lib/module/bean/index.js +0 -24
  191. package/dist/lib/module/broadcast/broadcast.d.ts +0 -3
  192. package/dist/lib/module/broadcast/broadcast.js +0 -49
  193. package/dist/lib/module/broadcast/broadcastClient.d.ts +0 -24
  194. package/dist/lib/module/broadcast/broadcastClient.js +0 -91
  195. package/dist/lib/module/cluster/agent.d.ts +0 -3
  196. package/dist/lib/module/cluster/agent.js +0 -22
  197. package/dist/lib/module/cluster/app.d.ts +0 -3
  198. package/dist/lib/module/cluster/app.js +0 -26
  199. package/dist/lib/module/config.d.ts +0 -3
  200. package/dist/lib/module/config.js +0 -67
  201. package/dist/lib/module/constant.d.ts +0 -3
  202. package/dist/lib/module/constant.js +0 -46
  203. package/dist/lib/module/contextPatch.d.ts +0 -3
  204. package/dist/lib/module/contextPatch.js +0 -16
  205. package/dist/lib/module/errors.d.ts +0 -3
  206. package/dist/lib/module/errors.js +0 -49
  207. package/dist/lib/module/index.d.ts +0 -2
  208. package/dist/lib/module/index.js +0 -3
  209. package/dist/lib/module/loader.d.ts +0 -5
  210. package/dist/lib/module/loader.js +0 -73
  211. package/dist/lib/module/locales.d.ts +0 -3
  212. package/dist/lib/module/locales.js +0 -132
  213. package/dist/lib/module/messenger.d.ts +0 -25
  214. package/dist/lib/module/messenger.js +0 -128
  215. package/dist/lib/module/middleware.d.ts +0 -3
  216. package/dist/lib/module/middleware.js +0 -113
  217. package/dist/lib/module/model.d.ts +0 -3
  218. package/dist/lib/module/model.js +0 -47
  219. package/dist/lib/module/module.d.ts +0 -12
  220. package/dist/lib/module/module.js +0 -134
  221. package/dist/lib/module/moduleMeta.d.ts +0 -3
  222. package/dist/lib/module/moduleMeta.js +0 -26
  223. package/dist/lib/module/queue/queue.d.ts +0 -3
  224. package/dist/lib/module/queue/queue.js +0 -59
  225. package/dist/lib/module/queue/queueClient.d.ts +0 -26
  226. package/dist/lib/module/queue/queueClient.js +0 -262
  227. package/dist/lib/module/redis.d.ts +0 -11
  228. package/dist/lib/module/redis.js +0 -46
  229. package/dist/lib/module/reload/development.d.ts +0 -3
  230. package/dist/lib/module/reload/development.js +0 -98
  231. package/dist/lib/module/reload/reload.d.ts +0 -16
  232. package/dist/lib/module/reload/reload.js +0 -113
  233. package/dist/lib/module/reload.d.ts +0 -7
  234. package/dist/lib/module/reload.js +0 -17
  235. package/dist/lib/module/route.d.ts +0 -10
  236. package/dist/lib/module/route.js +0 -239
  237. package/dist/lib/module/schedule.d.ts +0 -3
  238. package/dist/lib/module/schedule.js +0 -129
  239. package/dist/lib/module/service.d.ts +0 -3
  240. package/dist/lib/module/service.js +0 -35
  241. package/dist/lib/module/socketio.d.ts +0 -5
  242. package/dist/lib/module/socketio.js +0 -47
  243. package/dist/lib/module/startup.d.ts +0 -2
  244. package/dist/lib/module/startup.js +0 -134
  245. package/dist/lib/module/version/clear.d.ts +0 -2
  246. package/dist/lib/module/version/clear.js +0 -42
  247. package/dist/lib/module/version/ready.d.ts +0 -6
  248. package/dist/lib/module/version/ready.js +0 -106
  249. package/dist/lib/resource/error/errorClass.d.ts +0 -18
  250. package/dist/lib/resource/error/errorClass.js +0 -72
  251. package/dist/lib/resource/error/errorContext.d.ts +0 -38
  252. package/dist/lib/resource/error/errorContext.js +0 -3
  253. package/dist/lib/resource/error/errorGlobal.d.ts +0 -8
  254. package/dist/lib/resource/error/errorGlobal.js +0 -3
  255. package/dist/lib/resource/error/errorInternal.d.ts +0 -67
  256. package/dist/lib/resource/error/errorInternal.js +0 -70
  257. package/dist/lib/resource/error/errorObject.d.ts +0 -5
  258. package/dist/lib/resource/error/errorObject.js +0 -3
  259. package/dist/lib/resource/error/index.d.ts +0 -5
  260. package/dist/lib/resource/error/index.js +0 -21
  261. package/dist/lib/utils/index.d.ts +0 -2
  262. package/dist/lib/utils/index.js +0 -18
  263. package/dist/lib/utils/isClass.d.ts +0 -2
  264. package/dist/lib/utils/isClass.js +0 -20
  265. package/dist/lib/utils/mockUtil.d.ts +0 -11
  266. package/dist/lib/utils/mockUtil.js +0 -34
  267. package/dist/lib/utils/mockUtilCtx.d.ts +0 -10
  268. package/dist/lib/utils/mockUtilCtx.js +0 -35
  269. package/dist/lib/utils/performAction.d.ts +0 -19
  270. package/dist/lib/utils/performAction.js +0 -137
  271. package/dist/lib/utils/util.d.ts +0 -63
  272. package/dist/lib/utils/util.js +0 -445
  273. package/dist/lib/utils/utilCtx.d.ts +0 -34
  274. package/dist/lib/utils/utilCtx.js +0 -137
  275. package/dist/types/application/app.d.ts +0 -19
  276. package/dist/types/application/app.js +0 -28
  277. package/dist/types/application/index.d.ts +0 -2
  278. package/dist/types/application/index.js +0 -18
  279. package/dist/types/config/appInfo.d.ts +0 -4
  280. package/dist/types/config/appInfo.js +0 -3
  281. package/dist/types/config/config.d.ts +0 -10
  282. package/dist/types/config/config.js +0 -3
  283. package/dist/types/config/development.d.ts +0 -4
  284. package/dist/types/config/development.js +0 -3
  285. package/dist/types/config/index.d.ts +0 -4
  286. package/dist/types/config/index.js +0 -20
  287. package/dist/types/config/locale.d.ts +0 -10
  288. package/dist/types/config/locale.js +0 -7
  289. package/dist/types/context/contextBase.d.ts +0 -21
  290. package/dist/types/context/contextBase.js +0 -3
  291. package/dist/types/context/contextConfig.d.ts +0 -4
  292. package/dist/types/context/contextConfig.js +0 -3
  293. package/dist/types/context/contextError.d.ts +0 -25
  294. package/dist/types/context/contextError.js +0 -3
  295. package/dist/types/context/contextLocale.d.ts +0 -9
  296. package/dist/types/context/contextLocale.js +0 -3
  297. package/dist/types/context/contextOthers.d.ts +0 -4
  298. package/dist/types/context/contextOthers.js +0 -3
  299. package/dist/types/context/contextState.d.ts +0 -8
  300. package/dist/types/context/contextState.js +0 -3
  301. package/dist/types/context/index.d.ts +0 -18
  302. package/dist/types/context/index.js +0 -18
  303. package/dist/types/enum/appEvent.d.ts +0 -5
  304. package/dist/types/enum/appEvent.js +0 -9
  305. package/dist/types/enum/index.d.ts +0 -2
  306. package/dist/types/enum/index.js +0 -18
  307. package/dist/types/index.d.ts +0 -7
  308. package/dist/types/index.js +0 -23
  309. package/dist/types/interface/broadcast.d.ts +0 -5
  310. package/dist/types/interface/broadcast.js +0 -3
  311. package/dist/types/interface/error.d.ts +0 -8
  312. package/dist/types/interface/error.js +0 -3
  313. package/dist/types/interface/index.d.ts +0 -6
  314. package/dist/types/interface/index.js +0 -22
  315. package/dist/types/interface/module.d.ts +0 -32
  316. package/dist/types/interface/module.js +0 -18
  317. package/dist/types/interface/monkey.d.ts +0 -25
  318. package/dist/types/interface/monkey.js +0 -3
  319. package/dist/types/interface/queue.d.ts +0 -29
  320. package/dist/types/interface/queue.js +0 -3
  321. package/dist/types/interface/schedule.d.ts +0 -11
  322. package/dist/types/interface/schedule.js +0 -3
  323. package/dist/types/utils/cast.d.ts +0 -6
  324. package/dist/types/utils/cast.js +0 -8
  325. package/dist/types/utils/index.d.ts +0 -3
  326. package/dist/types/utils/index.js +0 -19
  327. package/dist/types/utils/powerPartial.d.ts +0 -4
  328. package/dist/types/utils/powerPartial.js +0 -3
package/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016-present Vona
4
+
5
+
6
+ > Vona 5.0 internal alpha version, still under continuous development, not yet open source, please do not spread it
7
+
8
+ > Vona 5.0 内测版,仍在持续开发中,尚未开源,请勿扩散
@@ -0,0 +1,63 @@
1
+ English | [简体中文](./README.md)
2
+
3
+ # What is Vona
4
+
5
+ Vona is an intuitive, elegant and powerful Node.js framework for rapidly developing enterprise applications of any size
6
+
7
+ * Issues: https://github.com/vonajs/vona/issues
8
+ * Discussions: https://github.com/vonajs/vona/discussions
9
+ * Twitter: https://x.com/zhennann2024
10
+ * Bilibili: https://space.bilibili.com/454737998
11
+
12
+ ## Quick Start
13
+
14
+ 1. Clone
15
+
16
+ ``` bash
17
+ git clone git@github.com:cabloy/vona-dev.git vona-dev
18
+ ```
19
+
20
+ 2. Install
21
+
22
+ ``` bash
23
+ $ cp package.original.json package.json
24
+ $ npm run init
25
+ ```
26
+
27
+ 3. .env
28
+
29
+ Modify the `.env` file:
30
+
31
+ ``` bash
32
+ # app
33
+ APP_NAME = Vona
34
+
35
+ # database
36
+
37
+ DATABASE_DEFAULT_CLIENT = 'pg' # pg/mysql
38
+
39
+ DATABASE_CLIENT_PG_HOST = 127.0.0.1
40
+ DATABASE_CLIENT_PG_PORT = 5432
41
+ DATABASE_CLIENT_PG_USER = postgres
42
+ DATABASE_CLIENT_PG_PASSWORD =
43
+ DATABASE_CLIENT_PG_DATABASE = postgres
44
+
45
+ DATABASE_CLIENT_MYSQL_HOST = 127.0.0.1
46
+ DATABASE_CLIENT_MYSQL_PORT = 3306
47
+ DATABASE_CLIENT_MYSQL_USER = root
48
+ DATABASE_CLIENT_MYSQL_PASSWORD =
49
+ DATABASE_CLIENT_MYSQL_DATABASE = mysql
50
+
51
+ # redis
52
+
53
+ REDIS_DEFAULT_HOST = 127.0.0.1
54
+ REDIS_DEFAULT_PORT = 6379
55
+ REDIS_DEFAULT_PASSWORD =
56
+ REDIS_DEFAULT_DB = 0
57
+ ```
58
+
59
+ 4. Start
60
+
61
+ ``` bash
62
+ npm run dev
63
+ ```
package/README.md CHANGED
@@ -1 +1,63 @@
1
- # vona
1
+ 简体中文 | [English](./README.en-US.md)
2
+
3
+ # Vona 是什么
4
+
5
+ Vona 是一款直观、优雅、强大的Node.js框架,用于快速开发任何规模的企业级应用
6
+
7
+ * Issues: https://github.com/vonajs/vona/issues
8
+ * Discussions: https://github.com/vonajs/vona/discussions
9
+ * Twitter: https://x.com/zhennann2024
10
+ * Bilibili: https://space.bilibili.com/454737998
11
+
12
+ ## 快速开始
13
+
14
+ 1. Clone
15
+
16
+ ``` bash
17
+ git clone git@github.com:cabloy/vona-dev.git vona-dev
18
+ ```
19
+
20
+ 2. Install
21
+
22
+ ``` bash
23
+ $ cp package.original.json package.json
24
+ $ npm run init
25
+ ```
26
+
27
+ 3. .env
28
+
29
+ Modify the `.env` file:
30
+
31
+ ``` bash
32
+ # app
33
+ APP_NAME = Vona
34
+
35
+ # database
36
+
37
+ DATABASE_DEFAULT_CLIENT = 'pg' # pg/mysql
38
+
39
+ DATABASE_CLIENT_PG_HOST = 127.0.0.1
40
+ DATABASE_CLIENT_PG_PORT = 5432
41
+ DATABASE_CLIENT_PG_USER = postgres
42
+ DATABASE_CLIENT_PG_PASSWORD =
43
+ DATABASE_CLIENT_PG_DATABASE = postgres
44
+
45
+ DATABASE_CLIENT_MYSQL_HOST = 127.0.0.1
46
+ DATABASE_CLIENT_MYSQL_PORT = 3306
47
+ DATABASE_CLIENT_MYSQL_USER = root
48
+ DATABASE_CLIENT_MYSQL_PASSWORD =
49
+ DATABASE_CLIENT_MYSQL_DATABASE = mysql
50
+
51
+ # redis
52
+
53
+ REDIS_DEFAULT_HOST = 127.0.0.1
54
+ REDIS_DEFAULT_PORT = 6379
55
+ REDIS_DEFAULT_PASSWORD =
56
+ REDIS_DEFAULT_DB = 0
57
+ ```
58
+
59
+ 4. Start
60
+
61
+ ``` bash
62
+ npm run dev
63
+ ```
package/package.json CHANGED
@@ -1,85 +1,15 @@
1
1
  {
2
2
  "name": "vona",
3
- "version": "5.0.4",
3
+ "type": "module",
4
+ "version": "5.0.8",
4
5
  "description": "vona",
5
6
  "publishConfig": {
6
7
  "access": "public"
7
8
  },
8
- "exports": {
9
- ".": {
10
- "types": [
11
- "./src/index.ts",
12
- "./dist/index.d.ts"
13
- ],
14
- "import": "./dist/index.js",
15
- "require": "./dist/index.js",
16
- "default": "./src/index.ts"
17
- },
18
- "./package.json": "./package.json"
19
- },
20
- "files": [
21
- "dist/**/*.js",
22
- "dist/**/*.d.ts"
23
- ],
24
- "scripts": {
25
- "lint": "eslint ."
26
- },
9
+ "author": "zhennann",
27
10
  "keywords": [
28
- "egg",
29
- "egg-born",
11
+ "nodejs",
30
12
  "framework",
31
- "cabloy"
32
- ],
33
- "author": "zhennann",
34
- "dependencies": {
35
- "@cabloy/cluster-reload": "^1.0.4",
36
- "@cabloy/compose": "^1.0.6",
37
- "@cabloy/deps": "^1.0.4",
38
- "@cabloy/dotenv": "^1.0.6",
39
- "@cabloy/egg-socket.io": "^6.0.0",
40
- "@cabloy/ensure-array": "^1.0.5",
41
- "@cabloy/extend": "^3.0.9",
42
- "@cabloy/json5": "^1.0.4",
43
- "@cabloy/koa-static-cache": "^5.1.8",
44
- "@cabloy/localeutil": "^1.0.8",
45
- "@cabloy/module-glob": "^5.1.5",
46
- "@cabloy/module-info": "^1.1.5",
47
- "@cabloy/module-info-pro": "^1.0.13",
48
- "@cabloy/set": "^1.0.4",
49
- "@cabloy/word-utils": "^1.0.2",
50
- "@zhennann/egg-passport": "^2.1.5",
51
- "async": "^3.2.0",
52
- "bottleneck": "^2.19.5",
53
- "bullmq": "^2.3.1",
54
- "chalk": "^3.0.0",
55
- "chokidar": "^3.5.2",
56
- "debounce": "^1.2.0",
57
- "debug": "^4.3.4",
58
- "egg": "^3.17.5",
59
- "egg-born-mock": "^6.0.4",
60
- "egg-cluster": "^2.2.1",
61
- "egg-path-matching": "^1.0.1",
62
- "egg-redis": "^2.4.0",
63
- "egg-security": "^3.0.0",
64
- "fs-extra": "^10.1.0",
65
- "inflation": "^2.0.0",
66
- "ioredis": "^5.3.2",
67
- "is-type-of": "^1.2.0",
68
- "jsonwebtoken": "^9.0.2",
69
- "koa-compose": "^4.1.0",
70
- "koa-jwt2": "^1.0.3",
71
- "mixin-classes": "^1.0.2",
72
- "module-alias": "^2.2.2",
73
- "moment": "^2.24.0",
74
- "passport-oauth2": "^1.6.1",
75
- "raw-body": "2.5.1",
76
- "redlock": "^4.1.0",
77
- "reflect-metadata": "^0.2.1",
78
- "regenerator-runtime": "^0.14.1",
79
- "semver": "^7.3.7",
80
- "socket.io": "^2.3.0",
81
- "supertest": "^4.0.2",
82
- "uuid": "^9.0.1"
83
- },
84
- "gitHead": "72c82934d27173943963f25132b03c3f8e8933d3"
13
+ "vona"
14
+ ]
85
15
  }
package/LICENSE.en-US DELETED
@@ -1,3 +0,0 @@
1
- Copyright (c) 2016-present CabloyJS
2
-
3
- CabloyJS 5.0 internal beta version, still under continuous development, not yet open source, please do not spread it
package/README.zh-CN.md DELETED
@@ -1 +0,0 @@
1
- # vona
@@ -1,4 +0,0 @@
1
- import { ContextBase } from '../../types/context/contextBase.js';
2
- declare const context: ContextBase;
3
- export default context;
4
- //# sourceMappingURL=context.d.ts.map
@@ -1,152 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const raw_body_1 = __importDefault(require("raw-body"));
30
- const inflation_1 = __importDefault(require("inflation"));
31
- const ModuleInfo = __importStar(require("@cabloy/module-info"));
32
- const metaCtx_js_1 = require("../../lib/core/metaCtx.js");
33
- const cast_js_1 = require("../../types/utils/cast.js");
34
- const MODULE = Symbol.for('Context#__module');
35
- const META = Symbol.for('Context#__meta');
36
- const INNERACCESS = Symbol.for('Context#__inneraccess');
37
- const SUBDOMAIN = Symbol.for('Context#__subdomain');
38
- const CTXCALLER = Symbol.for('Context#__ctxcaller');
39
- const TAILCALLBACKS = Symbol.for('Context#__tailcallbacks');
40
- const DBLEVEL = Symbol.for('Context#__dblevel');
41
- const context = {
42
- get module() {
43
- const self = (0, cast_js_1.Cast)(this);
44
- if (this[MODULE] === undefined) {
45
- const url = self.req.url || '';
46
- let info;
47
- if (url.indexOf('/api/static/public/') === 0) {
48
- info = null;
49
- }
50
- else {
51
- info = ModuleInfo.parseInfo(ModuleInfo.parseName(url));
52
- }
53
- if (!info) {
54
- info = ModuleInfo.parseInfo('a-base');
55
- }
56
- if (info) {
57
- const module = self.app.meta.modules[info.relativeName];
58
- // should not throw error, because the url maybe not valid
59
- // if (!module) throw new Error(`module not found: ${info.relativeName}`);
60
- this[MODULE] = module || null;
61
- }
62
- else {
63
- this[MODULE] = null;
64
- }
65
- }
66
- return this[MODULE];
67
- },
68
- get meta() {
69
- const self = (0, cast_js_1.Cast)(this);
70
- if (!this[META]) {
71
- this[META] = self.bean._newBean(metaCtx_js_1.CtxMeta);
72
- }
73
- return this[META];
74
- },
75
- get innerAccess() {
76
- return this[INNERACCESS];
77
- },
78
- set innerAccess(value) {
79
- this[INNERACCESS] = value;
80
- },
81
- get dbLevel() {
82
- return this[DBLEVEL] || 0;
83
- },
84
- set dbLevel(value) {
85
- this[DBLEVEL] = value;
86
- },
87
- get subdomain() {
88
- const self = (0, cast_js_1.Cast)(this);
89
- return typeof this[SUBDOMAIN] === 'undefined' ? self.subdomains.join('.') : this[SUBDOMAIN];
90
- },
91
- set subdomain(value) {
92
- this[SUBDOMAIN] = value;
93
- },
94
- get ctxCaller() {
95
- return this[CTXCALLER];
96
- },
97
- set ctxCaller(value) {
98
- // ctxCaller
99
- this[CTXCALLER] = value;
100
- // innerAccess
101
- this.innerAccess = true;
102
- // transaction
103
- (0, cast_js_1.Cast)(this).dbMeta = value.dbMeta;
104
- // dbLevel
105
- this.dbLevel = value.dbLevel;
106
- },
107
- get cache() {
108
- const self = (0, cast_js_1.Cast)(this);
109
- return self.bean._getBean('cache');
110
- },
111
- tail(cb) {
112
- if (!(0, cast_js_1.Cast)(this).dbMeta.master) {
113
- this.ctxCaller.tail(cb);
114
- }
115
- else {
116
- this.tailCallbacks.push(cb);
117
- }
118
- },
119
- async tailDone() {
120
- while (true) {
121
- const cb = this.tailCallbacks.shift();
122
- if (!cb)
123
- break;
124
- await cb();
125
- // try {
126
- // await cb();
127
- // } catch (err) {
128
- // this.app.logger.error(err);
129
- // }
130
- }
131
- },
132
- get tailCallbacks() {
133
- if (!this[TAILCALLBACKS]) {
134
- this[TAILCALLBACKS] = [];
135
- }
136
- return this[TAILCALLBACKS];
137
- },
138
- successMore(list, index, size) {
139
- const self = (0, cast_js_1.Cast)(this);
140
- self.success({
141
- list,
142
- index: index + list.length,
143
- finished: size === -1 || size === 0 || list.length < size,
144
- });
145
- },
146
- async getPayload(options) {
147
- const self = (0, cast_js_1.Cast)(this);
148
- return await (0, raw_body_1.default)((0, inflation_1.default)(self.req), options);
149
- },
150
- };
151
- exports.default = context;
152
- //# sourceMappingURL=context.js.map
package/dist/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import '@cabloy/set';
2
- import '@cabloy/json5';
3
- import 'regenerator-runtime';
4
- export * from './types/index.js';
5
- export * from './lib/bean/index.js';
6
- export * from './lib/core/index.js';
7
- export * from './lib/decorator/index.js';
8
- export * from './lib/module/index.js';
9
- export * from './lib/framework/framework.js';
10
- export * from './lib/utils/index.js';
11
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js DELETED
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- require("@cabloy/set");
21
- require("@cabloy/json5");
22
- require("regenerator-runtime");
23
- const module_alias_1 = __importDefault(require("module-alias"));
24
- const cluster_reload_1 = __importDefault(require("@cabloy/cluster-reload"));
25
- const master_js_1 = __importDefault(require("egg-cluster/lib/master.js"));
26
- module_alias_1.default.addAlias('koa-static-cache', '@cabloy/koa-static-cache');
27
- master_js_1.default.prototype.onReload = cluster_reload_1.default;
28
- __exportStar(require("./types/index.js"), exports);
29
- __exportStar(require("./lib/bean/index.js"), exports);
30
- __exportStar(require("./lib/core/index.js"), exports);
31
- __exportStar(require("./lib/decorator/index.js"), exports);
32
- __exportStar(require("./lib/module/index.js"), exports);
33
- __exportStar(require("./lib/framework/framework.js"), exports);
34
- __exportStar(require("./lib/utils/index.js"), exports);
35
- //# sourceMappingURL=index.js.map
@@ -1,12 +0,0 @@
1
- import { CabloyContext } from '../../types/index.js';
2
- export default class DbTransaction {
3
- _ctx: CabloyContext;
4
- _transactionCounter: number;
5
- _connection: any;
6
- constructor(ctx: any);
7
- get inTransaction(): boolean;
8
- get connection(): any;
9
- set connection(value: any);
10
- begin(fn: any): Promise<any>;
11
- }
12
- //# sourceMappingURL=dbTransaction.d.ts.map
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class DbTransaction {
4
- constructor(ctx) {
5
- this._ctx = ctx;
6
- this._transactionCounter = 0;
7
- this._connection = null;
8
- }
9
- get inTransaction() {
10
- return this._transactionCounter > 0;
11
- }
12
- get connection() {
13
- return this._connection;
14
- }
15
- set connection(value) {
16
- this._connection = value;
17
- }
18
- async begin(fn) {
19
- let res;
20
- const db = this._ctx.meta.util.getDbOriginal();
21
- try {
22
- if (++this._transactionCounter === 1) {
23
- this._connection = await db.beginTransaction();
24
- }
25
- }
26
- catch (err) {
27
- this._transactionCounter--;
28
- throw err;
29
- }
30
- try {
31
- res = await fn();
32
- }
33
- catch (err) {
34
- if (--this._transactionCounter === 0) {
35
- await this._connection.rollback();
36
- this._connection = null;
37
- }
38
- throw err;
39
- }
40
- try {
41
- if (--this._transactionCounter === 0) {
42
- await this._connection.commit();
43
- this._connection = null;
44
- }
45
- }
46
- catch (err) {
47
- await this._connection.rollback();
48
- this._connection = null;
49
- throw err;
50
- }
51
- return res;
52
- }
53
- }
54
- exports.default = DbTransaction;
55
- //# sourceMappingURL=dbTransaction.js.map
@@ -1,18 +0,0 @@
1
- import { BeanSimple } from '../bean/beanSimple.js';
2
- export declare class ErrorClass extends BeanSimple {
3
- ebErrors: any;
4
- constructor(ebErrors: any);
5
- success(module: any, data: any, code: any, ...args: any[]): void;
6
- fail(module: any, code: any, ...args: any[]): void;
7
- throw(module: any, code: any, ...args: any[]): void;
8
- parseFail(module: any, code: any, ...args: any[]): any;
9
- parseSuccess(module: any, code: any, ...args: any[]): {
10
- code: any;
11
- message: null;
12
- };
13
- parseCode(module: any, codeDefault: any, code: any, ...args: any[]): {
14
- code: any;
15
- message: null;
16
- };
17
- }
18
- //# sourceMappingURL=error.d.ts.map
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorClass = void 0;
4
- const beanSimple_js_1 = require("../bean/beanSimple.js");
5
- class ErrorClass extends beanSimple_js_1.BeanSimple {
6
- constructor(ebErrors) {
7
- super();
8
- this.ebErrors = ebErrors;
9
- }
10
- // data,code/message,args
11
- success(module, data, code, ...args) {
12
- const body = this.parseSuccess(module, code, ...args);
13
- this.ctx.response.status = 200;
14
- this.ctx.response.type = 'application/json';
15
- this.ctx.response.body = { code: 0, message: body.message, data };
16
- }
17
- // code/message,args
18
- fail(module, code, ...args) {
19
- const body = this.parseFail(module, code, ...args);
20
- this.ctx.response.status = 200;
21
- this.ctx.response.type = 'application/json';
22
- this.ctx.response.body = { code: __combineErrorCode(module, body.code), message: body.message }; // body maybe Error
23
- }
24
- // code/message,args
25
- throw(module, code, ...args) {
26
- const body = this.parseFail(module, code, ...args);
27
- const err = new Error();
28
- err.code = __combineErrorCode(module, body.code);
29
- err.message = body.message;
30
- if (body.code < 500)
31
- err.status = body.code;
32
- throw err;
33
- }
34
- // code/message,args
35
- parseFail(module, code, ...args) {
36
- if (typeof code === 'object')
37
- return code;
38
- return this.parseCode(module, 1, code, ...args);
39
- }
40
- // code/message,args
41
- parseSuccess(module, code, ...args) {
42
- return this.parseCode(module, 0, code, ...args);
43
- }
44
- // parseCode
45
- parseCode(module, codeDefault, code, ...args) {
46
- const ebError = this.ebErrors[module];
47
- let message = null;
48
- if (code === undefined || code === null || code === '') {
49
- code = codeDefault;
50
- }
51
- else if (typeof code === 'string') {
52
- message = this.ctx.text(code, ...args);
53
- code = codeDefault;
54
- }
55
- else {
56
- message = this.ctx.text(ebError[code], ...args);
57
- }
58
- if (!message) {
59
- message = this.ctx.text(ebError[codeDefault]);
60
- }
61
- return { code, message };
62
- }
63
- }
64
- exports.ErrorClass = ErrorClass;
65
- function __combineErrorCode(module, code) {
66
- if (code <= 1000)
67
- return code;
68
- return module ? `${module}:${code}` : code;
69
- }
70
- //# sourceMappingURL=error.js.map
@@ -1,22 +0,0 @@
1
- import { BeanSimple } from '../bean/beanSimple.js';
2
- export declare class Model extends BeanSimple {
3
- table: string;
4
- options: any;
5
- constructor({ table, options }: {
6
- table: any;
7
- options?: {} | undefined;
8
- });
9
- get disableDeleted(): any;
10
- get disableInstance(): any;
11
- columns(tableName?: string): Promise<any>;
12
- columnsClear(tableName: any): any;
13
- columnsClearAll(): boolean;
14
- prepareData(item: any): Promise<{}>;
15
- default(data: any): Promise<any>;
16
- _coerceTypeOfDefault(column: any): any;
17
- create(data: any, ...args: any[]): Promise<any>;
18
- write(data: any, ...args: any[]): Promise<any>;
19
- _rowCheck(row: any): void;
20
- _insertRowsCheck(rows: any): void;
21
- }
22
- //# sourceMappingURL=model.d.ts.map