@knime/hub-features 1.10.4 → 1.10.5
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
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knime/hub-features",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.5",
|
|
4
4
|
"description": "Vue components & composables for shared hub features",
|
|
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)",
|
|
@@ -18,8 +18,20 @@ type ArtifactStatusResponse = {
|
|
|
18
18
|
downloadUrl?: string;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
// Initial request can have either download url (if it can be downloaded immediately) or download id (to poll for the status)
|
|
22
|
+
type RequestDownloadResponse =
|
|
23
|
+
| {
|
|
24
|
+
downloadId: string;
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
downloadUrl: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// type guard
|
|
31
|
+
const hasDownloadUrl = (
|
|
32
|
+
response: RequestDownloadResponse,
|
|
33
|
+
): response is { downloadUrl: string } => {
|
|
34
|
+
return "downloadUrl" in response;
|
|
23
35
|
};
|
|
24
36
|
|
|
25
37
|
/**
|
|
@@ -255,24 +267,20 @@ export const useDownloadArtifact = (
|
|
|
255
267
|
query: { version },
|
|
256
268
|
},
|
|
257
269
|
);
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
// download is ready immediately, no polling needed
|
|
264
|
-
downloadStatusResponse?.status === "READY" &&
|
|
265
|
-
downloadStatusResponse?.downloadUrl
|
|
266
|
-
) {
|
|
267
|
-
openDownload(downloadStatusResponse.downloadUrl);
|
|
268
|
-
} else {
|
|
269
|
-
await pollDownloadItem({
|
|
270
|
-
itemId,
|
|
271
|
-
version,
|
|
272
|
-
downloadId,
|
|
273
|
-
name,
|
|
274
|
-
});
|
|
270
|
+
|
|
271
|
+
// if download is ready, open url immediately
|
|
272
|
+
if (hasDownloadUrl(response)) {
|
|
273
|
+
openDownload(response.downloadUrl);
|
|
274
|
+
return;
|
|
275
275
|
}
|
|
276
|
+
|
|
277
|
+
// otherwise start polling download status
|
|
278
|
+
await pollDownloadItem({
|
|
279
|
+
itemId,
|
|
280
|
+
version,
|
|
281
|
+
downloadId: response.downloadId,
|
|
282
|
+
name,
|
|
283
|
+
});
|
|
276
284
|
} catch (error: unknown) {
|
|
277
285
|
// here only errors thrown by the initial requests are caught;
|
|
278
286
|
// errors occurring while polling will be handled in pollDownloadItem
|