@visulima/storage-client 1.0.0-alpha.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 +10 -0
- package/LICENSE.md +27 -0
- package/README.md +71 -0
- package/dist/core/chunked-rest-adapter.d.ts +43 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/multipart-adapter.d.ts +34 -0
- package/dist/core/query-client.d.ts +57 -0
- package/dist/core/query-keys.d.ts +34 -0
- package/dist/core/tus-adapter.d.ts +43 -0
- package/dist/core/uploader.d.ts +183 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/packem_shared/createAbortAll-B5vFFliA.js +1 -0
- package/dist/packem_shared/createAbortAll-D-x-LWNg.js +1 -0
- package/dist/packem_shared/createAbortBatch-CYtSbWfz.js +1 -0
- package/dist/packem_shared/createAbortBatch-zA0PTnOB.js +1 -0
- package/dist/packem_shared/createAbortItem-0f0bigbq.js +1 -0
- package/dist/packem_shared/createAbortItem-CIRlRD4X.js +1 -0
- package/dist/packem_shared/createAllAbortListener-CDrnG87k.js +1 -0
- package/dist/packem_shared/createAllAbortListener-CYLEWan0.js +1 -0
- package/dist/packem_shared/createBatchCancelledListener-Deq8lrIn.js +1 -0
- package/dist/packem_shared/createBatchCancelledListener-l9c0mi15.js +1 -0
- package/dist/packem_shared/createBatchDeleteFiles-B0SYSdYj.js +1 -0
- package/dist/packem_shared/createBatchDeleteFiles-Z4S-30eN.js +1 -0
- package/dist/packem_shared/createBatchErrorListener-CGJPEngL.js +1 -0
- package/dist/packem_shared/createBatchErrorListener-CJQFdXW2.js +1 -0
- package/dist/packem_shared/createBatchFinalizeListener-B2rEps7g.js +1 -0
- package/dist/packem_shared/createBatchFinalizeListener-Og0rELSL.js +1 -0
- package/dist/packem_shared/createBatchFinishListener-BeE6-b6E.js +1 -0
- package/dist/packem_shared/createBatchFinishListener-D9AOd6Cl.js +1 -0
- package/dist/packem_shared/createBatchProgressListener-1KpCpw7e.js +1 -0
- package/dist/packem_shared/createBatchProgressListener-BWW_tnse.js +1 -0
- package/dist/packem_shared/createBatchRetry-6E_Ivzh4.js +1 -0
- package/dist/packem_shared/createBatchRetry-D_F4v9oA.js +1 -0
- package/dist/packem_shared/createBatchStartListener-CkcMX3tq.js +1 -0
- package/dist/packem_shared/createBatchStartListener-DBHjoANG.js +1 -0
- package/dist/packem_shared/createBatchUpload-8yahZiID.js +1 -0
- package/dist/packem_shared/createBatchUpload-DWcVWF9h.js +1 -0
- package/dist/packem_shared/createChunkedRestAdapter-Df1E_Adn.js +1 -0
- package/dist/packem_shared/createChunkedRestUpload-CJNQp68Z.js +1 -0
- package/dist/packem_shared/createChunkedRestUpload-DZIOry7M.js +1 -0
- package/dist/packem_shared/createDeleteFile-DsUMoSxn.js +1 -0
- package/dist/packem_shared/createDeleteFile-_Znrnika.js +1 -0
- package/dist/packem_shared/createFileInput-B7WPz_-r.js +1 -0
- package/dist/packem_shared/createFileInput-TTI-EsSq.js +1 -0
- package/dist/packem_shared/createGetFile-BOV5S7mX.js +1 -0
- package/dist/packem_shared/createGetFile-CY2ohQF-.js +1 -0
- package/dist/packem_shared/createGetFileList-DGZQymc5.js +1 -0
- package/dist/packem_shared/createGetFileList-ZF0Luf6h.js +1 -0
- package/dist/packem_shared/createGetFileMeta-50LymNvf.js +1 -0
- package/dist/packem_shared/createGetFileMeta-DmC_OvP4.js +1 -0
- package/dist/packem_shared/createHeadFile-CGD6bHDS.js +1 -0
- package/dist/packem_shared/createHeadFile-DYb9FeQ1.js +1 -0
- package/dist/packem_shared/createMultipartAdapter-CoJpvX9z.js +1 -0
- package/dist/packem_shared/createMultipartUpload-CTats5BN.js +1 -0
- package/dist/packem_shared/createMultipartUpload-DF3XyOX3.js +1 -0
- package/dist/packem_shared/createPasteUpload-BS7pMOvb.js +1 -0
- package/dist/packem_shared/createPasteUpload-DemCREgp.js +1 -0
- package/dist/packem_shared/createPatchChunk-DqCMbHjI.js +1 -0
- package/dist/packem_shared/createPatchChunk-Zy6I60LN.js +1 -0
- package/dist/packem_shared/createPutFile-D8hN-9Ai.js +1 -0
- package/dist/packem_shared/createPutFile-DJraow7z.js +1 -0
- package/dist/packem_shared/createRetry-DPaN9i_a.js +1 -0
- package/dist/packem_shared/createRetry-D_fXIQUj.js +1 -0
- package/dist/packem_shared/createRetryListener-DonB2P-g.js +1 -0
- package/dist/packem_shared/createRetryListener-bMqMm13Y.js +1 -0
- package/dist/packem_shared/createTransformFile-C2fVfiwL.js +1 -0
- package/dist/packem_shared/createTransformFile-CJXLJEfg.js +1 -0
- package/dist/packem_shared/createTransformMetadata-BImjFF_i.js +1 -0
- package/dist/packem_shared/createTransformMetadata-zyl5UymO.js +1 -0
- package/dist/packem_shared/createTusAdapter-DM31lujI.js +1 -0
- package/dist/packem_shared/createTusUpload-BoM0S0Or.js +1 -0
- package/dist/packem_shared/createTusUpload-ClmXqmcz.js +1 -0
- package/dist/packem_shared/createUpload-CuZqq0nu.js +1 -0
- package/dist/packem_shared/createUpload-LRQ4N_cF.js +1 -0
- package/dist/packem_shared/createUploader-B_IjjBxw.js +1 -0
- package/dist/packem_shared/parseApiError-CUagSahh.js +1 -0
- package/dist/packem_shared/storageQueryKeys-cD4rL4b1.js +1 -0
- package/dist/packem_shared/useAbortAll-DeTTc8gX.js +1 -0
- package/dist/packem_shared/useAbortAll-DrHBz3kQ.js +1 -0
- package/dist/packem_shared/useAbortBatch-BoXLZH9d.js +1 -0
- package/dist/packem_shared/useAbortBatch-gVI48Gqa.js +1 -0
- package/dist/packem_shared/useAbortItem-Blw0eI13.js +1 -0
- package/dist/packem_shared/useAbortItem-DOVDiZFG.js +1 -0
- package/dist/packem_shared/useAllAbortListener-CadZ6Ohd.js +1 -0
- package/dist/packem_shared/useAllAbortListener-DiliYPra.js +1 -0
- package/dist/packem_shared/useBatchCancelledListener-CADhAnT8.js +1 -0
- package/dist/packem_shared/useBatchCancelledListener-CD0CULd_.js +1 -0
- package/dist/packem_shared/useBatchDeleteFiles-ASYuAVXn.js +1 -0
- package/dist/packem_shared/useBatchDeleteFiles-KthW4bon.js +1 -0
- package/dist/packem_shared/useBatchErrorListener-C3KwlH_D.js +1 -0
- package/dist/packem_shared/useBatchErrorListener-D-M1xGbQ.js +1 -0
- package/dist/packem_shared/useBatchFinalizeListener-BjnW3Lst.js +1 -0
- package/dist/packem_shared/useBatchFinalizeListener-CuVe9PGl.js +1 -0
- package/dist/packem_shared/useBatchFinishListener-4RjAPVhl.js +1 -0
- package/dist/packem_shared/useBatchFinishListener-DedP4Rm_.js +1 -0
- package/dist/packem_shared/useBatchProgressListener-CBAjGzmu.js +1 -0
- package/dist/packem_shared/useBatchProgressListener-CoYeF3Zj.js +1 -0
- package/dist/packem_shared/useBatchRetry-C53msBuL.js +1 -0
- package/dist/packem_shared/useBatchRetry-CAqFm7V8.js +1 -0
- package/dist/packem_shared/useBatchStartListener-BAOxxo1Y.js +1 -0
- package/dist/packem_shared/useBatchStartListener-DwAzFph7.js +1 -0
- package/dist/packem_shared/useBatchUpload-DLQNW410.js +1 -0
- package/dist/packem_shared/useBatchUpload-xPQlYOIK.js +1 -0
- package/dist/packem_shared/useChunkedRestUpload-DmXiSpyb.js +1 -0
- package/dist/packem_shared/useChunkedRestUpload-cKHvYQN3.js +1 -0
- package/dist/packem_shared/useDeleteFile-CND-6aNW.js +1 -0
- package/dist/packem_shared/useDeleteFile-CZUMjbYV.js +1 -0
- package/dist/packem_shared/useFileInput-Dvy2fNU7.js +1 -0
- package/dist/packem_shared/useFileInput-hIbzJ_JN.js +1 -0
- package/dist/packem_shared/useGetFile-CuST4rUN.js +1 -0
- package/dist/packem_shared/useGetFile-DvgluPgA.js +1 -0
- package/dist/packem_shared/useGetFileList-BiYDlEAl.js +1 -0
- package/dist/packem_shared/useGetFileList-D0tKDYAc.js +1 -0
- package/dist/packem_shared/useGetFileMeta-C2U1PExr.js +1 -0
- package/dist/packem_shared/useGetFileMeta-Ekre98Sg.js +1 -0
- package/dist/packem_shared/useHeadFile-CCu61b-B.js +1 -0
- package/dist/packem_shared/useHeadFile-DBQdkWZG.js +1 -0
- package/dist/packem_shared/useMultipartUpload-B9Vi7f5z.js +1 -0
- package/dist/packem_shared/useMultipartUpload-CIp4NLzf.js +1 -0
- package/dist/packem_shared/usePasteUpload-COdUC9xU.js +1 -0
- package/dist/packem_shared/usePasteUpload-_YqkCkrL.js +1 -0
- package/dist/packem_shared/usePatchChunk-BO3S0Tx4.js +1 -0
- package/dist/packem_shared/usePatchChunk-DoKsCbBH.js +1 -0
- package/dist/packem_shared/usePutFile-B6cFjClD.js +1 -0
- package/dist/packem_shared/usePutFile-bQl10v42.js +1 -0
- package/dist/packem_shared/useRetry-Dsq4jvkt.js +1 -0
- package/dist/packem_shared/useRetry-mkTUERYR.js +1 -0
- package/dist/packem_shared/useRetryListener-B45dL00Q.js +1 -0
- package/dist/packem_shared/useRetryListener-BEONt1sx.js +1 -0
- package/dist/packem_shared/useTransformFile-DmfsqTjp.js +1 -0
- package/dist/packem_shared/useTransformFile-sIkJLAwo.js +1 -0
- package/dist/packem_shared/useTransformMetadata-B0JbX1Ni.js +1 -0
- package/dist/packem_shared/useTransformMetadata-DK1561-K.js +1 -0
- package/dist/packem_shared/useTusUpload-CDRjQl0e.js +1 -0
- package/dist/packem_shared/useTusUpload-Cn1UeWo4.js +1 -0
- package/dist/packem_shared/useUpload-B_RxNnHC.js +1 -0
- package/dist/packem_shared/useUpload-CjLWLpyn.js +1 -0
- package/dist/react/index.d.ts +61 -0
- package/dist/react/index.js +1 -0
- package/dist/react/types.d.ts +65 -0
- package/dist/react/use-abort-all.d.ts +16 -0
- package/dist/react/use-abort-batch.d.ts +16 -0
- package/dist/react/use-abort-item.d.ts +16 -0
- package/dist/react/use-all-abort-listener.d.ts +14 -0
- package/dist/react/use-batch-cancelled-listener.d.ts +14 -0
- package/dist/react/use-batch-delete-files.d.ts +32 -0
- package/dist/react/use-batch-error-listener.d.ts +14 -0
- package/dist/react/use-batch-finalize-listener.d.ts +15 -0
- package/dist/react/use-batch-finish-listener.d.ts +14 -0
- package/dist/react/use-batch-progress-listener.d.ts +14 -0
- package/dist/react/use-batch-retry.d.ts +16 -0
- package/dist/react/use-batch-start-listener.d.ts +14 -0
- package/dist/react/use-batch-upload.d.ts +42 -0
- package/dist/react/use-chunked-rest-upload.d.ts +55 -0
- package/dist/react/use-delete-file.d.ts +25 -0
- package/dist/react/use-file-input.d.ts +32 -0
- package/dist/react/use-get-file-list.d.ts +46 -0
- package/dist/react/use-get-file-meta.d.ts +29 -0
- package/dist/react/use-get-file.d.ts +34 -0
- package/dist/react/use-head-file.d.ts +49 -0
- package/dist/react/use-multipart-upload.d.ts +35 -0
- package/dist/react/use-paste-upload.d.ts +20 -0
- package/dist/react/use-patch-chunk.d.ts +29 -0
- package/dist/react/use-put-file.d.ts +32 -0
- package/dist/react/use-retry-listener.d.ts +15 -0
- package/dist/react/use-retry.d.ts +16 -0
- package/dist/react/use-transform-file.d.ts +48 -0
- package/dist/react/use-transform-metadata.d.ts +33 -0
- package/dist/react/use-tus-upload.d.ts +55 -0
- package/dist/react/use-upload.d.ts +69 -0
- package/dist/solid/create-abort-all.d.ts +8 -0
- package/dist/solid/create-abort-batch.d.ts +8 -0
- package/dist/solid/create-abort-item.d.ts +8 -0
- package/dist/solid/create-all-abort-listener.d.ts +7 -0
- package/dist/solid/create-batch-cancelled-listener.d.ts +7 -0
- package/dist/solid/create-batch-delete-files.d.ts +29 -0
- package/dist/solid/create-batch-error-listener.d.ts +7 -0
- package/dist/solid/create-batch-finalize-listener.d.ts +7 -0
- package/dist/solid/create-batch-finish-listener.d.ts +7 -0
- package/dist/solid/create-batch-progress-listener.d.ts +7 -0
- package/dist/solid/create-batch-retry.d.ts +8 -0
- package/dist/solid/create-batch-start-listener.d.ts +7 -0
- package/dist/solid/create-batch-upload.d.ts +43 -0
- package/dist/solid/create-chunked-rest-upload.d.ts +56 -0
- package/dist/solid/create-delete-file.d.ts +22 -0
- package/dist/solid/create-file-input.d.ts +20 -0
- package/dist/solid/create-get-file-list.d.ts +46 -0
- package/dist/solid/create-get-file-meta.d.ts +29 -0
- package/dist/solid/create-get-file.d.ts +38 -0
- package/dist/solid/create-head-file.d.ts +46 -0
- package/dist/solid/create-multipart-upload.d.ts +36 -0
- package/dist/solid/create-paste-upload.d.ts +11 -0
- package/dist/solid/create-patch-chunk.d.ts +26 -0
- package/dist/solid/create-put-file.d.ts +29 -0
- package/dist/solid/create-retry-listener.d.ts +7 -0
- package/dist/solid/create-retry.d.ts +8 -0
- package/dist/solid/create-transform-file.d.ts +45 -0
- package/dist/solid/create-transform-metadata.d.ts +30 -0
- package/dist/solid/create-tus-upload.d.ts +56 -0
- package/dist/solid/create-upload.d.ts +70 -0
- package/dist/solid/index.d.ts +60 -0
- package/dist/solid/index.js +1 -0
- package/dist/svelte/create-abort-all.d.ts +8 -0
- package/dist/svelte/create-abort-batch.d.ts +8 -0
- package/dist/svelte/create-abort-item.d.ts +8 -0
- package/dist/svelte/create-all-abort-listener.d.ts +7 -0
- package/dist/svelte/create-batch-cancelled-listener.d.ts +7 -0
- package/dist/svelte/create-batch-delete-files.d.ts +29 -0
- package/dist/svelte/create-batch-error-listener.d.ts +7 -0
- package/dist/svelte/create-batch-finalize-listener.d.ts +7 -0
- package/dist/svelte/create-batch-finish-listener.d.ts +7 -0
- package/dist/svelte/create-batch-progress-listener.d.ts +7 -0
- package/dist/svelte/create-batch-retry.d.ts +8 -0
- package/dist/svelte/create-batch-start-listener.d.ts +7 -0
- package/dist/svelte/create-batch-upload.d.ts +23 -0
- package/dist/svelte/create-chunked-rest-upload.d.ts +56 -0
- package/dist/svelte/create-delete-file.d.ts +26 -0
- package/dist/svelte/create-file-input.d.ts +19 -0
- package/dist/svelte/create-get-file-list.d.ts +43 -0
- package/dist/svelte/create-get-file-meta.d.ts +26 -0
- package/dist/svelte/create-get-file.d.ts +41 -0
- package/dist/svelte/create-head-file.d.ts +46 -0
- package/dist/svelte/create-multipart-upload.d.ts +36 -0
- package/dist/svelte/create-paste-upload.d.ts +11 -0
- package/dist/svelte/create-patch-chunk.d.ts +26 -0
- package/dist/svelte/create-put-file.d.ts +29 -0
- package/dist/svelte/create-retry-listener.d.ts +7 -0
- package/dist/svelte/create-retry.d.ts +8 -0
- package/dist/svelte/create-transform-file.d.ts +45 -0
- package/dist/svelte/create-transform-metadata.d.ts +30 -0
- package/dist/svelte/create-tus-upload.d.ts +56 -0
- package/dist/svelte/create-upload.d.ts +68 -0
- package/dist/svelte/index.d.ts +60 -0
- package/dist/svelte/index.js +1 -0
- package/dist/vue/index.d.ts +60 -0
- package/dist/vue/index.js +1 -0
- package/dist/vue/use-abort-all.d.ts +16 -0
- package/dist/vue/use-abort-batch.d.ts +16 -0
- package/dist/vue/use-abort-item.d.ts +16 -0
- package/dist/vue/use-all-abort-listener.d.ts +14 -0
- package/dist/vue/use-batch-cancelled-listener.d.ts +14 -0
- package/dist/vue/use-batch-delete-files.d.ts +29 -0
- package/dist/vue/use-batch-error-listener.d.ts +14 -0
- package/dist/vue/use-batch-finalize-listener.d.ts +15 -0
- package/dist/vue/use-batch-finish-listener.d.ts +14 -0
- package/dist/vue/use-batch-progress-listener.d.ts +14 -0
- package/dist/vue/use-batch-retry.d.ts +16 -0
- package/dist/vue/use-batch-start-listener.d.ts +14 -0
- package/dist/vue/use-batch-upload.d.ts +43 -0
- package/dist/vue/use-chunked-rest-upload.d.ts +56 -0
- package/dist/vue/use-delete-file.d.ts +22 -0
- package/dist/vue/use-file-input.d.ts +33 -0
- package/dist/vue/use-get-file-list.d.ts +43 -0
- package/dist/vue/use-get-file-meta.d.ts +26 -0
- package/dist/vue/use-get-file.d.ts +35 -0
- package/dist/vue/use-head-file.d.ts +46 -0
- package/dist/vue/use-multipart-upload.d.ts +36 -0
- package/dist/vue/use-paste-upload.d.ts +21 -0
- package/dist/vue/use-patch-chunk.d.ts +26 -0
- package/dist/vue/use-put-file.d.ts +29 -0
- package/dist/vue/use-retry-listener.d.ts +15 -0
- package/dist/vue/use-retry.d.ts +16 -0
- package/dist/vue/use-transform-file.d.ts +45 -0
- package/dist/vue/use-transform-metadata.d.ts +30 -0
- package/dist/vue/use-tus-upload.d.ts +56 -0
- package/dist/vue/use-upload.d.ts +68 -0
- package/package.json +101 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
import type { UploadResult } from "../react/types.d.ts";
|
|
3
|
+
export interface UseChunkedRestUploadOptions {
|
|
4
|
+
/** Chunk size for chunked REST uploads (default: 5MB) */
|
|
5
|
+
chunkSize?: number;
|
|
6
|
+
/** Chunked REST upload endpoint URL */
|
|
7
|
+
endpoint: string;
|
|
8
|
+
/** Maximum number of retry attempts */
|
|
9
|
+
maxRetries?: number;
|
|
10
|
+
/** Additional metadata to include with the upload */
|
|
11
|
+
metadata?: Record<string, string>;
|
|
12
|
+
/** Callback when upload fails */
|
|
13
|
+
onError?: (error: Error) => void;
|
|
14
|
+
/** Callback when upload is paused */
|
|
15
|
+
onPause?: () => void;
|
|
16
|
+
/** Callback when upload progress updates */
|
|
17
|
+
onProgress?: (progress: number, offset: number) => void;
|
|
18
|
+
/** Callback when upload is resumed */
|
|
19
|
+
onResume?: () => void;
|
|
20
|
+
/** Callback when upload starts */
|
|
21
|
+
onStart?: () => void;
|
|
22
|
+
/** Callback when upload completes successfully */
|
|
23
|
+
onSuccess?: (file: UploadResult) => void;
|
|
24
|
+
/** Enable automatic retry on failure */
|
|
25
|
+
retry?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface UseChunkedRestUploadReturn {
|
|
28
|
+
/** Abort the current upload */
|
|
29
|
+
abort: () => void;
|
|
30
|
+
/** Last upload error, if any */
|
|
31
|
+
error: Ref<Error | undefined>;
|
|
32
|
+
/** Whether the upload is paused */
|
|
33
|
+
isPaused: Ref<boolean>;
|
|
34
|
+
/** Whether an upload is currently in progress */
|
|
35
|
+
isUploading: Ref<boolean>;
|
|
36
|
+
/** Current upload offset (bytes uploaded) */
|
|
37
|
+
offset: Ref<number>;
|
|
38
|
+
/** Pause the current upload */
|
|
39
|
+
pause: () => void;
|
|
40
|
+
/** Current upload progress (0-100) */
|
|
41
|
+
progress: Ref<number>;
|
|
42
|
+
/** Reset upload state */
|
|
43
|
+
reset: () => void;
|
|
44
|
+
/** Last upload result, if any */
|
|
45
|
+
result: Ref<UploadResult | undefined>;
|
|
46
|
+
/** Resume a paused upload */
|
|
47
|
+
resume: () => Promise<void>;
|
|
48
|
+
/** Upload a file using chunked REST protocol */
|
|
49
|
+
upload: (file: File) => Promise<UploadResult>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Vue composable for chunked REST file uploads.
|
|
53
|
+
* @param options Upload configuration options
|
|
54
|
+
* @returns Upload functions and state
|
|
55
|
+
*/
|
|
56
|
+
export declare const useChunkedRestUpload: (options: UseChunkedRestUploadOptions) => UseChunkedRestUploadReturn;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
export interface UseDeleteFileOptions {
|
|
3
|
+
/** Base endpoint URL for file operations */
|
|
4
|
+
endpoint: string;
|
|
5
|
+
}
|
|
6
|
+
export interface UseDeleteFileReturn {
|
|
7
|
+
/** Delete a file by ID */
|
|
8
|
+
deleteFile: (id: string) => Promise<void>;
|
|
9
|
+
/** Last request error, if any */
|
|
10
|
+
error: Readonly<Ref<Error | undefined>>;
|
|
11
|
+
/** Whether a request is currently in progress */
|
|
12
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
13
|
+
/** Reset mutation state */
|
|
14
|
+
reset: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Vue composable for deleting a single file using TanStack Query.
|
|
18
|
+
* Automatically invalidates related queries.
|
|
19
|
+
* @param options Hook configuration options
|
|
20
|
+
* @returns File deletion functions and state
|
|
21
|
+
*/
|
|
22
|
+
export declare const useDeleteFile: (options: UseDeleteFileOptions) => UseDeleteFileReturn;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
export interface UseFileInputOptions {
|
|
3
|
+
/** Accept file types (e.g., "image/*", ".pdf") */
|
|
4
|
+
accept?: string;
|
|
5
|
+
/** Whether to allow multiple file selection */
|
|
6
|
+
multiple?: boolean;
|
|
7
|
+
/** Callback when files are selected */
|
|
8
|
+
onFilesSelected?: (files: File[]) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface UseFileInputReturn {
|
|
11
|
+
/** Currently selected files */
|
|
12
|
+
files: Ref<File[]>;
|
|
13
|
+
/** Handle drag leave event */
|
|
14
|
+
handleDragLeave: (event: DragEvent) => void;
|
|
15
|
+
/** Handle drag and drop events */
|
|
16
|
+
handleDragOver: (event: DragEvent) => void;
|
|
17
|
+
/** Handle drop event */
|
|
18
|
+
handleDrop: (event: DragEvent) => void;
|
|
19
|
+
/** Handle file input change event */
|
|
20
|
+
handleFileChange: (event: Event) => void;
|
|
21
|
+
/** File input element ref */
|
|
22
|
+
inputRef: Ref<HTMLInputElement | undefined>;
|
|
23
|
+
/** Open file dialog programmatically */
|
|
24
|
+
openFileDialog: () => void;
|
|
25
|
+
/** Reset selected files */
|
|
26
|
+
reset: () => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Vue composable for file input handling with drag & drop support.
|
|
30
|
+
* @param options Configuration options
|
|
31
|
+
* @returns File input functions and state
|
|
32
|
+
*/
|
|
33
|
+
export declare const useFileInput: (options?: UseFileInputOptions) => UseFileInputReturn;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter, Ref } from "vue";
|
|
2
|
+
import type { FileMeta } from "../react/types.d.ts";
|
|
3
|
+
export interface FileListResponse {
|
|
4
|
+
data: FileMeta[];
|
|
5
|
+
meta?: {
|
|
6
|
+
firstPage?: number;
|
|
7
|
+
firstPageUrl?: string;
|
|
8
|
+
lastPage?: number;
|
|
9
|
+
lastPageUrl?: string;
|
|
10
|
+
nextPageUrl?: string | undefined;
|
|
11
|
+
page?: number;
|
|
12
|
+
perPage?: number;
|
|
13
|
+
previousPageUrl?: string | undefined;
|
|
14
|
+
total?: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface UseGetFileListOptions {
|
|
18
|
+
/** Whether to enable the query */
|
|
19
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
20
|
+
/** Base endpoint URL for file operations */
|
|
21
|
+
endpoint: string;
|
|
22
|
+
/** Maximum number of elements to retrieve */
|
|
23
|
+
limit?: MaybeRefOrGetter<number | undefined>;
|
|
24
|
+
/** Page number for pagination */
|
|
25
|
+
page?: MaybeRefOrGetter<number | undefined>;
|
|
26
|
+
}
|
|
27
|
+
export interface UseGetFileListReturn {
|
|
28
|
+
/** File list data */
|
|
29
|
+
data: Readonly<Ref<FileListResponse | undefined>>;
|
|
30
|
+
/** Last request error, if any */
|
|
31
|
+
error: Readonly<Ref<Error | undefined>>;
|
|
32
|
+
/** Whether a request is currently in progress */
|
|
33
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
34
|
+
/** Refetch the file list */
|
|
35
|
+
refetch: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Vue composable for fetching a list of files using TanStack Query.
|
|
39
|
+
* Supports pagination via query parameters.
|
|
40
|
+
* @param options Hook configuration options
|
|
41
|
+
* @returns File list fetching functions and state
|
|
42
|
+
*/
|
|
43
|
+
export declare const useGetFileList: (options: UseGetFileListOptions) => UseGetFileListReturn;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter, Ref } from "vue";
|
|
2
|
+
import type { FileMeta } from "../react/types.d.ts";
|
|
3
|
+
export interface UseGetFileMetaOptions {
|
|
4
|
+
/** Whether to enable the query */
|
|
5
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
6
|
+
/** Base endpoint URL for file operations */
|
|
7
|
+
endpoint: string;
|
|
8
|
+
/** File ID to fetch metadata for */
|
|
9
|
+
id: MaybeRefOrGetter<string>;
|
|
10
|
+
}
|
|
11
|
+
export interface UseGetFileMetaReturn {
|
|
12
|
+
/** File metadata */
|
|
13
|
+
data: Readonly<Ref<FileMeta | undefined>>;
|
|
14
|
+
/** Last request error, if any */
|
|
15
|
+
error: Readonly<Ref<Error | undefined>>;
|
|
16
|
+
/** Whether a request is currently in progress */
|
|
17
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
18
|
+
/** Refetch the file metadata */
|
|
19
|
+
refetch: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Vue composable for fetching file metadata using TanStack Query.
|
|
23
|
+
* @param options Hook configuration options
|
|
24
|
+
* @returns File metadata fetching functions and state
|
|
25
|
+
*/
|
|
26
|
+
export declare const useGetFileMeta: (options: UseGetFileMetaOptions) => UseGetFileMetaReturn;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter, Ref } from "vue";
|
|
2
|
+
import type { FileMeta } from "../react/types.d.ts";
|
|
3
|
+
export interface UseGetFileOptions {
|
|
4
|
+
/** Whether to enable the query */
|
|
5
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
6
|
+
/** Base endpoint URL for file operations */
|
|
7
|
+
endpoint: string;
|
|
8
|
+
/** File ID to fetch */
|
|
9
|
+
id: MaybeRefOrGetter<string>;
|
|
10
|
+
/** Callback when request fails */
|
|
11
|
+
onError?: (error: Error) => void;
|
|
12
|
+
/** Callback when request succeeds */
|
|
13
|
+
onSuccess?: (data: Blob, meta: FileMeta | undefined) => void;
|
|
14
|
+
/** Transformation parameters for media files */
|
|
15
|
+
transform?: MaybeRefOrGetter<Record<string, string | number | boolean> | undefined>;
|
|
16
|
+
}
|
|
17
|
+
export interface UseGetFileReturn {
|
|
18
|
+
/** File data as Blob */
|
|
19
|
+
data: Readonly<Ref<Blob | undefined>>;
|
|
20
|
+
/** Last request error, if any */
|
|
21
|
+
error: Readonly<Ref<Error | undefined>>;
|
|
22
|
+
/** Whether a request is currently in progress */
|
|
23
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
24
|
+
/** File metadata from response headers */
|
|
25
|
+
meta: Readonly<Ref<FileMeta | undefined>>;
|
|
26
|
+
/** Refetch the file */
|
|
27
|
+
refetch: () => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Vue composable for fetching/downloading files using TanStack Query.
|
|
31
|
+
* Supports optional transformation parameters for media files.
|
|
32
|
+
* @param options Hook configuration options
|
|
33
|
+
* @returns File fetching functions and state
|
|
34
|
+
*/
|
|
35
|
+
export declare const useGetFile: (options: UseGetFileOptions) => UseGetFileReturn;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter, Ref } from "vue";
|
|
2
|
+
export interface FileHeadMetadata {
|
|
3
|
+
/** Whether this is a chunked upload session */
|
|
4
|
+
chunkedUpload?: boolean;
|
|
5
|
+
/** Content length in bytes */
|
|
6
|
+
contentLength?: number;
|
|
7
|
+
/** Content type */
|
|
8
|
+
contentType?: string;
|
|
9
|
+
/** Entity tag for caching */
|
|
10
|
+
etag?: string;
|
|
11
|
+
/** Last modified date */
|
|
12
|
+
lastModified?: string;
|
|
13
|
+
/** Received chunk offsets (chunked uploads) */
|
|
14
|
+
receivedChunks?: number[];
|
|
15
|
+
/** Whether upload is complete (chunked uploads) */
|
|
16
|
+
uploadComplete?: boolean;
|
|
17
|
+
/** Upload expiration date */
|
|
18
|
+
uploadExpires?: string;
|
|
19
|
+
/** Upload offset for chunked uploads */
|
|
20
|
+
uploadOffset?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface UseHeadFileOptions {
|
|
23
|
+
/** Whether to enable the query */
|
|
24
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
25
|
+
/** Base endpoint URL for file operations */
|
|
26
|
+
endpoint: string;
|
|
27
|
+
/** File ID to fetch metadata for */
|
|
28
|
+
id: MaybeRefOrGetter<string>;
|
|
29
|
+
}
|
|
30
|
+
export interface UseHeadFileReturn {
|
|
31
|
+
/** File metadata from HEAD request */
|
|
32
|
+
data: Readonly<Ref<FileHeadMetadata | undefined>>;
|
|
33
|
+
/** Last request error, if any */
|
|
34
|
+
error: Readonly<Ref<Error | undefined>>;
|
|
35
|
+
/** Whether a request is currently in progress */
|
|
36
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
37
|
+
/** Refetch the file metadata */
|
|
38
|
+
refetch: () => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Vue composable for fetching file metadata via HEAD request using TanStack Query.
|
|
42
|
+
* Useful for checking upload progress and file status without downloading.
|
|
43
|
+
* @param options Hook configuration options
|
|
44
|
+
* @returns File HEAD request functions and state
|
|
45
|
+
*/
|
|
46
|
+
export declare const useHeadFile: (options: UseHeadFileOptions) => UseHeadFileReturn;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
import type { UploadResult } from "../react/types.d.ts";
|
|
3
|
+
export interface UseMultipartUploadOptions {
|
|
4
|
+
/** Upload endpoint URL */
|
|
5
|
+
endpoint: string;
|
|
6
|
+
/** Additional metadata to include with the upload */
|
|
7
|
+
metadata?: Record<string, string>;
|
|
8
|
+
/** Callback when upload fails */
|
|
9
|
+
onError?: (error: Error) => void;
|
|
10
|
+
/** Callback when upload progress updates */
|
|
11
|
+
onProgress?: (progress: number) => void;
|
|
12
|
+
/** Callback when upload starts */
|
|
13
|
+
onStart?: () => void;
|
|
14
|
+
/** Callback when upload completes successfully */
|
|
15
|
+
onSuccess?: (file: UploadResult) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface UseMultipartUploadReturn {
|
|
18
|
+
/** Last upload error, if any */
|
|
19
|
+
error: Ref<Error | undefined>;
|
|
20
|
+
/** Whether an upload is currently in progress */
|
|
21
|
+
isUploading: Ref<boolean>;
|
|
22
|
+
/** Current upload progress (0-100) */
|
|
23
|
+
progress: Ref<number>;
|
|
24
|
+
/** Reset upload state */
|
|
25
|
+
reset: () => void;
|
|
26
|
+
/** Last upload result, if any */
|
|
27
|
+
result: Ref<UploadResult | undefined>;
|
|
28
|
+
/** Upload a file using multipart/form-data */
|
|
29
|
+
upload: (file: File) => Promise<UploadResult>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Vue composable for multipart/form-data file uploads using rpldy uploader core.
|
|
33
|
+
* @param options Upload configuration options
|
|
34
|
+
* @returns Upload functions and state
|
|
35
|
+
*/
|
|
36
|
+
export declare const useMultipartUpload: (options: UseMultipartUploadOptions) => UseMultipartUploadReturn;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
export interface UsePasteUploadOptions {
|
|
3
|
+
/** Filter function to determine which files to accept */
|
|
4
|
+
filter?: (file: File) => boolean;
|
|
5
|
+
/** Callback when files are pasted */
|
|
6
|
+
onFilesPasted?: (files: File[]) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface UsePasteUploadReturn {
|
|
9
|
+
/** Handle paste event */
|
|
10
|
+
handlePaste: (event: ClipboardEvent) => void;
|
|
11
|
+
/** Files that were pasted */
|
|
12
|
+
pastedFiles: Ref<File[]>;
|
|
13
|
+
/** Reset pasted files */
|
|
14
|
+
reset: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Vue composable for handling paste uploads from clipboard.
|
|
18
|
+
* @param options Configuration options
|
|
19
|
+
* @returns Paste upload functions and state
|
|
20
|
+
*/
|
|
21
|
+
export declare const usePasteUpload: (options?: UsePasteUploadOptions) => UsePasteUploadReturn;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
import type { UploadResult } from "../react/types.d.ts";
|
|
3
|
+
export interface UsePatchChunkOptions {
|
|
4
|
+
/** Base endpoint URL for file operations */
|
|
5
|
+
endpoint: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UsePatchChunkReturn {
|
|
8
|
+
/** Last upload result, if any */
|
|
9
|
+
data: Readonly<Ref<UploadResult | undefined>>;
|
|
10
|
+
/** Last request error, if any */
|
|
11
|
+
error: Readonly<Ref<Error | undefined>>;
|
|
12
|
+
/** Whether a request is currently in progress */
|
|
13
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
14
|
+
/** Upload a chunk for chunked uploads */
|
|
15
|
+
patchChunk: (id: string, chunk: Blob, offset: number, checksum?: string) => Promise<UploadResult>;
|
|
16
|
+
/** Reset mutation state */
|
|
17
|
+
reset: () => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Vue composable for uploading chunks in chunked uploads using TanStack Query.
|
|
21
|
+
* Requires X-Chunk-Offset header and chunk data.
|
|
22
|
+
* Automatically invalidates related queries when upload is complete.
|
|
23
|
+
* @param options Hook configuration options
|
|
24
|
+
* @returns Chunk upload functions and state
|
|
25
|
+
*/
|
|
26
|
+
export declare const usePatchChunk: (options: UsePatchChunkOptions) => UsePatchChunkReturn;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
import type { UploadResult } from "../react/types.d.ts";
|
|
3
|
+
export interface UsePutFileOptions {
|
|
4
|
+
/** Base endpoint URL for file operations */
|
|
5
|
+
endpoint: string;
|
|
6
|
+
/** Callback when upload progress updates */
|
|
7
|
+
onProgress?: (progress: number) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface UsePutFileReturn {
|
|
10
|
+
/** Last upload result, if any */
|
|
11
|
+
data: Readonly<Ref<UploadResult | undefined>>;
|
|
12
|
+
/** Last request error, if any */
|
|
13
|
+
error: Readonly<Ref<Error | undefined>>;
|
|
14
|
+
/** Whether a request is currently in progress */
|
|
15
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
16
|
+
/** Current upload progress (0-100) */
|
|
17
|
+
progress: Readonly<Ref<number>>;
|
|
18
|
+
/** Create or update a file by ID */
|
|
19
|
+
putFile: (id: string, file: File | Blob) => Promise<UploadResult>;
|
|
20
|
+
/** Reset mutation state */
|
|
21
|
+
reset: () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Vue composable for creating or updating files via PUT request using TanStack Query.
|
|
25
|
+
* Automatically invalidates related queries.
|
|
26
|
+
* @param options Hook configuration options
|
|
27
|
+
* @returns File PUT functions and state
|
|
28
|
+
*/
|
|
29
|
+
export declare const usePutFile: (options: UsePutFileOptions) => UsePutFileReturn;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UploadItem } from "../core/uploader.d.ts";
|
|
2
|
+
export interface UseRetryListenerOptions {
|
|
3
|
+
/** Upload endpoint URL (used to create uploader instance) */
|
|
4
|
+
endpoint: string;
|
|
5
|
+
/** Additional metadata to include with the upload */
|
|
6
|
+
metadata?: Record<string, string>;
|
|
7
|
+
/** Callback when an item is retried */
|
|
8
|
+
onRetry: (item: UploadItem) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Vue composable to listen to retry events.
|
|
12
|
+
* Note: This listens to ITEM_START events for items that have been retried (retryCount > 0).
|
|
13
|
+
* @param options Listener configuration options
|
|
14
|
+
*/
|
|
15
|
+
export declare const useRetryListener: (options: UseRetryListenerOptions) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UseRetryOptions {
|
|
2
|
+
/** Upload endpoint URL (used to create uploader instance) */
|
|
3
|
+
endpoint: string;
|
|
4
|
+
/** Additional metadata to include with the upload */
|
|
5
|
+
metadata?: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
export interface UseRetryReturn {
|
|
8
|
+
/** Retry a failed upload item by ID */
|
|
9
|
+
retryItem: (id: string) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Vue composable to retry a failed upload item.
|
|
13
|
+
* @param options Configuration options
|
|
14
|
+
* @returns Retry function
|
|
15
|
+
*/
|
|
16
|
+
export declare const useRetry: (options: UseRetryOptions) => UseRetryReturn;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter, Ref } from "vue";
|
|
2
|
+
import type { FileMeta } from "../react/types.d.ts";
|
|
3
|
+
export interface TransformOptions {
|
|
4
|
+
/** Additional transformation parameters */
|
|
5
|
+
[key: string]: string | number | boolean | undefined;
|
|
6
|
+
/** Resize fit mode */
|
|
7
|
+
fit?: "cover" | "contain" | "fill" | "inside" | "outside";
|
|
8
|
+
/** Output format (jpeg, png, webp, etc.) */
|
|
9
|
+
format?: string;
|
|
10
|
+
/** Desired height in pixels */
|
|
11
|
+
height?: number;
|
|
12
|
+
/** Quality setting (0-100) */
|
|
13
|
+
quality?: number;
|
|
14
|
+
/** Desired width in pixels */
|
|
15
|
+
width?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface UseTransformFileOptions {
|
|
18
|
+
/** Whether to enable the query */
|
|
19
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
20
|
+
/** Base endpoint URL for transform operations */
|
|
21
|
+
endpoint: string;
|
|
22
|
+
/** File ID to transform */
|
|
23
|
+
id: MaybeRefOrGetter<string>;
|
|
24
|
+
/** Transformation parameters */
|
|
25
|
+
transform: MaybeRefOrGetter<TransformOptions>;
|
|
26
|
+
}
|
|
27
|
+
export interface UseTransformFileReturn {
|
|
28
|
+
/** Transformed file data as Blob */
|
|
29
|
+
data: Readonly<Ref<Blob | undefined>>;
|
|
30
|
+
/** Last request error, if any */
|
|
31
|
+
error: Readonly<Ref<Error | undefined>>;
|
|
32
|
+
/** Whether a request is currently in progress */
|
|
33
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
34
|
+
/** File metadata from response headers */
|
|
35
|
+
meta: Readonly<Ref<FileMeta | undefined>>;
|
|
36
|
+
/** Refetch the transformed file */
|
|
37
|
+
refetch: () => void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Vue composable for fetching transformed files using TanStack Query.
|
|
41
|
+
* Supports image, video, and audio transformation parameters.
|
|
42
|
+
* @param options Hook configuration options
|
|
43
|
+
* @returns Transform file fetching functions and state
|
|
44
|
+
*/
|
|
45
|
+
export declare const useTransformFile: (options: UseTransformFileOptions) => UseTransformFileReturn;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter, Ref } from "vue";
|
|
2
|
+
export interface TransformMetadata {
|
|
3
|
+
/** Available transformation formats */
|
|
4
|
+
formats?: string[];
|
|
5
|
+
/** Supported transformation parameters */
|
|
6
|
+
parameters?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface UseTransformMetadataOptions {
|
|
9
|
+
/** Whether to enable the query */
|
|
10
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
11
|
+
/** Base endpoint URL for transform operations */
|
|
12
|
+
endpoint: string;
|
|
13
|
+
}
|
|
14
|
+
export interface UseTransformMetadataReturn {
|
|
15
|
+
/** Transform metadata */
|
|
16
|
+
data: Readonly<Ref<TransformMetadata | undefined>>;
|
|
17
|
+
/** Last request error, if any */
|
|
18
|
+
error: Readonly<Ref<Error | undefined>>;
|
|
19
|
+
/** Whether a request is currently in progress */
|
|
20
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
21
|
+
/** Refetch the transform metadata */
|
|
22
|
+
refetch: () => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Vue composable for fetching transformation metadata using TanStack Query.
|
|
26
|
+
* Returns available formats and transformation parameters.
|
|
27
|
+
* @param options Hook configuration options
|
|
28
|
+
* @returns Transform metadata fetching functions and state
|
|
29
|
+
*/
|
|
30
|
+
export declare const useTransformMetadata: (options: UseTransformMetadataOptions) => UseTransformMetadataReturn;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
import type { UploadResult } from "../react/types.d.ts";
|
|
3
|
+
export interface UseTusUploadOptions {
|
|
4
|
+
/** Chunk size for TUS uploads (default: 1MB) */
|
|
5
|
+
chunkSize?: number;
|
|
6
|
+
/** TUS upload endpoint URL */
|
|
7
|
+
endpoint: string;
|
|
8
|
+
/** Maximum number of retry attempts */
|
|
9
|
+
maxRetries?: number;
|
|
10
|
+
/** Additional metadata to include with the upload */
|
|
11
|
+
metadata?: Record<string, string>;
|
|
12
|
+
/** Callback when upload fails */
|
|
13
|
+
onError?: (error: Error) => void;
|
|
14
|
+
/** Callback when upload is paused */
|
|
15
|
+
onPause?: () => void;
|
|
16
|
+
/** Callback when upload progress updates */
|
|
17
|
+
onProgress?: (progress: number) => void;
|
|
18
|
+
/** Callback when upload is resumed */
|
|
19
|
+
onResume?: () => void;
|
|
20
|
+
/** Callback when upload starts */
|
|
21
|
+
onStart?: () => void;
|
|
22
|
+
/** Callback when upload completes successfully */
|
|
23
|
+
onSuccess?: (file: UploadResult) => void;
|
|
24
|
+
/** Enable automatic retry on failure */
|
|
25
|
+
retry?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface UseTusUploadReturn {
|
|
28
|
+
/** Abort the current upload */
|
|
29
|
+
abort: () => void;
|
|
30
|
+
/** Last upload error, if any */
|
|
31
|
+
error: Ref<Error | undefined>;
|
|
32
|
+
/** Whether the upload is paused */
|
|
33
|
+
isPaused: Ref<boolean>;
|
|
34
|
+
/** Whether an upload is currently in progress */
|
|
35
|
+
isUploading: Ref<boolean>;
|
|
36
|
+
/** Current upload offset (bytes uploaded) */
|
|
37
|
+
offset: Ref<number>;
|
|
38
|
+
/** Pause the current upload */
|
|
39
|
+
pause: () => void;
|
|
40
|
+
/** Current upload progress (0-100) */
|
|
41
|
+
progress: Ref<number>;
|
|
42
|
+
/** Reset upload state */
|
|
43
|
+
reset: () => void;
|
|
44
|
+
/** Last upload result, if any */
|
|
45
|
+
result: Ref<UploadResult | undefined>;
|
|
46
|
+
/** Resume a paused upload */
|
|
47
|
+
resume: () => Promise<void>;
|
|
48
|
+
/** Upload a file using TUS protocol */
|
|
49
|
+
upload: (file: File) => Promise<UploadResult>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Vue composable for TUS resumable file uploads.
|
|
53
|
+
* @param options Upload configuration options
|
|
54
|
+
* @returns Upload functions and state
|
|
55
|
+
*/
|
|
56
|
+
export declare const useTusUpload: (options: UseTusUploadOptions) => UseTusUploadReturn;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ComputedRef } from "vue";
|
|
2
|
+
import type { UploadMethod, UploadResult } from "../react/types.d.ts";
|
|
3
|
+
export interface UseUploadOptions {
|
|
4
|
+
/** Chunk size for TUS and chunked REST uploads (default: 1MB for TUS, 5MB for chunked REST) */
|
|
5
|
+
chunkSize?: number;
|
|
6
|
+
/** Chunked REST upload endpoint URL */
|
|
7
|
+
endpointChunkedRest?: string;
|
|
8
|
+
/** Multipart upload endpoint URL */
|
|
9
|
+
endpointMultipart?: string;
|
|
10
|
+
/** TUS upload endpoint URL */
|
|
11
|
+
endpointTus?: string;
|
|
12
|
+
/** Maximum number of retry attempts (TUS and chunked REST only) */
|
|
13
|
+
maxRetries?: number;
|
|
14
|
+
/** Additional metadata to include with the upload */
|
|
15
|
+
metadata?: Record<string, string>;
|
|
16
|
+
/** Upload method to use: 'multipart', 'tus', 'chunked-rest', or 'auto'. If undefined, auto-detected based on provided endpoints */
|
|
17
|
+
method?: UploadMethod;
|
|
18
|
+
/** Callback when upload fails */
|
|
19
|
+
onError?: (error: Error) => void;
|
|
20
|
+
/** Callback when upload is paused (TUS and chunked REST only) */
|
|
21
|
+
onPause?: () => void;
|
|
22
|
+
/** Callback when upload progress updates */
|
|
23
|
+
onProgress?: (progress: number) => void;
|
|
24
|
+
/** Callback when upload is resumed (TUS and chunked REST only) */
|
|
25
|
+
onResume?: () => void;
|
|
26
|
+
/** Callback when upload starts */
|
|
27
|
+
onStart?: () => void;
|
|
28
|
+
/** Callback when upload completes successfully */
|
|
29
|
+
onSuccess?: (file: UploadResult) => void;
|
|
30
|
+
/** Enable automatic retry on failure (TUS and chunked REST only) */
|
|
31
|
+
retry?: boolean;
|
|
32
|
+
/** File size threshold for auto-selecting TUS (default: 10MB) */
|
|
33
|
+
tusThreshold?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface UseUploadReturn {
|
|
36
|
+
/** Abort the current upload */
|
|
37
|
+
abort: () => void;
|
|
38
|
+
/** Current upload method being used */
|
|
39
|
+
currentMethod: ComputedRef<UploadMethod>;
|
|
40
|
+
/** Last upload error, if any */
|
|
41
|
+
error: ComputedRef<Error | undefined>;
|
|
42
|
+
/** Whether the upload is paused (TUS and chunked REST only) */
|
|
43
|
+
isPaused: ComputedRef<boolean | undefined>;
|
|
44
|
+
/** Whether an upload is currently in progress */
|
|
45
|
+
isUploading: ComputedRef<boolean>;
|
|
46
|
+
/** Current upload offset in bytes (TUS and chunked REST only) */
|
|
47
|
+
offset: ComputedRef<number | undefined>;
|
|
48
|
+
/** Pause the current upload (TUS and chunked REST only) */
|
|
49
|
+
pause: ComputedRef<(() => void) | undefined>;
|
|
50
|
+
/** Current upload progress (0-100) */
|
|
51
|
+
progress: ComputedRef<number>;
|
|
52
|
+
/** Reset upload state */
|
|
53
|
+
reset: () => void;
|
|
54
|
+
/** Last upload result, if any */
|
|
55
|
+
result: ComputedRef<UploadResult | undefined>;
|
|
56
|
+
/** Resume a paused upload (TUS and chunked REST only) */
|
|
57
|
+
resume: ComputedRef<(() => Promise<void>) | undefined>;
|
|
58
|
+
/** Upload a file using the configured method */
|
|
59
|
+
upload: (file: File) => Promise<UploadResult>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Vue composable for file uploads with automatic method selection.
|
|
63
|
+
* Uses custom uploader implementations for multipart, TUS, and chunked REST.
|
|
64
|
+
* Automatically chooses between methods based on file size and method preference.
|
|
65
|
+
* @param options Upload configuration options
|
|
66
|
+
* @returns Upload functions and state
|
|
67
|
+
*/
|
|
68
|
+
export declare const useUpload: (options: UseUploadOptions) => UseUploadReturn;
|