@swiss-ai-hub/web 0.305.5 → 0.305.6
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.
|
@@ -11,7 +11,7 @@ export interface UploadFileOptions {
|
|
|
11
11
|
namespace: string
|
|
12
12
|
database: string
|
|
13
13
|
tenantId: string
|
|
14
|
-
onProgress?: () => void
|
|
14
|
+
onProgress?: (percent: number) => void
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// Map extensions to MIME types for files where browser fails
|
|
@@ -54,12 +54,18 @@ export const useFileUpload = defineMutation(() => {
|
|
|
54
54
|
},
|
|
55
55
|
})
|
|
56
56
|
|
|
57
|
-
await
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
await new Promise<void>((resolve, reject) => {
|
|
58
|
+
const xhr = new XMLHttpRequest()
|
|
59
|
+
|
|
60
|
+
xhr.open('PUT', initiateResponse.upload_url)
|
|
61
|
+
xhr.setRequestHeader('Content-Type', contentType)
|
|
62
|
+
xhr.upload.onprogress = (e) => {
|
|
63
|
+
if (e.lengthComputable) options.onProgress?.(Math.round((e.loaded / e.total) * 100))
|
|
64
|
+
}
|
|
65
|
+
xhr.onload = () => (xhr.status < 400 ? resolve() : reject(new Error(`Upload failed: ${xhr.status}`)))
|
|
66
|
+
xhr.onerror = () => reject(new Error('Upload network error'))
|
|
67
|
+
|
|
68
|
+
xhr.send(file)
|
|
63
69
|
})
|
|
64
70
|
|
|
65
71
|
const validationRequest: DocumentUploadValidationRequest = {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"license": "AGPL-3.0-or-later",
|
|
4
4
|
"author": "bbv Software Services AG (https://www.bbv.ch)",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "0.305.
|
|
6
|
+
"version": "0.305.6",
|
|
7
7
|
"description": "Swiss AI Hub - Admin & Management UI (Nuxt 3 layer)",
|
|
8
8
|
"main": "./nuxt.config.ts",
|
|
9
9
|
"repository": {
|