@nu-art/ts-common 0.300.8 → 0.400.1
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/consts/consts.js +2 -4
- package/consts/consts.js.map +1 -0
- package/core/application.d.ts +1 -1
- package/core/application.js +3 -6
- package/core/application.js.map +1 -0
- package/core/debug-flags.d.ts +1 -1
- package/core/debug-flags.js +15 -17
- package/core/debug-flags.js.map +1 -0
- package/core/dispatcher.d.ts +2 -2
- package/core/dispatcher.js +7 -8
- package/core/dispatcher.js.map +1 -0
- package/core/error-handling.d.ts +5 -5
- package/core/error-handling.js +7 -9
- package/core/error-handling.js.map +1 -0
- package/core/exceptions/exceptions.d.ts +2 -2
- package/core/exceptions/exceptions.js +33 -44
- package/core/exceptions/exceptions.js.map +1 -0
- package/core/exceptions/http-codes.d.ts +8 -2
- package/core/exceptions/http-codes.js +6 -6
- package/core/exceptions/http-codes.js.map +1 -0
- package/core/exceptions/types.js +2 -2
- package/core/exceptions/types.js.map +1 -0
- package/core/logger/BeLogged.d.ts +2 -2
- package/core/logger/BeLogged.js +9 -11
- package/core/logger/BeLogged.js.map +1 -0
- package/core/logger/LogClient.d.ts +3 -1
- package/core/logger/LogClient.js +21 -24
- package/core/logger/LogClient.js.map +1 -0
- package/core/logger/LogClient_BaseRotate.d.ts +2 -2
- package/core/logger/LogClient_BaseRotate.js +12 -12
- package/core/logger/LogClient_BaseRotate.js.map +1 -0
- package/core/logger/LogClient_Browser.d.ts +2 -2
- package/core/logger/LogClient_Browser.js +40 -45
- package/core/logger/LogClient_Browser.js.map +1 -0
- package/core/logger/LogClient_BrowserGroups.d.ts +2 -2
- package/core/logger/LogClient_BrowserGroups.js +65 -67
- package/core/logger/LogClient_BrowserGroups.js.map +1 -0
- package/core/logger/LogClient_ConsoleProxy.d.ts +23 -0
- package/core/logger/LogClient_ConsoleProxy.js +89 -0
- package/core/logger/LogClient_ConsoleProxy.js.map +1 -0
- package/core/logger/LogClient_File.d.ts +1 -1
- package/core/logger/LogClient_File.js +6 -30
- package/core/logger/LogClient_File.js.map +1 -0
- package/core/logger/LogClient_Function.d.ts +2 -2
- package/core/logger/LogClient_Function.js +6 -8
- package/core/logger/LogClient_Function.js.map +1 -0
- package/core/logger/LogClient_MemBuffer.d.ts +2 -2
- package/core/logger/LogClient_MemBuffer.js +19 -21
- package/core/logger/LogClient_MemBuffer.js.map +1 -0
- package/core/logger/LogClient_Terminal.d.ts +2 -2
- package/core/logger/LogClient_Terminal.js +16 -21
- package/core/logger/LogClient_Terminal.js.map +1 -0
- package/core/logger/Logger.d.ts +2 -2
- package/core/logger/Logger.js +37 -39
- package/core/logger/Logger.js.map +1 -0
- package/core/logger/types.js +4 -6
- package/core/logger/types.js.map +1 -0
- package/core/logger/utils.d.ts +1 -1
- package/core/logger/utils.js +10 -15
- package/core/logger/utils.js.map +1 -0
- package/core/module-manager.d.ts +8 -6
- package/core/module-manager.js +28 -26
- package/core/module-manager.js.map +1 -0
- package/core/module.d.ts +5 -5
- package/core/module.js +28 -28
- package/core/module.js.map +1 -0
- package/csv.d.ts +2 -2
- package/csv.js +3 -18
- package/csv.js.map +1 -0
- package/db/consts.d.ts +3 -0
- package/db/consts.js +17 -7
- package/db/consts.js.map +1 -0
- package/db/dependencies-test.js +2 -2
- package/db/dependencies-test.js.map +1 -0
- package/db/types.d.ts +10 -2
- package/db/types.js +2 -2
- package/db/types.js.map +1 -0
- package/esm.d.ts +1 -0
- package/esm.js +4 -0
- package/esm.js.map +1 -0
- package/index.d.ts +50 -49
- package/index.js +51 -65
- package/index.js.map +1 -0
- package/mem-storage/MemStorage.d.ts +3 -1
- package/mem-storage/MemStorage.js +90 -72
- package/mem-storage/MemStorage.js.map +1 -0
- package/mem-storage/index.d.ts +1 -0
- package/mem-storage/index.js +2 -0
- package/mem-storage/index.js.map +1 -0
- package/modules/CSVModule.d.ts +2 -2
- package/modules/CSVModule.js +22 -48
- package/modules/CSVModule.js.map +1 -0
- package/modules/CSVModuleV3.d.ts +2 -2
- package/modules/CSVModuleV3.js +60 -86
- package/modules/CSVModuleV3.js.map +1 -0
- package/modules/CliParamsModule.d.ts +2 -2
- package/modules/CliParamsModule.js +23 -28
- package/modules/CliParamsModule.js.map +1 -0
- package/modules/JSONCSVModule.d.ts +2 -2
- package/modules/JSONCSVModule.js +56 -78
- package/modules/JSONCSVModule.js.map +1 -0
- package/modules/csv-serializer.d.ts +1 -1
- package/modules/csv-serializer.js +11 -5
- package/modules/csv-serializer.js.map +1 -0
- package/package.json +20 -11
- package/replacer-v2/ReplacerV2.d.ts +1 -1
- package/replacer-v2/ReplacerV2.js +6 -9
- package/replacer-v2/ReplacerV2.js.map +1 -0
- package/test-index.d.ts +2 -2
- package/test-index.js +3 -18
- package/test-index.js.map +1 -0
- package/testing/consts.d.ts +13 -2
- package/testing/consts.js +66 -26
- package/testing/consts.js.map +1 -0
- package/testing/test-template.test.d.ts +1 -0
- package/testing/test-template.test.js +42 -0
- package/testing/test-template.test.js.map +1 -0
- package/testing/types.d.ts +17 -5
- package/testing/types.js +2 -2
- package/testing/types.js.map +1 -0
- package/testing/workspace-creator.d.ts +10 -0
- package/testing/workspace-creator.js +79 -0
- package/testing/workspace-creator.js.map +1 -0
- package/tools/Replacer.d.ts +2 -2
- package/tools/Replacer.js +22 -24
- package/tools/Replacer.js.map +1 -0
- package/tools/get-log-style.js +4 -6
- package/tools/get-log-style.js.map +1 -0
- package/utils/FileSystemUtils.d.ts +34 -0
- package/utils/FileSystemUtils.js +153 -0
- package/utils/FileSystemUtils.js.map +1 -0
- package/utils/array-tools.d.ts +4 -4
- package/utils/array-tools.js +56 -83
- package/utils/array-tools.js.map +1 -0
- package/utils/conflict-tools.d.ts +1 -0
- package/utils/conflict-tools.js +3 -0
- package/utils/conflict-tools.js.map +1 -0
- package/utils/crypto-tools.d.ts +44 -0
- package/utils/crypto-tools.js +101 -10
- package/utils/crypto-tools.js.map +1 -0
- package/utils/date-time-tools.d.ts +48 -4
- package/utils/date-time-tools.js +166 -64
- package/utils/date-time-tools.js.map +1 -0
- package/utils/db-object-tools.d.ts +7 -2
- package/utils/db-object-tools.js +20 -20
- package/utils/db-object-tools.js.map +1 -0
- package/utils/exception-tools.js +13 -15
- package/utils/exception-tools.js.map +1 -0
- package/utils/filter-tools.js +48 -48
- package/utils/filter-tools.js.map +1 -0
- package/utils/hash-tools.js +14 -22
- package/utils/hash-tools.js.map +1 -0
- package/utils/index.d.ts +27 -0
- package/utils/index.js +28 -0
- package/utils/index.js.map +1 -0
- package/utils/json-tools.js +5 -8
- package/utils/json-tools.js.map +1 -0
- package/utils/merge-tools.d.ts +9 -0
- package/utils/merge-tools.js +18 -19
- package/utils/merge-tools.js.map +1 -0
- package/utils/mimetype-tools.d.ts +1 -0
- package/utils/mimetype-tools.js +26 -27
- package/utils/mimetype-tools.js.map +1 -0
- package/utils/number-tools.js +3 -7
- package/utils/number-tools.js.map +1 -0
- package/utils/object-tools.d.ts +15 -1
- package/utils/object-tools.js +110 -33
- package/utils/object-tools.js.map +1 -0
- package/utils/promise-tools.d.ts +5 -0
- package/utils/promise-tools.js +9 -5
- package/utils/promise-tools.js.map +1 -0
- package/utils/query-params.js +3 -6
- package/utils/query-params.js.map +1 -0
- package/utils/queue-v2.d.ts +1 -1
- package/utils/queue-v2.js +72 -73
- package/utils/queue-v2.js.map +1 -0
- package/utils/queue.d.ts +1 -1
- package/utils/queue.js +15 -17
- package/utils/queue.js.map +1 -0
- package/utils/random-tools.js +7 -11
- package/utils/random-tools.js.map +1 -0
- package/utils/storage-capacity-tools.js +7 -9
- package/utils/storage-capacity-tools.js.map +1 -0
- package/utils/string-tools.js +17 -31
- package/utils/string-tools.js.map +1 -0
- package/utils/time-proxy.d.ts +8 -0
- package/utils/time-proxy.js +10 -0
- package/utils/time-proxy.js.map +1 -0
- package/utils/tools.d.ts +1 -1
- package/utils/tools.js +18 -28
- package/utils/tools.js.map +1 -0
- package/utils/types.d.ts +9 -3
- package/utils/types.js +2 -4
- package/utils/types.js.map +1 -0
- package/utils/ui-tools.js +6 -12
- package/utils/ui-tools.js.map +1 -0
- package/utils/url-tools.d.ts +5 -0
- package/utils/url-tools.js +20 -0
- package/utils/url-tools.js.map +1 -0
- package/utils/version-tools.js +17 -12
- package/utils/version-tools.js.map +1 -0
- package/validator/type-validators.d.ts +14 -10
- package/validator/type-validators.js +84 -105
- package/validator/type-validators.js.map +1 -0
- package/validator/validator-core.d.ts +4 -4
- package/validator/validator-core.js +16 -21
- package/validator/validator-core.js.map +1 -0
- package/validator/validators.d.ts +9 -5
- package/validator/validators.js +48 -47
- package/validator/validators.js.map +1 -0
- package/tsconfig.json +0 -23
package/utils/types.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* ts-common is the basic building blocks of our typescript projects
|
|
4
3
|
*
|
|
@@ -16,7 +15,6 @@
|
|
|
16
15
|
* See the License for the specific language governing permissions and
|
|
17
16
|
* limitations under the License.
|
|
18
17
|
*/
|
|
19
|
-
|
|
20
|
-
exports.Void = void 0;
|
|
21
|
-
exports.Void = (() => {
|
|
18
|
+
export const Void = (() => {
|
|
22
19
|
})();
|
|
20
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/ts-common/src/main/","sources":["utils/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA8KH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE;AAC1B,CAAC,CAAC,EAAE,CAAC"}
|
package/utils/ui-tools.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.awaitedDebounce = exports.queuedDebounce = exports.debounce = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Creates a debounced function that delays invoking the provided function until after a specified
|
|
6
3
|
* timeout has elapsed since the last time the debounced function was called. It also ensures that
|
|
@@ -30,7 +27,7 @@ exports.awaitedDebounce = exports.queuedDebounce = exports.debounce = void 0;
|
|
|
30
27
|
* // The original function will be invoked after 500ms since the last call,
|
|
31
28
|
* // or at least once after 1000ms, regardless of continuous calls.
|
|
32
29
|
*/
|
|
33
|
-
const debounce = (func, timeout = 500, maxTimeout = 1000) => {
|
|
30
|
+
export const debounce = (func, timeout = 500, maxTimeout = 1000) => {
|
|
34
31
|
let timer;
|
|
35
32
|
let defaultTimer;
|
|
36
33
|
return (...args) => {
|
|
@@ -48,8 +45,7 @@ const debounce = (func, timeout = 500, maxTimeout = 1000) => {
|
|
|
48
45
|
}
|
|
49
46
|
};
|
|
50
47
|
};
|
|
51
|
-
|
|
52
|
-
const queuedDebounce = (func, timeout = 500, maxTimeout = 1000) => {
|
|
48
|
+
export const queuedDebounce = (func, timeout = 500, maxTimeout = 1000) => {
|
|
53
49
|
let timer;
|
|
54
50
|
let defaultTimer;
|
|
55
51
|
let running = false;
|
|
@@ -83,8 +79,7 @@ const queuedDebounce = (func, timeout = 500, maxTimeout = 1000) => {
|
|
|
83
79
|
};
|
|
84
80
|
return debounceFunc;
|
|
85
81
|
};
|
|
86
|
-
|
|
87
|
-
const awaitedDebounce = (params) => {
|
|
82
|
+
export const awaitedDebounce = (params) => {
|
|
88
83
|
const timers = {};
|
|
89
84
|
const _clearTimeout = (timer) => {
|
|
90
85
|
clearTimeout(timers[timer]);
|
|
@@ -96,8 +91,7 @@ const awaitedDebounce = (params) => {
|
|
|
96
91
|
};
|
|
97
92
|
return (...args) => {
|
|
98
93
|
return new Promise((resolve, reject) => {
|
|
99
|
-
|
|
100
|
-
const timeout = (_a = params.timeout) !== null && _a !== void 0 ? _a : 500;
|
|
94
|
+
const timeout = params.timeout ?? 500;
|
|
101
95
|
_clearTimeout('timer');
|
|
102
96
|
timers.timer = setTimeout(async () => {
|
|
103
97
|
try {
|
|
@@ -110,7 +104,7 @@ const awaitedDebounce = (params) => {
|
|
|
110
104
|
}
|
|
111
105
|
}, timeout);
|
|
112
106
|
if (!timers.fallbackTimer) {
|
|
113
|
-
const fallbackTimeout =
|
|
107
|
+
const fallbackTimeout = params.fallbackTimeout ?? 1000;
|
|
114
108
|
timers.fallbackTimer = setTimeout(async () => {
|
|
115
109
|
try {
|
|
116
110
|
_clearTimeouts();
|
|
@@ -125,4 +119,4 @@ const awaitedDebounce = (params) => {
|
|
|
125
119
|
});
|
|
126
120
|
};
|
|
127
121
|
};
|
|
128
|
-
|
|
122
|
+
//# sourceMappingURL=ui-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-tools.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/ts-common/src/main/","sources":["utils/ui-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAqB,IAA6C,EAAE,UAAkB,GAAG,EAAE,aAAqB,IAAI,EAAE,EAAE;IAC/I,IAAI,KAAqB,CAAC;IAC1B,IAAI,YAAwC,CAAC;IAC7C,OAAO,CAAC,GAAG,IAAU,EAAE,EAAE;QACxB,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACvB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YACd,YAAY,CAAC,YAAY,CAAC,CAAC;YAC3B,YAAY,GAAG,SAAS,CAAC;QAC1B,CAAC,EAAE,OAAO,CAAC,CAAC;QACZ,IAAI,CAAC,YAAY,EAAE,CAAC;YACnB,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC9B,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;gBACd,YAAY,GAAG,SAAS,CAAC;YAC1B,CAAC,EAAE,UAAU,CAAC,CAAC;QAChB,CAAC;IACF,CAAC,CAAC;AACH,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AAC;oBAAC,OAAO,GAAQ,EAAE,CAAC;wBACnB,MAAM,CAAC,GAAG,CAAC,CAAC;oBACb,CAAC;gBACF,CAAC,EAAE,eAAe,CAAC,CAAC;YACrB,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic subdomain extractor.
|
|
3
|
+
* @param origin - The origin URL from which to extract the subdomain.
|
|
4
|
+
*/
|
|
5
|
+
export const extractSubdomain = (origin) => {
|
|
6
|
+
try {
|
|
7
|
+
const url = new URL(origin);
|
|
8
|
+
const hostname = url.hostname;
|
|
9
|
+
const parts = hostname.split('.');
|
|
10
|
+
if (parts.length > 1) {
|
|
11
|
+
return parts.slice(0, -1).join('.'); // Extract subdomain (everything before the last part)
|
|
12
|
+
}
|
|
13
|
+
return undefined; // No subdomain
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
console.error(`Invalid origin: ${origin}`, error);
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=url-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-tools.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/ts-common/src/main/","sources":["utils/url-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAsB,EAAE;IACnE,IAAI,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5B,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAE9B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,sDAAsD;QAC/F,CAAC;QAED,OAAO,SAAS,CAAC,CAAC,eAAe;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,mBAAmB,MAAM,EAAE,EAAE,KAAK,CAAC,CAAC;QAClD,OAAO,SAAS,CAAC;IACrB,CAAC;AACL,CAAC,CAAC"}
|
package/utils/version-tools.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* ts-common is the basic building blocks of our typescript projects
|
|
4
3
|
*
|
|
@@ -16,12 +15,9 @@
|
|
|
16
15
|
* See the License for the specific language governing permissions and
|
|
17
16
|
* limitations under the License.
|
|
18
17
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const exceptions_1 = require("../core/exceptions/exceptions");
|
|
23
|
-
const validator_core_1 = require("../validator/validator-core");
|
|
24
|
-
const validators_1 = require("../validator/validators");
|
|
18
|
+
import { BadImplementationException } from '../core/exceptions/exceptions.js';
|
|
19
|
+
import { tsValidateResult } from '../validator/validator-core.js';
|
|
20
|
+
import { tsValidateVersion } from '../validator/validators.js';
|
|
25
21
|
/**
|
|
26
22
|
*
|
|
27
23
|
* @param firstVersion a version
|
|
@@ -31,11 +27,19 @@ const validators_1 = require("../validator/validators");
|
|
|
31
27
|
* 0 if versions match
|
|
32
28
|
* 1 if second is greater
|
|
33
29
|
*/
|
|
34
|
-
function compareVersions(firstVersion, secondVersion) {
|
|
30
|
+
export function compareVersions(firstVersion, secondVersion) {
|
|
35
31
|
if (!firstVersion)
|
|
36
|
-
throw new
|
|
32
|
+
throw new BadImplementationException('First version is undefined');
|
|
37
33
|
if (!secondVersion)
|
|
38
|
-
throw new
|
|
34
|
+
throw new BadImplementationException('Second version is undefined');
|
|
35
|
+
const extractedFirstVersion = firstVersion.match(/\d+\.\d+\.\d+/)?.[0];
|
|
36
|
+
if (!extractedFirstVersion)
|
|
37
|
+
throw new BadImplementationException(`Unable to extract calculable version from '${firstVersion}'`);
|
|
38
|
+
firstVersion = extractedFirstVersion;
|
|
39
|
+
const extractedSecondVersion = secondVersion.match(/\d+\.\d+\.\d+/)?.[0];
|
|
40
|
+
if (!extractedSecondVersion)
|
|
41
|
+
throw new BadImplementationException(`Unable to extract calculable version from '${secondVersion}'`);
|
|
42
|
+
secondVersion = extractedSecondVersion;
|
|
39
43
|
const firstVersionAsArray = firstVersion.split('\.');
|
|
40
44
|
const secondVersionAsArray = secondVersion.split('\.');
|
|
41
45
|
for (let i = 0; i < firstVersionAsArray.length; i++) {
|
|
@@ -54,6 +58,7 @@ function compareVersions(firstVersion, secondVersion) {
|
|
|
54
58
|
* Expects a version of XXX.YYY.ZZZ and nothing else
|
|
55
59
|
* @param version
|
|
56
60
|
*/
|
|
57
|
-
function validateVersion(version) {
|
|
58
|
-
return
|
|
61
|
+
export function validateVersion(version) {
|
|
62
|
+
return tsValidateResult(version, tsValidateVersion);
|
|
59
63
|
}
|
|
64
|
+
//# sourceMappingURL=version-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-tools.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/ts-common/src/main/","sources":["utils/version-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,0BAA0B,EAAC,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAC,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,YAAoB,EAAE,aAAqB;IAC1E,IAAI,CAAC,YAAY;QAChB,MAAM,IAAI,0BAA0B,CAAC,4BAA4B,CAAC,CAAC;IAEpE,IAA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1
|
-
import { InvalidResult, InvalidResultArray, InvalidResultObject, Validator, ValidatorTypeResolver } from './validator-core';
|
|
2
|
-
import { TimeRange } from '../utils/date-time-tools';
|
|
3
|
-
import { ArrayType, AuditBy, RangeTimestamp, TypedMap } from '../utils/types';
|
|
4
|
-
export declare const tsValidateDynamicObject: <T extends object>(valuesValidator: ValidatorTypeResolver<T[keyof T]>, keysValidator: ValidatorTypeResolver<string>, mandatory?: boolean) => (import("./validator-core").ValidatorImpl<any> | ((input?: T) => InvalidResultObject<T> | undefined))[];
|
|
5
|
-
export declare const tsValidateUnion: <T>(validators: ValidatorTypeResolver<T>[], mandatory?: boolean) => (import("./validator-core").ValidatorImpl<any> | ((input?: any) => InvalidResultArray<T>[] | undefined))[];
|
|
1
|
+
import { InvalidResult, InvalidResultArray, InvalidResultObject, Validator, ValidatorTypeResolver } from './validator-core.js';
|
|
2
|
+
import { TimeRange } from '../utils/date-time-tools.js';
|
|
3
|
+
import { ArrayType, AuditBy, RangeTimestamp, TypedMap } from '../utils/types.js';
|
|
4
|
+
export declare const tsValidateDynamicObject: <T extends object>(valuesValidator: ValidatorTypeResolver<T[keyof T]>, keysValidator: ValidatorTypeResolver<string>, mandatory?: boolean) => (import("./validator-core.js").ValidatorImpl<any> | ((input?: T) => InvalidResultObject<T> | undefined))[];
|
|
5
|
+
export declare const tsValidateUnion: <T>(validators: ValidatorTypeResolver<T>[], mandatory?: boolean) => (import("./validator-core.js").ValidatorImpl<any> | ((input?: any) => InvalidResultArray<T>[] | undefined))[];
|
|
6
6
|
export declare const tsValidateCustom: <T>(processor: (input?: T, parentInput?: any) => InvalidResult<T>, mandatory?: boolean) => Validator<T>[];
|
|
7
7
|
declare const typeFunc: (type: any) => "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
8
8
|
type types = ReturnType<typeof typeFunc>;
|
|
9
9
|
type validatorObject<T> = {
|
|
10
10
|
[k in types]?: ValidatorTypeResolver<T>;
|
|
11
11
|
};
|
|
12
|
-
export declare const tsValidateUnionV3: <T>(validatorObject: validatorObject<T>, mandatory?: boolean) => (import("./validator-core").ValidatorImpl<any> | ((input?: T) => "Input does not match any of the possible types" | InvalidResult<T> | undefined))[];
|
|
13
|
-
export declare const tsValidateArray: <T extends any[], I extends ArrayType<T> = ArrayType<T>>(validator: ValidatorTypeResolver<I> | ValidatorTypeResolver<I>[], mandatory?: boolean, minimumLength?: number) => Validator<I[]>;
|
|
12
|
+
export declare const tsValidateUnionV3: <T>(validatorObject: validatorObject<T>, mandatory?: boolean) => (import("./validator-core.js").ValidatorImpl<any> | ((input?: T) => "Input does not match any of the possible types" | InvalidResult<T> | undefined))[];
|
|
13
|
+
export declare const tsValidateArray: <T extends any[], I extends ArrayType<T> = ArrayType<T>>(validator: ValidatorTypeResolver<I> | ValidatorTypeResolver<I>[], mandatory?: boolean, minimumLength?: number, strict?: boolean) => Validator<I[]>;
|
|
14
14
|
export declare const tsValidateString: (length?: number | [number, number], mandatory?: boolean) => Validator<string>;
|
|
15
|
+
export declare const tsValidateAnyString: Validator<string>;
|
|
16
|
+
export declare const tsValidateOptionalAnyString: Validator<string>;
|
|
15
17
|
export declare const tsValidateStringMinLength: (length: number, mandatory?: boolean) => Validator<string>;
|
|
16
18
|
export declare const tsValidateNumber: (mandatory?: boolean) => Validator<number>;
|
|
19
|
+
export declare const tsValidateAnyNumber: Validator<number>;
|
|
20
|
+
export declare const tsValidateOptionalAnyNumber: Validator<number>;
|
|
17
21
|
export declare const tsValidateEnum: (enumType: TypedMap<number | string>, mandatory?: boolean) => Validator<number | string>;
|
|
18
22
|
export declare const tsValidateBoolean: (mandatory?: boolean) => Validator<boolean>;
|
|
19
23
|
export declare const tsValidateValue: <T>(values: T[] | ReadonlyArray<T>, mandatory?: boolean) => Validator<any>;
|
|
@@ -23,12 +27,12 @@ export declare const tsValidateRegexp: (regexp: RegExp, mandatory?: boolean) =>
|
|
|
23
27
|
export declare const tsValidateTimestamp: (interval?: number, mandatory?: boolean) => Validator<number>;
|
|
24
28
|
export declare const tsValidateAudit: (range?: RangeTimestamp) => (audit?: AuditBy) => string | undefined;
|
|
25
29
|
export declare const tsValidateTimeRange: (mandatory?: boolean) => Validator<TimeRange>;
|
|
26
|
-
export declare const tsValidateNonMandatoryObject: <T extends object | undefined>(validator: ValidatorTypeResolver<T>) => (import("./validator-core").ValidatorImpl<any> | ((input?: T) => InvalidResult<T> | undefined))[];
|
|
27
|
-
export declare const tsValidateOptionalObject: <T extends object | undefined>(validator: ValidatorTypeResolver<T>) => (import("./validator-core").ValidatorImpl<any> | ((input?: T) => InvalidResult<T> | undefined))[];
|
|
30
|
+
export declare const tsValidateNonMandatoryObject: <T extends object | undefined>(validator: ValidatorTypeResolver<T>) => (import("./validator-core.js").ValidatorImpl<any> | ((input?: T) => InvalidResult<T> | undefined))[];
|
|
31
|
+
export declare const tsValidateOptionalObject: <T extends object | undefined>(validator: ValidatorTypeResolver<T>) => (import("./validator-core.js").ValidatorImpl<any> | ((input?: T) => InvalidResult<T> | undefined))[];
|
|
28
32
|
export declare const tsValidator_valueByKey: <T>(validatorObject: {
|
|
29
33
|
[k: string]: ValidatorTypeResolver<any>;
|
|
30
34
|
}, prop?: string) => ValidatorTypeResolver<T>;
|
|
31
|
-
export declare const tsValidator_ArrayOfObjectsByKey: <T extends
|
|
35
|
+
export declare const tsValidator_ArrayOfObjectsByKey: <T extends object>(key: keyof T, validatorMap: {
|
|
32
36
|
[k: string]: ValidatorTypeResolver<T>;
|
|
33
37
|
}) => Validator<T[]>;
|
|
34
38
|
export declare const tsValidator_stringOrNumber: (mandatory?: boolean) => ValidatorTypeResolver<string | number>;
|
|
@@ -1,80 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const exceptions_1 = require("../core/exceptions/exceptions");
|
|
10
|
-
const tsValidateDynamicObject = (valuesValidator, keysValidator, mandatory = true) => {
|
|
11
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory),
|
|
1
|
+
import { __stringify, exists } from '../utils/tools.js';
|
|
2
|
+
import { tsValidateExists, tsValidateResult } from './validator-core.js';
|
|
3
|
+
import { currentTimeMillis } from '../utils/date-time-tools.js';
|
|
4
|
+
import { asArray, filterInstances } from '../utils/array-tools.js';
|
|
5
|
+
import { _keys } from '../utils/object-tools.js';
|
|
6
|
+
import { BadImplementationException } from '../core/exceptions/exceptions.js';
|
|
7
|
+
export const tsValidateDynamicObject = (valuesValidator, keysValidator, mandatory = true) => {
|
|
8
|
+
return [tsValidateExists(mandatory),
|
|
12
9
|
(input) => {
|
|
13
10
|
if (!input)
|
|
14
11
|
return;
|
|
15
|
-
const keys =
|
|
12
|
+
const keys = _keys(input);
|
|
16
13
|
const _result = keys.reduce((res, key) => {
|
|
17
|
-
const _valRes =
|
|
18
|
-
const _keyRes =
|
|
14
|
+
const _valRes = tsValidateResult(input[key], valuesValidator);
|
|
15
|
+
const _keyRes = tsValidateResult(key, keysValidator);
|
|
19
16
|
if (_valRes && _keyRes)
|
|
20
17
|
res[key] = `Key: ${_keyRes}}\nValue: ${_valRes}`;
|
|
21
18
|
else if (_valRes)
|
|
22
|
-
res[key] = 'Value: ' + _valRes;
|
|
19
|
+
res[key] = 'Value: ' + __stringify(_valRes, true);
|
|
23
20
|
else if (_keyRes)
|
|
24
|
-
res[key] = 'Key: ' + _keyRes;
|
|
21
|
+
res[key] = 'Key: ' + __stringify(_keyRes, true);
|
|
25
22
|
return res;
|
|
26
23
|
}, {});
|
|
27
|
-
return
|
|
24
|
+
return _keys(_result).length ? _result : undefined;
|
|
28
25
|
}];
|
|
29
26
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory),
|
|
27
|
+
export const tsValidateUnion = (validators, mandatory = true) => {
|
|
28
|
+
return [tsValidateExists(mandatory),
|
|
33
29
|
(input) => {
|
|
34
30
|
const results = [];
|
|
35
31
|
for (const validator of validators) {
|
|
36
|
-
const _res =
|
|
32
|
+
const _res = tsValidateResult(input, validator);
|
|
37
33
|
if (!_res)
|
|
38
34
|
return;
|
|
39
35
|
results.push(_res);
|
|
40
36
|
}
|
|
41
|
-
return
|
|
37
|
+
return filterInstances(results).length !== 0 ? ['Input does not match any of the possible types',
|
|
42
38
|
results] : undefined;
|
|
43
39
|
}];
|
|
44
40
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory), processor];
|
|
41
|
+
export const tsValidateCustom = (processor, mandatory = true) => {
|
|
42
|
+
return [tsValidateExists(mandatory), processor];
|
|
48
43
|
};
|
|
49
|
-
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
50
45
|
const typeFunc = (type) => typeof type;
|
|
51
|
-
const tsValidateUnionV3 = (validatorObject, mandatory = true) => {
|
|
52
|
-
return [
|
|
46
|
+
export const tsValidateUnionV3 = (validatorObject, mandatory = true) => {
|
|
47
|
+
return [tsValidateExists(mandatory),
|
|
53
48
|
(input) => {
|
|
54
49
|
const _type = typeof input;
|
|
55
|
-
return
|
|
56
|
-
.includes(_type) ?
|
|
50
|
+
return _keys(validatorObject)
|
|
51
|
+
.includes(_type) ? tsValidateResult(input, validatorObject[_type]) : 'Input does not match any of the possible types';
|
|
57
52
|
}];
|
|
58
53
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
...(0, array_tools_1.asArray)(validator).map(validator => {
|
|
54
|
+
export const tsValidateArray = (validator, mandatory = true, minimumLength = 0, strict = true) => {
|
|
55
|
+
return [tsValidateExists(mandatory),
|
|
56
|
+
...asArray(validator).map(validator => {
|
|
63
57
|
return (input) => {
|
|
64
58
|
const results = [];
|
|
65
59
|
const _input = input;
|
|
66
60
|
if (_input.length < minimumLength)
|
|
67
61
|
return 'Array length smaller than minimum defined length';
|
|
68
62
|
for (let i = 0; i < _input.length; i++) {
|
|
69
|
-
results[i] =
|
|
63
|
+
results[i] = tsValidateResult(_input[i], validator, undefined, strict, input);
|
|
70
64
|
}
|
|
71
|
-
return
|
|
65
|
+
return filterInstances(results).length !== 0 ? results : undefined;
|
|
72
66
|
};
|
|
73
67
|
})];
|
|
74
68
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory),
|
|
69
|
+
export const tsValidateString = (length = -1, mandatory = true) => {
|
|
70
|
+
return [tsValidateExists(mandatory),
|
|
78
71
|
(input) => {
|
|
79
72
|
// noinspection SuspiciousTypeOfGuard
|
|
80
73
|
if (typeof input !== 'string')
|
|
@@ -90,9 +83,10 @@ const tsValidateString = (length = -1, mandatory = true) => {
|
|
|
90
83
|
return;
|
|
91
84
|
}];
|
|
92
85
|
};
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
86
|
+
export const tsValidateAnyString = tsValidateString();
|
|
87
|
+
export const tsValidateOptionalAnyString = tsValidateString(-1, false);
|
|
88
|
+
export const tsValidateStringMinLength = (length, mandatory = true) => {
|
|
89
|
+
return [tsValidateExists(mandatory),
|
|
96
90
|
(input) => {
|
|
97
91
|
// noinspection SuspiciousTypeOfGuard
|
|
98
92
|
if (typeof input !== 'string')
|
|
@@ -102,9 +96,8 @@ const tsValidateStringMinLength = (length, mandatory = true) => {
|
|
|
102
96
|
return `input has less than ${length} chars`;
|
|
103
97
|
}];
|
|
104
98
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory),
|
|
99
|
+
export const tsValidateNumber = (mandatory = true) => {
|
|
100
|
+
return [tsValidateExists(mandatory),
|
|
108
101
|
(input) => {
|
|
109
102
|
// noinspection SuspiciousTypeOfGuard
|
|
110
103
|
if (typeof input === 'number')
|
|
@@ -112,19 +105,19 @@ const tsValidateNumber = (mandatory = true) => {
|
|
|
112
105
|
return `Input is not a number! \nvalue: ${input}\ntype: ${typeof input}`;
|
|
113
106
|
}];
|
|
114
107
|
};
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
108
|
+
export const tsValidateAnyNumber = tsValidateNumber();
|
|
109
|
+
export const tsValidateOptionalAnyNumber = tsValidateNumber(false);
|
|
110
|
+
export const tsValidateEnum = (enumType, mandatory = true) => {
|
|
111
|
+
return [tsValidateExists(mandatory),
|
|
118
112
|
(input) => {
|
|
119
113
|
// @ts-ignore
|
|
120
|
-
if (
|
|
114
|
+
if (exists(enumType[input]))
|
|
121
115
|
return;
|
|
122
|
-
return `Input is not a valid enum value in ${
|
|
116
|
+
return `Input is not a valid enum value in ${__stringify(enumType)}`;
|
|
123
117
|
}];
|
|
124
118
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory),
|
|
119
|
+
export const tsValidateBoolean = (mandatory = true) => {
|
|
120
|
+
return [tsValidateExists(mandatory),
|
|
128
121
|
(input) => {
|
|
129
122
|
// noinspection SuspiciousTypeOfGuard
|
|
130
123
|
if (typeof input === 'boolean')
|
|
@@ -132,27 +125,24 @@ const tsValidateBoolean = (mandatory = true) => {
|
|
|
132
125
|
return `Input is not a boolean! \nvalue: ${input}\ntype: ${typeof input}`;
|
|
133
126
|
}];
|
|
134
127
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory),
|
|
128
|
+
export const tsValidateValue = (values, mandatory = true) => {
|
|
129
|
+
return [tsValidateExists(mandatory),
|
|
138
130
|
(input) => {
|
|
139
131
|
if (values.includes(input))
|
|
140
132
|
return;
|
|
141
|
-
return `Input is not valid:\n input: ${input &&
|
|
133
|
+
return `Input is not valid:\n input: ${input && __stringify(input) || input}\n options: ${__stringify(values)}\n`;
|
|
142
134
|
}];
|
|
143
135
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory),
|
|
136
|
+
export const tsValidateIsInRange = (ranges, mandatory = true) => {
|
|
137
|
+
return [tsValidateExists(mandatory),
|
|
147
138
|
(input) => {
|
|
148
139
|
if (ranges.some((range) => range[0] <= input && input <= range[1]))
|
|
149
140
|
return;
|
|
150
|
-
return `Input is not valid: ${input}. It should fit one of the expected range: ${
|
|
141
|
+
return `Input is not valid: ${input}. It should fit one of the expected range: ${__stringify(ranges)}`;
|
|
151
142
|
}];
|
|
152
143
|
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory),
|
|
144
|
+
export const tsValidateRange = (mandatory = true) => {
|
|
145
|
+
return [tsValidateExists(mandatory),
|
|
156
146
|
(input) => {
|
|
157
147
|
if (!input)
|
|
158
148
|
return 'Missing range';
|
|
@@ -164,9 +154,8 @@ const tsValidateRange = (mandatory = true) => {
|
|
|
164
154
|
return;
|
|
165
155
|
}];
|
|
166
156
|
};
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory),
|
|
157
|
+
export const tsValidateRegexp = (regexp, mandatory = true) => {
|
|
158
|
+
return [tsValidateExists(mandatory),
|
|
170
159
|
(input) => {
|
|
171
160
|
// console.log({input, regexp});
|
|
172
161
|
if (regexp.test(input))
|
|
@@ -174,28 +163,23 @@ const tsValidateRegexp = (regexp, mandatory = true) => {
|
|
|
174
163
|
return `Input does not match regexp:\n input: ${input}\n regexp: ${regexp}\n`;
|
|
175
164
|
}];
|
|
176
165
|
};
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory),
|
|
166
|
+
export const tsValidateTimestamp = (interval, mandatory = true) => {
|
|
167
|
+
return [tsValidateExists(mandatory),
|
|
180
168
|
(input) => {
|
|
181
|
-
const now =
|
|
169
|
+
const now = currentTimeMillis();
|
|
182
170
|
const minTimestamp = now - (interval || now);
|
|
183
171
|
if (minTimestamp <= input && input <= now)
|
|
184
172
|
return;
|
|
185
173
|
return `Input is not valid:\n input: ${input}\n Expected Interval: ${minTimestamp} - ${now}\n`;
|
|
186
174
|
}];
|
|
187
175
|
};
|
|
188
|
-
|
|
189
|
-
const tsValidateAudit = (range) => {
|
|
176
|
+
export const tsValidateAudit = (range = { min: 0, max: Number.MAX_VALUE }) => {
|
|
190
177
|
return (audit) => {
|
|
191
|
-
|
|
192
|
-
return (0, validator_core_1.tsValidateResult)((_a = audit === null || audit === void 0 ? void 0 : audit.auditAt) === null || _a === void 0 ? void 0 : _a.timestamp, (0, exports.tsValidateIsInRange)([[0,
|
|
193
|
-
Number.MAX_VALUE]]));
|
|
178
|
+
return tsValidateResult(audit?.auditAt?.timestamp, tsValidateIsInRange([[range.min, range.max]]));
|
|
194
179
|
};
|
|
195
180
|
};
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory), (instance) => {
|
|
181
|
+
export const tsValidateTimeRange = (mandatory = true) => {
|
|
182
|
+
return [tsValidateExists(mandatory), (instance) => {
|
|
199
183
|
if (!instance)
|
|
200
184
|
return 'No instance was provided to validation';
|
|
201
185
|
if (!instance.length || instance.every(value => value === undefined))
|
|
@@ -206,53 +190,48 @@ const tsValidateTimeRange = (mandatory = true) => {
|
|
|
206
190
|
return;
|
|
207
191
|
if (!instance[1] && typeof instance[0] === 'number')
|
|
208
192
|
return;
|
|
209
|
-
return
|
|
193
|
+
return tsValidateResult(instance, tsValidateRange());
|
|
210
194
|
}];
|
|
211
195
|
};
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
(input) => (0, validator_core_1.tsValidateResult)(input, validator)];
|
|
196
|
+
export const tsValidateNonMandatoryObject = (validator) => {
|
|
197
|
+
return [tsValidateExists(false),
|
|
198
|
+
(input) => tsValidateResult(input, validator)];
|
|
216
199
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return (0, validator_core_1.tsValidateResult)(value, validatorObject[parentObject[prop]]);
|
|
200
|
+
export const tsValidateOptionalObject = tsValidateNonMandatoryObject;
|
|
201
|
+
export const tsValidator_valueByKey = (validatorObject, prop = 'type') => {
|
|
202
|
+
return tsValidateCustom((value, parentObject) => {
|
|
203
|
+
return tsValidateResult(value, validatorObject[parentObject[prop]]);
|
|
222
204
|
});
|
|
223
205
|
};
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return (0, exports.tsValidateArray)((0, exports.tsValidateCustom)((value) => {
|
|
206
|
+
export const tsValidator_ArrayOfObjectsByKey = (key, validatorMap) => {
|
|
207
|
+
return tsValidateArray(tsValidateCustom((value) => {
|
|
227
208
|
const _value = value;
|
|
228
209
|
const validator = validatorMap[_value[key]];
|
|
229
210
|
if (!validator)
|
|
230
|
-
throw new
|
|
231
|
-
return
|
|
211
|
+
throw new BadImplementationException(`No validator defined for key ${key} with value ${_value[key]}`);
|
|
212
|
+
return tsValidateResult(_value, validator);
|
|
232
213
|
}));
|
|
233
214
|
};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
return (0, exports.tsValidateCustom)((input) => {
|
|
215
|
+
export const tsValidator_stringOrNumber = (mandatory = true) => {
|
|
216
|
+
return tsValidateCustom((input) => {
|
|
237
217
|
switch (typeof input) {
|
|
238
218
|
case 'string':
|
|
239
|
-
return
|
|
219
|
+
return tsValidateResult(input, tsValidateString());
|
|
240
220
|
case 'number':
|
|
241
|
-
return
|
|
221
|
+
return tsValidateResult(input, tsValidateNumber());
|
|
242
222
|
}
|
|
243
223
|
return 'Input is not string or number.';
|
|
244
224
|
}, mandatory);
|
|
245
225
|
};
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return [(0, validator_core_1.tsValidateExists)(mandatory), (input) => {
|
|
226
|
+
export const tsValidateIpAddress = (mandatory = true) => {
|
|
227
|
+
return [tsValidateExists(mandatory), (input) => {
|
|
249
228
|
if (!input && mandatory)
|
|
250
229
|
return 'no input provided for validation of mandatory prop';
|
|
251
|
-
if (
|
|
230
|
+
if (tsValidateResult(input, tsValidateRegexp(/(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/)))
|
|
252
231
|
return;
|
|
253
|
-
if (
|
|
232
|
+
if (tsValidateResult(input, tsValidateRegexp(/((([0-9a-fA-F]){1,4})\:){7}([0-9a-fA-F]){1,4}/)))
|
|
254
233
|
return;
|
|
255
234
|
return `Invalid input ${input}, not an ip address`;
|
|
256
235
|
}];
|
|
257
236
|
};
|
|
258
|
-
|
|
237
|
+
//# sourceMappingURL=type-validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-validators.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/ts-common/src/main/","sources":["validator/type-validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAyD,gBAAgB,EAAE,gBAAgB,EAAmC,MAAM,qBAAqB,CAAC;AACjK,OAAO,EAAC,iBAAiB,EAAY,MAAM,6BAA6B,CAAC;AAEzE,OAAO,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAC,KAAK,EAAC,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAC,0BAA0B,EAAC,MAAM,kCAAkC,CAAC;AAG5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAmB,eAAkD,EAAE,aAA4C,EAAE,SAAS,GAAG,IAAI,EAAE,EAAE;IAC/K,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC;QAC/B,CAAC,KAAS,EAAE,EAAE;YACb,IAAI,CAAC,KAAK;gBACT,OAAO;YAER,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAa,CAAC;YACtC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAyB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;gBAChE,M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AC,KAAK,EAAE,gBAAgB,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,gCAAgC,CAAC;IACzC,CAAC,EAAE,SAAS,CAA2C,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAS,GAAG,IAAI,EAAqB,EAAE;IAC1E,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC,KAAc,EAAE,EAAE;YACvD,IAAI,CAAC,KAAK,IAAI,SAAS;gBACtB,OAAO,oDAAoD,CAAC;YAE7D,IAAI,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,CAAC,6GAA6G,CAAC,CAAC;gBAC3J,OAAO;YAER,IAAI,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,CAAC,+CAA+C,CAAC,CAAC;gBAC7F,OAAO;YAER,OAAO,iBAAiB,KAAK,qBAAqB,CAAC;QACpD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TS_Object } from '../utils/types';
|
|
2
|
-
import { CustomException } from '../core/exceptions/exceptions';
|
|
1
|
+
import { TS_Object } from '../utils/types.js';
|
|
2
|
+
import { CustomException } from '../core/exceptions/exceptions.js';
|
|
3
3
|
/**
|
|
4
4
|
* Should be like the following but errors in resolving...
|
|
5
5
|
*
|
|
@@ -26,5 +26,5 @@ export declare class ValidationException<T> extends CustomException {
|
|
|
26
26
|
}
|
|
27
27
|
export declare const tsValidateExists: (mandatory?: boolean) => ValidatorImpl<any>;
|
|
28
28
|
export declare const tsValidate: <T>(instance: T | undefined, _validator: ValidatorTypeResolver<T>, strict?: boolean) => InvalidResult<T> | undefined;
|
|
29
|
-
export declare const tsValidateResult: <T>(instance: T | undefined, _validator: ValidatorTypeResolver<T>, key?: keyof T, parentInstance?: any) => InvalidResult<T> | undefined;
|
|
30
|
-
export declare const tsValidateObject: <T extends object>(__validator: TypeValidator<T>, instance: T, path?: string) => InvalidResultObject<T> | undefined;
|
|
29
|
+
export declare const tsValidateResult: <T>(instance: T | undefined, _validator: ValidatorTypeResolver<T>, key?: keyof T, strict?: boolean, parentInstance?: any) => InvalidResult<T> | undefined;
|
|
30
|
+
export declare const tsValidateObject: <T extends object>(__validator: TypeValidator<T>, instance: T, path?: string, strict?: boolean) => InvalidResultObject<T> | undefined;
|