@lakutata/core 1.0.28 → 1.0.32
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 +4 -0
- package/build/Application.d.ts +4 -0
- package/build/Application.js +20 -7
- package/build/Application.js.map +1 -1
- package/build/ApplicationManagement.js +5 -0
- package/build/ApplicationManagement.js.map +1 -1
- package/build/base/BaseObject.js +1 -1
- package/build/base/BaseObject.js.map +1 -1
- package/build/base/Container.js +16 -0
- package/build/base/Container.js.map +1 -1
- package/build/base/ValidatorClass.d.ts +1 -0
- package/build/base/ValidatorClass.js +70 -53
- package/build/base/ValidatorClass.js.map +1 -1
- package/build/base/abstracts/Module.js +8 -8
- package/build/base/abstracts/Module.js.map +1 -1
- package/build/base/abstracts/Workflow.js +1 -1
- package/build/base/abstracts/Workflow.js.map +1 -1
- package/build/base/process/Process.d.ts +1 -1
- package/build/base/process/Process.js +2 -2
- package/build/base/process/Process.js.map +1 -1
- package/build/base/process/ProcessManager.d.ts +1 -1
- package/build/base/process/ProcessManager.js +2 -2
- package/build/base/process/ProcessManager.js.map +1 -1
- package/build/base/thread/Thread.d.ts +1 -1
- package/build/base/thread/Thread.js +2 -2
- package/build/base/thread/Thread.js.map +1 -1
- package/build/base/thread/ThreadManager.d.ts +1 -1
- package/build/base/thread/ThreadManager.js +2 -2
- package/build/base/thread/ThreadManager.js.map +1 -1
- package/build/decorators/MethodValidation.js.map +1 -1
- package/build/interfaces/IApplicationConfig.d.ts +1 -0
- package/build/interfaces/ShellJsInterfaces.d.ts +162 -0
- package/build/interfaces/ShellJsInterfaces.js +3 -0
- package/build/interfaces/ShellJsInterfaces.js.map +1 -0
- package/build/lib/minified/ShellJs.d.ts +2 -0
- package/build/lib/minified/ShellJs.js +3699 -0
- package/build/lib/minified/ShellJs.js.map +1 -0
- package/build/lib/multipleRunner/constants/Channel.d.ts +5 -0
- package/build/lib/multipleRunner/constants/Channel.js +9 -0
- package/build/lib/multipleRunner/constants/Channel.js.map +1 -0
- package/build/lib/multipleRunner/constants/MetadataKey.d.ts +2 -0
- package/build/lib/multipleRunner/constants/MetadataKey.js +6 -0
- package/build/lib/multipleRunner/constants/MetadataKey.js.map +1 -0
- package/build/lib/multipleRunner/containers/ContainerVolume.d.ts +4 -0
- package/build/lib/multipleRunner/containers/ContainerVolume.js +85 -0
- package/build/lib/multipleRunner/containers/ContainerVolume.js.map +1 -0
- package/build/lib/multipleRunner/definitions/interfaces/ClassConstructor.d.ts +3 -0
- package/build/lib/multipleRunner/definitions/interfaces/ClassConstructor.js +3 -0
- package/build/lib/multipleRunner/definitions/interfaces/ClassConstructor.js.map +1 -0
- package/build/lib/multipleRunner/definitions/interfaces/MultipleRunnerBaseClassConstructor.d.ts +4 -0
- package/build/lib/multipleRunner/definitions/interfaces/MultipleRunnerBaseClassConstructor.js +3 -0
- package/build/lib/multipleRunner/definitions/interfaces/MultipleRunnerBaseClassConstructor.js.map +1 -0
- package/build/lib/multipleRunner/definitions/interfaces/ProcessClassConstructor.d.ts +7 -0
- package/build/lib/multipleRunner/definitions/interfaces/ProcessClassConstructor.js +3 -0
- package/build/lib/multipleRunner/definitions/interfaces/ProcessClassConstructor.js.map +1 -0
- package/build/lib/multipleRunner/definitions/interfaces/ProxyClass.d.ts +3 -0
- package/build/lib/multipleRunner/definitions/interfaces/ProxyClass.js +3 -0
- package/build/lib/multipleRunner/definitions/interfaces/ProxyClass.js.map +1 -0
- package/build/lib/multipleRunner/definitions/interfaces/ThreadClassConstructor.d.ts +7 -0
- package/build/lib/multipleRunner/definitions/interfaces/ThreadClassConstructor.js +3 -0
- package/build/lib/multipleRunner/definitions/interfaces/ThreadClassConstructor.js.map +1 -0
- package/build/lib/multipleRunner/lib/Process.d.ts +5 -0
- package/build/lib/multipleRunner/lib/Process.js +44 -0
- package/build/lib/multipleRunner/lib/Process.js.map +1 -0
- package/build/lib/multipleRunner/lib/Thread.d.ts +5 -0
- package/build/lib/multipleRunner/lib/Thread.js +52 -0
- package/build/lib/multipleRunner/lib/Thread.js.map +1 -0
- package/build/lib/multipleRunner/lib/bridges/BaseBridge.d.ts +32 -0
- package/build/lib/multipleRunner/lib/bridges/BaseBridge.js +104 -0
- package/build/lib/multipleRunner/lib/bridges/BaseBridge.js.map +1 -0
- package/build/lib/multipleRunner/lib/bridges/ProcessBridge.d.ts +5 -0
- package/build/lib/multipleRunner/lib/bridges/ProcessBridge.js +20 -0
- package/build/lib/multipleRunner/lib/bridges/ProcessBridge.js.map +1 -0
- package/build/lib/multipleRunner/lib/bridges/ThreadBridge.d.ts +5 -0
- package/build/lib/multipleRunner/lib/bridges/ThreadBridge.js +17 -0
- package/build/lib/multipleRunner/lib/bridges/ThreadBridge.js.map +1 -0
- package/build/lib/multipleRunner/lib/cores/GenerateExecArgv.d.ts +2 -0
- package/build/lib/multipleRunner/lib/cores/GenerateExecArgv.js +35 -0
- package/build/lib/multipleRunner/lib/cores/GenerateExecArgv.js.map +1 -0
- package/build/lib/multipleRunner/lib/cores/IsElectron.d.ts +1 -0
- package/build/lib/multipleRunner/lib/cores/IsElectron.js +9 -0
- package/build/lib/multipleRunner/lib/cores/IsElectron.js.map +1 -0
- package/build/lib/multipleRunner/lib/cores/ProcessClass.d.ts +5 -0
- package/build/lib/multipleRunner/lib/cores/ProcessClass.js +12 -0
- package/build/lib/multipleRunner/lib/cores/ProcessClass.js.map +1 -0
- package/build/lib/multipleRunner/lib/cores/ThreadClass.d.ts +5 -0
- package/build/lib/multipleRunner/lib/cores/ThreadClass.js +12 -0
- package/build/lib/multipleRunner/lib/cores/ThreadClass.js.map +1 -0
- package/build/lib/multipleRunner/lib/cores/UniParentBridgeHandler.d.ts +2 -0
- package/build/lib/multipleRunner/lib/cores/UniParentBridgeHandler.js +104 -0
- package/build/lib/multipleRunner/lib/cores/UniParentBridgeHandler.js.map +1 -0
- package/build/lib/multipleRunner/lib/prototypes/MultipleRunnerBaseClass.d.ts +17 -0
- package/build/lib/multipleRunner/lib/prototypes/MultipleRunnerBaseClass.js +53 -0
- package/build/lib/multipleRunner/lib/prototypes/MultipleRunnerBaseClass.js.map +1 -0
- package/build/plugins/Crypto.js +2 -2
- package/build/plugins/Crypto.js.map +1 -1
- package/build/plugins/Formatter.d.ts +1 -0
- package/build/plugins/Formatter.js +9 -6
- package/build/plugins/Formatter.js.map +1 -1
- package/build/plugins/HttpRequest.js +8 -8
- package/build/plugins/HttpRequest.js.map +1 -1
- package/build/plugins/Logger.js +15 -6
- package/build/plugins/Logger.js.map +1 -1
- package/build/plugins/MessagePack.js +2 -2
- package/build/plugins/MessagePack.js.map +1 -1
- package/build/plugins/Security.js +24 -24
- package/build/plugins/Security.js.map +1 -1
- package/build/plugins/Shell.d.ts +39 -0
- package/build/plugins/Shell.js +58 -0
- package/build/plugins/Shell.js.map +1 -0
- package/build/types/TPluginsConfig.d.ts +1 -0
- package/build/utils/Delay.js +1 -1
- package/build/utils/Delay.js.map +1 -1
- package/build/utils/Timeout.js +1 -1
- package/build/utils/Timeout.js.map +1 -1
- package/build/utils/ValidDataUrl.d.ts +1 -0
- package/build/utils/ValidDataUrl.js +8 -0
- package/build/utils/ValidDataUrl.js.map +1 -0
- package/package.json +6 -5
- package/src/Application.ts +33 -11
- package/src/ApplicationManagement.ts +4 -1
- package/src/base/Container.ts +14 -1
- package/src/base/ValidatorClass.ts +44 -7
- package/src/base/abstracts/Exception.ts +1 -1
- package/src/base/abstracts/Module.ts +2 -1
- package/src/base/process/Process.ts +1 -1
- package/src/base/process/ProcessManager.ts +2 -2
- package/src/base/thread/Thread.ts +1 -1
- package/src/base/thread/ThreadManager.ts +2 -2
- package/src/decorators/MethodValidation.ts +6 -6
- package/src/interfaces/IApplicationConfig.ts +1 -0
- package/src/interfaces/ShellJsInterfaces.ts +858 -0
- package/src/lib/minified/ShellJs.js +1 -0
- package/src/lib/multipleRunner/constants/Channel.ts +5 -0
- package/src/lib/multipleRunner/constants/MetadataKey.ts +2 -0
- package/src/lib/multipleRunner/containers/ContainerVolume.ts +83 -0
- package/src/lib/multipleRunner/definitions/interfaces/ClassConstructor.ts +3 -0
- package/src/lib/multipleRunner/definitions/interfaces/MultipleRunnerBaseClassConstructor.ts +5 -0
- package/src/lib/multipleRunner/definitions/interfaces/ProcessClassConstructor.ts +10 -0
- package/src/lib/multipleRunner/definitions/interfaces/ProxyClass.ts +3 -0
- package/src/lib/multipleRunner/definitions/interfaces/ThreadClassConstructor.ts +10 -0
- package/src/lib/multipleRunner/lib/Process.ts +44 -0
- package/src/lib/multipleRunner/lib/Thread.ts +52 -0
- package/src/lib/multipleRunner/lib/bridges/BaseBridge.ts +115 -0
- package/src/lib/multipleRunner/lib/bridges/ProcessBridge.ts +18 -0
- package/src/lib/multipleRunner/lib/bridges/ThreadBridge.ts +15 -0
- package/src/lib/multipleRunner/lib/cores/GenerateExecArgv.ts +28 -0
- package/src/lib/multipleRunner/lib/cores/IsElectron.ts +3 -0
- package/src/lib/multipleRunner/lib/cores/ProcessClass.ts +8 -0
- package/src/lib/multipleRunner/lib/cores/ThreadClass.ts +8 -0
- package/src/lib/multipleRunner/lib/cores/UniParentBridgeHandler.ts +97 -0
- package/src/lib/multipleRunner/lib/prototypes/MultipleRunnerBaseClass.ts +66 -0
- package/src/plugins/Crypto.ts +3 -3
- package/src/plugins/Formatter.ts +10 -5
- package/src/plugins/Logger.ts +8 -2
- package/src/plugins/Shell.ts +371 -0
- package/src/tests/Main.spec.ts +11 -6
- package/src/tests/threads/TestThread.ts +3 -1
- package/src/types/TPluginsConfig.ts +1 -1
- package/src/utils/ValidDataUrl.ts +8 -0
|
@@ -30,7 +30,7 @@ class Security extends Plugin_1.Plugin {
|
|
|
30
30
|
letters: true,
|
|
31
31
|
specials: false
|
|
32
32
|
}) {
|
|
33
|
-
return string_random_1.default(length, {
|
|
33
|
+
return (0, string_random_1.default)(length, {
|
|
34
34
|
numbers: options.numbers === undefined ? true : options.numbers,
|
|
35
35
|
letters: options.letters === undefined ? true : options.letters,
|
|
36
36
|
specials: options.specials === undefined ? false : options.specials
|
|
@@ -39,64 +39,64 @@ class Security extends Plugin_1.Plugin {
|
|
|
39
39
|
MD5(data, key) {
|
|
40
40
|
const stringData = typeof data === 'string' ? data : this.JSON.stringify(data);
|
|
41
41
|
if (key) {
|
|
42
|
-
return crypto_js_1.HmacMD5(stringData, key).toString();
|
|
42
|
+
return (0, crypto_js_1.HmacMD5)(stringData, key).toString();
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
return crypto_js_1.MD5(stringData).toString();
|
|
45
|
+
return (0, crypto_js_1.MD5)(stringData).toString();
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
SHA1(data, key) {
|
|
49
49
|
const stringData = typeof data === 'string' ? data : this.JSON.stringify(data);
|
|
50
50
|
if (key) {
|
|
51
|
-
return crypto_js_1.HmacSHA1(stringData, key).toString();
|
|
51
|
+
return (0, crypto_js_1.HmacSHA1)(stringData, key).toString();
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
|
-
return crypto_js_1.SHA1(stringData).toString();
|
|
54
|
+
return (0, crypto_js_1.SHA1)(stringData).toString();
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
SHA3(data, key) {
|
|
58
58
|
const stringData = typeof data === 'string' ? data : this.JSON.stringify(data);
|
|
59
59
|
if (key) {
|
|
60
|
-
return crypto_js_1.HmacSHA3(stringData, key).toString();
|
|
60
|
+
return (0, crypto_js_1.HmacSHA3)(stringData, key).toString();
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
return crypto_js_1.SHA3(stringData).toString();
|
|
63
|
+
return (0, crypto_js_1.SHA3)(stringData).toString();
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
SHA224(data, key) {
|
|
67
67
|
const stringData = typeof data === 'string' ? data : this.JSON.stringify(data);
|
|
68
68
|
if (key) {
|
|
69
|
-
return crypto_js_1.HmacSHA224(stringData, key).toString();
|
|
69
|
+
return (0, crypto_js_1.HmacSHA224)(stringData, key).toString();
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
72
|
-
return crypto_js_1.SHA224(stringData).toString();
|
|
72
|
+
return (0, crypto_js_1.SHA224)(stringData).toString();
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
SHA256(data, key) {
|
|
76
76
|
const stringData = typeof data === 'string' ? data : this.JSON.stringify(data);
|
|
77
77
|
if (key) {
|
|
78
|
-
return crypto_js_1.HmacSHA256(stringData, key).toString();
|
|
78
|
+
return (0, crypto_js_1.HmacSHA256)(stringData, key).toString();
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
|
-
return crypto_js_1.SHA256(stringData).toString();
|
|
81
|
+
return (0, crypto_js_1.SHA256)(stringData).toString();
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
SHA384(data, key) {
|
|
85
85
|
const stringData = typeof data === 'string' ? data : this.JSON.stringify(data);
|
|
86
86
|
if (key) {
|
|
87
|
-
return crypto_js_1.HmacSHA384(stringData, key).toString();
|
|
87
|
+
return (0, crypto_js_1.HmacSHA384)(stringData, key).toString();
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
|
-
return crypto_js_1.SHA384(stringData).toString();
|
|
90
|
+
return (0, crypto_js_1.SHA384)(stringData).toString();
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
SHA512(data, key) {
|
|
94
94
|
const stringData = typeof data === 'string' ? data : this.JSON.stringify(data);
|
|
95
95
|
if (key) {
|
|
96
|
-
return crypto_js_1.HmacSHA512(stringData, key).toString();
|
|
96
|
+
return (0, crypto_js_1.HmacSHA512)(stringData, key).toString();
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
|
-
return crypto_js_1.SHA512(stringData).toString();
|
|
99
|
+
return (0, crypto_js_1.SHA512)(stringData).toString();
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
encryptByPassword(data, password) {
|
|
@@ -114,30 +114,30 @@ class Security extends Plugin_1.Plugin {
|
|
|
114
114
|
return this.Crypto.decrypt(ciphertext, secretKey);
|
|
115
115
|
}
|
|
116
116
|
generatePasswordHashSync(password) {
|
|
117
|
-
const salt = bcryptjs_1.genSaltSync(this.saltRound);
|
|
118
|
-
return bcryptjs_1.hashSync(password, salt);
|
|
117
|
+
const salt = (0, bcryptjs_1.genSaltSync)(this.saltRound);
|
|
118
|
+
return (0, bcryptjs_1.hashSync)(password, salt);
|
|
119
119
|
}
|
|
120
120
|
async generatePasswordHash(password) {
|
|
121
|
-
const salt = await bcryptjs_1.genSalt(this.saltRound);
|
|
122
|
-
return await bcryptjs_1.hash(password, salt);
|
|
121
|
+
const salt = await (0, bcryptjs_1.genSalt)(this.saltRound);
|
|
122
|
+
return await (0, bcryptjs_1.hash)(password, salt);
|
|
123
123
|
}
|
|
124
124
|
validatePasswordSync(password, hash) {
|
|
125
|
-
return bcryptjs_1.compareSync(password, hash);
|
|
125
|
+
return (0, bcryptjs_1.compareSync)(password, hash);
|
|
126
126
|
}
|
|
127
127
|
async validatePassword(password, hash) {
|
|
128
|
-
return await bcryptjs_1.compare(password, hash);
|
|
128
|
+
return await (0, bcryptjs_1.compare)(password, hash);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
__decorate([
|
|
132
|
-
DependencyInjection_1.Inject('JSON'),
|
|
132
|
+
(0, DependencyInjection_1.Inject)('JSON'),
|
|
133
133
|
__metadata("design:type", JSON_1.JSON)
|
|
134
134
|
], Security.prototype, "JSON", void 0);
|
|
135
135
|
__decorate([
|
|
136
|
-
DependencyInjection_1.Inject('Crypto'),
|
|
136
|
+
(0, DependencyInjection_1.Inject)('Crypto'),
|
|
137
137
|
__metadata("design:type", Crypto_1.Crypto)
|
|
138
138
|
], Security.prototype, "Crypto", void 0);
|
|
139
139
|
__decorate([
|
|
140
|
-
DependencyInjection_1.Configurable(),
|
|
140
|
+
(0, DependencyInjection_1.Configurable)(),
|
|
141
141
|
__metadata("design:type", Number)
|
|
142
142
|
], Security.prototype, "saltRound", void 0);
|
|
143
143
|
exports.Security = Security;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Security.js","sourceRoot":"","sources":["../../src/plugins/Security.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kEAAwC;AACxC,yCAiBkB;AAClB,uCAAmF;AACnF,2CAAqC;AACrC,iCAA2B;AAC3B,qCAA+B;AAC/B,2EAAsE;AAQtE,MAAa,QAAS,SAAQ,eAAM;IAApC;;QAaoB,cAAS,GAAW,CAAC,CAAA;IAqNzC,CAAC;IA7MO,oBAAoB,CAAC,SAAiB,EAAE,EAAE,UAAgG;QAChJ,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,KAAK;KACf;QACA,OAAO,uBAAY,
|
|
1
|
+
{"version":3,"file":"Security.js","sourceRoot":"","sources":["../../src/plugins/Security.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kEAAwC;AACxC,yCAiBkB;AAClB,uCAAmF;AACnF,2CAAqC;AACrC,iCAA2B;AAC3B,qCAA+B;AAC/B,2EAAsE;AAQtE,MAAa,QAAS,SAAQ,eAAM;IAApC;;QAaoB,cAAS,GAAW,CAAC,CAAA;IAqNzC,CAAC;IA7MO,oBAAoB,CAAC,SAAiB,EAAE,EAAE,UAAgG;QAChJ,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,KAAK;KACf;QACA,OAAO,IAAA,uBAAY,EAAC,MAAM,EAAE;YAC3B,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO;YAC/D,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO;YAC/D,QAAQ,EAAE,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ;SACnE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;QACjD,MAAM,IAAI,GAAW,MAAM,IAAA,kBAAO,EAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAClD,OAAO,MAAM,IAAA,eAAI,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IAClC,CAAC;IAQM,oBAAoB,CAAC,QAAgB,EAAE,IAAY;QACzD,OAAO,IAAA,sBAAW,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;IAQM,KAAK,CAAC,gBAAgB,CAAC,QAAgB,EAAE,IAAY;QAC3D,OAAO,MAAM,IAAA,kBAAO,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACrC,CAAC;CACD;AAhOA;IADC,IAAA,4BAAM,EAAC,MAAM,CAAC;8BACQ,WAAI;sCAAA;AAG3B;IADC,IAAA,4BAAM,EAAC,QAAQ,CAAC;8BACQ,eAAM;wCAAA;AAQ/B;IADC,IAAA,kCAAY,GAAE;;2CACyB;AAbzC,4BAkOC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Plugin } from '../base/Plugin';
|
|
2
|
+
import { CatFunction, ChmodFunction, CopyFunction, DirsFunction, EchoFunction, ExecFunction, FindFunction, GrepFunction, HeadFunction, LinkFunction, ListFunction, MkdirFunction, MoveFunction, PopDirFunction, PushDirFunction, RemoveFunction, SedFunction, ShellString, SortFunction, TailFunction, TestOptions, TouchFunction, UniqFunction } from '../interfaces/ShellJsInterfaces';
|
|
3
|
+
declare module '../Core' {
|
|
4
|
+
interface Application {
|
|
5
|
+
Shell: Shell;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare class Shell extends Plugin {
|
|
9
|
+
protected shelljs: any;
|
|
10
|
+
cd(dir?: string): ShellString;
|
|
11
|
+
pwd(): ShellString;
|
|
12
|
+
test(option: TestOptions, path: string): boolean;
|
|
13
|
+
which(command: string): ShellString;
|
|
14
|
+
exit(code?: number): never;
|
|
15
|
+
tempdir(): ShellString;
|
|
16
|
+
error(): ShellString;
|
|
17
|
+
set(options: string): void;
|
|
18
|
+
ls: ListFunction;
|
|
19
|
+
find: FindFunction;
|
|
20
|
+
cp: CopyFunction;
|
|
21
|
+
rm: RemoveFunction;
|
|
22
|
+
mv: MoveFunction;
|
|
23
|
+
mkdir: MkdirFunction;
|
|
24
|
+
cat: CatFunction;
|
|
25
|
+
sed: SedFunction;
|
|
26
|
+
grep: GrepFunction;
|
|
27
|
+
echo: EchoFunction;
|
|
28
|
+
pushd: PushDirFunction;
|
|
29
|
+
popd: PopDirFunction;
|
|
30
|
+
dirs: DirsFunction;
|
|
31
|
+
ln: LinkFunction;
|
|
32
|
+
exec: ExecFunction;
|
|
33
|
+
chmod: ChmodFunction;
|
|
34
|
+
touch: TouchFunction;
|
|
35
|
+
head: HeadFunction;
|
|
36
|
+
sort: SortFunction;
|
|
37
|
+
tail: TailFunction;
|
|
38
|
+
uniq: UniqFunction;
|
|
39
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Shell = void 0;
|
|
4
|
+
const Plugin_1 = require("../base/Plugin");
|
|
5
|
+
const shelljs = require('../lib/minified/ShellJs');
|
|
6
|
+
class Shell extends Plugin_1.Plugin {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.shelljs = shelljs;
|
|
10
|
+
this.ls = this.shelljs.ls;
|
|
11
|
+
this.find = this.shelljs.find;
|
|
12
|
+
this.cp = this.shelljs.cp;
|
|
13
|
+
this.rm = this.shelljs.rm;
|
|
14
|
+
this.mv = this.shelljs.mv;
|
|
15
|
+
this.mkdir = this.shelljs.mkdir;
|
|
16
|
+
this.cat = this.shelljs.cat;
|
|
17
|
+
this.sed = this.shelljs.sed;
|
|
18
|
+
this.grep = this.shelljs.grep;
|
|
19
|
+
this.echo = this.shelljs.echo;
|
|
20
|
+
this.pushd = this.shelljs.pushd;
|
|
21
|
+
this.popd = this.shelljs.popd;
|
|
22
|
+
this.dirs = this.shelljs.dirs;
|
|
23
|
+
this.ln = this.shelljs.ln;
|
|
24
|
+
this.exec = this.shelljs.exec;
|
|
25
|
+
this.chmod = this.shelljs.chmod;
|
|
26
|
+
this.touch = this.shelljs.touch;
|
|
27
|
+
this.head = this.shelljs.head;
|
|
28
|
+
this.sort = this.shelljs.sort;
|
|
29
|
+
this.tail = this.shelljs.tail;
|
|
30
|
+
this.uniq = this.shelljs.uniq;
|
|
31
|
+
}
|
|
32
|
+
cd(dir) {
|
|
33
|
+
return this.shelljs.cd(dir);
|
|
34
|
+
}
|
|
35
|
+
pwd() {
|
|
36
|
+
return this.shelljs.pwd();
|
|
37
|
+
}
|
|
38
|
+
test(option, path) {
|
|
39
|
+
return this.shelljs.test(option, path);
|
|
40
|
+
}
|
|
41
|
+
which(command) {
|
|
42
|
+
return this.shelljs.which(command);
|
|
43
|
+
}
|
|
44
|
+
exit(code) {
|
|
45
|
+
return this.shelljs.exit(code);
|
|
46
|
+
}
|
|
47
|
+
tempdir() {
|
|
48
|
+
return this.shelljs.tempdir();
|
|
49
|
+
}
|
|
50
|
+
error() {
|
|
51
|
+
return this.shelljs.error();
|
|
52
|
+
}
|
|
53
|
+
set(options) {
|
|
54
|
+
return this.shelljs.set(options);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.Shell = Shell;
|
|
58
|
+
//# sourceMappingURL=Shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shell.js","sourceRoot":"","sources":["../../src/plugins/Shell.ts"],"names":[],"mappings":";;;AAAA,2CAAqC;AA2BrC,MAAM,OAAO,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AAQlD,MAAa,KAAM,SAAQ,eAAM;IAAjC;;QACW,YAAO,GAAQ,OAAO,CAAA;QAwGzB,OAAE,GAAiB,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QAQlC,SAAI,GAAiB,IAAI,CAAC,OAAO,C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AAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAA;IAC1B,CAAC;IAiBM,IAAI,CAAC,MAAmB,EAAE,IAAY;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACvC,CAAC;IAQM,KAAK,CAAC,OAAe;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;IASM,IAAI,CAAC,IAAa;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAU,CAAA;IACxC,CAAC;IAQM,OAAO;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAA;IAC9B,CAAC;IAOM,KAAK;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;IAC5B,CAAC;IASM,GAAG,CAAC,OAAe;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC;CAqPD;AA/UD,sBA+UC"}
|
|
@@ -2,5 +2,6 @@ import { IConstructor } from '../interfaces/IConstructor';
|
|
|
2
2
|
import { Plugin } from '../base/Plugin';
|
|
3
3
|
export declare type TPluginsConfig<TPlugin extends Plugin = Plugin> = ({
|
|
4
4
|
class: IConstructor<TPlugin>;
|
|
5
|
+
scope?: 'Transient' | 'Singleton';
|
|
5
6
|
[propertyKey: string]: any;
|
|
6
7
|
} | IConstructor<TPlugin>)[];
|
package/build/utils/Delay.js
CHANGED
package/build/utils/Delay.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Delay.js","sourceRoot":"","sources":["../../src/utils/Delay.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AAO1B,KAAK,UAAU,KAAK,CAAC,YAAoB;IAC/C,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC5B,mBAAU,
|
|
1
|
+
{"version":3,"file":"Delay.js","sourceRoot":"","sources":["../../src/utils/Delay.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AAO1B,KAAK,UAAU,KAAK,CAAC,YAAoB;IAC/C,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE;YACf,OAAO,EAAE,CAAA;QACV,CAAC,EAAE,YAAY,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACH,CAAC;AAND,sBAMC"}
|
package/build/utils/Timeout.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.timeout = void 0;
|
|
|
7
7
|
const p_timeout_1 = __importDefault(require("p-timeout"));
|
|
8
8
|
const TimeoutException_1 = require("../exceptions/TimeoutException");
|
|
9
9
|
async function timeout(p, milliseconds, messageOrFallback) {
|
|
10
|
-
return p_timeout_1.default(p, milliseconds, async () => {
|
|
10
|
+
return (0, p_timeout_1.default)(p, milliseconds, async () => {
|
|
11
11
|
if (messageOrFallback) {
|
|
12
12
|
switch (typeof messageOrFallback) {
|
|
13
13
|
case 'function':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeout.js","sourceRoot":"","sources":["../../src/utils/Timeout.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAgC;AAEhC,qEAA+D;AASxD,KAAK,UAAU,OAAO,CAAI,CAAa,EAAE,YAAoB,EAAE,iBAA+D;IACpI,OAAO,mBAAQ,
|
|
1
|
+
{"version":3,"file":"Timeout.js","sourceRoot":"","sources":["../../src/utils/Timeout.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAgC;AAEhC,qEAA+D;AASxD,KAAK,UAAU,OAAO,CAAI,CAAa,EAAE,YAAoB,EAAE,iBAA+D;IACpI,OAAO,IAAA,mBAAQ,EAAC,CAAC,EAAE,YAAY,EAAE,KAAK,IAAI,EAAE;QAC3C,IAAI,iBAAiB,EAAE;YACtB,QAAQ,OAAO,iBAAiB,EAAE;gBACjC,KAAK,UAAU;oBACd,OAAO,CAAC,MAAM,iBAAiB,EAAE,CAAQ,CAAA;gBAC1C,KAAK,QAAQ;oBACZ,MAAM,IAAI,mCAAgB,CAAC,iBAAiB,CAAC,CAAA;gBAC9C,KAAK,QAAQ;oBACZ,MAAM,iBAAiB,CAAA;aACxB;SACD;aAAM;YACN,MAAM,IAAI,mCAAgB,CAAC,2BAA2B,YAAY,eAAe,CAAC,CAAA;SAClF;IACF,CAAC,CAAC,CAAA;AACH,CAAC;AAfD,0BAeC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function validDataUrl(candidate: string): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validDataUrl = void 0;
|
|
4
|
+
function validDataUrl(candidate) {
|
|
5
|
+
return /^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(candidate);
|
|
6
|
+
}
|
|
7
|
+
exports.validDataUrl = validDataUrl;
|
|
8
|
+
//# sourceMappingURL=ValidDataUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidDataUrl.js","sourceRoot":"","sources":["../../src/utils/ValidDataUrl.ts"],"names":[],"mappings":";;;AAKA,SAAgB,YAAY,CAAC,SAAiB;IAC7C,OAAO,uIAAuI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AAC/J,CAAC;AAFD,oCAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lakutata/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
4
4
|
"description": "Lakutata Framework Core",
|
|
5
5
|
"main": "./build/Core.js",
|
|
6
6
|
"types": "./build/Core.d.ts",
|
|
@@ -53,26 +53,26 @@
|
|
|
53
53
|
"author": "alex.ma",
|
|
54
54
|
"license": "MIT",
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@thiagodelgado111/yup-phone": "^0.0.2",
|
|
57
56
|
"bcryptjs": "^2.4.3",
|
|
58
57
|
"crypto-js": "^4.1.1",
|
|
59
|
-
"
|
|
58
|
+
"google-libphonenumber": "^3.2.25",
|
|
60
59
|
"inversify": "^5.1.1",
|
|
61
60
|
"is-ssh": "^1.3.3",
|
|
62
61
|
"json-helpers": "^5.1.4",
|
|
63
62
|
"json5": "^2.2.0",
|
|
64
63
|
"lodash.mapvalues": "^4.6.0",
|
|
65
|
-
"memfs": "^3.
|
|
64
|
+
"memfs": "^3.4.0",
|
|
66
65
|
"merge-deep": "^3.0.3",
|
|
67
66
|
"moment": "^2.29.1",
|
|
67
|
+
"moment-timezone": "^0.5.34",
|
|
68
68
|
"msgpack5": "^5.3.2",
|
|
69
69
|
"needle": "^2.9.1",
|
|
70
70
|
"node-rsa": "^1.1.1",
|
|
71
71
|
"p-timeout": "^4.1.0",
|
|
72
72
|
"pupa": "^2.1.1",
|
|
73
|
+
"random": "^3.0.6",
|
|
73
74
|
"reflect-metadata": "^0.1.13",
|
|
74
75
|
"string-random": "^0.1.3",
|
|
75
|
-
"valid-data-url": "^3.0.1",
|
|
76
76
|
"winston": "^3.3.3",
|
|
77
77
|
"winston-transport": "^4.4.0",
|
|
78
78
|
"yup": "^0.32.11"
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"@types/bcryptjs": "^2.4.2",
|
|
82
82
|
"@types/chai": "^4.2.14",
|
|
83
83
|
"@types/crypto-js": "^4.0.2",
|
|
84
|
+
"@types/google-libphonenumber": "^7.4.23",
|
|
84
85
|
"@types/is-ssh": "^1.3.0",
|
|
85
86
|
"@types/lodash.mapvalues": "^4.6.6",
|
|
86
87
|
"@types/merge-deep": "^3.0.0",
|
package/src/Application.ts
CHANGED
|
@@ -10,9 +10,10 @@ import {MessagePack} from './plugins/MessagePack'
|
|
|
10
10
|
import {JSON} from './plugins/JSON'
|
|
11
11
|
import {TWorkflowsConfig} from './types/TWorkflowsConfig'
|
|
12
12
|
import {Logger} from './plugins/Logger'
|
|
13
|
-
import {format} from 'winston'
|
|
14
13
|
import {TProcessesConfig} from './types/TProcessesConfig'
|
|
15
14
|
import {TThreadsConfig} from './types/TThreadsConfig'
|
|
15
|
+
import momentTimezone from 'moment-timezone'
|
|
16
|
+
import {Shell} from './plugins/Shell'
|
|
16
17
|
|
|
17
18
|
export class Application extends Module {
|
|
18
19
|
/**
|
|
@@ -64,6 +65,9 @@ export class Application extends Module {
|
|
|
64
65
|
{
|
|
65
66
|
class: JSON
|
|
66
67
|
},
|
|
68
|
+
{
|
|
69
|
+
class: Shell
|
|
70
|
+
},
|
|
67
71
|
{
|
|
68
72
|
class: Formatter,
|
|
69
73
|
dateFormat: 'YYYY-MM-DD HH:mm:ss'
|
|
@@ -76,16 +80,6 @@ export class Application extends Module {
|
|
|
76
80
|
appId: process.env.appId,
|
|
77
81
|
appName: process.env.appName
|
|
78
82
|
},
|
|
79
|
-
console: {
|
|
80
|
-
silent: false,
|
|
81
|
-
format: format.combine(
|
|
82
|
-
format.timestamp({format: 'YYYY-MM-DD HH:mm:ss'}),
|
|
83
|
-
format.colorize(),
|
|
84
|
-
format.printf(packet => {
|
|
85
|
-
return `${packet.timestamp} ${packet.level}: ${packet.message}`
|
|
86
|
-
})
|
|
87
|
-
)
|
|
88
|
-
},
|
|
89
83
|
transports: []
|
|
90
84
|
}
|
|
91
85
|
]
|
|
@@ -125,6 +119,18 @@ export class Application extends Module {
|
|
|
125
119
|
*/
|
|
126
120
|
protected readonly workflows: TWorkflowsConfig = []
|
|
127
121
|
|
|
122
|
+
/**
|
|
123
|
+
* 程序时区
|
|
124
|
+
* @type {string}
|
|
125
|
+
* @protected
|
|
126
|
+
*/
|
|
127
|
+
protected tz: string = (() => {
|
|
128
|
+
if (!process.env.TZ) {
|
|
129
|
+
process.env.TZ = momentTimezone.tz.guess()
|
|
130
|
+
}
|
|
131
|
+
return process.env.TZ
|
|
132
|
+
})()
|
|
133
|
+
|
|
128
134
|
/**
|
|
129
135
|
* 初始化
|
|
130
136
|
* @returns {Promise<void>}
|
|
@@ -137,6 +143,22 @@ export class Application extends Module {
|
|
|
137
143
|
})
|
|
138
144
|
}
|
|
139
145
|
|
|
146
|
+
/**
|
|
147
|
+
* 获取程序时区
|
|
148
|
+
* @returns {string}
|
|
149
|
+
*/
|
|
150
|
+
public getTimezone() {
|
|
151
|
+
return this.tz
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 设置程序时区
|
|
156
|
+
* @param {string} tz
|
|
157
|
+
*/
|
|
158
|
+
public setTimezone(tz: string) {
|
|
159
|
+
this.tz = tz
|
|
160
|
+
}
|
|
161
|
+
|
|
140
162
|
/**
|
|
141
163
|
* 获取应用程序ID
|
|
142
164
|
* @returns {string}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import momentTimezone from 'moment-timezone'
|
|
2
|
+
|
|
1
3
|
require('events').captureRejections = true
|
|
2
4
|
import {IApplicationConfig} from './interfaces/IApplicationConfig'
|
|
3
5
|
import {Application} from './Application'
|
|
@@ -19,10 +21,11 @@ export async function createApp(config: IApplicationConfig): Promise<Application
|
|
|
19
21
|
process.title = config.id
|
|
20
22
|
process.env.appId = config.id
|
|
21
23
|
process.env.appName = config.name
|
|
24
|
+
process.env.TZ = config.timezone ? config.timezone : momentTimezone.tz.guess()
|
|
22
25
|
await coreContainer.initialize()
|
|
23
26
|
return coreContainer.getModule(Application)
|
|
24
27
|
} catch (e) {
|
|
25
|
-
throw new FatalException(e.message)
|
|
28
|
+
throw new FatalException((e as Error).message)
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
|
package/src/base/Container.ts
CHANGED
|
@@ -83,12 +83,25 @@ export class Container<TObject extends BaseObject = BaseObject, TPlugin extends
|
|
|
83
83
|
* @param {IConstructor<TPlugin>} pluginConstructor
|
|
84
84
|
* @param {string} identifier
|
|
85
85
|
* @param {object} config
|
|
86
|
-
* @param {"Transient" | "Singleton"} scope
|
|
87
86
|
*/
|
|
88
87
|
public bindPlugin(pluginConstructor: IConstructor<TPlugin>, identifier: string, config: object): void {
|
|
88
|
+
const scope = config['scope'] ? config['scope'] : 'Transient'
|
|
89
89
|
const pluginConfiguration = config ? config : {}
|
|
90
90
|
if (this.pluginIoC.isBound(identifier)) return
|
|
91
91
|
const binding = this.pluginIoC.bind(identifier).to(pluginConstructor)
|
|
92
|
+
switch (scope) {
|
|
93
|
+
case 'Transient': {
|
|
94
|
+
binding.inTransientScope()
|
|
95
|
+
}
|
|
96
|
+
break
|
|
97
|
+
case 'Singleton': {
|
|
98
|
+
binding.inSingletonScope()
|
|
99
|
+
}
|
|
100
|
+
break
|
|
101
|
+
default: {
|
|
102
|
+
binding.inTransientScope()
|
|
103
|
+
}
|
|
104
|
+
}
|
|
92
105
|
binding.onActivation((context, injectable) => {
|
|
93
106
|
const onActivationFunc = function (this: TPlugin) {
|
|
94
107
|
const pluginConfigurationKeys = Object.keys(pluginConfiguration)
|
|
@@ -25,11 +25,11 @@ import {OptionalArraySchema} from 'yup/lib/array'
|
|
|
25
25
|
import Reference, {ReferenceOptions} from 'yup/lib/Reference'
|
|
26
26
|
import mapValues from 'lodash/mapValues'
|
|
27
27
|
import {ValidationException} from '../exceptions/ValidationException'
|
|
28
|
-
import phoneValidationMethod, {YUP_METHOD as PHONE_METHOD} from '@thiagodelgado111/yup-phone'
|
|
29
28
|
import isSsh from 'is-ssh'
|
|
30
|
-
import validDataUrl from 'valid-data-url'
|
|
31
29
|
import {MixedSchema} from 'yup/lib/mixed'
|
|
32
30
|
import {BaseObject} from './BaseObject'
|
|
31
|
+
import gPhoneNumber from 'google-libphonenumber'
|
|
32
|
+
import {validDataUrl} from '../utils/ValidDataUrl'
|
|
33
33
|
|
|
34
34
|
declare module 'yup' {
|
|
35
35
|
interface StringSchema {
|
|
@@ -44,13 +44,15 @@ declare module 'yup' {
|
|
|
44
44
|
dataUrl(): StringSchema
|
|
45
45
|
|
|
46
46
|
url(option?: { acceptParams?: boolean; protocol?: string[] | string; blackHostnameList?: string[]; whiteHostnameList?: string[] }): StringSchema
|
|
47
|
+
|
|
48
|
+
phone(countryCode?: string, strict?: boolean): StringSchema
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
interface ObjectSchema<TShape extends ObjectShape, TContext extends AnyObject = AnyObject, TIn extends Maybe<TypeOfShape<TShape>> = TypeOfShape<TShape>, TOut extends Maybe<AssertsShape<TShape>> = AssertsShape<TShape> | Optionals<TIn>> extends BaseSchema<TIn, TContext, TOut> {
|
|
50
52
|
structure(valueSchema: AnySchema): OptionalObjectSchema<TShape, Record<string, any>, TypeOfShape<TShape>>
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
|
-
|
|
55
|
+
const PHONE_METHOD = 'phone'
|
|
54
56
|
const IPV4_METHOD = 'ipv4'
|
|
55
57
|
const IPV6_METHOD = 'ipv6'
|
|
56
58
|
const IP_ALL_METHOD = 'ip'
|
|
@@ -515,7 +517,42 @@ export class ValidatorClass extends BaseObject {
|
|
|
515
517
|
|
|
516
518
|
constructor() {
|
|
517
519
|
super()
|
|
518
|
-
addMethod(string, PHONE_METHOD,
|
|
520
|
+
addMethod(string, PHONE_METHOD, function (this: StringSchema, countryCode?: string, strict: boolean = false) {
|
|
521
|
+
const phoneUtil = gPhoneNumber.PhoneNumberUtil.getInstance()
|
|
522
|
+
const CLDR_REGION_CODE_SIZE = 2
|
|
523
|
+
const isValidCountryCode = (countryCode: any): boolean => typeof countryCode === 'string' && countryCode.length === CLDR_REGION_CODE_SIZE
|
|
524
|
+
const errMsg = isValidCountryCode(countryCode)
|
|
525
|
+
? `\${path} must be a valid phone number for region ${countryCode}`
|
|
526
|
+
: '${path} must be a valid phone number.'
|
|
527
|
+
|
|
528
|
+
return this.test(<any>{
|
|
529
|
+
name: PHONE_METHOD,
|
|
530
|
+
message: errMsg,
|
|
531
|
+
test(value: string) {
|
|
532
|
+
if (this.schema._nullable && value === null) {
|
|
533
|
+
return this.resolve(true)
|
|
534
|
+
}
|
|
535
|
+
if (!isValidCountryCode(countryCode)) {
|
|
536
|
+
countryCode = 'US'
|
|
537
|
+
strict = false
|
|
538
|
+
}
|
|
539
|
+
let isValid
|
|
540
|
+
try {
|
|
541
|
+
const phoneNumber = phoneUtil.parseAndKeepRawInput(value, countryCode)
|
|
542
|
+
if (!phoneUtil.isPossibleNumber(phoneNumber)) {
|
|
543
|
+
return false
|
|
544
|
+
}
|
|
545
|
+
const regionCodeFromPhoneNumber = phoneUtil.getRegionCodeForNumber(phoneNumber)
|
|
546
|
+
isValid = strict
|
|
547
|
+
? phoneUtil.isValidNumberForRegion(phoneNumber, countryCode)
|
|
548
|
+
: phoneUtil.isValidNumberForRegion(phoneNumber, regionCodeFromPhoneNumber)
|
|
549
|
+
} catch (error) {
|
|
550
|
+
isValid = false
|
|
551
|
+
}
|
|
552
|
+
return this.resolve(isValid)
|
|
553
|
+
}
|
|
554
|
+
})
|
|
555
|
+
})
|
|
519
556
|
addMethod(string, IPV4_METHOD, function (this: StringSchema, message = 'Invalid IP address') {
|
|
520
557
|
return this.matches(/(^(\d{1,3}\.){3}(\d{1,3})$)/, {
|
|
521
558
|
message,
|
|
@@ -668,7 +705,7 @@ export class ValidatorClass extends BaseObject {
|
|
|
668
705
|
try {
|
|
669
706
|
return await schema.validate(data, {strict: true})
|
|
670
707
|
} catch (e) {
|
|
671
|
-
throw this.generateException(ValidationException,e.message)
|
|
708
|
+
throw this.generateException(ValidationException, (e as Error).message)
|
|
672
709
|
}
|
|
673
710
|
}
|
|
674
711
|
|
|
@@ -682,7 +719,7 @@ export class ValidatorClass extends BaseObject {
|
|
|
682
719
|
try {
|
|
683
720
|
return schema.validateSync(data, {strict: true})
|
|
684
721
|
} catch (e) {
|
|
685
|
-
throw this.generateException(ValidationException,e.message)
|
|
722
|
+
throw this.generateException(ValidationException, (e as Error).message)
|
|
686
723
|
}
|
|
687
724
|
}
|
|
688
725
|
|
|
@@ -705,4 +742,4 @@ export class ValidatorClass extends BaseObject {
|
|
|
705
742
|
public isValidSync<SchemaType extends AnySchema, DataType = any>(schema: SchemaType, data: DataType): boolean {
|
|
706
743
|
return schema.isValidSync(data, {strict: true})
|
|
707
744
|
}
|
|
708
|
-
}
|
|
745
|
+
}
|
|
@@ -160,12 +160,13 @@ export abstract class Module extends BaseObject {
|
|
|
160
160
|
* @protected
|
|
161
161
|
*/
|
|
162
162
|
protected bindPlugins(): void {
|
|
163
|
+
//todo 可能需要合并一下多个相同插件的配置
|
|
163
164
|
if (!this.plugins) return
|
|
164
165
|
const reversedPlugins = this.plugins.reverse()
|
|
165
166
|
const registeredPluginSet = new Set()
|
|
166
167
|
for (const pluginConstructorOrConfig of reversedPlugins) {
|
|
167
168
|
let pluginConstructor
|
|
168
|
-
let pluginConfig: object = {}
|
|
169
|
+
let pluginConfig: object & { scope?: 'Transient' | 'Singleton' } = {}
|
|
169
170
|
if (typeof pluginConstructorOrConfig === 'object') {
|
|
170
171
|
pluginConstructor = pluginConstructorOrConfig.class
|
|
171
172
|
for (const configKey of Object.keys(pluginConstructorOrConfig)) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {Process} from './Process'
|
|
2
|
-
import {ProxyClass} from 'ergate'
|
|
3
2
|
import {IProcessConstructor} from '../../interfaces/IProcessConstructor'
|
|
4
|
-
import {Process as processCreate} from 'ergate'
|
|
5
3
|
import {ProcessException} from '../../exceptions/ProcessException'
|
|
4
|
+
import {ProxyClass} from '../../lib/multipleRunner/definitions/interfaces/ProxyClass'
|
|
5
|
+
import {Process as processCreate} from '../../lib/multipleRunner/lib/Process'
|
|
6
6
|
|
|
7
7
|
export class ProcessManager<TProcess extends Process = Process> {
|
|
8
8
|
protected readonly processMap: Map<IProcessConstructor<TProcess>, TProcess & ProxyClass> = new Map()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {Thread} from './Thread'
|
|
2
2
|
import {IThreadConstructor} from '../../interfaces/IThreadConstructor'
|
|
3
|
-
import {Thread as threadCreate} from 'ergate'
|
|
4
3
|
import {ThreadException} from '../../exceptions/ThreadException'
|
|
5
|
-
import {ProxyClass} from '
|
|
4
|
+
import {ProxyClass} from '../../lib/multipleRunner/definitions/interfaces/ProxyClass'
|
|
5
|
+
import {Thread as threadCreate} from '../../lib/multipleRunner/lib/Thread'
|
|
6
6
|
|
|
7
7
|
export class ThreadManager<TThread extends Thread = Thread> {
|
|
8
8
|
protected readonly threadMap: Map<IThreadConstructor<TThread>, TThread & ProxyClass> = new Map()
|