@intuitionrobotics/ts-common 0.45.0 → 0.45.3
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 +17 -0
- package/consts/consts.js.map +1 -1
- package/core/application.js +17 -0
- package/core/application.js.map +1 -1
- package/core/debug-flags.js +17 -0
- package/core/debug-flags.js.map +1 -1
- package/core/dispatcher.js +17 -0
- package/core/dispatcher.js.map +1 -1
- package/core/error-handling.js +17 -0
- package/core/error-handling.js.map +1 -1
- package/core/exceptions.d.ts +3 -0
- package/core/exceptions.js +20 -0
- package/core/exceptions.js.map +1 -1
- package/core/logger/BeLogged.js +17 -0
- package/core/logger/BeLogged.js.map +1 -1
- package/core/logger/LogClient.js +17 -0
- package/core/logger/LogClient.js.map +1 -1
- package/core/logger/LogClient_BaseRotate.js +18 -0
- package/core/logger/LogClient_BaseRotate.js.map +1 -1
- package/core/logger/LogClient_Browser.js +17 -0
- package/core/logger/LogClient_Browser.js.map +1 -1
- package/core/logger/LogClient_Function.js +17 -0
- package/core/logger/LogClient_Function.js.map +1 -1
- package/core/logger/LogClient_MemBuffer.js +18 -0
- package/core/logger/LogClient_MemBuffer.js.map +1 -1
- package/core/logger/LogClient_Terminal.js +17 -0
- package/core/logger/LogClient_Terminal.js.map +1 -1
- package/core/logger/Logger.js +17 -0
- package/core/logger/Logger.js.map +1 -1
- package/core/logger/types.js +17 -0
- package/core/logger/types.js.map +1 -1
- package/core/logger/utils.js +20 -0
- package/core/logger/utils.js.map +1 -1
- package/core/module-manager.d.ts +3 -0
- package/core/module-manager.js +17 -0
- package/core/module-manager.js.map +1 -1
- package/core/module.d.ts +5 -6
- package/core/module.js +24 -17
- package/core/module.js.map +1 -1
- package/index.d.ts +35 -0
- package/index.js +63 -0
- package/index.js.map +1 -1
- package/modules/CliParamsModule.js +3 -3
- package/modules/CliParamsModule.js.map +1 -1
- package/package.json +1 -1
- package/permissions/permission-group.js +20 -4
- package/permissions/permission-group.js.map +1 -1
- package/testing/test-model.js +17 -0
- package/testing/test-model.js.map +1 -1
- package/ts-generics/array-params.js +17 -0
- package/ts-generics/array-params.js.map +1 -1
- package/ts-generics/omit-and-join.js +17 -0
- package/ts-generics/omit-and-join.js.map +1 -1
- package/utils/array-tools.js +17 -0
- package/utils/array-tools.js.map +1 -1
- package/utils/crypto-tools.js +17 -0
- package/utils/crypto-tools.js.map +1 -1
- package/utils/date-time-tools.d.ts +4 -1
- package/utils/date-time-tools.js +42 -3
- package/utils/date-time-tools.js.map +1 -1
- package/utils/filter-tools.js +17 -0
- package/utils/filter-tools.js.map +1 -1
- package/utils/hash-tools.js +17 -0
- package/utils/hash-tools.js.map +1 -1
- package/utils/merge-tools.js +22 -6
- package/utils/merge-tools.js.map +1 -1
- package/utils/object-tools.js +20 -3
- package/utils/object-tools.js.map +1 -1
- package/utils/queue.js +20 -3
- package/utils/queue.js.map +1 -1
- package/utils/random-tools.js +17 -0
- package/utils/random-tools.js.map +1 -1
- package/utils/string-tools.js +17 -0
- package/utils/string-tools.js.map +1 -1
- package/utils/tools.js +17 -0
- package/utils/tools.js.map +1 -1
- package/utils/types.js +17 -0
- package/utils/types.js.map +1 -1
- package/utils/version-tools.js +20 -3
- package/utils/version-tools.js.map +1 -1
- package/validator/validator.js +19 -5
- package/validator/validator.js.map +1 -1
- package/utils/date-manipulation-tools.d.ts +0 -4
- package/utils/date-manipulation-tools.js +0 -28
- package/utils/date-manipulation-tools.js.map +0 -1
package/utils/merge-tools.js
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
20
|
exports.merge = exports.mergeArray = exports.mergeObject = void 0;
|
|
4
|
-
const
|
|
5
|
-
const object_tools_1 = require("./object-tools");
|
|
21
|
+
const index_1 = require("../index");
|
|
6
22
|
function mergeObject(original, override) {
|
|
7
23
|
if (original === override) {
|
|
8
24
|
console.log("Original: " + JSON.stringify(original));
|
|
9
25
|
console.log("Override: " + JSON.stringify(override));
|
|
10
|
-
throw new
|
|
26
|
+
throw new index_1.BadImplementationException(`trying to merge same Object instance\n Original: ${typeof original}\n Override: ${typeof override}`);
|
|
11
27
|
}
|
|
12
|
-
const returnValue =
|
|
28
|
+
const returnValue = index_1.deepClone(original);
|
|
13
29
|
return Object.keys(override).reduce((obj, key) => {
|
|
14
30
|
obj[key] = merge(original[key], override[key]);
|
|
15
31
|
if (obj[key] === undefined)
|
|
@@ -22,7 +38,7 @@ function mergeArray(original, override) {
|
|
|
22
38
|
if (original === override) {
|
|
23
39
|
console.log("Original: " + JSON.stringify(original));
|
|
24
40
|
console.log("Override: " + JSON.stringify(override));
|
|
25
|
-
throw new
|
|
41
|
+
throw new index_1.BadImplementationException(`trying to merge same Array instance\n Original: ${typeof original}\n Override: ${typeof override}`);
|
|
26
42
|
}
|
|
27
43
|
// const returnValue = deepClone(original);
|
|
28
44
|
// returnValue.reduce((array, value) => {
|
|
@@ -46,7 +62,7 @@ function merge(original, override) {
|
|
|
46
62
|
if (override === undefined || override === null)
|
|
47
63
|
return undefined;
|
|
48
64
|
if (override && original && typeof original !== typeof override || (typeof original === "object" && typeof override === 'object' && Array.isArray(original) !== Array.isArray(override)))
|
|
49
|
-
throw new
|
|
65
|
+
throw new index_1.BadImplementationException(`trying to merge object of different types!! \n Original: ${typeof original}\n Override: ${typeof override}`);
|
|
50
66
|
if (Array.isArray(original) && Array.isArray(override))
|
|
51
67
|
return mergeArray(original, override);
|
|
52
68
|
if (typeof original === "object" && typeof override === 'object' && !Array.isArray(original) && !Array.isArray(override))
|
package/utils/merge-tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-tools.js","sourceRoot":"","sources":["../../src/main/utils/merge-tools.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"merge-tools.js","sourceRoot":"","sources":["../../src/main/utils/merge-tools.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,oCAGkB;AAElB,SAAgB,WAAW,CAAC,QAAa,EAAE,QAAa;IACvD,IAAI,QAAQ,KAAK,QAAQ,EAAE;QAC1B,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrD,MAAM,IAAI,kCAA0B,CAAC,oDAAoD,OAAO,QAAQ,gBAAgB,OAAO,QAAQ,EAAE,CAAC,CAAC;KAC3I;IAED,MAAM,WAAW,GAAG,iBAAS,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAChD,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAE/C,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS;YACzB,OAAO,G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,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QACrD,OAAO,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEvC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QACvH,OAAO,WAAW,CAAC,QAAQ,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;IAE9C,OAAO,QAAQ,CAAA;AAChB,CAAC;AAdD,sBAcC"}
|
package/utils/object-tools.js
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
20
|
exports.assert = exports.compare = exports.cloneObj = exports.cloneArr = exports._setTypedProp = exports._values = exports._keys = exports.deepClone = void 0;
|
|
4
|
-
const
|
|
21
|
+
const index_1 = require("../index");
|
|
5
22
|
function deepClone(obj) {
|
|
6
23
|
if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || typeof obj === 'undefined' || obj === null)
|
|
7
24
|
return obj;
|
|
@@ -47,7 +64,7 @@ function compare(one, two, keys) {
|
|
|
47
64
|
if (one === null || two === null)
|
|
48
65
|
return false;
|
|
49
66
|
if (typeofOne === "function")
|
|
50
|
-
throw new
|
|
67
|
+
throw new index_1.BadImplementationException("This compare meant to compare two POJOs.. nothing more");
|
|
51
68
|
if (typeofOne !== "object")
|
|
52
69
|
return one === two;
|
|
53
70
|
if (Array.isArray(one) && Array.isArray(two)) {
|
|
@@ -80,7 +97,7 @@ function compare(one, two, keys) {
|
|
|
80
97
|
exports.compare = compare;
|
|
81
98
|
function assert(message, expected, actual) {
|
|
82
99
|
if (!compare(expected, actual))
|
|
83
|
-
throw new
|
|
100
|
+
throw new index_1.AssertionException(`Assertion Failed:\n -- ${message}\n -- Expected: ${JSON.stringify(expected)}\n -- Actual: ${JSON.stringify(actual)}\n\n`);
|
|
84
101
|
}
|
|
85
102
|
exports.assert = assert;
|
|
86
103
|
//# sourceMappingURL=object-tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-tools.js","sourceRoot":"","sources":["../../src/main/utils/object-tools.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"object-tools.js","sourceRoot":"","sources":["../../src/main/utils/object-tools.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,oCAGkB;AAGlB,SAAgB,SAAS,CAAI,GAAM;IAClC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,SAAS,IAAI,OAAO,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,IAAI;QAC/H,OAAO,GAAG,CAAC;IAEZ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QACrB,OAAO,QAAQ,CAAC,GAAuB,CAAiB,CAAC;IAE1D,OAAO,QAAQ,CAAC,GAAwB,CAAiB,CAAC;AAC3D,CAAC;A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AM,CAAC,CAAC;YACtC,SAAS;QAEV,OAAO,KAAK,CAAC;KACb;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AA1DD,0BA0DC;AAED,SAAgB,MAAM,CAAI,OAAe,EAAE,QAAW,EAAE,MAAS;IAChE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC7B,MAAM,IAAI,0BAAkB,CAC3B,2BAA2B,OAAO,oBAAoB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACnI,CAAC;AAJD,wBAIC"}
|
package/utils/queue.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
2
19
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
20
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
21
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -10,8 +27,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
27
|
};
|
|
11
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
29
|
exports.Queue = void 0;
|
|
30
|
+
const index_1 = require("../index");
|
|
13
31
|
const Logger_1 = require("../core/logger/Logger");
|
|
14
|
-
const array_tools_1 = require("./array-tools");
|
|
15
32
|
class Queue extends Logger_1.Logger {
|
|
16
33
|
constructor(name) {
|
|
17
34
|
super(name);
|
|
@@ -34,7 +51,7 @@ class Queue extends Logger_1.Logger {
|
|
|
34
51
|
this.execute();
|
|
35
52
|
}
|
|
36
53
|
addItemImpl(toExecute, onCompleted, onError) {
|
|
37
|
-
|
|
54
|
+
index_1.addItemToArray(this.queue, (resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
38
55
|
this.running++;
|
|
39
56
|
try {
|
|
40
57
|
const output = yield toExecute();
|
|
@@ -63,7 +80,7 @@ class Queue extends Logger_1.Logger {
|
|
|
63
80
|
}
|
|
64
81
|
for (let i = 0; this.running < this.parallelCount && i < this.queue.length; i++) {
|
|
65
82
|
const toExecute = this.queue[0];
|
|
66
|
-
|
|
83
|
+
index_1.removeItemFromArray(this.queue, toExecute);
|
|
67
84
|
new Promise(toExecute.bind(this))
|
|
68
85
|
.then(this.ignore)
|
|
69
86
|
.catch(this.ignore);
|
package/utils/queue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../src/main/utils/queue.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../src/main/utils/queue.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;AAEH,oCAGkB;AAClB,kDAA6C;AAE7C,MAAa,KACZ,SAAQ,eAAM;IAQd,YAAY,IAAY;QACvB,KAAK,CAAC,IAAI,CAAC,CAAC;QAPL,kBAAa,GAAG,CAAC,CAAC;QAClB,YAAO,GAAG,CAAC,CAAC;QACZ,UAAK,GAA4B,EAAE,CAAC;QA6C5C,WAAM,GAAG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CAAC,CAAA,CAAC,CAAC;IACJ,CAAC;IAKD,OAAO;;QACN,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC,EAAE;YAClD,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACzC,aAAO,IAAI,CAAC,YAAY,+CAAjB,IAAI,EAAkB;SAC7B;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAChF,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChC,2BAAmB,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAC3C,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBAC/B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;iBACjB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACrB;IACF,CAAC;IAEK,WAAW;;YAChB,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC3B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;gBAC5B,IAAI,CAAC,OAAO,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;QACJ,CAAC;KAAA;CACD;AA1ED,sBA0EC"}
|
package/utils/random-tools.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
20
|
exports.generateUUID = exports.generateHex = void 0;
|
|
4
21
|
const crypto_1 = require("crypto");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random-tools.js","sourceRoot":"","sources":["../../src/main/utils/random-tools.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"random-tools.js","sourceRoot":"","sources":["../../src/main/utils/random-tools.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,mCAAmC;AAEnC,SAAgB,WAAW,CAAC,MAAc;IACzC,OAAO,oBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SACvC,QAAQ,CAAC,KAAK,CAAC;SACf,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAJD,kCAIC;AAED,SAAgB,YAAY;IAC3B,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC;QACzE,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;QACtE,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACJ,CAAC;AALD,oCAKC"}
|
package/utils/string-tools.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
20
|
exports.padNumber = void 0;
|
|
4
21
|
function padNumber(num, length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-tools.js","sourceRoot":"","sources":["../../src/main/utils/string-tools.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"string-tools.js","sourceRoot":"","sources":["../../src/main/utils/string-tools.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,SAAgB,SAAS,CAAC,GAAoB,EAAE,MAAc;IAC7D,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC5B,OAAO,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC;AAHD,8BAGC"}
|
package/utils/tools.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
20
|
exports.__stringify = exports.calculateJsonSizeMb = exports.createFilterPattern = exports.regexpCase = void 0;
|
|
4
21
|
const object_tools_1 = require("./object-tools");
|
package/utils/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/main/utils/tools.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/main/utils/tools.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,iDAAqC;AAGrC,SAAgB,UAAU,CAAC,KAAa,EAAE,GAAW;IACpD,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC;AAC3D,CAAC;AAFD,gCAEC;AAED,SAAgB,mBAAmB,CAAC,SAAkB;IACrD,IAAI,MAAM,GAAG,SAAS,IAAI,EAAE,CAAC;IAC7B,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IACvB,MAAM,GAAG,MAAM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+1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
20
|
exports.Void = void 0;
|
|
4
21
|
exports.Void = (() => {
|
package/utils/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/main/utils/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/main/utils/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAoDU,QAAA,IAAI,GAAG,CAAC,GAAG,EAAE;AAC1B,CAAC,CAAC,EAAE,CAAC"}
|
package/utils/version-tools.js
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
20
|
exports.compareVersions = void 0;
|
|
4
|
-
const
|
|
21
|
+
const index_1 = require("../index");
|
|
5
22
|
/**
|
|
6
23
|
*
|
|
7
24
|
* @param firstVersion a version
|
|
@@ -13,9 +30,9 @@ const exceptions_1 = require("../core/exceptions");
|
|
|
13
30
|
*/
|
|
14
31
|
function compareVersions(firstVersion, secondVersion) {
|
|
15
32
|
if (!firstVersion)
|
|
16
|
-
throw new
|
|
33
|
+
throw new index_1.BadImplementationException("First version is undefined");
|
|
17
34
|
if (!secondVersion)
|
|
18
|
-
throw new
|
|
35
|
+
throw new index_1.BadImplementationException("Second version is undefined");
|
|
19
36
|
const firstVersionAsArray = firstVersion.split("\.");
|
|
20
37
|
const secondVersionAsArray = secondVersion.split("\.");
|
|
21
38
|
for (let i = 0; i < firstVersionAsArray.length; i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-tools.js","sourceRoot":"","sources":["../../src/main/utils/version-tools.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"version-tools.js","sourceRoot":"","sources":["../../src/main/utils/version-tools.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAGH,oCAAoD;AAEpD;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAAC,YAAoB,EAAE,aAAqB;IAC1E,IAAI,CAAC,YAAY;QAChB,MAAM,IAAI,kCAA0B,CAAC,4BAA4B,CAAC,CAAC;IAEpE,IAAI,CAAC,aAAa;QACjB,MAAM,IAAI,kCAA0B,CAAC,6BAA6B,CAAC,CAAC;IAErE,MAAM,mBAAmB,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,oBAAoB,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpD,MAAM,SAAS,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,QAAQ,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACzC,IAAI,SAAS,GAAG,QAAQ;YACvB,OAAO,CAAC,CAAC;QAEV,IAAI,SAAS,KAAK,QAAQ;YACzB,SAAS;QAEV,IAAI,SAAS,GAAG,QAAQ;YACvB,OAAO,CAAC,CAAC,CAAC;KACX;IAED,OAAO,CAAC,CAAC;AACV,CAAC;AAvBD,0CAuBC"}
|
package/validator/validator.js
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
20
|
exports.validateEmail = exports.timestampValidator = exports.auditValidator = exports.isTimestampValid = exports.validateObject = exports.validate = exports.validateRange = exports.validateValue = exports.validateRegexp = exports.validateArray = exports.validateObjectValues = exports.validateBoolean = exports.validateNumber = exports.validateString = exports.validateType = exports.validateExists = exports.ValidationException = void 0;
|
|
4
21
|
const exceptions_1 = require("../core/exceptions");
|
|
5
22
|
const tools_1 = require("../utils/tools");
|
|
6
23
|
const object_tools_1 = require("../utils/object-tools");
|
|
7
|
-
const
|
|
24
|
+
const __1 = require("..");
|
|
8
25
|
class ValidationException extends exceptions_1.CustomException {
|
|
9
26
|
constructor(debugMessage, path, input) {
|
|
10
27
|
super(ValidationException, debugMessage);
|
|
@@ -139,10 +156,7 @@ const validateObject = (__validator, instance, path = "") => {
|
|
|
139
156
|
}
|
|
140
157
|
};
|
|
141
158
|
exports.validateObject = validateObject;
|
|
142
|
-
const isTimestampValid = (time, range = {
|
|
143
|
-
min: date_time_tools_1.currentTimeMillies() - 1000 * date_time_tools_1.Day,
|
|
144
|
-
max: date_time_tools_1.currentTimeMillies() + 1000 * date_time_tools_1.Day
|
|
145
|
-
}) => {
|
|
159
|
+
const isTimestampValid = (time, range = { min: __1.currentTimeMillies() - 1000 * __1.Day, max: __1.currentTimeMillies() + 1000 * __1.Day }) => {
|
|
146
160
|
return time >= range.min && time <= range.max;
|
|
147
161
|
};
|
|
148
162
|
exports.isTimestampValid = isTimestampValid;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/main/validator/validator.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/main/validator/validator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,mDAG4B;AAC5B,0CAA4C;AAC5C,wDAA4C;AAO5C,0BAGY;AA4BZ,MAAa,mBACZ,SAAQ,4BAAe;IAIvB,YAAY,YAAoB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C;AAFW,QAAA,cAAc,kBAEzB;AAEK,MAAM,kBAAkB,GAAG,CAAC,KAAsB,EAAE,EAAE,CAAC,CAAC,KAAa,EAAE,SAAkB,EAAE,EAAE;IACnG,IAAI,CAAC,SAAS,IAAI,CAAC,wBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC;QACpD,MAAM,IAAI,mBAAmB,CAAC,oBAAoB,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AACxE,CAAC,CAAA;AAHY,QAAA,kBAAkB,sBAG9B;AAEY,QAAA,aAAa,GAAG,sBAAc,CAC1C,uIAAuI,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Timestamp } from "./types";
|
|
2
|
-
export declare function createReadableTimestampObject(pattern?: string, timestamp?: number, timezone?: string): Timestamp;
|
|
3
|
-
export declare function formatTimestamp(pattern?: string, timestamp?: number, timezone?: string): string;
|
|
4
|
-
export declare function parseTimeString(timestamp: string, pattern?: string): number;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseTimeString = exports.formatTimestamp = exports.createReadableTimestampObject = void 0;
|
|
4
|
-
const moment_1 = require("moment/moment");
|
|
5
|
-
const date_time_tools_1 = require("./date-time-tools");
|
|
6
|
-
function createReadableTimestampObject(pattern = date_time_tools_1.Format_HHmmss_DDMMYYYY, timestamp = date_time_tools_1.currentTimeMillies(), timezone) {
|
|
7
|
-
const timeObj = {
|
|
8
|
-
timestamp: timestamp,
|
|
9
|
-
pretty: formatTimestamp(pattern, timestamp)
|
|
10
|
-
};
|
|
11
|
-
if (timezone)
|
|
12
|
-
timeObj.timezone = timezone;
|
|
13
|
-
return timeObj;
|
|
14
|
-
}
|
|
15
|
-
exports.createReadableTimestampObject = createReadableTimestampObject;
|
|
16
|
-
function formatTimestamp(pattern = date_time_tools_1.Format_HHmmss_DDMMYYYY, timestamp = date_time_tools_1.currentTimeMillies(), timezone) {
|
|
17
|
-
const m = moment_1.utc(timestamp);
|
|
18
|
-
if (timezone) {
|
|
19
|
-
m.utcOffset(timezone);
|
|
20
|
-
}
|
|
21
|
-
return m.format(pattern);
|
|
22
|
-
}
|
|
23
|
-
exports.formatTimestamp = formatTimestamp;
|
|
24
|
-
function parseTimeString(timestamp, pattern = date_time_tools_1.Format_HHmmss_DDMMYYYY) {
|
|
25
|
-
return moment_1.utc(timestamp, pattern).valueOf();
|
|
26
|
-
}
|
|
27
|
-
exports.parseTimeString = parseTimeString;
|
|
28
|
-
//# sourceMappingURL=date-manipulation-tools.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-manipulation-tools.js","sourceRoot":"","sources":["../../src/main/utils/date-manipulation-tools.ts"],"names":[],"mappings":";;;AACA,0CAAkC;AAClC,uDAA6E;AAE7E,SAAgB,6BAA6B,CAAC,UAAkB,wCAAsB,EAAE,YAAoB,oCAAkB,EAAE,EAAE,QAAiB;IAE/I,MAAM,OAAO,GAAc;QACvB,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC;KAC9C,CAAC;IAEF,IAAI,QAAQ;QACR,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAEhC,OAAO,OAAO,CAAC;AACnB,CAAC;AAXD,sEAWC;AAED,SAAgB,eAAe,CAAC,UAAkB,wCAAsB,EAAE,YAAoB,oCAAkB,EAAE,EAAE,QAAiB;IACjI,MAAM,CAAC,GAAG,YAAG,CAAC,SAAS,CAAC,CAAC;IACzB,IAAI,QAAQ,EAAE;QACV,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;KACzB;IACD,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAND,0CAMC;AAED,SAAgB,eAAe,CAAC,SAAiB,EAAE,UAAkB,wCAAsB;IACvF,OAAO,YAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;AAC7C,CAAC;AAFD,0CAEC"}
|