@visulima/storage 1.0.0-alpha.25 → 1.0.0-alpha.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/LICENSE.md +0 -1104
- package/README.md +79 -466
- package/dist/adapter/nuxt/module.d.ts +4 -4
- package/dist/adapter/nuxt/node_modules/.bin/nuxi +22 -0
- package/dist/adapter/nuxt/node_modules/.bin/nuxt +22 -0
- package/dist/ai/ai-sdk/index.d.ts +113 -0
- package/dist/ai/ai-sdk/index.js +1 -0
- package/dist/ai/claude/index.d.ts +177 -0
- package/dist/ai/claude/index.js +1 -0
- package/dist/ai/openai/index.d.ts +205 -0
- package/dist/ai/openai/index.js +1 -0
- package/dist/ai/tanstack/index.d.ts +115 -0
- package/dist/ai/tanstack/index.js +1 -0
- package/dist/handler/http/fetch/index.d.ts +13 -7
- package/dist/handler/http/fetch/index.js +1 -1
- package/dist/handler/http/hono/index.d.ts +5 -1412
- package/dist/handler/http/hono/index.js +1 -1
- package/dist/handler/http/nextjs/index.d.ts +4 -4
- package/dist/handler/http/nextjs/index.js +1 -1
- package/dist/handler/http/node/index.d.ts +7 -7
- package/dist/handler/http/node/index.js +1 -1
- package/dist/handler/http/solid-start/index.d.ts +4 -4
- package/dist/handler/http/solid-start/index.js +1 -1
- package/dist/index.d.ts +6 -324
- package/dist/index.js +1 -1
- package/dist/packem_shared/{AwsLightFile-BTLiRxXj.js → AwsLightFile-BSqjc_rD.js} +1 -1
- package/dist/packem_shared/{AwsLightStorage-CA9cdfJ6.js → AwsLightStorage-SH7j-myh.js} +1 -1
- package/dist/packem_shared/{AzureFile-BKHru1zB.js → AzureFile-Dgj2Tef4.js} +1 -1
- package/dist/packem_shared/{AzureSMetaStorage-BqA4jUDJ.js → AzureSMetaStorage-DV2tNjKh.js} +1 -1
- package/dist/packem_shared/AzureStorage-BVYMFEBP.js +1 -0
- package/dist/packem_shared/BaseTransformer-Fpcuz4kj.js +1 -0
- package/dist/packem_shared/BoxFile-Be0S4N1L.js +1 -0
- package/dist/packem_shared/BoxMetaStorage-BUe5Qmqe.js +1 -0
- package/dist/packem_shared/BoxStorage-CgC81_So.js +1 -0
- package/dist/packem_shared/BunnyFile-Dotl-lO9.js +1 -0
- package/dist/packem_shared/BunnyMetaStorage-D0mT6veJ.js +1 -0
- package/dist/packem_shared/BunnyStorage-Bl4usdVT.js +1 -0
- package/dist/packem_shared/DiskStorage-B5uIDVXr.js +1 -0
- package/dist/packem_shared/DiskStorageWithChecksum-CbXWpSOr.js +1 -0
- package/dist/packem_shared/DropboxFile-BGVG2kXM.js +1 -0
- package/dist/packem_shared/DropboxMetaStorage-CICuUZ1n.js +1 -0
- package/dist/packem_shared/DropboxStorage-CPjhDN5B.js +1 -0
- package/dist/packem_shared/ERRORS-CyOuSMLY.js +1 -0
- package/dist/packem_shared/File-BhfUgJjs.js +1 -0
- package/dist/packem_shared/Files-B7hlJcB4.js +1 -0
- package/dist/packem_shared/{GCSFile-CHjX_fJk.js → GCSFile-CDQ6IWAz.js} +1 -1
- package/dist/packem_shared/{GCSMetaStorage-BQkYQUDn.js → GCSMetaStorage-CqP9ifYB.js} +1 -1
- package/dist/packem_shared/GCStorage-XSBKVx90.js +1 -0
- package/dist/packem_shared/GoogleDriveFile-D0aGfGbL.js +1 -0
- package/dist/packem_shared/GoogleDriveMetaStorage-rghGy3Fa.js +1 -0
- package/dist/packem_shared/GoogleDriveStorage-DuB6glUk.js +1 -0
- package/dist/packem_shared/LocalMetaStorage-B5uh1snG.js +1 -0
- package/dist/packem_shared/MediaTransformer-D-1c9Q_k.js +1 -0
- package/dist/packem_shared/Multipart-7FSSy2n1.js +1 -0
- package/dist/packem_shared/Multipart-DACQFsrn.js +1 -0
- package/dist/packem_shared/{NetlifyBlobFile-CpzkMKng.js → NetlifyBlobFile-PMZLJ8AC.js} +1 -1
- package/dist/packem_shared/NetlifyBlobMetaStorage-BcRFPky8.js +1 -0
- package/dist/packem_shared/NetlifyBlobStorage-C4qkJv1R.js +1 -0
- package/dist/packem_shared/OneDriveFile-XbVVKIJh.js +1 -0
- package/dist/packem_shared/OneDriveMetaStorage-B_BkGLzW.js +1 -0
- package/dist/packem_shared/OneDriveStorage-Cu0cGcrh.js +1 -0
- package/dist/packem_shared/Rest-5NwM1xYj.js +1 -0
- package/dist/packem_shared/{Rest-CYEBbtCD.js → Rest-y8Vz2Rt0.js} +1 -1
- package/dist/packem_shared/{S3File-Du6wP0Sz.js → S3File-BfmCOET4.js} +1 -1
- package/dist/packem_shared/S3Storage-D8dopWoO.js +1 -0
- package/dist/packem_shared/SupabaseFile-DZ1iv9gM.js +1 -0
- package/dist/packem_shared/SupabaseMetaStorage-BR1UGqnj.js +1 -0
- package/dist/packem_shared/SupabaseStorage-CCtMTiN5.js +1 -0
- package/dist/packem_shared/{Tus-CUBCkuPE.js → Tus-BCVAbJIi.js} +1 -1
- package/dist/packem_shared/Tus-CJMcygk7.js +1 -0
- package/dist/packem_shared/UploadThingFile-BpG9mE8K.js +1 -0
- package/dist/packem_shared/UploadThingMetaStorage-DyGNyaAq.js +1 -0
- package/dist/packem_shared/UploadThingStorage-B_fNzNFO.js +1 -0
- package/dist/packem_shared/{VercelBlobFile-CL9MjKcY.js → VercelBlobFile-Cni_1qwD.js} +1 -1
- package/dist/packem_shared/{VercelBlobMetaStorage-BsOTx-Su.js → VercelBlobMetaStorage-Do9ZoKrl.js} +1 -1
- package/dist/packem_shared/VercelBlobStorage-D5zy4PPQ.js +1 -0
- package/dist/packem_shared/agentsListFiles-R-CnGKc4.js +1 -0
- package/dist/packem_shared/akamai-BYS9pP8S.js +1 -0
- package/dist/packem_shared/approval-BBeX3o4E.js +1 -0
- package/dist/packem_shared/approval.d-CMAYH9GF.d.ts +75 -0
- package/dist/packem_shared/backblaze-CvdtCvJL.js +1 -0
- package/dist/packem_shared/base-handler-core-BfwZ1RS1.js +1 -0
- package/dist/packem_shared/base-handler-fetch-CLxqXTQf.js +1 -0
- package/dist/packem_shared/base-handler-node-DBZjcqsp.js +1 -0
- package/dist/packem_shared/claudeListFiles-DAezbKEi.js +1 -0
- package/dist/packem_shared/cloudflare-Bm_Pg6yx.js +1 -0
- package/dist/packem_shared/createResponsesFileTools-BCep-qdO.js +1 -0
- package/dist/packem_shared/defaultCloudStorageFileNameValidation-6URTv-Mp.js +1 -0
- package/dist/packem_shared/detect-file-type-5JhzC9RU.js +1 -0
- package/dist/packem_shared/digitalOcean-Lj1NfDzc.js +1 -0
- package/dist/packem_shared/disk-storage-CbSSPnOf.js +5 -0
- package/dist/packem_shared/{disk-storage-with-checksum.d-B5D9I_CA.d.ts → disk-storage-with-checksum.d-BQMXA4Wl.d.ts} +6 -4
- package/dist/packem_shared/executors-DG6hGtvm.js +1 -0
- package/dist/packem_shared/executors.d-UtkeCbk1.d.ts +65 -0
- package/dist/packem_shared/{gcs-meta-storage-CNiEWerS.js → gcs-meta-storage-XB-UPJn6.js} +1 -1
- package/dist/packem_shared/hetzner-DDxE7Gy7.js +1 -0
- package/dist/packem_shared/index.d-DotjipuX.d.ts +89 -0
- package/dist/packem_shared/isRetryableError-B6ZS_-5I.js +1 -0
- package/dist/packem_shared/listFiles-B6VF05d-.js +1 -0
- package/dist/packem_shared/listFiles-BtP6VnUp.js +1 -0
- package/dist/packem_shared/{local-meta-storage-Bkwqi_gi.js → local-meta-storage-CT1audnK.js} +1 -1
- package/dist/packem_shared/{local-meta-storage.d-rO44cnQ5.d.ts → local-meta-storage.d-B5R1nswK.d.ts} +2 -1
- package/dist/packem_shared/{media-transformer.d-BXjTN5Qv.d.ts → media-transformer.d-DK7NJncf.d.ts} +2 -2
- package/dist/packem_shared/minio-T_Z3iEy7.js +1 -0
- package/dist/packem_shared/multipart-base-BxckfvQf.js +1 -0
- package/dist/packem_shared/oauth-refresh-Dg2ybc6_.js +1 -0
- package/dist/packem_shared/part-match-B5fLLmFw.js +1 -0
- package/dist/packem_shared/rest-base-CCv78k7h.js +1 -0
- package/dist/packem_shared/s3-base-storage-f_EyFAAt.js +1 -0
- package/dist/packem_shared/{s3-base-storage.d-Ccatb1dO.d.ts → s3-base-storage.d-BROGYJ4F.d.ts} +1 -1
- package/dist/packem_shared/storage-CoyB2O-Y.js +1 -0
- package/dist/packem_shared/{storage.d-sc8gn16g.d.ts → storage.d-Cr6f2lac.d.ts} +118 -17
- package/dist/packem_shared/storj-CVA9mM-7.js +1 -0
- package/dist/packem_shared/tigris-wmhjfsH2.js +1 -0
- package/dist/packem_shared/{tus-base.d-BX3mSWL6.d.ts → tus-base.d-4-ZfDQwl.d.ts} +3 -3
- package/dist/packem_shared/{types.d-Cor8FV54.d.ts → types.d-BgCmSE94.d.ts} +2 -2
- package/dist/packem_shared/{types.d-b0WcdT0x.d.ts → types.d-C8eSxqX9.d.ts} +14 -2
- package/dist/packem_shared/wasabi-JQzxdrFy.js +1 -0
- package/dist/storage/aws/clients/index.d.ts +90 -15
- package/dist/storage/aws/clients/index.js +1 -1
- package/dist/storage/aws/index.d.ts +16 -15
- package/dist/storage/aws/index.js +1 -1
- package/dist/storage/aws-light/index.d.ts +5 -3
- package/dist/storage/aws-light/index.js +1 -1
- package/dist/storage/azure/index.d.ts +4 -10277
- package/dist/storage/azure/index.js +1 -1
- package/dist/storage/box/index.d.ts +186 -0
- package/dist/storage/box/index.js +1 -0
- package/dist/storage/bunny/index.d.ts +116 -0
- package/dist/storage/bunny/index.js +1 -0
- package/dist/storage/dropbox/index.d.ts +129 -0
- package/dist/storage/dropbox/index.js +1 -0
- package/dist/storage/gcs/index.d.ts +6 -3941
- package/dist/storage/gcs/index.js +1 -1
- package/dist/storage/google-drive/index.d.ts +145 -0
- package/dist/storage/google-drive/index.js +1 -0
- package/dist/storage/local/index.d.ts +3 -3
- package/dist/storage/local/index.js +1 -1
- package/dist/storage/netlify-blob/index.d.ts +4 -2
- package/dist/storage/netlify-blob/index.js +1 -1
- package/dist/storage/onedrive/index.d.ts +192 -0
- package/dist/storage/onedrive/index.js +1 -0
- package/dist/storage/supabase/index.d.ts +111 -0
- package/dist/storage/supabase/index.js +1 -0
- package/dist/storage/uploadthing/index.d.ts +91 -0
- package/dist/storage/uploadthing/index.js +1 -0
- package/dist/storage/vercel-blob/index.d.ts +17 -2
- package/dist/storage/vercel-blob/index.js +1 -1
- package/dist/transformer/audio-transformer.d.ts +2 -2
- package/dist/transformer/audio-transformer.js +1 -1
- package/dist/transformer/image-transformer.d.ts +6 -2
- package/dist/transformer/image-transformer.js +1 -1
- package/dist/transformer/index.d.ts +3 -3
- package/dist/transformer/index.js +1 -1
- package/dist/transformer/video-transformer.d.ts +2 -2
- package/dist/transformer/video-transformer.js +1 -1
- package/package.json +99 -3
- package/dist/packem_shared/AzureStorage-BKUjCymW.js +0 -1
- package/dist/packem_shared/BaseTransformer-D68eLyz1.js +0 -1
- package/dist/packem_shared/DiskStorage-DNjpDMX9.js +0 -1
- package/dist/packem_shared/DiskStorageWithChecksum-Bb6JX_tC.js +0 -1
- package/dist/packem_shared/ERRORS-B9jkvKwx.js +0 -1
- package/dist/packem_shared/File-alcSNpLq.js +0 -1
- package/dist/packem_shared/GCStorage-C8hxSNLM.js +0 -1
- package/dist/packem_shared/LocalMetaStorage-BWuFvWn4.js +0 -1
- package/dist/packem_shared/MediaTransformer-2C8MJeAg.js +0 -1
- package/dist/packem_shared/Multipart-Bd9YFFn0.js +0 -1
- package/dist/packem_shared/Multipart-D5bcEvga.js +0 -1
- package/dist/packem_shared/NetlifyBlobMetaStorage-dD0oBLom.js +0 -1
- package/dist/packem_shared/NetlifyBlobStorage-ByTwCN-h.js +0 -1
- package/dist/packem_shared/Rest-DoonVU7B.js +0 -1
- package/dist/packem_shared/S3Client.d-CZ62Jztg.d.ts +0 -20357
- package/dist/packem_shared/S3Storage-Fx6-OSc-.js +0 -1
- package/dist/packem_shared/Tus-Bd_2Ki2G.js +0 -1
- package/dist/packem_shared/VercelBlobStorage-kNkk5Cn4.js +0 -1
- package/dist/packem_shared/backblaze-DEflv87m.js +0 -1
- package/dist/packem_shared/base-handler-core-DaggCVsq.js +0 -1
- package/dist/packem_shared/base-handler-fetch-DnarP64X.js +0 -1
- package/dist/packem_shared/base-handler-node-BTes6sql.js +0 -1
- package/dist/packem_shared/cloudflare-DLAeQvgD.js +0 -1
- package/dist/packem_shared/defaultCloudStorageFileNameValidation-yiM9GxHr.js +0 -1
- package/dist/packem_shared/digitalOcean-nhZUds87.js +0 -1
- package/dist/packem_shared/disk-storage-BvdK4bqF.js +0 -5
- package/dist/packem_shared/isRetryableError-DQNSZiBc.js +0 -1
- package/dist/packem_shared/minio-BWwgGXeE.js +0 -1
- package/dist/packem_shared/multipart-base-C6OjBwMS.js +0 -1
- package/dist/packem_shared/part-match-DqD5U7An.js +0 -1
- package/dist/packem_shared/rest-base-B2Dv7esY.js +0 -1
- package/dist/packem_shared/s3-base-storage-xHZNtsGe.js +0 -1
- package/dist/packem_shared/storage-m_Cxgiih.js +0 -1
- package/dist/packem_shared/tigris-DZoyrMNd.js +0 -1
- package/dist/packem_shared/validator-DK41xp8N.js +0 -1
- package/dist/packem_shared/wasabi-Dmce4x9s.js +0 -1
package/dist/packem_shared/{s3-base-storage.d-Ccatb1dO.d.ts → s3-base-storage.d-BROGYJ4F.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
|
-
import { F as File, M as MetaStorage, d as createRetryWrapper, e as FileInit, B as BaseStorage, R as RetryConfig, f as FilePart, g as FileQuery, a as FileReturn } from "./storage.d-
|
|
2
|
+
import { F as File, M as MetaStorage, d as createRetryWrapper, e as FileInit, B as BaseStorage, R as RetryConfig, f as FilePart, g as FileQuery, a as FileReturn } from "./storage.d-Cr6f2lac.js";
|
|
3
3
|
/**
|
|
4
4
|
* Part interface for multipart uploads.
|
|
5
5
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var H=Object.defineProperty;var h=(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-B718mbm6.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{o as ie}from"./is-expired-1JuZjDtb.js";var ne=Object.defineProperty,ce=h((t,e)=>ne(t,"name",{value:e,configurable:!0}),"y$3"),le=Object.defineProperty,ue=ce((t,e)=>le(t,"name",{value:e,configurable:!0}),"y"),me=Object.defineProperty,S=ue((t,e)=>me(t,"name",{value:e,configurable:!0}),"i");const de=/^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i,ge=/^KIBI/,he=/^MIBI/,pe=/^GIBI/,fe=/^TEBI/,ye=/^PEBI/,be=/^EXBI/,we=/^ZEBI/,ve=/^YIBI/,Ee=/^(.)IB$/,_={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"}]},$e=S((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"),F=S(t=>{switch(t){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},"fromBase"),j=S((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=$e(o.value,r.locale),i=(o.type??"Bytes").toUpperCase().replace(ge,"KILO").replace(he,"MEGA").replace(pe,"GIGA").replace(fe,"TERA").replace(ye,"PETA").replace(be,"EXA").replace(we,"ZETTA").replace(ve,"YOTTA").replace(Ee,"$1B"),n=_[r.units].findIndex(c=>c.short[0].toUpperCase()===i[0]),l=F(r.base);return s*l**n},"parseBytes");S((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:i,unit:n,units:l,...c}={base:2,decimals:0,locale:"en-US",long:!1,units:"metric",...e},a=F(r),m=Math.abs(t),u=e?.space??!0?" ":"",d=_[l],g=d.findIndex(w=>w.short===n);if(t===0){const w=Math.min(0,Math.max(g,d.length-1));return"0"+u+d[w][i?"long":"short"]}const y=g===-1?Math.min(Math.floor(Math.log(m)/Math.log(a)),d.length-1):g,N=d[y][i?"long":"short"],O=t/a**y,v=o<0?void 0:o;return new Intl.NumberFormat(s,{maximumFractionDigits:v,minimumFractionDigits:v,...c}).format(O)+u+N},"formatBytes");var xe=Object.defineProperty,Me=h((t,e)=>xe(t,"name",{value:e,configurable:!0}),"u$3"),Ne=Object.defineProperty,Oe=Me((t,e)=>Ne(t,"name",{value:e,configurable:!0}),"v"),Ae=Object.defineProperty,Te=Oe((t,e)=>Ae(t,"name",{value:e,configurable:!0}),"D");const Se=Te((t,e,r,o,s,i,n,l,c,a,m,u,d,g)=>{const y={d:o,h:s,m:i,mo:e,ms:l,s:n,w:r,y:t};return c!==void 0&&(y.future=c),a!==void 0&&(y.past=a),m!==void 0&&(y.decimal=m),u!==void 0&&(y.unitMap=u),d!==void 0&&(y.groupSeparator=d),g!==void 0&&(y.placeholderSeparator=g),y},"createDurationLanguage"),L={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"},Ce=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",".",L,",","_");var Ie=Object.defineProperty,Be=h((t,e)=>Ie(t,"name",{value:e,configurable:!0}),"o"),Pe=Object.defineProperty,De=Be((t,e)=>Pe(t,"name",{value:e,configurable:!0}),"o"),Ue=Object.defineProperty,ze=De((t,e)=>Ue(t,"name",{value:e,configurable:!0}),"o");const je=ze(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 ke=Object.defineProperty,_e=h((t,e)=>ke(t,"name",{value:e,configurable:!0}),"w$1"),Fe=Object.defineProperty,Le=_e((t,e)=>Fe(t,"name",{value:e,configurable:!0}),"S"),Re=Object.defineProperty,Ve=Le((t,e)=>Re(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,Ge=/^PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?$/i,Ye=/^(?:(\d+):)?(?:(\d+):)?(\d+)$/,Ze=/^[+-]?\d+(?:\.\d+)?$/,Ke=/^[-+]/,We=Ve((t,e)=>{if(typeof t!="string"||t.length===0)return;const{defaultUnit:r="ms",language:o=Ce}=e??{};je(o);const s=o.decimal??".",i=o.groupSeparator??",",n=o.placeholderSeparator??"_",l=s.replaceAll(A,String.raw`\$&`),c=i.replaceAll(A,String.raw`\$&`),a=n.replaceAll(A,String.raw`\$&`),m=o.unitMap??L;let u=t.replaceAll(new RegExp(String.raw`(\d)[${a}${c}](\d)`,"g"),"$1$2");if(s!=="."&&(u=u.replace(l,".")),Ze.test(t)){const p=Number.parseFloat(u.trim());if(!Number.isNaN(p)){const f=m[r];if(f!==void 0)return p*k[f]}return}const d=Ge.exec(t);if(d){const p=Number.parseInt(d[1]??"0",10),f=Number.parseInt(d[2]??"0",10),x=Number.parseInt(d[3]??"0",10);return p*36e5+f*6e4+x*1e3}const g=Ye.exec(t);if(g){let p=0,f=0;g[2]!==void 0?(p=Number.parseInt(g[1]??"0",10),f=Number.parseInt(g[2],10)):g[1]!==void 0&&(f=Number.parseInt(g[1],10));const x=Number.parseInt(g[3]??"0",10);return p*36e5+f*6e4+x*1e3}const y=Object.keys(m).toSorted((p,f)=>f.length-p.length).map(p=>p.replaceAll(A,String.raw`\$&`)).join("|"),N=new RegExp(String.raw`(-?\d*\.?\d+)\s*(${y})`,"gi");let O=0,v,w=!1,P=-1,D=0;for(N.lastIndex=0;(v=N.exec(u))!==null;){w||(P=v.index),w=!0;const p=v[1],f=v[2];if(!p||!f)continue;const x=p.trim(),K=x.startsWith("-")?-1:1,W=x.replace(Ke,""),U=Number.parseFloat(W),z=m[f.toLowerCase()];if(z===void 0)continue;const q=k[z];if(Number.isNaN(U))return;O+=K*U*q,D=N.lastIndex}const Y=u.slice(0,P).trim(),Z=u.slice(D).trim();if(!(w&&(Y.length>0||Z.length>0))&&w)return O},"parseDuration");var qe=Object.defineProperty,He=h((t,e)=>qe(t,"name",{value:e,configurable:!0}),"n$1");let Xe=class extends ae{static{h(this,"u")}static{He(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 Je=Object.defineProperty,Qe=h((t,e)=>Je(t,"name",{value:e,configurable:!0}),"e$1");const T=Qe(t=>{if(t===Number(t))return t;if(!t)return;const e=We(t);if(e!==void 0)return e},"toMilliseconds");var et=Object.defineProperty,tt=h((t,e)=>et(t,"name",{value:e,configurable:!0}),"t");let rt=class extends Error{static{h(this,"d")}static{tt(this,"ValidationError")}code;statusCode;body;headers;name="ValidationError";constructor(e,r,o,s){const i=typeof o=="string"?o:o?.message||"Validation error";super(i),this.code=e,this.statusCode=r,this.body=o,this.headers=s}};var ot=Object.defineProperty,C=h((t,e)=>ot(t,"name",{value:e,configurable:!0}),"e");const st=C(t=>t&&t[0].toUpperCase()+t.slice(1),"capitalize"),at=C(t=>{if(!Array.isArray(t))return t;const[e,r,o]=t;return{body:r,headers:o,statusCode:e}},"toResponse");class it{static{h(this,"Validator")}constructor(e="ValidationError"){this.prefix=e}prefix;static{C(this,"Validator")}validators={};add(e){Object.entries(e).forEach(([r,o])=>{const s=`${this.prefix}${st(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),i=at(s),{body:n,headers:l,message:c,statusCode:a}=i;throw new rt(r,a,n||c,l)}}}const Tt=C(t=>t.name==="ValidationError","isValidationError");var nt=Object.defineProperty,B=h((t,e)=>nt(t,"name",{value:e,configurable:!0}),"i");const ct=B(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"),R=B((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 i=r[o],n=i&&typeof i=="object"&&!Array.isArray(i)?i:{};r[o]=R(n,s)}else r[o]=s}),r},"deepMerge"),lt=B((t,e)=>{const r=R(t,e);Object.assign(t,r),t.originalName=ct(t.metadata)||t.originalName},"updateMetadata");var ut=Object.defineProperty,b=h((t,e)=>ut(t,"name",{value:e,configurable:!0}),"g");const mt=/(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"&&mt.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:{}},gt=b(t=>!t||t.length<3||t.length>255||I(t)?!1:!(t.toUpperCase().includes("../")||t.includes("\0")),"defaultCloudStorageFileNameValidation"),St=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{h(this,"BaseStorage")}static{b(this,"BaseStorage")}onCreate;onUpdate;onComplete;onDelete;onError;isReady=!0;errorResponses={};cache;logger;metrics;genericConfig;maxMetadataSize;checksumTypes=[];maxUploadSize;expiration;locker;namingFunction;validation=new it;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 Xe({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(c){if(c.size===void 0)return!0;const a=c.size;if(a==null)return!1;const m=typeof a=="number"?a:Number(a);if(Number.isNaN(m)||m<0)return!1;const u=typeof this.value=="number"?this.value:Number(this.value);return!Number.isNaN(u)&&m<=u},response:M.RequestEntityTooLarge,value:this.maxUploadSize},i={isValid(c){return!!te.is(c.contentType,this.value)},response:M.UnsupportedMediaType,value:r.allowMIME},n=r.fileNameValidation??gt,l={isValid(c){return n(c.name)},response:M.InvalidFileName};this.validation.add({filename:l,mime:i,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){return this.instrumentOperation("exists",async()=>{try{return await this.getMeta(e.id),!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){try{const r=await this.meta.get(e);return this.cache.set(r.id,r),{...r}}catch(r){const o=this.normalizeError(r instanceof Error?r:new Error(String(r)));return await this.onError(o),E($.FILE_NOT_FOUND)}}async checkIfExpired(e){return ie(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,i=(await this.list()).filter(n=>Number(new Date(this.expiration?.rolling&&n.modifiedAt||n.createdAt))<s);for await(const{id:n,...l}of i)try{const c=await this.delete({id:n});o.items.push({...c,...l})}catch(c){this.logger?.warn(`Failed to delete file ${n} during purge: ${c instanceof Error?c.message:String(c)}`)}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){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 n=s.ttl,l=typeof n=="string"?T(n):n;l!==void 0&&(s.expiredAt=Date.now()+l),delete s.ttl}lt(o,s),await this.saveMeta(o);const i={...o,status:"updated"};return await this.onUpdate(i),i})}async deleteBatch(e){const r=Date.now(),o=this.constructor.name.toLowerCase().replace("storage","");this.metrics.increment("storage.operations.batch.delete.count",1,{batch_size:e.length,storage:o});const s=[],i=[],n=e.map(async a=>{try{return{file:await this.delete({id:a}),id:a,success:!0}}catch(m){const u=m instanceof Error?m.message:"Delete failed";return this.metrics.increment("storage.operations.delete.error.count",1,{error:u,storage:o}),{error:u,id:a,success:!1}}}),l=await Promise.allSettled(n);for(const a of l)a.status==="fulfilled"?a.value.success?s.push(a.value.file):i.push({error:a.value.error,id:a.value.id}):i.push({error:a.reason?.message||"Delete failed",id:""});const c=Date.now()-r;return this.metrics.timing("storage.operations.batch.delete.duration",c,{batch_size:e.length,storage:o}),this.metrics.gauge("storage.operations.batch.delete.success_count",s.length,{storage:o}),this.metrics.gauge("storage.operations.batch.delete.failed_count",i.length,{storage:o}),{failed:i,failedCount:i.length,successful:s,successfulCount:s.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=[],i=[],n=e.map(async({destination:a,options:m,source:u})=>{try{return{file:await this.copy(u,a,m),id:a,success:!0}}catch(d){const g=d instanceof Error?d.message:"Copy failed";return this.metrics.increment("storage.operations.copy.error.count",1,{error:g,storage:o}),{error:g,id:a,success:!1}}}),l=await Promise.allSettled(n);for(const a of l)a.status==="fulfilled"?a.value.success&&a.value.file?s.push(a.value.file):i.push({error:a.value.error||"Copy failed",id:a.value.id}):i.push({error:a.reason?.message||"Copy failed",id:""});const c=Date.now()-r;return this.metrics.timing("storage.operations.batch.copy.duration",c,{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",i.length,{storage:o}),{failed:i,failedCount:i.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=[],i=[],n=e.map(async({destination:a,source:m})=>{try{return{file:await this.move(m,a),id:a,success:!0}}catch(u){const d=u instanceof Error?u.message:"Move failed";return this.metrics.increment("storage.operations.move.error.count",1,{error:d,storage:o}),{error:d,id:a,success:!1}}}),l=await Promise.allSettled(n);for(const a of l)a.status==="fulfilled"?a.value.success&&a.value.file?s.push(a.value.file):i.push({error:a.value.error||"Move failed",id:a.value.id}):i.push({error:a.reason?.message||"Move failed",id:a.reason?.id||""});const c=Date.now()-r;return this.metrics.timing("storage.operations.batch.move.duration",c,{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",i.length,{storage:o}),{failed:i,failedCount:i.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}async instrumentOperation(e,r,o){const s=Date.now(),i={storage:this.constructor.name.toLowerCase().replace("storage",""),...o};try{this.metrics.increment(`storage.operations.${e}.count`,1,i);const n=await r(),l=Date.now()-s;return this.metrics.timing(`storage.operations.${e}.duration`,l,i),n&&typeof n=="object"&&"size"in n&&typeof n.size=="number"&&this.metrics.gauge("storage.files.size",n.size,{...i,operation:e}),n}catch(n){const l=Date.now()-s,c=n instanceof Error?n.message:"Unknown error";throw this.metrics.timing(`storage.operations.${e}.duration`,l,{...i,error:"true"}),this.metrics.increment(`storage.operations.${e}.error.count`,1,{...i,error:c}),n}}}export{j as $,G as B,St as a,rt as b,gt as d,Tt as i,T as t,lt as u,We as z};
|
|
@@ -14,6 +14,13 @@ interface Cache<K = string, V = unknown> {
|
|
|
14
14
|
get: (key: K) => V | undefined | Promise<V | undefined>;
|
|
15
15
|
/** Check if a key exists in cache */
|
|
16
16
|
has: (key: K) => boolean | Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* Optional. Iterate over the cache's current keys. Required for prefix-based
|
|
19
|
+
* eviction (`clearCache(fileId)` in transformers) — when absent, per-file
|
|
20
|
+
* clear falls back to a full `clear()`. `LRUCache` from `lru-cache`
|
|
21
|
+
* satisfies this out of the box.
|
|
22
|
+
*/
|
|
23
|
+
keys?: () => Iterable<K>;
|
|
17
24
|
/** Set a value in cache */
|
|
18
25
|
set: (key: K, value: V, options?: CacheOptions) => boolean | Promise<boolean>;
|
|
19
26
|
}
|
|
@@ -192,6 +199,47 @@ declare class UploadError extends Error {
|
|
|
192
199
|
*/
|
|
193
200
|
declare const isUploadError: (error: unknown) => error is UploadError;
|
|
194
201
|
/**
|
|
202
|
+
* Best-effort extraction of an HTTP status from a native SDK error.
|
|
203
|
+
*
|
|
204
|
+
* Covers the shapes used by the consumer-provider SDKs:
|
|
205
|
+
* - Dropbox `DropboxResponseError` → `error.status`
|
|
206
|
+
* - Box `BoxAPIError` / Microsoft Graph errors → `error.statusCode`
|
|
207
|
+
* - googleapis errors → `error.code` (numeric) or `error.response.status`
|
|
208
|
+
* - Supabase / fetch-style errors → `error.status` or `error.response.status`
|
|
209
|
+
*/
|
|
210
|
+
declare const extractHttpStatus: (error: unknown) => number | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Map an HTTP status code to the closest canonical ERRORS value.
|
|
213
|
+
*
|
|
214
|
+
* Returns STORAGE_ERROR for unknown/5xx and BAD_REQUEST for unmapped 4xx.
|
|
215
|
+
* 401 (unauthenticated) collapses to FORBIDDEN because the ERRORS enum has
|
|
216
|
+
* no dedicated UNAUTHORIZED value; callers needing to distinguish the two
|
|
217
|
+
* should inspect the native error on `UploadError.detail`.
|
|
218
|
+
*/
|
|
219
|
+
declare const mapStatusToErrorCode: (status?: number) => ERRORS;
|
|
220
|
+
/**
|
|
221
|
+
* Normalize a native storage-SDK error into an `UploadError`.
|
|
222
|
+
*
|
|
223
|
+
* The native error is preserved on `.detail` so advanced callers can drop down
|
|
224
|
+
* to provider-specific shapes when needed. Already-wrapped `UploadError`
|
|
225
|
+
* instances pass through unchanged.
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* try {
|
|
229
|
+
* await client.filesCopyV2({ from_path, to_path });
|
|
230
|
+
* } catch (error) {
|
|
231
|
+
* throw wrapStorageError(error, { adapter: "Dropbox", operation: "copy" });
|
|
232
|
+
* }
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
declare const wrapStorageError: (error: unknown, options: {
|
|
236
|
+
adapter: string;
|
|
237
|
+
code?: ERRORS;
|
|
238
|
+
message?: string;
|
|
239
|
+
operation: string;
|
|
240
|
+
status?: number;
|
|
241
|
+
}) => UploadError;
|
|
242
|
+
/**
|
|
195
243
|
* Convenience function to throw an UploadError from a string error code.
|
|
196
244
|
* Looks up the appropriate error message from ErrorMap.
|
|
197
245
|
* @param UploadErrorCode String error code to convert to UploadError
|
|
@@ -202,26 +250,27 @@ declare const throwErrorCode: (UploadErrorCode: ERRORS | string, detail?: string
|
|
|
202
250
|
/**
|
|
203
251
|
* A simple lock map keyed by strings, backed by LRUCache. Locks
|
|
204
252
|
* automatically expire according to the configured TTL preventing deadlocks.
|
|
253
|
+
*
|
|
254
|
+
* Each successful `lock()` returns a unique token; the corresponding `unlock(key, token)`
|
|
255
|
+
* call only releases the lock when the token matches the current holder. This prevents a
|
|
256
|
+
* stale lock owner (e.g. one whose entry TTL'd out and was re-acquired by another caller)
|
|
257
|
+
* from releasing another caller's lock by accident.
|
|
205
258
|
*/
|
|
206
|
-
declare class Locker<K extends string = string
|
|
207
|
-
|
|
208
|
-
* Creates a new Locker instance with configurable TTL and cache options.
|
|
209
|
-
* @param options LRU cache configuration options
|
|
210
|
-
*/
|
|
211
|
-
constructor(options?: LRUCache.Options<K, V, number>);
|
|
259
|
+
declare class Locker<K extends string = string> extends LRUCache<K, string, number> {
|
|
260
|
+
constructor(options?: LRUCache.Options<K, string, number>);
|
|
212
261
|
/**
|
|
213
262
|
* Acquires a lock for the specified key.
|
|
214
|
-
*
|
|
215
|
-
* @
|
|
216
|
-
* @returns The lock token (same as the key)
|
|
217
|
-
* @throws Error if the key is already locked
|
|
263
|
+
* @returns A unique token identifying the lock holder.
|
|
264
|
+
* @throws Error if the key is already locked.
|
|
218
265
|
*/
|
|
219
266
|
lock(key: K): string;
|
|
220
267
|
/**
|
|
221
|
-
* Releases the lock for the specified key.
|
|
222
|
-
*
|
|
268
|
+
* Releases the lock for the specified key, but only if the token matches the current holder.
|
|
269
|
+
* Silently no-ops when the lock has expired or is owned by someone else — releasing somebody
|
|
270
|
+
* else's lock is worse than leaving a stale entry to TTL out on its own.
|
|
271
|
+
* @returns true if the lock was released, false if it was already gone or owned by another caller.
|
|
223
272
|
*/
|
|
224
|
-
unlock(key: K):
|
|
273
|
+
unlock(key: K, token: string): boolean;
|
|
225
274
|
}
|
|
226
275
|
/**
|
|
227
276
|
* Configurable validation system for file upload constraints.
|
|
@@ -278,13 +327,19 @@ declare class Metadata {
|
|
|
278
327
|
interface FileInit {
|
|
279
328
|
contentType?: string;
|
|
280
329
|
expiredAt?: Date | number | string;
|
|
330
|
+
/**
|
|
331
|
+
* Explicit identifier. When provided, the File constructor uses it directly
|
|
332
|
+
* instead of deriving an id from originalName/size/mtime. Lets callers map a
|
|
333
|
+
* user-chosen storage key (e.g. `"avatars/abc.png"`) onto the metadata id.
|
|
334
|
+
*/
|
|
335
|
+
id?: string;
|
|
281
336
|
metadata: Metadata;
|
|
282
337
|
originalName?: string;
|
|
283
338
|
size?: number | string;
|
|
284
339
|
storageClass?: string;
|
|
285
340
|
ttl?: number | string;
|
|
286
341
|
}
|
|
287
|
-
interface FileReturn extends Omit<Required<FileInit>, "storageClass" | "ttl" | "expiredAt"> {
|
|
342
|
+
interface FileReturn extends Omit<Required<FileInit>, "id" | "storageClass" | "ttl" | "expiredAt"> {
|
|
288
343
|
content: Buffer;
|
|
289
344
|
ETag?: string;
|
|
290
345
|
expiredAt?: Date | number | string;
|
|
@@ -331,6 +386,7 @@ declare class File implements FileInit {
|
|
|
331
386
|
constructor({
|
|
332
387
|
contentType,
|
|
333
388
|
expiredAt,
|
|
389
|
+
id,
|
|
334
390
|
metadata,
|
|
335
391
|
originalName,
|
|
336
392
|
size
|
|
@@ -702,6 +758,34 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
|
|
|
702
758
|
*/
|
|
703
759
|
protected concurrency?: number;
|
|
704
760
|
protected constructor(config: BaseStorageOptions<TFile>);
|
|
761
|
+
/**
|
|
762
|
+
* Escape hatch returning the underlying native client (S3Client, BlobServiceClient, etc.)
|
|
763
|
+
* for provider-specific operations not covered by the unified API.
|
|
764
|
+
* Returns `undefined` when no native client is available (e.g. DiskStorage).
|
|
765
|
+
*/
|
|
766
|
+
get raw(): unknown;
|
|
767
|
+
/**
|
|
768
|
+
* Returns a presigned URL for downloading the object at `key`.
|
|
769
|
+
* Throws `ERRORS.METHOD_NOT_ALLOWED` when the adapter has no native presign support.
|
|
770
|
+
* @param _key Storage key.
|
|
771
|
+
* @param _options Optional expiry and response overrides.
|
|
772
|
+
*/
|
|
773
|
+
getReadUrl(_key: string, _options?: {
|
|
774
|
+
expiresIn?: number;
|
|
775
|
+
responseContentDisposition?: string;
|
|
776
|
+
responseContentType?: string;
|
|
777
|
+
}): Promise<string>;
|
|
778
|
+
/**
|
|
779
|
+
* Returns a presigned URL for uploading a single object to `key`.
|
|
780
|
+
* Throws `ERRORS.METHOD_NOT_ALLOWED` when the adapter has no native presign support.
|
|
781
|
+
* @param _key Storage key.
|
|
782
|
+
* @param _options Optional content type, expiry, and content length hints.
|
|
783
|
+
*/
|
|
784
|
+
getUploadUrl(_key: string, _options?: {
|
|
785
|
+
contentLength?: number;
|
|
786
|
+
contentType?: string;
|
|
787
|
+
expiresIn?: number;
|
|
788
|
+
}): Promise<string>;
|
|
705
789
|
get tusExtension(): string[];
|
|
706
790
|
/**
|
|
707
791
|
* Validates a file against configured validation rules.
|
|
@@ -735,9 +819,17 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
|
|
|
735
819
|
* @param file File object containing metadata to save.
|
|
736
820
|
* @returns Promise resolving to the saved file object.
|
|
737
821
|
* @remarks Updates timestamps and caches the file metadata.
|
|
822
|
+
* @throws {UploadError} If `file.id` contains path-traversal sequences, null bytes, or is an absolute path — patterns that could let a local MetaStorage implementation write outside its directory.
|
|
738
823
|
*/
|
|
739
824
|
saveMeta(file: TFile): Promise<TFile>;
|
|
740
825
|
/**
|
|
826
|
+
* Rejects ids containing `..` segments, null bytes, or absolute paths — defense-in-depth
|
|
827
|
+
* so any MetaStorage / facade / handler that uses `id` as part of a filesystem path or
|
|
828
|
+
* cross-bucket lookup can't be escaped. Public so the `Files` facade and Fetch handlers
|
|
829
|
+
* can validate user-supplied keys before any adapter call.
|
|
830
|
+
*/
|
|
831
|
+
static assertSafeId(id: string): void;
|
|
832
|
+
/**
|
|
741
833
|
* Deletes upload metadata from the metadata storage.
|
|
742
834
|
* @param id File ID whose metadata should be deleted.
|
|
743
835
|
* @returns Promise resolving when metadata is deleted.
|
|
@@ -914,10 +1006,19 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
|
|
|
914
1006
|
source: string;
|
|
915
1007
|
}[]): Promise<BatchOperationResponse<TFile>>;
|
|
916
1008
|
/**
|
|
917
|
-
* Prevent upload from being accessed by multiple requests
|
|
1009
|
+
* Prevent upload from being accessed by multiple requests.
|
|
1010
|
+
* Returns a unique token that must be passed back to `unlock()` so a caller whose lock TTL'd
|
|
1011
|
+
* out cannot accidentally release a newly-acquired lock held by another request.
|
|
918
1012
|
*/
|
|
919
1013
|
protected lock(key: string): Promise<string>;
|
|
920
|
-
protected unlock(key: string): Promise<void>;
|
|
1014
|
+
protected unlock(key: string, token?: string): Promise<void>;
|
|
1015
|
+
/**
|
|
1016
|
+
* Run a function while holding the lock for `key`. The lock is released even if `fn` throws,
|
|
1017
|
+
* and only released when the caller still owns the lock (token-verified). Public so that
|
|
1018
|
+
* handlers can serialize cross-call read-modify-write sequences on the same upload (e.g.
|
|
1019
|
+
* appending to `_chunks` during chunked PATCH).
|
|
1020
|
+
*/
|
|
1021
|
+
withLock<R>(key: string, function_: () => Promise<R>): Promise<R>;
|
|
921
1022
|
protected isUnsupportedChecksum(algorithm?: string): boolean;
|
|
922
1023
|
protected startAutoPurge(purgeInterval: number): void;
|
|
923
1024
|
protected updateTimestamps(file: TFile): TFile;
|
|
@@ -936,4 +1037,4 @@ declare abstract class BaseStorage<TFile extends File = File, TFileReturn extend
|
|
|
936
1037
|
*/
|
|
937
1038
|
protected instrumentOperation<T>(operation: string, function_: () => Promise<T>, attributes?: Record<string, string | number>): Promise<T>;
|
|
938
1039
|
}
|
|
939
|
-
export {
|
|
1040
|
+
export { throwErrorCode as $, RangeHasher as A, BaseStorage as B, Cache 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, OnComplete 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, UploadError as b, UploadEventType as c, createRetryWrapper as d, FileInit as e, FilePart as f, FileQuery as g, DiskStorageWithChecksumOptions as h, ResponseBodyType as i, ErrorResponses as j, Metrics as k, BaseStorageOptions 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, OnCreate as v, OnDelete as w, OnError as x, OnUpdate as y, RangeChecksum as z };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=Object.defineProperty;var o=(e,s)=>c(e,"name",{value:s,configurable:!0});var n=Object.defineProperty,S=o((e,s)=>n(e,"name",{value:s,configurable:!0}),"r");const a=S(e=>{const s=e?.accessKeyId??process.env.AWS_ACCESS_KEY_ID??process.env.STORJ_ACCESS_KEY_ID??process.env.STORJ_ACCESS_KEY,t=e?.endpoint??process.env.STORJ_ENDPOINT,r=e?.secretAccessKey??process.env.AWS_SECRET_ACCESS_KEY??process.env.STORJ_SECRET_ACCESS_KEY??process.env.STORJ_SECRET_KEY;if(!s||!r)throw new Error("Missing required parameters for Storj client.");return{credentials:{accessKeyId:s,secretAccessKey:r},endpoint:t??"https://gateway.storjshare.io",forcePathStyle:!1,region:"global"}},"storj");export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var t=(e,s)=>n(e,"name",{value:s,configurable:!0});var o=Object.defineProperty,S=t((e,s)=>o(e,"name",{value:s,configurable:!0}),"r");const _=S(e=>{const s=e?.accessKeyId??process.env.AWS_ACCESS_KEY_ID??process.env.TIGRIS_ACCESS_KEY_ID??process.env.TIGRIS_ACCESS_KEY,c=e?.endpoint??process.env.TIGRIS_ENDPOINT,r=e?.secretAccessKey??process.env.AWS_SECRET_ACCESS_KEY??process.env.TIGRIS_SECRET_ACCESS_KEY??process.env.TIGRIS_SECRET_KEY;if(!s||!r)throw new Error("Missing required parameters for Tigris client.");return{credentials:{accessKeyId:s,secretAccessKey:r},endpoint:c??"https://t3.storage.dev",forcePathStyle:!1,region:"auto"}},"tigris");export{_ as default};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
-
import { U as UploadFile, i as ResponseBodyType, B as BaseStorage, j as ErrorResponses } from "./storage.d-
|
|
2
|
+
import { U as UploadFile, i as ResponseBodyType, B as BaseStorage, j as ErrorResponses } from "./storage.d-Cr6f2lac.js";
|
|
3
3
|
import 'node:stream';
|
|
4
|
-
import { M as MediaTransformer } from "./media-transformer.d-
|
|
5
|
-
import { U as UploadOptions } from "./types.d-
|
|
4
|
+
import { M as MediaTransformer } from "./media-transformer.d-DK7NJncf.js";
|
|
5
|
+
import { U as UploadOptions } from "./types.d-BgCmSE94.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-
|
|
6
|
-
import { M as MediaTransformer } from "./media-transformer.d-
|
|
5
|
+
import { U as UploadFile, B as BaseStorage, b as UploadError, c as UploadEventType } from "./storage.d-Cr6f2lac.js";
|
|
6
|
+
import { M as MediaTransformer } from "./media-transformer.d-DK7NJncf.js";
|
|
7
7
|
type WebRequest = globalThis.Request;
|
|
8
8
|
type WebResponse = globalThis.Response;
|
|
9
9
|
interface BaseResponse {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Cache, F as File, a as FileReturn, B as BaseStorage } from "./storage.d-
|
|
1
|
+
import { C as Cache, F as File, a as FileReturn, B as BaseStorage } from "./storage.d-Cr6f2lac.js";
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
3
|
/**
|
|
4
4
|
* Base transformer configuration with common properties
|
|
@@ -54,6 +54,10 @@ declare abstract class BaseTransformer<Config extends BaseTransformerConfig, Cac
|
|
|
54
54
|
}>;
|
|
55
55
|
/**
|
|
56
56
|
* Clears cache for a specific file or all files.
|
|
57
|
+
*
|
|
58
|
+
* Cache keys are `${fileId}:${stepsHash}` (see `generateCacheKey` in subclasses),
|
|
59
|
+
* so per-file invalidation must iterate keys to find every transform of `fileId`.
|
|
60
|
+
* Falls back to a full `clear()` when the underlying cache doesn't expose `keys()`.
|
|
57
61
|
* @param fileId Optional file identifier to clear cache for specific file.
|
|
58
62
|
*/
|
|
59
63
|
clearCache(fileId?: string): void;
|
|
@@ -680,8 +684,16 @@ interface MediaTransformQuery {
|
|
|
680
684
|
* Image transformer configuration
|
|
681
685
|
*/
|
|
682
686
|
interface ImageTransformerConfig extends BaseTransformerConfig {
|
|
687
|
+
/** Sharp `failOn` setting controlling which libvips warnings abort decoding. Defaults to `"warning"`. */
|
|
688
|
+
failOn?: "error" | "none" | "truncated" | "warning";
|
|
689
|
+
/** Maximum total pixels (width * height) Sharp will decode. Defaults to 268435456 (16k x 16k). */
|
|
690
|
+
limitInputPixels?: false | number;
|
|
691
|
+
/** Reject images taller than this many pixels (post-decode metadata check). */
|
|
692
|
+
maxImageHeight?: number;
|
|
683
693
|
/** Maximum image size to process (in bytes) */
|
|
684
694
|
maxImageSize?: number;
|
|
695
|
+
/** Reject images wider than this many pixels (post-decode metadata check). */
|
|
696
|
+
maxImageWidth?: number;
|
|
685
697
|
}
|
|
686
698
|
/**
|
|
687
699
|
* Video transformer configuration
|
|
@@ -705,4 +717,4 @@ interface AudioTransformerConfig extends BaseTransformerConfig {
|
|
|
705
717
|
/** Maximum audio size to process (in bytes) */
|
|
706
718
|
maxAudioSize?: number;
|
|
707
719
|
}
|
|
708
|
-
export {
|
|
720
|
+
export { AudioTransformerConfig as A, BaseTransformer as B, CropOptions as C, DilateOptions as D, ExtractChannelOptions as E, ToColourspaceOptions as F, GreyscaleOptions as G, RemoveAlphaOptions as H, ImageTransformerConfig as I, JoinChannelOptions as J, EnsureAlphaOptions as K, LinearOptions as L, MedianOptions as M, TransformationStep as N, MediaTransformerConfig as O, PipelineColourspaceOptions as P, MediaTransformResult 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, AudioTransformResult as g, AudioResampleOptions as h, AudioChannelMixOptions as i, AudioTransformOptions as j, AudioTransformationStep as k, RotateOptions as l, ImageFormat as m, TransformOptions as n, BlurOptions as o, CLAHEOptions as p, ConvolveOptions as q, ThresholdOptions as r, BooleanOptions as s, RecombineOptions as t, ModulateOptions as u, TintOptions as v, ColourspaceOptions as w, BandboolOptions as x, AffineOptions as y, ErodeOptions as z };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var n=(e,s)=>o(e,"name",{value:s,configurable:!0});var S=Object.defineProperty,A=n((e,s)=>S(e,"name",{value:s,configurable:!0}),"t");const a=A(e=>{const s=e?.accessKeyId??process.env.AWS_ACCESS_KEY_ID??process.env.WASABI_ACCESS_KEY_ID??process.env.WASABI_ACCESS_KEY,r=e?.region??process.env.AWS_REGION??process.env.WASABI_REGION,c=e?.secretAccessKey??process.env.AWS_SECRET_ACCESS_KEY??process.env.WASABI_SECRET_ACCESS_KEY??process.env.WASABI_SECRET_KEY;if(!r||!s||!c)throw new Error("Missing required parameters for Wasabi client.");return{apiVersion:"2006-03-01",credentials:{accessKeyId:s,secretAccessKey:c},endpoint:`https://s3.${r}.wasabisys.com`,region:r}},"wasabi");export{a as default};
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '@aws-sdk/middleware-flexible-checksums';
|
|
3
|
-
import '@aws-sdk/middleware-host-header';
|
|
4
|
-
import '@aws-sdk/middleware-sdk-s3';
|
|
5
|
-
import '@aws-sdk/middleware-user-agent';
|
|
6
|
-
import '@smithy/types';
|
|
7
|
-
import '@smithy/config-resolver';
|
|
8
|
-
import '@smithy/eventstream-serde-config-resolver';
|
|
9
|
-
import '@smithy/middleware-endpoint';
|
|
10
|
-
import '@smithy/middleware-retry';
|
|
11
|
-
import '@smithy/protocol-http';
|
|
12
|
-
import '@smithy/smithy-client';
|
|
13
|
-
import 'node:stream';
|
|
14
|
-
import '@aws-sdk/core/httpAuthSchemes';
|
|
1
|
+
import { S3ClientConfig } from '@aws-sdk/client-s3';
|
|
15
2
|
type CreateCloudflareClientParameters = {
|
|
16
3
|
/**
|
|
17
4
|
* Cloudflare R2 access key ID.
|
|
@@ -107,6 +94,72 @@ type CreateTigrisClientParameters = {
|
|
|
107
94
|
*/
|
|
108
95
|
secretAccessKey: string;
|
|
109
96
|
};
|
|
97
|
+
type CreateHetznerClientParameters = {
|
|
98
|
+
/**
|
|
99
|
+
* Hetzner Object Storage access key ID.
|
|
100
|
+
*/
|
|
101
|
+
accessKeyId: string;
|
|
102
|
+
/**
|
|
103
|
+
* Hetzner Object Storage location. Used as both the region and the
|
|
104
|
+
* subdomain of the endpoint (`https://{location}.your-objectstorage.com`).
|
|
105
|
+
*/
|
|
106
|
+
location: "fsn1" | "hel1" | "nbg1";
|
|
107
|
+
/**
|
|
108
|
+
* Hetzner Object Storage secret access key.
|
|
109
|
+
*/
|
|
110
|
+
secretAccessKey: string;
|
|
111
|
+
};
|
|
112
|
+
type CreateAkamaiClientParameters = {
|
|
113
|
+
/**
|
|
114
|
+
* Akamai Cloud Object Storage access key ID.
|
|
115
|
+
*/
|
|
116
|
+
accessKeyId: string;
|
|
117
|
+
/**
|
|
118
|
+
* Override the endpoint. When unset, defaults to
|
|
119
|
+
* `https://${region}.linodeobjects.com`. The `linodeobjects.com` domain
|
|
120
|
+
* is unchanged from the Linode era — only the product branding moved
|
|
121
|
+
* to Akamai.
|
|
122
|
+
*/
|
|
123
|
+
endpoint?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Akamai Cloud Object Storage region/cluster code (formerly Linode Object
|
|
126
|
+
* Storage). Examples: `"us-iad-1"`, `"us-mia-1"`, `"us-ord-1"`,
|
|
127
|
+
* `"nl-ams-1"`, `"fr-par-1"`, `"gb-lon-1"`, `"jp-osa-1"`, plus the older
|
|
128
|
+
* `"us-east-1"` / `"eu-central-1"` / `"ap-south-1"` clusters.
|
|
129
|
+
*/
|
|
130
|
+
region: string;
|
|
131
|
+
/**
|
|
132
|
+
* Akamai Cloud Object Storage secret access key.
|
|
133
|
+
*/
|
|
134
|
+
secretAccessKey: string;
|
|
135
|
+
};
|
|
136
|
+
type CreateStorjClientParameters = {
|
|
137
|
+
/**
|
|
138
|
+
* Storj S3 Gateway access key (derived from a Storj access grant).
|
|
139
|
+
*/
|
|
140
|
+
accessKeyId: string;
|
|
141
|
+
/**
|
|
142
|
+
* Override the Storj S3 Gateway endpoint.
|
|
143
|
+
* @default `https://gateway.storjshare.io`
|
|
144
|
+
*/
|
|
145
|
+
endpoint?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Storj S3 Gateway secret key (derived from a Storj access grant).
|
|
148
|
+
*/
|
|
149
|
+
secretAccessKey: string;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Create an Akamai Cloud Object Storage client, compatible with the S3 API.
|
|
153
|
+
*
|
|
154
|
+
* Akamai Cloud Object Storage is the rebranded Linode Object Storage; the
|
|
155
|
+
* underlying `linodeobjects.com` domain is unchanged.
|
|
156
|
+
*
|
|
157
|
+
* Optionally, you can omit the parameters and use the following environment variables:
|
|
158
|
+
* - `AWS_ACCESS_KEY_ID` / `AKAMAI_ACCESS_KEY_ID`
|
|
159
|
+
* - `AWS_SECRET_ACCESS_KEY` / `AKAMAI_SECRET_ACCESS_KEY`
|
|
160
|
+
* - `AKAMAI_REGION` (e.g. `us-iad-1`)
|
|
161
|
+
*/
|
|
162
|
+
declare const akamai: (parameters?: Partial<CreateAkamaiClientParameters>) => S3ClientConfig;
|
|
110
163
|
/**
|
|
111
164
|
* Create a Backblaze B2 client, compatible with the S3 API.
|
|
112
165
|
*
|
|
@@ -136,6 +189,15 @@ declare const cloudflare: (parameters?: CreateCloudflareClientParameters) => S3C
|
|
|
136
189
|
*/
|
|
137
190
|
declare const digitalOcean: (parameters?: CreateDigitalOceanClientParameters) => S3ClientConfig;
|
|
138
191
|
/**
|
|
192
|
+
* Create a Hetzner Object Storage client, compatible with the S3 API.
|
|
193
|
+
*
|
|
194
|
+
* Optionally, you can omit the parameters and use the following environment variables:
|
|
195
|
+
* - `AWS_ACCESS_KEY_ID` / `HETZNER_ACCESS_KEY_ID`
|
|
196
|
+
* - `AWS_SECRET_ACCESS_KEY` / `HETZNER_SECRET_ACCESS_KEY`
|
|
197
|
+
* - `HETZNER_LOCATION` (one of `fsn1`, `nbg1`, `hel1`)
|
|
198
|
+
*/
|
|
199
|
+
declare const hetzner: (parameters?: CreateHetznerClientParameters) => S3ClientConfig;
|
|
200
|
+
/**
|
|
139
201
|
* Create a Minio client, compatible with the S3 API.
|
|
140
202
|
*
|
|
141
203
|
* Optionally, you can omit the parameters and use the following environment variables:
|
|
@@ -146,6 +208,19 @@ declare const digitalOcean: (parameters?: CreateDigitalOceanClientParameters) =>
|
|
|
146
208
|
*/
|
|
147
209
|
declare const minio: (parameters?: CreateMinioClientParameters) => S3ClientConfig;
|
|
148
210
|
/**
|
|
211
|
+
* Create a Storj S3 Gateway client, compatible with the S3 API.
|
|
212
|
+
*
|
|
213
|
+
* Credentials are derived from a Storj access grant via the
|
|
214
|
+
* `storj.io/uplink` CLI or web console. The default endpoint targets the
|
|
215
|
+
* global Storj S3 Gateway; self-hosted gateways can override via `endpoint`.
|
|
216
|
+
*
|
|
217
|
+
* Optionally, you can omit the parameters and use the following environment variables:
|
|
218
|
+
* - `AWS_ACCESS_KEY_ID` / `STORJ_ACCESS_KEY_ID`
|
|
219
|
+
* - `AWS_SECRET_ACCESS_KEY` / `STORJ_SECRET_ACCESS_KEY`
|
|
220
|
+
* - `STORJ_ENDPOINT` (defaults to `https://gateway.storjshare.io`)
|
|
221
|
+
*/
|
|
222
|
+
declare const storj: (parameters?: CreateStorjClientParameters) => S3ClientConfig;
|
|
223
|
+
/**
|
|
149
224
|
* Create a Tigris client, compatible with the S3 API.
|
|
150
225
|
*
|
|
151
226
|
* Optionally, you can omit the parameters and use the following environment variables:
|
|
@@ -163,4 +238,4 @@ declare const tigris: (parameters?: CreateTigrisClientParameters) => S3ClientCon
|
|
|
163
238
|
* - `AWS_SECRET_ACCESS_KEY`
|
|
164
239
|
*/
|
|
165
240
|
declare const wasabi: (parameters?: CreateWasabiClientParameters) => S3ClientConfig;
|
|
166
|
-
export { backblaze, cloudflare, digitalOcean, minio, tigris, wasabi };
|
|
241
|
+
export { akamai, backblaze, cloudflare, digitalOcean, hetzner, minio, storj, tigris, wasabi };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{backblaze as
|
|
1
|
+
import{default as e}from"../../../packem_shared/akamai-BYS9pP8S.js";import{backblaze as t}from"../../../packem_shared/backblaze-CvdtCvJL.js";import{cloudflare as l}from"../../../packem_shared/cloudflare-Bm_Pg6yx.js";import{default as s}from"../../../packem_shared/digitalOcean-Lj1NfDzc.js";import{default as p}from"../../../packem_shared/hetzner-DDxE7Gy7.js";import{default as i}from"../../../packem_shared/minio-T_Z3iEy7.js";import{default as b}from"../../../packem_shared/storj-CVA9mM-7.js";import{default as n}from"../../../packem_shared/tigris-wmhjfsH2.js";import{default as k}from"../../../packem_shared/wasabi-JQzxdrFy.js";export{e as akamai,t as backblaze,l as cloudflare,s as digitalOcean,p as hetzner,i as minio,b as storj,n as tigris,k as wasabi};
|
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import { F as File,
|
|
1
|
+
import { F as File, t as MetaStorageOptions, l as BaseStorageOptions, L as LocalMetaStorageOptions, M as MetaStorage, H as HttpError, g as FileQuery, e as FileInit } from "../../packem_shared/storage.d-Cr6f2lac.js";
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
|
-
import { P as Part, S as S3ApiOperations, a as S3BaseStorage } from "../../packem_shared/s3-base-storage.d-
|
|
4
|
-
import {
|
|
5
|
-
import { ResponseMetadata } from '@
|
|
3
|
+
import { P as Part, S as S3ApiOperations, a as S3BaseStorage } from "../../packem_shared/s3-base-storage.d-BROGYJ4F.js";
|
|
4
|
+
import { S3ClientConfig, ObjectCannedACL, S3Client } from '@aws-sdk/client-s3';
|
|
5
|
+
import { ResponseMetadata } from '@aws-sdk/types';
|
|
6
6
|
import 'node:crypto';
|
|
7
7
|
import 'node:http';
|
|
8
8
|
import 'lru-cache';
|
|
9
|
-
import '@aws-sdk/middleware-flexible-checksums';
|
|
10
|
-
import '@aws-sdk/middleware-host-header';
|
|
11
|
-
import '@aws-sdk/middleware-sdk-s3';
|
|
12
|
-
import '@aws-sdk/middleware-user-agent';
|
|
13
|
-
import '@smithy/config-resolver';
|
|
14
|
-
import '@smithy/eventstream-serde-config-resolver';
|
|
15
|
-
import '@smithy/middleware-endpoint';
|
|
16
|
-
import '@smithy/middleware-retry';
|
|
17
|
-
import '@smithy/protocol-http';
|
|
18
|
-
import '@smithy/smithy-client';
|
|
19
|
-
import '@aws-sdk/core/httpAuthSchemes';
|
|
20
9
|
declare class S3File extends File {
|
|
21
10
|
Parts?: Part[];
|
|
22
11
|
UploadId?: string;
|
|
@@ -297,6 +286,7 @@ declare class S3ClientAdapter implements S3ApiOperations {
|
|
|
297
286
|
declare class S3Storage extends S3BaseStorage {
|
|
298
287
|
static override readonly name: string;
|
|
299
288
|
private s3Api;
|
|
289
|
+
private rawClient;
|
|
300
290
|
constructor(config: S3StorageOptions);
|
|
301
291
|
/**
|
|
302
292
|
* Normalizes AWS S3 errors with S3-specific context.
|
|
@@ -312,6 +302,17 @@ declare class S3Storage extends S3BaseStorage {
|
|
|
312
302
|
size?: number;
|
|
313
303
|
stream: Readable;
|
|
314
304
|
}>;
|
|
305
|
+
override get raw(): S3Client;
|
|
306
|
+
override getReadUrl(key: string, options?: {
|
|
307
|
+
expiresIn?: number;
|
|
308
|
+
responseContentDisposition?: string;
|
|
309
|
+
responseContentType?: string;
|
|
310
|
+
}): Promise<string>;
|
|
311
|
+
override getUploadUrl(key: string, options?: {
|
|
312
|
+
contentLength?: number;
|
|
313
|
+
contentType?: string;
|
|
314
|
+
expiresIn?: number;
|
|
315
|
+
}): Promise<string>;
|
|
315
316
|
protected getS3Api(): S3ClientAdapter;
|
|
316
317
|
protected getFileClass(): new (config: FileInit) => S3File;
|
|
317
318
|
protected getAcl(): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as t}from"../../packem_shared/S3File-
|
|
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-D8dopWoO.js";export{t as S3File,r as S3MetaStorage,S as S3Storage};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { P as Part, S as S3ApiOperations, a as S3BaseStorage } from "../../packem_shared/s3-base-storage.d-
|
|
2
|
-
import { F as File,
|
|
1
|
+
import { P as Part, S as S3ApiOperations, a as S3BaseStorage } from "../../packem_shared/s3-base-storage.d-BROGYJ4F.js";
|
|
2
|
+
import { F as File, t as MetaStorageOptions, l as BaseStorageOptions, M as MetaStorage, H as HttpError, g as FileQuery, e as FileInit } from "../../packem_shared/storage.d-Cr6f2lac.js";
|
|
3
3
|
import { Readable } from 'node:stream';
|
|
4
|
+
import { AwsClient } from 'aws4fetch';
|
|
4
5
|
import 'node:crypto';
|
|
5
6
|
import 'node:http';
|
|
6
7
|
import 'lru-cache';
|
|
@@ -65,7 +66,7 @@ declare class AwsLightMetaStorage<T extends File = File> extends MetaStorage<T>
|
|
|
65
66
|
* Adapter that uses aws4fetch to implement S3ApiOperations interface.
|
|
66
67
|
*/
|
|
67
68
|
declare class AwsLightApiAdapter implements S3ApiOperations {
|
|
68
|
-
|
|
69
|
+
aws: AwsClient;
|
|
69
70
|
private readonly bucket;
|
|
70
71
|
private readonly endpoint;
|
|
71
72
|
constructor(config: AwsLightClientConfig & {
|
|
@@ -244,6 +245,7 @@ declare class AwsLightStorage extends S3BaseStorage {
|
|
|
244
245
|
size?: number;
|
|
245
246
|
stream: Readable;
|
|
246
247
|
}>;
|
|
248
|
+
override get raw(): AwsClient;
|
|
247
249
|
protected getS3Api(): AwsLightApiAdapter;
|
|
248
250
|
protected getFileClass(): new (config: FileInit) => AwsLightFile;
|
|
249
251
|
protected getAcl(): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/AwsLightFile-
|
|
1
|
+
import{default as a}from"../../packem_shared/AwsLightFile-BSqjc_rD.js";import{l as r}from"../../packem_shared/aws-light-meta-storage-TPyQwLvk.js";import{default as f}from"../../packem_shared/AwsLightStorage-SH7j-myh.js";export{a as AwsLightFile,r as AwsLightMetaStorage,f as AwsLightStorage};
|