@gadgetinc/ggt 1.3.1 → 1.3.2
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-CVO2CSA3.js → add-OTQMXZUR.js} +2 -2
- package/dist/{chunk-ACR6CVXY.js → chunk-3HRT72TB.js} +2 -2
- package/dist/{chunk-MIN6ZMLJ.js → chunk-BKO2TX4J.js} +2 -2
- package/dist/{chunk-6BXHYE2C.js → chunk-PC6ANBC6.js} +3 -3
- package/dist/{chunk-6BXHYE2C.js.map → chunk-PC6ANBC6.js.map} +1 -1
- package/dist/{chunk-YESACFSR.js → chunk-W4IVYUHW.js} +2 -2
- package/dist/{deploy-6JPQ4SNV.js → deploy-RK5PRQ4T.js} +2 -2
- package/dist/{dev-ZPSCK7JQ.js → dev-J6QHZMPR.js} +2 -2
- package/dist/main.js +1 -1
- package/dist/{open-MWPVVE7V.js → open-OZDKOY6V.js} +2 -2
- package/dist/{pull-WEYQPN7H.js → pull-YLUFPDDX.js} +4 -4
- package/dist/{pull-WEYQPN7H.js.map → pull-YLUFPDDX.js.map} +2 -2
- package/dist/push-FFLXHGFG.js +2 -0
- package/dist/{status-GI5XJQTQ.js → status-MP45HWIM.js} +2 -2
- package/package.json +2 -2
- package/dist/push-S4CWMHMS.js +0 -2
- /package/dist/{add-CVO2CSA3.js.map → add-OTQMXZUR.js.map} +0 -0
- /package/dist/{chunk-ACR6CVXY.js.map → chunk-3HRT72TB.js.map} +0 -0
- /package/dist/{chunk-MIN6ZMLJ.js.map → chunk-BKO2TX4J.js.map} +0 -0
- /package/dist/{chunk-YESACFSR.js.map → chunk-W4IVYUHW.js.map} +0 -0
- /package/dist/{deploy-6JPQ4SNV.js.map → deploy-RK5PRQ4T.js.map} +0 -0
- /package/dist/{dev-ZPSCK7JQ.js.map → dev-J6QHZMPR.js.map} +0 -0
- /package/dist/{open-MWPVVE7V.js.map → open-OZDKOY6V.js.map} +0 -0
- /package/dist/{push-S4CWMHMS.js.map → push-FFLXHGFG.js.map} +0 -0
- /package/dist/{status-GI5XJQTQ.js.map → status-MP45HWIM.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as U,g as L,h as S,i as O,j as R,o as P}from"./chunk-
|
|
1
|
+
import{f as U,g as L,h as S,i as O,j as R,o as P}from"./chunk-PC6ANBC6.js";import{g as F,l as j,m as M,n as N,o as k}from"./chunk-BKO2TX4J.js";import"./chunk-HCQR6OPH.js";import"./chunk-W5JAWOQQ.js";import{c as f}from"./chunk-W4IVYUHW.js";import"./chunk-FQ2LR3BI.js";import"./chunk-XB3JTJT6.js";import{a as T,f as v,g as E,j as y,n as $,p as u,x as C,y as B}from"./chunk-O2K4B6AL.js";import"./chunk-AGRDDZFS.js";import{$ as p,Z as r,b as m,m as b}from"./chunk-GIAIN3IJ.js";import"./chunk-B6XQEEUK.js";import{g as _}from"./chunk-SGMPMYEU.js";_();var h=class extends E{isBug=v.NO;constructor(t){let n="";if(b(t.cause)){let a=$(t.cause.map(e=>e.message));n=r` • ${a.map(e=>e.split(`
|
|
2
2
|
`).join(`
|
|
3
3
|
\u200E \u2022 `)).join(`
|
|
4
4
|
`)}`}else n=r`${t.cause}`;super(n)}render(){return`${m.redBright(y.cross)} Failed to add:
|
|
@@ -75,4 +75,4 @@ import{f as U,g as L,h as S,i as O,j as R,o as P}from"./chunk-6BXHYE2C.js";impor
|
|
|
75
75
|
|
|
76
76
|
{gray Usage}
|
|
77
77
|
{cyanBright ggt add field ${e[0]}/<field_name>:<field_type>}`);try{let i=(await a.edit.mutate({mutation:O,variables:{path:e[0],fields:s.map(d=>({name:d.name,fieldType:d.fieldType}))}})).createModelFields;await n.writeToLocalFilesystem(o,{filesVersion:i.remoteFilesVersion,files:i.changed,delete:[]})}catch(i){throw i instanceof u?new h(i):i}p({ensureEmptyLineAbove:!0,content:`Field ${m.cyanBright(s[0]?.name)} added successfully.`})};export{h as AddClientError,ce as args,me as run,I as usage};
|
|
78
|
-
//# sourceMappingURL=add-
|
|
78
|
+
//# sourceMappingURL=add-OTQMXZUR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as p}from"./chunk-
|
|
1
|
+
import{o as p}from"./chunk-PC6ANBC6.js";import{m as c,n as g,o as h}from"./chunk-BKO2TX4J.js";import{c as i}from"./chunk-W4IVYUHW.js";import{$ as r,Z as s}from"./chunk-GIAIN3IJ.js";import{g as a}from"./chunk-SGMPMYEU.js";a();var v={...c,"--force":{type:Boolean,alias:"-f"}},P=e=>s`
|
|
2
2
|
Pushes your local files to your environment directory.
|
|
3
3
|
|
|
4
4
|
This command first tracks changes in your environment directory since the last sync.
|
|
@@ -23,4 +23,4 @@ import{o as p}from"./chunk-6BXHYE2C.js";import{m as c,n as g,o as h}from"./chunk
|
|
|
23
23
|
If you are trying to push changes from a specific directory,
|
|
24
24
|
you must "cd" to that directory and then run "ggt push".
|
|
25
25
|
`);let y=await h(process.cwd()),m=await g.loadOrInit(e,{command:"push",args:o,directory:y}),t=new p(m),n=await t.hashes(e);if(n.localChangesToPush.size===0){r({ensureEmptyLineAbove:!0,content:"Nothing to push."});return}n.environmentChangesToPull.size>0&&!n.onlyDotGadgetFilesChanged&&await t.print(e,{hashes:n}),await t.push(e,{command:"push",hashes:n,force:o["--force"]})};export{v as a,P as b,A as c};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-3HRT72TB.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as V}from"./chunk-
|
|
1
|
+
import{c as V}from"./chunk-W4IVYUHW.js";import{a as lr}from"./chunk-FQ2LR3BI.js";import{a as yr,b as vr,i as br}from"./chunk-XB3JTJT6.js";import{a as st,c as pr,f as pt,g as mt,j as Pt,l as Wi,m as mr,o as ee,p as Q,t as hr,u as dr,v as re,w as gr,z as ft}from"./chunk-O2K4B6AL.js";import{a as fr}from"./chunk-AGRDDZFS.js";import{$ as z,D as ct,K as lt,P as te,R as ur,U as Et,X as cr,Z as T,_ as R,b as G,e as B,g as tr,h as er,l as rr,m as nr,t as sr,u as ir,v as or,y as ar,z as Qi}from"./chunk-GIAIN3IJ.js";import{a as Vi,c as Zt,e as nt,g as C}from"./chunk-SGMPMYEU.js";var xr=Zt(D=>{"use strict";C();var Ki=D&&D.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(D,"__esModule",{value:!0});var Xi=Vi("fs"),Zi=Ki(lr()),it=Zi.default("@kwsites/file-exists");function to(t,e,r){it("checking %s",t);try{let n=Xi.statSync(t);return n.isFile()&&e?(it("[OK] path represents a file"),!0):n.isDirectory()&&r?(it("[OK] path represents a directory"),!0):(it("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return it("[FAIL] path is not accessible: %o",n),!1;throw it("[FATAL] %o",n),n}}function eo(t,e=D.READABLE){return to(t,(e&D.FILE)>0,(e&D.FOLDER)>0)}D.exists=eo;D.FILE=1;D.FOLDER=2;D.READABLE=D.FILE+D.FOLDER});var Er=Zt(Rt=>{"use strict";C();function ro(t){for(var e in t)Rt.hasOwnProperty(e)||(Rt[e]=t[e])}Object.defineProperty(Rt,"__esModule",{value:!0});ro(xr())});var ue=Zt(Z=>{"use strict";C();Object.defineProperty(Z,"__esModule",{value:!0});Z.createDeferred=Z.deferred=void 0;function ae(){let t,e,r="pending";return{promise:new Promise((s,i)=>{t=s,e=i}),done(s){r==="pending"&&(r="resolved",t(s))},fail(s){r==="pending"&&(r="rejected",e(s))},get fulfilled(){return r!=="pending"},get status(){return r}}}Z.deferred=ae;Z.createDeferred=ae;Z.default=ae});C();var _r=nt(Wi(),1);var Ec=Object.freeze({Fatal:"Fatal",Error:"Error",Warning:"Warning",Info:"Info"}),ne=({problems:t,showFileTypes:e,...r})=>{let n="";for(let[s,i]of Object.entries(t)){n+=R(""),n+=R`• {cyan ${s}} {redBright ${(0,_r.default)("problem",i.length,!0)}}`;for(let o of i){let[a,...c]=o.message.split(`
|
|
2
2
|
`);n+=T` {red ✖} `,(e??o.type==="SourceFile")&&(n+=T`${Hi(s)} `),n+=T(a);for(let p of c)n+=R(""),n+=T` ${p}`;for(let p of o.labels)n+=T` {dim ${p}}`;n+=R("")}}return R({...r,content:n})},Pc=t=>{z(ne(t))},Hi=t=>{switch(!0){case sr(t):return G.yellowBright("JavaScript");case ir(t):return G.blue("TypeScript");case or(t):return G.magenta("Gelly");default:return G.gray("File")}},Cc=t=>{let e={};for(let r of t){let n=r.node?.apiIdentifier??r.node?.name??"Other";e[n]??=[],e[n].push({type:r.node?.type??"Unknown",severity:r.severity,message:r.message,labels:mr(r.nodeLabels?.map(s=>s?.identifier)??[])})}return e},Rc=t=>{let e={};for(let r of t)e[r.path]??=[],e[r.path].push({type:r.type,severity:r.level,message:r.message,labels:[]});return e};C();var kr=class extends mt{isBug=pt.NO;constructor(){super("Yarn not found")}render(){return T`
|
|
3
3
|
Yarn must be installed to sync your application. You can install it by running:
|
|
4
4
|
|
|
@@ -114,4 +114,4 @@ import{c as V}from"./chunk-YESACFSR.js";import{a as lr}from"./chunk-FQ2LR3BI.js"
|
|
|
114
114
|
• ${a.join(`
|
|
115
115
|
\u2022 `)}
|
|
116
116
|
`)},gc=async(t,{directory:e})=>{try{return await ai(e.path).revparse(["--abbrev-ref","HEAD"])}catch(r){t.log.warn("failed to read git branch",{error:r});return}},yc=B.object({application:B.string(),environment:B.string(),environments:B.record(B.object({filesVersion:B.string()}))}),vc=B.object({app:B.string(),filesVersion:B.string(),mtime:B.number()}),bc=B.union([yc,vc]),_c=bc.transform(t=>"environment"in t?t:{application:t.app,environment:"development",environments:{development:{filesVersion:t.filesVersion}}});export{Ec as a,ne as b,Pc as c,Cc as d,Rc as e,kr as f,Ct as g,wr as h,Tr as i,Yi as j,Fc as k,oe as l,yp as m,pi as n,vp as o};
|
|
117
|
-
//# sourceMappingURL=chunk-
|
|
117
|
+
//# sourceMappingURL=chunk-BKO2TX4J.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as gt,e as ft,h as ht,j as xe,k as te,l as It}from"./chunk-MIN6ZMLJ.js";import{a as St,b as mt}from"./chunk-HCQR6OPH.js";import{b as $}from"./chunk-W5JAWOQQ.js";import{c as dt}from"./chunk-YESACFSR.js";import{c as Me}from"./chunk-XB3JTJT6.js";import{B as Mt,i as Ee,j as w,k as _r,l as yt,q as bt}from"./chunk-O2K4B6AL.js";import{b as Et,c as xt}from"./chunk-AGRDDZFS.js";import{$ as R,E as ut,H as pt,I as N,L as be,M as Z,P as ee,S as ct,Z as m,_ as k,b,d as rt,g as at,n as ot,p as he,q as st,r as it,s as lt,z as Ar}from"./chunk-GIAIN3IJ.js";import{a as Ir}from"./chunk-B6XQEEUK.js";import{a as v,c as x,e as F,g as u}from"./chunk-SGMPMYEU.js";var Dt=x((hs,Vt)=>{u();Vt.exports=Gt;Gt.sync=Pr;var kt=v("fs");function wr(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 a=n[r].toLowerCase();if(a&&e.substr(-a.length).toLowerCase()===a)return!0}return!1}function Lt(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:wr(t,n)}function Gt(e,t,n){kt.stat(e,function(r,a){n(r,r?!1:Lt(a,e,t))})}function Pr(e,t){return Lt(kt.statSync(e),e,t)}});var jt=x((Es,Qt)=>{u();Qt.exports=Ut;Ut.sync=Or;var Ht=v("fs");function Ut(e,t,n){Ht.stat(e,function(r,a){n(r,r?!1:$t(a,t))})}function Or(e,t){return $t(Ht.statSync(e),t)}function $t(e,t){return e.isFile()&&Br(e,t)}function Br(e,t){var n=e.mode,r=e.uid,a=e.gid,o=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),i=parseInt("100",8),l=parseInt("010",8),p=parseInt("001",8),c=i|l,d=n&p||n&l&&a===s||n&i&&r===o||n&c&&o===0;return d}});var Wt=x((Is,Jt)=>{u();var Ms=v("fs"),ae;process.platform==="win32"||global.TESTING_WINDOWS?ae=Dt():ae=jt();Jt.exports=_e;_e.sync=Nr;function _e(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,a){_e(e,t||{},function(o,s){o?a(o):r(s)})})}ae(e,t||{},function(r,a){r&&(r.code==="EACCES"||t&&t.ignoreErrors)&&(r=null,a=!1),n(r,a)})}function Nr(e,t){try{return ae.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}});var en=x((_s,Zt)=>{u();var V=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",qt=v("path"),kr=V?";":":",Yt=Wt(),zt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Kt=(e,t)=>{let n=t.colon||kr,r=e.match(/\//)||V&&e.match(/\\/)?[""]:[...V?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],a=V?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=V?a.split(n):[""];return V&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:r,pathExt:o,pathExtExe:a}},Xt=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});let{pathEnv:r,pathExt:a,pathExtExe:o}=Kt(e,t),s=[],i=p=>new Promise((c,d)=>{if(p===r.length)return t.all&&s.length?c(s):d(zt(e));let y=r[p],S=/^".*"$/.test(y)?y.slice(1,-1):y,f=qt.join(S,e),h=!S&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;c(l(h,p,0))}),l=(p,c,d)=>new Promise((y,S)=>{if(d===a.length)return y(i(c+1));let f=a[d];Yt(p+f,{pathExt:o},(h,g)=>{if(!h&&g)if(t.all)s.push(p+f);else return y(p+f);return y(l(p,c,d+1))})});return n?i(0).then(p=>n(null,p),n):i(0)},Lr=(e,t)=>{t=t||{};let{pathEnv:n,pathExt:r,pathExtExe:a}=Kt(e,t),o=[];for(let s=0;s<n.length;s++){let i=n[s],l=/^".*"$/.test(i)?i.slice(1,-1):i,p=qt.join(l,e),c=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;for(let d=0;d<r.length;d++){let y=c+r[d];try{if(Yt.sync(y,{pathExt:a}))if(t.all)o.push(y);else return y}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw zt(e)};Zt.exports=Xt;Xt.sync=Lr});var nn=x((Ts,Ce)=>{"use strict";u();var tn=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};Ce.exports=tn;Ce.exports.default=tn});var sn=x((Fs,on)=>{"use strict";u();var rn=v("path"),Gr=en(),Vr=nn();function an(e,t){let n=e.options.env||process.env,r=process.cwd(),a=e.options.cwd!=null,o=a&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=Gr.sync(e.command,{path:n[Vr({env:n})],pathExt:t?rn.delimiter:void 0})}catch{}finally{o&&process.chdir(r)}return s&&(s=rn.resolve(a?e.options.cwd:"",s)),s}function Dr(e){return an(e)||an(e,!0)}on.exports=Dr});var ln=x((ws,ve)=>{"use strict";u();var Te=/([()\][%!^"`<>&|;, *?])/g;function Hr(e){return e=e.replace(Te,"^$1"),e}function Ur(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Te,"^$1"),t&&(e=e.replace(Te,"^$1")),e}ve.exports.command=Hr;ve.exports.argument=Ur});var pn=x((Os,un)=>{"use strict";u();un.exports=/^#!(.*)/});var dn=x((Ns,cn)=>{"use strict";u();var $r=pn();cn.exports=(e="")=>{let t=e.match($r);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,"").split(" "),a=n.split("/").pop();return a==="env"?r:r?`${a} ${r}`:a}});var Sn=x((Ls,yn)=>{"use strict";u();var Fe=v("fs"),Qr=dn();function jr(e){let n=Buffer.alloc(150),r;try{r=Fe.openSync(e,"r"),Fe.readSync(r,n,0,150,0),Fe.closeSync(r)}catch{}return Qr(n.toString())}yn.exports=jr});var hn=x((Vs,fn)=>{"use strict";u();var Jr=v("path"),mn=sn(),gn=ln(),Wr=Sn(),qr=process.platform==="win32",Yr=/\.(?:com|exe)$/i,zr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Kr(e){e.file=mn(e);let t=e.file&&Wr(e.file);return t?(e.args.unshift(e.file),e.command=t,mn(e)):e.file}function Xr(e){if(!qr)return e;let t=Kr(e),n=!Yr.test(t);if(e.options.forceShell||n){let r=zr.test(t);e.command=Jr.normalize(e.command),e.command=gn.command(e.command),e.args=e.args.map(o=>gn.argument(o,r));let a=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${a}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Zr(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:Xr(r)}fn.exports=Zr});var xn=x((Hs,En)=>{"use strict";u();var Re=process.platform==="win32";function we(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})}function ea(e,t){if(!Re)return;let n=e.emit;e.emit=function(r,a){if(r==="exit"){let o=bn(a,t,"spawn");if(o)return n.call(e,"error",o)}return n.apply(e,arguments)}}function bn(e,t){return Re&&e===1&&!t.file?we(t.original,"spawn"):null}function ta(e,t){return Re&&e===1&&!t.file?we(t.original,"spawnSync"):null}En.exports={hookChildProcess:ea,verifyENOENT:bn,verifyENOENTSync:ta,notFoundError:we}});var An=x(($s,D)=>{"use strict";u();var Mn=v("child_process"),Pe=hn(),Oe=xn();function In(e,t,n){let r=Pe(e,t,n),a=Mn.spawn(r.command,r.args,r.options);return Oe.hookChildProcess(a,r),a}function na(e,t,n){let r=Pe(e,t,n),a=Mn.spawnSync(r.command,r.args,r.options);return a.error=a.error||Oe.verifyENOENTSync(a.status,r),a}D.exports=In;D.exports.spawn=In;D.exports.sync=na;D.exports._parse=Pe;D.exports._enoent=Oe});var Kn=x((pl,zn)=>{"use strict";u();var{PassThrough:Xa}=v("stream");zn.exports=function(){var e=[],t=new Xa({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=r,t.on("unpipe",a),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",a.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function r(){return e.length==0}function a(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}}});var mr=x((zl,Sr)=>{u();function I(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))}Sr.exports=I;I.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};I.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};I.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};I.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)};I.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};I.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};I.prototype.start=I.prototype.try;I.prototype.errors=function(){return this._errors};I.prototype.attempts=function(){return this._attempts};I.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 a=this._errors[r],o=a.message,s=(e[o]||0)+1;e[o]=s,s>=n&&(t=a,n=s)}return t}});var gr=x(B=>{u();var Io=mr();B.operation=function(e){var t=B.timeouts(e);return new Io(t,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};B.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=[],a=0;a<t.retries;a++)r.push(this.createTimeout(a,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(a,t)),r.sort(function(o,s){return o-s}),r};B.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};B.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 a=0;a<n.length;a++){var o=n[a],s=e[o];e[o]=function(l){var p=B.operation(t),c=Array.prototype.slice.call(arguments,1),d=c.pop();c.push(function(y){p.retry(y)||(y&&(arguments[0]=p.mainError()),d.apply(this,arguments))}),p.attempt(function(){l.apply(e,c)})}.bind(e,s),e[o].options=t}}});var hr=x((eu,fr)=>{u();fr.exports=gr()});u();var Q=F(yt(),1);var ne=class extends Map{created=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="create").map(([t])=>t));updated=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="update").map(([t])=>t));deleted=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="delete").map(([t])=>t))},Cr=b.greenBright("+"),Tr=b.blueBright("\xB1"),vr=b.redBright("-"),At=b.yellowBright("\u2192"),j=(e,{changes:t,tense:n,limit:r=1/0,...a})=>{ee.logLevel<=Z.TRACE&&(r=1/0);let o=Array.from(t.entries()).filter(([y])=>!y.startsWith(".gadget/"));if(o.length===0)return"";let s=b.yellowBright(n==="past"?"renamed":"rename"),i=b.greenBright(n==="past"?"created":"create"),l=b.blueBright(n==="past"?"updated":"update"),p=b.redBright(n==="past"?"deleted":"delete"),c=o.sort((y,S)=>y[0].localeCompare(S[0])).slice(0,r).map(([y,S])=>{switch(!0){case(S.type==="create"&&at(S.oldPath)):return[At,b.yellowBright(S.oldPath),s,At,b.yellowBright(y)];case S.type==="create":return[Cr,b.greenBright(y),i];case S.type==="update":return[Tr,b.blueBright(y),l];case S.type==="delete":return[vr,b.redBright(y),p];default:return ot(S)}});o.length>r&&c.push([b.gray(w.ellipsis),m`{gray ${o.length-r} more}`,""]);let d;if(o.length>=5){let y=[],S=o.filter(([,g])=>g.type==="create").length;if(S>0){let g=n==="past"?`${S} created`:(0,Q.default)("create",S,!0);y.push(m`{greenBright ${g}}`)}let f=o.filter(([,g])=>g.type==="update").length;if(f>0){let g=n==="past"?`${f} updated`:(0,Q.default)("update",f,!0);y.push(m`{blueBright ${g}}`)}let h=o.filter(([,g])=>g.type==="delete").length;if(h>0){let g=n==="past"?`${h} deleted`:(0,Q.default)("delete",h,!0);y.push(m`{redBright ${g}}`)}d=k`
|
|
1
|
+
import{b as gt,e as ft,h as ht,j as xe,k as te,l as It}from"./chunk-BKO2TX4J.js";import{a as St,b as mt}from"./chunk-HCQR6OPH.js";import{b as $}from"./chunk-W5JAWOQQ.js";import{c as dt}from"./chunk-W4IVYUHW.js";import{c as Me}from"./chunk-XB3JTJT6.js";import{B as Mt,i as Ee,j as w,k as _r,l as yt,q as bt}from"./chunk-O2K4B6AL.js";import{b as Et,c as xt}from"./chunk-AGRDDZFS.js";import{$ as R,E as ut,H as pt,I as N,L as be,M as Z,P as ee,S as ct,Z as m,_ as k,b,d as rt,g as at,n as ot,p as he,q as st,r as it,s as lt,z as Ar}from"./chunk-GIAIN3IJ.js";import{a as Ir}from"./chunk-B6XQEEUK.js";import{a as v,c as x,e as F,g as u}from"./chunk-SGMPMYEU.js";var Dt=x((hs,Vt)=>{u();Vt.exports=Gt;Gt.sync=Pr;var kt=v("fs");function wr(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 a=n[r].toLowerCase();if(a&&e.substr(-a.length).toLowerCase()===a)return!0}return!1}function Lt(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:wr(t,n)}function Gt(e,t,n){kt.stat(e,function(r,a){n(r,r?!1:Lt(a,e,t))})}function Pr(e,t){return Lt(kt.statSync(e),e,t)}});var jt=x((Es,Qt)=>{u();Qt.exports=Ut;Ut.sync=Or;var Ht=v("fs");function Ut(e,t,n){Ht.stat(e,function(r,a){n(r,r?!1:$t(a,t))})}function Or(e,t){return $t(Ht.statSync(e),t)}function $t(e,t){return e.isFile()&&Br(e,t)}function Br(e,t){var n=e.mode,r=e.uid,a=e.gid,o=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),i=parseInt("100",8),l=parseInt("010",8),p=parseInt("001",8),c=i|l,d=n&p||n&l&&a===s||n&i&&r===o||n&c&&o===0;return d}});var Wt=x((Is,Jt)=>{u();var Ms=v("fs"),ae;process.platform==="win32"||global.TESTING_WINDOWS?ae=Dt():ae=jt();Jt.exports=_e;_e.sync=Nr;function _e(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,a){_e(e,t||{},function(o,s){o?a(o):r(s)})})}ae(e,t||{},function(r,a){r&&(r.code==="EACCES"||t&&t.ignoreErrors)&&(r=null,a=!1),n(r,a)})}function Nr(e,t){try{return ae.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}});var en=x((_s,Zt)=>{u();var V=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",qt=v("path"),kr=V?";":":",Yt=Wt(),zt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Kt=(e,t)=>{let n=t.colon||kr,r=e.match(/\//)||V&&e.match(/\\/)?[""]:[...V?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],a=V?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=V?a.split(n):[""];return V&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:r,pathExt:o,pathExtExe:a}},Xt=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});let{pathEnv:r,pathExt:a,pathExtExe:o}=Kt(e,t),s=[],i=p=>new Promise((c,d)=>{if(p===r.length)return t.all&&s.length?c(s):d(zt(e));let y=r[p],S=/^".*"$/.test(y)?y.slice(1,-1):y,f=qt.join(S,e),h=!S&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;c(l(h,p,0))}),l=(p,c,d)=>new Promise((y,S)=>{if(d===a.length)return y(i(c+1));let f=a[d];Yt(p+f,{pathExt:o},(h,g)=>{if(!h&&g)if(t.all)s.push(p+f);else return y(p+f);return y(l(p,c,d+1))})});return n?i(0).then(p=>n(null,p),n):i(0)},Lr=(e,t)=>{t=t||{};let{pathEnv:n,pathExt:r,pathExtExe:a}=Kt(e,t),o=[];for(let s=0;s<n.length;s++){let i=n[s],l=/^".*"$/.test(i)?i.slice(1,-1):i,p=qt.join(l,e),c=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;for(let d=0;d<r.length;d++){let y=c+r[d];try{if(Yt.sync(y,{pathExt:a}))if(t.all)o.push(y);else return y}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw zt(e)};Zt.exports=Xt;Xt.sync=Lr});var nn=x((Ts,Ce)=>{"use strict";u();var tn=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};Ce.exports=tn;Ce.exports.default=tn});var sn=x((Fs,on)=>{"use strict";u();var rn=v("path"),Gr=en(),Vr=nn();function an(e,t){let n=e.options.env||process.env,r=process.cwd(),a=e.options.cwd!=null,o=a&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=Gr.sync(e.command,{path:n[Vr({env:n})],pathExt:t?rn.delimiter:void 0})}catch{}finally{o&&process.chdir(r)}return s&&(s=rn.resolve(a?e.options.cwd:"",s)),s}function Dr(e){return an(e)||an(e,!0)}on.exports=Dr});var ln=x((ws,ve)=>{"use strict";u();var Te=/([()\][%!^"`<>&|;, *?])/g;function Hr(e){return e=e.replace(Te,"^$1"),e}function Ur(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Te,"^$1"),t&&(e=e.replace(Te,"^$1")),e}ve.exports.command=Hr;ve.exports.argument=Ur});var pn=x((Os,un)=>{"use strict";u();un.exports=/^#!(.*)/});var dn=x((Ns,cn)=>{"use strict";u();var $r=pn();cn.exports=(e="")=>{let t=e.match($r);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,"").split(" "),a=n.split("/").pop();return a==="env"?r:r?`${a} ${r}`:a}});var Sn=x((Ls,yn)=>{"use strict";u();var Fe=v("fs"),Qr=dn();function jr(e){let n=Buffer.alloc(150),r;try{r=Fe.openSync(e,"r"),Fe.readSync(r,n,0,150,0),Fe.closeSync(r)}catch{}return Qr(n.toString())}yn.exports=jr});var hn=x((Vs,fn)=>{"use strict";u();var Jr=v("path"),mn=sn(),gn=ln(),Wr=Sn(),qr=process.platform==="win32",Yr=/\.(?:com|exe)$/i,zr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Kr(e){e.file=mn(e);let t=e.file&&Wr(e.file);return t?(e.args.unshift(e.file),e.command=t,mn(e)):e.file}function Xr(e){if(!qr)return e;let t=Kr(e),n=!Yr.test(t);if(e.options.forceShell||n){let r=zr.test(t);e.command=Jr.normalize(e.command),e.command=gn.command(e.command),e.args=e.args.map(o=>gn.argument(o,r));let a=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${a}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Zr(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:Xr(r)}fn.exports=Zr});var xn=x((Hs,En)=>{"use strict";u();var Re=process.platform==="win32";function we(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})}function ea(e,t){if(!Re)return;let n=e.emit;e.emit=function(r,a){if(r==="exit"){let o=bn(a,t,"spawn");if(o)return n.call(e,"error",o)}return n.apply(e,arguments)}}function bn(e,t){return Re&&e===1&&!t.file?we(t.original,"spawn"):null}function ta(e,t){return Re&&e===1&&!t.file?we(t.original,"spawnSync"):null}En.exports={hookChildProcess:ea,verifyENOENT:bn,verifyENOENTSync:ta,notFoundError:we}});var An=x(($s,D)=>{"use strict";u();var Mn=v("child_process"),Pe=hn(),Oe=xn();function In(e,t,n){let r=Pe(e,t,n),a=Mn.spawn(r.command,r.args,r.options);return Oe.hookChildProcess(a,r),a}function na(e,t,n){let r=Pe(e,t,n),a=Mn.spawnSync(r.command,r.args,r.options);return a.error=a.error||Oe.verifyENOENTSync(a.status,r),a}D.exports=In;D.exports.spawn=In;D.exports.sync=na;D.exports._parse=Pe;D.exports._enoent=Oe});var Kn=x((pl,zn)=>{"use strict";u();var{PassThrough:Xa}=v("stream");zn.exports=function(){var e=[],t=new Xa({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=r,t.on("unpipe",a),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",a.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function r(){return e.length==0}function a(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}}});var mr=x((zl,Sr)=>{u();function I(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))}Sr.exports=I;I.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};I.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};I.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};I.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)};I.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};I.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};I.prototype.start=I.prototype.try;I.prototype.errors=function(){return this._errors};I.prototype.attempts=function(){return this._attempts};I.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 a=this._errors[r],o=a.message,s=(e[o]||0)+1;e[o]=s,s>=n&&(t=a,n=s)}return t}});var gr=x(B=>{u();var Io=mr();B.operation=function(e){var t=B.timeouts(e);return new Io(t,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};B.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=[],a=0;a<t.retries;a++)r.push(this.createTimeout(a,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(a,t)),r.sort(function(o,s){return o-s}),r};B.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};B.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 a=0;a<n.length;a++){var o=n[a],s=e[o];e[o]=function(l){var p=B.operation(t),c=Array.prototype.slice.call(arguments,1),d=c.pop();c.push(function(y){p.retry(y)||(y&&(arguments[0]=p.mainError()),d.apply(this,arguments))}),p.attempt(function(){l.apply(e,c)})}.bind(e,s),e[o].options=t}}});var hr=x((eu,fr)=>{u();fr.exports=gr()});u();var Q=F(yt(),1);var ne=class extends Map{created=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="create").map(([t])=>t));updated=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="update").map(([t])=>t));deleted=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="delete").map(([t])=>t))},Cr=b.greenBright("+"),Tr=b.blueBright("\xB1"),vr=b.redBright("-"),At=b.yellowBright("\u2192"),j=(e,{changes:t,tense:n,limit:r=1/0,...a})=>{ee.logLevel<=Z.TRACE&&(r=1/0);let o=Array.from(t.entries()).filter(([y])=>!y.startsWith(".gadget/"));if(o.length===0)return"";let s=b.yellowBright(n==="past"?"renamed":"rename"),i=b.greenBright(n==="past"?"created":"create"),l=b.blueBright(n==="past"?"updated":"update"),p=b.redBright(n==="past"?"deleted":"delete"),c=o.sort((y,S)=>y[0].localeCompare(S[0])).slice(0,r).map(([y,S])=>{switch(!0){case(S.type==="create"&&at(S.oldPath)):return[At,b.yellowBright(S.oldPath),s,At,b.yellowBright(y)];case S.type==="create":return[Cr,b.greenBright(y),i];case S.type==="update":return[Tr,b.blueBright(y),l];case S.type==="delete":return[vr,b.redBright(y),p];default:return ot(S)}});o.length>r&&c.push([b.gray(w.ellipsis),m`{gray ${o.length-r} more}`,""]);let d;if(o.length>=5){let y=[],S=o.filter(([,g])=>g.type==="create").length;if(S>0){let g=n==="past"?`${S} created`:(0,Q.default)("create",S,!0);y.push(m`{greenBright ${g}}`)}let f=o.filter(([,g])=>g.type==="update").length;if(f>0){let g=n==="past"?`${f} updated`:(0,Q.default)("update",f,!0);y.push(m`{blueBright ${g}}`)}let h=o.filter(([,g])=>g.type==="delete").length;if(h>0){let g=n==="past"?`${h} deleted`:(0,Q.default)("delete",h,!0);y.push(m`{redBright ${g}}`)}d=k`
|
|
2
2
|
${(0,Q.default)("change",o.length,!0)} in total. ${y.join(", ")}.
|
|
3
3
|
`}return St({rows:c,footer:d,ensureEmptyLineAbove:!0,ensureEmptyLineAboveBody:!1,ensureEmptyLineAboveFooter:!0,indent:0,...a})},re=(e,t)=>{let n=j(e,t);n&&R(n)};u();var _t=m(`
|
|
4
4
|
subscription EnvironmentLogs($query: String!, $start: DateTime, $limit: Int) {
|
|
@@ -170,7 +170,7 @@ ${r.message}`:g,_=[E,t,e].filter(Boolean).join(`
|
|
|
170
170
|
Your environment's files have changed since we last checked.
|
|
171
171
|
|
|
172
172
|
Please re-run "ggt ${n}" to see the changes and try again.
|
|
173
|
-
`)}}async pull(t,{hashes:n,force:r,printEnvironmentChangesOptions:a}={}){let{localChanges:o,environmentChangesToPull:s,environmentFilesVersion:i}=n??await this.hashes(t);H(s.size>0,"cannot
|
|
173
|
+
`)}}async pull(t,{hashes:n,force:r,printEnvironmentChangesOptions:a}={}){let{localChanges:o,environmentChangesToPull:s,environmentFilesVersion:i}=n??await this.hashes(t);H(s.size>0,"cannot pull if there are no changes"),o.size>0&&!r&&await Me(m`
|
|
174
174
|
Are you sure you want to {underline discard} your local changes?
|
|
175
175
|
`),await this._getChangesFromEnvironment(t,{changes:s,filesVersion:i,printEnvironmentChangesOptions:a})}async writeToLocalFilesystem(t,n){let r=BigInt(n.filesVersion);H(r>=this.syncJson.filesVersion,"filesVersion must be greater than or equal to current filesVersion"),t.log.debug("writing to local filesystem",{filesVersion:r,files:n.files.map(s=>s.path),delete:n.delete});let a=new ne,o=new Set;await K(n.delete,async s=>{let i=fe.dirname(s);for(;i!==".";)o.add(this.syncJson.directory.normalize(i,!0)),i=fe.dirname(i);let l=this.syncJson.directory.absolute(s),p=this.syncJson.directory.absolute(".gadget/backup",this.syncJson.directory.relative(s));await tt(async()=>{try{await A.default.remove(p),await A.default.move(l,p),a.set(s,{type:"delete"})}catch(c){if(he(c))return;if(it(c)||lt(c)){let d=fe.dirname(p);for(;d!==this.syncJson.directory.absolute(".gadget/backup");)(await A.default.stat(d)).isDirectory()||(t.log.debug("removing file in the way of backup path",{currentPath:l,backupPath:p,file:d}),await A.default.remove(d)),d=fe.dirname(d)}throw c}},{retries:ee.windows?4:2,minTimeout:(0,Mr.default)("100ms"),onFailedAttempt:c=>{t.log.warn("failed to move file to backup",{error:c,currentPath:l,backupPath:p})}})});for(let s of Array.from(o.values()).sort().reverse())if(!n.files.some(i=>i.path===s))try{await A.default.rmdir(this.syncJson.directory.absolute(s)),a.set(s,{type:"delete"})}catch(i){if(he(i)||st(i))continue;throw i}if(await K(n.files,async s=>{let i=this.syncJson.directory.absolute(s.path);await A.default.pathExists(i)?s.path.endsWith("/")||a.set(s.path,{type:"update"}):a.set(s.path,{type:"create"}),s.path.endsWith("/")?await A.default.ensureDir(i):await A.default.outputFile(i,Buffer.from(s.content,s.encoding)),Et&&await A.default.chmod(i,s.mode&511),i===this.syncJson.directory.absolute(".ignore")&&await this.syncJson.directory.loadIgnoreFile()}),await this.syncJson.save(String(r)),n.spinner?.clear(),re(t,{changes:a,tense:"past",title:m`{greenBright ${w.arrowDown}} Pulled ${(0,U.default)("file",a.size)}. ${P()}`,...n.printEnvironmentChangesOptions}),a.has("yarn.lock")){let s=$({ensureEmptyLineAbove:!0,content:'Running "yarn install --check-files"'});try{await Xe("yarn",["install","--check-files"],{cwd:this.syncJson.directory.path}),s.succeed(`Ran "yarn install --check-files" ${P()}`)}catch(i){s.fail(),t.log.error("yarn install failed",{error:i});let l=ut(i).message;l&&R({ensureEmptyLineAbove:!0,indent:2,content:l})}}return a}async _merge(t,{hashes:{localChanges:n,environmentChanges:r,environmentFilesVersion:a},prefer:o,printLocalChangesOptions:s,printEnvironmentChangesOptions:i}){let l=Bt({localChanges:n,environmentChanges:r});if(l.size>0)switch(t.log.debug("conflicts detected",{conflicts:l}),o||(Nt({conflicts:l}),o=await It({choices:Object.values(O),content:b.bold("How should we resolve these conflicts?")})),o){case O.CANCEL:{To.exit(0);break}case O.LOCAL:{r=Ae({conflicts:l,changes:r});break}case O.ENVIRONMENT:{n=Ae({conflicts:l,changes:n});break}}r.size>0&&await this._getChangesFromEnvironment(t,{changes:r,filesVersion:a,printEnvironmentChangesOptions:i}),n.size>0&&await this._sendChangesToEnvironment(t,{changes:n,expectedFilesVersion:a,printLocalChangesOptions:s})}async _getChangesFromEnvironment(t,{filesVersion:n,changes:r,printEnvironmentChangesOptions:a}){t.log.debug("getting changes from gadget",{filesVersion:n,changes:r});let o=r.created(),s=r.updated(),i=$({ensureEmptyLineAbove:!0,content:j(t,{changes:r,tense:"present",title:m`Pulling ${(0,U.default)("file",r.size)}.`,...a})});try{let l=[];if(o.length>0||s.length>0){let{fileSyncFiles:p}=await this.syncJson.edit.query({query:vt,variables:{paths:[...o,...s],filesVersion:String(n),encoding:"base64"}});l=p.files}await this.writeToLocalFilesystem(t,{filesVersion:n,files:l,delete:r.deleted(),spinner:i,printEnvironmentChangesOptions:a})}catch(l){throw i.fail(),l}}async _sendChangesToEnvironment(t,{changes:n,expectedFilesVersion:r=this.syncJson.filesVersion,printLocalChangesOptions:a}){t.log.debug("sending changes to gadget",{expectedFilesVersion:r,changes:n});let o=[],s=[];if(await K(n,async([p,c])=>{if(c.type==="delete"){s.push({path:p});return}let d=this.syncJson.directory.absolute(p),y;try{y=await A.default.stat(d)}catch(h){xt(h),t.log.debug("skipping change because file doesn't exist",{path:p});return}let S="";y.isFile()&&(S=await A.default.readFile(d,"base64"));let f;c.type==="create"&&c.oldPath&&(f=c.oldPath),o.push({content:S,oldPath:f,path:p,mode:y.mode,encoding:"base64"})}),o.length===0&&s.length===0){t.log.debug("skipping send because there are no changes");return}if(o.map(p=>p.content.length).reduce((p,c)=>p+c,0)>vo)throw new Ee(m`
|
|
176
176
|
{underline Your file changes are too large to push.}
|
|
@@ -184,4 +184,4 @@ ${r.message}`:g,_=[E,t,e].filter(Boolean).join(`
|
|
|
184
184
|
|
|
185
185
|
{red Your app will not be operational until all fatal errors are fixed.}
|
|
186
186
|
`})}catch(p){throw xe(p)?l.clear():l.fail(),p}}};export{ne as a,Tr as b,vr as c,en as d,Uo as e,$o as f,Qo as g,jo as h,Jo as i,P as j,Bt as k,Nt as l,Ss as m,ms as n,xr as o};
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
187
|
+
//# sourceMappingURL=chunk-PC6ANBC6.js.map
|