@northflank/cli 0.9.8 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 'use strict';const a0I2=a0z;(function(I,z){const I1=a0z,g=I();while(!![]){try{const Z=-parseInt(I1(0xd4))/0x1+-parseInt(I1(0xbc))/0x2*(-parseInt(I1(0xbb))/0x3)+-parseInt(I1(0xce))/0x4*(-parseInt(I1(0xdc))/0x5)+-parseInt(I1(0xe0))/0x6*(-parseInt(I1(0xed))/0x7)+parseInt(I1(0xf8))/0x8+-parseInt(I1(0xf6))/0x9*(parseInt(I1(0xe5))/0xa)+-parseInt(I1(0xc2))/0xb;if(Z===z)break;else g['push'](g['shift']());}catch(y){g['push'](g['shift']());}}}(a0I,0xf2c9a));var __awaiter=this&&this[a0I2(0xcf)]||function(I,z,g,Z){function y(i){return i instanceof g?i:new g(function(t){t(i);});}return new(g||(g=Promise))(function(i,t){const I5=a0z;function u(G){const I3=a0z;try{M(Z[I3(0xba)](G));}catch(h){t(h);}}function v(G){try{M(Z['throw'](G));}catch(h){t(h);}}function M(G){const I4=a0z;G[I4(0xf5)]?i(G['value']):y(G['value'])['then'](u,v);}M((Z=Z[I5(0xd5)](I,z||[]))['next']());});};Object[a0I2(0xcb)](exports,a0I2(0xd9),{'value':!![]}),exports[a0I2(0xc3)]=void 0x0;const utils_1=require(a0I2(0xe9)),defaultPaginationPageSize=0x32,getProjects=I=>z=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const I6=a0I2;var g;const Z=yield I[I6(0xc1)][I6(0xea)]({'options':{'per_page':defaultPaginationPageSize,'cursor':z===null||z===void 0x0?void 0x0:z[I6(0xc6)]}});return{'elements':Z[I6(0xcd)]['projects']['map'](y=>y['id']),'nextPageCursor':(g=Z['pagination'])===null||g===void 0x0?void 0x0:g[I6(0xc5)]};}),getServices=(I,z)=>g=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const I7=a0I2;var Z;const y=yield I[I7(0xc1)]['services']({'parameters':{'projectId':z},'options':{'per_page':defaultPaginationPageSize,'cursor':g===null||g===void 0x0?void 0x0:g[I7(0xc6)]}});return{'elements':y[I7(0xcd)][I7(0xe2)]['map'](i=>i['id']),'nextPageCursor':(Z=y[I7(0xdd)])===null||Z===void 0x0?void 0x0:Z[I7(0xc5)]};}),getAddons=(I,z)=>g=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const I8=a0I2;var Z;const y=yield I[I8(0xc1)][I8(0xf7)]({'parameters':{'projectId':z},'options':{'per_page':defaultPaginationPageSize,'cursor':g===null||g===void 0x0?void 0x0:g['nextPageCursor']}});return{'elements':y[I8(0xcd)][I8(0xf7)][I8(0xf1)](i=>i['id']),'nextPageCursor':(Z=y[I8(0xdd)])===null||Z===void 0x0?void 0x0:Z['cursor']};}),getAddonBackups=(I,z,g)=>Z=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const I9=a0I2;var y;const i=yield I[I9(0xb8)]['addon'][I9(0xd3)]({'parameters':{'projectId':z,'addonId':g},'options':{'per_page':defaultPaginationPageSize,'cursor':Z===null||Z===void 0x0?void 0x0:Z['nextPageCursor']}});return{'elements':i[I9(0xcd)]['backups'][I9(0xf1)](t=>t['id']),'nextPageCursor':(y=i[I9(0xdd)])===null||y===void 0x0?void 0x0:y[I9(0xc5)]};});function fetchResourceList(I,z,g,Z,y,i){var t,u,v,M,G,P,h,L,R,w,Q,K;return __awaiter(this,void 0x0,void 0x0,function*(){const II=a0z,J=undefined;try{if(I===II(0xf0)){const f=yield z[II(0xc1)][II(0xc9)]({}),x=f[II(0xcd)][II(0xc9)][II(0xf1)](o=>{const Iz=II;var d;return(d=o===null||o===void 0x0?void 0x0:o[Iz(0xdf)])!==null&&d!==void 0x0?d:o===null||o===void 0x0?void 0x0:o['id'];});return{'choices':x,'defaultValue':J};}if(I===II(0xcc)&&!(g===null||g===void 0x0?void 0x0:g['includes']('logSink'))){const o=yield z['list'][II(0xd1)]({}),d=o[II(0xcd)][II(0xd1)][II(0xf1)](n=>{const Ig=II;var A;return(A=n===null||n===void 0x0?void 0x0:n[Ig(0xdf)])!==null&&A!==void 0x0?A:n===null||n===void 0x0?void 0x0:n['id'];});return{'choices':d,'defaultValue':J};}if(I===II(0xe6)){const n=yield getProjects(z),{elements:A,nextPageCursor:T}=yield n();return{'choices':A,'defaultValue':J,'pagination':{'nextPageCursor':T,'loadMore':n}};}if(I===II(0xe1)){const m=yield z['list'][II(0xf3)]({}),b=m['data'][II(0xe1)][II(0xf1)](O=>O['id']);return{'choices':b,'defaultValue':J};}const j=y===null||y===void 0x0?void 0x0:y[II(0xe6)],F=I===II(0xb9)||I==='id'&&(i===null||i===void 0x0?void 0x0:i['includes'](II(0xf4)));if(j!==undefined&&F){const O=yield getServices(z,j),{elements:V,nextPageCursor:k}=yield O();return{'choices':V,'defaultValue':J,'pagination':{'nextPageCursor':k,'loadMore':O}};}const s=g===null||g===void 0x0?void 0x0:g[II(0xe3)]('addon');if(s){const N=a=>__awaiter(this,void 0x0,void 0x0,function*(){const IZ=II;var D;const H=yield z[IZ(0xb8)][IZ(0xde)][IZ(0xee)]({});return(D=H['data'][IZ(0xd8)])===null||D===void 0x0?void 0x0:D['find'](Y=>Y[IZ(0xbf)]===a);});if(I===II(0xbf)){const a=yield z[II(0xb8)][II(0xde)][II(0xee)]({}),D=(t=a[II(0xcd)][II(0xd8)])===null||t===void 0x0?void 0x0:t['map'](H=>H[II(0xbf)]);return{'choices':D,'defaultValue':J};}if(I===II(0xf9)&&(Z===null||Z===void 0x0?void 0x0:Z['type'])!==undefined){const H=(u=yield N(Z[II(0xbf)]))===null||u===void 0x0?void 0x0:u[II(0xc7)];return{'choices':H,'defaultValue':J};}if(I===II(0xb7)&&(Z===null||Z===void 0x0?void 0x0:Z[II(0xbf)])!==undefined){const Y=(M=(v=yield N(Z[II(0xbf)]))===null||v===void 0x0?void 0x0:v[II(0xbe)])===null||M===void 0x0?void 0x0:M[II(0xb7)];return{'choices':Y===null||Y===void 0x0?void 0x0:Y[II(0xef)],'defaultValue':Y===null||Y===void 0x0?void 0x0:Y[II(0xc4)]};}if(I===II(0xd7)&&(Z===null||Z===void 0x0?void 0x0:Z[II(0xbf)])!==undefined){const r=(P=(G=yield N(Z[II(0xbf)]))===null||G===void 0x0?void 0x0:G[II(0xbe)])===null||P===void 0x0?void 0x0:P[II(0xd7)];return{'choices':r===null||r===void 0x0?void 0x0:r[II(0xef)],'defaultValue':r===null||r===void 0x0?void 0x0:r[II(0xc4)]};}}if(I==='addonId'&&(y===null||y===void 0x0?void 0x0:y[II(0xe6)])!==undefined){const X=yield getAddons(z,y===null||y===void 0x0?void 0x0:y[II(0xe6)]),{elements:l,nextPageCursor:S}=yield X();return{'choices':l,'defaultValue':J,'pagination':{'nextPageCursor':S,'loadMore':X}};}if(I===II(0xdb)&&(y===null||y===void 0x0?void 0x0:y[II(0xe6)])!==undefined&&((h=Z===null||Z===void 0x0?void 0x0:Z[II(0xd2)])===null||h===void 0x0?void 0x0:h[II(0xeb)])!==undefined){const q=yield getAddonBackups(z,y===null||y===void 0x0?void 0x0:y[II(0xe6)],(L=Z===null||Z===void 0x0?void 0x0:Z['source'])===null||L===void 0x0?void 0x0:L[II(0xeb)]),{elements:E,nextPageCursor:W}=yield q();return{'choices':E,'defaultValue':J,'pagination':{'nextPageCursor':W,'loadMore':q}};}const C=(R=y===null||y===void 0x0?void 0x0:y[II(0xeb)])!==null&&R!==void 0x0?R:(w=Z===null||Z===void 0x0?void 0x0:Z[II(0xd6)])===null||w===void 0x0?void 0x0:w[II(0xeb)];if((g===null||g===void 0x0?void 0x0:g[II(0xda)](''))===II(0xe8)&&I==='version'&&(y===null||y===void 0x0?void 0x0:y['projectId'])!==undefined&&C!==undefined){const {upgradeTo:B}=(yield z[II(0xb8)]['addon'][II(0xf9)]({'parameters':{'addonId':C,'projectId':y===null||y===void 0x0?void 0x0:y['projectId']}}))[II(0xcd)];if(B===undefined||B['length']<=0x0){(0x0,utils_1[II(0xc0)])(II(0xbd));throw new Error();}return{'choices':B[II(0xf1)](p=>p[II(0xf9)]),'defaultValue':J};}if(I==='templateId'){const p=yield z[II(0xc1)][II(0xca)]({}),c=p['data'][II(0xca)][II(0xf1)](U=>U===null||U===void 0x0?void 0x0:U['id']);return{'choices':c,'defaultValue':J};}if(((g===null||g===void 0x0?void 0x0:g['includes'](II(0xe4)))||(g===null||g===void 0x0?void 0x0:g[II(0xe3)](II(0xf2))))&&I===II(0xc8)&&C!==undefined&&(y===null||y===void 0x0?void 0x0:y[II(0xe6)])!==undefined){const U=(yield z[II(0xb8)][II(0xde)]['credentials']({'parameters':{'addonId':C,'projectId':y===null||y===void 0x0?void 0x0:y[II(0xe6)]}}))['data'];return{'choices':[...(Q=Object['keys'](U===null||U===void 0x0?void 0x0:U[II(0xec)]))!==null&&Q!==void 0x0?Q:[],...(K=Object[II(0xd0)](U===null||U===void 0x0?void 0x0:U[II(0xe7)]))!==null&&K!==void 0x0?K:[]]};}}catch(I0){}return{'choices':undefined,'defaultValue':J};});}function a0I(){const Iy=['keyName','plans','templates','defineProperty','region','data','12276oGtpYt','__awaiter','keys','regions','source','backups','883487TtGejC','apply','addonDependencies','replicas','addonTypes','__esModule','join','backupId','2455vvBvyd','pagination','addon','internalId','69798PaVXKV','credentials','services','includes','secretLink','81520TGZSpJ','projectId','secrets','updateaddonversion','./utils','projects','addonId','envs','616fBITSx','types','options','deploymentPlan','map','secret','registries','owningObject','done','351PWZqQK','addons','3520408hTdaVh','version','storage','get','serviceId','next','153OidFuN','58674gHDKIC','No\x20available\x20versions\x20to\x20upgrade\x20to.','resources','type','warning','list','24980428IJGvmY','fetchResourceList','default','cursor','nextPageCursor','versions'];a0I=function(){return Iy;};return a0I();}function a0z(I,z){const g=a0I();return a0z=function(Z,y){Z=Z-0xb7;let i=g[Z];return i;},a0z(I,z);}exports[a0I2(0xc3)]=fetchResourceList;
1
+ 'use strict';const a0X2=a0V;(function(X,V){const X1=a0V,h=X();while(!![]){try{const Q=-parseInt(X1(0x1d9))/0x1*(parseInt(X1(0x1d6))/0x2)+parseInt(X1(0x1dd))/0x3+-parseInt(X1(0x1f9))/0x4+parseInt(X1(0x1ff))/0x5+parseInt(X1(0x1f8))/0x6+parseInt(X1(0x1ea))/0x7+-parseInt(X1(0x1f3))/0x8;if(Q===V)break;else h['push'](h['shift']());}catch(J){h['push'](h['shift']());}}}(a0X,0x856e4));function a0X(){const XJ=['updateaddonversion','1475994uLOCZz','1082316enMXTe','backupId','options','plans','done','backups','4619060PPiEPh','projects','projectId','__awaiter','warning','templateId','source','__esModule','then','envs','regions','addonDependencies','throw','credentials','addonId','resources','includes','serviceId','map','type','cursor','logSink','keyName','addons','46nLPKYW','region','replicas','41227jDnuyT','pagination','internalId','owningObject','2735379nwVskJ','value','registries','defineProperty','fetchResourceList','join','secret','No\x20available\x20versions\x20to\x20upgrade\x20to.','get','list','templates','addonTypes','./utils','5402929FOyxJG','data','storage','default','nextPageCursor','addon','keys','version','find','8704952TgSlOo','next','services','types'];a0X=function(){return XJ;};return a0X();}var __awaiter=this&&this[a0X2(0x202)]||function(X,V,h,Q){function J(G){return G instanceof h?G:new h(function(I){I(G);});}return new(h||(h=Promise))(function(G,I){const X6=a0V;function T(A){const X3=a0V;try{E(Q[X3(0x1f4)](A));}catch(D){I(D);}}function W(A){const X4=a0V;try{E(Q[X4(0x1ca)](A));}catch(D){I(D);}}function E(A){const X5=a0V;A[X5(0x1fd)]?G(A[X5(0x1de)]):J(A[X5(0x1de)])[X5(0x1c6)](T,W);}E((Q=Q['apply'](X,V||[]))[X6(0x1f4)]());});};Object[a0X2(0x1e0)](exports,a0X2(0x1c5),{'value':!![]}),exports[a0X2(0x1e1)]=void 0x0;function a0V(X,V){const h=a0X();return a0V=function(Q,J){Q=Q-0x1c4;let G=h[Q];return G;},a0V(X,V);}const utils_1=require(a0X2(0x1e9)),defaultPaginationPageSize=0x32,getProjects=X=>V=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const X7=a0X2;var h;const Q=yield X[X7(0x1e6)][X7(0x200)]({'options':{'per_page':defaultPaginationPageSize,'cursor':V===null||V===void 0x0?void 0x0:V[X7(0x1ee)]}});return{'elements':Q[X7(0x1eb)][X7(0x200)][X7(0x1d0)](J=>J['id']),'nextPageCursor':(h=Q[X7(0x1da)])===null||h===void 0x0?void 0x0:h[X7(0x1d2)]};}),getServices=(X,V)=>h=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const X8=a0X2;var Q;const J=yield X[X8(0x1e6)][X8(0x1f5)]({'parameters':{'projectId':V},'options':{'per_page':defaultPaginationPageSize,'cursor':h===null||h===void 0x0?void 0x0:h[X8(0x1ee)]}});return{'elements':J[X8(0x1eb)][X8(0x1f5)]['map'](G=>G['id']),'nextPageCursor':(Q=J[X8(0x1da)])===null||Q===void 0x0?void 0x0:Q['cursor']};}),getAddons=(X,V)=>h=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const X9=a0X2;var Q;const J=yield X[X9(0x1e6)][X9(0x1d5)]({'parameters':{'projectId':V},'options':{'per_page':defaultPaginationPageSize,'cursor':h===null||h===void 0x0?void 0x0:h[X9(0x1ee)]}});return{'elements':J['data'][X9(0x1d5)][X9(0x1d0)](G=>G['id']),'nextPageCursor':(Q=J[X9(0x1da)])===null||Q===void 0x0?void 0x0:Q[X9(0x1d2)]};}),getAddonBackups=(X,V,h)=>Q=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const XX=a0X2;var J;const G=yield X[XX(0x1e5)]['addon'][XX(0x1fe)]({'parameters':{'projectId':V,'addonId':h},'options':{'per_page':defaultPaginationPageSize,'cursor':Q===null||Q===void 0x0?void 0x0:Q[XX(0x1ee)]}});return{'elements':G['data'][XX(0x1fe)]['map'](I=>I['id']),'nextPageCursor':(J=G[XX(0x1da)])===null||J===void 0x0?void 0x0:J[XX(0x1d2)]};});function fetchResourceList(X,V,h,Q,J,G){var I,T,W,E,A,P,D,K,d,f,z,F;return __awaiter(this,void 0x0,void 0x0,function*(){const XV=a0V,n=undefined;try{if(X==='deploymentPlan'){const g=yield V[XV(0x1e6)]['plans']({}),B=g[XV(0x1eb)][XV(0x1fc)]['map'](O=>{const Xh=XV;var H;return(H=O===null||O===void 0x0?void 0x0:O[Xh(0x1db)])!==null&&H!==void 0x0?H:O===null||O===void 0x0?void 0x0:O['id'];});return{'choices':B,'defaultValue':n};}if(X===XV(0x1d7)&&!(h===null||h===void 0x0?void 0x0:h['includes'](XV(0x1d3)))){const O=yield V[XV(0x1e6)][XV(0x1c8)]({}),H=O['data'][XV(0x1c8)][XV(0x1d0)](k=>{var o;return(o=k===null||k===void 0x0?void 0x0:k['internalId'])!==null&&o!==void 0x0?o:k===null||k===void 0x0?void 0x0:k['id'];});return{'choices':H,'defaultValue':n};}if(X===XV(0x201)){const k=yield getProjects(V),{elements:o,nextPageCursor:N}=yield k();return{'choices':o,'defaultValue':n,'pagination':{'nextPageCursor':N,'loadMore':k}};}if(X==='credentials'){const p=yield V[XV(0x1e6)][XV(0x1df)]({}),i=p['data']['credentials'][XV(0x1d0)](x=>x['id']);return{'choices':i,'defaultValue':n};}const q=J===null||J===void 0x0?void 0x0:J[XV(0x201)],a=X===XV(0x1cf)||X==='id'&&(G===null||G===void 0x0?void 0x0:G[XV(0x1ce)](XV(0x1dc)));if(q!==undefined&&a){const x=yield getServices(V,q),{elements:L,nextPageCursor:y}=yield x();return{'choices':L,'defaultValue':n,'pagination':{'nextPageCursor':y,'loadMore':x}};}const R=h===null||h===void 0x0?void 0x0:h[XV(0x1ce)](XV(0x1ef));if(R){const M=Z=>__awaiter(this,void 0x0,void 0x0,function*(){const XQ=XV;var C;const u=yield V['get'][XQ(0x1ef)][XQ(0x1f6)]({});return(C=u[XQ(0x1eb)][XQ(0x1e8)])===null||C===void 0x0?void 0x0:C[XQ(0x1f2)](c=>c[XQ(0x1d1)]===Z);});if(X==='type'){const Z=yield V[XV(0x1e5)][XV(0x1ef)][XV(0x1f6)]({}),C=(I=Z[XV(0x1eb)][XV(0x1e8)])===null||I===void 0x0?void 0x0:I[XV(0x1d0)](u=>u[XV(0x1d1)]);return{'choices':C,'defaultValue':n};}if(X===XV(0x1f1)&&(Q===null||Q===void 0x0?void 0x0:Q[XV(0x1d1)])!==undefined){const u=(T=yield M(Q[XV(0x1d1)]))===null||T===void 0x0?void 0x0:T['versions'];return{'choices':u,'defaultValue':n};}if(X===XV(0x1ec)&&(Q===null||Q===void 0x0?void 0x0:Q[XV(0x1d1)])!==undefined){const c=(E=(W=yield M(Q[XV(0x1d1)]))===null||W===void 0x0?void 0x0:W[XV(0x1cd)])===null||E===void 0x0?void 0x0:E[XV(0x1ec)];return{'choices':c===null||c===void 0x0?void 0x0:c[XV(0x1fb)],'defaultValue':c===null||c===void 0x0?void 0x0:c[XV(0x1ed)]};}if(X===XV(0x1d8)&&(Q===null||Q===void 0x0?void 0x0:Q['type'])!==undefined){const Y=(P=(A=yield M(Q[XV(0x1d1)]))===null||A===void 0x0?void 0x0:A['resources'])===null||P===void 0x0?void 0x0:P['replicas'];return{'choices':Y===null||Y===void 0x0?void 0x0:Y['options'],'defaultValue':Y===null||Y===void 0x0?void 0x0:Y[XV(0x1ed)]};}}if(X===XV(0x1cc)&&(J===null||J===void 0x0?void 0x0:J['projectId'])!==undefined){const j=yield getAddons(V,J===null||J===void 0x0?void 0x0:J[XV(0x201)]),{elements:b,nextPageCursor:s}=yield j();return{'choices':b,'defaultValue':n,'pagination':{'nextPageCursor':s,'loadMore':j}};}if(X===XV(0x1fa)&&(J===null||J===void 0x0?void 0x0:J[XV(0x201)])!==undefined&&((D=Q===null||Q===void 0x0?void 0x0:Q[XV(0x1c4)])===null||D===void 0x0?void 0x0:D[XV(0x1cc)])!==undefined){const w=yield getAddonBackups(V,J===null||J===void 0x0?void 0x0:J[XV(0x201)],(K=Q===null||Q===void 0x0?void 0x0:Q[XV(0x1c4)])===null||K===void 0x0?void 0x0:K[XV(0x1cc)]),{elements:m,nextPageCursor:r}=yield w();return{'choices':m,'defaultValue':n,'pagination':{'nextPageCursor':r,'loadMore':w}};}const v=(d=J===null||J===void 0x0?void 0x0:J[XV(0x1cc)])!==null&&d!==void 0x0?d:(f=Q===null||Q===void 0x0?void 0x0:Q[XV(0x1c9)])===null||f===void 0x0?void 0x0:f[XV(0x1cc)];if((h===null||h===void 0x0?void 0x0:h[XV(0x1e2)](''))===XV(0x1f7)&&X===XV(0x1f1)&&(J===null||J===void 0x0?void 0x0:J[XV(0x201)])!==undefined&&v!==undefined){const {upgradeTo:l}=(yield V[XV(0x1e5)][XV(0x1ef)][XV(0x1f1)]({'parameters':{'addonId':v,'projectId':J===null||J===void 0x0?void 0x0:J[XV(0x201)]}}))[XV(0x1eb)];if(l===undefined||l['length']<=0x0){(0x0,utils_1[XV(0x203)])(XV(0x1e4));throw new Error();}return{'choices':l['map'](S=>S[XV(0x1f1)]),'defaultValue':n};}if(X===XV(0x204)){const S=yield V[XV(0x1e6)][XV(0x1e7)]({}),t=S[XV(0x1eb)]['templates'][XV(0x1d0)](U=>U===null||U===void 0x0?void 0x0:U['id']);return{'choices':t,'defaultValue':n};}if(((h===null||h===void 0x0?void 0x0:h[XV(0x1ce)]('secretLink'))||(h===null||h===void 0x0?void 0x0:h[XV(0x1ce)](XV(0x1e3))))&&X===XV(0x1d4)&&v!==undefined&&(J===null||J===void 0x0?void 0x0:J['projectId'])!==undefined){const U=(yield V[XV(0x1e5)][XV(0x1ef)][XV(0x1cb)]({'parameters':{'addonId':v,'projectId':J===null||J===void 0x0?void 0x0:J[XV(0x201)]}}))[XV(0x1eb)];return{'choices':[...(z=Object[XV(0x1f0)](U===null||U===void 0x0?void 0x0:U[XV(0x1c7)]))!==null&&z!==void 0x0?z:[],...(F=Object[XV(0x1f0)](U===null||U===void 0x0?void 0x0:U['secrets']))!==null&&F!==void 0x0?F:[]]};}}catch(X0){}return{'choices':undefined,'defaultValue':n};});}exports[a0X2(0x1e1)]=fetchResourceList;
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';const a1IR=a1z;function a1I(){const Iq=['repos','projects','Resource\x20was\x20not\x20deleted.','next','askForTemplateRun','CliLogs','\x20properties','details','apply','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','VERBOSE:\x20Request\x20body\x20->\x20','delete','filter','branches','version','forEach','invoices','update','chalk','option','entries','__esModule','./inquirer-helper','serviceId','askForService','InquirerHelper','consoleFormat','askForTemplate','file','assertContextExisting','askForVolume','948292GRFAEs','includes','readFileSync','region','8981316IQuxba','addons','custom-columns=','vol','safeLoad','parse','clearLine','backups','join','path','prototype','lodash','after','message','base','method',',\x20-','plan','query','pipelineId','project','alias','CliExec','dmn','cred','\x20--','./metrics','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','hasOwnProperty','upperFirst','warning','addonId','toString','omit','description','configurable','body','verbose','File\x20to\x20load\x20resource\x20json\x20from','count','5CceVMO','ajv','resource','askForBuild','repository','=>\x20running\x20command\x20with:\x20','-i,\x20--input\x20<resource-def>','buildId','name','stringify','VERBOSE:\x20Using\x20endpoint\x20->\x20','writable','login','prj','requiredPermissions','getCommand','repo','host','noDefaults','keys','domain','6rxWyRH','subdomain','askForDomain','argv','handleYamlOutput','find',',\x20NF\x20error\x20id:\x20','isEqual','.json','output','defineProperty','assign','./defaults','retrievePayloadViaInteractiveCli','create','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','get','quiet','propToType','kebabCase','logSinkId','addon','9568880XmJccI','addHelpText','templates','sort','opt','value','askForJob','credential','json','__createBinding','split','has','length','/docs/v1/api/','logs','getProgram','brn','isArray','runId','subdomainId','runtimeFiles/additionalProperties','commands','northflank','projectId','891278OxowZG','55090MTGOdz','domains','backupId','services','credentials','--verbose','contexts','boolean','askForCredentials','(HTTP\x20status\x20code:\x20','commander','enablePositionalOptions','replace','throw','askGeneric','templateRunId','set','4832992LtqFeP','CliPortForward','getLogsCommand','call','getOwnPropertyNames','there\x20are\x20more\x20rows,\x20load?','contextProvider','execCmd','example','job','78849jdcNFk','concat','secret','errors','type','opts','bind','askForAddon','domainId','askForSecret','addCommand','ApiClient','yml','exitCode','log','Unknown\x20input\x20file\x20type:\x20','setPathVars','ApiClientFileContextProvider','underline','90bNxxeS','repositories','./port-forward','default','CliMetrics','credentialId','CliContext','__importStar','map','cursor','getMetricsCommand','@northflank/js-client','existsSync','\x0a>\x20Token\x20permissions\x20required:\x20','-f,\x20--file\x20<file-path>','svc','branch','url','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','yaml','jobId','Documentation:\x20','secretId','handleJsonOutput','./logs','inv','validate','__awaiter','portFwdCmd','\x20Northflank\x20resources','then','Northflank\x20cli\x20version:\x20','secrets','./formatting/console-format-helpers','service','./exec','some','checkUpdate','\x0a\x09details\x20:','customUserAgent','getCommandOverview','templateId','parseAsync','OPTIONAL:\x20','endsWith','docsTagsPath','__importDefault'];a1I=function(){return Iq;};return a1I();}(function(I,z){const IL=a1z,g=I();while(!![]){try{const Z=parseInt(IL(0x21c))/0x1+-parseInt(IL(0x200))/0x2*(-parseInt(IL(0x2be))/0x3)+-parseInt(IL(0x27d))/0x4*(-parseInt(IL(0x2a9))/0x5)+parseInt(IL(0x22f))/0x6*(-parseInt(IL(0x201))/0x7)+-parseInt(IL(0x212))/0x8+parseInt(IL(0x281))/0x9+-parseInt(IL(0x2d4))/0xa;if(Z===z)break;else g['push'](g['shift']());}catch(y){g['push'](g['shift']());}}}(a1I,0x806ee));var __createBinding=this&&this[a1IR(0x1f1)]||(Object[a1IR(0x2cc)]?function(I,z,g,Z){const Iw=a1IR;if(Z===undefined)Z=g;var y=Object['getOwnPropertyDescriptor'](z,g);(!y||(Iw(0x2ce)in y?!z['__esModule']:y[Iw(0x2b4)]||y[Iw(0x2a4)]))&&(y={'enumerable':!![],'get':function(){return z[g];}}),Object[Iw(0x2c8)](I,Z,y);}:function(I,z,g,Z){if(Z===undefined)Z=g;I[Z]=z[g];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object[a1IR(0x2cc)]?function(I,z){const IQ=a1IR;Object[IQ(0x2c8)](I,'default',{'enumerable':!![],'value':z});}:function(I,z){const IK=a1IR;I[IK(0x232)]=z;}),__importStar=this&&this[a1IR(0x236)]||function(I){const IJ=a1IR;if(I&&I[IJ(0x273)])return I;var z={};if(I!=null){for(var g in I)if(g!==IJ(0x232)&&Object[IJ(0x28b)][IJ(0x29d)]['call'](I,g))__createBinding(z,I,g);}return __setModuleDefault(z,I),z;},__awaiter=this&&this[a1IR(0x24a)]||function(I,z,g,Z){function y(i){return i instanceof g?i:new g(function(t){t(i);});}return new(g||(g=Promise))(function(i,t){const IC=a1z;function u(G){const Ij=a1z;try{M(Z[Ij(0x261)](G));}catch(h){t(h);}}function v(G){const IF=a1z;try{M(Z[IF(0x20e)](G));}catch(h){t(h);}}function M(G){const Is=a1z;G['done']?i(G[Is(0x2d9)]):y(G[Is(0x2d9)])[Is(0x24d)](u,v);}M((Z=Z[IC(0x266)](I,z||[]))['next']());});},__importDefault=this&&this[a1IR(0x25d)]||function(I){const If=a1IR;return I&&I[If(0x273)]?I:{'default':I};};Object[a1IR(0x2c8)](exports,a1IR(0x273),{'value':!![]}),exports[a1IR(0x1f7)]=void 0x0;const js_client_1=require(a1IR(0x23a)),commander_1=__importDefault(require(a1IR(0x20b))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require(a1IR(0x2aa))),chalk_1=__importDefault(require(a1IR(0x270))),_=__importStar(require(a1IR(0x28c))),contextCommands_1=require('./context/contextCommands'),utils_1=require('./utils'),defaults=__importStar(require(a1IR(0x2ca))),inquirer_helper_1=require(a1IR(0x274)),console_format_helpers_1=require(a1IR(0x250)),command_overview_1=require('./formatting/command-overview'),port_forward_1=require(a1IR(0x231)),exec_1=require(a1IR(0x252)),logs_1=require(a1IR(0x247)),metrics_1=require(a1IR(0x29b)),yaml=require('js-yaml'),pgk=require('../package.json'),getProgram=I=>{const Ix=a1IR,z=new commander_1[(Ix(0x232))]['Command'](Ix(0x1fe));z[Ix(0x2a3)]('Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line'),z[Ix(0x20c)](!![]),z[Ix(0x26c)](Ix(0x24e)+chalk_1[Ix(0x232)][Ix(0x22e)](pgk[Ix(0x26c)]),'-v,\x20--version',Ix(0x267));const g=new js_client_1[(Ix(0x227))](I,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[Ix(0x256)]}),Z=new contextCommands_1[(Ix(0x235))](g),y=new port_forward_1[(Ix(0x213))](I),i=new exec_1[(Ix(0x297))](I),t=new logs_1[(Ix(0x263))](I),u=new metrics_1[(Ix(0x233))](I);return z[Ix(0x226)](y[Ix(0x24b)]),z[Ix(0x226)](i[Ix(0x219)]),z[Ix(0x226)](Z[Ix(0x2b5)]),z[Ix(0x226)](Z[Ix(0x207)]),generateCommands(g,g['endpoints'],z,t,u),z[Ix(0x226)]((0x0,command_overview_1[Ix(0x257)])(z)),z;};exports[a1IR(0x1f7)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Io=a1IR;try{const I=new js_client_1[(Io(0x22d))]();yield(0x0,utils_1[Io(0x254)])(I);const z=(0x0,exports['getProgram'])(I);yield z[Io(0x259)](process[Io(0x2c1)]);}catch(g){(0x0,utils_1['error'])('Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20'+g[Io(0x28e)]),process['argv'][Io(0x2c3)](Z=>Z===Io(0x206))&&console[Io(0x22a)](g),process[Io(0x229)]=0x1;}}))());function isListCommand(I){const Id=a1IR,z=[[Id(0x2ce),'addon',Id(0x288)],[Id(0x2ce),Id(0x21b),'runs']];return I['find'](g=>g==='list')||z['some'](g=>_[Id(0x2c5)](I,g));}function a1z(I,z){const g=a1I();return a1z=function(Z,y){Z=Z-0x1ee;let i=g[Z];return i;},a1z(I,z);}function generateCommands(I,z,g,Z,y,i=defaults['defaults'],t=[]){const In=a1IR,u=new inquirer_helper_1[(In(0x277))](new js_client_1[(In(0x227))](I['contextProvider'],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[In(0x256)]}));function v(L,R){return L['required']!==![]&&R===undefined;}function M(L,R){const IA=In,{opt:w,name:Q}=L,K=w[IA(0x232)],J=v(w,K),j=o=>o['length']>0x1?'--'+o:'-'+o,F=w===null||w===void 0x0?void 0x0:w[IA(0x296)],s=F?_[IA(0x1f9)](F)?'-'+(F===null||F===void 0x0?void 0x0:F['map'](o=>j(o))[IA(0x289)](IA(0x291)))+',':''+j(F):'',C=J?'':IA(0x25a),f=typeof w[IA(0x220)]===IA(0x208)?s+IA(0x29a)+Q:s+IA(0x29a)+Q+'\x20<'+Q['toUpperCase']()+'>',x=C+w[IA(0x2a3)];R[IA(0x271)](f,x,K);}function G(){const IT=In;if(g[IT(0x1fd)][IT(0x253)](L=>L[IT(0x2b1)]()===IT(0x1f6)))return;_['isEqual'](t,['get',IT(0x251)])&&(g[IT(0x226)](Z[IT(0x214)](IT(0x251))),g[IT(0x226)](y[IT(0x239)]('service')),g['addCommand'](Z[IT(0x214)]('service',!![])),g[IT(0x226)](y['getMetricsCommand']('service',!![]))),_[IT(0x2c5)](t,[IT(0x2ce),IT(0x21b)])&&(g['addCommand'](Z[IT(0x214)]('job')),g[IT(0x226)](y[IT(0x239)](IT(0x21b))),g[IT(0x226)](Z[IT(0x214)](IT(0x21b),!![])),g[IT(0x226)](y[IT(0x239)](IT(0x21b),!![]))),_[IT(0x2c5)](t,['get',IT(0x2d3)])&&(g['addCommand'](Z[IT(0x214)](IT(0x2d3))),g['addCommand'](y[IT(0x239)](IT(0x2d3))));}return Object[In(0x216)](i)[In(0x26d)](L=>{const Im=In,R=z[L],w=i[L],Q=t[Im(0x21d)]([L]);function K(n,A){const Ib=Im,T=Object['getOwnPropertyNames'](n||{});T[Ib(0x237)](m=>{return{'name':m,'opt':n[m]};})[Ib(0x2d7)]((m,b)=>!v(m['opt'])?!v(b[Ib(0x2d8)])?0x0:0x1:-0x1)[Ib(0x26d)](m=>{M(m,A);});}function J(n,A){const IO=Im,T=[[IO(0x295),IO(0x25f),IO(0x2b6)],['service',IO(0x204),IO(0x23e)],[IO(0x205),IO(0x1ef),IO(0x299)],[IO(0x2d3),IO(0x282),'adn'],[IO(0x21b),'jobs'],[IO(0x292),'plans','pln'],[IO(0x280),'regions','rgn'],['domain',IO(0x202),IO(0x298)],[IO(0x21e),IO(0x24f),'scrt'],['volumes','volume',IO(0x284)],[IO(0x26b),IO(0x23f),IO(0x1f8)],['invoice',IO(0x26e),IO(0x248)],['template',IO(0x2d6),'tpl'],[IO(0x25e),IO(0x2ad),IO(0x230),IO(0x2b9)]],m=T[IO(0x2c3)](b=>b[IO(0x27e)](A));if(m!==undefined)n['aliases'](m[IO(0x26a)](b=>b!==A));}function j(n){var A,T;return __awaiter(this,void 0x0,void 0x0,function*(){const IV=a1z,m={},{contextProvider:b}=I,O=Q[IV(0x27e)](IV(0x269)),V=n[IV(0x2bb)]===!![];function k(N,a,D){var H,Y;return __awaiter(this,void 0x0,void 0x0,function*(){const Ik=a1z;if(_[Ik(0x1f3)]((Y=(H=w[Ik(0x2d8)])===null||H===void 0x0?void 0x0:H[Ik(0x28a)])!==null&&Y!==void 0x0?Y:{},N)){const r=!V&&!O&&D?D():undefined,X=n[N]||r||(yield a());_[Ik(0x211)](m,N,X);}});}return yield(0x0,utils_1['asyncSequential'])(Object[IV(0x272)]((T=(A=w[IV(0x2d8)])===null||A===void 0x0?void 0x0:A[IV(0x28a)])!==null&&T!==void 0x0?T:{}),([N,a])=>__awaiter(this,void 0x0,void 0x0,function*(){const IN=IV,D=m===null||m===void 0x0?void 0x0:m['projectId'],H=m===null||m===void 0x0?void 0x0:m[IN(0x258)];switch(N){case'projectId':return yield k(IN(0x1ff),u['askForProject'][IN(0x222)](u),b['getCurrentProjectName'][IN(0x222)](b));case'serviceId':return yield k(IN(0x275),u[IN(0x276)](D)[IN(0x222)](u),b['getCurrentServiceName'][IN(0x222)](b));case IN(0x2a0):return yield k(IN(0x2a0),u[IN(0x223)](D)[IN(0x222)](u));case'jobId':return yield k('jobId',u[IN(0x1ee)](D)[IN(0x222)](u),b['getCurrentJobName'][IN(0x222)](b));case IN(0x1fa):return yield k('runId',u['askForJobRun'](m[IN(0x243)],D,![])[IN(0x222)](u));case'secretId':return yield k(IN(0x245),u[IN(0x225)](D)[IN(0x222)](u));case'domain':case IN(0x224):return yield k(IN(0x2bd),u[IN(0x2c0)][IN(0x222)](u));case IN(0x234):return yield k(IN(0x234),u[IN(0x209)][IN(0x222)](u));case'volumeId':return yield k('volumeId',u[IN(0x27c)](D)[IN(0x222)](u));case IN(0x2bf):return yield k(IN(0x2bf),u['askForSubdomain'](m[IN(0x2bd)])[IN(0x222)](u));case IN(0x1fb):return yield k(IN(0x1fb),u['askForSubdomain'](m[IN(0x224)])[IN(0x222)](u));case IN(0x203):return yield k(IN(0x203),u['askForAddonBackup'](D,m[IN(0x2a0)])['bind'](u));case IN(0x2b0):return yield k(IN(0x2b0),u[IN(0x2ac)](D,m[IN(0x275)],m[IN(0x243)])['bind'](u));case IN(0x258):return yield k(IN(0x258),u[IN(0x279)]()[IN(0x222)](u));case IN(0x210):return yield k(IN(0x210),u[IN(0x262)](H)['bind'](u));case IN(0x2d2):return yield k('logSinkId',u['askForLogSink']()[IN(0x222)](u));case IN(0x294):return yield k(IN(0x294),u['askForPipeline'](D)[IN(0x222)](u));default:return yield k(N,u[IN(0x20f)](N,a===null||a===void 0x0?void 0x0:a[IN(0x2a3)])['bind'](u));}})),m;});}function F(n){var A,T;return __awaiter(this,void 0x0,void 0x0,function*(){const Ia=a1z,m={},b=Object['keys']((T=(A=w[Ia(0x2d8)])===null||A===void 0x0?void 0x0:A[Ia(0x293)])!==null&&T!==void 0x0?T:{});return yield(0x0,utils_1['asyncSequential'])(b,O=>__awaiter(this,void 0x0,void 0x0,function*(){const ID=Ia;if(n[O]!==undefined)return n[O];const V={},{required:k,schema:N}=w[ID(0x2d8)][ID(0x293)][O];return yield u[ID(0x2d0)]([''+O],N,V,k),V[O]!==undefined&&_[ID(0x211)](m,O,V[O]),V;})),m;});}function s(){const IH=Im;switch(Q[0x0]){case'get':return'Get\x20information\x20about\x20Northflank\x20'+(Q[0x1]||IH(0x2ab))+'s';case IH(0x26f):return'Update\x20Northflank\x20'+(Q[0x1]||'resource')+IH(0x264);default:return _[IH(0x29e)](L)+IH(0x24c);}}function C(n,A){const IY=Im;var T,m,b,O,V,k;if(!A){const l=(0x0,utils_1[IY(0x2b8)])()['name'](_[IY(0x2d1)](L))['description'](s());return J(l,L),l;}const N=(n===null||n===void 0x0?void 0x0:n[IY(0x2b7)])?chalk_1[IY(0x232)]['grey'](IY(0x23c)+n[IY(0x2b7)]):'',a=I[IY(0x218)]['getCurrentContext'](),D=a!==undefined&&((T=w===null||w===void 0x0?void 0x0:w['opt'])===null||T===void 0x0?void 0x0:T[IY(0x25c)])!==undefined,H=a===null||a===void 0x0?void 0x0:a[IY(0x2ba)][IY(0x20d)]('api.',''),Y=D?IY(0x244)+H+IY(0x1f5)+((m=w===null||w===void 0x0?void 0x0:w['opt'])===null||m===void 0x0?void 0x0:m[IY(0x25c)]):'',r=(n===null||n===void 0x0?void 0x0:n[IY(0x2a3)])||'',X=(0x0,utils_1[IY(0x2b8)])(!![])['name'](_[IY(0x2d1)](L))[IY(0x2a3)](r)[IY(0x2d5)](IY(0x28d),[N,Y]['join']('\x0a'));return J(X,L),((b=w[IY(0x2d8)])===null||b===void 0x0?void 0x0:b[IY(0x2a5)])&&(X['option'](IY(0x23d),IY(0x2a7)),X[IY(0x271)](IY(0x2af),IY(0x2cd))),K((O=w['opt'])===null||O===void 0x0?void 0x0:O[IY(0x28a)],X),K((V=w[IY(0x2d8)])===null||V===void 0x0?void 0x0:V['query'],X),K((k=w['opt'])===null||k===void 0x0?void 0x0:k[IY(0x28f)],X),X['action'](()=>__awaiter(this,void 0x0,void 0x0,function*(){const Ir=IY;var S,e,q,E;(0x0,utils_1[Ir(0x27b)])(I);const W=X[Ir(0x221)](),B=W===null||W===void 0x0?void 0x0:W[Ir(0x2c7)],p=B===Ir(0x1f0),c=B===Ir(0x242)||B==='yml',U=yield j(W);u[Ir(0x22c)](U);const I0=yield F(W),I1=Object[Ir(0x2bc)]((e=(S=w[Ir(0x2d8)])===null||S===void 0x0?void 0x0:S['path'])!==null&&e!==void 0x0?e:{})['map'](I6=>I6+'='+chalk_1[Ir(0x232)]['green'](U[I6]))[Ir(0x289)](',\x20');if(I1[Ir(0x1f4)]>0x0&&!p&&!c){const I6=Ir(0x2ae)+I1;console['log'](I6);}const I2=((q=w[Ir(0x2d8)])===null||q===void 0x0?void 0x0:q['body'])?yield h(W,w,Q):undefined;if(!W['force']&&Q[Ir(0x27e)](Ir(0x269))&&!(yield u['deleteWarningPrompt']())){(0x0,utils_1[Ir(0x29f)])(Ir(0x260));return;}function I3(I7,I8=![],I9=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const IX=a1z,{data:II,request:Iz,error:Ig,pagination:IZ}=yield R[IX(0x215)]({'parameters':U,'options':Object[IX(0x2c9)](Object[IX(0x2c9)]({},I0),{'cursor':I7}),'data':I2});(W===null||W===void 0x0?void 0x0:W[IX(0x2a6)])&&(console[IX(0x22a)](IX(0x2b3)+Iz[IX(0x290)]+':'+Iz[IX(0x240)]),console[IX(0x22a)](IX(0x268)+Iz[IX(0x2a5)]));if(Ig){const Iy=Ig[IX(0x265)]?IX(0x255)+JSON[IX(0x2b2)](Ig[IX(0x265)]):'',Ii=(Ig===null||Ig===void 0x0?void 0x0:Ig['id'])?IX(0x2c4)+Ig['id']:'',It=IX(0x20a)+Ig['status']+Ii+')';throw new Error('API\x20request\x20failed\x0a\x09Message:\x20'+Ig['message']+'\x20'+It+Iy);}if(!(W===null||W===void 0x0?void 0x0:W['quiet'])){if(p)(0x0,console_format_helpers_1[IX(0x246)])(W===null||W===void 0x0?void 0x0:W[IX(0x2c7)],II);else{if(c)(0x0,console_format_helpers_1[IX(0x2c2)])(W===null||W===void 0x0?void 0x0:W[IX(0x2c7)],II);else{if(isListCommand(Q)){const Iu=(B===null||B===void 0x0?void 0x0:B['startsWith'](IX(0x283)))?B[IX(0x20d)]('custom-columns=','')['split'](',')['map'](Ih=>Ih['toLowerCase']()):undefined,Iv=Q[Q[IX(0x1f4)]-0x1],IM=''+Iv+(Iv[IX(0x25b)]('s')?'':'s'),IG=_['upperFirst'](IM),IP=_[IX(0x1f3)](II,IM)?II[IM]:II;(0x0,console_format_helpers_1['printAsTable'])(IP,IG,Iu,I8,I9);}else console['log']((0x0,console_format_helpers_1[IX(0x278)])(II));}}}return IZ;});}let I4=yield I3(),I5=0x0;if(!W[Ir(0x2cf)]&&(I4===null||I4===void 0x0?void 0x0:I4['cursor']))while(I4['cursor']){const I7=yield u['askConfirm'](Ir(0x217));I7&&(process['stdout']['moveCursor'](0x0,-0x1),process['stdout'][Ir(0x287)](0x1),I5+=(E=I4[Ir(0x2a8)])!==null&&E!==void 0x0?E:0x0,I4=yield I3(I4[Ir(0x238)],!![],I5));}})),X;}const f=_[Im(0x1f3)](w,Im(0x2d8)),x=R,o=C(x,f);g[Im(0x226)](o),G();const d=_[Im(0x2a2)](w,Im(0x2d8));Object[Im(0x2bc)](d)[Im(0x1f4)]>0x0&&generateCommands(I,R,o,Z,y,d,Q);});function P(L,R,w){return __awaiter(this,void 0x0,void 0x0,function*(){const Il=a1z,{input:Q,file:K}=L;if(Q!==undefined)try{return JSON['parse'](Q);}catch(J){try{return yaml[Il(0x285)](Q);}catch(j){throw new Error(Il(0x29c));}}if(K!==undefined){if(!fs_1[Il(0x232)][Il(0x23b)](K))throw new Error('File\x20does\x20not\x20exist:\x20'+K);const F=fs_1['default'][Il(0x27f)](K)[Il(0x2a1)]();let s;try{if(_['isString'](F)){if(L['file']['endsWith'](Il(0x2c6)))s=JSON[Il(0x286)](F);else{if(L[Il(0x27a)]['endsWith']('.yaml')||L[Il(0x27a)][Il(0x25b)](Il(0x228)))s=yaml[Il(0x285)](F);else throw new Error(Il(0x22b)+L[Il(0x27a)][Il(0x1f2)]('.')['pop']());}}else s=F;return s;}catch(C){throw new Error('Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20'+C[Il(0x28e)]);}}return yield u[Il(0x2cb)](R,{'cmdPath':w});});}function h(L,R,w){var Q;return __awaiter(this,void 0x0,void 0x0,function*(){const IS=a1z,K=yield P(L,R,w),J=new ajv_1[(IS(0x232))]({'allErrors':!![],'keywords':[IS(0x21a)],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let j=![];try{j=J[IS(0x249)](R[IS(0x2d8)]['body'],K);}catch(s){if(s['message'][IS(0x27e)](IS(0x1fc)))j=!![];else throw s;}const F=(Q=J===null||J===void 0x0?void 0x0:J[IS(0x21f)])===null||Q===void 0x0?void 0x0:Q[IS(0x26a)](C=>{const Ie=IS;var f;return!((f=C===null||C===void 0x0?void 0x0:C[Ie(0x28e)])===null||f===void 0x0?void 0x0:f['includes']('match\x20exactly\x20one\x20schema\x20in\x20oneOf'));});if(!j&&F!==undefined&&(F===null||F===void 0x0?void 0x0:F[IS(0x1f4)])>0x0)throw new Error(IS(0x241)+JSON[IS(0x2b2)](J[IS(0x21f)],null,'\x20'));return K;});}}
2
+ 'use strict';const a1Xd=a1V;(function(X,V){const XK=a1V,h=X();while(!![]){try{const Q=parseInt(XK(0xb0))/0x1+-parseInt(XK(0x11c))/0x2*(parseInt(XK(0x152))/0x3)+-parseInt(XK(0x8b))/0x4+-parseInt(XK(0xd3))/0x5*(parseInt(XK(0x137))/0x6)+-parseInt(XK(0x139))/0x7*(-parseInt(XK(0x120))/0x8)+-parseInt(XK(0xb5))/0x9*(-parseInt(XK(0x141))/0xa)+-parseInt(XK(0xa7))/0xb*(-parseInt(XK(0xbe))/0xc);if(Q===V)break;else h['push'](h['shift']());}catch(J){h['push'](h['shift']());}}}(a1X,0x58921));var __createBinding=this&&this[a1Xd(0xc6)]||(Object['create']?function(X,V,h,Q){const Xf=a1Xd;if(Q===undefined)Q=h;var J=Object[Xf(0xa5)](V,h);(!J||(Xf(0x8d)in J?!V[Xf(0x156)]:J['writable']||J[Xf(0x116)]))&&(J={'enumerable':!![],'get':function(){return V[h];}}),Object[Xf(0xd0)](X,Q,J);}:function(X,V,h,Q){if(Q===undefined)Q=h;X[Q]=V[h];}),__setModuleDefault=this&&this[a1Xd(0x15a)]||(Object[a1Xd(0xd6)]?function(X,V){const Xz=a1Xd;Object[Xz(0xd0)](X,Xz(0x75),{'enumerable':!![],'value':V});}:function(X,V){const XF=a1Xd;X[XF(0x75)]=V;}),__importStar=this&&this[a1Xd(0x15f)]||function(X){const Xn=a1Xd;if(X&&X['__esModule'])return X;var V={};if(X!=null){for(var h in X)if(h!=='default'&&Object['prototype'][Xn(0x70)][Xn(0xcf)](X,h))__createBinding(V,X,h);}return __setModuleDefault(V,X),V;},__awaiter=this&&this['__awaiter']||function(X,V,h,Q){function J(G){return G instanceof h?G:new h(function(I){I(G);});}return new(h||(h=Promise))(function(G,I){const Xv=a1V;function T(A){const Xq=a1V;try{E(Q[Xq(0x85)](A));}catch(D){I(D);}}function W(A){const Xa=a1V;try{E(Q[Xa(0x97)](A));}catch(D){I(D);}}function E(A){const XR=a1V;A[XR(0x13f)]?G(A[XR(0xd4)]):J(A[XR(0xd4)])[XR(0xaf)](T,W);}E((Q=Q[Xv(0x11d)](X,V||[]))[Xv(0x85)]());});},__importDefault=this&&this[a1Xd(0x8a)]||function(X){const Xg=a1Xd;return X&&X[Xg(0x156)]?X:{'default':X};};function a1V(X,V){const h=a1X();return a1V=function(Q,J){Q=Q-0x6e;let G=h[Q];return G;},a1V(X,V);}function a1X(){const Xm=['getMetricsCommand','type','askForCredentials','find','then','35536EHPTss','getProgram','getCurrentServiceName','pipelineId','(HTTP\x20status\x20code:\x20','45djvoTF','/docs/v1/api/','getLogsCommand','contexts','File\x20to\x20load\x20resource\x20json\x20from','parseAsync','forEach','\x20--','errors','12pxUDtC','query','action','serviceId','Update\x20Northflank\x20','OPTIONAL:\x20','readFileSync','omit','__createBinding','scrt','Command','@northflank/js-client','VERBOSE:\x20Request\x20body\x20->\x20','defaults','js-yaml','commander','credential','call','defineProperty','rgn','required','42835YZnNcG','value','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','create','secret','service','method','filter','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','Resource\x20was\x20not\x20deleted.','getCommandOverview','plan','addonId','runs','stdout','file','docsTagsPath','./exec','resource','repos','bind','templateRunId',',\x20-','.yaml','addon','jobs','sort','invoices','./logs','ApiClient','name','isEqual','length','parse','-v,\x20--version','getCurrentJobName','error','secrets','isString','details','join','verbose','split','warning','chalk','clearLine','\x20properties','exitCode','subdomain','Northflank\x20cli\x20version:\x20','match\x20exactly\x20one\x20schema\x20in\x20oneOf','prj','after','askForTemplate','entries','isArray','moveCursor','buildId','aliases','CliMetrics','API\x20request\x20failed\x0a\x09Message:\x20','checkUpdate','yaml','endpoints','kebabCase','ApiClientFileContextProvider','status','configurable','branch','output','custom-columns=','has','addHelpText','210418IMpPAa','apply','json','consoleFormat','278776eeEAhf','green','toLowerCase','askForBuild','projects','askForProject','./context/contextCommands','base','body','inv','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','addCommand','-i,\x20--input\x20<resource-def>','jobId','volume','svc','url','askForJob','portFwdCmd','secretId','set','endsWith','templateId','234EwuXqy','repository','49VwpIbO','./utils','askForJobRun','\x0a>\x20Token\x20permissions\x20required:\x20','startsWith','\x0a\x09details\x20:','done','askForPipeline','1326310IxFWZT','grey','propToType','map','description','job','deleteWarningPrompt','there\x20are\x20more\x20rows,\x20load?','requiredPermissions','api.','invoice','contextProvider','repo','toUpperCase','update','credentials','domains','15mGagFN','plans','askForAddonBackup','volumeId','__esModule','cursor','handleYamlOutput','volumes','__setModuleDefault','template','vol','opts','includes','__importStar','getOwnPropertyNames','keys','--verbose','quiet','count','execCmd','getCommand','argv','credentialId','askForSubdomain','hasOwnProperty','option','InquirerHelper','regions','log','default','Get\x20information\x20about\x20Northflank\x20','safeLoad','existsSync','helpOption','projectId','printAsTable','example','./defaults','list','version','northflank','addHelpCommand','askForService','domain','./port-forward','next','Display\x20help\x20for\x20command','File\x20does\x20not\x20exist:\x20','askForLogSink','.json','__importDefault','2199960EVYePJ','./metrics','get','customUserAgent','=>\x20running\x20command\x20with:\x20','project','toString','boolean','CliExec','ajv','message','stringify','throw','alias','backupId','askForSecret','getCurrentProjectName','some','logSinkId','concat','yml','subdomainId','opt','runId','backups','dmn','getOwnPropertyDescriptor','delete','9133443mIGZKa','path','-f,\x20--file\x20<file-path>','CliLogs'];a1X=function(){return Xm;};return a1X();}Object[a1Xd(0xd0)](exports,a1Xd(0x156),{'value':!![]}),exports[a1Xd(0xb1)]=void 0x0;const js_client_1=require(a1Xd(0xc9)),commander_1=__importDefault(require(a1Xd(0xcd))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require(a1Xd(0x94))),chalk_1=__importDefault(require(a1Xd(0xff))),_=__importStar(require('lodash')),contextCommands_1=require(a1Xd(0x126)),utils_1=require(a1Xd(0x13a)),defaults=__importStar(require(a1Xd(0x7d))),inquirer_helper_1=require('./inquirer-helper'),console_format_helpers_1=require('./formatting/console-format-helpers'),command_overview_1=require('./formatting/command-overview'),port_forward_1=require(a1Xd(0x84)),exec_1=require(a1Xd(0xe4)),logs_1=require(a1Xd(0xef)),metrics_1=require(a1Xd(0x8c)),yaml=require(a1Xd(0xcc)),pgk=require('../package.json'),getProgram=X=>{const XB=a1Xd,V=new commander_1[(XB(0x75))][(XB(0xc8))](XB(0x80));V[XB(0x145)]('Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line'),V['enablePositionalOptions'](!![]),V[XB(0x7f)](XB(0x104)+chalk_1[XB(0x75)]['underline'](pgk[XB(0x7f)]),XB(0xf5),XB(0xdb));const h=new js_client_1[(XB(0xf0))](X,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[XB(0x8e)]}),Q=new contextCommands_1['CliContext'](h),J=new port_forward_1['CliPortForward'](X),G=new exec_1[(XB(0x93))](X),I=new logs_1[(XB(0xaa))](X),T=new metrics_1[(XB(0x10e))](X);return V[XB(0x12b)](J[XB(0x132)]),V[XB(0x12b)](G[XB(0x165)]),V[XB(0x12b)](Q['login']),V[XB(0x12b)](Q[XB(0xb8)]),generateCommands(h,h[XB(0x112)],V,I,T),V[XB(0x12b)]((0x0,command_overview_1[XB(0xdd)])(V)),V[XB(0x81)](!![],XB(0x86)),V[XB(0x79)](undefined,XB(0x86)),V;};exports[a1Xd(0xb1)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const XO=a1Xd;try{const X=new js_client_1[(XO(0x114))]();yield(0x0,utils_1[XO(0x110)])(X);const V=(0x0,exports['getProgram'])(X);yield V[XO(0xba)](process[XO(0x167)]);}catch(h){(0x0,utils_1[XO(0xf7)])('Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20'+h[XO(0x95)]),process[XO(0x167)][XO(0xae)](Q=>Q===XO(0x162))&&console[XO(0x74)](h),process[XO(0x102)]=0x1;}}))());function isListCommand(X){const XH=a1Xd,V=[['get',XH(0xeb),XH(0xa3)],[XH(0x8d),XH(0x146),XH(0xe0)]];return X[XH(0xae)](h=>h===XH(0x7e))||V[XH(0x9c)](h=>_[XH(0xf2)](X,h));}function generateCommands(X,V,h,Q,J,G=defaults[a1Xd(0xcb)],I=[]){const Xk=a1Xd,T=new inquirer_helper_1[(Xk(0x72))](new js_client_1[(Xk(0xf0))](X[Xk(0x14c)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[Xk(0x8e)]}));function W(K,d){const Xo=Xk;return K[Xo(0xd2)]!==![]&&d===undefined;}function E(K,d){const XN=Xk,{opt:f,name:z}=K,F=f[XN(0x75)],n=W(f,F),q=O=>O[XN(0xf3)]>0x1?'--'+O:'-'+O,a=f===null||f===void 0x0?void 0x0:f[XN(0x98)],R=a?_[XN(0x10a)](a)?'-'+(a===null||a===void 0x0?void 0x0:a[XN(0x144)](O=>q(O))[XN(0xfb)](XN(0xe9)))+',':''+q(a):'',v=n?'':XN(0xc3),g=typeof f[XN(0xac)]===XN(0x92)?R+XN(0xbc)+z:R+'\x20--'+z+'\x20<'+z[XN(0x14e)]()+'>',B=v+f[XN(0x145)];d[XN(0x71)](g,B,F);}function A(){const Xp=Xk;if(h['commands'][Xp(0x9c)](K=>K['name']()==='logs'))return;_['isEqual'](I,[Xp(0x8d),Xp(0xd8)])&&(h[Xp(0x12b)](Q['getLogsCommand']('service')),h[Xp(0x12b)](J[Xp(0xab)](Xp(0xd8))),h[Xp(0x12b)](Q[Xp(0xb7)](Xp(0xd8),!![])),h[Xp(0x12b)](J['getMetricsCommand'](Xp(0xd8),!![]))),_['isEqual'](I,[Xp(0x8d),Xp(0x146)])&&(h[Xp(0x12b)](Q[Xp(0xb7)]('job')),h[Xp(0x12b)](J[Xp(0xab)](Xp(0x146))),h['addCommand'](Q[Xp(0xb7)](Xp(0x146),!![])),h['addCommand'](J['getMetricsCommand']('job',!![]))),_[Xp(0xf2)](I,[Xp(0x8d),'addon'])&&(h[Xp(0x12b)](Q[Xp(0xb7)](Xp(0xeb))),h[Xp(0x12b)](J[Xp(0xab)](Xp(0xeb))));}return Object[Xk(0x160)](G)[Xk(0xbb)](K=>{const Xi=Xk,d=V[K],f=G[K],z=I[Xi(0x9e)]([K]);function F(k,o){const Xx=Xi,N=Object['getOwnPropertyNames'](k||{});N[Xx(0x144)](p=>{return{'name':p,'opt':k[p]};})[Xx(0xed)]((p,i)=>!W(p[Xx(0xa1)])?!W(i['opt'])?0x0:0x1:-0x1)[Xx(0xbb)](p=>{E(p,o);});}function n(k,o){const XL=Xi,N=[[XL(0x90),XL(0x124),XL(0x106)],['service','services',XL(0x12f)],[XL(0x150),XL(0xce),'cred'],[XL(0xeb),'addons','adn'],[XL(0x146),XL(0xec)],[XL(0xde),XL(0x153),'pln'],['region',XL(0x73),XL(0xd1)],[XL(0x83),XL(0x151),XL(0xa4)],[XL(0xd7),XL(0xf8),XL(0xc7)],[XL(0x159),XL(0x12e),XL(0x15c)],['branches',XL(0x117),'brn'],[XL(0x14b),XL(0xee),XL(0x129)],[XL(0x15b),'templates','tpl'],[XL(0xe6),XL(0x138),'repositories',XL(0x14d)]],p=N[XL(0xae)](i=>i[XL(0x15e)](o));if(p!==undefined)k[XL(0x10d)](p[XL(0xda)](i=>i!==o));}function q(k){var o,N;return __awaiter(this,void 0x0,void 0x0,function*(){const Xy=a1V,p={},{contextProvider:i}=X,x=z['includes'](Xy(0xa6)),L=k['noDefaults']===!![];function y(M,e,Z){var C,u;return __awaiter(this,void 0x0,void 0x0,function*(){const XM=a1V;if(_[XM(0x11a)]((u=(C=f[XM(0xa1)])===null||C===void 0x0?void 0x0:C['path'])!==null&&u!==void 0x0?u:{},M)){const c=!L&&!x&&Z?Z():undefined,Y=k[M]||c||(yield e());_[XM(0x134)](p,M,Y);}});}return yield(0x0,utils_1['asyncSequential'])(Object[Xy(0x109)]((N=(o=f[Xy(0xa1)])===null||o===void 0x0?void 0x0:o['path'])!==null&&N!==void 0x0?N:{}),([M,e])=>__awaiter(this,void 0x0,void 0x0,function*(){const Xe=Xy,Z=p===null||p===void 0x0?void 0x0:p[Xe(0x7a)],C=p===null||p===void 0x0?void 0x0:p['templateId'];switch(M){case Xe(0x7a):return yield y('projectId',T[Xe(0x125)][Xe(0xe7)](T),i[Xe(0x9b)][Xe(0xe7)](i));case'serviceId':return yield y(Xe(0xc1),T[Xe(0x82)](Z)[Xe(0xe7)](T),i[Xe(0xb2)]['bind'](i));case Xe(0xdf):return yield y('addonId',T['askForAddon'](Z)[Xe(0xe7)](T));case'jobId':return yield y(Xe(0x12d),T[Xe(0x131)](Z)[Xe(0xe7)](T),i[Xe(0xf6)][Xe(0xe7)](i));case Xe(0xa2):return yield y(Xe(0xa2),T[Xe(0x13b)](p[Xe(0x12d)],Z,![])[Xe(0xe7)](T));case Xe(0x133):return yield y(Xe(0x133),T[Xe(0x9a)](Z)[Xe(0xe7)](T));case Xe(0x83):case'domainId':return yield y(Xe(0x83),T['askForDomain'][Xe(0xe7)](T));case Xe(0x6e):return yield y('credentialId',T[Xe(0xad)][Xe(0xe7)](T));case Xe(0x155):return yield y(Xe(0x155),T['askForVolume'](Z)[Xe(0xe7)](T));case Xe(0x103):return yield y('subdomain',T[Xe(0x6f)](p[Xe(0x83)])[Xe(0xe7)](T));case'subdomainId':return yield y(Xe(0xa0),T[Xe(0x6f)](p['domainId'])[Xe(0xe7)](T));case Xe(0x99):return yield y('backupId',T[Xe(0x154)](Z,p[Xe(0xdf)])[Xe(0xe7)](T));case Xe(0x10c):return yield y(Xe(0x10c),T[Xe(0x123)](Z,p[Xe(0xc1)],p[Xe(0x12d)])[Xe(0xe7)](T));case Xe(0x136):return yield y(Xe(0x136),T[Xe(0x108)]()[Xe(0xe7)](T));case'templateRunId':return yield y(Xe(0xe8),T['askForTemplateRun'](C)[Xe(0xe7)](T));case Xe(0x9d):return yield y(Xe(0x9d),T[Xe(0x88)]()[Xe(0xe7)](T));case Xe(0xb3):return yield y('pipelineId',T[Xe(0x140)](Z)['bind'](T));default:return yield y(M,T['askGeneric'](M,e===null||e===void 0x0?void 0x0:e[Xe(0x145)])[Xe(0xe7)](T));}})),p;});}function a(k){var o,N;return __awaiter(this,void 0x0,void 0x0,function*(){const XZ=a1V,p={},i=Object[XZ(0x161)]((N=(o=f['opt'])===null||o===void 0x0?void 0x0:o['query'])!==null&&N!==void 0x0?N:{});return yield(0x0,utils_1['asyncSequential'])(i,x=>__awaiter(this,void 0x0,void 0x0,function*(){const XC=XZ;if(k[x]!==undefined)return k[x];const L={},{required:y,schema:M}=f['opt'][XC(0xbf)][x];return yield T[XC(0x143)]([''+x],M,L,y),L[x]!==undefined&&_['set'](p,x,L[x]),L;})),p;});}function R(){const Xu=Xi;switch(z[0x0]){case Xu(0x8d):return Xu(0x76)+(z[0x1]||'resource')+'s';case Xu(0x14f):return Xu(0xc2)+(z[0x1]||Xu(0xe5))+Xu(0x101);default:return _['upperFirst'](K)+'\x20Northflank\x20resources';}}function v(k,o){const Xc=Xi;var N,p,i,x,L,y;if(!o){const j=(0x0,utils_1[Xc(0x166)])()[Xc(0xf1)](_[Xc(0x113)](K))[Xc(0x145)](R());return n(j,K),j;}const M=(k===null||k===void 0x0?void 0x0:k[Xc(0x149)])?chalk_1[Xc(0x75)][Xc(0x142)](Xc(0x13c)+k['requiredPermissions']):'',e=X[Xc(0x14c)]['getCurrentContext'](),Z=e!==undefined&&((N=f===null||f===void 0x0?void 0x0:f['opt'])===null||N===void 0x0?void 0x0:N[Xc(0xe3)])!==undefined,C=e===null||e===void 0x0?void 0x0:e['host']['replace'](Xc(0x14a),''),u=Z?'Documentation:\x20'+C+Xc(0xb6)+((p=f===null||f===void 0x0?void 0x0:f[Xc(0xa1)])===null||p===void 0x0?void 0x0:p['docsTagsPath']):'',c=(k===null||k===void 0x0?void 0x0:k[Xc(0x145)])||'',Y=(0x0,utils_1[Xc(0x166)])(!![])['name'](_[Xc(0x113)](K))['description'](c)[Xc(0x11b)](Xc(0x107),[M,u][Xc(0xfb)]('\x0a'));return n(Y,K),((i=f[Xc(0xa1)])===null||i===void 0x0?void 0x0:i['body'])&&(Y[Xc(0x71)](Xc(0xa9),Xc(0xb9)),Y[Xc(0x71)](Xc(0x12c),'JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22')),F((x=f[Xc(0xa1)])===null||x===void 0x0?void 0x0:x[Xc(0xa8)],Y),F((L=f['opt'])===null||L===void 0x0?void 0x0:L['query'],Y),F((y=f['opt'])===null||y===void 0x0?void 0x0:y[Xc(0x127)],Y),Y[Xc(0xc0)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const XY=Xc;var b,s,w,m;(0x0,utils_1['assertContextExisting'])(X);const r=Y[XY(0x15d)](),l=r===null||r===void 0x0?void 0x0:r[XY(0x118)],S=l===XY(0x11e),t=l===XY(0x111)||l===XY(0x9f),U=yield q(r);T['setPathVars'](U);const X0=yield a(r),X1=Object[XY(0x161)]((s=(b=f[XY(0xa1)])===null||b===void 0x0?void 0x0:b[XY(0xa8)])!==null&&s!==void 0x0?s:{})['map'](X6=>X6+'='+chalk_1['default'][XY(0x121)](U[X6]))[XY(0xfb)](',\x20');if(X1[XY(0xf3)]>0x0&&!S&&!t){const X6=XY(0x8f)+X1;console['log'](X6);}const X2=((w=f[XY(0xa1)])===null||w===void 0x0?void 0x0:w['body'])?yield D(r,f,z):undefined;if(!r['force']&&z['includes']('delete')&&!(yield T[XY(0x147)]())){(0x0,utils_1[XY(0xfe)])(XY(0xdc));return;}function X3(X7,X8=![],X9=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const Xj=a1V,{data:XX,request:XV,error:Xh,pagination:XQ}=yield d[Xj(0xcf)]({'parameters':U,'options':Object['assign'](Object['assign']({},X0),{'cursor':X7}),'data':X2});(r===null||r===void 0x0?void 0x0:r[Xj(0xfc)])&&(console[Xj(0x74)]('VERBOSE:\x20Using\x20endpoint\x20->\x20'+XV[Xj(0xd9)]+':'+XV[Xj(0x130)]),console['log'](Xj(0xca)+XV[Xj(0x128)]));if(Xh){const XJ=Xh[Xj(0xfa)]?Xj(0x13e)+JSON[Xj(0x96)](Xh['details']):'',XG=(Xh===null||Xh===void 0x0?void 0x0:Xh['id'])?',\x20NF\x20error\x20id:\x20'+Xh['id']:'',XI=Xj(0xb4)+Xh[Xj(0x115)]+XG+')';throw new Error(Xj(0x10f)+Xh[Xj(0x95)]+'\x20'+XI+XJ);}if(!(r===null||r===void 0x0?void 0x0:r[Xj(0x163)])){if(S)(0x0,console_format_helpers_1['handleJsonOutput'])(r===null||r===void 0x0?void 0x0:r['output'],XX);else{if(t)(0x0,console_format_helpers_1[Xj(0x158)])(r===null||r===void 0x0?void 0x0:r['output'],XX);else{if(isListCommand(z)){const XT=(l===null||l===void 0x0?void 0x0:l[Xj(0x13d)](Xj(0x119)))?l['replace'](Xj(0x119),'')['split'](',')[Xj(0x144)](XD=>XD[Xj(0x122)]()):undefined,XW=z[z[Xj(0xf3)]-0x1],XE=''+XW+(XW[Xj(0x135)]('s')?'':'s'),XA=_['upperFirst'](XE),XP=_[Xj(0x11a)](XX,XE)?XX[XE]:XX;(0x0,console_format_helpers_1[Xj(0x7b)])(XP,XA,XT,X8,X9);}else console[Xj(0x74)]((0x0,console_format_helpers_1[Xj(0x11f)])(XX));}}}return XQ;});}let X4=yield X3(),X5=0x0;if(!r[XY(0x163)]&&(X4===null||X4===void 0x0?void 0x0:X4[XY(0x157)]))while(X4[XY(0x157)]){const X7=yield T['askConfirm'](XY(0x148));X7&&(process['stdout'][XY(0x10b)](0x0,-0x1),process[XY(0xe1)][XY(0x100)](0x1),X5+=(m=X4[XY(0x164)])!==null&&m!==void 0x0?m:0x0,X4=yield X3(X4[XY(0x157)],!![],X5));}})),Y;}const g=_[Xi(0x11a)](f,'opt'),B=d,O=v(B,g);h[Xi(0x12b)](O),A();const H=_[Xi(0xc5)](f,Xi(0xa1));Object[Xi(0x161)](H)[Xi(0xf3)]>0x0&&generateCommands(X,d,O,Q,J,H,z);});function P(K,d,f){return __awaiter(this,void 0x0,void 0x0,function*(){const Xb=a1V,{input:z,file:F}=K;if(z!==undefined)try{return JSON[Xb(0xf4)](z);}catch(n){try{return yaml[Xb(0x77)](z);}catch(q){throw new Error(Xb(0xd5));}}if(F!==undefined){if(!fs_1[Xb(0x75)][Xb(0x78)](F))throw new Error(Xb(0x87)+F);const a=fs_1[Xb(0x75)][Xb(0xc4)](F)[Xb(0x91)]();let R;try{if(_[Xb(0xf9)](a)){if(K[Xb(0xe2)][Xb(0x135)](Xb(0x89)))R=JSON[Xb(0xf4)](a);else{if(K[Xb(0xe2)][Xb(0x135)](Xb(0xea))||K[Xb(0xe2)]['endsWith'](Xb(0x9f)))R=yaml['safeLoad'](a);else throw new Error('Unknown\x20input\x20file\x20type:\x20'+K[Xb(0xe2)][Xb(0xfd)]('.')['pop']());}}else R=a;return R;}catch(v){throw new Error('Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20'+v[Xb(0x95)]);}}return yield T['retrievePayloadViaInteractiveCli'](d,{'cmdPath':f});});}function D(K,d,f){var z;return __awaiter(this,void 0x0,void 0x0,function*(){const Xs=a1V,F=yield P(K,d,f),n=new ajv_1[(Xs(0x75))]({'allErrors':!![],'keywords':[Xs(0x7c)],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let q=![];try{q=n['validate'](d['opt'][Xs(0x128)],F);}catch(R){if(R[Xs(0x95)][Xs(0x15e)]('runtimeFiles/additionalProperties'))q=!![];else throw R;}const a=(z=n===null||n===void 0x0?void 0x0:n['errors'])===null||z===void 0x0?void 0x0:z[Xs(0xda)](v=>{const Xw=Xs;var g;return!((g=v===null||v===void 0x0?void 0x0:v['message'])===null||g===void 0x0?void 0x0:g[Xw(0x15e)](Xw(0x105)));});if(!q&&a!==undefined&&(a===null||a===void 0x0?void 0x0:a[Xs(0xf3)])>0x0)throw new Error(Xs(0x12a)+JSON[Xs(0x96)](n[Xs(0xbd)],null,'\x20'));return F;});}}
@@ -1 +1 @@
1
- 'use strict';const a2j=a2z;function a2z(I,z){const g=a2I();return a2z=function(Z,y){Z=Z-0xdf;let i=g[Z];return i;},a2z(I,z);}function a2I(){const c=['updateToken','browserLogin','Use\x20service\x20with\x20id:','getCurrentContext','option','Name\x20for\x20login\x20context','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','defineProperty','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','Local\x20context\x20\x27','useContext','lodash','\x27\x20successfully\x20updated.','action','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','catch','service','--all','verifyToken','set','hasOwnProperty','../login/browser-login','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','1015662PByMhz','../formatting/console-format-helpers','retry','name','\x27\x20successfully\x20removed.','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','getCurrentName','askForProject','281806GTZGqn','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','token','19oDvyHm','askForJob','Use\x20project\x20with\x20id:','660ifvgms','dir','success','apiTokenLogin','https://','sort','Error\x20occured\x20during\x20browser\x20login:\x20','getOwnPropertyDescriptor','log','close','login','warning','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','askForService','defaultBaseUrl','host','Token\x20for\x20current\x20context\x20\x27','getProjectName','getInfo','addCommand','get','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','printAsTable','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','moveCursor','prompt','delete','-h,\x20--host\x20[HOST]','finally','sanitiseHostname','\x20(current)','list','test','93390XnjexH','InquirerHelper','Update\x20token\x20for\x20current\x20context','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','List\x20all\x20available\x20contexts','4TSPdZZ','message','loadContextWrapper','writable','Changed\x20current\x20context\x20to\x20','use','remove','doNotOpenBrowser','Use\x20job\x20with\x20id:','-i,\x20--id\x20[ID]','description','getCurrentProjectName','create','contextProvider','https://api.northflank.com','-n,\x20--name\x20[NAME]','project','--token-login','getCurrentToken','stdout','value','useJobId','--do-not-open-browser','all','alias','fullUrl','next','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','search-list','Use\x20manual\x20login\x20with\x20API\x20token','call','tokenPrompt','map','Login\x20to\x20','throw','clearLine','37248RvnUoG','then','GET','/v1/login','__importDefault','__esModule','useServiceId','done','job','CliContext','\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20','contexts','Token\x20for\x20this\x20context','getCurrentBaseUrl','contextAvailable','browser-opened','default','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','removeContext','getCommand','prototype','1288070kLsTqO','apiClient','sessionToken=********','Remove\x20a\x20context','use\x20from\x20now\x20on','184059gqoSuA','error','__setModuleDefault','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','.\x20Using\x20fallback.','startLogin','autologin-','Retrieve\x20and\x20update\x20local\x20context\x20settings.','149178pFXtFo','askForContext','length','tokenLogin','replace','configurable','32LbwLqq','context','-t,\x20--token\x20[TOKEN]'];a2I=function(){return c;};return a2I();}(function(I,z){const K=a2z,g=I();while(!![]){try{const Z=-parseInt(K(0xff))/0x1*(-parseInt(K(0x14c))/0x2)+-parseInt(K(0xf4))/0x3*(-parseInt(K(0x128))/0x4)+parseInt(K(0x161))/0x5+-parseInt(K(0x16e))/0x6+parseInt(K(0xfc))/0x7*(-parseInt(K(0x174))/0x8)+-parseInt(K(0x166))/0x9+parseInt(K(0x123))/0xa*(-parseInt(K(0x102))/0xb);if(Z===z)break;else g['push'](g['shift']());}catch(y){g['push'](g['shift']());}}}(a2I,0x2cc2a));var __createBinding=this&&this['__createBinding']||(Object['create']?function(I,z,g,Z){const J=a2z;if(Z===undefined)Z=g;var y=Object[J(0x109)](z,g);(!y||(J(0x116)in y?!z['__esModule']:y[J(0x12b)]||y[J(0x173)]))&&(y={'enumerable':!![],'get':function(){return z[g];}}),Object[J(0xe4)](I,Z,y);}:function(I,z,g,Z){if(Z===undefined)Z=g;I[Z]=z[g];}),__setModuleDefault=this&&this[a2j(0x168)]||(Object[a2j(0x134)]?function(I,z){const F=a2j;Object[F(0xe4)](I,'default',{'enumerable':!![],'value':z});}:function(I,z){const s=a2j;I[s(0x15c)]=z;}),__importStar=this&&this['__importStar']||function(I){const C=a2j;if(I&&I['__esModule'])return I;var z={};if(I!=null){for(var g in I)if(g!==C(0x15c)&&Object[C(0x160)][C(0xf1)][C(0x146)](I,g))__createBinding(z,I,g);}return __setModuleDefault(z,I),z;},__awaiter=this&&this['__awaiter']||function(I,z,g,Z){function y(i){return i instanceof g?i:new g(function(t){t(i);});}return new(g||(g=Promise))(function(i,t){const d=a2z;function u(G){const f=a2z;try{M(Z[f(0x142)](G));}catch(h){t(h);}}function v(G){const x=a2z;try{M(Z[x(0x14a)](G));}catch(h){t(h);}}function M(G){const o=a2z;G[o(0x153)]?i(G[o(0x13c)]):y(G['value'])[o(0x14d)](u,v);}M((Z=Z['apply'](I,z||[]))[d(0x142)]());});},__importDefault=this&&this[a2j(0x150)]||function(I){const n=a2j;return I&&I[n(0x151)]?I:{'default':I};};Object[a2j(0xe4)](exports,'__esModule',{'value':!![]}),exports['CliContext']=void 0x0;const _=__importStar(require(a2j(0xe8))),node_fetch_1=__importDefault(require('node-fetch')),chalk_1=__importDefault(require('chalk')),utils_1=require('../utils'),inquirer_helper_1=require('../inquirer-helper'),console_format_helpers_1=require(a2j(0xf5)),browser_login_1=require(a2j(0xf2)),inquirer=require('inquirer');class CliContext{constructor(I,z=a2j(0x136)){const A=a2j;this[A(0x110)]=z,this[A(0x11f)]=P=>{const T=A;let h=P;return!/^https?:\/\//i[T(0x122)](h)&&(h=T(0x106)+h),h=h[T(0x172)](/\/+$/,''),h;},this[A(0x162)]=I;const g=new inquirer_helper_1[(A(0x124))](I);this[A(0x10c)]=(0x0,utils_1[A(0x15f)])()['name']('login')[A(0x132)](A(0x169))[A(0xe1)](A(0x139),A(0x145),![])[A(0xe1)](A(0x13e),'Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login',![])[A(0xe1)]('-n,\x20--name\x20[NAME]',A(0xe2))[A(0xe1)]('-t,\x20--token\x20[TOKEN]','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used')[A(0xe1)](A(0x11d),'host\x20url\x20for\x20this\x20context',this[A(0x110)])[A(0xe1)]('--override',A(0x126),![])[A(0xea)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const m=A;_[m(0xf0)](P,'host',this['sanitiseHostname'](P[m(0x111)]));const {name:h,host:L,token:R,override:w}=P[m(0x171)]||P[m(0xfe)]!==undefined?yield this[m(0x105)](P,g):yield this[m(0x178)](P,g);try{yield this[m(0x162)][m(0x135)]['addContext']({'name':h,'host':L,'token':R},w);}catch(Q){(0x0,utils_1[m(0x167)])(Q['message']);return;}!(yield this[m(0xef)]())?((0x0,utils_1[m(0x167)])(m(0x119)),yield this[m(0x162)][m(0x135)]['removeContext'](h)):(0x0,utils_1['success'])(m(0x149)+L+'\x20successful');})),this[A(0x157)]=(0x0,utils_1['getCommand'])()[A(0xf7)](A(0x175))[A(0x132)](A(0x16d))[A(0x140)](A(0x157))[A(0x140)]('ctx');const Z=(0x0,utils_1[A(0x15f)])()['name'](A(0x121))[A(0xf7)]('ls')['description'](A(0x127))['option'](A(0xee),'Shows\x20full\x20context\x20information\x20(including\x20tokens)')['action'](P=>__awaiter(this,void 0x0,void 0x0,function*(){const b=A;console['log'](I[b(0x135)][b(0x114)]());const h=I[b(0x135)][b(0x12a)]();if(P[b(0x13f)]===!![]){console[b(0x103)](h);return;}const L=h['current'],R=h[b(0x157)][b(0x107)]((w,Q)=>w[b(0xf7)]===L?-0x1:Q[b(0xf7)]===L?0x1:0x0)[b(0x148)](w=>{const O=b,Q=L===w[O(0xf7)]?O(0x120):'';return{'Name':''+w[O(0xf7)]+Q,'Host':w[O(0x111)],'Default\x20Project':w[O(0x138)]||'-','Default\x20Service':w[O(0xed)]||'-'};});(0x0,console_format_helpers_1[b(0x118)])(R,'Contexts');})),y=(0x0,utils_1['getCommand'])();y[A(0xf7)](A(0x12d))[A(0x132)]('Switch\x20between\x20your\x20local\x20contexts')[A(0xe1)](A(0x137),A(0x143))[A(0xea)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const V=A,h=(P===null||P===void 0x0?void 0x0:P[V(0xf7)])||(yield this[V(0x16f)](V(0x12d)));yield this[V(0x162)][V(0x135)][V(0xe7)](h),(0x0,utils_1[V(0x104)])('Changed\x20current\x20context\x20to\x20'+h);}));const i=A(0x131),t=(0x0,utils_1[A(0x15f)])()[A(0xf7)](A(0x138))[A(0x132)](A(0x117))['option'](i,A(0x10e))['action'](P=>__awaiter(this,void 0x0,void 0x0,function*(){const k=A,h=(P===null||P===void 0x0?void 0x0:P['id'])||(yield g[k(0xfb)]());yield this[k(0x162)][k(0x135)]['useProjectId'](h),console['log'](k(0x101),h);})),u=(0x0,utils_1[A(0x15f)])()[A(0xf7)]('service')['description']('Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context')[A(0xe1)](i,A(0x15d))[A(0xea)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const N=A,h=(P===null||P===void 0x0?void 0x0:P['id'])||(yield g[N(0x10f)](this[N(0x113)]())());console[N(0x10a)](N(0xdf),h),yield this[N(0x162)][N(0x135)][N(0x152)](h);})),v=(0x0,utils_1[A(0x15f)])()[A(0xf7)](A(0x154))[A(0x132)]('Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context')[A(0xe1)](i,'Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')[A(0xea)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const a=A,h=(P===null||P===void 0x0?void 0x0:P['id'])||(yield g[a(0x100)](this[a(0x113)]())());console[a(0x10a)](a(0x130),h),yield this[a(0x162)]['contextProvider'][a(0x13d)](h);}));y[A(0x115)](t),y['addCommand'](v),y['addCommand'](u);const M=(0x0,utils_1[A(0x15f)])()['name'](A(0x12e))['alias'](A(0x11c))[A(0x140)]('rm')[A(0x132)](A(0x164))['option'](i,'Local\x20context\x20name\x20to\x20remove.')[A(0xea)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const D=A;var h;const L=(P===null||P===void 0x0?void 0x0:P['id'])||(yield this[D(0x16f)](D(0x12e))),R=(h=this[D(0x162)][D(0x135)][D(0xe0)]())===null||h===void 0x0?void 0x0:h['name'];yield this[D(0x162)][D(0x135)][D(0x15e)](L),(0x0,utils_1[D(0x104)])(D(0xe6)+L+D(0xf8));if(!this[D(0x15a)]()){(0x0,utils_1[D(0x10d)])(D(0xf3));return;}if(R===L){const w=(P===null||P===void 0x0?void 0x0:P[D(0xf7)])||(yield this['askForContext'](D(0x165)));yield this['apiClient'][D(0x135)][D(0xe7)](w),(0x0,utils_1[D(0x104)])(D(0x12c)+w);}})),G=(0x0,utils_1['getCommand'])()[A(0xf7)]('update-token')[A(0x140)]('set-token')[A(0x132)](A(0x125))['option'](A(0x176),A(0x158))[A(0xea)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const H=A,{contextProvider:h}=this[H(0x162)],L=(P===null||P===void 0x0?void 0x0:P[H(0xfe)])||(yield g[H(0x147)]()),R=h[H(0x13a)]();yield h[H(0x177)](L);if(yield this[H(0xef)]())(0x0,utils_1[H(0x104)])(H(0x112)+h[H(0xfa)]()+H(0xe9));else{if(R)yield h['updateToken'](R);(0x0,utils_1[H(0x167)])(H(0xe3));}}));this['contexts'][A(0x115)](Z),this['contexts'][A(0x115)](y),this[A(0x157)][A(0x115)](M),this[A(0x157)]['addCommand'](G);}['browserLogin'](I,z){var g,Z,y,i;return __awaiter(this,void 0x0,void 0x0,function*(){const Y=a2z,t=!I[Y(0x12f)],u=(g=I[Y(0x111)])!==null&&g!==void 0x0?g:this[Y(0x110)],v=new browser_login_1['NorthflankApiBrowserLogin'](u,t);let M;v['on'](Y(0x15b),({url:L})=>{const r=Y;if(t){const R=L['replace'](/sessionToken=.*/,r(0x163));console[r(0x10a)]('Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20'+R+')'),M=inquirer['prompt']([{'type':'confirm','name':r(0x141),'message':r(0xfd),'default':![]}]),M[r(0x14d)](w=>{const X=r;process[X(0x13b)][X(0x11a)](0x0,-0x1),process[X(0x13b)][X(0x14b)](0x1),w['fullUrl']&&console['log'](X(0xf9)+L+'\x20');});}else console[r(0x10a)](r(0xf9)+L+'\x20');});const {token:G,contextName:P}=yield v[Y(0x16b)]()[Y(0xec)](L=>__awaiter(this,void 0x0,void 0x0,function*(){const l=Y;(0x0,utils_1[l(0x167)])(l(0x108)+L[l(0x129)]+l(0x16a));const R=yield this[l(0x105)](I,z);return{'token':R['token'],'contextName':R['name']};}))[Y(0x11e)](()=>{const S=Y;if(M)M['ui'][S(0x10b)]();}),h=(y=(Z=I[Y(0xf7)])!==null&&Z!==void 0x0?Z:P)!==null&&y!==void 0x0?y:Y(0x16c)+new Date()['valueOf']();return(0x0,utils_1[Y(0x104)])(Y(0x156)+chalk_1['default']['italic'](h)),{'name':h,'token':G,'host':u,'override':(i=I['override'])!==null&&i!==void 0x0?i:![]};});}[a2j(0x105)](I,z){return __awaiter(this,void 0x0,void 0x0,function*(){const e=a2z,g=this[e(0x162)][e(0x135)][e(0x12a)]()[e(0x157)],{name:Z,token:y,host:i,override:t}=yield z['loginPrompt'](I,g);return{'name':Z,'token':y,'host':i,'override':t};});}[a2j(0x113)](){const q=a2j,I=this[q(0x162)][q(0x135)][q(0x133)]();if(I===undefined)throw new Error(q(0xe5));return I;}['askForContext'](I){return __awaiter(this,void 0x0,void 0x0,function*(){const E=a2z;if(!this[E(0x15a)]())throw new Error(E(0xeb));const z=this[E(0x162)]['contextProvider'][E(0x12a)]()[E(0x157)][E(0x148)](Z=>Z[E(0xf7)]),g=z[E(0x170)]>0x4?E(0x144):E(0x121);return(yield inquirer[E(0x11b)]([{'type':g,'name':'name','message':'Choose\x20the\x20context\x20to\x20'+I+':','choices':z}]))[E(0xf7)];});}[a2j(0x15a)](){const W=a2j;return this[W(0x162)][W(0x135)]['loadContextWrapper']()[W(0x157)]['length']>0x0;}[a2j(0xef)](){return __awaiter(this,void 0x0,void 0x0,function*(){const B=a2z;try{const I=this[B(0x162)][B(0x135)][B(0x159)](),z=this[B(0x162)][B(0x135)][B(0x13a)](),g=I+B(0x14f),Z={'Authorization':'Bearer\x20'+z},y=yield(0x0,utils_1[B(0xf6)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const p=B;return(0x0,node_fetch_1['default'])(g,{'method':p(0x14e),'timeout':0xbb8,'headers':Z});}));if(y['ok'])return!![];return![];}catch(i){return![];}});}}exports[a2j(0x155)]=CliContext;
1
+ 'use strict';const a2n=a2V;(function(X,V){const F=a2V,h=X();while(!![]){try{const Q=-parseInt(F(0x1df))/0x1+-parseInt(F(0x1d7))/0x2+-parseInt(F(0x212))/0x3*(parseInt(F(0x21b))/0x4)+-parseInt(F(0x19b))/0x5+parseInt(F(0x227))/0x6*(-parseInt(F(0x1f0))/0x7)+-parseInt(F(0x1d3))/0x8*(parseInt(F(0x1c3))/0x9)+parseInt(F(0x199))/0xa;if(Q===V)break;else h['push'](h['shift']());}catch(J){h['push'](h['shift']());}}}(a2X,0x88d47));function a2V(X,V){const h=a2X();return a2V=function(Q,J){Q=Q-0x194;let G=h[Q];return G;},a2V(X,V);}var __createBinding=this&&this['__createBinding']||(Object[a2n(0x1bd)]?function(X,V,h,Q){const q=a2n;if(Q===undefined)Q=h;var J=Object[q(0x21e)](V,h);(!J||(q(0x1d9)in J?!V[q(0x1b2)]:J['writable']||J[q(0x1e0)]))&&(J={'enumerable':!![],'get':function(){return V[h];}}),Object['defineProperty'](X,Q,J);}:function(X,V,h,Q){if(Q===undefined)Q=h;X[Q]=V[h];}),__setModuleDefault=this&&this[a2n(0x1fa)]||(Object[a2n(0x1bd)]?function(X,V){const a=a2n;Object[a(0x1ce)](X,a(0x203),{'enumerable':!![],'value':V});}:function(X,V){X['default']=V;}),__importStar=this&&this['__importStar']||function(X){const R=a2n;if(X&&X['__esModule'])return X;var V={};if(X!=null){for(var h in X)if(h!=='default'&&Object[R(0x1a4)][R(0x208)]['call'](X,h))__createBinding(V,X,h);}return __setModuleDefault(V,X),V;},__awaiter=this&&this['__awaiter']||function(X,V,h,Q){function J(G){return G instanceof h?G:new h(function(I){I(G);});}return new(h||(h=Promise))(function(G,I){const B=a2V;function T(A){try{E(Q['next'](A));}catch(D){I(D);}}function W(A){const v=a2V;try{E(Q[v(0x1dc)](A));}catch(D){I(D);}}function E(A){const g=a2V;A[g(0x1ad)]?G(A['value']):J(A[g(0x22a)])['then'](T,W);}E((Q=Q[B(0x19c)](X,V||[]))[B(0x1b5)]());});},__importDefault=this&&this[a2n(0x228)]||function(X){const O=a2n;return X&&X[O(0x1b2)]?X:{'default':X};};Object[a2n(0x1ce)](exports,a2n(0x1b2),{'value':!![]}),exports[a2n(0x196)]=void 0x0;const _=__importStar(require(a2n(0x1b8))),node_fetch_1=__importDefault(require('node-fetch')),chalk_1=__importDefault(require(a2n(0x209))),utils_1=require(a2n(0x1db)),inquirer_helper_1=require(a2n(0x1e8)),console_format_helpers_1=require(a2n(0x22b)),browser_login_1=require(a2n(0x1f6)),inquirer=require(a2n(0x1e3));class CliContext{constructor(X,V=a2n(0x1fd)){const H=a2n;this[H(0x1b0)]=V,this[H(0x19e)]=P=>{const k=H;let D=P;return!/^https?:\/\//i['test'](D)&&(D=k(0x1c7)+D),D=D[k(0x1e4)](/\/+$/,''),D;},this[H(0x1e2)]=X;const h=new inquirer_helper_1[(H(0x20e))](X);this[H(0x1e1)]=(0x0,utils_1['getCommand'])()[H(0x19a)](H(0x1e1))[H(0x205)](H(0x1ff))[H(0x1d0)](H(0x1b3),H(0x1e9),![])['option'](H(0x224),H(0x1da),![])[H(0x1d0)](H(0x213),H(0x1b6))[H(0x1d0)](H(0x1f5),H(0x21d))[H(0x1d0)](H(0x201),H(0x1f4),this[H(0x1b0)])[H(0x1d0)](H(0x21c),'Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)',![])['action'](P=>__awaiter(this,void 0x0,void 0x0,function*(){const o=H;_[o(0x194)](P,o(0x1ae),this[o(0x19e)](P[o(0x1ae)]));const {name:D,host:K,token:d,override:f}=P['tokenLogin']||P[o(0x1d2)]!==undefined?yield this[o(0x222)](P,h):yield this[o(0x1d5)](P,h);try{yield this[o(0x1e2)][o(0x218)][o(0x1c1)]({'name':D,'host':K,'token':d},f);}catch(z){(0x0,utils_1['error'])(z['message']);return;}!(yield this[o(0x1cc)]())?((0x0,utils_1['error'])(o(0x1c9)),yield this['apiClient'][o(0x218)][o(0x1b9)](D)):(0x0,utils_1['success'])(o(0x1d4)+K+o(0x1ec));})),this['contexts']=(0x0,utils_1[H(0x210)])()[H(0x19a)](H(0x1ac))['description']('Retrieve\x20and\x20update\x20local\x20context\x20settings.')[H(0x1d6)]('contexts')[H(0x1d6)]('ctx');const Q=(0x0,utils_1[H(0x210)])()[H(0x19a)](H(0x225))[H(0x19a)]('ls')['description']('List\x20all\x20available\x20contexts')[H(0x1d0)](H(0x1bf),H(0x200))[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const N=H;console[N(0x1aa)](X[N(0x218)]['getInfo']());const D=X[N(0x218)]['loadContextWrapper']();if(P[N(0x211)]===!![]){console['dir'](D);return;}const K=D[N(0x1c0)],d=D[N(0x1ea)]['sort']((f,z)=>f[N(0x19a)]===K?-0x1:z[N(0x19a)]===K?0x1:0x0)[N(0x1c2)](f=>{const p=N,z=K===f[p(0x19a)]?p(0x226):'';return{'Name':''+f['name']+z,'Host':f['host'],'Default\x20Project':f[p(0x1eb)]||'-','Default\x20Service':f[p(0x1f1)]||'-'};});(0x0,console_format_helpers_1[N(0x1ef)])(d,N(0x206));})),J=(0x0,utils_1['getCommand'])();J['name'](H(0x204))['description'](H(0x1be))[H(0x1d0)]('-n,\x20--name\x20[NAME]',H(0x195))[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const i=H,D=(P===null||P===void 0x0?void 0x0:P['name'])||(yield this['askForContext'](i(0x204)));yield this[i(0x1e2)][i(0x218)][i(0x229)](D),(0x0,utils_1[i(0x1f9)])(i(0x1b7)+D);}));const G=H(0x20d),I=(0x0,utils_1[H(0x210)])()[H(0x19a)](H(0x1eb))[H(0x205)]('Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context')[H(0x1d0)](G,'Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const x=H,D=(P===null||P===void 0x0?void 0x0:P['id'])||(yield h['askForProject']());yield this[x(0x1e2)][x(0x218)][x(0x1a6)](D),console[x(0x1aa)]('Use\x20project\x20with\x20id:',D);})),T=(0x0,utils_1[H(0x210)])()[H(0x19a)](H(0x1f1))[H(0x205)](H(0x21a))[H(0x1d0)](G,H(0x1f7))[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const L=H,D=(P===null||P===void 0x0?void 0x0:P['id'])||(yield h['askForService'](this[L(0x1af)]())());console[L(0x1aa)](L(0x216),D),yield this[L(0x1e2)]['contextProvider'][L(0x1e7)](D);})),W=(0x0,utils_1['getCommand'])()[H(0x19a)]('job')[H(0x205)](H(0x1a8))[H(0x1d0)](G,H(0x1d8))[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const y=H,D=(P===null||P===void 0x0?void 0x0:P['id'])||(yield h[y(0x1c5)](this['getProjectName']())());console['log'](y(0x1a0),D),yield this[y(0x1e2)][y(0x218)][y(0x1a3)](D);}));J['addCommand'](I),J['addCommand'](W),J['addCommand'](T);const E=(0x0,utils_1[H(0x210)])()['name'](H(0x1cb))[H(0x1d6)](H(0x20a))[H(0x1d6)]('rm')[H(0x205)](H(0x1fe))['option'](G,H(0x1ba))[H(0x220)](P=>__awaiter(this,void 0x0,void 0x0,function*(){const M=H;var D;const K=(P===null||P===void 0x0?void 0x0:P['id'])||(yield this[M(0x22c)]('remove')),d=(D=this['apiClient']['contextProvider']['getCurrentContext']())===null||D===void 0x0?void 0x0:D[M(0x19a)];yield this['apiClient'][M(0x218)]['removeContext'](K),(0x0,utils_1[M(0x1f9)])('Local\x20context\x20\x27'+K+M(0x1a7));if(!this[M(0x1cf)]()){(0x0,utils_1['warning'])(M(0x1ca));return;}if(d===K){const f=(P===null||P===void 0x0?void 0x0:P[M(0x19a)])||(yield this['askForContext']('use\x20from\x20now\x20on'));yield this['apiClient'][M(0x218)][M(0x229)](f),(0x0,utils_1[M(0x1f9)])(M(0x1b7)+f);}})),A=(0x0,utils_1['getCommand'])()[H(0x19a)]('update-token')[H(0x1d6)](H(0x21f))[H(0x205)](H(0x20b))[H(0x1d0)]('-t,\x20--token\x20[TOKEN]',H(0x1fc))['action'](P=>__awaiter(this,void 0x0,void 0x0,function*(){const e=H,{contextProvider:D}=this['apiClient'],K=(P===null||P===void 0x0?void 0x0:P[e(0x1d2)])||(yield h[e(0x20c)]()),d=D[e(0x221)]();yield D[e(0x223)](K);if(yield this['verifyToken']())(0x0,utils_1[e(0x1f9)])('Token\x20for\x20current\x20context\x20\x27'+D[e(0x1c6)]()+'\x27\x20successfully\x20updated.');else{if(d)yield D[e(0x223)](d);(0x0,utils_1['error'])(e(0x215));}}));this[H(0x1ea)][H(0x1a9)](Q),this[H(0x1ea)][H(0x1a9)](J),this[H(0x1ea)][H(0x1a9)](E),this['contexts'][H(0x1a9)](A);}['browserLogin'](X,V){var h,Q,J,G;return __awaiter(this,void 0x0,void 0x0,function*(){const Z=a2V,I=!X[Z(0x1f3)],T=(h=X[Z(0x1ae)])!==null&&h!==void 0x0?h:this['defaultBaseUrl'],W=new browser_login_1[(Z(0x1a5))](T,I);let E;W['on'](Z(0x1d1),({url:K})=>{const C=Z;if(I){const d=K[C(0x1e4)](/sessionToken=.*/,'sessionToken=********');console[C(0x1aa)](C(0x19d)+d+')'),E=inquirer['prompt']([{'type':C(0x197),'name':'fullUrl','message':C(0x219),'default':![]}]),E['then'](f=>{const u=C;process[u(0x20f)][u(0x1ed)](0x0,-0x1),process[u(0x20f)][u(0x1cd)](0x1),f['fullUrl']&&console[u(0x1aa)](u(0x19f)+K+'\x20');});}else console[C(0x1aa)]('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+K+'\x20');});const {token:A,contextName:P}=yield W[Z(0x217)]()[Z(0x1e5)](K=>__awaiter(this,void 0x0,void 0x0,function*(){const c=Z;(0x0,utils_1[c(0x1f8)])('Error\x20occured\x20during\x20browser\x20login:\x20'+K[c(0x1fb)]+c(0x1bc));const d=yield this[c(0x222)](X,V);return{'token':d[c(0x1d2)],'contextName':d[c(0x19a)]};}))[Z(0x1bb)](()=>{const Y=Z;if(E)E['ui'][Y(0x1f2)]();}),D=(J=(Q=X[Z(0x19a)])!==null&&Q!==void 0x0?Q:P)!==null&&J!==void 0x0?J:'autologin-'+new Date()[Z(0x1e6)]();return(0x0,utils_1[Z(0x1f9)])(Z(0x214)+chalk_1['default'][Z(0x1a1)](D)),{'name':D,'token':A,'host':T,'override':(G=X[Z(0x1c4)])!==null&&G!==void 0x0?G:![]};});}[a2n(0x222)](X,V){return __awaiter(this,void 0x0,void 0x0,function*(){const j=a2V,h=this[j(0x1e2)][j(0x218)][j(0x1b1)]()[j(0x1ea)],{name:Q,token:J,host:G,override:I}=yield V[j(0x207)](X,h);return{'name':Q,'token':J,'host':G,'override':I};});}[a2n(0x1af)](){const b=a2n,X=this[b(0x1e2)][b(0x218)][b(0x202)]();if(X===undefined)throw new Error(b(0x1ee));return X;}[a2n(0x22c)](X){return __awaiter(this,void 0x0,void 0x0,function*(){const s=a2V;if(!this[s(0x1cf)]())throw new Error(s(0x1de));const V=this[s(0x1e2)][s(0x218)][s(0x1b1)]()['contexts'][s(0x1c2)](Q=>Q['name']),h=V[s(0x1b4)]>0x4?'search-list':s(0x225);return(yield inquirer[s(0x198)]([{'type':h,'name':s(0x19a),'message':s(0x1c8)+X+':','choices':V}]))[s(0x19a)];});}[a2n(0x1cf)](){const w=a2n;return this[w(0x1e2)][w(0x218)][w(0x1b1)]()['contexts'][w(0x1b4)]>0x0;}[a2n(0x1cc)](){return __awaiter(this,void 0x0,void 0x0,function*(){const m=a2V;try{const X=this['apiClient']['contextProvider']['getCurrentBaseUrl'](),V=this['apiClient']['contextProvider']['getCurrentToken'](),h=X+'/v1/login',Q={'Authorization':m(0x1dd)+V},J=yield(0x0,utils_1[m(0x1ab)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const r=m;return(0x0,node_fetch_1[r(0x203)])(h,{'method':r(0x1a2),'timeout':0xbb8,'headers':Q});}));if(J['ok'])return!![];return![];}catch(G){return![];}});}}exports[a2n(0x196)]=CliContext;function a2X(){const l=['action','getCurrentToken','apiTokenLogin','updateToken','--do-not-open-browser','list','\x20(current)','6doozqi','__importDefault','useContext','value','../formatting/console-format-helpers','askForContext','set','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','CliContext','confirm','prompt','44644330sbanwn','name','4926025hubAFB','apply','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','sanitiseHostname','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','Use\x20job\x20with\x20id:','italic','GET','useJobId','prototype','NorthflankApiBrowserLogin','useProjectId','\x27\x20successfully\x20removed.','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','addCommand','log','retry','context','done','host','getProjectName','defaultBaseUrl','loadContextWrapper','__esModule','--token-login','length','next','Name\x20for\x20login\x20context','Changed\x20current\x20context\x20to\x20','lodash','removeContext','Local\x20context\x20name\x20to\x20remove.','finally','.\x20Using\x20fallback.','create','Switch\x20between\x20your\x20local\x20contexts','--all','current','addContext','map','34011EldDOS','override','askForJob','getCurrentName','https://','Choose\x20the\x20context\x20to\x20','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','remove','verifyToken','clearLine','defineProperty','contextAvailable','option','browser-opened','token','536bhWzdl','Login\x20to\x20','browserLogin','alias','2088364YReVhB','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','get','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','../utils','throw','Bearer\x20','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','512611cWTlVA','configurable','login','apiClient','inquirer','replace','catch','valueOf','useServiceId','../inquirer-helper','Use\x20manual\x20login\x20with\x20API\x20token','contexts','project','\x20successful','moveCursor','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','printAsTable','2018443wdccBr','service','close','doNotOpenBrowser','host\x20url\x20for\x20this\x20context','-t,\x20--token\x20[TOKEN]','../login/browser-login','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','error','success','__setModuleDefault','message','Token\x20for\x20this\x20context','https://api.northflank.com','Remove\x20a\x20context','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','Shows\x20full\x20context\x20information\x20(including\x20tokens)','--host\x20[HOST]','getCurrentProjectName','default','use','description','Contexts','loginPrompt','hasOwnProperty','chalk','delete','Update\x20token\x20for\x20current\x20context','tokenPrompt','-i,\x20--id\x20[ID]','InquirerHelper','stdout','getCommand','all','66522zbeaqI','-n,\x20--name\x20[NAME]','\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','Use\x20service\x20with\x20id:','startLogin','contextProvider','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','148qqTHAC','--override','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','getOwnPropertyDescriptor','set-token'];a2X=function(){return l;};return a2X();}