@fastcar/core 0.2.62 → 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/target/FastCarApplication.js +708 -692
  4. package/target/annotation/Application.js +45 -45
  5. package/target/annotation/ExceptionMonitor.js +16 -16
  6. package/target/annotation/bind/AddRequireModule.js +21 -21
  7. package/target/annotation/bind/AliasInjection.js +23 -23
  8. package/target/annotation/bind/Autowired.js +13 -13
  9. package/target/annotation/bind/CallDependency.js +23 -23
  10. package/target/annotation/data/DBType.js +11 -11
  11. package/target/annotation/data/DS.js +54 -54
  12. package/target/annotation/data/DSIndex.js +9 -9
  13. package/target/annotation/data/Entity.js +10 -10
  14. package/target/annotation/data/Field.js +18 -18
  15. package/target/annotation/data/PrimaryKey.js +9 -9
  16. package/target/annotation/data/SqlSession.js +9 -9
  17. package/target/annotation/data/Table.js +35 -35
  18. package/target/annotation/data/Transactional.js +52 -52
  19. package/target/annotation/env/ApplicationSetting.js +25 -25
  20. package/target/annotation/env/BaseFilePath.js +14 -14
  21. package/target/annotation/env/BaseName.js +9 -9
  22. package/target/annotation/env/BasePath.js +14 -14
  23. package/target/annotation/env/ENV.js +10 -10
  24. package/target/annotation/env/ResourcePath.js +9 -9
  25. package/target/annotation/lifeCycle/AddLifeCycleItem.js +18 -18
  26. package/target/annotation/lifeCycle/ApplicationDestory.js +15 -15
  27. package/target/annotation/lifeCycle/ApplicationInit.js +15 -15
  28. package/target/annotation/lifeCycle/ApplicationRunner.js +7 -7
  29. package/target/annotation/lifeCycle/ApplicationStart.js +24 -24
  30. package/target/annotation/lifeCycle/ApplicationStop.js +20 -20
  31. package/target/annotation/property/Deprecate.js +19 -19
  32. package/target/annotation/property/NotImplemented.js +8 -8
  33. package/target/annotation/property/Override.js +7 -7
  34. package/target/annotation/property/Readonly.js +16 -16
  35. package/target/annotation/scan/ComponentInjection.js +21 -21
  36. package/target/annotation/scan/ComponentScan.js +9 -9
  37. package/target/annotation/scan/ComponentScanExclusion.js +25 -25
  38. package/target/annotation/scan/ComponentScanMust.js +25 -25
  39. package/target/annotation/scan/Hotter.js +8 -8
  40. package/target/annotation/stereotype/BeanName.js +11 -11
  41. package/target/annotation/stereotype/Component.js +8 -8
  42. package/target/annotation/stereotype/Configure.js +14 -14
  43. package/target/annotation/stereotype/Controller.js +9 -9
  44. package/target/annotation/stereotype/Injection.js +12 -12
  45. package/target/annotation/stereotype/Log.js +17 -17
  46. package/target/annotation/stereotype/Repository.js +9 -9
  47. package/target/annotation/stereotype/Service.js +9 -9
  48. package/target/annotation/valid/AddChildValid.js +56 -56
  49. package/target/annotation/valid/CustomType.js +11 -11
  50. package/target/annotation/valid/DefaultVal.js +10 -10
  51. package/target/annotation/valid/NotNull.js +8 -8
  52. package/target/annotation/valid/Rule.js +100 -100
  53. package/target/annotation/valid/Size.js +10 -10
  54. package/target/annotation/valid/Type.js +10 -10
  55. package/target/annotation/valid/ValidCustom.js +17 -17
  56. package/target/annotation/valid/ValidForm.js +133 -133
  57. package/target/annotation.js +108 -108
  58. package/target/config/ApplicationConfig.js +2 -2
  59. package/target/config/SysConfig.js +19 -19
  60. package/target/constant/AppStatusEnum.js +9 -9
  61. package/target/constant/BootPriority.js +11 -11
  62. package/target/constant/CommonConstant.js +18 -18
  63. package/target/constant/ComponentKind.js +11 -11
  64. package/target/constant/DataTypes.js +19 -19
  65. package/target/constant/FastCarMetaData.js +31 -31
  66. package/target/constant/LifeCycleModule.js +9 -9
  67. package/target/db.js +49 -49
  68. package/target/index.js +21 -21
  69. package/target/interface/ApplicationHook.js +2 -2
  70. package/target/interface/ApplicationInterface.js +2 -2
  71. package/target/interface/ApplicationRunnerService.js +2 -2
  72. package/target/interface/DataSourceManager.js +2 -2
  73. package/target/interface/Logger.js +5 -5
  74. package/target/model/BaseMapper.js +98 -98
  75. package/target/model/DataMap.js +87 -87
  76. package/target/model/FormRuleModel.js +2 -2
  77. package/target/model/ValidError.js +5 -5
  78. package/target/model/WinstonLogger.js +96 -96
  79. package/target/type/ComponentDesc.js +2 -2
  80. package/target/type/DesignMeta.js +15 -15
  81. package/target/type/FileHotterDesc.js +2 -2
  82. package/target/type/MapperType.js +2 -2
  83. package/target/type/ProcessType.js +2 -2
  84. package/target/type/SqlError.js +5 -5
  85. package/target/type/WinstonLoggerType.js +9 -9
  86. package/target/utils/ClassLoader.js +65 -65
  87. package/target/utils/ClassUtils.js +35 -35
  88. package/target/utils/CryptoUtil.js +86 -86
  89. package/target/utils/DataFormat.js +88 -88
  90. package/target/utils/DateUtil.js +71 -71
  91. package/target/utils/FileUtil.js +153 -153
  92. package/target/utils/FormatStr.js +14 -14
  93. package/target/utils/IPUtils.js +34 -34
  94. package/target/utils/Id.js +9 -9
  95. package/target/utils/Mix.js +62 -62
  96. package/target/utils/ReflectUtil.js +22 -22
  97. package/target/utils/TypeUtil.js +53 -53
  98. package/target/utils/ValidationUtil.js +123 -123
  99. package/target/utils.js +25 -25
  100. package/test/unit/decorators-test.ts +3 -3
  101. package/test/unit/valid-test.ts +49 -54
  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,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ComponentInjection_1 = require("./ComponentInjection");
4
- function ComponentScan(...names) {
5
- return function (target) {
6
- (0, ComponentInjection_1.default)(target, ...names);
7
- };
8
- }
9
- exports.default = ComponentScan;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ComponentInjection_1 = require("./ComponentInjection");
4
+ function ComponentScan(...names) {
5
+ return function (target) {
6
+ (0, ComponentInjection_1.default)(target, ...names);
7
+ };
8
+ }
9
+ exports.default = ComponentScan;
@@ -1,25 +1,25 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("reflect-metadata");
4
- const path = require("path");
5
- const fs = require("fs");
6
- const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
7
- //和本包的相对路径
8
- function ComponentScanExclusion(...names) {
9
- return function (target) {
10
- let ScanPathList = FastCarMetaData_1.FastCarMetaData.ComponentScanExclusion;
11
- let list = Reflect.get(target.prototype, ScanPathList) || [];
12
- for (let name of names) {
13
- //可支持绝对路径
14
- let p = path.join(require.main?.path || process.cwd() || "", name);
15
- if (fs.existsSync(name)) {
16
- p = name;
17
- }
18
- if (!list.includes(p)) {
19
- list.push(p);
20
- }
21
- }
22
- Reflect.set(target.prototype, ScanPathList, list);
23
- };
24
- }
25
- exports.default = ComponentScanExclusion;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("reflect-metadata");
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
7
+ //和本包的相对路径
8
+ function ComponentScanExclusion(...names) {
9
+ return function (target) {
10
+ let ScanPathList = FastCarMetaData_1.FastCarMetaData.ComponentScanExclusion;
11
+ let list = Reflect.get(target.prototype, ScanPathList) || [];
12
+ for (let name of names) {
13
+ //可支持绝对路径
14
+ let p = path.join(require.main?.path || process.cwd() || "", name);
15
+ if (fs.existsSync(name)) {
16
+ p = name;
17
+ }
18
+ if (!list.includes(p)) {
19
+ list.push(p);
20
+ }
21
+ }
22
+ Reflect.set(target.prototype, ScanPathList, list);
23
+ };
24
+ }
25
+ exports.default = ComponentScanExclusion;
@@ -1,25 +1,25 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("reflect-metadata");
4
- const path = require("path");
5
- const fs = require("fs");
6
- const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
7
- //和本包的相对路径
8
- function ComponentScanMust(...names) {
9
- return function (target) {
10
- let scanMust = FastCarMetaData_1.FastCarMetaData.ComponentScanMust;
11
- let list = Reflect.get(target.prototype, scanMust) || [];
12
- for (let name of names) {
13
- //可支持绝对路径
14
- let p = path.join(require.main?.path || process.cwd() || "", name);
15
- if (fs.existsSync(name)) {
16
- p = name;
17
- }
18
- if (!list.includes(p)) {
19
- list.push(p);
20
- }
21
- }
22
- Reflect.set(target.prototype, scanMust, list);
23
- };
24
- }
25
- exports.default = ComponentScanMust;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("reflect-metadata");
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
7
+ //和本包的相对路径
8
+ function ComponentScanMust(...names) {
9
+ return function (target) {
10
+ let scanMust = FastCarMetaData_1.FastCarMetaData.ComponentScanMust;
11
+ let list = Reflect.get(target.prototype, scanMust) || [];
12
+ for (let name of names) {
13
+ //可支持绝对路径
14
+ let p = path.join(require.main?.path || process.cwd() || "", name);
15
+ if (fs.existsSync(name)) {
16
+ p = name;
17
+ }
18
+ if (!list.includes(p)) {
19
+ list.push(p);
20
+ }
21
+ }
22
+ Reflect.set(target.prototype, scanMust, list);
23
+ };
24
+ }
25
+ exports.default = ComponentScanMust;
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("reflect-metadata");
4
- const __1 = require("../..");
5
- function Hotter(target) {
6
- Reflect.defineMetadata(__1.FastCarMetaData.Hotter, true, target.prototype);
7
- }
8
- exports.default = Hotter;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("reflect-metadata");
4
+ const __1 = require("../..");
5
+ function Hotter(target) {
6
+ Reflect.defineMetadata(__1.FastCarMetaData.Hotter, true, target.prototype);
7
+ }
8
+ exports.default = Hotter;
@@ -1,11 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
4
- //应用别名声明
5
- function BeanName(name) {
6
- return function (target) {
7
- //生成别名 用于逻辑识别
8
- Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.Alias, name, target.prototype); //放入至原型中
9
- };
10
- }
11
- exports.default = BeanName;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
4
+ //应用别名声明
5
+ function BeanName(name) {
6
+ return function (target) {
7
+ //生成别名 用于逻辑识别
8
+ Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.Alias, name, target.prototype); //放入至原型中
9
+ };
10
+ }
11
+ exports.default = BeanName;
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ComponentKind_1 = require("../../constant/ComponentKind");
4
- const Injection_1 = require("./Injection");
5
- function Component(target) {
6
- (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Component);
7
- }
8
- exports.default = Component;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ComponentKind_1 = require("../../constant/ComponentKind");
4
+ const Injection_1 = require("./Injection");
5
+ function Component(target) {
6
+ (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Component);
7
+ }
8
+ exports.default = Component;
@@ -1,14 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const Component_1 = require("./Component");
4
- const LifeCycleModule_1 = require("../../constant/LifeCycleModule");
5
- //配置文件层
6
- function Configure(name) {
7
- return function (target) {
8
- //配置对象也为组件
9
- (0, Component_1.default)(target);
10
- //当实例化时 加载默认配置并进行赋值
11
- Reflect.defineMetadata(LifeCycleModule_1.LifeCycleModule.LoadConfigure, name, target);
12
- };
13
- }
14
- exports.default = Configure;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Component_1 = require("./Component");
4
+ const LifeCycleModule_1 = require("../../constant/LifeCycleModule");
5
+ //配置文件层
6
+ function Configure(name) {
7
+ return function (target) {
8
+ //配置对象也为组件
9
+ (0, Component_1.default)(target);
10
+ //当实例化时 加载默认配置并进行赋值
11
+ Reflect.defineMetadata(LifeCycleModule_1.LifeCycleModule.LoadConfigure, name, target);
12
+ };
13
+ }
14
+ exports.default = Configure;
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ComponentKind_1 = require("../../constant/ComponentKind");
4
- const Injection_1 = require("./Injection");
5
- //业务逻辑层
6
- function Controller(target) {
7
- (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Controller);
8
- }
9
- exports.default = Controller;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ComponentKind_1 = require("../../constant/ComponentKind");
4
+ const Injection_1 = require("./Injection");
5
+ //业务逻辑层
6
+ function Controller(target) {
7
+ (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Controller);
8
+ }
9
+ exports.default = Controller;
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("reflect-metadata");
4
- const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
5
- const Id_1 = require("../../utils/Id");
6
- function Injection(target, name) {
7
- //生成别名 避免名称重复的情况
8
- let key = `${name}:${(0, Id_1.id)()}`;
9
- Reflect.defineMetadata(name, true, target.prototype);
10
- Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.InjectionUniqueKey, key, target); //放入至原型中
11
- }
12
- exports.default = Injection;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("reflect-metadata");
4
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
5
+ const Id_1 = require("../../utils/Id");
6
+ function Injection(target, name) {
7
+ //生成别名 避免名称重复的情况
8
+ let key = `${name}:${(0, Id_1.id)()}`;
9
+ Reflect.defineMetadata(name, true, target.prototype);
10
+ Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.InjectionUniqueKey, key, target); //放入至原型中
11
+ }
12
+ exports.default = Injection;
@@ -1,17 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const CommonConstant_1 = require("../../constant/CommonConstant");
4
- //日志实例
5
- function Log(category) {
6
- return function (target, propertyKey) {
7
- let m = category || propertyKey;
8
- Reflect.defineProperty(target, propertyKey, {
9
- get: () => {
10
- let app = Reflect.get(global, CommonConstant_1.CommonConstant.FastcarApp);
11
- let appid = app?.getSetting(CommonConstant_1.CommonConstant.APPId) || ""; //进行差异化区分
12
- return app ? app.getLogger(appid ? `${appid}.${m}` : m) : console;
13
- },
14
- });
15
- };
16
- }
17
- exports.default = Log;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const CommonConstant_1 = require("../../constant/CommonConstant");
4
+ //日志实例
5
+ function Log(category) {
6
+ return function (target, propertyKey) {
7
+ let m = category || propertyKey;
8
+ Reflect.defineProperty(target, propertyKey, {
9
+ get: () => {
10
+ let app = Reflect.get(global, CommonConstant_1.CommonConstant.FastcarApp);
11
+ let appid = app?.getSetting(CommonConstant_1.CommonConstant.APPId) || ""; //进行差异化区分
12
+ return app ? app.getLogger(appid ? `${appid}.${m}` : m) : console;
13
+ },
14
+ });
15
+ };
16
+ }
17
+ exports.default = Log;
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ComponentKind_1 = require("../../constant/ComponentKind");
4
- const Injection_1 = require("./Injection");
5
- //数据逻辑层(表明和数据库相关)
6
- function Repository(target) {
7
- (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Repository);
8
- }
9
- exports.default = Repository;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ComponentKind_1 = require("../../constant/ComponentKind");
4
+ const Injection_1 = require("./Injection");
5
+ //数据逻辑层(表明和数据库相关)
6
+ function Repository(target) {
7
+ (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Repository);
8
+ }
9
+ exports.default = Repository;
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ComponentKind_1 = require("../../constant/ComponentKind");
4
- const Injection_1 = require("./Injection");
5
- //中间服务层
6
- function Service(target) {
7
- (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Service);
8
- }
9
- exports.default = Service;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ComponentKind_1 = require("../../constant/ComponentKind");
4
+ const Injection_1 = require("./Injection");
5
+ //中间服务层
6
+ function Service(target) {
7
+ (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Service);
8
+ }
9
+ exports.default = Service;
@@ -1,56 +1,56 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("reflect-metadata");
4
- const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
5
- const TypeUtil_1 = require("../../utils/TypeUtil");
6
- const ValidationUtil_1 = require("../../utils/ValidationUtil");
7
- //添加子元素的校验规则
8
- function AddChildValid(target, name, value, index) {
9
- let childMap;
10
- let paramsFlag = ValidationUtil_1.default.isNumber(index);
11
- let alias = paramsFlag ? `${name}-${index}` : name;
12
- if (paramsFlag) {
13
- childMap = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, target, alias);
14
- if (!childMap) {
15
- childMap = new Map();
16
- Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, childMap, target, alias);
17
- }
18
- }
19
- else {
20
- childMap = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, target);
21
- if (!childMap) {
22
- childMap = new Map();
23
- Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, childMap, target);
24
- }
25
- }
26
- let item = childMap.get(alias);
27
- if (!item) {
28
- let proto = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.designType, target, name);
29
- if (paramsFlag) {
30
- //修改为方法获取原型
31
- let paramsTypes = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.paramTypes, target, name);
32
- if (typeof index == "number") {
33
- proto = paramsTypes[index];
34
- }
35
- }
36
- let typeName = proto.name.toLowerCase();
37
- if (!TypeUtil_1.default.isBasic(typeName)) {
38
- typeName = typeName == "array" ? "array" : "object";
39
- }
40
- item = {
41
- type: typeName,
42
- };
43
- }
44
- //自定义方法合并
45
- if (Reflect.has(value, "filters")) {
46
- if (Array.isArray(item.filters)) {
47
- item.filters.forEach((f) => {
48
- value.filters.push(f);
49
- });
50
- }
51
- }
52
- //合并所有属性
53
- Object.assign(item, value);
54
- childMap.set(alias, item);
55
- }
56
- exports.default = AddChildValid;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("reflect-metadata");
4
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
5
+ const TypeUtil_1 = require("../../utils/TypeUtil");
6
+ const ValidationUtil_1 = require("../../utils/ValidationUtil");
7
+ //添加子元素的校验规则
8
+ function AddChildValid(target, name, value, index) {
9
+ let childMap;
10
+ let paramsFlag = ValidationUtil_1.default.isNumber(index);
11
+ let alias = paramsFlag ? `${name}-${index}` : name;
12
+ if (paramsFlag) {
13
+ childMap = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, target, alias);
14
+ if (!childMap) {
15
+ childMap = new Map();
16
+ Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, childMap, target, alias);
17
+ }
18
+ }
19
+ else {
20
+ childMap = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, target);
21
+ if (!childMap) {
22
+ childMap = new Map();
23
+ Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, childMap, target);
24
+ }
25
+ }
26
+ let item = childMap.get(alias);
27
+ if (!item) {
28
+ let proto = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.designType, target, name);
29
+ if (paramsFlag) {
30
+ //修改为方法获取原型
31
+ let paramsTypes = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.paramTypes, target, name);
32
+ if (typeof index == "number") {
33
+ proto = paramsTypes[index];
34
+ }
35
+ }
36
+ let typeName = proto.name.toLowerCase();
37
+ if (!TypeUtil_1.default.isBasic(typeName)) {
38
+ typeName = typeName == "array" ? "array" : "object";
39
+ }
40
+ item = {
41
+ type: typeName,
42
+ };
43
+ }
44
+ //自定义方法合并
45
+ if (Reflect.has(value, "filters")) {
46
+ if (Array.isArray(item.filters)) {
47
+ item.filters.forEach((f) => {
48
+ value.filters.push(f);
49
+ });
50
+ }
51
+ }
52
+ //合并所有属性
53
+ Object.assign(item, value);
54
+ childMap.set(alias, item);
55
+ }
56
+ exports.default = AddChildValid;
@@ -1,11 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("reflect-metadata");
4
- const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
5
- //自定义类型
6
- function CustomType(name) {
7
- return function (target, propertyKey) {
8
- Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.CustomType, name, target, propertyKey);
9
- };
10
- }
11
- exports.default = CustomType;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("reflect-metadata");
4
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
5
+ //自定义类型
6
+ function CustomType(name) {
7
+ return function (target, propertyKey) {
8
+ Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.CustomType, name, target, propertyKey);
9
+ };
10
+ }
11
+ exports.default = CustomType;
@@ -1,10 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const AddChildValid_1 = require("./AddChildValid");
4
- //默认值获取
5
- function DefaultVal(val) {
6
- return function (target, propertyKey, index) {
7
- (0, AddChildValid_1.default)(target, propertyKey, { defaultVal: val }, index);
8
- };
9
- }
10
- exports.default = DefaultVal;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const AddChildValid_1 = require("./AddChildValid");
4
+ //默认值获取
5
+ function DefaultVal(val) {
6
+ return function (target, propertyKey, index) {
7
+ (0, AddChildValid_1.default)(target, propertyKey, { defaultVal: val }, index);
8
+ };
9
+ }
10
+ exports.default = DefaultVal;
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const AddChildValid_1 = require("./AddChildValid");
4
- //是否为非空字段
5
- function NotNull(target, propertyKey, index) {
6
- (0, AddChildValid_1.default)(target, propertyKey, { required: true }, index);
7
- }
8
- exports.default = NotNull;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const AddChildValid_1 = require("./AddChildValid");
4
+ //是否为非空字段
5
+ function NotNull(target, propertyKey, index) {
6
+ (0, AddChildValid_1.default)(target, propertyKey, { required: true }, index);
7
+ }
8
+ exports.default = NotNull;