@knime/hub-features 1.19.0 → 1.20.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/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/src/embeddingSDK/types.ts +1 -2
- package/src/useFileUpload/useFileUpload.ts +20 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @knime/hub-features
|
|
2
2
|
|
|
3
|
+
## 1.20.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c877d5a: NXT-4373: improve upload api
|
|
8
|
+
- Updated dependencies [c877d5a]
|
|
9
|
+
- @knime/components@1.45.6
|
|
10
|
+
|
|
11
|
+
## 1.20.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 63ed737: adjust analytics event structure
|
|
16
|
+
|
|
3
17
|
## 1.19.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knime/hub-features",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.1",
|
|
4
4
|
"description": "Vue components & composables for shared hub features",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"lodash-es": "4.17.23",
|
|
37
37
|
"ofetch": "^1.4.1",
|
|
38
38
|
"typescript": "^5.8.3",
|
|
39
|
-
"@knime/components": "1.45.
|
|
39
|
+
"@knime/components": "1.45.6",
|
|
40
40
|
"@knime/styles": "1.15.0",
|
|
41
41
|
"@knime/utils": "1.10.0"
|
|
42
42
|
},
|
|
@@ -34,6 +34,7 @@ type UseFileUploadOptions = {
|
|
|
34
34
|
uploadId: string;
|
|
35
35
|
filePartIds: Record<number, string>;
|
|
36
36
|
parentId: string;
|
|
37
|
+
name: string;
|
|
37
38
|
}) => void;
|
|
38
39
|
onFileUploadFailed?: (payload: {
|
|
39
40
|
uploadId: string;
|
|
@@ -193,8 +194,7 @@ export const useFileUpload = (options: UseFileUploadOptions = {}) => {
|
|
|
193
194
|
|
|
194
195
|
// contains upload ids for files that have a processing step which was not finished yet
|
|
195
196
|
const unprocessedUploads = reactive<Set<string>>(new Set());
|
|
196
|
-
const
|
|
197
|
-
knimeFileFormats.KNWF.matches(file);
|
|
197
|
+
const isKNWFFile = (file: File) => knimeFileFormats.KNWF.matches(file);
|
|
198
198
|
|
|
199
199
|
let useUploadManagerResult: ReturnType<typeof useUploadManager> | null = null;
|
|
200
200
|
|
|
@@ -219,11 +219,16 @@ export const useFileUpload = (options: UseFileUploadOptions = {}) => {
|
|
|
219
219
|
useUploadManagerResult = useUploadManager({
|
|
220
220
|
resolveFilePartUploadURL,
|
|
221
221
|
|
|
222
|
-
onFileUploadComplete: ({ uploadId, filePartIds, parentId }) => {
|
|
222
|
+
onFileUploadComplete: ({ uploadId, filePartIds, parentId, name }) => {
|
|
223
223
|
promise
|
|
224
224
|
.retryPromise({ fn: () => completeUpload(uploadId, filePartIds) })
|
|
225
225
|
.then(() => {
|
|
226
|
-
options.onFileUploadComplete?.({
|
|
226
|
+
options.onFileUploadComplete?.({
|
|
227
|
+
uploadId,
|
|
228
|
+
filePartIds,
|
|
229
|
+
parentId,
|
|
230
|
+
name,
|
|
231
|
+
});
|
|
227
232
|
})
|
|
228
233
|
.catch((error) => {
|
|
229
234
|
consola.error("Error attempting to complete upload", { error });
|
|
@@ -274,7 +279,12 @@ export const useFileUpload = (options: UseFileUploadOptions = {}) => {
|
|
|
274
279
|
isPreparingUpload: computed(() => prepareQueueSize.value > 0),
|
|
275
280
|
totalFilesBeingPrepared: computed(() => prepareQueueSize.value),
|
|
276
281
|
|
|
277
|
-
start: async (
|
|
282
|
+
start: async (
|
|
283
|
+
parentId: string,
|
|
284
|
+
files: File[],
|
|
285
|
+
options: { isFileWithProcessing?: typeof isKNWFFile } = {},
|
|
286
|
+
) => {
|
|
287
|
+
const { isFileWithProcessing = isKNWFFile } = options;
|
|
278
288
|
const enqueableFiles = getEnqueueableFiles(files);
|
|
279
289
|
const uploadSizeLimitBytes = getUploadSizeLimitBytes();
|
|
280
290
|
const oversizedFiles = enqueableFiles.filter(
|
|
@@ -294,7 +304,7 @@ export const useFileUpload = (options: UseFileUploadOptions = {}) => {
|
|
|
294
304
|
|
|
295
305
|
try {
|
|
296
306
|
if (enqueableFiles.length === 0) {
|
|
297
|
-
return;
|
|
307
|
+
return [];
|
|
298
308
|
}
|
|
299
309
|
|
|
300
310
|
prepareQueueSize.value += enqueableFiles.length;
|
|
@@ -313,9 +323,13 @@ export const useFileUpload = (options: UseFileUploadOptions = {}) => {
|
|
|
313
323
|
}
|
|
314
324
|
});
|
|
315
325
|
|
|
326
|
+
const uploadIds = uploadPayload.map((upload) => upload.uploadId);
|
|
327
|
+
|
|
316
328
|
// accept floating promise, errors are handled inside the function
|
|
317
329
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
318
330
|
useUploadManagerResult.start(parentId, uploadPayload);
|
|
331
|
+
|
|
332
|
+
return uploadIds;
|
|
319
333
|
} catch (error) {
|
|
320
334
|
throw rfcErrors.tryParse(error) ?? error;
|
|
321
335
|
} finally {
|