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