@knime/utils 1.7.1 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/package.json +5 -3
- package/src/index.ts +0 -3
- package/src/uploadManager/index.ts +5 -8
- package/src/fileTypeIcons.ts +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @knime/utils
|
|
2
2
|
|
|
3
|
+
## 1.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c4bd90d: treat etags in upload as optional, adjust docs
|
|
8
|
+
|
|
9
|
+
## 1.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- f2d266c: Move `icons` and `isIconExisting` from @knime/utils to @knime/components and rename to `fileTypeIcons` and `isFileTypeIconExisting` respectively.
|
|
14
|
+
- f2d266c: Updated node version range for support for node 22 - 24
|
|
15
|
+
|
|
3
16
|
## 1.7.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knime/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Internal utility functions and constants shared across @knime packages.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"date-fns": "2.30.0",
|
|
16
16
|
"date-fns-tz": "2.0.0",
|
|
17
|
-
"dompurify": "^3.2.7"
|
|
18
|
-
"@knime/styles": "1.14.3"
|
|
17
|
+
"dompurify": "^3.2.7"
|
|
19
18
|
},
|
|
20
19
|
"peerDependencies": {
|
|
21
20
|
"consola": "3.x"
|
|
@@ -45,6 +44,9 @@
|
|
|
45
44
|
"import": "./test-utils/index.ts"
|
|
46
45
|
}
|
|
47
46
|
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=22 <25"
|
|
49
|
+
},
|
|
48
50
|
"scripts": {
|
|
49
51
|
"test:unit": "TZ='Europe/Berlin' vitest"
|
|
50
52
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { capitalize, caseFormatter } from "./capitalize";
|
|
2
2
|
import { isAfterMaxDate, isBeforeMinDate } from "./dateMinMaxCheck";
|
|
3
3
|
import debounce from "./debounce";
|
|
4
|
-
import { icons, isIconExisting } from "./fileTypeIcons";
|
|
5
4
|
import { filters } from "./filters";
|
|
6
5
|
import {
|
|
7
6
|
formatDateString,
|
|
@@ -62,10 +61,8 @@ export {
|
|
|
62
61
|
getLocalTimeZone,
|
|
63
62
|
getWrappedAroundIndex,
|
|
64
63
|
hotkeys,
|
|
65
|
-
icons,
|
|
66
64
|
isAfterMaxDate,
|
|
67
65
|
isBeforeMinDate,
|
|
68
|
-
isIconExisting,
|
|
69
66
|
intervalUtils,
|
|
70
67
|
navigatorUtils,
|
|
71
68
|
numIntegerDigits,
|
|
@@ -28,6 +28,7 @@ const uploadChunkWithProgress = (params: {
|
|
|
28
28
|
const { method, url, chunk, chunkIndex, onProgress, abortSignal } = params;
|
|
29
29
|
|
|
30
30
|
const OK = 200;
|
|
31
|
+
const CREATED = 201;
|
|
31
32
|
|
|
32
33
|
return new Promise<{ partId: string }>((resolve, reject) => {
|
|
33
34
|
const xhr = new XMLHttpRequest();
|
|
@@ -44,17 +45,13 @@ const uploadChunkWithProgress = (params: {
|
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
xhr.onload = () => {
|
|
47
|
-
if (xhr.status === OK) {
|
|
48
|
+
if (xhr.status === OK || xhr.status === CREATED) {
|
|
48
49
|
const etag = xhr.getResponseHeader("ETag");
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// remove possible doublequotes (") around the etag and/or weak identifier (if either is present)
|
|
51
|
+
// 1. note that some backends don't return the etag header, then we just set an empty string
|
|
52
|
+
// 2. remove possible doublequotes (") around the etag and/or weak identifier (if either is present)
|
|
56
53
|
// https://datatracker.ietf.org/doc/html/rfc7232#section-2.3
|
|
57
|
-
resolve({ partId: etag
|
|
54
|
+
resolve({ partId: etag?.replace(/^(?:W\/)?"|"$/g, "") ?? "" });
|
|
58
55
|
} else {
|
|
59
56
|
consola.error("Failed or unexpected XHR response", {
|
|
60
57
|
xhrStatus: xhr.status,
|
package/src/fileTypeIcons.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import csvIcon from "@knime/styles/img/icons/file-csv.svg";
|
|
2
|
-
import docxIcon from "@knime/styles/img/icons/file-docx.svg";
|
|
3
|
-
import htmlIcon from "@knime/styles/img/icons/file-html.svg";
|
|
4
|
-
import mdIcon from "@knime/styles/img/icons/file-md.svg";
|
|
5
|
-
import odpIcon from "@knime/styles/img/icons/file-odp.svg";
|
|
6
|
-
import odsIcon from "@knime/styles/img/icons/file-ods.svg";
|
|
7
|
-
import odtIcon from "@knime/styles/img/icons/file-odt.svg";
|
|
8
|
-
import pdfIcon from "@knime/styles/img/icons/file-pdf.svg";
|
|
9
|
-
import pptxIcon from "@knime/styles/img/icons/file-pptx.svg";
|
|
10
|
-
import psIcon from "@knime/styles/img/icons/file-ps.svg";
|
|
11
|
-
import fileIcon from "@knime/styles/img/icons/file-question.svg";
|
|
12
|
-
import txtIcon from "@knime/styles/img/icons/file-text.svg";
|
|
13
|
-
import xlsIcon from "@knime/styles/img/icons/file-xls.svg";
|
|
14
|
-
import xlsxIcon from "@knime/styles/img/icons/file-xlsx.svg";
|
|
15
|
-
import xmlIcon from "@knime/styles/img/icons/file-xml.svg";
|
|
16
|
-
import exeIcon from "@knime/styles/img/icons/file-zip-exe.svg";
|
|
17
|
-
import zipIcon from "@knime/styles/img/icons/file-zip.svg";
|
|
18
|
-
|
|
19
|
-
export const icons = {
|
|
20
|
-
csvIcon,
|
|
21
|
-
docxIcon,
|
|
22
|
-
htmlIcon,
|
|
23
|
-
mdIcon,
|
|
24
|
-
odpIcon,
|
|
25
|
-
odsIcon,
|
|
26
|
-
odtIcon,
|
|
27
|
-
pdfIcon,
|
|
28
|
-
pptxIcon,
|
|
29
|
-
psIcon,
|
|
30
|
-
xlsIcon,
|
|
31
|
-
xlsxIcon,
|
|
32
|
-
xmlIcon,
|
|
33
|
-
zipIcon,
|
|
34
|
-
exeIcon,
|
|
35
|
-
txtIcon,
|
|
36
|
-
fileIcon,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const isIconExisting = function (iconName: string): boolean {
|
|
40
|
-
return icons.hasOwnProperty(iconName);
|
|
41
|
-
};
|