@visulima/storage 1.0.0-alpha.30 → 1.0.0-alpha.32

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.
Files changed (173) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +2 -2
  3. package/dist/adapter/nuxt/module.d.ts +4 -4
  4. package/dist/adapter/nuxt/node_modules/.bin/nuxi +2 -2
  5. package/dist/adapter/nuxt/node_modules/.bin/nuxt +2 -2
  6. package/dist/ai/ai-sdk/index.d.ts +3 -3
  7. package/dist/ai/claude/index.d.ts +2 -2
  8. package/dist/ai/openai/index.d.ts +3 -3
  9. package/dist/ai/tanstack/index.d.ts +2 -2
  10. package/dist/handler/http/fetch/index.d.ts +7 -7
  11. package/dist/handler/http/fetch/index.js +1 -1
  12. package/dist/handler/http/hono/index.d.ts +4 -4
  13. package/dist/handler/http/hono/index.js +1 -1
  14. package/dist/handler/http/nextjs/index.d.ts +4 -4
  15. package/dist/handler/http/nextjs/index.js +1 -1
  16. package/dist/handler/http/node/index.d.ts +7 -7
  17. package/dist/handler/http/node/index.js +1 -1
  18. package/dist/handler/http/solid-start/index.d.ts +4 -4
  19. package/dist/handler/http/solid-start/index.js +1 -1
  20. package/dist/index.d.ts +6 -5
  21. package/dist/index.js +1 -1
  22. package/dist/packem_shared/{AwsLightStorage-w21RxjUm.js → AwsLightStorage-B1jNF7sv.js} +1 -1
  23. package/dist/packem_shared/AzureStorage-B4E6VLn5.js +1 -0
  24. package/dist/packem_shared/{BoxMetaStorage-DLdXbZaV.js → BoxMetaStorage-nESVquA1.js} +1 -1
  25. package/dist/packem_shared/BoxStorage-CHYDrcxw.js +1 -0
  26. package/dist/packem_shared/{BunS3MetaStorage-Bv_CTTMz.js → BunS3MetaStorage-BkZx5q4w.js} +1 -1
  27. package/dist/packem_shared/BunS3Storage-BopE7kmX.js +1 -0
  28. package/dist/packem_shared/{BunnyMetaStorage-DNMTSeoN.js → BunnyMetaStorage-bB8NXGUI.js} +1 -1
  29. package/dist/packem_shared/BunnyStorage-C3IBxJqr.js +1 -0
  30. package/dist/packem_shared/{CloudinaryMetaStorage-DEBk5eQy.js → CloudinaryMetaStorage-BzibHydK.js} +1 -1
  31. package/dist/packem_shared/CloudinaryStorage-Cj00ZXWV.js +1 -0
  32. package/dist/packem_shared/DiskStorage-BrAb28Je.js +1 -0
  33. package/dist/packem_shared/DiskStorageWithChecksum-BX85CHJ6.js +1 -0
  34. package/dist/packem_shared/{DropboxMetaStorage-C6vj1QDA.js → DropboxMetaStorage-Bfm5bblb.js} +1 -1
  35. package/dist/packem_shared/DropboxStorage-Btz9h9Mj.js +1 -0
  36. package/dist/packem_shared/Files-tnc_buzM.js +1 -0
  37. package/dist/packem_shared/{FirebaseMetaStorage-CzyOim-J.js → FirebaseMetaStorage-CshnJMb0.js} +1 -1
  38. package/dist/packem_shared/FirebaseStorage-Y9P6Dx8I.js +2 -0
  39. package/dist/packem_shared/{FtpMetaStorage-1Njy0DpU.js → FtpMetaStorage-CoyWJafY.js} +1 -1
  40. package/dist/packem_shared/FtpStorage-DCKPMX0z.js +1 -0
  41. package/dist/packem_shared/{GCSMetaStorage-udgXA5ia.js → GCSMetaStorage-CfZj52hQ.js} +1 -1
  42. package/dist/packem_shared/GCStorage-hfL1u2KQ.js +1 -0
  43. package/dist/packem_shared/{GoogleDriveMetaStorage-WGuUZPyx.js → GoogleDriveMetaStorage-CBSdEQr6.js} +1 -1
  44. package/dist/packem_shared/GoogleDriveStorage-C7iuV7qb.js +1 -0
  45. package/dist/packem_shared/{LocalMetaStorage-QMKL7McF.js → LocalMetaStorage-DSwsmdt7.js} +1 -1
  46. package/dist/packem_shared/MemoryMetaStorage-DEzfBNgL.js +1 -0
  47. package/dist/packem_shared/{Multipart-CIFfQksD.js → Multipart-kQ5wJQaV.js} +1 -1
  48. package/dist/packem_shared/{Multipart-D9WIud9R.js → Multipart-qaEOWKz1.js} +1 -1
  49. package/dist/packem_shared/{NetlifyBlobMetaStorage-ClIFdTkT.js → NetlifyBlobMetaStorage-CqluIgV0.js} +1 -1
  50. package/dist/packem_shared/NetlifyBlobStorage-CkMw9Uyv.js +1 -0
  51. package/dist/packem_shared/{OneDriveMetaStorage-DS4f83X2.js → OneDriveMetaStorage-DPTNMpeq.js} +1 -1
  52. package/dist/packem_shared/OneDriveStorage-CEGYb6OC.js +1 -0
  53. package/dist/packem_shared/{PocketBaseMetaStorage-B6utPncj.js → PocketBaseMetaStorage-CemTT_01.js} +1 -1
  54. package/dist/packem_shared/PocketBaseStorage-BZNzWj09.js +1 -0
  55. package/dist/packem_shared/{Rest-URrQ5FYM.js → Rest-BAcUFAgk.js} +1 -1
  56. package/dist/packem_shared/{Rest-BuD3ySAg.js → Rest-DukkeDZe.js} +1 -1
  57. package/dist/packem_shared/S3Storage-7hG3izjU.js +1 -0
  58. package/dist/packem_shared/{SftpMetaStorage-DYqXwCdM.js → SftpMetaStorage-Cs8b7uBO.js} +1 -1
  59. package/dist/packem_shared/SftpStorage-DnigT9GT.js +1 -0
  60. package/dist/packem_shared/{SharePointMetaStorage-DVM5-X6g.js → SharePointMetaStorage-DTVKAx6f.js} +1 -1
  61. package/dist/packem_shared/{SharePointStorage-BY90zh1c.js → SharePointStorage-D1cWu-14.js} +1 -1
  62. package/dist/packem_shared/{SupabaseMetaStorage-ivXoYVUu.js → SupabaseMetaStorage-D_fGv0d6.js} +1 -1
  63. package/dist/packem_shared/SupabaseStorage-DbIUa6NZ.js +1 -0
  64. package/dist/packem_shared/{Tus-Fp_hx5ug.js → Tus-BYTcw17H.js} +1 -1
  65. package/dist/packem_shared/{Tus-TNG9HAY8.js → Tus-BrP4RFTg.js} +1 -1
  66. package/dist/packem_shared/{UploadThingMetaStorage-BvKNzgm7.js → UploadThingMetaStorage-CAQ1uTfv.js} +1 -1
  67. package/dist/packem_shared/UploadThingStorage-B1qw1GrM.js +1 -0
  68. package/dist/packem_shared/{VercelBlobMetaStorage-CwaqWucZ.js → VercelBlobMetaStorage-DY4zAB6M.js} +1 -1
  69. package/dist/packem_shared/VercelBlobStorage-u6xmp8ox.js +1 -0
  70. package/dist/packem_shared/{base-handler-core-BYDQditz.js → base-handler-core-Ccvdhx-k.js} +1 -1
  71. package/dist/packem_shared/{base-handler-fetch-DWzsPkmV.js → base-handler-fetch-DzbThEWy.js} +1 -1
  72. package/dist/packem_shared/{base-handler-node-Dety2rQB.js → base-handler-node-CmCpLlBt.js} +1 -1
  73. package/dist/packem_shared/default-BrhEhSqN.js +1 -0
  74. package/dist/packem_shared/{defaultCloudStorageFileNameValidation-shIZX_7L.js → defaultCloudStorageFileNameValidation-DwDn0XB5.js} +1 -1
  75. package/dist/packem_shared/disk-storage-fWizVrge.js +1 -0
  76. package/dist/packem_shared/{disk-storage-with-checksum.d-mHcg2uLw.d.ts → disk-storage-with-checksum.d-aYBmkg45.d.ts} +8 -2
  77. package/dist/packem_shared/{executors.d-X4hz3zfu.d.ts → executors.d-WGJGPSZs.d.ts} +1 -1
  78. package/dist/packem_shared/{gcs-meta-storage-mZiqlX-9.js → gcs-meta-storage-COq32th7.js} +1 -1
  79. package/dist/packem_shared/get-file-status-DLS18Zvd.js +1 -0
  80. package/dist/packem_shared/index.d-CYdFIB-w.d.ts +455 -0
  81. package/dist/packem_shared/isRetryableError-CBZ65V6T.js +1 -0
  82. package/dist/packem_shared/local-meta-storage-Dr891Iy7.js +1 -0
  83. package/dist/packem_shared/{local-meta-storage.d-B11vHYNm.d.ts → local-meta-storage.d-CuvN-KQ3.d.ts} +1 -1
  84. package/dist/packem_shared/{media-transformer.d-C3QvECD7.d.ts → media-transformer.d-DfU7VbFl.d.ts} +2 -2
  85. package/dist/packem_shared/memory-storage.d-DRbE0WMO.d.ts +101 -0
  86. package/dist/packem_shared/part-match-D_NwyoF3.js +1 -0
  87. package/dist/packem_shared/{path-D7rMc9nq-B718mbm6.js → path-D7rMc9nq-CPbxyMDy.js} +1 -1
  88. package/dist/packem_shared/{rest-base-DI7xFXr5.js → rest-base-xrnOBxS9.js} +1 -1
  89. package/dist/packem_shared/s3-base-storage-CqAyWHR6.js +1 -0
  90. package/dist/packem_shared/{s3-base-storage.d-V3N2nKCt.d.ts → s3-base-storage.d-BrHiKWFw.d.ts} +9 -2
  91. package/dist/packem_shared/storage-uhIhcN-O.js +1 -0
  92. package/dist/packem_shared/{storage.d-RteRC-cG.d.ts → storage.d-X6TimMHY.d.ts} +42 -15
  93. package/dist/packem_shared/{tus-base.d-CygntIPM.d.ts → tus-base.d-Ds7xYAJC.d.ts} +3 -3
  94. package/dist/packem_shared/{types.d-cI_cMxcZ.d.ts → types.d-B72PbsLY.d.ts} +2 -2
  95. package/dist/packem_shared/{types.d-DxonY4XS.d.ts → types.d-C4QumoP1.d.ts} +2 -2
  96. package/dist/packem_shared/{types.d-ChNXbbHG.d.ts → types.d-a1grKnaX.d.ts} +1 -1
  97. package/dist/storage/aws/index.d.ts +9 -3
  98. package/dist/storage/aws/index.js +1 -1
  99. package/dist/storage/aws-light/index.d.ts +2 -2
  100. package/dist/storage/aws-light/index.js +1 -1
  101. package/dist/storage/azure/index.d.ts +1 -1
  102. package/dist/storage/azure/index.js +1 -1
  103. package/dist/storage/box/index.d.ts +2 -2
  104. package/dist/storage/box/index.js +1 -1
  105. package/dist/storage/bun-s3/index.d.ts +2 -2
  106. package/dist/storage/bun-s3/index.js +1 -1
  107. package/dist/storage/bunny/index.d.ts +2 -2
  108. package/dist/storage/bunny/index.js +1 -1
  109. package/dist/storage/cloudinary/index.d.ts +2 -2
  110. package/dist/storage/cloudinary/index.js +1 -1
  111. package/dist/storage/dropbox/index.d.ts +2 -2
  112. package/dist/storage/dropbox/index.js +1 -1
  113. package/dist/storage/firebase/index.d.ts +2 -2
  114. package/dist/storage/firebase/index.js +1 -1
  115. package/dist/storage/ftp/index.d.ts +2 -2
  116. package/dist/storage/ftp/index.js +1 -1
  117. package/dist/storage/gcs/index.d.ts +1 -1
  118. package/dist/storage/gcs/index.js +1 -1
  119. package/dist/storage/google-drive/index.d.ts +2 -2
  120. package/dist/storage/google-drive/index.js +1 -1
  121. package/dist/storage/local/index.d.ts +3 -3
  122. package/dist/storage/local/index.js +1 -1
  123. package/dist/storage/memory/index.d.ts +6 -0
  124. package/dist/storage/memory/index.js +1 -0
  125. package/dist/storage/netlify-blob/index.d.ts +2 -2
  126. package/dist/storage/netlify-blob/index.js +1 -1
  127. package/dist/storage/onedrive/index.d.ts +4 -4
  128. package/dist/storage/onedrive/index.js +1 -1
  129. package/dist/storage/pocketbase/index.d.ts +2 -2
  130. package/dist/storage/pocketbase/index.js +1 -1
  131. package/dist/storage/sftp/index.d.ts +2 -2
  132. package/dist/storage/sftp/index.js +1 -1
  133. package/dist/storage/sharepoint/index.d.ts +3 -3
  134. package/dist/storage/sharepoint/index.js +1 -1
  135. package/dist/storage/supabase/index.d.ts +2 -2
  136. package/dist/storage/supabase/index.js +1 -1
  137. package/dist/storage/uploadthing/index.d.ts +2 -2
  138. package/dist/storage/uploadthing/index.js +1 -1
  139. package/dist/storage/vercel-blob/index.d.ts +2 -2
  140. package/dist/storage/vercel-blob/index.js +1 -1
  141. package/dist/transformer/audio-transformer.d.ts +2 -2
  142. package/dist/transformer/image-transformer.d.ts +2 -2
  143. package/dist/transformer/index.d.ts +3 -3
  144. package/dist/transformer/video-transformer.d.ts +2 -2
  145. package/package.json +6 -2
  146. package/dist/packem_shared/AzureStorage-2kl7JDXs.js +0 -1
  147. package/dist/packem_shared/BoxStorage-BUeEJoGL.js +0 -1
  148. package/dist/packem_shared/BunS3Storage-WM3rF6Fw.js +0 -1
  149. package/dist/packem_shared/BunnyStorage-D3s2fRB3.js +0 -1
  150. package/dist/packem_shared/CloudinaryStorage-BBE2-aVz.js +0 -1
  151. package/dist/packem_shared/DiskStorage-DL0GiG6k.js +0 -1
  152. package/dist/packem_shared/DiskStorageWithChecksum-BvUTn7O-.js +0 -1
  153. package/dist/packem_shared/DropboxStorage-BL3OIdE_.js +0 -1
  154. package/dist/packem_shared/Files-CJh9_N-9.js +0 -1
  155. package/dist/packem_shared/FirebaseStorage-lXMXy3Pm.js +0 -2
  156. package/dist/packem_shared/FtpStorage-Dw94efNW.js +0 -1
  157. package/dist/packem_shared/GCStorage-ChY6uJuO.js +0 -1
  158. package/dist/packem_shared/GoogleDriveStorage-C0NhBBWH.js +0 -1
  159. package/dist/packem_shared/NetlifyBlobStorage-CO89TGvF.js +0 -1
  160. package/dist/packem_shared/OneDriveStorage-jAN46vRm.js +0 -1
  161. package/dist/packem_shared/PocketBaseStorage-DpOjOKAt.js +0 -1
  162. package/dist/packem_shared/S3Storage-n1ohEZj4.js +0 -1
  163. package/dist/packem_shared/SftpStorage-Ban-WN8v.js +0 -1
  164. package/dist/packem_shared/SupabaseStorage-pNbHAE1Y.js +0 -1
  165. package/dist/packem_shared/UploadThingStorage-BcmIE2dI.js +0 -1
  166. package/dist/packem_shared/VercelBlobStorage-s260zfFo.js +0 -1
  167. package/dist/packem_shared/disk-storage-CKAJvhcj.js +0 -1
  168. package/dist/packem_shared/index.d-C4Fivh4I.d.ts +0 -94
  169. package/dist/packem_shared/isRetryableError-BhizNeAz.js +0 -1
  170. package/dist/packem_shared/local-meta-storage-Bi0mK6gD.js +0 -1
  171. package/dist/packem_shared/part-match-B5fLLmFw.js +0 -1
  172. package/dist/packem_shared/s3-base-storage-Dbexfg7p.js +0 -1
  173. package/dist/packem_shared/storage-Dh0tJh7j.js +0 -1
@@ -1 +1 @@
1
- var Vt=Object.defineProperty;var he=(s,u)=>Vt(s,"name",{value:u,configurable:!0});var Ht=Object.defineProperty,Jt=he((s,u)=>Ht(s,"name",{value:u,configurable:!0}),"$e"),Kt=Object.defineProperty,V=Jt((s,u)=>Kt(s,"name",{value:u,configurable:!0}),"W"),Qt=Object.defineProperty,a=V((s,u)=>Qt(s,"name",{value:u,configurable:!0}),"u$1");let ge=a(()=>{var s=(()=>{var u=Object.defineProperty,c=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,b=a((e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0})},"ne"),A=a((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of p(t))!g.call(e,r)&&r!==n&&u(e,r,{get:a(()=>t[r],"get"),enumerable:!(o=c(t,r))||o.enumerable});return e},"ae"),m=a(e=>A(u({},"__esModule",{value:!0}),e),"oe"),P={};b(P,{zeptomatch:a(()=>pe,"zeptomatch")});var H=a(e=>{const t=new Set,n=[e];for(let o=0;o<n.length;o++){const r=n[o];if(t.has(r))continue;t.add(r);const{children:l}=r;if(l?.length)for(let i=0,h=l.length;i<h;i++)n.push(l[i])}return Array.from(t)},"M"),be=a(e=>{let t="";const n=H(e);for(let o=0,r=n.length;o<r;o++){const l=n[o];if(!l.regex)continue;const i=l.regex.flags;if(t||(t=i),t!==i)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${i}"`)}return t},"se"),J=a((e,t,n)=>{const o=n.get(e);if(o!==void 0)return o;const r=e.partial??t;let l="";if(e.regex&&(l+=r?"(?:$|":"",l+=e.regex.source),e.children?.length){const i=ve(e.children.map(h=>J(h,t,n)).filter(Boolean));if(i?.length){const h=e.children.some(W=>!W.regex||!(W.partial??t)),x=i.length>1||r&&(!l.length||h);l+=x?r?"(?:$|":"(?:":"",l+=i.join("|"),l+=x?")":""}}return e.regex&&(l+=r?")":""),n.set(e,l),l},"O"),we=a((e,t)=>{const n=new Map,o=H(e);for(let r=o.length-1;r>=0;r--){const l=J(o[r],t,n);if(!(r>0))return l}return""},"ie"),ve=a(e=>Array.from(new Set(e)),"ue"),S=a((e,t,n)=>S.compile(e,n).test(t),"R");S.compile=(e,t)=>{const n=t?.partial??!1,o=we(e,n),r=be(e);return new RegExp(`^(?:${o})$`,r)};var ye=S,je=a((e,t)=>{const n=ye.compile(e,t),o=`${n.source.slice(0,-1)}[\\\\/]?$`,r=n.flags;return new RegExp(o,r)},"le"),Me=je,Ae=a(e=>{const t=e.map(o=>o.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),ze=Ae,K=a(e=>Array.isArray(e),"j"),R=a(e=>typeof e=="function","_"),ke=a(e=>e.length===0,"he"),Oe=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Ee=a(e=>typeof e=="number","de"),Ie=a(e=>typeof e=="object"&&e!==null,"xe"),Pe=a(e=>e instanceof RegExp,"me"),Re=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Be=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),Q=a(e=>typeof e=="string","A"),y=a(e=>e===void 0,"f"),We=a(e=>{const t=new Map;return n=>{const o=t.get(n);if(o!==void 0)return o;const r=e(n);return t.set(n,r),r}},"ye"),T=a((e,t,n={})=>{const o={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},r=j(t)(o),l=Math.max(o.index,o.indexBacktrackMax);if(r&&o.index===e.length)return o.output;throw new Error(`Failed to parse at index ${l}`)},"I"),f=a((e,t)=>K(e)?Ze(e,t):Q(e)?X(e,t):_e(e,t),"i"),Ze=a((e,t)=>{const n={};for(const o of e){if(o.length!==1)throw new Error(`Invalid character: "${o}"`);const r=o.charCodeAt(0);n[r]=!0}return o=>{const r=o.input;let l=o.index,i=l;for(;i<r.length&&r.charCodeAt(i)in n;)i+=1;if(i>l){if(!y(t)&&!o.options.silent){const h=r.slice(l,i),x=R(t)?t(h,r,`${l}`):t;y(x)||o.output.push(x)}o.index=i}return!0}},"we"),_e=a((e,t)=>{if(Be(e))return X(e.source,t);{const n=e.source,o=e.flags.replace(/y|$/,"y"),r=new RegExp(n,o);return Re(e)&&R(t)&&!Oe(t)?Ce(r,t):Se(r,t)}},"$e"),Ce=a((e,t)=>n=>{const o=n.index,r=n.input;e.lastIndex=o;const l=e.exec(r);if(l){const i=e.lastIndex;if(!n.options.silent){const h=t(...l,r,`${o}`);y(h)||n.output.push(h)}return n.index=i,!0}else return!1},"Ee"),Se=a((e,t)=>n=>{const o=n.index,r=n.input;if(e.lastIndex=o,e.test(r)){const l=e.lastIndex;if(!y(t)&&!n.options.silent){const i=R(t)?t(r.slice(o,l),r,`${o}`):t;y(i)||n.output.push(i)}return n.index=l,!0}else return!1},"Ce"),X=a((e,t)=>n=>{const o=n.index,r=n.input;if(r.startsWith(e,o)){if(!y(t)&&!n.options.silent){const l=R(t)?t(e,r,`${o}`):t;y(l)||n.output.push(l)}return n.index+=e.length,!0}else return!1},"F"),q=a((e,t,n,o)=>{const r=j(e),l=t>1;return F(L(ee(i=>{let h=0;for(;h<n;){const x=i.index;if(!r(i)||(h+=1,i.index===x))break}return h>=t},l),o))},"k"),Y=a((e,t)=>q(e,0,1,t),"L"),C=a((e,t)=>q(e,0,1/0,t),"$"),qe=a((e,t)=>q(e,1,1/0,t),"Re"),O=a((e,t)=>{const n=e.map(j);return F(L(ee(o=>{for(let r=0,l=n.length;r<l;r++)if(!n[r](o))return!1;return!0}),t))},"x"),w=a((e,t)=>{const n=e.map(j);return F(L(o=>{for(let r=0,l=n.length;r<l;r++)if(n[r](o))return!0;return!1},t))},"p"),ee=a((e,t=!0,n=!1)=>{const o=j(e);return t?r=>{const l=r.index,i=r.output.length,h=o(r);return!h&&!n&&(r.indexBacktrackMax=Math.max(r.indexBacktrackMax,r.index)),(!h||n)&&(r.index=l,r.output.length!==i&&(r.output.length=i)),h}:o},"q"),L=a((e,t)=>{const n=j(e);return t?o=>{if(o.options.silent)return n(o);const r=o.output.length;if(n(o)){const l=o.output.splice(r,1/0),i=t(l);return y(i)||o.output.push(i),!0}else return!1}:n},"B"),F=(()=>{let e=0;return t=>{const n=j(t),o=e+=1;return r=>{var l;if(r.options.memoization===!1)return n(r);const i=r.index,h=(l=r.cache)[o]||(l[o]={indexMax:-1,queue:[]}),x=h.queue;if(i<=h.indexMax){const Z=h.store||(h.store=new Map);if(x.length){for(let I=0,Gt=x.length;I<Gt;I+=2){const Ut=x[I*2],Dt=x[I*2+1];Z.set(Ut,Dt)}x.length=0}const v=Z.get(i);if(v===!1)return!1;if(Ee(v))return r.index=v,!0;if(v)return r.index=v.index,v.output?.length&&r.output.push(...v.output),!0}const W=r.output.length,Nt=n(r);if(h.indexMax=Math.max(h.indexMax,i),Nt){const Z=r.index,v=r.output.length;if(v>W){const I=r.output.slice(W,v);x.push(i,{index:Z,output:I})}else x.push(i,Z);return!0}else return x.push(i,!1),!1}}})(),te=a(e=>{let t;return n=>(t||(t=j(e())),t(n))},"G"),j=We(e=>{if(R(e))return ke(e)?te(e):e;if(Q(e)||Pe(e))return f(e);if(K(e))return O(e);if(Ie(e))return w(Object.values(e));throw new Error("Invalid rule")}),z=a(e=>e,"d"),Le=a(e=>typeof e=="string","ke"),Fe=a(e=>{const t=new WeakMap,n=new WeakMap;return(o,r)=>{const l=r?.partial?n:t,i=l.get(o);if(i!==void 0)return i;const h=e(o,r);return l.set(o,h),h}},"Be"),Ne=a(e=>{const t={},n={};return(o,r)=>{const l=r?.partial?n:t;return l[o]??(l[o]=e(o,r))}},"Pe"),Ge=f(/\\./,z),Ue=f(/./,z),De=f(/\*\*\*+/,"*"),Ve=f(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),He=f(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),Je=C(w([Ge,De,Ve,He,Ue])),Ke=Je,Qe=a(e=>T(e,Ke,{memoization:!1}).join(""),"Ie"),Te=Qe,ne="abcdefghijklmnopqrstuvwxyz",Xe=a(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ne[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),re=a(e=>{let t=0;for(let n=0,o=e.length;n<o;n++)t=t*26+ne.indexOf(e[n])+1;return t},"V"),N=a((e,t)=>{if(t<e)return N(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),Ye=a((e,t,n)=>N(e,t).map(o=>String(o).padStart(n,"0")),"qe"),oe=a((e,t)=>N(re(e),re(t)).map(Xe),"W"),d=a(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),B=a(e=>({children:e}),"y"),E=(()=>{const e=a((t,n,o)=>{if(o.has(t))return;o.add(t);const{children:r}=t;if(!r.length)r.push(n);else for(let l=0,i=r.length;l<i;l++)e(r[l],n,o)},"e");return t=>{if(!t.length)return B([]);for(let n=t.length-1;n>=1;n--){const o=new Set,r=t[n-1],l=t[n];e(r,l,o)}return t[0]}})(),M=a(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),et=f(/\\./,d),tt=f(/[$.*+?^(){}[\]\|]/,e=>d(`\\${e}`)),nt=f(/[\\\/]/,M),rt=f(/[^$.*+?^(){}[\]\|\\\/]+/,d),ot=f(/^(?:!!)*!(.*)$/,(e,t)=>d(`(?!^${pe.compile(t).source}$).*?`)),st=f(/^(!!)+/),lt=w([ot,st]),ut=f(/\/(\*\*\/)+/,()=>B([E([M(),d(".+?"),M()]),M()])),at=f(/^(\*\*\/)+/,()=>B([d("^"),E([d(".*?"),M()])])),ct=f(/\/(\*\*)$/,()=>B([E([M(),d(".*?")]),d("$")])),it=f(/\*\*/,()=>d(".*?")),se=w([ut,at,ct,it]),ft=f(/\*\/(?!\*\*\/|\*$)/,()=>E([d("[^\\\\/]*?"),M()])),pt=f(/\*/,()=>d("[^\\\\/]*")),le=w([ft,pt]),ue=f("?",()=>d("[^\\\\/]")),ht=f("[",z),gt=f("]",z),dt=f(/[!^]/,"^\\\\/"),xt=f(/[a-z]-[a-z]|[0-9]-[0-9]/i,z),$t=f(/\\./,z),mt=f(/[$.*+?^(){}[\|]/,e=>`\\${e}`),bt=f(/[\\\/]/,"\\\\/"),wt=f(/[^$.*+?^(){}[\]\|\\\/]+/,z),vt=w([$t,mt,bt,xt,wt]),ae=O([ht,Y(dt),C(vt),gt],e=>d(e.join(""))),yt=f("{","(?:"),jt=f("}",")"),Mt=f(/(\d+)\.\.(\d+)/,(e,t,n)=>Ye(+t,+n,Math.min(t.length,n.length)).join("|")),At=f(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>oe(t,n).join("|")),zt=f(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>oe(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),kt=w([Mt,At,zt]),ce=O([yt,kt,jt],e=>d(e.join(""))),Ot=f("{"),Et=f("}"),It=f(","),Pt=f(/\\./,d),Rt=f(/[$.*+?^(){[\]\|]/,e=>d(`\\${e}`)),Bt=f(/[\\\/]/,M),Wt=f(/[^$.*+?^(){}[\]\|\\\/,]+/,d),Zt=te(()=>fe),_t=f("",()=>d("(?:)")),Ct=qe(w([se,le,ue,ae,ce,Zt,Pt,Rt,Bt,Wt]),E),ie=w([Ct,_t]),fe=O([Ot,Y(O([ie,C(O([It,ie]))])),Et],B),St=C(w([lt,se,le,ue,ae,ce,fe,et,tt,nt,rt]),E),qt=St,Lt=a(e=>T(e,qt,{memoization:!1})[0],"kr"),Ft=Lt,G=a((e,t,n)=>G.compile(e,n).test(t),"N");G.compile=(()=>{const e=Ne((n,o)=>Me(Ft(Te(n)),o)),t=Fe((n,o)=>ze(n.map(r=>e(r,o))));return(n,o)=>Le(n)?e(n,o):t(n,o)})();var pe=G;return m(P)})();return s.default||s},"_lazyMatch"),U;const Tt=a((s,u)=>(U||(U=ge(),ge=null),U(s,u)),"default");var Xt=Object.defineProperty,Yt=V((s,u)=>Xt(s,"name",{value:u,configurable:!0}),"t$1");const en=/^[A-Z]:\//i,k=Yt((s="")=>s&&s.replaceAll("\\","/").replace(en,u=>u.toUpperCase()),"normalizeWindowsPath");var tn=Object.defineProperty,$=V((s,u)=>tn(s,"name",{value:u,configurable:!0}),"r");const nn=/^[/\\]{2}/,rn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,xe=/^[A-Z]:$/i,de=/^\/([A-Z]:)?$/i,on=/.(\.[^./]+)$/,sn=/^[/\\]|^[a-z]:[/\\]/i,ln=/\/$/,un=$(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),$e=$((s,u)=>{let c="",p=0,g=-1,b=0,A;for(let m=0;m<=s.length;++m){if(m<s.length)A=s[m];else{if(A==="/")break;A="/"}if(A==="/"){if(!(g===m-1||b===1))if(b===2){if(c.length<2||p!==2||!c.endsWith(".")||c.at(-2)!=="."){if(c.length>2){const P=c.lastIndexOf("/");P===-1?(c="",p=0):(c=c.slice(0,P),p=c.length-1-c.lastIndexOf("/")),g=m,b=0;continue}else if(c.length>0){c="",p=0,g=m,b=0;continue}}u&&(c+=c.length>0?"/..":"..",p=2)}else c.length>0?c+=`/${s.slice(g+1,m)}`:c=s.slice(g+1,m),p=m-g-1;g=m,b=0}else A==="."&&b!==-1?++b:b=-1}return c},"normalizeString"),_=$(s=>rn.test(s),"isAbsolute"),me=$(function(s){if(s.length===0)return".";s=k(s);const u=nn.exec(s),c=_(s),p=s.at(-1)==="/";return s=$e(s,!c),s.length===0?c?"/":p?"./":".":(p&&(s+="/"),xe.test(s)&&(s+="/"),u?c?`//${s}`:`//./${s}`:c&&!_(s)?`/${s}`:s)},"normalize"),hn=$((...s)=>{let u="";for(const c of s)if(c)if(u.length>0){const p=u.at(-1)==="/",g=c[0]==="/";p&&g?u+=c.slice(1):u+=p||g?c:`/${c}`}else u+=c;return me(u)},"join"),D=$(function(...s){s=s.map(p=>k(p));let u="",c=!1;for(let p=s.length-1;p>=-1&&!c;p--){const g=p>=0?s[p]:un();!g||g.length===0||(u=`${g}/${u}`,c=_(g))}return u=$e(u,!c),c&&!_(u)?`/${u}`:u.length>0?u:"."},"resolve");$(function(s){return k(s)},"toNamespacedPath");const an=$(function(s){return on.exec(k(s))?.[1]??""},"extname");$(function(s,u){const c=D(s).replace(de,"$1").split("/"),p=D(u).replace(de,"$1").split("/");if(p[0][1]===":"&&c[0][1]===":"&&c[0]!==p[0])return p.join("/");const g=[...c];for(const b of g){if(p[0]!==b)break;c.shift(),p.shift()}return[...c.map(()=>".."),...p].join("/")},"relative");const cn=$(s=>{const u=k(s).replace(ln,"").split("/").slice(0,-1);return u.length===1&&xe.test(u[0])&&(u[0]=`${u[0]}/`),u.join("/")||(_(s)?"/":".")},"dirname");$(function(s){const u=[s.root,s.dir,s.base??s.name+s.ext].filter(Boolean);return k(s.root?D(...u):u.join("/"))},"format");const fn=$((s,u)=>{const c=k(s).split("/").pop();return u&&c.endsWith(u)?c.slice(0,-u.length):c},"basename");$(function(s){const u=sn.exec(s)?.[0]?.replaceAll("\\","/")??"",c=fn(s),p=an(c);return{base:c,dir:cn(s),ext:p,name:c.slice(0,c.length-p.length),root:u}},"parse");$((s,u)=>Tt(u,me(s)),"matchesGlob");export{k as A,D as C,an as J,cn as K,me as L,hn as M,_ as O,fn as Q};
1
+ var Vt=Object.defineProperty;var he=(s,u)=>Vt(s,"name",{value:u,configurable:!0});var Ht=Object.defineProperty,Jt=he((s,u)=>Ht(s,"name",{value:u,configurable:!0}),"$e"),Kt=Object.defineProperty,V=Jt((s,u)=>Kt(s,"name",{value:u,configurable:!0}),"W"),Qt=Object.defineProperty,a=V((s,u)=>Qt(s,"name",{value:u,configurable:!0}),"u$1");let ge=a(()=>{var s=(()=>{var u=Object.defineProperty,c=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,b=a((e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0})},"ne"),A=a((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of p(t))!g.call(e,r)&&r!==n&&u(e,r,{get:a(()=>t[r],"get"),enumerable:!(o=c(t,r))||o.enumerable});return e},"ae"),m=a(e=>A(u({},"__esModule",{value:!0}),e),"oe"),P={};b(P,{zeptomatch:a(()=>pe,"zeptomatch")});var H=a(e=>{const t=new Set,n=[e];for(let o=0;o<n.length;o++){const r=n[o];if(t.has(r))continue;t.add(r);const{children:l}=r;if(l?.length)for(let i=0,h=l.length;i<h;i++)n.push(l[i])}return Array.from(t)},"M"),be=a(e=>{let t="";const n=H(e);for(let o=0,r=n.length;o<r;o++){const l=n[o];if(!l.regex)continue;const i=l.regex.flags;if(t||(t=i),t!==i)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${i}"`)}return t},"se"),J=a((e,t,n)=>{const o=n.get(e);if(o!==void 0)return o;const r=e.partial??t;let l="";if(e.regex&&(l+=r?"(?:$|":"",l+=e.regex.source),e.children?.length){const i=ve(e.children.map(h=>J(h,t,n)).filter(Boolean));if(i?.length){const h=e.children.some(W=>!W.regex||!(W.partial??t)),x=i.length>1||r&&(!l.length||h);l+=x?r?"(?:$|":"(?:":"",l+=i.join("|"),l+=x?")":""}}return e.regex&&(l+=r?")":""),n.set(e,l),l},"O"),we=a((e,t)=>{const n=new Map,o=H(e);for(let r=o.length-1;r>=0;r--){const l=J(o[r],t,n);if(!(r>0))return l}return""},"ie"),ve=a(e=>Array.from(new Set(e)),"ue"),S=a((e,t,n)=>S.compile(e,n).test(t),"R");S.compile=(e,t)=>{const n=t?.partial??!1,o=we(e,n),r=be(e);return new RegExp(`^(?:${o})$`,r)};var ye=S,je=a((e,t)=>{const n=ye.compile(e,t),o=`${n.source.slice(0,-1)}[\\\\/]?$`,r=n.flags;return new RegExp(o,r)},"le"),Me=je,Ae=a(e=>{const t=e.map(o=>o.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),ze=Ae,K=a(e=>Array.isArray(e),"j"),R=a(e=>typeof e=="function","_"),ke=a(e=>e.length===0,"he"),Oe=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Ee=a(e=>typeof e=="number","de"),Ie=a(e=>typeof e=="object"&&e!==null,"xe"),Pe=a(e=>e instanceof RegExp,"me"),Re=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Be=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),Q=a(e=>typeof e=="string","A"),y=a(e=>e===void 0,"f"),We=a(e=>{const t=new Map;return n=>{const o=t.get(n);if(o!==void 0)return o;const r=e(n);return t.set(n,r),r}},"ye"),T=a((e,t,n={})=>{const o={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},r=j(t)(o),l=Math.max(o.index,o.indexBacktrackMax);if(r&&o.index===e.length)return o.output;throw new Error(`Failed to parse at index ${l}`)},"I"),f=a((e,t)=>K(e)?Ze(e,t):Q(e)?X(e,t):_e(e,t),"i"),Ze=a((e,t)=>{const n={};for(const o of e){if(o.length!==1)throw new Error(`Invalid character: "${o}"`);const r=o.charCodeAt(0);n[r]=!0}return o=>{const r=o.input;let l=o.index,i=l;for(;i<r.length&&r.charCodeAt(i)in n;)i+=1;if(i>l){if(!y(t)&&!o.options.silent){const h=r.slice(l,i),x=R(t)?t(h,r,`${l}`):t;y(x)||o.output.push(x)}o.index=i}return!0}},"we"),_e=a((e,t)=>{if(Be(e))return X(e.source,t);{const n=e.source,o=e.flags.replace(/y|$/,"y"),r=new RegExp(n,o);return Re(e)&&R(t)&&!Oe(t)?Ce(r,t):Se(r,t)}},"$e"),Ce=a((e,t)=>n=>{const o=n.index,r=n.input;e.lastIndex=o;const l=e.exec(r);if(l){const i=e.lastIndex;if(!n.options.silent){const h=t(...l,r,`${o}`);y(h)||n.output.push(h)}return n.index=i,!0}else return!1},"Ee"),Se=a((e,t)=>n=>{const o=n.index,r=n.input;if(e.lastIndex=o,e.test(r)){const l=e.lastIndex;if(!y(t)&&!n.options.silent){const i=R(t)?t(r.slice(o,l),r,`${o}`):t;y(i)||n.output.push(i)}return n.index=l,!0}else return!1},"Ce"),X=a((e,t)=>n=>{const o=n.index,r=n.input;if(r.startsWith(e,o)){if(!y(t)&&!n.options.silent){const l=R(t)?t(e,r,`${o}`):t;y(l)||n.output.push(l)}return n.index+=e.length,!0}else return!1},"F"),q=a((e,t,n,o)=>{const r=j(e),l=t>1;return F(L(ee(i=>{let h=0;for(;h<n;){const x=i.index;if(!r(i)||(h+=1,i.index===x))break}return h>=t},l),o))},"k"),Y=a((e,t)=>q(e,0,1,t),"L"),C=a((e,t)=>q(e,0,1/0,t),"$"),qe=a((e,t)=>q(e,1,1/0,t),"Re"),O=a((e,t)=>{const n=e.map(j);return F(L(ee(o=>{for(let r=0,l=n.length;r<l;r++)if(!n[r](o))return!1;return!0}),t))},"x"),w=a((e,t)=>{const n=e.map(j);return F(L(o=>{for(let r=0,l=n.length;r<l;r++)if(n[r](o))return!0;return!1},t))},"p"),ee=a((e,t=!0,n=!1)=>{const o=j(e);return t?r=>{const l=r.index,i=r.output.length,h=o(r);return!h&&!n&&(r.indexBacktrackMax=Math.max(r.indexBacktrackMax,r.index)),(!h||n)&&(r.index=l,r.output.length!==i&&(r.output.length=i)),h}:o},"q"),L=a((e,t)=>{const n=j(e);return t?o=>{if(o.options.silent)return n(o);const r=o.output.length;if(n(o)){const l=o.output.splice(r,1/0),i=t(l);return y(i)||o.output.push(i),!0}else return!1}:n},"B"),F=(()=>{let e=0;return t=>{const n=j(t),o=e+=1;return r=>{var l;if(r.options.memoization===!1)return n(r);const i=r.index,h=(l=r.cache)[o]||(l[o]={indexMax:-1,queue:[]}),x=h.queue;if(i<=h.indexMax){const Z=h.store||(h.store=new Map);if(x.length){for(let I=0,Gt=x.length;I<Gt;I+=2){const Ut=x[I*2],Dt=x[I*2+1];Z.set(Ut,Dt)}x.length=0}const v=Z.get(i);if(v===!1)return!1;if(Ee(v))return r.index=v,!0;if(v)return r.index=v.index,v.output?.length&&r.output.push(...v.output),!0}const W=r.output.length,Nt=n(r);if(h.indexMax=Math.max(h.indexMax,i),Nt){const Z=r.index,v=r.output.length;if(v>W){const I=r.output.slice(W,v);x.push(i,{index:Z,output:I})}else x.push(i,Z);return!0}else return x.push(i,!1),!1}}})(),te=a(e=>{let t;return n=>(t||(t=j(e())),t(n))},"G"),j=We(e=>{if(R(e))return ke(e)?te(e):e;if(Q(e)||Pe(e))return f(e);if(K(e))return O(e);if(Ie(e))return w(Object.values(e));throw new Error("Invalid rule")}),z=a(e=>e,"d"),Le=a(e=>typeof e=="string","ke"),Fe=a(e=>{const t=new WeakMap,n=new WeakMap;return(o,r)=>{const l=r?.partial?n:t,i=l.get(o);if(i!==void 0)return i;const h=e(o,r);return l.set(o,h),h}},"Be"),Ne=a(e=>{const t={},n={};return(o,r)=>{const l=r?.partial?n:t;return l[o]??(l[o]=e(o,r))}},"Pe"),Ge=f(/\\./,z),Ue=f(/./,z),De=f(/\*\*\*+/,"*"),Ve=f(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),He=f(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),Je=C(w([Ge,De,Ve,He,Ue])),Ke=Je,Qe=a(e=>T(e,Ke,{memoization:!1}).join(""),"Ie"),Te=Qe,ne="abcdefghijklmnopqrstuvwxyz",Xe=a(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ne[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),re=a(e=>{let t=0;for(let n=0,o=e.length;n<o;n++)t=t*26+ne.indexOf(e[n])+1;return t},"V"),N=a((e,t)=>{if(t<e)return N(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),Ye=a((e,t,n)=>N(e,t).map(o=>String(o).padStart(n,"0")),"qe"),oe=a((e,t)=>N(re(e),re(t)).map(Xe),"W"),d=a(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),B=a(e=>({children:e}),"y"),E=(()=>{const e=a((t,n,o)=>{if(o.has(t))return;o.add(t);const{children:r}=t;if(!r.length)r.push(n);else for(let l=0,i=r.length;l<i;l++)e(r[l],n,o)},"e");return t=>{if(!t.length)return B([]);for(let n=t.length-1;n>=1;n--){const o=new Set,r=t[n-1],l=t[n];e(r,l,o)}return t[0]}})(),M=a(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),et=f(/\\./,d),tt=f(/[$.*+?^(){}[\]\|]/,e=>d(`\\${e}`)),nt=f(/[\\\/]/,M),rt=f(/[^$.*+?^(){}[\]\|\\\/]+/,d),ot=f(/^(?:!!)*!(.*)$/,(e,t)=>d(`(?!^${pe.compile(t).source}$).*?`)),st=f(/^(!!)+/),lt=w([ot,st]),ut=f(/\/(\*\*\/)+/,()=>B([E([M(),d(".+?"),M()]),M()])),at=f(/^(\*\*\/)+/,()=>B([d("^"),E([d(".*?"),M()])])),ct=f(/\/(\*\*)$/,()=>B([E([M(),d(".*?")]),d("$")])),it=f(/\*\*/,()=>d(".*?")),se=w([ut,at,ct,it]),ft=f(/\*\/(?!\*\*\/|\*$)/,()=>E([d("[^\\\\/]*?"),M()])),pt=f(/\*/,()=>d("[^\\\\/]*")),le=w([ft,pt]),ue=f("?",()=>d("[^\\\\/]")),ht=f("[",z),gt=f("]",z),dt=f(/[!^]/,"^\\\\/"),xt=f(/[a-z]-[a-z]|[0-9]-[0-9]/i,z),$t=f(/\\./,z),mt=f(/[$.*+?^(){}[\|]/,e=>`\\${e}`),bt=f(/[\\\/]/,"\\\\/"),wt=f(/[^$.*+?^(){}[\]\|\\\/]+/,z),vt=w([$t,mt,bt,xt,wt]),ae=O([ht,Y(dt),C(vt),gt],e=>d(e.join(""))),yt=f("{","(?:"),jt=f("}",")"),Mt=f(/(\d+)\.\.(\d+)/,(e,t,n)=>Ye(+t,+n,Math.min(t.length,n.length)).join("|")),At=f(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>oe(t,n).join("|")),zt=f(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>oe(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),kt=w([Mt,At,zt]),ce=O([yt,kt,jt],e=>d(e.join(""))),Ot=f("{"),Et=f("}"),It=f(","),Pt=f(/\\./,d),Rt=f(/[$.*+?^(){[\]\|]/,e=>d(`\\${e}`)),Bt=f(/[\\\/]/,M),Wt=f(/[^$.*+?^(){}[\]\|\\\/,]+/,d),Zt=te(()=>fe),_t=f("",()=>d("(?:)")),Ct=qe(w([se,le,ue,ae,ce,Zt,Pt,Rt,Bt,Wt]),E),ie=w([Ct,_t]),fe=O([Ot,Y(O([ie,C(O([It,ie]))])),Et],B),St=C(w([lt,se,le,ue,ae,ce,fe,et,tt,nt,rt]),E),qt=St,Lt=a(e=>T(e,qt,{memoization:!1})[0],"kr"),Ft=Lt,G=a((e,t,n)=>G.compile(e,n).test(t),"N");G.compile=(()=>{const e=Ne((n,o)=>Me(Ft(Te(n)),o)),t=Fe((n,o)=>ze(n.map(r=>e(r,o))));return(n,o)=>Le(n)?e(n,o):t(n,o)})();var pe=G;return m(P)})();return s.default||s},"_lazyMatch"),U;const Tt=a((s,u)=>(U||(U=ge(),ge=null),U(s,u)),"default");var Xt=Object.defineProperty,Yt=V((s,u)=>Xt(s,"name",{value:u,configurable:!0}),"t$1");const en=/^[A-Z]:\//i,k=Yt((s="")=>s&&s.replaceAll("\\","/").replace(en,u=>u.toUpperCase()),"normalizeWindowsPath");var tn=Object.defineProperty,$=V((s,u)=>tn(s,"name",{value:u,configurable:!0}),"r");const nn=/^[/\\]{2}/,rn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,xe=/^[A-Z]:$/i,de=/^\/([A-Z]:)?$/i,on=/.(\.[^./]+)$/,sn=/^[/\\]|^[a-z]:[/\\]/i,ln=/\/$/,un=$(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),$e=$((s,u)=>{let c="",p=0,g=-1,b=0,A;for(let m=0;m<=s.length;++m){if(m<s.length)A=s[m];else{if(A==="/")break;A="/"}if(A==="/"){if(!(g===m-1||b===1))if(b===2){if(c.length<2||p!==2||!c.endsWith(".")||c.at(-2)!=="."){if(c.length>2){const P=c.lastIndexOf("/");P===-1?(c="",p=0):(c=c.slice(0,P),p=c.length-1-c.lastIndexOf("/")),g=m,b=0;continue}else if(c.length>0){c="",p=0,g=m,b=0;continue}}u&&(c+=c.length>0?"/..":"..",p=2)}else c.length>0?c+=`/${s.slice(g+1,m)}`:c=s.slice(g+1,m),p=m-g-1;g=m,b=0}else A==="."&&b!==-1?++b:b=-1}return c},"normalizeString"),_=$(s=>rn.test(s),"isAbsolute"),me=$(function(s){if(s.length===0)return".";s=k(s);const u=nn.exec(s),c=_(s),p=s.at(-1)==="/";return s=$e(s,!c),s.length===0?c?"/":p?"./":".":(p&&(s+="/"),xe.test(s)&&(s+="/"),u?c?`//${s}`:`//./${s}`:c&&!_(s)?`/${s}`:s)},"normalize"),hn=$((...s)=>{let u="";for(const c of s)if(c)if(u.length>0){const p=u.at(-1)==="/",g=c[0]==="/";p&&g?u+=c.slice(1):u+=p||g?c:`/${c}`}else u+=c;return me(u)},"join"),D=$(function(...s){s=s.map(p=>k(p));let u="",c=!1;for(let p=s.length-1;p>=-1&&!c;p--){const g=p>=0?s[p]:un();!g||g.length===0||(u=`${g}/${u}`,c=_(g))}return u=$e(u,!c),c&&!_(u)?`/${u}`:u.length>0?u:"."},"resolve");$(function(s){return k(s)},"toNamespacedPath");const an=$(function(s){return on.exec(k(s))?.[1]??""},"extname");$(function(s,u){const c=D(s).replace(de,"$1").split("/"),p=D(u).replace(de,"$1").split("/");if(p[0][1]===":"&&c[0][1]===":"&&c[0]!==p[0])return p.join("/");const g=[...c];for(const b of g){if(p[0]!==b)break;c.shift(),p.shift()}return[...c.map(()=>".."),...p].join("/")},"relative");const cn=$(s=>{const u=k(s).replace(ln,"").split("/").slice(0,-1);return u.length===1&&xe.test(u[0])&&(u[0]=`${u[0]}/`),u.join("/")||(_(s)?"/":".")},"dirname");$(function(s){const u=[s.root,s.dir,s.base??s.name+s.ext].filter(Boolean);return k(s.root?D(...u):u.join("/"))},"format");const fn=$((s,u)=>{const c=k(s).split("/").pop();return u&&c.endsWith(u)?c.slice(0,-u.length):c},"basename");$(function(s){const u=sn.exec(s)?.[0]?.replaceAll("\\","/")??"",c=fn(s),p=an(c);return{base:c,dir:cn(s),ext:p,name:c.slice(0,c.length-p.length),root:u}},"parse");$((s,u)=>Tt(u,me(s)),"matchesGlob");export{me as L,hn as M,_ as O};
@@ -1 +1 @@
1
- var E=Object.defineProperty;var y=(a,t)=>E(a,"name",{value:t,configurable:!0});import{n as u}from"./headers-DC2MEOrK.js";import{hasBody as X}from"type-is";import{a as c}from"./base-handler-core-BYDQditz.js";import{ERRORS as A}from"./ERRORS-CyOuSMLY.js";import{b,a as z,c as v,d as L}from"./response-builder-Wdo_fvcF.js";var T=Object.defineProperty,f=y((a,t)=>T(a,"name",{value:t,configurable:!0}),"a$1");const D=f((a,t={})=>{const e=c(a,"x-file-metadata",!0);if(!e)return t;try{return{...t,...JSON.parse(e)}}catch{return t}},"parseMetadata"),P=f(a=>{if(!a)return;const t=2e3,e=a.length>t?a.slice(0,Math.max(0,t)):a,r=e.toLowerCase().indexOf("filename");if(r===-1)return;let s=r+8;for(;s<e.length&&(e[s]==="*"||e[s]===" "||e[s]===" ");)s++;if(s>=e.length||e[s]!=="=")return;for(s++;s<e.length&&(e[s]===" "||e[s]===" ");)s++;if(s>=e.length)return;let n=s,o;const i=e[s];return i==='"'||i==="'"?(n=s+1,o=e.indexOf(i,n),o===-1&&(o=e.indexOf(";",n),o===-1&&(o=e.length))):(o=e.indexOf(";",n),o===-1&&(o=e.length)),n>=o?void 0:e.substring(n,o).trim()||void 0},"parseContentDispositionValue"),I=f(a=>{const t=c(a,"content-disposition",!0);return P(t)},"parseContentDisposition"),R=f(a=>{const t=c(a,"x-chunked-upload",!0)==="true",e=c(a,"x-chunk-offset",!0),r=c(a,"x-total-size",!0),s={isChunkedUpload:t};if(e){const n=Number.parseInt(e,10);!Number.isNaN(n)&&n>=0&&(s.chunkOffset=n)}if(r){const n=Number.parseInt(r,10);!Number.isNaN(n)&&n>0&&(s.totalSize=n)}return s},"parseChunkHeaders"),Z=f((a,t=!1)=>{const e=c(a,"x-chunked-upload",!0)==="true";if(!(t&&e)){if(!X(a))throw u(400,"Request body is required");if(Number.parseInt(c(a,"content-length")||"0",10)===0&&!e)throw u(400,"Content-Length is required and must be greater than 0")}},"validateRequestBody"),ee=f((a,t=!1,e)=>{const r=c(a,"x-chunked-upload",!0)==="true",s=Number.parseInt(c(a,"content-length")||"0",10);if(!t&&!r&&s===0)throw u(400,"Content-Length is required and must be greater than 0");if(e!==void 0&&s>e)throw u(413,`File size exceeds maximum allowed size of ${e} bytes`);return s},"validateContentLength"),te=f((a,t,e="application/octet-stream")=>{const r=I(a),s=D(a),{isChunkedUpload:n,totalSize:o}=R(a),i=n&&o?o:t;return n&&o&&(s._chunkedUpload=!0,s._chunks=[],s._totalSize=o),{contentType:e,metadata:s,originalName:r,size:i}},"extractFileInit");f((a,t,e)=>{if(Number.isNaN(a)||a<0)throw u(400,"X-Chunk-Offset must be a valid non-negative number");if(a+t>e)throw u(400,`Chunk exceeds file size. Offset: ${a}, Size: ${t}, Total: ${e}`)},"validateChunk");f((a,t="application/octet-stream")=>c(a,"content-type")||t,"getContentType");var W=Object.defineProperty,g=y((a,t)=>W(a,"name",{value:t,configurable:!0}),"a");const N=g((a,t)=>{if(a.length===0)return!1;const e=[...a].toSorted((n,o)=>n.offset-o.offset),r=e[0];if(r?.offset!==0)return!1;let s=r.length;for(let n=1;n<e.length;n+=1){const o=e[n];if(o){if(o.offset>s)return!1;s=Math.max(s,o.offset+o.length)}}return s>=t},"isUploadComplete"),H=g((a,t,e,r)=>{if(Number.isNaN(a)||a<0)throw new Error("Chunk offset must be a valid non-negative number");if(t<=0)throw new Error("Chunk length must be greater than 0");if(r!==void 0&&t>r)throw new Error(`Chunk size exceeds maximum allowed size of ${r} bytes`);if(a+t>e)throw new Error(`Chunk exceeds file size. Offset: ${a}, Size: ${t}, Total: ${e}`)},"validateChunk"),B=g((a,t)=>{const e=a.find(r=>r.offset===t.offset&&r.length===t.length);return e?t.checksum&&e.checksum!==t.checksum?a.map(r=>r.offset===t.offset?{...r,checksum:t.checksum}:r):a:[...a,t]},"trackChunk"),j=g((a,t)=>{if(a.length===0||t===0)return{bytesWritten:0,percentage:0};const e=[...a].toSorted((o,i)=>o.offset-i.offset);let r=0,s=0;for(const o of e){const i=o.offset+o.length;o.offset<=s?r=Math.max(r,i):r+=o.length,s=Math.max(s,i)}r=Math.min(r,t);const n=t>0?r/t*100:0;return{bytesWritten:r,percentage:n}},"calculateUploadProgress");g(a=>{const t=a.metadata||{};if(t._chunkedUpload===!0&&Array.isArray(t._chunks)){const e=typeof t._totalSize=="number"?t._totalSize:a.size||0;return j(t._chunks,e).bytesWritten}return a.bytesWritten||0},"getBytesWritten");const _=g(a=>(a.metadata||{})._chunkedUpload===!0,"isChunkedUpload"),U=g(a=>{const t=a.metadata||{};if(t._chunkedUpload===!0&&typeof t._totalSize=="number")return t._totalSize},"getTotalSize");var q=Object.defineProperty,$=y((a,t)=>q(a,"name",{value:t,configurable:!0}),"y");class ae{static{y(this,"M")}static{$(this,"RestBase")}async deleteSingle(t){const e=await this.storage.delete({id:t});if(e.status===void 0)throw u(404,"File not found");return{...e,headers:{},statusCode:204}}async handlePost(t,e,r,s,n){if(e&&t.size!==void 0){const d=typeof t.size=="number"?t.size:Number.parseInt(String(t.size),10);if(d>0&&d>this.storage.maxUploadSize)throw u(413,`File size exceeds maximum allowed size of ${this.storage.maxUploadSize} bytes`)}const o=await this.storage.create(t);if(e){const d=this.buildFileUrl(r,o);return b(o,{...z(o,d),"X-Chunked-Upload":"true","X-Upload-ID":o.id},201)}const i=await this.storage.write({body:s,contentLength:n,id:o.id,start:0}),h=this.buildFileUrl(r,i);return b(i,z(i,h),201)}async handlePut(t,e,r,s,n,o){let i,h=!1;try{await this.storage.getMeta(t),h=!0,o&&await this.storage.update({id:t},{metadata:o}),i=await this.storage.write({body:s,contentLength:n,id:t,start:0})}catch(m){const S=m;if(S.UploadErrorCode===A.FILE_NOT_FOUND||S.code==="ENOENT")try{const w=await this.storage.create(e);i=await this.storage.write({body:s,contentLength:n,id:w.id,start:0})}catch(w){throw w}else throw m}const d=this.buildFileUrl(r,i);return b(i,z(i,d),h?200:201)}async handlePatch(t,e,r,s,n,o){let i=await this.storage.getMeta(t);const h=i.metadata||{},d=_(i);if(d){const l=U(i);l&&i.size!==l&&(i={...i,size:l})}const m=typeof h._totalSize=="number"?h._totalSize:i.size||0;if(!d)throw u(400,"File is not a chunked upload. Use POST or PUT for full file uploads.");const S=100*1024*1024;try{H(e,r,m,S)}catch(l){throw l instanceof Error&&l.message.includes("exceeds maximum")?u(413,l.message):u(400,l instanceof Error?l.message:String(l))}if(i.status==="completed"){const l=this.buildFileUrl(n,i);return b(i,{...z(i,l),"X-Upload-Complete":"true"},200)}const w=await this.storage.withLock(`chunks:${t}`,async()=>{const l=(await this.storage.getMeta(t)).metadata??{},M=Array.isArray(l._chunks)?l._chunks:[],x=B(M,{checksum:s,length:r,offset:e});return await this.storage.update({id:t},{metadata:{...l,_chunks:x}}),x});let p=await this.storage.write({body:o,contentLength:r,id:t,start:e}),C=p.bytesWritten>=m;d&&(C=N(w,m),p.status==="completed"&&!C&&(await this.storage.update({id:t},{status:"part"}),p={...p,status:"part"}));const k=C&&p.bytesWritten!==m?{...p,bytesWritten:m}:p,F=this.buildFileUrl(n,k),O={...z(k,F),...v(k,C),"x-upload-offset":String(k.bytesWritten||0)};return b(k,O,C?200:202)}async handleHead(t){let e=await this.storage.getMeta(t);const r=_(e);if(r){const n=U(e);n&&e.size!==n&&(e={...e,size:n})}const s={...L(e)};if(r){const n=e.metadata||{},o=U(e)||e.size||0,i=Array.isArray(n._chunks)?n._chunks:[],h=N(i,o);Object.assign(s,v(e,h))}return b(e,s,200)}handleOptions(t,e){return{headers:{"Access-Control-Allow-Headers":"Authorization, Content-Type, Content-Length, Content-Disposition, X-File-Metadata, X-Chunked-Upload, X-Total-Size, X-Chunk-Offset, X-Chunk-Checksum","Access-Control-Allow-Methods":t.map(r=>r.toUpperCase()).join(", "),"Access-Control-Max-Age":86400,"X-Max-Upload-Size":String(e)},statusCode:204}}async deleteBatch(t){const e=await this.storage.deleteBatch(t);if(e.successfulCount===0&&e.failedCount>0){const r=e.failed.map(s=>s.id).join(", ");throw u(404,`Failed to delete files: ${r}`)}return{data:e.successful,headers:e.failedCount>0?{"X-Delete-Errors":JSON.stringify(e.failed),"X-Delete-Failed":String(e.failedCount),"X-Delete-Successful":String(e.successfulCount)}:{"X-Delete-Successful":String(e.successfulCount)},statusCode:e.successfulCount===t.length?204:207}}get storage(){throw new Error("storage must be implemented")}buildFileUrl(t,e){throw new Error("buildFileUrl must be implemented")}}export{ae as M,ee as a,R as b,P as c,te as e,I as p,Z as v};
1
+ var E=Object.defineProperty;var y=(a,t)=>E(a,"name",{value:t,configurable:!0});import{n as u}from"./headers-DC2MEOrK.js";import{hasBody as X}from"type-is";import{a as c}from"./base-handler-core-Ccvdhx-k.js";import{ERRORS as A}from"./ERRORS-CyOuSMLY.js";import{b,a as z,c as v,d as L}from"./response-builder-Wdo_fvcF.js";var T=Object.defineProperty,f=y((a,t)=>T(a,"name",{value:t,configurable:!0}),"a$1");const D=f((a,t={})=>{const e=c(a,"x-file-metadata",!0);if(!e)return t;try{return{...t,...JSON.parse(e)}}catch{return t}},"parseMetadata"),P=f(a=>{if(!a)return;const t=2e3,e=a.length>t?a.slice(0,Math.max(0,t)):a,r=e.toLowerCase().indexOf("filename");if(r===-1)return;let s=r+8;for(;s<e.length&&(e[s]==="*"||e[s]===" "||e[s]===" ");)s++;if(s>=e.length||e[s]!=="=")return;for(s++;s<e.length&&(e[s]===" "||e[s]===" ");)s++;if(s>=e.length)return;let n=s,o;const i=e[s];return i==='"'||i==="'"?(n=s+1,o=e.indexOf(i,n),o===-1&&(o=e.indexOf(";",n),o===-1&&(o=e.length))):(o=e.indexOf(";",n),o===-1&&(o=e.length)),n>=o?void 0:e.substring(n,o).trim()||void 0},"parseContentDispositionValue"),I=f(a=>{const t=c(a,"content-disposition",!0);return P(t)},"parseContentDisposition"),R=f(a=>{const t=c(a,"x-chunked-upload",!0)==="true",e=c(a,"x-chunk-offset",!0),r=c(a,"x-total-size",!0),s={isChunkedUpload:t};if(e){const n=Number.parseInt(e,10);!Number.isNaN(n)&&n>=0&&(s.chunkOffset=n)}if(r){const n=Number.parseInt(r,10);!Number.isNaN(n)&&n>0&&(s.totalSize=n)}return s},"parseChunkHeaders"),Z=f((a,t=!1)=>{const e=c(a,"x-chunked-upload",!0)==="true";if(!(t&&e)){if(!X(a))throw u(400,"Request body is required");if(Number.parseInt(c(a,"content-length")||"0",10)===0&&!e)throw u(400,"Content-Length is required and must be greater than 0")}},"validateRequestBody"),ee=f((a,t=!1,e)=>{const r=c(a,"x-chunked-upload",!0)==="true",s=Number.parseInt(c(a,"content-length")||"0",10);if(!t&&!r&&s===0)throw u(400,"Content-Length is required and must be greater than 0");if(e!==void 0&&s>e)throw u(413,`File size exceeds maximum allowed size of ${e} bytes`);return s},"validateContentLength"),te=f((a,t,e="application/octet-stream")=>{const r=I(a),s=D(a),{isChunkedUpload:n,totalSize:o}=R(a),i=n&&o?o:t;return n&&o&&(s._chunkedUpload=!0,s._chunks=[],s._totalSize=o),{contentType:e,metadata:s,originalName:r,size:i}},"extractFileInit");f((a,t,e)=>{if(Number.isNaN(a)||a<0)throw u(400,"X-Chunk-Offset must be a valid non-negative number");if(a+t>e)throw u(400,`Chunk exceeds file size. Offset: ${a}, Size: ${t}, Total: ${e}`)},"validateChunk");f((a,t="application/octet-stream")=>c(a,"content-type")||t,"getContentType");var W=Object.defineProperty,g=y((a,t)=>W(a,"name",{value:t,configurable:!0}),"a");const N=g((a,t)=>{if(a.length===0)return!1;const e=[...a].toSorted((n,o)=>n.offset-o.offset),r=e[0];if(r?.offset!==0)return!1;let s=r.length;for(let n=1;n<e.length;n+=1){const o=e[n];if(o){if(o.offset>s)return!1;s=Math.max(s,o.offset+o.length)}}return s>=t},"isUploadComplete"),H=g((a,t,e,r)=>{if(Number.isNaN(a)||a<0)throw new Error("Chunk offset must be a valid non-negative number");if(t<=0)throw new Error("Chunk length must be greater than 0");if(r!==void 0&&t>r)throw new Error(`Chunk size exceeds maximum allowed size of ${r} bytes`);if(a+t>e)throw new Error(`Chunk exceeds file size. Offset: ${a}, Size: ${t}, Total: ${e}`)},"validateChunk"),B=g((a,t)=>{const e=a.find(r=>r.offset===t.offset&&r.length===t.length);return e?t.checksum&&e.checksum!==t.checksum?a.map(r=>r.offset===t.offset?{...r,checksum:t.checksum}:r):a:[...a,t]},"trackChunk"),j=g((a,t)=>{if(a.length===0||t===0)return{bytesWritten:0,percentage:0};const e=[...a].toSorted((o,i)=>o.offset-i.offset);let r=0,s=0;for(const o of e){const i=o.offset+o.length;o.offset<=s?r=Math.max(r,i):r+=o.length,s=Math.max(s,i)}r=Math.min(r,t);const n=t>0?r/t*100:0;return{bytesWritten:r,percentage:n}},"calculateUploadProgress");g(a=>{const t=a.metadata||{};if(t._chunkedUpload===!0&&Array.isArray(t._chunks)){const e=typeof t._totalSize=="number"?t._totalSize:a.size||0;return j(t._chunks,e).bytesWritten}return a.bytesWritten||0},"getBytesWritten");const _=g(a=>(a.metadata||{})._chunkedUpload===!0,"isChunkedUpload"),U=g(a=>{const t=a.metadata||{};if(t._chunkedUpload===!0&&typeof t._totalSize=="number")return t._totalSize},"getTotalSize");var q=Object.defineProperty,$=y((a,t)=>q(a,"name",{value:t,configurable:!0}),"y");class ae{static{y(this,"M")}static{$(this,"RestBase")}async deleteSingle(t){const e=await this.storage.delete({id:t});if(e.status===void 0)throw u(404,"File not found");return{...e,headers:{},statusCode:204}}async handlePost(t,e,r,s,n){if(e&&t.size!==void 0){const d=typeof t.size=="number"?t.size:Number.parseInt(String(t.size),10);if(d>0&&d>this.storage.maxUploadSize)throw u(413,`File size exceeds maximum allowed size of ${this.storage.maxUploadSize} bytes`)}const o=await this.storage.create(t);if(e){const d=this.buildFileUrl(r,o);return b(o,{...z(o,d),"X-Chunked-Upload":"true","X-Upload-ID":o.id},201)}const i=await this.storage.write({body:s,contentLength:n,id:o.id,start:0}),h=this.buildFileUrl(r,i);return b(i,z(i,h),201)}async handlePut(t,e,r,s,n,o){let i,h=!1;try{await this.storage.getMeta(t),h=!0,o&&await this.storage.update({id:t},{metadata:o}),i=await this.storage.write({body:s,contentLength:n,id:t,start:0})}catch(m){const S=m;if(S.UploadErrorCode===A.FILE_NOT_FOUND||S.code==="ENOENT")try{const w=await this.storage.create(e);i=await this.storage.write({body:s,contentLength:n,id:w.id,start:0})}catch(w){throw w}else throw m}const d=this.buildFileUrl(r,i);return b(i,z(i,d),h?200:201)}async handlePatch(t,e,r,s,n,o){let i=await this.storage.getMeta(t);const h=i.metadata||{},d=_(i);if(d){const l=U(i);l&&i.size!==l&&(i={...i,size:l})}const m=typeof h._totalSize=="number"?h._totalSize:i.size||0;if(!d)throw u(400,"File is not a chunked upload. Use POST or PUT for full file uploads.");const S=100*1024*1024;try{H(e,r,m,S)}catch(l){throw l instanceof Error&&l.message.includes("exceeds maximum")?u(413,l.message):u(400,l instanceof Error?l.message:String(l))}if(i.status==="completed"){const l=this.buildFileUrl(n,i);return b(i,{...z(i,l),"X-Upload-Complete":"true"},200)}const w=await this.storage.withLock(`chunks:${t}`,async()=>{const l=(await this.storage.getMeta(t)).metadata??{},M=Array.isArray(l._chunks)?l._chunks:[],x=B(M,{checksum:s,length:r,offset:e});return await this.storage.update({id:t},{metadata:{...l,_chunks:x}}),x});let p=await this.storage.write({body:o,contentLength:r,id:t,start:e}),C=p.bytesWritten>=m;d&&(C=N(w,m),p.status==="completed"&&!C&&(await this.storage.update({id:t},{status:"part"}),p={...p,status:"part"}));const k=C&&p.bytesWritten!==m?{...p,bytesWritten:m}:p,F=this.buildFileUrl(n,k),O={...z(k,F),...v(k,C),"x-upload-offset":String(k.bytesWritten||0)};return b(k,O,C?200:202)}async handleHead(t){let e=await this.storage.getMeta(t);const r=_(e);if(r){const n=U(e);n&&e.size!==n&&(e={...e,size:n})}const s={...L(e)};if(r){const n=e.metadata||{},o=U(e)||e.size||0,i=Array.isArray(n._chunks)?n._chunks:[],h=N(i,o);Object.assign(s,v(e,h))}return b(e,s,200)}handleOptions(t,e){return{headers:{"Access-Control-Allow-Headers":"Authorization, Content-Type, Content-Length, Content-Disposition, X-File-Metadata, X-Chunked-Upload, X-Total-Size, X-Chunk-Offset, X-Chunk-Checksum","Access-Control-Allow-Methods":t.map(r=>r.toUpperCase()).join(", "),"Access-Control-Max-Age":86400,"X-Max-Upload-Size":String(e)},statusCode:204}}async deleteBatch(t){const e=await this.storage.deleteBatch(t);if(e.successfulCount===0&&e.failedCount>0){const r=e.failed.map(s=>s.id).join(", ");throw u(404,`Failed to delete files: ${r}`)}return{data:e.successful,headers:e.failedCount>0?{"X-Delete-Errors":JSON.stringify(e.failed),"X-Delete-Failed":String(e.failedCount),"X-Delete-Successful":String(e.successfulCount)}:{"X-Delete-Successful":String(e.successfulCount)},statusCode:e.successfulCount===t.length?204:207}}get storage(){throw new Error("storage must be implemented")}buildFileUrl(t,e){throw new Error("buildFileUrl must be implemented")}}export{ae as M,ee as a,R as b,P as c,te as e,I as p,Z as v};
@@ -0,0 +1 @@
1
+ var M=Object.defineProperty;var p=(o,t)=>M(o,"name",{value:t,configurable:!0});import{Readable as S}from"node:stream";import{z as C,B as R,$ as A,t as T}from"./storage-uhIhcN-O.js";import{d as I}from"./detect-file-type-5JhzC9RU.js";import{throwErrorCode as m,ERRORS as y}from"./ERRORS-CyOuSMLY.js";import{createRetryWrapper as v}from"./isRetryableError-CBZ65V6T.js";import{v as P}from"./local-meta-storage-Dr891Iy7.js";import{u as z}from"./update-size-DANV7aa2.js";import{r as x}from"./part-match-D_NwyoF3.js";import{o as B}from"./has-content-Bx2p8Okx.js";import{o as U}from"./get-file-status-DLS18Zvd.js";var L=Object.defineProperty,N=p((o,t)=>L(o,"name",{value:t,configurable:!0}),"o$1");const $=N((o,t)=>{const a={};return Object.keys(o).forEach(e=>{a[e]=t(o[e])}),a},"mapValues");var K=Object.defineProperty,j=p((o,t)=>K(o,"name",{value:t,configurable:!0}),"t");const D=j(o=>o===Number(o)?o:(C(o)??0)/1e3,"toSeconds");var F=Object.defineProperty,f=p((o,t)=>F(o,"name",{value:t,configurable:!0}),"g");const W=5*1024*1024,_=16*1024*1024,q=f(o=>{if(o)return`bytes=${Math.max(0,o.start)}-${o.end===void 0?"":o.end}`},"buildRangeHeader");class k extends R{static{p(this,"S3BaseStorage")}static{f(this,"S3BaseStorage")}checksumTypes=["md5","crc32","crc32c","sha1","sha256"];supportsRange=!0;bucket;meta;MAX_PARTS=1e4;partSize;retry;resolvedRetryConfig;constructor(t){if(super(t),this.bucket=t.bucket,this.partSize=typeof t.partSize=="string"?A(t.partSize):t.partSize||_,this.partSize<W)throw new Error("Minimum allowed partSize value is 5MB");const a={backoffMultiplier:2,initialDelay:1e3,maxDelay:3e4,maxRetries:3,retryableStatusCodes:[408,429,500,502,503,504],shouldRetry:f(i=>{const s=i;return s.statusCode&&[408,429,500,502,503,504].includes(s.statusCode)?!0:s.retryable??!1},"shouldRetry"),...t.retryConfig};this.retry=v(a),this.resolvedRetryConfig=a;const{metaStorage:e,metaStorageConfig:r}=t;if(e)this.meta=e;else{const i={...t,...r,logger:this.logger};"directory"in i?(this.logger?.debug("Using local meta storage"),this.meta=new P(i)):this.meta=new P(i)}this.isReady=!1,this.accessCheck().then(()=>{this.isReady=!0}).catch(i=>{this.logger?.error("Storage access check failed: %O",i)})}getRetryConfig(){return this.resolvedRetryConfig}async create(t,a){return this.instrumentOperation("create",async()=>{const e={...t};if(t.ttl){const n=typeof t.ttl=="string"?T(t.ttl):t.ttl;n!==void 0&&(e.expiredAt=Date.now()+n)}const r=new(this.getFileClass())(e);r.name=this.namingFunction(r),await this.validate(r);try{const n=await this.getMeta(r.id);if(n.bytesWritten>=0)return n}catch{}const i=this.getS3Api();let s;try{s=await this.runOperation(a,n=>i.createMultipartUpload({ACL:this.getAcl(),Bucket:this.bucket,ContentType:r.contentType,Key:r.name,Metadata:$({originalName:r.originalName,...r.metadata},l=>encodeURI(String(l)))},{signal:n}))}catch{return m(y.FILE_ERROR,"s3 create upload error")}const{UploadId:c}=s||{};return c?(r.UploadId=c,r.bytesWritten=0,this.config.clientDirectUpload&&(r.partSize??=this.partSize),await this.saveMeta(r),r.status="created",await this.onCreate(r),this.config.clientDirectUpload?this.buildPresigned(r):r):m(y.FILE_ERROR,"s3 create upload error")})}async write(t,a){return this.instrumentOperation("write",async()=>{let e;if("contentType"in t&&"metadata"in t&&!("body"in t)&&!("start"in t)?e=t:(e=await this.getMeta(t.id),await this.checkIfExpired(e)),e.status==="completed")return e;if(typeof t.size=="number"&&t.size>0&&z(e,t.size),!x(t,e))return m(y.FILE_CONFLICT);if(this.config.clientDirectUpload)return this.buildPresigned(e);e.Parts??=await this.getParts(e),e.bytesWritten=e.Parts.map(i=>i.Size||0).reduce((i,s)=>i+s,0);const r=await this.lock(t.id);try{if(B(t)){if(this.isUnsupportedChecksum(t.checksumAlgorithm))return m(y.UNSUPPORTED_CHECKSUM_ALGORITHM);if(e.Parts.length===0&&(!e.contentType||e.contentType==="application/octet-stream"))try{const u=t.body instanceof S?t.body:S.fromWeb(t.body),{fileType:g,stream:w}=await I(u);g?.mime&&(e.contentType=g.mime),t.body=w}catch{}if(e.Parts.length>this.MAX_PARTS)throw new Error(`Exceeded ${this.MAX_PARTS} as part of the upload to ${this.bucket}.`);const i=e.Parts.length+1,s=this.getS3Api(),c=e.UploadId;if(!c)throw new Error("UploadId is required");const n=t.body,l=n instanceof Uint8Array,{ETag:h}=await this.runOperation(a,u=>s.uploadPart({Body:n,Bucket:this.bucket,ContentLength:t.contentLength||0,Key:e.name,PartNumber:i,UploadId:c,...t.checksumAlgorithm==="md5"?{ContentMD5:t.checksum}:{}},{signal:u}),{replayable:l}),b={ETag:h,PartNumber:i,Size:t.contentLength};e.Parts=[...e.Parts,b],e.bytesWritten+=t.contentLength||0}if(this.cache.set(e.id,e),e.status=U(e),e.status==="completed"){const[i]=await this.internalOnComplete(e);delete e.Parts,e.uri=i.Location,e.ETag=i.ETag}}finally{await this.unlock(t.id,r)}return e})}async delete({id:t},a){return this.instrumentOperation("delete",async()=>{const e=await this.getMeta(t);e.status="deleted",await this.abortMultipartUpload(e,a),await this.deleteMeta(e.id);const r={...e};return await this.onDelete(r),r})}async copy(t,a,e){return this.instrumentOperation("copy",async()=>{k.assertSafeId(t),k.assertSafeId(a);const r=await this.getMeta(t),i=`${this.bucket}/${t}`,s=this.bucket,c=a,n=this.getS3Api();return await this.runOperation(e,l=>n.copyObject({Bucket:s,CopySource:i,Key:c,...e?.storageClass&&{StorageClass:e.storageClass}},{signal:l})),{...r,id:c,name:c}})}async move(t,a,e){return this.instrumentOperation("move",async()=>{await this.copy(t,a,e);const r=this.getS3Api();return await this.runOperation(e,i=>r.deleteObject({Bucket:this.bucket,Key:t},{signal:i})),await this.getMeta(a)})}async list(t=1e3,a){return this.instrumentOperation("list",async()=>{const e=this.getS3Api(),r=Math.min(t,1e3);let i={Bucket:this.bucket,MaxKeys:r};const s=[];let c=!0;for(;c&&s.length<t;)try{const n=await this.runOperation(a,l=>e.listObjectsV2(i,{signal:l}));for(const{Key:l,LastModified:h}of n?.Contents||[]){if(s.length>=t)break;l!==void 0&&s.push({id:l,...h&&{createdAt:h}})}c=n.IsTruncated||!1,c&&n.NextContinuationToken&&s.length<t&&(i={...i,ContinuationToken:n.NextContinuationToken,MaxKeys:Math.min(r,t-s.length)})}catch(n){const l=this.normalizeError(n instanceof Error?n:new Error(String(n)));throw await this.onError(l),n}return s},{limit:t})}async exists({id:t},a){return this.instrumentOperation("exists",async()=>{try{await this.getMeta(t);const e=this.getS3Api();return await this.runOperation(a,r=>e.headObject({Bucket:this.bucket,Key:t},{signal:r})),!0}catch{return!1}})}async get({id:t},a){return this.instrumentOperation("get",async()=>{const e=this.getS3Api(),r=q(a?.range),{Body:i,ContentLength:s,ContentType:c,ETag:n,Expires:l,LastModified:h,Metadata:b}=await this.runOperation(a,d=>e.getObject({Bucket:this.bucket,Key:t,...r!==void 0&&{Range:r}},{signal:d}));await this.checkIfExpired({expiredAt:l});const u=[];if(i)if(i instanceof S)for await(const d of i)u.push(d instanceof Uint8Array?d:new Uint8Array(d));else{const d=i.getReader();for(;;){const{done:E,value:O}=await d.read();if(E)break;u.push(O)}}const{originalName:g,...w}=b||{};return{content:Buffer.concat(u),contentType:c,ETag:n,expiredAt:l,id:t,metadata:w,modifiedAt:h,name:t,originalName:g||t,size:Number(s)}})}async buildPresigned(t){const a=t;if(a.Parts?.length||(a.Parts=await this.getParts(t)),a.bytesWritten=a.Parts.map(e=>e.Size||0).reduce((e,r)=>e+r,0),t.status=U(a),a.partsUrls?.length||(a.partsUrls=await this.getPartsPresignedUrls(t)),t.status==="completed"){const[e]=await this.internalOnComplete(t);return delete a.Parts,a.uri=e.Location,t}return t}async getPartsPresignedUrls(t){t.partSize??=this.partSize;const a=t.UploadId;if(!a)throw new Error("UploadId is required for getting presigned URLs");const e=Math.trunc(t.size/this.partSize)+1,r=[],i=Math.trunc(D(this.config.expiration?.maxAge||"6hrs")),s=this.getS3Api();for(let c=0;c<e;c++)r.push(s.getPresignedUrl({Bucket:this.bucket,expiresIn:i,Key:t.name,PartNumber:c+1,UploadId:a}));return Promise.all(r)}async getParts(t){const a=this.getS3Api(),e=t.UploadId;if(!e)throw new Error("UploadId is required");const{Parts:r=[]}=await this.runOperation(void 0,i=>a.listParts({Bucket:this.bucket,Key:t.name,UploadId:e},{signal:i}));return r}completeMultipartUpload(t){const a=this.getS3Api(),e=t.UploadId;if(!e)throw new Error("UploadId is required");const r=t.Parts?.map(({ETag:i,PartNumber:s})=>{if(!i||!s)throw new Error("ETag and PartNumber are required");return{ETag:i,PartNumber:s}})||[];return this.runOperation(void 0,i=>a.completeMultipartUpload({Bucket:this.bucket,Key:t.name,Parts:r,UploadId:e},{signal:i}))}async abortMultipartUpload(t,a){if(t.status!=="completed")try{const e=this.getS3Api(),r=t.UploadId;if(!r)return;await this.runOperation(a,i=>e.abortMultipartUpload({Bucket:this.bucket,Key:t.name,UploadId:r},{signal:i}))}catch(e){this.logger?.error("abortMultipartUploadError: ",e);const r=this.normalizeError(e instanceof Error?e:new Error(String(e)));await this.onError(r)}}internalOnComplete=f(async t=>{const[a]=await Promise.all([this.completeMultipartUpload(t),this.deleteMeta(t.id)]);return[a,t]},"internalOnComplete")}export{k as S,q as b};
@@ -1,5 +1,5 @@
1
1
  import { Readable } from 'node:stream';
2
- import { F as File, M as MetaStorage, d as createRetryWrapper, R as RetryConfig, e as FileInit, B as BaseStorage, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn } from "./storage.d-RteRC-cG.js";
2
+ import { F as File, M as MetaStorage, d as createRetryWrapper, R as RetryConfig, e as FileInit, B as BaseStorage, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn } from "./storage.d-X6TimMHY.js";
3
3
  /**
4
4
  * Part interface for multipart uploads.
5
5
  */
@@ -71,6 +71,7 @@ interface S3ApiOperations {
71
71
  getObject: (params: {
72
72
  Bucket: string;
73
73
  Key: string;
74
+ Range?: string;
74
75
  }, options?: S3CallOptions) => Promise<{
75
76
  Body?: ReadableStream | Readable;
76
77
  ContentLength?: number;
@@ -136,6 +137,7 @@ interface S3ApiOperations {
136
137
  */
137
138
  declare abstract class S3BaseStorage<TFile extends S3CompatibleFile = S3CompatibleFile> extends BaseStorage<TFile> {
138
139
  override checksumTypes: string[];
140
+ override readonly supportsRange: boolean;
139
141
  protected bucket: string;
140
142
  protected meta: MetaStorage<TFile>;
141
143
  /**
@@ -217,7 +219,12 @@ declare abstract class S3BaseStorage<TFile extends S3CompatibleFile = S3Compatib
217
219
  */
218
220
  get({
219
221
  id
220
- }: FileQuery, options?: OperationOptions): Promise<FileReturn>;
222
+ }: FileQuery, options?: OperationOptions & {
223
+ range?: {
224
+ end?: number;
225
+ start: number;
226
+ };
227
+ }): Promise<FileReturn>;
221
228
  /**
222
229
  * Gets file stream (abstract - must be implemented by subclasses due to stream differences).
223
230
  */
@@ -0,0 +1 @@
1
+ var H=Object.defineProperty;var p=(t,e)=>H(t,"name",{value:e,configurable:!0});import{Readable as X}from"node:stream";import{setInterval as J}from"node:timers";import{inspect as Q}from"node:util";import{L as ee,O as I}from"./path-D7rMc9nq-CPbxyMDy.js";import te from"type-is";import re from"./NoOpMetrics-Dky06sf1.js";import{N as oe}from"./cache-qV_5Umeq.js";import{ErrorMap as M,throwErrorCode as E,ERRORS as $}from"./ERRORS-CyOuSMLY.js";import{randomUUID as se}from"node:crypto";import{LRUCache as ae}from"lru-cache";import{retry as ie}from"./isRetryableError-CBZ65V6T.js";import{o as ne}from"./is-expired-1JuZjDtb.js";var ce=Object.defineProperty,le=p((t,e)=>ce(t,"name",{value:e,configurable:!0}),"y$3"),ue=Object.defineProperty,me=le((t,e)=>ue(t,"name",{value:e,configurable:!0}),"y"),ge=Object.defineProperty,C=me((t,e)=>ge(t,"name",{value:e,configurable:!0}),"i");const de=/^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i,he=/^KIBI/,pe=/^MIBI/,fe=/^GIBI/,ye=/^TEBI/,be=/^PEBI/,we=/^EXBI/,ve=/^ZEBI/,Ee=/^YIBI/,$e=/^(.)IB$/,R={iec:[{long:"Bytes",short:"B"},{long:"Kibibytes",short:"KiB"},{long:"Mebibytes",short:"MiB"},{long:"Gibibytes",short:"GiB"},{long:"Tebibytes",short:"TiB"},{long:"Pebibytes",short:"PiB"},{long:"Exbibytes",short:"EiB"},{long:"Zebibytes",short:"ZiB"},{long:"Yobibytes",short:"YiB"}],iec_octet:[{long:"Octets",short:"o"},{long:"Kibioctets",short:"Kio"},{long:"Mebioctets",short:"Mio"},{long:"Gibioctets",short:"Gio"},{long:"Tebioctets",short:"Tio"},{long:"Pebioctets",short:"Pio"},{long:"Exbioctets",short:"Eio"},{long:"Zebioctets",short:"Zio"},{long:"Yobioctets",short:"Yio"}],metric:[{long:"Bytes",short:"Bytes"},{long:"Kilobytes",short:"KB"},{long:"Megabytes",short:"MB"},{long:"Gigabytes",short:"GB"},{long:"Terabytes",short:"TB"},{long:"Petabytes",short:"PB"},{long:"Exabytes",short:"EB"},{long:"Zettabytes",short:"ZB"},{long:"Yottabytes",short:"YB"}],metric_octet:[{long:"Octets",short:"o"},{long:"Kilo-octets",short:"ko"},{long:"Mega-octets",short:"Mo"},{long:"Giga-octets",short:"Go"},{long:"Tera-octets",short:"To"},{long:"Peta-octets",short:"Po"},{long:"Exa-octets",short:"Eo"},{long:"Zetta-octets",short:"Zo"},{long:"Yotta-octets",short:"Yo"}]},xe=C((t,e)=>{const r=new Intl.NumberFormat(e).format(11111).replaceAll(new RegExp("\\p{Number}","gu"),""),o=new Intl.NumberFormat(e).format(1.1).replaceAll(new RegExp("\\p{Number}","gu"),"");return Number.parseFloat(t.replaceAll(new RegExp(`\\${r}`,"g"),"").replace(new RegExp(`\\${o}`),"."))},"parseLocalizedNumber"),_=C(t=>{switch(t){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},"fromBase"),j=C((t,e)=>{const r={base:2,locale:"en-US",units:"metric",...e};if(typeof t!="string"||t.length===0)throw new TypeError("Value is not a string or is empty.");if(t.length>100)throw new TypeError("Value exceeds the maximum length of 100 characters.");const o=de.exec(t)?.groups;if(!o)return Number.NaN;const s=xe(o.value,r.locale),a=(o.type??"Bytes").toUpperCase().replace(he,"KILO").replace(pe,"MEGA").replace(fe,"GIGA").replace(ye,"TERA").replace(be,"PETA").replace(we,"EXA").replace(ve,"ZETTA").replace(Ee,"YOTTA").replace($e,"$1B"),i=R[r.units].findIndex(u=>u.short[0].toUpperCase()===a[0]),l=_(r.base);return s*l**i},"parseBytes");C((t,e)=>{if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("Bytesize is not a number.");const{base:r,decimals:o,locale:s,long:a,unit:i,units:l,...u}={base:2,decimals:0,locale:"en-US",long:!1,units:"metric",...e},n=_(r),m=Math.abs(t),g=e?.space??!0?" ":"",c=R[l],d=c.findIndex(w=>w.short===i);if(t===0){const w=Math.min(0,Math.max(d,c.length-1));return"0"+g+c[w][a?"long":"short"]}const h=d===-1?Math.min(Math.floor(Math.log(m)/Math.log(n)),c.length-1):d,N=c[h][a?"long":"short"],O=t/n**h,v=o<0?void 0:o;return new Intl.NumberFormat(s,{maximumFractionDigits:v,minimumFractionDigits:v,...u}).format(O)+g+N},"formatBytes");var Me=Object.defineProperty,Ne=p((t,e)=>Me(t,"name",{value:e,configurable:!0}),"u$3"),Oe=Object.defineProperty,Ae=Ne((t,e)=>Oe(t,"name",{value:e,configurable:!0}),"v"),Te=Object.defineProperty,Ce=Ae((t,e)=>Te(t,"name",{value:e,configurable:!0}),"D");const Se=Ce((t,e,r,o,s,a,i,l,u,n,m,g,c,d)=>{const h={d:o,h:s,m:a,mo:e,ms:l,s:i,w:r,y:t};return u!==void 0&&(h.future=u),n!==void 0&&(h.past=n),m!==void 0&&(h.decimal=m),g!==void 0&&(h.unitMap=g),c!==void 0&&(h.groupSeparator=c),d!==void 0&&(h.placeholderSeparator=d),h},"createDurationLanguage"),F={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Ie=Se(t=>`year${t===1?"":"s"}`,t=>`month${t===1?"":"s"}`,t=>`week${t===1?"":"s"}`,t=>`day${t===1?"":"s"}`,t=>`hour${t===1?"":"s"}`,t=>`minute${t===1?"":"s"}`,t=>`second${t===1?"":"s"}`,t=>`millisecond${t===1?"":"s"}`,"in %s","%s ago",".",F,",","_");var Pe=Object.defineProperty,Be=p((t,e)=>Pe(t,"name",{value:e,configurable:!0}),"o"),Ue=Object.defineProperty,De=Be((t,e)=>Ue(t,"name",{value:e,configurable:!0}),"o"),ze=Object.defineProperty,je=De((t,e)=>ze(t,"name",{value:e,configurable:!0}),"o");const ke=je(t=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const o of e)if(!Object.hasOwn(t,o))throw new TypeError(`Missing required property: ${o}`);if(typeof t.future!="string"||typeof t.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const o of r)if(typeof t[o]!="string"&&typeof t[o]!="function")throw new TypeError(`Property ${o} must be of type string or function`);if(t.decimal&&typeof t.decimal!="string")throw new TypeError("Property decimal must be of type string");if(t.delimiter&&typeof t.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(t._digitReplacements&&!Array.isArray(t._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(t._numberFirst&&typeof t._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(t.unitMap&&typeof t.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(t.unitMap&&Object.values(t.unitMap).some(o=>typeof o!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var Re=Object.defineProperty,_e=p((t,e)=>Re(t,"name",{value:e,configurable:!0}),"w"),Fe=Object.defineProperty,Le=_e((t,e)=>Fe(t,"name",{value:e,configurable:!0}),"S"),Ve=Object.defineProperty,Ge=Le((t,e)=>Ve(t,"name",{value:e,configurable:!0}),"h");const k={d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},A=/[-/\\^$*+?.()|[\]{}]/g,Ye=/^PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?$/i,Ze=/^(?:(\d+):)?(?:(\d+):)?(\d+)$/,Ke=/^[+-]?\d+(?:\.\d+)?$/,We=/^[-+]/,qe=Ge((t,e)=>{if(typeof t!="string"||t.length===0)return;const{defaultUnit:r="ms",language:o=Ie}=e??{};ke(o);const s=o.decimal??".",a=o.groupSeparator??",",i=o.placeholderSeparator??"_",l=s.replaceAll(A,String.raw`\$&`),u=a.replaceAll(A,String.raw`\$&`),n=i.replaceAll(A,String.raw`\$&`),m=o.unitMap??F;let g=t.replaceAll(new RegExp(String.raw`(\d)[${n}${u}](\d)`,"g"),"$1$2");if(s!=="."&&(g=g.replace(l,".")),Ke.test(t)){const f=Number.parseFloat(g.trim());if(!Number.isNaN(f)){const y=m[r];if(y!==void 0)return f*k[y]}return}const c=Ye.exec(t);if(c){const f=Number.parseInt(c[1]??"0",10),y=Number.parseInt(c[2]??"0",10),x=Number.parseInt(c[3]??"0",10);return f*36e5+y*6e4+x*1e3}const d=Ze.exec(t);if(d){let f=0,y=0;d[2]!==void 0?(f=Number.parseInt(d[1]??"0",10),y=Number.parseInt(d[2],10)):d[1]!==void 0&&(y=Number.parseInt(d[1],10));const x=Number.parseInt(d[3]??"0",10);return f*36e5+y*6e4+x*1e3}const h=Object.keys(m).toSorted((f,y)=>y.length-f.length).map(f=>f.replaceAll(A,String.raw`\$&`)).join("|"),N=new RegExp(String.raw`(-?\d*\.?\d+)\s*(${h})`,"gi");let O=0,v,w=!1,B=-1,U=0;for(N.lastIndex=0;(v=N.exec(g))!==null;){w||(B=v.index),w=!0;const f=v[1],y=v[2];if(!f||!y)continue;const x=f.trim(),K=x.startsWith("-")?-1:1,W=x.replace(We,""),D=Number.parseFloat(W),z=m[y.toLowerCase()];if(z===void 0)continue;const q=k[z];if(Number.isNaN(D))return;O+=K*D*q,U=N.lastIndex}const Y=g.slice(0,B).trim(),Z=g.slice(U).trim();if(!(w&&(Y.length>0||Z.length>0))&&w)return O},"parseDuration");var He=Object.defineProperty,Xe=p((t,e)=>He(t,"name",{value:e,configurable:!0}),"n$1");let Je=class extends ae{static{p(this,"u")}static{Xe(this,"Locker")}constructor(e){super({ttl:3e4,ttlAutopurge:!0,...e})}lock(e){if(this.get(e)!==void 0)throw new Error(`${e} is locked`);const r=se();return this.set(e,r),r}unlock(e,r){return this.get(e)!==r?!1:this.delete(e)}};var Qe=Object.defineProperty,et=p((t,e)=>Qe(t,"name",{value:e,configurable:!0}),"e$1");const T=et(t=>{if(t===Number(t))return t;if(!t)return;const e=qe(t);if(e!==void 0)return e},"toMilliseconds");var tt=Object.defineProperty,rt=p((t,e)=>tt(t,"name",{value:e,configurable:!0}),"t");let ot=class extends Error{static{p(this,"d")}static{rt(this,"ValidationError")}code;statusCode;body;headers;name="ValidationError";constructor(e,r,o,s){const a=typeof o=="string"?o:o?.message||"Validation error";super(a),this.code=e,this.statusCode=r,this.body=o,this.headers=s}};var st=Object.defineProperty,S=p((t,e)=>st(t,"name",{value:e,configurable:!0}),"e");const at=S(t=>t&&t[0].toUpperCase()+t.slice(1),"capitalize"),it=S(t=>{if(!Array.isArray(t))return t;const[e,r,o]=t;return{body:r,headers:o,statusCode:e}},"toResponse");class nt{static{p(this,"Validator")}constructor(e="ValidationError"){this.prefix=e}prefix;static{S(this,"Validator")}validators={};add(e){Object.entries(e).forEach(([r,o])=>{const s=`${this.prefix}${at(r)}`;if(this.validators[s]={...this.validators[s],...o},typeof this.validators[s].isValid!="function")throw new TypeError('Validation config "isValid" is missing, or it is not a function!')})}async verify(e){for(const[r,o]of Object.entries(this.validators))if(!await o.isValid(e)){const s=o.response||(r in M?M[r]:M.UnknownError),a=it(s),{body:i,headers:l,message:u,statusCode:n}=a;throw new ot(r,n,i||u,l)}}}const St=S(t=>t.name==="ValidationError","isValidationError");var ct=Object.defineProperty,P=p((t,e)=>ct(t,"name",{value:e,configurable:!0}),"i");const lt=P(t=>{if(typeof t.name=="string")return t.name;if(typeof t.title=="string")return t.title;if(typeof t.originalName=="string")return t.originalName;if(typeof t.filename=="string")return t.filename},"extractOriginalName"),L=P((t,e)=>{const r={...t};return Object.keys(e).forEach(o=>{const s=e[o];if(s!==null&&typeof s=="object"&&!Array.isArray(s)){const a=r[o],i=a&&typeof a=="object"&&!Array.isArray(a)?a:{};r[o]=L(i,s)}else r[o]=s}),r},"deepMerge"),ut=P((t,e)=>{const r=L(t,e);Object.assign(t,r),t.originalName=lt(t.metadata)||t.originalName},"updateMetadata");var mt=Object.defineProperty,b=p((t,e)=>mt(t,"name",{value:e,configurable:!0}),"d");const gt=/(secret|password|passwd|pwd|token|api[_-]?key|credential|authorization|sas|signature|sessiontoken|connectionstring)/i,V=b(t=>{const e={};for(const[r,o]of Object.entries(t))typeof o=="string"&&gt.test(r)?e[r]="[REDACTED]":o&&typeof o=="object"&&!Array.isArray(o)&&o.constructor===Object?e[r]=V(o):e[r]=o;return e},"redactSecrets"),dt={allowMIME:["*/*"],filename:b(({id:t})=>t,"filename"),maxMetadataSize:"8MB",maxUploadSize:"5TB",onComplete:b(()=>{},"onComplete"),onCreate:b(()=>{},"onCreate"),onDelete:b(()=>{},"onDelete"),onError:b(()=>{},"onError"),onUpdate:b(()=>{},"onUpdate"),useRelativeLocation:!1,validation:{}},ht=b(t=>!t||t.length<3||t.length>255||I(t)?!1:!(t.toUpperCase().includes("../")||t.includes("\0")),"defaultCloudStorageFileNameValidation"),It=b(t=>{if(!t||t.length<3||t.length>255||I(t))return!1;const e=t.toUpperCase();return!['"',"*",":","<",">","?","\\","|","../","\0"].some(r=>e.includes(r))},"defaultFilesystemFileNameValidation");class G{static{p(this,"BaseStorage")}static{b(this,"BaseStorage")}onCreate;onUpdate;onComplete;onDelete;onError;isReady=!0;errorResponses={};cache;logger;metrics;genericConfig;maxMetadataSize;checksumTypes=[];supportsRange=!1;reportsUploadProgress=!1;maxUploadSize;expiration;locker;namingFunction;validation=new nt;assetFolder=void 0;concurrency;constructor(e){const r={...dt,...e};this.onCreate=r.onCreate,this.onUpdate=r.onUpdate,this.onComplete=r.onComplete,this.onDelete=r.onDelete,this.onError=r.onError,this.namingFunction=r.filename,this.maxUploadSize=typeof r.maxUploadSize=="string"?j(r.maxUploadSize):r.maxUploadSize,this.maxMetadataSize=typeof r.maxMetadataSize=="string"?j(r.maxMetadataSize):r.maxMetadataSize,this.expiration=r.expiration,this.genericConfig=r,r.assetFolder!==void 0&&(this.assetFolder=ee(r.assetFolder)),this.locker=new Je({max:1e3,ttl:3e4,ttlAutopurge:!0}),this.cache=r.cache??new oe,this.logger=r.logger,this.metrics=r.metrics??new re,this.logger?.debug(`${this.constructor.name} config: ${Q(V({...e,logger:this.logger.constructor}))}`);const o=T(r.expiration?.purgeInterval);o&&this.startAutoPurge(o);const s={isValid(u){if(u.size===void 0)return!0;const n=u.size;if(n==null)return!1;const m=typeof n=="number"?n:Number(n);if(Number.isNaN(m)||m<0)return!1;const g=typeof this.value=="number"?this.value:Number(this.value);return!Number.isNaN(g)&&m<=g},response:M.RequestEntityTooLarge,value:this.maxUploadSize},a={isValid(u){return!!te.is(u.contentType,this.value)},response:M.UnsupportedMediaType,value:r.allowMIME},i=r.fileNameValidation??ht,l={isValid(u){return i(u.name)},response:M.InvalidFileName};this.validation.add({filename:l,mime:a,size:s}),this.validation.add({...r.validation})}get raw(){}async getReadUrl(e,r){return E($.METHOD_NOT_ALLOWED,`${this.constructor.name} does not implement getReadUrl()`)}async getUploadUrl(e,r){return E($.METHOD_NOT_ALLOWED,`${this.constructor.name} does not implement getUploadUrl()`)}get tusExtension(){const e=["creation","creation-with-upload","termination","checksum","creation-defer-length","concatenation"];return this.expiration&&e.push("expiration"),e}async validate(e){await this.validation.verify(e)}async exists(e,r){return this.instrumentOperation("exists",async()=>{try{return await this.getMeta(e.id,r),!0}catch{return!1}})}normalizeError(e){const r={code:e.name,message:e.message,name:e.name,statusCode:500};return{...r,message:`[${this.constructor.name}] ${r.message}`}}get config(){return this.genericConfig}async saveMeta(e){return G.assertSafeId(e.id),this.updateTimestamps(e),this.cache.set(e.id,e),this.meta.save(e.id,e)}static assertSafeId(e){(!e||typeof e!="string"||e.includes("\0")||e.includes("../")||e.includes("..\\")||e===".."||e.startsWith("../")||e.startsWith("..\\")||I(e)||/^[A-Z]:[/\\]/i.test(e))&&E($.INVALID_FILE_NAME,`Invalid file id: "${e}"`)}async deleteMeta(e){return this.cache.delete(e),this.meta.delete(e)}async getMeta(e,r){try{const o=await this.meta.get(e);return this.cache.set(o.id,o),{...o}}catch(o){const s=this.normalizeError(o instanceof Error?o:new Error(String(o)));return await this.onError(s),E($.FILE_NOT_FOUND)}}async checkIfExpired(e){return ne(e)?(this.delete(e).catch(()=>{}),this.deleteMeta(e.id).catch(()=>{}),E($.GONE)):e}async purge(e){return this.instrumentOperation("purge",async()=>{const r=T(e||this.expiration?.maxAge),o={items:[],maxAgeMs:r};if(r){const s=Date.now()-r,a=(await this.list()).filter(i=>Number(new Date(this.expiration?.rolling&&i.modifiedAt||i.createdAt))<s);for await(const{id:i,...l}of a)try{const u=await this.delete({id:i});o.items.push({...u,...l})}catch(u){this.logger?.warn(`Failed to delete file ${i} during purge: ${u instanceof Error?u.message:String(u)}`)}o.items.length>0&&(this.logger?.info(`Purge: removed ${o.items.length} uploads`),this.metrics.gauge("storage.operations.purge.items_count",o.items.length,{storage:this.constructor.name.toLowerCase().replace("storage","")}))}return o})}async getStream({id:e}){return this.instrumentOperation("getStream",async()=>{const r=await this.get({id:e}),o=X.from(r.content);return{headers:{"Content-Length":String(r.size),"Content-Type":r.contentType,...r.ETag&&{ETag:r.ETag},...r.modifiedAt&&{"Last-Modified":r.modifiedAt.toString()}},size:typeof r.size=="number"?r.size:void 0,stream:o}})}async list(e=1e3,r){return this.instrumentOperation("list",async()=>{throw new Error("Not implemented")})}async update({id:e},r){return this.instrumentOperation("update",async()=>{const o=await this.getMeta(e),s={...r};if("ttl"in s&&s.ttl!==void 0){const i=s.ttl,l=typeof i=="string"?T(i):i;l!==void 0&&(s.expiredAt=Date.now()+l),delete s.ttl}ut(o,s),await this.saveMeta(o);const a={...o,status:"updated"};return await this.onUpdate(a),a})}async deleteBatch(e,r){const o=Date.now(),s=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.delete.count",1,{batch_size:e.length,storage:s});const a=[],i=[],l=e.map(async m=>{try{return{file:await this.delete({id:m},r),id:m,success:!0}}catch(g){const c=g instanceof Error?g.message:"Delete failed";return this.metrics.increment("storage.operations.delete.error.count",1,{error:c,storage:s}),{error:c,id:m,success:!1}}}),u=await Promise.allSettled(l);for(const m of u)m.status==="fulfilled"?m.value.success?a.push(m.value.file):i.push({error:m.value.error,id:m.value.id}):i.push({error:m.reason?.message||"Delete failed",id:""});const n=Date.now()-o;return this.metrics.timing("storage.operations.batch.delete.duration",n,{batch_size:e.length,storage:s}),this.metrics.gauge("storage.operations.batch.delete.success_count",a.length,{storage:s}),this.metrics.gauge("storage.operations.batch.delete.failed_count",i.length,{storage:s}),{failed:i,failedCount:i.length,successful:a,successfulCount:a.length}}async copyBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.copy.count",1,{batch_size:e.length,storage:o});const s=[],a=[],i=e.map(async({destination:n,options:m,source:g})=>{try{return{file:await this.copy(g,n,m),id:n,success:!0}}catch(c){const d=c instanceof Error?c.message:"Copy failed";return this.metrics.increment("storage.operations.copy.error.count",1,{error:d,storage:o}),{error:d,id:n,success:!1}}}),l=await Promise.allSettled(i);for(const n of l)n.status==="fulfilled"?n.value.success&&n.value.file?s.push(n.value.file):a.push({error:n.value.error||"Copy failed",id:n.value.id}):a.push({error:n.reason?.message||"Copy failed",id:""});const u=Date.now()-r;return this.metrics.timing("storage.operations.batch.copy.duration",u,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.copy.success_count",s.length,{storage:o}),this.metrics.gauge("storage.operations.batch.copy.failed_count",a.length,{storage:o}),{failed:a,failedCount:a.length,successful:s,successfulCount:s.length}}async moveBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.move.count",1,{batch_size:e.length,storage:o});const s=[],a=[],i=e.map(async({destination:n,source:m})=>{try{return{file:await this.move(m,n),id:n,success:!0}}catch(g){const c=g instanceof Error?g.message:"Move failed";return this.metrics.increment("storage.operations.move.error.count",1,{error:c,storage:o}),{error:c,id:n,success:!1}}}),l=await Promise.allSettled(i);for(const n of l)n.status==="fulfilled"?n.value.success&&n.value.file?s.push(n.value.file):a.push({error:n.value.error||"Move failed",id:n.value.id}):a.push({error:n.reason?.message||"Move failed",id:n.reason?.id||""});const u=Date.now()-r;return this.metrics.timing("storage.operations.batch.move.duration",u,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.move.success_count",s.length,{storage:o}),this.metrics.gauge("storage.operations.batch.move.failed_count",a.length,{storage:o}),{failed:a,failedCount:a.length,successful:s,successfulCount:s.length}}async lock(e){const r=[...this.locker.keys()];return r.includes(e)?E($.FILE_LOCKED):this.config.concurrency&&typeof this.config.concurrency=="number"&&this.config.concurrency<r.length?E($.STORAGE_BUSY):this.locker.lock(e)}async unlock(e,r){if(r===void 0){this.locker.delete(e);return}this.locker.unlock(e,r)}async withLock(e,r){const o=await this.lock(e);try{return await r()}finally{await this.unlock(e,o)}}isUnsupportedChecksum(e=""){return!!e&&!this.checksumTypes.includes(e)}startAutoPurge(e){if(e>=2147483647)throw new Error("“purgeInterval” must be less than 2147483647 ms");J(()=>{this.purge().catch(r=>this.logger?.error(r))},e)}updateTimestamps(e){e.createdAt??=new Date().toISOString();const r=T(this.expiration?.maxAge);return r&&!e.expiredAt&&(e.expiredAt=this.expiration?.rolling?Date.now()+r:+new Date(e.createdAt)+r),e}getRetryConfig(){}runOperation(e,r,o){let s;typeof e?.retries=="number"?s={maxRetries:e.retries}:e?.retries&&(s=e.retries);const a={...this.getRetryConfig(),...s};o?.replayable===!1&&(a.maxRetries=0);const i=[];this.genericConfig.defaultSignal&&i.push(this.genericConfig.defaultSignal),e?.signal&&i.push(e.signal);let l;i.length===1?[l]=i:i.length>1&&(l=AbortSignal.any(i));const u=typeof e?.timeout=="number"?e.timeout:this.genericConfig.defaultTimeout,n=typeof u=="number"&&u>0?u:void 0,m=a.shouldRetry;a.shouldRetry=c=>l?.aborted||c instanceof Error&&c.name==="AbortError"?!1:m?m(c):!1;const g=b(c=>{if(c instanceof Error&&c.name==="AbortError")return c;const d=c instanceof Error&&c.message?c.message:"The operation was aborted",h=new Error(d,{cause:c});return h.name="AbortError",h},"toAbortError");return ie(async()=>{if(l?.aborted)throw g(l.reason);let c,d;if(n===void 0)d=l;else{const h=new AbortController;c=setTimeout(()=>{h.abort(new DOMException(`The operation timed out after ${n}ms`,"TimeoutError"))},n),d=l?AbortSignal.any([l,h.signal]):h.signal}try{return await r(d)}catch(h){throw d?.aborted?g(h):h}finally{c&&clearTimeout(c)}},a)}async instrumentOperation(e,r,o){const s=Date.now(),a={storage:this.constructor.name.toLowerCase().replace("storage",""),...o};try{this.metrics.increment(`storage.operations.${e}.count`,1,a);const i=await r(),l=Date.now()-s;return this.metrics.timing(`storage.operations.${e}.duration`,l,a),i&&typeof i=="object"&&"size"in i&&typeof i.size=="number"&&this.metrics.gauge("storage.files.size",i.size,{...a,operation:e}),i}catch(i){const l=Date.now()-s,u=i instanceof Error?i.message:"Unknown error";throw this.metrics.timing(`storage.operations.${e}.duration`,l,{...a,error:"true"}),this.metrics.increment(`storage.operations.${e}.error.count`,1,{...a,error:u}),i}}}export{j as $,G as B,It as a,ot as b,ht as d,St as i,T as t,ut as u,qe as z};
@@ -304,6 +304,13 @@ interface RetryConfig {
304
304
  */
305
305
  maxRetries?: number;
306
306
  /**
307
+ * Fire-and-forget hook invoked **before** each retry attempt's backoff sleep.
308
+ * `attempt` is 1-based (1 = first retry, i.e. after the initial call failed).
309
+ * Exceptions thrown by this callback are swallowed so an observability hook
310
+ * can never fail the underlying operation.
311
+ */
312
+ onRetry?: (attempt: number, error: unknown) => void;
313
+ /**
307
314
  * HTTP status codes that should trigger a retry
308
315
  * @default [408, 429, 500, 502, 503, 504]
309
316
  */
@@ -781,6 +788,21 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
781
788
  readonly genericConfig: BaseStorageOptions<TFile>;
782
789
  maxMetadataSize: number;
783
790
  checksumTypes: string[];
791
+ /**
792
+ * Adapter capability flag: when `true`, the adapter honours
793
+ * `OperationOptions.range` on {@link BaseStorage.get} and
794
+ * {@link BaseStorage.getStream}, returning only the requested byte slice.
795
+ * The `Files` facade gates `download({ range })` on this flag and throws
796
+ * `METHOD_NOT_ALLOWED` for adapters that haven't opted in.
797
+ */
798
+ readonly supportsRange: boolean;
799
+ /**
800
+ * Adapter capability flag: when `true`, the adapter reports its own
801
+ * byte-level `onProgress` events during `write`. The `Files` facade skips
802
+ * its coarse "start/done" emission for adapters that report progress
803
+ * natively, so callers see one consistent stream of events.
804
+ */
805
+ readonly reportsUploadProgress: boolean;
784
806
  maxUploadSize: number;
785
807
  protected expiration?: {
786
808
  maxAge?: string | number;
@@ -809,7 +831,7 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
809
831
  * @param _key Storage key.
810
832
  * @param _options Optional expiry and response overrides.
811
833
  */
812
- getReadUrl(_key: string, _options?: {
834
+ getReadUrl(_key: string, _options?: OperationOptions & {
813
835
  expiresIn?: number;
814
836
  responseContentDisposition?: string;
815
837
  responseContentType?: string;
@@ -818,9 +840,9 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
818
840
  * Returns a presigned URL for uploading a single object to `key`.
819
841
  * Throws `ERRORS.METHOD_NOT_ALLOWED` when the adapter has no native presign support.
820
842
  * @param _key Storage key.
821
- * @param _options Optional content type, expiry, and content length hints.
843
+ * @param _options Optional content type, expiry, and content length hints, plus per-call signal/timeout/retries.
822
844
  */
823
- getUploadUrl(_key: string, _options?: {
845
+ getUploadUrl(_key: string, _options?: OperationOptions & {
824
846
  contentLength?: number;
825
847
  contentType?: string;
826
848
  expiresIn?: number;
@@ -840,7 +862,7 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
840
862
  * @returns Promise resolving to true if file exists, false otherwise.
841
863
  * @remarks This method does not throw errors - it returns false if the file is not found.
842
864
  */
843
- exists(query: FileQuery): Promise<boolean>;
865
+ exists(query: FileQuery, options?: OperationOptions): Promise<boolean>;
844
866
  /**
845
867
  * Normalizes errors with storage-specific context.
846
868
  * @param error The error to normalize.
@@ -882,7 +904,7 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
882
904
  * @throws {UploadError} If the file metadata cannot be found (ERRORS.FILE_NOT_FOUND).
883
905
  * @remarks Caches the retrieved metadata for faster subsequent access.
884
906
  */
885
- getMeta(id: string): Promise<TFile>;
907
+ getMeta(id: string, _options?: OperationOptions): Promise<TFile>;
886
908
  /**
887
909
  * Checks if a file has expired and deletes it if so.
888
910
  * @param file File object to check for expiration.
@@ -907,13 +929,14 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
907
929
  * Gets an uploaded file by ID.
908
930
  * @param query File query containing the file ID to retrieve.
909
931
  * @param query.id File ID to retrieve.
932
+ * @param options Optional per-call signal/timeout/retries.
910
933
  * @returns Promise resolving to the file data including content.
911
934
  * @throws {UploadError} If the file cannot be found (ERRORS.FILE_NOT_FOUND) or has expired (ERRORS.GONE).
912
935
  * @remarks This method loads the entire file content into memory. For large files, use getStream() instead.
913
936
  */
914
937
  abstract get({
915
938
  id
916
- }: FileQuery): Promise<TFileReturn>;
939
+ }: FileQuery, options?: OperationOptions): Promise<TFileReturn>;
917
940
  /**
918
941
  * Gets an uploaded file as a readable stream for efficient large file handling.
919
942
  * @param query File query containing the file ID to stream.
@@ -939,7 +962,7 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
939
962
  * @throws {Error} If not implemented by the storage backend.
940
963
  * @remarks Storage implementations must override this method.
941
964
  */
942
- list(_limit?: number): Promise<TFile[]>;
965
+ list(_limit?: number, _options?: OperationOptions): Promise<TFile[]>;
943
966
  /**
944
967
  * Updates file metadata with user-provided key-value pairs.
945
968
  * @param query File query containing the file ID to update.
@@ -958,42 +981,46 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
958
981
  /**
959
982
  * Creates a new upload and saves its metadata.
960
983
  * @param file File initialization configuration.
984
+ * @param options Optional per-call signal/timeout/retries.
961
985
  * @returns Promise resolving to the created file object.
962
986
  */
963
- abstract create(file: FileInit): Promise<TFile>;
987
+ abstract create(file: FileInit, options?: OperationOptions): Promise<TFile>;
964
988
  /**
965
989
  * Writes part and/or returns status of an upload.
966
990
  * @param part File part, query, or full file object to write.
991
+ * @param options Optional per-call signal/timeout/retries.
967
992
  * @returns Promise resolving to the updated file object.
968
993
  */
969
- abstract write(part: FilePart | FileQuery | TFile): Promise<TFile>;
994
+ abstract write(part: FilePart | FileQuery | TFile, options?: OperationOptions): Promise<TFile>;
970
995
  /**
971
996
  * Deletes an upload and its metadata.
972
997
  * @param query File query containing the file ID to delete.
973
998
  * @param query.id File ID to delete.
999
+ * @param options Optional per-call signal/timeout/retries.
974
1000
  * @returns Promise resolving to the deleted file object with status: "deleted".
975
1001
  * @throws {UploadError} If the file metadata cannot be found.
976
1002
  */
977
- abstract delete(query: FileQuery): Promise<TFile>;
1003
+ abstract delete(query: FileQuery, options?: OperationOptions): Promise<TFile>;
978
1004
  /**
979
1005
  * Copies an upload file to a new location.
980
1006
  * @param name Source file name/ID.
981
1007
  * @param destination Destination file name/ID.
982
- * @param options Optional copy options including storage class.
1008
+ * @param options Optional copy options including storage class plus per-call signal/timeout/retries.
983
1009
  * @returns Promise resolving to the copied file object.
984
1010
  * @throws {UploadError} If the source file cannot be found.
985
1011
  */
986
- abstract copy(name: string, destination: string, options?: {
1012
+ abstract copy(name: string, destination: string, options?: OperationOptions & {
987
1013
  storageClass?: string;
988
1014
  }): Promise<TFile>;
989
1015
  /**
990
1016
  * Moves an upload file to a new location.
991
1017
  * @param name Source file name/ID.
992
1018
  * @param destination Destination file name/ID.
1019
+ * @param options Optional per-call signal/timeout/retries.
993
1020
  * @returns Promise resolving to the moved file object.
994
1021
  * @throws {UploadError} If the source file cannot be found.
995
1022
  */
996
- abstract move(name: string, destination: string): Promise<TFile>;
1023
+ abstract move(name: string, destination: string, options?: OperationOptions): Promise<TFile>;
997
1024
  /**
998
1025
  * Deletes multiple files in a single batch operation.
999
1026
  * @param ids Array of file IDs to delete.
@@ -1005,7 +1032,7 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
1005
1032
  * Metrics are recorded for the batch operation and individual failures.
1006
1033
  * Returns both successful and failed operations with detailed error information.
1007
1034
  */
1008
- deleteBatch(ids: string[]): Promise<BatchOperationResponse<TFile>>;
1035
+ deleteBatch(ids: string[], options?: OperationOptions): Promise<BatchOperationResponse<TFile>>;
1009
1036
  /**
1010
1037
  * Copies multiple files in a single batch operation.
1011
1038
  * @param operations Array of copy operations, each containing:
@@ -1103,4 +1130,4 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
1103
1130
  */
1104
1131
  protected instrumentOperation<T>(operation: string, function_: () => Promise<T>, attributes?: Record<string, string | number>): Promise<T>;
1105
1132
  }
1106
- export { throwErrorCode as $, RangeChecksum as A, BaseStorage as B, RangeHasher as C, DiskStorageOptions as D, ERRORS as E, File as F, ResponseBody as G, HttpError as H, IncomingMessageWithBody as I, ResponseTuple as J, UploadResponse as K, LocalMetaStorageOptions as L, MetaStorage as M, ValidationError as N, OperationOptions as O, PurgeList as P, ValidatorConfig as Q, RetryConfig as R, defaultCloudStorageFileNameValidation as S, defaultFilesystemFileNameValidation as T, UploadFile as U, Validation as V, extractHttpStatus as W, isRetryableError as X, isUploadError as Y, mapStatusToErrorCode as Z, retry as _, FileReturn as a, wrapStorageError as a0, Cache as a1, UploadError as b, UploadEventType as c, createRetryWrapper as d, FileInit as e, FilePart as f, FileQuery as g, DiskStorageWithChecksumOptions as h, BaseStorageOptions as i, ResponseBodyType as j, ErrorResponses as k, Metrics as l, BatchOperationResponse as m, BatchOperationResult as n, ErrorMap as o, ExpirationOptions as p, Header as q, Headers as r, HttpErrorBody as s, MetaStorageOptions as t, Metadata as u, OnComplete as v, OnCreate as w, OnDelete as x, OnError as y, OnUpdate as z };
1133
+ export { throwErrorCode as $, RangeChecksum as A, BaseStorage as B, RangeHasher as C, DiskStorageOptions as D, ERRORS as E, File as F, ResponseBody as G, HttpError as H, IncomingMessageWithBody as I, ResponseTuple as J, UploadResponse as K, LocalMetaStorageOptions as L, MetaStorage as M, ValidationError as N, OperationOptions as O, PurgeList as P, ValidatorConfig as Q, RetryConfig as R, defaultCloudStorageFileNameValidation as S, defaultFilesystemFileNameValidation as T, UploadFile as U, Validation as V, extractHttpStatus as W, isRetryableError as X, isUploadError as Y, mapStatusToErrorCode as Z, retry as _, FileReturn as a, wrapStorageError as a0, Cache as a1, UploadError as b, UploadEventType as c, createRetryWrapper as d, FileInit as e, FilePart as f, FileQuery as g, MetaStorageOptions as h, BaseStorageOptions as i, DiskStorageWithChecksumOptions as j, ResponseBodyType as k, ErrorResponses as l, Metrics as m, BatchOperationResponse as n, BatchOperationResult as o, ErrorMap as p, ExpirationOptions as q, Header as r, Headers as s, HttpErrorBody as t, Metadata as u, OnComplete as v, OnCreate as w, OnDelete as x, OnError as y, OnUpdate as z };
@@ -1,8 +1,8 @@
1
1
  import { EventEmitter } from 'node:events';
2
- import { U as UploadFile, j as ResponseBodyType, B as BaseStorage, k as ErrorResponses } from "./storage.d-RteRC-cG.js";
2
+ import { U as UploadFile, k as ResponseBodyType, B as BaseStorage, l as ErrorResponses } from "./storage.d-X6TimMHY.js";
3
3
  import 'node:stream';
4
- import { M as MediaTransformer } from "./media-transformer.d-C3QvECD7.js";
5
- import { U as UploadOptions } from "./types.d-cI_cMxcZ.js";
4
+ import { M as MediaTransformer } from "./media-transformer.d-DfU7VbFl.js";
5
+ import { U as UploadOptions } from "./types.d-B72PbsLY.js";
6
6
  import 'node:crypto';
7
7
  import 'node:http';
8
8
  import 'lru-cache';
@@ -2,8 +2,8 @@ import { EventEmitter } from 'node:events';
2
2
  import { IncomingMessage } from 'node:http';
3
3
  import { Readable } from 'node:stream';
4
4
  import { PaginationResult } from '@visulima/pagination';
5
- import { U as UploadFile, B as BaseStorage, b as UploadError, c as UploadEventType } from "./storage.d-RteRC-cG.js";
6
- import { M as MediaTransformer } from "./media-transformer.d-C3QvECD7.js";
5
+ import { U as UploadFile, B as BaseStorage, b as UploadError, c as UploadEventType } from "./storage.d-X6TimMHY.js";
6
+ import { M as MediaTransformer } from "./media-transformer.d-DfU7VbFl.js";
7
7
  type WebRequest = globalThis.Request;
8
8
  type WebResponse = globalThis.Response;
9
9
  interface BaseResponse {
@@ -1,4 +1,4 @@
1
- import { a1 as Cache, F as File, a as FileReturn, B as BaseStorage } from "./storage.d-RteRC-cG.js";
1
+ import { a1 as Cache, F as File, a as FileReturn, B as BaseStorage } from "./storage.d-X6TimMHY.js";
2
2
  import { Readable } from 'node:stream';
3
3
  /**
4
4
  * Base transformer configuration with common properties
@@ -717,4 +717,4 @@ interface AudioTransformerConfig extends BaseTransformerConfig {
717
717
  /** Maximum audio size to process (in bytes) */
718
718
  maxAudioSize?: number;
719
719
  }
720
- export { AudioTransformerConfig as A, BaseTransformer as B, CropOptions as C, DilateOptions as D, ExtractChannelOptions as E, VideoTransformResult as F, GreyscaleOptions as G, VideoResizeOptions as H, ImageTransformerConfig as I, JoinChannelOptions as J, VideoCropOptions as K, LinearOptions as L, MediaTransformerConfig as M, VideoRotateOptions as N, VideoTransformOptions as O, PipelineColourspaceOptions as P, VideoTransformationStep as Q, ResizeOptions as R, SharpenOptions as S, TransformResult as T, MediaTransformQuery as U, VideoTransformerConfig as V, MediaTransformationStep as W, AudioTransformResult as a, AudioResampleOptions as b, AudioChannelMixOptions as c, AudioTransformOptions as d, AudioTransformationStep as e, MediaTransformResult as f, RotateOptions as g, ImageFormat as h, TransformOptions as i, BlurOptions as j, MedianOptions as k, CLAHEOptions as l, ConvolveOptions as m, ThresholdOptions as n, BooleanOptions as o, RecombineOptions as p, ModulateOptions as q, TintOptions as r, ColourspaceOptions as s, BandboolOptions as t, AffineOptions as u, ErodeOptions as v, ToColourspaceOptions as w, RemoveAlphaOptions as x, EnsureAlphaOptions as y, TransformationStep as z };
720
+ export { AudioTransformerConfig as A, BaseTransformer as B, CropOptions as C, AffineOptions as D, ExtractChannelOptions as E, DilateOptions as F, GreyscaleOptions as G, ErodeOptions as H, ImageTransformerConfig as I, JoinChannelOptions as J, ToColourspaceOptions as K, LinearOptions as L, MediaTransformerConfig as M, RemoveAlphaOptions as N, EnsureAlphaOptions as O, PipelineColourspaceOptions as P, TransformationStep as Q, ResizeOptions as R, SharpenOptions as S, TransformResult as T, MediaTransformQuery as U, VideoTransformerConfig as V, MediaTransformationStep as W, VideoTransformResult as a, VideoResizeOptions as b, VideoCropOptions as c, VideoRotateOptions as d, VideoTransformOptions as e, VideoTransformationStep as f, MediaTransformResult as g, AudioTransformResult as h, AudioResampleOptions as i, AudioChannelMixOptions as j, AudioTransformOptions as k, AudioTransformationStep as l, RotateOptions as m, ImageFormat as n, TransformOptions as o, BlurOptions as p, MedianOptions as q, CLAHEOptions as r, ConvolveOptions as s, ThresholdOptions as t, BooleanOptions as u, RecombineOptions as v, ModulateOptions as w, TintOptions as x, ColourspaceOptions as y, BandboolOptions as z };
@@ -1,4 +1,4 @@
1
- import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions } from "./storage.d-RteRC-cG.js";
1
+ import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions } from "./storage.d-X6TimMHY.js";
2
2
  import 'node:stream';
3
3
  import { Client } from '@microsoft/microsoft-graph-client';
4
4
  declare class OneDriveFile extends File {
@@ -1,6 +1,6 @@
1
- import { F as File, t as MetaStorageOptions, i as BaseStorageOptions, L as LocalMetaStorageOptions, M as MetaStorage, H as HttpError, g as FileQuery, O as OperationOptions, e as FileInit } from "../../packem_shared/storage.d-RteRC-cG.js";
1
+ import { F as File, h as MetaStorageOptions, i as BaseStorageOptions, L as LocalMetaStorageOptions, M as MetaStorage, H as HttpError, g as FileQuery, O as OperationOptions, e as FileInit } from "../../packem_shared/storage.d-X6TimMHY.js";
2
2
  import { Readable } from 'node:stream';
3
- import { P as Part, S as S3CallOptions, a as S3ApiOperations, b as S3BaseStorage } from "../../packem_shared/s3-base-storage.d-V3N2nKCt.js";
3
+ import { P as Part, S as S3CallOptions, a as S3ApiOperations, b as S3BaseStorage } from "../../packem_shared/s3-base-storage.d-BrHiKWFw.js";
4
4
  import { S3ClientConfig, ObjectCannedACL, S3Client } from '@aws-sdk/client-s3';
5
5
  import { ResponseMetadata } from '@aws-sdk/types';
6
6
  import 'node:crypto';
@@ -188,6 +188,7 @@ declare class S3ClientAdapter implements S3ApiOperations {
188
188
  getObject(params: {
189
189
  Bucket: string;
190
190
  Key: string;
191
+ Range?: string;
191
192
  }, options?: S3CallOptions): Promise<{
192
193
  Body?: ReadableStream | Readable;
193
194
  ContentLength?: number;
@@ -297,7 +298,12 @@ declare class S3Storage extends S3BaseStorage {
297
298
  }: FileQuery, metadata: Partial<S3File>): Promise<S3File>;
298
299
  override getStream({
299
300
  id
300
- }: FileQuery, options?: OperationOptions): Promise<{
301
+ }: FileQuery, options?: OperationOptions & {
302
+ range?: {
303
+ end?: number;
304
+ start: number;
305
+ };
306
+ }): Promise<{
301
307
  headers?: Record<string, string>;
302
308
  size?: number;
303
309
  stream: Readable;
@@ -1 +1 @@
1
- import{default as t}from"../../packem_shared/S3File-BfmCOET4.js";import{default as r}from"../../packem_shared/S3MetaStorage-vcriiosn.js";import{default as S}from"../../packem_shared/S3Storage-n1ohEZj4.js";export{t as S3File,r as S3MetaStorage,S as S3Storage};
1
+ import{default as t}from"../../packem_shared/S3File-BfmCOET4.js";import{default as r}from"../../packem_shared/S3MetaStorage-vcriiosn.js";import{default as S}from"../../packem_shared/S3Storage-7hG3izjU.js";export{t as S3File,r as S3MetaStorage,S as S3Storage};
@@ -1,5 +1,5 @@
1
- import { P as Part, S as S3CallOptions, a as S3ApiOperations, b as S3BaseStorage } from "../../packem_shared/s3-base-storage.d-V3N2nKCt.js";
2
- import { F as File, t as MetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, H as HttpError, g as FileQuery, O as OperationOptions, e as FileInit } from "../../packem_shared/storage.d-RteRC-cG.js";
1
+ import { P as Part, S as S3CallOptions, a as S3ApiOperations, b as S3BaseStorage } from "../../packem_shared/s3-base-storage.d-BrHiKWFw.js";
2
+ import { F as File, h as MetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, H as HttpError, g as FileQuery, O as OperationOptions, e as FileInit } from "../../packem_shared/storage.d-X6TimMHY.js";
3
3
  import { Readable } from 'node:stream';
4
4
  import { AwsClient } from 'aws4fetch';
5
5
  import 'node:crypto';
@@ -1 +1 @@
1
- import{default as a}from"../../packem_shared/AwsLightFile-BSqjc_rD.js";import{l as r}from"../../packem_shared/aws-light-meta-storage-CstQBYXG.js";import{default as f}from"../../packem_shared/AwsLightStorage-w21RxjUm.js";export{a as AwsLightFile,r as AwsLightMetaStorage,f as AwsLightStorage};
1
+ import{default as a}from"../../packem_shared/AwsLightFile-BSqjc_rD.js";import{l as r}from"../../packem_shared/aws-light-meta-storage-CstQBYXG.js";import{default as f}from"../../packem_shared/AwsLightStorage-B1jNF7sv.js";export{a as AwsLightFile,r as AwsLightMetaStorage,f as AwsLightStorage};
@@ -1,4 +1,4 @@
1
- import { F as File, t as MetaStorageOptions, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, R as RetryConfig, e as FileInit, O as OperationOptions, g as FileQuery, f as FilePart, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-RteRC-cG.js";
1
+ import { F as File, h as MetaStorageOptions, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, R as RetryConfig, e as FileInit, O as OperationOptions, g as FileQuery, f as FilePart, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-X6TimMHY.js";
2
2
  import 'node:stream';
3
3
  import { TokenCredential } from '@azure/core-auth';
4
4
  import { BlobServiceClient } from '@azure/storage-blob';
@@ -1 +1 @@
1
- import{default as a}from"../../packem_shared/AzureFile-Dgj2Tef4.js";import{b as t}from"../../packem_shared/azure-meta-storage-C4SrMtT2.js";import{default as u}from"../../packem_shared/AzureStorage-2kl7JDXs.js";export{a as AzureFile,t as AzureSMetaStorage,u as AzureStorage};
1
+ import{default as a}from"../../packem_shared/AzureFile-Dgj2Tef4.js";import{b as t}from"../../packem_shared/azure-meta-storage-C4SrMtT2.js";import{default as u}from"../../packem_shared/AzureStorage-B4E6VLn5.js";export{a as AzureFile,t as AzureSMetaStorage,u as AzureStorage};
@@ -1,6 +1,6 @@
1
- import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-RteRC-cG.js";
1
+ import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-X6TimMHY.js";
2
2
  import 'node:stream';
3
- import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-B11vHYNm.js";
3
+ import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-CuvN-KQ3.js";
4
4
  import { BoxClient } from 'box-typescript-sdk-gen';
5
5
  import 'node:crypto';
6
6
  import 'node:http';
@@ -1 +1 @@
1
- import{default as a}from"../../packem_shared/BoxFile-Be0S4N1L.js";import{default as r}from"../../packem_shared/BoxMetaStorage-DLdXbZaV.js";import{default as x}from"../../packem_shared/BoxStorage-BUeEJoGL.js";export{a as BoxFile,r as BoxMetaStorage,x as BoxStorage};
1
+ import{default as a}from"../../packem_shared/BoxFile-Be0S4N1L.js";import{default as r}from"../../packem_shared/BoxMetaStorage-nESVquA1.js";import{default as x}from"../../packem_shared/BoxStorage-CHYDrcxw.js";export{a as BoxFile,r as BoxMetaStorage,x as BoxStorage};
@@ -1,6 +1,6 @@
1
- import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-RteRC-cG.js";
1
+ import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-X6TimMHY.js";
2
2
  import { Readable } from 'node:stream';
3
- import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-B11vHYNm.js";
3
+ import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-CuvN-KQ3.js";
4
4
  import 'node:crypto';
5
5
  import 'node:http';
6
6
  import 'lru-cache';
@@ -1 +1 @@
1
- import{default as t}from"../../packem_shared/BunS3File-D-SRiyrm.js";import{default as r}from"../../packem_shared/BunS3MetaStorage-Bv_CTTMz.js";import{default as u}from"../../packem_shared/BunS3Storage-WM3rF6Fw.js";export{t as BunS3File,r as BunS3MetaStorage,u as BunS3Storage};
1
+ import{default as t}from"../../packem_shared/BunS3File-D-SRiyrm.js";import{default as r}from"../../packem_shared/BunS3MetaStorage-BkZx5q4w.js";import{default as u}from"../../packem_shared/BunS3Storage-BopE7kmX.js";export{t as BunS3File,r as BunS3MetaStorage,u as BunS3Storage};
@@ -1,6 +1,6 @@
1
- import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-RteRC-cG.js";
1
+ import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-X6TimMHY.js";
2
2
  import 'node:stream';
3
- import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-B11vHYNm.js";
3
+ import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-CuvN-KQ3.js";
4
4
  import * as BunnyStorageSDK from '@bunny.net/storage-sdk';
5
5
  import 'node:crypto';
6
6
  import 'node:http';
@@ -1 +1 @@
1
- import{default as t}from"../../packem_shared/BunnyFile-Dotl-lO9.js";import{default as r}from"../../packem_shared/BunnyMetaStorage-DNMTSeoN.js";import{default as n}from"../../packem_shared/BunnyStorage-D3s2fRB3.js";export{t as BunnyFile,r as BunnyMetaStorage,n as BunnyStorage};
1
+ import{default as t}from"../../packem_shared/BunnyFile-Dotl-lO9.js";import{default as r}from"../../packem_shared/BunnyMetaStorage-bB8NXGUI.js";import{default as n}from"../../packem_shared/BunnyStorage-C3IBxJqr.js";export{t as BunnyFile,r as BunnyMetaStorage,n as BunnyStorage};
@@ -1,6 +1,6 @@
1
- import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-RteRC-cG.js";
1
+ import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, f as FilePart, g as FileQuery, a as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-X6TimMHY.js";
2
2
  import 'node:stream';
3
- import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-B11vHYNm.js";
3
+ import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-CuvN-KQ3.js";
4
4
  import { v2 } from 'cloudinary';
5
5
  import 'node:crypto';
6
6
  import 'node:http';
@@ -1 +1 @@
1
- import{default as r}from"../../packem_shared/CloudinaryFile-B5-m33eS.js";import{default as t}from"../../packem_shared/CloudinaryMetaStorage-DEBk5eQy.js";import{default as d}from"../../packem_shared/CloudinaryStorage-BBE2-aVz.js";export{r as CloudinaryFile,t as CloudinaryMetaStorage,d as CloudinaryStorage};
1
+ import{default as r}from"../../packem_shared/CloudinaryFile-B5-m33eS.js";import{default as t}from"../../packem_shared/CloudinaryMetaStorage-BzibHydK.js";import{default as d}from"../../packem_shared/CloudinaryStorage-Cj00ZXWV.js";export{r as CloudinaryFile,t as CloudinaryMetaStorage,d as CloudinaryStorage};