@supabase/storage-js 3.0.0-next.20 → 3.0.0-next.22

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.
@@ -1 +1 @@
1
- var supabase=(function(e){var t=class extends Error{constructor(e,t=`storage`,n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t===`vectors`?`StorageVectorsError`:`StorageError`,this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function n(e){return typeof e==`object`&&!!e&&`__isStorageError`in e}var r=class extends t{constructor(e,t,n,r=`storage`){super(e,r,t,n),this.name=r===`vectors`?`StorageVectorsApiError`:`StorageApiError`,this.status=t,this.statusCode=n}toJSON(){return{...super.toJSON()}}},i=class extends t{constructor(e,t,n=`storage`){super(e,n),this.name=n===`vectors`?`StorageVectorsUnknownError`:`StorageUnknownError`,this.originalError=t}},a=class extends t{constructor(e){super(e,`vectors`)}};function o(e){return n(e)&&e.namespace===`vectors`}var s=class extends r{constructor(e,t,n){super(e,t,n,`vectors`)}},c=class extends i{constructor(e,t){super(e,t,`vectors`)}};let l=function(e){return e.InternalError=`InternalError`,e.S3VectorConflictException=`S3VectorConflictException`,e.S3VectorNotFoundException=`S3VectorNotFoundException`,e.S3VectorBucketNotEmpty=`S3VectorBucketNotEmpty`,e.S3VectorMaxBucketsExceeded=`S3VectorMaxBucketsExceeded`,e.S3VectorMaxIndexesExceeded=`S3VectorMaxIndexesExceeded`,e}({});function u(e,t,n){let r={...e},i=t.toLowerCase();for(let e of Object.keys(r))e.toLowerCase()===i&&delete r[e];return r[i]=n,r}function d(e){let t={};for(let[n,r]of Object.entries(e))t[n.toLowerCase()]=r;return t}let f=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),p=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},m=e=>{if(Array.isArray(e))return e.map(e=>m(e));if(typeof e==`function`||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([e,n])=>{let r=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,``));t[r]=m(n)}),t},h=e=>!e||typeof e!=`string`||e.length===0||e.length>100||e.trim()!==e||e.includes(`/`)||e.includes(`\\`)?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),g=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.msg==`string`)return t.msg;if(typeof t.message==`string`)return t.message;if(typeof t.error_description==`string`)return t.error_description;if(typeof t.error==`string`)return t.error;if(typeof t.error==`object`&&t.error!==null){let e=t.error;if(typeof e.message==`string`)return e.message}}return JSON.stringify(e)},_=async(e,t,n,a)=>{if(typeof e==`object`&&e&&`json`in e&&typeof e.json==`function`){let n=e,i=parseInt(String(n.status),10);Number.isFinite(i)||(i=500),n.json().then(e=>{let n=e?.statusCode||e?.code||i+``;t(new r(g(e),i,n,a))}).catch(()=>{let e=i+``;t(new r(n.statusText||`HTTP ${i} error`,i,e,a))})}else t(new i(g(e),e,a))},v=(e,t,n,r)=>{let i={method:e,headers:t?.headers||{}};if(e===`GET`||e===`HEAD`||!r)return{...i,...n};if(p(r)){let e=t?.headers||{},n;for(let[t,r]of Object.entries(e))t.toLowerCase()===`content-type`&&(n=r);i.headers=u(e,`Content-Type`,n??`application/json`),i.body=JSON.stringify(r)}else i.body=r;return t?.duplex&&(i.duplex=t.duplex),{...i,...n}};async function y(e,t,n,r,i,a,o){return new Promise((s,c)=>{e(n,v(t,r,i,a)).then(e=>{if(!e.ok)throw e;if(r?.noResolveJson)return e;if(o===`vectors`){let t=e.headers.get(`content-type`);if(e.headers.get(`content-length`)===`0`||e.status===204||!t||!t.includes(`application/json`))return{}}return e.json()}).then(e=>s(e)).catch(e=>_(e,c,r,o))})}function b(e=`storage`){return{get:async(t,n,r,i)=>y(t,`GET`,n,r,i,void 0,e),post:async(t,n,r,i,a)=>y(t,`POST`,n,i,a,r,e),put:async(t,n,r,i,a)=>y(t,`PUT`,n,i,a,r,e),head:async(t,n,r,i)=>y(t,`HEAD`,n,{...r,noResolveJson:!0},i,void 0,e),remove:async(t,n,r,i,a)=>y(t,`DELETE`,n,i,a,r,e)}}let{get:x,post:S,put:C,head:w,remove:T}=b(`storage`),E=b(`vectors`);var D=class{constructor(e,t={},n,r=`storage`){this.shouldThrowOnError=!1,this.url=e,this.headers=d(t),this.fetch=f(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=u(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e))return{data:null,error:e};throw e}}},O=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e))return{data:null,error:e};throw e}}};let k;var A=class{static{k=Symbol.toStringTag}constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[k]=`BlobDownloadBuilder`,this.promise=null}asStream(){return new O(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||=this.execute(),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e))return{data:null,error:e};throw e}}};let j={limit:100,offset:0,sortBy:{column:`name`,order:`asc`}},M={cacheControl:`3600`,contentType:`text/plain;charset=UTF-8`,upsert:!1};var N=class extends D{constructor(e,t={},n,r){super(e,t,r,`storage`),this.bucketId=n}async uploadOrUpdate(e,t,n,r){return this.handleOperation(async()=>{let i,a={...M,...r},o={...this.headers,...e===`POST`&&{"x-upsert":String(a.upsert)}},s=a.metadata;if(typeof Blob<`u`&&n instanceof Blob?(i=new FormData,i.append(`cacheControl`,a.cacheControl),s&&i.append(`metadata`,this.encodeMetadata(s)),i.append(``,n)):typeof FormData<`u`&&n instanceof FormData?(i=n,i.has(`cacheControl`)||i.append(`cacheControl`,a.cacheControl),s&&!i.has(`metadata`)&&i.append(`metadata`,this.encodeMetadata(s))):(i=n,o[`cache-control`]=`max-age=${a.cacheControl}`,o[`content-type`]=a.contentType,s&&(o[`x-metadata`]=this.toBase64(this.encodeMetadata(s))),(typeof ReadableStream<`u`&&i instanceof ReadableStream||i&&typeof i==`object`&&`pipe`in i&&typeof i.pipe==`function`)&&!a.duplex&&(a.duplex=`half`)),r?.headers)for(let[e,t]of Object.entries(r.headers))o=u(o,e,t);let c=this._removeEmptyFolders(t),l=this._getFinalPath(c),d=await(e==`PUT`?C:S)(this.fetch,`${this.url}/object/${l}`,i,{headers:o,...a?.duplex?{duplex:a.duplex}:{}});return{path:c,id:d.Id,fullPath:d.Key}})}async upload(e,t,n){return this.uploadOrUpdate(`POST`,e,t,n)}async uploadToSignedUrl(e,t,n,r){let i=this._removeEmptyFolders(e),a=this._getFinalPath(i),o=new URL(this.url+`/object/upload/sign/${a}`);return o.searchParams.set(`token`,t),this.handleOperation(async()=>{let e,t={...M,...r},a={...this.headers,"x-upsert":String(t.upsert)},s=t.metadata;if(typeof Blob<`u`&&n instanceof Blob?(e=new FormData,e.append(`cacheControl`,t.cacheControl),s&&e.append(`metadata`,this.encodeMetadata(s)),e.append(``,n)):typeof FormData<`u`&&n instanceof FormData?(e=n,e.has(`cacheControl`)||e.append(`cacheControl`,t.cacheControl),s&&!e.has(`metadata`)&&e.append(`metadata`,this.encodeMetadata(s))):(e=n,a[`cache-control`]=`max-age=${t.cacheControl}`,a[`content-type`]=t.contentType,s&&(a[`x-metadata`]=this.toBase64(this.encodeMetadata(s))),(typeof ReadableStream<`u`&&e instanceof ReadableStream||e&&typeof e==`object`&&`pipe`in e&&typeof e.pipe==`function`)&&!t.duplex&&(t.duplex=`half`)),r?.headers)for(let[e,t]of Object.entries(r.headers))a=u(a,e,t);return{path:i,fullPath:(await C(this.fetch,o.toString(),e,{headers:a,...t?.duplex?{duplex:t.duplex}:{}})).Key}})}async createSignedUploadUrl(e,n){return this.handleOperation(async()=>{let r=this._getFinalPath(e),i={...this.headers};n?.upsert&&(i[`x-upsert`]=`true`);let a=await S(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:i}),o=new URL(this.url+a.url),s=o.searchParams.get(`token`);if(!s)throw new t(`No token returned by API`);return{signedUrl:o.toString(),path:e,token:s}})}async update(e,t,n){return this.uploadOrUpdate(`PUT`,e,t,n)}async move(e,t,n){return this.handleOperation(async()=>await S(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:this.headers}))}async copy(e,t,n){return this.handleOperation(async()=>({path:(await S(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key}))}async createSignedUrl(e,t,n){return this.handleOperation(async()=>{let r=this._getFinalPath(e),i=typeof n?.transform==`object`&&n.transform!==null&&Object.keys(n.transform).length>0,a=await S(this.fetch,`${this.url}/object/sign/${r}`,{expiresIn:t,...i?{transform:n.transform}:{}},{headers:this.headers}),o=new URLSearchParams;n?.download&&o.set(`download`,n.download===!0?``:n.download),n?.cacheNonce!=null&&o.set(`cacheNonce`,String(n.cacheNonce));let s=o.toString();return{signedUrl:encodeURI(`${this.url}${a.signedURL}${s?`&${s}`:``}`)}})}async createSignedUrls(e,t,n){return this.handleOperation(async()=>{let r=await S(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=new URLSearchParams;n?.download&&i.set(`download`,n.download===!0?``:n.download),n?.cacheNonce!=null&&i.set(`cacheNonce`,String(n.cacheNonce));let a=i.toString();return r.map(e=>({...e,signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${a?`&${a}`:``}`):null}))})}download(e,t,n){let r=typeof t?.transform==`object`&&t.transform!==null&&Object.keys(t.transform).length>0?`render/image/authenticated`:`object`,i=new URLSearchParams;t?.transform&&this.applyTransformOptsToQuery(i,t.transform),t?.cacheNonce!=null&&i.set(`cacheNonce`,String(t.cacheNonce));let a=i.toString(),o=this._getFinalPath(e);return new A(()=>x(this.fetch,`${this.url}/${r}/${o}${a?`?${a}`:``}`,{headers:this.headers,noResolveJson:!0},n),this.shouldThrowOnError)}async info(e){let t=this._getFinalPath(e);return this.handleOperation(async()=>m(await x(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers})))}async exists(e){let t=this._getFinalPath(e);try{return await w(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e)){let t=e instanceof r?e.status:e instanceof i?e.originalError?.status:void 0;if(t!==void 0&&[400,404].includes(t))return{data:!1,error:null}}throw e}}getPublicUrl(e,t){let n=this._getFinalPath(e),r=new URLSearchParams;t?.download&&r.set(`download`,t.download===!0?``:t.download),t?.transform&&this.applyTransformOptsToQuery(r,t.transform),t?.cacheNonce!=null&&r.set(`cacheNonce`,String(t.cacheNonce));let i=r.toString(),a=typeof t?.transform==`object`&&t.transform!==null&&Object.keys(t.transform).length>0?`render/image`:`object`;return{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${n}`)+(i?`?${i}`:``)}}}async remove(e){return this.handleOperation(async()=>await T(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}))}async list(e,t,n){return this.handleOperation(async()=>{let r={...j,...t,prefix:e||``};return await S(this.fetch,`${this.url}/object/list/${this.bucketId}`,r,{headers:this.headers},n)})}async listV2(e,t){return this.handleOperation(async()=>{let n={...e};return await S(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<`u`?Buffer.from(e).toString(`base64`):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,``)}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,``).replace(/\/+/g,`/`)}applyTransformOptsToQuery(e,t){return t.width&&e.set(`width`,t.width.toString()),t.height&&e.set(`height`,t.height.toString()),t.resize&&e.set(`resize`,t.resize),t.format&&e.set(`format`,t.format),t.quality&&e.set(`quality`,t.quality.toString()),e}};let P={"X-Client-Info":`storage-js/3.0.0-next.20`};var F=class extends D{constructor(e,t={},n,r){let i=new URL(e);r?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes(`storage.supabase.`)&&(i.hostname=i.hostname.replace(`supabase.`,`storage.supabase.`));let a=i.href.replace(/\/$/,``),o={...P,...t};super(a,o,n,`storage`)}async listBuckets(e){return this.handleOperation(async()=>{let t=this.listBucketOptionsToQueryString(e);return await x(this.fetch,`${this.url}/bucket${t}`,{headers:this.headers})})}async getBucket(e){return this.handleOperation(async()=>await x(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}))}async createBucket(e,t={public:!1}){return this.handleOperation(async()=>await S(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}))}async updateBucket(e,t){return this.handleOperation(async()=>await C(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}))}async emptyBucket(e){return this.handleOperation(async()=>await S(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}))}async deleteBucket(e){return this.handleOperation(async()=>await T(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}))}listBucketOptionsToQueryString(e){let t={};return e&&(`limit`in e&&(t.limit=String(e.limit)),`offset`in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?`?`+new URLSearchParams(t).toString():``}},I=class extends Error{constructor(e,t){super(e),this.name=`IcebergError`,this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType===`CommitStateUnknownException`||[500,502,504].includes(t.status)&&t.icebergType?.includes(`CommitState`)===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function L(e,t,n){let r=new URL(t,e);if(n)for(let[e,t]of Object.entries(n))t!==void 0&&r.searchParams.set(e,t);return r.toString()}async function R(e){return!e||e.type===`none`?{}:e.type===`bearer`?{Authorization:`Bearer ${e.token}`}:e.type===`header`?{[e.name]:e.value}:e.type===`custom`?await e.getHeaders():{}}function z(e){let t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:i,body:a,headers:o}){let s=L(e.baseUrl,r,i),c=await R(e.auth),l=await t(s,{method:n,headers:{...a?{"Content-Type":`application/json`}:{},...c,...o},body:a?JSON.stringify(a):void 0}),u=await l.text(),d=(l.headers.get(`content-type`)||``).includes(`application/json`),f=d&&u?JSON.parse(u):u;if(!l.ok){let e=d?f:void 0,t=e?.error;throw new I(t?.message??`Request failed with status ${l.status}`,{status:l.status,icebergType:t?.type,icebergCode:t?.code,details:e})}return{status:l.status,headers:l.headers,data:f}}}}function B(e){return e.join(``)}var V=class{constructor(e,t=``){this.client=e,this.prefix=t}async listNamespaces(e){let t=e?{parent:B(e.namespace)}:void 0;return(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(e=>({namespace:e}))}async createNamespace(e,t){let n={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:`POST`,path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:`DELETE`,path:`${this.prefix}/namespaces/${B(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${B(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:`HEAD`,path:`${this.prefix}/namespaces/${B(e.namespace)}`}),!0}catch(e){if(e instanceof I&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(e){if(e instanceof I&&e.status===409)return;throw e}}};function H(e){return e.join(``)}var U=class{constructor(e,t=``,n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){let n={};return this.accessDelegation&&(n[`X-Iceberg-Access-Delegation`]=this.accessDelegation),(await this.client.request({method:`POST`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){let n=await this.client.request({method:`POST`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data[`metadata-location`],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:`DELETE`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){let t={};return this.accessDelegation&&(t[`X-Iceberg-Access-Delegation`]=this.accessDelegation),(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){let t={};this.accessDelegation&&(t[`X-Iceberg-Access-Delegation`]=this.accessDelegation);try{return await this.client.request({method:`HEAD`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(e){if(e instanceof I&&e.status===404)return!1;throw e}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof I&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},W=class{constructor(e){let t=`v1`;e.catalogName&&(t+=`/${e.catalogName}`),this.client=z({baseUrl:e.baseUrl.endsWith(`/`)?e.baseUrl:`${e.baseUrl}/`,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(`,`),this.namespaceOps=new V(this.client,t),this.tableOps=new U(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},G=class extends D{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...P,...t};super(r,i,n,`storage`)}async createBucket(e){return this.handleOperation(async()=>await S(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}))}async listBuckets(e){return this.handleOperation(async()=>{let t=new URLSearchParams;e?.limit!==void 0&&t.set(`limit`,e.limit.toString()),e?.offset!==void 0&&t.set(`offset`,e.offset.toString()),e?.sortColumn&&t.set(`sortColumn`,e.sortColumn),e?.sortOrder&&t.set(`sortOrder`,e.sortOrder),e?.search&&t.set(`search`,e.search);let n=t.toString(),r=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return await x(this.fetch,r,{headers:this.headers})})}async deleteBucket(e){return this.handleOperation(async()=>await T(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}))}from(e){if(!h(e))throw new t(`Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.`);let n=new W({baseUrl:this.url,catalogName:e,auth:{type:`custom`,getHeaders:async()=>this.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(e,t){let n=e[t];return typeof n==`function`?async(...t)=>{try{return{data:await n.apply(e,t),error:null}}catch(e){if(r)throw e;return{data:null,error:e}}}:n}})}},K=class extends D{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...P,"Content-Type":`application/json`,...t};super(r,i,n,`vectors`)}async createIndex(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers})||{})}async getIndex(e,t){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}))}async listIndexes(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}))}async deleteIndex(e,t){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers})||{})}},q=class extends D{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...P,"Content-Type":`application/json`,...t};super(r,i,n,`vectors`)}async putVectors(e){if(e.vectors.length<1||e.vectors.length>500)throw Error(`Vector batch size must be between 1 and 500 items`);return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers})||{})}async getVectors(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}))}async listVectors(e){if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw Error(`segmentCount must be between 1 and 16`);if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}))}async queryVectors(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}))}async deleteVectors(e){if(e.keys.length<1||e.keys.length>500)throw Error(`Keys batch size must be between 1 and 500 items`);return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers})||{})}},J=class extends D{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...P,"Content-Type":`application/json`,...t};super(r,i,n,`vectors`)}async createBucket(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers})||{})}async getBucket(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}))}async listBuckets(e={}){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}))}async deleteBucket(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers})||{})}},Y=class extends J{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new X(this.url,this.headers,e,this.fetch)}async createBucket(e){return super.createBucket(e)}async getBucket(e){return super.getBucket(e)}async listBuckets(e={}){return super.listBuckets(e)}async deleteBucket(e){return super.deleteBucket(e)}},X=class extends K{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){return super.createIndex({...e,vectorBucketName:this.vectorBucketName})}async listIndexes(e={}){return super.listIndexes({...e,vectorBucketName:this.vectorBucketName})}async getIndex(e){return super.getIndex(this.vectorBucketName,e)}async deleteIndex(e){return super.deleteIndex(this.vectorBucketName,e)}index(e){return new Z(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Z=class extends q{constructor(e,t,n,r,i){super(e,t,i),this.vectorBucketName=n,this.indexName=r}async putVectors(e){return super.putVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async getVectors(e){return super.getVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async listVectors(e={}){return super.listVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async queryVectors(e){return super.queryVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async deleteVectors(e){return super.deleteVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}},Q=class extends F{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new N(this.url,this.headers,e,this.fetch)}get vectors(){return new Y(this.url+`/vector`,{headers:this.headers,fetch:this.fetch})}get analytics(){return new G(this.url+`/iceberg`,this.headers,this.fetch)}};return e.StorageAnalyticsClient=G,e.StorageApiError=r,e.StorageClient=Q,e.StorageError=t,e.StorageUnknownError=i,e.StorageVectorsApiError=s,e.StorageVectorsClient=Y,e.StorageVectorsError=a,e.StorageVectorsErrorCode=l,e.StorageVectorsUnknownError=c,e.VectorBucketApi=J,e.VectorBucketScope=X,e.VectorDataApi=q,e.VectorIndexApi=K,e.VectorIndexScope=Z,e.isStorageError=n,e.isStorageVectorsError=o,e})({});
1
+ var supabase=(function(e){var t=class extends Error{constructor(e,t=`storage`,n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t===`vectors`?`StorageVectorsError`:`StorageError`,this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function n(e){return typeof e==`object`&&!!e&&`__isStorageError`in e}var r=class extends t{constructor(e,t,n,r=`storage`){super(e,r,t,n),this.name=r===`vectors`?`StorageVectorsApiError`:`StorageApiError`,this.status=t,this.statusCode=n}toJSON(){return{...super.toJSON()}}},i=class extends t{constructor(e,t,n=`storage`){super(e,n),this.name=n===`vectors`?`StorageVectorsUnknownError`:`StorageUnknownError`,this.originalError=t}},a=class extends t{constructor(e){super(e,`vectors`)}};function o(e){return n(e)&&e.namespace===`vectors`}var s=class extends r{constructor(e,t,n){super(e,t,n,`vectors`)}},c=class extends i{constructor(e,t){super(e,t,`vectors`)}};let l=function(e){return e.InternalError=`InternalError`,e.S3VectorConflictException=`S3VectorConflictException`,e.S3VectorNotFoundException=`S3VectorNotFoundException`,e.S3VectorBucketNotEmpty=`S3VectorBucketNotEmpty`,e.S3VectorMaxBucketsExceeded=`S3VectorMaxBucketsExceeded`,e.S3VectorMaxIndexesExceeded=`S3VectorMaxIndexesExceeded`,e}({});function u(e,t,n){let r={...e},i=t.toLowerCase();for(let e of Object.keys(r))e.toLowerCase()===i&&delete r[e];return r[i]=n,r}function d(e){let t={};for(let[n,r]of Object.entries(e))t[n.toLowerCase()]=r;return t}let f=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),p=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},m=e=>{if(Array.isArray(e))return e.map(e=>m(e));if(typeof e==`function`||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([e,n])=>{let r=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,``));t[r]=m(n)}),t},h=e=>!e||typeof e!=`string`||e.length===0||e.length>100||e.trim()!==e||e.includes(`/`)||e.includes(`\\`)?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),g=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.msg==`string`)return t.msg;if(typeof t.message==`string`)return t.message;if(typeof t.error_description==`string`)return t.error_description;if(typeof t.error==`string`)return t.error;if(typeof t.error==`object`&&t.error!==null){let e=t.error;if(typeof e.message==`string`)return e.message}}return JSON.stringify(e)},_=async(e,t,n,a)=>{if(typeof e==`object`&&e&&`json`in e&&typeof e.json==`function`){let n=e,i=parseInt(String(n.status),10);Number.isFinite(i)||(i=500),n.json().then(e=>{let n=e?.statusCode||e?.code||i+``;t(new r(g(e),i,n,a))}).catch(()=>{let e=i+``;t(new r(n.statusText||`HTTP ${i} error`,i,e,a))})}else t(new i(g(e),e,a))},v=(e,t,n,r)=>{let i={method:e,headers:t?.headers||{}};if(e===`GET`||e===`HEAD`||!r)return{...i,...n};if(p(r)){let e=t?.headers||{},n;for(let[t,r]of Object.entries(e))t.toLowerCase()===`content-type`&&(n=r);i.headers=u(e,`Content-Type`,n??`application/json`),i.body=JSON.stringify(r)}else i.body=r;return t?.duplex&&(i.duplex=t.duplex),{...i,...n}};async function y(e,t,n,r,i,a,o){return new Promise((s,c)=>{e(n,v(t,r,i,a)).then(e=>{if(!e.ok)throw e;if(r?.noResolveJson)return e;if(o===`vectors`){let t=e.headers.get(`content-type`);if(e.headers.get(`content-length`)===`0`||e.status===204||!t||!t.includes(`application/json`))return{}}return e.json()}).then(e=>s(e)).catch(e=>_(e,c,r,o))})}function b(e=`storage`){return{get:async(t,n,r,i)=>y(t,`GET`,n,r,i,void 0,e),post:async(t,n,r,i,a)=>y(t,`POST`,n,i,a,r,e),put:async(t,n,r,i,a)=>y(t,`PUT`,n,i,a,r,e),head:async(t,n,r,i)=>y(t,`HEAD`,n,{...r,noResolveJson:!0},i,void 0,e),remove:async(t,n,r,i,a)=>y(t,`DELETE`,n,i,a,r,e)}}let{get:x,post:S,put:C,head:w,remove:T}=b(`storage`),E=b(`vectors`);var D=class{constructor(e,t={},n,r=`storage`){this.shouldThrowOnError=!1,this.url=e,this.headers=d(t),this.fetch=f(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=u(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e))return{data:null,error:e};throw e}}},O=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e))return{data:null,error:e};throw e}}};let k;var A=class{static{k=Symbol.toStringTag}constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[k]=`BlobDownloadBuilder`,this.promise=null}asStream(){return new O(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||=this.execute(),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e))return{data:null,error:e};throw e}}};let j={limit:100,offset:0,sortBy:{column:`name`,order:`asc`}},M={cacheControl:`3600`,contentType:`text/plain;charset=UTF-8`,upsert:!1};var N=class extends D{constructor(e,t={},n,r){super(e,t,r,`storage`),this.bucketId=n}async uploadOrUpdate(e,t,n,r){return this.handleOperation(async()=>{let i,a={...M,...r},o={...this.headers,...e===`POST`&&{"x-upsert":String(a.upsert)}},s=a.metadata;if(typeof Blob<`u`&&n instanceof Blob?(i=new FormData,i.append(`cacheControl`,a.cacheControl),s&&i.append(`metadata`,this.encodeMetadata(s)),i.append(``,n)):typeof FormData<`u`&&n instanceof FormData?(i=n,i.has(`cacheControl`)||i.append(`cacheControl`,a.cacheControl),s&&!i.has(`metadata`)&&i.append(`metadata`,this.encodeMetadata(s))):(i=n,o[`cache-control`]=`max-age=${a.cacheControl}`,o[`content-type`]=a.contentType,s&&(o[`x-metadata`]=this.toBase64(this.encodeMetadata(s))),(typeof ReadableStream<`u`&&i instanceof ReadableStream||i&&typeof i==`object`&&`pipe`in i&&typeof i.pipe==`function`)&&!a.duplex&&(a.duplex=`half`)),r?.headers)for(let[e,t]of Object.entries(r.headers))o=u(o,e,t);let c=this._removeEmptyFolders(t),l=this._getFinalPath(c),d=await(e==`PUT`?C:S)(this.fetch,`${this.url}/object/${l}`,i,{headers:o,...a?.duplex?{duplex:a.duplex}:{}});return{path:c,id:d.Id,fullPath:d.Key}})}async upload(e,t,n){return this.uploadOrUpdate(`POST`,e,t,n)}async uploadToSignedUrl(e,t,n,r){let i=this._removeEmptyFolders(e),a=this._getFinalPath(i),o=new URL(this.url+`/object/upload/sign/${a}`);return o.searchParams.set(`token`,t),this.handleOperation(async()=>{let e,t={...M,...r},a={...this.headers,"x-upsert":String(t.upsert)},s=t.metadata;if(typeof Blob<`u`&&n instanceof Blob?(e=new FormData,e.append(`cacheControl`,t.cacheControl),s&&e.append(`metadata`,this.encodeMetadata(s)),e.append(``,n)):typeof FormData<`u`&&n instanceof FormData?(e=n,e.has(`cacheControl`)||e.append(`cacheControl`,t.cacheControl),s&&!e.has(`metadata`)&&e.append(`metadata`,this.encodeMetadata(s))):(e=n,a[`cache-control`]=`max-age=${t.cacheControl}`,a[`content-type`]=t.contentType,s&&(a[`x-metadata`]=this.toBase64(this.encodeMetadata(s))),(typeof ReadableStream<`u`&&e instanceof ReadableStream||e&&typeof e==`object`&&`pipe`in e&&typeof e.pipe==`function`)&&!t.duplex&&(t.duplex=`half`)),r?.headers)for(let[e,t]of Object.entries(r.headers))a=u(a,e,t);return{path:i,fullPath:(await C(this.fetch,o.toString(),e,{headers:a,...t?.duplex?{duplex:t.duplex}:{}})).Key}})}async createSignedUploadUrl(e,n){return this.handleOperation(async()=>{let r=this._getFinalPath(e),i={...this.headers};n?.upsert&&(i[`x-upsert`]=`true`);let a=await S(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:i}),o=new URL(this.url+a.url),s=o.searchParams.get(`token`);if(!s)throw new t(`No token returned by API`);return{signedUrl:o.toString(),path:e,token:s}})}async update(e,t,n){return this.uploadOrUpdate(`PUT`,e,t,n)}async move(e,t,n){return this.handleOperation(async()=>await S(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:this.headers}))}async copy(e,t,n){return this.handleOperation(async()=>({path:(await S(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key}))}async createSignedUrl(e,t,n){return this.handleOperation(async()=>{let r=this._getFinalPath(e),i=typeof n?.transform==`object`&&n.transform!==null&&Object.keys(n.transform).length>0,a=await S(this.fetch,`${this.url}/object/sign/${r}`,{expiresIn:t,...i?{transform:n.transform}:{}},{headers:this.headers}),o=new URLSearchParams;n?.download&&o.set(`download`,n.download===!0?``:n.download),n?.cacheNonce!=null&&o.set(`cacheNonce`,String(n.cacheNonce));let s=o.toString();return{signedUrl:encodeURI(`${this.url}${a.signedURL}${s?`&${s}`:``}`)}})}async createSignedUrls(e,t,n){return this.handleOperation(async()=>{let r=await S(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=new URLSearchParams;n?.download&&i.set(`download`,n.download===!0?``:n.download),n?.cacheNonce!=null&&i.set(`cacheNonce`,String(n.cacheNonce));let a=i.toString();return r.map(e=>({...e,signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${a?`&${a}`:``}`):null}))})}download(e,t,n){let r=typeof t?.transform==`object`&&t.transform!==null&&Object.keys(t.transform).length>0?`render/image/authenticated`:`object`,i=new URLSearchParams;t?.transform&&this.applyTransformOptsToQuery(i,t.transform),t?.cacheNonce!=null&&i.set(`cacheNonce`,String(t.cacheNonce));let a=i.toString(),o=this._getFinalPath(e);return new A(()=>x(this.fetch,`${this.url}/${r}/${o}${a?`?${a}`:``}`,{headers:this.headers,noResolveJson:!0},n),this.shouldThrowOnError)}async info(e){let t=this._getFinalPath(e);return this.handleOperation(async()=>m(await x(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers})))}async exists(e){let t=this._getFinalPath(e);try{return await w(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e)){let t=e instanceof r?e.status:e instanceof i?e.originalError?.status:void 0;if(t!==void 0&&[400,404].includes(t))return{data:!1,error:null}}throw e}}getPublicUrl(e,t){let n=this._getFinalPath(e),r=new URLSearchParams;t?.download&&r.set(`download`,t.download===!0?``:t.download),t?.transform&&this.applyTransformOptsToQuery(r,t.transform),t?.cacheNonce!=null&&r.set(`cacheNonce`,String(t.cacheNonce));let i=r.toString(),a=typeof t?.transform==`object`&&t.transform!==null&&Object.keys(t.transform).length>0?`render/image`:`object`;return{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${n}`)+(i?`?${i}`:``)}}}async remove(e){return this.handleOperation(async()=>await T(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}))}async list(e,t,n){return this.handleOperation(async()=>{let r={...j,...t,prefix:e||``};return await S(this.fetch,`${this.url}/object/list/${this.bucketId}`,r,{headers:this.headers},n)})}async listV2(e,t){return this.handleOperation(async()=>{let n={...e};return await S(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<`u`?Buffer.from(e).toString(`base64`):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,``)}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,``).replace(/\/+/g,`/`)}applyTransformOptsToQuery(e,t){return t.width&&e.set(`width`,t.width.toString()),t.height&&e.set(`height`,t.height.toString()),t.resize&&e.set(`resize`,t.resize),t.format&&e.set(`format`,t.format),t.quality&&e.set(`quality`,t.quality.toString()),e}};let P={"X-Client-Info":`storage-js/3.0.0-next.22`};var F=class extends D{constructor(e,t={},n,r){let i=new URL(e);r?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes(`storage.supabase.`)&&(i.hostname=i.hostname.replace(`supabase.`,`storage.supabase.`));let a=i.href.replace(/\/$/,``),o={...P,...t};super(a,o,n,`storage`)}async listBuckets(e){return this.handleOperation(async()=>{let t=this.listBucketOptionsToQueryString(e);return await x(this.fetch,`${this.url}/bucket${t}`,{headers:this.headers})})}async getBucket(e){return this.handleOperation(async()=>await x(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}))}async createBucket(e,t={public:!1}){return this.handleOperation(async()=>await S(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}))}async updateBucket(e,t){return this.handleOperation(async()=>await C(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}))}async emptyBucket(e){return this.handleOperation(async()=>await S(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}))}async deleteBucket(e){return this.handleOperation(async()=>await T(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}))}listBucketOptionsToQueryString(e){let t={};return e&&(`limit`in e&&(t.limit=String(e.limit)),`offset`in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?`?`+new URLSearchParams(t).toString():``}},I=class extends Error{constructor(e,t){super(e),this.name=`IcebergError`,this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType===`CommitStateUnknownException`||[500,502,504].includes(t.status)&&t.icebergType?.includes(`CommitState`)===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function L(e,t,n){let r=new URL(t,e);if(n)for(let[e,t]of Object.entries(n))t!==void 0&&r.searchParams.set(e,t);return r.toString()}async function R(e){return!e||e.type===`none`?{}:e.type===`bearer`?{Authorization:`Bearer ${e.token}`}:e.type===`header`?{[e.name]:e.value}:e.type===`custom`?await e.getHeaders():{}}function z(e){let t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:i,body:a,headers:o}){let s=L(e.baseUrl,r,i),c=await R(e.auth),l=await t(s,{method:n,headers:{...a?{"Content-Type":`application/json`}:{},...c,...o},body:a?JSON.stringify(a):void 0}),u=await l.text(),d=(l.headers.get(`content-type`)||``).includes(`application/json`),f=d&&u?JSON.parse(u):u;if(!l.ok){let e=d?f:void 0,t=e?.error;throw new I(t?.message??`Request failed with status ${l.status}`,{status:l.status,icebergType:t?.type,icebergCode:t?.code,details:e})}return{status:l.status,headers:l.headers,data:f}}}}function B(e){return e.join(``)}var V=class{constructor(e,t=``){this.client=e,this.prefix=t}async listNamespaces(e){let t=e?{parent:B(e.namespace)}:void 0;return(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(e=>({namespace:e}))}async createNamespace(e,t){let n={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:`POST`,path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:`DELETE`,path:`${this.prefix}/namespaces/${B(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${B(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:`HEAD`,path:`${this.prefix}/namespaces/${B(e.namespace)}`}),!0}catch(e){if(e instanceof I&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(e){if(e instanceof I&&e.status===409)return;throw e}}};function H(e){return e.join(``)}var U=class{constructor(e,t=``,n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){let n={};return this.accessDelegation&&(n[`X-Iceberg-Access-Delegation`]=this.accessDelegation),(await this.client.request({method:`POST`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){let n=await this.client.request({method:`POST`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data[`metadata-location`],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:`DELETE`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){let t={};return this.accessDelegation&&(t[`X-Iceberg-Access-Delegation`]=this.accessDelegation),(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){let t={};this.accessDelegation&&(t[`X-Iceberg-Access-Delegation`]=this.accessDelegation);try{return await this.client.request({method:`HEAD`,path:`${this.prefix}/namespaces/${H(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(e){if(e instanceof I&&e.status===404)return!1;throw e}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof I&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},W=class{constructor(e){let t=`v1`;e.catalogName&&(t+=`/${e.catalogName}`),this.client=z({baseUrl:e.baseUrl.endsWith(`/`)?e.baseUrl:`${e.baseUrl}/`,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(`,`),this.namespaceOps=new V(this.client,t),this.tableOps=new U(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},G=class extends D{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...P,...t};super(r,i,n,`storage`)}async createBucket(e){return this.handleOperation(async()=>await S(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}))}async listBuckets(e){return this.handleOperation(async()=>{let t=new URLSearchParams;e?.limit!==void 0&&t.set(`limit`,e.limit.toString()),e?.offset!==void 0&&t.set(`offset`,e.offset.toString()),e?.sortColumn&&t.set(`sortColumn`,e.sortColumn),e?.sortOrder&&t.set(`sortOrder`,e.sortOrder),e?.search&&t.set(`search`,e.search);let n=t.toString(),r=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return await x(this.fetch,r,{headers:this.headers})})}async deleteBucket(e){return this.handleOperation(async()=>await T(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}))}from(e){if(!h(e))throw new t(`Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.`);let n=new W({baseUrl:this.url,catalogName:e,auth:{type:`custom`,getHeaders:async()=>this.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(e,t){let n=e[t];return typeof n==`function`?async(...t)=>{try{return{data:await n.apply(e,t),error:null}}catch(e){if(r)throw e;return{data:null,error:e}}}:n}})}},K=class extends D{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...P,"Content-Type":`application/json`,...t};super(r,i,n,`vectors`)}async createIndex(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers})||{})}async getIndex(e,t){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}))}async listIndexes(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}))}async deleteIndex(e,t){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers})||{})}},q=class extends D{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...P,"Content-Type":`application/json`,...t};super(r,i,n,`vectors`)}async putVectors(e){if(e.vectors.length<1||e.vectors.length>500)throw Error(`Vector batch size must be between 1 and 500 items`);return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers})||{})}async getVectors(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}))}async listVectors(e){if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw Error(`segmentCount must be between 1 and 16`);if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}))}async queryVectors(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}))}async deleteVectors(e){if(e.keys.length<1||e.keys.length>500)throw Error(`Keys batch size must be between 1 and 500 items`);return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers})||{})}},J=class extends D{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...P,"Content-Type":`application/json`,...t};super(r,i,n,`vectors`)}async createBucket(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers})||{})}async getBucket(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}))}async listBuckets(e={}){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}))}async deleteBucket(e){return this.handleOperation(async()=>await E.post(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers})||{})}},Y=class extends J{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new X(this.url,this.headers,e,this.fetch)}async createBucket(e){return super.createBucket(e)}async getBucket(e){return super.getBucket(e)}async listBuckets(e={}){return super.listBuckets(e)}async deleteBucket(e){return super.deleteBucket(e)}},X=class extends K{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){return super.createIndex({...e,vectorBucketName:this.vectorBucketName})}async listIndexes(e={}){return super.listIndexes({...e,vectorBucketName:this.vectorBucketName})}async getIndex(e){return super.getIndex(this.vectorBucketName,e)}async deleteIndex(e){return super.deleteIndex(this.vectorBucketName,e)}index(e){return new Z(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Z=class extends q{constructor(e,t,n,r,i){super(e,t,i),this.vectorBucketName=n,this.indexName=r}async putVectors(e){return super.putVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async getVectors(e){return super.getVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async listVectors(e={}){return super.listVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async queryVectors(e){return super.queryVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async deleteVectors(e){return super.deleteVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}},Q=class extends F{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new N(this.url,this.headers,e,this.fetch)}get vectors(){return new Y(this.url+`/vector`,{headers:this.headers,fetch:this.fetch})}get analytics(){return new G(this.url+`/iceberg`,this.headers,this.fetch)}};return e.StorageAnalyticsClient=G,e.StorageApiError=r,e.StorageClient=Q,e.StorageError=t,e.StorageUnknownError=i,e.StorageVectorsApiError=s,e.StorageVectorsClient=Y,e.StorageVectorsError=a,e.StorageVectorsErrorCode=l,e.StorageVectorsUnknownError=c,e.VectorBucketApi=J,e.VectorBucketScope=X,e.VectorDataApi=q,e.VectorIndexApi=K,e.VectorIndexScope=Z,e.isStorageError=n,e.isStorageVectorsError=o,e})({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supabase/storage-js",
3
- "version": "3.0.0-next.20",
3
+ "version": "3.0.0-next.22",
4
4
  "description": "Isomorphic storage client for Supabase.",
5
5
  "keywords": [
6
6
  "javascript",
@@ -12,7 +12,9 @@ export class StorageClient extends StorageBucketApi {
12
12
  /**
13
13
  * Creates a client for Storage buckets, files, analytics, and vectors.
14
14
  *
15
- * @category File Buckets
15
+ * @category Storage
16
+ * @subcategory File Buckets
17
+ *
16
18
  * @example Using supabase-js (recommended)
17
19
  * ```ts
18
20
  * import { createClient } from '@supabase/supabase-js'
@@ -43,7 +45,9 @@ export class StorageClient extends StorageBucketApi {
43
45
  /**
44
46
  * Perform file operation in a bucket.
45
47
  *
46
- * @category File Buckets
48
+ * @category Storage
49
+ * @subcategory File Buckets
50
+ *
47
51
  * @param id The bucket id to operate on.
48
52
  *
49
53
  * @example Accessing a bucket
@@ -63,7 +67,9 @@ export class StorageClient extends StorageBucketApi {
63
67
  *
64
68
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
65
69
  *
66
- * @category Vector Buckets
70
+ * @category Storage
71
+ * @subcategory Vector Buckets
72
+ *
67
73
  * @returns A StorageVectorsClient instance configured with the current storage settings.
68
74
  */
69
75
  get vectors(): StorageVectorsClient {
@@ -81,7 +87,9 @@ export class StorageClient extends StorageBucketApi {
81
87
  *
82
88
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
83
89
  *
84
- * @category Analytics Buckets
90
+ * @category Storage
91
+ * @subcategory Analytics Buckets
92
+ *
85
93
  * @returns A StorageAnalyticsClient instance configured with the current storage settings.
86
94
  */
87
95
  get analytics(): StorageAnalyticsClient {
@@ -4,4 +4,4 @@
4
4
  // - Debugging and support (identifying which version is running)
5
5
  // - Telemetry and logging (version reporting in errors/analytics)
6
6
  // - Ensuring build artifacts match the published package version
7
- export const version = '3.0.0-next.20'
7
+ export const version = '3.0.0-next.22'
@@ -26,7 +26,8 @@ export default class StorageAnalyticsClient extends BaseApiClient<StorageError>
26
26
  *
27
27
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
28
28
  *
29
- * @category Analytics Buckets
29
+ * @category Storage
30
+ * @subcategory Analytics Buckets
30
31
  * @param url - The base URL for the storage API
31
32
  * @param headers - HTTP headers to include in requests
32
33
  * @param fetch - Optional custom fetch implementation
@@ -60,7 +61,8 @@ export default class StorageAnalyticsClient extends BaseApiClient<StorageError>
60
61
  *
61
62
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
62
63
  *
63
- * @category Analytics Buckets
64
+ * @category Storage
65
+ * @subcategory Analytics Buckets
64
66
  * @param name A unique name for the bucket you are creating
65
67
  * @returns Promise with response containing newly created analytics bucket or error
66
68
  *
@@ -113,7 +115,8 @@ export default class StorageAnalyticsClient extends BaseApiClient<StorageError>
113
115
  *
114
116
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
115
117
  *
116
- * @category Analytics Buckets
118
+ * @category Storage
119
+ * @subcategory Analytics Buckets
117
120
  * @param options Query parameters for listing buckets
118
121
  * @param options.limit Maximum number of buckets to return
119
122
  * @param options.offset Number of buckets to skip
@@ -196,7 +199,8 @@ export default class StorageAnalyticsClient extends BaseApiClient<StorageError>
196
199
  *
197
200
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
198
201
  *
199
- * @category Analytics Buckets
202
+ * @category Storage
203
+ * @subcategory Analytics Buckets
200
204
  * @param bucketName The unique identifier of the bucket you would like to delete
201
205
  * @returns Promise with response containing success message or error
202
206
  *
@@ -251,7 +255,8 @@ export default class StorageAnalyticsClient extends BaseApiClient<StorageError>
251
255
  *
252
256
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
253
257
  *
254
- * @category Analytics Buckets
258
+ * @category Storage
259
+ * @subcategory Analytics Buckets
255
260
  * @param bucketName - The name of the analytics bucket (warehouse) to connect to
256
261
  * @returns The wrapped Iceberg catalog client
257
262
  * @throws {StorageError} If the bucket name is invalid
@@ -32,7 +32,8 @@ export default class StorageBucketApi extends BaseApiClient<StorageError> {
32
32
  /**
33
33
  * Retrieves the details of all Storage buckets within an existing project.
34
34
  *
35
- * @category File Buckets
35
+ * @category Storage
36
+ * @subcategory File Buckets
36
37
  * @param options Query parameters for listing buckets
37
38
  * @param options.limit Maximum number of buckets to return
38
39
  * @param options.offset Number of buckets to skip
@@ -88,7 +89,8 @@ export default class StorageBucketApi extends BaseApiClient<StorageError> {
88
89
  /**
89
90
  * Retrieves the details of an existing Storage bucket.
90
91
  *
91
- * @category File Buckets
92
+ * @category Storage
93
+ * @subcategory File Buckets
92
94
  * @param id The unique identifier of the bucket you would like to retrieve.
93
95
  * @returns Promise with response containing bucket details or error
94
96
  *
@@ -142,7 +144,8 @@ export default class StorageBucketApi extends BaseApiClient<StorageError> {
142
144
  /**
143
145
  * Creates a new Storage bucket
144
146
  *
145
- * @category File Buckets
147
+ * @category Storage
148
+ * @subcategory File Buckets
146
149
  * @param id A unique identifier for the bucket you are creating.
147
150
  * @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations. By default, buckets are private.
148
151
  * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
@@ -222,7 +225,8 @@ export default class StorageBucketApi extends BaseApiClient<StorageError> {
222
225
  /**
223
226
  * Updates a Storage bucket
224
227
  *
225
- * @category File Buckets
228
+ * @category Storage
229
+ * @subcategory File Buckets
226
230
  * @param id A unique identifier for the bucket you are updating.
227
231
  * @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations.
228
232
  * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
@@ -296,7 +300,8 @@ export default class StorageBucketApi extends BaseApiClient<StorageError> {
296
300
  /**
297
301
  * Removes all objects inside a single bucket.
298
302
  *
299
- * @category File Buckets
303
+ * @category Storage
304
+ * @subcategory File Buckets
300
305
  * @param id The unique identifier of the bucket you would like to empty.
301
306
  * @returns Promise with success message or error
302
307
  *
@@ -342,7 +347,8 @@ export default class StorageBucketApi extends BaseApiClient<StorageError> {
342
347
  * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
343
348
  * You must first `empty()` the bucket.
344
349
  *
345
- * @category File Buckets
350
+ * @category Storage
351
+ * @subcategory File Buckets
346
352
  * @param id The unique identifier of the bucket you would like to delete.
347
353
  * @returns Promise with success message or error
348
354
  *
@@ -152,7 +152,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
152
152
  /**
153
153
  * Uploads a file to an existing bucket.
154
154
  *
155
- * @category File Buckets
155
+ * @category Storage
156
+ * @subcategory File Buckets
156
157
  * @param path The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
157
158
  * @param fileBody The body of the file to be stored in the bucket.
158
159
  * @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata.
@@ -220,7 +221,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
220
221
  /**
221
222
  * Upload a file with a token generated from `createSignedUploadUrl`.
222
223
  *
223
- * @category File Buckets
224
+ * @category Storage
225
+ * @subcategory File Buckets
224
226
  * @param path The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
225
227
  * @param token The token generated from `createSignedUploadUrl`
226
228
  * @param fileBody The body of the file to be stored in the bucket.
@@ -328,7 +330,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
328
330
  * Signed upload URLs can be used to upload files to the bucket without further authentication.
329
331
  * They are valid for 2 hours.
330
332
  *
331
- * @category File Buckets
333
+ * @category Storage
334
+ * @subcategory File Buckets
332
335
  * @param path The file path, including the current file name. For example `folder/image.png`.
333
336
  * @param options.upsert If set to true, allows the file to be overwritten if it already exists.
334
337
  * @returns Promise with response containing signed upload URL, token, and path or error
@@ -403,7 +406,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
403
406
  /**
404
407
  * Replaces an existing file at the specified path with a new one.
405
408
  *
406
- * @category File Buckets
409
+ * @category Storage
410
+ * @subcategory File Buckets
407
411
  * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update.
408
412
  * @param fileBody The body of the file to be stored in the bucket.
409
413
  * @param fileOptions Optional file upload options including cacheControl, contentType, and metadata.
@@ -484,7 +488,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
484
488
  /**
485
489
  * Moves an existing file to a new path in the same bucket.
486
490
  *
487
- * @category File Buckets
491
+ * @category Storage
492
+ * @subcategory File Buckets
488
493
  * @param fromPath The original file path, including the current file name. For example `folder/image.png`.
489
494
  * @param toPath The new file path, including the new file name. For example `folder/image-new.png`.
490
495
  * @param options The destination options.
@@ -546,7 +551,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
546
551
  /**
547
552
  * Copies an existing file to a new path in the same bucket.
548
553
  *
549
- * @category File Buckets
554
+ * @category Storage
555
+ * @subcategory File Buckets
550
556
  * @param fromPath The original file path, including the current file name. For example `folder/image.png`.
551
557
  * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.
552
558
  * @param options The destination options.
@@ -609,7 +615,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
609
615
  /**
610
616
  * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
611
617
  *
612
- * @category File Buckets
618
+ * @category Storage
619
+ * @subcategory File Buckets
613
620
  * @param path The file path, including the current file name. For example `folder/image.png`.
614
621
  * @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.
615
622
  * @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
@@ -716,7 +723,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
716
723
  /**
717
724
  * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.
718
725
  *
719
- * @category File Buckets
726
+ * @category Storage
727
+ * @subcategory File Buckets
720
728
  * @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`.
721
729
  * @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.
722
730
  * @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
@@ -800,7 +808,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
800
808
  /**
801
809
  * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead.
802
810
  *
803
- * @category File Buckets
811
+ * @category Storage
812
+ * @subcategory File Buckets
804
813
  * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
805
814
  * @param options.transform Transform the asset before serving it to the client.
806
815
  * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
@@ -898,7 +907,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
898
907
  * Returns detailed file metadata including size, content type, and timestamps.
899
908
  * Note: The API returns `last_modified` field, not `updated_at`.
900
909
  *
901
- * @category File Buckets
910
+ * @category Storage
911
+ * @subcategory File Buckets
902
912
  * @param path The file path, including the file name. For example `folder/image.png`.
903
913
  * @returns Promise with response containing file metadata or error
904
914
  *
@@ -939,7 +949,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
939
949
  /**
940
950
  * Checks the existence of a file.
941
951
  *
942
- * @category File Buckets
952
+ * @category Storage
953
+ * @subcategory File Buckets
943
954
  * @param path The file path, including the file name. For example `folder/image.png`.
944
955
  * @returns `{ data: true, error: null }` when the file exists, `{ data: false, error: null }` when it does not (HTTP 400 or 404), or throws/returns a `StorageError` for any other failure.
945
956
  *
@@ -995,7 +1006,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
995
1006
  * A simple convenience function to get the URL for an asset in a public bucket. If you do not want to use this function, you can construct the public URL by concatenating the bucket URL with the path to the asset.
996
1007
  * This function does not verify if the bucket is public. If a public URL is created for a bucket which is not public, you will not be able to download the asset.
997
1008
  *
998
- * @category File Buckets
1009
+ * @category Storage
1010
+ * @subcategory File Buckets
999
1011
  * @param path The path and name of the file to generate the public URL for. For example `folder/image.png`.
1000
1012
  * @param options.download Triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
1001
1013
  * @param options.transform Transform the asset before serving it to the client.
@@ -1086,7 +1098,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
1086
1098
  * Returns an array of FileObject entries for the deleted files. Note that deprecated
1087
1099
  * fields like `bucket_id` may or may not be present in the response - do not rely on them.
1088
1100
  *
1089
- * @category File Buckets
1101
+ * @category Storage
1102
+ * @subcategory File Buckets
1090
1103
  * @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].
1091
1104
  * @returns Promise with response containing array of deleted file objects or error
1092
1105
  *
@@ -1203,7 +1216,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
1203
1216
  * Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned
1204
1217
  * by this method.
1205
1218
  *
1206
- * @category File Buckets
1219
+ * @category Storage
1220
+ * @subcategory File Buckets
1207
1221
  * @param path The folder path.
1208
1222
  * @param options Search options including limit (defaults to 100), offset, sortBy, and search
1209
1223
  * @param parameters Optional fetch parameters including signal for cancellation
@@ -1311,7 +1325,8 @@ export default class StorageFileApi extends BaseApiClient<StorageError> {
1311
1325
  *
1312
1326
  * @experimental this method signature might change in the future
1313
1327
  *
1314
- * @category File Buckets
1328
+ * @category Storage
1329
+ * @subcategory File Buckets
1315
1330
  * @param options Search options including prefix, cursor for pagination, limit, with_delimiter
1316
1331
  * @param parameters Optional fetch parameters including signal for cancellation
1317
1332
  * @returns Promise with response containing folders/objects arrays with pagination info or error
@@ -85,7 +85,8 @@ export class StorageVectorsClient extends VectorBucketApi {
85
85
  *
86
86
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
87
87
  *
88
- * @category Vector Buckets
88
+ * @category Storage
89
+ * @subcategory Vector Buckets
89
90
  * @param url - Base URL of the Storage Vectors REST API.
90
91
  * @param options.headers - Optional headers (for example `Authorization`) applied to every request.
91
92
  * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes.
@@ -118,7 +119,8 @@ export class StorageVectorsClient extends VectorBucketApi {
118
119
  *
119
120
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
120
121
  *
121
- * @category Vector Buckets
122
+ * @category Storage
123
+ * @subcategory Vector Buckets
122
124
  * @param vectorBucketName - Name of the vector bucket
123
125
  * @returns Bucket-scoped client with index and vector operations
124
126
  *
@@ -140,7 +142,8 @@ export class StorageVectorsClient extends VectorBucketApi {
140
142
  *
141
143
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
142
144
  *
143
- * @category Vector Buckets
145
+ * @category Storage
146
+ * @subcategory Vector Buckets
144
147
  * @param vectorBucketName - Unique name for the vector bucket
145
148
  * @returns Promise with empty response on success or error
146
149
  *
@@ -164,7 +167,8 @@ export class StorageVectorsClient extends VectorBucketApi {
164
167
  *
165
168
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
166
169
  *
167
- * @category Vector Buckets
170
+ * @category Storage
171
+ * @subcategory Vector Buckets
168
172
  * @param vectorBucketName - Name of the vector bucket
169
173
  * @returns Promise with bucket metadata or error
170
174
  *
@@ -190,7 +194,8 @@ export class StorageVectorsClient extends VectorBucketApi {
190
194
  *
191
195
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
192
196
  *
193
- * @category Vector Buckets
197
+ * @category Storage
198
+ * @subcategory Vector Buckets
194
199
  * @param options - Optional filters (prefix, maxResults, nextToken)
195
200
  * @returns Promise with list of buckets or error
196
201
  *
@@ -221,7 +226,8 @@ export class StorageVectorsClient extends VectorBucketApi {
221
226
  *
222
227
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
223
228
  *
224
- * @category Vector Buckets
229
+ * @category Storage
230
+ * @subcategory Vector Buckets
225
231
  * @param vectorBucketName - Name of the vector bucket to delete
226
232
  * @returns Promise with empty response on success or error
227
233
  *
@@ -257,7 +263,8 @@ export class VectorBucketScope extends VectorIndexApi {
257
263
  *
258
264
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
259
265
  *
260
- * @category Vector Buckets
266
+ * @category Storage
267
+ * @subcategory Vector Buckets
261
268
  * @example Creating a vector bucket scope
262
269
  * ```typescript
263
270
  * const bucket = supabase.storage.vectors.from('embeddings-prod')
@@ -282,7 +289,8 @@ export class VectorBucketScope extends VectorIndexApi {
282
289
  *
283
290
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
284
291
  *
285
- * @category Vector Buckets
292
+ * @category Storage
293
+ * @subcategory Vector Buckets
286
294
  * @param options - Index configuration (vectorBucketName is automatically set)
287
295
  * @returns Promise with empty response on success or error
288
296
  *
@@ -316,7 +324,8 @@ export class VectorBucketScope extends VectorIndexApi {
316
324
  *
317
325
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
318
326
  *
319
- * @category Vector Buckets
327
+ * @category Storage
328
+ * @subcategory Vector Buckets
320
329
  * @param options - Listing options (vectorBucketName is automatically set)
321
330
  * @returns Promise with response containing indexes array and pagination token or error
322
331
  *
@@ -342,7 +351,8 @@ export class VectorBucketScope extends VectorIndexApi {
342
351
  *
343
352
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
344
353
  *
345
- * @category Vector Buckets
354
+ * @category Storage
355
+ * @subcategory Vector Buckets
346
356
  * @param indexName - Name of the index to retrieve
347
357
  * @returns Promise with index metadata or error
348
358
  *
@@ -366,7 +376,8 @@ export class VectorBucketScope extends VectorIndexApi {
366
376
  *
367
377
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
368
378
  *
369
- * @category Vector Buckets
379
+ * @category Storage
380
+ * @subcategory Vector Buckets
370
381
  * @param indexName - Name of the index to delete
371
382
  * @returns Promise with empty response on success or error
372
383
  *
@@ -389,7 +400,8 @@ export class VectorBucketScope extends VectorIndexApi {
389
400
  *
390
401
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
391
402
  *
392
- * @category Vector Buckets
403
+ * @category Storage
404
+ * @subcategory Vector Buckets
393
405
  * @param indexName - Name of the index
394
406
  * @returns Index-scoped client with vector data operations
395
407
  *
@@ -443,7 +455,8 @@ export class VectorIndexScope extends VectorDataApi {
443
455
  *
444
456
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
445
457
  *
446
- * @category Vector Buckets
458
+ * @category Storage
459
+ * @subcategory Vector Buckets
447
460
  * @example Creating a vector index scope
448
461
  * ```typescript
449
462
  * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
@@ -470,7 +483,8 @@ export class VectorIndexScope extends VectorDataApi {
470
483
  *
471
484
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
472
485
  *
473
- * @category Vector Buckets
486
+ * @category Storage
487
+ * @subcategory Vector Buckets
474
488
  * @param options - Vector insertion options (bucket and index names automatically set)
475
489
  * @returns Promise with empty response on success or error
476
490
  *
@@ -505,7 +519,8 @@ export class VectorIndexScope extends VectorDataApi {
505
519
  *
506
520
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
507
521
  *
508
- * @category Vector Buckets
522
+ * @category Storage
523
+ * @subcategory Vector Buckets
509
524
  * @param options - Vector retrieval options (bucket and index names automatically set)
510
525
  * @returns Promise with response containing vectors array or error
511
526
  *
@@ -535,7 +550,8 @@ export class VectorIndexScope extends VectorDataApi {
535
550
  *
536
551
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
537
552
  *
538
- * @category Vector Buckets
553
+ * @category Storage
554
+ * @subcategory Vector Buckets
539
555
  * @param options - Listing options (bucket and index names automatically set)
540
556
  * @returns Promise with response containing vectors array and pagination token or error
541
557
  *
@@ -567,7 +583,8 @@ export class VectorIndexScope extends VectorDataApi {
567
583
  *
568
584
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
569
585
  *
570
- * @category Vector Buckets
586
+ * @category Storage
587
+ * @subcategory Vector Buckets
571
588
  * @param options - Query options (bucket and index names automatically set)
572
589
  * @returns Promise with response containing matches array of similar vectors ordered by distance or error
573
590
  *
@@ -602,7 +619,8 @@ export class VectorIndexScope extends VectorDataApi {
602
619
  *
603
620
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
604
621
  *
605
- * @category Vector Buckets
622
+ * @category Storage
623
+ * @subcategory Vector Buckets
606
624
  * @param options - Deletion options (bucket and index names automatically set)
607
625
  * @returns Promise with empty response on success or error
608
626
  *