@northflank/cli 0.9.10 → 0.9.11

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 a0T2=a0p;(function(T,p){const T1=a0p,y=T();while(!![]){try{const G=-parseInt(T1(0x196))/0x1*(-parseInt(T1(0x17d))/0x2)+-parseInt(T1(0x1c1))/0x3+-parseInt(T1(0x1a1))/0x4*(-parseInt(T1(0x1bd))/0x5)+-parseInt(T1(0x185))/0x6*(-parseInt(T1(0x1ad))/0x7)+-parseInt(T1(0x1a2))/0x8+-parseInt(T1(0x19f))/0x9*(parseInt(T1(0x19a))/0xa)+-parseInt(T1(0x190))/0xb*(-parseInt(T1(0x199))/0xc);if(G===p)break;else y['push'](y['shift']());}catch(q){y['push'](y['shift']());}}}(a0T,0xbf2cf));var __awaiter=this&&this[a0T2(0x19d)]||function(T,p,y,G){function q(S){return S instanceof y?S:new y(function(K){K(S);});}return new(y||(y=Promise))(function(S,K){const T6=a0p;function s(i){const T3=a0p;try{M(G[T3(0x1b4)](i));}catch(m){K(m);}}function N(i){const T4=a0p;try{M(G[T4(0x1b6)](i));}catch(m){K(m);}}function M(i){const T5=a0p;i['done']?S(i[T5(0x1bb)]):q(i[T5(0x1bb)])[T5(0x198)](s,N);}M((G=G[T6(0x195)](T,p||[]))[T6(0x1b4)]());});};Object[a0T2(0x187)](exports,'__esModule',{'value':!![]}),exports[a0T2(0x1be)]=void 0x0;const utils_1=require(a0T2(0x1b3)),defaultPaginationPageSize=0x32,getProjects=T=>p=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const T7=a0T2;var y;const G=yield T[T7(0x180)]['projects']({'options':{'per_page':defaultPaginationPageSize,'cursor':p===null||p===void 0x0?void 0x0:p[T7(0x197)]}});return{'elements':G[T7(0x19b)][T7(0x1a5)][T7(0x194)](q=>q['id']),'nextPageCursor':(y=G['pagination'])===null||y===void 0x0?void 0x0:y['cursor']};}),getServices=(T,p)=>y=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const T8=a0T2;var G;const q=yield T[T8(0x180)][T8(0x18a)]({'parameters':{'projectId':p},'options':{'per_page':defaultPaginationPageSize,'cursor':y===null||y===void 0x0?void 0x0:y[T8(0x197)]}});return{'elements':q[T8(0x19b)][T8(0x18a)][T8(0x194)](S=>S['id']),'nextPageCursor':(G=q['pagination'])===null||G===void 0x0?void 0x0:G[T8(0x1b1)]};}),getAddons=(T,p)=>y=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const T9=a0T2;var G;const q=yield T['list'][T9(0x1a3)]({'parameters':{'projectId':p},'options':{'per_page':defaultPaginationPageSize,'cursor':y===null||y===void 0x0?void 0x0:y['nextPageCursor']}});return{'elements':q[T9(0x19b)][T9(0x1a3)][T9(0x194)](S=>S['id']),'nextPageCursor':(G=q[T9(0x192)])===null||G===void 0x0?void 0x0:G[T9(0x1b1)]};}),getAddonBackups=(T,p,y)=>G=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const TT=a0T2;var q;const S=yield T['get'][TT(0x182)][TT(0x19e)]({'parameters':{'projectId':p,'addonId':y},'options':{'per_page':defaultPaginationPageSize,'cursor':G===null||G===void 0x0?void 0x0:G[TT(0x197)]}});return{'elements':S[TT(0x19b)]['backups']['map'](K=>K['id']),'nextPageCursor':(q=S[TT(0x192)])===null||q===void 0x0?void 0x0:q['cursor']};});function fetchResourceList(T,p,y,G,q,S){var K,s,N,M,i,m,R,u,b,B,o,f;return __awaiter(this,void 0x0,void 0x0,function*(){const Tp=a0p,d=undefined;try{if(T===Tp(0x1af)){const A=yield p[Tp(0x180)][Tp(0x1b2)]({}),c=A[Tp(0x19b)][Tp(0x1b2)]['map'](F=>{const Ty=Tp;var Z;return(Z=F===null||F===void 0x0?void 0x0:F[Ty(0x1c0)])!==null&&Z!==void 0x0?Z:F===null||F===void 0x0?void 0x0:F['id'];});return{'choices':c,'defaultValue':d};}if(T===Tp(0x1b0)&&!(y===null||y===void 0x0?void 0x0:y['includes'](Tp(0x186)))){const F=yield p[Tp(0x180)][Tp(0x1ae)]({}),Z=F[Tp(0x19b)][Tp(0x1ae)][Tp(0x194)](j=>{var V;return(V=j===null||j===void 0x0?void 0x0:j['internalId'])!==null&&V!==void 0x0?V:j===null||j===void 0x0?void 0x0:j['id'];});return{'choices':Z,'defaultValue':d};}if(T===Tp(0x18e)){const j=yield getProjects(p),{elements:V,nextPageCursor:h}=yield j();return{'choices':V,'defaultValue':d,'pagination':{'nextPageCursor':h,'loadMore':j}};}if(T==='credentials'){const v=yield p[Tp(0x180)]['registries']({}),t=v[Tp(0x19b)]['credentials'][Tp(0x194)](g=>g['id']);return{'choices':t,'defaultValue':d};}const Q=q===null||q===void 0x0?void 0x0:q[Tp(0x18e)],U=T===Tp(0x1a8)||T==='id'&&(S===null||S===void 0x0?void 0x0:S[Tp(0x181)](Tp(0x1b7)));if(Q!==undefined&&U){const g=yield getServices(p,Q),{elements:I,nextPageCursor:r}=yield g();return{'choices':I,'defaultValue':d,'pagination':{'nextPageCursor':r,'loadMore':g}};}const D=y===null||y===void 0x0?void 0x0:y['includes'](Tp(0x182));if(D){const Y=z=>__awaiter(this,void 0x0,void 0x0,function*(){const TG=Tp;var x;const W=yield p[TG(0x1b8)][TG(0x182)][TG(0x1ac)]({});return(x=W['data'][TG(0x1a9)])===null||x===void 0x0?void 0x0:x[TG(0x1a0)](P=>P[TG(0x18c)]===z);});if(T===Tp(0x18c)){const z=yield p[Tp(0x1b8)][Tp(0x182)][Tp(0x1ac)]({}),x=(K=z[Tp(0x19b)][Tp(0x1a9)])===null||K===void 0x0?void 0x0:K[Tp(0x194)](W=>W[Tp(0x18c)]);return{'choices':x,'defaultValue':d};}if(T==='version'&&(G===null||G===void 0x0?void 0x0:G[Tp(0x18c)])!==undefined){const W=(s=yield Y(G[Tp(0x18c)]))===null||s===void 0x0?void 0x0:s[Tp(0x191)];return{'choices':W,'defaultValue':d};}if(T===Tp(0x1a7)&&(G===null||G===void 0x0?void 0x0:G[Tp(0x18c)])!==undefined){const P=(M=(N=yield Y(G['type']))===null||N===void 0x0?void 0x0:N['resources'])===null||M===void 0x0?void 0x0:M['storage'];return{'choices':P===null||P===void 0x0?void 0x0:P['options'],'defaultValue':P===null||P===void 0x0?void 0x0:P[Tp(0x184)]};}if(T===Tp(0x1aa)&&(G===null||G===void 0x0?void 0x0:G['type'])!==undefined){const X=(m=(i=yield Y(G[Tp(0x18c)]))===null||i===void 0x0?void 0x0:i[Tp(0x18b)])===null||m===void 0x0?void 0x0:m[Tp(0x1aa)];return{'choices':X===null||X===void 0x0?void 0x0:X[Tp(0x1bf)],'defaultValue':X===null||X===void 0x0?void 0x0:X[Tp(0x184)]};}}if(T===Tp(0x183)&&(q===null||q===void 0x0?void 0x0:q[Tp(0x18e)])!==undefined){const J=yield getAddons(p,q===null||q===void 0x0?void 0x0:q[Tp(0x18e)]),{elements:n,nextPageCursor:k}=yield J();return{'choices':n,'defaultValue':d,'pagination':{'nextPageCursor':k,'loadMore':J}};}if(T===Tp(0x1b9)&&(q===null||q===void 0x0?void 0x0:q['projectId'])!==undefined&&((R=G===null||G===void 0x0?void 0x0:G['source'])===null||R===void 0x0?void 0x0:R[Tp(0x183)])!==undefined){const a=yield getAddonBackups(p,q===null||q===void 0x0?void 0x0:q['projectId'],(u=G===null||G===void 0x0?void 0x0:G[Tp(0x1ba)])===null||u===void 0x0?void 0x0:u[Tp(0x183)]),{elements:L,nextPageCursor:O}=yield a();return{'choices':L,'defaultValue':d,'pagination':{'nextPageCursor':O,'loadMore':a}};}const w=(b=q===null||q===void 0x0?void 0x0:q[Tp(0x183)])!==null&&b!==void 0x0?b:(B=G===null||G===void 0x0?void 0x0:G[Tp(0x1a6)])===null||B===void 0x0?void 0x0:B['addonId'];if((y===null||y===void 0x0?void 0x0:y['join'](''))==='updateaddonversion'&&T===Tp(0x1b5)&&(q===null||q===void 0x0?void 0x0:q[Tp(0x18e)])!==undefined&&w!==undefined){const {upgradeTo:H}=(yield p['get'][Tp(0x182)][Tp(0x1b5)]({'parameters':{'addonId':w,'projectId':q===null||q===void 0x0?void 0x0:q['projectId']}}))['data'];if(H===undefined||H[Tp(0x19c)]<=0x0){(0x0,utils_1[Tp(0x1ab)])(Tp(0x1bc));throw new Error();}return{'choices':H[Tp(0x194)](l=>l['version']),'defaultValue':d};}if(T===Tp(0x1a4)){const l=yield p['list'][Tp(0x18f)]({}),C=l[Tp(0x19b)][Tp(0x18f)][Tp(0x194)](E=>E===null||E===void 0x0?void 0x0:E['id']);return{'choices':C,'defaultValue':d};}if(((y===null||y===void 0x0?void 0x0:y['includes'](Tp(0x193)))||(y===null||y===void 0x0?void 0x0:y[Tp(0x181)](Tp(0x17f))))&&T==='keyName'&&w!==undefined&&(q===null||q===void 0x0?void 0x0:q[Tp(0x18e)])!==undefined){const E=(yield p['get'][Tp(0x182)][Tp(0x189)]({'parameters':{'addonId':w,'projectId':q===null||q===void 0x0?void 0x0:q['projectId']}}))[Tp(0x19b)];return{'choices':[...(o=Object[Tp(0x17e)](E===null||E===void 0x0?void 0x0:E[Tp(0x188)]))!==null&&o!==void 0x0?o:[],...(f=Object[Tp(0x17e)](E===null||E===void 0x0?void 0x0:E[Tp(0x18d)]))!==null&&f!==void 0x0?f:[]]};}}catch(T0){}return{'choices':undefined,'defaultValue':d};});}function a0T(){const Tq=['apply','77BJJrmc','nextPageCursor','then','20307396dwGIKP','10FaJaqg','data','length','__awaiter','backups','1623492CmkrvU','find','7916FLfoSO','6153632kqNBKB','addons','templateId','projects','addonDependencies','storage','serviceId','addonTypes','replicas','warning','types','203QAItIG','regions','deploymentPlan','region','cursor','plans','./utils','next','version','throw','owningObject','get','backupId','source','value','No\x20available\x20versions\x20to\x20upgrade\x20to.','465WVinlv','fetchResourceList','options','internalId','3570360rLdSEa','14030oUbEII','keys','secret','list','includes','addon','addonId','default','104748qXGffB','logSink','defineProperty','envs','credentials','services','resources','type','secrets','projectId','templates','11ZMAqJf','versions','pagination','secretLink','map'];a0T=function(){return Tq;};return a0T();}function a0p(T,p){const y=a0T();return a0p=function(G,q){G=G-0x17d;let S=y[G];return S;},a0p(T,p);}exports['fetchResourceList']=fetchResourceList;
1
+ 'use strict';const a0w2=a0h;(function(w,h){const w1=a0h,G=w();while(!![]){try{const P=-parseInt(w1(0x15e))/0x1*(-parseInt(w1(0x13e))/0x2)+parseInt(w1(0x163))/0x3*(-parseInt(w1(0x168))/0x4)+parseInt(w1(0x160))/0x5*(-parseInt(w1(0x13a))/0x6)+-parseInt(w1(0x13f))/0x7+parseInt(w1(0x15b))/0x8*(-parseInt(w1(0x164))/0x9)+-parseInt(w1(0x15f))/0xa+parseInt(w1(0x159))/0xb*(parseInt(w1(0x149))/0xc);if(P===h)break;else G['push'](G['shift']());}catch(v){G['push'](G['shift']());}}}(a0w,0xd2829));var __awaiter=this&&this[a0w2(0x171)]||function(w,h,G,v){function O(Z){return Z instanceof G?Z:new G(function(a){a(Z);});}return new(G||(G=Promise))(function(Z,a){const w4=a0h;function l(A){try{U(v['next'](A));}catch(D){a(D);}}function B(A){try{U(v['throw'](A));}catch(D){a(D);}}function U(A){const w3=a0h;A[w3(0x166)]?Z(A[w3(0x165)]):O(A[w3(0x165)])[w3(0x177)](l,B);}U((v=v[w4(0x138)](w,h||[]))['next']());});};Object[a0w2(0x16b)](exports,a0w2(0x156),{'value':!![]}),exports[a0w2(0x16e)]=void 0x0;function a0h(w,h){const G=a0w();return a0h=function(P,v){P=P-0x138;let O=G[P];return O;},a0h(w,h);}const utils_1=require(a0w2(0x175)),defaultPaginationPageSize=0x32,getProjects=w=>h=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const w5=a0w2;var G;const P=yield w['list'][w5(0x173)]({'options':{'per_page':defaultPaginationPageSize,'cursor':h===null||h===void 0x0?void 0x0:h[w5(0x157)]}});return{'elements':P[w5(0x155)][w5(0x173)][w5(0x14a)](v=>v['id']),'nextPageCursor':(G=P['pagination'])===null||G===void 0x0?void 0x0:G['cursor']};}),getServices=(w,h)=>G=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const w6=a0w2;var P;const v=yield w[w6(0x16a)][w6(0x176)]({'parameters':{'projectId':h},'options':{'per_page':defaultPaginationPageSize,'cursor':G===null||G===void 0x0?void 0x0:G[w6(0x157)]}});return{'elements':v[w6(0x155)][w6(0x176)][w6(0x14a)](O=>O['id']),'nextPageCursor':(P=v[w6(0x169)])===null||P===void 0x0?void 0x0:P['cursor']};}),getAddons=(w,h)=>G=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const w7=a0w2;var P;const v=yield w[w7(0x16a)][w7(0x14f)]({'parameters':{'projectId':h},'options':{'per_page':defaultPaginationPageSize,'cursor':G===null||G===void 0x0?void 0x0:G[w7(0x157)]}});return{'elements':v['data'][w7(0x14f)][w7(0x14a)](O=>O['id']),'nextPageCursor':(P=v[w7(0x169)])===null||P===void 0x0?void 0x0:P['cursor']};}),getAddonBackups=(w,h,G)=>P=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const w8=a0w2;var v;const O=yield w[w8(0x146)][w8(0x152)][w8(0x147)]({'parameters':{'projectId':h,'addonId':G},'options':{'per_page':defaultPaginationPageSize,'cursor':P===null||P===void 0x0?void 0x0:P[w8(0x157)]}});return{'elements':O[w8(0x155)][w8(0x147)][w8(0x14a)](Z=>Z['id']),'nextPageCursor':(v=O[w8(0x169)])===null||v===void 0x0?void 0x0:v['cursor']};});function fetchResourceList(w,h,G,P,v,O){var Z,a,l,B,U,A,D,p,s,W,X,T;return __awaiter(this,void 0x0,void 0x0,function*(){const w9=a0h,I=undefined;try{if(w===w9(0x167)){const q=yield h[w9(0x16a)][w9(0x151)]({}),f=q['data'][w9(0x151)]['map'](i=>{const ww=w9;var u;return(u=i===null||i===void 0x0?void 0x0:i[ww(0x14c)])!==null&&u!==void 0x0?u:i===null||i===void 0x0?void 0x0:i['id'];});return{'choices':f,'defaultValue':I};}if(w===w9(0x15a)&&!(G===null||G===void 0x0?void 0x0:G[w9(0x145)](w9(0x153)))){const i=yield h[w9(0x16a)][w9(0x16f)]({}),u=i[w9(0x155)][w9(0x16f)][w9(0x14a)](t=>{const wh=w9;var S;return(S=t===null||t===void 0x0?void 0x0:t[wh(0x14c)])!==null&&S!==void 0x0?S:t===null||t===void 0x0?void 0x0:t['id'];});return{'choices':u,'defaultValue':I};}if(w===w9(0x15c)){const t=yield getProjects(h),{elements:S,nextPageCursor:V}=yield t();return{'choices':S,'defaultValue':I,'pagination':{'nextPageCursor':V,'loadMore':t}};}if(w===w9(0x14e)){const C=yield h[w9(0x16a)]['registryCredentials']({}),M=C[w9(0x155)][w9(0x14e)][w9(0x14a)](Q=>Q['id']);return{'choices':M,'defaultValue':I};}const k=v===null||v===void 0x0?void 0x0:v[w9(0x15c)],Y=w===w9(0x170)||w==='id'&&(O===null||O===void 0x0?void 0x0:O['includes'](w9(0x16c)));if(k!==undefined&&Y){const Q=yield getServices(h,k),{elements:H,nextPageCursor:n}=yield Q();return{'choices':H,'defaultValue':I,'pagination':{'nextPageCursor':n,'loadMore':Q}};}const x=G===null||G===void 0x0?void 0x0:G[w9(0x145)](w9(0x152));if(x){const c=r=>__awaiter(this,void 0x0,void 0x0,function*(){const wG=w9;var j;const m=yield h[wG(0x146)][wG(0x152)]['types']({});return(j=m[wG(0x155)][wG(0x141)])===null||j===void 0x0?void 0x0:j['find'](y=>y['type']===r);});if(w===w9(0x158)){const r=yield h[w9(0x146)][w9(0x152)][w9(0x143)]({}),j=(Z=r[w9(0x155)][w9(0x141)])===null||Z===void 0x0?void 0x0:Z[w9(0x14a)](m=>m[w9(0x158)]);return{'choices':j,'defaultValue':I};}if(w===w9(0x140)&&(P===null||P===void 0x0?void 0x0:P[w9(0x158)])!==undefined){const m=(a=yield c(P[w9(0x158)]))===null||a===void 0x0?void 0x0:a[w9(0x15d)];return{'choices':m,'defaultValue':I};}if(w===w9(0x178)&&(P===null||P===void 0x0?void 0x0:P[w9(0x158)])!==undefined){const y=(B=(l=yield c(P[w9(0x158)]))===null||l===void 0x0?void 0x0:l[w9(0x14b)])===null||B===void 0x0?void 0x0:B[w9(0x178)];return{'choices':y===null||y===void 0x0?void 0x0:y[w9(0x172)],'defaultValue':y===null||y===void 0x0?void 0x0:y['default']};}if(w==='replicas'&&(P===null||P===void 0x0?void 0x0:P['type'])!==undefined){const E=(A=(U=yield c(P[w9(0x158)]))===null||U===void 0x0?void 0x0:U[w9(0x14b)])===null||A===void 0x0?void 0x0:A['replicas'];return{'choices':E===null||E===void 0x0?void 0x0:E[w9(0x172)],'defaultValue':E===null||E===void 0x0?void 0x0:E[w9(0x161)]};}}if(w===w9(0x16d)&&(v===null||v===void 0x0?void 0x0:v[w9(0x15c)])!==undefined){const K=yield getAddons(h,v===null||v===void 0x0?void 0x0:v[w9(0x15c)]),{elements:g,nextPageCursor:J}=yield K();return{'choices':g,'defaultValue':I,'pagination':{'nextPageCursor':J,'loadMore':K}};}if(w===w9(0x150)&&(v===null||v===void 0x0?void 0x0:v['projectId'])!==undefined&&((D=P===null||P===void 0x0?void 0x0:P[w9(0x148)])===null||D===void 0x0?void 0x0:D[w9(0x16d)])!==undefined){const R=yield getAddonBackups(h,v===null||v===void 0x0?void 0x0:v[w9(0x15c)],(p=P===null||P===void 0x0?void 0x0:P[w9(0x148)])===null||p===void 0x0?void 0x0:p[w9(0x16d)]),{elements:N,nextPageCursor:z}=yield R();return{'choices':N,'defaultValue':I,'pagination':{'nextPageCursor':z,'loadMore':R}};}const b=(s=v===null||v===void 0x0?void 0x0:v[w9(0x16d)])!==null&&s!==void 0x0?s:(W=P===null||P===void 0x0?void 0x0:P[w9(0x13d)])===null||W===void 0x0?void 0x0:W[w9(0x16d)];if((G===null||G===void 0x0?void 0x0:G['join'](''))===w9(0x13c)&&w===w9(0x140)&&(v===null||v===void 0x0?void 0x0:v[w9(0x15c)])!==undefined&&b!==undefined){const {upgradeTo:F}=(yield h['get'][w9(0x152)][w9(0x140)]({'parameters':{'addonId':b,'projectId':v===null||v===void 0x0?void 0x0:v[w9(0x15c)]}}))[w9(0x155)];if(F===undefined||F['length']<=0x0){(0x0,utils_1[w9(0x174)])(w9(0x14d));throw new Error();}return{'choices':F[w9(0x14a)](o=>o[w9(0x140)]),'defaultValue':I};}if(w===w9(0x144)){const o=yield h[w9(0x16a)][w9(0x162)]({}),L=o[w9(0x155)]['templates'][w9(0x14a)](d=>d===null||d===void 0x0?void 0x0:d['id']);return{'choices':L,'defaultValue':I};}if(((G===null||G===void 0x0?void 0x0:G[w9(0x145)](w9(0x13b)))||(G===null||G===void 0x0?void 0x0:G[w9(0x145)](w9(0x142))))&&w==='keyName'&&b!==undefined&&(v===null||v===void 0x0?void 0x0:v[w9(0x15c)])!==undefined){const d=(yield h[w9(0x146)][w9(0x152)][w9(0x14e)]({'parameters':{'addonId':b,'projectId':v===null||v===void 0x0?void 0x0:v[w9(0x15c)]}}))[w9(0x155)];return{'choices':[...(X=Object[w9(0x139)](d===null||d===void 0x0?void 0x0:d['envs']))!==null&&X!==void 0x0?X:[],...(T=Object[w9(0x139)](d===null||d===void 0x0?void 0x0:d[w9(0x154)]))!==null&&T!==void 0x0?T:[]]};}}catch(w0){}return{'choices':undefined,'defaultValue':I};});}function a0w(){const wP=['addonTypes','secret','types','templateId','includes','get','backups','source','12OzEFjz','map','resources','internalId','No\x20available\x20versions\x20to\x20upgrade\x20to.','credentials','addons','backupId','plans','addon','logSink','secrets','data','__esModule','nextPageCursor','type','31372385fcwnFH','region','9752KjQcSP','projectId','versions','11609MMkUEP','7325220oZDRes','5FBxeQE','default','templates','111VmUUBP','6336HSuuLt','value','done','deploymentPlan','75860RomyLT','pagination','list','defineProperty','owningObject','addonId','fetchResourceList','regions','serviceId','__awaiter','options','projects','warning','./utils','services','then','storage','apply','keys','3456282DfWpch','secretLink','updateaddonversion','addonDependencies','170KvWUNr','756707JsArGB','version'];a0w=function(){return wP;};return a0w();}exports['fetchResourceList']=fetchResourceList;
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';const a1Tb=a1p;function a1p(T,p){const y=a1T();return a1p=function(G,q){G=G-0x161;let S=y[G];return S;},a1p(T,p);}(function(T,p){const Tu=a1p,y=T();while(!![]){try{const G=parseInt(Tu(0x252))/0x1+parseInt(Tu(0x1f3))/0x2*(parseInt(Tu(0x244))/0x3)+parseInt(Tu(0x1ed))/0x4+parseInt(Tu(0x166))/0x5+parseInt(Tu(0x1e9))/0x6+-parseInt(Tu(0x23f))/0x7*(parseInt(Tu(0x19a))/0x8)+-parseInt(Tu(0x22a))/0x9;if(G===p)break;else y['push'](y['shift']());}catch(q){y['push'](y['shift']());}}}(a1T,0xb786d));function a1T(){const Ta=['tpl','Resource\x20was\x20not\x20deleted.','templates','File\x20to\x20load\x20resource\x20json\x20from','job','getCurrentContext','adn','askForCredentials','addons','entries','repos','projects','hasOwnProperty','pop','getProgram','./defaults','region','getCurrentProjectName','portFwdCmd',',\x20-','secret','contexts','error','addHelpText','getCommandOverview','validate','find','stdout','output','assertContextExisting','branches','execCmd','defineProperty','vol','.yaml','file','CliLogs','contextProvider','\x0a\x09details\x20:','concat','then','call','northflank','deleteWarningPrompt','host','askForJobRun','./exec','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','Get\x20information\x20about\x20Northflank\x20','./inquirer-helper','map','resource','get','has','noDefaults','keys','endsWith','yaml','subdomainId','count','Northflank\x20cli\x20version:\x20','volume','service','secrets','CliPortForward','askForTemplate','opts','getCommand','upperFirst','Unknown\x20input\x20file\x20type:\x20','safeLoad','repository','/docs/v1/api/','replace','File\x20does\x20not\x20exist:\x20','clearLine','projectId','askForLogSink','103548RLzdnr','addHelpCommand','jobId','query','4117668wpfzkG','existsSync','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','update','getOwnPropertyDescriptor','ApiClient','738734WGMVZB','./port-forward','helpOption','./formatting/console-format-helpers','brn','__importDefault','status','toString','Command','there\x20are\x20more\x20rows,\x20load?','required','--verbose','volumes','underline','VERBOSE:\x20Request\x20body\x20->\x20','setPathVars','length','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','branch','addonId','CliContext','docsTagsPath','rgn','askForBuild','askConfirm','option','argv','value','requiredPermissions','askForSubdomain','svc','name','templateId','runId','omit','js-yaml','askForSecret','url','serviceId','__esModule','templateRunId','getOwnPropertyNames','bind','subdomain','details','backupId','commander','grey','\x0a>\x20Token\x20permissions\x20required:\x20','__setModuleDefault','startsWith','=>\x20running\x20command\x20with:\x20','method','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','askForService','22780647cXdJlt','plan','Documentation:\x20','getMetricsCommand','apply','log','addCommand','runtimeFiles/additionalProperties','pln','printAsTable','./utils','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','create','json','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','asyncSequential','split','match\x20exactly\x20one\x20schema\x20in\x20oneOf','configurable','getLogsCommand','regions','6705398qDQpUz','propToType','./context/contextCommands','.json','\x20--','12BDYTBn','inv','assign','aliases','join','project','body','invoices','Display\x20help\x20for\x20command','(HTTP\x20status\x20code:\x20','services','OPTIONAL:\x20','logSinkId','lodash','1317336UsXJEh','type','stringify','version','toLowerCase','volumeId','filter','@northflank/js-client','template','green','cred','quiet','forEach','next','domain','login','secretId','domainId','1996715dkbovA','invoice','../package.json','credential','addon','customUserAgent','set','delete','consoleFormat','warning','domains','includes','scrt','parseAsync','Update\x20Northflank\x20','opt','message','repo','list',',\x20NF\x20error\x20id:\x20','path','api.','description','default','verbose','chalk','repositories','some','isString','-v,\x20--version','sort','dmn','cursor','VERBOSE:\x20Using\x20endpoint\x20->\x20','askForPipeline','kebabCase','askForAddonBackup','endpoints','./formatting/command-overview','-i,\x20--input\x20<resource-def>','example','runs','buildId','done','credentialId','isEqual','throw','boolean','errors','yml','prototype','askForTemplateRun','8yCtZIS'];a1T=function(){return Ta;};return a1T();}var __createBinding=this&&this['__createBinding']||(Object[a1Tb(0x236)]?function(T,p,y,G){const TB=a1Tb;if(G===undefined)G=y;var q=Object[TB(0x1f1)](p,y);(!q||('get'in q?!p['__esModule']:q['writable']||q[TB(0x23c)]))&&(q={'enumerable':!![],'get':function(){return p[y];}}),Object[TB(0x1bb)](T,G,q);}:function(T,p,y,G){if(G===undefined)G=y;T[G]=p[y];}),__setModuleDefault=this&&this[a1Tb(0x224)]||(Object['create']?function(T,p){const To=a1Tb;Object[To(0x1bb)](T,To(0x17d),{'enumerable':!![],'value':p});}:function(T,p){const Tf=a1Tb;T[Tf(0x17d)]=p;}),__importStar=this&&this['__importStar']||function(T){const Td=a1Tb;if(T&&T[Td(0x21a)])return T;var p={};if(T!=null){for(var y in T)if(y!=='default'&&Object[Td(0x198)][Td(0x1a7)]['call'](T,y))__createBinding(p,T,y);}return __setModuleDefault(p,T),p;},__awaiter=this&&this['__awaiter']||function(T,p,y,G){function q(S){return S instanceof y?S:new y(function(K){K(S);});}return new(y||(y=Promise))(function(S,K){const Tw=a1p;function s(i){const TQ=a1p;try{M(G[TQ(0x161)](i));}catch(m){K(m);}}function N(i){const TU=a1p;try{M(G[TU(0x194)](i));}catch(m){K(m);}}function M(i){const TD=a1p;i[TD(0x191)]?S(i[TD(0x20e)]):q(i[TD(0x20e)])[TD(0x1c3)](s,N);}M((G=G[Tw(0x22e)](T,p||[]))[Tw(0x161)]());});},__importDefault=this&&this[a1Tb(0x1f8)]||function(T){return T&&T['__esModule']?T:{'default':T};};Object[a1Tb(0x1bb)](exports,a1Tb(0x21a),{'value':!![]}),exports['getProgram']=void 0x0;const js_client_1=require(a1Tb(0x259)),commander_1=__importDefault(require(a1Tb(0x221))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require('ajv')),chalk_1=__importDefault(require(a1Tb(0x17f))),_=__importStar(require(a1Tb(0x251))),contextCommands_1=require(a1Tb(0x241)),utils_1=require(a1Tb(0x234)),defaults=__importStar(require(a1Tb(0x1aa))),inquirer_helper_1=require(a1Tb(0x1cc)),console_format_helpers_1=require(a1Tb(0x1f6)),command_overview_1=require(a1Tb(0x18c)),port_forward_1=require(a1Tb(0x1f4)),exec_1=require(a1Tb(0x1c9)),logs_1=require('./logs'),metrics_1=require('./metrics'),yaml=require(a1Tb(0x216)),pgk=require(a1Tb(0x168)),getProgram=T=>{const TA=a1Tb,p=new commander_1['default'][(TA(0x1fb))](TA(0x1c5));p[TA(0x17c)](TA(0x228)),p['enablePositionalOptions'](!![]),p['version'](TA(0x1d7)+chalk_1['default'][TA(0x200)](pgk[TA(0x255)]),TA(0x183),'Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli');const y=new js_client_1['ApiClient'](T,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1['customUserAgent']}),G=new contextCommands_1[(TA(0x207))](y),q=new port_forward_1[(TA(0x1db))](T),S=new exec_1['CliExec'](T),K=new logs_1[(TA(0x1bf))](T),s=new metrics_1['CliMetrics'](T);return p[TA(0x230)](q[TA(0x1ad)]),p['addCommand'](S[TA(0x1ba)]),p[TA(0x230)](G[TA(0x163)]),p[TA(0x230)](G[TA(0x1b0)]),generateCommands(y,y[TA(0x18b)],p,K,s),p[TA(0x230)]((0x0,command_overview_1[TA(0x1b3)])(p)),p[TA(0x1ea)](!![],'Display\x20help\x20for\x20command'),p[TA(0x1f5)](undefined,TA(0x24c)),p;};exports[a1Tb(0x1a9)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Tc=a1Tb;try{const T=new js_client_1['ApiClientFileContextProvider']();yield(0x0,utils_1['checkUpdate'])(T);const p=(0x0,exports['getProgram'])(T);yield p[Tc(0x173)](process[Tc(0x20d)]);}catch(y){(0x0,utils_1[Tc(0x1b1)])(Tc(0x204)+y[Tc(0x176)]),process[Tc(0x20d)][Tc(0x1b5)](G=>G===Tc(0x1fe))&&console[Tc(0x22f)](y),process['exitCode']=0x1;}}))());function isListCommand(T){const TF=a1Tb,p=[[TF(0x1cf),TF(0x16a),'backups'],['get',TF(0x19f),TF(0x18f)]];return T[TF(0x1b5)](y=>y===TF(0x178))||p[TF(0x181)](y=>_[TF(0x193)](T,y));}function generateCommands(T,p,y,G,q,S=defaults['defaults'],K=[]){const TZ=a1Tb,s=new inquirer_helper_1['InquirerHelper'](new js_client_1[(TZ(0x1f2))](T[TZ(0x1c0)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[TZ(0x16b)]}));function N(u,b){const Tj=TZ;return u[Tj(0x1fd)]!==![]&&b===undefined;}function M(u,b){const TV=TZ,{opt:B,name:o}=u,f=B['default'],d=N(B,f),Q=F=>F[TV(0x203)]>0x1?'--'+F:'-'+F,U=B===null||B===void 0x0?void 0x0:B['alias'],D=U?_['isArray'](U)?'-'+(U===null||U===void 0x0?void 0x0:U[TV(0x1cd)](F=>Q(F))['join'](TV(0x1ae)))+',':''+Q(U):'',w=d?'':TV(0x24f),A=typeof B[TV(0x253)]===TV(0x195)?D+TV(0x243)+o:D+TV(0x243)+o+'\x20<'+o['toUpperCase']()+'>',c=w+B[TV(0x17c)];b[TV(0x20c)](A,c,f);}function i(){const Th=TZ;if(y['commands'][Th(0x181)](u=>u['name']()==='logs'))return;_[Th(0x193)](K,[Th(0x1cf),Th(0x1d9)])&&(y['addCommand'](G['getLogsCommand'](Th(0x1d9))),y['addCommand'](q[Th(0x22d)](Th(0x1d9))),y[Th(0x230)](G[Th(0x23d)](Th(0x1d9),!![])),y[Th(0x230)](q['getMetricsCommand'](Th(0x1d9),!![]))),_[Th(0x193)](K,['get','job'])&&(y[Th(0x230)](G[Th(0x23d)](Th(0x19f))),y[Th(0x230)](q[Th(0x22d)](Th(0x19f))),y[Th(0x230)](G[Th(0x23d)](Th(0x19f),!![])),y['addCommand'](q[Th(0x22d)](Th(0x19f),!![]))),_[Th(0x193)](K,['get','addon'])&&(y['addCommand'](G[Th(0x23d)](Th(0x16a))),y['addCommand'](q[Th(0x22d)](Th(0x16a))));}return Object['getOwnPropertyNames'](S)[TZ(0x25e)](u=>{const Tv=TZ,b=p[u],B=S[u],o=K[Tv(0x1c2)]([u]);function f(j,V){const Tt=Tv,h=Object[Tt(0x21c)](j||{});h['map'](v=>{return{'name':v,'opt':j[v]};})[Tt(0x184)]((v,t)=>!N(v['opt'])?!N(t['opt'])?0x0:0x1:-0x1)['forEach'](v=>{M(v,V);});}function d(j,V){const Tg=Tv,h=[[Tg(0x249),Tg(0x1a6),'prj'],['service',Tg(0x24e),Tg(0x211)],['credentials',Tg(0x169),Tg(0x25c)],['addon',Tg(0x1a3),Tg(0x1a1)],[Tg(0x19f),'jobs'],[Tg(0x22b),'plans',Tg(0x232)],[Tg(0x1ab),Tg(0x23e),Tg(0x209)],[Tg(0x162),Tg(0x170),Tg(0x185)],[Tg(0x1af),Tg(0x1da),Tg(0x172)],[Tg(0x1ff),Tg(0x1d8),Tg(0x1bc)],[Tg(0x1b9),Tg(0x205),Tg(0x1f7)],[Tg(0x167),Tg(0x24b),Tg(0x245)],[Tg(0x25a),Tg(0x19d),Tg(0x19b)],[Tg(0x1a5),Tg(0x1e2),Tg(0x180),Tg(0x177)]],v=h[Tg(0x1b5)](t=>t['includes'](V));if(v!==undefined)j[Tg(0x247)](v[Tg(0x258)](t=>t!==V));}function Q(j){var V,h;return __awaiter(this,void 0x0,void 0x0,function*(){const TI=a1p,v={},{contextProvider:t}=T,g=o[TI(0x171)](TI(0x16d)),I=j[TI(0x1d1)]===!![];function r(Y,z,x){var W,e;return __awaiter(this,void 0x0,void 0x0,function*(){const Tr=a1p;if(_[Tr(0x1d0)]((e=(W=B['opt'])===null||W===void 0x0?void 0x0:W[Tr(0x17a)])!==null&&e!==void 0x0?e:{},Y)){const P=!I&&!g&&x?x():undefined,X=j[Y]||P||(yield z());_[Tr(0x16c)](v,Y,X);}});}return yield(0x0,utils_1['asyncSequential'])(Object[TI(0x1a4)]((h=(V=B[TI(0x175)])===null||V===void 0x0?void 0x0:V[TI(0x17a)])!==null&&h!==void 0x0?h:{}),([Y,z])=>__awaiter(this,void 0x0,void 0x0,function*(){const TY=TI,x=v===null||v===void 0x0?void 0x0:v[TY(0x1e7)],W=v===null||v===void 0x0?void 0x0:v[TY(0x213)];switch(Y){case'projectId':return yield r(TY(0x1e7),s['askForProject'][TY(0x21d)](s),t[TY(0x1ac)]['bind'](t));case TY(0x219):return yield r(TY(0x219),s[TY(0x229)](x)[TY(0x21d)](s),t['getCurrentServiceName']['bind'](t));case'addonId':return yield r(TY(0x206),s['askForAddon'](x)[TY(0x21d)](s));case TY(0x1eb):return yield r(TY(0x1eb),s['askForJob'](x)['bind'](s),t['getCurrentJobName']['bind'](t));case TY(0x214):return yield r(TY(0x214),s[TY(0x1c8)](v[TY(0x1eb)],x,![])[TY(0x21d)](s));case TY(0x164):return yield r('secretId',s[TY(0x217)](x)['bind'](s));case'domain':case TY(0x165):return yield r(TY(0x162),s['askForDomain']['bind'](s));case TY(0x192):return yield r(TY(0x192),s[TY(0x1a2)]['bind'](s));case TY(0x257):return yield r('volumeId',s['askForVolume'](x)[TY(0x21d)](s));case TY(0x21e):return yield r(TY(0x21e),s[TY(0x210)](v['domain'])[TY(0x21d)](s));case TY(0x1d5):return yield r(TY(0x1d5),s[TY(0x210)](v[TY(0x165)])[TY(0x21d)](s));case TY(0x220):return yield r(TY(0x220),s[TY(0x18a)](x,v['addonId'])[TY(0x21d)](s));case TY(0x190):return yield r(TY(0x190),s[TY(0x20a)](x,v['serviceId'],v[TY(0x1eb)])[TY(0x21d)](s));case'templateId':return yield r(TY(0x213),s[TY(0x1dc)]()[TY(0x21d)](s));case TY(0x21b):return yield r('templateRunId',s[TY(0x199)](W)[TY(0x21d)](s));case TY(0x250):return yield r('logSinkId',s[TY(0x1e8)]()[TY(0x21d)](s));case'pipelineId':return yield r('pipelineId',s[TY(0x188)](x)[TY(0x21d)](s));default:return yield r(Y,s['askGeneric'](Y,z===null||z===void 0x0?void 0x0:z['description'])[TY(0x21d)](s));}})),v;});}function U(j){var V,h;return __awaiter(this,void 0x0,void 0x0,function*(){const Tz=a1p,v={},t=Object[Tz(0x1d2)]((h=(V=B[Tz(0x175)])===null||V===void 0x0?void 0x0:V[Tz(0x1ec)])!==null&&h!==void 0x0?h:{});return yield(0x0,utils_1[Tz(0x239)])(t,g=>__awaiter(this,void 0x0,void 0x0,function*(){const Tx=Tz;if(j[g]!==undefined)return j[g];const I={},{required:r,schema:Y}=B[Tx(0x175)][Tx(0x1ec)][g];return yield s[Tx(0x240)]([''+g],Y,I,r),I[g]!==undefined&&_[Tx(0x16c)](v,g,I[g]),I;})),v;});}function D(){const TW=Tv;switch(o[0x0]){case TW(0x1cf):return TW(0x1cb)+(o[0x1]||'resource')+'s';case TW(0x1f0):return TW(0x174)+(o[0x1]||TW(0x1ce))+'\x20properties';default:return _[TW(0x1df)](u)+'\x20Northflank\x20resources';}}function w(j,V){const Te=Tv;var h,v,t,g,I,r;if(!V){const J=(0x0,utils_1[Te(0x1de)])()[Te(0x212)](_[Te(0x189)](u))[Te(0x17c)](D());return d(J,u),J;}const Y=(j===null||j===void 0x0?void 0x0:j[Te(0x20f)])?chalk_1[Te(0x17d)][Te(0x222)](Te(0x223)+j['requiredPermissions']):'',z=T['contextProvider'][Te(0x1a0)](),x=z!==undefined&&((h=B===null||B===void 0x0?void 0x0:B['opt'])===null||h===void 0x0?void 0x0:h[Te(0x208)])!==undefined,W=z===null||z===void 0x0?void 0x0:z[Te(0x1c7)][Te(0x1e4)](Te(0x17b),''),e=x?Te(0x22c)+W+Te(0x1e3)+((v=B===null||B===void 0x0?void 0x0:B['opt'])===null||v===void 0x0?void 0x0:v['docsTagsPath']):'',P=(j===null||j===void 0x0?void 0x0:j[Te(0x17c)])||'',X=(0x0,utils_1[Te(0x1de)])(!![])['name'](_[Te(0x189)](u))[Te(0x17c)](P)[Te(0x1b2)]('after',[Y,e][Te(0x248)]('\x0a'));return d(X,u),((t=B[Te(0x175)])===null||t===void 0x0?void 0x0:t['body'])&&(X[Te(0x20c)]('-f,\x20--file\x20<file-path>',Te(0x19e)),X[Te(0x20c)](Te(0x18d),Te(0x1ef))),f((g=B[Te(0x175)])===null||g===void 0x0?void 0x0:g[Te(0x17a)],X),f((I=B[Te(0x175)])===null||I===void 0x0?void 0x0:I[Te(0x1ec)],X),f((r=B[Te(0x175)])===null||r===void 0x0?void 0x0:r['base'],X),X['action'](()=>__awaiter(this,void 0x0,void 0x0,function*(){const TP=Te;var n,k,a,L;(0x0,utils_1[TP(0x1b8)])(T);const O=X[TP(0x1dd)](),H=O===null||O===void 0x0?void 0x0:O[TP(0x1b7)],l=H===TP(0x237),C=H===TP(0x1d4)||H===TP(0x197),E=yield Q(O);s[TP(0x202)](E);const T0=yield U(O),T1=Object['keys']((k=(n=B[TP(0x175)])===null||n===void 0x0?void 0x0:n[TP(0x17a)])!==null&&k!==void 0x0?k:{})[TP(0x1cd)](T6=>T6+'='+chalk_1[TP(0x17d)][TP(0x25b)](E[T6]))[TP(0x248)](',\x20');if(T1[TP(0x203)]>0x0&&!l&&!C){const T6=TP(0x226)+T1;console[TP(0x22f)](T6);}const T2=((a=B['opt'])===null||a===void 0x0?void 0x0:a['body'])?yield R(O,B,o):undefined;if(!O['force']&&o[TP(0x171)](TP(0x16d))&&!(yield s[TP(0x1c6)]())){(0x0,utils_1[TP(0x16f)])(TP(0x19c));return;}function T3(T7,T8=![],T9=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const TX=a1p,{data:TT,request:Tp,error:Ty,pagination:TG}=yield b[TX(0x1c4)]({'parameters':E,'options':Object[TX(0x246)](Object[TX(0x246)]({},T0),{'cursor':T7}),'data':T2});(O===null||O===void 0x0?void 0x0:O[TX(0x17e)])&&(console[TX(0x22f)](TX(0x187)+Tp[TX(0x227)]+':'+Tp[TX(0x218)]),console[TX(0x22f)](TX(0x201)+Tp[TX(0x24a)]));if(Ty){const Tq=Ty[TX(0x21f)]?TX(0x1c1)+JSON['stringify'](Ty[TX(0x21f)]):'',TS=(Ty===null||Ty===void 0x0?void 0x0:Ty['id'])?TX(0x179)+Ty['id']:'',TK=TX(0x24d)+Ty[TX(0x1f9)]+TS+')';throw new Error('API\x20request\x20failed\x0a\x09Message:\x20'+Ty[TX(0x176)]+'\x20'+TK+Tq);}if(!(O===null||O===void 0x0?void 0x0:O[TX(0x25d)])){if(l)(0x0,console_format_helpers_1['handleJsonOutput'])(O===null||O===void 0x0?void 0x0:O[TX(0x1b7)],TT);else{if(C)(0x0,console_format_helpers_1['handleYamlOutput'])(O===null||O===void 0x0?void 0x0:O[TX(0x1b7)],TT);else{if(isListCommand(o)){const Ts=(H===null||H===void 0x0?void 0x0:H[TX(0x225)]('custom-columns='))?H[TX(0x1e4)]('custom-columns=','')[TX(0x23a)](',')[TX(0x1cd)](TR=>TR[TX(0x256)]()):undefined,TN=o[o['length']-0x1],TM=''+TN+(TN[TX(0x1d3)]('s')?'':'s'),Ti=_[TX(0x1df)](TM),Tm=_[TX(0x1d0)](TT,TM)?TT[TM]:TT;(0x0,console_format_helpers_1[TX(0x233)])(Tm,Ti,Ts,T8,T9);}else console[TX(0x22f)]((0x0,console_format_helpers_1[TX(0x16e)])(TT));}}}return TG;});}let T4=yield T3(),T5=0x0;if(!O[TP(0x25d)]&&(T4===null||T4===void 0x0?void 0x0:T4['cursor']))while(T4[TP(0x186)]){const T7=yield s[TP(0x20b)](TP(0x1fc));T7&&(process[TP(0x1b6)]['moveCursor'](0x0,-0x1),process[TP(0x1b6)][TP(0x1e6)](0x1),T5+=(L=T4[TP(0x1d6)])!==null&&L!==void 0x0?L:0x0,T4=yield T3(T4[TP(0x186)],!![],T5));}})),X;}const A=_[Tv(0x1d0)](B,'opt'),c=b,F=w(c,A);y[Tv(0x230)](F),i();const Z=_[Tv(0x215)](B,Tv(0x175));Object[Tv(0x1d2)](Z)[Tv(0x203)]>0x0&&generateCommands(T,b,F,G,q,Z,o);});function m(u,b,B){return __awaiter(this,void 0x0,void 0x0,function*(){const TJ=a1p,{input:o,file:f}=u;if(o!==undefined)try{return JSON['parse'](o);}catch(Q){try{return yaml['safeLoad'](o);}catch(U){throw new Error(TJ(0x235));}}if(f!==undefined){if(!fs_1[TJ(0x17d)][TJ(0x1ee)](f))throw new Error(TJ(0x1e5)+f);const D=fs_1[TJ(0x17d)]['readFileSync'](f)[TJ(0x1fa)]();let w;try{if(_[TJ(0x182)](D)){if(u[TJ(0x1be)][TJ(0x1d3)](TJ(0x242)))w=JSON['parse'](D);else{if(u[TJ(0x1be)][TJ(0x1d3)](TJ(0x1bd))||u[TJ(0x1be)][TJ(0x1d3)]('yml'))w=yaml[TJ(0x1e1)](D);else throw new Error(TJ(0x1e0)+u[TJ(0x1be)]['split']('.')[TJ(0x1a8)]());}}else w=D;return w;}catch(A){throw new Error(TJ(0x238)+A[TJ(0x176)]);}}return yield s['retrievePayloadViaInteractiveCli'](b,{'cmdPath':B});});}function R(u,b,B){var o;return __awaiter(this,void 0x0,void 0x0,function*(){const Tn=a1p,f=yield m(u,b,B),d=new ajv_1[(Tn(0x17d))]({'allErrors':!![],'keywords':[Tn(0x18e)],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let Q=![];try{Q=d[Tn(0x1b4)](b[Tn(0x175)][Tn(0x24a)],f);}catch(D){if(D[Tn(0x176)][Tn(0x171)](Tn(0x231)))Q=!![];else throw D;}const U=(o=d===null||d===void 0x0?void 0x0:d[Tn(0x196)])===null||o===void 0x0?void 0x0:o['filter'](w=>{const Tk=Tn;var A;return!((A=w===null||w===void 0x0?void 0x0:w[Tk(0x176)])===null||A===void 0x0?void 0x0:A[Tk(0x171)](Tk(0x23b)));});if(!Q&&U!==undefined&&(U===null||U===void 0x0?void 0x0:U[Tn(0x203)])>0x0)throw new Error(Tn(0x1ca)+JSON[Tn(0x254)](d[Tn(0x196)],null,'\x20'));return f;});}}
2
+ 'use strict';const a1wW=a1h;(function(w,h){const ws=a1h,G=w();while(!![]){try{const P=-parseInt(ws(0x2a7))/0x1+parseInt(ws(0x2b4))/0x2+parseInt(ws(0x1da))/0x3*(-parseInt(ws(0x29c))/0x4)+-parseInt(ws(0x1e2))/0x5+-parseInt(ws(0x233))/0x6*(-parseInt(ws(0x2a3))/0x7)+parseInt(ws(0x1f4))/0x8+parseInt(ws(0x230))/0x9;if(P===h)break;else G['push'](G['shift']());}catch(v){G['push'](G['shift']());}}}(a1w,0x2031a));var __createBinding=this&&this[a1wW(0x22d)]||(Object[a1wW(0x26a)]?function(w,h,G,P){const wX=a1wW;if(P===undefined)P=G;var v=Object[wX(0x25f)](h,G);(!v||('get'in v?!h[wX(0x1f6)]:v[wX(0x239)]||v[wX(0x23b)]))&&(v={'enumerable':!![],'get':function(){return h[G];}}),Object[wX(0x288)](w,P,v);}:function(w,h,G,P){if(P===undefined)P=G;w[P]=h[G];}),__setModuleDefault=this&&this[a1wW(0x279)]||(Object[a1wW(0x26a)]?function(w,h){const wT=a1wW;Object[wT(0x288)](w,wT(0x246),{'enumerable':!![],'value':h});}:function(w,h){const wI=a1wW;w[wI(0x246)]=h;}),__importStar=this&&this['__importStar']||function(w){const wk=a1wW;if(w&&w[wk(0x1f6)])return w;var h={};if(w!=null){for(var G in w)if(G!=='default'&&Object[wk(0x232)][wk(0x275)][wk(0x1ce)](w,G))__createBinding(h,w,G);}return __setModuleDefault(h,w),h;},__awaiter=this&&this[a1wW(0x237)]||function(w,h,G,v){function O(Z){return Z instanceof G?Z:new G(function(a){a(Z);});}return new(G||(G=Promise))(function(Z,a){const wb=a1h;function l(A){try{U(v['next'](A));}catch(D){a(D);}}function B(A){const wY=a1h;try{U(v[wY(0x258)](A));}catch(D){a(D);}}function U(A){const wx=a1h;A[wx(0x202)]?Z(A['value']):O(A[wx(0x262)])['then'](l,B);}U((v=v['apply'](w,h||[]))[wb(0x236)]());});},__importDefault=this&&this[a1wW(0x201)]||function(w){const wq=a1wW;return w&&w[wq(0x1f6)]?w:{'default':w};};Object['defineProperty'](exports,a1wW(0x1f6),{'value':!![]}),exports[a1wW(0x22b)]=void 0x0;const js_client_1=require(a1wW(0x20f)),commander_1=__importDefault(require(a1wW(0x289))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require('ajv')),chalk_1=__importDefault(require(a1wW(0x1d4))),_=__importStar(require(a1wW(0x2ab))),contextCommands_1=require(a1wW(0x224)),utils_1=require(a1wW(0x205)),defaults=__importStar(require(a1wW(0x1e4))),inquirer_helper_1=require(a1wW(0x280)),console_format_helpers_1=require(a1wW(0x23f)),command_overview_1=require('./formatting/command-overview'),port_forward_1=require(a1wW(0x1cf)),exec_1=require('./exec'),logs_1=require(a1wW(0x1dd)),metrics_1=require(a1wW(0x217)),yaml=require(a1wW(0x271)),pgk=require('../package.json'),getProgram=w=>{const wf=a1wW,h=new commander_1[(wf(0x246))][(wf(0x231))](wf(0x295));h[wf(0x1e9)](wf(0x2a6)),h['enablePositionalOptions'](!![]),h[wf(0x221)](wf(0x1d5)+chalk_1[wf(0x246)]['underline'](pgk[wf(0x221)]),wf(0x23e),'Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli');const G=new js_client_1[(wf(0x218))](w,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[wf(0x2bc)]}),P=new contextCommands_1['CliContext'](G),v=new port_forward_1['CliPortForward'](w),O=new exec_1[(wf(0x1d2))](w),Z=new logs_1[(wf(0x268))](w),a=new metrics_1[(wf(0x24d))](w);return h[wf(0x282)](v['portFwdCmd']),h[wf(0x282)](O[wf(0x1fc)]),h[wf(0x282)](P[wf(0x1cd)]),h[wf(0x282)](P[wf(0x244)]),generateCommands(G,G[wf(0x21f)],h,Z,a),h[wf(0x282)]((0x0,command_overview_1[wf(0x234)])(h)),h[wf(0x25e)](!![],'Display\x20help\x20for\x20command'),h['helpOption'](undefined,'Display\x20help\x20for\x20command'),h;};function a1w(){const wN=['error','askForTemplate','credential','serviceId','askForVolume','repo','.json','argv','aliases','repositories','northflank','length','askForTemplateRun','required','File\x20does\x20not\x20exist:\x20','file','status','1003188aysFOn','resource','name','askForProject','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','File\x20to\x20load\x20resource\x20json\x20from','\x20--','25501KMqtzO','opt','action','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','76923phFKIW','commands','/docs/v1/api/','option','lodash','url','bind','askForAddon','delete','details','isArray','domains','getCurrentJobName','362490POfsAS','runtimeFiles/additionalProperties','cursor','some','concat','isString','printAsTable','validate','customUserAgent','join','backups','invoices','ApiClientFileContextProvider','askConfirm','map','endsWith','update','login','call','./port-forward','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','branches','CliExec','volumes','chalk','Northflank\x20cli\x20version:\x20','secrets','getMetricsCommand','yaml','getCurrentProjectName','3EnpaZa','askForSecret','jobs','./logs','askForCredentials','exitCode','boolean','count','1270195BsuPWI','Get\x20information\x20about\x20Northflank\x20','./defaults','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','kebabCase','startsWith','retrievePayloadViaInteractiveCli','description','credentials','path','OPTIONAL:\x20','there\x20are\x20more\x20rows,\x20load?','cred','quiet','deleteWarningPrompt','brn','list','warning','165416Huwwoa','-i,\x20--input\x20<resource-def>','__esModule','jobId','readFileSync','existsSync','projects','set','execCmd','getCommand','output','plans','find','__importDefault','done','base','parseAsync','./utils','alias','custom-columns=','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','assign','asyncSequential','requiredPermissions','projectId','grey','keys','@northflank/js-client','askForPipeline','sort','verbose','getCurrentContext','toUpperCase','force','isEqual','./metrics','ApiClient','secret','askForLogSink','body','split','branch','pipelineId','endpoints','logSinkId','version','vol','addons','./context/contextCommands','templateRunId','askForJobRun','defaults','clearLine',',\x20NF\x20error\x20id:\x20','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','getProgram','askForAddonBackup','__createBinding','addonId','askForService','3785652jGVAZV','Command','prototype','150ikUsUF','getCommandOverview','entries','next','__awaiter','project','writable','repository','configurable','runId','query','-v,\x20--version','./formatting/console-format-helpers','domain','getOwnPropertyNames','getLogsCommand','addon','contexts','upperFirst','default','match\x20exactly\x20one\x20schema\x20in\x20oneOf','-f,\x20--file\x20<file-path>','pln','toString','errors','logs','CliMetrics','stdout','checkUpdate','templates','handleYamlOutput','VERBOSE:\x20Request\x20body\x20->\x20','backupId','askForBuild','stringify','opts','credentialId','throw','safeLoad','.yaml','addHelpText','log','askForSubdomain','addHelpCommand','getOwnPropertyDescriptor','yml','subdomain','value','contextProvider','parse','template','consoleFormat','askGeneric','CliLogs','volumeId','create','backup','docsTagsPath','prj','regions','=>\x20running\x20command\x20with:\x20','askForJob','js-yaml','\x20properties','forEach','has','hasOwnProperty','includes','Update\x20Northflank\x20','after','__setModuleDefault','adn','domainId','rgn','method','plan','get','./inquirer-helper','service','addCommand','buildId','message','job','secretId','json','defineProperty','commander','templateId'];a1w=function(){return wN;};return a1w();}exports[a1wW(0x22b)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const we=a1wW;try{const w=new js_client_1[(we(0x2c0))]();yield(0x0,utils_1[we(0x24f)])(w);const h=(0x0,exports[we(0x22b)])(w);yield h[we(0x204)](process[we(0x292)]);}catch(G){(0x0,utils_1[we(0x28b)])(we(0x2a0)+G[we(0x284)]),process[we(0x292)][we(0x200)](P=>P==='--verbose')&&console[we(0x25c)](G),process[we(0x1df)]=0x1;}}))());function a1h(w,h){const G=a1w();return a1h=function(P,v){P=P-0x1cd;let O=G[P];return O;},a1h(w,h);}function isListCommand(w){const wi=a1wW,h=[[wi(0x27f),wi(0x243),wi(0x2be)],['get',wi(0x285),'runs']];return w[wi(0x200)](G=>G===wi(0x1f2))||h[wi(0x2b7)](G=>_[wi(0x216)](w,G));}function generateCommands(w,h,G,P,v,O=defaults[a1wW(0x227)],Z=[]){const wu=a1wW,a=new inquirer_helper_1['InquirerHelper'](new js_client_1[(wu(0x218))](w[wu(0x263)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[wu(0x2bc)]}));function l(p,s){const wt=wu;return p[wt(0x298)]!==![]&&s===undefined;}function B(p,s){const wS=wu,{opt:W,name:X}=p,T=W['default'],I=l(W,T),k=e=>e[wS(0x296)]>0x1?'--'+e:'-'+e,Y=W===null||W===void 0x0?void 0x0:W[wS(0x206)],x=Y?_[wS(0x2b1)](Y)?'-'+(Y===null||Y===void 0x0?void 0x0:Y[wS(0x2c2)](e=>k(e))[wS(0x2bd)](',\x20-'))+',':''+k(Y):'',b=I?'':wS(0x1ec),q=typeof W['type']===wS(0x1e0)?x+wS(0x2a2)+X:x+wS(0x2a2)+X+'\x20<'+X[wS(0x214)]()+'>',f=b+W[wS(0x1e9)];s[wS(0x2aa)](q,f,T);}function U(p,s){const wV=wu;if(s[wV(0x2a8)][wV(0x2b7)](W=>W[wV(0x29e)]()===wV(0x24c)))return;_[wV(0x216)](p,[wV(0x27f),'service'])&&(s[wV(0x282)](P['getLogsCommand'](wV(0x281))),s[wV(0x282)](v[wV(0x1d7)]('service')),s[wV(0x282)](P[wV(0x242)]('service',!![])),s[wV(0x282)](v[wV(0x1d7)](wV(0x281),!![]))),_[wV(0x216)](p,['get','job'])&&(s['addCommand'](P[wV(0x242)](wV(0x285))),s['addCommand'](v[wV(0x1d7)](wV(0x285))),s[wV(0x282)](P[wV(0x242)](wV(0x285),!![])),s[wV(0x282)](v[wV(0x1d7)](wV(0x285),!![]))),_[wV(0x216)](p,[wV(0x27f),wV(0x243)])&&(s[wV(0x282)](P[wV(0x242)](wV(0x243))),s[wV(0x282)](v[wV(0x1d7)](wV(0x243)))),_[wV(0x216)](p,[wV(0x27f),wV(0x243),wV(0x26b)])&&s[wV(0x282)](P[wV(0x242)](wV(0x243),![],!![])),_[wV(0x216)](p,[wV(0x27f),'addon','restores'])&&s[wV(0x282)](P[wV(0x242)](wV(0x243),![],!![],!![]));}return Object[wu(0x241)](O)[wu(0x273)](p=>{const wC=wu,s=h[p],W=O[p],X=Z[wC(0x2b8)]([p]);function T(u,t){const wM=wC,S=Object['getOwnPropertyNames'](u||{});S['map'](V=>{return{'name':V,'opt':u[V]};})[wM(0x211)]((V,C)=>!l(V[wM(0x2a4)])?!l(C[wM(0x2a4)])?0x0:0x1:-0x1)[wM(0x273)](V=>{B(V,t);});}function I(u,t){const wQ=wC,S=[[wQ(0x238),wQ(0x1fa),wQ(0x26d)],[wQ(0x281),'services','svc'],[wQ(0x1ea),wQ(0x28d),wQ(0x1ee)],[wQ(0x243),wQ(0x223),wQ(0x27a)],[wQ(0x285),wQ(0x1dc)],[wQ(0x27e),wQ(0x1ff),wQ(0x249)],['region',wQ(0x26e),wQ(0x27c)],['domain',wQ(0x2b2),'dmn'],[wQ(0x219),wQ(0x1d6),'scrt'],[wQ(0x1d3),'volume',wQ(0x222)],[wQ(0x1d1),wQ(0x21d),wQ(0x1f1)],['invoice',wQ(0x2bf),'inv'],[wQ(0x265),wQ(0x250),'tpl'],['repos',wQ(0x23a),wQ(0x294),wQ(0x290)]],V=S[wQ(0x200)](C=>C[wQ(0x276)](t));if(V!==undefined)u[wQ(0x293)](V['filter'](C=>C!==t));}function k(u){var t,S;return __awaiter(this,void 0x0,void 0x0,function*(){const wH=a1h,V={},{contextProvider:C}=w,M=X[wH(0x276)](wH(0x2af)),Q=u['noDefaults']===!![];function H(n,c,r){var j,m;return __awaiter(this,void 0x0,void 0x0,function*(){const wn=a1h;if(_['has']((m=(j=W[wn(0x2a4)])===null||j===void 0x0?void 0x0:j[wn(0x1eb)])!==null&&m!==void 0x0?m:{},n)){const y=!Q&&!M&&r?r():undefined,E=u[n]||y||(yield c());_[wn(0x1fb)](V,n,E);}});}return yield(0x0,utils_1['asyncSequential'])(Object[wH(0x235)]((S=(t=W[wH(0x2a4)])===null||t===void 0x0?void 0x0:t['path'])!==null&&S!==void 0x0?S:{}),([n,c])=>__awaiter(this,void 0x0,void 0x0,function*(){const wc=wH,r=V===null||V===void 0x0?void 0x0:V[wc(0x20c)],j=V===null||V===void 0x0?void 0x0:V[wc(0x28a)];switch(n){case wc(0x20c):return yield H(wc(0x20c),a[wc(0x29f)][wc(0x2ad)](a),C[wc(0x1d9)]['bind'](C));case wc(0x28e):return yield H('serviceId',a[wc(0x22f)](r)[wc(0x2ad)](a),C['getCurrentServiceName']['bind'](C));case wc(0x22e):return yield H('addonId',a[wc(0x2ae)](r)[wc(0x2ad)](a));case wc(0x1f7):return yield H(wc(0x1f7),a[wc(0x270)](r)['bind'](a),C[wc(0x2b3)][wc(0x2ad)](C));case wc(0x23c):return yield H('runId',a[wc(0x226)](V[wc(0x1f7)],r,![])['bind'](a));case'secretId':return yield H(wc(0x286),a[wc(0x1db)](r)[wc(0x2ad)](a));case wc(0x240):case wc(0x27b):return yield H(wc(0x240),a['askForDomain'][wc(0x2ad)](a));case wc(0x257):return yield H(wc(0x257),a[wc(0x1de)]['bind'](a));case'volumeId':return yield H(wc(0x269),a[wc(0x28f)](r)['bind'](a));case wc(0x261):return yield H('subdomain',a[wc(0x25d)](V['domain'])['bind'](a));case'subdomainId':return yield H('subdomainId',a[wc(0x25d)](V['domainId'])[wc(0x2ad)](a));case'backupId':return yield H(wc(0x253),a[wc(0x22c)](r,V[wc(0x22e)])[wc(0x2ad)](a));case wc(0x283):return yield H(wc(0x283),a[wc(0x254)](r,V[wc(0x28e)],V[wc(0x1f7)])[wc(0x2ad)](a));case wc(0x28a):return yield H(wc(0x28a),a[wc(0x28c)]()[wc(0x2ad)](a));case'templateRunId':return yield H(wc(0x225),a[wc(0x297)](j)['bind'](a));case wc(0x220):return yield H(wc(0x220),a[wc(0x21a)]()['bind'](a));case wc(0x21e):return yield H(wc(0x21e),a[wc(0x210)](r)['bind'](a));default:return yield H(n,a[wc(0x267)](n,c===null||c===void 0x0?void 0x0:c[wc(0x1e9)])['bind'](a));}})),V;});}function Y(u){var t,S;return __awaiter(this,void 0x0,void 0x0,function*(){const wr=a1h,V={},C=Object[wr(0x20e)]((S=(t=W['opt'])===null||t===void 0x0?void 0x0:t[wr(0x23d)])!==null&&S!==void 0x0?S:{});return yield(0x0,utils_1[wr(0x20a)])(C,M=>__awaiter(this,void 0x0,void 0x0,function*(){const wj=wr;if(u[M]!==undefined)return u[M];const Q={},{required:H,schema:n}=W['opt'][wj(0x23d)][M];return yield a['propToType']([''+M],n,Q,H),Q[M]!==undefined&&_[wj(0x1fb)](V,M,Q[M]),Q;})),V;});}function x(){const wm=wC;switch(X[0x0]){case wm(0x27f):return wm(0x1e3)+(X[0x1]||wm(0x29d))+'s';case wm(0x2c4):return wm(0x277)+(X[0x1]||wm(0x29d))+wm(0x272);default:return _[wm(0x245)](p)+'\x20Northflank\x20resources';}}function b(u,t){const wy=wC;var S,V,C,M,Q,H;if(!t){const K=(0x0,utils_1[wy(0x1fd)])()[wy(0x29e)](_[wy(0x1e6)](p))[wy(0x1e9)](x());return I(K,p),K;}const n=(u===null||u===void 0x0?void 0x0:u[wy(0x20b)])?chalk_1[wy(0x246)][wy(0x20d)]('\x0a>\x20Token\x20permissions\x20required:\x20'+u[wy(0x20b)]):'',c=w[wy(0x263)][wy(0x213)](),r=c!==undefined&&((S=W===null||W===void 0x0?void 0x0:W['opt'])===null||S===void 0x0?void 0x0:S[wy(0x26c)])!==undefined,j=c===null||c===void 0x0?void 0x0:c['host']['replace']('api.',''),m=r?'Documentation:\x20'+j+wy(0x2a9)+((V=W===null||W===void 0x0?void 0x0:W[wy(0x2a4)])===null||V===void 0x0?void 0x0:V['docsTagsPath']):'',y=(u===null||u===void 0x0?void 0x0:u[wy(0x1e9)])||'',E=(0x0,utils_1['getCommand'])(!![])[wy(0x29e)](_[wy(0x1e6)](p))[wy(0x1e9)](y)[wy(0x25b)](wy(0x278),[n,m][wy(0x2bd)]('\x0a'));return I(E,p),((C=W[wy(0x2a4)])===null||C===void 0x0?void 0x0:C['body'])&&(E[wy(0x2aa)](wy(0x248),wy(0x2a1)),E[wy(0x2aa)](wy(0x1f5),wy(0x1d0))),T((M=W['opt'])===null||M===void 0x0?void 0x0:M['path'],E),T((Q=W['opt'])===null||Q===void 0x0?void 0x0:Q['query'],E),T((H=W['opt'])===null||H===void 0x0?void 0x0:H[wy(0x203)],E),E[wy(0x2a5)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const wE=wy;var g,J,R,N;(0x0,utils_1['assertContextExisting'])(w);const z=E[wE(0x256)](),F=z===null||z===void 0x0?void 0x0:z[wE(0x1fe)],o=F===wE(0x287),L=F===wE(0x1d8)||F===wE(0x260),d=yield k(z);a['setPathVars'](d);const w0=yield Y(z),w1=Object[wE(0x20e)]((J=(g=W['opt'])===null||g===void 0x0?void 0x0:g[wE(0x1eb)])!==null&&J!==void 0x0?J:{})['map'](w6=>w6+'='+chalk_1[wE(0x246)]['green'](d[w6]))[wE(0x2bd)](',\x20');if(w1[wE(0x296)]>0x0&&!o&&!L){const w6=wE(0x26f)+w1;console[wE(0x25c)](w6);}const w2=((R=W[wE(0x2a4)])===null||R===void 0x0?void 0x0:R[wE(0x21b)])?yield D(z,W,X):undefined;if(!z[wE(0x215)]&&X[wE(0x276)](wE(0x2af))&&!(yield a[wE(0x1f0)]())){(0x0,utils_1[wE(0x1f3)])('Resource\x20was\x20not\x20deleted.');return;}function w3(w7,w8=![],w9=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const wK=a1h,{data:ww,request:wh,error:wG,pagination:wP,rawResponse:wv}=yield s['call']({'parameters':d,'options':Object[wK(0x209)](Object['assign']({},w0),{'cursor':w7}),'data':w2});(z===null||z===void 0x0?void 0x0:z[wK(0x212)])&&(console['log']('VERBOSE:\x20Using\x20endpoint\x20->\x20'+wh[wK(0x27d)]+':'+wh[wK(0x2ac)]),console[wK(0x25c)](wK(0x252)+wh[wK(0x21b)]));if(wG){const wO=wG[wK(0x2b0)]?'\x0a\x09details\x20:'+JSON[wK(0x255)](wG[wK(0x2b0)]):'',wZ=(wG===null||wG===void 0x0?void 0x0:wG['id'])?wK(0x229)+wG['id']:'',wa='(HTTP\x20status\x20code:\x20'+wG[wK(0x29b)]+wZ+')';throw new Error('API\x20request\x20failed\x0a\x09Message:\x20'+wG[wK(0x284)]+'\x20'+wa+wO);}if(!(z===null||z===void 0x0?void 0x0:z[wK(0x1ef)])){if(o)(0x0,console_format_helpers_1['handleJsonOutput'])(z===null||z===void 0x0?void 0x0:z['output'],ww);else{if(L)(0x0,console_format_helpers_1[wK(0x251)])(z===null||z===void 0x0?void 0x0:z[wK(0x1fe)],ww);else{if(isListCommand(X)){const wl=(F===null||F===void 0x0?void 0x0:F[wK(0x1e7)]('custom-columns='))?F['replace'](wK(0x207),'')[wK(0x21c)](',')[wK(0x2c2)](wp=>wp['toLowerCase']()):undefined,wB=X[X[wK(0x296)]-0x1],wU=''+wB+(wB[wK(0x2c3)]('s')?'':'s'),wA=_[wK(0x245)](wU),wD=_[wK(0x274)](ww,wU)?ww[wU]:ww;(0x0,console_format_helpers_1[wK(0x2ba)])(wD,wA,wl,w8,w9);}else console[wK(0x25c)]((0x0,console_format_helpers_1[wK(0x266)])(ww,wv['status']));}}}return wP;});}let w4=yield w3(),w5=0x0;if(!z['quiet']&&(w4===null||w4===void 0x0?void 0x0:w4[wE(0x2b6)]))while(w4[wE(0x2b6)]){const w7=yield a[wE(0x2c1)](wE(0x1ed));w7&&(process['stdout']['moveCursor'](0x0,-0x1),process[wE(0x24e)][wE(0x228)](0x1),w5+=(N=w4[wE(0x1e1)])!==null&&N!==void 0x0?N:0x0,w4=yield w3(w4[wE(0x2b6)],!![],w5));}})),E;}const q=_['has'](W,wC(0x2a4)),f=s,e=b(f,q);U(X,e),G[wC(0x282)](e);const i=_['omit'](W,wC(0x2a4));Object[wC(0x20e)](i)[wC(0x296)]>0x0&&generateCommands(w,s,e,P,v,i,X);});function A(p,s,W){return __awaiter(this,void 0x0,void 0x0,function*(){const wg=a1h,{input:X,file:T}=p;if(X!==undefined)try{return JSON[wg(0x264)](X);}catch(I){try{return yaml[wg(0x259)](X);}catch(k){throw new Error(wg(0x208));}}if(T!==undefined){if(!fs_1[wg(0x246)][wg(0x1f9)](T))throw new Error(wg(0x299)+T);const Y=fs_1[wg(0x246)][wg(0x1f8)](T)[wg(0x24a)]();let x;try{if(_[wg(0x2b9)](Y)){if(p[wg(0x29a)][wg(0x2c3)](wg(0x291)))x=JSON['parse'](Y);else{if(p[wg(0x29a)]['endsWith'](wg(0x25a))||p['file'][wg(0x2c3)]('yml'))x=yaml[wg(0x259)](Y);else throw new Error('Unknown\x20input\x20file\x20type:\x20'+p[wg(0x29a)]['split']('.')['pop']());}}else x=Y;return x;}catch(b){throw new Error(wg(0x22a)+b['message']);}}return yield a[wg(0x1e8)](s,{'cmdPath':W});});}function D(p,s,W){var X;return __awaiter(this,void 0x0,void 0x0,function*(){const wJ=a1h,T=yield A(p,s,W),I=new ajv_1[(wJ(0x246))]({'allErrors':!![],'keywords':['example'],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let k=![];try{k=I[wJ(0x2bb)](s['opt'][wJ(0x21b)],T);}catch(x){if(x[wJ(0x284)]['includes'](wJ(0x2b5)))k=!![];else throw x;}const Y=(X=I===null||I===void 0x0?void 0x0:I['errors'])===null||X===void 0x0?void 0x0:X['filter'](b=>{const wR=wJ;var q;return!((q=b===null||b===void 0x0?void 0x0:b[wR(0x284)])===null||q===void 0x0?void 0x0:q[wR(0x276)](wR(0x247)));});if(!k&&Y!==undefined&&(Y===null||Y===void 0x0?void 0x0:Y['length'])>0x0)throw new Error(wJ(0x1e5)+JSON[wJ(0x255)](I[wJ(0x24b)],null,'\x20'));return T;});}}
@@ -1 +1 @@
1
- 'use strict';const a2Q=a2p;(function(T,p){const f=a2p,y=T();while(!![]){try{const G=-parseInt(f(0x11c))/0x1*(-parseInt(f(0xe0))/0x2)+parseInt(f(0x130))/0x3+parseInt(f(0x100))/0x4+parseInt(f(0xbd))/0x5+parseInt(f(0x102))/0x6*(parseInt(f(0xda))/0x7)+parseInt(f(0xff))/0x8+parseInt(f(0x135))/0x9*(-parseInt(f(0xb4))/0xa);if(G===p)break;else y['push'](y['shift']());}catch(q){y['push'](y['shift']());}}}(a2T,0x9770c));var __createBinding=this&&this['__createBinding']||(Object['create']?function(T,p,y,G){const d=a2p;if(G===undefined)G=y;var q=Object[d(0x103)](p,y);(!q||('get'in q?!p[d(0x10d)]:q[d(0x10c)]||q[d(0x12d)]))&&(q={'enumerable':!![],'get':function(){return p[y];}}),Object[d(0xc5)](T,G,q);}:function(T,p,y,G){if(G===undefined)G=y;T[G]=p[y];}),__setModuleDefault=this&&this[a2Q(0x12c)]||(Object[a2Q(0x11f)]?function(T,p){const U=a2Q;Object[U(0xc5)](T,U(0x133),{'enumerable':!![],'value':p});}:function(T,p){const D=a2Q;T[D(0x133)]=p;}),__importStar=this&&this['__importStar']||function(T){const w=a2Q;if(T&&T[w(0x10d)])return T;var p={};if(T!=null){for(var y in T)if(y!==w(0x133)&&Object[w(0xd9)]['hasOwnProperty'][w(0x11e)](T,y))__createBinding(p,T,y);}return __setModuleDefault(p,T),p;},__awaiter=this&&this['__awaiter']||function(T,p,y,G){function q(S){return S instanceof y?S:new y(function(K){K(S);});}return new(y||(y=Promise))(function(S,K){const Z=a2p;function s(i){const A=a2p;try{M(G[A(0xb3)](i));}catch(m){K(m);}}function N(i){const c=a2p;try{M(G[c(0xa7)](i));}catch(m){K(m);}}function M(i){const F=a2p;i['done']?S(i['value']):q(i[F(0x134)])['then'](s,N);}M((G=G[Z(0xcd)](T,p||[]))[Z(0xb3)]());});},__importDefault=this&&this[a2Q(0xf4)]||function(T){return T&&T['__esModule']?T:{'default':T};};Object[a2Q(0xc5)](exports,'__esModule',{'value':!![]}),exports['CliContext']=void 0x0;const _=__importStar(require(a2Q(0xde))),node_fetch_1=__importDefault(require(a2Q(0xa8))),chalk_1=__importDefault(require(a2Q(0x12f))),utils_1=require(a2Q(0x138)),inquirer_helper_1=require(a2Q(0x121)),console_format_helpers_1=require('../formatting/console-format-helpers'),browser_login_1=require('../login/browser-login'),inquirer=require(a2Q(0xa5));class CliContext{constructor(T,p=a2Q(0xc9)){const j=a2Q;this[j(0xba)]=p,this[j(0xfb)]=m=>{const V=j;let R=m;return!/^https?:\/\//i[V(0xea)](R)&&(R=V(0x112)+R),R=R[V(0xc8)](/\/+$/,''),R;},this[j(0x126)]=T;const y=new inquirer_helper_1[(j(0x131))](T);this[j(0xab)]=(0x0,utils_1['getCommand'])()[j(0xdb)](j(0xab))[j(0xcb)](j(0xca))[j(0xb5)](j(0xf9),j(0x118),![])['option'](j(0x139),j(0xd3),![])['option'](j(0xd7),j(0xcf))[j(0xb5)](j(0x120),'Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used')['option'](j(0xc4),j(0x11b),this[j(0xba)])[j(0xb5)](j(0x106),j(0xf1),![])[j(0xe6)](m=>__awaiter(this,void 0x0,void 0x0,function*(){const h=j;_[h(0xa3)](m,h(0xf2),this[h(0xfb)](m[h(0xf2)]));const {name:R,host:u,token:b,override:B}=m[h(0xe5)]||m[h(0xc3)]!==undefined?yield this[h(0xa9)](m,y):yield this[h(0xc6)](m,y);try{yield this[h(0x126)][h(0x111)]['addContext']({'name':R,'host':u,'token':b},B);}catch(o){(0x0,utils_1['error'])(o[h(0xbc)]);return;}!(yield this[h(0x124)]())?((0x0,utils_1['error'])(h(0xb2)),yield this[h(0x126)][h(0x111)][h(0x105)](R)):(0x0,utils_1['success'])(h(0xcc)+u+'\x20successful');})),this['contexts']=(0x0,utils_1[j(0x104)])()[j(0xdb)](j(0xfe))[j(0xcb)](j(0xc2))[j(0x12e)](j(0x127))[j(0x12e)](j(0xaa));const G=(0x0,utils_1['getCommand'])()['name']('list')[j(0xdb)]('ls')[j(0xcb)](j(0xf7))['option'](j(0x11a),j(0x107))[j(0xe6)](m=>__awaiter(this,void 0x0,void 0x0,function*(){const v=j;console[v(0xad)](T['contextProvider'][v(0xdc)]());const R=T[v(0x111)]['loadContextWrapper']();if(m[v(0x110)]===!![]){console[v(0x119)](R);return;}const u=R[v(0xed)],b=R[v(0x127)]['sort']((B,o)=>B[v(0xdb)]===u?-0x1:o[v(0xdb)]===u?0x1:0x0)[v(0x115)](B=>{const t=v,o=u===B[t(0xdb)]?'\x20(current)':'';return{'Name':''+B['name']+o,'Host':B[t(0xf2)],'Default\x20Project':B[t(0xef)]||'-','Default\x20Service':B[t(0x10e)]||'-'};});(0x0,console_format_helpers_1[v(0xd4)])(b,v(0x132));})),q=(0x0,utils_1[j(0x104)])();q[j(0xdb)](j(0xe4))['description'](j(0xb7))['option']('-n,\x20--name\x20[NAME]',j(0xd6))['action'](m=>__awaiter(this,void 0x0,void 0x0,function*(){const g=j,R=(m===null||m===void 0x0?void 0x0:m[g(0xdb)])||(yield this[g(0x113)](g(0xe4)));yield this[g(0x126)][g(0x111)]['useContext'](R),(0x0,utils_1[g(0xc7)])(g(0xae)+R);}));const S=j(0xa4),K=(0x0,utils_1[j(0x104)])()[j(0xdb)]('project')[j(0xcb)]('Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context')[j(0xb5)](S,j(0xeb))[j(0xe6)](m=>__awaiter(this,void 0x0,void 0x0,function*(){const I=j,R=(m===null||m===void 0x0?void 0x0:m['id'])||(yield y[I(0xb6)]());yield this[I(0x126)]['contextProvider'][I(0xd0)](R),console[I(0xad)](I(0x101),R);})),s=(0x0,utils_1['getCommand'])()[j(0xdb)](j(0x10e))[j(0xcb)](j(0xf5))['option'](S,j(0xbb))[j(0xe6)](m=>__awaiter(this,void 0x0,void 0x0,function*(){const r=j,R=(m===null||m===void 0x0?void 0x0:m['id'])||(yield y[r(0xb1)](this[r(0xe7)]())());console[r(0xad)](r(0x10a),R),yield this[r(0x126)][r(0x111)][r(0xac)](R);})),N=(0x0,utils_1[j(0x104)])()['name'](j(0x116))[j(0xcb)](j(0xe3))[j(0xb5)](S,j(0xbf))['action'](m=>__awaiter(this,void 0x0,void 0x0,function*(){const Y=j,R=(m===null||m===void 0x0?void 0x0:m['id'])||(yield y['askForJob'](this[Y(0xe7)]())());console[Y(0xad)]('Use\x20job\x20with\x20id:',R),yield this[Y(0x126)][Y(0x111)]['useJobId'](R);}));q[j(0xdd)](K),q['addCommand'](N),q[j(0xdd)](s);const M=(0x0,utils_1[j(0x104)])()[j(0xdb)](j(0x125))[j(0x12e)]('delete')[j(0x12e)]('rm')[j(0xcb)](j(0x11d))[j(0xb5)](S,j(0x12a))[j(0xe6)](m=>__awaiter(this,void 0x0,void 0x0,function*(){const z=j;var R;const u=(m===null||m===void 0x0?void 0x0:m['id'])||(yield this[z(0x113)]('remove')),b=(R=this[z(0x126)]['contextProvider'][z(0xec)]())===null||R===void 0x0?void 0x0:R[z(0xdb)];yield this[z(0x126)][z(0x111)][z(0x105)](u),(0x0,utils_1[z(0xc7)])(z(0x109)+u+'\x27\x20successfully\x20removed.');if(!this[z(0x123)]()){(0x0,utils_1[z(0xd1)])(z(0xdf));return;}if(b===u){const B=(m===null||m===void 0x0?void 0x0:m[z(0xdb)])||(yield this[z(0x113)](z(0xce)));yield this[z(0x126)][z(0x111)]['useContext'](B),(0x0,utils_1[z(0xc7)])('Changed\x20current\x20context\x20to\x20'+B);}})),i=(0x0,utils_1[j(0x104)])()['name'](j(0x122))[j(0x12e)](j(0xd8))[j(0xcb)]('Update\x20token\x20for\x20current\x20context')[j(0xb5)](j(0x120),j(0xf3))[j(0xe6)](m=>__awaiter(this,void 0x0,void 0x0,function*(){const x=j,{contextProvider:R}=this[x(0x126)],u=(m===null||m===void 0x0?void 0x0:m[x(0xc3)])||(yield y[x(0xee)]()),b=R['getCurrentToken']();yield R['updateToken'](u);if(yield this[x(0x124)]())(0x0,utils_1[x(0xc7)])(x(0x137)+R[x(0xb9)]()+x(0xa6));else{if(b)yield R[x(0x129)](b);(0x0,utils_1[x(0x114)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed');}}));this['contexts']['addCommand'](G),this[j(0x127)][j(0xdd)](q),this['contexts'][j(0xdd)](M),this[j(0x127)][j(0xdd)](i);}[a2Q(0xc6)](T,p){var y,G,q,S;return __awaiter(this,void 0x0,void 0x0,function*(){const W=a2p,K=!T['doNotOpenBrowser'],s=(y=T[W(0xf2)])!==null&&y!==void 0x0?y:this[W(0xba)],N=new browser_login_1['NorthflankApiBrowserLogin'](s,K);let M;N['on'](W(0xf8),({url:u})=>{const e=W;if(K){const b=u[e(0xc8)](/sessionToken=.*/,e(0xe1));console[e(0xad)]('Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20'+b+')'),M=inquirer['prompt']([{'type':'confirm','name':e(0xc0),'message':e(0x128),'default':![]}]),M[e(0xd2)](B=>{const P=e;process['stdout']['moveCursor'](0x0,-0x1),process['stdout'][P(0xfa)](0x1),B[P(0xc0)]&&console['log'](P(0xaf)+u+'\x20');});}else console[e(0xad)]('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+u+'\x20');});const {token:i,contextName:m}=yield N[W(0x136)]()['catch'](u=>__awaiter(this,void 0x0,void 0x0,function*(){const X=W;(0x0,utils_1['error'])(X(0xd5)+u['message']+X(0xb0));const b=yield this['apiTokenLogin'](T,p);return{'token':b[X(0xc3)],'contextName':b[X(0xdb)]};}))['finally'](()=>{const J=W;if(M)M['ui'][J(0x108)]();}),R=(q=(G=T[W(0xdb)])!==null&&G!==void 0x0?G:m)!==null&&q!==void 0x0?q:W(0xf0)+new Date()['valueOf']();return(0x0,utils_1[W(0xc7)])(W(0x12b)+chalk_1[W(0x133)]['italic'](R)),{'name':R,'token':i,'host':s,'override':(S=T[W(0xfd)])!==null&&S!==void 0x0?S:![]};});}[a2Q(0xa9)](T,p){return __awaiter(this,void 0x0,void 0x0,function*(){const n=a2p,y=this['apiClient'][n(0x111)][n(0xbe)]()['contexts'],{name:G,token:q,host:S,override:K}=yield p[n(0x117)](T,y);return{'name':G,'token':q,'host':S,'override':K};});}[a2Q(0xe7)](){const k=a2Q,T=this['apiClient']['contextProvider'][k(0x10f)]();if(T===undefined)throw new Error(k(0xe8));return T;}['askForContext'](T){return __awaiter(this,void 0x0,void 0x0,function*(){const a=a2p;if(!this[a(0x123)]())throw new Error(a(0xe9));const p=this[a(0x126)][a(0x111)][a(0xbe)]()[a(0x127)]['map'](G=>G[a(0xdb)]),y=p['length']>0x4?a(0xb8):'list';return(yield inquirer['prompt']([{'type':y,'name':a(0xdb),'message':a(0xe2)+T+':','choices':p}]))[a(0xdb)];});}['contextAvailable'](){const L=a2Q;return this['apiClient'][L(0x111)][L(0xbe)]()['contexts']['length']>0x0;}[a2Q(0x124)](){return __awaiter(this,void 0x0,void 0x0,function*(){const O=a2p;try{const T=this[O(0x126)]['contextProvider'][O(0xf6)](),p=this['apiClient'][O(0x111)]['getCurrentToken'](),y=T+O(0xc1),G={'Authorization':'Bearer\x20'+p},q=yield(0x0,utils_1[O(0x10b)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const H=O;return(0x0,node_fetch_1[H(0x133)])(y,{'method':'GET','timeout':0xbb8,'headers':G});}));if(q['ok'])return!![];return![];}catch(S){return![];}});}}function a2p(T,p){const y=a2T();return a2p=function(G,q){G=G-0xa3;let S=y[G];return S;},a2p(T,p);}exports[a2Q(0xfc)]=CliContext;function a2T(){const l=['Token\x20for\x20current\x20context\x20\x27','../utils','--do-not-open-browser','set','-i,\x20--id\x20[ID]','inquirer','\x27\x20successfully\x20updated.','throw','node-fetch','apiTokenLogin','ctx','login','useServiceId','log','Changed\x20current\x20context\x20to\x20','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','.\x20Using\x20fallback.','askForService','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','next','121640RQnzjq','option','askForProject','Switch\x20between\x20your\x20local\x20contexts','search-list','getCurrentName','defaultBaseUrl','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','message','821815lEHkKd','loadContextWrapper','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','fullUrl','/v1/login','Retrieve\x20and\x20update\x20local\x20context\x20settings.','token','--host\x20[HOST]','defineProperty','browserLogin','success','replace','https://api.northflank.com','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','description','Login\x20to\x20','apply','use\x20from\x20now\x20on','Name\x20for\x20login\x20context','useProjectId','warning','then','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','printAsTable','Error\x20occured\x20during\x20browser\x20login:\x20','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','-n,\x20--name\x20[NAME]','set-token','prototype','1451443YKlPAK','name','getInfo','addCommand','lodash','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','668866zPxREa','sessionToken=********','Choose\x20the\x20context\x20to\x20','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','use','tokenLogin','action','getProjectName','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','test','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','getCurrentContext','current','tokenPrompt','project','autologin-','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','host','Token\x20for\x20this\x20context','__importDefault','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','getCurrentBaseUrl','List\x20all\x20available\x20contexts','browser-opened','--token-login','clearLine','sanitiseHostname','CliContext','override','context','1209800UgAoXX','1428536mwRFRp','Use\x20project\x20with\x20id:','12MCFFJs','getOwnPropertyDescriptor','getCommand','removeContext','--override','Shows\x20full\x20context\x20information\x20(including\x20tokens)','close','Local\x20context\x20\x27','Use\x20service\x20with\x20id:','retry','writable','__esModule','service','getCurrentProjectName','all','contextProvider','https://','askForContext','error','map','job','loginPrompt','Use\x20manual\x20login\x20with\x20API\x20token','dir','--all','host\x20url\x20for\x20this\x20context','1GQgxWs','Remove\x20a\x20context','call','create','-t,\x20--token\x20[TOKEN]','../inquirer-helper','update-token','contextAvailable','verifyToken','remove','apiClient','contexts','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','updateToken','Local\x20context\x20name\x20to\x20remove.','\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20','__setModuleDefault','configurable','alias','chalk','1499985xuGIIO','InquirerHelper','Contexts','default','value','963UKySvw','startLogin'];a2T=function(){return l;};return a2T();}
1
+ 'use strict';const a2I=a2h;function a2h(w,h){const G=a2w();return a2h=function(P,v){P=P-0x14e;let O=G[P];return O;},a2h(w,h);}(function(w,h){const T=a2h,G=w();while(!![]){try{const P=parseInt(T(0x150))/0x1*(-parseInt(T(0x18b))/0x2)+-parseInt(T(0x17f))/0x3+parseInt(T(0x17b))/0x4*(-parseInt(T(0x191))/0x5)+parseInt(T(0x182))/0x6+-parseInt(T(0x14f))/0x7+-parseInt(T(0x1de))/0x8+parseInt(T(0x19a))/0x9;if(P===h)break;else G['push'](G['shift']());}catch(v){G['push'](G['shift']());}}}(a2w,0xc3b7d));function a2w(){const o=['Changed\x20current\x20context\x20to\x20','configurable','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','create','search-list','getCurrentToken','getCurrentName','set','3151056bATxQm','useJobId','Remove\x20a\x20context','loginPrompt','confirm','Error\x20occured\x20during\x20browser\x20login:\x20','224870UKstFt','get','dir','project','../login/browser-login','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','getInfo','getCurrentContext','42971976groOtW','apiClient','contextProvider','Use\x20job\x20with\x20id:','CliContext','Token\x20for\x20this\x20context','warning','sanitiseHostname','../formatting/console-format-helpers','action','\x27\x20successfully\x20updated.','value','host\x20url\x20for\x20this\x20context','alias','NorthflankApiBrowserLogin','\x27\x20successfully\x20removed.','update-token','__awaiter','List\x20all\x20available\x20contexts','browserLogin','default','current','Name\x20for\x20login\x20context','askForService','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','Switch\x20between\x20your\x20local\x20contexts','tokenPrompt','--override','getOwnPropertyDescriptor','\x20(current)','done','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','description','https://api.northflank.com','name','prototype','message','loadContextWrapper','next','override','updateToken','all','success','__createBinding','Login\x20to\x20','service','replace','delete','browser-opened','-n,\x20--name\x20[NAME]','-i,\x20--id\x20[ID]','sort','writable','login','option','getCommand','startLogin','chalk','use','defaultBaseUrl','context','use\x20from\x20now\x20on','length','Retrieve\x20and\x20update\x20local\x20context\x20settings.','__setModuleDefault','../utils','.\x20Using\x20fallback.','Token\x20for\x20current\x20context\x20\x27','2202824XAOodV','Use\x20service\x20with\x20id:','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','useContext','host','log','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','/v1/login','job','fullUrl','moveCursor','-t,\x20--token\x20[TOKEN]','apiTokenLogin','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','token','../inquirer-helper','https://','getCurrentBaseUrl','9062837DEQaKO','1HLWPac','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','getProjectName','askForProject','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','removeContext','InquirerHelper','Contexts','\x20successful','throw','--host\x20[HOST]','hasOwnProperty','inquirer','stdout','contextAvailable','then','askForContext','--do-not-open-browser','valueOf','verifyToken','useProjectId','__importDefault','Use\x20manual\x20login\x20with\x20API\x20token','list','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','finally','call','Local\x20context\x20\x27','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','contexts','__importStar','apply','node-fetch','\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20','Choose\x20the\x20context\x20to\x20','__esModule','autologin-','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','ctx','Bearer\x20','error','catch','remove','32hczYhH','defineProperty','addCommand','prompt','2863818SUJRqH','--token-login','Shows\x20full\x20context\x20information\x20(including\x20tokens)','2921802ojHugx'];a2w=function(){return o;};return a2w();}var __createBinding=this&&this[a2I(0x1c5)]||(Object['create']?function(w,h,G,P){const k=a2I;if(P===undefined)P=G;var v=Object[k(0x1b6)](h,G);(!v||(k(0x192)in v?!h[k(0x173)]:v[k(0x1ce)]||v[k(0x184)]))&&(v={'enumerable':!![],'get':function(){return h[G];}}),Object[k(0x17c)](w,P,v);}:function(w,h,G,P){if(P===undefined)P=G;w[P]=h[G];}),__setModuleDefault=this&&this[a2I(0x1da)]||(Object[a2I(0x186)]?function(w,h){const Y=a2I;Object['defineProperty'](w,Y(0x1ae),{'enumerable':!![],'value':h});}:function(w,h){const x=a2I;w[x(0x1ae)]=h;}),__importStar=this&&this[a2I(0x16e)]||function(w){const b=a2I;if(w&&w['__esModule'])return w;var h={};if(w!=null){for(var G in w)if(G!==b(0x1ae)&&Object[b(0x1bd)][b(0x15b)][b(0x16a)](w,G))__createBinding(h,w,G);}return __setModuleDefault(h,w),h;},__awaiter=this&&this[a2I(0x1ab)]||function(w,h,G,v){function O(Z){return Z instanceof G?Z:new G(function(a){a(Z);});}return new(G||(G=Promise))(function(Z,a){const i=a2h;function l(A){const q=a2h;try{U(v[q(0x1c0)](A));}catch(D){a(D);}}function B(A){const f=a2h;try{U(v[f(0x159)](A));}catch(D){a(D);}}function U(A){const e=a2h;A[e(0x1b8)]?Z(A[e(0x1a5)]):O(A[e(0x1a5)])[e(0x15f)](l,B);}U((v=v[i(0x16f)](w,h||[]))[i(0x1c0)]());});},__importDefault=this&&this[a2I(0x165)]||function(w){const u=a2I;return w&&w[u(0x173)]?w:{'default':w};};Object[a2I(0x17c)](exports,'__esModule',{'value':!![]}),exports[a2I(0x19e)]=void 0x0;const _=__importStar(require('lodash')),node_fetch_1=__importDefault(require(a2I(0x170))),chalk_1=__importDefault(require(a2I(0x1d3))),utils_1=require(a2I(0x1db)),inquirer_helper_1=require(a2I(0x1ed)),console_format_helpers_1=require(a2I(0x1a2)),browser_login_1=require(a2I(0x195)),inquirer=require(a2I(0x15c));class CliContext{constructor(w,h=a2I(0x1bb)){const t=a2I;this[t(0x1d5)]=h,this[t(0x1a1)]=A=>{const S=t;let D=A;return!/^https?:\/\//i['test'](D)&&(D=S(0x1ee)+D),D=D[S(0x1c8)](/\/+$/,''),D;},this[t(0x19b)]=w;const G=new inquirer_helper_1[(t(0x156))](w);this[t(0x1cf)]=(0x0,utils_1[t(0x1d1)])()['name'](t(0x1cf))['description']('Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.')[t(0x1d0)](t(0x180),t(0x166),![])[t(0x1d0)](t(0x161),t(0x197),![])[t(0x1d0)](t(0x1cb),t(0x1b0))[t(0x1d0)]('-t,\x20--token\x20[TOKEN]',t(0x1eb))['option'](t(0x15a),t(0x1a6),this['defaultBaseUrl'])[t(0x1d0)](t(0x1b5),'Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)',![])[t(0x1a3)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const V=t;_[V(0x18a)](A,V(0x1e2),this[V(0x1a1)](A['host']));const {name:D,host:p,token:s,override:W}=A['tokenLogin']||A[V(0x1ec)]!==undefined?yield this['apiTokenLogin'](A,G):yield this['browserLogin'](A,G);try{yield this[V(0x19b)]['contextProvider']['addContext']({'name':D,'host':p,'token':s},W);}catch(X){(0x0,utils_1[V(0x178)])(X[V(0x1be)]);return;}!(yield this[V(0x163)]())?((0x0,utils_1[V(0x178)])(V(0x1e0)),yield this[V(0x19b)][V(0x19c)][V(0x155)](D)):(0x0,utils_1[V(0x1c4)])(V(0x1c6)+p+V(0x158));})),this[t(0x16d)]=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x1d6))[t(0x1ba)](t(0x1d9))['alias'](t(0x16d))[t(0x1a7)](t(0x176));const P=(0x0,utils_1[t(0x1d1)])()['name']('list')[t(0x1bc)]('ls')['description'](t(0x1ac))[t(0x1d0)]('--all',t(0x181))[t(0x1a3)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const C=t;console[C(0x1e3)](w[C(0x19c)][C(0x198)]());const D=w[C(0x19c)][C(0x1bf)]();if(A[C(0x1c3)]===!![]){console[C(0x193)](D);return;}const p=D[C(0x1af)],s=D[C(0x16d)][C(0x1cd)]((W,X)=>W[C(0x1bc)]===p?-0x1:X['name']===p?0x1:0x0)['map'](W=>{const M=C,X=p===W[M(0x1bc)]?M(0x1b7):'';return{'Name':''+W[M(0x1bc)]+X,'Host':W[M(0x1e2)],'Default\x20Project':W[M(0x194)]||'-','Default\x20Service':W[M(0x1c7)]||'-'};});(0x0,console_format_helpers_1['printAsTable'])(s,C(0x157));})),v=(0x0,utils_1[t(0x1d1)])();v[t(0x1bc)](t(0x1d4))['description'](t(0x1b3))[t(0x1d0)](t(0x1cb),t(0x151))['action'](A=>__awaiter(this,void 0x0,void 0x0,function*(){const Q=t,D=(A===null||A===void 0x0?void 0x0:A[Q(0x1bc)])||(yield this[Q(0x160)](Q(0x1d4)));yield this['apiClient'][Q(0x19c)][Q(0x1e1)](D),(0x0,utils_1[Q(0x1c4)])(Q(0x183)+D);}));const O=t(0x1cc),Z=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x194))[t(0x1ba)](t(0x1b2))[t(0x1d0)](O,t(0x168))['action'](A=>__awaiter(this,void 0x0,void 0x0,function*(){const H=t,D=(A===null||A===void 0x0?void 0x0:A['id'])||(yield G[H(0x153)]());yield this['apiClient'][H(0x19c)][H(0x164)](D),console[H(0x1e3)]('Use\x20project\x20with\x20id:',D);})),a=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x1c7))[t(0x1ba)](t(0x16c))[t(0x1d0)](O,'Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')[t(0x1a3)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const n=t,D=(A===null||A===void 0x0?void 0x0:A['id'])||(yield G[n(0x1b1)](this['getProjectName']())());console[n(0x1e3)](n(0x1df),D),yield this[n(0x19b)][n(0x19c)]['useServiceId'](D);})),l=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x1e6))[t(0x1ba)]('Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context')[t(0x1d0)](O,t(0x1e4))['action'](A=>__awaiter(this,void 0x0,void 0x0,function*(){const c=t,D=(A===null||A===void 0x0?void 0x0:A['id'])||(yield G['askForJob'](this[c(0x152)]())());console[c(0x1e3)](c(0x19d),D),yield this[c(0x19b)][c(0x19c)][c(0x18c)](D);}));v['addCommand'](Z),v['addCommand'](l),v[t(0x17d)](a);const B=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x17a))[t(0x1a7)](t(0x1c9))[t(0x1a7)]('rm')[t(0x1ba)](t(0x18d))[t(0x1d0)](O,'Local\x20context\x20name\x20to\x20remove.')[t(0x1a3)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const r=t;var D;const p=(A===null||A===void 0x0?void 0x0:A['id'])||(yield this[r(0x160)](r(0x17a))),s=(D=this['apiClient'][r(0x19c)][r(0x199)]())===null||D===void 0x0?void 0x0:D['name'];yield this['apiClient'][r(0x19c)][r(0x155)](p),(0x0,utils_1[r(0x1c4)])(r(0x16b)+p+r(0x1a9));if(!this['contextAvailable']()){(0x0,utils_1[r(0x1a0)])(r(0x1b9));return;}if(s===p){const W=(A===null||A===void 0x0?void 0x0:A[r(0x1bc)])||(yield this['askForContext'](r(0x1d7)));yield this[r(0x19b)][r(0x19c)][r(0x1e1)](W),(0x0,utils_1[r(0x1c4)])('Changed\x20current\x20context\x20to\x20'+W);}})),U=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x1aa))[t(0x1a7)]('set-token')[t(0x1ba)]('Update\x20token\x20for\x20current\x20context')[t(0x1d0)](t(0x1e9),t(0x19f))['action'](A=>__awaiter(this,void 0x0,void 0x0,function*(){const j=t,{contextProvider:D}=this[j(0x19b)],p=(A===null||A===void 0x0?void 0x0:A[j(0x1ec)])||(yield G[j(0x1b4)]()),s=D[j(0x188)]();yield D[j(0x1c2)](p);if(yield this[j(0x163)]())(0x0,utils_1[j(0x1c4)])(j(0x1dd)+D[j(0x189)]()+j(0x1a4));else{if(s)yield D[j(0x1c2)](s);(0x0,utils_1[j(0x178)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed');}}));this[t(0x16d)][t(0x17d)](P),this['contexts'][t(0x17d)](v),this[t(0x16d)]['addCommand'](B),this[t(0x16d)][t(0x17d)](U);}[a2I(0x1ad)](w,h){var G,P,v,O;return __awaiter(this,void 0x0,void 0x0,function*(){const m=a2h,Z=!w['doNotOpenBrowser'],a=(G=w[m(0x1e2)])!==null&&G!==void 0x0?G:this[m(0x1d5)],l=new browser_login_1[(m(0x1a8))](a,Z);let B;l['on'](m(0x1ca),({url:p})=>{const y=m;if(Z){const s=p['replace'](/sessionToken=.*/,'sessionToken=********');console[y(0x1e3)](y(0x185)+s+')'),B=inquirer[y(0x17e)]([{'type':y(0x18f),'name':'fullUrl','message':'Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','default':![]}]),B[y(0x15f)](W=>{const E=y;process['stdout'][E(0x1e8)](0x0,-0x1),process[E(0x15d)]['clearLine'](0x1),W[E(0x1e7)]&&console['log'](E(0x175)+p+'\x20');});}else console[y(0x1e3)]('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+p+'\x20');});const {token:U,contextName:A}=yield l[m(0x1d2)]()[m(0x179)](p=>__awaiter(this,void 0x0,void 0x0,function*(){const K=m;(0x0,utils_1[K(0x178)])(K(0x190)+p[K(0x1be)]+K(0x1dc));const s=yield this[K(0x1ea)](w,h);return{'token':s[K(0x1ec)],'contextName':s[K(0x1bc)]};}))[m(0x169)](()=>{if(B)B['ui']['close']();}),D=(v=(P=w[m(0x1bc)])!==null&&P!==void 0x0?P:A)!==null&&v!==void 0x0?v:m(0x174)+new Date()[m(0x162)]();return(0x0,utils_1[m(0x1c4)])(m(0x171)+chalk_1[m(0x1ae)]['italic'](D)),{'name':D,'token':U,'host':a,'override':(O=w[m(0x1c1)])!==null&&O!==void 0x0?O:![]};});}['apiTokenLogin'](w,h){return __awaiter(this,void 0x0,void 0x0,function*(){const g=a2h,G=this['apiClient']['contextProvider'][g(0x1bf)]()[g(0x16d)],{name:P,token:v,host:O,override:Z}=yield h[g(0x18e)](w,G);return{'name':P,'token':v,'host':O,'override':Z};});}[a2I(0x152)](){const J=a2I,w=this[J(0x19b)][J(0x19c)]['getCurrentProjectName']();if(w===undefined)throw new Error(J(0x196));return w;}[a2I(0x160)](w){return __awaiter(this,void 0x0,void 0x0,function*(){const R=a2h;if(!this['contextAvailable']())throw new Error(R(0x154));const h=this[R(0x19b)][R(0x19c)][R(0x1bf)]()[R(0x16d)]['map'](P=>P[R(0x1bc)]),G=h[R(0x1d8)]>0x4?R(0x187):R(0x167);return(yield inquirer['prompt']([{'type':G,'name':R(0x1bc),'message':R(0x172)+w+':','choices':h}]))[R(0x1bc)];});}[a2I(0x15e)](){const N=a2I;return this[N(0x19b)][N(0x19c)]['loadContextWrapper']()[N(0x16d)]['length']>0x0;}['verifyToken'](){return __awaiter(this,void 0x0,void 0x0,function*(){const z=a2h;try{const w=this[z(0x19b)][z(0x19c)][z(0x14e)](),h=this[z(0x19b)][z(0x19c)][z(0x188)](),G=w+z(0x1e5),P={'Authorization':z(0x177)+h},v=yield(0x0,utils_1['retry'])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const F=z;return(0x0,node_fetch_1[F(0x1ae)])(G,{'method':'GET','timeout':0xbb8,'headers':P});}));if(v['ok'])return!![];return![];}catch(O){return![];}});}}exports[a2I(0x19e)]=CliContext;