@fastcar/core 0.2.63 → 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 (143) 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/src/utils/ValidationUtil.ts +1 -1
  23. package/target/FastCarApplication.js +764 -708
  24. package/target/annotation/Application.js +46 -45
  25. package/target/annotation/ExceptionMonitor.js +16 -16
  26. package/target/annotation/bind/AddInjectionService.js +16 -0
  27. package/target/annotation/bind/AddRequireModule.js +21 -21
  28. package/target/annotation/bind/AliasInjection.js +19 -23
  29. package/target/annotation/bind/Autowired.js +13 -13
  30. package/target/annotation/bind/CallDependency.js +16 -23
  31. package/target/annotation/bind/DemandInjection.js +15 -0
  32. package/target/annotation/data/DBType.js +11 -11
  33. package/target/annotation/data/DS.js +54 -54
  34. package/target/annotation/data/DSIndex.js +9 -9
  35. package/target/annotation/data/Entity.js +10 -10
  36. package/target/annotation/data/Field.js +18 -18
  37. package/target/annotation/data/PrimaryKey.js +9 -9
  38. package/target/annotation/data/SqlSession.js +9 -9
  39. package/target/annotation/data/Table.js +35 -35
  40. package/target/annotation/data/Transactional.js +52 -52
  41. package/target/annotation/env/ApplicationSetting.js +25 -25
  42. package/target/annotation/env/BaseFilePath.js +14 -14
  43. package/target/annotation/env/BaseName.js +9 -9
  44. package/target/annotation/env/BasePath.js +14 -14
  45. package/target/annotation/env/ENV.js +10 -10
  46. package/target/annotation/env/ResourcePath.js +9 -9
  47. package/target/annotation/lifeCycle/AddLifeCycleItem.js +17 -18
  48. package/target/annotation/lifeCycle/ApplicationDestory.js +15 -15
  49. package/target/annotation/lifeCycle/ApplicationInit.js +15 -15
  50. package/target/annotation/lifeCycle/ApplicationRunner.js +7 -7
  51. package/target/annotation/lifeCycle/ApplicationStart.js +24 -24
  52. package/target/annotation/lifeCycle/ApplicationStop.js +20 -20
  53. package/target/annotation/property/Deprecate.js +19 -19
  54. package/target/annotation/property/NotImplemented.js +8 -8
  55. package/target/annotation/property/Override.js +7 -7
  56. package/target/annotation/property/Readonly.js +16 -16
  57. package/target/annotation/scan/ComponentInjection.js +21 -21
  58. package/target/annotation/scan/ComponentScan.js +9 -9
  59. package/target/annotation/scan/ComponentScanExclusion.js +25 -25
  60. package/target/annotation/scan/ComponentScanMust.js +25 -25
  61. package/target/annotation/scan/Hotter.js +8 -8
  62. package/target/annotation/stereotype/BeanName.js +11 -11
  63. package/target/annotation/stereotype/Component.js +8 -8
  64. package/target/annotation/stereotype/Configure.js +14 -14
  65. package/target/annotation/stereotype/Controller.js +9 -9
  66. package/target/annotation/stereotype/Injection.js +12 -12
  67. package/target/annotation/stereotype/Log.js +19 -17
  68. package/target/annotation/stereotype/Repository.js +9 -9
  69. package/target/annotation/stereotype/Service.js +9 -9
  70. package/target/annotation/stereotype/Value.js +5 -0
  71. package/target/annotation/valid/AddChildValid.js +56 -56
  72. package/target/annotation/valid/CustomType.js +11 -11
  73. package/target/annotation/valid/DefaultVal.js +10 -10
  74. package/target/annotation/valid/NotNull.js +8 -8
  75. package/target/annotation/valid/Rule.js +99 -100
  76. package/target/annotation/valid/Size.js +10 -10
  77. package/target/annotation/valid/Type.js +10 -10
  78. package/target/annotation/valid/ValidCustom.js +17 -17
  79. package/target/annotation/valid/ValidForm.js +133 -133
  80. package/target/annotation.js +110 -108
  81. package/target/config/ApplicationConfig.js +2 -2
  82. package/target/config/SysConfig.js +19 -19
  83. package/target/constant/AppStatusEnum.js +9 -9
  84. package/target/constant/BootPriority.js +11 -11
  85. package/target/constant/CommonConstant.js +18 -18
  86. package/target/constant/ComponentKind.js +11 -11
  87. package/target/constant/DataTypes.js +19 -19
  88. package/target/constant/FastCarMetaData.js +33 -31
  89. package/target/constant/LifeCycleModule.js +9 -9
  90. package/target/db.js +49 -49
  91. package/target/index.js +21 -21
  92. package/target/interface/ApplicationHook.js +2 -2
  93. package/target/interface/ApplicationInterface.js +2 -2
  94. package/target/interface/ApplicationRunnerService.js +2 -2
  95. package/target/interface/DataSourceManager.js +2 -2
  96. package/target/interface/Logger.js +5 -5
  97. package/target/model/BaseMapper.js +103 -98
  98. package/target/model/DataMap.js +87 -87
  99. package/target/model/FormRuleModel.js +2 -2
  100. package/target/model/ValidError.js +5 -5
  101. package/target/model/WinstonLogger.js +98 -96
  102. package/target/type/ClassConstructor.js +2 -0
  103. package/target/type/ComponentDesc.js +9 -2
  104. package/target/type/DesignMeta.js +15 -15
  105. package/target/type/FileHotterDesc.js +9 -2
  106. package/target/type/MapperType.js +2 -2
  107. package/target/type/ProcessType.js +2 -2
  108. package/target/type/SqlError.js +5 -5
  109. package/target/type/WinstonLoggerType.js +9 -9
  110. package/target/utils/ClassLoader.js +66 -65
  111. package/target/utils/ClassUtils.js +35 -35
  112. package/target/utils/CryptoUtil.js +86 -86
  113. package/target/utils/DataFormat.js +88 -88
  114. package/target/utils/DateUtil.js +71 -71
  115. package/target/utils/FileUtil.js +153 -153
  116. package/target/utils/FormatStr.js +14 -14
  117. package/target/utils/IPUtils.js +34 -34
  118. package/target/utils/Id.js +8 -9
  119. package/target/utils/Mix.js +62 -62
  120. package/target/utils/ReflectUtil.js +22 -22
  121. package/target/utils/TypeUtil.js +53 -53
  122. package/target/utils/ValidationUtil.js +123 -123
  123. package/target/utils.js +25 -25
  124. package/test/example/logs/fastcar-server.app.log +0 -0
  125. package/test/example/logs/fastcar-server.sys.log +10 -0
  126. package/test/example/logs/fastcar-server.sys1.log +8 -0
  127. package/test/example/logs/fastcar-server.sys2.log +11 -0
  128. package/test/example/logs/fastcar-server.sys3.log +0 -0
  129. package/test/example/logs/other-server.app.log +0 -0
  130. package/test/example/logs/other-server.sys.log +5 -0
  131. package/test/example/logs/sys.log +0 -0
  132. package/test/example/logs/sys1.log +0 -0
  133. package/test/example/resource/application.yml +2 -0
  134. package/test/example/resource/hello.yml +1 -1
  135. package/test/example/simple/app-test.ts +2 -1
  136. package/test/example/simple/app.ts +16 -16
  137. package/test/example/simple/service/CallService.ts +2 -0
  138. package/test/example/simple/service/HelloService.ts +2 -0
  139. package/test/unit/sys2.log +6 -0
  140. package/test/unit/sys3.log +6 -0
  141. package/test/unit/sys4.log +6 -0
  142. package/test/unit/sys5.log +6 -0
  143. package/test/unit/sys6.log +6 -0
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /***
4
- * @version 1.0 仅用于标记方法是否被重载
5
- */
6
- function Override(target, methodName, descriptor) { }
7
- exports.default = Override;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = Override;
4
+ /***
5
+ * @version 1.0 仅用于标记方法是否被重载
6
+ */
7
+ function Override(target, methodName, descriptor) { }
@@ -1,16 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * @version 1.0 用于标记只读 可作用于属性或者方法
5
- */
6
- function Readonly(target, methodName, descriptor) {
7
- if (!descriptor) {
8
- Reflect.defineProperty(target, methodName, {
9
- writable: false,
10
- });
11
- }
12
- else {
13
- descriptor.writable = false;
14
- }
15
- }
16
- exports.default = Readonly;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = Readonly;
4
+ /**
5
+ * @version 1.0 用于标记只读 可作用于属性或者方法
6
+ */
7
+ function Readonly(target, methodName, descriptor) {
8
+ if (!descriptor) {
9
+ Reflect.defineProperty(target, methodName, {
10
+ writable: false,
11
+ });
12
+ }
13
+ else {
14
+ descriptor.writable = false;
15
+ }
16
+ }
@@ -1,21 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const path = require("path");
4
- const fs = require("fs");
5
- const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
6
- function ComponentInjection(target, ...names) {
7
- let ScanPathList = FastCarMetaData_1.FastCarMetaData.ComponentScan;
8
- let list = Reflect.get(target.prototype, ScanPathList) || [];
9
- for (let name of names) {
10
- //可支持绝对路径
11
- let p = path.join(require.main?.path || process.cwd() || "", name);
12
- if (fs.existsSync(name)) {
13
- p = name;
14
- }
15
- if (!list.includes(p)) {
16
- list.push(p);
17
- }
18
- }
19
- Reflect.set(target.prototype, ScanPathList, list);
20
- }
21
- exports.default = ComponentInjection;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = ComponentInjection;
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
7
+ function ComponentInjection(target, ...names) {
8
+ let ScanPathList = FastCarMetaData_1.FastCarMetaData.ComponentScan;
9
+ let list = Reflect.get(target.prototype, ScanPathList) || [];
10
+ for (let name of names) {
11
+ //可支持绝对路径
12
+ let p = path.join(require.main?.path || process.cwd() || "", name);
13
+ if (fs.existsSync(name)) {
14
+ p = name;
15
+ }
16
+ if (!list.includes(p)) {
17
+ list.push(p);
18
+ }
19
+ }
20
+ Reflect.set(target.prototype, ScanPathList, list);
21
+ }
@@ -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
+ exports.default = ComponentScan;
4
+ const ComponentInjection_1 = require("./ComponentInjection");
5
+ function ComponentScan(...names) {
6
+ return function (target) {
7
+ (0, ComponentInjection_1.default)(target, ...names);
8
+ };
9
+ }
@@ -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
+ exports.default = ComponentScanExclusion;
4
+ require("reflect-metadata");
5
+ const path = require("path");
6
+ const fs = require("fs");
7
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
8
+ //和本包的相对路径
9
+ function ComponentScanExclusion(...names) {
10
+ return function (target) {
11
+ let ScanPathList = FastCarMetaData_1.FastCarMetaData.ComponentScanExclusion;
12
+ let list = Reflect.get(target.prototype, ScanPathList) || [];
13
+ for (let name of names) {
14
+ //可支持绝对路径
15
+ let p = path.join(require.main?.path || process.cwd() || "", name);
16
+ if (fs.existsSync(name)) {
17
+ p = name;
18
+ }
19
+ if (!list.includes(p)) {
20
+ list.push(p);
21
+ }
22
+ }
23
+ Reflect.set(target.prototype, ScanPathList, list);
24
+ };
25
+ }
@@ -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
+ exports.default = ComponentScanMust;
4
+ require("reflect-metadata");
5
+ const path = require("path");
6
+ const fs = require("fs");
7
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
8
+ //和本包的相对路径
9
+ function ComponentScanMust(...names) {
10
+ return function (target) {
11
+ let scanMust = FastCarMetaData_1.FastCarMetaData.ComponentScanMust;
12
+ let list = Reflect.get(target.prototype, scanMust) || [];
13
+ for (let name of names) {
14
+ //可支持绝对路径
15
+ let p = path.join(require.main?.path || process.cwd() || "", name);
16
+ if (fs.existsSync(name)) {
17
+ p = name;
18
+ }
19
+ if (!list.includes(p)) {
20
+ list.push(p);
21
+ }
22
+ }
23
+ Reflect.set(target.prototype, scanMust, list);
24
+ };
25
+ }
@@ -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
+ exports.default = Hotter;
4
+ require("reflect-metadata");
5
+ const __1 = require("../..");
6
+ function Hotter(target) {
7
+ Reflect.defineMetadata(__1.FastCarMetaData.Hotter, true, target.prototype);
8
+ }
@@ -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
+ exports.default = BeanName;
4
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
5
+ //应用别名声明
6
+ function BeanName(name) {
7
+ return function (target) {
8
+ //生成别名 用于逻辑识别
9
+ Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.Alias, name, target.prototype); //放入至原型中
10
+ };
11
+ }
@@ -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
+ exports.default = Component;
4
+ const ComponentKind_1 = require("../../constant/ComponentKind");
5
+ const Injection_1 = require("./Injection");
6
+ function Component(target) {
7
+ (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Component);
8
+ }
@@ -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
+ exports.default = Configure;
4
+ const Component_1 = require("./Component");
5
+ const LifeCycleModule_1 = require("../../constant/LifeCycleModule");
6
+ //配置文件层
7
+ function Configure(name) {
8
+ return function (target) {
9
+ //配置对象也为组件
10
+ (0, Component_1.default)(target);
11
+ //当实例化时 加载默认配置并进行赋值
12
+ Reflect.defineMetadata(LifeCycleModule_1.LifeCycleModule.LoadConfigure, name, target);
13
+ };
14
+ }
@@ -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
+ exports.default = Controller;
4
+ const ComponentKind_1 = require("../../constant/ComponentKind");
5
+ const Injection_1 = require("./Injection");
6
+ //业务逻辑层
7
+ function Controller(target) {
8
+ (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Controller);
9
+ }
@@ -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
+ exports.default = Injection;
4
+ require("reflect-metadata");
5
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
6
+ const Id_1 = require("../../utils/Id");
7
+ function Injection(target, name) {
8
+ //生成别名 避免名称重复的情况
9
+ let key = `${name}:${(0, Id_1.id)()}`;
10
+ Reflect.defineMetadata(name, true, target.prototype);
11
+ Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.InjectionUniqueKey, key, target); //放入至原型中
12
+ }
@@ -1,17 +1,19 @@
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
+ exports.default = Log;
4
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
5
+ //日志实例
6
+ function Log(category) {
7
+ return function (target, propertyKey) {
8
+ let m = category || propertyKey;
9
+ let services = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.InjectionLog, target);
10
+ if (!services) {
11
+ services = [];
12
+ Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.InjectionLog, services, target);
13
+ }
14
+ services.push({
15
+ propertyKey,
16
+ name: m,
17
+ });
18
+ };
19
+ }
@@ -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
+ exports.default = Repository;
4
+ const ComponentKind_1 = require("../../constant/ComponentKind");
5
+ const Injection_1 = require("./Injection");
6
+ //数据逻辑层(表明和数据库相关)
7
+ function Repository(target) {
8
+ (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Repository);
9
+ }
@@ -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
+ exports.default = Service;
4
+ const ComponentKind_1 = require("../../constant/ComponentKind");
5
+ const Injection_1 = require("./Injection");
6
+ //中间服务层
7
+ function Service(target) {
8
+ (0, Injection_1.default)(target, ComponentKind_1.ComponentKind.Service);
9
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ //获取原属性值
3
+ //application 代表系统参数
4
+ //setting 代表系统其余参数
5
+ //其他默认第一个代表 资源路径下的地址
@@ -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
+ exports.default = AddChildValid;
4
+ require("reflect-metadata");
5
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
6
+ const TypeUtil_1 = require("../../utils/TypeUtil");
7
+ const ValidationUtil_1 = require("../../utils/ValidationUtil");
8
+ //添加子元素的校验规则
9
+ function AddChildValid(target, name, value, index) {
10
+ let childMap;
11
+ let paramsFlag = ValidationUtil_1.default.isNumber(index);
12
+ let alias = paramsFlag ? `${name}-${index}` : name;
13
+ if (paramsFlag) {
14
+ childMap = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, target, alias);
15
+ if (!childMap) {
16
+ childMap = new Map();
17
+ Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, childMap, target, alias);
18
+ }
19
+ }
20
+ else {
21
+ childMap = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, target);
22
+ if (!childMap) {
23
+ childMap = new Map();
24
+ Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.ValidChildFormRules, childMap, target);
25
+ }
26
+ }
27
+ let item = childMap.get(alias);
28
+ if (!item) {
29
+ let proto = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.designType, target, name);
30
+ if (paramsFlag) {
31
+ //修改为方法获取原型
32
+ let paramsTypes = Reflect.getMetadata(FastCarMetaData_1.FastCarMetaData.paramTypes, target, name);
33
+ if (typeof index == "number") {
34
+ proto = paramsTypes[index];
35
+ }
36
+ }
37
+ let typeName = proto.name.toLowerCase();
38
+ if (!TypeUtil_1.default.isBasic(typeName)) {
39
+ typeName = typeName == "array" ? "array" : "object";
40
+ }
41
+ item = {
42
+ type: typeName,
43
+ };
44
+ }
45
+ //自定义方法合并
46
+ if (Reflect.has(value, "filters")) {
47
+ if (Array.isArray(item.filters)) {
48
+ item.filters.forEach((f) => {
49
+ value.filters.push(f);
50
+ });
51
+ }
52
+ }
53
+ //合并所有属性
54
+ Object.assign(item, value);
55
+ childMap.set(alias, item);
56
+ }
@@ -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
+ exports.default = CustomType;
4
+ require("reflect-metadata");
5
+ const FastCarMetaData_1 = require("../../constant/FastCarMetaData");
6
+ //自定义类型
7
+ function CustomType(name) {
8
+ return function (target, propertyKey) {
9
+ Reflect.defineMetadata(FastCarMetaData_1.FastCarMetaData.CustomType, name, target, propertyKey);
10
+ };
11
+ }
@@ -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
+ exports.default = DefaultVal;
4
+ const AddChildValid_1 = require("./AddChildValid");
5
+ //默认值获取
6
+ function DefaultVal(val) {
7
+ return function (target, propertyKey, index) {
8
+ (0, AddChildValid_1.default)(target, propertyKey, { defaultVal: val }, index);
9
+ };
10
+ }
@@ -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
+ exports.default = NotNull;
4
+ const AddChildValid_1 = require("./AddChildValid");
5
+ //是否为非空字段
6
+ function NotNull(target, propertyKey, index) {
7
+ (0, AddChildValid_1.default)(target, propertyKey, { required: true }, index);
8
+ }