@northflank/cli 0.9.5 → 0.9.6

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 a0z(u,z){const D=a0u();return a0z=function(M,H){M=M-0x1bf;let O=D[M];return O;},a0z(u,z);}const a0u2=a0z;function a0u(){const uO=['envs','addonDependencies','type','warning','source','1697598rxPkQx','2hcyDDS','addon','templateId','fetchResourceList','3347382yLtKoF','2210467zqMwpJ','backups','types','regions','addons','get','updateaddonversion','./utils','throw','find','region','options','20568861qlZIpV','cursor','__esModule','data','registries','includes','list','projectId','resources','nextPageCursor','__awaiter','map','secrets','pagination','keyName','templates','value','47504uKZtXM','plans','keys','next','886292gpjwnq','then','defineProperty','apply','services','projects','credentials','done','5524990buIgHr','internalId','serviceId','length','8SyVjkk','storage','No\x20available\x20versions\x20to\x20upgrade\x20to.','addonId','addonTypes','version'];a0u=function(){return uO;};return a0u();}(function(u,z){const u1=a0z,D=u();while(!![]){try{const M=parseInt(u1(0x1e8))/0x1*(parseInt(u1(0x1c6))/0x2)+-parseInt(u1(0x1c5))/0x3+parseInt(u1(0x1ec))/0x4+-parseInt(u1(0x1f4))/0x5+-parseInt(u1(0x1ca))/0x6+parseInt(u1(0x1cb))/0x7+parseInt(u1(0x1f8))/0x8*(parseInt(u1(0x1d7))/0x9);if(M===z)break;else D['push'](D['shift']());}catch(H){D['push'](D['shift']());}}}(a0u,0x9c9f6));var __awaiter=this&&this[a0u2(0x1e1)]||function(u,z,D,M){function H(O){return O instanceof D?O:new D(function(t){t(O);});}return new(D||(D=Promise))(function(O,t){const u6=a0z;function g(N){const u3=a0z;try{h(M[u3(0x1eb)](N));}catch(Z){t(Z);}}function T(N){const u4=a0z;try{h(M[u4(0x1d3)](N));}catch(Z){t(Z);}}function h(N){const u5=a0z;N[u5(0x1f3)]?O(N['value']):H(N[u5(0x1e7)])[u5(0x1ed)](g,T);}h((M=M[u6(0x1ef)](u,z||[]))[u6(0x1eb)]());});};Object[a0u2(0x1ee)](exports,a0u2(0x1d9),{'value':!![]}),exports[a0u2(0x1c9)]=void 0x0;const utils_1=require(a0u2(0x1d2)),defaultPaginationPageSize=0x32,getProjects=u=>z=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const u7=a0u2;var D;const M=yield u[u7(0x1dd)][u7(0x1f1)]({'options':{'per_page':defaultPaginationPageSize,'cursor':z===null||z===void 0x0?void 0x0:z[u7(0x1e0)]}});return{'elements':M[u7(0x1da)][u7(0x1f1)][u7(0x1e2)](H=>H['id']),'nextPageCursor':(D=M['pagination'])===null||D===void 0x0?void 0x0:D[u7(0x1d8)]};}),getServices=(u,z)=>D=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const u8=a0u2;var M;const H=yield u[u8(0x1dd)][u8(0x1f0)]({'parameters':{'projectId':z},'options':{'per_page':defaultPaginationPageSize,'cursor':D===null||D===void 0x0?void 0x0:D['nextPageCursor']}});return{'elements':H[u8(0x1da)][u8(0x1f0)][u8(0x1e2)](O=>O['id']),'nextPageCursor':(M=H[u8(0x1e4)])===null||M===void 0x0?void 0x0:M['cursor']};}),getAddons=(u,z)=>D=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const u9=a0u2;var M;const H=yield u[u9(0x1dd)]['addons']({'parameters':{'projectId':z},'options':{'per_page':defaultPaginationPageSize,'cursor':D===null||D===void 0x0?void 0x0:D[u9(0x1e0)]}});return{'elements':H[u9(0x1da)][u9(0x1cf)]['map'](O=>O['id']),'nextPageCursor':(M=H[u9(0x1e4)])===null||M===void 0x0?void 0x0:M[u9(0x1d8)]};}),getAddonBackups=(u,z,D)=>M=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const uu=a0u2;var H;const O=yield u[uu(0x1d0)][uu(0x1c7)][uu(0x1cc)]({'parameters':{'projectId':z,'addonId':D},'options':{'per_page':defaultPaginationPageSize,'cursor':M===null||M===void 0x0?void 0x0:M[uu(0x1e0)]}});return{'elements':O[uu(0x1da)]['backups'][uu(0x1e2)](t=>t['id']),'nextPageCursor':(H=O[uu(0x1e4)])===null||H===void 0x0?void 0x0:H['cursor']};});function fetchResourceList(u,z,D,M,H,O){var t,g,T,h,N,Z,E,X,R,b,A,o;return __awaiter(this,void 0x0,void 0x0,function*(){const uz=a0z,d=undefined;try{if(u==='deploymentPlan'){const l=yield z[uz(0x1dd)]['plans']({}),W=l['data'][uz(0x1e9)][uz(0x1e2)](F=>{const uD=uz;var I;return(I=F===null||F===void 0x0?void 0x0:F[uD(0x1f5)])!==null&&I!==void 0x0?I:F===null||F===void 0x0?void 0x0:F['id'];});return{'choices':W,'defaultValue':d};}if(u===uz(0x1d5)&&!(D===null||D===void 0x0?void 0x0:D['includes']('logSink'))){const F=yield z[uz(0x1dd)]['regions']({}),I=F['data'][uz(0x1ce)][uz(0x1e2)](q=>{const uM=uz;var Q;return(Q=q===null||q===void 0x0?void 0x0:q[uM(0x1f5)])!==null&&Q!==void 0x0?Q:q===null||q===void 0x0?void 0x0:q['id'];});return{'choices':I,'defaultValue':d};}if(u===uz(0x1de)){const q=yield getProjects(z),{elements:Q,nextPageCursor:r}=yield q();return{'choices':Q,'defaultValue':d,'pagination':{'nextPageCursor':r,'loadMore':q}};}if(u===uz(0x1f2)){const i=yield z[uz(0x1dd)][uz(0x1db)]({}),U=i[uz(0x1da)]['credentials'][uz(0x1e2)](L=>L['id']);return{'choices':U,'defaultValue':d};}const K=H===null||H===void 0x0?void 0x0:H[uz(0x1de)],w=u===uz(0x1f6)||u==='id'&&(O===null||O===void 0x0?void 0x0:O[uz(0x1dc)]('owningObject'));if(K!==undefined&&w){const L=yield getServices(z,K),{elements:C,nextPageCursor:j}=yield L();return{'choices':C,'defaultValue':d,'pagination':{'nextPageCursor':j,'loadMore':L}};}const y=D===null||D===void 0x0?void 0x0:D[uz(0x1dc)](uz(0x1c7));if(y){const J=a=>__awaiter(this,void 0x0,void 0x0,function*(){const uH=uz;var V;const m=yield z[uH(0x1d0)][uH(0x1c7)][uH(0x1cd)]({});return(V=m[uH(0x1da)][uH(0x1fc)])===null||V===void 0x0?void 0x0:V[uH(0x1d4)](B=>B[uH(0x1c2)]===a);});if(u==='type'){const a=yield z[uz(0x1d0)]['addon'][uz(0x1cd)]({}),V=(t=a[uz(0x1da)][uz(0x1fc)])===null||t===void 0x0?void 0x0:t[uz(0x1e2)](m=>m[uz(0x1c2)]);return{'choices':V,'defaultValue':d};}if(u===uz(0x1bf)&&(M===null||M===void 0x0?void 0x0:M[uz(0x1c2)])!==undefined){const m=(g=yield J(M['type']))===null||g===void 0x0?void 0x0:g['versions'];return{'choices':m,'defaultValue':d};}if(u===uz(0x1f9)&&(M===null||M===void 0x0?void 0x0:M[uz(0x1c2)])!==undefined){const B=(h=(T=yield J(M[uz(0x1c2)]))===null||T===void 0x0?void 0x0:T[uz(0x1df)])===null||h===void 0x0?void 0x0:h[uz(0x1f9)];return{'choices':B===null||B===void 0x0?void 0x0:B[uz(0x1d6)],'defaultValue':B===null||B===void 0x0?void 0x0:B['default']};}if(u==='replicas'&&(M===null||M===void 0x0?void 0x0:M['type'])!==undefined){const f=(Z=(N=yield J(M[uz(0x1c2)]))===null||N===void 0x0?void 0x0:N[uz(0x1df)])===null||Z===void 0x0?void 0x0:Z['replicas'];return{'choices':f===null||f===void 0x0?void 0x0:f[uz(0x1d6)],'defaultValue':f===null||f===void 0x0?void 0x0:f['default']};}}if(u===uz(0x1fb)&&(H===null||H===void 0x0?void 0x0:H[uz(0x1de)])!==undefined){const G=yield getAddons(z,H===null||H===void 0x0?void 0x0:H[uz(0x1de)]),{elements:Y,nextPageCursor:P}=yield G();return{'choices':Y,'defaultValue':d,'pagination':{'nextPageCursor':P,'loadMore':G}};}if(u==='backupId'&&(H===null||H===void 0x0?void 0x0:H[uz(0x1de)])!==undefined&&((E=M===null||M===void 0x0?void 0x0:M[uz(0x1c4)])===null||E===void 0x0?void 0x0:E['addonId'])!==undefined){const s=yield getAddonBackups(z,H===null||H===void 0x0?void 0x0:H[uz(0x1de)],(X=M===null||M===void 0x0?void 0x0:M[uz(0x1c4)])===null||X===void 0x0?void 0x0:X[uz(0x1fb)]),{elements:v,nextPageCursor:x}=yield s();return{'choices':v,'defaultValue':d,'pagination':{'nextPageCursor':x,'loadMore':s}};}const k=(R=H===null||H===void 0x0?void 0x0:H[uz(0x1fb)])!==null&&R!==void 0x0?R:(b=M===null||M===void 0x0?void 0x0:M[uz(0x1c1)])===null||b===void 0x0?void 0x0:b[uz(0x1fb)];if((D===null||D===void 0x0?void 0x0:D['join'](''))===uz(0x1d1)&&u===uz(0x1bf)&&(H===null||H===void 0x0?void 0x0:H['projectId'])!==undefined&&k!==undefined){const {upgradeTo:p}=(yield z[uz(0x1d0)]['addon'][uz(0x1bf)]({'parameters':{'addonId':k,'projectId':H===null||H===void 0x0?void 0x0:H['projectId']}}))[uz(0x1da)];if(p===undefined||p[uz(0x1f7)]<=0x0){(0x0,utils_1[uz(0x1c3)])(uz(0x1fa));throw new Error();}return{'choices':p['map'](n=>n[uz(0x1bf)]),'defaultValue':d};}if(u===uz(0x1c8)){const n=yield z[uz(0x1dd)][uz(0x1e6)]({}),c=n[uz(0x1da)]['templates'][uz(0x1e2)](S=>S===null||S===void 0x0?void 0x0:S['id']);return{'choices':c,'defaultValue':d};}if(((D===null||D===void 0x0?void 0x0:D[uz(0x1dc)]('secretLink'))||(D===null||D===void 0x0?void 0x0:D[uz(0x1dc)]('secret')))&&u===uz(0x1e5)&&k!==undefined&&(H===null||H===void 0x0?void 0x0:H['projectId'])!==undefined){const S=(yield z[uz(0x1d0)][uz(0x1c7)]['credentials']({'parameters':{'addonId':k,'projectId':H===null||H===void 0x0?void 0x0:H[uz(0x1de)]}}))['data'];return{'choices':[...(A=Object[uz(0x1ea)](S===null||S===void 0x0?void 0x0:S[uz(0x1c0)]))!==null&&A!==void 0x0?A:[],...(o=Object[uz(0x1ea)](S===null||S===void 0x0?void 0x0:S[uz(0x1e3)]))!==null&&o!==void 0x0?o:[]]};}}catch(u0){}return{'choices':undefined,'defaultValue':d};});}exports[a0u2(0x1c9)]=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 a1uR=a1z;function a1z(u,z){const D=a1u();return a1z=function(M,H){M=M-0x189;let O=D[M];return O;},a1z(u,z);}(function(u,z){const uX=a1z,D=u();while(!![]){try{const M=-parseInt(uX(0x1b8))/0x1+parseInt(uX(0x1e0))/0x2+parseInt(uX(0x250))/0x3+parseInt(uX(0x206))/0x4+parseInt(uX(0x21b))/0x5+-parseInt(uX(0x25c))/0x6*(-parseInt(uX(0x195))/0x7)+parseInt(uX(0x242))/0x8*(-parseInt(uX(0x1d9))/0x9);if(M===z)break;else D['push'](D['shift']());}catch(H){D['push'](D['shift']());}}}(a1u,0xcc321));var __createBinding=this&&this[a1uR(0x189)]||(Object['create']?function(u,z,D,M){const ub=a1uR;if(M===undefined)M=D;var H=Object[ub(0x233)](z,D);(!H||(ub(0x258)in H?!z['__esModule']:H['writable']||H[ub(0x1ae)]))&&(H={'enumerable':!![],'get':function(){return z[D];}}),Object[ub(0x21f)](u,M,H);}:function(u,z,D,M){if(M===undefined)M=D;u[M]=z[D];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object['create']?function(u,z){const uA=a1uR;Object[uA(0x21f)](u,uA(0x1d2),{'enumerable':!![],'value':z});}:function(u,z){const uo=a1uR;u[uo(0x1d2)]=z;}),__importStar=this&&this[a1uR(0x251)]||function(u){const ud=a1uR;if(u&&u[ud(0x266)])return u;var z={};if(u!=null){for(var D in u)if(D!==ud(0x1d2)&&Object['prototype'][ud(0x1b7)][ud(0x227)](u,D))__createBinding(z,u,D);}return __setModuleDefault(z,u),z;},__awaiter=this&&this[a1uR(0x1b1)]||function(u,z,D,M){function H(O){return O instanceof D?O:new D(function(t){t(O);});}return new(D||(D=Promise))(function(O,t){const uy=a1z;function g(N){const uK=a1z;try{h(M[uK(0x21a)](N));}catch(Z){t(Z);}}function T(N){try{h(M['throw'](N));}catch(Z){t(Z);}}function h(N){const uw=a1z;N['done']?O(N[uw(0x257)]):H(N[uw(0x257)])[uw(0x244)](g,T);}h((M=M[uy(0x19a)](u,z||[]))['next']());});},__importDefault=this&&this[a1uR(0x221)]||function(u){const uk=a1uR;return u&&u[uk(0x266)]?u:{'default':u};};Object[a1uR(0x21f)](exports,a1uR(0x266),{'value':!![]}),exports[a1uR(0x214)]=void 0x0;const js_client_1=require(a1uR(0x203)),commander_1=__importDefault(require('commander')),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require('ajv')),chalk_1=__importDefault(require('chalk')),_=__importStar(require(a1uR(0x1f2))),contextCommands_1=require('./context/contextCommands'),utils_1=require('./utils'),defaults=__importStar(require('./defaults')),inquirer_helper_1=require(a1uR(0x1ee)),console_format_helpers_1=require(a1uR(0x1fa)),command_overview_1=require(a1uR(0x223)),port_forward_1=require(a1uR(0x260)),exec_1=require(a1uR(0x1ba)),logs_1=require('./logs'),metrics_1=require(a1uR(0x24c)),yaml=require(a1uR(0x1be)),pgk=require(a1uR(0x1b2)),getProgram=u=>{const ul=a1uR,z=new commander_1[(ul(0x1d2))][(ul(0x1da))]('northflank');z[ul(0x1cb)](ul(0x23a)),z[ul(0x23e)](!![]),z['version'](ul(0x240)+chalk_1[ul(0x1d2)]['underline'](pgk[ul(0x24d)]),ul(0x1cc),ul(0x236));const D=new js_client_1[(ul(0x1cf))](u,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[ul(0x19c)]}),M=new contextCommands_1[(ul(0x234))](D),H=new port_forward_1[(ul(0x198))](u),O=new exec_1['CliExec'](u),t=new logs_1['CliLogs'](u),g=new metrics_1[(ul(0x1e4))](u);return z[ul(0x1a4)](H['portFwdCmd']),z['addCommand'](O[ul(0x1ab)]),z[ul(0x1a4)](M['login']),z[ul(0x1a4)](M[ul(0x1e2)]),generateCommands(D,D[ul(0x1d6)],z,t,g),z[ul(0x1a4)]((0x0,command_overview_1[ul(0x1e5)])(z)),z;};exports[a1uR(0x214)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const uW=a1uR;try{const u=new js_client_1['ApiClientFileContextProvider']();yield(0x0,utils_1['checkUpdate'])(u);const z=(0x0,exports[uW(0x214)])(u);yield z[uW(0x247)](process[uW(0x273)]);}catch(D){(0x0,utils_1[uW(0x1dd)])('Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20'+D[uW(0x1c4)]),process['argv'][uW(0x1b9)](M=>M===uW(0x1db))&&console[uW(0x1f3)](D),process['exitCode']=0x1;}}))());function a1u(){const us=['error','requiredPermissions','subdomainId','3022794mBvwzB','askForJobRun','contexts','API\x20request\x20failed\x0a\x09Message:\x20','CliMetrics','getCommandOverview','repository','credentialId','url','yml','plans','aliases','job','docsTagsPath','./inquirer-helper','required','svc','upperFirst','lodash','log','askForSubdomain','includes','projects','delete','templateRunId','getLogsCommand','./formatting/console-format-helpers','VERBOSE:\x20Request\x20body\x20->\x20','=>\x20running\x20command\x20with:\x20','OPTIONAL:\x20','addon','match\x20exactly\x20one\x20schema\x20in\x20oneOf','askForAddon','path','clearLine','@northflank/js-client','runId','runtimeFiles/additionalProperties','2453200KZTjCO','-f,\x20--file\x20<file-path>','cursor','asyncSequential','askConfirm','askForVolume','map','askForPipeline','secretId','isString','getCurrentServiceName','defaults','green','askForJob','getProgram','File\x20to\x20load\x20resource\x20json\x20from','askForLogSink','force','service','name','next','21085smpcpf','list','query','branch','defineProperty','bind','__importDefault','option','./formatting/command-overview','contextProvider','parse','region','call','brn','validate','entries','custom-columns=','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','template','handleYamlOutput','addons','invoices','forEach','backupId','getOwnPropertyDescriptor','CliContext','existsSync','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','credentials','volumes','status','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','moveCursor','startsWith','toString','enablePositionalOptions','printAsTable','Northflank\x20cli\x20version:\x20','api.','13354312icwIwc','propToType','then','details','join','parseAsync','stdout','domain','split','grey','./metrics','version','askForService','secret','3198873JraokD','__importStar','safeLoad','opt','credential','keys',',\x20-','value','get','volume','setPathVars','getCommand','6ptCdHx','length','getMetricsCommand','after','./port-forward','templates','\x20--','/docs/v1/api/','assign','templateId','__esModule','runs','Update\x20Northflank\x20','getCurrentJobName','logSinkId','errors','askForTemplate','project','\x0a>\x20Token\x20permissions\x20required:\x20','inv','askForAddonBackup','retrievePayloadViaInteractiveCli','invoice','argv','__createBinding','action','addonId','toLowerCase','VERBOSE:\x20Using\x20endpoint\x20->\x20','services','has','isEqual','getOwnPropertyNames','backups','Documentation:\x20','repositories','1700608rNMeZk','domainId','some','CliPortForward','toUpperCase','apply','Unknown\x20input\x20file\x20type:\x20','customUserAgent','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','omit','base','output','askForBuild','vol','projectId','addCommand','sort','askForDomain','json','replace','pln','\x20properties','execCmd','pipelineId','filter','configurable','Resource\x20was\x20not\x20deleted.','buildId','__awaiter','../package.json','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','body','addHelpText','kebabCase','hasOwnProperty','932475cNmOsE','find','./exec','resource','adn','warning','js-yaml','-i,\x20--input\x20<resource-def>','tpl','\x20Northflank\x20resources','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','\x0a\x09details\x20:','message','set','stringify','jobId','host','opts','File\x20does\x20not\x20exist:\x20','description','-v,\x20--version','serviceId','count','ApiClient','assertContextExisting','regions','default','verbose','repo','endsWith','endpoints','method','InquirerHelper','9wAcLLT','Command','--verbose','file'];a1u=function(){return us;};return a1u();}function isListCommand(u){const uF=a1uR,z=[['get',uF(0x1fe),uF(0x192)],[uF(0x258),uF(0x1ec),uF(0x267)]];return u[uF(0x1b9)](D=>D===uF(0x21c))||z['some'](D=>_['isEqual'](u,D));}function generateCommands(u,z,D,M,H,O=defaults[a1uR(0x211)],t=[]){const uI=a1uR,g=new inquirer_helper_1[(uI(0x1d8))](new js_client_1['ApiClient'](u[uI(0x224)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent']}));function T(X,R){const uq=uI;return X[uq(0x1ef)]!==![]&&R===undefined;}function h(X,R){const ue=uI,{opt:b,name:A}=X,o=b[ue(0x1d2)],d=T(b,o),K=F=>F[ue(0x25d)]>0x1?'--'+F:'-'+F,w=b===null||b===void 0x0?void 0x0:b['alias'],y=w?_['isArray'](w)?'-'+(w===null||w===void 0x0?void 0x0:w[ue(0x20c)](F=>K(F))['join'](ue(0x256)))+',':''+K(w):'',k=d?'':ue(0x1fd),l=typeof b['type']==='boolean'?y+'\x20--'+A:y+ue(0x262)+A+'\x20<'+A[ue(0x199)]()+'>',W=k+b[ue(0x1cb)];R[ue(0x222)](l,W,o);}function N(){const uQ=uI;if(D['commands'][uQ(0x197)](X=>X[uQ(0x219)]()==='logs'))return;_[uQ(0x190)](t,[uQ(0x258),uQ(0x218)])&&(D[uQ(0x1a4)](M[uQ(0x1f9)]('service')),D[uQ(0x1a4)](H[uQ(0x25e)](uQ(0x218))),D[uQ(0x1a4)](M[uQ(0x1f9)](uQ(0x218),!![])),D[uQ(0x1a4)](H['getMetricsCommand'](uQ(0x218),!![]))),_[uQ(0x190)](t,[uQ(0x258),'job'])&&(D[uQ(0x1a4)](M[uQ(0x1f9)](uQ(0x1ec))),D['addCommand'](H[uQ(0x25e)](uQ(0x1ec))),D[uQ(0x1a4)](M[uQ(0x1f9)]('job',!![])),D[uQ(0x1a4)](H[uQ(0x25e)](uQ(0x1ec),!![]))),_[uQ(0x190)](t,['get',uQ(0x1fe)])&&(D[uQ(0x1a4)](M[uQ(0x1f9)](uQ(0x1fe))),D[uQ(0x1a4)](H[uQ(0x25e)]('addon')));}return Object[uI(0x191)](O)['forEach'](X=>{const uf=uI,R=z[X],b=O[X],A=t['concat']([X]);function o(q,e){const ur=a1z,Q=Object['getOwnPropertyNames'](q||{});Q[ur(0x20c)](r=>{return{'name':r,'opt':q[r]};})[ur(0x1a5)]((r,i)=>!T(r[ur(0x253)])?!T(i[ur(0x253)])?0x0:0x1:-0x1)[ur(0x231)](r=>{h(r,e);});}function d(q,e){const ui=a1z,Q=[[ui(0x26d),ui(0x1f6),'prj'],[ui(0x218),ui(0x18e),ui(0x1f0)],[ui(0x237),ui(0x254),'cred'],[ui(0x1fe),ui(0x22f),ui(0x1bc)],['job','jobs'],['plan',ui(0x1ea),ui(0x1a9)],[ui(0x226),ui(0x1d1),'rgn'],['domain','domains','dmn'],[ui(0x24f),'secrets','scrt'],[ui(0x238),ui(0x259),ui(0x1a2)],['branches',ui(0x21e),ui(0x228)],[ui(0x272),ui(0x230),ui(0x26f)],[ui(0x22d),ui(0x261),ui(0x1c0)],['repos',ui(0x1e6),ui(0x194),ui(0x1d4)]],r=Q[ui(0x1b9)](i=>i[ui(0x1f5)](e));if(r!==undefined)q[ui(0x1eb)](r[ui(0x1ad)](i=>i!==e));}function K(q){var e,Q;return __awaiter(this,void 0x0,void 0x0,function*(){const uU=a1z,r={},{contextProvider:i}=u,U=A[uU(0x1f5)](uU(0x1f7)),L=q['noDefaults']===!![];function C(j,J,a){var V,m;return __awaiter(this,void 0x0,void 0x0,function*(){const uL=a1z;if(_[uL(0x18f)]((m=(V=b[uL(0x253)])===null||V===void 0x0?void 0x0:V[uL(0x201)])!==null&&m!==void 0x0?m:{},j)){const B=!L&&!U&&a?a():undefined,f=q[j]||B||(yield J());_['set'](r,j,f);}});}return yield(0x0,utils_1[uU(0x209)])(Object[uU(0x22a)]((Q=(e=b['opt'])===null||e===void 0x0?void 0x0:e[uU(0x201)])!==null&&Q!==void 0x0?Q:{}),([j,J])=>__awaiter(this,void 0x0,void 0x0,function*(){const uC=uU,a=r===null||r===void 0x0?void 0x0:r[uC(0x1a3)],V=r===null||r===void 0x0?void 0x0:r[uC(0x265)];switch(j){case uC(0x1a3):return yield C(uC(0x1a3),g['askForProject']['bind'](g),i['getCurrentProjectName'][uC(0x220)](i));case uC(0x1cd):return yield C(uC(0x1cd),g[uC(0x24e)](a)[uC(0x220)](g),i[uC(0x210)][uC(0x220)](i));case uC(0x18b):return yield C(uC(0x18b),g[uC(0x200)](a)[uC(0x220)](g));case uC(0x1c7):return yield C('jobId',g[uC(0x213)](a)[uC(0x220)](g),i[uC(0x269)][uC(0x220)](i));case uC(0x204):return yield C(uC(0x204),g[uC(0x1e1)](r[uC(0x1c7)],a)['bind'](g));case uC(0x20e):return yield C(uC(0x20e),g['askForSecret'](a)['bind'](g));case uC(0x249):case uC(0x196):return yield C(uC(0x249),g[uC(0x1a6)][uC(0x220)](g));case uC(0x1e7):return yield C('credentialId',g['askForCredentials'][uC(0x220)](g));case'volumeId':return yield C('volumeId',g[uC(0x20b)](a)['bind'](g));case'subdomain':return yield C('subdomain',g['askForSubdomain'](r[uC(0x249)])[uC(0x220)](g));case uC(0x1df):return yield C(uC(0x1df),g[uC(0x1f4)](r[uC(0x196)])[uC(0x220)](g));case uC(0x232):return yield C(uC(0x232),g[uC(0x270)](a,r['addonId'])[uC(0x220)](g));case'buildId':return yield C(uC(0x1b0),g[uC(0x1a1)](a,r[uC(0x1cd)],r[uC(0x1c7)])[uC(0x220)](g));case uC(0x265):return yield C('templateId',g[uC(0x26c)]()['bind'](g));case uC(0x1f8):return yield C(uC(0x1f8),g['askForTemplateRun'](V)[uC(0x220)](g));case uC(0x26a):return yield C(uC(0x26a),g[uC(0x216)]()[uC(0x220)](g));case uC(0x1ac):return yield C(uC(0x1ac),g[uC(0x20d)](a)[uC(0x220)](g));default:return yield C(j,g['askGeneric'](j,J===null||J===void 0x0?void 0x0:J['description'])['bind'](g));}})),r;});}function w(q){var e,Q;return __awaiter(this,void 0x0,void 0x0,function*(){const uj=a1z,r={},i=Object[uj(0x255)]((Q=(e=b[uj(0x253)])===null||e===void 0x0?void 0x0:e[uj(0x21d)])!==null&&Q!==void 0x0?Q:{});return yield(0x0,utils_1[uj(0x209)])(i,U=>__awaiter(this,void 0x0,void 0x0,function*(){const uJ=uj;if(q[U]!==undefined)return q[U];const L={},{required:C,schema:j}=b[uJ(0x253)][uJ(0x21d)][U];return yield g[uJ(0x243)]([''+U],j,L,C),L[U]!==undefined&&_[uJ(0x1c5)](r,U,L[U]),L;})),r;});}function y(){const ua=a1z;switch(A[0x0]){case'get':return'Get\x20information\x20about\x20Northflank\x20'+(A[0x1]||ua(0x1bb))+'s';case'update':return ua(0x268)+(A[0x1]||ua(0x1bb))+ua(0x1aa);default:return _[ua(0x1f1)](X)+ua(0x1c1);}}function k(q,e){const uV=a1z;var Q,r,i,U,L,C;if(!e){const G=(0x0,utils_1[uV(0x25b)])()[uV(0x219)](_[uV(0x1b6)](X))['description'](y());return d(G,X),G;}const j=(q===null||q===void 0x0?void 0x0:q[uV(0x1de)])?chalk_1['default'][uV(0x24b)](uV(0x26e)+q[uV(0x1de)]):'',J=u[uV(0x224)]['getCurrentContext'](),a=J!==undefined&&((Q=b===null||b===void 0x0?void 0x0:b[uV(0x253)])===null||Q===void 0x0?void 0x0:Q[uV(0x1ed)])!==undefined,V=J===null||J===void 0x0?void 0x0:J[uV(0x1c8)][uV(0x1a8)](uV(0x241),''),m=a?uV(0x193)+V+uV(0x263)+((r=b===null||b===void 0x0?void 0x0:b['opt'])===null||r===void 0x0?void 0x0:r[uV(0x1ed)]):'',B=(q===null||q===void 0x0?void 0x0:q[uV(0x1cb)])||'',f=(0x0,utils_1[uV(0x25b)])(!![])[uV(0x219)](_[uV(0x1b6)](X))[uV(0x1cb)](B)[uV(0x1b5)](uV(0x25f),[j,m][uV(0x246)]('\x0a'));return d(f,X),((i=b[uV(0x253)])===null||i===void 0x0?void 0x0:i[uV(0x1b4)])&&(f['option'](uV(0x207),uV(0x215)),f[uV(0x222)](uV(0x1bf),uV(0x22c))),o((U=b['opt'])===null||U===void 0x0?void 0x0:U[uV(0x201)],f),o((L=b[uV(0x253)])===null||L===void 0x0?void 0x0:L[uV(0x21d)],f),o((C=b['opt'])===null||C===void 0x0?void 0x0:C[uV(0x19f)],f),f[uV(0x18a)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const um=uV;var Y,P,s,v;(0x0,utils_1[um(0x1d0)])(u);const x=f[um(0x1c9)](),p=x===null||x===void 0x0?void 0x0:x[um(0x1a0)],n=p===um(0x1a7),c=p==='yaml'||p===um(0x1e9),S=yield K(x);g[um(0x25a)](S);const u0=yield w(x),u1=Object['keys']((P=(Y=b[um(0x253)])===null||Y===void 0x0?void 0x0:Y['path'])!==null&&P!==void 0x0?P:{})['map'](u6=>u6+'='+chalk_1[um(0x1d2)][um(0x212)](S[u6]))[um(0x246)](',\x20');if(u1[um(0x25d)]>0x0&&!n&&!c){const u6=um(0x1fc)+u1;console[um(0x1f3)](u6);}const u2=((s=b[um(0x253)])===null||s===void 0x0?void 0x0:s[um(0x1b4)])?yield E(x,b,A):undefined;if(!x[um(0x217)]&&A['includes'](um(0x1f7))&&!(yield g['deleteWarningPrompt']())){(0x0,utils_1[um(0x1bd)])(um(0x1af));return;}function u3(u7,u8=![],u9=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const uB=a1z,{data:uu,request:uz,error:uD,pagination:uM}=yield R['call']({'parameters':S,'options':Object[uB(0x264)](Object[uB(0x264)]({},u0),{'cursor':u7}),'data':u2});(x===null||x===void 0x0?void 0x0:x[uB(0x1d3)])&&(console['log'](uB(0x18d)+uz[uB(0x1d7)]+':'+uz[uB(0x1e8)]),console[uB(0x1f3)](uB(0x1fb)+uz['body']));if(uD){const uH=uD['details']?uB(0x1c3)+JSON[uB(0x1c6)](uD[uB(0x245)]):'',uO=(uD===null||uD===void 0x0?void 0x0:uD['id'])?',\x20NF\x20error\x20id:\x20'+uD['id']:'',ut='(HTTP\x20status\x20code:\x20'+uD[uB(0x239)]+uO+')';throw new Error(uB(0x1e3)+uD[uB(0x1c4)]+'\x20'+ut+uH);}if(!(x===null||x===void 0x0?void 0x0:x['quiet'])){if(n)(0x0,console_format_helpers_1['handleJsonOutput'])(x===null||x===void 0x0?void 0x0:x[uB(0x1a0)],uu);else{if(c)(0x0,console_format_helpers_1[uB(0x22e)])(x===null||x===void 0x0?void 0x0:x[uB(0x1a0)],uu);else{if(isListCommand(A)){const ug=(p===null||p===void 0x0?void 0x0:p[uB(0x23c)](uB(0x22b)))?p['replace'](uB(0x22b),'')['split'](',')[uB(0x20c)](uE=>uE[uB(0x18c)]()):undefined,uT=A[A[uB(0x25d)]-0x1],uh=''+uT+(uT[uB(0x1d5)]('s')?'':'s'),uN=_['upperFirst'](uh),uZ=_[uB(0x18f)](uu,uh)?uu[uh]:uu;(0x0,console_format_helpers_1[uB(0x23f)])(uZ,uN,ug,u8,u9);}else console[uB(0x1f3)]((0x0,console_format_helpers_1['consoleFormat'])(uu));}}}return uM;});}let u4=yield u3(),u5=0x0;if(!x['quiet']&&(u4===null||u4===void 0x0?void 0x0:u4[um(0x208)]))while(u4[um(0x208)]){const u7=yield g[um(0x20a)]('there\x20are\x20more\x20rows,\x20load?');u7&&(process[um(0x248)][um(0x23b)](0x0,-0x1),process[um(0x248)][um(0x202)](0x1),u5+=(v=u4[um(0x1ce)])!==null&&v!==void 0x0?v:0x0,u4=yield u3(u4[um(0x208)],!![],u5));}})),f;}const l=_['has'](b,uf(0x253)),W=R,F=k(W,l);D['addCommand'](F),N();const I=_[uf(0x19e)](b,'opt');Object[uf(0x255)](I)[uf(0x25d)]>0x0&&generateCommands(u,R,F,M,H,I,A);});function Z(X,R,b){return __awaiter(this,void 0x0,void 0x0,function*(){const uG=a1z,{input:A,file:o}=X;if(A!==undefined)try{return JSON[uG(0x225)](A);}catch(K){try{return yaml[uG(0x252)](A);}catch(w){throw new Error(uG(0x19d));}}if(o!==undefined){if(!fs_1[uG(0x1d2)][uG(0x235)](o))throw new Error(uG(0x1ca)+o);const y=fs_1['default']['readFileSync'](o)[uG(0x23d)]();let k;try{if(_[uG(0x20f)](y)){if(X[uG(0x1dc)][uG(0x1d5)]('.json'))k=JSON[uG(0x225)](y);else{if(X['file'][uG(0x1d5)]('.yaml')||X[uG(0x1dc)][uG(0x1d5)](uG(0x1e9)))k=yaml[uG(0x252)](y);else throw new Error(uG(0x19b)+X[uG(0x1dc)][uG(0x24a)]('.')['pop']());}}else k=y;return k;}catch(l){throw new Error(uG(0x1c2)+l[uG(0x1c4)]);}}return yield g[uG(0x271)](R,{'cmdPath':b});});}function E(X,R,b){var A;return __awaiter(this,void 0x0,void 0x0,function*(){const uY=a1z,o=yield Z(X,R,b),d=new ajv_1[(uY(0x1d2))]({'allErrors':!![],'keywords':['example'],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let K=![];try{K=d[uY(0x229)](R['opt'][uY(0x1b4)],o);}catch(y){if(y[uY(0x1c4)]['includes'](uY(0x205)))K=!![];else throw y;}const w=(A=d===null||d===void 0x0?void 0x0:d['errors'])===null||A===void 0x0?void 0x0:A[uY(0x1ad)](k=>{const uP=uY;var l;return!((l=k===null||k===void 0x0?void 0x0:k['message'])===null||l===void 0x0?void 0x0:l[uP(0x1f5)](uP(0x1ff)));});if(!K&&w!==undefined&&(w===null||w===void 0x0?void 0x0:w[uY(0x25d)])>0x0)throw new Error(uY(0x1b3)+JSON['stringify'](d[uY(0x26b)],null,'\x20'));return o;});}}
@@ -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 a2d=a2z;(function(u,z){const o=a2z,D=u();while(!![]){try{const M=-parseInt(o(0x108))/0x1+parseInt(o(0xf4))/0x2*(parseInt(o(0xdd))/0x3)+parseInt(o(0x150))/0x4+-parseInt(o(0x12b))/0x5+-parseInt(o(0xbb))/0x6*(-parseInt(o(0x155))/0x7)+-parseInt(o(0x146))/0x8+parseInt(o(0xf8))/0x9;if(M===z)break;else D['push'](D['shift']());}catch(H){D['push'](D['shift']());}}}(a2u,0xd040d));function a2z(u,z){const D=a2u();return a2z=function(M,H){M=M-0xba;let O=D[M];return O;},a2z(u,z);}function a2u(){const c=['227926WJkkvi','next','alias','value','16026786usoUnh','service','update-token','__esModule','getOwnPropertyDescriptor','Choose\x20the\x20context\x20to\x20','-n,\x20--name\x20[NAME]','getCurrentProjectName','get','../formatting/console-format-helpers','Token\x20for\x20current\x20context\x20\x27','--do-not-open-browser','host','addContext','Retrieve\x20and\x20update\x20local\x20context\x20settings.','__createBinding','1687900khotnr','useJobId','name','getCurrentName','../inquirer-helper','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','--token-login','valueOf','use\x20from\x20now\x20on','Contexts','default','token','loadContextWrapper','\x20successful','error','apiClient','success','Error\x20occured\x20during\x20browser\x20login:\x20','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','Use\x20job\x20with\x20id:','tokenPrompt','apiTokenLogin','moveCursor','action','stdout','browserLogin','GET','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','sessionToken=********','prompt','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','contextAvailable','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','1822385XcSVES','-h,\x20--host\x20[HOST]','getInfo','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','../utils','browser-opened','length','printAsTable','current','__awaiter','Name\x20for\x20login\x20context','dir','getCurrentContext','verifyToken','useContext','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','-t,\x20--token\x20[TOKEN]','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','map','done','../login/browser-login','Shows\x20full\x20context\x20information\x20(including\x20tokens)','then','catch','useProjectId','Update\x20token\x20for\x20current\x20context','askForJob','10422080dbggJe','https://api.northflank.com','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','hasOwnProperty','Login\x20to\x20','Changed\x20current\x20context\x20to\x20','sort','askForService','Local\x20context\x20\x27','Switch\x20between\x20your\x20local\x20contexts','4299076mErLGW','getCommand','override','\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','2947LDanTs','use','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','message','7908qZNrZC','description','askForContext','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','Remove\x20a\x20context','project','chalk','Local\x20context\x20name\x20to\x20remove.','warning','\x27\x20successfully\x20updated.','NorthflankApiBrowserLogin','italic','defaultBaseUrl','Token\x20for\x20this\x20context','Use\x20project\x20with\x20id:','https://','__setModuleDefault','.\x20Using\x20fallback.','askForProject','replace','contextProvider','remove','Use\x20manual\x20login\x20with\x20API\x20token','node-fetch','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','login','fullUrl','CliContext','prototype','option','getCurrentToken','log','sanitiseHostname','useServiceId','21URVuMf','throw','-i,\x20--id\x20[ID]','getCurrentBaseUrl','contexts','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','context','retry','updateToken','autologin-','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','create','\x27\x20successfully\x20removed.','--override','Use\x20service\x20with\x20id:','getProjectName','removeContext','job','set','addCommand','close','host\x20url\x20for\x20this\x20context','defineProperty'];a2u=function(){return c;};return a2u();}var __createBinding=this&&this[a2d(0x107)]||(Object[a2d(0xe8)]?function(u,z,D,M){const K=a2d;if(M===undefined)M=D;var H=Object[K(0xfc)](z,D);(!H||(K(0x100)in H?!z[K(0xfb)]:H['writable']||H['configurable']))&&(H={'enumerable':!![],'get':function(){return z[D];}}),Object['defineProperty'](u,M,H);}:function(u,z,D,M){if(M===undefined)M=D;u[M]=z[D];}),__setModuleDefault=this&&this[a2d(0xcb)]||(Object[a2d(0xe8)]?function(u,z){const w=a2d;Object['defineProperty'](u,w(0x112),{'enumerable':!![],'value':z});}:function(u,z){const y=a2d;u[y(0x112)]=z;}),__importStar=this&&this['__importStar']||function(u){const k=a2d;if(u&&u['__esModule'])return u;var z={};if(u!=null){for(var D in u)if(D!==k(0x112)&&Object[k(0xd7)][k(0x149)]['call'](u,D))__createBinding(z,u,D);}return __setModuleDefault(z,u),z;},__awaiter=this&&this[a2d(0x134)]||function(u,z,D,M){function H(O){return O instanceof D?O:new D(function(t){t(O);});}return new(D||(D=Promise))(function(O,t){const I=a2z;function g(N){const l=a2z;try{h(M[l(0xf5)](N));}catch(Z){t(Z);}}function T(N){const W=a2z;try{h(M[W(0xde)](N));}catch(Z){t(Z);}}function h(N){const F=a2z;N[F(0x13e)]?O(N[F(0xf7)]):H(N[F(0xf7)])[F(0x141)](g,T);}h((M=M['apply'](u,z||[]))[I(0xf5)]());});},__importDefault=this&&this['__importDefault']||function(u){const q=a2d;return u&&u[q(0xfb)]?u:{'default':u};};Object[a2d(0xf3)](exports,a2d(0xfb),{'value':!![]}),exports[a2d(0xd6)]=void 0x0;const _=__importStar(require('lodash')),node_fetch_1=__importDefault(require(a2d(0xd2))),chalk_1=__importDefault(require(a2d(0xc1))),utils_1=require(a2d(0x12f)),inquirer_helper_1=require(a2d(0x10c)),console_format_helpers_1=require(a2d(0x101)),browser_login_1=require(a2d(0x13f)),inquirer=require('inquirer');class CliContext{constructor(u,z=a2d(0x147)){const e=a2d;this[e(0xc7)]=z,this[e(0xdb)]=Z=>{const Q=e;let E=Z;return!/^https?:\/\//i['test'](E)&&(E=Q(0xca)+E),E=E[Q(0xce)](/\/+$/,''),E;},this['apiClient']=u;const D=new inquirer_helper_1['InquirerHelper'](u);this[e(0xd4)]=(0x0,utils_1['getCommand'])()[e(0x10a)](e(0xd4))[e(0xbc)]('Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.')[e(0xd8)](e(0x10e),e(0xd1),![])[e(0xd8)](e(0x103),e(0xe7),![])[e(0xd8)]('-n,\x20--name\x20[NAME]',e(0x135))[e(0xd8)](e(0x13b),e(0x10d))[e(0xd8)](e(0x12c),e(0xf2),this[e(0xc7)])['option'](e(0xea),e(0xbe),![])[e(0x120)](Z=>__awaiter(this,void 0x0,void 0x0,function*(){const r=e;_[r(0xef)](Z,r(0x104),this[r(0xdb)](Z[r(0x104)]));const {name:E,host:X,token:R,override:b}=Z['tokenLogin']||Z['token']!==undefined?yield this['apiTokenLogin'](Z,D):yield this[r(0x122)](Z,D);try{yield this[r(0x117)][r(0xcf)][r(0x105)]({'name':E,'host':X,'token':R},b);}catch(A){(0x0,utils_1[r(0x116)])(A[r(0xba)]);return;}!(yield this[r(0x138)]())?((0x0,utils_1[r(0x116)])(r(0x12e)),yield this['apiClient'][r(0xcf)][r(0xed)](E)):(0x0,utils_1[r(0x118)])(r(0x14a)+X+r(0x115));})),this[e(0xe1)]=(0x0,utils_1[e(0x151)])()[e(0x10a)](e(0xe3))[e(0xbc)](e(0x106))[e(0xf6)](e(0xe1))[e(0xf6)]('ctx');const M=(0x0,utils_1[e(0x151)])()[e(0x10a)]('list')['name']('ls')[e(0xbc)]('List\x20all\x20available\x20contexts')[e(0xd8)]('--all',e(0x140))[e(0x120)](Z=>__awaiter(this,void 0x0,void 0x0,function*(){const i=e;console[i(0xda)](u[i(0xcf)][i(0x12d)]());const E=u[i(0xcf)][i(0x114)]();if(Z['all']===!![]){console[i(0x136)](E);return;}const X=E[i(0x133)],R=E['contexts'][i(0x14c)]((b,A)=>b[i(0x10a)]===X?-0x1:A[i(0x10a)]===X?0x1:0x0)[i(0x13d)](b=>{const U=i,A=X===b['name']?'\x20(current)':'';return{'Name':''+b[U(0x10a)]+A,'Host':b['host'],'Default\x20Project':b['project']||'-','Default\x20Service':b[U(0xf9)]||'-'};});(0x0,console_format_helpers_1[i(0x132)])(R,i(0x111));})),H=(0x0,utils_1['getCommand'])();H['name'](e(0x156))[e(0xbc)](e(0x14f))['option'](e(0xfe),e(0x127))[e(0x120)](Z=>__awaiter(this,void 0x0,void 0x0,function*(){const L=e,E=(Z===null||Z===void 0x0?void 0x0:Z[L(0x10a)])||(yield this[L(0xbd)]('use'));yield this[L(0x117)][L(0xcf)][L(0x139)](E),(0x0,utils_1[L(0x118)])('Changed\x20current\x20context\x20to\x20'+E);}));const O=e(0xdf),t=(0x0,utils_1[e(0x151)])()[e(0x10a)](e(0xc0))[e(0xbc)](e(0x13c))['option'](O,e(0x11a))[e(0x120)](Z=>__awaiter(this,void 0x0,void 0x0,function*(){const C=e,E=(Z===null||Z===void 0x0?void 0x0:Z['id'])||(yield D[C(0xcd)]());yield this[C(0x117)][C(0xcf)][C(0x143)](E),console['log'](C(0xc9),E);})),g=(0x0,utils_1[e(0x151)])()['name'](e(0xf9))[e(0xbc)](e(0xd3))[e(0xd8)](O,e(0x13a))[e(0x120)](Z=>__awaiter(this,void 0x0,void 0x0,function*(){const j=e,E=(Z===null||Z===void 0x0?void 0x0:Z['id'])||(yield D[j(0x14d)](this[j(0xec)]())());console[j(0xda)](j(0xeb),E),yield this[j(0x117)]['contextProvider'][j(0xdc)](E);})),T=(0x0,utils_1[e(0x151)])()[e(0x10a)](e(0xee))['description'](e(0x124))[e(0xd8)](O,e(0x154))[e(0x120)](Z=>__awaiter(this,void 0x0,void 0x0,function*(){const J=e,E=(Z===null||Z===void 0x0?void 0x0:Z['id'])||(yield D[J(0x145)](this[J(0xec)]())());console[J(0xda)](J(0x11c),E),yield this[J(0x117)][J(0xcf)][J(0x109)](E);}));H['addCommand'](t),H['addCommand'](T),H[e(0xf0)](g);const h=(0x0,utils_1['getCommand'])()[e(0x10a)](e(0xd0))[e(0xf6)]('delete')[e(0xf6)]('rm')['description'](e(0xbf))[e(0xd8)](O,e(0xc2))[e(0x120)](Z=>__awaiter(this,void 0x0,void 0x0,function*(){const a=e;var E;const X=(Z===null||Z===void 0x0?void 0x0:Z['id'])||(yield this[a(0xbd)]('remove')),R=(E=this[a(0x117)][a(0xcf)][a(0x137)]())===null||E===void 0x0?void 0x0:E[a(0x10a)];yield this[a(0x117)]['contextProvider']['removeContext'](X),(0x0,utils_1[a(0x118)])(a(0x14e)+X+a(0xe9));if(!this[a(0x129)]()){(0x0,utils_1[a(0xc3)])(a(0x12a));return;}if(R===X){const b=(Z===null||Z===void 0x0?void 0x0:Z[a(0x10a)])||(yield this[a(0xbd)](a(0x110)));yield this[a(0x117)][a(0xcf)]['useContext'](b),(0x0,utils_1['success'])(a(0x14b)+b);}})),N=(0x0,utils_1['getCommand'])()[e(0x10a)](e(0xfa))['alias']('set-token')[e(0xbc)](e(0x144))[e(0xd8)]('-t,\x20--token\x20[TOKEN]',e(0xc8))['action'](Z=>__awaiter(this,void 0x0,void 0x0,function*(){const V=e,{contextProvider:E}=this[V(0x117)],X=(Z===null||Z===void 0x0?void 0x0:Z[V(0x113)])||(yield D[V(0x11d)]()),R=E[V(0xd9)]();yield E[V(0xe5)](X);if(yield this[V(0x138)]())(0x0,utils_1[V(0x118)])(V(0x102)+E[V(0x10b)]()+V(0xc4));else{if(R)yield E[V(0xe5)](R);(0x0,utils_1[V(0x116)])(V(0x148));}}));this[e(0xe1)]['addCommand'](M),this[e(0xe1)][e(0xf0)](H),this[e(0xe1)][e(0xf0)](h),this[e(0xe1)][e(0xf0)](N);}[a2d(0x122)](u,z){var D,M,H,O;return __awaiter(this,void 0x0,void 0x0,function*(){const m=a2z,t=!u['doNotOpenBrowser'],g=(D=u[m(0x104)])!==null&&D!==void 0x0?D:this['defaultBaseUrl'],T=new browser_login_1[(m(0xc5))](g,t);let h;T['on'](m(0x130),({url:X})=>{const B=m;if(t){const R=X[B(0xce)](/sessionToken=.*/,B(0x125));console[B(0xda)]('Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20'+R+')'),h=inquirer[B(0x126)]([{'type':'confirm','name':B(0xd5),'message':B(0x157),'default':![]}]),h[B(0x141)](b=>{const f=B;process[f(0x121)][f(0x11f)](0x0,-0x1),process[f(0x121)]['clearLine'](0x1),b['fullUrl']&&console['log'](f(0xe2)+X+'\x20');});}else console[B(0xda)]('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+X+'\x20');});const {token:N,contextName:Z}=yield T['startLogin']()[m(0x142)](X=>__awaiter(this,void 0x0,void 0x0,function*(){const G=m;(0x0,utils_1[G(0x116)])(G(0x119)+X['message']+G(0xcc));const R=yield this[G(0x11e)](u,z);return{'token':R[G(0x113)],'contextName':R['name']};}))['finally'](()=>{const Y=m;if(h)h['ui'][Y(0xf1)]();}),E=(H=(M=u[m(0x10a)])!==null&&M!==void 0x0?M:Z)!==null&&H!==void 0x0?H:m(0xe6)+new Date()[m(0x10f)]();return(0x0,utils_1[m(0x118)])(m(0x153)+chalk_1[m(0x112)][m(0xc6)](E)),{'name':E,'token':N,'host':g,'override':(O=u[m(0x152)])!==null&&O!==void 0x0?O:![]};});}['apiTokenLogin'](u,z){return __awaiter(this,void 0x0,void 0x0,function*(){const P=a2z,D=this['apiClient'][P(0xcf)]['loadContextWrapper']()[P(0xe1)],{name:M,token:H,host:O,override:t}=yield z['loginPrompt'](u,D);return{'name':M,'token':H,'host':O,'override':t};});}[a2d(0xec)](){const s=a2d,u=this['apiClient'][s(0xcf)][s(0xff)]();if(u===undefined)throw new Error(s(0x11b));return u;}[a2d(0xbd)](u){return __awaiter(this,void 0x0,void 0x0,function*(){const v=a2z;if(!this[v(0x129)]())throw new Error(v(0x128));const z=this[v(0x117)][v(0xcf)][v(0x114)]()[v(0xe1)]['map'](M=>M[v(0x10a)]),D=z[v(0x131)]>0x4?'search-list':'list';return(yield inquirer[v(0x126)]([{'type':D,'name':v(0x10a),'message':v(0xfd)+u+':','choices':z}]))['name'];});}[a2d(0x129)](){const x=a2d;return this[x(0x117)][x(0xcf)][x(0x114)]()[x(0xe1)][x(0x131)]>0x0;}[a2d(0x138)](){return __awaiter(this,void 0x0,void 0x0,function*(){const p=a2z;try{const u=this['apiClient'][p(0xcf)][p(0xe0)](),z=this['apiClient'][p(0xcf)]['getCurrentToken'](),D=u+'/v1/login',M={'Authorization':'Bearer\x20'+z},H=yield(0x0,utils_1[p(0xe4)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const n=p;return(0x0,node_fetch_1[n(0x112)])(D,{'method':n(0x123),'timeout':0xbb8,'headers':M});}));if(H['ok'])return!![];return![];}catch(O){return![];}});}}exports['CliContext']=CliContext;