@capgo/cli 7.62.2 → 7.63.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/README.md +13 -99
- package/dist/index.js +210 -210
- package/dist/package.json +1 -1
- package/dist/src/{organization → organisation}/add.d.ts.map +1 -1
- package/dist/src/{organization → organisation}/delete.d.ts.map +1 -1
- package/dist/src/{organization → organisation}/index.d.ts.map +1 -1
- package/dist/src/{organization → organisation}/list.d.ts.map +1 -1
- package/dist/src/{organization → organisation}/set.d.ts.map +1 -1
- package/dist/src/sdk.js +1 -1
- package/package.json +1 -1
- /package/dist/src/{organization → organisation}/add.d.ts +0 -0
- /package/dist/src/{organization → organisation}/delete.d.ts +0 -0
- /package/dist/src/{organization → organisation}/index.d.ts +0 -0
- /package/dist/src/{organization → organisation}/list.d.ts +0 -0
- /package/dist/src/{organization → organisation}/set.d.ts +0 -0
package/dist/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/organisation/add.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAW3C,UAAU,mBAAoB,SAAQ,WAAW;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAQ;;;;;;;;;;;GA8FzF;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,mBAAmB,iBAEjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/organisation/delete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAW3C,UAAU,yBAA0B,SAAQ,WAAW;IACrD,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,yBAAyB,EAClC,MAAM,UAAQ,oBA2Gf;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,yBAAyB,iBAEzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organisation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/organisation/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,UAAU,CAAA;AAqCzD,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAQ;;;;;;;;;;;;;;;;;;;;KA4CnF;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,WAAW,iBAE3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/organisation/set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAW3C,UAAU,mBAAoB,SAAQ,WAAW;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,mBAAmB,EAC5B,MAAM,UAAQ;;;;GA+Gf;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,iBAEhF"}
|
package/dist/src/sdk.js
CHANGED
|
@@ -296,7 +296,7 @@ ${X.default.gray(ss)} ${t}
|
|
|
296
296
|
`)}};var yj=require("node:child_process"),De=require("node:fs"),up=require("node:os"),de=we(require("node:path")),Bn=require("node:process"),Ji=we(wl());var rr=require("fs"),ru=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,rr.existsSync)(r)||(0,rr.existsSync)(n)?"bun":(0,rr.existsSync)(i)||(0,rr.existsSync)(s)?"pnpm":(0,rr.existsSync)(o)?"yarn":(0,rr.existsSync)(a)||(0,rr.existsSync)(u)?"npm":e},bl=(t=ru(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},Mv=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,rr.existsSync)(r)||(0,rr.existsSync)(n)?"bunx":(0,rr.existsSync)(i)||(0,rr.existsSync)(s)?"pnpm exec":(0,rr.existsSync)(o)?"yarn dlx":(0,rr.existsSync)(a)||(0,rr.existsSync)(u)?"npx":e};function vl(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function Hv(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function sm(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[n],s=e[n];if(i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(typeof i=="string"&&typeof s=="number")return 1;if(typeof i=="number"&&typeof s=="string"||i<s)return-1;if(i>s)return 1}return 0}var bo="0|[1-9]\\d*",pU="\\d*[a-zA-Z-][a-zA-Z0-9-]*",mU=`(?<major>${bo})\\.(?<minor>${bo})\\.(?<patch>${bo})`,Uv=`(?:${bo}|${pU})`,Vv=`(?:-(?<prerelease>${Uv}(?:\\.${Uv})*))`,qv="[0-9A-Za-z-]+",zv=`(?:\\+(?<buildmetadata>${qv}(?:\\.${qv})*))`,Kv=`v?${mU}${Vv}?${zv}?`,Gv=new RegExp(`^${Kv}$`),Wv="(?:<|>)?=?",gU="x|X|\\*",im=`${bo}|${gU}`,El=`[v=\\s]*(?<major>${im})(?:\\.(?<minor>${im})(?:\\.(?<patch>${im})${Vv}?${zv}?)?)?`,Xv=new RegExp(`^(?<operator>~>?|\\^|${Wv})\\s*${El}$`),Yv=new RegExp(`^(?<operator>${Wv})\\s*(${Kv})$|^$`);function om(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var am=256;var yU=new RegExp(`^${bo}$`);function nr(t){return t.split(".").filter(Boolean).map(e=>{if(yU.test(e)){let r=Number(e);if(om(r))return r}return e})}function rn(t){return t.split(".").filter(Boolean)}function Si(t,e){let r=Number(t);if(!om(r))throw new TypeError(e);return r}function Vn(t){return Number.isNaN(t.major)&&Number.isNaN(t.minor)&&Number.isNaN(t.patch)&&(t.prerelease===void 0||t.prerelease.length===0)&&(t.build===void 0||t.build.length===0)}function ir(t,e){return t===e?0:vl(t.major,e.major)||vl(t.minor,e.minor)||vl(t.patch,e.patch)||Hv(t.prerelease,e.prerelease)||sm(t.prerelease,e.prerelease)}function um(t){return t.toFixed(0)}function nn(t){let e=um(t.major),r=um(t.minor),n=um(t.patch),i=t.prerelease?.join(".")??"",s=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,i].filter(u=>u).join("-"),s].filter(u=>u).join("+")}function DU(t,e){if(Vn(e))return!0;let r=ir(t,e);switch(e.operator){case"=":case void 0:return r===0;case"!=":return r!==0;case">":return r>0;case"<":return r<0;case">=":return r>=0;case"<=":return r<=0}}function _l(t,e){for(let r of e)if(!DU(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Vn(r))continue;let{major:n,minor:i,patch:s,prerelease:o}=r;if(o&&o.length>0&&t.major===n&&t.minor===i&&t.patch===s)return!0}return!1}return!0}function nu(t,e){return e.some(r=>_l(t,r))}function wU(t=[]){let e=[...t],r=e.length;for(;r>=0;){let n=e[r];if(typeof n=="number"){e[r]=n+1;break}r-=1}return r===-1&&e.push(0),e}function iu(t=[],e){let r=wU(t);if(!e)return r;let n=nr(e);if(n.every(i=>typeof i=="string")){if(n.every((i,s)=>i===r[s])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function su(t,e,r={}){let n=r.build!==void 0?rn(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:iu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:iu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:iu(t.prerelease,r.prerelease),build:n};case"prerelease":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:iu(t.prerelease,r.prerelease),build:n}}case"major":return{major:(t.prerelease??[]).length===0||t.minor!==0||t.patch!==0?t.major+1:t.major,minor:0,patch:0,prerelease:[],build:n};case"minor":{let s=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:s,patch:0,prerelease:[],build:n}}case"patch":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:iu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Cl={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},vo={operator:void 0,...Cl};function cm(t,e){return ir(t,e)>0}function os(t,e){return ir(t,e)<0}function bU(t){let r=t.match(Yv)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:Si(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Si(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Si(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?nr(i):[],build:s?rn(s):[]}:Cl;return{operator:n||void 0,...o}}function Xe(t){return!t||t.toLowerCase()==="x"||t==="*"}function vU(t){if(!Xe(t.major))return Xe(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:Xe(t.patch)?{operator:">=",major:+t.major,minor:+t.minor,patch:0,prerelease:[],build:[]}:{operator:">=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:t.prerelease?nr(t.prerelease):[],build:[]}}function EU(t){if(!Xe(t.major))return Xe(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:Xe(t.patch)?{operator:"<",major:+t.major,minor:+t.minor+1,patch:0,prerelease:[],build:[]}:t.prerelease?{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:nr(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function _U(t){let e=t.match(new RegExp(`^${El}`)),r=e?.groups;if(!r)return null;let n=e[0].length,i=t.slice(n).match(/^\s+-\s+/);if(!i)return null;let s=i[0].length,a=t.slice(n+s).match(new RegExp(`^${El}\\s*$`))?.groups;if(!a)return null;let u=vU(r),c=EU(a);return[u,c].filter(Boolean)}function CU(t){let e=Xe(t.major),r=Xe(t.minor),n=Xe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return i===0?[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];let a=nr(t.prerelease??"");return i===0?s===0?[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s,patch:o+1}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i+1,minor:0,patch:0}]}function SU(t){let e=Xe(t.major),r=Xe(t.minor),n=Xe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=nr(t.prerelease??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]}function AU(t){let e=Xe(t.major),r=Xe(t.minor),n=Xe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:i,minor:0,patch:0}]:[{operator:"<",major:i,minor:0,patch:0}];if(n)return[{operator:"<",major:i,minor:s,patch:0}];let a=nr(t.prerelease??""),u=rn(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function OU(t){let e=Xe(t.minor),r=Xe(t.patch),n=+t.major,i=+t.minor,s=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:i+1,patch:0}];if(r)return[{operator:"<",major:n,minor:i+1,patch:0}];let o=nr(t.prerelease??""),a=rn(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function xU(t){let e=Xe(t.major),r=Xe(t.minor),n=Xe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s+1,patch:0}];let a=nr(t.prerelease??""),u=rn(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function TU(t){let e=Xe(t.major),r=Xe(t.minor),n=Xe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return n?[{operator:">=",major:i,minor:0,patch:0}]:[{operator:">=",major:i,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0}];let a=nr(t.prerelease??""),u=rn(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function IU(t){let e=Xe(t.major),r=Xe(t.minor),n=Xe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=nr(t.prerelease??""),u=rn(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function PU(t){let e=t.match(Xv)?.groups;if(!e)return bU(t);switch(e.operator){case"^":return CU(e);case"~":case"~>":return SU(e);case"<":return AU(e);case"<=":return OU(e);case">":return xU(e);case">=":return TU(e);case"=":case"":return IU(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function FU(t){return t.split(/\s+/).flatMap(PU)}function Sl(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>_U(r)||FU(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function ft(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>am)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${am}`);t=t.trim();let e=t.match(Gv)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Si(e.major,`Cannot parse version ${t}: invalid major version`),n=Si(e.minor,`Cannot parse version ${t}: invalid minor version`),i=Si(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?nr(e.prerelease):[],o=e.buildmetadata?rn(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function Jv(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Vn(t)?!0:nu(t,[[e]]);if(n===void 0)return Vn(e)?!0:nu(e,[[t]]);let i=ir(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||i===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||i===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||i===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function kU(t){return t.every(e=>e.some(r=>RU(r)))}function RU(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!Jv(r,n))return!1}return!0}function Zv(t,e){return kU([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>Jv(i,s)))))}function Qv(t){try{return ft(t),!0}catch{return!1}}function eE(t,e){return ir(t,e)>=0}var Q={};ol(Q,{FunctionRegion:()=>Yt.FunctionRegion,FunctionsError:()=>Yt.FunctionsError,FunctionsFetchError:()=>Yt.FunctionsFetchError,FunctionsHttpError:()=>Yt.FunctionsHttpError,FunctionsRelayError:()=>Yt.FunctionsRelayError,PostgrestError:()=>Dm,SupabaseClient:()=>R_,createClient:()=>Sg});var Yt=we(PE(),1);var Dm=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},qU=class{constructor(t){var e,r;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){var r=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let n=this.fetch,i=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{let o=null,a=null,u=null,c=s.status,l=s.statusText;if(s.ok){var h,d;if(r.method!=="HEAD"){var f;let v=await s.text();v===""||(r.headers.get("Accept")==="text/csv"||r.headers.get("Accept")&&(!((f=r.headers.get("Accept"))===null||f===void 0)&&f.includes("application/vnd.pgrst.plan+text"))?a=v:a=JSON.parse(v))}let y=(h=r.headers.get("Prefer"))===null||h===void 0?void 0:h.match(/count=(exact|planned|estimated)/),b=(d=s.headers.get("content-range"))===null||d===void 0?void 0:d.split("/");y&&b&&b.length>1&&(u=parseInt(b[1])),r.isMaybeSingle&&r.method==="GET"&&Array.isArray(a)&&(a.length>1?(o={code:"PGRST116",details:`Results contain ${a.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},a=null,u=null,c=406,l="Not Acceptable"):a.length===1?a=a[0]:a=null)}else{var p;let y=await s.text();try{o=JSON.parse(y),Array.isArray(o)&&s.status===404&&(a=[],o=null,c=200,l="OK")}catch{s.status===404&&y===""?(c=204,l="No Content"):o={message:y}}if(o&&r.isMaybeSingle&&(!(o==null||(p=o.details)===null||p===void 0)&&p.includes("0 rows"))&&(o=null,c=200,l="OK"),o&&r.shouldThrowOnError)throw new Dm(o)}return{error:o,data:a,count:u,status:c,statusText:l}});return this.shouldThrowOnError||(i=i.catch(s=>{var o;let a="",u=s?.cause;if(u){var c,l,h,d;let p=(c=u?.message)!==null&&c!==void 0?c:"",y=(l=u?.code)!==null&&l!==void 0?l:"";a=`${(h=s?.name)!==null&&h!==void 0?h:"FetchError"}: ${s?.message}`,a+=`
|
|
297
297
|
|
|
298
298
|
Caused by: ${(d=u?.name)!==null&&d!==void 0?d:"Error"}: ${p}`,y&&(a+=` (${y})`),u?.stack&&(a+=`
|
|
299
|
-
${u.stack}`)}else{var f;a=(f=s?.stack)!==null&&f!==void 0?f:""}return{error:{message:`${(o=s?.name)!==null&&o!==void 0?o:"FetchError"}: ${s?.message}`,details:a,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}returns(){return this}overrideTypes(){return this}},HU=class extends qU{select(t){let e=!1,r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:i=n}={}){let s=i?`${i}.order`:"order",o=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){let n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){let i=typeof n>"u"?"offset":`${n}.offset`,s=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(s,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:i=!1,format:s="text"}={}){var o;let a=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,i?"wal":null].filter(Boolean).join("|"),u=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${u}"; options=${a};`),s==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}},FE=new RegExp("[,()]"),So=class extends HU{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){let r=Array.from(new Set(e)).map(n=>typeof n=="string"&&FE.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){let r=Array.from(new Set(e)).map(n=>typeof n=="string"&&FE.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let i="";n==="plain"?i="pl":n==="phrase"?i="ph":n==="websearch"&&(i="w");let s=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${i}fts${s}.${e}`),this}match(t){return Object.entries(t).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){let n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},VU=class{constructor(t,{headers:e={},schema:r,fetch:n}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n}select(t,e){let{head:r=!1,count:n}=e??{},i=r?"HEAD":"GET",s=!1,o=(t??"*").split("").map(a=>/\s/.test(a)&&!s?"":(a==='"'&&(s=!s),a)).join("");return this.url.searchParams.set("select",o),n&&this.headers.append("Prefer",`count=${n}`),new So({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;let i="POST";if(e&&this.headers.append("Prefer",`count=${e}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let s=t.reduce((o,a)=>o.concat(Object.keys(a)),[]);if(s.length>0){let o=[...new Set(s)].map(a=>`"${a}"`);this.url.searchParams.set("columns",o.join(","))}}return new So({method:i,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:i=!0}={}){var s;let o="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),n&&this.headers.append("Prefer",`count=${n}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let a=t.reduce((u,c)=>u.concat(Object.keys(c)),[]);if(a.length>0){let u=[...new Set(a)].map(c=>`"${c}"`);this.url.searchParams.set("columns",u.join(","))}}return new So({method:o,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}update(t,{count:e}={}){var r;let n="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new So({method:n,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:t}={}){var e;let r="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new So({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},kE=class RE{constructor(e,{headers:r={},schema:n,fetch:i}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=i}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new VU(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new RE(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:i=!1,count:s}={}){var o;let a,u=new URL(`${this.url}/rpc/${e}`),c;n||i?(a=n?"HEAD":"GET",Object.entries(r).filter(([h,d])=>d!==void 0).map(([h,d])=>[h,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([h,d])=>{u.searchParams.append(h,d)})):(a="POST",c=r);let l=new Headers(this.headers);return s&&l.set("Prefer",`count=${s}`),new So({method:a,url:u,headers:l,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};var F_=we($m(),1);var fu=class extends Error{constructor(t,e){super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function pq(t,e,r){let n=new URL(e,t);if(r)for(let[i,s]of Object.entries(r))s!==void 0&&n.searchParams.set(i,s);return n.toString()}async function mq(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function gq(t){let e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:i,body:s,headers:o}){let a=pq(t.baseUrl,n,i),u=await mq(t.auth),c=await e(a,{method:r,headers:{...s?{"Content-Type":"application/json"}:{},...u,...o},body:s?JSON.stringify(s):void 0}),l=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&l?JSON.parse(l):l;if(!c.ok){let f=h?d:void 0,p=f?.error;throw new fu(p?.message??`Request failed with status ${c.status}`,{status:c.status,icebergType:p?.type,icebergCode:p?.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function jl(t){return t.join("")}var yq=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){let e=t?{parent:jl(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){let r={namespace:t.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${jl(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${jl(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${jl(t.namespace)}`}),!0}catch(e){if(e instanceof fu&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof fu&&r.status===409)return;throw r}}};function Ao(t){return t.join("")}var Dq=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){let r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){let r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(t){let e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){let e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof fu&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof fu&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},XE=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);let r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=gq({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new yq(this.client,e),this.tableOps=new Dq(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};var Ml=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function ht(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var wq=class extends Ml{constructor(t,e,r){super(t),this.name="StorageApiError",this.status=e,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},jm=class extends Ml{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}},qm=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),bq=()=>Response,Mm=t=>{if(Array.isArray(t))return t.map(r=>Mm(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let i=r.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=Mm(n)}),e},vq=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Eq=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function hu(t){"@babel/helpers - typeof";return hu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hu(t)}function _q(t,e){if(hu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(hu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Cq(t){var e=_q(t,"string");return hu(e)=="symbol"?e:e+""}function Sq(t,e,r){return(e=Cq(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function YE(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function le(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?YE(Object(r),!0).forEach(function(n){Sq(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):YE(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Lm=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},Aq=async(t,e,r)=>{t instanceof await bq()&&!r?.noResolveJson?t.json().then(n=>{let i=t.status||500,s=n?.statusCode||i+"";e(new wq(Lm(n),i,s))}).catch(n=>{e(new jm(Lm(n),n))}):e(new jm(Lm(t),t))},Oq=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:(vq(n)?(i.headers=le({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,e?.duplex&&(i.duplex=e.duplex),le(le({},i),r))};async function pu(t,e,r,n,i,s){return new Promise((o,a)=>{t(r,Oq(e,n,i,s)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>o(u)).catch(u=>Aq(u,a,n))})}async function du(t,e,r,n){return pu(t,"GET",e,r,n)}async function on(t,e,r,n,i){return pu(t,"POST",e,n,i,r)}async function Um(t,e,r,n,i){return pu(t,"PUT",e,n,i,r)}async function xq(t,e,r,n){return pu(t,"HEAD",e,le(le({},r),{},{noResolveJson:!0}),n)}async function Hm(t,e,r,n,i){return pu(t,"DELETE",e,n,i,r)}var Tq=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ht(e))return{data:null,error:e};throw e}}},QE;QE=Symbol.toStringTag;var Iq=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[QE]="BlobDownloadBuilder",this.promise=null}asStream(){return new Tq(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ht(e))return{data:null,error:e};throw e}}},Pq={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},JE={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Fq=class{constructor(t,e={},r,n){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=r,this.fetch=qm(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,r,n){var i=this;try{let s,o=le(le({},JE),n),a=le(le({},i.headers),t==="POST"&&{"x-upsert":String(o.upsert)}),u=o.metadata;typeof Blob<"u"&&r instanceof Blob?(s=new FormData,s.append("cacheControl",o.cacheControl),u&&s.append("metadata",i.encodeMetadata(u)),s.append("",r)):typeof FormData<"u"&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",o.cacheControl),u&&!s.has("metadata")&&s.append("metadata",i.encodeMetadata(u))):(s=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,u&&(a["x-metadata"]=i.toBase64(i.encodeMetadata(u))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!o.duplex&&(o.duplex="half")),n?.headers&&(a=le(le({},a),n.headers));let c=i._removeEmptyFolders(e),l=i._getFinalPath(c),h=await(t=="PUT"?Um:on)(i.fetch,`${i.url}/object/${l}`,s,le({headers:a},o?.duplex?{duplex:o.duplex}:{}));return{data:{path:c,id:h.Id,fullPath:h.Key},error:null}}catch(s){if(i.shouldThrowOnError)throw s;if(ht(s))return{data:null,error:s};throw s}}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var i=this;let s=i._removeEmptyFolders(t),o=i._getFinalPath(s),a=new URL(i.url+`/object/upload/sign/${o}`);a.searchParams.set("token",e);try{let u,c=le({upsert:JE.upsert},n),l=le(le({},i.headers),{"x-upsert":String(c.upsert)});return typeof Blob<"u"&&r instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),u.append("",r)):typeof FormData<"u"&&r instanceof FormData?(u=r,u.append("cacheControl",c.cacheControl)):(u=r,l["cache-control"]=`max-age=${c.cacheControl}`,l["content-type"]=c.contentType),{data:{path:s,fullPath:(await Um(i.fetch,a.toString(),u,{headers:l})).Key},error:null}}catch(u){if(i.shouldThrowOnError)throw u;if(ht(u))return{data:null,error:u};throw u}}async createSignedUploadUrl(t,e){var r=this;try{let n=r._getFinalPath(t),i=le({},r.headers);e?.upsert&&(i["x-upsert"]="true");let s=await on(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:i}),o=new URL(r.url+s.url),a=o.searchParams.get("token");if(!a)throw new Ml("No token returned by API");return{data:{signedUrl:o.toString(),path:t,token:a},error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(ht(n))return{data:null,error:n};throw n}}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;try{return{data:await on(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(ht(i))return{data:null,error:i};throw i}}async copy(t,e,r){var n=this;try{return{data:{path:(await on(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:n.headers})).Key},error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(ht(i))return{data:null,error:i};throw i}}async createSignedUrl(t,e,r){var n=this;try{let i=n._getFinalPath(t),s=await on(n.fetch,`${n.url}/object/sign/${i}`,le({expiresIn:e},r?.transform?{transform:r.transform}:{}),{headers:n.headers}),o=r?.download?`&download=${r.download===!0?"":r.download}`:"";return s={signedUrl:encodeURI(`${n.url}${s.signedURL}${o}`)},{data:s,error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(ht(i))return{data:null,error:i};throw i}}async createSignedUrls(t,e,r){var n=this;try{let i=await on(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),s=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{data:i.map(o=>le(le({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.signedURL}${s}`):null})),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(ht(i))return{data:null,error:i};throw i}}download(t,e){let r=typeof e?.transform<"u"?"render/image/authenticated":"object",n=this.transformOptsToQueryString(e?.transform||{}),i=n?`?${n}`:"",s=this._getFinalPath(t),o=()=>du(this.fetch,`${this.url}/${r}/${s}${i}`,{headers:this.headers,noResolveJson:!0});return new Iq(o,this.shouldThrowOnError)}async info(t){var e=this;let r=e._getFinalPath(t);try{return{data:Mm(await du(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(ht(n))return{data:null,error:n};throw n}}async exists(t){var e=this;let r=e._getFinalPath(t);try{return await xq(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(ht(n)&&n instanceof jm){let i=n.originalError;if([400,404].includes(i?.status))return{data:!1,error:n}}throw n}}getPublicUrl(t,e){let r=this._getFinalPath(t),n=[],i=e?.download?`download=${e.download===!0?"":e.download}`:"";i!==""&&n.push(i);let s=typeof e?.transform<"u"?"render/image":"object",o=this.transformOptsToQueryString(e?.transform||{});o!==""&&n.push(o);let a=n.join("&");return a!==""&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}${a}`)}}}async remove(t){var e=this;try{return{data:await Hm(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async list(t,e,r){var n=this;try{let i=le(le(le({},Pq),e),{},{prefix:t||""});return{data:await on(n.fetch,`${n.url}/object/list/${n.bucketId}`,i,{headers:n.headers},r),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(ht(i))return{data:null,error:i};throw i}}async listV2(t,e){var r=this;try{let n=le({},t);return{data:await on(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(ht(n))return{data:null,error:n};throw n}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){let e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}},e_="2.89.0",t_={"X-Client-Info":`storage-js/${e_}`},kq=class{constructor(t,e={},r,n){this.shouldThrowOnError=!1;let i=new URL(t);n?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=le(le({},t_),e),this.fetch=qm(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{let r=e.listBucketOptionsToQueryString(t);return{data:await du(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async getBucket(t){var e=this;try{return{data:await du(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async createBucket(t,e={public:!1}){var r=this;try{return{data:await on(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(ht(n))return{data:null,error:n};throw n}}async updateBucket(t,e){var r=this;try{return{data:await Um(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(ht(n))return{data:null,error:n};throw n}}async emptyBucket(t){var e=this;try{return{data:await on(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async deleteBucket(t){var e=this;try{return{data:await Hm(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(t){let e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},Rq=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=le(le({},t_),e),this.fetch=qm(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await on(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async listBuckets(t){var e=this;try{let r=new URLSearchParams;t?.limit!==void 0&&r.set("limit",t.limit.toString()),t?.offset!==void 0&&r.set("offset",t.offset.toString()),t?.sortColumn&&r.set("sortColumn",t.sortColumn),t?.sortOrder&&r.set("sortOrder",t.sortOrder),t?.search&&r.set("search",t.search);let n=r.toString(),i=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return{data:await du(e.fetch,i,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async deleteBucket(t){var e=this;try{return{data:await Hm(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}from(t){var e=this;if(!Eq(t))throw new Ml("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");let r=new XE({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(i,s){let o=i[s];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(i,a),error:null}}catch(u){if(n)throw u;return{data:null,error:u}}}}})}},Vm={"X-Client-Info":`storage-js/${e_}`,"Content-Type":"application/json"},r_=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Fr(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Bm=class extends r_{constructor(t,e,r){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Nq=class extends r_{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};var zm=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);var $q=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};var ZE=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Lq=async(t,e,r)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!r?.noResolveJson){let n=t.status||500,i=t;if(typeof i.json=="function")i.json().then(s=>{let o=s?.statusCode||s?.code||n+"";e(new Bm(ZE(s),n,o))}).catch(()=>{let s=n+"";e(new Bm(i.statusText||`HTTP ${n} error`,n,s))});else{let s=n+"";e(new Bm(i.statusText||`HTTP ${n} error`,n,s))}}else e(new Nq(ZE(t),t))},Bq=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:($q(n)?(i.headers=le({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,le(le({},i),r))};async function jq(t,e,r,n,i,s){return new Promise((o,a)=>{t(r,Bq(e,n,i,s)).then(u=>{if(!u.ok)throw u;if(n?.noResolveJson)return u;let c=u.headers.get("content-type");return!c||!c.includes("application/json")?{}:u.json()}).then(u=>o(u)).catch(u=>Lq(u,a,n))})}async function kr(t,e,r,n,i){return jq(t,"POST",e,n,i,r)}var Mq=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=le(le({},Vm),e),this.fetch=zm(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async getIndex(t,e){var r=this;try{return{data:await kr(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(Fr(n))return{data:null,error:n};throw n}}async listIndexes(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async deleteIndex(t,e){var r=this;try{return{data:await kr(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{},error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(Fr(n))return{data:null,error:n};throw n}}},Uq=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=le(le({},Vm),e),this.fetch=zm(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await kr(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async getVectors(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await kr(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async queryVectors(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await kr(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}},qq=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=le(le({},Vm),e),this.fetch=zm(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async getBucket(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async listBuckets(t={}){var e=this;try{return{data:await kr(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async deleteBucket(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}},Hq=class extends qq{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Vq(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},Vq=class extends Mq{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new zq(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},zq=class extends Uq{constructor(t,e,r,n,i){super(t,e,i),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},n_=class extends kq{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new Fq(this.url,this.headers,t,this.fetch)}get vectors(){return new Hq(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Rq(this.url+"/iceberg",this.headers,this.fetch)}};var k_=we(Cg(),1);ie(Q,we($m(),1));ie(Q,we(Cg(),1));var b5="2.89.0",Du="";typeof Deno<"u"?Du="deno":typeof document<"u"?Du="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Du="react-native":Du="node";var v5={"X-Client-Info":`supabase-js-${Du}/${b5}`},E5={headers:v5},_5={schema:"public"},C5={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},S5={};function wu(t){"@babel/helpers - typeof";return wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wu(t)}function A5(t,e){if(wu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(wu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function O5(t){var e=A5(t,"string");return wu(e)=="symbol"?e:e+""}function x5(t,e,r){return(e=O5(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function P_(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function vt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?P_(Object(r),!0).forEach(function(n){x5(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):P_(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var T5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),I5=()=>Headers,P5=(t,e,r)=>{let n=T5(r),i=I5();return async(s,o)=>{var a;let u=(a=await e())!==null&&a!==void 0?a:t,c=new i(o?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(s,vt(vt({},o),{},{headers:c}))}};function F5(t){return t.endsWith("/")?t:t+"/"}function k5(t,e){var r,n;let{db:i,auth:s,realtime:o,global:a}=t,{db:u,auth:c,realtime:l,global:h}=e,d={db:vt(vt({},u),i),auth:vt(vt({},c),s),realtime:vt(vt({},l),o),storage:{},global:vt(vt(vt({},h),a),{},{headers:vt(vt({},(r=h?.headers)!==null&&r!==void 0?r:{}),(n=a?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function R5(t){let e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(F5(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var N5=class extends k_.AuthClient{constructor(t){super(t)}},R_=class{constructor(t,e,r){var n,i;this.supabaseUrl=t,this.supabaseKey=e;let s=R5(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);let o=`sb-${s.hostname.split(".")[0]}-auth-token`,a={db:_5,realtime:S5,auth:vt(vt({},C5),{},{storageKey:o}),global:E5},u=k5(r??{},a);if(this.storageKey=(n=u.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(i=u.global.headers)!==null&&i!==void 0?i:{},u.accessToken)this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(l,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=u.auth)!==null&&c!==void 0?c:{},this.headers,u.global.fetch)}this.fetch=P5(e,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(vt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},u.realtime)),this.accessToken&&this.accessToken().then(l=>this.realtime.setAuth(l)).catch(l=>console.warn("Failed to set initial Realtime auth token:",l)),this.rest=new kE(new URL("rest/v1",s).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this.storage=new n_(this.storageUrl.href,this.headers,this.fetch,r?.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new Yt.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();let{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:i,storageKey:s,flowType:o,lock:a,debug:u,throwOnError:c},l,h){let d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new N5({url:this.authUrl.href,headers:vt(vt({},d),l),storageKey:s,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:i,flowType:o,lock:a,debug:u,throwOnError:c,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new F_.RealtimeClient(this.realtimeUrl.href,vt(vt({},t),{},{params:vt(vt({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}},Sg=(t,e,r)=>new R_(t,e,r);function $5(){if(typeof window<"u"||typeof process>"u")return!1;let t=process.version;if(t==null)return!1;let e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}$5()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");var $b=we(Pg()),Dj=we(HC()),cp=we(uh());var Jn={name:"@capgo/cli",version:"7.62.2",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@modelcontextprotocol/sdk":"^1.0.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3",zod:"^3.24.0"},dependencies:{micromatch:"^4.0.8"}};async function ch(t){try{let r=`https://registry.npmjs.org/${encodeURIComponent(t.toLowerCase())}`,n=await fetch(r,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});return n.ok&&(await n.json())["dist-tags"]?.latest||null}catch{return null}}async function Ze(){let t=await ch("@capgo/cli")??"",e=t?.split(".")[0];t!==Jn.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${Jn.version} it's not the latest version.
|
|
299
|
+
${u.stack}`)}else{var f;a=(f=s?.stack)!==null&&f!==void 0?f:""}return{error:{message:`${(o=s?.name)!==null&&o!==void 0?o:"FetchError"}: ${s?.message}`,details:a,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}returns(){return this}overrideTypes(){return this}},HU=class extends qU{select(t){let e=!1,r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:i=n}={}){let s=i?`${i}.order`:"order",o=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){let n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){let i=typeof n>"u"?"offset":`${n}.offset`,s=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(s,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:i=!1,format:s="text"}={}){var o;let a=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,i?"wal":null].filter(Boolean).join("|"),u=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${u}"; options=${a};`),s==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}},FE=new RegExp("[,()]"),So=class extends HU{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){let r=Array.from(new Set(e)).map(n=>typeof n=="string"&&FE.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){let r=Array.from(new Set(e)).map(n=>typeof n=="string"&&FE.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let i="";n==="plain"?i="pl":n==="phrase"?i="ph":n==="websearch"&&(i="w");let s=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${i}fts${s}.${e}`),this}match(t){return Object.entries(t).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){let n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},VU=class{constructor(t,{headers:e={},schema:r,fetch:n}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n}select(t,e){let{head:r=!1,count:n}=e??{},i=r?"HEAD":"GET",s=!1,o=(t??"*").split("").map(a=>/\s/.test(a)&&!s?"":(a==='"'&&(s=!s),a)).join("");return this.url.searchParams.set("select",o),n&&this.headers.append("Prefer",`count=${n}`),new So({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;let i="POST";if(e&&this.headers.append("Prefer",`count=${e}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let s=t.reduce((o,a)=>o.concat(Object.keys(a)),[]);if(s.length>0){let o=[...new Set(s)].map(a=>`"${a}"`);this.url.searchParams.set("columns",o.join(","))}}return new So({method:i,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:i=!0}={}){var s;let o="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),n&&this.headers.append("Prefer",`count=${n}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let a=t.reduce((u,c)=>u.concat(Object.keys(c)),[]);if(a.length>0){let u=[...new Set(a)].map(c=>`"${c}"`);this.url.searchParams.set("columns",u.join(","))}}return new So({method:o,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}update(t,{count:e}={}){var r;let n="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new So({method:n,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:t}={}){var e;let r="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new So({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},kE=class RE{constructor(e,{headers:r={},schema:n,fetch:i}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=i}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new VU(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new RE(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:i=!1,count:s}={}){var o;let a,u=new URL(`${this.url}/rpc/${e}`),c;n||i?(a=n?"HEAD":"GET",Object.entries(r).filter(([h,d])=>d!==void 0).map(([h,d])=>[h,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([h,d])=>{u.searchParams.append(h,d)})):(a="POST",c=r);let l=new Headers(this.headers);return s&&l.set("Prefer",`count=${s}`),new So({method:a,url:u,headers:l,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};var F_=we($m(),1);var fu=class extends Error{constructor(t,e){super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function pq(t,e,r){let n=new URL(e,t);if(r)for(let[i,s]of Object.entries(r))s!==void 0&&n.searchParams.set(i,s);return n.toString()}async function mq(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function gq(t){let e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:i,body:s,headers:o}){let a=pq(t.baseUrl,n,i),u=await mq(t.auth),c=await e(a,{method:r,headers:{...s?{"Content-Type":"application/json"}:{},...u,...o},body:s?JSON.stringify(s):void 0}),l=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&l?JSON.parse(l):l;if(!c.ok){let f=h?d:void 0,p=f?.error;throw new fu(p?.message??`Request failed with status ${c.status}`,{status:c.status,icebergType:p?.type,icebergCode:p?.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function jl(t){return t.join("")}var yq=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){let e=t?{parent:jl(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){let r={namespace:t.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${jl(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${jl(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${jl(t.namespace)}`}),!0}catch(e){if(e instanceof fu&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof fu&&r.status===409)return;throw r}}};function Ao(t){return t.join("")}var Dq=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){let r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){let r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(t){let e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){let e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Ao(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof fu&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof fu&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},XE=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);let r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=gq({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new yq(this.client,e),this.tableOps=new Dq(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};var Ml=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function ht(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var wq=class extends Ml{constructor(t,e,r){super(t),this.name="StorageApiError",this.status=e,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},jm=class extends Ml{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}},qm=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),bq=()=>Response,Mm=t=>{if(Array.isArray(t))return t.map(r=>Mm(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let i=r.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=Mm(n)}),e},vq=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Eq=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function hu(t){"@babel/helpers - typeof";return hu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hu(t)}function _q(t,e){if(hu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(hu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Cq(t){var e=_q(t,"string");return hu(e)=="symbol"?e:e+""}function Sq(t,e,r){return(e=Cq(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function YE(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function le(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?YE(Object(r),!0).forEach(function(n){Sq(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):YE(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Lm=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},Aq=async(t,e,r)=>{t instanceof await bq()&&!r?.noResolveJson?t.json().then(n=>{let i=t.status||500,s=n?.statusCode||i+"";e(new wq(Lm(n),i,s))}).catch(n=>{e(new jm(Lm(n),n))}):e(new jm(Lm(t),t))},Oq=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:(vq(n)?(i.headers=le({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,e?.duplex&&(i.duplex=e.duplex),le(le({},i),r))};async function pu(t,e,r,n,i,s){return new Promise((o,a)=>{t(r,Oq(e,n,i,s)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>o(u)).catch(u=>Aq(u,a,n))})}async function du(t,e,r,n){return pu(t,"GET",e,r,n)}async function on(t,e,r,n,i){return pu(t,"POST",e,n,i,r)}async function Um(t,e,r,n,i){return pu(t,"PUT",e,n,i,r)}async function xq(t,e,r,n){return pu(t,"HEAD",e,le(le({},r),{},{noResolveJson:!0}),n)}async function Hm(t,e,r,n,i){return pu(t,"DELETE",e,n,i,r)}var Tq=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ht(e))return{data:null,error:e};throw e}}},QE;QE=Symbol.toStringTag;var Iq=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[QE]="BlobDownloadBuilder",this.promise=null}asStream(){return new Tq(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ht(e))return{data:null,error:e};throw e}}},Pq={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},JE={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Fq=class{constructor(t,e={},r,n){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=r,this.fetch=qm(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,r,n){var i=this;try{let s,o=le(le({},JE),n),a=le(le({},i.headers),t==="POST"&&{"x-upsert":String(o.upsert)}),u=o.metadata;typeof Blob<"u"&&r instanceof Blob?(s=new FormData,s.append("cacheControl",o.cacheControl),u&&s.append("metadata",i.encodeMetadata(u)),s.append("",r)):typeof FormData<"u"&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",o.cacheControl),u&&!s.has("metadata")&&s.append("metadata",i.encodeMetadata(u))):(s=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,u&&(a["x-metadata"]=i.toBase64(i.encodeMetadata(u))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!o.duplex&&(o.duplex="half")),n?.headers&&(a=le(le({},a),n.headers));let c=i._removeEmptyFolders(e),l=i._getFinalPath(c),h=await(t=="PUT"?Um:on)(i.fetch,`${i.url}/object/${l}`,s,le({headers:a},o?.duplex?{duplex:o.duplex}:{}));return{data:{path:c,id:h.Id,fullPath:h.Key},error:null}}catch(s){if(i.shouldThrowOnError)throw s;if(ht(s))return{data:null,error:s};throw s}}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var i=this;let s=i._removeEmptyFolders(t),o=i._getFinalPath(s),a=new URL(i.url+`/object/upload/sign/${o}`);a.searchParams.set("token",e);try{let u,c=le({upsert:JE.upsert},n),l=le(le({},i.headers),{"x-upsert":String(c.upsert)});return typeof Blob<"u"&&r instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),u.append("",r)):typeof FormData<"u"&&r instanceof FormData?(u=r,u.append("cacheControl",c.cacheControl)):(u=r,l["cache-control"]=`max-age=${c.cacheControl}`,l["content-type"]=c.contentType),{data:{path:s,fullPath:(await Um(i.fetch,a.toString(),u,{headers:l})).Key},error:null}}catch(u){if(i.shouldThrowOnError)throw u;if(ht(u))return{data:null,error:u};throw u}}async createSignedUploadUrl(t,e){var r=this;try{let n=r._getFinalPath(t),i=le({},r.headers);e?.upsert&&(i["x-upsert"]="true");let s=await on(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:i}),o=new URL(r.url+s.url),a=o.searchParams.get("token");if(!a)throw new Ml("No token returned by API");return{data:{signedUrl:o.toString(),path:t,token:a},error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(ht(n))return{data:null,error:n};throw n}}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;try{return{data:await on(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(ht(i))return{data:null,error:i};throw i}}async copy(t,e,r){var n=this;try{return{data:{path:(await on(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:n.headers})).Key},error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(ht(i))return{data:null,error:i};throw i}}async createSignedUrl(t,e,r){var n=this;try{let i=n._getFinalPath(t),s=await on(n.fetch,`${n.url}/object/sign/${i}`,le({expiresIn:e},r?.transform?{transform:r.transform}:{}),{headers:n.headers}),o=r?.download?`&download=${r.download===!0?"":r.download}`:"";return s={signedUrl:encodeURI(`${n.url}${s.signedURL}${o}`)},{data:s,error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(ht(i))return{data:null,error:i};throw i}}async createSignedUrls(t,e,r){var n=this;try{let i=await on(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),s=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{data:i.map(o=>le(le({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.signedURL}${s}`):null})),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(ht(i))return{data:null,error:i};throw i}}download(t,e){let r=typeof e?.transform<"u"?"render/image/authenticated":"object",n=this.transformOptsToQueryString(e?.transform||{}),i=n?`?${n}`:"",s=this._getFinalPath(t),o=()=>du(this.fetch,`${this.url}/${r}/${s}${i}`,{headers:this.headers,noResolveJson:!0});return new Iq(o,this.shouldThrowOnError)}async info(t){var e=this;let r=e._getFinalPath(t);try{return{data:Mm(await du(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(ht(n))return{data:null,error:n};throw n}}async exists(t){var e=this;let r=e._getFinalPath(t);try{return await xq(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(ht(n)&&n instanceof jm){let i=n.originalError;if([400,404].includes(i?.status))return{data:!1,error:n}}throw n}}getPublicUrl(t,e){let r=this._getFinalPath(t),n=[],i=e?.download?`download=${e.download===!0?"":e.download}`:"";i!==""&&n.push(i);let s=typeof e?.transform<"u"?"render/image":"object",o=this.transformOptsToQueryString(e?.transform||{});o!==""&&n.push(o);let a=n.join("&");return a!==""&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}${a}`)}}}async remove(t){var e=this;try{return{data:await Hm(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async list(t,e,r){var n=this;try{let i=le(le(le({},Pq),e),{},{prefix:t||""});return{data:await on(n.fetch,`${n.url}/object/list/${n.bucketId}`,i,{headers:n.headers},r),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(ht(i))return{data:null,error:i};throw i}}async listV2(t,e){var r=this;try{let n=le({},t);return{data:await on(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(ht(n))return{data:null,error:n};throw n}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){let e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}},e_="2.89.0",t_={"X-Client-Info":`storage-js/${e_}`},kq=class{constructor(t,e={},r,n){this.shouldThrowOnError=!1;let i=new URL(t);n?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=le(le({},t_),e),this.fetch=qm(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{let r=e.listBucketOptionsToQueryString(t);return{data:await du(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async getBucket(t){var e=this;try{return{data:await du(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async createBucket(t,e={public:!1}){var r=this;try{return{data:await on(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(ht(n))return{data:null,error:n};throw n}}async updateBucket(t,e){var r=this;try{return{data:await Um(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(ht(n))return{data:null,error:n};throw n}}async emptyBucket(t){var e=this;try{return{data:await on(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async deleteBucket(t){var e=this;try{return{data:await Hm(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(t){let e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},Rq=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=le(le({},t_),e),this.fetch=qm(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await on(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async listBuckets(t){var e=this;try{let r=new URLSearchParams;t?.limit!==void 0&&r.set("limit",t.limit.toString()),t?.offset!==void 0&&r.set("offset",t.offset.toString()),t?.sortColumn&&r.set("sortColumn",t.sortColumn),t?.sortOrder&&r.set("sortOrder",t.sortOrder),t?.search&&r.set("search",t.search);let n=r.toString(),i=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return{data:await du(e.fetch,i,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}async deleteBucket(t){var e=this;try{return{data:await Hm(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ht(r))return{data:null,error:r};throw r}}from(t){var e=this;if(!Eq(t))throw new Ml("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");let r=new XE({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(i,s){let o=i[s];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(i,a),error:null}}catch(u){if(n)throw u;return{data:null,error:u}}}}})}},Vm={"X-Client-Info":`storage-js/${e_}`,"Content-Type":"application/json"},r_=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Fr(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Bm=class extends r_{constructor(t,e,r){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Nq=class extends r_{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};var zm=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);var $q=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};var ZE=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Lq=async(t,e,r)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!r?.noResolveJson){let n=t.status||500,i=t;if(typeof i.json=="function")i.json().then(s=>{let o=s?.statusCode||s?.code||n+"";e(new Bm(ZE(s),n,o))}).catch(()=>{let s=n+"";e(new Bm(i.statusText||`HTTP ${n} error`,n,s))});else{let s=n+"";e(new Bm(i.statusText||`HTTP ${n} error`,n,s))}}else e(new Nq(ZE(t),t))},Bq=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:($q(n)?(i.headers=le({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,le(le({},i),r))};async function jq(t,e,r,n,i,s){return new Promise((o,a)=>{t(r,Bq(e,n,i,s)).then(u=>{if(!u.ok)throw u;if(n?.noResolveJson)return u;let c=u.headers.get("content-type");return!c||!c.includes("application/json")?{}:u.json()}).then(u=>o(u)).catch(u=>Lq(u,a,n))})}async function kr(t,e,r,n,i){return jq(t,"POST",e,n,i,r)}var Mq=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=le(le({},Vm),e),this.fetch=zm(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async getIndex(t,e){var r=this;try{return{data:await kr(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}),error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(Fr(n))return{data:null,error:n};throw n}}async listIndexes(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async deleteIndex(t,e){var r=this;try{return{data:await kr(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{},error:null}}catch(n){if(r.shouldThrowOnError)throw n;if(Fr(n))return{data:null,error:n};throw n}}},Uq=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=le(le({},Vm),e),this.fetch=zm(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await kr(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async getVectors(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await kr(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async queryVectors(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await kr(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}},qq=class{constructor(t,e={},r){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=le(le({},Vm),e),this.fetch=zm(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async getBucket(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async listBuckets(t={}){var e=this;try{return{data:await kr(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}async deleteBucket(t){var e=this;try{return{data:await kr(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(Fr(r))return{data:null,error:r};throw r}}},Hq=class extends qq{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Vq(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},Vq=class extends Mq{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new zq(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},zq=class extends Uq{constructor(t,e,r,n,i){super(t,e,i),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,le(le({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},n_=class extends kq{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new Fq(this.url,this.headers,t,this.fetch)}get vectors(){return new Hq(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Rq(this.url+"/iceberg",this.headers,this.fetch)}};var k_=we(Cg(),1);ie(Q,we($m(),1));ie(Q,we(Cg(),1));var b5="2.89.0",Du="";typeof Deno<"u"?Du="deno":typeof document<"u"?Du="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Du="react-native":Du="node";var v5={"X-Client-Info":`supabase-js-${Du}/${b5}`},E5={headers:v5},_5={schema:"public"},C5={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},S5={};function wu(t){"@babel/helpers - typeof";return wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wu(t)}function A5(t,e){if(wu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(wu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function O5(t){var e=A5(t,"string");return wu(e)=="symbol"?e:e+""}function x5(t,e,r){return(e=O5(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function P_(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function vt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?P_(Object(r),!0).forEach(function(n){x5(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):P_(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var T5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),I5=()=>Headers,P5=(t,e,r)=>{let n=T5(r),i=I5();return async(s,o)=>{var a;let u=(a=await e())!==null&&a!==void 0?a:t,c=new i(o?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(s,vt(vt({},o),{},{headers:c}))}};function F5(t){return t.endsWith("/")?t:t+"/"}function k5(t,e){var r,n;let{db:i,auth:s,realtime:o,global:a}=t,{db:u,auth:c,realtime:l,global:h}=e,d={db:vt(vt({},u),i),auth:vt(vt({},c),s),realtime:vt(vt({},l),o),storage:{},global:vt(vt(vt({},h),a),{},{headers:vt(vt({},(r=h?.headers)!==null&&r!==void 0?r:{}),(n=a?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function R5(t){let e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(F5(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var N5=class extends k_.AuthClient{constructor(t){super(t)}},R_=class{constructor(t,e,r){var n,i;this.supabaseUrl=t,this.supabaseKey=e;let s=R5(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);let o=`sb-${s.hostname.split(".")[0]}-auth-token`,a={db:_5,realtime:S5,auth:vt(vt({},C5),{},{storageKey:o}),global:E5},u=k5(r??{},a);if(this.storageKey=(n=u.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(i=u.global.headers)!==null&&i!==void 0?i:{},u.accessToken)this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(l,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=u.auth)!==null&&c!==void 0?c:{},this.headers,u.global.fetch)}this.fetch=P5(e,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(vt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},u.realtime)),this.accessToken&&this.accessToken().then(l=>this.realtime.setAuth(l)).catch(l=>console.warn("Failed to set initial Realtime auth token:",l)),this.rest=new kE(new URL("rest/v1",s).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this.storage=new n_(this.storageUrl.href,this.headers,this.fetch,r?.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new Yt.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();let{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:i,storageKey:s,flowType:o,lock:a,debug:u,throwOnError:c},l,h){let d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new N5({url:this.authUrl.href,headers:vt(vt({},d),l),storageKey:s,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:i,flowType:o,lock:a,debug:u,throwOnError:c,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new F_.RealtimeClient(this.realtimeUrl.href,vt(vt({},t),{},{params:vt(vt({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}},Sg=(t,e,r)=>new R_(t,e,r);function $5(){if(typeof window<"u"||typeof process>"u")return!1;let t=process.version;if(t==null)return!1;let e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}$5()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");var $b=we(Pg()),Dj=we(HC()),cp=we(uh());var Jn={name:"@capgo/cli",version:"7.63.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@modelcontextprotocol/sdk":"^1.0.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3",zod:"^3.24.0"},dependencies:{micromatch:"^4.0.8"}};async function ch(t){try{let r=`https://registry.npmjs.org/${encodeURIComponent(t.toLowerCase())}`,n=await fetch(r,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});return n.ok&&(await n.json())["dist-tags"]?.latest||null}catch{return null}}async function Ze(){let t=await ch("@capgo/cli")??"",e=t?.split(".")[0];t!==Jn.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${Jn.version} it's not the latest version.
|
|
300
300
|
Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function tx(t,e,r,n,i,s="\u2705"){await Ae(r,{channel:t,event:n,icon:s,user_id:e,...i?{tags:{"app-id":i}}:{},notify:!1})}var Vy=require("node:buffer"),rx=require("node:crypto"),lW=(()=>{let t=[];for(let e=0;e<256;e++){let r=e;for(let n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t})();function fW(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=lW[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function Zn(t,e="sha256"){let r=Vy.Buffer.isBuffer(t)?t:Vy.Buffer.from(t);if(e==="crc32")return fW(r);let n=(0,rx.createHash)(e);return n.update(r),n.digest("hex")}var jc=we(CB());async function SB(){let t=await(0,jc.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function hb(t,e,r=!1){let n=await(0,jc.loadConfig)(),{extConfig:i}=n.app;i&&(i.plugins||(i.plugins={extConfig:{},[t]:{}}),i.plugins[t]||(i.plugins[t]={}),r?i=e.config:i.plugins[t]=e.config.plugins?.[t],(0,jc.writeConfig)(i,n.app.extConfigFilePath))}async function $a(t,e=!1){await hb("CapacitorUpdater",t,e)}var Ma=".capgo_key",Lr=".capgo_key_v2",lp=`${Ma}.pub`,mi=`${Lr}.pub`,hj="https://capgo.app",dj="https://files.capgo.app",pj="https://api.capgo.app",mj="https://console.capgo.app",Lb=12e4,xue=1024*1024*20,Tue=1024*1024*1024,Iue=1024*1024*99,io="package.json",Ua=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i,W=t=>t?`
|
|
301
301
|
${Dj.default.render(t)}`:"";function ap(t){return new Promise(e=>{setTimeout(e,t)})}function Br(t){return(0,Ji.isMonorepo)(t)?(0,Ji.findMonorepoRoot)(t):(0,Ji.isNXMonorepo)(t)?(0,Ji.findNXMonorepoRoot)(t):t}function Pue(t=Br((0,Bn.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,De.existsSync)(r)){let i=`Package.json at ${r} does not exist`;throw g.error(i),new Error(i)}let n=(0,De.readFileSync)(r??(0,de.join)(t,io));return JSON.parse(n)}function Zi(t=Br((0,Bn.cwd)()),e=void 0){return Pue(t,e).version??""}function Fue(t){let e=t.replace("^","").replace("~","");if(Qv(e))try{let r=ft(e);return nn(r)}catch{return e}return e}async function Qi(t,e=(0,Bn.cwd)(),r){let n=r?(0,de.dirname)(r):e;try{let o=`${t}/package.json`,{createRequire:a}=await import("node:module"),c=a((0,de.join)(n,"package.json")).resolve(o),l=JSON.parse((0,De.readFileSync)(c,"utf-8"));if(l.version)return l.version}catch{}let i=n,s=de.default.parse(i).root;for(;i!==s;){let o=(0,de.join)(i,"node_modules",t,io);if((0,De.existsSync)(o))try{let u=JSON.parse((0,De.readFileSync)(o,"utf-8"));if(u.version)return u.version}catch{}let a=(0,de.dirname)(i);if(a===i)break;i=a}if(t==="@capgo/capacitor-updater"){let o=null,a=(0,de.join)(e,"ios","App","Podfile");if((0,De.existsSync)(a))try{let c=(0,De.readFileSync)(a,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);c?.[1]&&(o=(0,de.resolve)((0,de.join)(e,"ios","App",c[1])))}catch{}if(!o){let u=(0,de.join)(e,"android","capacitor.settings.gradle");if((0,De.existsSync)(u))try{let l=(0,De.readFileSync)(u,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);l?.[1]&&(o=(0,de.resolve)((0,de.join)(e,"android",l[1])).replace(/\/android$/,""))}catch{}}if(o){let u=(0,de.join)(o,io);if((0,De.existsSync)(u))try{let c=JSON.parse((0,De.readFileSync)(u,"utf-8"));if(c.version)return c.version}catch{}}}try{let a=(await fp(e)).get(t);if(a)return a}catch{}return null}async function fp(t=Br((0,Bn.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,de.join)(t,io)],r){for(let s of r)if(!(0,De.existsSync)(s)){let o=`Package.json at ${s} does not exist`;throw g.error(o),new Error(o)}}let n=new Map,{createRequire:i}=await import("node:module");for(let s of r){let o=(0,De.readFileSync)(s),a=JSON.parse(o),u=(0,de.dirname)(s),c=(l,h)=>{try{let y=i((0,de.join)(u,"package.json")).resolve(`${l}/package.json`),b=JSON.parse((0,De.readFileSync)(y,"utf-8"));if(b.version)return b.version}catch{}let d=u,f=de.default.parse(d).root;for(;d!==f;){let p=(0,de.join)(d,"node_modules",l,io);if((0,De.existsSync)(p))try{let b=JSON.parse((0,De.readFileSync)(p,"utf-8"));if(b.version)return b.version}catch{}let y=(0,de.dirname)(d);if(y===d)break;d=y}return Fue(h)};for(let l in a.dependencies)n.set(l,c(l,a.dependencies[l]));for(let l in a.devDependencies)n.set(l,c(l,a.devDependencies[l]))}return n}async function pe(){try{let t=await SB();if(!t){let e="No capacitor config file found, run `cap init` first";throw g.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${W(t)}`;throw g.error(e),new Error(e)}}async function kue(t,e){let r=await pe();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await hb(t,r)),r}async function wj(t){return kue("CapacitorUpdater",t)}async function En(){try{let t=await pe(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||hj,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||mj,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||dj,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||pj};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(g.info("Using custom supabase instance from capacitor.config.json"),e.supaKey=t?.config?.plugins?.CapacitorUpdater?.localSupaAnon,e.supaHost=t?.config?.plugins?.CapacitorUpdater?.localSupa),e}catch{return{host:hj,hostWeb:mj,hostFilesApi:dj,hostApi:pj}}}var bj=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function hp(){let t=await En();try{let e=await fetch(`${t.hostApi}/private/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return{...await e.json(),...t}}catch{return g.info(`Local config ${W(t)}`),t}}async function vj(){let t=await En();try{let e=await fetch(`${t.hostFilesApi}/files/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:Tue,maxChunkSize:Iue,alertUploadSize:xue}}}async function me(t,e,r){let n=await hp();if(e&&r&&(g.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw g.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return Sg(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function Rue(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){g.error("Invalid API key or insufficient permissions.");let s=`Your key should be: ${r.map((o,a)=>r.length===1?`"${o}"`:a===r.length-1?`or "${o}"`:`"${o}", `).join("")} mode.`;throw g.error(s),new Error("Invalid API key or insufficient permissions.")}}async function Ej(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function _j(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function Nue(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function $ue(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var mr=(o=>(o[o.none=0]="none",o[o.read=1]="read",o[o.upload=2]="upload",o[o.write=3]="write",o[o.admin=4]="admin",o[o.super_admin=5]="super_admin",o))(mr||{}),qa=(t,e)=>t>=e;async function Cj(t,e,r){let{data:n,error:i}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(i)throw g.error("Cannot get permissions for organization!"),console.error(i),new Error("Cannot get permissions for organization");if(n.includes("perm")){let a=null;switch(n){case"perm_none":{a=0;break}case"perm_read":{a=1;break}case"perm_upload":{a=2;break}case"perm_write":{a=3;break}case"perm_admin":{a=4;break}case"perm_owner":{a=5;break}default:throw n.includes("invite")?(g.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(g.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:a}}let o=null;switch(n){case"INVALID_APIKEY":{o="INVALID_APIKEY";break}case"NO_APP":{o="NO_APP";break}case"NO_ORG":{o="NO_ORG";break}default:throw g.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:o}}async function Sj(t,e,r){let{data:n,error:i}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(i){g.error(`Cannot get cli warnings: ${W(i)}`);return}if(n.length>0){g.warn(`Found ${n.length} cli warnings for your organization.`);let s=null;for(let o of n){if(typeof o!="object"||typeof o.message!="string"||typeof o.fatal!="boolean"){g.error(`Invalid cli warning: ${o}`);continue}let a=o;a.fatal?(g.error(`${a.message.replaceAll("\\n",`
|
|
302
302
|
`)}`),s=new Error(a.message)):g.warn(`${a.message.replaceAll("\\n",`
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|