@northflank/cli 0.9.5 → 0.9.6-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 'use strict';function a0f(H,f){const l=a0H();return a0f=function(t,b){t=t-0x183;let i=l[t];return i;},a0f(H,f);}const a0H2=a0f;(function(H,f){const H1=a0f,l=H();while(!![]){try{const t=parseInt(H1(0x1b6))/0x1*(parseInt(H1(0x1c6))/0x2)+parseInt(H1(0x1a5))/0x3*(-parseInt(H1(0x1b7))/0x4)+parseInt(H1(0x1b1))/0x5+-parseInt(H1(0x189))/0x6*(-parseInt(H1(0x192))/0x7)+parseInt(H1(0x190))/0x8+-parseInt(H1(0x1a2))/0x9*(parseInt(H1(0x1a1))/0xa)+parseInt(H1(0x199))/0xb;if(t===f)break;else l['push'](l['shift']());}catch(b){l['push'](l['shift']());}}}(a0H,0xd44ef));var __awaiter=this&&this[a0H2(0x1b4)]||function(H,f,l,t){function b(i){return i instanceof l?i:new l(function(n){n(i);});}return new(l||(l=Promise))(function(i,n){const H6=a0f;function r(Y){const H3=a0f;try{w(t[H3(0x1b5)](Y));}catch(x){n(x);}}function q(Y){const H4=a0f;try{w(t[H4(0x1ab)](Y));}catch(x){n(x);}}function w(Y){const H5=a0f;Y[H5(0x1bb)]?i(Y[H5(0x1b2)]):b(Y[H5(0x1b2)])[H5(0x1ad)](r,q);}w((t=t[H6(0x1b3)](H,f||[]))[H6(0x1b5)]());});};Object[a0H2(0x1a8)](exports,a0H2(0x1a9),{'value':!![]}),exports['fetchResourceList']=void 0x0;const utils_1=require(a0H2(0x195)),defaultPaginationPageSize=0x32,getProjects=H=>f=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const H7=a0H2;var l;const t=yield H['list']['projects']({'options':{'per_page':defaultPaginationPageSize,'cursor':f===null||f===void 0x0?void 0x0:f[H7(0x183)]}});return{'elements':t[H7(0x1af)][H7(0x1c1)]['map'](b=>b['id']),'nextPageCursor':(l=t[H7(0x1be)])===null||l===void 0x0?void 0x0:l[H7(0x1c4)]};}),getServices=(H,f)=>l=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const H8=a0H2;var t;const b=yield H[H8(0x1a0)][H8(0x18f)]({'parameters':{'projectId':f},'options':{'per_page':defaultPaginationPageSize,'cursor':l===null||l===void 0x0?void 0x0:l[H8(0x183)]}});return{'elements':b[H8(0x1af)][H8(0x18f)]['map'](i=>i['id']),'nextPageCursor':(t=b[H8(0x1be)])===null||t===void 0x0?void 0x0:t[H8(0x1c4)]};}),getAddons=(H,f)=>l=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const H9=a0H2;var t;const b=yield H[H9(0x1a0)]['addons']({'parameters':{'projectId':f},'options':{'per_page':defaultPaginationPageSize,'cursor':l===null||l===void 0x0?void 0x0:l[H9(0x183)]}});return{'elements':b['data'][H9(0x188)][H9(0x187)](i=>i['id']),'nextPageCursor':(t=b[H9(0x1be)])===null||t===void 0x0?void 0x0:t[H9(0x1c4)]};}),getAddonBackups=(H,f,l)=>t=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const HH=a0H2;var b;const i=yield H[HH(0x1c3)][HH(0x1aa)][HH(0x18b)]({'parameters':{'projectId':f,'addonId':l},'options':{'per_page':defaultPaginationPageSize,'cursor':t===null||t===void 0x0?void 0x0:t['nextPageCursor']}});return{'elements':i[HH(0x1af)]['backups'][HH(0x187)](n=>n['id']),'nextPageCursor':(b=i[HH(0x1be)])===null||b===void 0x0?void 0x0:b[HH(0x1c4)]};});function fetchResourceList(H,f,l,t,b,i){var n,r,q,w,Y,x,U,m,Q,L,B,T;return __awaiter(this,void 0x0,void 0x0,function*(){const Hf=a0f,X=undefined;try{if(H===Hf(0x1bf)){const V=yield f[Hf(0x1a0)][Hf(0x1a4)]({}),O=V[Hf(0x1af)][Hf(0x1a4)][Hf(0x187)](E=>{const Hl=Hf;var S;return(S=E===null||E===void 0x0?void 0x0:E[Hl(0x185)])!==null&&S!==void 0x0?S:E===null||E===void 0x0?void 0x0:E['id'];});return{'choices':O,'defaultValue':X};}if(H===Hf(0x193)&&!(l===null||l===void 0x0?void 0x0:l[Hf(0x1b0)]('logSink'))){const E=yield f['list']['regions']({}),S=E['data'][Hf(0x1c5)][Hf(0x187)](A=>{const Ht=Hf;var k;return(k=A===null||A===void 0x0?void 0x0:A[Ht(0x185)])!==null&&k!==void 0x0?k:A===null||A===void 0x0?void 0x0:A['id'];});return{'choices':S,'defaultValue':X};}if(H==='projectId'){const A=yield getProjects(f),{elements:k,nextPageCursor:h}=yield A();return{'choices':k,'defaultValue':X,'pagination':{'nextPageCursor':h,'loadMore':A}};}if(H===Hf(0x19e)){const K=yield f[Hf(0x1a0)][Hf(0x18e)]({}),I=K[Hf(0x1af)][Hf(0x19e)][Hf(0x187)](P=>P['id']);return{'choices':I,'defaultValue':X};}const C=b===null||b===void 0x0?void 0x0:b[Hf(0x1a6)],j=H==='serviceId'||H==='id'&&(i===null||i===void 0x0?void 0x0:i['includes'](Hf(0x1c0)));if(C!==undefined&&j){const P=yield getServices(f,C),{elements:Z,nextPageCursor:W}=yield P();return{'choices':Z,'defaultValue':X,'pagination':{'nextPageCursor':W,'loadMore':P}};}const c=l===null||l===void 0x0?void 0x0:l[Hf(0x1b0)]('addon');if(c){const u=g=>__awaiter(this,void 0x0,void 0x0,function*(){const Hb=Hf;var d;const F=yield f[Hb(0x1c3)][Hb(0x1aa)]['types']({});return(d=F[Hb(0x1af)][Hb(0x1c2)])===null||d===void 0x0?void 0x0:d['find'](p=>p[Hb(0x1bd)]===g);});if(H===Hf(0x1bd)){const g=yield f[Hf(0x1c3)][Hf(0x1aa)][Hf(0x194)]({}),d=(n=g[Hf(0x1af)][Hf(0x1c2)])===null||n===void 0x0?void 0x0:n[Hf(0x187)](F=>F[Hf(0x1bd)]);return{'choices':d,'defaultValue':X};}if(H===Hf(0x1ae)&&(t===null||t===void 0x0?void 0x0:t[Hf(0x1bd)])!==undefined){const F=(r=yield u(t[Hf(0x1bd)]))===null||r===void 0x0?void 0x0:r[Hf(0x1ba)];return{'choices':F,'defaultValue':X};}if(H===Hf(0x19d)&&(t===null||t===void 0x0?void 0x0:t['type'])!==undefined){const p=(w=(q=yield u(t[Hf(0x1bd)]))===null||q===void 0x0?void 0x0:q[Hf(0x191)])===null||w===void 0x0?void 0x0:w[Hf(0x19d)];return{'choices':p===null||p===void 0x0?void 0x0:p['options'],'defaultValue':p===null||p===void 0x0?void 0x0:p[Hf(0x1bc)]};}if(H===Hf(0x1c7)&&(t===null||t===void 0x0?void 0x0:t['type'])!==undefined){const a=(x=(Y=yield u(t['type']))===null||Y===void 0x0?void 0x0:Y['resources'])===null||x===void 0x0?void 0x0:x[Hf(0x1c7)];return{'choices':a===null||a===void 0x0?void 0x0:a[Hf(0x1a7)],'defaultValue':a===null||a===void 0x0?void 0x0:a[Hf(0x1bc)]};}}if(H===Hf(0x18c)&&(b===null||b===void 0x0?void 0x0:b[Hf(0x1a6)])!==undefined){const J=yield getAddons(f,b===null||b===void 0x0?void 0x0:b[Hf(0x1a6)]),{elements:o,nextPageCursor:M}=yield J();return{'choices':o,'defaultValue':X,'pagination':{'nextPageCursor':M,'loadMore':J}};}if(H==='backupId'&&(b===null||b===void 0x0?void 0x0:b[Hf(0x1a6)])!==undefined&&((U=t===null||t===void 0x0?void 0x0:t['source'])===null||U===void 0x0?void 0x0:U[Hf(0x18c)])!==undefined){const G=yield getAddonBackups(f,b===null||b===void 0x0?void 0x0:b['projectId'],(m=t===null||t===void 0x0?void 0x0:t[Hf(0x19b)])===null||m===void 0x0?void 0x0:m[Hf(0x18c)]),{elements:N,nextPageCursor:z}=yield G();return{'choices':N,'defaultValue':X,'pagination':{'nextPageCursor':z,'loadMore':G}};}const D=(Q=b===null||b===void 0x0?void 0x0:b['addonId'])!==null&&Q!==void 0x0?Q:(L=t===null||t===void 0x0?void 0x0:t[Hf(0x18a)])===null||L===void 0x0?void 0x0:L[Hf(0x18c)];if((l===null||l===void 0x0?void 0x0:l[Hf(0x18d)](''))===Hf(0x1ac)&&H===Hf(0x1ae)&&(b===null||b===void 0x0?void 0x0:b[Hf(0x1a6)])!==undefined&&D!==undefined){const {upgradeTo:v}=(yield f['get'][Hf(0x1aa)][Hf(0x1ae)]({'parameters':{'addonId':D,'projectId':b===null||b===void 0x0?void 0x0:b[Hf(0x1a6)]}}))[Hf(0x1af)];if(v===undefined||v[Hf(0x1a3)]<=0x0){(0x0,utils_1[Hf(0x1b8)])(Hf(0x19a));throw new Error();}return{'choices':v[Hf(0x187)](R=>R[Hf(0x1ae)]),'defaultValue':X};}if(H===Hf(0x1b9)){const R=yield f[Hf(0x1a0)][Hf(0x19c)]({}),s=R[Hf(0x1af)][Hf(0x19c)]['map'](y=>y===null||y===void 0x0?void 0x0:y['id']);return{'choices':s,'defaultValue':X};}if(((l===null||l===void 0x0?void 0x0:l[Hf(0x1b0)](Hf(0x184)))||(l===null||l===void 0x0?void 0x0:l[Hf(0x1b0)](Hf(0x197))))&&H===Hf(0x198)&&D!==undefined&&(b===null||b===void 0x0?void 0x0:b['projectId'])!==undefined){const y=(yield f[Hf(0x1c3)][Hf(0x1aa)][Hf(0x19e)]({'parameters':{'addonId':D,'projectId':b===null||b===void 0x0?void 0x0:b['projectId']}}))[Hf(0x1af)];return{'choices':[...(B=Object[Hf(0x19f)](y===null||y===void 0x0?void 0x0:y['envs']))!==null&&B!==void 0x0?B:[],...(T=Object['keys'](y===null||y===void 0x0?void 0x0:y[Hf(0x196)]))!==null&&T!==void 0x0?T:[]]};}}catch(H0){}return{'choices':undefined,'defaultValue':X};});}exports[a0H2(0x186)]=fetchResourceList;function a0H(){const Hi=['version','data','includes','1057220VcNqYL','value','apply','__awaiter','next','71MODZkX','628vusGnD','warning','templateId','versions','done','default','type','pagination','deploymentPlan','owningObject','projects','addonTypes','get','cursor','regions','20082hseUMV','replicas','nextPageCursor','secretLink','internalId','fetchResourceList','map','addons','56778sPEfHm','addonDependencies','backups','addonId','join','registries','services','9621112LHyghx','resources','56FNWqKC','region','types','./utils','secrets','secret','keyName','4211911eoaMBO','No\x20available\x20versions\x20to\x20upgrade\x20to.','source','templates','storage','credentials','keys','list','6950260VKfZxu','18FsFXCM','length','plans','6228WuHGSk','projectId','options','defineProperty','__esModule','addon','throw','updateaddonversion','then'];a0H=function(){return Hi;};return a0H();}
1
+ 'use strict';function a0M(N,M){const V=a0N();return a0M=function(L,k){L=L-0xf1;let R=V[L];return R;},a0M(N,M);}const a0N2=a0M;(function(N,M){const N1=a0M,V=N();while(!![]){try{const L=parseInt(N1(0xf2))/0x1*(parseInt(N1(0x103))/0x2)+-parseInt(N1(0x131))/0x3+-parseInt(N1(0x108))/0x4+-parseInt(N1(0x110))/0x5+-parseInt(N1(0x112))/0x6*(parseInt(N1(0xfb))/0x7)+-parseInt(N1(0x115))/0x8+-parseInt(N1(0x11c))/0x9*(-parseInt(N1(0x124))/0xa);if(L===M)break;else V['push'](V['shift']());}catch(k){V['push'](V['shift']());}}}(a0N,0x34f62));var __awaiter=this&&this[a0N2(0x109)]||function(N,M,V,L){function k(R){return R instanceof V?R:new V(function(r){r(R);});}return new(V||(V=Promise))(function(R,r){const N6=a0M;function Q(X){const N3=a0M;try{h(L[N3(0xfc)](X));}catch(u){r(u);}}function z(X){const N4=a0M;try{h(L[N4(0x127)](X));}catch(u){r(u);}}function h(X){const N5=a0M;X[N5(0x104)]?R(X[N5(0x12d)]):k(X[N5(0x12d)])[N5(0x10b)](Q,z);}h((L=L[N6(0xf8)](N,M||[]))[N6(0xfc)]());});};Object['defineProperty'](exports,a0N2(0xf9),{'value':!![]}),exports[a0N2(0xf1)]=void 0x0;const utils_1=require('./utils'),defaultPaginationPageSize=0x32,getProjects=N=>M=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const N7=a0N2;var V;const L=yield N[N7(0x113)][N7(0x12f)]({'options':{'per_page':defaultPaginationPageSize,'cursor':M===null||M===void 0x0?void 0x0:M[N7(0x114)]}});return{'elements':L['data'][N7(0x12f)][N7(0xf5)](k=>k['id']),'nextPageCursor':(V=L[N7(0x123)])===null||V===void 0x0?void 0x0:V['cursor']};}),getServices=(N,M)=>V=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const N8=a0N2;var L;const k=yield N['list']['services']({'parameters':{'projectId':M},'options':{'per_page':defaultPaginationPageSize,'cursor':V===null||V===void 0x0?void 0x0:V['nextPageCursor']}});return{'elements':k[N8(0xf7)][N8(0x102)][N8(0xf5)](R=>R['id']),'nextPageCursor':(L=k[N8(0x123)])===null||L===void 0x0?void 0x0:L['cursor']};}),getAddons=(N,M)=>V=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const N9=a0N2;var L;const k=yield N[N9(0x113)][N9(0x12a)]({'parameters':{'projectId':M},'options':{'per_page':defaultPaginationPageSize,'cursor':V===null||V===void 0x0?void 0x0:V[N9(0x114)]}});return{'elements':k[N9(0xf7)]['addons'][N9(0xf5)](R=>R['id']),'nextPageCursor':(L=k['pagination'])===null||L===void 0x0?void 0x0:L[N9(0x11a)]};}),getAddonBackups=(N,M,V)=>L=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const NN=a0N2;var k;const R=yield N[NN(0x116)][NN(0xf6)][NN(0x101)]({'parameters':{'projectId':M,'addonId':V},'options':{'per_page':defaultPaginationPageSize,'cursor':L===null||L===void 0x0?void 0x0:L['nextPageCursor']}});return{'elements':R[NN(0xf7)][NN(0x101)][NN(0xf5)](r=>r['id']),'nextPageCursor':(k=R['pagination'])===null||k===void 0x0?void 0x0:k[NN(0x11a)]};});function a0N(){const NR=['projects','updateaddonversion','438999itiiMA','fetchResourceList','288EtuhOr','envs','serviceId','map','addon','data','apply','__esModule','deploymentPlan','1227121cbGiuP','next','logSink','source','secretLink','replicas','backups','services','1556gMjlQF','done','No\x20available\x20versions\x20to\x20upgrade\x20to.','type','internalId','373504mLXaTr','__awaiter','projectId','then','region','options','keys','owningObject','52865GTvIvy','includes','12vAJABe','list','nextPageCursor','1851368goexap','get','find','version','types','cursor','templateId','2925QkVDUk','addonId','regions','templates','storage','resources','addonDependencies','pagination','25390kXsBCm','credentials','addonTypes','throw','length','plans','addons','join','versions','value','default'];a0N=function(){return NR;};return a0N();}function fetchResourceList(N,M,V,L,k,R){var r,Q,z,h,X,u,p,F,S,b,s,y;return __awaiter(this,void 0x0,void 0x0,function*(){const NM=a0M,c=undefined;try{if(N===NM(0xfa)){const I=yield M['list'][NM(0x129)]({}),d=I[NM(0xf7)][NM(0x129)]['map'](v=>{const NV=NM;var a;return(a=v===null||v===void 0x0?void 0x0:v[NV(0x107)])!==null&&a!==void 0x0?a:v===null||v===void 0x0?void 0x0:v['id'];});return{'choices':d,'defaultValue':c};}if(N===NM(0x10c)&&!(V===null||V===void 0x0?void 0x0:V[NM(0x111)](NM(0xfd)))){const v=yield M[NM(0x113)][NM(0x11e)]({}),a=v[NM(0xf7)][NM(0x11e)][NM(0xf5)](l=>{const NL=NM;var o;return(o=l===null||l===void 0x0?void 0x0:l[NL(0x107)])!==null&&o!==void 0x0?o:l===null||l===void 0x0?void 0x0:l['id'];});return{'choices':a,'defaultValue':c};}if(N===NM(0x10a)){const l=yield getProjects(M),{elements:o,nextPageCursor:t}=yield l();return{'choices':o,'defaultValue':c,'pagination':{'nextPageCursor':t,'loadMore':l}};}if(N==='credentials'){const g=yield M[NM(0x113)]['registries']({}),m=g[NM(0xf7)][NM(0x125)][NM(0xf5)](W=>W['id']);return{'choices':m,'defaultValue':c};}const T=k===null||k===void 0x0?void 0x0:k[NM(0x10a)],U=N===NM(0xf4)||N==='id'&&(R===null||R===void 0x0?void 0x0:R[NM(0x111)](NM(0x10f)));if(T!==undefined&&U){const W=yield getServices(M,T),{elements:x,nextPageCursor:K}=yield W();return{'choices':x,'defaultValue':c,'pagination':{'nextPageCursor':K,'loadMore':W}};}const Z=V===null||V===void 0x0?void 0x0:V['includes'](NM(0xf6));if(Z){const A=f=>__awaiter(this,void 0x0,void 0x0,function*(){const Nk=NM;var G;const q=yield M[Nk(0x116)][Nk(0xf6)][Nk(0x119)]({});return(G=q[Nk(0xf7)]['addonTypes'])===null||G===void 0x0?void 0x0:G[Nk(0x117)](i=>i['type']===f);});if(N===NM(0x106)){const f=yield M[NM(0x116)]['addon'][NM(0x119)]({}),G=(r=f[NM(0xf7)][NM(0x126)])===null||r===void 0x0?void 0x0:r[NM(0xf5)](q=>q[NM(0x106)]);return{'choices':G,'defaultValue':c};}if(N===NM(0x118)&&(L===null||L===void 0x0?void 0x0:L[NM(0x106)])!==undefined){const q=(Q=yield A(L['type']))===null||Q===void 0x0?void 0x0:Q[NM(0x12c)];return{'choices':q,'defaultValue':c};}if(N===NM(0x120)&&(L===null||L===void 0x0?void 0x0:L['type'])!==undefined){const i=(h=(z=yield A(L[NM(0x106)]))===null||z===void 0x0?void 0x0:z[NM(0x121)])===null||h===void 0x0?void 0x0:h[NM(0x120)];return{'choices':i===null||i===void 0x0?void 0x0:i[NM(0x10d)],'defaultValue':i===null||i===void 0x0?void 0x0:i['default']};}if(N===NM(0x100)&&(L===null||L===void 0x0?void 0x0:L[NM(0x106)])!==undefined){const w=(u=(X=yield A(L[NM(0x106)]))===null||X===void 0x0?void 0x0:X['resources'])===null||u===void 0x0?void 0x0:u[NM(0x100)];return{'choices':w===null||w===void 0x0?void 0x0:w[NM(0x10d)],'defaultValue':w===null||w===void 0x0?void 0x0:w[NM(0x12e)]};}}if(N===NM(0x11d)&&(k===null||k===void 0x0?void 0x0:k['projectId'])!==undefined){const E=yield getAddons(M,k===null||k===void 0x0?void 0x0:k['projectId']),{elements:D,nextPageCursor:Y}=yield E();return{'choices':D,'defaultValue':c,'pagination':{'nextPageCursor':Y,'loadMore':E}};}if(N==='backupId'&&(k===null||k===void 0x0?void 0x0:k[NM(0x10a)])!==undefined&&((p=L===null||L===void 0x0?void 0x0:L['source'])===null||p===void 0x0?void 0x0:p['addonId'])!==undefined){const J=yield getAddonBackups(M,k===null||k===void 0x0?void 0x0:k[NM(0x10a)],(F=L===null||L===void 0x0?void 0x0:L[NM(0xfe)])===null||F===void 0x0?void 0x0:F[NM(0x11d)]),{elements:j,nextPageCursor:P}=yield J();return{'choices':j,'defaultValue':c,'pagination':{'nextPageCursor':P,'loadMore':J}};}const n=(S=k===null||k===void 0x0?void 0x0:k[NM(0x11d)])!==null&&S!==void 0x0?S:(b=L===null||L===void 0x0?void 0x0:L[NM(0x122)])===null||b===void 0x0?void 0x0:b[NM(0x11d)];if((V===null||V===void 0x0?void 0x0:V[NM(0x12b)](''))===NM(0x130)&&N===NM(0x118)&&(k===null||k===void 0x0?void 0x0:k['projectId'])!==undefined&&n!==undefined){const {upgradeTo:H}=(yield M['get'][NM(0xf6)]['version']({'parameters':{'addonId':n,'projectId':k===null||k===void 0x0?void 0x0:k[NM(0x10a)]}}))['data'];if(H===undefined||H[NM(0x128)]<=0x0){(0x0,utils_1['warning'])(NM(0x105));throw new Error();}return{'choices':H[NM(0xf5)](B=>B[NM(0x118)]),'defaultValue':c};}if(N===NM(0x11b)){const B=yield M[NM(0x113)][NM(0x11f)]({}),O=B['data']['templates'][NM(0xf5)](C=>C===null||C===void 0x0?void 0x0:C['id']);return{'choices':O,'defaultValue':c};}if(((V===null||V===void 0x0?void 0x0:V[NM(0x111)](NM(0xff)))||(V===null||V===void 0x0?void 0x0:V[NM(0x111)]('secret')))&&N==='keyName'&&n!==undefined&&(k===null||k===void 0x0?void 0x0:k[NM(0x10a)])!==undefined){const C=(yield M['get'][NM(0xf6)][NM(0x125)]({'parameters':{'addonId':n,'projectId':k===null||k===void 0x0?void 0x0:k[NM(0x10a)]}}))[NM(0xf7)];return{'choices':[...(s=Object[NM(0x10e)](C===null||C===void 0x0?void 0x0:C[NM(0xf3)]))!==null&&s!==void 0x0?s:[],...(y=Object[NM(0x10e)](C===null||C===void 0x0?void 0x0:C['secrets']))!==null&&y!==void 0x0?y:[]]};}}catch(N0){}return{'choices':undefined,'defaultValue':c};});}exports[a0N2(0xf1)]=fetchResourceList;
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';const a1Hx=a1f;(function(H,f){const HY=a1f,l=H();while(!![]){try{const t=parseInt(HY(0x12f))/0x1+-parseInt(HY(0x15d))/0x2*(-parseInt(HY(0x11f))/0x3)+-parseInt(HY(0x14b))/0x4*(parseInt(HY(0x12b))/0x5)+-parseInt(HY(0x95))/0x6+parseInt(HY(0x120))/0x7+parseInt(HY(0x16d))/0x8+parseInt(HY(0xf1))/0x9*(parseInt(HY(0x104))/0xa);if(t===f)break;else l['push'](l['shift']());}catch(b){l['push'](l['shift']());}}}(a1H,0x3133d));var __createBinding=this&&this['__createBinding']||(Object[a1Hx(0x186)]?function(H,f,l,t){const HU=a1Hx;if(t===undefined)t=l;var b=Object[HU(0xad)](f,l);(!b||('get'in b?!f[HU(0x9a)]:b[HU(0x147)]||b[HU(0xa7)]))&&(b={'enumerable':!![],'get':function(){return f[l];}}),Object[HU(0x148)](H,t,b);}:function(H,f,l,t){if(t===undefined)t=l;H[t]=f[l];}),__setModuleDefault=this&&this[a1Hx(0x17f)]||(Object[a1Hx(0x186)]?function(H,f){const Hm=a1Hx;Object[Hm(0x148)](H,Hm(0x15a),{'enumerable':!![],'value':f});}:function(H,f){const HQ=a1Hx;H[HQ(0x15a)]=f;}),__importStar=this&&this[a1Hx(0x123)]||function(H){const HL=a1Hx;if(H&&H['__esModule'])return H;var f={};if(H!=null){for(var l in H)if(l!=='default'&&Object[HL(0xcf)][HL(0x172)]['call'](H,l))__createBinding(f,H,l);}return __setModuleDefault(f,H),f;},__awaiter=this&&this[a1Hx(0x124)]||function(H,f,l,t){function b(i){return i instanceof l?i:new l(function(n){n(i);});}return new(l||(l=Promise))(function(i,n){const HT=a1f;function r(Y){try{w(t['next'](Y));}catch(x){n(x);}}function q(Y){try{w(t['throw'](Y));}catch(x){n(x);}}function w(Y){const HB=a1f;Y[HB(0x135)]?i(Y[HB(0xc4)]):b(Y[HB(0xc4)])[HB(0x139)](r,q);}w((t=t[HT(0x109)](H,f||[]))[HT(0xbb)]());});},__importDefault=this&&this[a1Hx(0x13b)]||function(H){const HX=a1Hx;return H&&H[HX(0x9a)]?H:{'default':H};};Object['defineProperty'](exports,a1Hx(0x9a),{'value':!![]}),exports[a1Hx(0xe2)]=void 0x0;function a1f(H,f){const l=a1H();return a1f=function(t,b){t=t-0x92;let i=l[t];return i;},a1f(H,f);}const js_client_1=require(a1Hx(0x17e)),commander_1=__importDefault(require(a1Hx(0x102))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require(a1Hx(0x175))),chalk_1=__importDefault(require(a1Hx(0x9f))),_=__importStar(require(a1Hx(0xf6))),contextCommands_1=require('./context/contextCommands'),utils_1=require('./utils'),defaults=__importStar(require(a1Hx(0xeb))),inquirer_helper_1=require(a1Hx(0xb2)),console_format_helpers_1=require(a1Hx(0xe4)),command_overview_1=require(a1Hx(0xee)),port_forward_1=require(a1Hx(0x132)),exec_1=require(a1Hx(0x162)),yaml=require(a1Hx(0xa5)),pgk=require(a1Hx(0x12e)),getProgram=H=>{const HC=a1Hx,f=new commander_1[(HC(0x15a))]['Command'](HC(0x17b));f[HC(0x106)](HC(0x140)),f[HC(0xaf)](!![]),f['version'](HC(0xa6)+chalk_1[HC(0x15a)][HC(0xe7)](pgk[HC(0x117)]),HC(0xc1),HC(0x15f));const l=new js_client_1[(HC(0x16f))](H,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[HC(0x168)]}),t=new contextCommands_1[(HC(0x178))](l),b=new port_forward_1[(HC(0x15b))](H),i=new exec_1[(HC(0xd8))](H);return f['addCommand'](b[HC(0x16b)]),f[HC(0xda)](i[HC(0xd5)]),f[HC(0xda)](t['login']),f[HC(0xda)](t[HC(0x163)]),generateCommands(l,l['endpoints'],f),f[HC(0xda)]((0x0,command_overview_1[HC(0x107)])(f)),f;};function a1H(){const HF=['readFileSync','VERBOSE:\x20Using\x20endpoint\x20->\x20','askForJobRun','projectId','commander','domain','236960LfnMPu','argv','description','getCommandOverview','type','apply','alias','dmn','assign','errors','credential','subdomainId','length','find','log','validate','askForAddon','\x20properties','asyncSequential','version','consoleFormat','askForSubdomain','exitCode','domains','/docs/v1/api/','action','resource','6qgoZJC','750323SfWwiP','isString','set','__importStar','__awaiter','OPTIONAL:\x20','propToType','=>\x20running\x20command\x20with:\x20','Get\x20information\x20about\x20Northflank\x20','cred','askGeneric','1313805HVsdgY','message','serviceId','../package.json','163108LUyykZ','inv','svc','./port-forward','getCurrentServiceName','askForCredentials','done','getCommand','--verbose','invoices','then','sort','__importDefault','has','error','runId','join','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','map','repositories','askForLogSink','service','kebabCase','base','writable','defineProperty','opts','(HTTP\x20status\x20code:\x20','4ISTkdm','path','secret','defaults','job','plan','prj','parse','backupId','askForProject','count','parseAsync','bind','repo','volumes','default','CliPortForward','askForPipeline','818AiGbFC','projects','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','aliases','addon','./exec','contexts','jobId','toString','split','filter','customUserAgent','includes','delete','portFwdCmd','backups','2986368gKsIMl','project','ApiClient','buildId','jobs','hasOwnProperty','cursor','existsSync','ajv','replace','.json','CliContext','contextProvider','addHelpText','northflank','startsWith','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','@northflank/js-client','__setModuleDefault','domainId','askForSecret','getCurrentProjectName','secretId','templateRunId','InquirerHelper','create','templateId','region','after','1649406KZWxES','secrets','addonId','pipelineId',',\x20NF\x20error\x20id:\x20','__esModule','runs','api.','toUpperCase','upperFirst','chalk','stdout','addons','pop','query','call','js-yaml','Northflank\x20cli\x20version:\x20','configurable','runtimeFiles/additionalProperties','credentialId','file','opt','stringify','getOwnPropertyDescriptor','some','enablePositionalOptions','clearLine','get','./inquirer-helper','isEqual','templates','tpl','requiredPermissions','assertContextExisting','url','json','entries','next','askConfirm','option','getOwnPropertyNames','details','printAsTable','-v,\x20--version','volumeId','logSinkId','value','askForBuild','scrt','-i,\x20--input\x20<resource-def>','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','API\x20request\x20failed\x0a\x09Message:\x20','askForTemplate','keys','Resource\x20was\x20not\x20deleted.','plans','yml','prototype','-f,\x20--file\x20<file-path>','warning',',\x20-','green','repos','execCmd','askForAddonBackup','boolean','CliExec','volume','addCommand','deleteWarningPrompt','File\x20does\x20not\x20exist:\x20','subdomain','concat','askForVolume','safeLoad','endsWith','getProgram','\x20--','./console-format-helpers','quiet','askForDomain','underline','isArray','method','.yaml','./defaults','host','verbose','./command-overview','forEach','name','36ZxaZFZ','setPathVars','omit','File\x20to\x20load\x20resource\x20json\x20from','credentials','lodash','body','branches','services','force','list','invoice','\x0a\x09details\x20:'];a1H=function(){return HF;};return a1H();}exports[a1Hx(0xe2)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Hj=a1Hx;try{const H=new js_client_1['ApiClientFileContextProvider']();yield(0x0,utils_1['checkUpdate'])(H);const f=(0x0,exports[Hj(0xe2)])(H);yield f[Hj(0x156)](process[Hj(0x105)]);}catch(l){(0x0,utils_1[Hj(0x13d)])('Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20'+l[Hj(0x12c)]),process['argv'][Hj(0x111)](t=>t===Hj(0x137))&&console[Hj(0x112)](l),process[Hj(0x11a)]=0x1;}}))());function isListCommand(H){const Hc=a1Hx,f=[[Hc(0xb1),'addon',Hc(0x16c)],[Hc(0xb1),Hc(0x14f),Hc(0x9b)]];return H[Hc(0x111)](l=>l===Hc(0xfb))||f[Hc(0xae)](l=>_[Hc(0xb3)](H,l));}function generateCommands(H,f,l,t=defaults[a1Hx(0x14e)],b=[]){const HD=a1Hx,i=new inquirer_helper_1[(HD(0x185))](new js_client_1['ApiClient'](H[HD(0x179)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[HD(0x168)]}));function n(Y,x){return Y['required']!==![]&&x===undefined;}function r(Y,x){const HV=HD,{opt:U,name:m}=Y,Q=U['default'],L=n(U,Q),B=D=>D[HV(0x110)]>0x1?'--'+D:'-'+D,T=U===null||U===void 0x0?void 0x0:U[HV(0x10a)],X=T?_[HV(0xe8)](T)?'-'+(T===null||T===void 0x0?void 0x0:T[HV(0x141)](D=>B(D))['join'](HV(0xd2)))+',':''+B(T):'',C=L?'':HV(0x125),j=typeof U[HV(0x108)]===HV(0xd7)?X+HV(0xe3)+m:X+HV(0xe3)+m+'\x20<'+m[HV(0x9d)]()+'>',c=C+U[HV(0x106)];x[HV(0xbd)](j,c,Q);}return Object[HD(0xbe)](t)[HD(0xef)](Y=>{const He=HD,x=f[Y],U=t[Y],m=b[He(0xde)]([Y]);function Q(e,O){const HO=He,E=Object[HO(0xbe)](e||{});E[HO(0x141)](S=>{return{'name':S,'opt':e[S]};})[HO(0x13a)]((S,A)=>!n(S['opt'])?!n(A[HO(0xab)])?0x0:0x1:-0x1)[HO(0xef)](S=>{r(S,O);});}function L(e,O){const HE=He,E=[[HE(0x16e),HE(0x15e),HE(0x151)],[HE(0x144),HE(0xf9),HE(0x131)],[HE(0xf5),HE(0x10e),HE(0x129)],[HE(0x161),HE(0xa1),'adn'],['job',HE(0x171)],[HE(0x150),HE(0xcd),'pln'],[HE(0x93),'regions','rgn'],[HE(0x103),HE(0x11b),HE(0x10b)],[HE(0x14d),HE(0x96),HE(0xc6)],[HE(0x159),HE(0xd9),'vol'],[HE(0xf8),'branch','brn'],[HE(0xfc),HE(0x138),HE(0x130)],['template',HE(0xb4),HE(0xb5)],[HE(0xd4),'repository',HE(0x142),HE(0x158)]],S=E[HE(0x111)](A=>A[HE(0x169)](O));if(S!==undefined)e[HE(0x160)](S[HE(0x167)](A=>A!==O));}function B(e){var O,E;return __awaiter(this,void 0x0,void 0x0,function*(){const HA=a1f,S={},{contextProvider:A}=H,k=m['includes']('delete'),h=e['noDefaults']===!![];function K(I,P,Z){var W,u;return __awaiter(this,void 0x0,void 0x0,function*(){const HS=a1f;if(_[HS(0x13c)]((u=(W=U[HS(0xab)])===null||W===void 0x0?void 0x0:W['path'])!==null&&u!==void 0x0?u:{},I)){const g=!h&&!k&&Z?Z():undefined,d=e[I]||g||(yield P());_[HS(0x122)](S,I,d);}});}return yield(0x0,utils_1[HA(0x116)])(Object[HA(0xba)]((E=(O=U[HA(0xab)])===null||O===void 0x0?void 0x0:O[HA(0x14c)])!==null&&E!==void 0x0?E:{}),([I,P])=>__awaiter(this,void 0x0,void 0x0,function*(){const Hk=HA,Z=S===null||S===void 0x0?void 0x0:S[Hk(0x101)],W=S===null||S===void 0x0?void 0x0:S[Hk(0x92)];switch(I){case'projectId':return yield K('projectId',i[Hk(0x154)][Hk(0x157)](i),A[Hk(0x182)][Hk(0x157)](A));case Hk(0x12d):return yield K('serviceId',i['askForService'](Z)[Hk(0x157)](i),A[Hk(0x133)][Hk(0x157)](A));case Hk(0x97):return yield K('addonId',i[Hk(0x114)](Z)['bind'](i));case Hk(0x164):return yield K(Hk(0x164),i['askForJob'](Z)['bind'](i),A['getCurrentJobName'][Hk(0x157)](A));case Hk(0x13e):return yield K('runId',i[Hk(0x100)](S[Hk(0x164)],Z)[Hk(0x157)](i));case Hk(0x183):return yield K(Hk(0x183),i[Hk(0x181)](Z)[Hk(0x157)](i));case Hk(0x103):case Hk(0x180):return yield K(Hk(0x103),i[Hk(0xe6)][Hk(0x157)](i));case'credentialId':return yield K(Hk(0xa9),i[Hk(0x134)][Hk(0x157)](i));case Hk(0xc2):return yield K(Hk(0xc2),i[Hk(0xdf)](Z)['bind'](i));case Hk(0xdd):return yield K('subdomain',i[Hk(0x119)](S[Hk(0x103)])[Hk(0x157)](i));case Hk(0x10f):return yield K(Hk(0x10f),i[Hk(0x119)](S['domainId'])['bind'](i));case Hk(0x153):return yield K(Hk(0x153),i[Hk(0xd6)](Z,S[Hk(0x97)])[Hk(0x157)](i));case Hk(0x170):return yield K(Hk(0x170),i[Hk(0xc5)](Z,S[Hk(0x12d)],S[Hk(0x164)])['bind'](i));case Hk(0x92):return yield K('templateId',i[Hk(0xca)]()[Hk(0x157)](i));case Hk(0x184):return yield K(Hk(0x184),i['askForTemplateRun'](W)[Hk(0x157)](i));case Hk(0xc3):return yield K(Hk(0xc3),i[Hk(0x143)]()[Hk(0x157)](i));case'pipelineId':return yield K(Hk(0x98),i[Hk(0x15c)](Z)['bind'](i));default:return yield K(I,i[Hk(0x12a)](I,P===null||P===void 0x0?void 0x0:P[Hk(0x106)])[Hk(0x157)](i));}})),S;});}function T(e){var O,E;return __awaiter(this,void 0x0,void 0x0,function*(){const Hh=a1f,S={},A=Object[Hh(0xcb)]((E=(O=U[Hh(0xab)])===null||O===void 0x0?void 0x0:O[Hh(0xa3)])!==null&&E!==void 0x0?E:{});return yield(0x0,utils_1[Hh(0x116)])(A,k=>__awaiter(this,void 0x0,void 0x0,function*(){const HK=Hh,h={},{required:K,schema:I}=U[HK(0xab)][HK(0xa3)][k];return yield i[HK(0x126)]([''+k],I,h,K),h[k]!==undefined&&_['set'](S,k,h[k]),h;})),S;});}function X(){const HI=He;switch(m[0x0]){case HI(0xb1):return HI(0x128)+(m[0x1]||HI(0x11e))+'s';case'update':return'Update\x20Northflank\x20'+(m[0x1]||'resource')+HI(0x115);default:return _[HI(0x9e)](Y)+'\x20Northflank\x20resources';}}function C(e,O){const HP=He;var E,S,A,k,h,K;if(!O){const F=(0x0,utils_1['getCommand'])()[HP(0xf0)](_[HP(0x145)](Y))[HP(0x106)](X());return L(F,Y),F;}const I=(e===null||e===void 0x0?void 0x0:e[HP(0xb6)])?chalk_1[HP(0x15a)]['grey']('\x0a>\x20Token\x20permissions\x20required:\x20'+e[HP(0xb6)]):'',P=H[HP(0x179)]['getCurrentContext'](),Z=P!==undefined&&((E=U===null||U===void 0x0?void 0x0:U[HP(0xab)])===null||E===void 0x0?void 0x0:E['docsTagsPath'])!==undefined,W=P===null||P===void 0x0?void 0x0:P[HP(0xec)][HP(0x176)](HP(0x9c),''),u=Z?'Documentation:\x20'+W+HP(0x11c)+((S=U===null||U===void 0x0?void 0x0:U['opt'])===null||S===void 0x0?void 0x0:S['docsTagsPath']):'',g=(e===null||e===void 0x0?void 0x0:e[HP(0x106)])||'',d=(0x0,utils_1[HP(0x136)])(!![])['name'](_[HP(0x145)](Y))[HP(0x106)](g)[HP(0x17a)](HP(0x94),[I,u][HP(0x13f)]('\x0a'));return L(d,Y),((A=U['opt'])===null||A===void 0x0?void 0x0:A['body'])&&(d[HP(0xbd)](HP(0xd0),HP(0xf4)),d['option'](HP(0xc7),HP(0xc8))),Q((k=U[HP(0xab)])===null||k===void 0x0?void 0x0:k[HP(0x14c)],d),Q((h=U['opt'])===null||h===void 0x0?void 0x0:h['query'],d),Q((K=U[HP(0xab)])===null||K===void 0x0?void 0x0:K[HP(0x146)],d),d[HP(0x11d)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const HZ=HP;var p,a,J,o;(0x0,utils_1[HZ(0xb7)])(H);const M=d[HZ(0x149)](),G=M===null||M===void 0x0?void 0x0:M['output'],N=G===HZ(0xb9),z=G==='yaml'||G===HZ(0xce),v=yield B(M);i[HZ(0xf2)](v);const R=yield T(M),s=Object['keys']((a=(p=U[HZ(0xab)])===null||p===void 0x0?void 0x0:p['path'])!==null&&a!==void 0x0?a:{})[HZ(0x141)](H3=>H3+'='+chalk_1['default'][HZ(0xd3)](v[H3]))['join'](',\x20');if(s[HZ(0x110)]>0x0&&!N&&!z){const H3=HZ(0x127)+s;console[HZ(0x112)](H3);}const y=((J=U['opt'])===null||J===void 0x0?void 0x0:J[HZ(0xf7)])?yield w(M,U,m):undefined;if(!M[HZ(0xfa)]&&m[HZ(0x169)](HZ(0x16a))&&!(yield i[HZ(0xdb)]())){(0x0,utils_1[HZ(0xd1)])(HZ(0xcc));return;}function H0(H4,H5=![],H6=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const HW=a1f,{data:H7,request:H8,error:H9,pagination:HH}=yield x[HW(0xa4)]({'parameters':v,'options':Object[HW(0x10c)](Object[HW(0x10c)]({},R),{'cursor':H4}),'data':y});(M===null||M===void 0x0?void 0x0:M[HW(0xed)])&&(console[HW(0x112)](HW(0xff)+H8[HW(0xe9)]+':'+H8[HW(0xb8)]),console[HW(0x112)]('VERBOSE:\x20Request\x20body\x20->\x20'+H8['body']));if(H9){const Hf=H9[HW(0xbf)]?HW(0xfd)+JSON['stringify'](H9[HW(0xbf)]):'',Hl=(H9===null||H9===void 0x0?void 0x0:H9['id'])?HW(0x99)+H9['id']:'',Ht=HW(0x14a)+H9['status']+Hl+')';throw new Error(HW(0xc9)+H9[HW(0x12c)]+'\x20'+Ht+Hf);}if(!(M===null||M===void 0x0?void 0x0:M['quiet'])){if(N)console[HW(0x112)](JSON[HW(0xac)](H7,null,'\x20'));else{if(z)console['log'](yaml['safeDump'](H7));else{if(isListCommand(m)){const Hb=(G===null||G===void 0x0?void 0x0:G[HW(0x17c)]('custom-columns='))?G['replace']('custom-columns=','')[HW(0x166)](',')[HW(0x141)](Hw=>Hw['toLowerCase']()):undefined,Hi=m[m[HW(0x110)]-0x1],Hn=''+Hi+(Hi[HW(0xe1)]('s')?'':'s'),Hr=_[HW(0x9e)](Hn),Hq=_[HW(0x13c)](H7,Hn)?H7[Hn]:H7;(0x0,console_format_helpers_1[HW(0xc0)])(Hq,Hr,Hb,H5,H6);}else console[HW(0x112)]((0x0,console_format_helpers_1[HW(0x118)])(H7));}}}return HH;});}let H1=yield H0(),H2=0x0;if(!M[HZ(0xe5)]&&(H1===null||H1===void 0x0?void 0x0:H1['cursor']))while(H1[HZ(0x173)]){const H4=yield i[HZ(0xbc)]('there\x20are\x20more\x20rows,\x20load?');H4&&(process[HZ(0xa0)]['moveCursor'](0x0,-0x1),process['stdout'][HZ(0xb0)](0x1),H2+=(o=H1[HZ(0x155)])!==null&&o!==void 0x0?o:0x0,H1=yield H0(H1[HZ(0x173)],!![],H2));}})),d;}const j=_[He(0x13c)](U,He(0xab)),c=x,D=C(c,j);l[He(0xda)](D);const V=_[He(0xf3)](U,'opt');Object[He(0xcb)](V)['length']>0x0&&generateCommands(H,x,D,V,m);});function q(Y,x,U){return __awaiter(this,void 0x0,void 0x0,function*(){const Hu=a1f,{input:m,file:Q}=Y;if(m!==undefined)try{return JSON['parse'](m);}catch(L){try{return yaml[Hu(0xe0)](m);}catch(B){throw new Error('Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.');}}if(Q!==undefined){if(!fs_1[Hu(0x15a)][Hu(0x174)](Q))throw new Error(Hu(0xdc)+Q);const T=fs_1['default'][Hu(0xfe)](Q)[Hu(0x165)]();let X;try{if(_[Hu(0x121)](T)){if(Y['file'][Hu(0xe1)](Hu(0x177)))X=JSON[Hu(0x152)](T);else{if(Y['file'][Hu(0xe1)](Hu(0xea))||Y[Hu(0xaa)][Hu(0xe1)](Hu(0xce)))X=yaml[Hu(0xe0)](T);else throw new Error('Unknown\x20input\x20file\x20type:\x20'+Y[Hu(0xaa)][Hu(0x166)]('.')[Hu(0xa2)]());}}else X=T;return X;}catch(C){throw new Error('Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20'+C[Hu(0x12c)]);}}return yield i['retrievePayloadViaInteractiveCli'](x,{'cmdPath':U});});}function w(Y,x,U){var m;return __awaiter(this,void 0x0,void 0x0,function*(){const Hg=a1f,Q=yield q(Y,x,U),L=new ajv_1[(Hg(0x15a))]({'allErrors':!![],'keywords':['example'],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let B=![];try{B=L[Hg(0x113)](x['opt'][Hg(0xf7)],Q);}catch(X){if(X[Hg(0x12c)][Hg(0x169)](Hg(0xa8)))B=!![];else throw X;}const T=(m=L===null||L===void 0x0?void 0x0:L[Hg(0x10d)])===null||m===void 0x0?void 0x0:m['filter'](C=>{const Hd=Hg;var j;return!((j=C===null||C===void 0x0?void 0x0:C[Hd(0x12c)])===null||j===void 0x0?void 0x0:j['includes']('match\x20exactly\x20one\x20schema\x20in\x20oneOf'));});if(!B&&T!==undefined&&(T===null||T===void 0x0?void 0x0:T['length'])>0x0)throw new Error(Hg(0x17d)+JSON[Hg(0xac)](L['errors'],null,'\x20'));return Q;});}}
2
+ 'use strict';const a1NS=a1M;(function(N,M){const NF=a1M,V=N();while(!![]){try{const L=parseInt(NF(0x1dd))/0x1+-parseInt(NF(0x21f))/0x2+parseInt(NF(0x142))/0x3*(parseInt(NF(0x20a))/0x4)+-parseInt(NF(0x213))/0x5+-parseInt(NF(0x17c))/0x6*(-parseInt(NF(0x216))/0x7)+-parseInt(NF(0x150))/0x8+parseInt(NF(0x168))/0x9;if(L===M)break;else V['push'](V['shift']());}catch(k){V['push'](V['shift']());}}}(a1N,0xa5675));var __createBinding=this&&this[a1NS(0x15e)]||(Object[a1NS(0x1f0)]?function(N,M,V,L){const Nb=a1NS;if(L===undefined)L=V;var R=Object[Nb(0x1b9)](M,V);(!R||('get'in R?!M['__esModule']:R['writable']||R[Nb(0x133)]))&&(R={'enumerable':!![],'get':function(){return M[V];}}),Object[Nb(0x180)](N,L,R);}:function(N,M,V,L){if(L===undefined)L=V;N[L]=M[V];}),__setModuleDefault=this&&this[a1NS(0x1bf)]||(Object[a1NS(0x1f0)]?function(N,M){const Ns=a1NS;Object['defineProperty'](N,Ns(0x1cf),{'enumerable':!![],'value':M});}:function(N,M){const Ny=a1NS;N[Ny(0x1cf)]=M;}),__importStar=this&&this[a1NS(0x13e)]||function(N){const Nc=a1NS;if(N&&N[Nc(0x13b)])return N;var M={};if(N!=null){for(var V in N)if(V!==Nc(0x1cf)&&Object[Nc(0x19c)]['hasOwnProperty'][Nc(0x13f)](N,V))__createBinding(M,N,V);}return __setModuleDefault(M,N),M;},__awaiter=this&&this[a1NS(0x203)]||function(N,M,V,L){function k(R){return R instanceof V?R:new V(function(r){r(R);});}return new(V||(V=Promise))(function(R,r){const Nn=a1M;function Q(X){const NT=a1M;try{h(L[NT(0x1fe)](X));}catch(u){r(u);}}function z(X){const NU=a1M;try{h(L[NU(0x138)](X));}catch(u){r(u);}}function h(X){const NZ=a1M;X[NZ(0x174)]?R(X[NZ(0x21b)]):k(X[NZ(0x21b)])['then'](Q,z);}h((L=L['apply'](N,M||[]))[Nn(0x1fe)]());});},__importDefault=this&&this[a1NS(0x1f8)]||function(N){return N&&N['__esModule']?N:{'default':N};};Object['defineProperty'](exports,a1NS(0x13b),{'value':!![]}),exports[a1NS(0x1a3)]=void 0x0;function a1N(){const NY=['Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','prj','.json','credential','addon','update','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','OPTIONAL:\x20','status','query','includes','stdout','subdomain','yml','\x20properties','CliLogs','domain','join','getOwnPropertyDescriptor','vol','contextProvider','backupId','invoices','Get\x20information\x20about\x20Northflank\x20','__setModuleDefault','projects','services','filter','askForCredentials','domainId','description','execCmd','addHelpText','moveCursor','get','host','cred','askForJob','green','readFileSync','default','set','some','yaml','split','repo','output','file','checkUpdate','templateId','plan','replace','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','/docs/v1/api/','781766tufhTM','buildId','adn','askForTemplate','volume',',\x20-','askForJobRun','secretId','getCommandOverview','bind','getMetricsCommand','map','assign','backups','job','runtimeFiles/additionalProperties','isEqual','pipelineId','Update\x20Northflank\x20','create','endsWith','ApiClientFileContextProvider','errors','-i,\x20--input\x20<resource-def>','addonId','path','region','__importDefault','enablePositionalOptions','API\x20request\x20failed\x0a\x09Message:\x20','CliPortForward','jobId','assertContextExisting','next','lodash','askForSecret','../package.json','there\x20are\x20more\x20rows,\x20load?','__awaiter','tpl','concat','validate','action','ajv','quiet','5295064kyqdCi','getLogsCommand','Command','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','customUserAgent','noDefaults','version','opt','./logs','5829425wfPTCW','Resource\x20was\x20not\x20deleted.','api.','623EyIuFO','logs','match\x20exactly\x20one\x20schema\x20in\x20oneOf','exitCode','./exec','value','consoleFormat','length','asyncSequential','731568VepGGz','\x20Northflank\x20resources','error',',\x20NF\x20error\x20id:\x20','body','--verbose','CliContext','grey','volumes','configurable','forEach','getCurrentProjectName','=>\x20running\x20command\x20with:\x20','\x20--','throw','subdomainId','projectId','__esModule','getOwnPropertyNames','entries','__importStar','call','details','find','3LMMFIa','setPathVars','clearLine','alias','keys','askForProject','./context/contextCommands','stringify','regions','omit','underline','./port-forward','getCommand','kebabCase','5593824hrcYVQ','domains','commander','runId','runs','dmn','sort','pln','./defaults','login','askForService','parse','credentials','Documentation:\x20','__createBinding','printAsTable','InquirerHelper','json','pop','./formatting/command-overview','VERBOSE:\x20Request\x20body\x20->\x20','VERBOSE:\x20Using\x20endpoint\x20->\x20','option','secret','892215vDZCrk','force','northflank','rgn','project','deleteWarningPrompt','./utils','Northflank\x20cli\x20version:\x20','askForAddon','CliExec','name','Unknown\x20input\x20file\x20type:\x20','done','volumeId','log','jobs','url','cursor','invoice','requiredPermissions','47442Fukfrd','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','existsSync','handleJsonOutput','defineProperty','boolean','scrt','portFwdCmd','base','toLowerCase','getCurrentContext','safeLoad','toUpperCase','logSinkId','message','service','argv','type','.yaml','askForPipeline','addCommand','commands','getCurrentServiceName','propToType','credentialId','-v,\x20--version','getCurrentJobName','has','serviceId','inv','delete','count','prototype','js-yaml','addons','askForSubdomain','upperFirst','verbose','secrets','getProgram','ApiClient','defaults','File\x20does\x20not\x20exist:\x20'];a1N=function(){return NY;};return a1N();}function a1M(N,M){const V=a1N();return a1M=function(L,k){L=L-0x131;let R=V[L];return R;},a1M(N,M);}const js_client_1=require('@northflank/js-client'),commander_1=__importDefault(require(a1NS(0x152))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require(a1NS(0x208))),chalk_1=__importDefault(require('chalk')),_=__importStar(require(a1NS(0x1ff))),contextCommands_1=require(a1NS(0x148)),utils_1=require(a1NS(0x16e)),defaults=__importStar(require(a1NS(0x158))),inquirer_helper_1=require('./inquirer-helper'),console_format_helpers_1=require('./formatting/console-format-helpers'),command_overview_1=require(a1NS(0x163)),port_forward_1=require(a1NS(0x14d)),exec_1=require(a1NS(0x21a)),logs_1=require(a1NS(0x212)),metrics_1=require('./metrics'),yaml=require(a1NS(0x19d)),pgk=require(a1NS(0x201)),getProgram=N=>{const NI=a1NS,M=new commander_1[(NI(0x1cf))][(NI(0x20c))](NI(0x16a));M['description'](NI(0x20d)),M[NI(0x1f9)](!![]),M[NI(0x210)](NI(0x16f)+chalk_1[NI(0x1cf)][NI(0x14c)](pgk[NI(0x210)]),NI(0x195),'Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli');const V=new js_client_1[(NI(0x1a4))](N,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1['customUserAgent']}),L=new contextCommands_1[(NI(0x225))](V),k=new port_forward_1[(NI(0x1fb))](N),R=new exec_1[(NI(0x171))](N),r=new logs_1[(NI(0x1b6))](N),Q=new metrics_1['CliMetrics'](N);return M['addCommand'](k[NI(0x183)]),M[NI(0x190)](R[NI(0x1c6)]),M['addCommand'](L[NI(0x159)]),M[NI(0x190)](L['contexts']),generateCommands(V,V['endpoints'],M,r,Q),M['addCommand']((0x0,command_overview_1[NI(0x1e5)])(M)),M;};exports[a1NS(0x1a3)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Nd=a1NS;try{const N=new js_client_1[(Nd(0x1f2))]();yield(0x0,utils_1[Nd(0x1d7)])(N);const M=(0x0,exports[Nd(0x1a3)])(N);yield M['parseAsync'](process['argv']);}catch(V){(0x0,utils_1[Nd(0x221)])(Nd(0x1a7)+V[Nd(0x18a)]),process[Nd(0x18c)]['find'](L=>L===Nd(0x224))&&console['log'](V),process[Nd(0x219)]=0x1;}}))());function isListCommand(N){const Nv=a1NS,M=[[Nv(0x1c9),Nv(0x1ab),Nv(0x1ea)],[Nv(0x1c9),Nv(0x1eb),Nv(0x154)]];return N['find'](V=>V==='list')||M['some'](V=>_[Nv(0x1ed)](N,V));}function generateCommands(N,M,V,L,k,R=defaults[a1NS(0x1a5)],r=[]){const Na=a1NS,Q=new inquirer_helper_1[(Na(0x160))](new js_client_1[(Na(0x1a4))](N[Na(0x1bb)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[Na(0x20e)]}));function z(F,S){return F['required']!==![]&&S===undefined;}function h(F,S){const Nl=Na,{opt:b,name:s}=F,y=b[Nl(0x1cf)],c=z(b,y),T=v=>v[Nl(0x21d)]>0x1?'--'+v:'-'+v,U=b===null||b===void 0x0?void 0x0:b[Nl(0x145)],Z=U?_['isArray'](U)?'-'+(U===null||U===void 0x0?void 0x0:U[Nl(0x1e8)](v=>T(v))[Nl(0x1b8)](Nl(0x1e2)))+',':''+T(U):'',n=c?'':Nl(0x1ae),I=typeof b[Nl(0x18d)]===Nl(0x181)?Z+Nl(0x137)+s:Z+Nl(0x137)+s+'\x20<'+s[Nl(0x188)]()+'>',d=n+b[Nl(0x1c5)];S['option'](I,d,y);}function X(){const No=Na;if(V[No(0x191)][No(0x1d1)](F=>F[No(0x172)]()===No(0x217)))return;_[No(0x1ed)](r,[No(0x1c9),'service'])&&(V[No(0x190)](L[No(0x20b)](No(0x18b))),V[No(0x190)](k[No(0x1e7)](No(0x18b))),V['addCommand'](L[No(0x20b)]('service',!![])),V[No(0x190)](k[No(0x1e7)](No(0x18b),!![]))),_[No(0x1ed)](r,[No(0x1c9),'job'])&&(V[No(0x190)](L[No(0x20b)](No(0x1eb))),V['addCommand'](k[No(0x1e7)](No(0x1eb))),V[No(0x190)](L[No(0x20b)](No(0x1eb),!![])),V[No(0x190)](k[No(0x1e7)](No(0x1eb),!![]))),_['isEqual'](r,[No(0x1c9),No(0x1ab)])&&(V['addCommand'](L[No(0x20b)](No(0x1ab))),V['addCommand'](k[No(0x1e7)](No(0x1ab))));}return Object[Na(0x13c)](R)[Na(0x134)](F=>{const Nt=Na,S=M[F],b=R[F],s=r[Nt(0x205)]([F]);function y(l,o){const Ng=Nt,t=Object[Ng(0x13c)](l||{});t[Ng(0x1e8)](g=>{return{'name':g,'opt':l[g]};})[Ng(0x156)]((g,m)=>!z(g[Ng(0x211)])?!z(m[Ng(0x211)])?0x0:0x1:-0x1)[Ng(0x134)](g=>{h(g,o);});}function c(l,o){const Nm=Nt,t=[[Nm(0x16c),Nm(0x1c0),Nm(0x1a8)],[Nm(0x18b),Nm(0x1c1),'svc'],[Nm(0x15c),Nm(0x1aa),Nm(0x1cb)],[Nm(0x1ab),Nm(0x19e),Nm(0x1df)],[Nm(0x1eb),Nm(0x177)],[Nm(0x1d9),'plans',Nm(0x157)],[Nm(0x1f7),Nm(0x14a),Nm(0x16b)],['domain',Nm(0x151),Nm(0x155)],[Nm(0x167),Nm(0x1a2),Nm(0x182)],[Nm(0x132),Nm(0x1e1),Nm(0x1ba)],['branches','branch','brn'],[Nm(0x17a),Nm(0x1bd),Nm(0x199)],['template','templates',Nm(0x204)],['repos','repository','repositories',Nm(0x1d4)]],g=t[Nm(0x141)](m=>m[Nm(0x1b1)](o));if(g!==undefined)l['aliases'](g['filter'](m=>m!==o));}function T(l){var o,t;return __awaiter(this,void 0x0,void 0x0,function*(){const NW=a1M,g={},{contextProvider:m}=N,W=s[NW(0x1b1)](NW(0x19a)),x=l[NW(0x20f)]===!![];function K(A,e,f){var G,q;return __awaiter(this,void 0x0,void 0x0,function*(){const Nx=a1M;if(_[Nx(0x197)]((q=(G=b[Nx(0x211)])===null||G===void 0x0?void 0x0:G[Nx(0x1f6)])!==null&&q!==void 0x0?q:{},A)){const i=!x&&!W&&f?f():undefined,w=l[A]||i||(yield e());_[Nx(0x1d0)](g,A,w);}});}return yield(0x0,utils_1[NW(0x21e)])(Object[NW(0x13d)]((t=(o=b[NW(0x211)])===null||o===void 0x0?void 0x0:o[NW(0x1f6)])!==null&&t!==void 0x0?t:{}),([A,e])=>__awaiter(this,void 0x0,void 0x0,function*(){const NK=NW,f=g===null||g===void 0x0?void 0x0:g[NK(0x13a)],G=g===null||g===void 0x0?void 0x0:g[NK(0x1d8)];switch(A){case NK(0x13a):return yield K('projectId',Q[NK(0x147)][NK(0x1e6)](Q),m[NK(0x135)][NK(0x1e6)](m));case NK(0x198):return yield K(NK(0x198),Q[NK(0x15a)](f)[NK(0x1e6)](Q),m[NK(0x192)][NK(0x1e6)](m));case NK(0x1f5):return yield K(NK(0x1f5),Q[NK(0x170)](f)[NK(0x1e6)](Q));case NK(0x1fc):return yield K(NK(0x1fc),Q[NK(0x1cc)](f)[NK(0x1e6)](Q),m[NK(0x196)][NK(0x1e6)](m));case NK(0x153):return yield K(NK(0x153),Q[NK(0x1e3)](g[NK(0x1fc)],f)[NK(0x1e6)](Q));case NK(0x1e4):return yield K('secretId',Q[NK(0x200)](f)[NK(0x1e6)](Q));case NK(0x1b7):case NK(0x1c4):return yield K(NK(0x1b7),Q['askForDomain'][NK(0x1e6)](Q));case'credentialId':return yield K(NK(0x194),Q[NK(0x1c3)][NK(0x1e6)](Q));case NK(0x175):return yield K(NK(0x175),Q['askForVolume'](f)['bind'](Q));case'subdomain':return yield K(NK(0x1b3),Q[NK(0x19f)](g[NK(0x1b7)])[NK(0x1e6)](Q));case NK(0x139):return yield K(NK(0x139),Q[NK(0x19f)](g[NK(0x1c4)])['bind'](Q));case NK(0x1bc):return yield K(NK(0x1bc),Q['askForAddonBackup'](f,g[NK(0x1f5)])[NK(0x1e6)](Q));case NK(0x1de):return yield K(NK(0x1de),Q['askForBuild'](f,g[NK(0x198)],g[NK(0x1fc)])['bind'](Q));case'templateId':return yield K(NK(0x1d8),Q[NK(0x1e0)]()['bind'](Q));case'templateRunId':return yield K('templateRunId',Q['askForTemplateRun'](G)['bind'](Q));case NK(0x189):return yield K(NK(0x189),Q['askForLogSink']()[NK(0x1e6)](Q));case NK(0x1ee):return yield K(NK(0x1ee),Q[NK(0x18f)](f)[NK(0x1e6)](Q));default:return yield K(A,Q['askGeneric'](A,e===null||e===void 0x0?void 0x0:e[NK(0x1c5)])[NK(0x1e6)](Q));}})),g;});}function U(l){var o,t;return __awaiter(this,void 0x0,void 0x0,function*(){const NA=a1M,g={},m=Object['keys']((t=(o=b[NA(0x211)])===null||o===void 0x0?void 0x0:o[NA(0x1b0)])!==null&&t!==void 0x0?t:{});return yield(0x0,utils_1[NA(0x21e)])(m,W=>__awaiter(this,void 0x0,void 0x0,function*(){const Ne=NA;if(l[W]!==undefined)return l[W];const x={},{required:K,schema:A}=b[Ne(0x211)][Ne(0x1b0)][W];return yield Q[Ne(0x193)]([''+W],A,x,K),x[W]!==undefined&&_[Ne(0x1d0)](g,W,x[W]),x;})),g;});}function Z(){const Nf=Nt;switch(s[0x0]){case Nf(0x1c9):return Nf(0x1be)+(s[0x1]||'resource')+'s';case Nf(0x1ac):return Nf(0x1ef)+(s[0x1]||'resource')+Nf(0x1b5);default:return _[Nf(0x1a0)](F)+Nf(0x220);}}function n(l,o){const NG=Nt;var t,g,m,W,x,K;if(!o){const E=(0x0,utils_1[NG(0x14e)])()[NG(0x172)](_[NG(0x14f)](F))[NG(0x1c5)](Z());return c(E,F),E;}const A=(l===null||l===void 0x0?void 0x0:l[NG(0x17b)])?chalk_1['default'][NG(0x131)]('\x0a>\x20Token\x20permissions\x20required:\x20'+l[NG(0x17b)]):'',e=N[NG(0x1bb)][NG(0x186)](),f=e!==undefined&&((t=b===null||b===void 0x0?void 0x0:b[NG(0x211)])===null||t===void 0x0?void 0x0:t['docsTagsPath'])!==undefined,G=e===null||e===void 0x0?void 0x0:e[NG(0x1ca)][NG(0x1da)](NG(0x215),''),q=f?NG(0x15d)+G+NG(0x1dc)+((g=b===null||b===void 0x0?void 0x0:b[NG(0x211)])===null||g===void 0x0?void 0x0:g['docsTagsPath']):'',i=(l===null||l===void 0x0?void 0x0:l[NG(0x1c5)])||'',w=(0x0,utils_1[NG(0x14e)])(!![])['name'](_[NG(0x14f)](F))[NG(0x1c5)](i)[NG(0x1c7)]('after',[A,q][NG(0x1b8)]('\x0a'));return c(w,F),((m=b[NG(0x211)])===null||m===void 0x0?void 0x0:m['body'])&&(w[NG(0x166)]('-f,\x20--file\x20<file-path>','File\x20to\x20load\x20resource\x20json\x20from'),w['option'](NG(0x1f4),'JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22')),y((W=b[NG(0x211)])===null||W===void 0x0?void 0x0:W[NG(0x1f6)],w),y((x=b[NG(0x211)])===null||x===void 0x0?void 0x0:x[NG(0x1b0)],w),y((K=b[NG(0x211)])===null||K===void 0x0?void 0x0:K[NG(0x184)],w),w[NG(0x207)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const Nq=NG;var D,Y,J,j;(0x0,utils_1[Nq(0x1fd)])(N);const P=w['opts'](),H=P===null||P===void 0x0?void 0x0:P[Nq(0x1d5)],B=H===Nq(0x161),O=H===Nq(0x1d2)||H===Nq(0x1b4),C=yield T(P);Q[Nq(0x143)](C);const N0=yield U(P),N1=Object[Nq(0x146)]((Y=(D=b[Nq(0x211)])===null||D===void 0x0?void 0x0:D['path'])!==null&&Y!==void 0x0?Y:{})[Nq(0x1e8)](N6=>N6+'='+chalk_1[Nq(0x1cf)][Nq(0x1cd)](C[N6]))[Nq(0x1b8)](',\x20');if(N1[Nq(0x21d)]>0x0&&!B&&!O){const N6=Nq(0x136)+N1;console[Nq(0x176)](N6);}const N2=((J=b[Nq(0x211)])===null||J===void 0x0?void 0x0:J[Nq(0x223)])?yield p(P,b,s):undefined;if(!P[Nq(0x169)]&&s[Nq(0x1b1)](Nq(0x19a))&&!(yield Q[Nq(0x16d)]())){(0x0,utils_1['warning'])(Nq(0x214));return;}function N3(N7,N8=![],N9=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const Ni=a1M,{data:NN,request:NM,error:NV,pagination:NL}=yield S['call']({'parameters':C,'options':Object['assign'](Object[Ni(0x1e9)]({},N0),{'cursor':N7}),'data':N2});(P===null||P===void 0x0?void 0x0:P[Ni(0x1a1)])&&(console[Ni(0x176)](Ni(0x165)+NM['method']+':'+NM[Ni(0x178)]),console[Ni(0x176)](Ni(0x164)+NM[Ni(0x223)]));if(NV){const Nk=NV[Ni(0x140)]?'\x0a\x09details\x20:'+JSON[Ni(0x149)](NV[Ni(0x140)]):'',NR=(NV===null||NV===void 0x0?void 0x0:NV['id'])?Ni(0x222)+NV['id']:'',Nr='(HTTP\x20status\x20code:\x20'+NV[Ni(0x1af)]+NR+')';throw new Error(Ni(0x1fa)+NV['message']+'\x20'+Nr+Nk);}if(!(P===null||P===void 0x0?void 0x0:P['quiet'])){if(B)(0x0,console_format_helpers_1[Ni(0x17f)])(P===null||P===void 0x0?void 0x0:P['output'],NN);else{if(O)(0x0,console_format_helpers_1['handleYamlOutput'])(P===null||P===void 0x0?void 0x0:P[Ni(0x1d5)],NN);else{if(isListCommand(s)){const NQ=(H===null||H===void 0x0?void 0x0:H['startsWith']('custom-columns='))?H['replace']('custom-columns=','')[Ni(0x1d3)](',')[Ni(0x1e8)](Np=>Np[Ni(0x185)]()):undefined,Nz=s[s[Ni(0x21d)]-0x1],Nh=''+Nz+(Nz['endsWith']('s')?'':'s'),NX=_['upperFirst'](Nh),Nu=_[Ni(0x197)](NN,Nh)?NN[Nh]:NN;(0x0,console_format_helpers_1[Ni(0x15f)])(Nu,NX,NQ,N8,N9);}else console[Ni(0x176)]((0x0,console_format_helpers_1[Ni(0x21c)])(NN));}}}return NL;});}let N4=yield N3(),N5=0x0;if(!P[Nq(0x209)]&&(N4===null||N4===void 0x0?void 0x0:N4[Nq(0x179)]))while(N4[Nq(0x179)]){const N7=yield Q['askConfirm'](Nq(0x202));N7&&(process[Nq(0x1b2)][Nq(0x1c8)](0x0,-0x1),process[Nq(0x1b2)][Nq(0x144)](0x1),N5+=(j=N4[Nq(0x19b)])!==null&&j!==void 0x0?j:0x0,N4=yield N3(N4[Nq(0x179)],!![],N5));}})),w;}const I=_['has'](b,'opt'),d=S,v=n(d,I);V['addCommand'](v),X();const a=_[Nt(0x14b)](b,Nt(0x211));Object[Nt(0x146)](a)[Nt(0x21d)]>0x0&&generateCommands(N,S,v,L,k,a,s);});function u(F,S,b){return __awaiter(this,void 0x0,void 0x0,function*(){const Nw=a1M,{input:s,file:y}=F;if(s!==undefined)try{return JSON[Nw(0x15b)](s);}catch(c){try{return yaml[Nw(0x187)](s);}catch(T){throw new Error(Nw(0x1ad));}}if(y!==undefined){if(!fs_1[Nw(0x1cf)][Nw(0x17e)](y))throw new Error(Nw(0x1a6)+y);const U=fs_1['default'][Nw(0x1ce)](y)['toString']();let Z;try{if(_['isString'](U)){if(F['file'][Nw(0x1f1)](Nw(0x1a9)))Z=JSON['parse'](U);else{if(F[Nw(0x1d6)][Nw(0x1f1)](Nw(0x18e))||F[Nw(0x1d6)][Nw(0x1f1)](Nw(0x1b4)))Z=yaml[Nw(0x187)](U);else throw new Error(Nw(0x173)+F['file'][Nw(0x1d3)]('.')[Nw(0x162)]());}}else Z=U;return Z;}catch(n){throw new Error(Nw(0x1db)+n[Nw(0x18a)]);}}return yield Q['retrievePayloadViaInteractiveCli'](S,{'cmdPath':b});});}function p(F,S,b){var s;return __awaiter(this,void 0x0,void 0x0,function*(){const NE=a1M,y=yield u(F,S,b),c=new ajv_1[(NE(0x1cf))]({'allErrors':!![],'keywords':['example'],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let T=![];try{T=c[NE(0x206)](S[NE(0x211)][NE(0x223)],y);}catch(Z){if(Z[NE(0x18a)]['includes'](NE(0x1ec)))T=!![];else throw Z;}const U=(s=c===null||c===void 0x0?void 0x0:c[NE(0x1f3)])===null||s===void 0x0?void 0x0:s[NE(0x1c2)](n=>{const ND=NE;var I;return!((I=n===null||n===void 0x0?void 0x0:n[ND(0x18a)])===null||I===void 0x0?void 0x0:I['includes'](ND(0x218)));});if(!T&&U!==undefined&&(U===null||U===void 0x0?void 0x0:U[NE(0x21d)])>0x0)throw new Error(NE(0x17d)+JSON['stringify'](c['errors'],null,'\x20'));return y;});}}
@@ -1 +1 @@
1
- 'use strict';const a4X=a4f;(function(H,f){const T=a4f,l=H();while(!![]){try{const t=parseInt(T(0x1a4))/0x1*(parseInt(T(0x21d))/0x2)+-parseInt(T(0x1d7))/0x3*(-parseInt(T(0x203))/0x4)+-parseInt(T(0x1e0))/0x5+-parseInt(T(0x1ca))/0x6+-parseInt(T(0x1d3))/0x7*(parseInt(T(0x1c1))/0x8)+parseInt(T(0x1f6))/0x9*(parseInt(T(0x200))/0xa)+parseInt(T(0x1d8))/0xb*(parseInt(T(0x1a9))/0xc);if(t===f)break;else l['push'](l['shift']());}catch(b){l['push'](l['shift']());}}}(a4H,0xe8174));var __createBinding=this&&this['__createBinding']||(Object[a4X(0x21e)]?function(H,f,l,t){const C=a4X;if(t===undefined)t=l;var b=Object['getOwnPropertyDescriptor'](f,l);(!b||(C(0x208)in b?!f[C(0x19c)]:b[C(0x20e)]||b[C(0x219)]))&&(b={'enumerable':!![],'get':function(){return f[l];}}),Object[C(0x1be)](H,t,b);}:function(H,f,l,t){if(t===undefined)t=l;H[t]=f[l];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object[a4X(0x21e)]?function(H,f){const j=a4X;Object[j(0x1be)](H,j(0x1f3),{'enumerable':!![],'value':f});}:function(H,f){const c=a4X;H[c(0x1f3)]=f;}),__importStar=this&&this['__importStar']||function(H){const D=a4X;if(H&&H[D(0x19c)])return H;var f={};if(H!=null){for(var l in H)if(l!==D(0x1f3)&&Object[D(0x1f2)][D(0x1d5)][D(0x214)](H,l))__createBinding(f,H,l);}return __setModuleDefault(f,H),f;},__awaiter=this&&this[a4X(0x204)]||function(H,f,l,t){function b(i){return i instanceof l?i:new l(function(n){n(i);});}return new(l||(l=Promise))(function(i,n){const E=a4f;function r(Y){const V=a4f;try{w(t[V(0x19d)](Y));}catch(x){n(x);}}function q(Y){const e=a4f;try{w(t[e(0x21b)](Y));}catch(x){n(x);}}function w(Y){const O=a4f;Y[O(0x20c)]?i(Y[O(0x198)]):b(Y[O(0x198)])[O(0x1ff)](r,q);}w((t=t[E(0x1a7)](H,f||[]))[E(0x19d)]());});},__importDefault=this&&this[a4X(0x217)]||function(H){const S=a4X;return H&&H[S(0x19c)]?H:{'default':H};};Object[a4X(0x1be)](exports,a4X(0x19c),{'value':!![]}),exports[a4X(0x1db)]=void 0x0;const _=__importStar(require(a4X(0x221))),node_fetch_1=__importDefault(require(a4X(0x1c5))),chalk_1=__importDefault(require('chalk')),utils_1=require(a4X(0x202)),inquirer_helper_1=require('../inquirer-helper'),console_format_helpers_1=require(a4X(0x1ce)),browser_login_1=require('../login/browser-login'),inquirer=require(a4X(0x1c7));class CliContext{constructor(H,f='https://api.northflank.com'){const A=a4X;this['defaultBaseUrl']=f,this[A(0x211)]=x=>{const k=A;let U=x;return!/^https?:\/\//i['test'](U)&&(U=k(0x1fd)+U),U=U['replace'](/\/+$/,''),U;},this[A(0x1a0)]=H;const l=new inquirer_helper_1[(A(0x1b1))](H);this[A(0x1fa)]=(0x0,utils_1['getCommand'])()[A(0x1c8)]('login')[A(0x18f)](A(0x1e6))[A(0x191)]('--token-login',A(0x195),![])['option'](A(0x197),A(0x1ee),![])['option'](A(0x1dc),A(0x206))[A(0x191)](A(0x20d),A(0x1d9))[A(0x191)](A(0x1f8),A(0x1cf),this['defaultBaseUrl'])['option']('--override','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)',![])[A(0x210)](x=>__awaiter(this,void 0x0,void 0x0,function*(){const h=A;_[h(0x1c4)](x,'host',this[h(0x211)](x[h(0x1cb)]));const {name:U,host:m,token:Q,override:L}=x[h(0x1ea)]||x[h(0x1ed)]!==undefined?yield this[h(0x223)](x,l):yield this[h(0x1da)](x,l);try{yield this['apiClient'][h(0x199)]['addContext']({'name':U,'host':m,'token':Q},L);}catch(B){(0x0,utils_1[h(0x1a6)])(B[h(0x1d6)]);return;}!(yield this['verifyToken']())?((0x0,utils_1[h(0x1a6)])(h(0x1bf)),yield this[h(0x1a0)][h(0x199)]['removeContext'](U)):(0x0,utils_1['success'])(h(0x207)+m+h(0x20b));})),this[A(0x212)]=(0x0,utils_1['getCommand'])()[A(0x1c8)](A(0x21c))[A(0x18f)](A(0x1f4))[A(0x1c6)](A(0x212))[A(0x1c6)](A(0x215));const t=(0x0,utils_1[A(0x1ad)])()['name'](A(0x21f))[A(0x1c8)]('ls')['description'](A(0x1bc))['option'](A(0x1b8),'Shows\x20full\x20context\x20information\x20(including\x20tokens)')[A(0x210)](x=>__awaiter(this,void 0x0,void 0x0,function*(){const K=A;console['log'](H['contextProvider']['getInfo']());const U=H[K(0x199)][K(0x1d1)]();if(x[K(0x21a)]===!![]){console[K(0x1f1)](U);return;}const m=U[K(0x1f5)],Q=U['contexts'][K(0x20a)]((L,B)=>L[K(0x1c8)]===m?-0x1:B['name']===m?0x1:0x0)[K(0x1df)](L=>{const I=K,B=m===L[I(0x1c8)]?'\x20(current)':'';return{'Name':''+L[I(0x1c8)]+B,'Host':L['host'],'Default\x20Project':L['project']||'-','Default\x20Service':L[I(0x196)]||'-'};});(0x0,console_format_helpers_1[K(0x1a3)])(Q,K(0x1ae));})),b=(0x0,utils_1[A(0x1ad)])();b[A(0x1c8)](A(0x1e9))[A(0x18f)](A(0x193))[A(0x191)](A(0x1dc),A(0x1e4))[A(0x210)](x=>__awaiter(this,void 0x0,void 0x0,function*(){const P=A,U=(x===null||x===void 0x0?void 0x0:x[P(0x1c8)])||(yield this[P(0x19f)]('use'));yield this[P(0x1a0)][P(0x199)][P(0x1af)](U),(0x0,utils_1['success'])('Changed\x20current\x20context\x20to\x20'+U);}));const i=A(0x18e),n=(0x0,utils_1['getCommand'])()[A(0x1c8)](A(0x220))[A(0x18f)](A(0x1eb))[A(0x191)](i,A(0x1b9))[A(0x210)](x=>__awaiter(this,void 0x0,void 0x0,function*(){const Z=A,U=(x===null||x===void 0x0?void 0x0:x['id'])||(yield l[Z(0x201)]());yield this[Z(0x1a0)][Z(0x199)][Z(0x1b5)](U),console['log'](Z(0x1b0),U);})),r=(0x0,utils_1[A(0x1ad)])()['name']('service')[A(0x18f)](A(0x1ac))[A(0x191)](i,'Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')[A(0x210)](x=>__awaiter(this,void 0x0,void 0x0,function*(){const W=A,U=(x===null||x===void 0x0?void 0x0:x['id'])||(yield l['askForService'](this[W(0x1c0)]())());console[W(0x20f)]('Use\x20service\x20with\x20id:',U),yield this[W(0x1a0)][W(0x199)][W(0x209)](U);})),q=(0x0,utils_1[A(0x1ad)])()[A(0x1c8)]('job')[A(0x18f)](A(0x1b2))[A(0x191)](i,A(0x1e2))['action'](x=>__awaiter(this,void 0x0,void 0x0,function*(){const u=A,U=(x===null||x===void 0x0?void 0x0:x['id'])||(yield l['askForJob'](this[u(0x1c0)]())());console[u(0x20f)](u(0x1fb),U),yield this['apiClient']['contextProvider']['useJobId'](U);}));b[A(0x213)](n),b['addCommand'](q),b[A(0x213)](r);const w=(0x0,utils_1[A(0x1ad)])()[A(0x1c8)](A(0x1ef))[A(0x1c6)]('delete')[A(0x1c6)]('rm')[A(0x18f)](A(0x1b4))['option'](i,A(0x1f7))['action'](x=>__awaiter(this,void 0x0,void 0x0,function*(){const g=A;var U;const m=(x===null||x===void 0x0?void 0x0:x['id'])||(yield this['askForContext'](g(0x1ef))),Q=(U=this['apiClient']['contextProvider']['getCurrentContext']())===null||U===void 0x0?void 0x0:U['name'];yield this[g(0x1a0)][g(0x199)][g(0x1bd)](m),(0x0,utils_1[g(0x1aa)])(g(0x19e)+m+g(0x1cc));if(!this[g(0x218)]()){(0x0,utils_1[g(0x1e8)])(g(0x1bb));return;}if(Q===m){const L=(x===null||x===void 0x0?void 0x0:x['name'])||(yield this[g(0x19f)](g(0x1cd)));yield this[g(0x1a0)][g(0x199)]['useContext'](L),(0x0,utils_1[g(0x1aa)])(g(0x1b6)+L);}})),Y=(0x0,utils_1[A(0x1ad)])()[A(0x1c8)](A(0x1de))[A(0x1c6)]('set-token')[A(0x18f)]('Update\x20token\x20for\x20current\x20context')[A(0x191)]('-t,\x20--token\x20[TOKEN]',A(0x216))[A(0x210)](x=>__awaiter(this,void 0x0,void 0x0,function*(){const d=A,{contextProvider:U}=this['apiClient'],m=(x===null||x===void 0x0?void 0x0:x[d(0x1ed)])||(yield l[d(0x1e3)]()),Q=U[d(0x1fc)]();yield U[d(0x1fe)](m);if(yield this['verifyToken']())(0x0,utils_1['success'])(d(0x1a2)+U[d(0x1e5)]()+'\x27\x20successfully\x20updated.');else{if(Q)yield U[d(0x1fe)](Q);(0x0,utils_1[d(0x1a6)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed');}}));this[A(0x212)]['addCommand'](t),this[A(0x212)]['addCommand'](b),this['contexts'][A(0x213)](w),this[A(0x212)][A(0x213)](Y);}['browserLogin'](H,f){var l,t,b,i;return __awaiter(this,void 0x0,void 0x0,function*(){const F=a4f,n=!H[F(0x190)],r=(l=H[F(0x1cb)])!==null&&l!==void 0x0?l:this[F(0x1dd)],q=new browser_login_1['NorthflankApiBrowserLogin'](r,n);let w;q['on']('browser-opened',({url:m})=>{const p=F;if(n){const Q=m['replace'](/sessionToken=.*/,p(0x1b7));console[p(0x20f)]('Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20'+Q+')'),w=inquirer[p(0x19a)]([{'type':p(0x1c3),'name':p(0x1ec),'message':p(0x1c2),'default':![]}]),w[p(0x1ff)](L=>{const a=p;process[a(0x192)]['moveCursor'](0x0,-0x1),process[a(0x192)][a(0x1ab)](0x1),L[a(0x1ec)]&&console['log'](a(0x1a8)+m+'\x20');});}else console['log']('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+m+'\x20');});const {token:Y,contextName:x}=yield q[F(0x1d2)]()[F(0x1f9)](m=>__awaiter(this,void 0x0,void 0x0,function*(){const J=F;(0x0,utils_1['error'])(J(0x205)+m[J(0x1d6)]+J(0x222));const Q=yield this['apiTokenLogin'](H,f);return{'token':Q[J(0x1ed)],'contextName':Q[J(0x1c8)]};}))[F(0x1d0)](()=>{const o=F;if(w)w['ui'][o(0x1d4)]();}),U=(b=(t=H['name'])!==null&&t!==void 0x0?t:x)!==null&&b!==void 0x0?b:F(0x1f0)+new Date()['valueOf']();return(0x0,utils_1[F(0x1aa)])('\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20'+chalk_1[F(0x1f3)][F(0x1b3)](U)),{'name':U,'token':Y,'host':r,'override':(i=H[F(0x1e1)])!==null&&i!==void 0x0?i:![]};});}['apiTokenLogin'](H,f){return __awaiter(this,void 0x0,void 0x0,function*(){const M=a4f,l=this[M(0x1a0)][M(0x199)][M(0x1d1)]()[M(0x212)],{name:t,token:b,host:i,override:n}=yield f[M(0x1ba)](H,l);return{'name':t,'token':b,'host':i,'override':n};});}['getProjectName'](){const G=a4X,H=this[G(0x1a0)][G(0x199)][G(0x1e7)]();if(H===undefined)throw new Error(G(0x1a5));return H;}['askForContext'](H){return __awaiter(this,void 0x0,void 0x0,function*(){const N=a4f;if(!this[N(0x218)]())throw new Error(N(0x19b));const f=this[N(0x1a0)][N(0x199)][N(0x1d1)]()[N(0x212)][N(0x1df)](t=>t[N(0x1c8)]),l=f[N(0x194)]>0x4?'search-list':N(0x21f);return(yield inquirer[N(0x19a)]([{'type':l,'name':N(0x1c8),'message':N(0x1a1)+H+':','choices':f}]))['name'];});}[a4X(0x218)](){const z=a4X;return this[z(0x1a0)][z(0x199)][z(0x1d1)]()['contexts']['length']>0x0;}[a4X(0x1c9)](){return __awaiter(this,void 0x0,void 0x0,function*(){const v=a4f;try{const H=this[v(0x1a0)][v(0x199)]['getCurrentBaseUrl'](),f=this[v(0x1a0)][v(0x199)][v(0x1fc)](),l=H+'/v1/login',t={'Authorization':'Bearer\x20'+f},b=yield(0x0,utils_1['retry'])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const R=v;return(0x0,node_fetch_1[R(0x1f3)])(l,{'method':'GET','timeout':0xbb8,'headers':t});}));if(b['ok'])return!![];return![];}catch(i){return![];}});}}function a4f(H,f){const l=a4H();return a4f=function(t,b){t=t-0x18e;let i=l[t];return i;},a4f(H,f);}exports[a4X(0x1db)]=CliContext;function a4H(){const s=['No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','List\x20all\x20available\x20contexts','removeContext','defineProperty','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','getProjectName','640ncHQEZ','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','confirm','set','node-fetch','alias','inquirer','name','verifyToken','6411060NFukDx','host','\x27\x20successfully\x20removed.','use\x20from\x20now\x20on','../console-format-helpers','host\x20url\x20for\x20this\x20context','finally','loadContextWrapper','startLogin','130886jqZbwA','close','hasOwnProperty','message','6IImTDJ','128491mJpgNB','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','browserLogin','CliContext','-n,\x20--name\x20[NAME]','defaultBaseUrl','update-token','map','5605120NdIhIt','override','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','tokenPrompt','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','getCurrentName','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','getCurrentProjectName','warning','use','tokenLogin','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','fullUrl','token','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','remove','autologin-','dir','prototype','default','Retrieve\x20and\x20update\x20local\x20context\x20settings.','current','10677375nkyIww','Local\x20context\x20name\x20to\x20remove.','-h,\x20--host\x20[HOST]','catch','login','Use\x20job\x20with\x20id:','getCurrentToken','https://','updateToken','then','10WDvYeo','askForProject','../utils','1696736NPUTta','__awaiter','Error\x20occured\x20during\x20browser\x20login:\x20','Name\x20for\x20login\x20context','Login\x20to\x20','get','useServiceId','sort','\x20successful','done','-t,\x20--token\x20[TOKEN]','writable','log','action','sanitiseHostname','contexts','addCommand','call','ctx','Token\x20for\x20this\x20context','__importDefault','contextAvailable','configurable','all','throw','context','31618QMrExl','create','list','project','lodash','.\x20Using\x20fallback.','apiTokenLogin','-i,\x20--id\x20[ID]','description','doNotOpenBrowser','option','stdout','Switch\x20between\x20your\x20local\x20contexts','length','Use\x20manual\x20login\x20with\x20API\x20token','service','--do-not-open-browser','value','contextProvider','prompt','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','__esModule','next','Local\x20context\x20\x27','askForContext','apiClient','Choose\x20the\x20context\x20to\x20','Token\x20for\x20current\x20context\x20\x27','printAsTable','101xnqEuw','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','error','apply','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','1032yPsnqB','success','clearLine','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','getCommand','Contexts','useContext','Use\x20project\x20with\x20id:','InquirerHelper','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','italic','Remove\x20a\x20context','useProjectId','Changed\x20current\x20context\x20to\x20','sessionToken=********','--all','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','loginPrompt'];a4H=function(){return s;};return a4H();}
1
+ 'use strict';const a2c=a2M;(function(N,M){const y=a2M,V=N();while(!![]){try{const L=-parseInt(y(0x128))/0x1*(-parseInt(y(0x135))/0x2)+-parseInt(y(0x137))/0x3+-parseInt(y(0x162))/0x4+parseInt(y(0x13d))/0x5*(parseInt(y(0x119))/0x6)+-parseInt(y(0x145))/0x7*(-parseInt(y(0x103))/0x8)+parseInt(y(0x107))/0x9+-parseInt(y(0x11e))/0xa;if(L===M)break;else V['push'](V['shift']());}catch(k){V['push'](V['shift']());}}}(a2N,0xa143e));function a2M(N,M){const V=a2N();return a2M=function(L,k){L=L-0xcd;let R=V[L];return R;},a2M(N,M);}var __createBinding=this&&this[a2c(0x163)]||(Object['create']?function(N,M,V,L){const T=a2c;if(L===undefined)L=V;var R=Object[T(0xd6)](M,V);(!R||(T(0xf0)in R?!M['__esModule']:R['writable']||R[T(0xd0)]))&&(R={'enumerable':!![],'get':function(){return M[V];}}),Object['defineProperty'](N,L,R);}:function(N,M,V,L){if(L===undefined)L=V;N[L]=M[V];}),__setModuleDefault=this&&this[a2c(0xfd)]||(Object[a2c(0xe6)]?function(N,M){Object['defineProperty'](N,'default',{'enumerable':!![],'value':M});}:function(N,M){const U=a2c;N[U(0xf6)]=M;}),__importStar=this&&this['__importStar']||function(N){const Z=a2c;if(N&&N['__esModule'])return N;var M={};if(N!=null){for(var V in N)if(V!==Z(0xf6)&&Object['prototype'][Z(0xd1)][Z(0xcd)](N,V))__createBinding(M,N,V);}return __setModuleDefault(M,N),M;},__awaiter=this&&this[a2c(0xdd)]||function(N,M,V,L){function k(R){return R instanceof V?R:new V(function(r){r(R);});}return new(V||(V=Promise))(function(R,r){const v=a2M;function Q(X){const n=a2M;try{h(L[n(0x117)](X));}catch(u){r(u);}}function z(X){const I=a2M;try{h(L[I(0x164)](X));}catch(u){r(u);}}function h(X){const d=a2M;X[d(0xe4)]?R(X[d(0x13c)]):k(X[d(0x13c)])[d(0x132)](Q,z);}h((L=L[v(0x129)](N,M||[]))['next']());});},__importDefault=this&&this[a2c(0x110)]||function(N){return N&&N['__esModule']?N:{'default':N};};Object[a2c(0xf4)](exports,'__esModule',{'value':!![]}),exports[a2c(0xf2)]=void 0x0;const _=__importStar(require(a2c(0x11f))),node_fetch_1=__importDefault(require('node-fetch')),chalk_1=__importDefault(require(a2c(0x104))),utils_1=require(a2c(0x150)),inquirer_helper_1=require(a2c(0xf3)),console_format_helpers_1=require('../formatting/console-format-helpers'),browser_login_1=require('../login/browser-login'),inquirer=require(a2c(0xe0));class CliContext{constructor(N,M=a2c(0xfe)){const a=a2c;this[a(0x124)]=M,this['sanitiseHostname']=u=>{const l=a;let p=u;return!/^https?:\/\//i[l(0xd5)](p)&&(p='https://'+p),p=p['replace'](/\/+$/,''),p;},this[a(0x109)]=N;const V=new inquirer_helper_1[(a(0xf9))](N);this['login']=(0x0,utils_1[a(0x121)])()[a(0x15e)]('login')[a(0x133)](a(0xd2))[a(0x10c)](a(0xe5),'Use\x20manual\x20login\x20with\x20API\x20token',![])[a(0x10c)](a(0xe7),'Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login',![])['option'](a(0xfb),'Name\x20for\x20login\x20context')[a(0x10c)](a(0x147),'Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used')[a(0x10c)](a(0x143),a(0x11c),this['defaultBaseUrl'])[a(0x10c)]('--override',a(0x13f),![])[a(0x114)](u=>__awaiter(this,void 0x0,void 0x0,function*(){const o=a;_[o(0x108)](u,o(0x101),this['sanitiseHostname'](u[o(0x101)]));const {name:p,host:F,token:S,override:b}=u['tokenLogin']||u[o(0x105)]!==undefined?yield this[o(0xda)](u,V):yield this[o(0x13b)](u,V);try{yield this['apiClient'][o(0x157)][o(0x11b)]({'name':p,'host':F,'token':S},b);}catch(s){(0x0,utils_1[o(0x126)])(s[o(0x15c)]);return;}!(yield this['verifyToken']())?((0x0,utils_1[o(0x126)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.'),yield this[o(0x109)][o(0x157)][o(0x122)](p)):(0x0,utils_1[o(0x148)])(o(0xd7)+F+o(0x12f));})),this['contexts']=(0x0,utils_1['getCommand'])()[a(0x15e)]('context')[a(0x133)](a(0x131))[a(0x136)](a(0x13a))[a(0x136)]('ctx');const L=(0x0,utils_1[a(0x121)])()[a(0x15e)]('list')['name']('ls')[a(0x133)](a(0x151))[a(0x10c)](a(0xe1),'Shows\x20full\x20context\x20information\x20(including\x20tokens)')[a(0x114)](u=>__awaiter(this,void 0x0,void 0x0,function*(){const t=a;console[t(0x127)](N['contextProvider'][t(0x134)]());const p=N[t(0x157)][t(0x15a)]();if(u[t(0x15d)]===!![]){console['dir'](p);return;}const F=p[t(0x11a)],S=p[t(0x13a)][t(0xea)]((b,s)=>b[t(0x15e)]===F?-0x1:s['name']===F?0x1:0x0)[t(0x116)](b=>{const g=t,s=F===b[g(0x15e)]?g(0xce):'';return{'Name':''+b['name']+s,'Host':b[g(0x101)],'Default\x20Project':b[g(0xeb)]||'-','Default\x20Service':b[g(0x139)]||'-'};});(0x0,console_format_helpers_1['printAsTable'])(S,t(0xe2));})),k=(0x0,utils_1[a(0x121)])();k[a(0x15e)](a(0x12e))[a(0x133)](a(0xef))[a(0x10c)](a(0xfb),a(0x14c))[a(0x114)](u=>__awaiter(this,void 0x0,void 0x0,function*(){const m=a,p=(u===null||u===void 0x0?void 0x0:u['name'])||(yield this[m(0x152)]('use'));yield this[m(0x109)][m(0x157)][m(0x154)](p),(0x0,utils_1[m(0x148)])(m(0x140)+p);}));const R='-i,\x20--id\x20[ID]',r=(0x0,utils_1[a(0x121)])()[a(0x15e)](a(0xeb))[a(0x133)](a(0xf8))[a(0x10c)](R,a(0x115))['action'](u=>__awaiter(this,void 0x0,void 0x0,function*(){const W=a,p=(u===null||u===void 0x0?void 0x0:u['id'])||(yield V[W(0x10f)]());yield this[W(0x109)][W(0x157)][W(0x12a)](p),console[W(0x127)](W(0x112),p);})),Q=(0x0,utils_1['getCommand'])()[a(0x15e)](a(0x139))['description'](a(0xf1))[a(0x10c)](R,a(0x102))[a(0x114)](u=>__awaiter(this,void 0x0,void 0x0,function*(){const x=a,p=(u===null||u===void 0x0?void 0x0:u['id'])||(yield V[x(0x160)](this[x(0x118)]())());console['log']('Use\x20service\x20with\x20id:',p),yield this[x(0x109)]['contextProvider']['useServiceId'](p);})),z=(0x0,utils_1['getCommand'])()[a(0x15e)]('job')[a(0x133)](a(0xfc))['option'](R,a(0xfa))[a(0x114)](u=>__awaiter(this,void 0x0,void 0x0,function*(){const K=a,p=(u===null||u===void 0x0?void 0x0:u['id'])||(yield V[K(0x155)](this[K(0x118)]())());console[K(0x127)](K(0x125),p),yield this['apiClient'][K(0x157)]['useJobId'](p);}));k[a(0x10e)](r),k[a(0x10e)](z),k[a(0x10e)](Q);const h=(0x0,utils_1[a(0x121)])()['name'](a(0x14f))['alias'](a(0xd8))[a(0x136)]('rm')[a(0x133)](a(0xff))[a(0x10c)](R,a(0x111))['action'](u=>__awaiter(this,void 0x0,void 0x0,function*(){const A=a;var p;const F=(u===null||u===void 0x0?void 0x0:u['id'])||(yield this['askForContext'](A(0x14f))),S=(p=this[A(0x109)][A(0x157)][A(0x123)]())===null||p===void 0x0?void 0x0:p[A(0x15e)];yield this['apiClient']['contextProvider']['removeContext'](F),(0x0,utils_1['success'])(A(0x10d)+F+'\x27\x20successfully\x20removed.');if(!this[A(0x113)]()){(0x0,utils_1[A(0xcf)])(A(0x106));return;}if(S===F){const b=(u===null||u===void 0x0?void 0x0:u[A(0x15e)])||(yield this[A(0x152)](A(0xe9)));yield this[A(0x109)][A(0x157)][A(0x154)](b),(0x0,utils_1['success'])(A(0x140)+b);}})),X=(0x0,utils_1[a(0x121)])()[a(0x15e)]('update-token')[a(0x136)]('set-token')[a(0x133)](a(0xe8))[a(0x10c)](a(0x147),a(0xf7))[a(0x114)](u=>__awaiter(this,void 0x0,void 0x0,function*(){const e=a,{contextProvider:p}=this[e(0x109)],F=(u===null||u===void 0x0?void 0x0:u[e(0x105)])||(yield V[e(0x14b)]()),S=p[e(0xed)]();yield p['updateToken'](F);if(yield this['verifyToken']())(0x0,utils_1['success'])(e(0x12c)+p[e(0xd9)]()+e(0x144));else{if(S)yield p['updateToken'](S);(0x0,utils_1[e(0x126)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed');}}));this['contexts'][a(0x10e)](L),this[a(0x13a)][a(0x10e)](k),this[a(0x13a)][a(0x10e)](h),this[a(0x13a)][a(0x10e)](X);}[a2c(0x13b)](N,M){var V,L,k,R;return __awaiter(this,void 0x0,void 0x0,function*(){const f=a2M,r=!N[f(0x142)],Q=(V=N['host'])!==null&&V!==void 0x0?V:this[f(0x124)],z=new browser_login_1[(f(0xe3))](Q,r);let h;z['on'](f(0xf5),({url:F})=>{const G=f;if(r){const S=F[G(0x11d)](/sessionToken=.*/,G(0x10b));console['log'](G(0x153)+S+')'),h=inquirer[G(0x12b)]([{'type':G(0x146),'name':G(0x159),'message':G(0x15f),'default':![]}]),h[G(0x132)](b=>{const q=G;process['stdout']['moveCursor'](0x0,-0x1),process['stdout'][q(0x158)](0x1),b[q(0x159)]&&console[q(0x127)](q(0x149)+F+'\x20');});}else console[G(0x127)](G(0x149)+F+'\x20');});const {token:X,contextName:u}=yield z[f(0xd4)]()[f(0xd3)](F=>__awaiter(this,void 0x0,void 0x0,function*(){const i=f;(0x0,utils_1['error'])(i(0x14d)+F[i(0x15c)]+i(0x130));const S=yield this[i(0xda)](N,M);return{'token':S[i(0x105)],'contextName':S[i(0x15e)]};}))[f(0x10a)](()=>{const w=f;if(h)h['ui'][w(0xec)]();}),p=(k=(L=N[f(0x15e)])!==null&&L!==void 0x0?L:u)!==null&&k!==void 0x0?k:'autologin-'+new Date()[f(0x100)]();return(0x0,utils_1[f(0x148)])(f(0xdf)+chalk_1['default']['italic'](p)),{'name':p,'token':X,'host':Q,'override':(R=N[f(0x15b)])!==null&&R!==void 0x0?R:![]};});}[a2c(0xda)](N,M){return __awaiter(this,void 0x0,void 0x0,function*(){const E=a2M,V=this[E(0x109)][E(0x157)][E(0x15a)]()[E(0x13a)],{name:L,token:k,host:R,override:r}=yield M[E(0x13e)](N,V);return{'name':L,'token':k,'host':R,'override':r};});}[a2c(0x118)](){const D=a2c,N=this['apiClient'][D(0x157)][D(0x12d)]();if(N===undefined)throw new Error(D(0x120));return N;}[a2c(0x152)](N){return __awaiter(this,void 0x0,void 0x0,function*(){const Y=a2M;if(!this[Y(0x113)]())throw new Error(Y(0x138));const M=this[Y(0x109)]['contextProvider'][Y(0x15a)]()['contexts'][Y(0x116)](L=>L[Y(0x15e)]),V=M[Y(0xdc)]>0x4?Y(0xee):Y(0x156);return(yield inquirer[Y(0x12b)]([{'type':V,'name':Y(0x15e),'message':Y(0x14e)+N+':','choices':M}]))[Y(0x15e)];});}['contextAvailable'](){const J=a2c;return this[J(0x109)][J(0x157)]['loadContextWrapper']()[J(0x13a)][J(0xdc)]>0x0;}[a2c(0x161)](){return __awaiter(this,void 0x0,void 0x0,function*(){const j=a2M;try{const N=this['apiClient'][j(0x157)][j(0x141)](),M=this[j(0x109)]['contextProvider'][j(0xed)](),V=N+j(0xde),L={'Authorization':j(0xdb)+M},k=yield(0x0,utils_1['retry'])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const P=j;return(0x0,node_fetch_1[P(0xf6)])(V,{'method':P(0x14a),'timeout':0xbb8,'headers':L});}));if(k['ok'])return!![];return![];}catch(R){return![];}});}}function a2N(){const H=['155860jhgiTF','loginPrompt','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','Changed\x20current\x20context\x20to\x20','getCurrentBaseUrl','doNotOpenBrowser','-h,\x20--host\x20[HOST]','\x27\x20successfully\x20updated.','7225519SVThTz','confirm','-t,\x20--token\x20[TOKEN]','success','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','GET','tokenPrompt','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','Error\x20occured\x20during\x20browser\x20login:\x20','Choose\x20the\x20context\x20to\x20','remove','../utils','List\x20all\x20available\x20contexts','askForContext','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','useContext','askForJob','list','contextProvider','clearLine','fullUrl','loadContextWrapper','override','message','all','name','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','askForService','verifyToken','2142320POfItD','__createBinding','throw','call','\x20(current)','warning','configurable','hasOwnProperty','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','catch','startLogin','test','getOwnPropertyDescriptor','Login\x20to\x20','delete','getCurrentName','apiTokenLogin','Bearer\x20','length','__awaiter','/v1/login','\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20','inquirer','--all','Contexts','NorthflankApiBrowserLogin','done','--token-login','create','--do-not-open-browser','Update\x20token\x20for\x20current\x20context','use\x20from\x20now\x20on','sort','project','close','getCurrentToken','search-list','Switch\x20between\x20your\x20local\x20contexts','get','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','CliContext','../inquirer-helper','defineProperty','browser-opened','default','Token\x20for\x20this\x20context','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','InquirerHelper','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','-n,\x20--name\x20[NAME]','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','__setModuleDefault','https://api.northflank.com','Remove\x20a\x20context','valueOf','host','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','8VKfRdY','chalk','token','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','9615384CApJkp','set','apiClient','finally','sessionToken=********','option','Local\x20context\x20\x27','addCommand','askForProject','__importDefault','Local\x20context\x20name\x20to\x20remove.','Use\x20project\x20with\x20id:','contextAvailable','action','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','map','next','getProjectName','66PpevVj','current','addContext','host\x20url\x20for\x20this\x20context','replace','13843350lNonDZ','lodash','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','getCommand','removeContext','getCurrentContext','defaultBaseUrl','Use\x20job\x20with\x20id:','error','log','277aZBLWk','apply','useProjectId','prompt','Token\x20for\x20current\x20context\x20\x27','getCurrentProjectName','use','\x20successful','.\x20Using\x20fallback.','Retrieve\x20and\x20update\x20local\x20context\x20settings.','then','description','getInfo','7258LXzWaD','alias','2604783dDrErz','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','service','contexts','browserLogin','value'];a2N=function(){return H;};return a2N();}exports[a2c(0xf2)]=CliContext;