@visulima/storage-client 1.0.0-alpha.13 → 1.0.0-alpha.15
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 +35 -0
- package/README.md +23 -0
- package/dist/index.d.ts +23 -3
- package/dist/index.js +1 -1
- package/dist/packem_shared/MemoryUrlStorage-DN4oF-4W.js +1 -0
- package/dist/packem_shared/UploadControl-CKU7Tv3Q.js +1 -0
- package/dist/packem_shared/createChunkedRestAdapter-YzmsiWvW.js +1 -0
- package/dist/packem_shared/createChunkedRestUpload-Cu19LRnt.js +1 -0
- package/dist/packem_shared/createChunkedRestUpload-D4WS_E_m.js +1 -0
- package/dist/packem_shared/createTusAdapter-6FZAUcvj.js +1 -0
- package/dist/packem_shared/createTusUpload-C_EE1exZ.js +1 -0
- package/dist/packem_shared/createTusUpload-DrZu_r2C.js +1 -0
- package/dist/packem_shared/{createUpload-0qE79TWD.js → createUpload-ABEJ1whY.js} +1 -1
- package/dist/packem_shared/{createUpload-BF6TujIH.js → createUpload-F7cp3uwR.js} +1 -1
- package/dist/packem_shared/defaultFingerprint-CI2Sdd2s.js +1 -0
- package/dist/packem_shared/uploader.d-npepq2LE.d.ts +381 -0
- package/dist/packem_shared/useChunkedRestUpload-C_I_pDEa.js +1 -0
- package/dist/packem_shared/useChunkedRestUpload-T5jeupI6.js +1 -0
- package/dist/packem_shared/useTusUpload-DJedNEXm.js +1 -0
- package/dist/packem_shared/useTusUpload-SYnJmg1s.js +1 -0
- package/dist/packem_shared/{useUpload-DqGwpOZK.js → useUpload-BDMiZyCV.js} +1 -1
- package/dist/packem_shared/{useUpload-7OjscFW6.js → useUpload-D-2542dH.js} +1 -1
- package/dist/react/index.d.ts +17 -1
- package/dist/react/index.js +1 -1
- package/dist/solid/index.d.ts +13 -1
- package/dist/solid/index.js +1 -1
- package/dist/svelte/index.d.ts +13 -1
- package/dist/svelte/index.js +1 -1
- package/dist/vue/index.d.ts +13 -1
- package/dist/vue/index.js +1 -1
- package/package.json +2 -4
- package/dist/packem_shared/createChunkedRestAdapter-CWFhVX6x.js +0 -1
- package/dist/packem_shared/createChunkedRestUpload-BH_5ZAr2.js +0 -1
- package/dist/packem_shared/createChunkedRestUpload-DAoXFznW.js +0 -1
- package/dist/packem_shared/createTusAdapter-BbFsUNsP.js +0 -1
- package/dist/packem_shared/createTusUpload-DKIIHh2X.js +0 -1
- package/dist/packem_shared/createTusUpload-rZKMrL5n.js +0 -1
- package/dist/packem_shared/uploader.d-DsC50BbX.d.ts +0 -223
- package/dist/packem_shared/useChunkedRestUpload-C7zv7mL3.js +0 -1
- package/dist/packem_shared/useChunkedRestUpload-C9RhEtUt.js +0 -1
- package/dist/packem_shared/useTusUpload-B5KsdwDR.js +0 -1
- package/dist/packem_shared/useTusUpload-BwF0G1LE.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _=Object.defineProperty;var z=(i,a)=>_(i,"name",{value:a,configurable:!0});import{useState as u,useMemo as J,useRef as K,useEffect as C,useCallback as l}from"react";import{createChunkedRestAdapter as L}from"./createChunkedRestAdapter-YzmsiWvW.js";var N=Object.defineProperty,Q=z((i,a)=>N(i,"name",{value:a,configurable:!0}),"F");const Y=Q(i=>{const{chunkSize:a,control:E,endpoint:w,fingerprint:O,maxRetries:R,metadata:b,onError:g,onPause:p,onProgress:S,onResume:m,onStart:h,onSuccess:v,retry:y,urlStorage:k}=i,[F,d]=u(0),[T,s]=u(!1),[j,o]=u(!1),[A,P]=u(void 0),[I,x]=u(void 0),[M,f]=u(0),e=J(()=>L({chunkSize:a,control:E,endpoint:w,fingerprint:O,maxRetries:R,metadata:b,retry:y,urlStorage:k}),[a,E,w,O,R,b,y,k]),n=K({onError:g,onPause:p,onProgress:S,onResume:m,onStart:h,onSuccess:v});C(()=>{n.current={onError:g,onPause:p,onProgress:S,onResume:m,onStart:h,onSuccess:v}},[g,S,p,m,h,v]),C(()=>{e.setOnStart(()=>{s(!0),o(!1),d(0),P(void 0),f(0),n.current.onStart?.()}),e.setOnProgress((r,U)=>{d(r),f(U),n.current.onProgress?.(r,U)}),e.setOnFinish(r=>{d(100),x(r),s(!1),o(!1),n.current.onSuccess?.(r)}),e.setOnError(r=>{P(r),s(!1),n.current.onError?.(r)});let t=!0;const c=setInterval(()=>{!t||!("window"in globalThis)||(e.getOffset().then(r=>(!t||!("window"in globalThis)||f(r),r)).catch(()=>{}),o(e.isPaused()))},100);return()=>{t=!1,clearInterval(c),e.setOnStart(void 0),e.setOnProgress(void 0),e.setOnFinish(void 0),e.setOnError(void 0)}},[e]);const q=l(async t=>{try{return await e.upload(t)}catch(c){throw c instanceof Error?c:new Error(String(c))}},[e]),B=l(()=>{e.pause(),o(!0),n.current.onPause?.()},[e]),D=l(async()=>{o(!1),s(!0),n.current.onResume?.();try{await e.resume()}catch(t){throw s(!1),t instanceof Error?t:new Error(String(t))}},[e]),G=l(()=>{e.abort(),s(!1),o(!1)},[e]),H=l(()=>{e.clear(),d(0),s(!1),o(!1),P(void 0),x(void 0),f(0)},[e]);return{abort:G,error:A,isPaused:j,isUploading:T,offset:M,pause:B,progress:F,reset:H,result:I,resume:D,upload:q}},"useChunkedRestUpload");export{Y as useChunkedRestUpload};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var C=Object.defineProperty;var m=(v,i)=>C(v,"name",{value:i,configurable:!0});import{ref as n,onMounted as x,onBeforeUnmount as z}from"vue";import{createChunkedRestAdapter as F}from"./createChunkedRestAdapter-YzmsiWvW.js";var I=Object.defineProperty,l=m((v,i)=>I(v,"name",{value:i,configurable:!0}),"s");const M=l(v=>{const{chunkSize:i,control:g,endpoint:h,fingerprint:O,maxRetries:S,metadata:y,onError:f,onPause:E,onProgress:P,onResume:R,onStart:b,onSuccess:k,retry:w,urlStorage:U}=v,d=n(0),a=n(!1),t=n(!1),o=n(void 0),p=n(void 0),c=n(0),r=F({chunkSize:i,control:g,endpoint:h,fingerprint:O,maxRetries:S,metadata:y,retry:w,urlStorage:U});return x(()=>{r.setOnStart(()=>{a.value=!0,t.value=!1,d.value=0,o.value=void 0,c.value=0,b?.()}),r.setOnProgress((e,u)=>{d.value=e,c.value=u,P?.(e,u)}),r.setOnFinish(e=>{d.value=100,p.value=e,a.value=!1,t.value=!1,k?.(e)}),r.setOnError(e=>{o.value=e,a.value=!1,f?.(e)});const s=setInterval(()=>{r.getOffset().then(e=>(c.value=e,e)).catch(()=>{}),t.value=r.isPaused()},100);z(()=>{clearInterval(s),r.setOnStart(void 0),r.setOnProgress(void 0),r.setOnFinish(void 0),r.setOnError(void 0)})}),{abort:l(()=>{r.abort(),a.value=!1,t.value=!1},"abort"),error:o,isPaused:t,isUploading:a,offset:c,pause:l(()=>{r.pause(),t.value=!0,E?.()},"pause"),progress:d,reset:l(()=>{r.clear(),d.value=0,a.value=!1,t.value=!1,o.value=void 0,p.value=void 0,c.value=0},"reset"),result:p,resume:l(async()=>{t.value=!1,a.value=!0,R?.();try{await r.resume()}catch(s){const e=s instanceof Error?s:new Error(String(s));throw o.value=e,a.value=!1,f?.(e),e}},"resume"),upload:l(async s=>{try{return await r.upload(s)}catch(e){const u=e instanceof Error?e:new Error(String(e));throw o.value=u,f?.(u),u}},"upload")}},"useChunkedRestUpload");export{M as useChunkedRestUpload};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _=Object.defineProperty;var z=(i,u)=>_(i,"name",{value:u,configurable:!0});import{useState as c,useMemo as K,useRef as y,useEffect as F,useCallback as f}from"react";import{createTusAdapter as L}from"./createTusAdapter-6FZAUcvj.js";var Q=Object.defineProperty,V=z((i,u)=>Q(i,"name",{value:u,configurable:!0}),"k");const Z=V(i=>{const{chunkSize:u,control:R,endpoint:w,fingerprint:b,maxRetries:k,metadata:x,onError:S,onPause:g,onProgress:m,onResume:p,onStart:E,onSuccess:P,retry:I,urlStorage:T}=i,[j,d]=c(0),[A,s]=c(!1),[M,a]=c(!1),[q,l]=c(void 0),[B,U]=c(void 0),[C,v]=c(0),r=K(()=>L({chunkSize:u,control:R,endpoint:w,fingerprint:b,maxRetries:k,metadata:x,retry:I,urlStorage:T}),[u,R,w,b,k,x,I,T]),t=y({onError:S,onPause:g,onProgress:m,onResume:p,onStart:E,onSuccess:P}),o=y(void 0),O=y(!0);F(()=>{t.current={onError:S,onPause:g,onProgress:m,onResume:p,onStart:E,onSuccess:P}},[S,m,g,p,E,P]),F(()=>(O.current=!0,r.setOnStart(()=>{s(!0),a(!1),d(0),l(void 0),v(0),t.current.onStart?.()}),r.setOnProgress((e,n)=>{d(e),v(n),t.current.onProgress?.(e)}),r.setOnFinish(e=>{d(100),U(e),s(!1),a(!1),t.current.onSuccess?.(e)}),r.setOnError(e=>{l(e),s(!1),t.current.onError?.(e)}),o.current=setInterval(()=>{O.current&&o.current&&(v(r.getOffset()),a(r.isPaused()))},100),()=>{O.current=!1,o.current&&(clearInterval(o.current),o.current=void 0),r.setOnStart(void 0),r.setOnProgress(void 0),r.setOnFinish(void 0),r.setOnError(void 0)}),[r]);const D=f(async e=>{try{return await r.upload(e)}catch(n){const h=n instanceof Error?n:new Error(String(n));throw l(h),t.current.onError?.(h),h}},[r]),G=f(()=>{r.pause(),a(!0),t.current.onPause?.()},[r]),H=f(async()=>{a(!1),s(!0),t.current.onResume?.();try{await r.resume()}catch(e){const n=e instanceof Error?e:new Error(String(e));throw l(n),s(!1),t.current.onError?.(n),n}},[r]),J=f(()=>{o.current&&(clearInterval(o.current),o.current=void 0),r.abort(),s(!1),a(!1)},[r]),N=f(()=>{r.clear(),d(0),s(!1),a(!1),l(void 0),U(void 0),v(0)},[r]);return{abort:J,error:q,isPaused:M,isUploading:A,offset:C,pause:G,progress:j,reset:N,result:B,resume:H,upload:D}},"useTusUpload");export{Z as useTusUpload};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var F=Object.defineProperty;var m=(n,v)=>F(n,"name",{value:v,configurable:!0});import{ref as u,onMounted as T,onBeforeUnmount as k}from"vue";import{createTusAdapter as z}from"./createTusAdapter-6FZAUcvj.js";var I=Object.defineProperty,l=m((n,v)=>I(n,"name",{value:v,configurable:!0}),"s");const M=l(n=>{const{chunkSize:v,control:g,endpoint:O,fingerprint:S,maxRetries:h,metadata:y,onError:d,onPause:E,onProgress:P,onResume:w,onStart:b,onSuccess:U,retry:R,urlStorage:x}=n,i=u(0),a=u(!1),t=u(!1),o=u(void 0),p=u(void 0),f=u(0),r=z({chunkSize:v,control:g,endpoint:O,fingerprint:S,maxRetries:h,metadata:y,retry:R,urlStorage:x});return T(()=>{r.setOnStart(()=>{a.value=!0,t.value=!1,i.value=0,o.value=void 0,f.value=0,b?.()}),r.setOnProgress((e,c)=>{i.value=e,f.value=c,P?.(e)}),r.setOnFinish(e=>{i.value=100,p.value=e,a.value=!1,t.value=!1,U?.(e)}),r.setOnError(e=>{o.value=e,a.value=!1,d?.(e)});const s=setInterval(()=>{f.value=r.getOffset(),t.value=r.isPaused()},100);k(()=>{clearInterval(s),r.setOnStart(void 0),r.setOnProgress(void 0),r.setOnFinish(void 0),r.setOnError(void 0)})}),{abort:l(()=>{r.abort(),a.value=!1,t.value=!1},"abort"),error:o,isPaused:t,isUploading:a,offset:f,pause:l(()=>{r.pause(),t.value=!0,E?.()},"pause"),progress:i,reset:l(()=>{r.clear(),i.value=0,a.value=!1,t.value=!1,o.value=void 0,p.value=void 0,f.value=0},"reset"),result:p,resume:l(async()=>{t.value=!1,a.value=!0,w?.();try{await r.resume()}catch(s){const e=s instanceof Error?s:new Error(String(s));throw o.value=e,a.value=!1,d?.(e),e}},"resume"),upload:l(async s=>{try{return await r.upload(s)}catch(e){const c=e instanceof Error?e:new Error(String(e));throw o.value=c,d?.(c),c}},"upload")}},"useTusUpload");export{M as useTusUpload};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var K=Object.defineProperty;var x=(m,a)=>K(m,"name",{value:a,configurable:!0});import{useMemo as k,useCallback as R}from"react";import{useChunkedRestUpload as L}from"./useChunkedRestUpload-
|
|
1
|
+
var K=Object.defineProperty;var x=(m,a)=>K(m,"name",{value:a,configurable:!0});import{useMemo as k,useCallback as R}from"react";import{useChunkedRestUpload as L}from"./useChunkedRestUpload-C_I_pDEa.js";import{useMultipartUpload as _}from"./useMultipartUpload-CJMa-_Yo.js";import{useTusUpload as q}from"./useTusUpload-DJedNEXm.js";var G=Object.defineProperty,i=x((m,a)=>G(m,"name",{value:a,configurable:!0}),"s");const Q=10*1024*1024,$=i(m=>{const{chunkSize:a,endpointChunkedRest:s,endpointMultipart:d,endpointTus:n,maxRetries:v,metadata:p,method:E,onError:l,onPause:P,onProgress:f,onResume:U,onStart:c,onSuccess:g,retry:S,tusThreshold:w=Q}=m,h=k(()=>{if(E!==void 0)return E;const u=[s,d,n].filter(Boolean);if(u.length===1)return s?"chunked-rest":n?"tus":"multipart";if(u.length>1)return"auto";throw new Error("At least one endpoint must be provided: endpointChunkedRest, endpointMultipart, or endpointTus")},[E,s,d,n]),b=k(()=>{if(s)return{chunkSize:a,endpoint:s,maxRetries:v,metadata:p,onError:l,onPause:P,onProgress:f,onResume:U,onStart:c,onSuccess:g,retry:S}},[s,a,p,c,g,l,f,P,U,S,v]),T=k(()=>{if(d)return{endpoint:d,metadata:p,onError:l,onProgress:f,onStart:c,onSuccess:g}},[d,p,c,g,l,f]),y=k(()=>{if(n)return{chunkSize:a,endpoint:n,maxRetries:v,metadata:p,onError:l,onPause:P,onProgress:f,onResume:U,onStart:c,onSuccess:g,retry:S}},[n,a,p,c,g,l,f,P,U,S,v]),e=b?L(b):void 0,o=T?_(T):void 0,r=y?q(y):void 0,C=R(u=>{if(h!=="auto")return h;if(u.size>w){if(n)return"tus";if(s)return"chunked-rest"}if(s)return"chunked-rest";if(d)return"multipart";throw new Error("No available endpoint for upload")},[h,w,s,d,n]),z=R(async u=>{const M=C(u);if(M==="tus"){if(!r)throw new Error("TUS endpoint not configured");return r.upload(u)}if(M==="chunked-rest"){if(!e)throw new Error("Chunked REST endpoint not configured");return e.upload(u)}if(!o)throw new Error("Multipart endpoint not configured");return o.upload(u)},[C,r,e,o]),I=R(()=>{r?.abort(),e?.abort(),o?.reset()},[r,e,o]),O=R(()=>{r?.reset(),e?.reset(),o?.reset()},[r,e,o]),t=k(()=>h!=="auto"?h:r&&(r.isUploading||r.result)?"tus":e&&(e.isUploading||e.result)?"chunked-rest":o&&(o.isUploading||o.result)?"multipart":s?"chunked-rest":n?"tus":"multipart",[h,r,e,o,s,d,n]),A=i(()=>t==="tus"?r?.error??void 0:t==="chunked-rest"?e?.error??void 0:o?.error??void 0,"getError"),B=i(()=>{if(t==="tus")return r?.isPaused;if(t==="chunked-rest")return e?.isPaused},"getIsPaused"),N=i(()=>t==="tus"?r?.isUploading??!1:t==="chunked-rest"?e?.isUploading??!1:o?.isUploading??!1,"getIsUploading"),j=i(()=>{if(t==="tus")return r?.offset;if(t==="chunked-rest")return e?.offset},"getOffset"),D=i(()=>{if(t==="tus")return r?.pause;if(t==="chunked-rest")return e?.pause},"getPause"),F=i(()=>t==="tus"?r?.progress??0:t==="chunked-rest"?e?.progress??0:o?.progress??0,"getProgress"),H=i(()=>t==="tus"?r?.result??void 0:t==="chunked-rest"?e?.result??void 0:o?.result??void 0,"getResult"),J=i(()=>{if(t==="tus")return r?.resume;if(t==="chunked-rest")return e?.resume},"getResume");return{abort:I,currentMethod:t,error:A(),isPaused:B(),isUploading:N(),offset:j(),pause:D(),progress:F(),reset:O,result:H(),resume:J(),upload:z}},"useUpload");export{$ as useUpload};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var j=Object.defineProperty;var T=(d,a)=>j(d,"name",{value:a,configurable:!0});import{computed as o}from"vue";import{useChunkedRestUpload as A}from"./useChunkedRestUpload-
|
|
1
|
+
var j=Object.defineProperty;var T=(d,a)=>j(d,"name",{value:a,configurable:!0});import{computed as o}from"vue";import{useChunkedRestUpload as A}from"./useChunkedRestUpload-T5jeupI6.js";import{useMultipartUpload as B}from"./useMultipartUpload-CbRSpnTb.js";import{useTusUpload as F}from"./useTusUpload-SYnJmg1s.js";var H=Object.defineProperty,l=T((d,a)=>H(d,"name",{value:a,configurable:!0}),"i");const N=10*1024*1024,K=l(d=>{const{chunkSize:a,endpointChunkedRest:s,endpointMultipart:p,endpointTus:i,maxRetries:k,metadata:c,method:S,onError:f,onPause:U,onProgress:h,onResume:P,onStart:m,onSuccess:g,retry:w,tusThreshold:y=N}=d,v=o(()=>{if(S!==void 0)return S;const e=[s,p,i].filter(Boolean);if(e.length===1)return s?"chunked-rest":i?"tus":"multipart";if(e.length>1)return"auto";throw new Error("At least one endpoint must be provided: endpointChunkedRest, endpointMultipart, or endpointTus")}),E=s?{chunkSize:a,endpoint:s,maxRetries:k,metadata:c,onError:f,onPause:U,onProgress:h,onResume:P,onStart:m,onSuccess:g,retry:w}:void 0,R=p?{endpoint:p,metadata:c,onError:f,onProgress:h,onStart:m,onSuccess:g}:void 0,b=i?{chunkSize:a,endpoint:i,maxRetries:k,metadata:c,onError:f,onPause:U,onProgress:h,onResume:P,onStart:m,onSuccess:g,retry:w}:void 0,r=E?A(E):void 0,u=R?B(R):void 0,t=b?F(b):void 0,x=l(e=>{if(v.value!=="auto")return v.value;if(e.size>y){if(i)return"tus";if(s)return"chunked-rest"}if(s)return"chunked-rest";if(p)return"multipart";throw new Error("No available endpoint for upload")},"determineMethod"),C=l(async e=>{const M=x(e);if(M==="tus"){if(!t)throw new Error("TUS endpoint not configured");return t.upload(e)}if(M==="chunked-rest"){if(!r)throw new Error("Chunked REST endpoint not configured");return r.upload(e)}if(!u)throw new Error("Multipart endpoint not configured");return u.upload(e)},"upload"),z=l(()=>{t?.abort(),r?.abort(),u?.reset()},"abort"),O=l(()=>{t?.reset(),r?.reset(),u?.reset()},"reset"),n=o(()=>v.value!=="auto"?v.value:t&&(t.isUploading.value||t.result.value)?"tus":r&&(r.isUploading.value||r.result.value)?"chunked-rest":u&&(u.isUploading.value||u.result.value)?"multipart":s?"chunked-rest":i?"tus":"multipart");return{abort:z,currentMethod:n,error:o(()=>{const e=n.value;return e==="tus"?t?.error.value??void 0:e==="chunked-rest"?r?.error.value??void 0:u?.error.value??void 0}),isPaused:o(()=>{const e=n.value;if(e==="tus")return t?.isPaused.value;if(e==="chunked-rest")return r?.isPaused.value}),isUploading:o(()=>{const e=n.value;return e==="tus"?t?.isUploading.value??!1:e==="chunked-rest"?r?.isUploading.value??!1:u?.isUploading.value??!1}),offset:o(()=>{const e=n.value;if(e==="tus")return t?.offset.value;if(e==="chunked-rest")return r?.offset.value}),pause:o(()=>{const e=n.value;if(e==="tus")return t?.pause;if(e==="chunked-rest")return r?.pause}),progress:o(()=>{const e=n.value;return e==="tus"?t?.progress.value??0:e==="chunked-rest"?r?.progress.value??0:u?.progress.value??0}),reset:O,result:o(()=>{const e=n.value;return e==="tus"?t?.result.value??void 0:e==="chunked-rest"?r?.result.value??void 0:u?.result.value??void 0}),resume:o(()=>{const e=n.value;if(e==="tus")return t?.resume;if(e==="chunked-rest")return r?.resume}),upload:C}},"useUpload");export{K as useUpload};
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as UploadItem, B as BatchState, U as UploadResult, a as UploadControl, F as FingerprintFn, b as UrlStorage, d as FileMeta, r as UploadMethod } from "../packem_shared/uploader.d-npepq2LE.js";
|
|
2
2
|
interface UseAbortAllOptions {
|
|
3
3
|
/** Upload endpoint URL (used to create uploader instance) */
|
|
4
4
|
endpoint: string;
|
|
@@ -230,8 +230,12 @@ declare const useBatchUpload: (options: UseBatchUploadOptions) => UseBatchUpload
|
|
|
230
230
|
interface UseChunkedRestUploadOptions {
|
|
231
231
|
/** Chunk size for chunked REST uploads (default: 5MB) */
|
|
232
232
|
chunkSize?: number;
|
|
233
|
+
/** Unified control handle. See `UploadControl`. */
|
|
234
|
+
control?: UploadControl;
|
|
233
235
|
/** Chunked REST upload endpoint URL */
|
|
234
236
|
endpoint: string;
|
|
237
|
+
/** Customise the resume fingerprint. Defaults to `defaultFingerprint`. */
|
|
238
|
+
fingerprint?: FingerprintFn;
|
|
235
239
|
/** Maximum number of retry attempts */
|
|
236
240
|
maxRetries?: number;
|
|
237
241
|
/** Additional metadata to include with the upload */
|
|
@@ -250,6 +254,8 @@ interface UseChunkedRestUploadOptions {
|
|
|
250
254
|
onSuccess?: (file: UploadResult) => void;
|
|
251
255
|
/** Enable automatic retry on failure */
|
|
252
256
|
retry?: boolean;
|
|
257
|
+
/** Persistent storage for resume identifiers. */
|
|
258
|
+
urlStorage?: UrlStorage;
|
|
253
259
|
}
|
|
254
260
|
interface UseChunkedRestUploadReturn {
|
|
255
261
|
/** Abort the current upload */
|
|
@@ -719,8 +725,16 @@ declare const useTransformMetadata: (options: UseTransformMetadataOptions) => Us
|
|
|
719
725
|
interface UseTusUploadOptions {
|
|
720
726
|
/** Chunk size for TUS uploads (default: 1MB) */
|
|
721
727
|
chunkSize?: number;
|
|
728
|
+
/**
|
|
729
|
+
* Unified control handle. Pass an empty `new UploadControl()` to drive the
|
|
730
|
+
* upload, or `UploadControl.from(token)` to resume an upload that was
|
|
731
|
+
* started in another process / tab.
|
|
732
|
+
*/
|
|
733
|
+
control?: UploadControl;
|
|
722
734
|
/** TUS upload endpoint URL */
|
|
723
735
|
endpoint: string;
|
|
736
|
+
/** Customise the resume fingerprint. Defaults to `defaultFingerprint`. */
|
|
737
|
+
fingerprint?: FingerprintFn;
|
|
724
738
|
/** Maximum number of retry attempts */
|
|
725
739
|
maxRetries?: number;
|
|
726
740
|
/** Additional metadata to include with the upload */
|
|
@@ -739,6 +753,8 @@ interface UseTusUploadOptions {
|
|
|
739
753
|
onSuccess?: (file: UploadResult) => void;
|
|
740
754
|
/** Enable automatic retry on failure */
|
|
741
755
|
retry?: boolean;
|
|
756
|
+
/** Persistent storage for resume URLs (e.g. `defaultUrlStorage()` in the browser). */
|
|
757
|
+
urlStorage?: UrlStorage;
|
|
742
758
|
}
|
|
743
759
|
interface UseTusUploadReturn {
|
|
744
760
|
/** Abort the current upload */
|
package/dist/react/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useAbortAll as o}from"../packem_shared/useAbortAll-Xks2z0Rf.js";import{useAbortBatch as s}from"../packem_shared/useAbortBatch-y-KZjKTY.js";import{useAbortItem as u}from"../packem_shared/useAbortItem-BhdhRgs8.js";import{useAllAbortListener as f}from"../packem_shared/useAllAbortListener-Crsmf1kC.js";import{useBatchCancelledListener as a}from"../packem_shared/useBatchCancelledListener-CVJULtua.js";import{useBatchDeleteFiles as i}from"../packem_shared/useBatchDeleteFiles-BSG8D3Do.js";import{useBatchErrorListener as h}from"../packem_shared/useBatchErrorListener-BAVIRlQE.js";import{useBatchFinalizeListener as F}from"../packem_shared/useBatchFinalizeListener-nA7Qs-Ya.js";import{useBatchFinishListener as B}from"../packem_shared/useBatchFinishListener-C6zS5OI6.js";import{useBatchProgressListener as A}from"../packem_shared/useBatchProgressListener-CdcDM2sa.js";import{useBatchRetry as b}from"../packem_shared/useBatchRetry-B3FQ1DdH.js";import{useBatchStartListener as R}from"../packem_shared/useBatchStartListener-ByQlcF8F.js";import{useBatchUpload as C}from"../packem_shared/useBatchUpload-BJBdu6vh.js";import{useChunkedRestUpload as M}from"../packem_shared/useChunkedRestUpload-
|
|
1
|
+
import{useAbortAll as o}from"../packem_shared/useAbortAll-Xks2z0Rf.js";import{useAbortBatch as s}from"../packem_shared/useAbortBatch-y-KZjKTY.js";import{useAbortItem as u}from"../packem_shared/useAbortItem-BhdhRgs8.js";import{useAllAbortListener as f}from"../packem_shared/useAllAbortListener-Crsmf1kC.js";import{useBatchCancelledListener as a}from"../packem_shared/useBatchCancelledListener-CVJULtua.js";import{useBatchDeleteFiles as i}from"../packem_shared/useBatchDeleteFiles-BSG8D3Do.js";import{useBatchErrorListener as h}from"../packem_shared/useBatchErrorListener-BAVIRlQE.js";import{useBatchFinalizeListener as F}from"../packem_shared/useBatchFinalizeListener-nA7Qs-Ya.js";import{useBatchFinishListener as B}from"../packem_shared/useBatchFinishListener-C6zS5OI6.js";import{useBatchProgressListener as A}from"../packem_shared/useBatchProgressListener-CdcDM2sa.js";import{useBatchRetry as b}from"../packem_shared/useBatchRetry-B3FQ1DdH.js";import{useBatchStartListener as R}from"../packem_shared/useBatchStartListener-ByQlcF8F.js";import{useBatchUpload as C}from"../packem_shared/useBatchUpload-BJBdu6vh.js";import{useChunkedRestUpload as M}from"../packem_shared/useChunkedRestUpload-C_I_pDEa.js";import{useDeleteFile as k}from"../packem_shared/useDeleteFile-BJnTMMUr.js";import{useFileInput as I}from"../packem_shared/useFileInput-CgqlIlGE.js";import{useGetFile as z}from"../packem_shared/useGetFile-CNOi9ZIM.js";import{useGetFileList as H}from"../packem_shared/useGetFileList-BIGh4thc.js";import{useGetFileMeta as j}from"../packem_shared/useGetFileMeta-CHee8013.js";import{useHeadFile as v}from"../packem_shared/useHeadFile-CdIM_Xi1.js";import{useMultipartUpload as J}from"../packem_shared/useMultipartUpload-CJMa-_Yo.js";import{usePasteUpload as N}from"../packem_shared/usePasteUpload-_YqkCkrL.js";import{usePatchChunk as Q}from"../packem_shared/usePatchChunk-B8ZCd9Th.js";import{usePutFile as W}from"../packem_shared/usePutFile-Db_uVkqT.js";import{useRetry as Y}from"../packem_shared/useRetry-trYC3K_p.js";import{useRetryListener as _}from"../packem_shared/useRetryListener-DC8G9lmY.js";import{useTransformFile as ee}from"../packem_shared/useTransformFile-BMqWIG7J.js";import{useTransformMetadata as oe}from"../packem_shared/useTransformMetadata-CUo8IdKP.js";import{useTusUpload as se}from"../packem_shared/useTusUpload-DJedNEXm.js";import{useUpload as ue}from"../packem_shared/useUpload-BDMiZyCV.js";export{o as useAbortAll,s as useAbortBatch,u as useAbortItem,f as useAllAbortListener,a as useBatchCancelledListener,i as useBatchDeleteFiles,h as useBatchErrorListener,F as useBatchFinalizeListener,B as useBatchFinishListener,A as useBatchProgressListener,b as useBatchRetry,R as useBatchStartListener,C as useBatchUpload,M as useChunkedRestUpload,k as useDeleteFile,I as useFileInput,z as useGetFile,H as useGetFileList,j as useGetFileMeta,v as useHeadFile,J as useMultipartUpload,N as usePasteUpload,Q as usePatchChunk,W as usePutFile,Y as useRetry,_ as useRetryListener,ee as useTransformFile,oe as useTransformMetadata,se as useTusUpload,ue as useUpload};
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as UploadItem, B as BatchState, U as UploadResult, a as UploadControl, F as FingerprintFn, b as UrlStorage, d as FileMeta, r as UploadMethod } from "../packem_shared/uploader.d-npepq2LE.js";
|
|
2
2
|
import { Accessor } from 'solid-js';
|
|
3
3
|
import { QueryClient } from '@tanstack/solid-query';
|
|
4
4
|
interface CreateAbortAllOptions {
|
|
@@ -146,8 +146,12 @@ declare const createBatchUpload: (options: CreateBatchUploadOptions) => CreateBa
|
|
|
146
146
|
interface CreateChunkedRestUploadOptions {
|
|
147
147
|
/** Chunk size for chunked REST uploads (default: 5MB) */
|
|
148
148
|
chunkSize?: number;
|
|
149
|
+
/** Unified control handle. See `UploadControl`. */
|
|
150
|
+
control?: UploadControl;
|
|
149
151
|
/** Chunked REST upload endpoint URL */
|
|
150
152
|
endpoint: string;
|
|
153
|
+
/** Customise the resume fingerprint. */
|
|
154
|
+
fingerprint?: FingerprintFn;
|
|
151
155
|
/** Maximum number of retry attempts */
|
|
152
156
|
maxRetries?: number;
|
|
153
157
|
/** Additional metadata to include with the upload */
|
|
@@ -166,6 +170,8 @@ interface CreateChunkedRestUploadOptions {
|
|
|
166
170
|
onSuccess?: (file: UploadResult) => void;
|
|
167
171
|
/** Enable automatic retry on failure */
|
|
168
172
|
retry?: boolean;
|
|
173
|
+
/** Persistent storage for resume identifiers. */
|
|
174
|
+
urlStorage?: UrlStorage;
|
|
169
175
|
}
|
|
170
176
|
interface CreateChunkedRestUploadReturn {
|
|
171
177
|
/** Abort the current upload */
|
|
@@ -570,8 +576,12 @@ declare const createTransformMetadata: (options: CreateTransformMetadataOptions)
|
|
|
570
576
|
interface CreateTusUploadOptions {
|
|
571
577
|
/** Chunk size for TUS uploads (default: 1MB) */
|
|
572
578
|
chunkSize?: number;
|
|
579
|
+
/** Unified control handle. See `UploadControl`. */
|
|
580
|
+
control?: UploadControl;
|
|
573
581
|
/** TUS upload endpoint URL */
|
|
574
582
|
endpoint: string;
|
|
583
|
+
/** Customise the resume fingerprint. */
|
|
584
|
+
fingerprint?: FingerprintFn;
|
|
575
585
|
/** Maximum number of retry attempts */
|
|
576
586
|
maxRetries?: number;
|
|
577
587
|
/** Additional metadata to include with the upload */
|
|
@@ -590,6 +600,8 @@ interface CreateTusUploadOptions {
|
|
|
590
600
|
onSuccess?: (file: UploadResult) => void;
|
|
591
601
|
/** Enable automatic retry on failure */
|
|
592
602
|
retry?: boolean;
|
|
603
|
+
/** Persistent storage for resume URLs. */
|
|
604
|
+
urlStorage?: UrlStorage;
|
|
593
605
|
}
|
|
594
606
|
interface CreateTusUploadReturn {
|
|
595
607
|
/** Abort the current upload */
|
package/dist/solid/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createAbortAll as t}from"../packem_shared/createAbortAll-
|
|
1
|
+
import{createAbortAll as t}from"../packem_shared/createAbortAll-DMUWUL4C.js";import{createAbortBatch as a}from"../packem_shared/createAbortBatch-bMvSBu1k.js";import{createAbortItem as p}from"../packem_shared/createAbortItem-BsqmmxdZ.js";import{createAllAbortListener as f}from"../packem_shared/createAllAbortListener-BF9VhxQA.js";import{createBatchCancelledListener as l}from"../packem_shared/createBatchCancelledListener-FsVlTbYv.js";import{createBatchDeleteFiles as s}from"../packem_shared/createBatchDeleteFiles-CN07ubNE.js";import{createBatchErrorListener as h}from"../packem_shared/createBatchErrorListener-CxEJhGOX.js";import{createBatchFinalizeListener as d}from"../packem_shared/createBatchFinalizeListener-DOK5uoog.js";import{createBatchFinishListener as L}from"../packem_shared/createBatchFinishListener-BbMzJGlN.js";import{createBatchProgressListener as A}from"../packem_shared/createBatchProgressListener-D28nm9Xe.js";import{createBatchRetry as b}from"../packem_shared/createBatchRetry-Bnaf10e9.js";import{createBatchStartListener as R}from"../packem_shared/createBatchStartListener-BwVzPsCB.js";import{createBatchUpload as C}from"../packem_shared/createBatchUpload-Dm5vSg1j.js";import{createChunkedRestUpload as M}from"../packem_shared/createChunkedRestUpload-D4WS_E_m.js";import{createDeleteFile as k}from"../packem_shared/createDeleteFile-D07PU21a.js";import{createFileInput as I}from"../packem_shared/createFileInput-DyGrmzbc.js";import{createGetFile as z}from"../packem_shared/createGetFile-cUIB1L1M.js";import{createGetFileList as H}from"../packem_shared/createGetFileList-C3lYvKGY.js";import{createGetFileMeta as j}from"../packem_shared/createGetFileMeta-DZ46CHse.js";import{createHeadFile as v}from"../packem_shared/createHeadFile-Ch80NkDO.js";import{createMultipartUpload as J}from"../packem_shared/createMultipartUpload-BPcFYSwI.js";import{createPasteUpload as N}from"../packem_shared/createPasteUpload-DemCREgp.js";import{createPatchChunk as Q}from"../packem_shared/createPatchChunk-D-N2cYZ7.js";import{createPutFile as W}from"../packem_shared/createPutFile-CamOtR__.js";import{createRetry as Y}from"../packem_shared/createRetry-BInLl1TV.js";import{createRetryListener as _}from"../packem_shared/createRetryListener-hZUkGq7P.js";import{createTransformFile as ee}from"../packem_shared/createTransformFile-BcoA39lM.js";import{createTransformMetadata as te}from"../packem_shared/createTransformMetadata-CqyCBOXk.js";import{createTusUpload as ae}from"../packem_shared/createTusUpload-DrZu_r2C.js";import{createUpload as pe}from"../packem_shared/createUpload-ABEJ1whY.js";export{t as createAbortAll,a as createAbortBatch,p as createAbortItem,f as createAllAbortListener,l as createBatchCancelledListener,s as createBatchDeleteFiles,h as createBatchErrorListener,d as createBatchFinalizeListener,L as createBatchFinishListener,A as createBatchProgressListener,b as createBatchRetry,R as createBatchStartListener,C as createBatchUpload,M as createChunkedRestUpload,k as createDeleteFile,I as createFileInput,z as createGetFile,H as createGetFileList,j as createGetFileMeta,v as createHeadFile,J as createMultipartUpload,N as createPasteUpload,Q as createPatchChunk,W as createPutFile,Y as createRetry,_ as createRetryListener,ee as createTransformFile,te as createTransformMetadata,ae as createTusUpload,pe as createUpload};
|
package/dist/svelte/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as UploadItem, B as BatchState, U as UploadResult, a as UploadControl, F as FingerprintFn, b as UrlStorage, d as FileMeta, r as UploadMethod } from "../packem_shared/uploader.d-npepq2LE.js";
|
|
2
2
|
import { Readable } from 'svelte/store';
|
|
3
3
|
interface CreateAbortAllOptions {
|
|
4
4
|
endpoint: string;
|
|
@@ -125,8 +125,12 @@ declare const createBatchUpload: (options: CreateBatchUploadOptions) => CreateBa
|
|
|
125
125
|
interface CreateChunkedRestUploadOptions {
|
|
126
126
|
/** Chunk size for chunked REST uploads (default: 5MB) */
|
|
127
127
|
chunkSize?: number;
|
|
128
|
+
/** Unified control handle. See `UploadControl`. */
|
|
129
|
+
control?: UploadControl;
|
|
128
130
|
/** Chunked REST upload endpoint URL */
|
|
129
131
|
endpoint: string;
|
|
132
|
+
/** Customise the resume fingerprint. */
|
|
133
|
+
fingerprint?: FingerprintFn;
|
|
130
134
|
/** Maximum number of retry attempts */
|
|
131
135
|
maxRetries?: number;
|
|
132
136
|
/** Additional metadata to include with the upload */
|
|
@@ -145,6 +149,8 @@ interface CreateChunkedRestUploadOptions {
|
|
|
145
149
|
onSuccess?: (file: UploadResult) => void;
|
|
146
150
|
/** Enable automatic retry on failure */
|
|
147
151
|
retry?: boolean;
|
|
152
|
+
/** Persistent storage for resume identifiers. */
|
|
153
|
+
urlStorage?: UrlStorage;
|
|
148
154
|
}
|
|
149
155
|
interface CreateChunkedRestUploadReturn {
|
|
150
156
|
/** Abort the current upload */
|
|
@@ -551,8 +557,12 @@ declare const createTransformMetadata: (options: CreateTransformMetadataOptions)
|
|
|
551
557
|
interface CreateTusUploadOptions {
|
|
552
558
|
/** Chunk size for TUS uploads (default: 1MB) */
|
|
553
559
|
chunkSize?: number;
|
|
560
|
+
/** Unified control handle. See `UploadControl`. */
|
|
561
|
+
control?: UploadControl;
|
|
554
562
|
/** TUS upload endpoint URL */
|
|
555
563
|
endpoint: string;
|
|
564
|
+
/** Customise the resume fingerprint. */
|
|
565
|
+
fingerprint?: FingerprintFn;
|
|
556
566
|
/** Maximum number of retry attempts */
|
|
557
567
|
maxRetries?: number;
|
|
558
568
|
/** Additional metadata to include with the upload */
|
|
@@ -571,6 +581,8 @@ interface CreateTusUploadOptions {
|
|
|
571
581
|
onSuccess?: (file: UploadResult) => void;
|
|
572
582
|
/** Enable automatic retry on failure */
|
|
573
583
|
retry?: boolean;
|
|
584
|
+
/** Persistent storage for resume URLs. */
|
|
585
|
+
urlStorage?: UrlStorage;
|
|
574
586
|
}
|
|
575
587
|
interface CreateTusUploadReturn {
|
|
576
588
|
/** Abort the current upload */
|
package/dist/svelte/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createAbortAll as t}from"../packem_shared/createAbortAll-
|
|
1
|
+
import{createAbortAll as t}from"../packem_shared/createAbortAll-BVH_Wo6s.js";import{createAbortBatch as a}from"../packem_shared/createAbortBatch-C3t-Ho9c.js";import{createAbortItem as p}from"../packem_shared/createAbortItem-Bmhqhi8L.js";import{createAllAbortListener as f}from"../packem_shared/createAllAbortListener-BChF9YcG.js";import{createBatchCancelledListener as l}from"../packem_shared/createBatchCancelledListener-DIHrRDNj.js";import{createBatchDeleteFiles as s}from"../packem_shared/createBatchDeleteFiles-B8bHItyS.js";import{createBatchErrorListener as h}from"../packem_shared/createBatchErrorListener-BNXfdSlM.js";import{createBatchFinalizeListener as d}from"../packem_shared/createBatchFinalizeListener-pjqAl9iM.js";import{createBatchFinishListener as L}from"../packem_shared/createBatchFinishListener-DuMOo7Kn.js";import{createBatchProgressListener as A}from"../packem_shared/createBatchProgressListener-CUpa_7Nv.js";import{createBatchRetry as b}from"../packem_shared/createBatchRetry-DWOdovQt.js";import{createBatchStartListener as R}from"../packem_shared/createBatchStartListener-DejGDAMY.js";import{createBatchUpload as C}from"../packem_shared/createBatchUpload-Z-8vD9Ql.js";import{createChunkedRestUpload as M}from"../packem_shared/createChunkedRestUpload-Cu19LRnt.js";import{createDeleteFile as k}from"../packem_shared/createDeleteFile-mGIgeCQK.js";import{createFileInput as I}from"../packem_shared/createFileInput-CERPgCpc.js";import{createGetFile as z}from"../packem_shared/createGetFile-dT-EuNKP.js";import{createGetFileList as H}from"../packem_shared/createGetFileList-C_n3HgHG.js";import{createGetFileMeta as j}from"../packem_shared/createGetFileMeta-CSYB0Oj1.js";import{createHeadFile as v}from"../packem_shared/createHeadFile--rl2Ezgb.js";import{createMultipartUpload as J}from"../packem_shared/createMultipartUpload-CFsUjhvG.js";import{createPasteUpload as N}from"../packem_shared/createPasteUpload-BS7pMOvb.js";import{createPatchChunk as Q}from"../packem_shared/createPatchChunk-7y5S60GE.js";import{createPutFile as W}from"../packem_shared/createPutFile-BJcLUSQi.js";import{createRetry as Y}from"../packem_shared/createRetry-D0eddvNY.js";import{createRetryListener as _}from"../packem_shared/createRetryListener-59bXI4qF.js";import{createTransformFile as ee}from"../packem_shared/createTransformFile-BaofH3n5.js";import{createTransformMetadata as te}from"../packem_shared/createTransformMetadata-C9lWyhne.js";import{createTusUpload as ae}from"../packem_shared/createTusUpload-C_EE1exZ.js";import{createUpload as pe}from"../packem_shared/createUpload-F7cp3uwR.js";export{t as createAbortAll,a as createAbortBatch,p as createAbortItem,f as createAllAbortListener,l as createBatchCancelledListener,s as createBatchDeleteFiles,h as createBatchErrorListener,d as createBatchFinalizeListener,L as createBatchFinishListener,A as createBatchProgressListener,b as createBatchRetry,R as createBatchStartListener,C as createBatchUpload,M as createChunkedRestUpload,k as createDeleteFile,I as createFileInput,z as createGetFile,H as createGetFileList,j as createGetFileMeta,v as createHeadFile,J as createMultipartUpload,N as createPasteUpload,Q as createPatchChunk,W as createPutFile,Y as createRetry,_ as createRetryListener,ee as createTransformFile,te as createTransformMetadata,ae as createTusUpload,pe as createUpload};
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as UploadItem, B as BatchState, U as UploadResult, a as UploadControl, F as FingerprintFn, b as UrlStorage, d as FileMeta, r as UploadMethod } from "../packem_shared/uploader.d-npepq2LE.js";
|
|
2
2
|
import { Ref, MaybeRefOrGetter, ComputedRef } from 'vue';
|
|
3
3
|
interface UseAbortAllOptions {
|
|
4
4
|
/** Upload endpoint URL (used to create uploader instance) */
|
|
@@ -227,8 +227,12 @@ declare const useBatchUpload: (options: UseBatchUploadOptions) => UseBatchUpload
|
|
|
227
227
|
interface UseChunkedRestUploadOptions {
|
|
228
228
|
/** Chunk size for chunked REST uploads (default: 5MB) */
|
|
229
229
|
chunkSize?: number;
|
|
230
|
+
/** Unified control handle. See `UploadControl`. */
|
|
231
|
+
control?: UploadControl;
|
|
230
232
|
/** Chunked REST upload endpoint URL */
|
|
231
233
|
endpoint: string;
|
|
234
|
+
/** Customise the resume fingerprint. */
|
|
235
|
+
fingerprint?: FingerprintFn;
|
|
232
236
|
/** Maximum number of retry attempts */
|
|
233
237
|
maxRetries?: number;
|
|
234
238
|
/** Additional metadata to include with the upload */
|
|
@@ -247,6 +251,8 @@ interface UseChunkedRestUploadOptions {
|
|
|
247
251
|
onSuccess?: (file: UploadResult) => void;
|
|
248
252
|
/** Enable automatic retry on failure */
|
|
249
253
|
retry?: boolean;
|
|
254
|
+
/** Persistent storage for resume identifiers. */
|
|
255
|
+
urlStorage?: UrlStorage;
|
|
250
256
|
}
|
|
251
257
|
interface UseChunkedRestUploadReturn {
|
|
252
258
|
/** Abort the current upload */
|
|
@@ -684,8 +690,12 @@ declare const useTransformMetadata: (options: UseTransformMetadataOptions) => Us
|
|
|
684
690
|
interface UseTusUploadOptions {
|
|
685
691
|
/** Chunk size for TUS uploads (default: 1MB) */
|
|
686
692
|
chunkSize?: number;
|
|
693
|
+
/** Unified control handle. See `UploadControl`. */
|
|
694
|
+
control?: UploadControl;
|
|
687
695
|
/** TUS upload endpoint URL */
|
|
688
696
|
endpoint: string;
|
|
697
|
+
/** Customise the resume fingerprint. */
|
|
698
|
+
fingerprint?: FingerprintFn;
|
|
689
699
|
/** Maximum number of retry attempts */
|
|
690
700
|
maxRetries?: number;
|
|
691
701
|
/** Additional metadata to include with the upload */
|
|
@@ -704,6 +714,8 @@ interface UseTusUploadOptions {
|
|
|
704
714
|
onSuccess?: (file: UploadResult) => void;
|
|
705
715
|
/** Enable automatic retry on failure */
|
|
706
716
|
retry?: boolean;
|
|
717
|
+
/** Persistent storage for resume URLs. */
|
|
718
|
+
urlStorage?: UrlStorage;
|
|
707
719
|
}
|
|
708
720
|
interface UseTusUploadReturn {
|
|
709
721
|
/** Abort the current upload */
|
package/dist/vue/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useAbortAll as o}from"../packem_shared/useAbortAll-DNzPcfOt.js";import{useAbortBatch as s}from"../packem_shared/useAbortBatch-Jb37hbXq.js";import{useAbortItem as u}from"../packem_shared/useAbortItem-DTFUUKVu.js";import{useAllAbortListener as f}from"../packem_shared/useAllAbortListener-BBw02ZoD.js";import{useBatchCancelledListener as a}from"../packem_shared/useBatchCancelledListener-C3IW43nC.js";import{useBatchDeleteFiles as i}from"../packem_shared/useBatchDeleteFiles-DmKXrcBR.js";import{useBatchErrorListener as h}from"../packem_shared/useBatchErrorListener-Ck1BwfZA.js";import{useBatchFinalizeListener as F}from"../packem_shared/useBatchFinalizeListener-D7TRElSE.js";import{useBatchFinishListener as B}from"../packem_shared/useBatchFinishListener-VdCzyg4J.js";import{useBatchProgressListener as A}from"../packem_shared/useBatchProgressListener-B08x2n9U.js";import{useBatchRetry as b}from"../packem_shared/useBatchRetry-DahiIOXJ.js";import{useBatchStartListener as R}from"../packem_shared/useBatchStartListener-DndF1z5v.js";import{useBatchUpload as C}from"../packem_shared/useBatchUpload-IZkU_Gop.js";import{useChunkedRestUpload as M}from"../packem_shared/useChunkedRestUpload-
|
|
1
|
+
import{useAbortAll as o}from"../packem_shared/useAbortAll-DNzPcfOt.js";import{useAbortBatch as s}from"../packem_shared/useAbortBatch-Jb37hbXq.js";import{useAbortItem as u}from"../packem_shared/useAbortItem-DTFUUKVu.js";import{useAllAbortListener as f}from"../packem_shared/useAllAbortListener-BBw02ZoD.js";import{useBatchCancelledListener as a}from"../packem_shared/useBatchCancelledListener-C3IW43nC.js";import{useBatchDeleteFiles as i}from"../packem_shared/useBatchDeleteFiles-DmKXrcBR.js";import{useBatchErrorListener as h}from"../packem_shared/useBatchErrorListener-Ck1BwfZA.js";import{useBatchFinalizeListener as F}from"../packem_shared/useBatchFinalizeListener-D7TRElSE.js";import{useBatchFinishListener as B}from"../packem_shared/useBatchFinishListener-VdCzyg4J.js";import{useBatchProgressListener as A}from"../packem_shared/useBatchProgressListener-B08x2n9U.js";import{useBatchRetry as b}from"../packem_shared/useBatchRetry-DahiIOXJ.js";import{useBatchStartListener as R}from"../packem_shared/useBatchStartListener-DndF1z5v.js";import{useBatchUpload as C}from"../packem_shared/useBatchUpload-IZkU_Gop.js";import{useChunkedRestUpload as M}from"../packem_shared/useChunkedRestUpload-T5jeupI6.js";import{useDeleteFile as k}from"../packem_shared/useDeleteFile-Dsw372GL.js";import{useFileInput as I}from"../packem_shared/useFileInput-BUPBo2m_.js";import{useGetFile as z}from"../packem_shared/useGetFile-BkmKk12o.js";import{useGetFileList as H}from"../packem_shared/useGetFileList-CkAmk7lP.js";import{useGetFileMeta as j}from"../packem_shared/useGetFileMeta-eKrJc2p1.js";import{useHeadFile as v}from"../packem_shared/useHeadFile-D5CQQnyf.js";import{useMultipartUpload as J}from"../packem_shared/useMultipartUpload-CbRSpnTb.js";import{usePasteUpload as N}from"../packem_shared/usePasteUpload-COdUC9xU.js";import{usePatchChunk as Q}from"../packem_shared/usePatchChunk-DqZtVBBl.js";import{usePutFile as W}from"../packem_shared/usePutFile-CFaBgDX4.js";import{useRetry as Y}from"../packem_shared/useRetry-DHjDuH0H.js";import{useRetryListener as _}from"../packem_shared/useRetryListener-CAIyK1_Q.js";import{useTransformFile as ee}from"../packem_shared/useTransformFile-BCyX-R_e.js";import{useTransformMetadata as oe}from"../packem_shared/useTransformMetadata-DjcVDZOc.js";import{useTusUpload as se}from"../packem_shared/useTusUpload-SYnJmg1s.js";import{useUpload as ue}from"../packem_shared/useUpload-D-2542dH.js";export{o as useAbortAll,s as useAbortBatch,u as useAbortItem,f as useAllAbortListener,a as useBatchCancelledListener,i as useBatchDeleteFiles,h as useBatchErrorListener,F as useBatchFinalizeListener,B as useBatchFinishListener,A as useBatchProgressListener,b as useBatchRetry,R as useBatchStartListener,C as useBatchUpload,M as useChunkedRestUpload,k as useDeleteFile,I as useFileInput,z as useGetFile,H as useGetFileList,j as useGetFileMeta,v as useHeadFile,J as useMultipartUpload,N as usePasteUpload,Q as usePatchChunk,W as usePutFile,Y as useRetry,_ as useRetryListener,ee as useTransformFile,oe as useTransformMetadata,se as useTusUpload,ue as useUpload};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/storage-client",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.15",
|
|
4
4
|
"description": "The upload client library. Simple and easy file uploads for React | Vue | Solid | Svelte.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"abort-upload",
|
|
@@ -28,9 +28,7 @@
|
|
|
28
28
|
"vue-query"
|
|
29
29
|
],
|
|
30
30
|
"homepage": "https://visulima.com/packages/storage-client",
|
|
31
|
-
"bugs":
|
|
32
|
-
"url": "https://github.com/visulima/visulima/issues"
|
|
33
|
-
},
|
|
31
|
+
"bugs": "https://github.com/visulima/visulima/issues",
|
|
34
32
|
"repository": {
|
|
35
33
|
"type": "git",
|
|
36
34
|
"url": "git+https://github.com/visulima/visulima.git",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var I=Object.defineProperty;var A=(m,h)=>I(m,"name",{value:h,configurable:!0});var N=Object.defineProperty,s=A((m,h)=>N(m,"name",{value:h,configurable:!0}),"s");const D=s(m=>{const{chunkSize:h=5242880,endpoint:f,maxRetries:y=3,metadata:S={},retry:E=!0}=m;let r={aborted:!1,paused:!1,totalSize:0,uploadedChunks:new Set},$,z,g,b;const O=s(async(t,e)=>{if(e?.aborted)throw new Error("Aborted");const a=100,n=Date.now();for(;Date.now()-n<t;){if(e?.aborted)throw new Error("Aborted");const i=t-(Date.now()-n),d=Math.min(a,i);await new Promise(u=>{setTimeout(()=>{u()},d)})}},"abortableDelay"),w=s(async(t,e,a=y)=>{try{const n=await fetch(t,e);if(!n.ok&&a>0&&E){const i=1e3*2**(y-a);return await O(i,e.signal),w(t,e,a-1)}return n}catch(n){if(e.signal?.aborted||n instanceof Error&&n.message==="Aborted")throw n;if(a>0&&E){const i=1e3*2**(y-a);return await O(i,e.signal),w(t,e,a-1)}throw n}},"fetchWithRetry"),U=s(async t=>{const e={"Content-Type":t.type||"application/octet-stream","X-Chunked-Upload":"true","X-Total-Size":String(t.size)};Object.keys(S).length>0&&(e["X-File-Metadata"]=JSON.stringify(S)),t.name&&(e["Content-Disposition"]=`attachment; filename="${t.name}"`);const a=await w(f,{body:new Uint8Array(0),headers:e,method:"POST"});if(!a.ok)throw new Error(`Failed to create upload session: ${String(a.status)} ${a.statusText}`);const n=a.headers.get("X-Upload-ID")??a.headers.get("Location")?.split("/").pop();if(!n)throw new Error("Failed to get upload ID from server");return n},"createUpload"),k=s(async t=>{const e=f.endsWith("/")?`${f}${t}`:`${f}/${t}`,a=await w(e,{method:"HEAD"});if(!a.ok)throw new Error(`Failed to get upload status: ${String(a.status)} ${a.statusText}`);const n=Number.parseInt(a.headers.get("X-Upload-Offset")??"0",10),i=a.headers.get("X-Received-Chunks");let d=[];if(i)try{const u=JSON.parse(i);Array.isArray(u)&&(d=u)}catch{}return{chunks:d,offset:n}},"getUploadStatus"),P=s(async(t,e,a,n,i)=>{const d=t.slice(a,n),u=n-a;if(r.uploadedChunks.has(a))return;const p=f.endsWith("/")?`${f}${e}`:`${f}/${e}`,c=await w(p,{body:d,headers:{"Content-Length":String(u),"Content-Type":"application/octet-stream","X-Chunk-Offset":String(a)},method:"PATCH",signal:i});if(!c.ok)throw new Error(`Failed to upload chunk: ${String(c.status)} ${c.statusText}`);r.uploadedChunks.add(a);const o=Number.parseInt(c.headers.get("X-Upload-Offset")??String(n),10),l=Math.round(o/t.size*100);z?.(l,o)},"uploadChunk"),T=s(async(t,e,a)=>{const n=Math.ceil(t.size/h),{chunks:i}=await k(e);for(const l of i)r.uploadedChunks.add(l.offset);const d=[];for(let l=0;l<n;l+=1){const C=l*h,v=Math.min(C+h,t.size);if(!r.uploadedChunks.has(C)){for(;r.paused&&!r.aborted;)await new Promise(F=>{setTimeout(()=>{F()},100)});if(r.aborted)throw new Error("Upload aborted");d.push(P(t,e,C,v,a))}}await Promise.all(d);const u=await k(e);if(u.offset<t.size)throw new Error(`Upload incomplete. Expected ${String(t.size)} bytes, got ${String(u.offset)}`);if(r.uploadedChunks.size<=0)throw new Error("No chunks were uploaded");const p=f.endsWith("/")?`${f}${e}`:`${f}/${e}`,c=await w(p,{method:"GET"});if(!c.ok)throw new Error(`Failed to get upload result: ${String(c.status)} ${c.statusText}`);const o=await c.json();return{bytesWritten:o.bytesWritten??Math.max(t.size,0),contentType:o.contentType??t.type,createdAt:o.createdAt,filename:o.originalName??t.name,id:o.id??e,metadata:o.metadata,name:o.name,originalName:o.originalName??t.name,size:o.size??t.size,status:o.status??"completed",url:o.url}},"performUpload");return{abort:s(()=>{r.aborted=!0,r.paused=!1,r.abortController?.abort()},"abort"),clear:s(()=>{r={abortController:void 0,aborted:!1,file:void 0,fileId:void 0,paused:!1,totalSize:0,uploadedChunks:new Set}},"clear"),getOffset:s(async()=>{if(!r.fileId)return 0;try{return(await k(r.fileId)).offset}catch{let t=0;for(const e of r.uploadedChunks){const a=Math.min(e+h,r.totalSize);t+=a-e}return t}},"getOffset"),isPaused:s(()=>r.paused,"isPaused"),pause:s(()=>{r.paused=!0},"pause"),resume:s(async()=>{if(!r.fileId||!r.file)throw new Error("No upload to resume");r.paused=!1;const t=new AbortController;r.abortController=t;try{const e=await T(r.file,r.fileId,t.signal);g?.(e)}catch(e){const a=e instanceof Error?e:new Error(String(e));throw b?.(a),a}},"resume"),setOnError:s(t=>{b=t},"setOnError"),setOnFinish:s(t=>{g=t},"setOnFinish"),setOnProgress:s(t=>{z=t},"setOnProgress"),setOnStart:s(t=>{$=t},"setOnStart"),upload:s(async t=>{let e=!1;const a=g,n=b;let i;const d=s(()=>{i&&(clearTimeout(i),i=void 0),g=a,b=n},"cleanupTimeout"),u=s(o=>{e||(e=!0,d(),a?.(o))},"internalFinishCallback"),p=s(o=>{e||(e=!0,d(),n?.(o))},"internalErrorCallback");g=u,b=p,r={aborted:!1,file:t,paused:!1,totalSize:t.size,uploadedChunks:new Set},$?.();const c=(async()=>{const o=new AbortController;r.abortController=o;const l=await U(t);return r.fileId=l,T(t,l,o.signal)})();i=setTimeout(()=>{e||(r.aborted=!0,d(),p(new Error("Upload timeout")))},3e5);try{const o=await c;return u(o),o}catch(o){const l=o instanceof Error?o:new Error(String(o));throw p(l),l}},"upload")}},"createChunkedRestAdapter");export{D as createChunkedRestAdapter};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var R=Object.defineProperty;var h=(l,c)=>R(l,"name",{value:c,configurable:!0});import{onMount as k,onDestroy as U}from"svelte";import{writable as i}from"svelte/store";import{createChunkedRestAdapter as x}from"./createChunkedRestAdapter-CWFhVX6x.js";var C=Object.defineProperty,u=h((l,c)=>C(l,"name",{value:c,configurable:!0}),"n");const A=u(l=>{const{chunkSize:c,endpoint:v,maxRetries:O,metadata:g,onError:p,onPause:y,onProgress:E,onResume:P,onStart:S,onSuccess:b,retry:w}=l,d=i(0),s=i(!1),r=i(!1),o=i(),m=i(),f=i(0),t=x({chunkSize:c,endpoint:v,maxRetries:O,metadata:g,retry:w});return k(()=>{t.setOnStart(()=>{s.set(!0),r.set(!1),d.set(0),o.set(void 0),f.set(0),S?.()}),t.setOnProgress((e,n)=>{d.set(e),f.set(n),E?.(e,n)}),t.setOnFinish(e=>{d.set(100),m.set(e),s.set(!1),r.set(!1),b?.(e)}),t.setOnError(e=>{o.set(e),s.set(!1),p?.(e)});const a=setInterval(()=>{t.getOffset().then(e=>(f.set(e),e)).catch(()=>{}),r.set(t.isPaused())},100);U(()=>{clearInterval(a),t.setOnStart(void 0),t.setOnProgress(void 0),t.setOnFinish(void 0),t.setOnError(void 0)})}),{abort:u(()=>{t.abort(),s.set(!1),r.set(!1)},"abort"),error:o,isPaused:r,isUploading:s,offset:f,pause:u(()=>{t.pause(),r.set(!0),y?.()},"pause"),progress:d,reset:u(()=>{t.clear(),d.set(0),s.set(!1),r.set(!1),o.set(void 0),m.set(void 0),f.set(0)},"reset"),result:m,resume:u(async()=>{r.set(!1),s.set(!0),P?.();try{await t.resume()}catch(a){const e=a instanceof Error?a:new Error(String(a));throw o.set(e),s.set(!1),p?.(e),e}},"resume"),upload:u(async a=>{try{return await t.upload(a)}catch(e){const n=e instanceof Error?e:new Error(String(e));throw o.set(n),p?.(n),n}},"upload")}},"createChunkedRestUpload");export{A as createChunkedRestUpload};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var z=Object.defineProperty;var h=(u,c)=>z(u,"name",{value:c,configurable:!0});import{createSignal as n,onMount as A,onCleanup as F}from"solid-js";import{createChunkedRestAdapter as j}from"./createChunkedRestAdapter-CWFhVX6x.js";var M=Object.defineProperty,i=h((u,c)=>M(u,"name",{value:c,configurable:!0}),"n");const G=i(u=>{const{chunkSize:c,endpoint:m,maxRetries:g,metadata:O,onError:p,onPause:S,onProgress:y,onResume:E,onStart:P,onSuccess:w,retry:R}=u,[b,d]=n(0),[k,t]=n(!1),[C,s]=n(!1),[U,l]=n(void 0),[x,v]=n(void 0),[I,f]=n(0),r=j({chunkSize:c,endpoint:m,maxRetries:g,metadata:O,retry:R});return A(()=>{r.setOnStart(()=>{t(!0),s(!1),d(0),l(void 0),f(0),P?.()}),r.setOnProgress((e,o)=>{d(e),f(o),y?.(e,o)}),r.setOnFinish(e=>{d(100),v(e),t(!1),s(!1),w?.(e)}),r.setOnError(e=>{l(e),t(!1),p?.(e)});const a=setInterval(()=>{r.getOffset().then(e=>f(e)).catch(()=>{}),s(r.isPaused())},100);F(()=>{clearInterval(a),r.setOnStart(void 0),r.setOnProgress(void 0),r.setOnFinish(void 0),r.setOnError(void 0)})}),{abort:i(()=>{r.abort(),t(!1),s(!1)},"abort"),error:U,isPaused:C,isUploading:k,offset:I,pause:i(()=>{r.pause(),s(!0),S?.()},"pause"),progress:b,reset:i(()=>{r.clear(),d(0),t(!1),s(!1),l(void 0),v(void 0),f(0)},"reset"),result:x,resume:i(async()=>{s(!1),t(!0),E?.();try{await r.resume()}catch(a){const e=a instanceof Error?a:new Error(String(a));throw l(e),t(!1),p?.(e),e}},"resume"),upload:i(async a=>{try{return await r.upload(a)}catch(e){const o=e instanceof Error?e:new Error(String(e));throw l(o),p?.(o),o}},"upload")}},"createChunkedRestUpload");export{G as createChunkedRestUpload};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var N=Object.defineProperty;var S=(p,c)=>N(p,"name",{value:c,configurable:!0});var k=Object.defineProperty,a=S((p,c)=>k(p,"name",{value:c,configurable:!0}),"t");const E="1.0.0",x=a(p=>{const c=new TextEncoder().encode(p);let h="";for(const m of c)h+=String.fromCodePoint(m);return btoa(h)},"encodeBase64Utf8"),R=a(p=>{const c=atob(p),h=new Uint8Array(c.length);for(let m=0;m<c.length;m+=1)h[m]=c.codePointAt(m)??0;return new TextDecoder().decode(h)},"decodeBase64Utf8"),$=a(p=>Object.entries(p).map(([c,h])=>{const m=x(h);return`${c} ${m}`}).join(","),"encodeMetadata"),F=a(p=>{if(!p)return{};const c={};return p.split(",").forEach(h=>{const[m,...C]=h.trim().split(" "),b=C.join(" ");if(m&&b)try{c[m]=R(b)}catch{}}),c},"decodeMetadata"),j=a(p=>{const{chunkSize:c=1048576,endpoint:h,maxRetries:m=3,metadata:C={},retry:b=!0}=p;let o,y,z,U,T;const A=a(async t=>{const i={filename:t.name,filetype:t.type,...C},r=await fetch(h,{headers:{"Tus-Resumable":E,"Upload-Length":t.size.toString(),"Upload-Metadata":$(i)},method:"POST"});if(r.status!==201&&r.status!==200)throw new Error(`Failed to create upload: ${String(r.status)} ${r.statusText}`);const e=r.headers.get("Location");if(!e)throw new Error("No Location header in response");let n;if(e.startsWith("http"))n=e;else try{n=new URL(e,h).href}catch{const u="window"in globalThis?globalThis.location.origin:"http://localhost";n=new URL(e,u+h).href}const l=r.headers.get("Upload-Offset");return{initialOffset:l?Number.parseInt(l,10):0,uploadUrl:n}},"createUpload"),O=a(async(t,i)=>{const r=await fetch(t,{headers:{"Tus-Resumable":E},method:"HEAD",signal:i});if(!r.ok){if(r.status===404||r.status===410||r.status===403)return 0;throw new Error(`Failed to get upload offset: ${String(r.status)} ${r.statusText}`)}const e=r.headers.get("Upload-Offset");return e?Number.parseInt(e,10):0},"getUploadOffset"),v=a(async(t,i,r,e)=>{const n=Math.min(r+c,t.size),l=t.slice(r,n),u=await fetch(i,{body:l,headers:{"Content-Length":l.size.toString(),"Content-Type":"application/offset+octet-stream","Tus-Resumable":E,"Upload-Offset":r.toString()},method:"PATCH",signal:e});if(u.status!==204){if(u.status===409)return await O(i);throw u.status===404||u.status===410?new Error("Upload expired or not found"):u.status===415?new Error("Content-Type must be application/offset+octet-stream"):new Error(`Failed to upload chunk: ${String(u.status)} ${u.statusText}`)}const w=u.headers.get("Upload-Offset");if(!w)throw new Error("Missing Upload-Offset header in PATCH response");return Number.parseInt(w,10)},"uploadChunk"),M=a(async(t,i,r=0)=>{const e=o;if(!e)throw new Error("Upload state not initialized");const{abortController:n}=e;let l=r;try{for(;l<t.size;){if(n.signal.aborted)throw new Error("Upload aborted");if(e.isPaused&&await new Promise(f=>{const g=a(()=>{n.signal.aborted?f():e.isPaused?setTimeout(g,100):f()},"checkPause");g()}),n.signal.aborted)throw new Error("Upload aborted");try{l=await v(t,i,l,n.signal),e.offset=l;const f=Math.round(l/t.size*100);y?.(f,l)}catch(f){if(n.signal.aborted)throw new Error("Upload aborted");if(b&&e.retryCount<m){if(e.retryCount+=1,await new Promise(g=>setTimeout(g,1e3*e.retryCount)),n.signal.aborted)throw new Error("Upload aborted");l=await O(i,n.signal);continue}throw f}e.retryCount=0}if(n.signal.aborted)throw new Error("Upload aborted");const u=await fetch(i,{headers:{"Tus-Resumable":E},method:"HEAD",signal:n.signal}),w=u.headers.get("Location")??i,P=u.headers.get("Upload-Metadata"),s=F(P??void 0);let d={};try{d={contentType:u.headers.get("Content-Type")??s.filetype??t.type,id:i.split("/").pop()??"",metadata:s,originalName:s.filename??t.name,size:t.size,status:"completed"}}catch{}return{bytesWritten:l,contentType:d.contentType??t.type,createdAt:d.createdAt,filename:d.originalName??t.name,id:d.id??i.split("/").pop()??"",metadata:d.metadata??s,name:d.name,offset:l,originalName:d.originalName??t.name,size:d.size??t.size,status:d.status??"completed",url:w}}finally{o===e&&(o=void 0)}},"performUpload");return{abort:a(()=>{o&&o.abortController.abort()},"abort"),clear:a(()=>{o&&o.abortController.abort()},"clear"),getOffset:a(()=>o?.offset??0,"getOffset"),isPaused:a(()=>o?.isPaused??!1,"isPaused"),pause:a(()=>{o&&(o.isPaused=!0)},"pause"),resume:a(async()=>{if(!o?.uploadUrl)throw new Error("No upload to resume");o.isPaused=!1},"resume"),setOnError:a(t=>{T=t},"setOnError"),setOnFinish:a(t=>{U=t},"setOnFinish"),setOnProgress:a(t=>{y=t},"setOnProgress"),setOnStart:a(t=>{z=t},"setOnStart"),upload:a(async t=>{let i=!1;const r=U,e=T;let n;const l=a(()=>{n&&(clearTimeout(n),n=void 0),U=r,T=e},"cleanupTimeout"),u=a(s=>{i||(i=!0,l(),r?.(s))},"internalFinishCallback"),w=a(s=>{i||(i=!0,l(),e?.(s),o?.uploadUrl||(o=void 0))},"internalErrorCallback");U=u,T=w,o={abortController:new AbortController,file:t,isPaused:!1,offset:0,retryCount:0,uploadUrl:void 0};const P=(async()=>{z?.();const s=o;let d=s.uploadUrl;if(d===void 0){const{initialOffset:f,uploadUrl:g}=await A(t);d=g,s.uploadUrl=d,s.offset=f,f>0&&y?.(Math.round(f/t.size*100),f)}else{const f=await O(d,s.abortController.signal);f>0&&(s.offset=f,y?.(Math.round(f/t.size*100),f))}return M(t,d,s.offset)})();n=setTimeout(()=>{i||(i=!0,l(),o&&o.abortController.abort(),o&&!o.uploadUrl&&(o=void 0))},3e5);try{const s=await P;return u(s),s}catch(s){const d=s instanceof Error?s:new Error(String(s));throw w(d),d}},"upload")}},"createTusAdapter");export{j as createTusAdapter};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var z=Object.defineProperty;var m=(i,u)=>z(i,"name",{value:u,configurable:!0});import{createSignal as o,onMount as A,onCleanup as F}from"solid-js";import{createTusAdapter as j}from"./createTusAdapter-BbFsUNsP.js";var C=Object.defineProperty,n=m((i,u)=>C(i,"name",{value:u,configurable:!0}),"n");const D=n(i=>{const{chunkSize:u,endpoint:g,maxRetries:O,metadata:S,onError:p,onPause:h,onProgress:y,onResume:E,onStart:P,onSuccess:w,retry:b}=i,[x,d]=o(0),[R,t]=o(!1),[T,s]=o(!1),[U,l]=o(void 0),[I,v]=o(void 0),[k,f]=o(0),r=j({chunkSize:u,endpoint:g,maxRetries:O,metadata:S,retry:b});return A(()=>{r.setOnStart(()=>{t(!0),s(!1),d(0),l(void 0),f(0),P?.()}),r.setOnProgress((e,c)=>{d(e),f(c),y?.(e)}),r.setOnFinish(e=>{d(100),v(e),t(!1),s(!1),w?.(e)}),r.setOnError(e=>{l(e),t(!1),p?.(e)});const a=setInterval(()=>{f(r.getOffset()),s(r.isPaused())},100);F(()=>{clearInterval(a),r.setOnStart(void 0),r.setOnProgress(void 0),r.setOnFinish(void 0),r.setOnError(void 0)})}),{abort:n(()=>{r.abort(),t(!1),s(!1)},"abort"),error:U,isPaused:T,isUploading:R,offset:k,pause:n(()=>{r.pause(),s(!0),h?.()},"pause"),progress:x,reset:n(()=>{r.clear(),d(0),t(!1),s(!1),l(void 0),v(void 0),f(0)},"reset"),result:I,resume:n(async()=>{s(!1),t(!0),E?.();try{await r.resume()}catch(a){const e=a instanceof Error?a:new Error(String(a));throw l(e),t(!1),p?.(e),e}},"resume"),upload:n(async a=>{try{return await r.upload(a)}catch(e){const c=e instanceof Error?e:new Error(String(e));throw l(c),p?.(c),c}},"upload")}},"createTusUpload");export{D as createTusUpload};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var R=Object.defineProperty;var v=(u,l)=>R(u,"name",{value:l,configurable:!0});import{onMount as U,onDestroy as x}from"svelte";import{writable as n}from"svelte/store";import{createTusAdapter as T}from"./createTusAdapter-BbFsUNsP.js";var k=Object.defineProperty,i=v((u,l)=>k(u,"name",{value:l,configurable:!0}),"n");const A=i(u=>{const{chunkSize:l,endpoint:O,maxRetries:g,metadata:y,onError:p,onPause:S,onProgress:h,onResume:E,onStart:P,onSuccess:b,retry:w}=u,c=n(0),s=n(!1),r=n(!1),o=n(),m=n(),f=n(0),t=T({chunkSize:l,endpoint:O,maxRetries:g,metadata:y,retry:w});return U(()=>{t.setOnStart(()=>{s.set(!0),r.set(!1),c.set(0),o.set(void 0),f.set(0),P?.()}),t.setOnProgress((e,d)=>{c.set(e),f.set(d),h?.(e)}),t.setOnFinish(e=>{c.set(100),m.set(e),s.set(!1),r.set(!1),b?.(e)}),t.setOnError(e=>{o.set(e),s.set(!1),p?.(e)});const a=setInterval(()=>{f.set(t.getOffset()),r.set(t.isPaused())},100);x(()=>{clearInterval(a),t.setOnStart(void 0),t.setOnProgress(void 0),t.setOnFinish(void 0),t.setOnError(void 0)})}),{abort:i(()=>{t.abort(),s.set(!1),r.set(!1)},"abort"),error:o,isPaused:r,isUploading:s,offset:f,pause:i(()=>{t.pause(),r.set(!0),S?.()},"pause"),progress:c,reset:i(()=>{t.clear(),c.set(0),s.set(!1),r.set(!1),o.set(void 0),m.set(void 0),f.set(0)},"reset"),result:m,resume:i(async()=>{r.set(!1),s.set(!0),E?.();try{await t.resume()}catch(a){const e=a instanceof Error?a:new Error(String(a));throw o.set(e),s.set(!1),p?.(e),e}},"resume"),upload:i(async a=>{try{return await t.upload(a)}catch(e){const d=e instanceof Error?e:new Error(String(e));throw o.set(d),p?.(d),d}},"upload")}},"createTusUpload");export{A as createTusUpload};
|