@supabase/storage-js 2.86.2 → 2.86.3-canary.0
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/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.d.ts.map +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/lib/version.js.map +1 -1
- package/dist/main/packages/StorageAnalyticsClient.d.ts +37 -38
- package/dist/main/packages/StorageAnalyticsClient.d.ts.map +1 -1
- package/dist/main/packages/StorageAnalyticsClient.js +47 -37
- package/dist/main/packages/StorageAnalyticsClient.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.d.ts.map +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/lib/version.js.map +1 -1
- package/dist/module/packages/StorageAnalyticsClient.d.ts +37 -38
- package/dist/module/packages/StorageAnalyticsClient.d.ts.map +1 -1
- package/dist/module/packages/StorageAnalyticsClient.js +47 -37
- package/dist/module/packages/StorageAnalyticsClient.js.map +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/supabase.js +1 -1
- package/package.json +2 -2
- package/src/lib/version.ts +1 -1
- package/src/packages/StorageAnalyticsClient.ts +60 -39
package/dist/umd/supabase.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.supabase=t():e.supabase=t()}(self,()=>(()=>{"use strict";var e={12:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateVectorDimension=t.normalizeToFloat32=t.isPlainObject=t.resolveResponse=t.resolveFetch=void 0,t.resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),t.resolveResponse=()=>Response,t.isPlainObject=e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},t.normalizeToFloat32=e=>Array.from(new Float32Array(e)),t.validateVectorDimension=(e,t)=>{if(void 0!==t&&e.float32.length!==t)throw new Error(`Vector dimension mismatch: expected ${t}, got ${e.float32.length}`)}},96:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(643),s=r(251),i=r(607),a=r(442),c=r(819);t.default=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},s.DEFAULT_HEADERS),t),this.fetch=(0,c.resolveFetch)(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,a.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,i.isStorageError)(e))return{data:null,error:e};throw e}})}listBuckets(e){return o.__awaiter(this,void 0,void 0,function*(){try{const t=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&t.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&t.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&t.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&t.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&t.set("search",e.search);const r=t.toString(),o=r?`${this.url}/bucket?${r}`:`${this.url}/bucket`;return{data:yield(0,a.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,i.isStorageError)(e))return{data:null,error:e};throw e}})}deleteBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,a.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,i.isStorageError)(e))return{data:null,error:e};throw e}})}from(e){if(!(0,c.isValidBucketName)(e))throw new i.StorageError("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");return new n.IcebergRestCatalog({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:()=>o.__awaiter(this,void 0,void 0,function*(){return this.headers})},fetch:this.fetch})}}},251:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_HEADERS=void 0;const o=r(822);t.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${o.version}`}},272:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(680),s=r(538),i=r(317),a=r(12);t.default=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},n.DEFAULT_HEADERS),t),this.fetch=(0,a.resolveFetch)(r)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return o.__awaiter(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield(0,i.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}getVectors(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}listVectors(e){return o.__awaiter(this,void 0,void 0,function*(){try{if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return{data:yield(0,i.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}queryVectors(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}deleteVectors(e){return o.__awaiter(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield(0,i.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}}},317:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.get=function(e,t,r,n){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"GET",t,r,n)})},t.post=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"POST",t,n,s,r)})},t.put=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"PUT",t,n,s,r)})},t.remove=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"DELETE",t,n,s,r)})};const o=r(823),n=r(538),s=r(12),i=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),a=(e,t,r)=>o.__awaiter(void 0,void 0,void 0,function*(){if(e&&"object"==typeof e&&"status"in e&&"ok"in e&&"number"==typeof e.status&&!(null==r?void 0:r.noResolveJson)){const r=e.status||500,o=e;if("function"==typeof o.json)o.json().then(e=>{const o=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||r+"";t(new n.StorageVectorsApiError(i(e),r,o))}).catch(()=>{const e=r+"",s=o.statusText||`HTTP ${r} error`;t(new n.StorageVectorsApiError(s,r,e))});else{const e=r+"",s=o.statusText||`HTTP ${r} error`;t(new n.StorageVectorsApiError(s,r,e))}}else t(new n.StorageVectorsUnknownError(i(e),e))}),c=(e,t,r,o)=>{const n={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&o?((0,s.isPlainObject)(o)?(n.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),n.body=JSON.stringify(o)):n.body=o,Object.assign(Object.assign({},n),r)):n};function u(e,t,r,n,s,i){return o.__awaiter(this,void 0,void 0,function*(){return new Promise((o,u)=>{e(r,c(t,n,s,i)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;const t=e.headers.get("content-type");return t&&t.includes("application/json")?e.json():{}}).then(e=>o(e)).catch(e=>a(e,u,n))})})}},368:(e,t,r)=>{var o;Object.defineProperty(t,"__esModule",{value:!0});const n=r(823),s=r(607),i=n.__importDefault(r(857));o=Symbol.toStringTag,t.default=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[o]="BlobDownloadBuilder",this.promise=null}asStream(){return new i.default(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.promise=this.execute()),this.promise}execute(){return n.__awaiter(this,void 0,void 0,function*(){try{const e=yield this.downloadFn();return{data:yield e.blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}}},411:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},442:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.get=function(e,t,r,n){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"GET",t,r,n)})},t.post=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"POST",t,n,s,r)})},t.put=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"PUT",t,n,s,r)})},t.head=function(e,t,r,n){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})},t.remove=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"DELETE",t,n,s,r)})};const o=r(823),n=r(607),s=r(819),i=e=>{var t;return e.msg||e.message||e.error_description||("string"==typeof e.error?e.error:null===(t=e.error)||void 0===t?void 0:t.message)||JSON.stringify(e)},a=(e,t,r)=>o.__awaiter(void 0,void 0,void 0,function*(){const o=yield(0,s.resolveResponse)();e instanceof o&&!(null==r?void 0:r.noResolveJson)?e.json().then(r=>{const o=e.status||500,s=(null==r?void 0:r.statusCode)||o+"";t(new n.StorageApiError(i(r),o,s))}).catch(e=>{t(new n.StorageUnknownError(i(e),e))}):t(new n.StorageUnknownError(i(e),e))}),c=(e,t,r,o)=>{const n={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&o?((0,s.isPlainObject)(o)?(n.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),n.body=JSON.stringify(o)):n.body=o,(null==t?void 0:t.duplex)&&(n.duplex=t.duplex),Object.assign(Object.assign({},n),r)):n};function u(e,t,r,n,s,i){return o.__awaiter(this,void 0,void 0,function*(){return new Promise((o,u)=>{e(r,c(t,n,s,i)).then(e=>{if(!e.ok)throw e;return(null==n?void 0:n.noResolveJson)?e:e.json()}).then(e=>o(e)).catch(e=>a(e,u,n))})})}},456:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StorageClient=void 0;const o=r(823),n=o.__importDefault(r(781)),s=o.__importDefault(r(485)),i=o.__importDefault(r(96)),a=r(833);class c extends s.default{constructor(e,t={},r,o){super(e,t,r,o)}from(e){return new n.default(this.url,this.headers,e,this.fetch)}get vectors(){return new a.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new i.default(this.url+"/iceberg",this.headers,this.fetch)}}t.StorageClient=c},485:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(251),s=r(607),i=r(442),a=r(819);t.default=class{constructor(e,t={},r,o){this.shouldThrowOnError=!1;const s=new URL(e);(null==o?void 0:o.useNewHostname)&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},n.DEFAULT_HEADERS),t),this.fetch=(0,a.resolveFetch)(r)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return o.__awaiter(this,void 0,void 0,function*(){try{const t=this.listBucketOptionsToQueryString(e);return{data:yield(0,i.get)(this.fetch,`${this.url}/bucket${t}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}getBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}createBucket(e){return o.__awaiter(this,arguments,void 0,function*(e,t={public:!1}){try{return{data:yield(0,i.post)(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}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}updateBucket(e,t){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.put)(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}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}emptyBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}deleteBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}listBucketOptionsToQueryString(e){const 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():""}}},538:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StorageVectorsErrorCode=t.StorageVectorsUnknownError=t.StorageVectorsApiError=t.StorageVectorsError=void 0,t.isStorageVectorsError=function(e){return"object"==typeof e&&null!==e&&"__isStorageVectorsError"in e};class r extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}var o;t.StorageVectorsError=r,t.StorageVectorsApiError=class extends r{constructor(e,t,r){super(e),this.name="StorageVectorsApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},t.StorageVectorsUnknownError=class extends r{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}},function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"}(o||(t.StorageVectorsErrorCode=o={}))},562:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(680),s=r(538),i=r(317),a=r(12);t.default=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},n.DEFAULT_HEADERS),t),this.fetch=(0,a.resolveFetch)(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,i.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}getIndex(e,t){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}listIndexes(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}deleteIndex(e,t){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,i.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}}},565:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VectorIndexScope=t.VectorBucketScope=t.StorageVectorsClient=void 0;const o=r(823),n=o.__importDefault(r(562)),s=o.__importDefault(r(272)),i=o.__importDefault(r(658));class a extends i.default{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new c(this.url,this.headers,e,this.fetch)}createBucket(e){const t=Object.create(null,{createBucket:{get:()=>super.createBucket}});return o.__awaiter(this,void 0,void 0,function*(){return t.createBucket.call(this,e)})}getBucket(e){const t=Object.create(null,{getBucket:{get:()=>super.getBucket}});return o.__awaiter(this,void 0,void 0,function*(){return t.getBucket.call(this,e)})}listBuckets(){const e=Object.create(null,{listBuckets:{get:()=>super.listBuckets}});return o.__awaiter(this,arguments,void 0,function*(t={}){return e.listBuckets.call(this,t)})}deleteBucket(e){const t=Object.create(null,{deleteBucket:{get:()=>super.deleteBucket}});return o.__awaiter(this,void 0,void 0,function*(){return t.deleteBucket.call(this,e)})}}t.StorageVectorsClient=a;class c extends n.default{constructor(e,t,r,o){super(e,t,o),this.vectorBucketName=r}createIndex(e){const t=Object.create(null,{createIndex:{get:()=>super.createIndex}});return o.__awaiter(this,void 0,void 0,function*(){return t.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return o.__awaiter(this,arguments,void 0,function*(t={}){return e.listIndexes.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){const t=Object.create(null,{getIndex:{get:()=>super.getIndex}});return o.__awaiter(this,void 0,void 0,function*(){return t.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){const t=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return o.__awaiter(this,void 0,void 0,function*(){return t.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new u(this.url,this.headers,this.vectorBucketName,e,this.fetch)}}t.VectorBucketScope=c;class u extends s.default{constructor(e,t,r,o,n){super(e,t,n),this.vectorBucketName=r,this.indexName=o}putVectors(e){const t=Object.create(null,{putVectors:{get:()=>super.putVectors}});return o.__awaiter(this,void 0,void 0,function*(){return t.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){const t=Object.create(null,{getVectors:{get:()=>super.getVectors}});return o.__awaiter(this,void 0,void 0,function*(){return t.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){const e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return o.__awaiter(this,arguments,void 0,function*(t={}){return e.listVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){const t=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return o.__awaiter(this,void 0,void 0,function*(){return t.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){const t=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return o.__awaiter(this,void 0,void 0,function*(){return t.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}t.VectorIndexScope=u},607:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StorageUnknownError=t.StorageApiError=t.StorageError=void 0,t.isStorageError=function(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e};class r extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}t.StorageError=r,t.StorageApiError=class extends r{constructor(e,t,r){super(e),this.name="StorageApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},t.StorageUnknownError=class extends r{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}},643:(e,t)=>{var r=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="CommitStateUnknownException"===t.icebergType||[500,502,504].includes(t.status)&&!0===t.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function o(e){return e.join("")}var n=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:o(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){const r={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${o(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${o(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${o(e.namespace)}`}),!0}catch(e){if(e instanceof r&&404===e.status)return!1;throw e}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(e){if(e instanceof r&&409===e.status)return;throw e}}};function s(e){return e.join("")}var i=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(e){if(e instanceof r&&404===e.status)return!1;throw e}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(o){if(o instanceof r&&409===o.status)return await this.loadTable({namespace:e.namespace,name:t.name});throw o}}};t.IcebergError=r,t.IcebergRestCatalog=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const o=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=function(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:o,path:n,query:s,body:i,headers:a}){const c=function(e,t,r){const o=new URL(t,e);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,t);return o.toString()}(e.baseUrl,n,s),u=await async function(e){return e&&"none"!==e.type?"bearer"===e.type?{Authorization:`Bearer ${e.token}`}:"header"===e.type?{[e.name]:e.value}:"custom"===e.type?await e.getHeaders():{}:{}}(e.auth),l=await t(c,{method:o,headers:{...i?{"Content-Type":"application/json"}:{},...u,...a},body:i?JSON.stringify(i):void 0}),h=await l.text(),d=(l.headers.get("content-type")||"").includes("application/json"),f=d&&h?JSON.parse(h):h;if(!l.ok){const e=d?f:void 0,t=e?.error;throw new r(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}}}}({baseUrl:o,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new n(this.client,t),this.tableOps=new i(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)}},t.getCurrentSchema=function(e){return e.schemas.find(t=>t["schema-id"]===e["current-schema-id"])}},646:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StorageAnalyticsClient=t.StorageClient=void 0;const o=r(823);var n=r(456);Object.defineProperty(t,"StorageClient",{enumerable:!0,get:function(){return n.StorageClient}});var s=r(96);Object.defineProperty(t,"StorageAnalyticsClient",{enumerable:!0,get:function(){return o.__importDefault(s).default}}),o.__exportStar(r(411),t),o.__exportStar(r(607),t),o.__exportStar(r(833),t)},658:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(680),s=r(538),i=r(317),a=r(12);t.default=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},n.DEFAULT_HEADERS),t),this.fetch=(0,a.resolveFetch)(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,i.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}getBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}listBuckets(){return o.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}deleteBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,i.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}}},680:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_HEADERS=void 0;const o=r(822);t.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${o.version}`,"Content-Type":"application/json"}},781:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(607),s=r(442),i=r(819),a=o.__importDefault(r(368)),c={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},u={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};t.default=class{constructor(e,t={},r,o){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=r,this.fetch=(0,i.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,t,r,i){return o.__awaiter(this,void 0,void 0,function*(){try{let o;const n=Object.assign(Object.assign({},u),i);let a=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(n.upsert)});const c=n.metadata;"undefined"!=typeof Blob&&r instanceof Blob?(o=new FormData,o.append("cacheControl",n.cacheControl),c&&o.append("metadata",this.encodeMetadata(c)),o.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(o=r,o.has("cacheControl")||o.append("cacheControl",n.cacheControl),c&&!o.has("metadata")&&o.append("metadata",this.encodeMetadata(c))):(o=r,a["cache-control"]=`max-age=${n.cacheControl}`,a["content-type"]=n.contentType,c&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(c))),("undefined"!=typeof ReadableStream&&o instanceof ReadableStream||o&&"object"==typeof o&&"pipe"in o&&"function"==typeof o.pipe)&&!n.duplex&&(n.duplex="half")),(null==i?void 0:i.headers)&&(a=Object.assign(Object.assign({},a),i.headers));const l=this._removeEmptyFolders(t),h=this._getFinalPath(l),d=yield("PUT"==e?s.put:s.post)(this.fetch,`${this.url}/object/${h}`,o,Object.assign({headers:a},(null==n?void 0:n.duplex)?{duplex:n.duplex}:{}));return{data:{path:l,id:d.Id,fullPath:d.Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}upload(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}uploadToSignedUrl(e,t,r,i){return o.__awaiter(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(e),a=this._getFinalPath(o),c=new URL(this.url+`/object/upload/sign/${a}`);c.searchParams.set("token",t);try{let e;const t=Object.assign({upsert:u.upsert},i),n=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});return"undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.append("cacheControl",t.cacheControl)):(e=r,n["cache-control"]=`max-age=${t.cacheControl}`,n["content-type"]=t.contentType),{data:{path:o,fullPath:(yield(0,s.put)(this.fetch,c.toString(),e,{headers:n})).Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}createSignedUploadUrl(e,t){return o.__awaiter(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e);const o=Object.assign({},this.headers);(null==t?void 0:t.upsert)&&(o["x-upsert"]="true");const i=yield(0,s.post)(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:o}),a=new URL(this.url+i.url),c=a.searchParams.get("token");if(!c)throw new n.StorageError("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:c},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}update(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,s.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}copy(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,s.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}createSignedUrl(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),n=yield(0,s.post)(this.fetch,`${this.url}/object/sign/${o}`,Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers});const i=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return n={signedUrl:encodeURI(`${this.url}${n.signedURL}${i}`)},{data:n,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}createSignedUrls(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){try{const o=yield(0,s.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),n=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:o.map(e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${n}`):null})),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}download(e,t){const r=void 0!==(null==t?void 0:t.transform)?"render/image/authenticated":"object",o=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),n=o?`?${o}`:"",i=this._getFinalPath(e);return new a.default(()=>(0,s.get)(this.fetch,`${this.url}/${r}/${i}${n}`,{headers:this.headers,noResolveJson:!0}),this.shouldThrowOnError)}info(e){return o.__awaiter(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{const e=yield(0,s.get)(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:(0,i.recursiveToCamel)(e),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}exists(e){return o.__awaiter(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{return yield(0,s.head)(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e)&&e instanceof n.StorageUnknownError){const t=e.originalError;if([400,404].includes(null==t?void 0:t.status))return{data:!1,error:e}}throw e}})}getPublicUrl(e,t){const r=this._getFinalPath(e),o=[],n=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==n&&o.push(n);const s=void 0!==(null==t?void 0:t.transform)?"render/image":"object",i=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==i&&o.push(i);let a=o.join("&");return""!==a&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}${a}`)}}}remove(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,s.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}list(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){try{const o=Object.assign(Object.assign(Object.assign({},c),t),{prefix:e||""});return{data:yield(0,s.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,o,{headers:this.headers},r),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}listV2(e,t){return o.__awaiter(this,void 0,void 0,function*(){try{const r=Object.assign({},e);return{data:yield(0,s.post)(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},t),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}},819:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isValidBucketName=t.isPlainObject=t.recursiveToCamel=t.resolveResponse=t.resolveFetch=void 0,t.resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),t.resolveResponse=()=>Response,t.recursiveToCamel=e=>{if(Array.isArray(e))return e.map(e=>(0,t.recursiveToCamel)(e));if("function"==typeof e||e!==Object(e))return e;const r={};return Object.entries(e).forEach(([e,o])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));r[n]=(0,t.recursiveToCamel)(o)}),r},t.isPlainObject=e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},t.isValidBucketName=e=>!(!e||"string"!=typeof e)&&(!(0===e.length||e.length>100)&&(e.trim()===e&&(!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e))))},822:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="2.86.2"},823:(e,t,r)=>{r.r(t),r.d(t,{__addDisposableResource:()=>C,__assign:()=>s,__asyncDelegator:()=>j,__asyncGenerator:()=>S,__asyncValues:()=>T,__await:()=>E,__awaiter:()=>p,__classPrivateFieldGet:()=>I,__classPrivateFieldIn:()=>N,__classPrivateFieldSet:()=>B,__createBinding:()=>m,__decorate:()=>a,__disposeResources:()=>F,__esDecorate:()=>u,__exportStar:()=>g,__extends:()=>n,__generator:()=>y,__importDefault:()=>$,__importStar:()=>V,__makeTemplateObject:()=>x,__metadata:()=>f,__param:()=>c,__propKey:()=>h,__read:()=>w,__rest:()=>i,__rewriteRelativeImportExtension:()=>A,__runInitializers:()=>l,__setFunctionName:()=>d,__spread:()=>b,__spreadArray:()=>O,__spreadArrays:()=>_,__values:()=>v,default:()=>U});var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},o(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return s=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},s.apply(this,arguments)};function i(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}function a(e,t,r,o){var n,s=arguments.length,i=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,o);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(i=(s<3?n(i):s>3?n(t,r,i):n(t,r))||i);return s>3&&i&&Object.defineProperty(t,r,i),i}function c(e,t){return function(r,o){t(r,o,e)}}function u(e,t,r,o,n,s){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,c=o.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?o.static?e:e.prototype:null,h=t||(l?Object.getOwnPropertyDescriptor(l,o.name):{}),d=!1,f=r.length-1;f>=0;f--){var p={};for(var y in o)p[y]="access"===y?{}:o[y];for(var y in o.access)p.access[y]=o.access[y];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(e||null))};var m=(0,r[f])("accessor"===c?{get:h.get,set:h.set}:h[u],p);if("accessor"===c){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=i(m.get))&&(h.get=a),(a=i(m.set))&&(h.set=a),(a=i(m.init))&&n.unshift(a)}else(a=i(m))&&("field"===c?n.unshift(a):h[u]=a)}l&&Object.defineProperty(l,o.name,h),d=!0}function l(e,t,r){for(var o=arguments.length>2,n=0;n<t.length;n++)r=o?t[n].call(e,r):t[n].call(e);return o?r:void 0}function h(e){return"symbol"==typeof e?e:"".concat(e)}function d(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function f(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,r,o){return new(r||(r=Promise))(function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,a)}c((o=o.apply(e,t||[])).next())})}function y(e,t){var r,o,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,o&&(n=2&a[0]?o.return:a[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,a[1])).done)return n;switch(o=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],o=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var m=Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]};function g(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||m(t,e,r)}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=s.next()).done;)i.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(w(arguments[t]));return e}function _(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var o=Array(e),n=0;for(t=0;t<r;t++)for(var s=arguments[t],i=0,a=s.length;i<a;i++,n++)o[n]=s[i];return o}function O(e,t,r){if(r||2===arguments.length)for(var o,n=0,s=t.length;n<s;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function E(e){return this instanceof E?(this.v=e,this):new E(e)}function S(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,n=r.apply(e,t||[]),s=[];return o=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),i("next"),i("throw"),i("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(e,t){n[e]&&(o[e]=function(t){return new Promise(function(r,o){s.push([e,t,r,o])>1||a(e,t)})},t&&(o[e]=t(o[e])))}function a(e,t){try{(r=n[e](t)).value instanceof E?Promise.resolve(r.value.v).then(c,u):l(s[0][2],r)}catch(e){l(s[0][3],e)}var r}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function j(e){var t,r;return t={},o("next"),o("throw",function(e){throw e}),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,n){t[o]=e[o]?function(t){return(r=!r)?{value:E(e[o](t)),done:!1}:n?n(t):t}:n}}function T(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=v(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(r){t[r]=e[r]&&function(t){return new Promise(function(o,n){!function(e,t,r,o){Promise.resolve(o).then(function(t){e({value:t,done:r})},t)}(o,n,(t=e[r](t)).done,t.value)})}}}function x(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var k=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},P=function(e){return P=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},P(e)};function V(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=P(e),o=0;o<r.length;o++)"default"!==r[o]&&m(t,e,r[o]);return k(t,e),t}function $(e){return e&&e.__esModule?e:{default:e}}function I(e,t,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(e):o?o.value:t.get(e)}function B(e,t,r,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,r):n?n.value=r:t.set(e,r),r}function N(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function C(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var o,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=t[Symbol.asyncDispose]}if(void 0===o){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=t[Symbol.dispose],r&&(n=o)}if("function"!=typeof o)throw new TypeError("Object not disposable.");n&&(o=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:o,async:r})}else r&&e.stack.push({async:!0});return t}var D="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var o=new Error(r);return o.name="SuppressedError",o.error=e,o.suppressed=t,o};function F(e){function t(t){e.error=e.hasError?new D(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var r,o=0;return function n(){for(;r=e.stack.pop();)try{if(!r.async&&1===o)return o=0,e.stack.push(r),Promise.resolve().then(n);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return o|=2,Promise.resolve(s).then(n,function(e){return t(e),n()})}else o|=1}catch(e){t(e)}if(1===o)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function A(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,o,n,s){return r?t?".jsx":".js":!o||n&&s?o+n+"."+s.toLowerCase()+"js":e}):e}const U={__extends:n,__assign:s,__rest:i,__decorate:a,__param:c,__esDecorate:u,__runInitializers:l,__propKey:h,__setFunctionName:d,__metadata:f,__awaiter:p,__generator:y,__createBinding:m,__exportStar:g,__values:v,__read:w,__spread:b,__spreadArrays:_,__spreadArray:O,__await:E,__asyncGenerator:S,__asyncDelegator:j,__asyncValues:T,__makeTemplateObject:x,__importStar:V,__importDefault:$,__classPrivateFieldGet:I,__classPrivateFieldSet:B,__classPrivateFieldIn:N,__addDisposableResource:C,__disposeResources:F,__rewriteRelativeImportExtension:A}},833:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateVectorDimension=t.normalizeToFloat32=t.isPlainObject=t.resolveResponse=t.resolveFetch=t.isStorageVectorsError=t.StorageVectorsErrorCode=t.StorageVectorsUnknownError=t.StorageVectorsApiError=t.StorageVectorsError=t.VectorDataApi=t.VectorIndexApi=t.VectorBucketApi=t.VectorIndexScope=t.VectorBucketScope=t.StorageVectorsClient=void 0;const o=r(823);var n=r(565);Object.defineProperty(t,"StorageVectorsClient",{enumerable:!0,get:function(){return n.StorageVectorsClient}}),Object.defineProperty(t,"VectorBucketScope",{enumerable:!0,get:function(){return n.VectorBucketScope}}),Object.defineProperty(t,"VectorIndexScope",{enumerable:!0,get:function(){return n.VectorIndexScope}});var s=r(658);Object.defineProperty(t,"VectorBucketApi",{enumerable:!0,get:function(){return o.__importDefault(s).default}});var i=r(562);Object.defineProperty(t,"VectorIndexApi",{enumerable:!0,get:function(){return o.__importDefault(i).default}});var a=r(272);Object.defineProperty(t,"VectorDataApi",{enumerable:!0,get:function(){return o.__importDefault(a).default}});var c=r(538);Object.defineProperty(t,"StorageVectorsError",{enumerable:!0,get:function(){return c.StorageVectorsError}}),Object.defineProperty(t,"StorageVectorsApiError",{enumerable:!0,get:function(){return c.StorageVectorsApiError}}),Object.defineProperty(t,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return c.StorageVectorsUnknownError}}),Object.defineProperty(t,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return c.StorageVectorsErrorCode}}),Object.defineProperty(t,"isStorageVectorsError",{enumerable:!0,get:function(){return c.isStorageVectorsError}});var u=r(12);Object.defineProperty(t,"resolveFetch",{enumerable:!0,get:function(){return u.resolveFetch}}),Object.defineProperty(t,"resolveResponse",{enumerable:!0,get:function(){return u.resolveResponse}}),Object.defineProperty(t,"isPlainObject",{enumerable:!0,get:function(){return u.isPlainObject}}),Object.defineProperty(t,"normalizeToFloat32",{enumerable:!0,get:function(){return u.normalizeToFloat32}}),Object.defineProperty(t,"validateVectorDimension",{enumerable:!0,get:function(){return u.validateVectorDimension}})},857:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(607);t.default=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}execute(){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,r),s.exports}return r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(646)})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.supabase=t():e.supabase=t()}(self,()=>(()=>{"use strict";var e={12:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateVectorDimension=t.normalizeToFloat32=t.isPlainObject=t.resolveResponse=t.resolveFetch=void 0,t.resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),t.resolveResponse=()=>Response,t.isPlainObject=e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},t.normalizeToFloat32=e=>Array.from(new Float32Array(e)),t.validateVectorDimension=(e,t)=>{if(void 0!==t&&e.float32.length!==t)throw new Error(`Vector dimension mismatch: expected ${t}, got ${e.float32.length}`)}},96:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(643),s=r(251),i=r(607),a=r(442),c=r(819);t.default=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},s.DEFAULT_HEADERS),t),this.fetch=(0,c.resolveFetch)(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,a.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,i.isStorageError)(e))return{data:null,error:e};throw e}})}listBuckets(e){return o.__awaiter(this,void 0,void 0,function*(){try{const t=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&t.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&t.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&t.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&t.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&t.set("search",e.search);const r=t.toString(),o=r?`${this.url}/bucket?${r}`:`${this.url}/bucket`;return{data:yield(0,a.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,i.isStorageError)(e))return{data:null,error:e};throw e}})}deleteBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,a.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,i.isStorageError)(e))return{data:null,error:e};throw e}})}from(e){if(!(0,c.isValidBucketName)(e))throw new i.StorageError("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const t=new n.IcebergRestCatalog({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:()=>o.__awaiter(this,void 0,void 0,function*(){return this.headers})},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(t,{get(e,t){const n=e[t];return"function"!=typeof n?n:(...t)=>o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield n.apply(e,t),error:null}}catch(e){if(r)throw e;return{data:null,error:e}}})}})}}},251:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_HEADERS=void 0;const o=r(822);t.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${o.version}`}},272:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(680),s=r(538),i=r(317),a=r(12);t.default=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},n.DEFAULT_HEADERS),t),this.fetch=(0,a.resolveFetch)(r)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return o.__awaiter(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield(0,i.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}getVectors(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}listVectors(e){return o.__awaiter(this,void 0,void 0,function*(){try{if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return{data:yield(0,i.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}queryVectors(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}deleteVectors(e){return o.__awaiter(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield(0,i.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}}},317:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.get=function(e,t,r,n){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"GET",t,r,n)})},t.post=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"POST",t,n,s,r)})},t.put=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"PUT",t,n,s,r)})},t.remove=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"DELETE",t,n,s,r)})};const o=r(823),n=r(538),s=r(12),i=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),a=(e,t,r)=>o.__awaiter(void 0,void 0,void 0,function*(){if(e&&"object"==typeof e&&"status"in e&&"ok"in e&&"number"==typeof e.status&&!(null==r?void 0:r.noResolveJson)){const r=e.status||500,o=e;if("function"==typeof o.json)o.json().then(e=>{const o=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||r+"";t(new n.StorageVectorsApiError(i(e),r,o))}).catch(()=>{const e=r+"",s=o.statusText||`HTTP ${r} error`;t(new n.StorageVectorsApiError(s,r,e))});else{const e=r+"",s=o.statusText||`HTTP ${r} error`;t(new n.StorageVectorsApiError(s,r,e))}}else t(new n.StorageVectorsUnknownError(i(e),e))}),c=(e,t,r,o)=>{const n={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&o?((0,s.isPlainObject)(o)?(n.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),n.body=JSON.stringify(o)):n.body=o,Object.assign(Object.assign({},n),r)):n};function u(e,t,r,n,s,i){return o.__awaiter(this,void 0,void 0,function*(){return new Promise((o,u)=>{e(r,c(t,n,s,i)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;const t=e.headers.get("content-type");return t&&t.includes("application/json")?e.json():{}}).then(e=>o(e)).catch(e=>a(e,u,n))})})}},368:(e,t,r)=>{var o;Object.defineProperty(t,"__esModule",{value:!0});const n=r(823),s=r(607),i=n.__importDefault(r(857));o=Symbol.toStringTag,t.default=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[o]="BlobDownloadBuilder",this.promise=null}asStream(){return new i.default(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.promise=this.execute()),this.promise}execute(){return n.__awaiter(this,void 0,void 0,function*(){try{const e=yield this.downloadFn();return{data:yield e.blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}}},411:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},442:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.get=function(e,t,r,n){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"GET",t,r,n)})},t.post=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"POST",t,n,s,r)})},t.put=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"PUT",t,n,s,r)})},t.head=function(e,t,r,n){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})},t.remove=function(e,t,r,n,s){return o.__awaiter(this,void 0,void 0,function*(){return u(e,"DELETE",t,n,s,r)})};const o=r(823),n=r(607),s=r(819),i=e=>{var t;return e.msg||e.message||e.error_description||("string"==typeof e.error?e.error:null===(t=e.error)||void 0===t?void 0:t.message)||JSON.stringify(e)},a=(e,t,r)=>o.__awaiter(void 0,void 0,void 0,function*(){const o=yield(0,s.resolveResponse)();e instanceof o&&!(null==r?void 0:r.noResolveJson)?e.json().then(r=>{const o=e.status||500,s=(null==r?void 0:r.statusCode)||o+"";t(new n.StorageApiError(i(r),o,s))}).catch(e=>{t(new n.StorageUnknownError(i(e),e))}):t(new n.StorageUnknownError(i(e),e))}),c=(e,t,r,o)=>{const n={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&o?((0,s.isPlainObject)(o)?(n.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),n.body=JSON.stringify(o)):n.body=o,(null==t?void 0:t.duplex)&&(n.duplex=t.duplex),Object.assign(Object.assign({},n),r)):n};function u(e,t,r,n,s,i){return o.__awaiter(this,void 0,void 0,function*(){return new Promise((o,u)=>{e(r,c(t,n,s,i)).then(e=>{if(!e.ok)throw e;return(null==n?void 0:n.noResolveJson)?e:e.json()}).then(e=>o(e)).catch(e=>a(e,u,n))})})}},456:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StorageClient=void 0;const o=r(823),n=o.__importDefault(r(781)),s=o.__importDefault(r(485)),i=o.__importDefault(r(96)),a=r(833);class c extends s.default{constructor(e,t={},r,o){super(e,t,r,o)}from(e){return new n.default(this.url,this.headers,e,this.fetch)}get vectors(){return new a.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new i.default(this.url+"/iceberg",this.headers,this.fetch)}}t.StorageClient=c},485:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(251),s=r(607),i=r(442),a=r(819);t.default=class{constructor(e,t={},r,o){this.shouldThrowOnError=!1;const s=new URL(e);(null==o?void 0:o.useNewHostname)&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},n.DEFAULT_HEADERS),t),this.fetch=(0,a.resolveFetch)(r)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return o.__awaiter(this,void 0,void 0,function*(){try{const t=this.listBucketOptionsToQueryString(e);return{data:yield(0,i.get)(this.fetch,`${this.url}/bucket${t}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}getBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}createBucket(e){return o.__awaiter(this,arguments,void 0,function*(e,t={public:!1}){try{return{data:yield(0,i.post)(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}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}updateBucket(e,t){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.put)(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}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}emptyBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}deleteBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageError)(e))return{data:null,error:e};throw e}})}listBucketOptionsToQueryString(e){const 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():""}}},538:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StorageVectorsErrorCode=t.StorageVectorsUnknownError=t.StorageVectorsApiError=t.StorageVectorsError=void 0,t.isStorageVectorsError=function(e){return"object"==typeof e&&null!==e&&"__isStorageVectorsError"in e};class r extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}var o;t.StorageVectorsError=r,t.StorageVectorsApiError=class extends r{constructor(e,t,r){super(e),this.name="StorageVectorsApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},t.StorageVectorsUnknownError=class extends r{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}},function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"}(o||(t.StorageVectorsErrorCode=o={}))},562:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(680),s=r(538),i=r(317),a=r(12);t.default=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},n.DEFAULT_HEADERS),t),this.fetch=(0,a.resolveFetch)(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,i.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}getIndex(e,t){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}listIndexes(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}deleteIndex(e,t){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,i.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}}},565:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VectorIndexScope=t.VectorBucketScope=t.StorageVectorsClient=void 0;const o=r(823),n=o.__importDefault(r(562)),s=o.__importDefault(r(272)),i=o.__importDefault(r(658));class a extends i.default{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new c(this.url,this.headers,e,this.fetch)}createBucket(e){const t=Object.create(null,{createBucket:{get:()=>super.createBucket}});return o.__awaiter(this,void 0,void 0,function*(){return t.createBucket.call(this,e)})}getBucket(e){const t=Object.create(null,{getBucket:{get:()=>super.getBucket}});return o.__awaiter(this,void 0,void 0,function*(){return t.getBucket.call(this,e)})}listBuckets(){const e=Object.create(null,{listBuckets:{get:()=>super.listBuckets}});return o.__awaiter(this,arguments,void 0,function*(t={}){return e.listBuckets.call(this,t)})}deleteBucket(e){const t=Object.create(null,{deleteBucket:{get:()=>super.deleteBucket}});return o.__awaiter(this,void 0,void 0,function*(){return t.deleteBucket.call(this,e)})}}t.StorageVectorsClient=a;class c extends n.default{constructor(e,t,r,o){super(e,t,o),this.vectorBucketName=r}createIndex(e){const t=Object.create(null,{createIndex:{get:()=>super.createIndex}});return o.__awaiter(this,void 0,void 0,function*(){return t.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return o.__awaiter(this,arguments,void 0,function*(t={}){return e.listIndexes.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){const t=Object.create(null,{getIndex:{get:()=>super.getIndex}});return o.__awaiter(this,void 0,void 0,function*(){return t.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){const t=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return o.__awaiter(this,void 0,void 0,function*(){return t.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new u(this.url,this.headers,this.vectorBucketName,e,this.fetch)}}t.VectorBucketScope=c;class u extends s.default{constructor(e,t,r,o,n){super(e,t,n),this.vectorBucketName=r,this.indexName=o}putVectors(e){const t=Object.create(null,{putVectors:{get:()=>super.putVectors}});return o.__awaiter(this,void 0,void 0,function*(){return t.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){const t=Object.create(null,{getVectors:{get:()=>super.getVectors}});return o.__awaiter(this,void 0,void 0,function*(){return t.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){const e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return o.__awaiter(this,arguments,void 0,function*(t={}){return e.listVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){const t=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return o.__awaiter(this,void 0,void 0,function*(){return t.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){const t=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return o.__awaiter(this,void 0,void 0,function*(){return t.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}t.VectorIndexScope=u},607:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StorageUnknownError=t.StorageApiError=t.StorageError=void 0,t.isStorageError=function(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e};class r extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}t.StorageError=r,t.StorageApiError=class extends r{constructor(e,t,r){super(e),this.name="StorageApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},t.StorageUnknownError=class extends r{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}},643:(e,t)=>{var r=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="CommitStateUnknownException"===t.icebergType||[500,502,504].includes(t.status)&&!0===t.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function o(e){return e.join("")}var n=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:o(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){const r={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${o(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${o(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${o(e.namespace)}`}),!0}catch(e){if(e instanceof r&&404===e.status)return!1;throw e}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(e){if(e instanceof r&&409===e.status)return;throw e}}};function s(e){return e.join("")}var i=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${s(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(e){if(e instanceof r&&404===e.status)return!1;throw e}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(o){if(o instanceof r&&409===o.status)return await this.loadTable({namespace:e.namespace,name:t.name});throw o}}},a=/^decimal\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)$/,c=/^fixed\s*\[\s*(\d+)\s*\]$/;function u(e){const t=e.match(a);return t?{precision:parseInt(t[1],10),scale:parseInt(t[2],10)}:null}function l(e){const t=e.match(c);return t?{length:parseInt(t[1],10)}:null}t.IcebergError=r,t.IcebergRestCatalog=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const o=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=function(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:o,path:n,query:s,body:i,headers:a}){const c=function(e,t,r){const o=new URL(t,e);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,t);return o.toString()}(e.baseUrl,n,s),u=await async function(e){return e&&"none"!==e.type?"bearer"===e.type?{Authorization:`Bearer ${e.token}`}:"header"===e.type?{[e.name]:e.value}:"custom"===e.type?await e.getHeaders():{}:{}}(e.auth),l=await t(c,{method:o,headers:{...i?{"Content-Type":"application/json"}:{},...u,...a},body:i?JSON.stringify(i):void 0}),h=await l.text(),d=(l.headers.get("content-type")||"").includes("application/json"),f=d&&h?JSON.parse(h):h;if(!l.ok){const e=d?f:void 0,t=e?.error;throw new r(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}}}}({baseUrl:o,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new n(this.client,t),this.tableOps=new i(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)}},t.getCurrentSchema=function(e){return e.schemas.find(t=>t["schema-id"]===e["current-schema-id"])},t.isDecimalType=function(e){return a.test(e)},t.isFixedType=function(e){return c.test(e)},t.parseDecimalType=u,t.parseFixedType=l,t.typesEqual=function(e,t){const r=u(e),o=u(t);if(r&&o)return r.precision===o.precision&&r.scale===o.scale;const n=l(e),s=l(t);return n&&s?n.length===s.length:e===t}},646:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StorageAnalyticsClient=t.StorageClient=void 0;const o=r(823);var n=r(456);Object.defineProperty(t,"StorageClient",{enumerable:!0,get:function(){return n.StorageClient}});var s=r(96);Object.defineProperty(t,"StorageAnalyticsClient",{enumerable:!0,get:function(){return o.__importDefault(s).default}}),o.__exportStar(r(411),t),o.__exportStar(r(607),t),o.__exportStar(r(833),t)},658:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(680),s=r(538),i=r(317),a=r(12);t.default=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},n.DEFAULT_HEADERS),t),this.fetch=(0,a.resolveFetch)(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,i.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}getBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}listBuckets(){return o.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,i.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}deleteBucket(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,i.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,s.isStorageVectorsError)(e))return{data:null,error:e};throw e}})}}},680:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_HEADERS=void 0;const o=r(822);t.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${o.version}`,"Content-Type":"application/json"}},781:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(607),s=r(442),i=r(819),a=o.__importDefault(r(368)),c={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},u={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};t.default=class{constructor(e,t={},r,o){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=r,this.fetch=(0,i.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,t,r,i){return o.__awaiter(this,void 0,void 0,function*(){try{let o;const n=Object.assign(Object.assign({},u),i);let a=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(n.upsert)});const c=n.metadata;"undefined"!=typeof Blob&&r instanceof Blob?(o=new FormData,o.append("cacheControl",n.cacheControl),c&&o.append("metadata",this.encodeMetadata(c)),o.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(o=r,o.has("cacheControl")||o.append("cacheControl",n.cacheControl),c&&!o.has("metadata")&&o.append("metadata",this.encodeMetadata(c))):(o=r,a["cache-control"]=`max-age=${n.cacheControl}`,a["content-type"]=n.contentType,c&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(c))),("undefined"!=typeof ReadableStream&&o instanceof ReadableStream||o&&"object"==typeof o&&"pipe"in o&&"function"==typeof o.pipe)&&!n.duplex&&(n.duplex="half")),(null==i?void 0:i.headers)&&(a=Object.assign(Object.assign({},a),i.headers));const l=this._removeEmptyFolders(t),h=this._getFinalPath(l),d=yield("PUT"==e?s.put:s.post)(this.fetch,`${this.url}/object/${h}`,o,Object.assign({headers:a},(null==n?void 0:n.duplex)?{duplex:n.duplex}:{}));return{data:{path:l,id:d.Id,fullPath:d.Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}upload(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}uploadToSignedUrl(e,t,r,i){return o.__awaiter(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(e),a=this._getFinalPath(o),c=new URL(this.url+`/object/upload/sign/${a}`);c.searchParams.set("token",t);try{let e;const t=Object.assign({upsert:u.upsert},i),n=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});return"undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.append("cacheControl",t.cacheControl)):(e=r,n["cache-control"]=`max-age=${t.cacheControl}`,n["content-type"]=t.contentType),{data:{path:o,fullPath:(yield(0,s.put)(this.fetch,c.toString(),e,{headers:n})).Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}createSignedUploadUrl(e,t){return o.__awaiter(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e);const o=Object.assign({},this.headers);(null==t?void 0:t.upsert)&&(o["x-upsert"]="true");const i=yield(0,s.post)(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:o}),a=new URL(this.url+i.url),c=a.searchParams.get("token");if(!c)throw new n.StorageError("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:c},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}update(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,s.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}copy(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,s.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}createSignedUrl(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),n=yield(0,s.post)(this.fetch,`${this.url}/object/sign/${o}`,Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers});const i=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return n={signedUrl:encodeURI(`${this.url}${n.signedURL}${i}`)},{data:n,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}createSignedUrls(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){try{const o=yield(0,s.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),n=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:o.map(e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${n}`):null})),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}download(e,t){const r=void 0!==(null==t?void 0:t.transform)?"render/image/authenticated":"object",o=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),n=o?`?${o}`:"",i=this._getFinalPath(e);return new a.default(()=>(0,s.get)(this.fetch,`${this.url}/${r}/${i}${n}`,{headers:this.headers,noResolveJson:!0}),this.shouldThrowOnError)}info(e){return o.__awaiter(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{const e=yield(0,s.get)(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:(0,i.recursiveToCamel)(e),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}exists(e){return o.__awaiter(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{return yield(0,s.head)(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e)&&e instanceof n.StorageUnknownError){const t=e.originalError;if([400,404].includes(null==t?void 0:t.status))return{data:!1,error:e}}throw e}})}getPublicUrl(e,t){const r=this._getFinalPath(e),o=[],n=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==n&&o.push(n);const s=void 0!==(null==t?void 0:t.transform)?"render/image":"object",i=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==i&&o.push(i);let a=o.join("&");return""!==a&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}${a}`)}}}remove(e){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,s.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}list(e,t,r){return o.__awaiter(this,void 0,void 0,function*(){try{const o=Object.assign(Object.assign(Object.assign({},c),t),{prefix:e||""});return{data:yield(0,s.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,o,{headers:this.headers},r),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}listV2(e,t){return o.__awaiter(this,void 0,void 0,function*(){try{const r=Object.assign({},e);return{data:yield(0,s.post)(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},t),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}},819:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isValidBucketName=t.isPlainObject=t.recursiveToCamel=t.resolveResponse=t.resolveFetch=void 0,t.resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),t.resolveResponse=()=>Response,t.recursiveToCamel=e=>{if(Array.isArray(e))return e.map(e=>(0,t.recursiveToCamel)(e));if("function"==typeof e||e!==Object(e))return e;const r={};return Object.entries(e).forEach(([e,o])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));r[n]=(0,t.recursiveToCamel)(o)}),r},t.isPlainObject=e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},t.isValidBucketName=e=>!(!e||"string"!=typeof e)&&(!(0===e.length||e.length>100)&&(e.trim()===e&&(!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e))))},822:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="2.86.3-canary.0"},823:(e,t,r)=>{r.r(t),r.d(t,{__addDisposableResource:()=>D,__assign:()=>s,__asyncDelegator:()=>j,__asyncGenerator:()=>S,__asyncValues:()=>T,__await:()=>E,__awaiter:()=>p,__classPrivateFieldGet:()=>I,__classPrivateFieldIn:()=>N,__classPrivateFieldSet:()=>B,__createBinding:()=>m,__decorate:()=>a,__disposeResources:()=>F,__esDecorate:()=>u,__exportStar:()=>g,__extends:()=>n,__generator:()=>y,__importDefault:()=>V,__importStar:()=>$,__makeTemplateObject:()=>x,__metadata:()=>f,__param:()=>c,__propKey:()=>h,__read:()=>w,__rest:()=>i,__rewriteRelativeImportExtension:()=>A,__runInitializers:()=>l,__setFunctionName:()=>d,__spread:()=>b,__spreadArray:()=>O,__spreadArrays:()=>_,__values:()=>v,default:()=>U});var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},o(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return s=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},s.apply(this,arguments)};function i(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}function a(e,t,r,o){var n,s=arguments.length,i=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,o);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(i=(s<3?n(i):s>3?n(t,r,i):n(t,r))||i);return s>3&&i&&Object.defineProperty(t,r,i),i}function c(e,t){return function(r,o){t(r,o,e)}}function u(e,t,r,o,n,s){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,c=o.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?o.static?e:e.prototype:null,h=t||(l?Object.getOwnPropertyDescriptor(l,o.name):{}),d=!1,f=r.length-1;f>=0;f--){var p={};for(var y in o)p[y]="access"===y?{}:o[y];for(var y in o.access)p.access[y]=o.access[y];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(e||null))};var m=(0,r[f])("accessor"===c?{get:h.get,set:h.set}:h[u],p);if("accessor"===c){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=i(m.get))&&(h.get=a),(a=i(m.set))&&(h.set=a),(a=i(m.init))&&n.unshift(a)}else(a=i(m))&&("field"===c?n.unshift(a):h[u]=a)}l&&Object.defineProperty(l,o.name,h),d=!0}function l(e,t,r){for(var o=arguments.length>2,n=0;n<t.length;n++)r=o?t[n].call(e,r):t[n].call(e);return o?r:void 0}function h(e){return"symbol"==typeof e?e:"".concat(e)}function d(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function f(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,r,o){return new(r||(r=Promise))(function(n,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,a)}c((o=o.apply(e,t||[])).next())})}function y(e,t){var r,o,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,o&&(n=2&a[0]?o.return:a[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,a[1])).done)return n;switch(o=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],o=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var m=Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]};function g(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||m(t,e,r)}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=s.next()).done;)i.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(w(arguments[t]));return e}function _(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var o=Array(e),n=0;for(t=0;t<r;t++)for(var s=arguments[t],i=0,a=s.length;i<a;i++,n++)o[n]=s[i];return o}function O(e,t,r){if(r||2===arguments.length)for(var o,n=0,s=t.length;n<s;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function E(e){return this instanceof E?(this.v=e,this):new E(e)}function S(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,n=r.apply(e,t||[]),s=[];return o=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),i("next"),i("throw"),i("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(e,t){n[e]&&(o[e]=function(t){return new Promise(function(r,o){s.push([e,t,r,o])>1||a(e,t)})},t&&(o[e]=t(o[e])))}function a(e,t){try{(r=n[e](t)).value instanceof E?Promise.resolve(r.value.v).then(c,u):l(s[0][2],r)}catch(e){l(s[0][3],e)}var r}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function j(e){var t,r;return t={},o("next"),o("throw",function(e){throw e}),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,n){t[o]=e[o]?function(t){return(r=!r)?{value:E(e[o](t)),done:!1}:n?n(t):t}:n}}function T(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=v(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(r){t[r]=e[r]&&function(t){return new Promise(function(o,n){!function(e,t,r,o){Promise.resolve(o).then(function(t){e({value:t,done:r})},t)}(o,n,(t=e[r](t)).done,t.value)})}}}function x(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var k=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},P=function(e){return P=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},P(e)};function $(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=P(e),o=0;o<r.length;o++)"default"!==r[o]&&m(t,e,r[o]);return k(t,e),t}function V(e){return e&&e.__esModule?e:{default:e}}function I(e,t,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(e):o?o.value:t.get(e)}function B(e,t,r,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,r):n?n.value=r:t.set(e,r),r}function N(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function D(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var o,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=t[Symbol.asyncDispose]}if(void 0===o){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=t[Symbol.dispose],r&&(n=o)}if("function"!=typeof o)throw new TypeError("Object not disposable.");n&&(o=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:o,async:r})}else r&&e.stack.push({async:!0});return t}var C="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var o=new Error(r);return o.name="SuppressedError",o.error=e,o.suppressed=t,o};function F(e){function t(t){e.error=e.hasError?new C(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var r,o=0;return function n(){for(;r=e.stack.pop();)try{if(!r.async&&1===o)return o=0,e.stack.push(r),Promise.resolve().then(n);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return o|=2,Promise.resolve(s).then(n,function(e){return t(e),n()})}else o|=1}catch(e){t(e)}if(1===o)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function A(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,o,n,s){return r?t?".jsx":".js":!o||n&&s?o+n+"."+s.toLowerCase()+"js":e}):e}const U={__extends:n,__assign:s,__rest:i,__decorate:a,__param:c,__esDecorate:u,__runInitializers:l,__propKey:h,__setFunctionName:d,__metadata:f,__awaiter:p,__generator:y,__createBinding:m,__exportStar:g,__values:v,__read:w,__spread:b,__spreadArrays:_,__spreadArray:O,__await:E,__asyncGenerator:S,__asyncDelegator:j,__asyncValues:T,__makeTemplateObject:x,__importStar:$,__importDefault:V,__classPrivateFieldGet:I,__classPrivateFieldSet:B,__classPrivateFieldIn:N,__addDisposableResource:D,__disposeResources:F,__rewriteRelativeImportExtension:A}},833:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateVectorDimension=t.normalizeToFloat32=t.isPlainObject=t.resolveResponse=t.resolveFetch=t.isStorageVectorsError=t.StorageVectorsErrorCode=t.StorageVectorsUnknownError=t.StorageVectorsApiError=t.StorageVectorsError=t.VectorDataApi=t.VectorIndexApi=t.VectorBucketApi=t.VectorIndexScope=t.VectorBucketScope=t.StorageVectorsClient=void 0;const o=r(823);var n=r(565);Object.defineProperty(t,"StorageVectorsClient",{enumerable:!0,get:function(){return n.StorageVectorsClient}}),Object.defineProperty(t,"VectorBucketScope",{enumerable:!0,get:function(){return n.VectorBucketScope}}),Object.defineProperty(t,"VectorIndexScope",{enumerable:!0,get:function(){return n.VectorIndexScope}});var s=r(658);Object.defineProperty(t,"VectorBucketApi",{enumerable:!0,get:function(){return o.__importDefault(s).default}});var i=r(562);Object.defineProperty(t,"VectorIndexApi",{enumerable:!0,get:function(){return o.__importDefault(i).default}});var a=r(272);Object.defineProperty(t,"VectorDataApi",{enumerable:!0,get:function(){return o.__importDefault(a).default}});var c=r(538);Object.defineProperty(t,"StorageVectorsError",{enumerable:!0,get:function(){return c.StorageVectorsError}}),Object.defineProperty(t,"StorageVectorsApiError",{enumerable:!0,get:function(){return c.StorageVectorsApiError}}),Object.defineProperty(t,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return c.StorageVectorsUnknownError}}),Object.defineProperty(t,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return c.StorageVectorsErrorCode}}),Object.defineProperty(t,"isStorageVectorsError",{enumerable:!0,get:function(){return c.isStorageVectorsError}});var u=r(12);Object.defineProperty(t,"resolveFetch",{enumerable:!0,get:function(){return u.resolveFetch}}),Object.defineProperty(t,"resolveResponse",{enumerable:!0,get:function(){return u.resolveResponse}}),Object.defineProperty(t,"isPlainObject",{enumerable:!0,get:function(){return u.isPlainObject}}),Object.defineProperty(t,"normalizeToFloat32",{enumerable:!0,get:function(){return u.normalizeToFloat32}}),Object.defineProperty(t,"validateVectorDimension",{enumerable:!0,get:function(){return u.validateVectorDimension}})},857:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(823),n=r(607);t.default=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}execute(){return o.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,n.isStorageError)(e))return{data:null,error:e};throw e}})}}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,r),s.exports}return r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(646)})());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supabase/storage-js",
|
|
3
|
-
"version": "2.86.
|
|
3
|
+
"version": "2.86.3-canary.0",
|
|
4
4
|
"description": "Isomorphic storage client for Supabase.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"docs:json": "typedoc --json docs/v2/spec.json --entryPoints src/index.ts --entryPoints src/packages/* --excludePrivate --excludeExternals --excludeProtected"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"iceberg-js": "^0.8.
|
|
40
|
+
"iceberg-js": "^0.8.1",
|
|
41
41
|
"tslib": "2.8.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
package/src/lib/version.ts
CHANGED
|
@@ -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 = '2.86.
|
|
7
|
+
export const version = '2.86.3-canary.0'
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { IcebergRestCatalog } from 'iceberg-js'
|
|
1
|
+
import { IcebergRestCatalog, IcebergError } from 'iceberg-js'
|
|
2
2
|
import { DEFAULT_HEADERS } from '../lib/constants'
|
|
3
3
|
import { isStorageError, StorageError } from '../lib/errors'
|
|
4
4
|
import { Fetch, get, post, remove } from '../lib/fetch'
|
|
5
5
|
import { isValidBucketName, resolveFetch } from '../lib/helpers'
|
|
6
6
|
import { AnalyticBucket } from '../lib/types'
|
|
7
7
|
|
|
8
|
+
type WrapAsyncMethod<T> = T extends (...args: infer A) => Promise<infer R>
|
|
9
|
+
? (...args: A) => Promise<{ data: R; error: null } | { data: null; error: IcebergError }>
|
|
10
|
+
: T
|
|
11
|
+
|
|
12
|
+
export type WrappedIcebergRestCatalog = {
|
|
13
|
+
[K in keyof IcebergRestCatalog]: WrapAsyncMethod<IcebergRestCatalog[K]>
|
|
14
|
+
}
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* Client class for managing Analytics Buckets using Iceberg tables
|
|
10
18
|
* Provides methods for creating, listing, and deleting analytics buckets
|
|
@@ -269,12 +277,14 @@ export default class StorageAnalyticsClient {
|
|
|
269
277
|
* Get an Iceberg REST Catalog client configured for a specific analytics bucket
|
|
270
278
|
* Use this to perform advanced table and namespace operations within the bucket
|
|
271
279
|
* The returned client provides full access to the Apache Iceberg REST Catalog API
|
|
280
|
+
* with the Supabase `{ data, error }` pattern for consistent error handling on all operations.
|
|
272
281
|
*
|
|
273
282
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
274
283
|
*
|
|
275
284
|
* @category Analytics Buckets
|
|
276
285
|
* @param bucketName - The name of the analytics bucket (warehouse) to connect to
|
|
277
|
-
* @returns
|
|
286
|
+
* @returns The wrapped Iceberg catalog client
|
|
287
|
+
* @throws {StorageError} If the bucket name is invalid
|
|
278
288
|
*
|
|
279
289
|
* @example Get catalog and create table
|
|
280
290
|
* ```js
|
|
@@ -288,10 +298,10 @@ export default class StorageAnalyticsClient {
|
|
|
288
298
|
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
289
299
|
*
|
|
290
300
|
* // Create a namespace
|
|
291
|
-
* await catalog.createNamespace({ namespace: ['default'] })
|
|
301
|
+
* const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] })
|
|
292
302
|
*
|
|
293
303
|
* // Create a table with schema
|
|
294
|
-
* await catalog.createTable(
|
|
304
|
+
* const { data: tableMetadata, error: tableError } = await catalog.createTable(
|
|
295
305
|
* { namespace: ['default'] },
|
|
296
306
|
* {
|
|
297
307
|
* name: 'events',
|
|
@@ -325,7 +335,13 @@ export default class StorageAnalyticsClient {
|
|
|
325
335
|
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
326
336
|
*
|
|
327
337
|
* // List all tables in the default namespace
|
|
328
|
-
* const tables = await catalog.listTables({ namespace: ['default'] })
|
|
338
|
+
* const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] })
|
|
339
|
+
* if (listError) {
|
|
340
|
+
* if (listError.isNotFound()) {
|
|
341
|
+
* console.log('Namespace not found')
|
|
342
|
+
* }
|
|
343
|
+
* return
|
|
344
|
+
* }
|
|
329
345
|
* console.log(tables) // [{ namespace: ['default'], name: 'events' }]
|
|
330
346
|
* ```
|
|
331
347
|
*
|
|
@@ -334,7 +350,7 @@ export default class StorageAnalyticsClient {
|
|
|
334
350
|
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
335
351
|
*
|
|
336
352
|
* // List all namespaces
|
|
337
|
-
* const namespaces = await catalog.listNamespaces()
|
|
353
|
+
* const { data: namespaces } = await catalog.listNamespaces()
|
|
338
354
|
*
|
|
339
355
|
* // Create namespace with properties
|
|
340
356
|
* await catalog.createNamespace(
|
|
@@ -348,57 +364,37 @@ export default class StorageAnalyticsClient {
|
|
|
348
364
|
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
349
365
|
*
|
|
350
366
|
* // Drop table with purge option (removes all data)
|
|
351
|
-
* await catalog.dropTable(
|
|
367
|
+
* const { error: dropError } = await catalog.dropTable(
|
|
352
368
|
* { namespace: ['default'], name: 'events' },
|
|
353
369
|
* { purge: true }
|
|
354
370
|
* )
|
|
355
371
|
*
|
|
372
|
+
* if (dropError?.isNotFound()) {
|
|
373
|
+
* console.log('Table does not exist')
|
|
374
|
+
* }
|
|
375
|
+
*
|
|
356
376
|
* // Drop namespace (must be empty)
|
|
357
377
|
* await catalog.dropNamespace({ namespace: ['default'] })
|
|
358
378
|
* ```
|
|
359
379
|
*
|
|
360
|
-
* @example Error handling with catalog operations
|
|
361
|
-
* ```js
|
|
362
|
-
* import { IcebergError } from 'iceberg-js'
|
|
363
|
-
*
|
|
364
|
-
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
365
|
-
*
|
|
366
|
-
* try {
|
|
367
|
-
* await catalog.dropTable({ namespace: ['default'], name: 'events' }, { purge: true })
|
|
368
|
-
* } catch (error) {
|
|
369
|
-
* // Handle 404 errors (resource not found)
|
|
370
|
-
* const is404 =
|
|
371
|
-
* (error instanceof IcebergError && error.status === 404) ||
|
|
372
|
-
* error?.status === 404 ||
|
|
373
|
-
* error?.details?.error?.code === 404
|
|
374
|
-
*
|
|
375
|
-
* if (is404) {
|
|
376
|
-
* console.log('Table does not exist')
|
|
377
|
-
* } else {
|
|
378
|
-
* throw error // Re-throw other errors
|
|
379
|
-
* }
|
|
380
|
-
* }
|
|
381
|
-
* ```
|
|
382
|
-
*
|
|
383
380
|
* @remarks
|
|
384
381
|
* This method provides a bridge between Supabase's bucket management and the standard
|
|
385
382
|
* Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter.
|
|
386
383
|
* All authentication and configuration is handled automatically using your Supabase credentials.
|
|
387
384
|
*
|
|
388
|
-
* **Error Handling**:
|
|
389
|
-
*
|
|
385
|
+
* **Error Handling**: Invalid bucket names throw immediately. All catalog
|
|
386
|
+
* operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js.
|
|
387
|
+
* Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling.
|
|
388
|
+
* Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations.
|
|
390
389
|
*
|
|
391
390
|
* **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently
|
|
392
391
|
* deletes all table data. Without it, the table is marked as deleted but data remains.
|
|
393
392
|
*
|
|
394
|
-
* **Library Dependency**: The returned catalog
|
|
395
|
-
*
|
|
393
|
+
* **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js.
|
|
394
|
+
* For complete API documentation and advanced usage, refer to the
|
|
396
395
|
* [iceberg-js documentation](https://supabase.github.io/iceberg-js/).
|
|
397
|
-
*
|
|
398
|
-
* For advanced Iceberg operations beyond bucket management, you can also install and use
|
|
399
|
-
* the `iceberg-js` package directly with manual configuration.
|
|
400
396
|
*/
|
|
401
|
-
from(bucketName: string):
|
|
397
|
+
from(bucketName: string): WrappedIcebergRestCatalog {
|
|
402
398
|
// Validate bucket name using same rules as Supabase Storage API backend
|
|
403
399
|
if (!isValidBucketName(bucketName)) {
|
|
404
400
|
throw new StorageError(
|
|
@@ -411,7 +407,7 @@ export default class StorageAnalyticsClient {
|
|
|
411
407
|
// The base URL is /storage/v1/iceberg
|
|
412
408
|
// Note: IcebergRestCatalog from iceberg-js automatically adds /v1/ prefix to API paths
|
|
413
409
|
// so we should NOT append /v1 here (it would cause double /v1/v1/ in the URL)
|
|
414
|
-
|
|
410
|
+
const catalog = new IcebergRestCatalog({
|
|
415
411
|
baseUrl: this.url,
|
|
416
412
|
catalogName: bucketName, // Maps to the warehouse parameter in Supabase's implementation
|
|
417
413
|
auth: {
|
|
@@ -420,5 +416,30 @@ export default class StorageAnalyticsClient {
|
|
|
420
416
|
},
|
|
421
417
|
fetch: this.fetch,
|
|
422
418
|
})
|
|
419
|
+
|
|
420
|
+
const shouldThrowOnError = this.shouldThrowOnError
|
|
421
|
+
|
|
422
|
+
const wrappedCatalog = new Proxy(catalog, {
|
|
423
|
+
get(target, prop: keyof IcebergRestCatalog) {
|
|
424
|
+
const value = target[prop]
|
|
425
|
+
if (typeof value !== 'function') {
|
|
426
|
+
return value
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return async (...args: unknown[]) => {
|
|
430
|
+
try {
|
|
431
|
+
const data = await (value as Function).apply(target, args)
|
|
432
|
+
return { data, error: null }
|
|
433
|
+
} catch (error) {
|
|
434
|
+
if (shouldThrowOnError) {
|
|
435
|
+
throw error
|
|
436
|
+
}
|
|
437
|
+
return { data: null, error: error as IcebergError }
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
}) as unknown as WrappedIcebergRestCatalog
|
|
442
|
+
|
|
443
|
+
return wrappedCatalog
|
|
423
444
|
}
|
|
424
445
|
}
|