@northflank/cli 0.9.7 → 0.9.9

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.
@@ -1 +1 @@
1
- 'use strict';const a0v6=a0N;function a0N(v,N){const z=a0v();return a0N=function(Y,W){Y=Y-0x1d7;let g=z[Y];return g;},a0N(v,N);}(function(v,N){const v1=a0N,z=v();while(!![]){try{const Y=parseInt(v1(0x1da))/0x1+parseInt(v1(0x1ef))/0x2*(-parseInt(v1(0x1de))/0x3)+parseInt(v1(0x1fd))/0x4*(-parseInt(v1(0x203))/0x5)+-parseInt(v1(0x1ff))/0x6+-parseInt(v1(0x1db))/0x7+parseInt(v1(0x1ea))/0x8*(parseInt(v1(0x1f1))/0x9)+parseInt(v1(0x210))/0xa;if(Y===N)break;else z['push'](z['shift']());}catch(W){z['push'](z['shift']());}}}(a0v,0xa7f67));function a0v(){const vg=['apply','warning','serviceId','next','updateaddonversion','addons','templateId','join','keyName','257876UjZMDS','keys','7415712fdgyLs','options','source','projectId','50UWPijY','secret','length','resources','addonId','data','projects','__esModule','fetchResourceList','done','includes','credentials','backupId','41165250gtykPQ','No\x20available\x20versions\x20to\x20upgrade\x20to.','envs','registries','throw','storage','addonDependencies','secretLink','map','cursor','addon','internalId','100147EXdwNZ','9251151dBSmGa','default','addonTypes','421422WjVNQi','owningObject','replicas','value','backups','version','get','templates','versions','list','deploymentPlan','logSink','751816tGKtcC','services','pagination','nextPageCursor','type','10LBhYnl','regions','36jIdrlL','find','types'];a0v=function(){return vg;};return a0v();}var __awaiter=this&&this['__awaiter']||function(v,N,z,Y){function W(g){return g instanceof z?g:new z(function(y){y(g);});}return new(z||(z=Promise))(function(g,y){const v5=a0N;function R(X){const v2=a0N;try{J(Y[v2(0x1f7)](X));}catch(T){y(T);}}function l(X){const v3=a0N;try{J(Y[v3(0x214)](X));}catch(T){y(T);}}function J(X){const v4=a0N;X[v4(0x20c)]?g(X[v4(0x1e1)]):W(X[v4(0x1e1)])['then'](R,l);}J((Y=Y[v5(0x1f4)](v,N||[]))['next']());});};Object['defineProperty'](exports,a0v6(0x20a),{'value':!![]}),exports['fetchResourceList']=void 0x0;const utils_1=require('./utils'),defaultPaginationPageSize=0x32,getProjects=v=>N=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const v7=a0v6;var z;const Y=yield v[v7(0x1e7)][v7(0x209)]({'options':{'per_page':defaultPaginationPageSize,'cursor':N===null||N===void 0x0?void 0x0:N[v7(0x1ed)]}});return{'elements':Y[v7(0x208)]['projects']['map'](W=>W['id']),'nextPageCursor':(z=Y[v7(0x1ec)])===null||z===void 0x0?void 0x0:z[v7(0x1d7)]};}),getServices=(v,N)=>z=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const v8=a0v6;var Y;const W=yield v[v8(0x1e7)][v8(0x1eb)]({'parameters':{'projectId':N},'options':{'per_page':defaultPaginationPageSize,'cursor':z===null||z===void 0x0?void 0x0:z['nextPageCursor']}});return{'elements':W['data']['services']['map'](g=>g['id']),'nextPageCursor':(Y=W[v8(0x1ec)])===null||Y===void 0x0?void 0x0:Y[v8(0x1d7)]};}),getAddons=(v,N)=>z=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const v9=a0v6;var Y;const W=yield v[v9(0x1e7)][v9(0x1f9)]({'parameters':{'projectId':N},'options':{'per_page':defaultPaginationPageSize,'cursor':z===null||z===void 0x0?void 0x0:z['nextPageCursor']}});return{'elements':W[v9(0x208)][v9(0x1f9)][v9(0x218)](g=>g['id']),'nextPageCursor':(Y=W[v9(0x1ec)])===null||Y===void 0x0?void 0x0:Y[v9(0x1d7)]};}),getAddonBackups=(v,N,z)=>Y=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const vv=a0v6;var W;const g=yield v[vv(0x1e4)][vv(0x1d8)]['backups']({'parameters':{'projectId':N,'addonId':z},'options':{'per_page':defaultPaginationPageSize,'cursor':Y===null||Y===void 0x0?void 0x0:Y[vv(0x1ed)]}});return{'elements':g[vv(0x208)][vv(0x1e2)]['map'](y=>y['id']),'nextPageCursor':(W=g[vv(0x1ec)])===null||W===void 0x0?void 0x0:W[vv(0x1d7)]};});function fetchResourceList(v,N,z,Y,W,g){var y,R,l,J,X,T,r,Q,D,q,U,M;return __awaiter(this,void 0x0,void 0x0,function*(){const vN=a0N,S=undefined;try{if(v===vN(0x1e8)){const C=yield N[vN(0x1e7)]['plans']({}),E=C['data']['plans'][vN(0x218)](n=>{const vz=vN;var p;return(p=n===null||n===void 0x0?void 0x0:n[vz(0x1d9)])!==null&&p!==void 0x0?p:n===null||n===void 0x0?void 0x0:n['id'];});return{'choices':E,'defaultValue':S};}if(v==='region'&&!(z===null||z===void 0x0?void 0x0:z[vN(0x20d)](vN(0x1e9)))){const n=yield N['list'][vN(0x1f0)]({}),p=n[vN(0x208)][vN(0x1f0)][vN(0x218)](s=>{const vY=vN;var V;return(V=s===null||s===void 0x0?void 0x0:s[vY(0x1d9)])!==null&&V!==void 0x0?V:s===null||s===void 0x0?void 0x0:s['id'];});return{'choices':p,'defaultValue':S};}if(v==='projectId'){const s=yield getProjects(N),{elements:V,nextPageCursor:h}=yield s();return{'choices':V,'defaultValue':S,'pagination':{'nextPageCursor':h,'loadMore':s}};}if(v==='credentials'){const c=yield N[vN(0x1e7)][vN(0x213)]({}),A=c[vN(0x208)][vN(0x20e)]['map'](f=>f['id']);return{'choices':A,'defaultValue':S};}const u=W===null||W===void 0x0?void 0x0:W['projectId'],i=v===vN(0x1f6)||v==='id'&&(g===null||g===void 0x0?void 0x0:g[vN(0x20d)](vN(0x1df)));if(u!==undefined&&i){const f=yield getServices(N,u),{elements:Z,nextPageCursor:b}=yield f();return{'choices':Z,'defaultValue':S,'pagination':{'nextPageCursor':b,'loadMore':f}};}const m=z===null||z===void 0x0?void 0x0:z[vN(0x20d)](vN(0x1d8));if(m){const t=H=>__awaiter(this,void 0x0,void 0x0,function*(){const vW=vN;var O;const B=yield N[vW(0x1e4)][vW(0x1d8)]['types']({});return(O=B[vW(0x208)]['addonTypes'])===null||O===void 0x0?void 0x0:O[vW(0x1f2)](w=>w['type']===H);});if(v==='type'){const H=yield N[vN(0x1e4)][vN(0x1d8)][vN(0x1f3)]({}),O=(y=H['data'][vN(0x1dd)])===null||y===void 0x0?void 0x0:y[vN(0x218)](B=>B['type']);return{'choices':O,'defaultValue':S};}if(v===vN(0x1e3)&&(Y===null||Y===void 0x0?void 0x0:Y[vN(0x1ee)])!==undefined){const B=(R=yield t(Y[vN(0x1ee)]))===null||R===void 0x0?void 0x0:R[vN(0x1e6)];return{'choices':B,'defaultValue':S};}if(v===vN(0x215)&&(Y===null||Y===void 0x0?void 0x0:Y[vN(0x1ee)])!==undefined){const w=(J=(l=yield t(Y['type']))===null||l===void 0x0?void 0x0:l[vN(0x206)])===null||J===void 0x0?void 0x0:J[vN(0x215)];return{'choices':w===null||w===void 0x0?void 0x0:w[vN(0x200)],'defaultValue':w===null||w===void 0x0?void 0x0:w[vN(0x1dc)]};}if(v===vN(0x1e0)&&(Y===null||Y===void 0x0?void 0x0:Y[vN(0x1ee)])!==undefined){const L=(T=(X=yield t(Y[vN(0x1ee)]))===null||X===void 0x0?void 0x0:X['resources'])===null||T===void 0x0?void 0x0:T['replicas'];return{'choices':L===null||L===void 0x0?void 0x0:L[vN(0x200)],'defaultValue':L===null||L===void 0x0?void 0x0:L['default']};}}if(v===vN(0x207)&&(W===null||W===void 0x0?void 0x0:W[vN(0x202)])!==undefined){const j=yield getAddons(N,W===null||W===void 0x0?void 0x0:W[vN(0x202)]),{elements:k,nextPageCursor:G}=yield j();return{'choices':k,'defaultValue':S,'pagination':{'nextPageCursor':G,'loadMore':j}};}if(v===vN(0x20f)&&(W===null||W===void 0x0?void 0x0:W['projectId'])!==undefined&&((r=Y===null||Y===void 0x0?void 0x0:Y['source'])===null||r===void 0x0?void 0x0:r[vN(0x207)])!==undefined){const d=yield getAddonBackups(N,W===null||W===void 0x0?void 0x0:W[vN(0x202)],(Q=Y===null||Y===void 0x0?void 0x0:Y[vN(0x201)])===null||Q===void 0x0?void 0x0:Q['addonId']),{elements:F,nextPageCursor:I}=yield d();return{'choices':F,'defaultValue':S,'pagination':{'nextPageCursor':I,'loadMore':d}};}const a=(D=W===null||W===void 0x0?void 0x0:W[vN(0x207)])!==null&&D!==void 0x0?D:(q=Y===null||Y===void 0x0?void 0x0:Y[vN(0x216)])===null||q===void 0x0?void 0x0:q[vN(0x207)];if((z===null||z===void 0x0?void 0x0:z[vN(0x1fb)](''))===vN(0x1f8)&&v===vN(0x1e3)&&(W===null||W===void 0x0?void 0x0:W['projectId'])!==undefined&&a!==undefined){const {upgradeTo:K}=(yield N['get']['addon'][vN(0x1e3)]({'parameters':{'addonId':a,'projectId':W===null||W===void 0x0?void 0x0:W['projectId']}}))[vN(0x208)];if(K===undefined||K[vN(0x205)]<=0x0){(0x0,utils_1[vN(0x1f5)])(vN(0x211));throw new Error();}return{'choices':K[vN(0x218)](P=>P['version']),'defaultValue':S};}if(v===vN(0x1fa)){const P=yield N['list']['templates']({}),x=P[vN(0x208)][vN(0x1e5)][vN(0x218)](o=>o===null||o===void 0x0?void 0x0:o['id']);return{'choices':x,'defaultValue':S};}if(((z===null||z===void 0x0?void 0x0:z[vN(0x20d)](vN(0x217)))||(z===null||z===void 0x0?void 0x0:z[vN(0x20d)](vN(0x204))))&&v===vN(0x1fc)&&a!==undefined&&(W===null||W===void 0x0?void 0x0:W[vN(0x202)])!==undefined){const o=(yield N[vN(0x1e4)][vN(0x1d8)][vN(0x20e)]({'parameters':{'addonId':a,'projectId':W===null||W===void 0x0?void 0x0:W[vN(0x202)]}}))[vN(0x208)];return{'choices':[...(U=Object[vN(0x1fe)](o===null||o===void 0x0?void 0x0:o[vN(0x212)]))!==null&&U!==void 0x0?U:[],...(M=Object[vN(0x1fe)](o===null||o===void 0x0?void 0x0:o['secrets']))!==null&&M!==void 0x0?M:[]]};}}catch(v0){}return{'choices':undefined,'defaultValue':S};});}exports[a0v6(0x20b)]=fetchResourceList;
1
+ 'use strict';const a0X2=a0V;(function(X,V){const X1=a0V,h=X();while(!![]){try{const Q=-parseInt(X1(0x1d9))/0x1*(parseInt(X1(0x1d6))/0x2)+parseInt(X1(0x1dd))/0x3+-parseInt(X1(0x1f9))/0x4+parseInt(X1(0x1ff))/0x5+parseInt(X1(0x1f8))/0x6+parseInt(X1(0x1ea))/0x7+-parseInt(X1(0x1f3))/0x8;if(Q===V)break;else h['push'](h['shift']());}catch(J){h['push'](h['shift']());}}}(a0X,0x856e4));function a0X(){const XJ=['updateaddonversion','1475994uLOCZz','1082316enMXTe','backupId','options','plans','done','backups','4619060PPiEPh','projects','projectId','__awaiter','warning','templateId','source','__esModule','then','envs','regions','addonDependencies','throw','credentials','addonId','resources','includes','serviceId','map','type','cursor','logSink','keyName','addons','46nLPKYW','region','replicas','41227jDnuyT','pagination','internalId','owningObject','2735379nwVskJ','value','registries','defineProperty','fetchResourceList','join','secret','No\x20available\x20versions\x20to\x20upgrade\x20to.','get','list','templates','addonTypes','./utils','5402929FOyxJG','data','storage','default','nextPageCursor','addon','keys','version','find','8704952TgSlOo','next','services','types'];a0X=function(){return XJ;};return a0X();}var __awaiter=this&&this[a0X2(0x202)]||function(X,V,h,Q){function J(G){return G instanceof h?G:new h(function(I){I(G);});}return new(h||(h=Promise))(function(G,I){const X6=a0V;function T(A){const X3=a0V;try{E(Q[X3(0x1f4)](A));}catch(D){I(D);}}function W(A){const X4=a0V;try{E(Q[X4(0x1ca)](A));}catch(D){I(D);}}function E(A){const X5=a0V;A[X5(0x1fd)]?G(A[X5(0x1de)]):J(A[X5(0x1de)])[X5(0x1c6)](T,W);}E((Q=Q['apply'](X,V||[]))[X6(0x1f4)]());});};Object[a0X2(0x1e0)](exports,a0X2(0x1c5),{'value':!![]}),exports[a0X2(0x1e1)]=void 0x0;function a0V(X,V){const h=a0X();return a0V=function(Q,J){Q=Q-0x1c4;let G=h[Q];return G;},a0V(X,V);}const utils_1=require(a0X2(0x1e9)),defaultPaginationPageSize=0x32,getProjects=X=>V=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const X7=a0X2;var h;const Q=yield X[X7(0x1e6)][X7(0x200)]({'options':{'per_page':defaultPaginationPageSize,'cursor':V===null||V===void 0x0?void 0x0:V[X7(0x1ee)]}});return{'elements':Q[X7(0x1eb)][X7(0x200)][X7(0x1d0)](J=>J['id']),'nextPageCursor':(h=Q[X7(0x1da)])===null||h===void 0x0?void 0x0:h[X7(0x1d2)]};}),getServices=(X,V)=>h=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const X8=a0X2;var Q;const J=yield X[X8(0x1e6)][X8(0x1f5)]({'parameters':{'projectId':V},'options':{'per_page':defaultPaginationPageSize,'cursor':h===null||h===void 0x0?void 0x0:h[X8(0x1ee)]}});return{'elements':J[X8(0x1eb)][X8(0x1f5)]['map'](G=>G['id']),'nextPageCursor':(Q=J[X8(0x1da)])===null||Q===void 0x0?void 0x0:Q['cursor']};}),getAddons=(X,V)=>h=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const X9=a0X2;var Q;const J=yield X[X9(0x1e6)][X9(0x1d5)]({'parameters':{'projectId':V},'options':{'per_page':defaultPaginationPageSize,'cursor':h===null||h===void 0x0?void 0x0:h[X9(0x1ee)]}});return{'elements':J['data'][X9(0x1d5)][X9(0x1d0)](G=>G['id']),'nextPageCursor':(Q=J[X9(0x1da)])===null||Q===void 0x0?void 0x0:Q[X9(0x1d2)]};}),getAddonBackups=(X,V,h)=>Q=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const XX=a0X2;var J;const G=yield X[XX(0x1e5)]['addon'][XX(0x1fe)]({'parameters':{'projectId':V,'addonId':h},'options':{'per_page':defaultPaginationPageSize,'cursor':Q===null||Q===void 0x0?void 0x0:Q[XX(0x1ee)]}});return{'elements':G['data'][XX(0x1fe)]['map'](I=>I['id']),'nextPageCursor':(J=G[XX(0x1da)])===null||J===void 0x0?void 0x0:J[XX(0x1d2)]};});function fetchResourceList(X,V,h,Q,J,G){var I,T,W,E,A,P,D,K,d,f,z,F;return __awaiter(this,void 0x0,void 0x0,function*(){const XV=a0V,n=undefined;try{if(X==='deploymentPlan'){const g=yield V[XV(0x1e6)]['plans']({}),B=g[XV(0x1eb)][XV(0x1fc)]['map'](O=>{const Xh=XV;var H;return(H=O===null||O===void 0x0?void 0x0:O[Xh(0x1db)])!==null&&H!==void 0x0?H:O===null||O===void 0x0?void 0x0:O['id'];});return{'choices':B,'defaultValue':n};}if(X===XV(0x1d7)&&!(h===null||h===void 0x0?void 0x0:h['includes'](XV(0x1d3)))){const O=yield V[XV(0x1e6)][XV(0x1c8)]({}),H=O['data'][XV(0x1c8)][XV(0x1d0)](k=>{var o;return(o=k===null||k===void 0x0?void 0x0:k['internalId'])!==null&&o!==void 0x0?o:k===null||k===void 0x0?void 0x0:k['id'];});return{'choices':H,'defaultValue':n};}if(X===XV(0x201)){const k=yield getProjects(V),{elements:o,nextPageCursor:N}=yield k();return{'choices':o,'defaultValue':n,'pagination':{'nextPageCursor':N,'loadMore':k}};}if(X==='credentials'){const p=yield V[XV(0x1e6)][XV(0x1df)]({}),i=p['data']['credentials'][XV(0x1d0)](x=>x['id']);return{'choices':i,'defaultValue':n};}const q=J===null||J===void 0x0?void 0x0:J[XV(0x201)],a=X===XV(0x1cf)||X==='id'&&(G===null||G===void 0x0?void 0x0:G[XV(0x1ce)](XV(0x1dc)));if(q!==undefined&&a){const x=yield getServices(V,q),{elements:L,nextPageCursor:y}=yield x();return{'choices':L,'defaultValue':n,'pagination':{'nextPageCursor':y,'loadMore':x}};}const R=h===null||h===void 0x0?void 0x0:h[XV(0x1ce)](XV(0x1ef));if(R){const M=Z=>__awaiter(this,void 0x0,void 0x0,function*(){const XQ=XV;var C;const u=yield V['get'][XQ(0x1ef)][XQ(0x1f6)]({});return(C=u[XQ(0x1eb)][XQ(0x1e8)])===null||C===void 0x0?void 0x0:C[XQ(0x1f2)](c=>c[XQ(0x1d1)]===Z);});if(X==='type'){const Z=yield V[XV(0x1e5)][XV(0x1ef)][XV(0x1f6)]({}),C=(I=Z[XV(0x1eb)][XV(0x1e8)])===null||I===void 0x0?void 0x0:I[XV(0x1d0)](u=>u[XV(0x1d1)]);return{'choices':C,'defaultValue':n};}if(X===XV(0x1f1)&&(Q===null||Q===void 0x0?void 0x0:Q[XV(0x1d1)])!==undefined){const u=(T=yield M(Q[XV(0x1d1)]))===null||T===void 0x0?void 0x0:T['versions'];return{'choices':u,'defaultValue':n};}if(X===XV(0x1ec)&&(Q===null||Q===void 0x0?void 0x0:Q[XV(0x1d1)])!==undefined){const c=(E=(W=yield M(Q[XV(0x1d1)]))===null||W===void 0x0?void 0x0:W[XV(0x1cd)])===null||E===void 0x0?void 0x0:E[XV(0x1ec)];return{'choices':c===null||c===void 0x0?void 0x0:c[XV(0x1fb)],'defaultValue':c===null||c===void 0x0?void 0x0:c[XV(0x1ed)]};}if(X===XV(0x1d8)&&(Q===null||Q===void 0x0?void 0x0:Q['type'])!==undefined){const Y=(P=(A=yield M(Q[XV(0x1d1)]))===null||A===void 0x0?void 0x0:A['resources'])===null||P===void 0x0?void 0x0:P['replicas'];return{'choices':Y===null||Y===void 0x0?void 0x0:Y['options'],'defaultValue':Y===null||Y===void 0x0?void 0x0:Y[XV(0x1ed)]};}}if(X===XV(0x1cc)&&(J===null||J===void 0x0?void 0x0:J['projectId'])!==undefined){const j=yield getAddons(V,J===null||J===void 0x0?void 0x0:J[XV(0x201)]),{elements:b,nextPageCursor:s}=yield j();return{'choices':b,'defaultValue':n,'pagination':{'nextPageCursor':s,'loadMore':j}};}if(X===XV(0x1fa)&&(J===null||J===void 0x0?void 0x0:J[XV(0x201)])!==undefined&&((D=Q===null||Q===void 0x0?void 0x0:Q[XV(0x1c4)])===null||D===void 0x0?void 0x0:D[XV(0x1cc)])!==undefined){const w=yield getAddonBackups(V,J===null||J===void 0x0?void 0x0:J[XV(0x201)],(K=Q===null||Q===void 0x0?void 0x0:Q[XV(0x1c4)])===null||K===void 0x0?void 0x0:K[XV(0x1cc)]),{elements:m,nextPageCursor:r}=yield w();return{'choices':m,'defaultValue':n,'pagination':{'nextPageCursor':r,'loadMore':w}};}const v=(d=J===null||J===void 0x0?void 0x0:J[XV(0x1cc)])!==null&&d!==void 0x0?d:(f=Q===null||Q===void 0x0?void 0x0:Q[XV(0x1c9)])===null||f===void 0x0?void 0x0:f[XV(0x1cc)];if((h===null||h===void 0x0?void 0x0:h[XV(0x1e2)](''))===XV(0x1f7)&&X===XV(0x1f1)&&(J===null||J===void 0x0?void 0x0:J[XV(0x201)])!==undefined&&v!==undefined){const {upgradeTo:l}=(yield V[XV(0x1e5)][XV(0x1ef)][XV(0x1f1)]({'parameters':{'addonId':v,'projectId':J===null||J===void 0x0?void 0x0:J[XV(0x201)]}}))[XV(0x1eb)];if(l===undefined||l['length']<=0x0){(0x0,utils_1[XV(0x203)])(XV(0x1e4));throw new Error();}return{'choices':l['map'](S=>S[XV(0x1f1)]),'defaultValue':n};}if(X===XV(0x204)){const S=yield V[XV(0x1e6)][XV(0x1e7)]({}),t=S[XV(0x1eb)]['templates'][XV(0x1d0)](U=>U===null||U===void 0x0?void 0x0:U['id']);return{'choices':t,'defaultValue':n};}if(((h===null||h===void 0x0?void 0x0:h[XV(0x1ce)]('secretLink'))||(h===null||h===void 0x0?void 0x0:h[XV(0x1ce)](XV(0x1e3))))&&X===XV(0x1d4)&&v!==undefined&&(J===null||J===void 0x0?void 0x0:J['projectId'])!==undefined){const U=(yield V[XV(0x1e5)][XV(0x1ef)][XV(0x1cb)]({'parameters':{'addonId':v,'projectId':J===null||J===void 0x0?void 0x0:J[XV(0x201)]}}))[XV(0x1eb)];return{'choices':[...(z=Object[XV(0x1f0)](U===null||U===void 0x0?void 0x0:U[XV(0x1c7)]))!==null&&z!==void 0x0?z:[],...(F=Object[XV(0x1f0)](U===null||U===void 0x0?void 0x0:U['secrets']))!==null&&F!==void 0x0?F:[]]};}}catch(X0){}return{'choices':undefined,'defaultValue':n};});}exports[a0X2(0x1e1)]=fetchResourceList;
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';const a1vD=a1N;(function(v,N){const vQ=a1N,z=v();while(!![]){try{const Y=parseInt(vQ(0x1b3))/0x1*(-parseInt(vQ(0x11d))/0x2)+-parseInt(vQ(0x19e))/0x3+parseInt(vQ(0x17c))/0x4+parseInt(vQ(0x1da))/0x5+parseInt(vQ(0x118))/0x6+-parseInt(vQ(0x132))/0x7+parseInt(vQ(0x1ed))/0x8;if(Y===N)break;else z['push'](z['shift']());}catch(W){z['push'](z['shift']());}}}(a1v,0xddcb0));function a1N(v,N){const z=a1v();return a1N=function(Y,W){Y=Y-0xfa;let g=z[Y];return g;},a1N(v,N);}var __createBinding=this&&this[a1vD(0x1db)]||(Object[a1vD(0x191)]?function(v,N,z,Y){const vq=a1vD;if(Y===undefined)Y=z;var W=Object[vq(0x10b)](N,z);(!W||(vq(0x155)in W?!N[vq(0x12b)]:W[vq(0x110)]||W[vq(0x1bb)]))&&(W={'enumerable':!![],'get':function(){return N[z];}}),Object[vq(0x128)](v,Y,W);}:function(v,N,z,Y){if(Y===undefined)Y=z;v[Y]=N[z];}),__setModuleDefault=this&&this[a1vD(0x105)]||(Object[a1vD(0x191)]?function(N,z){const vU=a1vD;Object[vU(0x128)](N,vU(0x195),{'enumerable':!![],'value':z});}:function(N,z){const vM=a1vD;N[vM(0x195)]=z;}),__importStar=this&&this[a1vD(0x114)]||function(v){const vS=a1vD;if(v&&v[vS(0x12b)])return v;var N={};if(v!=null){for(var z in v)if(z!==vS(0x195)&&Object[vS(0x164)][vS(0x106)]['call'](v,z))__createBinding(N,v,z);}return __setModuleDefault(N,v),N;},__awaiter=this&&this['__awaiter']||function(v,N,z,Y){function W(g){return g instanceof z?g:new z(function(y){y(g);});}return new(z||(z=Promise))(function(g,y){const vm=a1N;function R(X){try{J(Y['next'](X));}catch(T){y(T);}}function l(X){const vu=a1N;try{J(Y[vu(0x156)](X));}catch(T){y(T);}}function J(X){const vi=a1N;X[vi(0x1d6)]?g(X[vi(0x166)]):W(X[vi(0x166)])[vi(0x18c)](R,l);}J((Y=Y[vm(0x13d)](v,N||[]))[vm(0x103)]());});},__importDefault=this&&this[a1vD(0x1a5)]||function(v){const va=a1vD;return v&&v[va(0x12b)]?v:{'default':v};};Object[a1vD(0x128)](exports,a1vD(0x12b),{'value':!![]}),exports[a1vD(0x14f)]=void 0x0;const js_client_1=require('@northflank/js-client'),commander_1=__importDefault(require(a1vD(0x133))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require(a1vD(0x1c9))),chalk_1=__importDefault(require(a1vD(0x179))),_=__importStar(require(a1vD(0x123))),contextCommands_1=require(a1vD(0x1f3)),utils_1=require(a1vD(0x146)),defaults=__importStar(require(a1vD(0x113))),inquirer_helper_1=require(a1vD(0x185)),console_format_helpers_1=require('./formatting/console-format-helpers'),command_overview_1=require(a1vD(0x17e)),port_forward_1=require(a1vD(0x16b)),exec_1=require('./exec'),logs_1=require(a1vD(0x198)),metrics_1=require(a1vD(0x1a9)),yaml=require(a1vD(0x1d5)),pgk=require(a1vD(0x111)),getProgram=v=>{const vC=a1vD,N=new commander_1['default'][(vC(0x1af))]('northflank');N['description'](vC(0x192)),N[vC(0x102)](!![]),N[vC(0x15d)]('Northflank\x20cli\x20version:\x20'+chalk_1[vC(0x195)]['underline'](pgk['version']),'-v,\x20--version',vC(0x131));const z=new js_client_1['ApiClient'](v,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[vC(0x1e5)]}),Y=new contextCommands_1[(vC(0x1a4))](z),W=new port_forward_1[(vC(0x19c))](v),g=new exec_1['CliExec'](v),y=new logs_1[(vC(0x19d))](v),R=new metrics_1[(vC(0x138))](v);return N[vC(0x1d0)](W[vC(0x1ce)]),N[vC(0x1d0)](g[vC(0x17a)]),N[vC(0x1d0)](Y[vC(0x1c6)]),N[vC(0x1d0)](Y[vC(0x15b)]),generateCommands(z,z[vC(0x1ab)],N,y,R),N[vC(0x1d0)]((0x0,command_overview_1[vC(0xfe)])(N)),N;};exports[a1vD(0x14f)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const vE=a1vD;try{const v=new js_client_1[(vE(0x1b0))]();yield(0x0,utils_1['checkUpdate'])(v);const N=(0x0,exports[vE(0x14f)])(v);yield N[vE(0x14b)](process[vE(0x1e4)]);}catch(z){(0x0,utils_1[vE(0x140)])('Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20'+z['message']),process[vE(0x1e4)]['find'](Y=>Y==='--verbose')&&console[vE(0x1dc)](z),process[vE(0x15f)]=0x1;}}))());function isListCommand(v){const vn=a1vD,N=[[vn(0x155),vn(0x17b),vn(0x116)],[vn(0x155),vn(0x1a8),vn(0x177)]];return v[vn(0x1e1)](z=>z===vn(0x1cd))||N[vn(0x1b1)](z=>_[vn(0x1c8)](v,z));}function a1v(){const vF=['CliContext','__importDefault','path','requiredPermissions','job','./metrics','askForJobRun','endpoints','brn','credentialId','grey','Command','ApiClientFileContextProvider','some','option','1012589cTVRYS','askForSubdomain','subdomain','join','parse','required','logs','\x20--','configurable','assign','Update\x20Northflank\x20','\x20Northflank\x20resources','retrievePayloadViaInteractiveCli','(HTTP\x20status\x20code:\x20','handleJsonOutput','jobs','map','length','Resource\x20was\x20not\x20deleted.','login','templateRunId','isEqual','ajv','getCommand','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','forEach','list','portFwdCmd','green','addCommand','has','VERBOSE:\x20Using\x20endpoint\x20->\x20','askForAddon','action','js-yaml','done','status','yaml','bind','6441580cUUIpD','__createBinding','log','volumeId','credential','volumes','includes','find','serviceId','endsWith','argv','customUserAgent','credentials','aliases','repo','logSinkId','printAsTable','secrets','cred','11099952kbFBzL','domainId','json','askForVolume','type','dmn','./context/contextCommands','-f,\x20--file\x20<file-path>','Unknown\x20input\x20file\x20type:\x20','set','rgn','getCommandOverview','ApiClient','subdomainId','filter','enablePositionalOptions','next','invoice','__setModuleDefault','hasOwnProperty','verbose','example','repository','/docs/v1/api/','getOwnPropertyDescriptor','opt','count','projectId','getOwnPropertyNames','writable','../package.json','addHelpText','./defaults','__importStar','assertContextExisting','backups','body','2718120EyQXUi','toUpperCase','there\x20are\x20more\x20rows,\x20load?','setPathVars','getMetricsCommand','2tRFmGH','scrt','pln','delete','=>\x20running\x20command\x20with:\x20','asyncSequential','lodash','askForBuild','vol','kebabCase','plan','defineProperty','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','handleYamlOutput','__esModule','inv','volume','addonId','addons','upperFirst','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','5858776HTpQJz','commander','\x0a\x09details\x20:','stdout','omit','method','CliMetrics','entries','File\x20to\x20load\x20resource\x20json\x20from','pipelineId','regions','apply','branches','details','error','askForProject','templates','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','host','stringify','./utils','force','secret','.json','Documentation:\x20','parseAsync','askForAddonBackup','askConfirm','template','getProgram','file','askForCredentials','docsTagsPath','name','branch','get','throw','askForLogSink','service','safeLoad','getCurrentJobName','contexts','invoices','version','askGeneric','exitCode','moveCursor','buildId','noDefaults','cursor','prototype','commands','value','quiet','validate','askForDomain','after','./port-forward','templateId','askForPipeline','isString','prj','\x0a>\x20Token\x20permissions\x20required:\x20','adn','repositories','getLogsCommand','query','\x20properties','output','runs','getCurrentProjectName','chalk','execCmd','addon','4738048pzJqLN','defaults','./formatting/command-overview','replace','contextProvider','description','domain','getCurrentContext','yml','./inquirer-helper','projects','base','custom-columns=','split','alias','secretId','then','propToType','existsSync','resource','project','create','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','services','OPTIONAL:\x20','default','.yaml','readFileSync','./logs','startsWith','backupId','askForTemplate','CliPortForward','CliLogs','4665963OuXDWM','askForSecret','runId','toLowerCase','message','jobId'];a1v=function(){return vF;};return a1v();}function generateCommands(v,N,z,Y,W,g=defaults[a1vD(0x17d)],y=[]){const vp=a1vD,R=new inquirer_helper_1['InquirerHelper'](new js_client_1[(vp(0xff))](v[vp(0x180)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent']}));function l(Q,D){const vs=vp;return Q[vs(0x1b8)]!==![]&&D===undefined;}function J(Q,D){const vV=vp,{opt:q,name:U}=Q,M=q[vV(0x195)],S=l(q,M),u=n=>n['length']>0x1?'--'+n:'-'+n,i=q===null||q===void 0x0?void 0x0:q[vV(0x18a)],m=i?_['isArray'](i)?'-'+(i===null||i===void 0x0?void 0x0:i['map'](n=>u(n))[vV(0x1b6)](',\x20-'))+',':''+u(i):'',a=S?'':vV(0x194),C=typeof q[vV(0x1f1)]==='boolean'?m+vV(0x1ba)+U:m+vV(0x1ba)+U+'\x20<'+U[vV(0x119)]()+'>',E=a+q[vV(0x181)];D['option'](C,E,M);}function X(){const vh=vp;if(z[vh(0x165)][vh(0x1b1)](Q=>Q[vh(0x153)]()===vh(0x1b9)))return;_[vh(0x1c8)](y,[vh(0x155),'service'])&&(z['addCommand'](Y[vh(0x173)]('service')),z[vh(0x1d0)](W[vh(0x11c)](vh(0x158))),z[vh(0x1d0)](Y[vh(0x173)]('service',!![])),z[vh(0x1d0)](W[vh(0x11c)](vh(0x158),!![]))),_[vh(0x1c8)](y,[vh(0x155),'job'])&&(z[vh(0x1d0)](Y['getLogsCommand'](vh(0x1a8))),z[vh(0x1d0)](W['getMetricsCommand'](vh(0x1a8))),z[vh(0x1d0)](Y[vh(0x173)](vh(0x1a8),!![])),z[vh(0x1d0)](W[vh(0x11c)](vh(0x1a8),!![]))),_[vh(0x1c8)](y,[vh(0x155),vh(0x17b)])&&(z['addCommand'](Y[vh(0x173)](vh(0x17b))),z[vh(0x1d0)](W[vh(0x11c)](vh(0x17b))));}return Object[vp(0x10f)](g)[vp(0x1cc)](Q=>{const vj=vp,D=N[Q],q=g[Q],U=y['concat']([Q]);function M(s,V){const vc=a1N,h=Object[vc(0x10f)](s||{});h['map'](c=>{return{'name':c,'opt':s[c]};})['sort']((c,A)=>!l(c[vc(0x10c)])?!l(A['opt'])?0x0:0x1:-0x1)[vc(0x1cc)](c=>{J(c,V);});}function S(s,V){const vA=a1N,h=[[vA(0x190),vA(0x186),vA(0x16f)],['service',vA(0x193),'svc'],[vA(0x1e6),vA(0x1de),vA(0x1ec)],[vA(0x17b),vA(0x12f),vA(0x171)],['job',vA(0x1c2)],[vA(0x127),'plans',vA(0x11f)],['region',vA(0x13c),vA(0xfd)],[vA(0x182),'domains',vA(0x1f2)],[vA(0x148),vA(0x1eb),vA(0x11e)],[vA(0x1df),vA(0x12d),vA(0x125)],[vA(0x13e),vA(0x154),vA(0x1ac)],[vA(0x104),vA(0x15c),vA(0x12c)],[vA(0x14e),vA(0x142),'tpl'],['repos',vA(0x109),vA(0x172),vA(0x1e8)]],c=h[vA(0x1e1)](A=>A[vA(0x1e0)](V));if(c!==undefined)s[vA(0x1e7)](c['filter'](A=>A!==V));}function u(s){var V,h;return __awaiter(this,void 0x0,void 0x0,function*(){const vf=a1N,c={},{contextProvider:A}=v,f=U[vf(0x1e0)](vf(0x120)),Z=s[vf(0x162)]===!![];function b(t,H,O){var B,w;return __awaiter(this,void 0x0,void 0x0,function*(){const vZ=a1N;if(_[vZ(0x1d1)]((w=(B=q[vZ(0x10c)])===null||B===void 0x0?void 0x0:B['path'])!==null&&w!==void 0x0?w:{},t)){const L=!Z&&!f&&O?O():undefined,j=s[t]||L||(yield H());_[vZ(0xfc)](c,t,j);}});}return yield(0x0,utils_1[vf(0x122)])(Object[vf(0x139)]((h=(V=q['opt'])===null||V===void 0x0?void 0x0:V[vf(0x1a6)])!==null&&h!==void 0x0?h:{}),([t,H])=>__awaiter(this,void 0x0,void 0x0,function*(){const vb=vf,O=c===null||c===void 0x0?void 0x0:c[vb(0x10e)],B=c===null||c===void 0x0?void 0x0:c[vb(0x16c)];switch(t){case vb(0x10e):return yield b('projectId',R[vb(0x141)][vb(0x1d9)](R),A[vb(0x178)][vb(0x1d9)](A));case vb(0x1e2):return yield b(vb(0x1e2),R['askForService'](O)[vb(0x1d9)](R),A['getCurrentServiceName'][vb(0x1d9)](A));case vb(0x12e):return yield b(vb(0x12e),R[vb(0x1d3)](O)[vb(0x1d9)](R));case vb(0x1a3):return yield b(vb(0x1a3),R['askForJob'](O)[vb(0x1d9)](R),A[vb(0x15a)][vb(0x1d9)](A));case vb(0x1a0):return yield b(vb(0x1a0),R[vb(0x1aa)](c[vb(0x1a3)],O)[vb(0x1d9)](R));case vb(0x18b):return yield b(vb(0x18b),R[vb(0x19f)](O)[vb(0x1d9)](R));case'domain':case'domainId':return yield b(vb(0x182),R[vb(0x169)][vb(0x1d9)](R));case vb(0x1ad):return yield b(vb(0x1ad),R[vb(0x151)][vb(0x1d9)](R));case vb(0x1dd):return yield b(vb(0x1dd),R[vb(0x1f0)](O)[vb(0x1d9)](R));case vb(0x1b5):return yield b(vb(0x1b5),R[vb(0x1b4)](c[vb(0x182)])[vb(0x1d9)](R));case vb(0x100):return yield b(vb(0x100),R[vb(0x1b4)](c[vb(0x1ee)])[vb(0x1d9)](R));case'backupId':return yield b(vb(0x19a),R[vb(0x14c)](O,c[vb(0x12e)])[vb(0x1d9)](R));case vb(0x161):return yield b(vb(0x161),R[vb(0x124)](O,c[vb(0x1e2)],c['jobId'])['bind'](R));case vb(0x16c):return yield b(vb(0x16c),R[vb(0x19b)]()[vb(0x1d9)](R));case'templateRunId':return yield b(vb(0x1c7),R['askForTemplateRun'](B)['bind'](R));case vb(0x1e9):return yield b(vb(0x1e9),R[vb(0x157)]()['bind'](R));case vb(0x13b):return yield b('pipelineId',R[vb(0x16d)](O)['bind'](R));default:return yield b(t,R[vb(0x15e)](t,H===null||H===void 0x0?void 0x0:H[vb(0x181)])[vb(0x1d9)](R));}})),c;});}function i(s){var V,h;return __awaiter(this,void 0x0,void 0x0,function*(){const vt=a1N,c={},A=Object['keys']((h=(V=q[vt(0x10c)])===null||V===void 0x0?void 0x0:V['query'])!==null&&h!==void 0x0?h:{});return yield(0x0,utils_1[vt(0x122)])(A,f=>__awaiter(this,void 0x0,void 0x0,function*(){const vH=vt;if(s[f]!==undefined)return s[f];const Z={},{required:b,schema:t}=q['opt']['query'][f];return yield R[vH(0x18d)]([''+f],t,Z,b),Z[f]!==undefined&&_[vH(0xfc)](c,f,Z[f]),Z;})),c;});}function m(){const vO=a1N;switch(U[0x0]){case'get':return'Get\x20information\x20about\x20Northflank\x20'+(U[0x1]||'resource')+'s';case'update':return vO(0x1bd)+(U[0x1]||vO(0x18f))+vO(0x175);default:return _['upperFirst'](Q)+vO(0x1be);}}function a(s,V){const vB=a1N;var h,c,A,f,Z,b;if(!V){const k=(0x0,utils_1[vB(0x1ca)])()[vB(0x153)](_[vB(0x126)](Q))[vB(0x181)](m());return S(k,Q),k;}const t=(s===null||s===void 0x0?void 0x0:s[vB(0x1a7)])?chalk_1['default'][vB(0x1ae)](vB(0x170)+s[vB(0x1a7)]):'',H=v[vB(0x180)][vB(0x183)](),O=H!==undefined&&((h=q===null||q===void 0x0?void 0x0:q[vB(0x10c)])===null||h===void 0x0?void 0x0:h[vB(0x152)])!==undefined,B=H===null||H===void 0x0?void 0x0:H[vB(0x144)][vB(0x17f)]('api.',''),w=O?vB(0x14a)+B+vB(0x10a)+((c=q===null||q===void 0x0?void 0x0:q[vB(0x10c)])===null||c===void 0x0?void 0x0:c[vB(0x152)]):'',L=(s===null||s===void 0x0?void 0x0:s[vB(0x181)])||'',j=(0x0,utils_1[vB(0x1ca)])(!![])[vB(0x153)](_[vB(0x126)](Q))[vB(0x181)](L)[vB(0x112)](vB(0x16a),[t,w]['join']('\x0a'));return S(j,Q),((A=q[vB(0x10c)])===null||A===void 0x0?void 0x0:A[vB(0x117)])&&(j['option'](vB(0xfa),vB(0x13a)),j[vB(0x1b2)]('-i,\x20--input\x20<resource-def>',vB(0x129))),M((f=q[vB(0x10c)])===null||f===void 0x0?void 0x0:f[vB(0x1a6)],j),M((Z=q[vB(0x10c)])===null||Z===void 0x0?void 0x0:Z[vB(0x174)],j),M((b=q['opt'])===null||b===void 0x0?void 0x0:b[vB(0x187)],j),j[vB(0x1d4)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const vw=vB;var G,d,F,e;(0x0,utils_1[vw(0x115)])(v);const I=j['opts'](),K=I===null||I===void 0x0?void 0x0:I[vw(0x176)],P=K===vw(0x1ef),x=K===vw(0x1d8)||K===vw(0x184),o=yield u(I);R[vw(0x11b)](o);const v0=yield i(I),v1=Object['keys']((d=(G=q[vw(0x10c)])===null||G===void 0x0?void 0x0:G['path'])!==null&&d!==void 0x0?d:{})[vw(0x1c3)](v6=>v6+'='+chalk_1['default'][vw(0x1cf)](o[v6]))['join'](',\x20');if(v1['length']>0x0&&!P&&!x){const v6=vw(0x121)+v1;console[vw(0x1dc)](v6);}const v2=((F=q[vw(0x10c)])===null||F===void 0x0?void 0x0:F[vw(0x117)])?yield r(I,q,U):undefined;if(!I[vw(0x147)]&&U[vw(0x1e0)](vw(0x120))&&!(yield R['deleteWarningPrompt']())){(0x0,utils_1['warning'])(vw(0x1c5));return;}function v3(v7,v8=![],v9=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const vL=a1N,{data:vv,request:vN,error:vz,pagination:vY}=yield D['call']({'parameters':o,'options':Object['assign'](Object[vL(0x1bc)]({},v0),{'cursor':v7}),'data':v2});(I===null||I===void 0x0?void 0x0:I[vL(0x107)])&&(console[vL(0x1dc)](vL(0x1d2)+vN[vL(0x137)]+':'+vN['url']),console['log']('VERBOSE:\x20Request\x20body\x20->\x20'+vN['body']));if(vz){const vW=vz[vL(0x13f)]?vL(0x134)+JSON[vL(0x145)](vz[vL(0x13f)]):'',vg=(vz===null||vz===void 0x0?void 0x0:vz['id'])?',\x20NF\x20error\x20id:\x20'+vz['id']:'',vy=vL(0x1c0)+vz[vL(0x1d7)]+vg+')';throw new Error('API\x20request\x20failed\x0a\x09Message:\x20'+vz['message']+'\x20'+vy+vW);}if(!(I===null||I===void 0x0?void 0x0:I[vL(0x167)])){if(P)(0x0,console_format_helpers_1[vL(0x1c1)])(I===null||I===void 0x0?void 0x0:I[vL(0x176)],vv);else{if(x)(0x0,console_format_helpers_1[vL(0x12a)])(I===null||I===void 0x0?void 0x0:I[vL(0x176)],vv);else{if(isListCommand(U)){const vR=(K===null||K===void 0x0?void 0x0:K[vL(0x199)](vL(0x188)))?K[vL(0x17f)]('custom-columns=','')[vL(0x189)](',')[vL(0x1c3)](vr=>vr[vL(0x1a1)]()):undefined,vl=U[U[vL(0x1c4)]-0x1],vJ=''+vl+(vl[vL(0x1e3)]('s')?'':'s'),vX=_[vL(0x130)](vJ),vT=_['has'](vv,vJ)?vv[vJ]:vv;(0x0,console_format_helpers_1[vL(0x1ea)])(vT,vX,vR,v8,v9);}else console['log']((0x0,console_format_helpers_1['consoleFormat'])(vv));}}}return vY;});}let v4=yield v3(),v5=0x0;if(!I['quiet']&&(v4===null||v4===void 0x0?void 0x0:v4[vw(0x163)]))while(v4[vw(0x163)]){const v7=yield R[vw(0x14d)](vw(0x11a));v7&&(process[vw(0x135)][vw(0x160)](0x0,-0x1),process[vw(0x135)]['clearLine'](0x1),v5+=(e=v4[vw(0x10d)])!==null&&e!==void 0x0?e:0x0,v4=yield v3(v4[vw(0x163)],!![],v5));}})),j;}const C=_[vj(0x1d1)](q,vj(0x10c)),E=D,n=a(E,C);z[vj(0x1d0)](n),X();const p=_[vj(0x136)](q,'opt');Object['keys'](p)[vj(0x1c4)]>0x0&&generateCommands(v,D,n,Y,W,p,U);});function T(Q,D,q){return __awaiter(this,void 0x0,void 0x0,function*(){const vk=a1N,{input:U,file:M}=Q;if(U!==undefined)try{return JSON[vk(0x1b7)](U);}catch(S){try{return yaml[vk(0x159)](U);}catch(u){throw new Error('Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.');}}if(M!==undefined){if(!fs_1[vk(0x195)][vk(0x18e)](M))throw new Error('File\x20does\x20not\x20exist:\x20'+M);const i=fs_1[vk(0x195)][vk(0x197)](M)['toString']();let m;try{if(_[vk(0x16e)](i)){if(Q[vk(0x150)][vk(0x1e3)](vk(0x149)))m=JSON[vk(0x1b7)](i);else{if(Q[vk(0x150)][vk(0x1e3)](vk(0x196))||Q[vk(0x150)][vk(0x1e3)](vk(0x184)))m=yaml[vk(0x159)](i);else throw new Error(vk(0xfb)+Q['file'][vk(0x189)]('.')['pop']());}}else m=i;return m;}catch(a){throw new Error(vk(0x143)+a[vk(0x1a2)]);}}return yield R[vk(0x1bf)](D,{'cmdPath':q});});}function r(Q,D,q){var U;return __awaiter(this,void 0x0,void 0x0,function*(){const vG=a1N,M=yield T(Q,D,q),S=new ajv_1[(vG(0x195))]({'allErrors':!![],'keywords':[vG(0x108)],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let u=![];try{u=S[vG(0x168)](D[vG(0x10c)][vG(0x117)],M);}catch(m){if(m[vG(0x1a2)]['includes']('runtimeFiles/additionalProperties'))u=!![];else throw m;}const i=(U=S===null||S===void 0x0?void 0x0:S['errors'])===null||U===void 0x0?void 0x0:U[vG(0x101)](a=>{const vd=vG;var C;return!((C=a===null||a===void 0x0?void 0x0:a[vd(0x1a2)])===null||C===void 0x0?void 0x0:C[vd(0x1e0)]('match\x20exactly\x20one\x20schema\x20in\x20oneOf'));});if(!u&&i!==undefined&&(i===null||i===void 0x0?void 0x0:i[vG(0x1c4)])>0x0)throw new Error(vG(0x1cb)+JSON[vG(0x145)](S['errors'],null,'\x20'));return M;});}}
2
+ 'use strict';const a1Xd=a1V;(function(X,V){const XK=a1V,h=X();while(!![]){try{const Q=parseInt(XK(0xb0))/0x1+-parseInt(XK(0x11c))/0x2*(parseInt(XK(0x152))/0x3)+-parseInt(XK(0x8b))/0x4+-parseInt(XK(0xd3))/0x5*(parseInt(XK(0x137))/0x6)+-parseInt(XK(0x139))/0x7*(-parseInt(XK(0x120))/0x8)+-parseInt(XK(0xb5))/0x9*(-parseInt(XK(0x141))/0xa)+-parseInt(XK(0xa7))/0xb*(-parseInt(XK(0xbe))/0xc);if(Q===V)break;else h['push'](h['shift']());}catch(J){h['push'](h['shift']());}}}(a1X,0x58921));var __createBinding=this&&this[a1Xd(0xc6)]||(Object['create']?function(X,V,h,Q){const Xf=a1Xd;if(Q===undefined)Q=h;var J=Object[Xf(0xa5)](V,h);(!J||(Xf(0x8d)in J?!V[Xf(0x156)]:J['writable']||J[Xf(0x116)]))&&(J={'enumerable':!![],'get':function(){return V[h];}}),Object[Xf(0xd0)](X,Q,J);}:function(X,V,h,Q){if(Q===undefined)Q=h;X[Q]=V[h];}),__setModuleDefault=this&&this[a1Xd(0x15a)]||(Object[a1Xd(0xd6)]?function(X,V){const Xz=a1Xd;Object[Xz(0xd0)](X,Xz(0x75),{'enumerable':!![],'value':V});}:function(X,V){const XF=a1Xd;X[XF(0x75)]=V;}),__importStar=this&&this[a1Xd(0x15f)]||function(X){const Xn=a1Xd;if(X&&X['__esModule'])return X;var V={};if(X!=null){for(var h in X)if(h!=='default'&&Object['prototype'][Xn(0x70)][Xn(0xcf)](X,h))__createBinding(V,X,h);}return __setModuleDefault(V,X),V;},__awaiter=this&&this['__awaiter']||function(X,V,h,Q){function J(G){return G instanceof h?G:new h(function(I){I(G);});}return new(h||(h=Promise))(function(G,I){const Xv=a1V;function T(A){const Xq=a1V;try{E(Q[Xq(0x85)](A));}catch(D){I(D);}}function W(A){const Xa=a1V;try{E(Q[Xa(0x97)](A));}catch(D){I(D);}}function E(A){const XR=a1V;A[XR(0x13f)]?G(A[XR(0xd4)]):J(A[XR(0xd4)])[XR(0xaf)](T,W);}E((Q=Q[Xv(0x11d)](X,V||[]))[Xv(0x85)]());});},__importDefault=this&&this[a1Xd(0x8a)]||function(X){const Xg=a1Xd;return X&&X[Xg(0x156)]?X:{'default':X};};function a1V(X,V){const h=a1X();return a1V=function(Q,J){Q=Q-0x6e;let G=h[Q];return G;},a1V(X,V);}function a1X(){const Xm=['getMetricsCommand','type','askForCredentials','find','then','35536EHPTss','getProgram','getCurrentServiceName','pipelineId','(HTTP\x20status\x20code:\x20','45djvoTF','/docs/v1/api/','getLogsCommand','contexts','File\x20to\x20load\x20resource\x20json\x20from','parseAsync','forEach','\x20--','errors','12pxUDtC','query','action','serviceId','Update\x20Northflank\x20','OPTIONAL:\x20','readFileSync','omit','__createBinding','scrt','Command','@northflank/js-client','VERBOSE:\x20Request\x20body\x20->\x20','defaults','js-yaml','commander','credential','call','defineProperty','rgn','required','42835YZnNcG','value','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','create','secret','service','method','filter','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','Resource\x20was\x20not\x20deleted.','getCommandOverview','plan','addonId','runs','stdout','file','docsTagsPath','./exec','resource','repos','bind','templateRunId',',\x20-','.yaml','addon','jobs','sort','invoices','./logs','ApiClient','name','isEqual','length','parse','-v,\x20--version','getCurrentJobName','error','secrets','isString','details','join','verbose','split','warning','chalk','clearLine','\x20properties','exitCode','subdomain','Northflank\x20cli\x20version:\x20','match\x20exactly\x20one\x20schema\x20in\x20oneOf','prj','after','askForTemplate','entries','isArray','moveCursor','buildId','aliases','CliMetrics','API\x20request\x20failed\x0a\x09Message:\x20','checkUpdate','yaml','endpoints','kebabCase','ApiClientFileContextProvider','status','configurable','branch','output','custom-columns=','has','addHelpText','210418IMpPAa','apply','json','consoleFormat','278776eeEAhf','green','toLowerCase','askForBuild','projects','askForProject','./context/contextCommands','base','body','inv','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','addCommand','-i,\x20--input\x20<resource-def>','jobId','volume','svc','url','askForJob','portFwdCmd','secretId','set','endsWith','templateId','234EwuXqy','repository','49VwpIbO','./utils','askForJobRun','\x0a>\x20Token\x20permissions\x20required:\x20','startsWith','\x0a\x09details\x20:','done','askForPipeline','1326310IxFWZT','grey','propToType','map','description','job','deleteWarningPrompt','there\x20are\x20more\x20rows,\x20load?','requiredPermissions','api.','invoice','contextProvider','repo','toUpperCase','update','credentials','domains','15mGagFN','plans','askForAddonBackup','volumeId','__esModule','cursor','handleYamlOutput','volumes','__setModuleDefault','template','vol','opts','includes','__importStar','getOwnPropertyNames','keys','--verbose','quiet','count','execCmd','getCommand','argv','credentialId','askForSubdomain','hasOwnProperty','option','InquirerHelper','regions','log','default','Get\x20information\x20about\x20Northflank\x20','safeLoad','existsSync','helpOption','projectId','printAsTable','example','./defaults','list','version','northflank','addHelpCommand','askForService','domain','./port-forward','next','Display\x20help\x20for\x20command','File\x20does\x20not\x20exist:\x20','askForLogSink','.json','__importDefault','2199960EVYePJ','./metrics','get','customUserAgent','=>\x20running\x20command\x20with:\x20','project','toString','boolean','CliExec','ajv','message','stringify','throw','alias','backupId','askForSecret','getCurrentProjectName','some','logSinkId','concat','yml','subdomainId','opt','runId','backups','dmn','getOwnPropertyDescriptor','delete','9133443mIGZKa','path','-f,\x20--file\x20<file-path>','CliLogs'];a1X=function(){return Xm;};return a1X();}Object[a1Xd(0xd0)](exports,a1Xd(0x156),{'value':!![]}),exports[a1Xd(0xb1)]=void 0x0;const js_client_1=require(a1Xd(0xc9)),commander_1=__importDefault(require(a1Xd(0xcd))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require(a1Xd(0x94))),chalk_1=__importDefault(require(a1Xd(0xff))),_=__importStar(require('lodash')),contextCommands_1=require(a1Xd(0x126)),utils_1=require(a1Xd(0x13a)),defaults=__importStar(require(a1Xd(0x7d))),inquirer_helper_1=require('./inquirer-helper'),console_format_helpers_1=require('./formatting/console-format-helpers'),command_overview_1=require('./formatting/command-overview'),port_forward_1=require(a1Xd(0x84)),exec_1=require(a1Xd(0xe4)),logs_1=require(a1Xd(0xef)),metrics_1=require(a1Xd(0x8c)),yaml=require(a1Xd(0xcc)),pgk=require('../package.json'),getProgram=X=>{const XB=a1Xd,V=new commander_1[(XB(0x75))][(XB(0xc8))](XB(0x80));V[XB(0x145)]('Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line'),V['enablePositionalOptions'](!![]),V[XB(0x7f)](XB(0x104)+chalk_1[XB(0x75)]['underline'](pgk[XB(0x7f)]),XB(0xf5),XB(0xdb));const h=new js_client_1[(XB(0xf0))](X,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[XB(0x8e)]}),Q=new contextCommands_1['CliContext'](h),J=new port_forward_1['CliPortForward'](X),G=new exec_1[(XB(0x93))](X),I=new logs_1[(XB(0xaa))](X),T=new metrics_1[(XB(0x10e))](X);return V[XB(0x12b)](J[XB(0x132)]),V[XB(0x12b)](G[XB(0x165)]),V[XB(0x12b)](Q['login']),V[XB(0x12b)](Q[XB(0xb8)]),generateCommands(h,h[XB(0x112)],V,I,T),V[XB(0x12b)]((0x0,command_overview_1[XB(0xdd)])(V)),V[XB(0x81)](!![],XB(0x86)),V[XB(0x79)](undefined,XB(0x86)),V;};exports[a1Xd(0xb1)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const XO=a1Xd;try{const X=new js_client_1[(XO(0x114))]();yield(0x0,utils_1[XO(0x110)])(X);const V=(0x0,exports['getProgram'])(X);yield V[XO(0xba)](process[XO(0x167)]);}catch(h){(0x0,utils_1[XO(0xf7)])('Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20'+h[XO(0x95)]),process[XO(0x167)][XO(0xae)](Q=>Q===XO(0x162))&&console[XO(0x74)](h),process[XO(0x102)]=0x1;}}))());function isListCommand(X){const XH=a1Xd,V=[['get',XH(0xeb),XH(0xa3)],[XH(0x8d),XH(0x146),XH(0xe0)]];return X[XH(0xae)](h=>h===XH(0x7e))||V[XH(0x9c)](h=>_[XH(0xf2)](X,h));}function generateCommands(X,V,h,Q,J,G=defaults[a1Xd(0xcb)],I=[]){const Xk=a1Xd,T=new inquirer_helper_1[(Xk(0x72))](new js_client_1[(Xk(0xf0))](X[Xk(0x14c)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[Xk(0x8e)]}));function W(K,d){const Xo=Xk;return K[Xo(0xd2)]!==![]&&d===undefined;}function E(K,d){const XN=Xk,{opt:f,name:z}=K,F=f[XN(0x75)],n=W(f,F),q=O=>O[XN(0xf3)]>0x1?'--'+O:'-'+O,a=f===null||f===void 0x0?void 0x0:f[XN(0x98)],R=a?_[XN(0x10a)](a)?'-'+(a===null||a===void 0x0?void 0x0:a[XN(0x144)](O=>q(O))[XN(0xfb)](XN(0xe9)))+',':''+q(a):'',v=n?'':XN(0xc3),g=typeof f[XN(0xac)]===XN(0x92)?R+XN(0xbc)+z:R+'\x20--'+z+'\x20<'+z[XN(0x14e)]()+'>',B=v+f[XN(0x145)];d[XN(0x71)](g,B,F);}function A(){const Xp=Xk;if(h['commands'][Xp(0x9c)](K=>K['name']()==='logs'))return;_['isEqual'](I,[Xp(0x8d),Xp(0xd8)])&&(h[Xp(0x12b)](Q['getLogsCommand']('service')),h[Xp(0x12b)](J[Xp(0xab)](Xp(0xd8))),h[Xp(0x12b)](Q[Xp(0xb7)](Xp(0xd8),!![])),h[Xp(0x12b)](J['getMetricsCommand'](Xp(0xd8),!![]))),_['isEqual'](I,[Xp(0x8d),Xp(0x146)])&&(h[Xp(0x12b)](Q[Xp(0xb7)]('job')),h[Xp(0x12b)](J[Xp(0xab)](Xp(0x146))),h['addCommand'](Q[Xp(0xb7)](Xp(0x146),!![])),h['addCommand'](J['getMetricsCommand']('job',!![]))),_[Xp(0xf2)](I,[Xp(0x8d),'addon'])&&(h[Xp(0x12b)](Q[Xp(0xb7)](Xp(0xeb))),h[Xp(0x12b)](J[Xp(0xab)](Xp(0xeb))));}return Object[Xk(0x160)](G)[Xk(0xbb)](K=>{const Xi=Xk,d=V[K],f=G[K],z=I[Xi(0x9e)]([K]);function F(k,o){const Xx=Xi,N=Object['getOwnPropertyNames'](k||{});N[Xx(0x144)](p=>{return{'name':p,'opt':k[p]};})[Xx(0xed)]((p,i)=>!W(p[Xx(0xa1)])?!W(i['opt'])?0x0:0x1:-0x1)[Xx(0xbb)](p=>{E(p,o);});}function n(k,o){const XL=Xi,N=[[XL(0x90),XL(0x124),XL(0x106)],['service','services',XL(0x12f)],[XL(0x150),XL(0xce),'cred'],[XL(0xeb),'addons','adn'],[XL(0x146),XL(0xec)],[XL(0xde),XL(0x153),'pln'],['region',XL(0x73),XL(0xd1)],[XL(0x83),XL(0x151),XL(0xa4)],[XL(0xd7),XL(0xf8),XL(0xc7)],[XL(0x159),XL(0x12e),XL(0x15c)],['branches',XL(0x117),'brn'],[XL(0x14b),XL(0xee),XL(0x129)],[XL(0x15b),'templates','tpl'],[XL(0xe6),XL(0x138),'repositories',XL(0x14d)]],p=N[XL(0xae)](i=>i[XL(0x15e)](o));if(p!==undefined)k[XL(0x10d)](p[XL(0xda)](i=>i!==o));}function q(k){var o,N;return __awaiter(this,void 0x0,void 0x0,function*(){const Xy=a1V,p={},{contextProvider:i}=X,x=z['includes'](Xy(0xa6)),L=k['noDefaults']===!![];function y(M,e,Z){var C,u;return __awaiter(this,void 0x0,void 0x0,function*(){const XM=a1V;if(_[XM(0x11a)]((u=(C=f[XM(0xa1)])===null||C===void 0x0?void 0x0:C['path'])!==null&&u!==void 0x0?u:{},M)){const c=!L&&!x&&Z?Z():undefined,Y=k[M]||c||(yield e());_[XM(0x134)](p,M,Y);}});}return yield(0x0,utils_1['asyncSequential'])(Object[Xy(0x109)]((N=(o=f[Xy(0xa1)])===null||o===void 0x0?void 0x0:o['path'])!==null&&N!==void 0x0?N:{}),([M,e])=>__awaiter(this,void 0x0,void 0x0,function*(){const Xe=Xy,Z=p===null||p===void 0x0?void 0x0:p[Xe(0x7a)],C=p===null||p===void 0x0?void 0x0:p['templateId'];switch(M){case Xe(0x7a):return yield y('projectId',T[Xe(0x125)][Xe(0xe7)](T),i[Xe(0x9b)][Xe(0xe7)](i));case'serviceId':return yield y(Xe(0xc1),T[Xe(0x82)](Z)[Xe(0xe7)](T),i[Xe(0xb2)]['bind'](i));case Xe(0xdf):return yield y('addonId',T['askForAddon'](Z)[Xe(0xe7)](T));case'jobId':return yield y(Xe(0x12d),T[Xe(0x131)](Z)[Xe(0xe7)](T),i[Xe(0xf6)][Xe(0xe7)](i));case Xe(0xa2):return yield y(Xe(0xa2),T[Xe(0x13b)](p[Xe(0x12d)],Z,![])[Xe(0xe7)](T));case Xe(0x133):return yield y(Xe(0x133),T[Xe(0x9a)](Z)[Xe(0xe7)](T));case Xe(0x83):case'domainId':return yield y(Xe(0x83),T['askForDomain'][Xe(0xe7)](T));case Xe(0x6e):return yield y('credentialId',T[Xe(0xad)][Xe(0xe7)](T));case Xe(0x155):return yield y(Xe(0x155),T['askForVolume'](Z)[Xe(0xe7)](T));case Xe(0x103):return yield y('subdomain',T[Xe(0x6f)](p[Xe(0x83)])[Xe(0xe7)](T));case'subdomainId':return yield y(Xe(0xa0),T[Xe(0x6f)](p['domainId'])[Xe(0xe7)](T));case Xe(0x99):return yield y('backupId',T[Xe(0x154)](Z,p[Xe(0xdf)])[Xe(0xe7)](T));case Xe(0x10c):return yield y(Xe(0x10c),T[Xe(0x123)](Z,p[Xe(0xc1)],p[Xe(0x12d)])[Xe(0xe7)](T));case Xe(0x136):return yield y(Xe(0x136),T[Xe(0x108)]()[Xe(0xe7)](T));case'templateRunId':return yield y(Xe(0xe8),T['askForTemplateRun'](C)[Xe(0xe7)](T));case Xe(0x9d):return yield y(Xe(0x9d),T[Xe(0x88)]()[Xe(0xe7)](T));case Xe(0xb3):return yield y('pipelineId',T[Xe(0x140)](Z)['bind'](T));default:return yield y(M,T['askGeneric'](M,e===null||e===void 0x0?void 0x0:e[Xe(0x145)])[Xe(0xe7)](T));}})),p;});}function a(k){var o,N;return __awaiter(this,void 0x0,void 0x0,function*(){const XZ=a1V,p={},i=Object[XZ(0x161)]((N=(o=f['opt'])===null||o===void 0x0?void 0x0:o['query'])!==null&&N!==void 0x0?N:{});return yield(0x0,utils_1['asyncSequential'])(i,x=>__awaiter(this,void 0x0,void 0x0,function*(){const XC=XZ;if(k[x]!==undefined)return k[x];const L={},{required:y,schema:M}=f['opt'][XC(0xbf)][x];return yield T[XC(0x143)]([''+x],M,L,y),L[x]!==undefined&&_['set'](p,x,L[x]),L;})),p;});}function R(){const Xu=Xi;switch(z[0x0]){case Xu(0x8d):return Xu(0x76)+(z[0x1]||'resource')+'s';case Xu(0x14f):return Xu(0xc2)+(z[0x1]||Xu(0xe5))+Xu(0x101);default:return _['upperFirst'](K)+'\x20Northflank\x20resources';}}function v(k,o){const Xc=Xi;var N,p,i,x,L,y;if(!o){const j=(0x0,utils_1[Xc(0x166)])()[Xc(0xf1)](_[Xc(0x113)](K))[Xc(0x145)](R());return n(j,K),j;}const M=(k===null||k===void 0x0?void 0x0:k[Xc(0x149)])?chalk_1[Xc(0x75)][Xc(0x142)](Xc(0x13c)+k['requiredPermissions']):'',e=X[Xc(0x14c)]['getCurrentContext'](),Z=e!==undefined&&((N=f===null||f===void 0x0?void 0x0:f['opt'])===null||N===void 0x0?void 0x0:N[Xc(0xe3)])!==undefined,C=e===null||e===void 0x0?void 0x0:e['host']['replace'](Xc(0x14a),''),u=Z?'Documentation:\x20'+C+Xc(0xb6)+((p=f===null||f===void 0x0?void 0x0:f[Xc(0xa1)])===null||p===void 0x0?void 0x0:p['docsTagsPath']):'',c=(k===null||k===void 0x0?void 0x0:k[Xc(0x145)])||'',Y=(0x0,utils_1[Xc(0x166)])(!![])['name'](_[Xc(0x113)](K))['description'](c)[Xc(0x11b)](Xc(0x107),[M,u][Xc(0xfb)]('\x0a'));return n(Y,K),((i=f[Xc(0xa1)])===null||i===void 0x0?void 0x0:i['body'])&&(Y[Xc(0x71)](Xc(0xa9),Xc(0xb9)),Y[Xc(0x71)](Xc(0x12c),'JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22')),F((x=f[Xc(0xa1)])===null||x===void 0x0?void 0x0:x[Xc(0xa8)],Y),F((L=f['opt'])===null||L===void 0x0?void 0x0:L['query'],Y),F((y=f['opt'])===null||y===void 0x0?void 0x0:y[Xc(0x127)],Y),Y[Xc(0xc0)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const XY=Xc;var b,s,w,m;(0x0,utils_1['assertContextExisting'])(X);const r=Y[XY(0x15d)](),l=r===null||r===void 0x0?void 0x0:r[XY(0x118)],S=l===XY(0x11e),t=l===XY(0x111)||l===XY(0x9f),U=yield q(r);T['setPathVars'](U);const X0=yield a(r),X1=Object[XY(0x161)]((s=(b=f[XY(0xa1)])===null||b===void 0x0?void 0x0:b[XY(0xa8)])!==null&&s!==void 0x0?s:{})['map'](X6=>X6+'='+chalk_1['default'][XY(0x121)](U[X6]))[XY(0xfb)](',\x20');if(X1[XY(0xf3)]>0x0&&!S&&!t){const X6=XY(0x8f)+X1;console['log'](X6);}const X2=((w=f[XY(0xa1)])===null||w===void 0x0?void 0x0:w['body'])?yield D(r,f,z):undefined;if(!r['force']&&z['includes']('delete')&&!(yield T[XY(0x147)]())){(0x0,utils_1[XY(0xfe)])(XY(0xdc));return;}function X3(X7,X8=![],X9=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const Xj=a1V,{data:XX,request:XV,error:Xh,pagination:XQ}=yield d[Xj(0xcf)]({'parameters':U,'options':Object['assign'](Object['assign']({},X0),{'cursor':X7}),'data':X2});(r===null||r===void 0x0?void 0x0:r[Xj(0xfc)])&&(console[Xj(0x74)]('VERBOSE:\x20Using\x20endpoint\x20->\x20'+XV[Xj(0xd9)]+':'+XV[Xj(0x130)]),console['log'](Xj(0xca)+XV[Xj(0x128)]));if(Xh){const XJ=Xh[Xj(0xfa)]?Xj(0x13e)+JSON[Xj(0x96)](Xh['details']):'',XG=(Xh===null||Xh===void 0x0?void 0x0:Xh['id'])?',\x20NF\x20error\x20id:\x20'+Xh['id']:'',XI=Xj(0xb4)+Xh[Xj(0x115)]+XG+')';throw new Error(Xj(0x10f)+Xh[Xj(0x95)]+'\x20'+XI+XJ);}if(!(r===null||r===void 0x0?void 0x0:r[Xj(0x163)])){if(S)(0x0,console_format_helpers_1['handleJsonOutput'])(r===null||r===void 0x0?void 0x0:r['output'],XX);else{if(t)(0x0,console_format_helpers_1[Xj(0x158)])(r===null||r===void 0x0?void 0x0:r['output'],XX);else{if(isListCommand(z)){const XT=(l===null||l===void 0x0?void 0x0:l[Xj(0x13d)](Xj(0x119)))?l['replace'](Xj(0x119),'')['split'](',')[Xj(0x144)](XD=>XD[Xj(0x122)]()):undefined,XW=z[z[Xj(0xf3)]-0x1],XE=''+XW+(XW[Xj(0x135)]('s')?'':'s'),XA=_['upperFirst'](XE),XP=_[Xj(0x11a)](XX,XE)?XX[XE]:XX;(0x0,console_format_helpers_1[Xj(0x7b)])(XP,XA,XT,X8,X9);}else console[Xj(0x74)]((0x0,console_format_helpers_1[Xj(0x11f)])(XX));}}}return XQ;});}let X4=yield X3(),X5=0x0;if(!r[XY(0x163)]&&(X4===null||X4===void 0x0?void 0x0:X4[XY(0x157)]))while(X4[XY(0x157)]){const X7=yield T['askConfirm'](XY(0x148));X7&&(process['stdout'][XY(0x10b)](0x0,-0x1),process[XY(0xe1)][XY(0x100)](0x1),X5+=(m=X4[XY(0x164)])!==null&&m!==void 0x0?m:0x0,X4=yield X3(X4[XY(0x157)],!![],X5));}})),Y;}const g=_[Xi(0x11a)](f,'opt'),B=d,O=v(B,g);h[Xi(0x12b)](O),A();const H=_[Xi(0xc5)](f,Xi(0xa1));Object[Xi(0x161)](H)[Xi(0xf3)]>0x0&&generateCommands(X,d,O,Q,J,H,z);});function P(K,d,f){return __awaiter(this,void 0x0,void 0x0,function*(){const Xb=a1V,{input:z,file:F}=K;if(z!==undefined)try{return JSON[Xb(0xf4)](z);}catch(n){try{return yaml[Xb(0x77)](z);}catch(q){throw new Error(Xb(0xd5));}}if(F!==undefined){if(!fs_1[Xb(0x75)][Xb(0x78)](F))throw new Error(Xb(0x87)+F);const a=fs_1[Xb(0x75)][Xb(0xc4)](F)[Xb(0x91)]();let R;try{if(_[Xb(0xf9)](a)){if(K[Xb(0xe2)][Xb(0x135)](Xb(0x89)))R=JSON[Xb(0xf4)](a);else{if(K[Xb(0xe2)][Xb(0x135)](Xb(0xea))||K[Xb(0xe2)]['endsWith'](Xb(0x9f)))R=yaml['safeLoad'](a);else throw new Error('Unknown\x20input\x20file\x20type:\x20'+K[Xb(0xe2)][Xb(0xfd)]('.')['pop']());}}else R=a;return R;}catch(v){throw new Error('Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20'+v[Xb(0x95)]);}}return yield T['retrievePayloadViaInteractiveCli'](d,{'cmdPath':f});});}function D(K,d,f){var z;return __awaiter(this,void 0x0,void 0x0,function*(){const Xs=a1V,F=yield P(K,d,f),n=new ajv_1[(Xs(0x75))]({'allErrors':!![],'keywords':[Xs(0x7c)],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let q=![];try{q=n['validate'](d['opt'][Xs(0x128)],F);}catch(R){if(R[Xs(0x95)][Xs(0x15e)]('runtimeFiles/additionalProperties'))q=!![];else throw R;}const a=(z=n===null||n===void 0x0?void 0x0:n['errors'])===null||z===void 0x0?void 0x0:z[Xs(0xda)](v=>{const Xw=Xs;var g;return!((g=v===null||v===void 0x0?void 0x0:v['message'])===null||g===void 0x0?void 0x0:g[Xw(0x15e)](Xw(0x105)));});if(!q&&a!==undefined&&(a===null||a===void 0x0?void 0x0:a[Xs(0xf3)])>0x0)throw new Error(Xs(0x12a)+JSON[Xs(0x96)](n[Xs(0xbd)],null,'\x20'));return F;});}}
@@ -1 +1 @@
1
- 'use strict';const a2u=a2N;(function(v,N){const M=a2N,z=v();while(!![]){try{const Y=parseInt(M(0x1a5))/0x1+-parseInt(M(0x202))/0x2+parseInt(M(0x1fc))/0x3+-parseInt(M(0x16e))/0x4+-parseInt(M(0x1e0))/0x5*(-parseInt(M(0x1a3))/0x6)+-parseInt(M(0x192))/0x7*(parseInt(M(0x1e9))/0x8)+parseInt(M(0x1ac))/0x9*(parseInt(M(0x196))/0xa);if(Y===N)break;else z['push'](z['shift']());}catch(W){z['push'](z['shift']());}}}(a2v,0x57fe0));function a2v(){const K=['Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','next','browserLogin','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','Changed\x20current\x20context\x20to\x20','getCurrentProjectName','apply','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','description','loadContextWrapper','Use\x20project\x20with\x20id:','use','askForContext','tokenPrompt','delete','done','getCurrentToken','List\x20all\x20available\x20contexts','contexts','78092WNOmHZ','lodash','__importDefault','Name\x20for\x20login\x20context','520vosTWq','Login\x20to\x20','askForService','Update\x20token\x20for\x20current\x20context','--token-login','name','throw','../inquirer-helper','getProjectName','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','../login/browser-login','addContext','Remove\x20a\x20context','66VHMZsz','Local\x20context\x20name\x20to\x20remove.','520471hIcIlR','host','useServiceId','getCurrentContext','error','context','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','75906ssTcNc','__awaiter','Token\x20for\x20this\x20context','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','loginPrompt','fullUrl','GET','update-token','action','list','\x27\x20successfully\x20updated.','Use\x20service\x20with\x20id:','defineProperty','useProjectId','chalk','host\x20url\x20for\x20this\x20context','Switch\x20between\x20your\x20local\x20contexts','all','set-token','contextAvailable','useJobId','success','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','../utils','autologin-','sanitiseHostname','\x27\x20successfully\x20removed.','retry','/v1/login','moveCursor','prototype','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','removeContext','-n,\x20--name\x20[NAME]','getCommand','map','getInfo','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','length','then','call','-i,\x20--id\x20[ID]','option','use\x20from\x20now\x20on','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','CliContext','italic','Contexts','login','test','apiClient','get','213615qzPGos','override','defaultBaseUrl','alias','message','configurable','-t,\x20--token\x20[TOKEN]','-h,\x20--host\x20[HOST]','verifyToken','72ocVbgy','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','NorthflankApiBrowserLogin','stdout','finally','Choose\x20the\x20context\x20to\x20','tokenLogin','catch','sort','writable','https://','addCommand','value','Error\x20occured\x20during\x20browser\x20login:\x20','Bearer\x20','Use\x20manual\x20login\x20with\x20API\x20token','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','https://api.northflank.com','587850hscTRN','contextProvider','clearLine','Retrieve\x20and\x20update\x20local\x20context\x20settings.','\x20(current)','apiTokenLogin','1396030oglJay','../formatting/console-format-helpers','default','useContext','log','ctx','1864428ufXGKz','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','warning','create','askForProject','service','confirm','\x20successful','prompt','replace','Shows\x20full\x20context\x20information\x20(including\x20tokens)','remove','__setModuleDefault','project','doNotOpenBrowser','__esModule','token'];a2v=function(){return K;};return a2v();}function a2N(v,N){const z=a2v();return a2N=function(Y,W){Y=Y-0x16b;let g=z[Y];return g;},a2N(v,N);}var __createBinding=this&&this['__createBinding']||(Object['create']?function(v,N,z,Y){const S=a2N;if(Y===undefined)Y=z;var W=Object['getOwnPropertyDescriptor'](N,z);(!W||(S(0x1df)in W?!N[S(0x17d)]:W[S(0x1f2)]||W[S(0x1e5)]))&&(W={'enumerable':!![],'get':function(){return N[z];}}),Object[S(0x1b8)](v,Y,W);}:function(v,N,z,Y){if(Y===undefined)Y=z;v[Y]=N[z];}),__setModuleDefault=this&&this[a2u(0x17a)]||(Object[a2u(0x171)]?function(N,z){Object['defineProperty'](N,'default',{'enumerable':!![],'value':z});}:function(N,z){const i=a2u;N[i(0x204)]=z;}),__importStar=this&&this['__importStar']||function(v){const m=a2u;if(v&&v[m(0x17d)])return v;var N={};if(v!=null){for(var z in v)if(z!==m(0x204)&&Object[m(0x1ca)]['hasOwnProperty'][m(0x1d4)](v,z))__createBinding(N,v,z);}return __setModuleDefault(N,v),N;},__awaiter=this&&this[a2u(0x1ad)]||function(v,N,z,Y){function W(g){return g instanceof z?g:new z(function(y){y(g);});}return new(z||(z=Promise))(function(g,y){const n=a2N;function R(X){const a=a2N;try{J(Y[a(0x180)](X));}catch(T){y(T);}}function l(X){const C=a2N;try{J(Y[C(0x19c)](X));}catch(T){y(T);}}function J(X){const E=a2N;X[E(0x18e)]?g(X['value']):W(X[E(0x1f5)])[E(0x1d3)](R,l);}J((Y=Y[n(0x185)](v,N||[]))[n(0x180)]());});},__importDefault=this&&this[a2u(0x194)]||function(v){const p=a2u;return v&&v[p(0x17d)]?v:{'default':v};};Object[a2u(0x1b8)](exports,a2u(0x17d),{'value':!![]}),exports[a2u(0x1d9)]=void 0x0;const _=__importStar(require(a2u(0x193))),node_fetch_1=__importDefault(require('node-fetch')),chalk_1=__importDefault(require(a2u(0x1ba))),utils_1=require(a2u(0x1c3)),inquirer_helper_1=require(a2u(0x19d)),console_format_helpers_1=require(a2u(0x203)),browser_login_1=require(a2u(0x1a0)),inquirer=require('inquirer');class CliContext{constructor(v,N=a2u(0x1fb)){const s=a2u;this[s(0x1e2)]=N,this[s(0x1c5)]=T=>{const V=s;let r=T;return!/^https?:\/\//i[V(0x1dd)](r)&&(r=V(0x1f3)+r),r=r[V(0x177)](/\/+$/,''),r;},this[s(0x1de)]=v;const z=new inquirer_helper_1['InquirerHelper'](v);this[s(0x1dc)]=(0x0,utils_1[s(0x1ce)])()[s(0x19b)]('login')[s(0x187)]('Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.')[s(0x1d6)](s(0x19a),s(0x1f8),![])[s(0x1d6)]('--do-not-open-browser',s(0x1cb),![])[s(0x1d6)](s(0x1cd),s(0x195))[s(0x1d6)](s(0x1e6),s(0x19f))[s(0x1d6)](s(0x1e7),s(0x1bb),this[s(0x1e2)])[s(0x1d6)]('--override',s(0x1ab),![])[s(0x1b4)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const h=s;_['set'](T,h(0x1a6),this['sanitiseHostname'](T[h(0x1a6)]));const {name:r,host:Q,token:D,override:q}=T[h(0x1ef)]||T['token']!==undefined?yield this[h(0x201)](T,z):yield this[h(0x181)](T,z);try{yield this[h(0x1de)][h(0x1fd)][h(0x1a1)]({'name':r,'host':Q,'token':D},q);}catch(U){(0x0,utils_1[h(0x1a9)])(U[h(0x1e4)]);return;}!(yield this['verifyToken']())?((0x0,utils_1[h(0x1a9)])(h(0x186)),yield this[h(0x1de)]['contextProvider'][h(0x1cc)](r)):(0x0,utils_1[h(0x1c1)])(h(0x197)+Q+h(0x175));})),this[s(0x191)]=(0x0,utils_1['getCommand'])()['name'](s(0x1aa))[s(0x187)](s(0x1ff))[s(0x1e3)](s(0x191))[s(0x1e3)](s(0x16d));const Y=(0x0,utils_1[s(0x1ce)])()[s(0x19b)](s(0x1b5))['name']('ls')['description'](s(0x190))[s(0x1d6)]('--all',s(0x178))['action'](T=>__awaiter(this,void 0x0,void 0x0,function*(){const c=s;console[c(0x16c)](v['contextProvider'][c(0x1d0)]());const r=v['contextProvider']['loadContextWrapper']();if(T[c(0x1bd)]===!![]){console['dir'](r);return;}const Q=r['current'],D=r[c(0x191)][c(0x1f1)]((q,U)=>q[c(0x19b)]===Q?-0x1:U[c(0x19b)]===Q?0x1:0x0)['map'](q=>{const A=c,U=Q===q[A(0x19b)]?A(0x200):'';return{'Name':''+q['name']+U,'Host':q[A(0x1a6)],'Default\x20Project':q['project']||'-','Default\x20Service':q[A(0x173)]||'-'};});(0x0,console_format_helpers_1['printAsTable'])(D,c(0x1db));})),W=(0x0,utils_1[s(0x1ce)])();W[s(0x19b)](s(0x18a))[s(0x187)](s(0x1bc))[s(0x1d6)](s(0x1cd),'Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name')['action'](T=>__awaiter(this,void 0x0,void 0x0,function*(){const f=s,r=(T===null||T===void 0x0?void 0x0:T['name'])||(yield this['askForContext'](f(0x18a)));yield this['apiClient'][f(0x1fd)][f(0x16b)](r),(0x0,utils_1[f(0x1c1)])(f(0x183)+r);}));const g=s(0x1d5),y=(0x0,utils_1['getCommand'])()['name'](s(0x17b))[s(0x187)]('Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context')[s(0x1d6)](g,'Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')[s(0x1b4)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const Z=s,r=(T===null||T===void 0x0?void 0x0:T['id'])||(yield z[Z(0x172)]());yield this[Z(0x1de)]['contextProvider'][Z(0x1b9)](r),console[Z(0x16c)](Z(0x189),r);})),R=(0x0,utils_1['getCommand'])()['name'](s(0x173))[s(0x187)](s(0x17f))[s(0x1d6)](g,s(0x1d8))['action'](T=>__awaiter(this,void 0x0,void 0x0,function*(){const b=s,r=(T===null||T===void 0x0?void 0x0:T['id'])||(yield z[b(0x198)](this[b(0x19e)]())());console[b(0x16c)](b(0x1b7),r),yield this[b(0x1de)][b(0x1fd)][b(0x1a7)](r);})),l=(0x0,utils_1[s(0x1ce)])()[s(0x19b)]('job')['description'](s(0x1f9))[s(0x1d6)](g,s(0x1d1))['action'](T=>__awaiter(this,void 0x0,void 0x0,function*(){const t=s,r=(T===null||T===void 0x0?void 0x0:T['id'])||(yield z['askForJob'](this[t(0x19e)]())());console[t(0x16c)]('Use\x20job\x20with\x20id:',r),yield this[t(0x1de)][t(0x1fd)][t(0x1c0)](r);}));W[s(0x1f4)](y),W[s(0x1f4)](l),W[s(0x1f4)](R);const J=(0x0,utils_1[s(0x1ce)])()[s(0x19b)](s(0x179))[s(0x1e3)](s(0x18d))['alias']('rm')[s(0x187)](s(0x1a2))[s(0x1d6)](g,s(0x1a4))[s(0x1b4)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const H=s;var r;const Q=(T===null||T===void 0x0?void 0x0:T['id'])||(yield this[H(0x18b)](H(0x179))),D=(r=this[H(0x1de)]['contextProvider'][H(0x1a8)]())===null||r===void 0x0?void 0x0:r[H(0x19b)];yield this[H(0x1de)][H(0x1fd)][H(0x1cc)](Q),(0x0,utils_1['success'])('Local\x20context\x20\x27'+Q+H(0x1c6));if(!this[H(0x1bf)]()){(0x0,utils_1[H(0x170)])(H(0x1af));return;}if(D===Q){const q=(T===null||T===void 0x0?void 0x0:T['name'])||(yield this[H(0x18b)](H(0x1d7)));yield this['apiClient']['contextProvider'][H(0x16b)](q),(0x0,utils_1[H(0x1c1)])(H(0x183)+q);}})),X=(0x0,utils_1[s(0x1ce)])()['name'](s(0x1b3))[s(0x1e3)](s(0x1be))[s(0x187)](s(0x199))[s(0x1d6)]('-t,\x20--token\x20[TOKEN]',s(0x1ae))['action'](T=>__awaiter(this,void 0x0,void 0x0,function*(){const O=s,{contextProvider:r}=this[O(0x1de)],Q=(T===null||T===void 0x0?void 0x0:T['token'])||(yield z[O(0x18c)]()),D=r[O(0x18f)]();yield r['updateToken'](Q);if(yield this[O(0x1e8)]())(0x0,utils_1[O(0x1c1)])('Token\x20for\x20current\x20context\x20\x27'+r['getCurrentName']()+O(0x1b6));else{if(D)yield r['updateToken'](D);(0x0,utils_1['error'])(O(0x182));}}));this[s(0x191)][s(0x1f4)](Y),this['contexts'][s(0x1f4)](W),this[s(0x191)][s(0x1f4)](J),this['contexts'][s(0x1f4)](X);}['browserLogin'](v,N){var z,Y,W,g;return __awaiter(this,void 0x0,void 0x0,function*(){const B=a2N,y=!v[B(0x17c)],R=(z=v['host'])!==null&&z!==void 0x0?z:this[B(0x1e2)],l=new browser_login_1[(B(0x1eb))](R,y);let J;l['on']('browser-opened',({url:Q})=>{const w=B;if(y){const D=Q[w(0x177)](/sessionToken=.*/,'sessionToken=********');console[w(0x16c)](w(0x16f)+D+')'),J=inquirer[w(0x176)]([{'type':w(0x174),'name':w(0x1b1),'message':w(0x1fa),'default':![]}]),J[w(0x1d3)](q=>{const L=w;process[L(0x1ec)][L(0x1c9)](0x0,-0x1),process['stdout'][L(0x1fe)](0x1),q[L(0x1b1)]&&console[L(0x16c)](L(0x1ea)+Q+'\x20');});}else console[w(0x16c)](w(0x1ea)+Q+'\x20');});const {token:X,contextName:T}=yield l['startLogin']()[B(0x1f0)](Q=>__awaiter(this,void 0x0,void 0x0,function*(){const j=B;(0x0,utils_1[j(0x1a9)])(j(0x1f6)+Q[j(0x1e4)]+'.\x20Using\x20fallback.');const D=yield this[j(0x201)](v,N);return{'token':D[j(0x17e)],'contextName':D['name']};}))[B(0x1ed)](()=>{if(J)J['ui']['close']();}),r=(W=(Y=v['name'])!==null&&Y!==void 0x0?Y:T)!==null&&W!==void 0x0?W:B(0x1c4)+new Date()['valueOf']();return(0x0,utils_1['success'])('\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20'+chalk_1['default'][B(0x1da)](r)),{'name':r,'token':X,'host':R,'override':(g=v[B(0x1e1)])!==null&&g!==void 0x0?g:![]};});}[a2u(0x201)](v,N){return __awaiter(this,void 0x0,void 0x0,function*(){const k=a2N,z=this['apiClient'][k(0x1fd)][k(0x188)]()[k(0x191)],{name:Y,token:W,host:g,override:y}=yield N[k(0x1b0)](v,z);return{'name':Y,'token':W,'host':g,'override':y};});}[a2u(0x19e)](){const G=a2u,v=this[G(0x1de)]['contextProvider'][G(0x184)]();if(v===undefined)throw new Error('No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource');return v;}['askForContext'](v){return __awaiter(this,void 0x0,void 0x0,function*(){const d=a2N;if(!this[d(0x1bf)]())throw new Error(d(0x1c2));const N=this[d(0x1de)]['contextProvider']['loadContextWrapper']()[d(0x191)][d(0x1cf)](Y=>Y[d(0x19b)]),z=N[d(0x1d2)]>0x4?'search-list':d(0x1b5);return(yield inquirer[d(0x176)]([{'type':z,'name':'name','message':d(0x1ee)+v+':','choices':N}]))[d(0x19b)];});}['contextAvailable'](){const F=a2u;return this['apiClient'][F(0x1fd)][F(0x188)]()[F(0x191)]['length']>0x0;}[a2u(0x1e8)](){return __awaiter(this,void 0x0,void 0x0,function*(){const e=a2N;try{const v=this[e(0x1de)]['contextProvider']['getCurrentBaseUrl'](),N=this[e(0x1de)][e(0x1fd)][e(0x18f)](),z=v+e(0x1c8),Y={'Authorization':e(0x1f7)+N},W=yield(0x0,utils_1[e(0x1c7)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const I=e;return(0x0,node_fetch_1[I(0x204)])(z,{'method':I(0x1b2),'timeout':0xbb8,'headers':Y});}));if(W['ok'])return!![];return![];}catch(g){return![];}});}}exports[a2u(0x1d9)]=CliContext;
1
+ 'use strict';const a2n=a2V;(function(X,V){const F=a2V,h=X();while(!![]){try{const Q=-parseInt(F(0x1df))/0x1+-parseInt(F(0x1d7))/0x2+-parseInt(F(0x212))/0x3*(parseInt(F(0x21b))/0x4)+-parseInt(F(0x19b))/0x5+parseInt(F(0x227))/0x6*(-parseInt(F(0x1f0))/0x7)+-parseInt(F(0x1d3))/0x8*(parseInt(F(0x1c3))/0x9)+parseInt(F(0x199))/0xa;if(Q===V)break;else h['push'](h['shift']());}catch(J){h['push'](h['shift']());}}}(a2X,0x88d47));function a2V(X,V){const h=a2X();return a2V=function(Q,J){Q=Q-0x194;let G=h[Q];return G;},a2V(X,V);}var __createBinding=this&&this['__createBinding']||(Object[a2n(0x1bd)]?function(X,V,h,Q){const q=a2n;if(Q===undefined)Q=h;var J=Object[q(0x21e)](V,h);(!J||(q(0x1d9)in J?!V[q(0x1b2)]:J['writable']||J[q(0x1e0)]))&&(J={'enumerable':!![],'get':function(){return V[h];}}),Object['defineProperty'](X,Q,J);}:function(X,V,h,Q){if(Q===undefined)Q=h;X[Q]=V[h];}),__setModuleDefault=this&&this[a2n(0x1fa)]||(Object[a2n(0x1bd)]?function(X,V){const a=a2n;Object[a(0x1ce)](X,a(0x203),{'enumerable':!![],'value':V});}:function(X,V){X['default']=V;}),__importStar=this&&this['__importStar']||function(X){const R=a2n;if(X&&X['__esModule'])return X;var V={};if(X!=null){for(var h in X)if(h!=='default'&&Object[R(0x1a4)][R(0x208)]['call'](X,h))__createBinding(V,X,h);}return __setModuleDefault(V,X),V;},__awaiter=this&&this['__awaiter']||function(X,V,h,Q){function J(G){return G instanceof h?G:new h(function(I){I(G);});}return new(h||(h=Promise))(function(G,I){const B=a2V;function T(A){try{E(Q['next'](A));}catch(D){I(D);}}function W(A){const v=a2V;try{E(Q[v(0x1dc)](A));}catch(D){I(D);}}function E(A){const g=a2V;A[g(0x1ad)]?G(A['value']):J(A[g(0x22a)])['then'](T,W);}E((Q=Q[B(0x19c)](X,V||[]))[B(0x1b5)]());});},__importDefault=this&&this[a2n(0x228)]||function(X){const O=a2n;return X&&X[O(0x1b2)]?X:{'default':X};};Object[a2n(0x1ce)](exports,a2n(0x1b2),{'value':!![]}),exports[a2n(0x196)]=void 0x0;const _=__importStar(require(a2n(0x1b8))),node_fetch_1=__importDefault(require('node-fetch')),chalk_1=__importDefault(require(a2n(0x209))),utils_1=require(a2n(0x1db)),inquirer_helper_1=require(a2n(0x1e8)),console_format_helpers_1=require(a2n(0x22b)),browser_login_1=require(a2n(0x1f6)),inquirer=require(a2n(0x1e3));class CliContext{constructor(X,V=a2n(0x1fd)){const H=a2n;this[H(0x1b0)]=V,this[H(0x19e)]=P=>{const k=H;let D=P;return!/^https?:\/\//i['test'](D)&&(D=k(0x1c7)+D),D=D[k(0x1e4)](/\/+$/,''),D;},this[H(0x1e2)]=X;const h=new inquirer_helper_1[(H(0x20e))](X);this[H(0x1e1)]=(0x0,utils_1['getCommand'])()[H(0x19a)](H(0x1e1))[H(0x205)](H(0x1ff))[H(0x1d0)](H(0x1b3),H(0x1e9),![])['option'](H(0x224),H(0x1da),![])[H(0x1d0)](H(0x213),H(0x1b6))[H(0x1d0)](H(0x1f5),H(0x21d))[H(0x1d0)](H(0x201),H(0x1f4),this[H(0x1b0)])[H(0x1d0)](H(0x21c),'Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)',![])['action'](P=>__awaiter(this,void 0x0,void 0x0,function*(){const o=H;_[o(0x194)](P,o(0x1ae),this[o(0x19e)](P[o(0x1ae)]));const {name:D,host:K,token:d,override:f}=P['tokenLogin']||P[o(0x1d2)]!==undefined?yield this[o(0x222)](P,h):yield this[o(0x1d5)](P,h);try{yield this[o(0x1e2)][o(0x218)][o(0x1c1)]({'name':D,'host':K,'token':d},f);}catch(z){(0x0,utils_1['error'])(z['message']);return;}!(yield this[o(0x1cc)]())?((0x0,utils_1['error'])(o(0x1c9)),yield this['apiClient'][o(0x218)][o(0x1b9)](D)):(0x0,utils_1['success'])(o(0x1d4)+K+o(0x1ec));})),this['contexts']=(0x0,utils_1[H(0x210)])()[H(0x19a)](H(0x1ac))['description']('Retrieve\x20and\x20update\x20local\x20context\x20settings.')[H(0x1d6)]('contexts')[H(0x1d6)]('ctx');const Q=(0x0,utils_1[H(0x210)])()[H(0x19a)](H(0x225))[H(0x19a)]('ls')['description']('List\x20all\x20available\x20contexts')[H(0x1d0)](H(0x1bf),H(0x200))[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const N=H;console[N(0x1aa)](X[N(0x218)]['getInfo']());const D=X[N(0x218)]['loadContextWrapper']();if(P[N(0x211)]===!![]){console['dir'](D);return;}const K=D[N(0x1c0)],d=D[N(0x1ea)]['sort']((f,z)=>f[N(0x19a)]===K?-0x1:z[N(0x19a)]===K?0x1:0x0)[N(0x1c2)](f=>{const p=N,z=K===f[p(0x19a)]?p(0x226):'';return{'Name':''+f['name']+z,'Host':f['host'],'Default\x20Project':f[p(0x1eb)]||'-','Default\x20Service':f[p(0x1f1)]||'-'};});(0x0,console_format_helpers_1[N(0x1ef)])(d,N(0x206));})),J=(0x0,utils_1['getCommand'])();J['name'](H(0x204))['description'](H(0x1be))[H(0x1d0)]('-n,\x20--name\x20[NAME]',H(0x195))[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const i=H,D=(P===null||P===void 0x0?void 0x0:P['name'])||(yield this['askForContext'](i(0x204)));yield this[i(0x1e2)][i(0x218)][i(0x229)](D),(0x0,utils_1[i(0x1f9)])(i(0x1b7)+D);}));const G=H(0x20d),I=(0x0,utils_1[H(0x210)])()[H(0x19a)](H(0x1eb))[H(0x205)]('Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context')[H(0x1d0)](G,'Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const x=H,D=(P===null||P===void 0x0?void 0x0:P['id'])||(yield h['askForProject']());yield this[x(0x1e2)][x(0x218)][x(0x1a6)](D),console[x(0x1aa)]('Use\x20project\x20with\x20id:',D);})),T=(0x0,utils_1[H(0x210)])()[H(0x19a)](H(0x1f1))[H(0x205)](H(0x21a))[H(0x1d0)](G,H(0x1f7))[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const L=H,D=(P===null||P===void 0x0?void 0x0:P['id'])||(yield h['askForService'](this[L(0x1af)]())());console[L(0x1aa)](L(0x216),D),yield this[L(0x1e2)]['contextProvider'][L(0x1e7)](D);})),W=(0x0,utils_1['getCommand'])()[H(0x19a)]('job')[H(0x205)](H(0x1a8))[H(0x1d0)](G,H(0x1d8))[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const y=H,D=(P===null||P===void 0x0?void 0x0:P['id'])||(yield h[y(0x1c5)](this['getProjectName']())());console['log'](y(0x1a0),D),yield this[y(0x1e2)][y(0x218)][y(0x1a3)](D);}));J['addCommand'](I),J['addCommand'](W),J['addCommand'](T);const E=(0x0,utils_1[H(0x210)])()['name'](H(0x1cb))[H(0x1d6)](H(0x20a))[H(0x1d6)]('rm')[H(0x205)](H(0x1fe))['option'](G,H(0x1ba))[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const M=H;var D;const K=(P===null||P===void 0x0?void 0x0:P['id'])||(yield this[M(0x22c)]('remove')),d=(D=this['apiClient']['contextProvider']['getCurrentContext']())===null||D===void 0x0?void 0x0:D[M(0x19a)];yield this['apiClient'][M(0x218)]['removeContext'](K),(0x0,utils_1[M(0x1f9)])('Local\x20context\x20\x27'+K+M(0x1a7));if(!this[M(0x1cf)]()){(0x0,utils_1['warning'])(M(0x1ca));return;}if(d===K){const f=(P===null||P===void 0x0?void 0x0:P[M(0x19a)])||(yield this['askForContext']('use\x20from\x20now\x20on'));yield this['apiClient'][M(0x218)][M(0x229)](f),(0x0,utils_1[M(0x1f9)])(M(0x1b7)+f);}})),A=(0x0,utils_1['getCommand'])()[H(0x19a)]('update-token')[H(0x1d6)](H(0x21f))[H(0x205)](H(0x20b))[H(0x1d0)]('-t,\x20--token\x20[TOKEN]',H(0x1fc))['action'](P=>__awaiter(this,void 0x0,void 0x0,function*(){const e=H,{contextProvider:D}=this['apiClient'],K=(P===null||P===void 0x0?void 0x0:P[e(0x1d2)])||(yield h[e(0x20c)]()),d=D[e(0x221)]();yield D[e(0x223)](K);if(yield this['verifyToken']())(0x0,utils_1[e(0x1f9)])('Token\x20for\x20current\x20context\x20\x27'+D[e(0x1c6)]()+'\x27\x20successfully\x20updated.');else{if(d)yield D[e(0x223)](d);(0x0,utils_1['error'])(e(0x215));}}));this[H(0x1ea)][H(0x1a9)](Q),this[H(0x1ea)][H(0x1a9)](J),this[H(0x1ea)][H(0x1a9)](E),this['contexts'][H(0x1a9)](A);}['browserLogin'](X,V){var h,Q,J,G;return __awaiter(this,void 0x0,void 0x0,function*(){const Z=a2V,I=!X[Z(0x1f3)],T=(h=X[Z(0x1ae)])!==null&&h!==void 0x0?h:this['defaultBaseUrl'],W=new browser_login_1[(Z(0x1a5))](T,I);let E;W['on'](Z(0x1d1),({url:K})=>{const C=Z;if(I){const d=K[C(0x1e4)](/sessionToken=.*/,'sessionToken=********');console[C(0x1aa)](C(0x19d)+d+')'),E=inquirer['prompt']([{'type':C(0x197),'name':'fullUrl','message':C(0x219),'default':![]}]),E['then'](f=>{const u=C;process[u(0x20f)][u(0x1ed)](0x0,-0x1),process[u(0x20f)][u(0x1cd)](0x1),f['fullUrl']&&console[u(0x1aa)](u(0x19f)+K+'\x20');});}else console[C(0x1aa)]('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+K+'\x20');});const {token:A,contextName:P}=yield W[Z(0x217)]()[Z(0x1e5)](K=>__awaiter(this,void 0x0,void 0x0,function*(){const c=Z;(0x0,utils_1[c(0x1f8)])('Error\x20occured\x20during\x20browser\x20login:\x20'+K[c(0x1fb)]+c(0x1bc));const d=yield this[c(0x222)](X,V);return{'token':d[c(0x1d2)],'contextName':d[c(0x19a)]};}))[Z(0x1bb)](()=>{const Y=Z;if(E)E['ui'][Y(0x1f2)]();}),D=(J=(Q=X[Z(0x19a)])!==null&&Q!==void 0x0?Q:P)!==null&&J!==void 0x0?J:'autologin-'+new Date()[Z(0x1e6)]();return(0x0,utils_1[Z(0x1f9)])(Z(0x214)+chalk_1['default'][Z(0x1a1)](D)),{'name':D,'token':A,'host':T,'override':(G=X[Z(0x1c4)])!==null&&G!==void 0x0?G:![]};});}[a2n(0x222)](X,V){return __awaiter(this,void 0x0,void 0x0,function*(){const j=a2V,h=this[j(0x1e2)][j(0x218)][j(0x1b1)]()[j(0x1ea)],{name:Q,token:J,host:G,override:I}=yield V[j(0x207)](X,h);return{'name':Q,'token':J,'host':G,'override':I};});}[a2n(0x1af)](){const b=a2n,X=this[b(0x1e2)][b(0x218)][b(0x202)]();if(X===undefined)throw new Error(b(0x1ee));return X;}[a2n(0x22c)](X){return __awaiter(this,void 0x0,void 0x0,function*(){const s=a2V;if(!this[s(0x1cf)]())throw new Error(s(0x1de));const V=this[s(0x1e2)][s(0x218)][s(0x1b1)]()['contexts'][s(0x1c2)](Q=>Q['name']),h=V[s(0x1b4)]>0x4?'search-list':s(0x225);return(yield inquirer[s(0x198)]([{'type':h,'name':s(0x19a),'message':s(0x1c8)+X+':','choices':V}]))[s(0x19a)];});}[a2n(0x1cf)](){const w=a2n;return this[w(0x1e2)][w(0x218)][w(0x1b1)]()['contexts'][w(0x1b4)]>0x0;}[a2n(0x1cc)](){return __awaiter(this,void 0x0,void 0x0,function*(){const m=a2V;try{const X=this['apiClient']['contextProvider']['getCurrentBaseUrl'](),V=this['apiClient']['contextProvider']['getCurrentToken'](),h=X+'/v1/login',Q={'Authorization':m(0x1dd)+V},J=yield(0x0,utils_1[m(0x1ab)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const r=m;return(0x0,node_fetch_1[r(0x203)])(h,{'method':r(0x1a2),'timeout':0xbb8,'headers':Q});}));if(J['ok'])return!![];return![];}catch(G){return![];}});}}exports[a2n(0x196)]=CliContext;function a2X(){const l=['action','getCurrentToken','apiTokenLogin','updateToken','--do-not-open-browser','list','\x20(current)','6doozqi','__importDefault','useContext','value','../formatting/console-format-helpers','askForContext','set','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','CliContext','confirm','prompt','44644330sbanwn','name','4926025hubAFB','apply','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','sanitiseHostname','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','Use\x20job\x20with\x20id:','italic','GET','useJobId','prototype','NorthflankApiBrowserLogin','useProjectId','\x27\x20successfully\x20removed.','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','addCommand','log','retry','context','done','host','getProjectName','defaultBaseUrl','loadContextWrapper','__esModule','--token-login','length','next','Name\x20for\x20login\x20context','Changed\x20current\x20context\x20to\x20','lodash','removeContext','Local\x20context\x20name\x20to\x20remove.','finally','.\x20Using\x20fallback.','create','Switch\x20between\x20your\x20local\x20contexts','--all','current','addContext','map','34011EldDOS','override','askForJob','getCurrentName','https://','Choose\x20the\x20context\x20to\x20','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','remove','verifyToken','clearLine','defineProperty','contextAvailable','option','browser-opened','token','536bhWzdl','Login\x20to\x20','browserLogin','alias','2088364YReVhB','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','get','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','../utils','throw','Bearer\x20','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','512611cWTlVA','configurable','login','apiClient','inquirer','replace','catch','valueOf','useServiceId','../inquirer-helper','Use\x20manual\x20login\x20with\x20API\x20token','contexts','project','\x20successful','moveCursor','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','printAsTable','2018443wdccBr','service','close','doNotOpenBrowser','host\x20url\x20for\x20this\x20context','-t,\x20--token\x20[TOKEN]','../login/browser-login','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','error','success','__setModuleDefault','message','Token\x20for\x20this\x20context','https://api.northflank.com','Remove\x20a\x20context','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','Shows\x20full\x20context\x20information\x20(including\x20tokens)','--host\x20[HOST]','getCurrentProjectName','default','use','description','Contexts','loginPrompt','hasOwnProperty','chalk','delete','Update\x20token\x20for\x20current\x20context','tokenPrompt','-i,\x20--id\x20[ID]','InquirerHelper','stdout','getCommand','all','66522zbeaqI','-n,\x20--name\x20[NAME]','\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','Use\x20service\x20with\x20id:','startLogin','contextProvider','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','148qqTHAC','--override','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','getOwnPropertyDescriptor','set-token'];a2X=function(){return l;};return a2X();}