@fastcar/core 0.2.61 → 0.2.63

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 (233) hide show
  1. package/package.json +1 -1
  2. package/src/FastCarApplication.ts +30 -9
  3. package/src/utils/ValidationUtil.ts +1 -3
  4. package/target/FastCarApplication.js +708 -692
  5. package/target/annotation/Application.js +45 -45
  6. package/target/annotation/ExceptionMonitor.js +16 -16
  7. package/target/annotation/bind/AddRequireModule.js +21 -21
  8. package/target/annotation/bind/AliasInjection.js +23 -23
  9. package/target/annotation/bind/Autowired.js +13 -13
  10. package/target/annotation/bind/CallDependency.js +23 -23
  11. package/target/annotation/data/DBType.js +11 -11
  12. package/target/annotation/data/DS.js +54 -54
  13. package/target/annotation/data/DSIndex.js +9 -9
  14. package/target/annotation/data/Entity.js +10 -10
  15. package/target/annotation/data/Field.js +18 -18
  16. package/target/annotation/data/PrimaryKey.js +9 -9
  17. package/target/annotation/data/SqlSession.js +9 -9
  18. package/target/annotation/data/Table.js +35 -35
  19. package/target/annotation/data/Transactional.js +52 -52
  20. package/target/annotation/env/ApplicationSetting.js +25 -25
  21. package/target/annotation/env/BaseFilePath.js +14 -14
  22. package/target/annotation/env/BaseName.js +9 -9
  23. package/target/annotation/env/BasePath.js +14 -14
  24. package/target/annotation/env/ENV.js +10 -10
  25. package/target/annotation/env/ResourcePath.js +9 -9
  26. package/target/annotation/lifeCycle/AddLifeCycleItem.js +18 -18
  27. package/target/annotation/lifeCycle/ApplicationDestory.js +15 -15
  28. package/target/annotation/lifeCycle/ApplicationInit.js +15 -15
  29. package/target/annotation/lifeCycle/ApplicationRunner.js +7 -7
  30. package/target/annotation/lifeCycle/ApplicationStart.js +24 -24
  31. package/target/annotation/lifeCycle/ApplicationStop.js +20 -20
  32. package/target/annotation/property/Deprecate.js +19 -19
  33. package/target/annotation/property/NotImplemented.js +8 -8
  34. package/target/annotation/property/Override.js +7 -7
  35. package/target/annotation/property/Readonly.js +16 -16
  36. package/target/annotation/scan/ComponentInjection.js +21 -21
  37. package/target/annotation/scan/ComponentScan.js +9 -9
  38. package/target/annotation/scan/ComponentScanExclusion.js +25 -25
  39. package/target/annotation/scan/ComponentScanMust.js +25 -25
  40. package/target/annotation/scan/Hotter.js +8 -8
  41. package/target/annotation/stereotype/BeanName.js +11 -11
  42. package/target/annotation/stereotype/Component.js +8 -8
  43. package/target/annotation/stereotype/Configure.js +14 -14
  44. package/target/annotation/stereotype/Controller.js +9 -9
  45. package/target/annotation/stereotype/Injection.js +12 -12
  46. package/target/annotation/stereotype/Log.js +17 -17
  47. package/target/annotation/stereotype/Repository.js +9 -9
  48. package/target/annotation/stereotype/Service.js +9 -9
  49. package/target/annotation/valid/AddChildValid.js +56 -56
  50. package/target/annotation/valid/CustomType.js +11 -11
  51. package/target/annotation/valid/DefaultVal.js +10 -10
  52. package/target/annotation/valid/NotNull.js +8 -8
  53. package/target/annotation/valid/Rule.js +100 -100
  54. package/target/annotation/valid/Size.js +10 -10
  55. package/target/annotation/valid/Type.js +10 -10
  56. package/target/annotation/valid/ValidCustom.js +17 -17
  57. package/target/annotation/valid/ValidForm.js +133 -133
  58. package/target/annotation.js +108 -108
  59. package/target/config/ApplicationConfig.js +2 -2
  60. package/target/config/SysConfig.js +19 -19
  61. package/target/constant/AppStatusEnum.js +9 -9
  62. package/target/constant/BootPriority.js +11 -11
  63. package/target/constant/CommonConstant.js +18 -18
  64. package/target/constant/ComponentKind.js +11 -11
  65. package/target/constant/DataTypes.js +19 -19
  66. package/target/constant/FastCarMetaData.js +31 -31
  67. package/target/constant/LifeCycleModule.js +9 -9
  68. package/target/db.js +49 -49
  69. package/target/index.js +21 -21
  70. package/target/interface/ApplicationHook.js +2 -2
  71. package/target/interface/ApplicationInterface.js +2 -2
  72. package/target/interface/ApplicationRunnerService.js +2 -2
  73. package/target/interface/DataSourceManager.js +2 -2
  74. package/target/interface/Logger.js +5 -5
  75. package/target/model/BaseMapper.js +98 -98
  76. package/target/model/DataMap.js +87 -87
  77. package/target/model/FormRuleModel.js +2 -2
  78. package/target/model/ValidError.js +5 -5
  79. package/target/model/WinstonLogger.js +96 -96
  80. package/target/type/ComponentDesc.js +2 -2
  81. package/target/type/DesignMeta.js +15 -15
  82. package/target/type/FileHotterDesc.js +2 -2
  83. package/target/type/MapperType.js +2 -2
  84. package/target/type/ProcessType.js +2 -2
  85. package/target/type/SqlError.js +5 -5
  86. package/target/type/WinstonLoggerType.js +9 -9
  87. package/target/utils/ClassLoader.js +65 -65
  88. package/target/utils/ClassUtils.js +35 -35
  89. package/target/utils/CryptoUtil.js +86 -86
  90. package/target/utils/DataFormat.js +88 -88
  91. package/target/utils/DateUtil.js +71 -71
  92. package/target/utils/FileUtil.js +153 -153
  93. package/target/utils/FormatStr.js +14 -14
  94. package/target/utils/IPUtils.js +34 -34
  95. package/target/utils/Id.js +9 -9
  96. package/target/utils/Mix.js +62 -62
  97. package/target/utils/ReflectUtil.js +22 -22
  98. package/target/utils/TypeUtil.js +53 -53
  99. package/target/utils/ValidationUtil.js +123 -124
  100. package/target/utils.js +25 -25
  101. package/test/unit/decorators-test.ts +3 -3
  102. package/target/src/FastCarApplication.js +0 -704
  103. package/target/src/annotation/Application.js +0 -45
  104. package/target/src/annotation/ExceptionMonitor.js +0 -16
  105. package/target/src/annotation/bind/AddRequireModule.js +0 -21
  106. package/target/src/annotation/bind/AliasInjection.js +0 -23
  107. package/target/src/annotation/bind/Autowired.js +0 -13
  108. package/target/src/annotation/bind/CallDependency.js +0 -23
  109. package/target/src/annotation/data/DBType.js +0 -11
  110. package/target/src/annotation/data/DS.js +0 -54
  111. package/target/src/annotation/data/DSIndex.js +0 -9
  112. package/target/src/annotation/data/Entity.js +0 -10
  113. package/target/src/annotation/data/Field.js +0 -18
  114. package/target/src/annotation/data/PrimaryKey.js +0 -9
  115. package/target/src/annotation/data/SqlSession.js +0 -9
  116. package/target/src/annotation/data/Table.js +0 -35
  117. package/target/src/annotation/data/Transactional.js +0 -52
  118. package/target/src/annotation/env/ApplicationSetting.js +0 -25
  119. package/target/src/annotation/env/BaseFilePath.js +0 -14
  120. package/target/src/annotation/env/BaseName.js +0 -9
  121. package/target/src/annotation/env/BasePath.js +0 -14
  122. package/target/src/annotation/env/ENV.js +0 -10
  123. package/target/src/annotation/env/ResourcePath.js +0 -9
  124. package/target/src/annotation/lifeCycle/AddLifeCycleItem.js +0 -18
  125. package/target/src/annotation/lifeCycle/ApplicationDestory.js +0 -15
  126. package/target/src/annotation/lifeCycle/ApplicationInit.js +0 -15
  127. package/target/src/annotation/lifeCycle/ApplicationRunner.js +0 -7
  128. package/target/src/annotation/lifeCycle/ApplicationStart.js +0 -24
  129. package/target/src/annotation/lifeCycle/ApplicationStop.js +0 -20
  130. package/target/src/annotation/property/Deprecate.js +0 -19
  131. package/target/src/annotation/property/NotImplemented.js +0 -8
  132. package/target/src/annotation/property/Override.js +0 -7
  133. package/target/src/annotation/property/Readonly.js +0 -16
  134. package/target/src/annotation/scan/ComponentInjection.js +0 -21
  135. package/target/src/annotation/scan/ComponentScan.js +0 -9
  136. package/target/src/annotation/scan/ComponentScanExclusion.js +0 -25
  137. package/target/src/annotation/scan/ComponentScanMust.js +0 -25
  138. package/target/src/annotation/scan/Hotter.js +0 -8
  139. package/target/src/annotation/stereotype/BeanName.js +0 -11
  140. package/target/src/annotation/stereotype/Component.js +0 -8
  141. package/target/src/annotation/stereotype/Configure.js +0 -14
  142. package/target/src/annotation/stereotype/Controller.js +0 -9
  143. package/target/src/annotation/stereotype/Injection.js +0 -12
  144. package/target/src/annotation/stereotype/Log.js +0 -22
  145. package/target/src/annotation/stereotype/Repository.js +0 -9
  146. package/target/src/annotation/stereotype/Service.js +0 -9
  147. package/target/src/annotation/valid/AddChildValid.js +0 -56
  148. package/target/src/annotation/valid/CustomType.js +0 -11
  149. package/target/src/annotation/valid/DefaultVal.js +0 -10
  150. package/target/src/annotation/valid/NotNull.js +0 -8
  151. package/target/src/annotation/valid/Rule.js +0 -100
  152. package/target/src/annotation/valid/Size.js +0 -10
  153. package/target/src/annotation/valid/Type.js +0 -10
  154. package/target/src/annotation/valid/ValidCustom.js +0 -17
  155. package/target/src/annotation/valid/ValidForm.js +0 -133
  156. package/target/src/annotation.js +0 -108
  157. package/target/src/config/ApplicationConfig.js +0 -2
  158. package/target/src/config/SysConfig.js +0 -19
  159. package/target/src/constant/AppStatusEnum.js +0 -9
  160. package/target/src/constant/BootPriority.js +0 -11
  161. package/target/src/constant/CommonConstant.js +0 -18
  162. package/target/src/constant/ComponentKind.js +0 -11
  163. package/target/src/constant/DataTypes.js +0 -19
  164. package/target/src/constant/FastCarMetaData.js +0 -31
  165. package/target/src/constant/LifeCycleModule.js +0 -9
  166. package/target/src/db.js +0 -49
  167. package/target/src/index.js +0 -21
  168. package/target/src/interface/ApplicationHook.js +0 -2
  169. package/target/src/interface/ApplicationInterface.js +0 -2
  170. package/target/src/interface/ApplicationRunnerService.js +0 -2
  171. package/target/src/interface/DataSourceManager.js +0 -2
  172. package/target/src/interface/Logger.js +0 -5
  173. package/target/src/model/BaseMapper.js +0 -103
  174. package/target/src/model/DataMap.js +0 -87
  175. package/target/src/model/FormRuleModel.js +0 -2
  176. package/target/src/model/ValidError.js +0 -5
  177. package/target/src/model/WinstonLogger.js +0 -97
  178. package/target/src/type/ComponentDesc.js +0 -2
  179. package/target/src/type/DesignMeta.js +0 -15
  180. package/target/src/type/FileHotterDesc.js +0 -2
  181. package/target/src/type/MapperType.js +0 -2
  182. package/target/src/type/ProcessType.js +0 -2
  183. package/target/src/type/SqlError.js +0 -5
  184. package/target/src/type/WinstonLoggerType.js +0 -9
  185. package/target/src/utils/ClassLoader.js +0 -65
  186. package/target/src/utils/ClassUtils.js +0 -35
  187. package/target/src/utils/CryptoUtil.js +0 -86
  188. package/target/src/utils/DataFormat.js +0 -88
  189. package/target/src/utils/DateUtil.js +0 -71
  190. package/target/src/utils/FileUtil.js +0 -153
  191. package/target/src/utils/FormatStr.js +0 -14
  192. package/target/src/utils/IPUtils.js +0 -34
  193. package/target/src/utils/Id.js +0 -9
  194. package/target/src/utils/Mix.js +0 -62
  195. package/target/src/utils/ReflectUtil.js +0 -22
  196. package/target/src/utils/TypeUtil.js +0 -53
  197. package/target/src/utils/ValidationUtil.js +0 -118
  198. package/target/src/utils.js +0 -25
  199. package/target/test/example/simple/app-test.js +0 -57
  200. package/target/test/example/simple/app.js +0 -116
  201. package/target/test/example/simple/component/StartRunner.js +0 -19
  202. package/target/test/example/simple/component/StopRunner.js +0 -23
  203. package/target/test/example/simple/config/EnvConfig.js +0 -16
  204. package/target/test/example/simple/config/HelloConfig.js +0 -16
  205. package/target/test/example/simple/config/HotConfig.js +0 -18
  206. package/target/test/example/simple/controller/AliasController.js +0 -17
  207. package/target/test/example/simple/controller/HelloController.js +0 -55
  208. package/target/test/example/simple/controller/NotFoundController.js +0 -36
  209. package/target/test/example/simple/noclude/excludeApp.js +0 -17
  210. package/target/test/example/simple/service/CallService.js +0 -24
  211. package/target/test/example/simple/service/HelloService.js +0 -18
  212. package/target/test/example/simple/service/LogService.js +0 -32
  213. package/target/test/multi/app.js +0 -29
  214. package/target/test/multi/service/aService.js +0 -33
  215. package/target/test/multi/service/bService.js +0 -35
  216. package/target/test/multi/service/cService.js +0 -40
  217. package/target/test/unit/dataMap-test.js +0 -35
  218. package/target/test/unit/decorators-test.js +0 -59
  219. package/target/test/unit/ds-test.js +0 -58
  220. package/target/test/unit/reflectMetadata-test.js +0 -27
  221. package/target/test/unit/valid-test.js +0 -99
  222. package/target/test/unit/winston-test.js +0 -15
  223. package/test/example/logs/fastcar-server.sys.log +0 -3
  224. package/test/example/logs/other-server.app.log +0 -0
  225. package/test/example/logs/other-server.sys.log +0 -0
  226. package/test/example/logs/other-server.sys1.log +0 -0
  227. package/test/example/logs/other-server.sys2.log +0 -0
  228. package/test/example/logs/other-server.sys3.log +0 -6
  229. package/test/example/logs/other-server.sys4.log +0 -0
  230. package/test/example/logs/other-server.sys5.log +0 -0
  231. package/test/example/logs/other-server.sys6.log +0 -2
  232. package/test/logs/logger.log +0 -0
  233. package/test/logs/sys.log +0 -227
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogDefaultConfig = exports.SYSDefaultConfig = void 0;
4
- exports.SYSDefaultConfig = {
5
- application: {
6
- name: "app",
7
- env: "development",
8
- version: "1.0.0",
9
- },
10
- settings: new Map(), //自定义配置
11
- };
12
- exports.LogDefaultConfig = {
13
- consoleLevel: "info",
14
- fileLevel: "info",
15
- rootPath: __dirname,
16
- maxsize: 1024 * 1024 * 10,
17
- maxFiles: 30,
18
- printConsole: true,
19
- };
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppStatusEnum = void 0;
4
- var AppStatusEnum;
5
- (function (AppStatusEnum) {
6
- AppStatusEnum["READY"] = "ready";
7
- AppStatusEnum["RUN"] = "run";
8
- AppStatusEnum["STOP"] = "stop";
9
- })(AppStatusEnum = exports.AppStatusEnum || (exports.AppStatusEnum = {}));
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BootPriority = void 0;
4
- var BootPriority;
5
- (function (BootPriority) {
6
- BootPriority[BootPriority["Base"] = 0] = "Base";
7
- BootPriority[BootPriority["Sys"] = 1] = "Sys";
8
- BootPriority[BootPriority["Common"] = 2] = "Common";
9
- BootPriority[BootPriority["Other"] = 3] = "Other";
10
- BootPriority[BootPriority["Lowest"] = 10000] = "Lowest";
11
- })(BootPriority = exports.BootPriority || (exports.BootPriority = {}));
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FileResSuffix = exports.CommonConstant = void 0;
4
- exports.CommonConstant = {
5
- Application: "application",
6
- Settings: "settings",
7
- Resource: "resource",
8
- ENV: Symbol("env"),
9
- BasePath: Symbol("basePath"),
10
- BaseFileName: Symbol("baseFileName"),
11
- SYSLOGGER: "sys",
12
- FastcarApp: Symbol("FastcarApp"),
13
- FastcarSetting: Symbol("FastcarSetting"),
14
- ResourcePath: "resourcePath",
15
- APPId: "appid",
16
- BaseName: "basename", //设置基础的文件名称
17
- };
18
- exports.FileResSuffix = ["json", "yml", "js"];
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComponentKind = void 0;
4
- //实例类型
5
- var ComponentKind;
6
- (function (ComponentKind) {
7
- ComponentKind["Controller"] = "Controller";
8
- ComponentKind["Service"] = "Service";
9
- ComponentKind["Component"] = "Component";
10
- ComponentKind["Repository"] = "Repository";
11
- })(ComponentKind = exports.ComponentKind || (exports.ComponentKind = {}));
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataTypes = void 0;
4
- //数据类型枚举
5
- var DataTypes;
6
- (function (DataTypes) {
7
- DataTypes["BOOLEAN"] = "boolean";
8
- DataTypes["NUMBER"] = "number";
9
- DataTypes["STRING"] = "string";
10
- DataTypes["INT"] = "int";
11
- DataTypes["FLOAT"] = "float";
12
- DataTypes["DATE"] = "date";
13
- DataTypes["Object"] = "object";
14
- DataTypes["ARRAYNUMBER"] = "arraynumber";
15
- DataTypes["ARRAYINT"] = "arrayint";
16
- DataTypes["ARRAYFLOAT"] = "arrayfloat";
17
- DataTypes["ARRAYSTRING"] = "arraystring";
18
- DataTypes["ARRAYOBJECT"] = "arrayobject";
19
- })(DataTypes = exports.DataTypes || (exports.DataTypes = {}));
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FastCarMetaData = void 0;
4
- //元数据加载模块
5
- var FastCarMetaData;
6
- (function (FastCarMetaData) {
7
- FastCarMetaData["paramTypes"] = "design:paramtypes";
8
- FastCarMetaData["returnType"] = "design:returntype";
9
- FastCarMetaData["designType"] = "design:type";
10
- FastCarMetaData["InjectionMap"] = "InjectionMap";
11
- FastCarMetaData["IocModule"] = "IocModule";
12
- FastCarMetaData["ComponentScan"] = "ComponentScan";
13
- FastCarMetaData["ComponentScanExclusion"] = "ComponentScanExclusion";
14
- FastCarMetaData["RouterMap"] = "RouterMap";
15
- FastCarMetaData["SpecifyMap"] = "SpecifyMap";
16
- FastCarMetaData["APP"] = "APP";
17
- FastCarMetaData["DS"] = "dynamicDataSource";
18
- FastCarMetaData["DSIndex"] = "dynamicDataSourceIndex";
19
- FastCarMetaData["ValidFormRules"] = "validFormRules";
20
- FastCarMetaData["ValidChildFormRules"] = "validChildFormRules";
21
- FastCarMetaData["ValidSize"] = "valid:size";
22
- FastCarMetaData["NotNull"] = "valid:notNull";
23
- FastCarMetaData["ValidCustom"] = "valid:custom";
24
- FastCarMetaData["Hotter"] = "hotter";
25
- FastCarMetaData["InjectionUniqueKey"] = "injection_uniqueKey";
26
- FastCarMetaData["Alias"] = "alias";
27
- FastCarMetaData["LoggerModule"] = "LoggerModule";
28
- FastCarMetaData["HotterSysConfig"] = "hotterSysConfig";
29
- FastCarMetaData["CustomType"] = "custom:type";
30
- FastCarMetaData["ComponentScanMust"] = "ComponentScanMust";
31
- })(FastCarMetaData = exports.FastCarMetaData || (exports.FastCarMetaData = {}));
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LifeCycleModule = void 0;
4
- var LifeCycleModule;
5
- (function (LifeCycleModule) {
6
- LifeCycleModule["ApplicationStart"] = "applicationStart";
7
- LifeCycleModule["ApplicationStop"] = "applicationStop";
8
- LifeCycleModule["LoadConfigure"] = "loadConfigure";
9
- })(LifeCycleModule = exports.LifeCycleModule || (exports.LifeCycleModule = {}));
package/target/src/db.js DELETED
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DesignMeta = exports.SqlError = exports.BaseMapper = exports.OrderEnum = exports.JoinEnum = exports.OperatorEnum = void 0;
4
- const BaseMapper_1 = require("./model/BaseMapper");
5
- exports.BaseMapper = BaseMapper_1.default;
6
- const SqlError_1 = require("./type/SqlError");
7
- exports.SqlError = SqlError_1.default;
8
- var OperatorEnum;
9
- (function (OperatorEnum) {
10
- OperatorEnum["eq"] = "=";
11
- OperatorEnum["neq"] = "!=";
12
- OperatorEnum["gt"] = ">";
13
- OperatorEnum["gte"] = ">=";
14
- OperatorEnum["lt"] = "<";
15
- OperatorEnum["lte"] = "<=";
16
- OperatorEnum["like"] = "LIKE";
17
- OperatorEnum["in"] = "IN";
18
- OperatorEnum["isNUll"] = "ISNULL";
19
- OperatorEnum["isNotNull"] = "IS NOT NULL";
20
- OperatorEnum["inc"] = "+";
21
- OperatorEnum["dec"] = "-";
22
- OperatorEnum["multiply"] = "*";
23
- OperatorEnum["division"] = "/";
24
- OperatorEnum["notin"] = "NOT IN";
25
- OperatorEnum["custom"] = "CUSTOM";
26
- })(OperatorEnum = exports.OperatorEnum || (exports.OperatorEnum = {}));
27
- var JoinEnum;
28
- (function (JoinEnum) {
29
- JoinEnum["and"] = "AND";
30
- JoinEnum["or"] = "OR";
31
- JoinEnum["not"] = "NOT";
32
- })(JoinEnum = exports.JoinEnum || (exports.JoinEnum = {}));
33
- var OrderEnum;
34
- (function (OrderEnum) {
35
- OrderEnum["asc"] = "ASC";
36
- OrderEnum["desc"] = "DESC";
37
- })(OrderEnum = exports.OrderEnum || (exports.OrderEnum = {}));
38
- var DesignMeta;
39
- (function (DesignMeta) {
40
- DesignMeta["table"] = "db:table";
41
- DesignMeta["field"] = "db:field";
42
- DesignMeta["fieldMap"] = "db:fieldMap";
43
- DesignMeta["dbType"] = "db:dbType";
44
- DesignMeta["primaryKey"] = "db:primaryKey";
45
- DesignMeta["entity"] = "db:entity";
46
- DesignMeta["mapping"] = "db:mapping";
47
- DesignMeta["dbFields"] = "db:fields";
48
- DesignMeta["sqlSession"] = "SqlSession";
49
- })(DesignMeta = exports.DesignMeta || (exports.DesignMeta = {}));
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommonConstant = exports.Logger = exports.DataMap = exports.ValidError = exports.FastCarMetaData = exports.FastCarApplication = exports.BootPriority = exports.ComponentKind = exports.LifeCycleModule = void 0;
4
- const BootPriority_1 = require("./constant/BootPriority");
5
- Object.defineProperty(exports, "BootPriority", { enumerable: true, get: function () { return BootPriority_1.BootPriority; } });
6
- const CommonConstant_1 = require("./constant/CommonConstant");
7
- Object.defineProperty(exports, "CommonConstant", { enumerable: true, get: function () { return CommonConstant_1.CommonConstant; } });
8
- const ComponentKind_1 = require("./constant/ComponentKind");
9
- Object.defineProperty(exports, "ComponentKind", { enumerable: true, get: function () { return ComponentKind_1.ComponentKind; } });
10
- const FastCarMetaData_1 = require("./constant/FastCarMetaData");
11
- Object.defineProperty(exports, "FastCarMetaData", { enumerable: true, get: function () { return FastCarMetaData_1.FastCarMetaData; } });
12
- const LifeCycleModule_1 = require("./constant/LifeCycleModule");
13
- Object.defineProperty(exports, "LifeCycleModule", { enumerable: true, get: function () { return LifeCycleModule_1.LifeCycleModule; } });
14
- const FastCarApplication_1 = require("./FastCarApplication");
15
- exports.FastCarApplication = FastCarApplication_1.default;
16
- const Logger_1 = require("./interface/Logger");
17
- exports.Logger = Logger_1.default;
18
- const DataMap_1 = require("./model/DataMap");
19
- exports.DataMap = DataMap_1.default;
20
- const ValidError_1 = require("./model/ValidError");
21
- exports.ValidError = ValidError_1.default;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class Logger {
4
- }
5
- exports.default = Logger;
@@ -1,103 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const DesignMeta_1 = require("../type/DesignMeta");
4
- const DataFormat_1 = require("../utils/DataFormat");
5
- class BaseMapper {
6
- tableName;
7
- classZ; //映射的原型类
8
- mappingMap; //代码别名-映射关系
9
- mappingList;
10
- dbFields; //数据库别名-代码别名
11
- /***
12
- * @version 1.0 对于类型做一个转换
13
- */
14
- constructor() {
15
- let tClass = Reflect.getMetadata(DesignMeta_1.DesignMeta.entity, this);
16
- this.classZ = tClass;
17
- let tableName = Reflect.getMetadata(DesignMeta_1.DesignMeta.table, tClass);
18
- if (!tableName) {
19
- throw new Error(`This class ${tClass.name} has no annotation table name`);
20
- }
21
- this.tableName = tableName;
22
- this.mappingMap = Reflect.getMetadata(DesignMeta_1.DesignMeta.mapping, tClass); //映射关系
23
- this.dbFields = Reflect.getMetadata(DesignMeta_1.DesignMeta.dbFields, tClass); //作用的列名
24
- this.mappingList = Array.of();
25
- this.mappingMap.forEach(item => {
26
- this.mappingList.push(item);
27
- });
28
- }
29
- //获取数据库别名通过代码内的名称
30
- getFieldName(name) {
31
- let info = this.mappingMap.get(name);
32
- return info ? info.field : name;
33
- }
34
- setRow(rowData) {
35
- let t = new this.classZ();
36
- this.mappingMap.forEach((item, key) => {
37
- let value = Reflect.get(rowData, item.field) || Reflect.get(rowData, key);
38
- if (value != null) {
39
- let fvalue = DataFormat_1.default.formatValue(value, item.type);
40
- Reflect.set(t, key, fvalue);
41
- }
42
- });
43
- return t;
44
- }
45
- setRows(rowDataList) {
46
- let list = Array.of();
47
- rowDataList.forEach(item => {
48
- list.push(this.setRow(item));
49
- });
50
- return list;
51
- }
52
- saveORUpdate(rows, ds, sessionId) {
53
- throw new Error("Method not implemented.");
54
- }
55
- saveOne(row, ds, sessionId) {
56
- throw new Error("Method not implemented.");
57
- }
58
- saveList(rows, ds, sessionId) {
59
- throw new Error("Method not implemented.");
60
- }
61
- update({ row, where, limit }, ds, sessionId) {
62
- throw new Error("Method not implemented.");
63
- }
64
- updateOne(sqlUpdate, ds, sessionId) {
65
- throw new Error("Method not implemented.");
66
- }
67
- updateByPrimaryKey(row, ds, sessionId) {
68
- throw new Error("Method not implemented.");
69
- }
70
- select(conditions, ds, sessionId) {
71
- throw new Error("Method not implemented.");
72
- }
73
- /***
74
- * @version 1.0 查询单个对象
75
- *
76
- */
77
- async selectOne(conditions, ds, sessionId) {
78
- throw new Error("Method not implemented.");
79
- }
80
- /***
81
- * @version 1.0 通过主键查找对象
82
- *
83
- */
84
- async selectByPrimaryKey(row, ds, sessionId) {
85
- throw new Error("Method not implemented.");
86
- }
87
- exist(where, ds, sessionId) {
88
- throw new Error("Method not implemented.");
89
- }
90
- count(where, ds, sessionId) {
91
- throw new Error("Method not implemented.");
92
- }
93
- delete(conditions, ds, sessionId) {
94
- throw new Error("Method not implemented.");
95
- }
96
- deleteOne(where, ds, sessionId) {
97
- throw new Error("Method not implemented.");
98
- }
99
- deleteByPrimaryKey(row, ds, sessionId) {
100
- throw new Error("Method not implemented.");
101
- }
102
- }
103
- exports.default = BaseMapper;
@@ -1,87 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class DataMap extends Map {
4
- constructor() {
5
- super();
6
- }
7
- toValues() {
8
- return [...this.values()];
9
- }
10
- toKeys() {
11
- return [...this.keys()];
12
- }
13
- toObject() {
14
- let o = {};
15
- this.forEach((v, k) => {
16
- Reflect.set(o, k, v);
17
- });
18
- return o;
19
- }
20
- //自定义排序 支持多个排序
21
- sort(sorts, list) {
22
- list = !list ? this.toValues() : list;
23
- if (!sorts || sorts?.length == 0) {
24
- return list;
25
- }
26
- let total = sorts.length;
27
- list.sort((a, b) => {
28
- let resultNum = 0;
29
- sorts.some((f, index) => {
30
- let field = f.field;
31
- let aValue = Reflect.get(a, field);
32
- let bValue = Reflect.get(b, field);
33
- let flag = f.compare ? f.compare(aValue, bValue) : aValue > bValue;
34
- resultNum = flag ? total - index : index - total;
35
- //降序则倒着
36
- if (f.order) {
37
- resultNum = -resultNum;
38
- }
39
- return !!flag;
40
- });
41
- return resultNum;
42
- });
43
- return list;
44
- }
45
- /***
46
- * @version 1.0 查找属性名称
47
- * @params atts代表属性键值对匹配
48
- *
49
- */
50
- findByAtts(atts) {
51
- let list = [];
52
- let keys = Object.keys(atts);
53
- this.forEach((item) => {
54
- let flag = keys.every((key) => {
55
- let v = Reflect.get(atts, key);
56
- //这边判断 是不是一个复合属性
57
- if (Reflect.has(item, key)) {
58
- let itemV = Reflect.get(item, key);
59
- return itemV == v;
60
- }
61
- else {
62
- let keyList = key.split(".");
63
- if (keyList.length > 1) {
64
- let tmpV = item;
65
- let f = keyList.every((tk) => {
66
- if (!Reflect.has(tmpV, tk)) {
67
- return false;
68
- }
69
- tmpV = Reflect.get(tmpV, tk);
70
- return true;
71
- });
72
- if (!f) {
73
- return false;
74
- }
75
- return tmpV == v;
76
- }
77
- }
78
- return false;
79
- });
80
- if (flag) {
81
- list.push(item);
82
- }
83
- });
84
- return list;
85
- }
86
- }
87
- exports.default = DataMap;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class ValidError extends Error {
4
- }
5
- exports.default = ValidError;
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const winston = require("winston");
4
- const WinstonLoggerType_1 = require("../type/WinstonLoggerType");
5
- const path = require("path");
6
- const utils_1 = require("../utils");
7
- const util = require("util");
8
- const SPLAT = Symbol.for("splat");
9
- class WinstonLogger {
10
- config;
11
- categoryMap;
12
- constructor(config) {
13
- this.config = config;
14
- this.categoryMap = new Map();
15
- }
16
- //控制台着色
17
- colorize(str, level) {
18
- let colorStyle = Reflect.get(WinstonLoggerType_1.ColorLevelType, level);
19
- if (!colorStyle) {
20
- return str;
21
- }
22
- return `\x1B[${colorStyle[0]}m ${str} \x1B[${colorStyle[1]}m`;
23
- }
24
- //数据着色为白色
25
- colorizeData(data) {
26
- let msg = utils_1.ValidationUtil.isObject(data) ? JSON.stringify(data) : data;
27
- return `\x1B[37m ${msg} \x1B[39m`;
28
- }
29
- setConfig(config) {
30
- this.config = config;
31
- }
32
- hasLogger(category) {
33
- return winston.loggers.has(category);
34
- }
35
- getLogger(category) {
36
- return this.categoryMap.get(category);
37
- }
38
- addLogger(category) {
39
- if (this.categoryMap.has(category)) {
40
- winston.loggers.close(category);
41
- }
42
- let newLogger = winston.loggers.add(category, {
43
- format: winston.format.combine(winston.format.label({ label: category }), winston.format.printf(info => {
44
- //debug模式等级时仅为控制台输出
45
- let level = info.level.toUpperCase();
46
- let timestamp = utils_1.DateUtil.toDateTimeMS();
47
- let content = {
48
- timestamp,
49
- level,
50
- label: info.label,
51
- message: info.message,
52
- };
53
- if (Reflect.has(info, SPLAT)) {
54
- Reflect.set(content, "splat", JSON.stringify(Reflect.get(info, SPLAT)));
55
- }
56
- if (info.stack) {
57
- Reflect.set(content, "stack", info.stack);
58
- }
59
- Reflect.set(info, "timestamp", content.timestamp);
60
- //新增打印控制台
61
- if (this.config.printConsole) {
62
- let text = this.colorize(util.format("[%s] [%s] %s - ", timestamp, level, info.label), info.level);
63
- text += this.colorizeData(content.message);
64
- if (Reflect.has(info, SPLAT)) {
65
- let splatMsg = Reflect.get(info, SPLAT);
66
- splatMsg.forEach(item => {
67
- text += " " + this.colorizeData(item);
68
- });
69
- }
70
- if (info.stack) {
71
- text += this.colorizeData(`\nstatck: ${info.stack}`);
72
- }
73
- let fn = console.info;
74
- if (Reflect.has(console, info.level)) {
75
- fn = Reflect.get(console, info.level);
76
- }
77
- Reflect.apply(fn, console, [text]);
78
- }
79
- return util.format("%j", content);
80
- })),
81
- transports: [
82
- new winston.transports.File({
83
- level: this.config.fileLevel,
84
- filename: path.join(this.config.rootPath, `${category}.log`),
85
- maxsize: this.config.maxsize,
86
- maxFiles: this.config.maxFiles,
87
- }),
88
- ],
89
- });
90
- this.categoryMap.set(category, newLogger);
91
- return newLogger;
92
- }
93
- getLoggerList() {
94
- return [...this.categoryMap.values()];
95
- }
96
- }
97
- exports.default = WinstonLogger;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DesignMeta = void 0;
4
- var DesignMeta;
5
- (function (DesignMeta) {
6
- DesignMeta["table"] = "db:table";
7
- DesignMeta["field"] = "db:field";
8
- DesignMeta["fieldMap"] = "db:fieldMap";
9
- DesignMeta["dbType"] = "db:dbType";
10
- DesignMeta["primaryKey"] = "db:primaryKey";
11
- DesignMeta["entity"] = "db:entity";
12
- DesignMeta["mapping"] = "db:mapping";
13
- DesignMeta["dbFields"] = "db:fields";
14
- DesignMeta["sqlSession"] = "SqlSession";
15
- })(DesignMeta = exports.DesignMeta || (exports.DesignMeta = {}));
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class SqlError extends Error {
4
- }
5
- exports.default = SqlError;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ColorLevelType = void 0;
4
- exports.ColorLevelType = {
5
- info: [32, 39],
6
- debug: [36, 39],
7
- warn: [33, 39],
8
- error: [91, 39], //red
9
- };
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const TypeUtil_1 = require("./TypeUtil");
4
- const FileUtil_1 = require("./FileUtil");
5
- const fs = require("fs");
6
- const path = require("path");
7
- class ClassLoader {
8
- /***
9
- * @version 1.0 加载模块
10
- * @version 1.1 新增是否强制重载模块
11
- *
12
- */
13
- static loadModule(filePath, force = false) {
14
- //校验后缀名是否为js或者ts
15
- if (!TypeUtil_1.default.isTSORJS(filePath)) {
16
- return null;
17
- }
18
- //避免重复加载或者想要重新进行挂载
19
- if (Reflect.has(require.cache, filePath)) {
20
- if (force) {
21
- Reflect.deleteProperty(require.cache, filePath);
22
- }
23
- }
24
- //可能不止一个方法
25
- const modulesMap = new Map();
26
- //进行方法加载
27
- let moduleClass = require(filePath);
28
- let keys = Object.keys(moduleClass);
29
- let fileName = FileUtil_1.default.getFileName(filePath);
30
- keys.forEach((key) => {
31
- let instance = moduleClass[key];
32
- if (TypeUtil_1.default.isFunction(instance)) {
33
- modulesMap.set(instance.name, instance);
34
- return;
35
- }
36
- if (TypeUtil_1.default.isObject(instance)) {
37
- modulesMap.set(fileName, instance);
38
- }
39
- });
40
- return modulesMap;
41
- }
42
- /**
43
- * @version 1.0 监听某个文件或者文件夹
44
- */
45
- static watchServices(fp, context, eventName = "reload") {
46
- if (typeof context.emit != "function") {
47
- return false;
48
- }
49
- const currStats = fs.statSync(fp);
50
- let fileFlag = currStats.isFile();
51
- //添加热更方法
52
- fs.watch(fp, function (event, filename) {
53
- if (event === "change") {
54
- if (!fileFlag) {
55
- context.emit(eventName, path.join(fp, filename));
56
- }
57
- else {
58
- context.emit(eventName, fp);
59
- }
60
- }
61
- });
62
- return true;
63
- }
64
- }
65
- exports.default = ClassLoader;