@gadgetinc/ggt 1.5.0 → 1.5.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/{add-DXY6AG6H.js → add-XHMGXWYX.js} +2 -2
- package/dist/{chunk-DJD3NXRH.js → chunk-3B2GY4UU.js} +2 -2
- package/dist/{chunk-EUGLHSIM.js → chunk-A75V6SNW.js} +2 -2
- package/dist/{chunk-4Y2HLTHR.js → chunk-KW4V2PJW.js} +2 -2
- package/dist/{chunk-4SKILKRX.js → chunk-LPIHKY3M.js} +2 -2
- package/dist/{chunk-4SKILKRX.js.map → chunk-LPIHKY3M.js.map} +2 -2
- package/dist/{chunk-SQN5DMIE.js → chunk-U5I2YBJK.js} +2 -2
- package/dist/{chunk-ZZ65SSGY.js → chunk-WQ4SFIE4.js} +2 -2
- package/dist/{chunk-CQZ6BU7J.js → chunk-Z7JIVKEF.js} +2 -2
- package/dist/{deploy-HH4JGQQQ.js → deploy-QW6KPNDB.js} +2 -2
- package/dist/{dev-2DTGRUJB.js → dev-KUTYS7OU.js} +2 -2
- package/dist/{list-HJ2MHZYD.js → list-OSMGHITM.js} +2 -2
- package/dist/login-UU4MWB6Y.js +2 -0
- package/dist/main.js +1 -1
- package/dist/{open-PSHZ2QUY.js → open-SP5XOXPG.js} +2 -2
- package/dist/{pull-TULQDNBR.js → pull-7JMGBM4A.js} +2 -2
- package/dist/push-7S6V2HSB.js +2 -0
- package/dist/{status-UMVNPXXU.js → status-CJVN2UZ6.js} +2 -2
- package/dist/{whoami-Z2TFEATF.js → whoami-MU3POPXB.js} +2 -2
- package/package.json +1 -1
- package/dist/login-NA3DP22R.js +0 -2
- package/dist/push-KB43HKQI.js +0 -2
- /package/dist/{add-DXY6AG6H.js.map → add-XHMGXWYX.js.map} +0 -0
- /package/dist/{chunk-DJD3NXRH.js.map → chunk-3B2GY4UU.js.map} +0 -0
- /package/dist/{chunk-EUGLHSIM.js.map → chunk-A75V6SNW.js.map} +0 -0
- /package/dist/{chunk-4Y2HLTHR.js.map → chunk-KW4V2PJW.js.map} +0 -0
- /package/dist/{chunk-SQN5DMIE.js.map → chunk-U5I2YBJK.js.map} +0 -0
- /package/dist/{chunk-ZZ65SSGY.js.map → chunk-WQ4SFIE4.js.map} +0 -0
- /package/dist/{chunk-CQZ6BU7J.js.map → chunk-Z7JIVKEF.js.map} +0 -0
- /package/dist/{deploy-HH4JGQQQ.js.map → deploy-QW6KPNDB.js.map} +0 -0
- /package/dist/{dev-2DTGRUJB.js.map → dev-KUTYS7OU.js.map} +0 -0
- /package/dist/{list-HJ2MHZYD.js.map → list-OSMGHITM.js.map} +0 -0
- /package/dist/{login-NA3DP22R.js.map → login-UU4MWB6Y.js.map} +0 -0
- /package/dist/{open-PSHZ2QUY.js.map → open-SP5XOXPG.js.map} +0 -0
- /package/dist/{pull-TULQDNBR.js.map → pull-7JMGBM4A.js.map} +0 -0
- /package/dist/{push-KB43HKQI.js.map → push-7S6V2HSB.js.map} +0 -0
- /package/dist/{status-UMVNPXXU.js.map → status-CJVN2UZ6.js.map} +0 -0
- /package/dist/{whoami-Z2TFEATF.js.map → whoami-MU3POPXB.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as O,g as R,h as M,i as j,j as k,k as P,p as b}from"./chunk-
|
|
1
|
+
import{f as O,g as R,h as M,i as j,j as k,k as P,p as b}from"./chunk-A75V6SNW.js";import{g as N,l as J,m as D,n as _,o as E}from"./chunk-3B2GY4UU.js";import"./chunk-HAYHNB7Q.js";import"./chunk-Z7JIVKEF.js";import{c as f}from"./chunk-U5I2YBJK.js";import"./chunk-HN3YKQ3C.js";import"./chunk-KW4V2PJW.js";import{b as T,g as C,h as S,k as w,o as B,q as y,y as U,z as L}from"./chunk-LPIHKY3M.js";import"./chunk-5VLIBRPJ.js";import{b as m,ga as d,ia as p,m as F}from"./chunk-XOSBJSTW.js";import"./chunk-GFQYFEEH.js";import{a as g,h as $}from"./chunk-7DYQUG5M.js";$();var h=class extends S{static{g(this,"AddClientError")}isBug=C.NO;constructor(o){let i="";if(F(o.cause)){let a=B(o.cause.map(e=>e.message));i=d` • ${a.map(e=>e.split(`
|
|
2
2
|
`).join(`
|
|
3
3
|
\u200E \u2022 `)).join(`
|
|
4
4
|
`)}`}else i=d`${o.cause}`;super(i)}render(){return`${m.redBright(w.cross)} Failed to add:
|
|
@@ -78,4 +78,4 @@ import{f as O,g as R,h as M,i as j,j as k,k as P,p as b}from"./chunk-EUGLHSIM.js
|
|
|
78
78
|
|
|
79
79
|
{gray Usage}
|
|
80
80
|
{cyanBright ggt add field ${e[0]}/<field_name>:<field_type>}`);try{let n=(await a.edit.mutate({mutation:j,variables:{path:e[0],fields:r.map(s=>({name:s.name,fieldType:s.fieldType}))}})).createModelFields;await i.writeToLocalFilesystem(t,{filesVersion:n.remoteFilesVersion,files:n.changed,delete:[]})}catch(n){throw n instanceof y?new h(n):n}p({ensureEmptyLineAbove:!0,content:`Field ${m.cyanBright(r[0]?.name)} added successfully.`})},"fieldSubCommand"),Q=g(async(t,{args:o,filesync:i})=>{let a=i.syncJson,e=o._[1]??Y();try{await a.edit.mutate({mutation:k,variables:{environment:{slug:e,sourceSlug:a.environment.name}}})}catch(n){throw n instanceof y?new h(n):n}if(p({ensureEmptyLineAbove:!0,content:`Environment ${m.cyanBright(e)} added successfully.`}),await _.load(t,{command:"pull",args:{_:[],"--app":void 0,"--allow-unknown-directory":void 0,"--allow-different-app":void 0,"--env":e},directory:await E(process.cwd())})){let n=new b(a),s=await n.hashes(t);if(s.environmentChangesToPull.size===0){p({ensureEmptyLineAbove:!0,content:"Nothing to pull."});return}s.localChangesToPush.size>0&&await n.print(t,{hashes:s}),await n.pull(t,{hashes:s,force:!0})}},"envSubCommand"),Y=g(()=>{let t=new Date;return`env-${t.toISOString().slice(0,10).replace(/-/g,"")}-${t.toLocaleTimeString("en-US",{hour12:!1}).replace(/:/g,"")}`},"makeDefaultEnvName");export{h as AddClientError,ue as args,fe as run,G as usage};
|
|
81
|
-
//# sourceMappingURL=add-
|
|
81
|
+
//# sourceMappingURL=add-XHMGXWYX.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Z}from"./chunk-
|
|
1
|
+
import{c as Z}from"./chunk-U5I2YBJK.js";import{a as uo,b as co}from"./chunk-HN3YKQ3C.js";import{a as Br,b as Nr,i as Gr}from"./chunk-KW4V2PJW.js";import{A as Tt,b as mt,d as jr,g as _t,h as kt,k as Bt,m as lo,n as Dr,p as be,q as tt,u as Mr,v as we,w as _e,x as Ir}from"./chunk-LPIHKY3M.js";import{a as Lr}from"./chunk-5VLIBRPJ.js";import{M as bt,T as wt,Y as ve,_ as Fr,b as W,ba as It,e as J,ea as $r,g as Cr,ga as S,h as Sr,ha as A,ia as X,l as xr,m as Er,t as Or,u as Pr,v as Rr,y as Ar,z as ao}from"./chunk-XOSBJSTW.js";import{a as oo}from"./chunk-GFQYFEEH.js";import{a as n,b as ye,d as it,f as ft,h as T}from"./chunk-7DYQUG5M.js";var Wr=it(N=>{"use strict";T();var mo=N&&N.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(N,"__esModule",{value:!0});var ho=ye("fs"),go=mo(co()),ht=go.default("@kwsites/file-exists");function yo(t,e,r){ht("checking %s",t);try{let s=ho.statSync(t);return s.isFile()&&e?(ht("[OK] path represents a file"),!0):s.isDirectory()&&r?(ht("[OK] path represents a directory"),!0):(ht("[FAIL] path represents something other than a file or directory"),!1)}catch(s){if(s.code==="ENOENT")return ht("[FAIL] path is not accessible: %o",s),!1;throw ht("[FATAL] %o",s),s}}n(yo,"check");function vo(t,e=N.READABLE){return yo(t,(e&N.FILE)>0,(e&N.FOLDER)>0)}n(vo,"exists");N.exists=vo;N.FILE=1;N.FOLDER=2;N.READABLE=N.FILE+N.FOLDER});var Qr=it(Gt=>{"use strict";T();function bo(t){for(var e in t)Gt.hasOwnProperty(e)||(Gt[e]=t[e])}n(bo,"__export");Object.defineProperty(Gt,"__esModule",{value:!0});bo(Wr())});var xe=it((Nl,Hr)=>{T();function wo(t){r.debug=r,r.default=r,r.coerce=c,r.disable=o,r.enable=i,r.enabled=a,r.humanize=oo(),r.destroy=h,Object.keys(t).forEach(p=>{r[p]=t[p]}),r.names=[],r.skips=[],r.formatters={};function e(p){let m=0;for(let d=0;d<p.length;d++)m=(m<<5)-m+p.charCodeAt(d),m|=0;return r.colors[Math.abs(m)%r.colors.length]}n(e,"selectColor"),r.selectColor=e;function r(p){let m,d=null,g,B;function q(...D){if(!q.enabled)return;let K=q,lt=Number(new Date),me=lt-(m||lt);K.diff=me,K.prev=m,K.curr=lt,m=lt,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let pt=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(vt,he)=>{if(vt==="%%")return"%";pt++;let Mt=r.formatters[he];if(typeof Mt=="function"){let de=D[pt];vt=Mt.call(K,de),D.splice(pt,1),pt--}return vt}),r.formatArgs.call(K,D),(K.log||r.log).apply(K,D)}return n(q,"debug"),q.namespace=p,q.useColors=r.useColors(),q.color=r.selectColor(p),q.extend=s,q.destroy=r.destroy,Object.defineProperty(q,"enabled",{enumerable:!0,configurable:!1,get:n(()=>d!==null?d:(g!==r.namespaces&&(g=r.namespaces,B=r.enabled(p)),B),"get"),set:n(D=>{d=D},"set")}),typeof r.init=="function"&&r.init(q),q}n(r,"createDebug");function s(p,m){let d=r(this.namespace+(typeof m>"u"?":":m)+p);return d.log=this.log,d}n(s,"extend");function i(p){r.save(p),r.namespaces=p,r.names=[],r.skips=[];let m,d=(typeof p=="string"?p:"").split(/[\s,]+/),g=d.length;for(m=0;m<g;m++)d[m]&&(p=d[m].replace(/\*/g,".*?"),p[0]==="-"?r.skips.push(new RegExp("^"+p.slice(1)+"$")):r.names.push(new RegExp("^"+p+"$")))}n(i,"enable");function o(){let p=[...r.names.map(u),...r.skips.map(u).map(m=>"-"+m)].join(",");return r.enable(""),p}n(o,"disable");function a(p){if(p[p.length-1]==="*")return!0;let m,d;for(m=0,d=r.skips.length;m<d;m++)if(r.skips[m].test(p))return!1;for(m=0,d=r.names.length;m<d;m++)if(r.names[m].test(p))return!0;return!1}n(a,"enabled");function u(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}n(u,"toNamespace");function c(p){return p instanceof Error?p.stack||p.message:p}n(c,"coerce");function h(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n(h,"destroy"),r.enable(r.load()),r}n(wo,"setup");Hr.exports=wo});var Yr=it((G,Ut)=>{T();G.formatArgs=ko;G.save=To;G.load=Co;G.useColors=_o;G.storage=So();G.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();G.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function _o(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}n(_o,"useColors");function ko(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Ut.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(s=r))}),t.splice(s,0,e)}n(ko,"formatArgs");G.log=console.debug||console.log||(()=>{});function To(t){try{t?G.storage.setItem("debug",t):G.storage.removeItem("debug")}catch{}}n(To,"save");function Co(){let t;try{t=G.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}n(Co,"load");function So(){try{return localStorage}catch{}}n(So,"localstorage");Ut.exports=xe()(G);var{formatters:xo}=Ut.exports;xo.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Xr=it((R,Jt)=>{T();var Eo=ye("tty"),qt=ye("util");R.init=jo;R.log=Ao;R.formatArgs=Po;R.save=Fo;R.load=$o;R.useColors=Oo;R.destroy=qt.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");R.colors=[6,2,3,4,5,1];try{let t=uo();t&&(t.stderr||t).level>=2&&(R.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}R.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,o)=>o.toUpperCase()),s=process.env[e];return/^(yes|on|true|enabled)$/i.test(s)?s=!0:/^(no|off|false|disabled)$/i.test(s)?s=!1:s==="null"?s=null:s=Number(s),t[r]=s,t},{});function Oo(){return"colors"in R.inspectOpts?!!R.inspectOpts.colors:Eo.isatty(process.stderr.fd)}n(Oo,"useColors");function Po(t){let{namespace:e,useColors:r}=this;if(r){let s=this.color,i="\x1B[3"+(s<8?s:"8;5;"+s),o=` ${i};1m${e} \x1B[0m`;t[0]=o+t[0].split(`
|
|
2
2
|
`).join(`
|
|
3
3
|
`+o),t.push(i+"m+"+Jt.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Ro()+e+" "+t[0]}n(Po,"formatArgs");function Ro(){return R.inspectOpts.hideDate?"":new Date().toISOString()+" "}n(Ro,"getDate");function Ao(...t){return process.stderr.write(qt.formatWithOptions(R.inspectOpts,...t)+`
|
|
4
4
|
`)}n(Ao,"log");function Fo(t){t?process.env.DEBUG=t:delete process.env.DEBUG}n(Fo,"save");function $o(){return process.env.DEBUG}n($o,"load");function jo(t){t.inspectOpts={};let e=Object.keys(R.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=R.inspectOpts[e[r]]}n(jo,"init");Jt.exports=xe()(R);var{formatters:Kr}=Jt.exports;Kr.o=function(t){return this.inspectOpts.colors=this.useColors,qt.inspect(t,this.inspectOpts).split(`
|
|
@@ -118,4 +118,4 @@ import{c as Z}from"./chunk-SQN5DMIE.js";import{a as uo,b as co}from"./chunk-HN3Y
|
|
|
118
118
|
• ${u.join(`
|
|
119
119
|
\u2022 `)}
|
|
120
120
|
`)},"loadEnvironment"),Wc=n(async(t,{directory:e})=>{try{return await ji(e.path).revparse(["--abbrev-ref","HEAD"])}catch(r){t.log.warn("failed to read git branch",{error:r});return}},"loadBranch"),Qc=J.object({application:J.string(),environment:J.string(),environments:J.record(J.object({filesVersion:J.string()}))}),Hc=J.object({app:J.string(),filesVersion:J.string(),mtime:J.number()}),Yc=J.union([Qc,Hc]),Kc=Yc.transform(t=>"environment"in t?t:{application:t.app,environment:"development",environments:{development:{filesVersion:t.filesVersion}}});export{nl as a,ke as b,sl as c,il as d,ol as e,qr as f,Nt as g,Jr as h,zr as i,fo as j,yl as k,Se as l,mf as m,_r as n,hf as o};
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
121
|
+
//# sourceMappingURL=chunk-3B2GY4UU.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as bt,e as Et,h as xt,j as Ie,k as ne,l as Ct}from"./chunk-DJD3NXRH.js";import{a as ft,b as ht}from"./chunk-HAYHNB7Q.js";import{b as W}from"./chunk-CQZ6BU7J.js";import{c as St}from"./chunk-SQN5DMIE.js";import{c as Ae}from"./chunk-4Y2HLTHR.js";import{C as _t,j as Me,k as N,l as vr,m as gt,r as Mt}from"./chunk-4SKILKRX.js";import{b as It,c as At}from"./chunk-5VLIBRPJ.js";import{$ as mt,N as ct,Q as dt,R as D,U as xe,V as te,Y as yt,b as E,d as ot,g as st,ga as g,ha as G,ia as O,n as it,p as Ee,q as lt,r as ut,s as pt,z as Tr}from"./chunk-XOSBJSTW.js";import{a as Cr}from"./chunk-GFQYFEEH.js";import{a,b as F,d as x,f as w,h as p}from"./chunk-7DYQUG5M.js";var $t=x((Ts,Ut)=>{p();Ut.exports=Ht;Ht.sync=Br;var Dt=F("fs");function Nr(e,t){var n=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var r=0;r<n.length;r++){var o=n[r].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}a(Nr,"checkPathExt");function Gt(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:Nr(t,n)}a(Gt,"checkStat");function Ht(e,t,n){Dt.stat(e,function(r,o){n(r,r?!1:Gt(o,e,t))})}a(Ht,"isexe");function Br(e,t){return Gt(Dt.statSync(e),e,t)}a(Br,"sync")});var qt=x((Rs,Wt)=>{p();Wt.exports=jt;jt.sync=kr;var Qt=F("fs");function jt(e,t,n){Qt.stat(e,function(r,o){n(r,r?!1:Jt(o,t))})}a(jt,"isexe");function kr(e,t){return Jt(Qt.statSync(e),t)}a(kr,"sync");function Jt(e,t){return e.isFile()&&Lr(e,t)}a(Jt,"checkStat");function Lr(e,t){var n=e.mode,r=e.uid,o=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),i=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),l=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),d=l|u,y=n&c||n&u&&o===i||n&l&&r===s||n&d&&s===0;return y}a(Lr,"checkMode")});var zt=x((Ns,Yt)=>{p();var Os=F("fs"),oe;process.platform==="win32"||global.TESTING_WINDOWS?oe=$t():oe=qt();Yt.exports=Te;Te.sync=Vr;function Te(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,o){Te(e,t||{},function(s,i){s?o(s):r(i)})})}oe(e,t||{},function(r,o){r&&(r.code==="EACCES"||t&&t.ignoreErrors)&&(r=null,o=!1),n(r,o)})}a(Te,"isexe");function Vr(e,t){try{return oe.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}a(Vr,"sync")});var rn=x((Ls,nn)=>{p();var $=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Kt=F("path"),Dr=$?";":":",Xt=zt(),Zt=a(e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),"getNotFoundError"),en=a((e,t)=>{let n=t.colon||Dr,r=e.match(/\//)||$&&e.match(/\\/)?[""]:[...$?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],o=$?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=$?o.split(n):[""];return $&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:r,pathExt:s,pathExtExe:o}},"getPathInfo"),tn=a((e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});let{pathEnv:r,pathExt:o,pathExtExe:s}=en(e,t),i=[],l=a(c=>new Promise((d,y)=>{if(c===r.length)return t.all&&i.length?d(i):y(Zt(e));let m=r[c],S=/^".*"$/.test(m)?m.slice(1,-1):m,f=Kt.join(S,e),h=!S&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;d(u(h,c,0))}),"step"),u=a((c,d,y)=>new Promise((m,S)=>{if(y===o.length)return m(l(d+1));let f=o[y];Xt(c+f,{pathExt:s},(h,b)=>{if(!h&&b)if(t.all)i.push(c+f);else return m(c+f);return m(u(c,d,y+1))})}),"subStep");return n?l(0).then(c=>n(null,c),n):l(0)},"which"),Gr=a((e,t)=>{t=t||{};let{pathEnv:n,pathExt:r,pathExtExe:o}=en(e,t),s=[];for(let i=0;i<n.length;i++){let l=n[i],u=/^".*"$/.test(l)?l.slice(1,-1):l,c=Kt.join(u,e),d=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let y=0;y<r.length;y++){let m=d+r[y];try{if(Xt.sync(m,{pathExt:o}))if(t.all)s.push(m);else return m}catch{}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw Zt(e)},"whichSync");nn.exports=tn;tn.sync=Gr});var on=x((Gs,ve)=>{"use strict";p();var an=a((e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"},"pathKey");ve.exports=an;ve.exports.default=an});var pn=x(($s,un)=>{"use strict";p();var sn=F("path"),Hr=rn(),Ur=on();function ln(e,t){let n=e.options.env||process.env,r=process.cwd(),o=e.options.cwd!=null,s=o&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch{}let i;try{i=Hr.sync(e.command,{path:n[Ur({env:n})],pathExt:t?sn.delimiter:void 0})}catch{}finally{s&&process.chdir(r)}return i&&(i=sn.resolve(o?e.options.cwd:"",i)),i}a(ln,"resolveCommandAttempt");function $r(e){return ln(e)||ln(e,!0)}a($r,"resolveCommand");un.exports=$r});var cn=x((Js,Re)=>{"use strict";p();var Fe=/([()\][%!^"`<>&|;, *?])/g;function Qr(e){return e=e.replace(Fe,"^$1"),e}a(Qr,"escapeCommand");function jr(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Fe,"^$1"),t&&(e=e.replace(Fe,"^$1")),e}a(jr,"escapeArgument");Re.exports.command=Qr;Re.exports.argument=jr});var yn=x((Ys,dn)=>{"use strict";p();dn.exports=/^#!(.*)/});var Sn=x((Ks,mn)=>{"use strict";p();var Jr=yn();mn.exports=(e="")=>{let t=e.match(Jr);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,"").split(" "),o=n.split("/").pop();return o==="env"?r:r?`${o} ${r}`:o}});var fn=x((Zs,gn)=>{"use strict";p();var we=F("fs"),Wr=Sn();function qr(e){let n=Buffer.alloc(150),r;try{r=we.openSync(e,"r"),we.readSync(r,n,0,150,0),we.closeSync(r)}catch{}return Wr(n.toString())}a(qr,"readShebang");gn.exports=qr});var xn=x((ni,En)=>{"use strict";p();var Yr=F("path"),hn=pn(),bn=cn(),zr=fn(),Kr=process.platform==="win32",Xr=/\.(?:com|exe)$/i,Zr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function ea(e){e.file=hn(e);let t=e.file&&zr(e.file);return t?(e.args.unshift(e.file),e.command=t,hn(e)):e.file}a(ea,"detectShebang");function ta(e){if(!Kr)return e;let t=ea(e),n=!Xr.test(t);if(e.options.forceShell||n){let r=Zr.test(t);e.command=Yr.normalize(e.command),e.command=bn.command(e.command),e.args=e.args.map(s=>bn.argument(s,r));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}a(ta,"parseNonShell");function na(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:ta(r)}a(na,"parse");En.exports=na});var An=x((oi,In)=>{"use strict";p();var Pe=process.platform==="win32";function Oe(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}a(Oe,"notFoundError");function ra(e,t){if(!Pe)return;let n=e.emit;e.emit=function(r,o){if(r==="exit"){let s=Mn(o,t,"spawn");if(s)return n.call(e,"error",s)}return n.apply(e,arguments)}}a(ra,"hookChildProcess");function Mn(e,t){return Pe&&e===1&&!t.file?Oe(t.original,"spawn"):null}a(Mn,"verifyENOENT");function aa(e,t){return Pe&&e===1&&!t.file?Oe(t.original,"spawnSync"):null}a(aa,"verifyENOENTSync");In.exports={hookChildProcess:ra,verifyENOENT:Mn,verifyENOENTSync:aa,notFoundError:Oe}});var Tn=x((li,Q)=>{"use strict";p();var _n=F("child_process"),Ne=xn(),Be=An();function Cn(e,t,n){let r=Ne(e,t,n),o=_n.spawn(r.command,r.args,r.options);return Be.hookChildProcess(o,r),o}a(Cn,"spawn");function oa(e,t,n){let r=Ne(e,t,n),o=_n.spawnSync(r.command,r.args,r.options);return o.error=o.error||Be.verifyENOENTSync(o.status,r),o}a(oa,"spawnSync");Q.exports=Cn;Q.exports.spawn=Cn;Q.exports.sync=oa;Q.exports._parse=Ne;Q.exports._enoent=Be});var Zn=x((zl,Xn)=>{"use strict";p();var{PassThrough:to}=F("stream");Xn.exports=function(){var e=[],t=new to({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=r,t.on("unpipe",o),Array.prototype.slice.call(arguments).forEach(n),t;function n(s){return Array.isArray(s)?(s.forEach(n),this):(e.push(s),s.once("end",o.bind(null,s)),s.once("error",t.emit.bind(t,"error")),s.pipe(t,{end:!1}),this)}a(n,"add");function r(){return e.length==0}a(r,"isEmpty");function o(s){e=e.filter(function(i){return i!==s}),!e.length&&t.readable&&t.end()}a(o,"remove")}});var fr=x(($u,gr)=>{p();function A(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}a(A,"RetryOperation");gr.exports=A;A.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};A.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};A.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0};A.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};A.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};A.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};A.prototype.start=A.prototype.try;A.prototype.errors=function(){return this._errors};A.prototype.attempts=function(){return this._attempts};A.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],s=o.message,i=(e[s]||0)+1;e[s]=i,i>=n&&(t=o,n=i)}return t}});var hr=x(L=>{p();var Co=fr();L.operation=function(e){var t=L.timeouts(e);return new Co(t,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};L.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],o=0;o<t.retries;o++)r.push(this.createTimeout(o,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(o,t)),r.sort(function(s,i){return s-i}),r};L.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout),r};L.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var r in e)typeof e[r]=="function"&&n.push(r)}for(var o=0;o<n.length;o++){var s=n[o],i=e[s];e[s]=a(function(u){var c=L.operation(t),d=Array.prototype.slice.call(arguments,1),y=d.pop();d.push(function(m){c.retry(m)||(m&&(arguments[0]=c.mainError()),y.apply(this,arguments))}),c.attempt(function(){u.apply(e,d)})},"retryWrapper").bind(e,i),e[s].options=t}}});var Er=x((Yu,br)=>{p();br.exports=hr()});p();var q=w(gt(),1);var re=class extends Map{static{a(this,"Changes")}created=D(()=>Array.from(this.entries()).filter(([,t])=>t.type==="create").map(([t])=>t));updated=D(()=>Array.from(this.entries()).filter(([,t])=>t.type==="update").map(([t])=>t));deleted=D(()=>Array.from(this.entries()).filter(([,t])=>t.type==="delete").map(([t])=>t))},Fr=E.greenBright("+"),Rr=E.blueBright("\xB1"),wr=E.redBright("-"),Tt=E.yellowBright("\u2192"),Y=a((e,{changes:t,tense:n,limit:r=1/0,...o})=>{yt.logLevel<=te.TRACE&&(r=1/0);let s=Array.from(t.entries()).filter(([m])=>!m.startsWith(".gadget/"));if(s.length===0)return"";let i=E.yellowBright(n==="past"?"renamed":"rename"),l=E.greenBright(n==="past"?"created":"create"),u=E.blueBright(n==="past"?"updated":"update"),c=E.redBright(n==="past"?"deleted":"delete"),d=s.sort((m,S)=>m[0].localeCompare(S[0])).slice(0,r).map(([m,S])=>{switch(!0){case(S.type==="create"&&st(S.oldPath)):return[Tt,E.yellowBright(S.oldPath),i,Tt,E.yellowBright(m)];case S.type==="create":return[Fr,E.greenBright(m),l];case S.type==="update":return[Rr,E.blueBright(m),u];case S.type==="delete":return[wr,E.redBright(m),c];default:return it(S)}});s.length>r&&d.push([E.gray(N.ellipsis),g`{gray ${s.length-r} more}`,""]);let y;if(s.length>=5){let m=[],S=s.filter(([,b])=>b.type==="create").length;if(S>0){let b=n==="past"?`${S} created`:(0,q.default)("create",S,!0);m.push(g`{greenBright ${b}}`)}let f=s.filter(([,b])=>b.type==="update").length;if(f>0){let b=n==="past"?`${f} updated`:(0,q.default)("update",f,!0);m.push(g`{blueBright ${b}}`)}let h=s.filter(([,b])=>b.type==="delete").length;if(h>0){let b=n==="past"?`${h} deleted`:(0,q.default)("delete",h,!0);m.push(g`{redBright ${b}}`)}y=G`
|
|
1
|
+
import{b as bt,e as Et,h as xt,j as Ie,k as ne,l as Ct}from"./chunk-3B2GY4UU.js";import{a as ft,b as ht}from"./chunk-HAYHNB7Q.js";import{b as W}from"./chunk-Z7JIVKEF.js";import{c as St}from"./chunk-U5I2YBJK.js";import{c as Ae}from"./chunk-KW4V2PJW.js";import{C as _t,j as Me,k as N,l as vr,m as gt,r as Mt}from"./chunk-LPIHKY3M.js";import{b as It,c as At}from"./chunk-5VLIBRPJ.js";import{$ as mt,N as ct,Q as dt,R as D,U as xe,V as te,Y as yt,b as E,d as ot,g as st,ga as g,ha as G,ia as O,n as it,p as Ee,q as lt,r as ut,s as pt,z as Tr}from"./chunk-XOSBJSTW.js";import{a as Cr}from"./chunk-GFQYFEEH.js";import{a,b as F,d as x,f as w,h as p}from"./chunk-7DYQUG5M.js";var $t=x((Ts,Ut)=>{p();Ut.exports=Ht;Ht.sync=Br;var Dt=F("fs");function Nr(e,t){var n=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var r=0;r<n.length;r++){var o=n[r].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}a(Nr,"checkPathExt");function Gt(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:Nr(t,n)}a(Gt,"checkStat");function Ht(e,t,n){Dt.stat(e,function(r,o){n(r,r?!1:Gt(o,e,t))})}a(Ht,"isexe");function Br(e,t){return Gt(Dt.statSync(e),e,t)}a(Br,"sync")});var qt=x((Rs,Wt)=>{p();Wt.exports=jt;jt.sync=kr;var Qt=F("fs");function jt(e,t,n){Qt.stat(e,function(r,o){n(r,r?!1:Jt(o,t))})}a(jt,"isexe");function kr(e,t){return Jt(Qt.statSync(e),t)}a(kr,"sync");function Jt(e,t){return e.isFile()&&Lr(e,t)}a(Jt,"checkStat");function Lr(e,t){var n=e.mode,r=e.uid,o=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),i=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),l=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),d=l|u,y=n&c||n&u&&o===i||n&l&&r===s||n&d&&s===0;return y}a(Lr,"checkMode")});var zt=x((Ns,Yt)=>{p();var Os=F("fs"),oe;process.platform==="win32"||global.TESTING_WINDOWS?oe=$t():oe=qt();Yt.exports=Te;Te.sync=Vr;function Te(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,o){Te(e,t||{},function(s,i){s?o(s):r(i)})})}oe(e,t||{},function(r,o){r&&(r.code==="EACCES"||t&&t.ignoreErrors)&&(r=null,o=!1),n(r,o)})}a(Te,"isexe");function Vr(e,t){try{return oe.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}a(Vr,"sync")});var rn=x((Ls,nn)=>{p();var $=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Kt=F("path"),Dr=$?";":":",Xt=zt(),Zt=a(e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),"getNotFoundError"),en=a((e,t)=>{let n=t.colon||Dr,r=e.match(/\//)||$&&e.match(/\\/)?[""]:[...$?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],o=$?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=$?o.split(n):[""];return $&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:r,pathExt:s,pathExtExe:o}},"getPathInfo"),tn=a((e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});let{pathEnv:r,pathExt:o,pathExtExe:s}=en(e,t),i=[],l=a(c=>new Promise((d,y)=>{if(c===r.length)return t.all&&i.length?d(i):y(Zt(e));let m=r[c],S=/^".*"$/.test(m)?m.slice(1,-1):m,f=Kt.join(S,e),h=!S&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;d(u(h,c,0))}),"step"),u=a((c,d,y)=>new Promise((m,S)=>{if(y===o.length)return m(l(d+1));let f=o[y];Xt(c+f,{pathExt:s},(h,b)=>{if(!h&&b)if(t.all)i.push(c+f);else return m(c+f);return m(u(c,d,y+1))})}),"subStep");return n?l(0).then(c=>n(null,c),n):l(0)},"which"),Gr=a((e,t)=>{t=t||{};let{pathEnv:n,pathExt:r,pathExtExe:o}=en(e,t),s=[];for(let i=0;i<n.length;i++){let l=n[i],u=/^".*"$/.test(l)?l.slice(1,-1):l,c=Kt.join(u,e),d=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let y=0;y<r.length;y++){let m=d+r[y];try{if(Xt.sync(m,{pathExt:o}))if(t.all)s.push(m);else return m}catch{}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw Zt(e)},"whichSync");nn.exports=tn;tn.sync=Gr});var on=x((Gs,ve)=>{"use strict";p();var an=a((e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"},"pathKey");ve.exports=an;ve.exports.default=an});var pn=x(($s,un)=>{"use strict";p();var sn=F("path"),Hr=rn(),Ur=on();function ln(e,t){let n=e.options.env||process.env,r=process.cwd(),o=e.options.cwd!=null,s=o&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch{}let i;try{i=Hr.sync(e.command,{path:n[Ur({env:n})],pathExt:t?sn.delimiter:void 0})}catch{}finally{s&&process.chdir(r)}return i&&(i=sn.resolve(o?e.options.cwd:"",i)),i}a(ln,"resolveCommandAttempt");function $r(e){return ln(e)||ln(e,!0)}a($r,"resolveCommand");un.exports=$r});var cn=x((Js,Re)=>{"use strict";p();var Fe=/([()\][%!^"`<>&|;, *?])/g;function Qr(e){return e=e.replace(Fe,"^$1"),e}a(Qr,"escapeCommand");function jr(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Fe,"^$1"),t&&(e=e.replace(Fe,"^$1")),e}a(jr,"escapeArgument");Re.exports.command=Qr;Re.exports.argument=jr});var yn=x((Ys,dn)=>{"use strict";p();dn.exports=/^#!(.*)/});var Sn=x((Ks,mn)=>{"use strict";p();var Jr=yn();mn.exports=(e="")=>{let t=e.match(Jr);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,"").split(" "),o=n.split("/").pop();return o==="env"?r:r?`${o} ${r}`:o}});var fn=x((Zs,gn)=>{"use strict";p();var we=F("fs"),Wr=Sn();function qr(e){let n=Buffer.alloc(150),r;try{r=we.openSync(e,"r"),we.readSync(r,n,0,150,0),we.closeSync(r)}catch{}return Wr(n.toString())}a(qr,"readShebang");gn.exports=qr});var xn=x((ni,En)=>{"use strict";p();var Yr=F("path"),hn=pn(),bn=cn(),zr=fn(),Kr=process.platform==="win32",Xr=/\.(?:com|exe)$/i,Zr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function ea(e){e.file=hn(e);let t=e.file&&zr(e.file);return t?(e.args.unshift(e.file),e.command=t,hn(e)):e.file}a(ea,"detectShebang");function ta(e){if(!Kr)return e;let t=ea(e),n=!Xr.test(t);if(e.options.forceShell||n){let r=Zr.test(t);e.command=Yr.normalize(e.command),e.command=bn.command(e.command),e.args=e.args.map(s=>bn.argument(s,r));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}a(ta,"parseNonShell");function na(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:ta(r)}a(na,"parse");En.exports=na});var An=x((oi,In)=>{"use strict";p();var Pe=process.platform==="win32";function Oe(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}a(Oe,"notFoundError");function ra(e,t){if(!Pe)return;let n=e.emit;e.emit=function(r,o){if(r==="exit"){let s=Mn(o,t,"spawn");if(s)return n.call(e,"error",s)}return n.apply(e,arguments)}}a(ra,"hookChildProcess");function Mn(e,t){return Pe&&e===1&&!t.file?Oe(t.original,"spawn"):null}a(Mn,"verifyENOENT");function aa(e,t){return Pe&&e===1&&!t.file?Oe(t.original,"spawnSync"):null}a(aa,"verifyENOENTSync");In.exports={hookChildProcess:ra,verifyENOENT:Mn,verifyENOENTSync:aa,notFoundError:Oe}});var Tn=x((li,Q)=>{"use strict";p();var _n=F("child_process"),Ne=xn(),Be=An();function Cn(e,t,n){let r=Ne(e,t,n),o=_n.spawn(r.command,r.args,r.options);return Be.hookChildProcess(o,r),o}a(Cn,"spawn");function oa(e,t,n){let r=Ne(e,t,n),o=_n.spawnSync(r.command,r.args,r.options);return o.error=o.error||Be.verifyENOENTSync(o.status,r),o}a(oa,"spawnSync");Q.exports=Cn;Q.exports.spawn=Cn;Q.exports.sync=oa;Q.exports._parse=Ne;Q.exports._enoent=Be});var Zn=x((zl,Xn)=>{"use strict";p();var{PassThrough:to}=F("stream");Xn.exports=function(){var e=[],t=new to({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=r,t.on("unpipe",o),Array.prototype.slice.call(arguments).forEach(n),t;function n(s){return Array.isArray(s)?(s.forEach(n),this):(e.push(s),s.once("end",o.bind(null,s)),s.once("error",t.emit.bind(t,"error")),s.pipe(t,{end:!1}),this)}a(n,"add");function r(){return e.length==0}a(r,"isEmpty");function o(s){e=e.filter(function(i){return i!==s}),!e.length&&t.readable&&t.end()}a(o,"remove")}});var fr=x(($u,gr)=>{p();function A(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}a(A,"RetryOperation");gr.exports=A;A.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};A.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};A.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0};A.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};A.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};A.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};A.prototype.start=A.prototype.try;A.prototype.errors=function(){return this._errors};A.prototype.attempts=function(){return this._attempts};A.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],s=o.message,i=(e[s]||0)+1;e[s]=i,i>=n&&(t=o,n=i)}return t}});var hr=x(L=>{p();var Co=fr();L.operation=function(e){var t=L.timeouts(e);return new Co(t,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};L.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],o=0;o<t.retries;o++)r.push(this.createTimeout(o,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(o,t)),r.sort(function(s,i){return s-i}),r};L.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout),r};L.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var r in e)typeof e[r]=="function"&&n.push(r)}for(var o=0;o<n.length;o++){var s=n[o],i=e[s];e[s]=a(function(u){var c=L.operation(t),d=Array.prototype.slice.call(arguments,1),y=d.pop();d.push(function(m){c.retry(m)||(m&&(arguments[0]=c.mainError()),y.apply(this,arguments))}),c.attempt(function(){u.apply(e,d)})},"retryWrapper").bind(e,i),e[s].options=t}}});var Er=x((Yu,br)=>{p();br.exports=hr()});p();var q=w(gt(),1);var re=class extends Map{static{a(this,"Changes")}created=D(()=>Array.from(this.entries()).filter(([,t])=>t.type==="create").map(([t])=>t));updated=D(()=>Array.from(this.entries()).filter(([,t])=>t.type==="update").map(([t])=>t));deleted=D(()=>Array.from(this.entries()).filter(([,t])=>t.type==="delete").map(([t])=>t))},Fr=E.greenBright("+"),Rr=E.blueBright("\xB1"),wr=E.redBright("-"),Tt=E.yellowBright("\u2192"),Y=a((e,{changes:t,tense:n,limit:r=1/0,...o})=>{yt.logLevel<=te.TRACE&&(r=1/0);let s=Array.from(t.entries()).filter(([m])=>!m.startsWith(".gadget/"));if(s.length===0)return"";let i=E.yellowBright(n==="past"?"renamed":"rename"),l=E.greenBright(n==="past"?"created":"create"),u=E.blueBright(n==="past"?"updated":"update"),c=E.redBright(n==="past"?"deleted":"delete"),d=s.sort((m,S)=>m[0].localeCompare(S[0])).slice(0,r).map(([m,S])=>{switch(!0){case(S.type==="create"&&st(S.oldPath)):return[Tt,E.yellowBright(S.oldPath),i,Tt,E.yellowBright(m)];case S.type==="create":return[Fr,E.greenBright(m),l];case S.type==="update":return[Rr,E.blueBright(m),u];case S.type==="delete":return[wr,E.redBright(m),c];default:return it(S)}});s.length>r&&d.push([E.gray(N.ellipsis),g`{gray ${s.length-r} more}`,""]);let y;if(s.length>=5){let m=[],S=s.filter(([,b])=>b.type==="create").length;if(S>0){let b=n==="past"?`${S} created`:(0,q.default)("create",S,!0);m.push(g`{greenBright ${b}}`)}let f=s.filter(([,b])=>b.type==="update").length;if(f>0){let b=n==="past"?`${f} updated`:(0,q.default)("update",f,!0);m.push(g`{blueBright ${b}}`)}let h=s.filter(([,b])=>b.type==="delete").length;if(h>0){let b=n==="past"?`${h} deleted`:(0,q.default)("delete",h,!0);m.push(g`{redBright ${b}}`)}y=G`
|
|
2
2
|
${(0,q.default)("change",s.length,!0)} in total. ${m.join(", ")}.
|
|
3
3
|
`}return ft({rows:d,footer:y,ensureEmptyLineAbove:!0,ensureEmptyLineAboveBody:!1,ensureEmptyLineAboveFooter:!0,indent:0,...o})},"sprintChanges"),ae=a((e,t)=>{let n=Y(e,t);n&&O(n)},"printChanges");p();var vt=g(`
|
|
4
4
|
subscription EnvironmentLogs($query: String!, $start: DateTime, $limit: Int) {
|
|
@@ -191,4 +191,4 @@ ${r.message}`:b,T=[M,t,e].filter(Boolean).join(`
|
|
|
191
191
|
|
|
192
192
|
{red Your app will not be operational until all fatal errors are fixed.}
|
|
193
193
|
`})}catch(c){throw Ie(c)?u.clear():u.fail(),c}}};export{re as a,Rr as b,wr as c,rn as d,Jo as e,Wo as f,qo as g,Yo as h,zo as i,Ko as j,B as k,Lt as l,Vt as m,Ms as n,Is as o,Ir as p};
|
|
194
|
-
//# sourceMappingURL=chunk-
|
|
194
|
+
//# sourceMappingURL=chunk-A75V6SNW.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{F as Z,a as X,c as V,s as J,t as Q}from"./chunk-
|
|
1
|
+
import{F as Z,a as X,c as V,s as J,t as Q}from"./chunk-LPIHKY3M.js";import{e as M}from"./chunk-5VLIBRPJ.js";import{M as B,O as q,P as w,Y as y,b as S,ba as x,e as g,ga as A,ha as R,ia as f}from"./chunk-XOSBJSTW.js";import{a as i,h as a}from"./chunk-7DYQUG5M.js";a();a();import he from"node:net";import we from"node:os";var I=class extends Error{static{i(this,"Locked")}constructor(t){super(`${t} is locked`)}},b={old:new Set,young:new Set},ye=1e3*15;var L,xe=i(()=>{let e=we.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let o of r)t.add(o.address);return t},"getLocalHosts"),ee=i(e=>new Promise((t,r)=>{let o=he.createServer();o.unref(),o.on("error",r),o.listen(e,()=>{let{port:n}=o.address();o.close(()=>{t(n)})})}),"checkAvailablePort"),te=i(async(e,t)=>{if(e.host||e.port===0)return ee(e);for(let r of t)try{await ee({port:e.port,host:r})}catch(o){if(!["EADDRNOTAVAIL","EINVAL"].includes(o.code))throw o}return e.port},"getAvailablePort"),be=i(function*(e){e&&(yield*e),yield 0},"portCheckSequence");async function O(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let n=e.exclude;if(typeof n[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let s of n){if(typeof s!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(s))throw new TypeError(`Number ${s} in the exclude option is not a safe integer and can't be used`)}r=new Set(n)}L===void 0&&(L=setTimeout(()=>{L=void 0,b.old=b.young,b.young=new Set},ye),L.unref&&L.unref());let o=xe();for(let n of be(t))try{if(r.has(n))continue;let s=await te({...e,port:n},o);for(;b.old.has(s)||b.young.has(s);){if(n!==0)throw new I(n);s=await te({...e,port:n},o)}return b.young.add(s),s}catch(s){if(!["EADDRINUSE","EACCES"].includes(s.code)&&!(s instanceof I))throw s}throw new Error("No available ports found")}i(O,"getPorts");import G from"node:assert";import Xe from"node:http";a();import N from"node:process";import{Buffer as ae}from"node:buffer";import ce from"node:path";import{fileURLToPath as Oe}from"node:url";import We from"node:util";import me from"node:child_process";import j,{constants as ue}from"node:fs/promises";a();function h(e,t,r){let o=i(n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0}),"define");return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let n=r();return o(n),n},set(n){o(n)}}),e}i(h,"defineLazyProperty");a();import{promisify as Ue}from"node:util";import _ from"node:process";import{execFile as Be}from"node:child_process";a();import{promisify as ve}from"node:util";import Pe from"node:process";import{execFile as Ee}from"node:child_process";var Se=ve(Ee);async function W(){if(Pe.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await Se("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari"}i(W,"defaultBrowserId");a();a();import Ae from"node:process";import{promisify as Le}from"node:util";import{execFile as Ce,execFileSync as dt}from"node:child_process";var Ie=Le(Ce);async function re(e,{humanReadableOutput:t=!0}={}){if(Ae.platform!=="darwin")throw new Error("macOS only");let r=t?[]:["-ss"],{stdout:o}=await Ie("osascript",["-e",e,r]);return o.trim()}i(re,"runAppleScript");async function H(e){return re(`tell application "Finder" to set app_path to application file id "${e}" as string
|
|
2
2
|
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}i(H,"bundleName");a();import{promisify as $e}from"node:util";import{execFile as Ne}from"node:child_process";var Te=$e(Ne),Fe={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},$=class extends Error{static{i(this,"UnknownBrowserError")}};async function k(e=Te){let{stdout:t}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!r)throw new $(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:o}=r.groups,n=Fe[o];if(!n)throw new $(`Unknown browser ID: ${o}`);return n}i(k,"defaultBrowser");var Re=Ue(Be),Me=i(e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,t=>t.toUpperCase()),"titleize");async function z(){if(_.platform==="darwin"){let e=await W();return{name:await H(e),id:e}}if(_.platform==="linux"){let{stdout:e}=await Re("xdg-mime",["query","default","x-scheme-handler/http"]),t=e.trim();return{name:Me(t.replace(/.desktop$/,"").replace("-"," ")),id:t}}if(_.platform==="win32")return k();throw new Error("Only macOS, Linux, and Windows are supported")}i(z,"defaultBrowser");var He=We.promisify(me.execFile),K=ce.dirname(Oe(import.meta.url)),oe=ce.join(K,"xdg-open"),{platform:v,arch:ne}=N,ke=(()=>{let e="/mnt/",t;return async function(){if(t)return t;let r="/etc/wsl.conf",o=!1;try{await j.access(r,ue.F_OK),o=!0}catch{}if(!o)return e;let n=await j.readFile(r,{encoding:"utf8"}),s=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(n);return s?(t=s.groups.mountPoint.trim(),t=t.endsWith("/")?t:`${t}/`,t):e}})(),le=i(async()=>`${await ke()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,"getPowershellPathFromWsl");async function _e(){let e=await le(),r=ae.from('(Get-ItemProperty -Path "HKCU:\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice").ProgId',"utf16le").toString("base64"),{stdout:o}=await He(e,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),n=o.trim(),s={ChromeHTML:"com.google.chrome",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return s[n]?{id:s[n]}:{}}i(_e,"getWindowsDefaultBrowserFromWsl");var ie=i(async(e,t)=>{let r;for(let o of e)try{return await t(o)}catch(n){r=n}throw r},"pTryEach"),T=i(async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return ie(e.app,c=>T({...e,app:c}));let{name:t,arguments:r=[]}=e.app??{};if(r=[...r],Array.isArray(t))return ie(t,c=>T({...e,app:{name:c,arguments:r}}));if(t==="browser"||t==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},u={chrome:"--incognito",firefox:"--private-window",edge:"--inPrivate"},l=w?await _e():await z();if(l.id in c){let p=c[l.id];return t==="browserPrivate"&&r.push(u[p]),T({...e,app:{name:P[p],arguments:r}})}throw new Error(`${l.name} is not supported as a default browser`)}let o,n=[],s={};if(v==="darwin")o="open",e.wait&&n.push("--wait-apps"),e.background&&n.push("--background"),e.newInstance&&n.push("--new"),t&&n.push("-a",t);else if(v==="win32"||w&&!q()&&!t){o=w?await le():`${N.env.SYSTEMROOT||N.env.windir||"C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell`,n.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),w||(s.windowsVerbatimArguments=!0);let c=["Start"];e.wait&&c.push("-Wait"),t?(c.push(`"\`"${t}\`""`),e.target&&r.push(e.target)):e.target&&c.push(`"${e.target}"`),r.length>0&&(r=r.map(u=>`"\`"${u}\`""`),c.push("-ArgumentList",r.join(","))),e.target=ae.from(c.join(" "),"utf16le").toString("base64")}else{if(t)o=t;else{let c=!K||K==="/",u=!1;try{await j.access(oe,ue.X_OK),u=!0}catch{}o=N.versions.electron??(v==="android"||c||!u)?"xdg-open":oe}r.length>0&&n.push(...r),e.wait||(s.stdio="ignore",s.detached=!0)}v==="darwin"&&r.length>0&&n.push("--args",...r),e.target&&n.push(e.target);let m=me.spawn(o,n,s);return e.wait?new Promise((c,u)=>{m.once("error",u),m.once("close",l=>{if(!e.allowNonzeroExitCode&&l>0){u(new Error(`Exited with code ${l}`));return}c(m)})}):(m.unref(),m)},"baseOpen"),ze=i((e,t)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return T({...t,target:e})},"open");function se(e){if(typeof e=="string"||Array.isArray(e))return e;let{[ne]:t}=e;if(!t)throw new Error(`${ne} is not supported`);return t}i(se,"detectArchBinary");function D({[v]:e},{wsl:t}){if(t&&w)return se(t);if(!e)throw new Error(`${v} is not supported`);return se(e)}i(D,"detectPlatformBinary");var P={};h(P,"chrome",()=>D({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));h(P,"firefox",()=>D({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));h(P,"edge",()=>D({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));h(P,"browser",()=>"browser");h(P,"browserPrivate",()=>"browserPrivate");var fe=ze;a();import Ye from"node:assert";a();import C from"node:process";a();import je from"node:assert";import Ke from"node:events";import d from"node:process";import de from"node:readline";var F=class e extends Ke{static{i(this,"Prompt")}static active=!1;value=void 0;firstRender=!0;done=!1;closed=!1;aborted=!1;exited=!1;close;constructor(){super(),je(!e.active,"only one prompt can be active at a time"),e.active=!0;let t=de.createInterface({input:d.stdin,escapeCodeTimeout:50});de.emitKeypressEvents(d.stdin,t),d.stdin.isTTY&&d.stdin.setRawMode(!0);let r=["SelectPrompt"].includes(this.constructor.name),o=i((n,s)=>{let m=De(s,r);m===!1?this._(n,s):m&&typeof this[m]=="function"?this[m](s):this.bell()},"keypress");this.close=()=>{d.stdin.removeListener("keypress",o),d.stdin.isTTY&&d.stdin.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0,e.active=!1},d.stdin.on("keypress",o)}_(t,r){}onRender(){}fire(){this.emit("state",{value:this.value,aborted:this.aborted,exited:this.exited})}bell(){x.writeStdout(X.beep)}render(){this.onRender(),this.firstRender&&(this.firstRender=!1)}},De=i((e,t)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl)switch(e.name){case"a":return"first";case"c":case"d":return"abort";case"e":return"last";case"g":return"reset"}if(t){if(e.name==="j")return"down";if(e.name==="k")return"up"}switch(e.name){case"return":case"enter":return"submit";case"backspace":return"delete";case"delete":return"deleteForward";case"abort":return"abort";case"escape":return"exit";case"tab":return"next";case"pagedown":return"nextPage";case"pageup":return"prevPage";case"home":return"home";case"end":return"end";case"up":return"up";case"down":return"down";case"right":return"right";case"left":return"left";default:return!1}}},"getPromptAction"),tr=i((e,t,r)=>{r=r||t;let o=Math.min(t-r,e-Math.floor(r/2));o<0&&(o=0);let n=Math.min(o+r,t);return{startIndex:o,endIndex:n}},"entriesToDisplay");var pe=i(e=>{let t;if(typeof e=="string"?t={content:e}:t=e,t=B(t,{ensureEmptyLineAbove:!0,ensureNewLine:!0,exitWhenNo:!0}),!x.isInteractive){let r=t.whenNotInteractive??(()=>{f(t),f({ensureEmptyLineAbove:!0,content:"Aborting because ggt is not running in an interactive terminal."}),C.exit(1)});return Promise.resolve(r())}return new Promise(r=>{let o=new Y(t);o.on("submit",r),o.on("exit",()=>C.exit(0)),o.on("abort",()=>C.exit(1))})},"confirm"),Y=class extends F{static{i(this,"Confirm")}value=void 0;defaultValue=!1;options;constructor(t){super(),this.options=B(t,{exitWhenNo:!0,ensureEmptyLineAbove:!0}),this.render()}reset(){this.value=this.defaultValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=!1,this.done=this.aborted=!0,this.fire(),this.render(!1),this.close(),this.options.exitWhenNo&&C.exit(0)}submit(){this.value=this.value??!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.close(),this.options.exitWhenNo&&!this.value&&C.exit(0)}_(t,r){if(t.toLowerCase()==="y"){this.value=!0,this.submit();return}if(t.toLowerCase()==="n"){this.value=!1,this.submit();return}this.bell()}render(t=this.value){if(super.render(),this.done){x.persistPrompt(R({...this.options,content:`${this.options.content} ${t?S.bold.greenBright("Yes."):S.bold.redBright("No.")}`}));return}x.updatePrompt(R({...this.options,content:`${this.options.content} ${this.defaultValue?S.blueBright("[Y/n] "):S.blueBright("[y/N] ")}`}))}};var Ge=g.object({id:g.union([g.string(),g.number()]).transform(Number),name:g.string().nullish(),email:g.string()}),U=i(async e=>{let t=J(e);if(t)try{let r=await Z({context:{ctx:e},url:`https://${y.domains.services}/auth/api/current-user`,headers:t,responseType:"json",resolveBodyOnly:!0}),o=Ge.parse(r);return e.log.info("loaded user",{user:{id:o.id}},{user:o}),V(o),o}catch(r){Q(e,r);return}},"getUser"),Sr=i(async(e,t)=>{let r=await U(e);return r||(e.log.info("prompting user to log in"),f({ensureEmptyLineAbove:!0,content:`You must be logged in to use "ggt ${t}".`}),await pe({ensureEmptyLineAbove:!0,content:"Would you like to log in?"}),await ge(e,{_:[]}),r=await U(e),Ye(r,"missing user after successful login"),r)},"getUserOrLogin");var Or=i(()=>A`
|
|
3
3
|
Log in to your account.
|
|
4
4
|
|
|
@@ -15,4 +15,4 @@ tell application "System Events" to get value of property list item "CFBundleNam
|
|
|
15
15
|
|
|
16
16
|
Once logged in, return to this terminal.
|
|
17
17
|
`})}await o}finally{t?.close()}},"run"),ge=qe;export{F as a,tr as b,pe as c,fe as d,Or as e,qe as f,ge as g,U as h,Sr as i};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-KW4V2PJW.js.map
|
|
@@ -28,7 +28,7 @@ import{d as pn,e as mn,f as gn}from"./chunk-5VLIBRPJ.js";import{J as We,K as un,
|
|
|
28
28
|
context: { ctx },
|
|
29
29
|
...options,
|
|
30
30
|
});
|
|
31
|
-
`)),e.context.ctx),"getContext"),At=cn.extend({agent:{http:new Zo({keepAlive:!0}),https:new Xo({keepAlive:!0})},retry:{limit:10,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN","EADDRNOTAVAIL","EHOSTUNREACH"],maxRetryAfter:void 0,calculateDelay:o(({computedValue:e})=>e,"calculateDelay"),backoffLimit:(0,xi.default)("5s"),noise:100},hooks:{beforeRequest:[e=>{let t=Or(e);e.signal=t.signal,e.headers["user-agent"]=F.versionFull,t.log.debug("http request",{http:{request:{method:e.method,url:e.url?.toString()}}})}],beforeRetry:[(e,t)=>{Or(e.request?.options??e.options.context).log.warn("http request failed, retrying...",{http:{retryCount:t,error:ce(e),request:e.request&&{method:e.request.options.method,url:e.request.options.url?.toString()},response:e.response&&{statusCode:e.response.statusCode,traceId:e.response.headers["x-trace-id"],durationMs:e.response.timings.phases.total}}})}],afterResponse:[e=>{let t=Or(e.request.options);return t.log.debug("http response",{http:{request:{method:e.request.options.method,url:e.request.options.url?.toString()},response:{statusCode:e.statusCode,traceId:e.headers["x-trace-id"],durationMs:e.timings.phases.total}}}),e.statusCode===401&&Wn(e.request.options)&&mn(t,void 0),e}]}});h();import Ll from"node:assert";h();h();h();h();function ie(e){return e===null?"null":Array.isArray(e)?"array":typeof e}o(ie,"extendedTypeof");function Te(e){return ie(e)==="object"}o(Te,"isObject");function vi(e){return Array.isArray(e)&&e.length>0&&e.every(t=>"message"in t)}o(vi,"areGraphQLErrors");function Lr(e,t){return e.length<124?e:t}o(Lr,"limitCloseReason");var wi="graphql-transport-ws";var le;(function(e){e[e.InternalServerError=4500]="InternalServerError",e[e.InternalClientError=4005]="InternalClientError",e[e.BadRequest=4400]="BadRequest",e[e.BadResponse=4004]="BadResponse",e[e.Unauthorized=4401]="Unauthorized",e[e.Forbidden=4403]="Forbidden",e[e.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",e[e.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",e[e.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",e[e.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",e[e.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(le||(le={}));var Q;(function(e){e.ConnectionInit="connection_init",e.ConnectionAck="connection_ack",e.Ping="ping",e.Pong="pong",e.Subscribe="subscribe",e.Next="next",e.Error="error",e.Complete="complete"})(Q||(Q={}));function Ei(e){if(!Te(e))throw new Error(`Message is expected to be an object, but got ${ie(e)}`);if(!e.type)throw new Error("Message is missing the 'type' property");if(typeof e.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${ie(e.type)}`);switch(e.type){case Q.ConnectionInit:case Q.ConnectionAck:case Q.Ping:case Q.Pong:{if(e.payload!=null&&!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case Q.Subscribe:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ie(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${ie(e.payload)}`);if(typeof e.payload.query!="string")throw new Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${ie(e.payload.query)}`);if(e.payload.variables!=null&&!Te(e.payload.variables))throw new Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${ie(e.payload.variables)}`);if(e.payload.operationName!=null&&ie(e.payload.operationName)!=="string")throw new Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${ie(e.payload.operationName)}`);if(e.payload.extensions!=null&&!Te(e.payload.extensions))throw new Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${ie(e.payload.extensions)}`);break}case Q.Next:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ie(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${ie(e.payload)}`);break}case Q.Error:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ie(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!vi(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case Q.Complete:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ie(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${e.type}"`)}return e}o(Ei,"validateMessage");function Si(e,t){return Ei(typeof e=="string"?JSON.parse(e,t):e)}o(Si,"parseMessage");function Ye(e,t){return Ei(e),JSON.stringify(e,t)}o(Ye,"stringifyMessage");var Je=function(e){return this instanceof Je?(this.v=e,this):new Je(e)},ea=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(c){return function(m){return Promise.resolve(m).then(c,d)}}function u(c,m){n[c]&&(i[c]=function(w){return new Promise(function(T,B){s.push([c,w,T,B])>1||l(c,w)})},m&&(i[c]=m(i[c])))}function l(c,m){try{f(n[c](m))}catch(w){b(s[0][3],w)}}function f(c){c.value instanceof Je?Promise.resolve(c.value.v).then(p,d):b(s[0][2],c)}function p(c){l("next",c)}function d(c){l("throw",c)}function b(c,m){c(m),s.shift(),s.length&&l(s[0][0],s[0][1])}};function Ti(e){let{url:t,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:a=0,disablePong:u,connectionAckWaitTimeout:l=0,retryAttempts:f=5,retryWait:p=o(async function(g){let _=1e3;for(let x=0;x<g;x++)_*=2;await new Promise(x=>setTimeout(x,_+Math.floor(Math.random()*2700+300)))},"randomisedExponentialBackoff"),shouldRetry:d=kr,isFatalConnectionProblem:b,on:c,webSocketImpl:m,generateID:w=o(function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,g=>{let _=Math.random()*16|0;return(g=="x"?_:_&3|8).toString(16)})},"generateUUID"),jsonMessageReplacer:T,jsonMessageReviver:B}=e,P;if(m){if(!ra(m))throw new Error("Invalid WebSocket implementation provided");P=m}else typeof WebSocket<"u"?P=WebSocket:typeof global<"u"?P=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(P=window.WebSocket||window.MozWebSocket);if(!P)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let Y=P,k=(()=>{let y=(()=>{let _={};return{on(x,S){return _[x]=S,()=>{delete _[x]}},emit(x){var S;"id"in x&&((S=_[x.id])===null||S===void 0||S.call(_,x))}}})(),g={connecting:c?.connecting?[c.connecting]:[],opened:c?.opened?[c.opened]:[],connected:c?.connected?[c.connected]:[],ping:c?.ping?[c.ping]:[],pong:c?.pong?[c.pong]:[],message:c?.message?[y.emit,c.message]:[y.emit],closed:c?.closed?[c.closed]:[],error:c?.error?[c.error]:[]};return{onMessage:y.on,on(_,x){let S=g[_];return S.push(x),()=>{S.splice(S.indexOf(x),1)}},emit(_,...x){for(let S of[...g[_]])S(...x)}}})();function z(y){let g=[k.on("error",_=>{g.forEach(x=>x()),y(_)}),k.on("closed",_=>{g.forEach(x=>x()),y(_)})]}o(z,"errorOrClosed");let J,V=0,N,C=!1,te=0,rt=!1;async function O(){clearTimeout(N);let[y,g]=await(J??(J=new Promise((S,D)=>(async()=>{if(C){if(await p(te),!V)return J=void 0,D({code:1e3,reason:"All Subscriptions Gone"});te++}k.emit("connecting",C);let L=new Y(typeof t=="function"?await t():t,wi),U,K;function pe(){isFinite(a)&&a>0&&(clearTimeout(K),K=setTimeout(()=>{L.readyState===Y.OPEN&&(L.send(Ye({type:Q.Ping})),k.emit("ping",!1,void 0))},a))}o(pe,"enqueuePing"),z(H=>{J=void 0,clearTimeout(U),clearTimeout(K),D(H),H instanceof Nt&&(L.close(4499,"Terminated"),L.onerror=null,L.onclose=null)}),L.onerror=H=>k.emit("error",H),L.onclose=H=>k.emit("closed",H),L.onopen=async()=>{try{k.emit("opened",L);let H=typeof r=="function"?await r():r;if(L.readyState!==Y.OPEN)return;L.send(Ye(H?{type:Q.ConnectionInit,payload:H}:{type:Q.ConnectionInit},T)),isFinite(l)&&l>0&&(U=setTimeout(()=>{L.close(le.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),pe()}catch(H){k.emit("error",H),L.close(le.InternalClientError,Lr(H instanceof Error?H.message:new Error(H).message,"Internal client error"))}};let oe=!1;L.onmessage=({data:H})=>{try{let q=Si(H,B);if(k.emit("message",q),q.type==="ping"||q.type==="pong"){k.emit(q.type,!0,q.payload),q.type==="pong"?pe():u||(L.send(Ye(q.payload?{type:Q.Pong,payload:q.payload}:{type:Q.Pong})),k.emit("pong",!1,q.payload));return}if(oe)return;if(q.type!==Q.ConnectionAck)throw new Error(`First message cannot be of type ${q.type}`);clearTimeout(U),oe=!0,k.emit("connected",L,q.payload,C),C=!1,te=0,S([L,new Promise((re,_e)=>z(_e))])}catch(q){L.onmessage=null,k.emit("error",q),L.close(le.BadResponse,Lr(q instanceof Error?q.message:new Error(q).message,"Bad response"))}}})())));y.readyState===Y.CLOSING&&await g;let _=o(()=>{},"release"),x=new Promise(S=>_=S);return[y,_,Promise.race([x.then(()=>{if(!V){let S=o(()=>y.close(1e3,"Normal Closure"),"complete");isFinite(s)&&s>0?N=setTimeout(()=>{y.readyState===Y.OPEN&&S()},s):S()}}),g])]}o(O,"connect");function E(y){if(kr(y)&&(ta(y.code)||[le.InternalServerError,le.InternalClientError,le.BadRequest,le.BadResponse,le.Unauthorized,le.SubprotocolNotAcceptable,le.SubscriberAlreadyExists,le.TooManyInitialisationRequests].includes(y.code)))throw y;if(rt)return!1;if(kr(y)&&y.code===1e3)return V>0;if(!f||te>=f||!d(y)||b?.(y))throw y;return C=!0}o(E,"shouldRetryConnectOrThrow"),n||(async()=>{for(V++;;)try{let[,,y]=await O();await y}catch(y){try{if(!E(y))return}catch(g){return i?.(g)}}})();function v(y,g){let _=w(y),x=!1,S=!1,D=o(()=>{V--,x=!0},"releaser");return(async()=>{for(V++;;)try{let[L,U,K]=await O();if(x)return U();let pe=k.onMessage(_,oe=>{switch(oe.type){case Q.Next:{g.next(oe.payload);return}case Q.Error:{S=!0,x=!0,g.error(oe.payload),D();return}case Q.Complete:{x=!0,D();return}}});L.send(Ye({id:_,type:Q.Subscribe,payload:y},T)),D=o(()=>{!x&&L.readyState===Y.OPEN&&L.send(Ye({id:_,type:Q.Complete},T)),V--,x=!0,U()},"releaser"),await K.finally(pe);return}catch(L){if(!E(L))return}})().then(()=>{S||g.complete()}).catch(L=>{g.error(L)}),()=>{x||D()}}return o(v,"subscribe"),{on:k.on,subscribe:v,iterate(y){let g=[],_={done:!1,error:null,resolve:o(()=>{},"resolve")},x=v(y,{next(D){g.push(D),_.resolve()},error(D){_.done=!0,_.error=D,_.resolve()},complete(){_.done=!0,_.resolve()}}),S=o(function(){return ea(this,arguments,o(function*(){for(;;){for(g.length||(yield Je(new Promise(U=>_.resolve=U)));g.length;)yield yield Je(g.shift());if(_.error)throw _.error;if(_.done)return yield Je(void 0)}},"iterator_1"))},"iterator")();return S.throw=async D=>(_.done||(_.done=!0,_.error=D,_.resolve()),{done:!0,value:void 0}),S.return=async()=>(x(),{done:!0,value:void 0}),S},async dispose(){if(rt=!0,J){let[y]=await J;y.close(1e3,"Normal Closure")}},terminate(){J&&k.emit("closed",new Nt)}}}o(Ti,"createClient");var Nt=class extends Error{static{o(this,"TerminatedCloseEvent")}constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}};function kr(e){return Te(e)&&"code"in e&&"reason"in e}o(kr,"isLikeCloseEvent");function ta(e){return[1e3,1001,1006,1005,1012,1013,1014].includes(e)?!1:e>=1e3&&e<=1999}o(ta,"isFatalInternalCloseCode");function ra(e){return typeof e=="function"&&"constructor"in e&&"CLOSED"in e&&"CLOSING"in e&&"CONNECTING"in e&&"OPEN"in e}o(ra,"isWebSocket");var Is=ne(Ot(),1);h();h();var Rr=ne(Li(),1);h();var ht=class extends Error{static{o(this,"TimeoutError")}constructor(t){super(t),this.name="TimeoutError"}},Br=class extends Error{static{o(this,"AbortError")}constructor(t){super(),this.name="AbortError",this.message=t}},ki=o(e=>globalThis.DOMException===void 0?new Br(e):new DOMException(e),"getDOMException"),Ci=o(e=>{let t=e.reason===void 0?ki("This operation was aborted."):e.reason;return t instanceof Error?t:ki(t)},"getAbortedReason");function Dr(e,t){let{milliseconds:r,fallback:n,message:i,customTimers:s={setTimeout,clearTimeout}}=t,a,u,f=new Promise((p,d)=>{if(typeof r!="number"||Math.sign(r)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);if(t.signal){let{signal:c}=t;c.aborted&&d(Ci(c)),u=o(()=>{d(Ci(c))},"abortHandler"),c.addEventListener("abort",u,{once:!0})}if(r===Number.POSITIVE_INFINITY){e.then(p,d);return}let b=new ht;a=s.setTimeout.call(void 0,()=>{if(n){try{p(n())}catch(c){d(c)}return}typeof e.cancel=="function"&&e.cancel(),i===!1?p():i instanceof Error?d(i):(b.message=i??`Promise timed out after ${r} milliseconds`,d(b))},r),(async()=>{try{p(await e)}catch(c){d(c)}})()}).finally(()=>{f.clear(),u&&t.signal&&t.signal.removeEventListener("abort",u)});return f.clear=()=>{s.clearTimeout.call(void 0,a),a=void 0},f}o(Dr,"pTimeout");h();h();function $r(e,t,r){let n=0,i=e.length;for(;i>0;){let s=Math.trunc(i/2),a=n+s;r(e[a],t)<=0?(n=++a,i-=s+1):i=s}return n}o($r,"lowerBound");var dt=class{static{o(this,"PriorityQueue")}#e=[];enqueue(t,r){r={priority:0,...r};let n={priority:r.priority,id:r.id,run:t};if(this.size===0||this.#e[this.size-1].priority>=r.priority){this.#e.push(n);return}let i=$r(this.#e,n,(s,a)=>a.priority-s.priority);this.#e.splice(i,0,n)}setPriority(t,r){let n=this.#e.findIndex(s=>s.id===t);if(n===-1)throw new ReferenceError(`No promise function with the id "${t}" exists in the queue.`);let[i]=this.#e.splice(n,1);this.enqueue(i.run,{priority:r,id:t})}dequeue(){return this.#e.shift()?.run}filter(t){return this.#e.filter(r=>r.priority===t.priority).map(r=>r.run)}get size(){return this.#e.length}};var pt=class extends Rr.default{static{o(this,"PQueue")}#e;#i;#o=0;#d;#a;#p=0;#r;#l;#t;#m;#n=0;#c;#s;#g;#_=1n;timeout;constructor(t){if(super(),t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:dt,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${t.intervalCap?.toString()??""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${t.interval?.toString()??""}\` (${typeof t.interval})`);this.#e=t.carryoverConcurrencyCount,this.#i=t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0,this.#d=t.intervalCap,this.#a=t.interval,this.#t=new t.queueClass,this.#m=t.queueClass,this.concurrency=t.concurrency,this.timeout=t.timeout,this.#g=t.throwOnTimeout===!0,this.#s=t.autoStart===!1}get#x(){return this.#i||this.#o<this.#d}get#v(){return this.#n<this.#c}#w(){this.#n--,this.#u(),this.emit("next")}#E(){this.#b(),this.#y(),this.#l=void 0}get#S(){let t=Date.now();if(this.#r===void 0){let r=this.#p-t;if(r<0)this.#o=this.#e?this.#n:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#E()},r)),!0}return!1}#u(){if(this.#t.size===0)return this.#r&&clearInterval(this.#r),this.#r=void 0,this.emit("empty"),this.#n===0&&this.emit("idle"),!1;if(!this.#s){let t=!this.#S;if(this.#x&&this.#v){let r=this.#t.dequeue();return r?(this.emit("active"),r(),t&&this.#y(),!0):!1}}return!1}#y(){this.#i||this.#r!==void 0||(this.#r=setInterval(()=>{this.#b()},this.#a),this.#p=Date.now()+this.#a)}#b(){this.#o===0&&this.#n===0&&this.#r&&(clearInterval(this.#r),this.#r=void 0),this.#o=this.#e?this.#n:0,this.#f()}#f(){for(;this.#u(););}get concurrency(){return this.#c}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this.#c=t,this.#f()}async#T(t){return new Promise((r,n)=>{t.addEventListener("abort",()=>{n(t.reason)},{once:!0})})}setPriority(t,r){this.#t.setPriority(t,r)}async add(t,r={}){return r.id??=(this.#_++).toString(),r={timeout:this.timeout,throwOnTimeout:this.#g,...r},new Promise((n,i)=>{this.#t.enqueue(async()=>{this.#n++,this.#o++;try{r.signal?.throwIfAborted();let s=t({signal:r.signal});r.timeout&&(s=Dr(Promise.resolve(s),{milliseconds:r.timeout})),r.signal&&(s=Promise.race([s,this.#T(r.signal)]));let a=await s;n(a),this.emit("completed",a)}catch(s){if(s instanceof ht&&!r.throwOnTimeout){n();return}i(s),this.emit("error",s)}finally{this.#w()}},r),this.emit("add"),this.#u()})}async addAll(t,r){return Promise.all(t.map(async n=>this.add(n,r)))}start(){return this.#s?(this.#s=!1,this.#f(),this):this}pause(){this.#s=!0}clear(){this.#t=new this.#m}async onEmpty(){this.#t.size!==0&&await this.#h("empty")}async onSizeLessThan(t){this.#t.size<t||await this.#h("next",()=>this.#t.size<t)}async onIdle(){this.#n===0&&this.#t.size===0||await this.#h("idle")}async#h(t,r){return new Promise(n=>{let i=o(()=>{r&&!r()||(this.off(t,i),n())},"listener");this.on(t,i)})}get size(){return this.#t.size}sizeBy(t){return this.#t.filter(t).length}get pending(){return this.#n}get isPaused(){return this.#s}};h();var El=ne($i(),1),Sl=ne(Wr(),1),Tl=ne(Hr(),1),As=ne(en(),1),Ol=ne($s(),1);var Ns=As.default;var Jt=class{constructor(t,r,n){this.environment=r;this.endpoint=n;this.ctx=t.child({name:"client"}),this._graphqlWsClient=Ti({url:`wss://${r.application.slug}.${F.domains.app}/edit/api/graphql-ws`,keepAlive:(0,Is.default)("10s"),shouldRetry:o(()=>!0,"shouldRetry"),connectionParams:{environment:r.name},webSocketImpl:class extends Ns{static{o(this,"webSocketImpl")}constructor(i,s,a){super(i,s,{signal:t.signal,...a,headers:{...a?.headers,"user-agent":F.versionFull,..._r(t)}})}},on:{opened:o(()=>{this.ctx.log.trace("opened")},"opened"),ping:o(i=>{this.ctx.log.trace("ping",{received:i})},"ping"),pong:o(i=>{this.ctx.log.trace("pong",{received:i})},"pong"),connecting:o(()=>{switch(this.status){case 1:this.status=2,this.ctx.log.info("reconnecting");break;case 2:this.ctx.log.info("retrying");break;default:this.ctx.log.debug("connecting");break}},"connecting"),connected:o(()=>{this.status===2?this.ctx.log.info("reconnected"):this.ctx.log.debug("connected"),setImmediate(()=>this.status=0)},"connected"),closed:o(()=>{this.status=1,this.ctx.log.debug("disconnected")},"closed"),error:o(i=>{this.status===2?this.ctx.log.error("failed to reconnect",{error:i}):this.ctx.log.error("connection error",{error:i})},"error")}})}static{o(this,"Client")}status=0;ctx;_graphqlWsClient;subscribe(t,{subscription:r,variables:n,onResponse:i,onError:s,onComplete:a=fn}){let u={query:r,variables:ae(n)},l=this._graphqlWsClient.on("connected",()=>{this.status===2&&(u.variables=ae(n),t.log.info("re-subscribing to graphql subscription"))}),f=new pt({concurrency:1}),p=o(b=>s(new Be(r,b)),"onError"),d=this._graphqlWsClient.subscribe(u,{next:o(b=>void f.add(()=>i(b)).catch(p),"next"),error:o(b=>void f.add(()=>p(b)),"error"),complete:o(()=>void f.add(()=>a()).catch(p),"complete")});return()=>{t.log.trace("unsubscribing from graphql subscription"),l(),f.clear(),d()}}async execute(t,r){let n=this.environment.application.slug;this.environment.application.multiEnvironmentEnabled?this.environment.type!=="production"&&(n+=`--${this.environment.name}`):this.environment.application.hasSplitEnvironments&&(n+="--development");try{let i=await At({context:{ctx:t},method:"POST",url:`https://${n}.${F.domains.app}${this.endpoint}`,headers:{..._r(t),"x-gadget-environment":this.environment.name},json:{query:r.operation,variables:ae(r.variables)},responseType:"json",resolveBodyOnly:!0,throwHttpErrors:!1,...r.http});if(!je(i)||!("data"in i)&&!("errors"in i))throw t.log.error("received invalid graphql response",{error:i}),i;return i}catch(i){throw new Be(r.operation,i)}}async dispose(){await this._graphqlWsClient.dispose()}};var St=class{static{o(this,"Api")}ctx;#e;constructor(t,r){this.ctx=t.child({name:"api"}),this.#e=new Jt(this.ctx,r,"/api/graphql")}async query({query:t,variables:r,...n}){let i=/query (\w+)/.exec(t)?.[1];Ll(i,"query name not found");let s=this.ctx.child({name:"api",fields:{edit:{query:i}},devFields:{edit:{query:i,variables:ae(r)}}});s.log.info("executing graphql query");let a=await this.#e.execute(s,{operation:t,variables:r,...n,http:{retry:{methods:["POST"]},...n.http}});if(a.errors)throw new Be(t,a.errors);if(!a.data)throw new Be(t,"Query response did not contain data");return a.data}async dispose(){await this.#e.dispose()}};h();var Ps=xe(`
|
|
31
|
+
`)),e.context.ctx),"getContext"),At=cn.extend({agent:{http:new Zo({keepAlive:!0}),https:new Xo({keepAlive:!0,minVersion:"TLSv1.1"})},retry:{limit:10,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN","EADDRNOTAVAIL","EHOSTUNREACH"],maxRetryAfter:void 0,calculateDelay:o(({computedValue:e})=>e,"calculateDelay"),backoffLimit:(0,xi.default)("5s"),noise:100},hooks:{beforeRequest:[e=>{let t=Or(e);e.signal=t.signal,e.headers["user-agent"]=F.versionFull,t.log.debug("http request",{http:{request:{method:e.method,url:e.url?.toString()}}})}],beforeRetry:[(e,t)=>{Or(e.request?.options??e.options.context).log.warn("http request failed, retrying...",{http:{retryCount:t,error:ce(e),request:e.request&&{method:e.request.options.method,url:e.request.options.url?.toString()},response:e.response&&{statusCode:e.response.statusCode,traceId:e.response.headers["x-trace-id"],durationMs:e.response.timings.phases.total}}})}],afterResponse:[e=>{let t=Or(e.request.options);return t.log.debug("http response",{http:{request:{method:e.request.options.method,url:e.request.options.url?.toString()},response:{statusCode:e.statusCode,traceId:e.headers["x-trace-id"],durationMs:e.timings.phases.total}}}),e.statusCode===401&&Wn(e.request.options)&&mn(t,void 0),e}]}});h();import Ll from"node:assert";h();h();h();h();function ie(e){return e===null?"null":Array.isArray(e)?"array":typeof e}o(ie,"extendedTypeof");function Te(e){return ie(e)==="object"}o(Te,"isObject");function vi(e){return Array.isArray(e)&&e.length>0&&e.every(t=>"message"in t)}o(vi,"areGraphQLErrors");function Lr(e,t){return e.length<124?e:t}o(Lr,"limitCloseReason");var wi="graphql-transport-ws";var le;(function(e){e[e.InternalServerError=4500]="InternalServerError",e[e.InternalClientError=4005]="InternalClientError",e[e.BadRequest=4400]="BadRequest",e[e.BadResponse=4004]="BadResponse",e[e.Unauthorized=4401]="Unauthorized",e[e.Forbidden=4403]="Forbidden",e[e.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",e[e.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",e[e.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",e[e.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",e[e.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(le||(le={}));var Q;(function(e){e.ConnectionInit="connection_init",e.ConnectionAck="connection_ack",e.Ping="ping",e.Pong="pong",e.Subscribe="subscribe",e.Next="next",e.Error="error",e.Complete="complete"})(Q||(Q={}));function Ei(e){if(!Te(e))throw new Error(`Message is expected to be an object, but got ${ie(e)}`);if(!e.type)throw new Error("Message is missing the 'type' property");if(typeof e.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${ie(e.type)}`);switch(e.type){case Q.ConnectionInit:case Q.ConnectionAck:case Q.Ping:case Q.Pong:{if(e.payload!=null&&!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case Q.Subscribe:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ie(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${ie(e.payload)}`);if(typeof e.payload.query!="string")throw new Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${ie(e.payload.query)}`);if(e.payload.variables!=null&&!Te(e.payload.variables))throw new Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${ie(e.payload.variables)}`);if(e.payload.operationName!=null&&ie(e.payload.operationName)!=="string")throw new Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${ie(e.payload.operationName)}`);if(e.payload.extensions!=null&&!Te(e.payload.extensions))throw new Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${ie(e.payload.extensions)}`);break}case Q.Next:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ie(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${ie(e.payload)}`);break}case Q.Error:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ie(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!vi(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case Q.Complete:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ie(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${e.type}"`)}return e}o(Ei,"validateMessage");function Si(e,t){return Ei(typeof e=="string"?JSON.parse(e,t):e)}o(Si,"parseMessage");function Ye(e,t){return Ei(e),JSON.stringify(e,t)}o(Ye,"stringifyMessage");var Je=function(e){return this instanceof Je?(this.v=e,this):new Je(e)},ea=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(c){return function(m){return Promise.resolve(m).then(c,d)}}function u(c,m){n[c]&&(i[c]=function(w){return new Promise(function(T,B){s.push([c,w,T,B])>1||l(c,w)})},m&&(i[c]=m(i[c])))}function l(c,m){try{f(n[c](m))}catch(w){b(s[0][3],w)}}function f(c){c.value instanceof Je?Promise.resolve(c.value.v).then(p,d):b(s[0][2],c)}function p(c){l("next",c)}function d(c){l("throw",c)}function b(c,m){c(m),s.shift(),s.length&&l(s[0][0],s[0][1])}};function Ti(e){let{url:t,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:a=0,disablePong:u,connectionAckWaitTimeout:l=0,retryAttempts:f=5,retryWait:p=o(async function(g){let _=1e3;for(let x=0;x<g;x++)_*=2;await new Promise(x=>setTimeout(x,_+Math.floor(Math.random()*2700+300)))},"randomisedExponentialBackoff"),shouldRetry:d=kr,isFatalConnectionProblem:b,on:c,webSocketImpl:m,generateID:w=o(function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,g=>{let _=Math.random()*16|0;return(g=="x"?_:_&3|8).toString(16)})},"generateUUID"),jsonMessageReplacer:T,jsonMessageReviver:B}=e,P;if(m){if(!ra(m))throw new Error("Invalid WebSocket implementation provided");P=m}else typeof WebSocket<"u"?P=WebSocket:typeof global<"u"?P=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(P=window.WebSocket||window.MozWebSocket);if(!P)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let Y=P,k=(()=>{let y=(()=>{let _={};return{on(x,S){return _[x]=S,()=>{delete _[x]}},emit(x){var S;"id"in x&&((S=_[x.id])===null||S===void 0||S.call(_,x))}}})(),g={connecting:c?.connecting?[c.connecting]:[],opened:c?.opened?[c.opened]:[],connected:c?.connected?[c.connected]:[],ping:c?.ping?[c.ping]:[],pong:c?.pong?[c.pong]:[],message:c?.message?[y.emit,c.message]:[y.emit],closed:c?.closed?[c.closed]:[],error:c?.error?[c.error]:[]};return{onMessage:y.on,on(_,x){let S=g[_];return S.push(x),()=>{S.splice(S.indexOf(x),1)}},emit(_,...x){for(let S of[...g[_]])S(...x)}}})();function z(y){let g=[k.on("error",_=>{g.forEach(x=>x()),y(_)}),k.on("closed",_=>{g.forEach(x=>x()),y(_)})]}o(z,"errorOrClosed");let J,V=0,N,C=!1,te=0,rt=!1;async function O(){clearTimeout(N);let[y,g]=await(J??(J=new Promise((S,D)=>(async()=>{if(C){if(await p(te),!V)return J=void 0,D({code:1e3,reason:"All Subscriptions Gone"});te++}k.emit("connecting",C);let L=new Y(typeof t=="function"?await t():t,wi),U,K;function pe(){isFinite(a)&&a>0&&(clearTimeout(K),K=setTimeout(()=>{L.readyState===Y.OPEN&&(L.send(Ye({type:Q.Ping})),k.emit("ping",!1,void 0))},a))}o(pe,"enqueuePing"),z(H=>{J=void 0,clearTimeout(U),clearTimeout(K),D(H),H instanceof Nt&&(L.close(4499,"Terminated"),L.onerror=null,L.onclose=null)}),L.onerror=H=>k.emit("error",H),L.onclose=H=>k.emit("closed",H),L.onopen=async()=>{try{k.emit("opened",L);let H=typeof r=="function"?await r():r;if(L.readyState!==Y.OPEN)return;L.send(Ye(H?{type:Q.ConnectionInit,payload:H}:{type:Q.ConnectionInit},T)),isFinite(l)&&l>0&&(U=setTimeout(()=>{L.close(le.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),pe()}catch(H){k.emit("error",H),L.close(le.InternalClientError,Lr(H instanceof Error?H.message:new Error(H).message,"Internal client error"))}};let oe=!1;L.onmessage=({data:H})=>{try{let q=Si(H,B);if(k.emit("message",q),q.type==="ping"||q.type==="pong"){k.emit(q.type,!0,q.payload),q.type==="pong"?pe():u||(L.send(Ye(q.payload?{type:Q.Pong,payload:q.payload}:{type:Q.Pong})),k.emit("pong",!1,q.payload));return}if(oe)return;if(q.type!==Q.ConnectionAck)throw new Error(`First message cannot be of type ${q.type}`);clearTimeout(U),oe=!0,k.emit("connected",L,q.payload,C),C=!1,te=0,S([L,new Promise((re,_e)=>z(_e))])}catch(q){L.onmessage=null,k.emit("error",q),L.close(le.BadResponse,Lr(q instanceof Error?q.message:new Error(q).message,"Bad response"))}}})())));y.readyState===Y.CLOSING&&await g;let _=o(()=>{},"release"),x=new Promise(S=>_=S);return[y,_,Promise.race([x.then(()=>{if(!V){let S=o(()=>y.close(1e3,"Normal Closure"),"complete");isFinite(s)&&s>0?N=setTimeout(()=>{y.readyState===Y.OPEN&&S()},s):S()}}),g])]}o(O,"connect");function E(y){if(kr(y)&&(ta(y.code)||[le.InternalServerError,le.InternalClientError,le.BadRequest,le.BadResponse,le.Unauthorized,le.SubprotocolNotAcceptable,le.SubscriberAlreadyExists,le.TooManyInitialisationRequests].includes(y.code)))throw y;if(rt)return!1;if(kr(y)&&y.code===1e3)return V>0;if(!f||te>=f||!d(y)||b?.(y))throw y;return C=!0}o(E,"shouldRetryConnectOrThrow"),n||(async()=>{for(V++;;)try{let[,,y]=await O();await y}catch(y){try{if(!E(y))return}catch(g){return i?.(g)}}})();function v(y,g){let _=w(y),x=!1,S=!1,D=o(()=>{V--,x=!0},"releaser");return(async()=>{for(V++;;)try{let[L,U,K]=await O();if(x)return U();let pe=k.onMessage(_,oe=>{switch(oe.type){case Q.Next:{g.next(oe.payload);return}case Q.Error:{S=!0,x=!0,g.error(oe.payload),D();return}case Q.Complete:{x=!0,D();return}}});L.send(Ye({id:_,type:Q.Subscribe,payload:y},T)),D=o(()=>{!x&&L.readyState===Y.OPEN&&L.send(Ye({id:_,type:Q.Complete},T)),V--,x=!0,U()},"releaser"),await K.finally(pe);return}catch(L){if(!E(L))return}})().then(()=>{S||g.complete()}).catch(L=>{g.error(L)}),()=>{x||D()}}return o(v,"subscribe"),{on:k.on,subscribe:v,iterate(y){let g=[],_={done:!1,error:null,resolve:o(()=>{},"resolve")},x=v(y,{next(D){g.push(D),_.resolve()},error(D){_.done=!0,_.error=D,_.resolve()},complete(){_.done=!0,_.resolve()}}),S=o(function(){return ea(this,arguments,o(function*(){for(;;){for(g.length||(yield Je(new Promise(U=>_.resolve=U)));g.length;)yield yield Je(g.shift());if(_.error)throw _.error;if(_.done)return yield Je(void 0)}},"iterator_1"))},"iterator")();return S.throw=async D=>(_.done||(_.done=!0,_.error=D,_.resolve()),{done:!0,value:void 0}),S.return=async()=>(x(),{done:!0,value:void 0}),S},async dispose(){if(rt=!0,J){let[y]=await J;y.close(1e3,"Normal Closure")}},terminate(){J&&k.emit("closed",new Nt)}}}o(Ti,"createClient");var Nt=class extends Error{static{o(this,"TerminatedCloseEvent")}constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}};function kr(e){return Te(e)&&"code"in e&&"reason"in e}o(kr,"isLikeCloseEvent");function ta(e){return[1e3,1001,1006,1005,1012,1013,1014].includes(e)?!1:e>=1e3&&e<=1999}o(ta,"isFatalInternalCloseCode");function ra(e){return typeof e=="function"&&"constructor"in e&&"CLOSED"in e&&"CLOSING"in e&&"CONNECTING"in e&&"OPEN"in e}o(ra,"isWebSocket");var Is=ne(Ot(),1);h();h();var Rr=ne(Li(),1);h();var ht=class extends Error{static{o(this,"TimeoutError")}constructor(t){super(t),this.name="TimeoutError"}},Br=class extends Error{static{o(this,"AbortError")}constructor(t){super(),this.name="AbortError",this.message=t}},ki=o(e=>globalThis.DOMException===void 0?new Br(e):new DOMException(e),"getDOMException"),Ci=o(e=>{let t=e.reason===void 0?ki("This operation was aborted."):e.reason;return t instanceof Error?t:ki(t)},"getAbortedReason");function Dr(e,t){let{milliseconds:r,fallback:n,message:i,customTimers:s={setTimeout,clearTimeout}}=t,a,u,f=new Promise((p,d)=>{if(typeof r!="number"||Math.sign(r)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);if(t.signal){let{signal:c}=t;c.aborted&&d(Ci(c)),u=o(()=>{d(Ci(c))},"abortHandler"),c.addEventListener("abort",u,{once:!0})}if(r===Number.POSITIVE_INFINITY){e.then(p,d);return}let b=new ht;a=s.setTimeout.call(void 0,()=>{if(n){try{p(n())}catch(c){d(c)}return}typeof e.cancel=="function"&&e.cancel(),i===!1?p():i instanceof Error?d(i):(b.message=i??`Promise timed out after ${r} milliseconds`,d(b))},r),(async()=>{try{p(await e)}catch(c){d(c)}})()}).finally(()=>{f.clear(),u&&t.signal&&t.signal.removeEventListener("abort",u)});return f.clear=()=>{s.clearTimeout.call(void 0,a),a=void 0},f}o(Dr,"pTimeout");h();h();function $r(e,t,r){let n=0,i=e.length;for(;i>0;){let s=Math.trunc(i/2),a=n+s;r(e[a],t)<=0?(n=++a,i-=s+1):i=s}return n}o($r,"lowerBound");var dt=class{static{o(this,"PriorityQueue")}#e=[];enqueue(t,r){r={priority:0,...r};let n={priority:r.priority,id:r.id,run:t};if(this.size===0||this.#e[this.size-1].priority>=r.priority){this.#e.push(n);return}let i=$r(this.#e,n,(s,a)=>a.priority-s.priority);this.#e.splice(i,0,n)}setPriority(t,r){let n=this.#e.findIndex(s=>s.id===t);if(n===-1)throw new ReferenceError(`No promise function with the id "${t}" exists in the queue.`);let[i]=this.#e.splice(n,1);this.enqueue(i.run,{priority:r,id:t})}dequeue(){return this.#e.shift()?.run}filter(t){return this.#e.filter(r=>r.priority===t.priority).map(r=>r.run)}get size(){return this.#e.length}};var pt=class extends Rr.default{static{o(this,"PQueue")}#e;#i;#o=0;#d;#a;#p=0;#r;#l;#t;#m;#n=0;#c;#s;#g;#_=1n;timeout;constructor(t){if(super(),t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:dt,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${t.intervalCap?.toString()??""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${t.interval?.toString()??""}\` (${typeof t.interval})`);this.#e=t.carryoverConcurrencyCount,this.#i=t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0,this.#d=t.intervalCap,this.#a=t.interval,this.#t=new t.queueClass,this.#m=t.queueClass,this.concurrency=t.concurrency,this.timeout=t.timeout,this.#g=t.throwOnTimeout===!0,this.#s=t.autoStart===!1}get#x(){return this.#i||this.#o<this.#d}get#v(){return this.#n<this.#c}#w(){this.#n--,this.#u(),this.emit("next")}#E(){this.#b(),this.#y(),this.#l=void 0}get#S(){let t=Date.now();if(this.#r===void 0){let r=this.#p-t;if(r<0)this.#o=this.#e?this.#n:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#E()},r)),!0}return!1}#u(){if(this.#t.size===0)return this.#r&&clearInterval(this.#r),this.#r=void 0,this.emit("empty"),this.#n===0&&this.emit("idle"),!1;if(!this.#s){let t=!this.#S;if(this.#x&&this.#v){let r=this.#t.dequeue();return r?(this.emit("active"),r(),t&&this.#y(),!0):!1}}return!1}#y(){this.#i||this.#r!==void 0||(this.#r=setInterval(()=>{this.#b()},this.#a),this.#p=Date.now()+this.#a)}#b(){this.#o===0&&this.#n===0&&this.#r&&(clearInterval(this.#r),this.#r=void 0),this.#o=this.#e?this.#n:0,this.#f()}#f(){for(;this.#u(););}get concurrency(){return this.#c}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this.#c=t,this.#f()}async#T(t){return new Promise((r,n)=>{t.addEventListener("abort",()=>{n(t.reason)},{once:!0})})}setPriority(t,r){this.#t.setPriority(t,r)}async add(t,r={}){return r.id??=(this.#_++).toString(),r={timeout:this.timeout,throwOnTimeout:this.#g,...r},new Promise((n,i)=>{this.#t.enqueue(async()=>{this.#n++,this.#o++;try{r.signal?.throwIfAborted();let s=t({signal:r.signal});r.timeout&&(s=Dr(Promise.resolve(s),{milliseconds:r.timeout})),r.signal&&(s=Promise.race([s,this.#T(r.signal)]));let a=await s;n(a),this.emit("completed",a)}catch(s){if(s instanceof ht&&!r.throwOnTimeout){n();return}i(s),this.emit("error",s)}finally{this.#w()}},r),this.emit("add"),this.#u()})}async addAll(t,r){return Promise.all(t.map(async n=>this.add(n,r)))}start(){return this.#s?(this.#s=!1,this.#f(),this):this}pause(){this.#s=!0}clear(){this.#t=new this.#m}async onEmpty(){this.#t.size!==0&&await this.#h("empty")}async onSizeLessThan(t){this.#t.size<t||await this.#h("next",()=>this.#t.size<t)}async onIdle(){this.#n===0&&this.#t.size===0||await this.#h("idle")}async#h(t,r){return new Promise(n=>{let i=o(()=>{r&&!r()||(this.off(t,i),n())},"listener");this.on(t,i)})}get size(){return this.#t.size}sizeBy(t){return this.#t.filter(t).length}get pending(){return this.#n}get isPaused(){return this.#s}};h();var El=ne($i(),1),Sl=ne(Wr(),1),Tl=ne(Hr(),1),As=ne(en(),1),Ol=ne($s(),1);var Ns=As.default;var Jt=class{constructor(t,r,n){this.environment=r;this.endpoint=n;this.ctx=t.child({name:"client"}),this._graphqlWsClient=Ti({url:`wss://${r.application.slug}.${F.domains.app}/edit/api/graphql-ws`,keepAlive:(0,Is.default)("10s"),shouldRetry:o(()=>!0,"shouldRetry"),connectionParams:{environment:r.name},webSocketImpl:class extends Ns{static{o(this,"webSocketImpl")}constructor(i,s,a){super(i,s,{signal:t.signal,...a,headers:{...a?.headers,"user-agent":F.versionFull,..._r(t)}})}},on:{opened:o(()=>{this.ctx.log.trace("opened")},"opened"),ping:o(i=>{this.ctx.log.trace("ping",{received:i})},"ping"),pong:o(i=>{this.ctx.log.trace("pong",{received:i})},"pong"),connecting:o(()=>{switch(this.status){case 1:this.status=2,this.ctx.log.info("reconnecting");break;case 2:this.ctx.log.info("retrying");break;default:this.ctx.log.debug("connecting");break}},"connecting"),connected:o(()=>{this.status===2?this.ctx.log.info("reconnected"):this.ctx.log.debug("connected"),setImmediate(()=>this.status=0)},"connected"),closed:o(()=>{this.status=1,this.ctx.log.debug("disconnected")},"closed"),error:o(i=>{this.status===2?this.ctx.log.error("failed to reconnect",{error:i}):this.ctx.log.error("connection error",{error:i})},"error")}})}static{o(this,"Client")}status=0;ctx;_graphqlWsClient;subscribe(t,{subscription:r,variables:n,onResponse:i,onError:s,onComplete:a=fn}){let u={query:r,variables:ae(n)},l=this._graphqlWsClient.on("connected",()=>{this.status===2&&(u.variables=ae(n),t.log.info("re-subscribing to graphql subscription"))}),f=new pt({concurrency:1}),p=o(b=>s(new Be(r,b)),"onError"),d=this._graphqlWsClient.subscribe(u,{next:o(b=>void f.add(()=>i(b)).catch(p),"next"),error:o(b=>void f.add(()=>p(b)),"error"),complete:o(()=>void f.add(()=>a()).catch(p),"complete")});return()=>{t.log.trace("unsubscribing from graphql subscription"),l(),f.clear(),d()}}async execute(t,r){let n=this.environment.application.slug;this.environment.application.multiEnvironmentEnabled?this.environment.type!=="production"&&(n+=`--${this.environment.name}`):this.environment.application.hasSplitEnvironments&&(n+="--development");try{let i=await At({context:{ctx:t},method:"POST",url:`https://${n}.${F.domains.app}${this.endpoint}`,headers:{..._r(t),"x-gadget-environment":this.environment.name},json:{query:r.operation,variables:ae(r.variables)},responseType:"json",resolveBodyOnly:!0,throwHttpErrors:!1,...r.http});if(!je(i)||!("data"in i)&&!("errors"in i))throw t.log.error("received invalid graphql response",{error:i}),i;return i}catch(i){throw new Be(r.operation,i)}}async dispose(){await this._graphqlWsClient.dispose()}};var St=class{static{o(this,"Api")}ctx;#e;constructor(t,r){this.ctx=t.child({name:"api"}),this.#e=new Jt(this.ctx,r,"/api/graphql")}async query({query:t,variables:r,...n}){let i=/query (\w+)/.exec(t)?.[1];Ll(i,"query name not found");let s=this.ctx.child({name:"api",fields:{edit:{query:i}},devFields:{edit:{query:i,variables:ae(r)}}});s.log.info("executing graphql query");let a=await this.#e.execute(s,{operation:t,variables:r,...n,http:{retry:{methods:["POST"]},...n.http}});if(a.errors)throw new Be(t,a.errors);if(!a.data)throw new Be(t,"Query response did not contain data");return a.data}async dispose(){await this.#e.dispose()}};h();var Ps=xe(`
|
|
32
32
|
query GadgetMetaModels {
|
|
33
33
|
gadgetMeta {
|
|
34
34
|
models {
|
|
@@ -47,4 +47,4 @@ import{d as pn,e as mn,f as gn}from"./chunk-5VLIBRPJ.js";import{J as We,K as un,
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
`);var kl=Object.freeze({Development:"development",Production:"production",Test:"test"}),Cl=$.object({id:$.union([$.string(),$.number(),$.bigint()]).transform(e=>BigInt(e)),name:$.string().transform(e=>e.toLowerCase()),type:$.nativeEnum(kl)}),Rl=$.object({id:$.union([$.string(),$.number(),$.bigint()]).transform(e=>BigInt(e)),slug:$.string(),primaryDomain:$.string(),hasSplitEnvironments:$.boolean(),multiEnvironmentEnabled:$.boolean(),environments:$.array(Cl),team:$.object({id:$.union([$.string(),$.number(),$.bigint()]).transform(e=>BigInt(e)),name:$.string()})}),cp=$.object({apiIdentifier:$.string(),namespace:$.nullable($.array($.string())).optional()}),up=$.object({apiIdentifier:$.string(),namespace:$.nullable($.array($.string())).optional()}),fp=o(async e=>{let t=ct(e);if(!t)return[];let r=await At({context:{ctx:e},url:`https://${F.domains.services}/auth/api/apps`,headers:{...t},responseType:"json",resolveBodyOnly:!0});return $.array(Rl).parse(r)},"getApplications"),hp=o(e=>{let t=new Map;for(let r of e){let n=r.team.name,i=t.get(n)??[];i.push(r),t.set(n,i)}return t},"groupByTeam"),dp=o(async(e,t)=>{if(!ct(e))return[];let n=new St(e,t),{gadgetMeta:i}=await n.query({query:Ps});return i.models},"getModels"),pp=o(async(e,t)=>{if(!ct(e))return[];let n=new St(e,t),{gadgetMeta:i}=await n.query({query:Ms});return i.globalActions},"getGlobalActions");export{Rt as a,ge as b,yc as c,bc as d,xo as e,Dc as f,Ie as g,Pe as h,ur as i,Dn as j,hr as k,Pn as l,Gn as m,su as n,Fn as o,ou as p,Be as q,pt as r,ct as s,Tu as t,Jt as u,kl as v,fp as w,hp as x,dp as y,pp as z,I as A,Rf as B,Bf as C,Ff as D,$t as E,At as F};
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
50
|
+
//# sourceMappingURL=chunk-LPIHKY3M.js.map
|