@fastcar/core 0.2.64 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +5 -2
  2. package/annotation.d.ts +3 -0
  3. package/index.d.ts +57 -50
  4. package/package.json +4 -4
  5. package/src/FastCarApplication.ts +184 -123
  6. package/src/annotation/Application.ts +3 -1
  7. package/src/annotation/bind/AddInjectionService.ts +17 -0
  8. package/src/annotation/bind/AddRequireModule.ts +1 -1
  9. package/src/annotation/bind/AliasInjection.ts +8 -15
  10. package/src/annotation/bind/Autowired.ts +1 -1
  11. package/src/annotation/bind/CallDependency.ts +7 -17
  12. package/src/annotation/bind/DemandInjection.ts +16 -0
  13. package/src/annotation/stereotype/Log.ts +13 -9
  14. package/src/annotation/stereotype/Value.ts +5 -0
  15. package/src/annotation.ts +2 -0
  16. package/src/constant/FastCarMetaData.ts +2 -0
  17. package/src/model/WinstonLogger.ts +1 -1
  18. package/src/type/ClassConstructor.ts +5 -0
  19. package/src/type/ComponentDesc.ts +13 -0
  20. package/src/type/FileHotterDesc.ts +6 -0
  21. package/src/utils/ClassLoader.ts +2 -1
  22. package/target/FastCarApplication.js +764 -708
  23. package/target/annotation/Application.js +46 -45
  24. package/target/annotation/ExceptionMonitor.js +16 -16
  25. package/target/annotation/bind/AddInjectionService.js +16 -0
  26. package/target/annotation/bind/AddRequireModule.js +21 -21
  27. package/target/annotation/bind/AliasInjection.js +19 -23
  28. package/target/annotation/bind/Autowired.js +13 -13
  29. package/target/annotation/bind/CallDependency.js +16 -23
  30. package/target/annotation/bind/DemandInjection.js +15 -0
  31. package/target/annotation/data/DBType.js +11 -11
  32. package/target/annotation/data/DS.js +54 -54
  33. package/target/annotation/data/DSIndex.js +9 -9
  34. package/target/annotation/data/Entity.js +10 -10
  35. package/target/annotation/data/Field.js +18 -18
  36. package/target/annotation/data/PrimaryKey.js +9 -9
  37. package/target/annotation/data/SqlSession.js +9 -9
  38. package/target/annotation/data/Table.js +35 -35
  39. package/target/annotation/data/Transactional.js +52 -52
  40. package/target/annotation/env/ApplicationSetting.js +25 -25
  41. package/target/annotation/env/BaseFilePath.js +14 -14
  42. package/target/annotation/env/BaseName.js +9 -9
  43. package/target/annotation/env/BasePath.js +14 -14
  44. package/target/annotation/env/ENV.js +10 -10
  45. package/target/annotation/env/ResourcePath.js +9 -9
  46. package/target/annotation/lifeCycle/AddLifeCycleItem.js +17 -18
  47. package/target/annotation/lifeCycle/ApplicationDestory.js +15 -15
  48. package/target/annotation/lifeCycle/ApplicationInit.js +15 -15
  49. package/target/annotation/lifeCycle/ApplicationRunner.js +7 -7
  50. package/target/annotation/lifeCycle/ApplicationStart.js +24 -24
  51. package/target/annotation/lifeCycle/ApplicationStop.js +20 -20
  52. package/target/annotation/property/Deprecate.js +19 -19
  53. package/target/annotation/property/NotImplemented.js +8 -8
  54. package/target/annotation/property/Override.js +7 -7
  55. package/target/annotation/property/Readonly.js +16 -16
  56. package/target/annotation/scan/ComponentInjection.js +21 -21
  57. package/target/annotation/scan/ComponentScan.js +9 -9
  58. package/target/annotation/scan/ComponentScanExclusion.js +25 -25
  59. package/target/annotation/scan/ComponentScanMust.js +25 -25
  60. package/target/annotation/scan/Hotter.js +8 -8
  61. package/target/annotation/stereotype/BeanName.js +11 -11
  62. package/target/annotation/stereotype/Component.js +8 -8
  63. package/target/annotation/stereotype/Configure.js +14 -14
  64. package/target/annotation/stereotype/Controller.js +9 -9
  65. package/target/annotation/stereotype/Injection.js +12 -12
  66. package/target/annotation/stereotype/Log.js +19 -17
  67. package/target/annotation/stereotype/Repository.js +9 -9
  68. package/target/annotation/stereotype/Service.js +9 -9
  69. package/target/annotation/stereotype/Value.js +5 -0
  70. package/target/annotation/valid/AddChildValid.js +56 -56
  71. package/target/annotation/valid/CustomType.js +11 -11
  72. package/target/annotation/valid/DefaultVal.js +10 -10
  73. package/target/annotation/valid/NotNull.js +8 -8
  74. package/target/annotation/valid/Rule.js +99 -100
  75. package/target/annotation/valid/Size.js +10 -10
  76. package/target/annotation/valid/Type.js +10 -10
  77. package/target/annotation/valid/ValidCustom.js +17 -17
  78. package/target/annotation/valid/ValidForm.js +133 -133
  79. package/target/annotation.js +110 -108
  80. package/target/config/ApplicationConfig.js +2 -2
  81. package/target/config/SysConfig.js +19 -19
  82. package/target/constant/AppStatusEnum.js +9 -9
  83. package/target/constant/BootPriority.js +11 -11
  84. package/target/constant/CommonConstant.js +18 -18
  85. package/target/constant/ComponentKind.js +11 -11
  86. package/target/constant/DataTypes.js +19 -19
  87. package/target/constant/FastCarMetaData.js +33 -31
  88. package/target/constant/LifeCycleModule.js +9 -9
  89. package/target/db.js +49 -49
  90. package/target/index.js +21 -21
  91. package/target/interface/ApplicationHook.js +2 -2
  92. package/target/interface/ApplicationInterface.js +2 -2
  93. package/target/interface/ApplicationRunnerService.js +2 -2
  94. package/target/interface/DataSourceManager.js +2 -2
  95. package/target/interface/Logger.js +5 -5
  96. package/target/model/BaseMapper.js +103 -98
  97. package/target/model/DataMap.js +87 -87
  98. package/target/model/FormRuleModel.js +2 -2
  99. package/target/model/ValidError.js +5 -5
  100. package/target/model/WinstonLogger.js +98 -96
  101. package/target/type/ClassConstructor.js +2 -0
  102. package/target/type/ComponentDesc.js +9 -2
  103. package/target/type/DesignMeta.js +15 -15
  104. package/target/type/FileHotterDesc.js +9 -2
  105. package/target/type/MapperType.js +2 -2
  106. package/target/type/ProcessType.js +2 -2
  107. package/target/type/SqlError.js +5 -5
  108. package/target/type/WinstonLoggerType.js +9 -9
  109. package/target/utils/ClassLoader.js +66 -65
  110. package/target/utils/ClassUtils.js +35 -35
  111. package/target/utils/CryptoUtil.js +86 -86
  112. package/target/utils/DataFormat.js +88 -88
  113. package/target/utils/DateUtil.js +71 -71
  114. package/target/utils/FileUtil.js +153 -153
  115. package/target/utils/FormatStr.js +14 -14
  116. package/target/utils/IPUtils.js +34 -34
  117. package/target/utils/Id.js +8 -9
  118. package/target/utils/Mix.js +62 -62
  119. package/target/utils/ReflectUtil.js +22 -22
  120. package/target/utils/TypeUtil.js +53 -53
  121. package/target/utils/ValidationUtil.js +123 -123
  122. package/target/utils.js +25 -25
  123. package/test/example/logs/fastcar-server.app.log +0 -0
  124. package/test/example/logs/fastcar-server.sys.log +10 -0
  125. package/test/example/logs/fastcar-server.sys1.log +8 -0
  126. package/test/example/logs/fastcar-server.sys2.log +11 -0
  127. package/test/example/logs/fastcar-server.sys3.log +0 -0
  128. package/test/example/logs/other-server.app.log +0 -0
  129. package/test/example/logs/other-server.sys.log +5 -0
  130. package/test/example/logs/sys.log +0 -0
  131. package/test/example/logs/sys1.log +0 -0
  132. package/test/example/resource/application.yml +2 -0
  133. package/test/example/resource/hello.yml +1 -1
  134. package/test/example/simple/app-test.ts +2 -1
  135. package/test/example/simple/app.ts +16 -16
  136. package/test/example/simple/service/CallService.ts +2 -0
  137. package/test/example/simple/service/HelloService.ts +2 -0
  138. package/test/unit/sys2.log +6 -0
  139. package/test/unit/sys3.log +6 -0
  140. package/test/unit/sys4.log +6 -0
  141. package/test/unit/sys5.log +6 -0
  142. package/test/unit/sys6.log +6 -0
@@ -0,0 +1,5 @@
1
+ export interface ClassConstructor<Object> {
2
+ new (): Object;
3
+
4
+ new (...args: any[]): Object;
5
+ }
@@ -2,4 +2,17 @@ export type ComponentDesc = {
2
2
  id: string;
3
3
  name: string;
4
4
  path: string;
5
+ classZ: Function | Object;
6
+ };
7
+
8
+ //注入的类型
9
+ export enum InjectionType {
10
+ PROPERTYKEY = "PROPERTYKEY",
11
+ ALIAS = "ALIAS",
12
+ }
13
+
14
+ export type InjectionMeta = {
15
+ key: string;
16
+ kind: InjectionType;
17
+ alias?: string;
5
18
  };
@@ -2,3 +2,9 @@ export type FileHotterDesc = {
2
2
  name: string;
3
3
  key: string | symbol;
4
4
  };
5
+
6
+ export enum HotReloadEnum {
7
+ reload = "reload",
8
+ sysReload = "sysReload",
9
+ configReload = "configReload",
10
+ }
@@ -2,6 +2,7 @@ import TypeUtil from "./TypeUtil";
2
2
  import FileUtil from "./FileUtil";
3
3
  import * as fs from "fs";
4
4
  import * as path from "path";
5
+ import { HotReloadEnum } from "../type/FileHotterDesc";
5
6
 
6
7
  export default class ClassLoader {
7
8
  /***
@@ -48,7 +49,7 @@ export default class ClassLoader {
48
49
  /**
49
50
  * @version 1.0 监听某个文件或者文件夹
50
51
  */
51
- static watchServices(fp: string, context: any, eventName: string = "reload"): boolean {
52
+ static watchServices(fp: string, context: any, eventName: HotReloadEnum = HotReloadEnum.reload): boolean {
52
53
  if (typeof context.emit != "function") {
53
54
  return false;
54
55
  }