@capgo/cli 7.42.0 → 7.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "7.42.0",
3
+ "version": "7.42.1",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "author": "Martin martin@capgo.app",
6
6
  "license": "Apache 2.0",
package/dist/src/sdk.js CHANGED
@@ -283,7 +283,7 @@ ${Z.default.gray(pu)} ${t}
283
283
  `);let w=0,_=0;f(),s=setInterval(()=>{if(n&&a===u)return;y(),u=a;let F=Z.default.magenta(e[w]);if(n)process.stdout.write(`${F} ${a}...`);else if(t==="timer")process.stdout.write(`${F} ${a} ${C(c)}`);else{let v=".".repeat(Math.floor(_)).slice(0,3);process.stdout.write(`${F} ${a}${v}`)}w=w+1<e.length?w+1:0,_=_<e.length?_+.125:0},r)},m=(D="",w=0)=>{o=!1,clearInterval(s),y();let _=w===0?Z.default.green(Lm):w===1?Z.default.red(l_):Z.default.red(f_);a=E(D??a),t==="timer"?process.stdout.write(`${_} ${a} ${C(c)}
284
284
  `):process.stdout.write(`${_} ${a}
285
285
  `),p(),i()};return{start:A,stop:m,message:(D="")=>{a=E(D??a)}}};function h_(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),i="\x1B[";return i+n+"m"+e+i+"0m"}var zt=class t{title=null;headers=[];rows=[];static narrowTheme={top:["\u2554","\u2550","\u2564","\u2557"],row:["\u2551"," ","\u2502","\u2551"],div:["\u255F","\u2500","\u253C","\u2562"],bot:["\u255A","\u2550","\u2567","\u255D"]};static wideTheme={top:["\u2554\u2550","\u2550","\u2550\u2564\u2550","\u2550\u2557"],row:["\u2551 "," "," \u2502 "," \u2551"],div:["\u255F\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2562"],bot:["\u255A\u2550","\u2550","\u2550\u2567\u2550","\u2550\u255D"]};static roundTheme={top:["\u256D\u2500","\u2500","\u2500\u252C\u2500","\u2500\u256E"],row:["\u2502 "," "," \u2502 "," \u2502"],div:["\u251C\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2524"],bot:["\u2570\u2500","\u2500","\u2500\u2534\u2500","\u2500\u256F"]};theme=t.wideTheme;columnWidth(){let e=[this.headers,...this.rows].filter(n=>n.length>0),r=e[0].map(n=>this.cast(n).length);for(let n of e.slice(1))for(let i=0;i<r.length;i++){let s=this.cast(n[i]).length;s>r[i]&&(r[i]=s)}return r}cast(e){return typeof e=="object"?"obj":e!==void 0&&typeof e.toString=="function"?e.toString():""}renderTitle(){return"[ "+this.title+" ]"}renderLine(e){let r=this.columnWidth();return e[0]+r.map(n=>e[1].repeat(n)).join(e[2])+e[3]}renderCell(e,r,n=!1){let i=this.cast(e),s=n?h_("bold",i):i,o=r-i.length,a=this.theme.row[1];switch(typeof e){case"number":return a.repeat(o)+s;case"string":return s+a.repeat(o);case"boolean":case"object":return a.repeat(Math.ceil(o/2))+h_("italic",i)+a.repeat(Math.floor(o/2));default:return a.repeat(o)}}renderRow(e,r=!1){let n=this.theme.row,i=this.columnWidth();return n[0]+e.map((s,o)=>this.renderCell(s,i[o],r)).join(n[2])+n[3]}toString(){let e=this.theme,r=this.headers.length>0,n=this.rows.length>0;return[this.title?this.renderTitle():"",r||n?this.renderLine(e.top):"",r?this.renderRow(this.headers,!0):"",r&&n?this.renderLine(e.div):"",...this.rows.map(i=>this.renderRow(i)),r||n?this.renderLine(e.bot):""].filter(i=>i.length>0).join(`
286
- `)}};var l8=require("node:child_process"),Be=require("node:fs"),Vp=require("node:os"),xe=Ee(require("node:path")),jn=require("node:process"),is=Ee(Nl());var Zt=require("fs"),gu=(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,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bun":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm":(0,Zt.existsSync)(o)?"yarn":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npm":e},$l=(t=gu(),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"}},d_=(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,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bunx":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm exec":(0,Zt.existsSync)(o)?"yarn dlx":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npx":e};function Ll(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function g_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Um(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 Co="0|[1-9]\\d*",ZU="\\d*[a-zA-Z-][a-zA-Z0-9-]*",QU=`(?<major>${Co})\\.(?<minor>${Co})\\.(?<patch>${Co})`,p_=`(?:${Co}|${ZU})`,y_=`(?:-(?<prerelease>${p_}(?:\\.${p_})*))`,m_="[0-9A-Za-z-]+",D_=`(?:\\+(?<buildmetadata>${m_}(?:\\.${m_})*))`,w_=`v?${QU}${y_}?${D_}?`,E_=new RegExp(`^${w_}$`),v_="(?:<|>)?=?",e4="x|X|\\*",qm=`${Co}|${e4}`,Bl=`[v=\\s]*(?<major>${qm})(?:\\.(?<minor>${qm})(?:\\.(?<patch>${qm})${y_}?${D_}?)?)?`,b_=new RegExp(`^(?<operator>~>?|\\^|${v_})\\s*${Bl}$`),__=new RegExp(`^(?<operator>${v_})\\s*(${w_})$|^$`);function Hm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Vm=256;var t4=new RegExp(`^${Co}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(t4.test(e)){let r=Number(e);if(Hm(r))return r}return e})}function tn(t){return t.split(".").filter(Boolean)}function Oi(t,e){let r=Number(t);if(!Hm(r))throw new TypeError(e);return r}function zn(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 er(t,e){return t===e?0:Ll(t.major,e.major)||Ll(t.minor,e.minor)||Ll(t.patch,e.patch)||g_(t.prerelease,e.prerelease)||Um(t.prerelease,e.prerelease)}function zm(t){return t.toFixed(0)}function xi(t){let e=zm(t.major),r=zm(t.minor),n=zm(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 r4(t,e){if(zn(e))return!0;let r=er(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 jl(t,e){for(let r of e)if(!r4(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(zn(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 yu(t,e){return e.some(r=>jl(t,r))}function n4(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 Du(t=[],e){let r=n4(t);if(!e)return r;let n=Qt(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 C_(t,e,r={}){let n=r.build!==void 0?tn(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:Du(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:Du(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:Du(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:Du(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:Du(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Ml={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},So={operator:void 0,...Ml};function Km(t,e){return er(t,e)>0}function fs(t,e){return er(t,e)<0}function i4(t){let r=t.match(__)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:Oi(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Oi(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Oi(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Qt(i):[],build:s?tn(s):[]}:Ml;return{operator:n||void 0,...o}}function ze(t){return!t||t.toLowerCase()==="x"||t==="*"}function s4(t){if(!ze(t.major))return ze(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:ze(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?Qt(t.prerelease):[],build:[]}}function o4(t){if(!ze(t.major))return ze(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:ze(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:Qt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function a4(t){let e=t.match(new RegExp(`^${Bl}`)),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(`^${Bl}\\s*$`))?.groups;if(!a)return null;let u=s4(r),c=o4(a);return[u,c].filter(Boolean)}function u4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[So];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=Qt(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 c4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[So];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=Qt(t.prerelease??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]}function l4(t){let e=ze(t.major),r=ze(t.minor),n=ze(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=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function f4(t){let e=ze(t.minor),r=ze(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=Qt(t.prerelease??""),a=tn(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function h4(t){let e=ze(t.major),r=ze(t.minor),n=ze(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=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function d4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[So];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=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function p4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[So];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=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function m4(t){let e=t.match(b_)?.groups;if(!e)return i4(t);switch(e.operator){case"^":return u4(e);case"~":case"~>":return c4(e);case"<":return l4(e);case"<=":return f4(e);case">":return h4(e);case">=":return d4(e);case"=":case"":return p4(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function g4(t){return t.split(/\s+/).flatMap(m4)}function ql(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>a4(r)||g4(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function Ot(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Vm)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Vm}`);t=t.trim();let e=t.match(E_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Oi(e.major,`Cannot parse version ${t}: invalid major version`),n=Oi(e.minor,`Cannot parse version ${t}: invalid minor version`),i=Oi(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Qt(e.prerelease):[],o=e.buildmetadata?tn(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function S_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return zn(t)?!0:yu(t,[[e]]);if(n===void 0)return zn(e)?!0:yu(e,[[t]]);let i=er(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 y4(t){return t.every(e=>e.some(r=>D4(r)))}function D4(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!S_(r,n))return!1}return!0}function A_(t,e){return y4([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>S_(i,s)))))}function O_(t){try{return Ot(t),!0}catch{return!1}}function x_(t,e){return er(t,e)>=0}var Za=Ee(SS()),fb=Ee(aD()),f8=Ee(kA()),zp=Ee(Vh());var Bi={name:"@capgo/cli",version:"7.42.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":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.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.9.1","@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"}};async function zh(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 Xe(){let t=await zh("@capgo/cli")??"",e=t?.split(".")[0];t!==Bi.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${Bi.version} it's not the latest version.
286
+ `)}};var l8=require("node:child_process"),Be=require("node:fs"),Vp=require("node:os"),xe=Ee(require("node:path")),jn=require("node:process"),is=Ee(Nl());var Zt=require("fs"),gu=(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,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bun":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm":(0,Zt.existsSync)(o)?"yarn":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npm":e},$l=(t=gu(),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"}},d_=(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,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bunx":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm exec":(0,Zt.existsSync)(o)?"yarn dlx":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npx":e};function Ll(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function g_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Um(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 Co="0|[1-9]\\d*",ZU="\\d*[a-zA-Z-][a-zA-Z0-9-]*",QU=`(?<major>${Co})\\.(?<minor>${Co})\\.(?<patch>${Co})`,p_=`(?:${Co}|${ZU})`,y_=`(?:-(?<prerelease>${p_}(?:\\.${p_})*))`,m_="[0-9A-Za-z-]+",D_=`(?:\\+(?<buildmetadata>${m_}(?:\\.${m_})*))`,w_=`v?${QU}${y_}?${D_}?`,E_=new RegExp(`^${w_}$`),v_="(?:<|>)?=?",e4="x|X|\\*",qm=`${Co}|${e4}`,Bl=`[v=\\s]*(?<major>${qm})(?:\\.(?<minor>${qm})(?:\\.(?<patch>${qm})${y_}?${D_}?)?)?`,b_=new RegExp(`^(?<operator>~>?|\\^|${v_})\\s*${Bl}$`),__=new RegExp(`^(?<operator>${v_})\\s*(${w_})$|^$`);function Hm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Vm=256;var t4=new RegExp(`^${Co}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(t4.test(e)){let r=Number(e);if(Hm(r))return r}return e})}function tn(t){return t.split(".").filter(Boolean)}function Oi(t,e){let r=Number(t);if(!Hm(r))throw new TypeError(e);return r}function zn(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 er(t,e){return t===e?0:Ll(t.major,e.major)||Ll(t.minor,e.minor)||Ll(t.patch,e.patch)||g_(t.prerelease,e.prerelease)||Um(t.prerelease,e.prerelease)}function zm(t){return t.toFixed(0)}function xi(t){let e=zm(t.major),r=zm(t.minor),n=zm(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 r4(t,e){if(zn(e))return!0;let r=er(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 jl(t,e){for(let r of e)if(!r4(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(zn(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 yu(t,e){return e.some(r=>jl(t,r))}function n4(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 Du(t=[],e){let r=n4(t);if(!e)return r;let n=Qt(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 C_(t,e,r={}){let n=r.build!==void 0?tn(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:Du(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:Du(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:Du(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:Du(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:Du(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Ml={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},So={operator:void 0,...Ml};function Km(t,e){return er(t,e)>0}function fs(t,e){return er(t,e)<0}function i4(t){let r=t.match(__)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:Oi(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Oi(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Oi(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Qt(i):[],build:s?tn(s):[]}:Ml;return{operator:n||void 0,...o}}function ze(t){return!t||t.toLowerCase()==="x"||t==="*"}function s4(t){if(!ze(t.major))return ze(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:ze(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?Qt(t.prerelease):[],build:[]}}function o4(t){if(!ze(t.major))return ze(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:ze(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:Qt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function a4(t){let e=t.match(new RegExp(`^${Bl}`)),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(`^${Bl}\\s*$`))?.groups;if(!a)return null;let u=s4(r),c=o4(a);return[u,c].filter(Boolean)}function u4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[So];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=Qt(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 c4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[So];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=Qt(t.prerelease??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]}function l4(t){let e=ze(t.major),r=ze(t.minor),n=ze(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=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function f4(t){let e=ze(t.minor),r=ze(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=Qt(t.prerelease??""),a=tn(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function h4(t){let e=ze(t.major),r=ze(t.minor),n=ze(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=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function d4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[So];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=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function p4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[So];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=Qt(t.prerelease??""),u=tn(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function m4(t){let e=t.match(b_)?.groups;if(!e)return i4(t);switch(e.operator){case"^":return u4(e);case"~":case"~>":return c4(e);case"<":return l4(e);case"<=":return f4(e);case">":return h4(e);case">=":return d4(e);case"=":case"":return p4(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function g4(t){return t.split(/\s+/).flatMap(m4)}function ql(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>a4(r)||g4(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function Ot(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Vm)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Vm}`);t=t.trim();let e=t.match(E_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Oi(e.major,`Cannot parse version ${t}: invalid major version`),n=Oi(e.minor,`Cannot parse version ${t}: invalid minor version`),i=Oi(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Qt(e.prerelease):[],o=e.buildmetadata?tn(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function S_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return zn(t)?!0:yu(t,[[e]]);if(n===void 0)return zn(e)?!0:yu(e,[[t]]);let i=er(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 y4(t){return t.every(e=>e.some(r=>D4(r)))}function D4(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!S_(r,n))return!1}return!0}function A_(t,e){return y4([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>S_(i,s)))))}function O_(t){try{return Ot(t),!0}catch{return!1}}function x_(t,e){return er(t,e)>=0}var Za=Ee(SS()),fb=Ee(aD()),f8=Ee(kA()),zp=Ee(Vh());var Bi={name:"@capgo/cli",version:"7.42.1",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":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.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.9.1","@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"}};async function zh(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 Xe(){let t=await zh("@capgo/cli")??"",e=t?.split(".")[0];t!==Bi.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${Bi.version} it's not the latest version.
287
287
  Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function KT(t,e,r,n,i,s="\u2705"){await _e(r,{channel:t,event:n,icon:s,user_id:e,...i?{tags:{"app-id":i}}:{},notify:!1})}var E0=require("node:buffer"),GT=require("node:crypto"),OY=(()=>{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 xY(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=OY[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function ei(t,e="sha256"){let r=E0.Buffer.isBuffer(t)?t:E0.Buffer.from(t);if(e==="crc32")return xY(r);let n=(0,GT.createHash)(e);return n.update(r),n.digest("hex")}var il=Ee(gM());async function yM(){let t=await(0,il.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function qv(t,e,r=!1){let n=await(0,il.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,il.writeConfig)(i,n.app.extConfigFilePath))}async function Wa(t,e=!1){await qv("CapacitorUpdater",t,e)}var Qa=".capgo_key",Nr=".capgo_key_v2",Kp=`${Qa}.pub`,yi=`${Nr}.pub`,i8="https://capgo.app",s8="https://files.capgo.app",o8="https://api.capgo.app",a8="https://console.capgo.app",hb=12e4,zle=1024*1024*20,Kle=1024*1024*1024,Gle=1024*1024*99,ul="package.json",eu=/^(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?`
288
288
  ${f8.default.render(t)}`:"";function Hp(t){return new Promise(e=>{setTimeout(e,t)})}function $r(t){return(0,is.isMonorepo)(t)?(0,is.findMonorepoRoot)(t):(0,is.isNXMonorepo)(t)?(0,is.findNXMonorepoRoot)(t):t}function Wle(t=$r((0,jn.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Be.existsSync)(r)){let i=`Package.json at ${r} does not exist`;throw g.error(i),new Error(i)}let n=(0,Be.readFileSync)(r??(0,xe.join)(t,ul));return JSON.parse(n)}function ss(t=$r((0,jn.cwd)()),e=void 0){return Wle(t,e).version??""}function u8(t){let e=t.replace("^","").replace("~","");if(O_(e))try{let r=Ot(e);return xi(r)}catch{return e}return e}async function os(t,e=(0,jn.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;let n=r?(0,xe.dirname)(r):e;try{let u=`${t}/package.json`,{createRequire:c}=await import("node:module"),h=c((0,xe.join)(n,"package.json")).resolve(u),d=JSON.parse((0,Be.readFileSync)(h,"utf-8"));if(d.version)return d.version}catch{}let i=n,s=xe.default.parse(i).root;for(;i!==s;){let u=(0,xe.join)(i,"node_modules",t,ul);if((0,Be.existsSync)(u))try{let l=JSON.parse((0,Be.readFileSync)(u,"utf-8"));if(l.version)return l.version}catch{}let c=(0,xe.dirname)(i);if(c===i)break;i=c}let o=null,a=(0,xe.join)(e,"ios","App","Podfile");if((0,Be.existsSync)(a))try{let c=(0,Be.readFileSync)(a,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);c?.[1]&&(o=(0,xe.resolve)((0,xe.join)(e,"ios","App",c[1])))}catch{}if(!o){let u=(0,xe.join)(e,"android","capacitor.settings.gradle");if((0,Be.existsSync)(u))try{let l=(0,Be.readFileSync)(u,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);l?.[1]&&(o=(0,xe.resolve)((0,xe.join)(e,"android",l[1])).replace(/\/android$/,""))}catch{}}if(o){let u=(0,xe.join)(o,ul);if((0,Be.existsSync)(u))try{let c=JSON.parse((0,Be.readFileSync)(u,"utf-8"));if(c.version)return c.version}catch{}}try{let c=(await Gp(e)).get(t);if(c)return c}catch{}return null}async function Gp(t=$r((0,jn.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,xe.join)(t,ul)],r){for(let i of r)if(!(0,Be.existsSync)(i)){let s=`Package.json at ${i} does not exist`;throw g.error(s),new Error(s)}}let n=new Map;for(let i of r){let s=(0,Be.readFileSync)(i),o=JSON.parse(s);for(let a in o.dependencies)n.set(a,u8(o.dependencies[a]));for(let a in o.devDependencies)n.set(a,u8(o.devDependencies[a]))}return n}async function de(){try{let t=await yM();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 Xle(t,e){let r=await de();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await qv(t,r)),r}async function h8(t){return Xle("CapacitorUpdater",t)}async function _n(){try{let t=await de(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||i8,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||a8,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||s8,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||o8};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:i8,hostWeb:a8,hostFilesApi:s8,hostApi:o8}}}var Yle=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Wp(){let t=await _n();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 d8(){let t=await _n();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:Kle,maxChunkSize:Gle,alertUploadSize:zle}}}async function pe(t,e,r){let n=await Wp();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(0,Za.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function Jle(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 p8(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function m8(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function Zle(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function Qle(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var hr=(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))(hr||{}),tu=(t,e)=>t>=e;async function g8(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 y8(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",`
289
289
  `)}`),s=new Error(a.message)):g.warn(`${a.message.replaceAll("\\n",`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "7.42.0",
3
+ "version": "7.42.1",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "author": "Martin martin@capgo.app",
6
6
  "license": "Apache 2.0",