@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.
- package/README.md +5 -2
- package/annotation.d.ts +3 -0
- package/index.d.ts +57 -50
- package/package.json +4 -4
- package/src/FastCarApplication.ts +184 -123
- package/src/annotation/Application.ts +3 -1
- package/src/annotation/bind/AddInjectionService.ts +17 -0
- package/src/annotation/bind/AddRequireModule.ts +1 -1
- package/src/annotation/bind/AliasInjection.ts +8 -15
- package/src/annotation/bind/Autowired.ts +1 -1
- package/src/annotation/bind/CallDependency.ts +7 -17
- package/src/annotation/bind/DemandInjection.ts +16 -0
- package/src/annotation/stereotype/Log.ts +13 -9
- package/src/annotation/stereotype/Value.ts +5 -0
- package/src/annotation.ts +2 -0
- package/src/constant/FastCarMetaData.ts +2 -0
- package/src/model/WinstonLogger.ts +1 -1
- package/src/type/ClassConstructor.ts +5 -0
- package/src/type/ComponentDesc.ts +13 -0
- package/src/type/FileHotterDesc.ts +6 -0
- package/src/utils/ClassLoader.ts +2 -1
- package/target/FastCarApplication.js +764 -708
- package/target/annotation/Application.js +46 -45
- package/target/annotation/ExceptionMonitor.js +16 -16
- package/target/annotation/bind/AddInjectionService.js +16 -0
- package/target/annotation/bind/AddRequireModule.js +21 -21
- package/target/annotation/bind/AliasInjection.js +19 -23
- package/target/annotation/bind/Autowired.js +13 -13
- package/target/annotation/bind/CallDependency.js +16 -23
- package/target/annotation/bind/DemandInjection.js +15 -0
- 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 +17 -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 +19 -17
- package/target/annotation/stereotype/Repository.js +9 -9
- package/target/annotation/stereotype/Service.js +9 -9
- package/target/annotation/stereotype/Value.js +5 -0
- 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 +99 -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 +110 -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 +33 -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 +103 -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 +98 -96
- package/target/type/ClassConstructor.js +2 -0
- package/target/type/ComponentDesc.js +9 -2
- package/target/type/DesignMeta.js +15 -15
- package/target/type/FileHotterDesc.js +9 -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 +66 -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 +8 -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 -123
- package/target/utils.js +25 -25
- package/test/example/logs/fastcar-server.app.log +0 -0
- package/test/example/logs/fastcar-server.sys.log +10 -0
- package/test/example/logs/fastcar-server.sys1.log +8 -0
- package/test/example/logs/fastcar-server.sys2.log +11 -0
- package/test/example/logs/fastcar-server.sys3.log +0 -0
- package/test/example/logs/other-server.app.log +0 -0
- package/test/example/logs/other-server.sys.log +5 -0
- package/test/example/logs/sys.log +0 -0
- package/test/example/logs/sys1.log +0 -0
- package/test/example/resource/application.yml +2 -0
- package/test/example/resource/hello.yml +1 -1
- package/test/example/simple/app-test.ts +2 -1
- package/test/example/simple/app.ts +16 -16
- package/test/example/simple/service/CallService.ts +2 -0
- package/test/example/simple/service/HelloService.ts +2 -0
- package/test/unit/sys2.log +6 -0
- package/test/unit/sys3.log +6 -0
- package/test/unit/sys4.log +6 -0
- package/test/unit/sys5.log +6 -0
- package/test/unit/sys6.log +6 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
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
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
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
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
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
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Reflect.defineMetadata(
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
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
|
+
}
|