@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.
- package/package.json +1 -1
- package/src/FastCarApplication.ts +30 -9
- package/src/utils/ValidationUtil.ts +1 -3
- package/target/FastCarApplication.js +708 -692
- package/target/annotation/Application.js +45 -45
- package/target/annotation/ExceptionMonitor.js +16 -16
- package/target/annotation/bind/AddRequireModule.js +21 -21
- package/target/annotation/bind/AliasInjection.js +23 -23
- package/target/annotation/bind/Autowired.js +13 -13
- package/target/annotation/bind/CallDependency.js +23 -23
- package/target/annotation/data/DBType.js +11 -11
- package/target/annotation/data/DS.js +54 -54
- package/target/annotation/data/DSIndex.js +9 -9
- package/target/annotation/data/Entity.js +10 -10
- package/target/annotation/data/Field.js +18 -18
- package/target/annotation/data/PrimaryKey.js +9 -9
- package/target/annotation/data/SqlSession.js +9 -9
- package/target/annotation/data/Table.js +35 -35
- package/target/annotation/data/Transactional.js +52 -52
- package/target/annotation/env/ApplicationSetting.js +25 -25
- package/target/annotation/env/BaseFilePath.js +14 -14
- package/target/annotation/env/BaseName.js +9 -9
- package/target/annotation/env/BasePath.js +14 -14
- package/target/annotation/env/ENV.js +10 -10
- package/target/annotation/env/ResourcePath.js +9 -9
- package/target/annotation/lifeCycle/AddLifeCycleItem.js +18 -18
- package/target/annotation/lifeCycle/ApplicationDestory.js +15 -15
- package/target/annotation/lifeCycle/ApplicationInit.js +15 -15
- package/target/annotation/lifeCycle/ApplicationRunner.js +7 -7
- package/target/annotation/lifeCycle/ApplicationStart.js +24 -24
- package/target/annotation/lifeCycle/ApplicationStop.js +20 -20
- package/target/annotation/property/Deprecate.js +19 -19
- package/target/annotation/property/NotImplemented.js +8 -8
- package/target/annotation/property/Override.js +7 -7
- package/target/annotation/property/Readonly.js +16 -16
- package/target/annotation/scan/ComponentInjection.js +21 -21
- package/target/annotation/scan/ComponentScan.js +9 -9
- package/target/annotation/scan/ComponentScanExclusion.js +25 -25
- package/target/annotation/scan/ComponentScanMust.js +25 -25
- package/target/annotation/scan/Hotter.js +8 -8
- package/target/annotation/stereotype/BeanName.js +11 -11
- package/target/annotation/stereotype/Component.js +8 -8
- package/target/annotation/stereotype/Configure.js +14 -14
- package/target/annotation/stereotype/Controller.js +9 -9
- package/target/annotation/stereotype/Injection.js +12 -12
- package/target/annotation/stereotype/Log.js +17 -17
- package/target/annotation/stereotype/Repository.js +9 -9
- package/target/annotation/stereotype/Service.js +9 -9
- package/target/annotation/valid/AddChildValid.js +56 -56
- package/target/annotation/valid/CustomType.js +11 -11
- package/target/annotation/valid/DefaultVal.js +10 -10
- package/target/annotation/valid/NotNull.js +8 -8
- package/target/annotation/valid/Rule.js +100 -100
- package/target/annotation/valid/Size.js +10 -10
- package/target/annotation/valid/Type.js +10 -10
- package/target/annotation/valid/ValidCustom.js +17 -17
- package/target/annotation/valid/ValidForm.js +133 -133
- package/target/annotation.js +108 -108
- package/target/config/ApplicationConfig.js +2 -2
- package/target/config/SysConfig.js +19 -19
- package/target/constant/AppStatusEnum.js +9 -9
- package/target/constant/BootPriority.js +11 -11
- package/target/constant/CommonConstant.js +18 -18
- package/target/constant/ComponentKind.js +11 -11
- package/target/constant/DataTypes.js +19 -19
- package/target/constant/FastCarMetaData.js +31 -31
- package/target/constant/LifeCycleModule.js +9 -9
- package/target/db.js +49 -49
- package/target/index.js +21 -21
- package/target/interface/ApplicationHook.js +2 -2
- package/target/interface/ApplicationInterface.js +2 -2
- package/target/interface/ApplicationRunnerService.js +2 -2
- package/target/interface/DataSourceManager.js +2 -2
- package/target/interface/Logger.js +5 -5
- package/target/model/BaseMapper.js +98 -98
- package/target/model/DataMap.js +87 -87
- package/target/model/FormRuleModel.js +2 -2
- package/target/model/ValidError.js +5 -5
- package/target/model/WinstonLogger.js +96 -96
- package/target/type/ComponentDesc.js +2 -2
- package/target/type/DesignMeta.js +15 -15
- package/target/type/FileHotterDesc.js +2 -2
- package/target/type/MapperType.js +2 -2
- package/target/type/ProcessType.js +2 -2
- package/target/type/SqlError.js +5 -5
- package/target/type/WinstonLoggerType.js +9 -9
- package/target/utils/ClassLoader.js +65 -65
- package/target/utils/ClassUtils.js +35 -35
- package/target/utils/CryptoUtil.js +86 -86
- package/target/utils/DataFormat.js +88 -88
- package/target/utils/DateUtil.js +71 -71
- package/target/utils/FileUtil.js +153 -153
- package/target/utils/FormatStr.js +14 -14
- package/target/utils/IPUtils.js +34 -34
- package/target/utils/Id.js +9 -9
- package/target/utils/Mix.js +62 -62
- package/target/utils/ReflectUtil.js +22 -22
- package/target/utils/TypeUtil.js +53 -53
- package/target/utils/ValidationUtil.js +123 -124
- package/target/utils.js +25 -25
- package/test/unit/decorators-test.ts +3 -3
- package/target/src/FastCarApplication.js +0 -704
- package/target/src/annotation/Application.js +0 -45
- package/target/src/annotation/ExceptionMonitor.js +0 -16
- package/target/src/annotation/bind/AddRequireModule.js +0 -21
- package/target/src/annotation/bind/AliasInjection.js +0 -23
- package/target/src/annotation/bind/Autowired.js +0 -13
- package/target/src/annotation/bind/CallDependency.js +0 -23
- package/target/src/annotation/data/DBType.js +0 -11
- package/target/src/annotation/data/DS.js +0 -54
- package/target/src/annotation/data/DSIndex.js +0 -9
- package/target/src/annotation/data/Entity.js +0 -10
- package/target/src/annotation/data/Field.js +0 -18
- package/target/src/annotation/data/PrimaryKey.js +0 -9
- package/target/src/annotation/data/SqlSession.js +0 -9
- package/target/src/annotation/data/Table.js +0 -35
- package/target/src/annotation/data/Transactional.js +0 -52
- package/target/src/annotation/env/ApplicationSetting.js +0 -25
- package/target/src/annotation/env/BaseFilePath.js +0 -14
- package/target/src/annotation/env/BaseName.js +0 -9
- package/target/src/annotation/env/BasePath.js +0 -14
- package/target/src/annotation/env/ENV.js +0 -10
- package/target/src/annotation/env/ResourcePath.js +0 -9
- package/target/src/annotation/lifeCycle/AddLifeCycleItem.js +0 -18
- package/target/src/annotation/lifeCycle/ApplicationDestory.js +0 -15
- package/target/src/annotation/lifeCycle/ApplicationInit.js +0 -15
- package/target/src/annotation/lifeCycle/ApplicationRunner.js +0 -7
- package/target/src/annotation/lifeCycle/ApplicationStart.js +0 -24
- package/target/src/annotation/lifeCycle/ApplicationStop.js +0 -20
- package/target/src/annotation/property/Deprecate.js +0 -19
- package/target/src/annotation/property/NotImplemented.js +0 -8
- package/target/src/annotation/property/Override.js +0 -7
- package/target/src/annotation/property/Readonly.js +0 -16
- package/target/src/annotation/scan/ComponentInjection.js +0 -21
- package/target/src/annotation/scan/ComponentScan.js +0 -9
- package/target/src/annotation/scan/ComponentScanExclusion.js +0 -25
- package/target/src/annotation/scan/ComponentScanMust.js +0 -25
- package/target/src/annotation/scan/Hotter.js +0 -8
- package/target/src/annotation/stereotype/BeanName.js +0 -11
- package/target/src/annotation/stereotype/Component.js +0 -8
- package/target/src/annotation/stereotype/Configure.js +0 -14
- package/target/src/annotation/stereotype/Controller.js +0 -9
- package/target/src/annotation/stereotype/Injection.js +0 -12
- package/target/src/annotation/stereotype/Log.js +0 -22
- package/target/src/annotation/stereotype/Repository.js +0 -9
- package/target/src/annotation/stereotype/Service.js +0 -9
- package/target/src/annotation/valid/AddChildValid.js +0 -56
- package/target/src/annotation/valid/CustomType.js +0 -11
- package/target/src/annotation/valid/DefaultVal.js +0 -10
- package/target/src/annotation/valid/NotNull.js +0 -8
- package/target/src/annotation/valid/Rule.js +0 -100
- package/target/src/annotation/valid/Size.js +0 -10
- package/target/src/annotation/valid/Type.js +0 -10
- package/target/src/annotation/valid/ValidCustom.js +0 -17
- package/target/src/annotation/valid/ValidForm.js +0 -133
- package/target/src/annotation.js +0 -108
- package/target/src/config/ApplicationConfig.js +0 -2
- package/target/src/config/SysConfig.js +0 -19
- package/target/src/constant/AppStatusEnum.js +0 -9
- package/target/src/constant/BootPriority.js +0 -11
- package/target/src/constant/CommonConstant.js +0 -18
- package/target/src/constant/ComponentKind.js +0 -11
- package/target/src/constant/DataTypes.js +0 -19
- package/target/src/constant/FastCarMetaData.js +0 -31
- package/target/src/constant/LifeCycleModule.js +0 -9
- package/target/src/db.js +0 -49
- package/target/src/index.js +0 -21
- package/target/src/interface/ApplicationHook.js +0 -2
- package/target/src/interface/ApplicationInterface.js +0 -2
- package/target/src/interface/ApplicationRunnerService.js +0 -2
- package/target/src/interface/DataSourceManager.js +0 -2
- package/target/src/interface/Logger.js +0 -5
- package/target/src/model/BaseMapper.js +0 -103
- package/target/src/model/DataMap.js +0 -87
- package/target/src/model/FormRuleModel.js +0 -2
- package/target/src/model/ValidError.js +0 -5
- package/target/src/model/WinstonLogger.js +0 -97
- package/target/src/type/ComponentDesc.js +0 -2
- package/target/src/type/DesignMeta.js +0 -15
- package/target/src/type/FileHotterDesc.js +0 -2
- package/target/src/type/MapperType.js +0 -2
- package/target/src/type/ProcessType.js +0 -2
- package/target/src/type/SqlError.js +0 -5
- package/target/src/type/WinstonLoggerType.js +0 -9
- package/target/src/utils/ClassLoader.js +0 -65
- package/target/src/utils/ClassUtils.js +0 -35
- package/target/src/utils/CryptoUtil.js +0 -86
- package/target/src/utils/DataFormat.js +0 -88
- package/target/src/utils/DateUtil.js +0 -71
- package/target/src/utils/FileUtil.js +0 -153
- package/target/src/utils/FormatStr.js +0 -14
- package/target/src/utils/IPUtils.js +0 -34
- package/target/src/utils/Id.js +0 -9
- package/target/src/utils/Mix.js +0 -62
- package/target/src/utils/ReflectUtil.js +0 -22
- package/target/src/utils/TypeUtil.js +0 -53
- package/target/src/utils/ValidationUtil.js +0 -118
- package/target/src/utils.js +0 -25
- package/target/test/example/simple/app-test.js +0 -57
- package/target/test/example/simple/app.js +0 -116
- package/target/test/example/simple/component/StartRunner.js +0 -19
- package/target/test/example/simple/component/StopRunner.js +0 -23
- package/target/test/example/simple/config/EnvConfig.js +0 -16
- package/target/test/example/simple/config/HelloConfig.js +0 -16
- package/target/test/example/simple/config/HotConfig.js +0 -18
- package/target/test/example/simple/controller/AliasController.js +0 -17
- package/target/test/example/simple/controller/HelloController.js +0 -55
- package/target/test/example/simple/controller/NotFoundController.js +0 -36
- package/target/test/example/simple/noclude/excludeApp.js +0 -17
- package/target/test/example/simple/service/CallService.js +0 -24
- package/target/test/example/simple/service/HelloService.js +0 -18
- package/target/test/example/simple/service/LogService.js +0 -32
- package/target/test/multi/app.js +0 -29
- package/target/test/multi/service/aService.js +0 -33
- package/target/test/multi/service/bService.js +0 -35
- package/target/test/multi/service/cService.js +0 -40
- package/target/test/unit/dataMap-test.js +0 -35
- package/target/test/unit/decorators-test.js +0 -59
- package/target/test/unit/ds-test.js +0 -58
- package/target/test/unit/reflectMetadata-test.js +0 -27
- package/target/test/unit/valid-test.js +0 -99
- package/target/test/unit/winston-test.js +0 -15
- package/test/example/logs/fastcar-server.sys.log +0 -3
- package/test/example/logs/other-server.app.log +0 -0
- package/test/example/logs/other-server.sys.log +0 -0
- package/test/example/logs/other-server.sys1.log +0 -0
- package/test/example/logs/other-server.sys2.log +0 -0
- package/test/example/logs/other-server.sys3.log +0 -6
- package/test/example/logs/other-server.sys4.log +0 -0
- package/test/example/logs/other-server.sys5.log +0 -0
- package/test/example/logs/other-server.sys6.log +0 -2
- package/test/logs/logger.log +0 -0
- package/test/logs/sys.log +0 -227
package/package.json
CHANGED
|
@@ -46,6 +46,7 @@ class FastCarApplication extends Events {
|
|
|
46
46
|
protected delayHotIds: Map<string, { fp: string; loadType: number }>;
|
|
47
47
|
protected reloadTimerId: NodeJS.Timeout | null;
|
|
48
48
|
protected basename: string = CommonConstant.Application;
|
|
49
|
+
protected componentAliasMap: Map<string | symbol, string | symbol>;
|
|
49
50
|
|
|
50
51
|
constructor() {
|
|
51
52
|
super();
|
|
@@ -58,6 +59,7 @@ class FastCarApplication extends Events {
|
|
|
58
59
|
this.watchFiles = new Map();
|
|
59
60
|
this.delayHotIds = new Map();
|
|
60
61
|
this.reloadTimerId = null;
|
|
62
|
+
this.componentAliasMap = new Map();
|
|
61
63
|
|
|
62
64
|
this.loadSelf();
|
|
63
65
|
this.addHot();
|
|
@@ -397,12 +399,13 @@ class FastCarApplication extends Events {
|
|
|
397
399
|
//判断是否有别名
|
|
398
400
|
let aliasName = Reflect.getMetadata(FastCarMetaData.Alias, instance);
|
|
399
401
|
if (aliasName) {
|
|
400
|
-
this.
|
|
401
|
-
this.
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
402
|
+
this.componentAliasMap.set(aliasName, instanceKey);
|
|
403
|
+
// this.componentMap.set(aliasName, instance);
|
|
404
|
+
// this.componentDeatils.set(aliasName, {
|
|
405
|
+
// id: aliasName,
|
|
406
|
+
// name: aliasName,
|
|
407
|
+
// path: fp,
|
|
408
|
+
// });
|
|
406
409
|
}
|
|
407
410
|
|
|
408
411
|
//判断是否需要热更加载
|
|
@@ -498,14 +501,23 @@ class FastCarApplication extends Events {
|
|
|
498
501
|
* @version 1.0 根据名称组件
|
|
499
502
|
*/
|
|
500
503
|
getComponentByName(name: string | symbol): any {
|
|
501
|
-
|
|
504
|
+
if (this.componentMap.has(name)) {
|
|
505
|
+
return this.componentMap.get(name);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
let key = this.componentAliasMap.get(name);
|
|
509
|
+
if (key) {
|
|
510
|
+
return this.componentMap.get(key);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
return null;
|
|
502
514
|
}
|
|
503
515
|
|
|
504
516
|
/***
|
|
505
517
|
* @version 1.0 判断是否拥有组件名称
|
|
506
518
|
*/
|
|
507
519
|
hasComponentByName(name: string | symbol): boolean {
|
|
508
|
-
return this.componentMap.has(name);
|
|
520
|
+
return this.componentMap.has(name) || this.componentAliasMap.has(name as string);
|
|
509
521
|
}
|
|
510
522
|
|
|
511
523
|
/***
|
|
@@ -529,7 +541,16 @@ class FastCarApplication extends Events {
|
|
|
529
541
|
*
|
|
530
542
|
*/
|
|
531
543
|
getComponentDetailByName(name: string | symbol): ComponentDesc | undefined {
|
|
532
|
-
|
|
544
|
+
if (this.componentDeatils.has(name)) {
|
|
545
|
+
return this.componentDeatils.get(name);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
let key = this.componentAliasMap.get(name);
|
|
549
|
+
if (key) {
|
|
550
|
+
return this.componentDeatils.get(key);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return undefined;
|
|
533
554
|
}
|
|
534
555
|
|
|
535
556
|
/***
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { DataTypes } from "../constant/DataTypes";
|
|
2
2
|
import TypeUtil from "./TypeUtil";
|
|
3
3
|
|
|
4
|
-
const NumberRegex = /^[0-9]+$/;
|
|
5
|
-
|
|
6
4
|
//类型校验器
|
|
7
5
|
export default class ValidationUtil {
|
|
8
6
|
//是否为空
|
|
@@ -32,7 +30,7 @@ export default class ValidationUtil {
|
|
|
32
30
|
|
|
33
31
|
//修改数字的判断方法
|
|
34
32
|
static isNumber(param: any): boolean {
|
|
35
|
-
return
|
|
33
|
+
return !isNaN(param);
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
static isString(param: any): boolean {
|