@knime/utils 1.3.2 → 1.3.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/CHANGELOG.md +8 -1
- package/package.json +2 -2
- package/src/config/globals.d.ts +8 -2
- package/src/filters.ts +2 -2
- package/src/format.ts +2 -3
- package/src/intervalUtils.ts +2 -4
- package/src/uploadManager/index.ts +0 -1
- package/test-utils/muteConsole.ts +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
# @knime/utils
|
|
2
2
|
|
|
3
|
+
## 1.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [4bda98c]
|
|
8
|
+
- @knime/styles@1.4.0
|
|
9
|
+
|
|
3
10
|
## 1.3.2
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
6
13
|
|
|
7
|
-
-
|
|
14
|
+
- bb186d1: add isWindows check to navigator utils
|
|
8
15
|
|
|
9
16
|
## 1.3.1
|
|
10
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knime/utils",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Internal utility functions and constants shared across @knime packages.",
|
|
5
5
|
"homepage": "https://knime.github.io/webapps-common/",
|
|
6
6
|
"license": "GPL 3 and Additional Permissions according to Sec. 7 (SEE the file LICENSE)",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"date-fns": "2.30.0",
|
|
11
11
|
"date-fns-tz": "2.0.0",
|
|
12
|
-
"@knime/styles": "1.
|
|
12
|
+
"@knime/styles": "1.4.0"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"consola": "3.x"
|
package/src/config/globals.d.ts
CHANGED
package/src/filters.ts
CHANGED
|
@@ -65,7 +65,7 @@ const modeDefinitions = [
|
|
|
65
65
|
try {
|
|
66
66
|
const flags = caseSensitiveSearch ? "" : "i";
|
|
67
67
|
return new RegExp(searchTerm, flags);
|
|
68
|
-
} catch (
|
|
68
|
+
} catch (_error) {
|
|
69
69
|
// In case of an invalid regular expression, an impossible
|
|
70
70
|
// regex is returned, not matching anything.
|
|
71
71
|
return /$^/;
|
|
@@ -82,7 +82,7 @@ const modeDefinitions = [
|
|
|
82
82
|
try {
|
|
83
83
|
const flags = caseSensitiveSearch ? "" : "i";
|
|
84
84
|
return new RegExp(`^(${searchTerm})$`, flags);
|
|
85
|
-
} catch (
|
|
85
|
+
} catch (_error) {
|
|
86
86
|
// In case of an invalid regular expression, an impossible
|
|
87
87
|
// regex is returned, not matching anything.
|
|
88
88
|
return /$^/;
|
package/src/format.ts
CHANGED
|
@@ -13,7 +13,7 @@ export const formatDateString = (
|
|
|
13
13
|
) => {
|
|
14
14
|
const date = new Date(dateString);
|
|
15
15
|
|
|
16
|
-
// @ts-
|
|
16
|
+
// @ts-expect-error Argument of type 'Date' is not assignable to parameter of type 'number'
|
|
17
17
|
if (isNaN(date)) {
|
|
18
18
|
throw Error("Invalid Date format");
|
|
19
19
|
}
|
|
@@ -47,7 +47,7 @@ export const formatTimeString = (
|
|
|
47
47
|
) => {
|
|
48
48
|
const time = new Date(timeString);
|
|
49
49
|
|
|
50
|
-
// @ts-
|
|
50
|
+
// @ts-expect-error Argument of type 'Date' is not assignable to parameter of type 'number'
|
|
51
51
|
if (isNaN(time)) {
|
|
52
52
|
throw Error("Invalid Date format");
|
|
53
53
|
}
|
|
@@ -79,7 +79,6 @@ export const formatDateTimeString = (
|
|
|
79
79
|
dateTimeString: string | number,
|
|
80
80
|
useTimeZone = false,
|
|
81
81
|
) => {
|
|
82
|
-
// eslint-disable-line arrow-body-style
|
|
83
82
|
return `${formatDateString(dateTimeString, useTimeZone)} ${formatTimeString(
|
|
84
83
|
dateTimeString,
|
|
85
84
|
useTimeZone,
|
package/src/intervalUtils.ts
CHANGED
|
@@ -52,7 +52,6 @@ const extractDurationFromRegexMatch = (
|
|
|
52
52
|
negative: boolean,
|
|
53
53
|
match: RegExpExecArray,
|
|
54
54
|
): Duration => {
|
|
55
|
-
// eslint-disable-next-line no-magic-numbers
|
|
56
55
|
const milliseconds = parseInt(match[4]?.padEnd(3, "0") ?? "0", 10);
|
|
57
56
|
|
|
58
57
|
return {
|
|
@@ -104,7 +103,6 @@ export const formatIntervalToISOIntervalString = (
|
|
|
104
103
|
} else {
|
|
105
104
|
output += `T${toFormat.interval.hours}H${toFormat.interval.minutes}M${toFormat.interval.seconds}.${toFormat.interval.milliseconds
|
|
106
105
|
.toString()
|
|
107
|
-
// eslint-disable-next-line no-magic-numbers
|
|
108
106
|
.padStart(3, "0")}S`;
|
|
109
107
|
}
|
|
110
108
|
|
|
@@ -308,7 +306,7 @@ export const isValidHumanReadableIntervalString = (
|
|
|
308
306
|
} else {
|
|
309
307
|
return { valid: false };
|
|
310
308
|
}
|
|
311
|
-
} catch (
|
|
309
|
+
} catch (_e) {
|
|
312
310
|
return { valid: false };
|
|
313
311
|
}
|
|
314
312
|
};
|
|
@@ -384,7 +382,7 @@ export const isValidISOIntervalString = (
|
|
|
384
382
|
} else {
|
|
385
383
|
return { valid: false };
|
|
386
384
|
}
|
|
387
|
-
} catch (
|
|
385
|
+
} catch (_e) {
|
|
388
386
|
return { valid: false };
|
|
389
387
|
}
|
|
390
388
|
};
|
|
@@ -8,6 +8,7 @@ const methods: ConsoleMethod[] = ["log", "warn", "error", "info"];
|
|
|
8
8
|
* @param f The function to run. Can be async.
|
|
9
9
|
* @returns The original function's return value
|
|
10
10
|
*/
|
|
11
|
+
// TODO: replace Function with fitting top type (...args: never[]) => unknown has unknown return type which makes problems in line 41
|
|
11
12
|
export default (f: Function) => {
|
|
12
13
|
const originals = methods.map((method) => console[method]);
|
|
13
14
|
methods.forEach((method) => {
|
|
@@ -15,11 +16,11 @@ export default (f: Function) => {
|
|
|
15
16
|
});
|
|
16
17
|
|
|
17
18
|
let originalConsola: typeof consola;
|
|
18
|
-
// @ts-
|
|
19
|
+
// @ts-expect-error Property 'consola' does not exist on type 'typeof globalThis'.
|
|
19
20
|
if (global.consola) {
|
|
20
|
-
// @ts-
|
|
21
|
+
// @ts-expect-error Property 'consola' does not exist on type 'typeof globalThis'.
|
|
21
22
|
originalConsola = global.consola;
|
|
22
|
-
// @ts-
|
|
23
|
+
// @ts-expect-error Property 'consola' does not exist on type 'typeof globalThis'.
|
|
23
24
|
global.consola = consola.create({
|
|
24
25
|
level: -1,
|
|
25
26
|
});
|
|
@@ -30,7 +31,7 @@ export default (f: Function) => {
|
|
|
30
31
|
console[method] = originals[i];
|
|
31
32
|
});
|
|
32
33
|
if (originalConsola) {
|
|
33
|
-
// @ts-
|
|
34
|
+
// @ts-expect-error Property 'consola' does not exist on type 'typeof globalThis'.
|
|
34
35
|
global.consola = originalConsola;
|
|
35
36
|
}
|
|
36
37
|
};
|