@northflank/cli 0.10.4 → 0.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 'use strict';const a0Z3=a0K;(function(Z,K){const Z2=a0K,O=Z();while(!![]){try{const g=-parseInt(Z2(0xd4))/0x1*(-parseInt(Z2(0xc8))/0x2)+-parseInt(Z2(0xc7))/0x3+-parseInt(Z2(0x9c))/0x4*(-parseInt(Z2(0xd9))/0x5)+-parseInt(Z2(0xba))/0x6+parseInt(Z2(0xbf))/0x7+parseInt(Z2(0xc3))/0x8+parseInt(Z2(0xcd))/0x9*(-parseInt(Z2(0xc0))/0xa);if(g===K)break;else O['push'](O['shift']());}catch(N){O['push'](O['shift']());}}}(a0Z,0x9239e));function a0K(Z,K){const O=a0Z();return a0K=function(g,N){g=g-0x9c;let H=O[g];return H;},a0K(Z,K);}var __awaiter=this&&this[a0Z3(0xbd)]||function(Z,K,O,g){function N(H){return H instanceof O?H:new O(function(o){o(H);});}return new(O||(O=Promise))(function(H,o){function s(W){const Z4=a0K;try{y(g[Z4(0x9f)](W));}catch(B){o(B);}}function R(W){const Z5=a0K;try{y(g[Z5(0xd0)](W));}catch(B){o(B);}}function y(W){const Z6=a0K;W[Z6(0xd7)]?H(W[Z6(0xda)]):N(W[Z6(0xda)])[Z6(0xbb)](s,R);}y((g=g['apply'](Z,K||[]))['next']());});};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['fetchResourceList']=void 0x0;const utils_1=require(a0Z3(0x9d)),defaultPaginationPageSize=0x64,getProjects=Z=>K=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z7=a0Z3;var O;const g=yield Z[Z7(0xa5)][Z7(0xb2)]({'options':{'per_page':defaultPaginationPageSize,'cursor':K===null||K===void 0x0?void 0x0:K['nextPageCursor']}});return{'elements':g['data']['projects']['map'](N=>N['id']),'nextPageCursor':(O=g['pagination'])===null||O===void 0x0?void 0x0:O[Z7(0xd5)]};}),getServices=(Z,K)=>O=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z8=a0Z3;var g;const N=yield Z[Z8(0xa5)]['services']({'parameters':{'projectId':K},'options':{'per_page':defaultPaginationPageSize,'cursor':O===null||O===void 0x0?void 0x0:O[Z8(0xb7)]}});return{'elements':N[Z8(0xae)]['services'][Z8(0xdc)](H=>H['id']),'nextPageCursor':(g=N[Z8(0xa7)])===null||g===void 0x0?void 0x0:g[Z8(0xd5)]};}),getAddons=(Z,K)=>O=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z9=a0Z3;var g;const N=yield Z[Z9(0xa5)][Z9(0xa9)]({'parameters':{'projectId':K},'options':{'per_page':defaultPaginationPageSize,'cursor':O===null||O===void 0x0?void 0x0:O[Z9(0xb7)]}});return{'elements':N[Z9(0xae)][Z9(0xa9)][Z9(0xdc)](H=>H['id']),'nextPageCursor':(g=N[Z9(0xa7)])===null||g===void 0x0?void 0x0:g[Z9(0xd5)]};}),getAddonBackups=(Z,K,O)=>g=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const ZZ=a0Z3;var N;const H=yield Z[ZZ(0xad)]['addon']['backups']({'parameters':{'projectId':K,'addonId':O},'options':{'per_page':defaultPaginationPageSize,'cursor':g===null||g===void 0x0?void 0x0:g[ZZ(0xb7)]}});return{'elements':H[ZZ(0xae)][ZZ(0xb4)][ZZ(0xdc)](o=>o['id']),'nextPageCursor':(N=H[ZZ(0xa7)])===null||N===void 0x0?void 0x0:N[ZZ(0xd5)]};});function fetchResourceList(Z,K,O,g,N,H){var o,s,R,y,W,B,V,M,I,c,E,p;return __awaiter(this,void 0x0,void 0x0,function*(){const ZK=a0K,T=undefined;try{if(Z===ZK(0xc2)){const C=yield K[ZK(0xa5)][ZK(0xca)]({}),S=C[ZK(0xae)][ZK(0xca)][ZK(0xdc)](n=>{const ZO=ZK;var k;return(k=n===null||n===void 0x0?void 0x0:n[ZO(0xd2)])!==null&&k!==void 0x0?k:n===null||n===void 0x0?void 0x0:n['id'];});return{'choices':S,'defaultValue':T};}if(Z===ZK(0xa1)&&!(O===null||O===void 0x0?void 0x0:O[ZK(0xaf)](ZK(0xb1)))){const n=yield K[ZK(0xa5)][ZK(0x9e)]({}),k=n[ZK(0xae)]['regions'][ZK(0xdc)](x=>{const Zg=ZK;var m;return(m=x===null||x===void 0x0?void 0x0:x[Zg(0xd2)])!==null&&m!==void 0x0?m:x===null||x===void 0x0?void 0x0:x['id'];});return{'choices':k,'defaultValue':T};}if(Z===ZK(0xa3)){const x=yield getProjects(K),{elements:m,nextPageCursor:r}=yield x();return{'choices':m,'defaultValue':T,'pagination':{'nextPageCursor':r,'loadMore':x}};}if(Z===ZK(0xab)){const D=yield K[ZK(0xa5)][ZK(0xa2)]({}),d=D['data'][ZK(0xab)][ZK(0xdc)](b=>b['id']);return{'choices':d,'defaultValue':T};}const J=N===null||N===void 0x0?void 0x0:N[ZK(0xa3)],q=Z===ZK(0xb8)||Z==='id'&&(H===null||H===void 0x0?void 0x0:H[ZK(0xaf)](ZK(0xc1)));if(J!==undefined&&q){const b=yield getServices(K,J),{elements:l,nextPageCursor:f}=yield b();return{'choices':l,'defaultValue':T,'pagination':{'nextPageCursor':f,'loadMore':b}};}const Y=O===null||O===void 0x0?void 0x0:O[ZK(0xaf)](ZK(0xdb));if(Y){const a=v=>__awaiter(this,void 0x0,void 0x0,function*(){const ZN=ZK;var L;const X=yield K[ZN(0xad)][ZN(0xdb)][ZN(0xc4)]({});return(L=X['data'][ZN(0xce)])===null||L===void 0x0?void 0x0:L['map'](U=>U[ZN(0xa8)])['find'](U=>U['type']===v);});if(Z===ZK(0xa8)){const v=yield K[ZK(0xad)]['addon']['types']({}),L=(o=v['data'][ZK(0xce)])===null||o===void 0x0?void 0x0:o[ZK(0xdc)](X=>X[ZK(0xa8)]);return{'choices':L,'defaultValue':T};}if(Z==='version'&&(g===null||g===void 0x0?void 0x0:g[ZK(0xa8)])!==undefined){const X=(s=yield a(g[ZK(0xa8)]))===null||s===void 0x0?void 0x0:s[ZK(0xcf)],U=X!==undefined?[ZK(0xb3),...X]:undefined;return{'choices':U,'defaultValue':T};}if(Z===ZK(0xac)&&(g===null||g===void 0x0?void 0x0:g['type'])!==undefined){const i=(y=(R=yield a(g['type']))===null||R===void 0x0?void 0x0:R[ZK(0xa6)])===null||y===void 0x0?void 0x0:y[ZK(0xac)];return{'choices':i===null||i===void 0x0?void 0x0:i[ZK(0xaa)],'defaultValue':i===null||i===void 0x0?void 0x0:i[ZK(0xd1)]};}if(Z===ZK(0xc6)&&(g===null||g===void 0x0?void 0x0:g[ZK(0xa8)])!==undefined){const z=(B=(W=yield a(g[ZK(0xa8)]))===null||W===void 0x0?void 0x0:W['resources'])===null||B===void 0x0?void 0x0:B['replicas'];return{'choices':z===null||z===void 0x0?void 0x0:z['options'],'defaultValue':z===null||z===void 0x0?void 0x0:z[ZK(0xd1)]};}}if(Z===ZK(0xb9)&&(N===null||N===void 0x0?void 0x0:N['projectId'])!==undefined){const j=yield getAddons(K,N===null||N===void 0x0?void 0x0:N[ZK(0xa3)]),{elements:G,nextPageCursor:w}=yield j();return{'choices':G,'defaultValue':T,'pagination':{'nextPageCursor':w,'loadMore':j}};}if(Z===ZK(0xb6)&&(N===null||N===void 0x0?void 0x0:N[ZK(0xa3)])!==undefined&&((V=g===null||g===void 0x0?void 0x0:g[ZK(0xd3)])===null||V===void 0x0?void 0x0:V[ZK(0xb9)])!==undefined){const Q=yield getAddonBackups(K,N===null||N===void 0x0?void 0x0:N['projectId'],(M=g===null||g===void 0x0?void 0x0:g['source'])===null||M===void 0x0?void 0x0:M[ZK(0xb9)]),{elements:u,nextPageCursor:F}=yield Q();return{'choices':u,'defaultValue':T,'pagination':{'nextPageCursor':F,'loadMore':Q}};}const P=(I=N===null||N===void 0x0?void 0x0:N[ZK(0xb9)])!==null&&I!==void 0x0?I:(c=g===null||g===void 0x0?void 0x0:g[ZK(0xb0)])===null||c===void 0x0?void 0x0:c['addonId'];if((O===null||O===void 0x0?void 0x0:O[ZK(0xcb)](''))===ZK(0xc9)&&Z===ZK(0xcc)&&(N===null||N===void 0x0?void 0x0:N['projectId'])!==undefined&&P!==undefined){const {upgradeTo:A}=(yield K[ZK(0xad)][ZK(0xdb)]['version']({'parameters':{'addonId':P,'projectId':N===null||N===void 0x0?void 0x0:N[ZK(0xa3)]}}))[ZK(0xae)];if(A===undefined||A['length']<=0x0){(0x0,utils_1['warning'])('No\x20available\x20versions\x20to\x20upgrade\x20to.');throw new Error();}return{'choices':A['map'](h=>h[ZK(0xcc)]),'defaultValue':T};}if(Z===ZK(0xd8)){const h=yield K[ZK(0xa5)][ZK(0xc5)]({}),t=h[ZK(0xae)]['templates']['map'](Z0=>Z0===null||Z0===void 0x0?void 0x0:Z0['id']);return{'choices':t,'defaultValue':T};}if(((O===null||O===void 0x0?void 0x0:O[ZK(0xaf)]('secretLink'))||(O===null||O===void 0x0?void 0x0:O['includes'](ZK(0xd6))))&&Z===ZK(0xbe)&&P!==undefined&&(N===null||N===void 0x0?void 0x0:N['projectId'])!==undefined){const Z0=(yield K[ZK(0xad)][ZK(0xdb)]['credentials']({'parameters':{'addonId':P,'projectId':N===null||N===void 0x0?void 0x0:N['projectId']}}))[ZK(0xae)];return{'choices':[...(E=Object[ZK(0xbc)](Z0===null||Z0===void 0x0?void 0x0:Z0[ZK(0xa4)]))!==null&&E!==void 0x0?E:[],...(p=Object[ZK(0xbc)](Z0===null||Z0===void 0x0?void 0x0:Z0[ZK(0xb5)]))!==null&&p!==void 0x0?p:[]]};}}catch(Z1){}return{'choices':undefined,'defaultValue':T};});}function a0Z(){const ZH=['replicas','2457822QawYDc','2778BHZOfO','updateaddonversion','plans','join','version','6633XZUrqk','addonTypes','versions','throw','default','internalId','source','535pQqjDr','cursor','secret','done','templateId','167665LNXMPw','value','addon','map','88WBRCIV','./utils','regions','next','fetchResourceList','region','registryCredentials','projectId','envs','list','resources','pagination','type','addons','options','credentials','storage','get','data','includes','addonDependencies','logSink','projects','latest','backups','secrets','backupId','nextPageCursor','serviceId','addonId','1485882ZqSOwP','then','keys','__awaiter','keyName','869442rDfSXx','4410qrWsmY','owningObject','deploymentPlan','3086664CDkdna','types','templates'];a0Z=function(){return ZH;};return a0Z();}exports[a0Z3(0xa0)]=fetchResourceList;
1
+ 'use strict';const a0O2=a0g;(function(O,g){const O1=a0g,R=O();while(!![]){try{const Y=-parseInt(O1(0x17d))/0x1+parseInt(O1(0x1a3))/0x2+-parseInt(O1(0x193))/0x3*(parseInt(O1(0x19c))/0x4)+-parseInt(O1(0x1a8))/0x5+-parseInt(O1(0x1a0))/0x6+-parseInt(O1(0x1af))/0x7+parseInt(O1(0x18b))/0x8;if(Y===g)break;else R['push'](R['shift']());}catch(y){R['push'](R['shift']());}}}(a0O,0xd3815));var __awaiter=this&&this[a0O2(0x1a1)]||function(O,g,R,Y){function y(n){return n instanceof R?n:new R(function(G){G(n);});}return new(R||(R=Promise))(function(n,G){const O5=a0g;function S(L){const O3=a0g;try{V(Y[O3(0x19b)](L));}catch(N){G(N);}}function q(L){try{V(Y['throw'](L));}catch(N){G(N);}}function V(e){const O4=a0g;e[O4(0x188)]?n(e[O4(0x195)]):y(e['value'])[O4(0x19e)](S,q);}V((Y=Y[O5(0x197)](O,g||[]))[O5(0x19b)]());});};Object['defineProperty'](exports,a0O2(0x1a9),{'value':!![]}),exports[a0O2(0x185)]=void 0x0;const utils_1=require(a0O2(0x17c)),defaultPaginationPageSize=0x64,getProjects=O=>g=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const O6=a0O2;var R;const Y=yield O[O6(0x199)]['projects']({'options':{'per_page':defaultPaginationPageSize,'cursor':g===null||g===void 0x0?void 0x0:g[O6(0x194)]}});return{'elements':Y[O6(0x178)]['projects']['map'](y=>y['id']),'nextPageCursor':(R=Y['pagination'])===null||R===void 0x0?void 0x0:R[O6(0x187)]};}),getServices=(O,g)=>R=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const O7=a0O2;var Y;const y=yield O[O7(0x199)][O7(0x175)]({'parameters':{'projectId':g},'options':{'per_page':defaultPaginationPageSize,'cursor':R===null||R===void 0x0?void 0x0:R['nextPageCursor']}});return{'elements':y['data'][O7(0x175)]['map'](n=>n['id']),'nextPageCursor':(Y=y[O7(0x180)])===null||Y===void 0x0?void 0x0:Y['cursor']};}),getAddons=(O,g)=>R=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const O8=a0O2;var Y;const y=yield O[O8(0x199)][O8(0x179)]({'parameters':{'projectId':g},'options':{'per_page':defaultPaginationPageSize,'cursor':R===null||R===void 0x0?void 0x0:R[O8(0x194)]}});return{'elements':y[O8(0x178)][O8(0x179)][O8(0x189)](n=>n['id']),'nextPageCursor':(Y=y[O8(0x180)])===null||Y===void 0x0?void 0x0:Y['cursor']};}),getAddonBackups=(O,g,R)=>Y=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const O9=a0O2;var y;const n=yield O[O9(0x18e)][O9(0x1ae)][O9(0x18f)]({'parameters':{'projectId':g,'addonId':R},'options':{'per_page':defaultPaginationPageSize,'cursor':Y===null||Y===void 0x0?void 0x0:Y['nextPageCursor']}});return{'elements':n[O9(0x178)][O9(0x18f)][O9(0x189)](G=>G['id']),'nextPageCursor':(y=n[O9(0x180)])===null||y===void 0x0?void 0x0:y['cursor']};});function a0g(O,g){const R=a0O();return a0g=function(Y,y){Y=Y-0x174;let n=R[Y];return n;},a0g(O,g);}function a0O(){const Oy=['__esModule','join','latest','updateaddonversion','keyName','addon','2605533mgLpCG','internalId','secretLink','resources','services','owningObject','types','data','addons','No\x20available\x20versions\x20to\x20upgrade\x20to.','keys','./utils','692115ScexMo','version','secrets','pagination','replicas','regions','addonTypes','warning','fetchResourceList','templateId','cursor','done','map','addonId','26807504zwvQGz','registryCredentials','projectId','get','backups','length','storage','credentials','12oCpHKU','nextPageCursor','value','deploymentPlan','apply','type','list','backupId','next','1660552nESalS','envs','then','region','7533234FlJYkV','__awaiter','plans','3331664EzmdNf','includes','templates','default','find','850100LvzdRx'];a0O=function(){return Oy;};return a0O();}function fetchResourceList(O,g,R,Y,y,n){var G,S,q,V,e,L,N,b,E,p,F,m;return __awaiter(this,void 0x0,void 0x0,function*(){const OO=a0g,o=undefined;try{if(O===OO(0x196)){const X=yield g[OO(0x199)][OO(0x1a2)]({}),M=X[OO(0x178)]['plans']['map'](l=>{const Og=OO;var C;return(C=l===null||l===void 0x0?void 0x0:l[Og(0x1b0)])!==null&&C!==void 0x0?C:l===null||l===void 0x0?void 0x0:l['id'];});return{'choices':M,'defaultValue':o};}if(O===OO(0x19f)&&!(R===null||R===void 0x0?void 0x0:R['includes']('logSink'))){const l=yield g[OO(0x199)][OO(0x182)]({}),C=l[OO(0x178)][OO(0x182)][OO(0x189)](K=>{const OR=OO;var H;return(H=K===null||K===void 0x0?void 0x0:K[OR(0x1b0)])!==null&&H!==void 0x0?H:K===null||K===void 0x0?void 0x0:K['id'];});return{'choices':C,'defaultValue':o};}if(O===OO(0x18d)){const K=yield getProjects(g),{elements:H,nextPageCursor:f}=yield K();return{'choices':H,'defaultValue':o,'pagination':{'nextPageCursor':f,'loadMore':K}};}if(O===OO(0x192)){const i=yield g['list'][OO(0x18c)]({}),A=i[OO(0x178)][OO(0x192)]['map'](Z=>Z['id']);return{'choices':A,'defaultValue':o};}const v=y===null||y===void 0x0?void 0x0:y[OO(0x18d)],a=O==='serviceId'||O==='id'&&(n===null||n===void 0x0?void 0x0:n['includes'](OO(0x176)));if(v!==undefined&&a){const Z=yield getServices(g,v),{elements:c,nextPageCursor:U}=yield Z();return{'choices':c,'defaultValue':o,'pagination':{'nextPageCursor':U,'loadMore':Z}};}const z=R===null||R===void 0x0?void 0x0:R[OO(0x1a4)](OO(0x1ae));if(z){const d=r=>__awaiter(this,void 0x0,void 0x0,function*(){const OY=OO;var j;const t=yield g[OY(0x18e)]['addon'][OY(0x177)]({});return(j=t[OY(0x178)]['addonTypes'])===null||j===void 0x0?void 0x0:j[OY(0x189)](Q=>Q['type'])[OY(0x1a7)](Q=>Q[OY(0x198)]===r);});if(O==='type'){const r=yield g['get'][OO(0x1ae)][OO(0x177)]({}),j=(G=r[OO(0x178)][OO(0x183)])===null||G===void 0x0?void 0x0:G['map'](t=>t[OO(0x198)]);return{'choices':j,'defaultValue':o};}if(O===OO(0x17e)&&(Y===null||Y===void 0x0?void 0x0:Y[OO(0x198)])!==undefined){const t=(S=yield d(Y[OO(0x198)]))===null||S===void 0x0?void 0x0:S['versions'],Q=t!==undefined?[OO(0x1ab),...t]:undefined;return{'choices':Q,'defaultValue':o};}if(O===OO(0x191)&&(Y===null||Y===void 0x0?void 0x0:Y[OO(0x198)])!==undefined){const T=(V=(q=yield d(Y[OO(0x198)]))===null||q===void 0x0?void 0x0:q[OO(0x174)])===null||V===void 0x0?void 0x0:V[OO(0x191)];return{'choices':T===null||T===void 0x0?void 0x0:T['options'],'defaultValue':T===null||T===void 0x0?void 0x0:T['default']};}if(O==='replicas'&&(Y===null||Y===void 0x0?void 0x0:Y[OO(0x198)])!==undefined){const u=(L=(e=yield d(Y['type']))===null||e===void 0x0?void 0x0:e[OO(0x174)])===null||L===void 0x0?void 0x0:L[OO(0x181)];return{'choices':u===null||u===void 0x0?void 0x0:u['options'],'defaultValue':u===null||u===void 0x0?void 0x0:u[OO(0x1a6)]};}}if(O===OO(0x18a)&&(y===null||y===void 0x0?void 0x0:y[OO(0x18d)])!==undefined){const I=yield getAddons(g,y===null||y===void 0x0?void 0x0:y[OO(0x18d)]),{elements:x,nextPageCursor:k}=yield I();return{'choices':x,'defaultValue':o,'pagination':{'nextPageCursor':k,'loadMore':I}};}if(O===OO(0x19a)&&(y===null||y===void 0x0?void 0x0:y[OO(0x18d)])!==undefined&&((N=Y===null||Y===void 0x0?void 0x0:Y['source'])===null||N===void 0x0?void 0x0:N[OO(0x18a)])!==undefined){const s=yield getAddonBackups(g,y===null||y===void 0x0?void 0x0:y[OO(0x18d)],(b=Y===null||Y===void 0x0?void 0x0:Y['source'])===null||b===void 0x0?void 0x0:b['addonId']),{elements:P,nextPageCursor:B}=yield s();return{'choices':P,'defaultValue':o,'pagination':{'nextPageCursor':B,'loadMore':s}};}const W=(E=y===null||y===void 0x0?void 0x0:y[OO(0x18a)])!==null&&E!==void 0x0?E:(p=Y===null||Y===void 0x0?void 0x0:Y['addonDependencies'])===null||p===void 0x0?void 0x0:p[OO(0x18a)];if((R===null||R===void 0x0?void 0x0:R[OO(0x1aa)](''))===OO(0x1ac)&&O===OO(0x17e)&&(y===null||y===void 0x0?void 0x0:y[OO(0x18d)])!==undefined&&W!==undefined){const {upgradeTo:w}=(yield g[OO(0x18e)][OO(0x1ae)][OO(0x17e)]({'parameters':{'addonId':W,'projectId':y===null||y===void 0x0?void 0x0:y[OO(0x18d)]}}))[OO(0x178)];if(w===undefined||w[OO(0x190)]<=0x0){(0x0,utils_1[OO(0x184)])(OO(0x17a));throw new Error();}return{'choices':w[OO(0x189)](J=>J[OO(0x17e)]),'defaultValue':o};}if(O===OO(0x186)){const J=yield g[OO(0x199)][OO(0x1a5)]({}),h=J[OO(0x178)][OO(0x1a5)][OO(0x189)](D=>D===null||D===void 0x0?void 0x0:D['id']);return{'choices':h,'defaultValue':o};}if(((R===null||R===void 0x0?void 0x0:R[OO(0x1a4)](OO(0x1b1)))||(R===null||R===void 0x0?void 0x0:R[OO(0x1a4)]('secret')))&&O===OO(0x1ad)&&W!==undefined&&(y===null||y===void 0x0?void 0x0:y[OO(0x18d)])!==undefined){const D=(yield g['get'][OO(0x1ae)][OO(0x192)]({'parameters':{'addonId':W,'projectId':y===null||y===void 0x0?void 0x0:y[OO(0x18d)]}}))[OO(0x178)];return{'choices':[...(F=Object[OO(0x17b)](D===null||D===void 0x0?void 0x0:D[OO(0x19d)]))!==null&&F!==void 0x0?F:[],...(m=Object[OO(0x17b)](D===null||D===void 0x0?void 0x0:D[OO(0x17f)]))!==null&&m!==void 0x0?m:[]]};}}catch(O0){}return{'choices':undefined,'defaultValue':o};});}exports[a0O2(0x185)]=fetchResourceList;
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env -S node --no-deprecation
2
- 'use strict';const a1ZV=a1K;(function(Z,K){const ZB=a1K,O=Z();while(!![]){try{const g=parseInt(ZB(0x10b))/0x1*(parseInt(ZB(0x19d))/0x2)+parseInt(ZB(0x126))/0x3+parseInt(ZB(0x142))/0x4+parseInt(ZB(0x141))/0x5*(-parseInt(ZB(0x18c))/0x6)+-parseInt(ZB(0x1c8))/0x7*(-parseInt(ZB(0x17e))/0x8)+-parseInt(ZB(0x1a9))/0x9*(parseInt(ZB(0x11d))/0xa)+-parseInt(ZB(0x132))/0xb*(parseInt(ZB(0xeb))/0xc);if(g===K)break;else O['push'](O['shift']());}catch(N){O['push'](O['shift']());}}}(a1Z,0xe02f1));function a1K(Z,K){const O=a1Z();return a1K=function(g,N){g=g-0xe7;let H=O[g];return H;},a1K(Z,K);}var __createBinding=this&&this[a1ZV(0xf7)]||(Object[a1ZV(0x177)]?function(Z,K,O,g){const ZM=a1ZV;if(g===undefined)g=O;var N=Object[ZM(0x1b7)](K,O);(!N||(ZM(0x117)in N?!K[ZM(0x1d7)]:N[ZM(0x14d)]||N[ZM(0x122)]))&&(N={'enumerable':!![],'get':function(){return K[O];}}),Object[ZM(0x12e)](Z,g,N);}:function(Z,K,O,g){if(g===undefined)g=O;Z[g]=K[O];}),__setModuleDefault=this&&this[a1ZV(0x136)]||(Object[a1ZV(0x177)]?function(Z,K){const ZI=a1ZV;Object['defineProperty'](Z,ZI(0x1b4),{'enumerable':!![],'value':K});}:function(Z,K){const Zc=a1ZV;Z[Zc(0x1b4)]=K;}),__importStar=this&&this[a1ZV(0x172)]||function(Z){const ZE=a1ZV;if(Z&&Z['__esModule'])return Z;var K={};if(Z!=null){for(var O in Z)if(O!==ZE(0x1b4)&&Object[ZE(0x11b)]['hasOwnProperty'][ZE(0x1a6)](Z,O))__createBinding(K,Z,O);}return __setModuleDefault(K,Z),K;},__awaiter=this&&this[a1ZV(0x1ac)]||function(Z,K,O,g){function N(H){return H instanceof O?H:new O(function(o){o(H);});}return new(O||(O=Promise))(function(H,o){const Zq=a1K;function s(W){const Zp=a1K;try{y(g[Zp(0xfb)](W));}catch(B){o(B);}}function R(W){const ZT=a1K;try{y(g[ZT(0xfc)](W));}catch(B){o(B);}}function y(W){const ZJ=a1K;W['done']?H(W['value']):N(W[ZJ(0x105)])['then'](s,R);}y((g=g[Zq(0x186)](Z,K||[]))[Zq(0xfb)]());});},__importDefault=this&&this[a1ZV(0x174)]||function(Z){const ZY=a1ZV;return Z&&Z[ZY(0x1d7)]?Z:{'default':Z};};Object[a1ZV(0x12e)](exports,a1ZV(0x1d7),{'value':!![]}),exports[a1ZV(0x13f)]=void 0x0;const js_client_1=require('@northflank/js-client'),commander_1=__importDefault(require(a1ZV(0xf5))),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require(a1ZV(0x193))),_=__importStar(require(a1ZV(0xf1))),contextCommands_1=require('./context/contextCommands'),utils_1=require('./utils'),defaults=__importStar(require(a1ZV(0x1e6))),inquirer_helper_1=require(a1ZV(0x107)),console_format_helpers_1=require(a1ZV(0x1d4)),command_overview_1=require(a1ZV(0x16a)),port_forward_1=require('./port-forward'),exec_1=require(a1ZV(0x106)),logs_1=require(a1ZV(0x1b6)),metrics_1=require(a1ZV(0x192)),copy_1=require(a1ZV(0x1c3)),yaml=require(a1ZV(0x10c)),pgk=require(a1ZV(0x103)),getProgram=Z=>{const ZP=a1ZV,K=new commander_1[(ZP(0x1b4))][(ZP(0x1c0))](ZP(0x12d));K[ZP(0x1bd)](ZP(0x1d0)),K[ZP(0x16b)](!![]),K[ZP(0x183)](ZP(0x1dd)+chalk_1[ZP(0x1b4)][ZP(0x150)](pgk[ZP(0x183)]),'-v,\x20--version',ZP(0x111));const O=new js_client_1[(ZP(0x165))](Z,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1['customUserAgent'],'agent':utils_1[ZP(0x13b)]}),g=new contextCommands_1['CliContext'](O,utils_1[ZP(0x13b)]),N=new port_forward_1[(ZP(0x1e9))](Z,utils_1[ZP(0x13b)]),H=new exec_1[(ZP(0x180))](Z,utils_1['agent']),o=new copy_1[(ZP(0x140))](Z,utils_1[ZP(0x13b)]),s=new logs_1['CliLogs'](Z,utils_1[ZP(0x13b)]),R=new metrics_1[(ZP(0x196))](Z,utils_1['agent']);return K[ZP(0x18b)](N[ZP(0x18a)]),K['addCommand'](H['execCmd']),K['addCommand'](o[ZP(0x1f3)]),K[ZP(0x18b)](o[ZP(0x12b)]),K[ZP(0x18b)](g[ZP(0x1ba)]),K[ZP(0x18b)](g['contexts']),generateCommands(O,O[ZP(0x1b0)],K,s,R),K[ZP(0x18b)]((0x0,command_overview_1[ZP(0x1ca)])(K)),K[ZP(0x14e)](!![],ZP(0x168)),K['helpOption'](undefined,ZP(0x168)),K;};exports['getProgram']=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const ZC=a1ZV;try{const Z=new js_client_1[(ZC(0x1be))]();yield(0x0,utils_1[ZC(0x181)])(Z);const K=(0x0,exports[ZC(0x13f)])(Z);yield K['parseAsync'](process[ZC(0x16f)]);}catch(O){(0x0,utils_1[ZC(0x1e7)])('Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20'+O[ZC(0x101)]),process[ZC(0x16f)][ZC(0x1f8)](g=>g===ZC(0x1f1))&&console[ZC(0x19f)](O),process[ZC(0xe9)]=0x1;}}))());function isListCommand(Z){const ZS=a1ZV,K=[['get',ZS(0x146),'backups'],[ZS(0x117),ZS(0x13c),ZS(0x1c5)]];return Z[ZS(0x1f8)](O=>O===ZS(0x1fa))||K[ZS(0x13d)](O=>_[ZS(0x1bf)](Z,O));}function generateCommands(Z,K,O,g,N,H=defaults[a1ZV(0x185)],o=[]){const Zn=a1ZV,s=new inquirer_helper_1['InquirerHelper'](new js_client_1[(Zn(0x165))](Z[Zn(0x19b)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent'],'agent':utils_1[Zn(0x13b)]}));function R(V,M){const Zk=Zn;return V[Zk(0x1fc)]!==![]&&M===undefined;}function y(V,M){const Zx=Zn,{opt:I,name:c}=V,E=I[Zx(0x1b4)],p=R(I,E),T=S=>S[Zx(0xef)]>0x1?'--'+S:'-'+S,J=I===null||I===void 0x0?void 0x0:I['alias'],q=J?_[Zx(0xe7)](J)?'-'+(J===null||J===void 0x0?void 0x0:J[Zx(0x15b)](S=>T(S))[Zx(0x1e4)](',\x20-'))+',':''+T(J):'',Y=p?'':Zx(0x139),P=typeof I[Zx(0x19e)]==='boolean'||I[Zx(0x19e)]==='boolean'?q+'\x20--'+c:q+Zx(0x19c)+c+'\x20<'+c['toUpperCase']()+'>',C=Y+I[Zx(0x1bd)];M['option'](P,C,E);}function W(V,M){const Zm=Zn;if(M[Zm(0x157)][Zm(0x13d)](I=>I[Zm(0x130)]()===Zm(0x10e)))return;_[Zm(0x1bf)](V,['get','service'])&&(M[Zm(0x18b)](g['getLogsCommand'](Zm(0x1fd))),M['addCommand'](N[Zm(0x1cb)]('service')),M[Zm(0x18b)](g['getLogsCommand']('service',!![])),M[Zm(0x18b)](N[Zm(0x1cb)](Zm(0x1fd),!![]))),_['isEqual'](V,['get','job'])&&(M['addCommand'](g['getLogsCommand'](Zm(0x13c))),M['addCommand'](N[Zm(0x1cb)](Zm(0x13c))),M[Zm(0x18b)](g[Zm(0x1b8)](Zm(0x13c),!![])),M[Zm(0x18b)](N[Zm(0x1cb)]('job',!![]))),_[Zm(0x1bf)](V,['get',Zm(0x146)])&&(M['addCommand'](g[Zm(0x1b8)](Zm(0x146))),M[Zm(0x18b)](N['getMetricsCommand'](Zm(0x146)))),_[Zm(0x1bf)](V,[Zm(0x117),Zm(0x146),Zm(0x151)])&&M[Zm(0x18b)](g[Zm(0x1b8)](Zm(0x146),![],!![])),_[Zm(0x1bf)](V,[Zm(0x117),Zm(0x146),Zm(0xf0)])&&M[Zm(0x18b)](g[Zm(0x1b8)](Zm(0x146),![],!![],!![]));}return Object[Zn(0x17f)](H)[Zn(0x1da)](V=>{const Zr=Zn,M=K[V],I=H[V],c=o[Zr(0x1d2)]([V]);function E(k,x){const ZD=Zr,m=Object['getOwnPropertyNames'](k||{});m[ZD(0x15b)](r=>{return{'name':r,'opt':k[r]};})['sort']((r,D)=>!R(r[ZD(0x135)])?!R(D[ZD(0x135)])?0x0:0x1:-0x1)[ZD(0x1da)](r=>{y(r,x);});}function p(k,x){const Zd=Zr,m=[[Zd(0x1de),Zd(0x176),Zd(0x198)],[Zd(0x1fd),Zd(0x124),Zd(0x194)],[Zd(0x1a7),'credential',Zd(0x145)],[Zd(0x146),'addons','adn'],[Zd(0x13c),'jobs'],[Zd(0x156),'plans',Zd(0xf9)],['region','regions',Zd(0x127)],['domain',Zd(0x1f5),Zd(0x1a8)],['secret',Zd(0x197),Zd(0x1ab)],[Zd(0x1cc),'volume',Zd(0x162)],[Zd(0x129),Zd(0x12c),'brn'],[Zd(0x199),Zd(0x179),'inv'],[Zd(0x1c2),Zd(0x1a3),Zd(0x121)],[Zd(0x1b3),Zd(0x13e),Zd(0x18d),Zd(0x119)],[Zd(0x1d5),Zd(0xea)],[Zd(0x188),'tags']],r=m[Zd(0x1f8)](D=>D[Zd(0x1aa)](x));if(r!==undefined)k[Zd(0x163)](r[Zd(0x1e3)](D=>D!==x));}function T(k){var x,m;return __awaiter(this,void 0x0,void 0x0,function*(){const Zb=a1K,r={},{contextProvider:D}=Z,d=c[Zb(0x1aa)](Zb(0xff)),b=k[Zb(0x1d1)]===!![];function l(f,a,v){var L,X;return __awaiter(this,void 0x0,void 0x0,function*(){const Zl=a1K;if(_[Zl(0x1f9)]((X=(L=I['opt'])===null||L===void 0x0?void 0x0:L['path'])!==null&&X!==void 0x0?X:{},f)){const e=!b&&!d&&v?v():undefined,U=k[f]||e||(yield a());_[Zl(0x1d9)](r,f,U);}});}return yield(0x0,utils_1[Zb(0x100)])(Object['entries']((m=(x=I[Zb(0x135)])===null||x===void 0x0?void 0x0:x[Zb(0x10a)])!==null&&m!==void 0x0?m:{}),([f,a])=>__awaiter(this,void 0x0,void 0x0,function*(){const Zf=Zb;var v;const L=r===null||r===void 0x0?void 0x0:r['projectId'],X=r===null||r===void 0x0?void 0x0:r[Zf(0x15a)];switch(f){case Zf(0x16d):return yield l(Zf(0x16d),s[Zf(0x123)][Zf(0x12a)](s),D[Zf(0x190)][Zf(0x12a)](D));case'serviceId':return yield l(Zf(0x159),s[Zf(0x17b)](L)[Zf(0x12a)](s),D[Zf(0x175)][Zf(0x12a)](D));case Zf(0x1eb):return yield l(Zf(0x1eb),s[Zf(0xf3)](L)['bind'](s));case Zf(0x178):return yield l(Zf(0x178),s[Zf(0x164)](L)[Zf(0x12a)](s),D[Zf(0x166)][Zf(0x12a)](D));case'runId':return yield l(Zf(0x11f),s[Zf(0xf6)](r[Zf(0x178)],L,![])['bind'](s));case Zf(0x1df):return yield l(Zf(0x1df),s['askForSecret'](L)[Zf(0x12a)](s));case Zf(0x116):case Zf(0x148):return yield l(Zf(0x116),s[Zf(0x173)]['bind'](s));case'credentialId':return yield l(Zf(0xfe),s['askForCredentials']['bind'](s));case Zf(0x108):return yield l('volumeId',s[Zf(0x115)](L)[Zf(0x12a)](s));case'subdomain':return yield l(Zf(0x13a),s[Zf(0x171)](r[Zf(0x116)])[Zf(0x12a)](s));case Zf(0x10d):return yield l(Zf(0x10d),s[Zf(0x171)](r[Zf(0x148)])[Zf(0x12a)](s));case'subdomainPath':return yield l(Zf(0x1e1),s[Zf(0x144)](r['domain'],(v=r[Zf(0x13a)])!==null&&v!==void 0x0?v:r[Zf(0x10d)])[Zf(0x12a)](s));case'backupId':return yield l(Zf(0x1bb),s[Zf(0x1e5)](L,r[Zf(0x1eb)])['bind'](s));case Zf(0x120):return yield l('buildId',s[Zf(0x138)](L,r[Zf(0x159)],r[Zf(0x178)])[Zf(0x12a)](s));case Zf(0x15a):return yield l(Zf(0x15a),s['askForTemplate']()[Zf(0x12a)](s));case Zf(0x133):return yield l('templateRunId',s[Zf(0x154)](X)[Zf(0x12a)](s));case Zf(0xfa):return yield l(Zf(0xfa),s[Zf(0x1c6)]()[Zf(0x12a)](s));case Zf(0xf2):return yield l(Zf(0xf2),s[Zf(0x16e)](L)['bind'](s));case Zf(0x170):return yield l(Zf(0x170),s['askForTag']()[Zf(0x12a)](s));case Zf(0xee):return yield l(Zf(0xee),s[Zf(0x143)]()['bind'](s));case Zf(0x1d3):return yield l(Zf(0x1d3),s['askForClusterId']()[Zf(0x12a)](s));default:return yield l(f,s[Zf(0x1b1)](f,a===null||a===void 0x0?void 0x0:a[Zf(0x1bd)])[Zf(0x12a)](s));}})),r;});}function J(k){var x,m,r;return __awaiter(this,void 0x0,void 0x0,function*(){const Za=a1K,D={},d=((x=I['opt'])===null||x===void 0x0?void 0x0:x[Za(0x14c)])?defaults[Za(0x152)]:{},b=Object[Za(0x1ec)](Object[Za(0x1ec)]({},(r=(m=I[Za(0x135)])===null||m===void 0x0?void 0x0:m[Za(0x1b5)])!==null&&r!==void 0x0?r:{}),d),l=Object[Za(0xec)](b)[Za(0x1e3)](f=>f!==Za(0x1a5));return yield(0x0,utils_1['asyncSequential'])(l,f=>__awaiter(this,void 0x0,void 0x0,function*(){const Zv=Za;if(k[f]!==undefined)return _[Zv(0x1d9)](D,f,k[f]);})),D;});}function q(){const ZL=Zr;switch(c[0x0]){case ZL(0x117):return'Get\x20information\x20about\x20Northflank\x20'+(c[0x1]||ZL(0x14f))+'s';case ZL(0x114):return'Update\x20Northflank\x20'+(c[0x1]||ZL(0x14f))+ZL(0x1b9);default:return _['upperFirst'](V)+ZL(0x1b2);}}function Y(k,x){const ZX=Zr;var m,r,D,d,b,l,f,a;if(!x){const G=(0x0,utils_1[ZX(0x161)])()['name'](_['kebabCase'](V))[ZX(0x1bd)](q());return p(G,V),G;}const v=(k===null||k===void 0x0?void 0x0:k[ZX(0x11e)])?chalk_1[ZX(0x1b4)]['grey'](ZX(0x187)+k['requiredPermissions']):'',L=Z[ZX(0x19b)][ZX(0x128)](),X=L!==undefined&&((m=I===null||I===void 0x0?void 0x0:I[ZX(0x135)])===null||m===void 0x0?void 0x0:m[ZX(0x1ea)])!==undefined,e=L===null||L===void 0x0?void 0x0:L['host'][ZX(0x12f)](ZX(0x104),''),U=X?ZX(0x1ce)+e+ZX(0x1a1)+((r=I===null||I===void 0x0?void 0x0:I[ZX(0x135)])===null||r===void 0x0?void 0x0:r[ZX(0x1ea)]):'',i=(k===null||k===void 0x0?void 0x0:k[ZX(0x1bd)])||'',z=(0x0,utils_1['getCommand'])(!![])['name'](_[ZX(0x1bc)](V))[ZX(0x1bd)](i)[ZX(0x17d)](ZX(0x125),[v,U][ZX(0x1e4)]('\x0a'));p(z,V);(((D=I['opt'])===null||D===void 0x0?void 0x0:D[ZX(0xf8)])||((d=I[ZX(0x135)])===null||d===void 0x0?void 0x0:d[ZX(0xe8)]))&&(z[ZX(0x184)](ZX(0x102),ZX(0x16c)),z[ZX(0x184)](ZX(0xed),'JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22'));E((b=I['opt'])===null||b===void 0x0?void 0x0:b[ZX(0x10a)],z),E((l=I[ZX(0x135)])===null||l===void 0x0?void 0x0:l['query'],z);const j=(f=I[ZX(0x135)])===null||f===void 0x0?void 0x0:f['isPaginatedEndpoint'];return j&&E(defaults[ZX(0x152)],z),E((a=I[ZX(0x135)])===null||a===void 0x0?void 0x0:a[ZX(0x1ee)],z),z[ZX(0x1e2)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const Ze=ZX;var w,Q,u,F,A,h;(0x0,utils_1[Ze(0x1f0)])(Z);const t=z[Ze(0x113)]();(t===null||t===void 0x0?void 0x0:t[Ze(0x1c4)])&&utils_1[Ze(0x1ed)]&&(0x0,utils_1[Ze(0x15d)])(Ze(0x15e));const Z0=t[Ze(0x182)]!==undefined||t[Ze(0x147)]!==undefined;if(t[Ze(0x1a5)]===!![]&&Z0)throw new Error(Ze(0x155));const Z1=t===null||t===void 0x0?void 0x0:t[Ze(0x11c)],Z2=Z1===Ze(0x17c),Z3=Z1===Ze(0x1fb)||Z1==='yml',Z4=yield T(t);s['setPathVars'](Z4);const Z5=yield J(t),Z6=Object[Ze(0xec)]((Q=(w=I[Ze(0x135)])===null||w===void 0x0?void 0x0:w[Ze(0x10a)])!==null&&Q!==void 0x0?Q:{})['map'](ZK=>ZK+'='+chalk_1[Ze(0x1b4)]['green'](Z4[ZK]))[Ze(0x1e4)](',\x20');if(Z6['length']>0x0&&!Z2&&!Z3){const ZK=Ze(0x1d8)+Z6;console['log'](ZK);}const Z7=((u=I[Ze(0x135)])===null||u===void 0x0?void 0x0:u['body'])||((F=I[Ze(0x135)])===null||F===void 0x0?void 0x0:F[Ze(0xe8)])?yield B(t,I,c):undefined;if(!t[Ze(0x1c7)]&&c['includes']('delete')&&!(yield s['deleteWarningPrompt']())){(0x0,utils_1[Ze(0x15d)])(Ze(0x14b));return;}const Z8=j&&(t['loadAll']||(t[Ze(0x11c)]===Ze(0x17c)||t[Ze(0x11c)]===Ze(0x1fb))&&!Z0);let Z9=Z8&&M instanceof js_client_1[Ze(0x191)]?yield M[Ze(0x1f2)]({'parameters':Z4,'options':Z5,'data':Z7}):yield M['call']({'parameters':Z4,'options':Object['assign']({},Z5),'data':Z7});if(t===null||t===void 0x0?void 0x0:t[Ze(0x1c4)]){const ZO=Z9[Ze(0x18f)];console[Ze(0x19f)](Ze(0xfd)+ZO[Ze(0x153)][Ze(0x118)]()+':'+ZO[Ze(0x17a)]);if(Z7!==undefined)console[Ze(0x19f)](Ze(0x1f7)+Z7);}if(Z9[Ze(0x1e7)]){const {details:Zg,id:ZN,message:ZH,status:Zo}=Z9[Ze(0x1e7)],Zs=Zg?Ze(0x1e0)+JSON['stringify'](Zg):'',ZR=ZN?',\x20NF\x20error\x20id:\x20'+ZN:'',Zy=Ze(0xf4)+Zo+ZR+')';throw new Error(Ze(0x195)+ZH+'\x20'+Zy+Zs);}let ZZ=0x0;printCallResult(t,Z2,Z9['data'],Z3,c,Z1,![],ZZ,Z9[Ze(0x149)][Ze(0x14a)]);if(!t[Ze(0x1d6)]&&!Z8&&!Z0&&((A=Z9[Ze(0x1cd)])===null||A===void 0x0?void 0x0:A[Ze(0x1af)]))while((h=Z9['pagination'])===null||h===void 0x0?void 0x0:h[Ze(0x1af)]){const ZW=yield s[Ze(0x169)](Ze(0x134));if(ZW)process['stdout'][Ze(0x158)](0x0,-0x1),process[Ze(0x189)][Ze(0x18e)](0x1),ZZ+=Z9['pagination'][Ze(0x110)],Z9=yield Z9[Ze(0x1cd)][Ze(0x19a)](),printCallResult(t,Z2,Z9[Ze(0x10f)],Z3,c,Z1,!![],ZZ,Z9['rawResponse'][Ze(0x14a)]);else return;}})),z;}const P=_['has'](I,Zr(0x135)),C=M,S=Y(C,P);W(c,S),O['addCommand'](S);const n=_[Zr(0x137)](I,Zr(0x135));Object[Zr(0xec)](n)['length']>0x0&&generateCommands(Z,M,S,g,N,n,c);});function B(V,M,I){var c;return __awaiter(this,void 0x0,void 0x0,function*(){const ZU=a1K,{input:E,file:p}=V;if(E!==undefined)try{return JSON['parse'](E);}catch(T){try{return yaml[ZU(0x1cf)](E);}catch(J){throw new Error(ZU(0x1a2));}}if(p!==undefined){if(!fs_1[ZU(0x1b4)][ZU(0x1a4)](p))throw new Error(ZU(0x167)+p);const q=fs_1[ZU(0x1b4)][ZU(0x11a)](p)[ZU(0x1db)]();let Y;try{if(_[ZU(0x109)](q)){if(V[ZU(0x131)][ZU(0x15c)](ZU(0x1ef)))Y=JSON[ZU(0x1a0)](q);else{if(V[ZU(0x131)][ZU(0x15c)](ZU(0x1ad))||V['file'][ZU(0x15c)]('yml'))Y=yaml['safeLoad'](q);else throw new Error(ZU(0x112)+V['file']['split']('.')[ZU(0x1dc)]());}}else Y=q;return Y;}catch(P){throw new Error('Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20'+P[ZU(0x101)]);}}if((c=M===null||M===void 0x0?void 0x0:M['opt'])===null||c===void 0x0?void 0x0:c[ZU(0xe8)])throw new Error(ZU(0x1e8));return yield s['retrievePayloadViaInteractiveCli'](M,{'cmdPath':I,'skipValidation':V['skipValidation']});});}}const printCallResult=(Z,K,O,g,N,H,o,s,R)=>{const Zi=a1ZV;if(!(Z===null||Z===void 0x0?void 0x0:Z['quiet'])){if(K)(0x0,console_format_helpers_1['handleJsonOutput'])(Z===null||Z===void 0x0?void 0x0:Z['output'],O);else{if(g)(0x0,console_format_helpers_1[Zi(0x160)])(Z===null||Z===void 0x0?void 0x0:Z['output'],O);else{if(isListCommand(N)){const y=(H===null||H===void 0x0?void 0x0:H[Zi(0x15f)](Zi(0x1c9)))?H['replace'](Zi(0x1c9),'')[Zi(0x1ae)](',')[Zi(0x15b)](I=>I['toLowerCase']()):undefined,W=N[N[Zi(0xef)]-0x1],B=''+W+(W[Zi(0x15c)]('s')?'':'s'),V=_[Zi(0x1f4)](B),M=_[Zi(0x1f9)](O,B)?O[B]:O;(0x0,console_format_helpers_1[Zi(0x1c1)])(M,V,y,o,s);}else console[Zi(0x19f)]((0x0,console_format_helpers_1[Zi(0x1f6)])(O,R));}}}};function a1Z(){const Zz=['northflank','defineProperty','replace','name','file','9258579GIjKGt','templateRunId','there\x20are\x20more\x20rows,\x20load?','opt','__setModuleDefault','omit','askForBuild','OPTIONAL:\x20','subdomain','agent','job','some','repository','getProgram','CliFileCopy','128670zKfAdC','6170704hnZmVN','askForBackupDestination','askForSubdomainPath','cred','addon','cursor','domainId','rawResponse','statusText','Resource\x20was\x20not\x20deleted.','isPaginatedEndpoint','writable','addHelpCommand','resource','underline','backup','paginationArgs','method','askForTemplateRun','Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27','plan','commands','moveCursor','serviceId','templateId','map','endsWith','warning','VERBOSE:\x20HTTP_PROXY\x20or\x20HTTPS_PROXY\x20environment\x20variable\x20set:\x20tunnelling\x20traffic\x20through\x20HTTP\x20proxy.','startsWith','handleYamlOutput','getCommand','vol','aliases','askForJob','ApiClient','getCurrentJobName','File\x20does\x20not\x20exist:\x20','Display\x20help\x20for\x20command','askConfirm','./formatting/command-overview','enablePositionalOptions','File\x20to\x20load\x20resource\x20json\x20from','projectId','askForPipeline','argv','resourceTagId','askForSubdomain','__importStar','askForDomain','__importDefault','getCurrentServiceName','projects','create','jobId','invoices','url','askForService','json','addHelpText','32YaPzjT','getOwnPropertyNames','CliExec','checkUpdate','page','version','option','defaults','apply','\x0a>\x20Token\x20permissions\x20required:\x20','tag','stdout','portFwdCmd','addCommand','108GtMndE','repositories','clearLine','request','getCurrentProjectName','GetApiEndpointPaginated','./metrics','chalk','svc','API\x20request\x20failed\x0a\x09Message:\x20','CliMetrics','secrets','prj','invoice','getNextPage','contextProvider','\x20--','2EBFMqx','type','log','parse','/docs/v1/api/','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','templates','existsSync','loadAll','call','credentials','dmn','9TfFqmr','includes','scrt','__awaiter','.yaml','split','hasNextPage','endpoints','askGeneric','\x20Northflank\x20resources','repos','default','query','./logs','getOwnPropertyDescriptor','getLogsCommand','\x20properties','login','backupId','kebabCase','description','ApiClientFileContextProvider','isEqual','Command','printAsTable','template','./copy','verbose','runs','askForLogSink','force','3110457edKKOH','custom-columns=','getCommandOverview','getMetricsCommand','volumes','pagination','Documentation:\x20','safeLoad','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','noDefaults','concat','clusterId','./formatting/console-format-helpers','backup-destination','quiet','__esModule','=>\x20running\x20command\x20with:\x20','set','forEach','toString','pop','Northflank\x20cli\x20version:\x20','project','secretId','\x0a\x09details\x20:','subdomainPath','action','filter','join','askForAddonBackup','./defaults','error','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','CliPortForward','docsTagsPath','addonId','assign','proxyEnvsSet','base','.json','assertContextExisting','--verbose','all','downloadCmd','upperFirst','domains','consoleFormat','VERBOSE:\x20Request\x20body\x20->\x20','find','has','list','yaml','required','service','isArray','nonInteractiveEndpoint','exitCode','backup-destinations','36yyamrT','keys','-i,\x20--input\x20<resource-def>','backupDestinationId','length','restores','lodash','pipelineId','askForAddon','(HTTP\x20status\x20code:\x20','commander','askForJobRun','__createBinding','body','pln','logSinkId','next','throw','VERBOSE:\x20Using\x20endpoint\x20->\x20','credentialId','delete','asyncSequential','message','-f,\x20--file\x20<file-path>','../package.json','api.','value','./exec','./inquirer-helper','volumeId','isString','path','334223binfaU','js-yaml','subdomainId','logs','data','count','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','Unknown\x20input\x20file\x20type:\x20','opts','update','askForVolume','domain','get','toUpperCase','repo','readFileSync','prototype','output','15358130eikjLv','requiredPermissions','runId','buildId','tpl','configurable','askForProject','services','after','5364138aTtani','rgn','getCurrentContext','branches','bind','uploadCmd','branch'];a1Z=function(){return Zz;};return a1Z();}
2
+ 'use strict';const a1ON=a1g;(function(O,g){const OL=a1g,R=O();while(!![]){try{const Y=-parseInt(OL(0x120))/0x1*(parseInt(OL(0xfa))/0x2)+-parseInt(OL(0x154))/0x3+-parseInt(OL(0x1df))/0x4+parseInt(OL(0x11f))/0x5*(parseInt(OL(0x13a))/0x6)+-parseInt(OL(0x1c6))/0x7*(-parseInt(OL(0x19c))/0x8)+-parseInt(OL(0x153))/0x9*(parseInt(OL(0x1a5))/0xa)+-parseInt(OL(0x1e9))/0xb*(-parseInt(OL(0x171))/0xc);if(Y===g)break;else R['push'](R['shift']());}catch(y){R['push'](R['shift']());}}}(a1O,0x78678));function a1g(O,g){const R=a1O();return a1g=function(Y,y){Y=Y-0xd0;let n=R[Y];return n;},a1g(O,g);}var __createBinding=this&&this['__createBinding']||(Object[a1ON(0x177)]?function(O,g,R,Y){const Ob=a1ON;if(Y===undefined)Y=R;var y=Object[Ob(0x165)](g,R);(!y||(Ob(0x16d)in y?!g[Ob(0x1e6)]:y['writable']||y[Ob(0x1ca)]))&&(y={'enumerable':!![],'get':function(){return g[R];}}),Object[Ob(0x1a0)](O,Y,y);}:function(O,g,R,Y){if(Y===undefined)Y=R;O[Y]=g[R];}),__setModuleDefault=this&&this[a1ON(0x14d)]||(Object[a1ON(0x177)]?function(O,g){const OE=a1ON;Object[OE(0x1a0)](O,'default',{'enumerable':!![],'value':g});}:function(O,g){const Op=a1ON;O[Op(0x136)]=g;}),__importStar=this&&this[a1ON(0x1e1)]||function(O){const OF=a1ON;if(O&&O[OF(0x1e6)])return O;var g={};if(O!=null){for(var R in O)if(R!==OF(0x136)&&Object[OF(0x110)][OF(0x133)][OF(0x1c9)](O,R))__createBinding(g,O,R);}return __setModuleDefault(g,O),g;},__awaiter=this&&this['__awaiter']||function(O,g,R,Y){function y(n){return n instanceof R?n:new R(function(G){G(n);});}return new(R||(R=Promise))(function(n,G){const Ov=a1g;function S(L){try{V(Y['next'](L));}catch(N){G(N);}}function q(L){const Om=a1g;try{V(Y[Om(0xe0)](L));}catch(N){G(N);}}function V(e){const Oo=a1g;e['done']?n(e[Oo(0x121)]):y(e[Oo(0x121)])[Oo(0x124)](S,q);}V((Y=Y[Ov(0xee)](O,g||[]))['next']());});},__importDefault=this&&this[a1ON(0x1e2)]||function(O){const Oa=a1ON;return O&&O[Oa(0x1e6)]?O:{'default':O};};function a1O(){const Ou=['backups','login','enablePositionalOptions','__esModule','jobId','assertContextExisting','1034UhNGmh','secrets','runId','verbose','agent','OPTIONAL:\x20','loadAll','invoices','asyncSequential','find','prj','CliFileCopy','ApiClientFileContextProvider','askForBuild','VERBOSE:\x20Request\x20body\x20->\x20','pipelineId','services',',\x20NF\x20error\x20id:\x20','askForTag','base','isArray','throw','host','method','askForService','startsWith','./defaults','Documentation:\x20','askForSubdomain','list','Update\x20Northflank\x20','template','Get\x20information\x20about\x20Northflank\x20','getCommandOverview','retrievePayloadViaInteractiveCli','apply','getLogsCommand','paginationArgs','skipValidation','boolean','backup-destination','green','.yaml','includes','defaults','-f,\x20--file\x20<file-path>','isPaginatedEndpoint','2QRvECD','plan','api.','VERBOSE:\x20HTTP_PROXY\x20or\x20HTTPS_PROXY\x20environment\x20variable\x20set:\x20tunnelling\x20traffic\x20through\x20HTTP\x20proxy.','askForJob','lodash','uploadCmd','helpOption','portFwdCmd','tags','grey','Northflank\x20cli\x20version:\x20','force','(HTTP\x20status\x20code:\x20','logSinkId','askForDomain','service','printAsTable','askForClusterId','\x0a\x09details\x20:','bind','option','prototype','regions','kebabCase','volume','all','secret','aliases','nonInteractiveEndpoint','getCurrentProjectName','description','backup','rgn','-i,\x20--input\x20<resource-def>','runs','subdomainPath','25zztwLw','381607VScmNF','value','type','assign','then','Command','keys','log','askForBackupDestination','yml','getCommand','yaml','backupDestinationId','@northflank/js-client','upperFirst','askForCredentials','\x20properties','execCmd','askForSecret','hasOwnProperty','templateRunId','filter','default','repositories','pagination','readFileSync','558270iyBZHj','backupId','downloadCmd','domainId','exitCode','askForAddonBackup','opts','/docs/v1/api/','pln','serviceId','delete','./copy','count','askForVolume','getCurrentJobName','./context/contextCommands','sort','-v,\x20--version','../package.json','__setModuleDefault','File\x20does\x20not\x20exist:\x20','secretId','noDefaults','subdomainId','required','5400333ofMMEV','1876296xReeot','./formatting/console-format-helpers','clearLine','adn','VERBOSE:\x20Using\x20endpoint\x20->\x20','docsTagsPath','error','Display\x20help\x20for\x20command','branches','askForProject','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','\x0a>\x20Token\x20permissions\x20required:\x20','output','parse','subdomain','resource','dmn','getOwnPropertyDescriptor','forEach','pop','stringify','addCommand','addon','resourceTagId','\x20--','get','has','projects','length','263964srRRCk','omit','domain','getProgram','scrt','InquirerHelper','create','map','repo','clusterId','askConfirm','file','askGeneric','inv','jobs','deleteWarningPrompt','branch','brn','url','project','there\x20are\x20more\x20rows,\x20load?','contexts','API\x20request\x20failed\x0a\x09Message:\x20','body','askForTemplate',',\x20-','set','parseAsync','GetApiEndpointPaginated','moveCursor','job','path','join','addons','getOwnPropertyNames','toUpperCase','CliMetrics','name','custom-columns=','stdout','getMetricsCommand','statusText','credentialId','172336ZcLiEp','addHelpCommand','isString','toString','defineProperty','safeLoad','getCurrentServiceName','askForSubdomainPath','query','10wmLHyd','opt','concat','isEqual','credential','request','handleJsonOutput','entries','chalk','vol','repos','underline','askForJobRun','File\x20to\x20load\x20resource\x20json\x20from','./inquirer-helper','=>\x20running\x20command\x20with:\x20','version','customUserAgent','existsSync','./metrics','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','warning','proxyEnvsSet','some','getCurrentContext','projectId','cred','hasNextPage','getNextPage','split','tpl','plans','56YfabdL','rawResponse','requiredPermissions','call','configurable','askForLogSink','buildId','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','Unknown\x20input\x20file\x20type:\x20','toLowerCase','northflank','templateId','ApiClient','cursor','--verbose','\x20Northflank\x20resources','volumeId','addonId','data','logs','message','argv','quiet','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','endsWith','2420108EiETtQ','./utils','__importStar','__importDefault'];a1O=function(){return Ou;};return a1O();}Object[a1ON(0x1a0)](exports,a1ON(0x1e6),{'value':!![]}),exports[a1ON(0x174)]=void 0x0;const js_client_1=require(a1ON(0x12d)),commander_1=__importDefault(require('commander')),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require(a1ON(0x1ad))),_=__importStar(require(a1ON(0xff))),contextCommands_1=require(a1ON(0x149)),utils_1=require(a1ON(0x1e0)),defaults=__importStar(require(a1ON(0xe5))),inquirer_helper_1=require(a1ON(0x1b3)),console_format_helpers_1=require(a1ON(0x155)),command_overview_1=require('./formatting/command-overview'),port_forward_1=require('./port-forward'),exec_1=require('./exec'),logs_1=require('./logs'),metrics_1=require(a1ON(0x1b8)),copy_1=require(a1ON(0x145)),yaml=require('js-yaml'),pgk=require(a1ON(0x14c)),getProgram=O=>{const Oz=a1ON,g=new commander_1[(Oz(0x136))][(Oz(0x125))](Oz(0x1d0));g[Oz(0x119)](Oz(0x1cd)),g[Oz(0x1e5)](!![]),g[Oz(0x1b5)](Oz(0x105)+chalk_1['default'][Oz(0x1b0)](pgk['version']),Oz(0x14b),'Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli');const R=new js_client_1[(Oz(0x1d2))](O,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[Oz(0x1b6)],'agent':utils_1['agent']}),Y=new contextCommands_1['CliContext'](R,utils_1[Oz(0x1ed)]),y=new port_forward_1['CliPortForward'](O,utils_1[Oz(0x1ed)]),n=new exec_1['CliExec'](O,utils_1[Oz(0x1ed)]),G=new copy_1[(Oz(0xd6))](O,utils_1[Oz(0x1ed)]),S=new logs_1['CliLogs'](O,utils_1['agent']),q=new metrics_1[(Oz(0x195))](O,utils_1[Oz(0x1ed)]);return g[Oz(0x169)](y[Oz(0x102)]),g['addCommand'](n[Oz(0x131)]),g['addCommand'](G[Oz(0x13c)]),g[Oz(0x169)](G[Oz(0x100)]),g[Oz(0x169)](Y[Oz(0x1e4)]),g[Oz(0x169)](Y[Oz(0x186)]),generateCommands(R,R['endpoints'],g,S,q),g['addCommand']((0x0,command_overview_1[Oz(0xec)])(g)),g[Oz(0x19d)](!![],Oz(0x15b)),g[Oz(0x101)](undefined,'Display\x20help\x20for\x20command'),g;};exports[a1ON(0x174)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const OW=a1ON;try{const O=new js_client_1[(OW(0xd7))]();yield(0x0,utils_1['checkUpdate'])(O);const g=(0x0,exports[OW(0x174)])(O);yield g[OW(0x18c)](process[OW(0x1db)]);}catch(R){(0x0,utils_1[OW(0x15a)])(OW(0x1dd)+R[OW(0x1da)]),process[OW(0x1db)][OW(0xd4)](Y=>Y===OW(0x1d4))&&console[OW(0x127)](R),process[OW(0x13e)]=0x1;}}))());function isListCommand(O){const OX=a1ON,g=[[OX(0x16d),OX(0x16a),OX(0x1e3)],[OX(0x16d),'job',OX(0x11d)]];return O[OX(0xd4)](R=>R===OX(0xe8))||g[OX(0x1bd)](R=>_[OX(0x1a8)](O,R));}function generateCommands(O,g,R,Y,y,n=defaults[a1ON(0xf7)],G=[]){const OM=a1ON,S=new inquirer_helper_1[(OM(0x176))](new js_client_1[(OM(0x1d2))](O['contextProvider'],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[OM(0x1b6)],'agent':utils_1['agent']}));function q(N,b){const Ol=OM;return N[Ol(0x152)]!==![]&&b===undefined;}function V(N,b){const OC=OM,{opt:E,name:p}=N,F=E['default'],m=q(E,F),o=M=>M['length']>0x1?'--'+M:'-'+M,v=E===null||E===void 0x0?void 0x0:E['alias'],a=v?_[OC(0xdf)](v)?'-'+(v===null||v===void 0x0?void 0x0:v[OC(0x178)](M=>o(M))[OC(0x191)](OC(0x18a)))+',':''+o(v):'',z=m?'':OC(0xd0),W=typeof E[OC(0x122)]==='boolean'||E[OC(0x122)]===OC(0xf2)?a+OC(0x16c)+p:a+'\x20--'+p+'\x20<'+p[OC(0x194)]()+'>',X=z+E['description'];b[OC(0x10f)](W,X,F);}function e(N,b){const OK=OM;if(b['commands'][OK(0x1bd)](E=>E[OK(0x196)]()===OK(0x1d9)))return;_['isEqual'](N,[OK(0x16d),OK(0x10a)])&&(b[OK(0x169)](Y[OK(0xef)]('service')),b[OK(0x169)](y[OK(0x199)]('service')),b[OK(0x169)](Y[OK(0xef)](OK(0x10a),!![])),b[OK(0x169)](y[OK(0x199)]('service',!![]))),_[OK(0x1a8)](N,[OK(0x16d),'job'])&&(b[OK(0x169)](Y['getLogsCommand'](OK(0x18f))),b[OK(0x169)](y[OK(0x199)](OK(0x18f))),b['addCommand'](Y['getLogsCommand'](OK(0x18f),!![])),b['addCommand'](y[OK(0x199)](OK(0x18f),!![]))),_['isEqual'](N,[OK(0x16d),OK(0x16a)])&&(b[OK(0x169)](Y[OK(0xef)]('addon')),b[OK(0x169)](y[OK(0x199)]('addon'))),_['isEqual'](N,[OK(0x16d),OK(0x16a),OK(0x11a)])&&b['addCommand'](Y[OK(0xef)](OK(0x16a),![],!![])),_[OK(0x1a8)](N,[OK(0x16d),'addon','restores'])&&b['addCommand'](Y[OK(0xef)](OK(0x16a),![],!![],!![]));}return Object[OM(0x193)](n)[OM(0x166)](N=>{const OH=OM,b=g[N],E=n[N],p=G[OH(0x1a7)]([N]);function F(C,K){const Of=OH,H=Object[Of(0x193)](C||{});H[Of(0x178)](f=>{return{'name':f,'opt':C[f]};})[Of(0x14a)]((f,i)=>!q(f['opt'])?!q(i[Of(0x1a6)])?0x0:0x1:-0x1)['forEach'](f=>{V(f,K);});}function m(C,K){const Oi=OH,H=[[Oi(0x184),Oi(0x16f),Oi(0xd5)],[Oi(0x10a),Oi(0xdb),'svc'],['credentials',Oi(0x1a9),Oi(0x1c0)],['addon',Oi(0x192),Oi(0x157)],[Oi(0x18f),Oi(0x17f)],[Oi(0xfb),Oi(0x1c5),Oi(0x142)],['region',Oi(0x111),Oi(0x11b)],['domain','domains',Oi(0x164)],[Oi(0x115),Oi(0x1ea),Oi(0x175)],['volumes',Oi(0x113),Oi(0x1ae)],[Oi(0x15c),Oi(0x181),Oi(0x182)],['invoice',Oi(0xd2),Oi(0x17e)],[Oi(0xea),'templates',Oi(0x1c4)],[Oi(0x1af),'repository',Oi(0x137),Oi(0x179)],[Oi(0xf3),'backup-destinations'],['tag',Oi(0x103)]],f=H[Oi(0xd4)](i=>i[Oi(0xf6)](K));if(f!==undefined)C[Oi(0x116)](f[Oi(0x135)](i=>i!==K));}function o(C){var K,H;return __awaiter(this,void 0x0,void 0x0,function*(){const OA=a1g,f={},{contextProvider:i}=O,A=p[OA(0xf6)](OA(0x144)),Z=C[OA(0x150)]===!![];function c(U,d,r){var j,t;return __awaiter(this,void 0x0,void 0x0,function*(){const OZ=a1g;if(_[OZ(0x16e)]((t=(j=E[OZ(0x1a6)])===null||j===void 0x0?void 0x0:j[OZ(0x190)])!==null&&t!==void 0x0?t:{},U)){const Q=!Z&&!A&&r?r():undefined,T=C[U]||Q||(yield d());_[OZ(0x18b)](f,U,T);}});}return yield(0x0,utils_1[OA(0xd3)])(Object[OA(0x1ac)]((H=(K=E['opt'])===null||K===void 0x0?void 0x0:K[OA(0x190)])!==null&&H!==void 0x0?H:{}),([U,d])=>__awaiter(this,void 0x0,void 0x0,function*(){const Oc=OA;var r;const j=f===null||f===void 0x0?void 0x0:f['projectId'],t=f===null||f===void 0x0?void 0x0:f[Oc(0x1d1)];switch(U){case Oc(0x1bf):return yield c('projectId',S[Oc(0x15d)][Oc(0x10e)](S),i[Oc(0x118)]['bind'](i));case Oc(0x143):return yield c(Oc(0x143),S[Oc(0xe3)](j)[Oc(0x10e)](S),i[Oc(0x1a2)][Oc(0x10e)](i));case Oc(0x1d7):return yield c(Oc(0x1d7),S['askForAddon'](j)[Oc(0x10e)](S));case Oc(0x1e7):return yield c(Oc(0x1e7),S[Oc(0xfe)](j)['bind'](S),i[Oc(0x148)]['bind'](i));case Oc(0x1eb):return yield c(Oc(0x1eb),S[Oc(0x1b1)](f[Oc(0x1e7)],j,![])[Oc(0x10e)](S));case Oc(0x14f):return yield c(Oc(0x14f),S[Oc(0x132)](j)[Oc(0x10e)](S));case Oc(0x173):case Oc(0x13d):return yield c(Oc(0x173),S[Oc(0x109)][Oc(0x10e)](S));case Oc(0x19b):return yield c(Oc(0x19b),S[Oc(0x12f)]['bind'](S));case Oc(0x1d6):return yield c(Oc(0x1d6),S[Oc(0x147)](j)[Oc(0x10e)](S));case Oc(0x162):return yield c(Oc(0x162),S[Oc(0xe7)](f[Oc(0x173)])[Oc(0x10e)](S));case Oc(0x151):return yield c(Oc(0x151),S[Oc(0xe7)](f['domainId'])[Oc(0x10e)](S));case Oc(0x11e):return yield c(Oc(0x11e),S[Oc(0x1a3)](f[Oc(0x173)],(r=f[Oc(0x162)])!==null&&r!==void 0x0?r:f[Oc(0x151)])[Oc(0x10e)](S));case Oc(0x13b):return yield c(Oc(0x13b),S[Oc(0x13f)](j,f[Oc(0x1d7)])['bind'](S));case Oc(0x1cc):return yield c(Oc(0x1cc),S[Oc(0xd8)](j,f[Oc(0x143)],f[Oc(0x1e7)])['bind'](S));case Oc(0x1d1):return yield c(Oc(0x1d1),S[Oc(0x189)]()[Oc(0x10e)](S));case Oc(0x134):return yield c(Oc(0x134),S['askForTemplateRun'](t)[Oc(0x10e)](S));case Oc(0x108):return yield c('logSinkId',S[Oc(0x1cb)]()[Oc(0x10e)](S));case'pipelineId':return yield c(Oc(0xda),S['askForPipeline'](j)[Oc(0x10e)](S));case Oc(0x16b):return yield c(Oc(0x16b),S[Oc(0xdd)]()['bind'](S));case Oc(0x12c):return yield c(Oc(0x12c),S[Oc(0x128)]()['bind'](S));case Oc(0x17a):return yield c(Oc(0x17a),S[Oc(0x10c)]()[Oc(0x10e)](S));default:return yield c(U,S[Oc(0x17d)](U,d===null||d===void 0x0?void 0x0:d[Oc(0x119)])['bind'](S));}})),f;});}function v(C){var K,H,f;return __awaiter(this,void 0x0,void 0x0,function*(){const OU=a1g,i={},A=((K=E[OU(0x1a6)])===null||K===void 0x0?void 0x0:K[OU(0xf9)])?defaults['paginationArgs']:{},Z=Object['assign'](Object[OU(0x123)]({},(f=(H=E[OU(0x1a6)])===null||H===void 0x0?void 0x0:H[OU(0x1a4)])!==null&&f!==void 0x0?f:{}),A),c=Object[OU(0x126)](Z)[OU(0x135)](U=>U!==OU(0xd1));return yield(0x0,utils_1['asyncSequential'])(c,U=>__awaiter(this,void 0x0,void 0x0,function*(){const Od=OU;if(C[U]!==undefined)return _[Od(0x18b)](i,U,C[U]);})),i;});}function a(){const Or=OH;switch(p[0x0]){case Or(0x16d):return Or(0xeb)+(p[0x1]||Or(0x163))+'s';case'update':return Or(0xe9)+(p[0x1]||Or(0x163))+Or(0x130);default:return _[Or(0x12e)](N)+Or(0x1d5);}}function z(C,K){const Oj=OH;var H,f,i,A,Z,c,U,d;if(!K){const k=(0x0,utils_1[Oj(0x12a)])()[Oj(0x196)](_[Oj(0x112)](N))[Oj(0x119)](a());return m(k,N),k;}const r=(C===null||C===void 0x0?void 0x0:C[Oj(0x1c8)])?chalk_1[Oj(0x136)][Oj(0x104)](Oj(0x15f)+C['requiredPermissions']):'',j=O['contextProvider'][Oj(0x1be)](),t=j!==undefined&&((H=E===null||E===void 0x0?void 0x0:E['opt'])===null||H===void 0x0?void 0x0:H[Oj(0x159)])!==undefined,Q=j===null||j===void 0x0?void 0x0:j[Oj(0xe1)]['replace'](Oj(0xfc),''),T=t?Oj(0xe6)+Q+Oj(0x141)+((f=E===null||E===void 0x0?void 0x0:E[Oj(0x1a6)])===null||f===void 0x0?void 0x0:f[Oj(0x159)]):'',u=(C===null||C===void 0x0?void 0x0:C[Oj(0x119)])||'',I=(0x0,utils_1[Oj(0x12a)])(!![])['name'](_[Oj(0x112)](N))['description'](u)['addHelpText']('after',[r,T]['join']('\x0a'));m(I,N);(((i=E['opt'])===null||i===void 0x0?void 0x0:i['body'])||((A=E['opt'])===null||A===void 0x0?void 0x0:A[Oj(0x117)]))&&(I[Oj(0x10f)](Oj(0xf8),Oj(0x1b2)),I[Oj(0x10f)](Oj(0x11c),Oj(0x1ba)));F((Z=E[Oj(0x1a6)])===null||Z===void 0x0?void 0x0:Z['path'],I),F((c=E[Oj(0x1a6)])===null||c===void 0x0?void 0x0:c[Oj(0x1a4)],I);const x=(U=E[Oj(0x1a6)])===null||U===void 0x0?void 0x0:U[Oj(0xf9)];return x&&F(defaults[Oj(0xf0)],I),F((d=E['opt'])===null||d===void 0x0?void 0x0:d[Oj(0xde)],I),I['action'](()=>__awaiter(this,void 0x0,void 0x0,function*(){const Ot=Oj;var s,P,B,w,J,h;(0x0,utils_1[Ot(0x1e8)])(O);const D=I[Ot(0x140)]();(D===null||D===void 0x0?void 0x0:D[Ot(0x1ec)])&&utils_1[Ot(0x1bc)]&&(0x0,utils_1[Ot(0x1bb)])(Ot(0xfd));const O0=D['page']!==undefined||D[Ot(0x1d3)]!==undefined;if(D[Ot(0xd1)]===!![]&&O0)throw new Error('Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27');const O1=D===null||D===void 0x0?void 0x0:D[Ot(0x160)],O2=O1==='json',O3=O1===Ot(0x12b)||O1===Ot(0x129),O4=yield o(D);S['setPathVars'](O4);const O5=yield v(D),O6=Object[Ot(0x126)]((P=(s=E[Ot(0x1a6)])===null||s===void 0x0?void 0x0:s[Ot(0x190)])!==null&&P!==void 0x0?P:{})[Ot(0x178)](Og=>Og+'='+chalk_1['default'][Ot(0xf4)](O4[Og]))[Ot(0x191)](',\x20');if(O6['length']>0x0&&!O2&&!O3){const Og=Ot(0x1b4)+O6;console['log'](Og);}const O7=((B=E[Ot(0x1a6)])===null||B===void 0x0?void 0x0:B[Ot(0x188)])||((w=E[Ot(0x1a6)])===null||w===void 0x0?void 0x0:w[Ot(0x117)])?yield L(D,E,p):undefined;if(!D[Ot(0x106)]&&p['includes'](Ot(0x144))&&!(yield S[Ot(0x180)]())){(0x0,utils_1[Ot(0x1bb)])('Resource\x20was\x20not\x20deleted.');return;}const O8=x&&(D['loadAll']||(D[Ot(0x160)]==='json'||D['output']===Ot(0x12b))&&!O0);let O9=O8&&b instanceof js_client_1[Ot(0x18d)]?yield b[Ot(0x114)]({'parameters':O4,'options':O5,'data':O7}):yield b['call']({'parameters':O4,'options':Object[Ot(0x123)]({},O5),'data':O7});if(D===null||D===void 0x0?void 0x0:D['verbose']){const OR=O9[Ot(0x1aa)];console[Ot(0x127)](Ot(0x158)+OR[Ot(0xe2)][Ot(0x194)]()+':'+OR[Ot(0x183)]);if(O7!==undefined)console[Ot(0x127)](Ot(0xd9)+O7);}if(O9['error']){const {details:OY,id:Oy,message:On,status:OG}=O9[Ot(0x15a)],OS=OY?Ot(0x10d)+JSON[Ot(0x168)](OY):'',Oq=Oy?Ot(0xdc)+Oy:'',OV=Ot(0x107)+OG+Oq+')';throw new Error(Ot(0x187)+On+'\x20'+OV+OS);}let OO=0x0;printCallResult(D,O2,O9[Ot(0x1d8)],O3,p,O1,![],OO,O9[Ot(0x1c7)][Ot(0x19a)]);if(!D[Ot(0x1dc)]&&!O8&&!O0&&((J=O9[Ot(0x138)])===null||J===void 0x0?void 0x0:J[Ot(0x1c1)]))while((h=O9[Ot(0x138)])===null||h===void 0x0?void 0x0:h[Ot(0x1c1)]){const Oe=yield S[Ot(0x17b)](Ot(0x185));if(Oe)process[Ot(0x198)][Ot(0x18e)](0x0,-0x1),process['stdout'][Ot(0x156)](0x1),OO+=O9['pagination'][Ot(0x146)],O9=yield O9[Ot(0x138)][Ot(0x1c2)](),printCallResult(D,O2,O9[Ot(0x1d8)],O3,p,O1,!![],OO,O9['rawResponse']['statusText']);else return;}})),I;}const W=_[OH(0x16e)](E,'opt'),X=b,M=z(X,W);e(p,M),R['addCommand'](M);const l=_[OH(0x172)](E,OH(0x1a6));Object[OH(0x126)](l)[OH(0x170)]>0x0&&generateCommands(O,b,M,Y,y,l,p);});function L(N,b,E){var p;return __awaiter(this,void 0x0,void 0x0,function*(){const OQ=a1g,{input:F,file:m}=N;if(F!==undefined)try{return JSON[OQ(0x161)](F);}catch(o){try{return yaml['safeLoad'](F);}catch(v){throw new Error('Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.');}}if(m!==undefined){if(!fs_1['default'][OQ(0x1b7)](m))throw new Error(OQ(0x14e)+m);const a=fs_1['default'][OQ(0x139)](m)[OQ(0x19f)]();let z;try{if(_[OQ(0x19e)](a)){if(N[OQ(0x17c)][OQ(0x1de)]('.json'))z=JSON[OQ(0x161)](a);else{if(N['file']['endsWith'](OQ(0xf5))||N[OQ(0x17c)][OQ(0x1de)](OQ(0x129)))z=yaml[OQ(0x1a1)](a);else throw new Error(OQ(0x1ce)+N[OQ(0x17c)][OQ(0x1c3)]('.')[OQ(0x167)]());}}else z=a;return z;}catch(W){throw new Error(OQ(0x15e)+W[OQ(0x1da)]);}}if((p=b===null||b===void 0x0?void 0x0:b['opt'])===null||p===void 0x0?void 0x0:p[OQ(0x117)])throw new Error(OQ(0x1b9));return yield S[OQ(0xed)](b,{'cmdPath':E,'skipValidation':N[OQ(0xf1)]});});}}const printCallResult=(O,g,R,Y,y,n,G,S,q)=>{const OT=a1ON;if(!(O===null||O===void 0x0?void 0x0:O[OT(0x1dc)])){if(g)(0x0,console_format_helpers_1[OT(0x1ab)])(O===null||O===void 0x0?void 0x0:O[OT(0x160)],R);else{if(Y)(0x0,console_format_helpers_1['handleYamlOutput'])(O===null||O===void 0x0?void 0x0:O['output'],R);else{if(isListCommand(y)){const V=(n===null||n===void 0x0?void 0x0:n[OT(0xe4)](OT(0x197)))?n['replace'](OT(0x197),'')['split'](',')[OT(0x178)](E=>E[OT(0x1cf)]()):undefined,e=y[y[OT(0x170)]-0x1],L=''+e+(e[OT(0x1de)]('s')?'':'s'),N=_[OT(0x12e)](L),b=_['has'](R,L)?R[L]:R;(0x0,console_format_helpers_1[OT(0x10b)])(b,N,V,G,S);}else console[OT(0x127)]((0x0,console_format_helpers_1['consoleFormat'])(R,q));}}}};
@@ -1 +1 @@
1
- 'use strict';const a2P=a2K;function a2K(Z,K){const O=a2Z();return a2K=function(g,N){g=g-0x11b;let H=O[g];return H;},a2K(Z,K);}(function(Z,K){const Y=a2K,O=Z();while(!![]){try{const g=parseInt(Y(0x150))/0x1*(parseInt(Y(0x17f))/0x2)+parseInt(Y(0x1a1))/0x3+-parseInt(Y(0x181))/0x4+parseInt(Y(0x144))/0x5+-parseInt(Y(0x1b7))/0x6*(-parseInt(Y(0x121))/0x7)+parseInt(Y(0x14e))/0x8*(parseInt(Y(0x1bb))/0x9)+-parseInt(Y(0x1a2))/0xa;if(g===K)break;else O['push'](O['shift']());}catch(N){O['push'](O['shift']());}}}(a2Z,0x6f63b));var __createBinding=this&&this[a2P(0x192)]||(Object['create']?function(Z,K,O,g){const C=a2P;if(g===undefined)g=O;var N=Object[C(0x16b)](K,O);(!N||(C(0x182)in N?!K[C(0x180)]:N[C(0x165)]||N['configurable']))&&(N={'enumerable':!![],'get':function(){return K[O];}}),Object[C(0x162)](Z,g,N);}:function(Z,K,O,g){if(g===undefined)g=O;Z[g]=K[O];}),__setModuleDefault=this&&this[a2P(0x1aa)]||(Object[a2P(0x13f)]?function(Z,K){const S=a2P;Object[S(0x162)](Z,S(0x136),{'enumerable':!![],'value':K});}:function(Z,K){const n=a2P;Z[n(0x136)]=K;}),__importStar=this&&this[a2P(0x133)]||function(Z){const k=a2P;if(Z&&Z[k(0x180)])return Z;var K={};if(Z!=null){for(var O in Z)if(O!==k(0x136)&&Object[k(0x153)][k(0x12c)][k(0x199)](Z,O))__createBinding(K,Z,O);}return __setModuleDefault(K,Z),K;},__awaiter=this&&this[a2P(0x16f)]||function(Z,K,O,g){function N(H){return H instanceof O?H:new O(function(o){o(H);});}return new(O||(O=Promise))(function(H,o){const r=a2K;function s(W){const x=a2K;try{y(g[x(0x18d)](W));}catch(B){o(B);}}function R(W){try{y(g['throw'](W));}catch(B){o(B);}}function y(W){const m=a2K;W['done']?H(W[m(0x11d)]):N(W[m(0x11d)])[m(0x15c)](s,R);}y((g=g[r(0x138)](Z,K||[]))['next']());});},__importDefault=this&&this[a2P(0x159)]||function(Z){return Z&&Z['__esModule']?Z:{'default':Z};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[a2P(0x11e)]=void 0x0;function a2Z(){const t=['test','replace','name','InquirerHelper','__setModuleDefault','Shows\x20full\x20context\x20information\x20(including\x20tokens)','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','Update\x20token\x20for\x20current\x20context','remove','../inquirer-helper','verifyToken','map','askForService','clearLine','Retrieve\x20and\x20update\x20local\x20context\x20settings.','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','contextAvailable','12LbgDxV','getInfo','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','8451UXUtia','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','Bearer\x20','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','contextProvider','value','CliContext','error','Name\x20for\x20login\x20context','1670221RCrBas','action','useJobId','service','defaultBaseUrl','finally','Local\x20context\x20name\x20to\x20remove.','\x20(api\x20host:\x20','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','list','search-list','hasOwnProperty','--token-login','ProxyAgent','alias','project','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','-i,\x20--id\x20[ID]','__importStar','success','\x20(current)','default','token','apply','addContext','getCurrentBaseUrl','set','tokenPrompt','moveCursor','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','create','removeContext','all','use','chalk','3201475SQWCSK','apiTokenLogin','getProjectName','browser-opened','Use\x20job\x20with\x20id:','message','askForContext','--host\x20[HOST]','-t,\x20--token\x20[TOKEN]','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','1624vqYQGa','context','3233fhXMUV','useServiceId','getCommand','prototype','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','sessionToken=********','description','sort','prompt','__importDefault','valueOf','useContext','then','node-fetch','getCurrentContext','Token\x20for\x20this\x20context','dir','useProjectId','defineProperty','loginPrompt','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','writable','current','log','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','apiClient','use\x20from\x20now\x20on','getOwnPropertyDescriptor','length','autologin-','Changed\x20current\x20context\x20to\x20','__awaiter','browser\x20login','Use\x20manual\x20login\x20with\x20API\x20token','Remove\x20a\x20context','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','https://api.northflank.com','host','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','ctx','contexts','doNotOpenBrowser','Contexts','sanitiseHostname','getCurrentName','host\x20url\x20for\x20this\x20context','Use\x20project\x20with\x20id:','236nBHkku','__esModule','3277056KQYjya','get','proxy-agent',',\x20added\x20context\x20with\x20name\x20','loadContextWrapper','override','https://','List\x20all\x20available\x20contexts','Use\x20service\x20with\x20id:','agent','--do-not-open-browser','stdout','next','delete','login','askForJob','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','__createBinding','warning','addCommand','/v1/login','option','browserLogin','.\x20Using\x20fallback.','call','startLogin','token\x20login','../utils','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','set-token','timeout','job','2559882sFvcoG','12673910kuIjGM','--all','GET','updateToken'];a2Z=function(){return t;};return a2Z();}const _=__importStar(require('lodash')),proxy_agent_1=require(a2P(0x183)),chalk_1=__importDefault(require(a2P(0x143))),utils_1=require(a2P(0x19c)),inquirer_helper_1=require(a2P(0x1af)),console_format_helpers_1=require('../formatting/console-format-helpers'),browser_login_1=require('../login/browser-login'),node_fetch_1=__importDefault(require(a2P(0x15d))),inquirer=require('inquirer');class CliContext{constructor(Z,K=undefined,O=a2P(0x174)){const D=a2P;this[D(0x18a)]=K,this['defaultBaseUrl']=O,this['sanitiseHostname']=V=>{const d=D;let M=V;return!/^https?:\/\//i[d(0x1a6)](M)&&(M=d(0x187)+M),M=M[d(0x1a7)](/\/+$/,''),M;},this['apiClient']=Z;const g=new inquirer_helper_1[(D(0x1a9))](Z);this[D(0x18f)]=(0x0,utils_1[D(0x152)])()[D(0x1a8)](D(0x18f))['description'](D(0x11b))['option'](D(0x12d),D(0x171),![])[D(0x196)](D(0x18b),D(0x1b5),![])[D(0x196)]('-n,\x20--name\x20[NAME]',D(0x120))[D(0x196)](D(0x14c),D(0x14d))['option'](D(0x14b),D(0x17d),this[D(0x125)])['option']('--override','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)',![])['action'](V=>__awaiter(this,void 0x0,void 0x0,function*(){const b=D;_[b(0x13b)](V,b(0x175),this[b(0x17b)](V[b(0x175)]));const M=V['tokenLogin']||V[b(0x137)]!==undefined,{name:I,host:c,token:E,override:p}=M?yield this[b(0x145)](V,g):yield this[b(0x197)](V,g);try{yield this[b(0x169)][b(0x11c)][b(0x139)]({'name':I,'host':c,'token':E},p);}catch(T){(0x0,utils_1[b(0x11f)])(T[b(0x149)]);return;}if(!(yield this[b(0x1b0)]()))(0x0,utils_1[b(0x11f)])(b(0x129)),yield this[b(0x169)][b(0x11c)][b(0x140)](I);else{const J=M?b(0x19b):b(0x170),q='\x0aSuccessfully\x20logged\x20in\x20using\x20'+J+b(0x184)+chalk_1[b(0x136)]['italic'](I)+b(0x128)+c+')';(0x0,utils_1['success'])(q);}})),this[D(0x178)]=(0x0,utils_1['getCommand'])()['name'](D(0x14f))[D(0x156)](D(0x1b4))[D(0x12f)](D(0x178))[D(0x12f)](D(0x177));const N=(0x0,utils_1[D(0x152)])()[D(0x1a8)]('list')['name']('ls')[D(0x156)](D(0x188))[D(0x196)](D(0x1a3),D(0x1ab))[D(0x122)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const l=D;console[l(0x167)](Z['contextProvider'][l(0x1b8)]());const M=Z['contextProvider'][l(0x185)]();if(V[l(0x141)]===!![]){console[l(0x160)](M);return;}const I=M[l(0x166)],c=M[l(0x178)][l(0x157)]((E,p)=>E[l(0x1a8)]===I?-0x1:p['name']===I?0x1:0x0)[l(0x1b1)](E=>{const f=l,p=I===E['name']?f(0x135):'';return{'Name':''+E[f(0x1a8)]+p,'Host':E[f(0x175)],'Default\x20Project':E['project']||'-','Default\x20Service':E[f(0x124)]||'-'};});(0x0,console_format_helpers_1['printAsTable'])(c,l(0x17a));})),H=(0x0,utils_1['getCommand'])();H[D(0x1a8)](D(0x142))[D(0x156)]('Switch\x20between\x20your\x20local\x20contexts')[D(0x196)]('-n,\x20--name\x20[NAME]',D(0x1bc))[D(0x122)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const a=D,M=(V===null||V===void 0x0?void 0x0:V[a(0x1a8)])||(yield this['askForContext'](a(0x142)));yield this[a(0x169)][a(0x11c)][a(0x15b)](M),(0x0,utils_1[a(0x134)])(a(0x16e)+M);}));const o=D(0x132),s=(0x0,utils_1[D(0x152)])()[D(0x1a8)](D(0x130))[D(0x156)](D(0x131))[D(0x196)](o,D(0x1b9))['action'](V=>__awaiter(this,void 0x0,void 0x0,function*(){const v=D,M=(V===null||V===void 0x0?void 0x0:V['id'])||(yield g['askForProject']());yield this[v(0x169)]['contextProvider'][v(0x161)](M),console[v(0x167)](v(0x17e),M);})),R=(0x0,utils_1['getCommand'])()[D(0x1a8)](D(0x124))[D(0x156)](D(0x173))[D(0x196)](o,D(0x19d))[D(0x122)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const L=D,M=(V===null||V===void 0x0?void 0x0:V['id'])||(yield g[L(0x1b2)](this[L(0x146)]())());console['log'](L(0x189),M),yield this['apiClient']['contextProvider'][L(0x151)](M);})),y=(0x0,utils_1[D(0x152)])()[D(0x1a8)](D(0x1a0))[D(0x156)](D(0x176))['option'](o,D(0x168))[D(0x122)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const X=D,M=(V===null||V===void 0x0?void 0x0:V['id'])||(yield g[X(0x190)](this[X(0x146)]())());console[X(0x167)](X(0x148),M),yield this[X(0x169)][X(0x11c)][X(0x123)](M);}));H[D(0x194)](s),H[D(0x194)](y),H[D(0x194)](R);const W=(0x0,utils_1['getCommand'])()[D(0x1a8)](D(0x1ae))['alias'](D(0x18e))['alias']('rm')[D(0x156)](D(0x172))[D(0x196)](o,D(0x127))[D(0x122)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const e=D;var M;const I=(V===null||V===void 0x0?void 0x0:V['id'])||(yield this[e(0x14a)](e(0x1ae))),c=(M=this[e(0x169)][e(0x11c)][e(0x15e)]())===null||M===void 0x0?void 0x0:M[e(0x1a8)];yield this['apiClient'][e(0x11c)][e(0x140)](I),(0x0,utils_1[e(0x134)])('Local\x20context\x20\x27'+I+'\x27\x20successfully\x20removed.');if(!this[e(0x1b6)]()){(0x0,utils_1[e(0x193)])(e(0x191));return;}if(c===I){const E=(V===null||V===void 0x0?void 0x0:V[e(0x1a8)])||(yield this[e(0x14a)](e(0x16a)));yield this[e(0x169)]['contextProvider'][e(0x15b)](E),(0x0,utils_1[e(0x134)])(e(0x16e)+E);}})),B=(0x0,utils_1['getCommand'])()['name']('update-token')[D(0x12f)](D(0x19e))[D(0x156)](D(0x1ad))[D(0x196)]('-t,\x20--token\x20[TOKEN]',D(0x15f))['action'](V=>__awaiter(this,void 0x0,void 0x0,function*(){const U=D,{contextProvider:M}=this['apiClient'],I=(V===null||V===void 0x0?void 0x0:V[U(0x137)])||(yield g[U(0x13c)]()),c=M['getCurrentToken']();yield M[U(0x1a5)](I);if(yield this[U(0x1b0)]())(0x0,utils_1[U(0x134)])('Token\x20for\x20current\x20context\x20\x27'+M[U(0x17c)]()+'\x27\x20successfully\x20updated.');else{if(c)yield M[U(0x1a5)](c);(0x0,utils_1['error'])(U(0x1ba));}}));this[D(0x178)][D(0x194)](N),this[D(0x178)][D(0x194)](H),this[D(0x178)][D(0x194)](W),this[D(0x178)][D(0x194)](B);}[a2P(0x197)](Z,K){var O,g,N,H;return __awaiter(this,void 0x0,void 0x0,function*(){const i=a2K,o=!Z[i(0x179)],s=(O=Z[i(0x175)])!==null&&O!==void 0x0?O:this[i(0x125)],R=new browser_login_1['NorthflankApiBrowserLogin'](s,o,this[i(0x18a)]);let y;R['on'](i(0x147),({url:M})=>{const z=i;if(o){const I=M['replace'](/sessionToken=.*/,z(0x155));console[z(0x167)](z(0x164)+I+')'),y=inquirer[z(0x158)]([{'type':'confirm','name':'fullUrl','message':'Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','default':![]}]),y[z(0x15c)](c=>{const j=z;process['stdout'][j(0x13d)](0x0,-0x1),process[j(0x18c)][j(0x1b3)](0x1),c['fullUrl']&&console[j(0x167)](j(0x154)+M+'\x20');});}else console['log']('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+M+'\x20');});const {token:W,contextName:B}=yield R[i(0x19a)]()['catch'](M=>__awaiter(this,void 0x0,void 0x0,function*(){const G=i;(0x0,utils_1[G(0x11f)])('Error\x20occured\x20during\x20browser\x20login:\x20'+M[G(0x149)]+G(0x198));const I=yield this[G(0x145)](Z,K);return{'token':I[G(0x137)],'contextName':I[G(0x1a8)]};}))[i(0x126)](()=>{if(y)y['ui']['close']();}),V=(N=(g=Z['name'])!==null&&g!==void 0x0?g:B)!==null&&N!==void 0x0?N:i(0x16d)+new Date()[i(0x15a)]();return{'name':V,'token':W,'host':s,'override':(H=Z[i(0x186)])!==null&&H!==void 0x0?H:![]};});}[a2P(0x145)](Z,K){return __awaiter(this,void 0x0,void 0x0,function*(){const w=a2K,O=this['apiClient'][w(0x11c)][w(0x185)]()['contexts'],{name:g,token:N,host:H,override:o}=yield K[w(0x163)](Z,O);return{'name':g,'token':N,'host':H,'override':o};});}['getProjectName'](){const Q=a2P,Z=this[Q(0x169)][Q(0x11c)]['getCurrentProjectName']();if(Z===undefined)throw new Error(Q(0x1ac));return Z;}[a2P(0x14a)](Z){return __awaiter(this,void 0x0,void 0x0,function*(){const u=a2K;if(!this['contextAvailable']())throw new Error(u(0x13e));const K=this[u(0x169)]['contextProvider'][u(0x185)]()['contexts'][u(0x1b1)](g=>g[u(0x1a8)]),O=K[u(0x16c)]>0x4?u(0x12b):u(0x12a);return(yield inquirer[u(0x158)]([{'type':O,'name':u(0x1a8),'message':'Choose\x20the\x20context\x20to\x20'+Z+':','choices':K}]))['name'];});}[a2P(0x1b6)](){const F=a2P;return this[F(0x169)][F(0x11c)]['loadContextWrapper']()[F(0x178)][F(0x16c)]>0x0;}[a2P(0x1b0)](){return __awaiter(this,void 0x0,void 0x0,function*(){const A=a2K;try{const Z=this[A(0x169)][A(0x11c)][A(0x13a)](),K=this[A(0x169)][A(0x11c)]['getCurrentToken'](),O=Z+A(0x195),g={'Authorization':A(0x1bd)+K},N=new proxy_agent_1[(A(0x12e))](),H=yield(0x0,utils_1['retry'])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const h=A;return(0x0,node_fetch_1['default'])(O,{'method':h(0x1a4),'signal':AbortSignal[h(0x19f)](0xbb8),'headers':g,'agent':N});}));if(H['ok'])return!![];return![];}catch(o){return![];}});}}exports[a2P(0x11e)]=CliContext;
1
+ 'use strict';const a2W=a2g;(function(O,g){const z=a2g,R=O();while(!![]){try{const Y=-parseInt(z(0x9d))/0x1*(parseInt(z(0x101))/0x2)+-parseInt(z(0xa9))/0x3*(parseInt(z(0x6e))/0x4)+parseInt(z(0x71))/0x5*(parseInt(z(0xdc))/0x6)+-parseInt(z(0xb7))/0x7+-parseInt(z(0xe1))/0x8+-parseInt(z(0x89))/0x9*(-parseInt(z(0x95))/0xa)+-parseInt(z(0x83))/0xb*(-parseInt(z(0x72))/0xc);if(Y===g)break;else R['push'](R['shift']());}catch(y){R['push'](R['shift']());}}}(a2O,0xbe7a3));var __createBinding=this&&this['__createBinding']||(Object[a2W(0x6f)]?function(O,g,R,Y){const X=a2W;if(Y===undefined)Y=R;var y=Object[X(0xfd)](g,R);(!y||(X(0xec)in y?!g[X(0xd7)]:y['writable']||y[X(0xa8)]))&&(y={'enumerable':!![],'get':function(){return g[R];}}),Object[X(0xa0)](O,Y,y);}:function(O,g,R,Y){if(Y===undefined)Y=R;O[Y]=g[R];}),__setModuleDefault=this&&this[a2W(0xe6)]||(Object[a2W(0x6f)]?function(O,g){const M=a2W;Object[M(0xa0)](O,M(0x99),{'enumerable':!![],'value':g});}:function(O,g){O['default']=g;}),__importStar=this&&this[a2W(0xe4)]||function(O){const l=a2W;if(O&&O[l(0xd7)])return O;var g={};if(O!=null){for(var R in O)if(R!==l(0x99)&&Object['prototype'][l(0xed)][l(0xa5)](O,R))__createBinding(g,O,R);}return __setModuleDefault(g,O),g;},__awaiter=this&&this['__awaiter']||function(O,g,R,Y){function y(n){return n instanceof R?n:new R(function(G){G(n);});}return new(R||(R=Promise))(function(n,G){const f=a2g;function S(L){const C=a2g;try{V(Y[C(0x88)](L));}catch(N){G(N);}}function q(L){const K=a2g;try{V(Y[K(0xfb)](L));}catch(N){G(N);}}function V(e){const H=a2g;e[H(0x7a)]?n(e[H(0x9c)]):y(e['value'])[H(0x100)](S,q);}V((Y=Y[f(0x82)](O,g||[]))[f(0x88)]());});},__importDefault=this&&this['__importDefault']||function(O){return O&&O['__esModule']?O:{'default':O};};Object[a2W(0xa0)](exports,a2W(0xd7),{'value':!![]}),exports[a2W(0xc8)]=void 0x0;function a2g(O,g){const R=a2O();return a2g=function(Y,y){Y=Y-0x66;let n=R[Y];return n;},a2g(O,g);}const _=__importStar(require('lodash')),proxy_agent_1=require('proxy-agent'),chalk_1=__importDefault(require(a2W(0x67))),utils_1=require(a2W(0xf5)),inquirer_helper_1=require(a2W(0x9b)),console_format_helpers_1=require(a2W(0x8d)),browser_login_1=require('../login/browser-login'),node_fetch_1=__importDefault(require(a2W(0x70))),inquirer=require(a2W(0x76));function a2O(){const O0=['--do-not-open-browser','token','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','tokenLogin','browserLogin','Local\x20context\x20\x27','finally','CliContext','verifyToken','remove','Local\x20context\x20name\x20to\x20remove.','contexts','addCommand','project','ctx','token\x20login','agent','test','InquirerHelper','Use\x20project\x20with\x20id:','NorthflankApiBrowserLogin','ProxyAgent','__esModule','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','warning','option','Shows\x20full\x20context\x20information\x20(including\x20tokens)','6VGIToC','-n,\x20--name\x20[NAME]','error','italic','description','10339328QhDfsD','list','Update\x20token\x20for\x20current\x20context','__importStar','getCurrentContext','__setModuleDefault','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','moveCursor','clearLine','askForProject','success','get','hasOwnProperty','retry','host\x20url\x20for\x20this\x20context','apiTokenLogin','Contexts','GET','map','addContext','../utils','job','getInfo','Error\x20occured\x20during\x20browser\x20login:\x20','dir','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','throw','-t,\x20--token\x20[TOKEN]','getOwnPropertyDescriptor','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','replace','then','596lVDyby','--all','tokenPrompt','useContext','\x0aSuccessfully\x20logged\x20in\x20using\x20','chalk','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','\x20(api\x20host:\x20','set','context','4804CDhlbF','create','node-fetch','5029065nsdRar','1212996mOoxee','host','doNotOpenBrowser','Retrieve\x20and\x20update\x20local\x20context\x20settings.','inquirer','Token\x20for\x20current\x20context\x20\x27','-i,\x20--id\x20[ID]','message','done','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','removeContext','Switch\x20between\x20your\x20local\x20contexts','useProjectId','askForJob','apiClient','use\x20from\x20now\x20on','apply','297fSnBgp','login','--host\x20[HOST]','.\x20Using\x20fallback.','getCurrentName','next','930438jleUWc','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','contextProvider','../formatting/console-format-helpers','search-list','List\x20all\x20available\x20contexts','contextAvailable','getCurrentBaseUrl','length','close','log','110KsJIRC','Bearer\x20','Use\x20job\x20with\x20id:','fullUrl','default','Changed\x20current\x20context\x20to\x20','../inquirer-helper','value','4493FQUSQH','--token-login','startLogin','defineProperty','getCurrentToken','getCommand','--override','defaultBaseUrl','call','name','prompt','configurable','2319tTBGpr','updateToken','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','browser-opened','Remove\x20a\x20context','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','valueOf','\x27\x20successfully\x20removed.','askForService','sort','alias','/v1/login','use','update-token','3726506xSgdvm','Token\x20for\x20this\x20context','loadContextWrapper','browser\x20login','loginPrompt','askForContext','stdout','getProjectName','action','sessionToken=********'];a2O=function(){return O0;};return a2O();}class CliContext{constructor(O,g=undefined,R='https://api.northflank.com'){const i=a2W;this[i(0xd1)]=g,this[i(0xa4)]=R,this['sanitiseHostname']=N=>{const A=i;let b=N;return!/^https?:\/\//i[A(0xd2)](b)&&(b='https://'+b),b=b[A(0xff)](/\/+$/,''),b;},this['apiClient']=O;const Y=new inquirer_helper_1[(i(0xd3))](O);this[i(0x84)]=(0x0,utils_1[i(0xa2)])()[i(0xa6)](i(0x84))[i(0xe0)]('Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.')[i(0xda)](i(0x9e),'Use\x20manual\x20login\x20with\x20API\x20token',![])[i(0xda)](i(0xc1),i(0x7b),![])[i(0xda)](i(0xdd),'Name\x20for\x20login\x20context')[i(0xda)](i(0xfc),i(0xfa))[i(0xda)](i(0x85),i(0xef),this['defaultBaseUrl'])[i(0xda)](i(0xa3),i(0xfe),![])['action'](N=>__awaiter(this,void 0x0,void 0x0,function*(){const Z=i;_[Z(0x6c)](N,'host',this['sanitiseHostname'](N[Z(0x73)]));const b=N[Z(0xc4)]||N[Z(0xc2)]!==undefined,{name:E,host:p,token:F,override:m}=b?yield this[Z(0xf0)](N,Y):yield this[Z(0xc5)](N,Y);try{yield this[Z(0x80)]['contextProvider'][Z(0xf4)]({'name':E,'host':p,'token':F},m);}catch(o){(0x0,utils_1['error'])(o[Z(0x79)]);return;}if(!(yield this[Z(0xc9)]()))(0x0,utils_1[Z(0xde)])(Z(0xe7)),yield this[Z(0x80)][Z(0x8c)]['removeContext'](E);else{const v=b?Z(0xd0):Z(0xba),a=Z(0x66)+v+',\x20added\x20context\x20with\x20name\x20'+chalk_1['default'][Z(0xdf)](E)+Z(0x6b)+p+')';(0x0,utils_1['success'])(a);}})),this[i(0xcc)]=(0x0,utils_1[i(0xa2)])()[i(0xa6)](i(0x6d))[i(0xe0)](i(0x75))[i(0xb3)]('contexts')['alias'](i(0xcf));const y=(0x0,utils_1['getCommand'])()[i(0xa6)]('list')[i(0xa6)]('ls')[i(0xe0)](i(0x8f))[i(0xda)](i(0x102),i(0xdb))[i(0xbf)](N=>__awaiter(this,void 0x0,void 0x0,function*(){const c=i;console[c(0x94)](O[c(0x8c)][c(0xf7)]());const b=O[c(0x8c)][c(0xb9)]();if(N['all']===!![]){console[c(0xf9)](b);return;}const E=b['current'],p=b[c(0xcc)][c(0xb2)]((F,m)=>F[c(0xa6)]===E?-0x1:m['name']===E?0x1:0x0)['map'](F=>{const U=c,m=E===F['name']?'\x20(current)':'';return{'Name':''+F['name']+m,'Host':F[U(0x73)],'Default\x20Project':F[U(0xce)]||'-','Default\x20Service':F['service']||'-'};});(0x0,console_format_helpers_1['printAsTable'])(p,c(0xf1));})),n=(0x0,utils_1[i(0xa2)])();n[i(0xa6)]('use')[i(0xe0)](i(0x7d))['option'](i(0xdd),i(0x69))['action'](N=>__awaiter(this,void 0x0,void 0x0,function*(){const d=i,b=(N===null||N===void 0x0?void 0x0:N[d(0xa6)])||(yield this[d(0xbc)](d(0xb5)));yield this[d(0x80)][d(0x8c)][d(0x104)](b),(0x0,utils_1[d(0xeb)])(d(0x9a)+b);}));const G=i(0x78),S=(0x0,utils_1[i(0xa2)])()[i(0xa6)](i(0xce))[i(0xe0)](i(0xd8))['option'](G,i(0x8a))['action'](N=>__awaiter(this,void 0x0,void 0x0,function*(){const r=i,b=(N===null||N===void 0x0?void 0x0:N['id'])||(yield Y[r(0xea)]());yield this[r(0x80)]['contextProvider'][r(0x7e)](b),console[r(0x94)](r(0xd4),b);})),q=(0x0,utils_1['getCommand'])()[i(0xa6)]('service')[i(0xe0)]('Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context')[i(0xda)](G,'Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')[i(0xbf)](N=>__awaiter(this,void 0x0,void 0x0,function*(){const j=i,b=(N===null||N===void 0x0?void 0x0:N['id'])||(yield Y[j(0xb1)](this[j(0xbe)]())());console[j(0x94)]('Use\x20service\x20with\x20id:',b),yield this[j(0x80)]['contextProvider']['useServiceId'](b);})),V=(0x0,utils_1[i(0xa2)])()[i(0xa6)](i(0xf6))['description']('Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context')[i(0xda)](G,i(0xc3))[i(0xbf)](N=>__awaiter(this,void 0x0,void 0x0,function*(){const t=i,b=(N===null||N===void 0x0?void 0x0:N['id'])||(yield Y[t(0x7f)](this['getProjectName']())());console['log'](t(0x97),b),yield this[t(0x80)][t(0x8c)]['useJobId'](b);}));n[i(0xcd)](S),n[i(0xcd)](V),n[i(0xcd)](q);const e=(0x0,utils_1[i(0xa2)])()[i(0xa6)](i(0xca))[i(0xb3)]('delete')[i(0xb3)]('rm')['description'](i(0xad))[i(0xda)](G,i(0xcb))[i(0xbf)](N=>__awaiter(this,void 0x0,void 0x0,function*(){const Q=i;var b;const E=(N===null||N===void 0x0?void 0x0:N['id'])||(yield this[Q(0xbc)](Q(0xca))),p=(b=this[Q(0x80)]['contextProvider'][Q(0xe5)]())===null||b===void 0x0?void 0x0:b['name'];yield this[Q(0x80)][Q(0x8c)][Q(0x7c)](E),(0x0,utils_1[Q(0xeb)])(Q(0xc6)+E+Q(0xb0));if(!this[Q(0x90)]()){(0x0,utils_1[Q(0xd9)])(Q(0x68));return;}if(p===E){const F=(N===null||N===void 0x0?void 0x0:N['name'])||(yield this[Q(0xbc)](Q(0x81)));yield this[Q(0x80)][Q(0x8c)]['useContext'](F),(0x0,utils_1[Q(0xeb)])('Changed\x20current\x20context\x20to\x20'+F);}})),L=(0x0,utils_1[i(0xa2)])()['name'](i(0xb6))[i(0xb3)]('set-token')[i(0xe0)](i(0xe3))['option'](i(0xfc),i(0xb8))[i(0xbf)](N=>__awaiter(this,void 0x0,void 0x0,function*(){const T=i,{contextProvider:b}=this['apiClient'],E=(N===null||N===void 0x0?void 0x0:N[T(0xc2)])||(yield Y[T(0x103)]()),p=b['getCurrentToken']();yield b[T(0xaa)](E);if(yield this[T(0xc9)]())(0x0,utils_1[T(0xeb)])(T(0x77)+b[T(0x87)]()+'\x27\x20successfully\x20updated.');else{if(p)yield b[T(0xaa)](p);(0x0,utils_1[T(0xde)])(T(0x6a));}}));this['contexts'][i(0xcd)](y),this[i(0xcc)][i(0xcd)](n),this['contexts'][i(0xcd)](e),this[i(0xcc)][i(0xcd)](L);}[a2W(0xc5)](O,g){var R,Y,y,n;return __awaiter(this,void 0x0,void 0x0,function*(){const u=a2g,G=!O[u(0x74)],S=(R=O[u(0x73)])!==null&&R!==void 0x0?R:this[u(0xa4)],q=new browser_login_1[(u(0xd5))](S,G,this[u(0xd1)]);let V;q['on'](u(0xac),({url:b})=>{const I=u;if(G){const E=b[I(0xff)](/sessionToken=.*/,I(0xc0));console[I(0x94)](I(0xae)+E+')'),V=inquirer[I(0xa7)]([{'type':'confirm','name':I(0x98),'message':'Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','default':![]}]),V[I(0x100)](p=>{const x=I;process[x(0xbd)][x(0xe8)](0x0,-0x1),process[x(0xbd)][x(0xe9)](0x1),p[x(0x98)]&&console['log'](x(0x8b)+b+'\x20');});}else console['log']('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+b+'\x20');});const {token:e,contextName:L}=yield q[u(0x9f)]()['catch'](b=>__awaiter(this,void 0x0,void 0x0,function*(){const k=u;(0x0,utils_1[k(0xde)])(k(0xf8)+b[k(0x79)]+k(0x86));const E=yield this['apiTokenLogin'](O,g);return{'token':E['token'],'contextName':E['name']};}))[u(0xc7)](()=>{const s=u;if(V)V['ui'][s(0x93)]();}),N=(y=(Y=O[u(0xa6)])!==null&&Y!==void 0x0?Y:L)!==null&&y!==void 0x0?y:'autologin-'+new Date()[u(0xaf)]();return{'name':N,'token':e,'host':S,'override':(n=O['override'])!==null&&n!==void 0x0?n:![]};});}[a2W(0xf0)](O,g){return __awaiter(this,void 0x0,void 0x0,function*(){const P=a2g,R=this['apiClient'][P(0x8c)][P(0xb9)]()[P(0xcc)],{name:Y,token:y,host:n,override:G}=yield g[P(0xbb)](O,R);return{'name':Y,'token':y,'host':n,'override':G};});}['getProjectName'](){const B=a2W,O=this[B(0x80)][B(0x8c)]['getCurrentProjectName']();if(O===undefined)throw new Error(B(0xab));return O;}[a2W(0xbc)](O){return __awaiter(this,void 0x0,void 0x0,function*(){const w=a2g;if(!this['contextAvailable']())throw new Error('No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.');const g=this[w(0x80)][w(0x8c)]['loadContextWrapper']()['contexts'][w(0xf3)](Y=>Y[w(0xa6)]),R=g[w(0x92)]>0x4?w(0x8e):w(0xe2);return(yield inquirer[w(0xa7)]([{'type':R,'name':w(0xa6),'message':'Choose\x20the\x20context\x20to\x20'+O+':','choices':g}]))[w(0xa6)];});}[a2W(0x90)](){const J=a2W;return this['apiClient'][J(0x8c)][J(0xb9)]()[J(0xcc)][J(0x92)]>0x0;}[a2W(0xc9)](){return __awaiter(this,void 0x0,void 0x0,function*(){const h=a2g;try{const O=this['apiClient'][h(0x8c)][h(0x91)](),g=this[h(0x80)][h(0x8c)][h(0xa1)](),R=O+h(0xb4),Y={'Authorization':h(0x96)+g},y=new proxy_agent_1[(h(0xd6))](),n=yield(0x0,utils_1[h(0xee)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const D=h;return(0x0,node_fetch_1['default'])(R,{'method':D(0xf2),'signal':AbortSignal['timeout'](0xbb8),'headers':Y,'agent':y});}));if(n['ok'])return!![];return![];}catch(G){return![];}});}}exports[a2W(0xc8)]=CliContext;
@@ -1 +1 @@
1
- 'use strict';const a3n=a3K;(function(Z,K){const S=a3K,O=Z();while(!![]){try{const g=-parseInt(S(0xc4))/0x1*(parseInt(S(0xb9))/0x2)+-parseInt(S(0x112))/0x3*(parseInt(S(0xb5))/0x4)+-parseInt(S(0x104))/0x5*(-parseInt(S(0xe3))/0x6)+-parseInt(S(0x100))/0x7+-parseInt(S(0xe1))/0x8+-parseInt(S(0x103))/0x9*(-parseInt(S(0xd2))/0xa)+parseInt(S(0xc2))/0xb;if(g===K)break;else O['push'](O['shift']());}catch(N){O['push'](O['shift']());}}}(a3Z,0xc3302));var __awaiter=this&&this[a3n(0xe8)]||function(Z,K,O,g){function N(H){return H instanceof O?H:new O(function(o){o(H);});}return new(O||(O=Promise))(function(H,o){const r=a3K;function s(W){const k=a3K;try{y(g[k(0xb7)](W));}catch(B){o(B);}}function R(W){const x=a3K;try{y(g[x(0xfd)](W));}catch(B){o(B);}}function y(W){const m=a3K;W[m(0xdc)]?H(W[m(0xc9)]):N(W[m(0xc9)])[m(0xcb)](s,R);}y((g=g[r(0xc6)](Z,K||[]))[r(0xb7)]());});};function a3K(Z,K){const O=a3Z();return a3K=function(g,N){g=g-0xb1;let H=O[g];return H;},a3K(Z,K);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[a3n(0xd7)]=void 0x0;const js_client_1=require('@northflank/js-client'),utils_1=require(a3n(0x10f)),inquirer_helper_1=require(a3n(0xde)),lodash_1=require(a3n(0xf1)),inquirer=require('inquirer');class CliFileCopy{constructor(Z,K){const D=a3n;this[D(0xe9)]=(y,W)=>{const d=D,B=(0x0,lodash_1[d(0xd9)])(W),V=W===d(0xe5)?d(0xc5):d(0xf9),M=W===d(0xe5)?d(0x111):'current\x20working',I=W===d(0xe5)?'to':d(0xb1);return(0x0,utils_1[d(0xf5)])(!![])[d(0xd8)]('file')[d(0x101)](B+d(0xbf)+I+d(0xb3)+y+d(0xd6)+V+'Path\x20is\x20not\x20specified,\x20the\x20'+M+'\x20directory\x20is\x20used.\x20If\x20the\x20directory\x20for\x20'+V+d(0xe7)+B+'\x20single\x20file:\x20\x20\x20northflank\x20'+W+'\x20'+y+d(0xfb)+W+'ed-file.txt\x0a\x20\x20'+B+d(0xdb)+W+'\x20'+y+'\x20file\x20--localPath\x20my_directory\x20--remotePath\x20/home/'+W+d(0xcd))[d(0xb8)]('--project\x20--projectId\x20[NAME]',d(0xd5)+W)[d(0xb8)]('--'+y+d(0xcc)+y+d(0x106),y[d(0xda)](0x0)[d(0x10e)]()+y[d(0x113)](0x1)+d(0xdd)+W+d(0xea))['option']('--container\x20--containerId\x20[NAME]',d(0xba)+W+'\x20(random\x20container\x20will\x20be\x20chosen\x20if\x20not\x20specified)')[d(0xb8)](d(0xc0),d(0xb2))[d(0xb8)](d(0xc7),d(0xce))[d(0xb8)](d(0xfe),d(0x102),![]);},this[D(0xf0)]=(y,W)=>{const b=D;if(W)return;const {sourceDirectory:B,targetDirectory:V,sourceFile:M,targetFile:I}=y;switch(y[b(0xbe)]){case js_client_1[b(0xeb)][b(0xca)]:{(0x0,utils_1['success'])(b(0x10b)+B+b(0xf6)+V+'\x27');break;}case js_client_1[b(0xeb)][b(0xef)]:{(0x0,utils_1[b(0x105)])(b(0xf3)+B+'/'+M+b(0xdf)+V+'/'+I+'\x27');break;}case js_client_1[b(0xeb)][b(0xc8)]:{(0x0,utils_1[b(0x105)])('Uploaded\x20all\x20directory\x20contents\x20from\x20\x27'+B+b(0xe4)+V+'\x27');break;}case js_client_1[b(0xeb)][b(0x108)]:{(0x0,utils_1['success'])(b(0xd4)+B+'/'+M+b(0xdf)+V+'/'+I+'\x27');break;}}},this[D(0x10c)]=(y,W)=>__awaiter(this,void 0x0,void 0x0,function*(){const l=D,B=y===l(0x109)&&W[l(0xb6)]===undefined?yield this[l(0xbc)]('\x27remotePath\x27','download'):W['remotePath'],V=y===l(0xe5)&&W[l(0xb4)]===undefined?yield this[l(0xbc)](l(0xf4),l(0xe5)):W[l(0xb4)];return{'localPath':V,'remotePath':B};}),this[D(0xbc)]=(y,W)=>__awaiter(this,void 0x0,void 0x0,function*(){const f=D,B=y+'\x20is\x20required\x20for\x20'+W+f(0xec);return(yield inquirer[f(0x110)]([{'type':f(0x107),'name':f(0xd8),'message':B}]))[f(0xd8)];}),this[D(0xee)]=new js_client_1[(D(0xed))](Z,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent'],'agent':K});const O=new inquirer_helper_1[(D(0xf7))](this[D(0xee)]);this[D(0xbd)]=(0x0,utils_1[D(0xf5)])()[D(0xd8)]('download')['alias']('dl')['description'](D(0xd0)),this['uploadCmd']=(0x0,utils_1[D(0xf5)])()['name'](D(0xe5))['alias']('ul')[D(0x101)](D(0xc3));const g=(0x0,utils_1[D(0xf5)])()[D(0xd8)](D(0xd1))[D(0x101)](D(0xf2)),N=(0x0,utils_1[D(0xf5)])()[D(0xd8)](D(0xd1))['description'](D(0xe0)),H=(0x0,utils_1[D(0xf5)])()[D(0xd8)](D(0xfa))[D(0x101)](D(0xbb)),o=(0x0,utils_1['getCommand'])()['name']('job')[D(0x101)](D(0xff)),s=y=>{const a=D;return this[a(0xe9)]('service',y)[a(0xe6)](W=>__awaiter(this,void 0x0,void 0x0,function*(){const v=a,{projectId:B,serviceId:V,containerId:M,noDefaults:I,quiet:c}=W;(0x0,utils_1[v(0xc1)])(this[v(0xee)]);const E=I?undefined:Z[v(0xe2)](),p=B||E||(yield O[v(0x10a)]()),T=I?undefined:Z[v(0xcf)](),J=V||T||(yield O['askForService'](p)()),{remotePath:q,localPath:Y}=yield this[v(0x10c)](y,W),P={'projectId':p,'serviceId':J},C=yield this[v(0xee)][y][v(0xd1)]['files'](P,{'containerName':M,'localPath':Y,'remotePath':q});this[v(0xf0)](C,c);}));},R=y=>{const L=D;return this[L(0xe9)](L(0xfa),y)['action'](W=>__awaiter(this,void 0x0,void 0x0,function*(){const X=L,{projectId:B,jobId:V,containerId:M,noDefaults:I,quiet:c}=W;(0x0,utils_1['assertContextExisting'])(this[X(0xee)]);const E=I?undefined:Z[X(0xe2)](),p=B||E||(yield O[X(0x10a)]()),T=V||(yield O[X(0xd3)](p)()),{remotePath:J,localPath:q}=yield this[X(0x10c)](y,W),Y={'projectId':p,'jobId':T},P=yield this['apiClient'][y][X(0xfa)][X(0xfc)](Y,{'containerName':M,'localPath':q,'remotePath':J});this[X(0xf0)](P,c);}));};g['addCommand'](s(D(0x109))),H[D(0x10d)](R(D(0x109))),N[D(0x10d)](s(D(0xe5))),o[D(0x10d)](R('upload')),this[D(0xbd)][D(0x10d)](g),this['downloadCmd']['addCommand'](H),this[D(0xf8)]['addCommand'](N),this[D(0xf8)][D(0x10d)](o);}}function a3Z(){const e=['charAt','\x20directory:\x20\x20\x20\x20\x20northflank\x20','done','\x20to\x20','../inquirer-helper','\x27\x20to\x20\x27','File\x20and\x20directory\x20upload\x20for\x20Northflank\x20service.','11032016OdMFje','getCurrentProjectName','6370326KJzHYn','\x27\x20to\x20container\x20directory\x20\x27','upload','action','Path\x20does\x20not\x20exist,\x20it\x20will\x20be\x20created.\x0aExamples:\x0a\x20\x20','__awaiter','getStandardCopyCommand','\x20files','CopyType','s.\x20Please\x20enter\x20a\x20path:','ApiClient','apiClient','FILE_DOWNLOAD','logCopyResult','lodash','File\x20and\x20directory\x20download\x20for\x20Northflank\x20service.','Downloaded\x20file\x20\x27','\x27localPath\x27','getCommand','\x27\x20to\x20local\x20directory\x20\x27','InquirerHelper','uploadCmd','local','job','\x20file\x20--localPath\x20my_directory/my-file.txt\x20--remotePath\x20/home/my-','files','throw','--noDefaults','File\x20and\x20directory\x20upload\x20for\x20Northflank\x20job.','6740048frbGUY','description','Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.','4047561oZxRYu','5xagdbi','success','Id\x20[NAME]','input','FILE_UPLOAD','download','askForProject','Downloaded\x20all\x20directory\x20contents\x20from\x20\x27','ensureRelevantPathIsSet','addCommand','toUpperCase','../utils','prompt','user\x20home','6753PTlRjY','slice','from','Local\x20file\x20or\x20directory','\x20the\x20specified\x20','localPath','2740ufUagQ','remotePath','next','option','745348pavVNn','Container\x20used\x20to\x20','File\x20and\x20directory\x20download\x20for\x20Northflank\x20job.','askForPath','downloadCmd','type','\x20files\x20','--local\x20--localPath\x20[LOCALPATH]','assertContextExisting','38989665lEczHc','File\x20and\x20directory\x20upload\x20for\x20Northflank\x20services\x20and\x20jobs.','1wHUthx','remote','apply','--remote\x20--remotePath\x20[REMOTEPATH]','DIRECTORY_UPLOAD','value','DIRECTORY_DOWNLOAD','then','\x20--','-dir','Remote\x20file\x20or\x20directory','getCurrentServiceName','File\x20and\x20directory\x20download\x20for\x20Northflank\x20services\x20and\x20jobs.','service','10nihzxN','askForJob','Uploaded\x20file\x20from\x20\x27','Project\x20for\x20','.\x20If\x20the\x20','CliFileCopy','name','capitalize'];a3Z=function(){return e;};return a3Z();}exports[a3n(0xd7)]=CliFileCopy;
1
+ 'use strict';function a3O(){const Q=['alias','getCurrentProjectName','File\x20and\x20directory\x20download\x20for\x20Northflank\x20service.','CliFileCopy','ed-file.txt\x0a\x20\x20','Downloaded\x20all\x20directory\x20contents\x20from\x20\x27','\x27\x20to\x20\x27','\x20file\x20--localPath\x20my_directory\x20--remotePath\x20/home/','downloadCmd','\x20file\x20--localPath\x20my_directory/my-file.txt\x20--remotePath\x20/home/my-','\x27\x20to\x20local\x20directory\x20\x27','askForPath','\x20is\x20required\x20for\x20','addCommand','getCommand','-dir','../inquirer-helper','current\x20working','Container\x20used\x20to\x20','191970fqlTtd','DIRECTORY_DOWNLOAD','logCopyResult','Local\x20file\x20or\x20directory','\x20files','value','\x20files\x20','upload','lodash','local','\x27remotePath\x27','ApiClient','Downloaded\x20file\x20\x27','name','\x20--','remotePath','@northflank/js-client','action','download','askForJob','option','job','--project\x20--projectId\x20[NAME]','DIRECTORY_UPLOAD','user\x20home','InquirerHelper','42357110vUBiZS','687112ORKGRI','--remote\x20--remotePath\x20[REMOTEPATH]','then','6218744mabszr','toUpperCase','\x20directory:\x20\x20\x20\x20\x20northflank\x20','inquirer','Uploaded\x20all\x20directory\x20contents\x20from\x20\x27','success','99grcRyL','description','getStandardCopyCommand','uploadCmd','apply','Path\x20is\x20not\x20specified,\x20the\x20','2546FcNuuF','6878634gAMuJY','--local\x20--localPath\x20[LOCALPATH]','remote','prompt','next','ensureRelevantPathIsSet','service','Path\x20does\x20not\x20exist,\x20it\x20will\x20be\x20created.\x0aExamples:\x0a\x20\x20','\x20to\x20','CopyType','438VTIQlv','File\x20and\x20directory\x20upload\x20for\x20Northflank\x20services\x20and\x20jobs.','Remote\x20file\x20or\x20directory','throw','done','apiClient','capitalize','Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.','charAt','File\x20and\x20directory\x20upload\x20for\x20Northflank\x20job.','s.\x20Please\x20enter\x20a\x20path:','Id\x20[NAME]','370jhwYsw','assertContextExisting','\x20the\x20specified\x20','FILE_DOWNLOAD','file','\x27\x20to\x20container\x20directory\x20\x27','slice','../utils','FILE_UPLOAD','__awaiter','localPath','files','\x20(random\x20container\x20will\x20be\x20chosen\x20if\x20not\x20specified)','268GCjkiz','getCurrentServiceName'];a3O=function(){return Q;};return a3O();}const a3l=a3g;(function(O,g){const M=a3g,R=O();while(!![]){try{const Y=-parseInt(M(0x162))/0x1*(parseInt(M(0x179))/0x2)+parseInt(M(0x16d))/0x3*(parseInt(M(0x186))/0x4)+-parseInt(M(0x19b))/0x5+-parseInt(M(0x163))/0x6+-parseInt(M(0x156))/0x7+-parseInt(M(0x153))/0x8*(parseInt(M(0x15c))/0x9)+parseInt(M(0x152))/0xa;if(Y===g)break;else R['push'](R['shift']());}catch(y){R['push'](R['shift']());}}}(a3O,0xb8aff));var __awaiter=this&&this[a3l(0x182)]||function(O,g,R,Y){function y(n){return n instanceof R?n:new R(function(G){G(n);});}return new(R||(R=Promise))(function(n,G){const f=a3g;function S(L){const C=a3g;try{V(Y[C(0x167)](L));}catch(N){G(N);}}function q(L){const K=a3g;try{V(Y[K(0x170)](L));}catch(N){G(N);}}function V(e){const H=a3g;e[H(0x171)]?n(e[H(0x1a0)]):y(e[H(0x1a0)])[H(0x155)](S,q);}V((Y=Y[f(0x160)](O,g||[]))[f(0x167)]());});};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[a3l(0x18b)]=void 0x0;function a3g(O,g){const R=a3O();return a3g=function(Y,y){Y=Y-0x150;let n=R[Y];return n;},a3g(O,g);}const js_client_1=require(a3l(0x1ab)),utils_1=require(a3l(0x180)),inquirer_helper_1=require(a3l(0x198)),lodash_1=require(a3l(0x1a3)),inquirer=require(a3l(0x159));class CliFileCopy{constructor(O,g){const A=a3l;this['getStandardCopyCommand']=(V,e)=>{const i=a3g,L=(0x0,lodash_1[i(0x173)])(e),N=e==='upload'?i(0x165):i(0x1a4),b=e===i(0x1a2)?i(0x150):i(0x199),E=e===i(0x1a2)?'to':'from';return(0x0,utils_1[i(0x196)])(!![])[i(0x1a8)](i(0x17d))[i(0x15d)](L+i(0x1a1)+E+i(0x17b)+V+'.\x20If\x20the\x20'+N+i(0x161)+b+'\x20directory\x20is\x20used.\x20If\x20the\x20directory\x20for\x20'+N+i(0x16a)+L+'\x20single\x20file:\x20\x20\x20northflank\x20'+e+'\x20'+V+i(0x191)+e+i(0x18c)+L+i(0x158)+e+'\x20'+V+i(0x18f)+e+i(0x197))[i(0x1af)](i(0x1b1),'Project\x20for\x20'+e)[i(0x1af)]('--'+V+i(0x1a9)+V+i(0x178),V[i(0x175)](0x0)[i(0x157)]()+V[i(0x17f)](0x1)+i(0x16b)+e+i(0x19f))[i(0x1af)]('--container\x20--containerId\x20[NAME]',i(0x19a)+e+i(0x185))[i(0x1af)](i(0x164),i(0x19e))[i(0x1af)](i(0x154),i(0x16f))[i(0x1af)]('--noDefaults',i(0x174),![]);},this[A(0x19d)]=(V,e)=>{const Z=A;if(e)return;const {sourceDirectory:L,targetDirectory:N,sourceFile:b,targetFile:E}=V;switch(V['type']){case js_client_1[Z(0x16c)][Z(0x19c)]:{(0x0,utils_1[Z(0x15b)])(Z(0x18d)+L+Z(0x192)+N+'\x27');break;}case js_client_1[Z(0x16c)][Z(0x17c)]:{(0x0,utils_1[Z(0x15b)])(Z(0x1a7)+L+'/'+b+Z(0x18e)+N+'/'+E+'\x27');break;}case js_client_1['CopyType'][Z(0x1b2)]:{(0x0,utils_1[Z(0x15b)])(Z(0x15a)+L+Z(0x17e)+N+'\x27');break;}case js_client_1[Z(0x16c)][Z(0x181)]:{(0x0,utils_1['success'])('Uploaded\x20file\x20from\x20\x27'+L+'/'+b+Z(0x18e)+N+'/'+E+'\x27');break;}}},this[A(0x168)]=(V,e)=>__awaiter(this,void 0x0,void 0x0,function*(){const c=A,L=V===c(0x1ad)&&e[c(0x1aa)]===undefined?yield this[c(0x193)](c(0x1a5),'download'):e[c(0x1aa)],N=V===c(0x1a2)&&e[c(0x183)]===undefined?yield this[c(0x193)]('\x27localPath\x27',c(0x1a2)):e[c(0x183)];return{'localPath':N,'remotePath':L};}),this['askForPath']=(V,e)=>__awaiter(this,void 0x0,void 0x0,function*(){const U=A,L=V+U(0x194)+e+U(0x177);return(yield inquirer[U(0x166)]([{'type':'input','name':'name','message':L}]))[U(0x1a8)];}),this[A(0x172)]=new js_client_1[(A(0x1a6))](O,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent'],'agent':g});const R=new inquirer_helper_1[(A(0x151))](this[A(0x172)]);this[A(0x190)]=(0x0,utils_1[A(0x196)])()[A(0x1a8)](A(0x1ad))[A(0x188)]('dl')['description']('File\x20and\x20directory\x20download\x20for\x20Northflank\x20services\x20and\x20jobs.'),this[A(0x15f)]=(0x0,utils_1[A(0x196)])()[A(0x1a8)](A(0x1a2))[A(0x188)]('ul')['description'](A(0x16e));const Y=(0x0,utils_1[A(0x196)])()[A(0x1a8)](A(0x169))[A(0x15d)](A(0x18a)),y=(0x0,utils_1['getCommand'])()['name'](A(0x169))[A(0x15d)]('File\x20and\x20directory\x20upload\x20for\x20Northflank\x20service.'),n=(0x0,utils_1[A(0x196)])()['name'](A(0x1b0))[A(0x15d)]('File\x20and\x20directory\x20download\x20for\x20Northflank\x20job.'),G=(0x0,utils_1[A(0x196)])()[A(0x1a8)](A(0x1b0))['description'](A(0x176)),S=V=>{const d=A;return this[d(0x15e)](d(0x169),V)[d(0x1ac)](e=>__awaiter(this,void 0x0,void 0x0,function*(){const r=d,{projectId:L,serviceId:N,containerId:b,noDefaults:E,quiet:p}=e;(0x0,utils_1[r(0x17a)])(this[r(0x172)]);const F=E?undefined:O[r(0x189)](),m=L||F||(yield R['askForProject']()),o=E?undefined:O[r(0x187)](),v=N||o||(yield R['askForService'](m)()),{remotePath:a,localPath:z}=yield this[r(0x168)](V,e),W={'projectId':m,'serviceId':v},X=yield this[r(0x172)][V]['service'][r(0x184)](W,{'containerName':b,'localPath':z,'remotePath':a});this[r(0x19d)](X,p);}));},q=V=>{const j=A;return this[j(0x15e)](j(0x1b0),V)[j(0x1ac)](e=>__awaiter(this,void 0x0,void 0x0,function*(){const t=j,{projectId:L,jobId:N,containerId:b,noDefaults:E,quiet:p}=e;(0x0,utils_1['assertContextExisting'])(this[t(0x172)]);const F=E?undefined:O[t(0x189)](),m=L||F||(yield R['askForProject']()),o=N||(yield R[t(0x1ae)](m)()),{remotePath:v,localPath:a}=yield this[t(0x168)](V,e),z={'projectId':m,'jobId':o},W=yield this[t(0x172)][V][t(0x1b0)][t(0x184)](z,{'containerName':b,'localPath':a,'remotePath':v});this[t(0x19d)](W,p);}));};Y['addCommand'](S('download')),n['addCommand'](q(A(0x1ad))),y[A(0x195)](S(A(0x1a2))),G[A(0x195)](q('upload')),this['downloadCmd'][A(0x195)](Y),this[A(0x190)]['addCommand'](n),this['uploadCmd']['addCommand'](y),this[A(0x15f)][A(0x195)](G);}}exports[a3l(0x18b)]=CliFileCopy;