@northflank/cli 0.9.25 → 0.9.27

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 a0F2=a0e;(function(F,e){const F1=a0e,G=F();while(!![]){try{const u=-parseInt(F1(0xf4))/0x1+-parseInt(F1(0xdb))/0x2*(parseInt(F1(0xfa))/0x3)+-parseInt(F1(0x103))/0x4*(parseInt(F1(0xd5))/0x5)+-parseInt(F1(0xf5))/0x6*(parseInt(F1(0xf9))/0x7)+-parseInt(F1(0xe7))/0x8+-parseInt(F1(0xee))/0x9*(-parseInt(F1(0xd6))/0xa)+parseInt(F1(0xe4))/0xb;if(u===e)break;else G['push'](G['shift']());}catch(R){G['push'](G['shift']());}}}(a0F,0x2c559));function a0F(){const Fu=['data','join','replicas','versions','957105ufBygo','2276260hAbrzo','owningObject','services','map','__awaiter','36CAkWbd','source','type','projectId','default','pagination','done','backups','serviceId','11016533qADaTk','updateaddonversion','version','1487512GDkDNv','fetchResourceList','addons','length','addonDependencies','resources','value','9iezqxL','envs','nextPageCursor','credentials','keyName','addonTypes','159831OpOgbr','262602bCRzJh','projects','includes','addon','49DjTxoa','33996fErhIm','then','warning','region','templates','secret','storage','next','keys','4wmoPnx','list','secretLink','throw','regions','plans','./utils','secrets','templateId','get','addonId','cursor'];a0F=function(){return Fu;};return a0F();}var __awaiter=this&&this[a0F2(0xda)]||function(F,e,G,u){function R(b){return b instanceof G?b:new G(function(W){W(b);});}return new(G||(G=Promise))(function(b,W){const F6=a0e;function V(t){const F3=a0e;try{m(u[F3(0x101)](t));}catch(T){W(T);}}function a(t){const F4=a0e;try{m(u[F4(0x106)](t));}catch(T){W(T);}}function m(t){const F5=a0e;t[F5(0xe1)]?b(t[F5(0xed)]):R(t[F5(0xed)])[F5(0xfb)](V,a);}m((u=u['apply'](F,e||[]))[F6(0x101)]());});};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[a0F2(0xe8)]=void 0x0;function a0e(F,e){const G=a0F();return a0e=function(u,R){u=u-0xd2;let b=G[u];return b;},a0e(F,e);}const utils_1=require(a0F2(0x109)),defaultPaginationPageSize=0x64,getProjects=F=>e=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const F7=a0F2;var G;const u=yield F[F7(0x104)][F7(0xf6)]({'options':{'per_page':defaultPaginationPageSize,'cursor':e===null||e===void 0x0?void 0x0:e[F7(0xf0)]}});return{'elements':u[F7(0x10f)][F7(0xf6)][F7(0xd9)](R=>R['id']),'nextPageCursor':(G=u[F7(0xe0)])===null||G===void 0x0?void 0x0:G[F7(0x10e)]};}),getServices=(F,e)=>G=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const F8=a0F2;var u;const R=yield F[F8(0x104)][F8(0xd8)]({'parameters':{'projectId':e},'options':{'per_page':defaultPaginationPageSize,'cursor':G===null||G===void 0x0?void 0x0:G[F8(0xf0)]}});return{'elements':R[F8(0x10f)][F8(0xd8)][F8(0xd9)](b=>b['id']),'nextPageCursor':(u=R[F8(0xe0)])===null||u===void 0x0?void 0x0:u[F8(0x10e)]};}),getAddons=(F,e)=>G=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const F9=a0F2;var u;const R=yield F[F9(0x104)][F9(0xe9)]({'parameters':{'projectId':e},'options':{'per_page':defaultPaginationPageSize,'cursor':G===null||G===void 0x0?void 0x0:G[F9(0xf0)]}});return{'elements':R[F9(0x10f)][F9(0xe9)]['map'](b=>b['id']),'nextPageCursor':(u=R['pagination'])===null||u===void 0x0?void 0x0:u[F9(0x10e)]};}),getAddonBackups=(F,e,G)=>u=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const FF=a0F2;var R;const b=yield F[FF(0x10c)][FF(0xf8)][FF(0xe2)]({'parameters':{'projectId':e,'addonId':G},'options':{'per_page':defaultPaginationPageSize,'cursor':u===null||u===void 0x0?void 0x0:u[FF(0xf0)]}});return{'elements':b[FF(0x10f)]['backups']['map'](W=>W['id']),'nextPageCursor':(R=b['pagination'])===null||R===void 0x0?void 0x0:R[FF(0x10e)]};});function fetchResourceList(F,e,G,u,R,b){var W,V,a,m,t,T,Z,n,v,A,w,o;return __awaiter(this,void 0x0,void 0x0,function*(){const Fe=a0e,i=undefined;try{if(F==='deploymentPlan'){const d=yield e[Fe(0x104)][Fe(0x108)]({}),B=d['data'][Fe(0x108)][Fe(0xd9)](x=>{var r;return(r=x===null||x===void 0x0?void 0x0:x['internalId'])!==null&&r!==void 0x0?r:x===null||x===void 0x0?void 0x0:x['id'];});return{'choices':B,'defaultValue':i};}if(F===Fe(0xfd)&&!(G===null||G===void 0x0?void 0x0:G[Fe(0xf7)]('logSink'))){const x=yield e[Fe(0x104)][Fe(0x107)]({}),r=x[Fe(0x10f)]['regions']['map'](k=>{var K;return(K=k===null||k===void 0x0?void 0x0:k['internalId'])!==null&&K!==void 0x0?K:k===null||k===void 0x0?void 0x0:k['id'];});return{'choices':r,'defaultValue':i};}if(F===Fe(0xde)){const k=yield getProjects(e),{elements:K,nextPageCursor:p}=yield k();return{'choices':K,'defaultValue':i,'pagination':{'nextPageCursor':p,'loadMore':k}};}if(F===Fe(0xf1)){const O=yield e[Fe(0x104)]['registryCredentials']({}),D=O['data']['credentials']['map'](z=>z['id']);return{'choices':D,'defaultValue':i};}const c=R===null||R===void 0x0?void 0x0:R[Fe(0xde)],l=F===Fe(0xe3)||F==='id'&&(b===null||b===void 0x0?void 0x0:b['includes'](Fe(0xd7)));if(c!==undefined&&l){const z=yield getServices(e,c),{elements:C,nextPageCursor:N}=yield z();return{'choices':C,'defaultValue':i,'pagination':{'nextPageCursor':N,'loadMore':z}};}const X=G===null||G===void 0x0?void 0x0:G[Fe(0xf7)]('addon');if(X){const I=Y=>__awaiter(this,void 0x0,void 0x0,function*(){const FG=Fe;var g;const Q=yield e[FG(0x10c)][FG(0xf8)]['types']({});return(g=Q[FG(0x10f)][FG(0xf3)])===null||g===void 0x0?void 0x0:g[FG(0xd9)](S=>S[FG(0xdd)])['find'](S=>S[FG(0xdd)]===Y);});if(F===Fe(0xdd)){const Y=yield e[Fe(0x10c)][Fe(0xf8)]['types']({}),g=(W=Y[Fe(0x10f)][Fe(0xf3)])===null||W===void 0x0?void 0x0:W[Fe(0xd9)](Q=>Q['type']);return{'choices':g,'defaultValue':i};}if(F===Fe(0xe6)&&(u===null||u===void 0x0?void 0x0:u[Fe(0xdd)])!==undefined){const Q=(V=yield I(u['type']))===null||V===void 0x0?void 0x0:V[Fe(0xd4)],S=Q!==undefined?['latest',...Q]:undefined;return{'choices':S,'defaultValue':i};}if(F===Fe(0x100)&&(u===null||u===void 0x0?void 0x0:u[Fe(0xdd)])!==undefined){const j=(m=(a=yield I(u[Fe(0xdd)]))===null||a===void 0x0?void 0x0:a[Fe(0xec)])===null||m===void 0x0?void 0x0:m['storage'];return{'choices':j===null||j===void 0x0?void 0x0:j['options'],'defaultValue':j===null||j===void 0x0?void 0x0:j[Fe(0xdf)]};}if(F===Fe(0xd3)&&(u===null||u===void 0x0?void 0x0:u[Fe(0xdd)])!==undefined){const q=(T=(t=yield I(u[Fe(0xdd)]))===null||t===void 0x0?void 0x0:t[Fe(0xec)])===null||T===void 0x0?void 0x0:T[Fe(0xd3)];return{'choices':q===null||q===void 0x0?void 0x0:q['options'],'defaultValue':q===null||q===void 0x0?void 0x0:q['default']};}}if(F==='addonId'&&(R===null||R===void 0x0?void 0x0:R['projectId'])!==undefined){const f=yield getAddons(e,R===null||R===void 0x0?void 0x0:R[Fe(0xde)]),{elements:H,nextPageCursor:s}=yield f();return{'choices':H,'defaultValue':i,'pagination':{'nextPageCursor':s,'loadMore':f}};}if(F==='backupId'&&(R===null||R===void 0x0?void 0x0:R[Fe(0xde)])!==undefined&&((Z=u===null||u===void 0x0?void 0x0:u[Fe(0xdc)])===null||Z===void 0x0?void 0x0:Z[Fe(0x10d)])!==undefined){const y=yield getAddonBackups(e,R===null||R===void 0x0?void 0x0:R[Fe(0xde)],(n=u===null||u===void 0x0?void 0x0:u[Fe(0xdc)])===null||n===void 0x0?void 0x0:n[Fe(0x10d)]),{elements:E,nextPageCursor:J}=yield y();return{'choices':E,'defaultValue':i,'pagination':{'nextPageCursor':J,'loadMore':y}};}const h=(v=R===null||R===void 0x0?void 0x0:R[Fe(0x10d)])!==null&&v!==void 0x0?v:(A=u===null||u===void 0x0?void 0x0:u[Fe(0xeb)])===null||A===void 0x0?void 0x0:A[Fe(0x10d)];if((G===null||G===void 0x0?void 0x0:G[Fe(0xd2)](''))===Fe(0xe5)&&F===Fe(0xe6)&&(R===null||R===void 0x0?void 0x0:R[Fe(0xde)])!==undefined&&h!==undefined){const {upgradeTo:M}=(yield e[Fe(0x10c)][Fe(0xf8)]['version']({'parameters':{'addonId':h,'projectId':R===null||R===void 0x0?void 0x0:R['projectId']}}))[Fe(0x10f)];if(M===undefined||M[Fe(0xea)]<=0x0){(0x0,utils_1[Fe(0xfc)])('No\x20available\x20versions\x20to\x20upgrade\x20to.');throw new Error();}return{'choices':M[Fe(0xd9)](L=>L[Fe(0xe6)]),'defaultValue':i};}if(F===Fe(0x10b)){const L=yield e['list'][Fe(0xfe)]({}),P=L['data'][Fe(0xfe)][Fe(0xd9)](U=>U===null||U===void 0x0?void 0x0:U['id']);return{'choices':P,'defaultValue':i};}if(((G===null||G===void 0x0?void 0x0:G['includes'](Fe(0x105)))||(G===null||G===void 0x0?void 0x0:G[Fe(0xf7)](Fe(0xff))))&&F===Fe(0xf2)&&h!==undefined&&(R===null||R===void 0x0?void 0x0:R[Fe(0xde)])!==undefined){const U=(yield e[Fe(0x10c)][Fe(0xf8)][Fe(0xf1)]({'parameters':{'addonId':h,'projectId':R===null||R===void 0x0?void 0x0:R[Fe(0xde)]}}))['data'];return{'choices':[...(w=Object[Fe(0x102)](U===null||U===void 0x0?void 0x0:U[Fe(0xef)]))!==null&&w!==void 0x0?w:[],...(o=Object[Fe(0x102)](U===null||U===void 0x0?void 0x0:U[Fe(0x10a)]))!==null&&o!==void 0x0?o:[]]};}}catch(F0){}return{'choices':undefined,'defaultValue':i};});}exports[a0F2(0xe8)]=fetchResourceList;
1
+ 'use strict';const a0Y2=a0k;(function(Y,k){const Y1=a0k,X=Y();while(!![]){try{const B=-parseInt(Y1(0x148))/0x1*(parseInt(Y1(0x14b))/0x2)+-parseInt(Y1(0x126))/0x3*(parseInt(Y1(0x15f))/0x4)+parseInt(Y1(0x152))/0x5+-parseInt(Y1(0x160))/0x6*(-parseInt(Y1(0x123))/0x7)+parseInt(Y1(0x162))/0x8*(-parseInt(Y1(0x140))/0x9)+parseInt(Y1(0x157))/0xa+-parseInt(Y1(0x13d))/0xb*(-parseInt(Y1(0x13a))/0xc);if(B===k)break;else X['push'](X['shift']());}catch(l){X['push'](X['shift']());}}}(a0Y,0x9c834));var __awaiter=this&&this[a0Y2(0x13b)]||function(Y,k,X,B){function l(S){return S instanceof X?S:new X(function(C){C(S);});}return new(X||(X=Promise))(function(S,C){const Y5=a0k;function j(O){const Y3=a0k;try{e(B[Y3(0x158)](O));}catch(T){C(T);}}function o(O){try{e(B['throw'](O));}catch(T){C(T);}}function e(O){const Y4=a0k;O[Y4(0x15e)]?S(O[Y4(0x149)]):l(O[Y4(0x149)])[Y4(0x150)](j,o);}e((B=B[Y5(0x159)](Y,k||[]))['next']());});};Object[a0Y2(0x13f)](exports,'__esModule',{'value':!![]}),exports[a0Y2(0x146)]=void 0x0;const utils_1=require(a0Y2(0x142)),defaultPaginationPageSize=0x64,getProjects=Y=>k=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Y6=a0Y2;var X;const B=yield Y[Y6(0x156)]['projects']({'options':{'per_page':defaultPaginationPageSize,'cursor':k===null||k===void 0x0?void 0x0:k[Y6(0x14f)]}});return{'elements':B[Y6(0x129)][Y6(0x131)][Y6(0x154)](l=>l['id']),'nextPageCursor':(X=B[Y6(0x125)])===null||X===void 0x0?void 0x0:X['cursor']};}),getServices=(Y,k)=>X=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Y7=a0Y2;var B;const l=yield Y[Y7(0x156)][Y7(0x15c)]({'parameters':{'projectId':k},'options':{'per_page':defaultPaginationPageSize,'cursor':X===null||X===void 0x0?void 0x0:X[Y7(0x14f)]}});return{'elements':l[Y7(0x129)][Y7(0x15c)][Y7(0x154)](S=>S['id']),'nextPageCursor':(B=l[Y7(0x125)])===null||B===void 0x0?void 0x0:B[Y7(0x139)]};}),getAddons=(Y,k)=>X=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Y8=a0Y2;var B;const l=yield Y[Y8(0x156)]['addons']({'parameters':{'projectId':k},'options':{'per_page':defaultPaginationPageSize,'cursor':X===null||X===void 0x0?void 0x0:X[Y8(0x14f)]}});return{'elements':l[Y8(0x129)][Y8(0x12b)][Y8(0x154)](S=>S['id']),'nextPageCursor':(B=l[Y8(0x125)])===null||B===void 0x0?void 0x0:B['cursor']};}),getAddonBackups=(Y,k,X)=>B=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Y9=a0Y2;var l;const S=yield Y[Y9(0x120)]['addon'][Y9(0x12e)]({'parameters':{'projectId':k,'addonId':X},'options':{'per_page':defaultPaginationPageSize,'cursor':B===null||B===void 0x0?void 0x0:B['nextPageCursor']}});return{'elements':S['data'][Y9(0x12e)][Y9(0x154)](C=>C['id']),'nextPageCursor':(l=S[Y9(0x125)])===null||l===void 0x0?void 0x0:l[Y9(0x139)]};});function fetchResourceList(Y,k,X,B,l,S){var C,j,o,e,O,T,v,F,x,t,Q,n;return __awaiter(this,void 0x0,void 0x0,function*(){const YY=a0k,M=undefined;try{if(Y===YY(0x144)){const N=yield k[YY(0x156)][YY(0x153)]({}),K=N['data']['plans'][YY(0x154)](r=>{const Yk=YY;var w;return(w=r===null||r===void 0x0?void 0x0:r[Yk(0x147)])!==null&&w!==void 0x0?w:r===null||r===void 0x0?void 0x0:r['id'];});return{'choices':K,'defaultValue':M};}if(Y===YY(0x13e)&&!(X===null||X===void 0x0?void 0x0:X['includes'](YY(0x138)))){const r=yield k['list'][YY(0x12c)]({}),w=r[YY(0x129)][YY(0x12c)][YY(0x154)](h=>{const YX=YY;var g;return(g=h===null||h===void 0x0?void 0x0:h[YX(0x147)])!==null&&g!==void 0x0?g:h===null||h===void 0x0?void 0x0:h['id'];});return{'choices':w,'defaultValue':M};}if(Y==='projectId'){const h=yield getProjects(k),{elements:g,nextPageCursor:y}=yield h();return{'choices':g,'defaultValue':M,'pagination':{'nextPageCursor':y,'loadMore':h}};}if(Y===YY(0x14a)){const R=yield k['list'][YY(0x132)]({}),q=R[YY(0x129)][YY(0x14a)][YY(0x154)](U=>U['id']);return{'choices':q,'defaultValue':M};}const p=l===null||l===void 0x0?void 0x0:l['projectId'],d=Y==='serviceId'||Y==='id'&&(S===null||S===void 0x0?void 0x0:S[YY(0x14c)]('owningObject'));if(p!==undefined&&d){const U=yield getServices(k,p),{elements:L,nextPageCursor:z}=yield U();return{'choices':L,'defaultValue':M,'pagination':{'nextPageCursor':z,'loadMore':U}};}const P=X===null||X===void 0x0?void 0x0:X['includes'](YY(0x121));if(P){const A=D=>__awaiter(this,void 0x0,void 0x0,function*(){const YB=YY;var E;const b=yield k[YB(0x120)][YB(0x121)][YB(0x124)]({});return(E=b['data'][YB(0x133)])===null||E===void 0x0?void 0x0:E[YB(0x154)](a=>a[YB(0x128)])[YB(0x13c)](a=>a[YB(0x128)]===D);});if(Y===YY(0x128)){const D=yield k[YY(0x120)][YY(0x121)][YY(0x124)]({}),E=(C=D[YY(0x129)][YY(0x133)])===null||C===void 0x0?void 0x0:C[YY(0x154)](b=>b[YY(0x128)]);return{'choices':E,'defaultValue':M};}if(Y===YY(0x12d)&&(B===null||B===void 0x0?void 0x0:B[YY(0x128)])!==undefined){const b=(j=yield A(B[YY(0x128)]))===null||j===void 0x0?void 0x0:j['versions'],a=b!==undefined?[YY(0x12a),...b]:undefined;return{'choices':a,'defaultValue':M};}if(Y==='storage'&&(B===null||B===void 0x0?void 0x0:B[YY(0x128)])!==undefined){const Z=(e=(o=yield A(B[YY(0x128)]))===null||o===void 0x0?void 0x0:o[YY(0x137)])===null||e===void 0x0?void 0x0:e[YY(0x134)];return{'choices':Z===null||Z===void 0x0?void 0x0:Z[YY(0x127)],'defaultValue':Z===null||Z===void 0x0?void 0x0:Z['default']};}if(Y===YY(0x122)&&(B===null||B===void 0x0?void 0x0:B[YY(0x128)])!==undefined){const c=(T=(O=yield A(B['type']))===null||O===void 0x0?void 0x0:O['resources'])===null||T===void 0x0?void 0x0:T[YY(0x122)];return{'choices':c===null||c===void 0x0?void 0x0:c[YY(0x127)],'defaultValue':c===null||c===void 0x0?void 0x0:c[YY(0x141)]};}}if(Y===YY(0x14e)&&(l===null||l===void 0x0?void 0x0:l[YY(0x163)])!==undefined){const V=yield getAddons(k,l===null||l===void 0x0?void 0x0:l[YY(0x163)]),{elements:m,nextPageCursor:J}=yield V();return{'choices':m,'defaultValue':M,'pagination':{'nextPageCursor':J,'loadMore':V}};}if(Y===YY(0x15a)&&(l===null||l===void 0x0?void 0x0:l['projectId'])!==undefined&&((v=B===null||B===void 0x0?void 0x0:B[YY(0x15b)])===null||v===void 0x0?void 0x0:v[YY(0x14e)])!==undefined){const H=yield getAddonBackups(k,l===null||l===void 0x0?void 0x0:l['projectId'],(F=B===null||B===void 0x0?void 0x0:B[YY(0x15b)])===null||F===void 0x0?void 0x0:F[YY(0x14e)]),{elements:G,nextPageCursor:s}=yield H();return{'choices':G,'defaultValue':M,'pagination':{'nextPageCursor':s,'loadMore':H}};}const f=(x=l===null||l===void 0x0?void 0x0:l['addonId'])!==null&&x!==void 0x0?x:(t=B===null||B===void 0x0?void 0x0:B[YY(0x151)])===null||t===void 0x0?void 0x0:t['addonId'];if((X===null||X===void 0x0?void 0x0:X[YY(0x15d)](''))==='updateaddonversion'&&Y===YY(0x12d)&&(l===null||l===void 0x0?void 0x0:l[YY(0x163)])!==undefined&&f!==undefined){const {upgradeTo:I}=(yield k[YY(0x120)][YY(0x121)][YY(0x12d)]({'parameters':{'addonId':f,'projectId':l===null||l===void 0x0?void 0x0:l[YY(0x163)]}}))['data'];if(I===undefined||I[YY(0x136)]<=0x0){(0x0,utils_1[YY(0x12f)])(YY(0x14d));throw new Error();}return{'choices':I[YY(0x154)](i=>i[YY(0x12d)]),'defaultValue':M};}if(Y===YY(0x155)){const u=yield k[YY(0x156)]['templates']({}),i=u[YY(0x129)]['templates'][YY(0x154)](W=>W===null||W===void 0x0?void 0x0:W['id']);return{'choices':i,'defaultValue':M};}if(((X===null||X===void 0x0?void 0x0:X[YY(0x14c)](YY(0x161)))||(X===null||X===void 0x0?void 0x0:X[YY(0x14c)](YY(0x135))))&&Y===YY(0x145)&&f!==undefined&&(l===null||l===void 0x0?void 0x0:l['projectId'])!==undefined){const W=(yield k['get'][YY(0x121)][YY(0x14a)]({'parameters':{'addonId':f,'projectId':l===null||l===void 0x0?void 0x0:l[YY(0x163)]}}))[YY(0x129)];return{'choices':[...(Q=Object['keys'](W===null||W===void 0x0?void 0x0:W[YY(0x130)]))!==null&&Q!==void 0x0?Q:[],...(n=Object[YY(0x143)](W===null||W===void 0x0?void 0x0:W['secrets']))!==null&&n!==void 0x0?n:[]]};}}catch(Y0){}return{'choices':undefined,'defaultValue':M};});}function a0Y(){const Yl=['services','join','done','5020vkZRCa','1609998amAvKE','secretLink','10229624FttLWb','projectId','get','addon','replicas','7xdPlXW','types','pagination','948xOppWG','options','type','data','latest','addons','regions','version','backups','warning','envs','projects','registryCredentials','addonTypes','storage','secret','length','resources','logSink','cursor','12DXOyQj','__awaiter','find','18894491nGLGoD','region','defineProperty','9eURoPZ','default','./utils','keys','deploymentPlan','keyName','fetchResourceList','internalId','1bXjnBW','value','credentials','1168718bGjcHm','includes','No\x20available\x20versions\x20to\x20upgrade\x20to.','addonId','nextPageCursor','then','addonDependencies','4346240oRpFZh','plans','map','templateId','list','454560KrgaZz','next','apply','backupId','source'];a0Y=function(){return Yl;};return a0Y();}function a0k(Y,k){const X=a0Y();return a0k=function(B,l){B=B-0x120;let S=X[B];return S;},a0k(Y,k);}exports['fetchResourceList']=fetchResourceList;
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';const a1FZ=a1e;(function(F,e){const FT=a1e,G=F();while(!![]){try{const u=parseInt(FT(0x106))/0x1+parseInt(FT(0x179))/0x2+parseInt(FT(0x1c6))/0x3+parseInt(FT(0xc6))/0x4+-parseInt(FT(0xd7))/0x5*(-parseInt(FT(0x14c))/0x6)+parseInt(FT(0x18c))/0x7+-parseInt(FT(0x18e))/0x8*(parseInt(FT(0xd9))/0x9);if(u===e)break;else G['push'](G['shift']());}catch(R){G['push'](G['shift']());}}}(a1F,0x9f1f3));var __createBinding=this&&this[a1FZ(0x183)]||(Object['create']?function(F,e,G,u){const Fn=a1FZ;if(u===undefined)u=G;var R=Object['getOwnPropertyDescriptor'](e,G);(!R||(Fn(0xfd)in R?!e['__esModule']:R[Fn(0x15c)]||R['configurable']))&&(R={'enumerable':!![],'get':function(){return e[G];}}),Object[Fn(0x12b)](F,u,R);}:function(F,e,G,u){if(u===undefined)u=G;F[u]=e[G];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object[a1FZ(0x156)]?function(F,e){const Fv=a1FZ;Object[Fv(0x12b)](F,Fv(0x171),{'enumerable':!![],'value':e});}:function(F,e){const FA=a1FZ;F[FA(0x171)]=e;}),__importStar=this&&this[a1FZ(0xe4)]||function(F){const Fw=a1FZ;if(F&&F['__esModule'])return F;var e={};if(F!=null){for(var G in F)if(G!==Fw(0x171)&&Object[Fw(0x148)][Fw(0x10a)]['call'](F,G))__createBinding(e,F,G);}return __setModuleDefault(e,F),e;},__awaiter=this&&this[a1FZ(0x150)]||function(F,e,G,u){function R(b){return b instanceof G?b:new G(function(W){W(b);});}return new(G||(G=Promise))(function(b,W){const Fc=a1e;function V(t){const Fo=a1e;try{m(u[Fo(0x1a9)](t));}catch(T){W(T);}}function a(t){try{m(u['throw'](t));}catch(T){W(T);}}function m(t){const Fi=a1e;t[Fi(0x122)]?b(t['value']):R(t[Fi(0x105)])['then'](V,a);}m((u=u[Fc(0x178)](F,e||[]))[Fc(0x1a9)]());});},__importDefault=this&&this[a1FZ(0x18a)]||function(F){const Fl=a1FZ;return F&&F[Fl(0x172)]?F:{'default':F};};function a1F(){const Fj=[',\x20NF\x20error\x20id:\x20','boolean','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','list','replace','prj','login','getProgram','data','default','__esModule','body','pagination','ApiClient','./formatting/console-format-helpers','lodash','apply','2041604vswDjp','askForCredentials','skipValidation','isArray','hasNextPage','split','askForAddonBackup','CliExec','branch','Documentation:\x20','__createBinding','exitCode','./inquirer-helper','File\x20to\x20load\x20resource\x20json\x20from','VERBOSE:\x20Request\x20body\x20->\x20','-i,\x20--input\x20<resource-def>','getCurrentContext','__importDefault','Command','4763171wPGXMI','warning','1450472ciXykG','consoleFormat','keys','checkUpdate','secrets','omit','addCommand',',\x20-','docsTagsPath','(HTTP\x20status\x20code:\x20','json','brn','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','addon','output','getCommand','endsWith','credentialId','isEqual','green','nonInteractiveEndpoint','statusText','resource','domain','=>\x20running\x20command\x20with:\x20','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','serviceId','next','isString','path','version','has','API\x20request\x20failed\x0a\x09Message:\x20','template','rgn','isPaginatedEndpoint','backups','file','subdomain','custom-columns=','backup-destination','Northflank\x20cli\x20version:\x20','contextProvider','find','action','InquirerHelper','--verbose','./utils','tpl','js-yaml','restores','backupId','handleJsonOutput','service','templateRunId','count','1850988ONcrzN','getCurrentProjectName','force','resourceTagId','./formatting/command-overview','clearLine','ApiClientFileContextProvider','addHelpText','upperFirst','rawResponse','paginationArgs','askForDomain','invoice','volume','1164268cdtFST','File\x20does\x20not\x20exist:\x20','pln','askForClusterId','existsSync','request','job','tag','log','forEach','volumes','repos','askForVolume','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','inv','askForBuild','stringify','15RNDVfd','askForTag','108svXXld','kebabCase','plan','length','domainId','askForSubdomainPath','map','CliContext','aliases','assertContextExisting','-v,\x20--version','__importStar','askForAddon','vol','option','setPathVars','getCommandOverview','northflank','\x20properties','base','.yaml','parse','startsWith','alias','logSinkId','required','askGeneric','\x20--','credential','grey','addons','defaults','buildId','requiredPermissions','logs','askForBackupDestination','get','backupDestinationId','after','toString','tags','helpOption','page','type','value','144104oFLUaH','concat','filter','repository','hasOwnProperty','includes','description','getMetricsCommand','regions','Display\x20help\x20for\x20command','clusterId','query','asyncSequential','call','entries','invoices','update','@northflank/js-client','jobId','portFwdCmd','printAsTable','.json','sort','getOwnPropertyNames','askForService','askForSubdomain','credentials','./exec','done','commands','error','quiet','cred','askForSecret','pipelineId','CliMetrics','commander','defineProperty','CliLogs','askForTemplateRun','Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27','cursor','addonId','CliPortForward','bind','name','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','./port-forward','getNextPage','VERBOSE:\x20Using\x20endpoint\x20->\x20','askForJob','./context/contextCommands','loadAll','branches','adn','services','stdout','askForLogSink','yml','opt','url','projectId','dmn','askForProject','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','region','prototype','customUserAgent','./logs','\x20Northflank\x20resources','148098RGZfEW','-f,\x20--file\x20<file-path>','../package.json','contexts','__awaiter','subdomainId','runId','repositories','yaml','delete','create','addHelpCommand','host','toUpperCase','backup-destinations','askForPipeline','writable','secretId','argv','backup','safeLoad','message','getLogsCommand','getCurrentServiceName','OPTIONAL:\x20','endpoints','askForTemplate','templateId'];a1F=function(){return Fj;};return a1F();}function a1e(F,e){const G=a1F();return a1e=function(u,R){u=u-0xc4;let b=G[u];return b;},a1e(F,e);}Object[a1FZ(0x12b)](exports,a1FZ(0x172),{'value':!![]}),exports[a1FZ(0x16f)]=void 0x0;const js_client_1=require(a1FZ(0x117)),commander_1=__importDefault(require(a1FZ(0x12a))),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require('chalk')),_=__importStar(require(a1FZ(0x177))),contextCommands_1=require(a1FZ(0x139)),utils_1=require(a1FZ(0x1bd)),defaults=__importStar(require('./defaults')),inquirer_helper_1=require(a1FZ(0x185)),console_format_helpers_1=require(a1FZ(0x176)),command_overview_1=require(a1FZ(0x1ca)),port_forward_1=require(a1FZ(0x135)),exec_1=require(a1FZ(0x121)),logs_1=require(a1FZ(0x14a)),metrics_1=require('./metrics'),yaml=require(a1FZ(0x1bf)),pgk=require(a1FZ(0x14e)),getProgram=F=>{const FX=a1FZ,e=new commander_1[(FX(0x171))][(FX(0x18b))](FX(0xea));e[FX(0x10c)](FX(0x1a7)),e['enablePositionalOptions'](!![]),e[FX(0x1ac)](FX(0x1b7)+chalk_1[FX(0x171)]['underline'](pgk['version']),FX(0xe3),FX(0x146));const G=new js_client_1[(FX(0x175))](F,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[FX(0x149)]}),u=new contextCommands_1[(FX(0xe0))](G),R=new port_forward_1[(FX(0x131))](F),b=new exec_1[(FX(0x180))](F),W=new logs_1[(FX(0x12c))](F),V=new metrics_1[(FX(0x129))](F);return e[FX(0x194)](R[FX(0x119)]),e['addCommand'](b['execCmd']),e[FX(0x194)](u[FX(0x16e)]),e[FX(0x194)](u[FX(0x14f)]),generateCommands(G,G[FX(0x165)],e,W,V),e[FX(0x194)]((0x0,command_overview_1[FX(0xe9)])(e)),e[FX(0x157)](!![],'Display\x20help\x20for\x20command'),e[FX(0x102)](undefined,FX(0x10f)),e;};exports['getProgram']=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Fh=a1FZ;try{const F=new js_client_1[(Fh(0x1cc))]();yield(0x0,utils_1[Fh(0x191)])(F);const G=(0x0,exports[Fh(0x16f)])(F);yield G['parseAsync'](process['argv']);}catch(u){(0x0,utils_1[Fh(0x124)])('Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20'+u[Fh(0x161)]),process[Fh(0x15e)]['find'](R=>R===Fh(0x1bc))&&console[Fh(0xce)](u),process[Fh(0x184)]=0x1;}}))());function isListCommand(F){const Fd=a1FZ,e=[['get',Fd(0x19b),Fd(0x1b2)],[Fd(0xfd),Fd(0xcc),'runs']];return F[Fd(0x1b9)](G=>G===Fd(0x16b))||e['some'](G=>_[Fd(0x1a0)](F,G));}function generateCommands(F,e,G,u,R,b=defaults[a1FZ(0xf8)],W=[]){const FB=a1FZ,V=new inquirer_helper_1[(FB(0x1bb))](new js_client_1[(FB(0x175))](F[FB(0x1b8)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[FB(0x149)]}));function a(Z,n){const Fx=FB;return Z[Fx(0xf2)]!==![]&&n===undefined;}function m(Z,n){const Fr=FB,{opt:v,name:A}=Z,w=v[Fr(0x171)],o=a(v,w),i=B=>B[Fr(0xdc)]>0x1?'--'+B:'-'+B,c=v===null||v===void 0x0?void 0x0:v[Fr(0xf0)],l=c?_[Fr(0x17c)](c)?'-'+(c===null||c===void 0x0?void 0x0:c[Fr(0xdf)](B=>i(B))['join'](Fr(0x195)))+',':''+i(c):'',X=o?'':Fr(0x164),h=typeof v[Fr(0x104)]===Fr(0x169)||v[Fr(0x104)]===Fr(0x169)?l+'\x20--'+A:l+Fr(0xf4)+A+'\x20<'+A[Fr(0x159)]()+'>',d=X+v[Fr(0x10c)];n[Fr(0xe7)](h,d,w);}function t(Z,n){const Fk=FB;if(n[Fk(0x123)]['some'](v=>v['name']()===Fk(0xfb)))return;_['isEqual'](Z,['get',Fk(0x1c3)])&&(n[Fk(0x194)](u['getLogsCommand']('service')),n['addCommand'](R[Fk(0x10d)](Fk(0x1c3))),n[Fk(0x194)](u[Fk(0x162)](Fk(0x1c3),!![])),n[Fk(0x194)](R['getMetricsCommand'](Fk(0x1c3),!![]))),_[Fk(0x1a0)](Z,[Fk(0xfd),Fk(0xcc)])&&(n['addCommand'](u[Fk(0x162)]('job')),n[Fk(0x194)](R['getMetricsCommand'](Fk(0xcc))),n[Fk(0x194)](u['getLogsCommand'](Fk(0xcc),!![])),n[Fk(0x194)](R['getMetricsCommand']('job',!![]))),_['isEqual'](Z,[Fk(0xfd),Fk(0x19b)])&&(n[Fk(0x194)](u['getLogsCommand'](Fk(0x19b))),n[Fk(0x194)](R[Fk(0x10d)]('addon'))),_[Fk(0x1a0)](Z,[Fk(0xfd),Fk(0x19b),Fk(0x15f)])&&n[Fk(0x194)](u['getLogsCommand'](Fk(0x19b),![],!![])),_[Fk(0x1a0)](Z,[Fk(0xfd),Fk(0x19b),Fk(0x1c0)])&&n['addCommand'](u[Fk(0x162)](Fk(0x19b),![],!![],!![]));}return Object[FB(0x11d)](b)[FB(0xcf)](Z=>{const FK=FB,n=e[Z],v=b[Z],A=W[FK(0x107)]([Z]);function w(r,k){const Fp=FK,K=Object[Fp(0x11d)](r||{});K[Fp(0xdf)](p=>{return{'name':p,'opt':r[p]};})[Fp(0x11c)]((p,O)=>!a(p[Fp(0x141)])?!a(O[Fp(0x141)])?0x0:0x1:-0x1)[Fp(0xcf)](p=>{m(p,k);});}function o(r,k){const FO=FK,K=[['project','projects',FO(0x16d)],[FO(0x1c3),FO(0x13d),'svc'],[FO(0x120),FO(0xf5),FO(0x126)],[FO(0x19b),FO(0xf7),FO(0x13c)],[FO(0xcc),'jobs'],[FO(0xdb),'plans',FO(0xc8)],[FO(0x147),FO(0x10e),FO(0x1b0)],[FO(0x1a5),'domains',FO(0x144)],['secret',FO(0x192),'scrt'],[FO(0xd0),FO(0xc5),FO(0xe6)],[FO(0x13b),FO(0x181),FO(0x199)],[FO(0xc4),FO(0x115),FO(0xd4)],[FO(0x1af),'templates',FO(0x1be)],[FO(0xd1),FO(0x109),FO(0x153),'repo'],[FO(0x1b6),FO(0x15a)],[FO(0xcd),FO(0x101)]],p=K['find'](O=>O[FO(0x10b)](k));if(p!==undefined)r[FO(0xe1)](p[FO(0x108)](O=>O!==k));}function i(r){var k,K;return __awaiter(this,void 0x0,void 0x0,function*(){const FD=a1e,p={},{contextProvider:O}=F,D=A['includes'](FD(0x155)),z=r['noDefaults']===!![];function C(N,I,Y){var g,Q;return __awaiter(this,void 0x0,void 0x0,function*(){const Fz=a1e;if(_[Fz(0x1ad)]((Q=(g=v[Fz(0x141)])===null||g===void 0x0?void 0x0:g['path'])!==null&&Q!==void 0x0?Q:{},N)){const S=!z&&!D&&Y?Y():undefined,j=r[N]||S||(yield I());_['set'](p,N,j);}});}return yield(0x0,utils_1[FD(0x112)])(Object[FD(0x114)]((K=(k=v[FD(0x141)])===null||k===void 0x0?void 0x0:k['path'])!==null&&K!==void 0x0?K:{}),([N,I])=>__awaiter(this,void 0x0,void 0x0,function*(){const FC=FD;var Y;const g=p===null||p===void 0x0?void 0x0:p[FC(0x143)],Q=p===null||p===void 0x0?void 0x0:p['templateId'];switch(N){case FC(0x143):return yield C('projectId',V[FC(0x145)][FC(0x132)](V),O[FC(0x1c7)][FC(0x132)](O));case FC(0x1a8):return yield C(FC(0x1a8),V[FC(0x11e)](g)[FC(0x132)](V),O[FC(0x163)][FC(0x132)](O));case FC(0x130):return yield C(FC(0x130),V[FC(0xe5)](g)[FC(0x132)](V));case FC(0x118):return yield C(FC(0x118),V[FC(0x138)](g)[FC(0x132)](V),O['getCurrentJobName'][FC(0x132)](O));case FC(0x152):return yield C(FC(0x152),V['askForJobRun'](p[FC(0x118)],g,![])[FC(0x132)](V));case'secretId':return yield C(FC(0x15d),V[FC(0x127)](g)['bind'](V));case FC(0x1a5):case FC(0xdd):return yield C(FC(0x1a5),V[FC(0x1d1)][FC(0x132)](V));case FC(0x19f):return yield C('credentialId',V[FC(0x17a)]['bind'](V));case'volumeId':return yield C('volumeId',V[FC(0xd2)](g)[FC(0x132)](V));case FC(0x1b4):return yield C('subdomain',V[FC(0x11f)](p[FC(0x1a5)])['bind'](V));case FC(0x151):return yield C(FC(0x151),V[FC(0x11f)](p[FC(0xdd)])[FC(0x132)](V));case'subdomainPath':return yield C('subdomainPath',V[FC(0xde)](p[FC(0x1a5)],(Y=p[FC(0x1b4)])!==null&&Y!==void 0x0?Y:p[FC(0x151)])['bind'](V));case'backupId':return yield C(FC(0x1c1),V[FC(0x17f)](g,p[FC(0x130)])[FC(0x132)](V));case FC(0xf9):return yield C(FC(0xf9),V[FC(0xd5)](g,p[FC(0x1a8)],p['jobId'])[FC(0x132)](V));case FC(0x167):return yield C(FC(0x167),V[FC(0x166)]()['bind'](V));case FC(0x1c4):return yield C(FC(0x1c4),V[FC(0x12d)](Q)[FC(0x132)](V));case FC(0xf1):return yield C(FC(0xf1),V[FC(0x13f)]()[FC(0x132)](V));case FC(0x128):return yield C(FC(0x128),V[FC(0x15b)](g)[FC(0x132)](V));case FC(0x1c9):return yield C('resourceTagId',V[FC(0xd8)]()['bind'](V));case FC(0xfe):return yield C(FC(0xfe),V[FC(0xfc)]()[FC(0x132)](V));case'clusterId':return yield C(FC(0x110),V[FC(0xc9)]()[FC(0x132)](V));default:return yield C(N,V[FC(0xf3)](N,I===null||I===void 0x0?void 0x0:I['description'])[FC(0x132)](V));}})),p;});}function c(r){var k,K,p;return __awaiter(this,void 0x0,void 0x0,function*(){const FN=a1e,O={},D=((k=v['opt'])===null||k===void 0x0?void 0x0:k['isPaginatedEndpoint'])?defaults[FN(0x1d0)]:{},z=Object['assign'](Object['assign']({},(p=(K=v[FN(0x141)])===null||K===void 0x0?void 0x0:K[FN(0x111)])!==null&&p!==void 0x0?p:{}),D),C=Object[FN(0x190)](z)['filter'](N=>N!==FN(0x13a));return yield(0x0,utils_1[FN(0x112)])(C,N=>__awaiter(this,void 0x0,void 0x0,function*(){if(r[N]!==undefined)return _['set'](O,N,r[N]);})),O;});}function l(){const FI=FK;switch(A[0x0]){case'get':return'Get\x20information\x20about\x20Northflank\x20'+(A[0x1]||FI(0x1a4))+'s';case FI(0x116):return'Update\x20Northflank\x20'+(A[0x1]||FI(0x1a4))+FI(0xeb);default:return _[FI(0x1ce)](Z)+FI(0x14b);}}function X(r,k){const FY=FK;var K,p,O,D,z,C,N,I;if(!k){const s=(0x0,utils_1[FY(0x19d)])()[FY(0x133)](_[FY(0xda)](Z))[FY(0x10c)](l());return o(s,Z),s;}const Y=(r===null||r===void 0x0?void 0x0:r[FY(0xfa)])?chalk_1['default'][FY(0xf6)]('\x0a>\x20Token\x20permissions\x20required:\x20'+r[FY(0xfa)]):'',g=F[FY(0x1b8)][FY(0x189)](),Q=g!==undefined&&((K=v===null||v===void 0x0?void 0x0:v[FY(0x141)])===null||K===void 0x0?void 0x0:K[FY(0x196)])!==undefined,S=g===null||g===void 0x0?void 0x0:g[FY(0x158)]['replace']('api.',''),j=Q?FY(0x182)+S+'/docs/v1/api/'+((p=v===null||v===void 0x0?void 0x0:v[FY(0x141)])===null||p===void 0x0?void 0x0:p[FY(0x196)]):'',q=(r===null||r===void 0x0?void 0x0:r['description'])||'',f=(0x0,utils_1[FY(0x19d)])(!![])['name'](_[FY(0xda)](Z))[FY(0x10c)](q)[FY(0x1cd)](FY(0xff),[Y,j]['join']('\x0a'));o(f,Z);(((O=v[FY(0x141)])===null||O===void 0x0?void 0x0:O['body'])||((D=v['opt'])===null||D===void 0x0?void 0x0:D[FY(0x1a2)]))&&(f['option'](FY(0x14d),FY(0x186)),f[FY(0xe7)](FY(0x188),FY(0x134)));w((z=v[FY(0x141)])===null||z===void 0x0?void 0x0:z[FY(0x1ab)],f),w((C=v['opt'])===null||C===void 0x0?void 0x0:C[FY(0x111)],f);const H=(N=v['opt'])===null||N===void 0x0?void 0x0:N[FY(0x1b1)];return H&&w(defaults[FY(0x1d0)],f),w((I=v[FY(0x141)])===null||I===void 0x0?void 0x0:I[FY(0xec)],f),f[FY(0x1ba)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const Fg=FY;var y,E,J,M,L,P;(0x0,utils_1[Fg(0xe2)])(F);const U=f['opts'](),F0=U[Fg(0x103)]!==undefined||U[Fg(0x12f)]!==undefined;if(U[Fg(0x13a)]===!![]&&F0)throw new Error(Fg(0x12e));const F1=U===null||U===void 0x0?void 0x0:U[Fg(0x19c)],F2=F1===Fg(0x198),F3=F1==='yaml'||F1===Fg(0x140),F4=yield i(U);V[Fg(0xe8)](F4);const F5=yield c(U),F6=Object[Fg(0x190)]((E=(y=v[Fg(0x141)])===null||y===void 0x0?void 0x0:y[Fg(0x1ab)])!==null&&E!==void 0x0?E:{})[Fg(0xdf)](Fe=>Fe+'='+chalk_1[Fg(0x171)][Fg(0x1a1)](F4[Fe]))['join'](',\x20');if(F6['length']>0x0&&!F2&&!F3){const Fe=Fg(0x1a6)+F6;console[Fg(0xce)](Fe);}const F7=((J=v['opt'])===null||J===void 0x0?void 0x0:J[Fg(0x173)])||((M=v[Fg(0x141)])===null||M===void 0x0?void 0x0:M[Fg(0x1a2)])?yield T(U,v,A):undefined;if(!U[Fg(0x1c8)]&&A[Fg(0x10b)](Fg(0x155))&&!(yield V['deleteWarningPrompt']())){(0x0,utils_1[Fg(0x18d)])('Resource\x20was\x20not\x20deleted.');return;}const F8=H&&(U[Fg(0x13a)]||(U[Fg(0x19c)]===Fg(0x198)||U['output']===Fg(0x154))&&!F0);let F9=F8&&n instanceof js_client_1['GetApiEndpointPaginated']?yield n['all']({'parameters':F4,'options':F5,'data':F7}):yield n[Fg(0x113)]({'parameters':F4,'options':Object['assign']({},F5),'data':F7});if(U===null||U===void 0x0?void 0x0:U['verbose']){const FG=F9[Fg(0xcb)];console[Fg(0xce)](Fg(0x137)+FG['method'][Fg(0x159)]()+':'+FG[Fg(0x142)]);if(F7!==undefined)console['log'](Fg(0x187)+F7);}if(F9[Fg(0x124)]){const {details:Fu,id:FR,message:Fb,status:FW}=F9[Fg(0x124)],FV=Fu?'\x0a\x09details\x20:'+JSON[Fg(0xd6)](Fu):'',Fa=FR?Fg(0x168)+FR:'',Fm=Fg(0x197)+FW+Fa+')';throw new Error(Fg(0x1ae)+Fb+'\x20'+Fm+FV);}let FF=0x0;printCallResult(U,F2,F9[Fg(0x170)],F3,A,F1,![],FF,F9['rawResponse'][Fg(0x1a3)]);if(!U[Fg(0x125)]&&!F8&&!F0&&((L=F9[Fg(0x174)])===null||L===void 0x0?void 0x0:L[Fg(0x17d)]))while((P=F9[Fg(0x174)])===null||P===void 0x0?void 0x0:P['hasNextPage']){const Ft=yield V['askConfirm']('there\x20are\x20more\x20rows,\x20load?');if(Ft)process['stdout']['moveCursor'](0x0,-0x1),process[Fg(0x13e)][Fg(0x1cb)](0x1),FF+=F9[Fg(0x174)][Fg(0x1c5)],F9=yield F9[Fg(0x174)][Fg(0x136)](),printCallResult(U,F2,F9[Fg(0x170)],F3,A,F1,!![],FF,F9[Fg(0x1cf)][Fg(0x1a3)]);else return;}})),f;}const h=_[FK(0x1ad)](v,FK(0x141)),d=n,B=X(d,h);t(A,B),G['addCommand'](B);const x=_[FK(0x193)](v,'opt');Object[FK(0x190)](x)[FK(0xdc)]>0x0&&generateCommands(F,n,B,u,R,x,A);});function T(Z,n,v){var A;return __awaiter(this,void 0x0,void 0x0,function*(){const FQ=a1e,{input:w,file:o}=Z;if(w!==undefined)try{return JSON['parse'](w);}catch(i){try{return yaml[FQ(0x160)](w);}catch(c){throw new Error(FQ(0x19a));}}if(o!==undefined){if(!fs_1[FQ(0x171)][FQ(0xca)](o))throw new Error(FQ(0xc7)+o);const l=fs_1[FQ(0x171)]['readFileSync'](o)[FQ(0x100)]();let X;try{if(_[FQ(0x1aa)](l)){if(Z[FQ(0x1b3)][FQ(0x19e)](FQ(0x11b)))X=JSON[FQ(0xee)](l);else{if(Z[FQ(0x1b3)]['endsWith'](FQ(0xed))||Z[FQ(0x1b3)][FQ(0x19e)](FQ(0x140)))X=yaml['safeLoad'](l);else throw new Error('Unknown\x20input\x20file\x20type:\x20'+Z['file'][FQ(0x17e)]('.')['pop']());}}else X=l;return X;}catch(h){throw new Error(FQ(0xd3)+h[FQ(0x161)]);}}if((A=n===null||n===void 0x0?void 0x0:n[FQ(0x141)])===null||A===void 0x0?void 0x0:A[FQ(0x1a2)])throw new Error(FQ(0x16a));return yield V['retrievePayloadViaInteractiveCli'](n,{'cmdPath':v,'skipValidation':Z[FQ(0x17b)]});});}}const printCallResult=(F,e,G,u,R,b,W,V,a)=>{const FS=a1FZ;if(!(F===null||F===void 0x0?void 0x0:F[FS(0x125)])){if(e)(0x0,console_format_helpers_1[FS(0x1c2)])(F===null||F===void 0x0?void 0x0:F[FS(0x19c)],G);else{if(u)(0x0,console_format_helpers_1['handleYamlOutput'])(F===null||F===void 0x0?void 0x0:F[FS(0x19c)],G);else{if(isListCommand(R)){const m=(b===null||b===void 0x0?void 0x0:b[FS(0xef)](FS(0x1b5)))?b[FS(0x16c)]('custom-columns=','')[FS(0x17e)](',')[FS(0xdf)](v=>v['toLowerCase']()):undefined,t=R[R[FS(0xdc)]-0x1],T=''+t+(t[FS(0x19e)]('s')?'':'s'),Z=_['upperFirst'](T),n=_[FS(0x1ad)](G,T)?G[T]:G;(0x0,console_format_helpers_1[FS(0x11a)])(n,Z,m,W,V);}else console[FS(0xce)]((0x0,console_format_helpers_1[FS(0x18f)])(G,a));}}}};
2
+ 'use strict';function a1k(Y,k){const X=a1Y();return a1k=function(B,l){B=B-0x145;let S=X[B];return S;},a1k(Y,k);}const a1Yv=a1k;(function(Y,k){const YT=a1k,X=Y();while(!![]){try{const B=-parseInt(YT(0x151))/0x1*(parseInt(YT(0x189))/0x2)+parseInt(YT(0x1b8))/0x3+-parseInt(YT(0x170))/0x4*(parseInt(YT(0x1c1))/0x5)+-parseInt(YT(0x178))/0x6+-parseInt(YT(0x156))/0x7+parseInt(YT(0x200))/0x8*(parseInt(YT(0x15f))/0x9)+parseInt(YT(0x1c9))/0xa;if(B===k)break;else X['push'](X['shift']());}catch(l){X['push'](X['shift']());}}}(a1Y,0x2e3b7));var __createBinding=this&&this[a1Yv(0x1ce)]||(Object[a1Yv(0x208)]?function(Y,X,B,l){const YF=a1Yv;if(l===undefined)l=B;var S=Object[YF(0x22b)](X,B);(!S||(YF(0x1b1)in S?!X[YF(0x17b)]:S[YF(0x1b2)]||S[YF(0x1dd)]))&&(S={'enumerable':!![],'get':function(){return X[B];}}),Object['defineProperty'](Y,l,S);}:function(Y,X,B,l){if(l===undefined)l=B;Y[l]=X[B];}),__setModuleDefault=this&&this[a1Yv(0x1f3)]||(Object[a1Yv(0x208)]?function(Y,k){const Yx=a1Yv;Object['defineProperty'](Y,Yx(0x1f2),{'enumerable':!![],'value':k});}:function(Y,k){const Yt=a1Yv;Y[Yt(0x1f2)]=k;}),__importStar=this&&this[a1Yv(0x1d5)]||function(Y){const YQ=a1Yv;if(Y&&Y[YQ(0x17b)])return Y;var X={};if(Y!=null){for(var B in Y)if(B!==YQ(0x1f2)&&Object[YQ(0x152)][YQ(0x210)][YQ(0x19b)](Y,B))__createBinding(X,Y,B);}return __setModuleDefault(X,Y),X;},__awaiter=this&&this['__awaiter']||function(Y,k,X,B){function l(S){return S instanceof X?S:new X(function(C){C(S);});}return new(X||(X=Promise))(function(S,C){const Yp=a1k;function j(O){const Yn=a1k;try{e(B[Yn(0x14d)](O));}catch(T){C(T);}}function o(O){try{e(B['throw'](O));}catch(T){C(T);}}function e(O){const YM=a1k;O[YM(0x21c)]?S(O['value']):l(O['value'])[YM(0x171)](j,o);}e((B=B['apply'](Y,k||[]))[Yp(0x14d)]());});},__importDefault=this&&this[a1Yv(0x229)]||function(Y){const Yd=a1Yv;return Y&&Y[Yd(0x17b)]?Y:{'default':Y};};Object['defineProperty'](exports,a1Yv(0x17b),{'value':!![]}),exports[a1Yv(0x1fd)]=void 0x0;const js_client_1=require(a1Yv(0x179)),commander_1=__importDefault(require('commander')),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require(a1Yv(0x1ad))),_=__importStar(require(a1Yv(0x17a))),contextCommands_1=require(a1Yv(0x1d9)),utils_1=require(a1Yv(0x209)),defaults=__importStar(require(a1Yv(0x1a8))),inquirer_helper_1=require(a1Yv(0x21d)),console_format_helpers_1=require(a1Yv(0x14b)),command_overview_1=require(a1Yv(0x15d)),port_forward_1=require(a1Yv(0x176)),exec_1=require(a1Yv(0x146)),logs_1=require(a1Yv(0x242)),metrics_1=require(a1Yv(0x16b)),yaml=require(a1Yv(0x1b0)),pgk=require('../package.json'),getProgram=Y=>{const YP=a1Yv,k=new commander_1[(YP(0x1f2))]['Command'](YP(0x1ef));k[YP(0x23e)](YP(0x1b4)),k['enablePositionalOptions'](!![]),k['version']('Northflank\x20cli\x20version:\x20'+chalk_1[YP(0x1f2)][YP(0x211)](pgk['version']),YP(0x233),YP(0x184));const X=new js_client_1['ApiClient'](Y,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[YP(0x217)],'agent':utils_1[YP(0x1d1)]}),B=new contextCommands_1[(YP(0x155))](X,utils_1[YP(0x1d1)]),l=new port_forward_1[(YP(0x202))](Y,utils_1[YP(0x1d1)]),S=new exec_1[(YP(0x15b))](Y,utils_1['agent']),C=new logs_1['CliLogs'](Y,utils_1['agent']),j=new metrics_1[(YP(0x1f6))](Y,utils_1[YP(0x1d1)]);return k[YP(0x212)](l[YP(0x1d6)]),k[YP(0x212)](S[YP(0x1af)]),k[YP(0x212)](B[YP(0x1fe)]),k['addCommand'](B['contexts']),generateCommands(X,X[YP(0x150)],k,C,j),k[YP(0x212)]((0x0,command_overview_1[YP(0x19c)])(k)),k[YP(0x1ff)](!![],YP(0x17f)),k['helpOption'](undefined,YP(0x17f)),k;};function a1Y(){const Yc=['action','subdomainPath','template','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','warning','url','repositories','stringify','104QWCbUh','getCurrentContext','upperFirst','method','tag','addHelpText','runId','toString','adn','askForAddon','OPTIONAL:\x20','paginationArgs','runs','verbose','resource','buildId','askForVolume','Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27','call','getCommandOverview','volumeId','.json','name','backupDestinationId','pipelineId','askForBuild','logs','asyncSequential','boolean','isPaginatedEndpoint','job','./defaults','commands','-f,\x20--file\x20<file-path>','services',',\x20NF\x20error\x20id:\x20','chalk','InquirerHelper','execCmd','js-yaml','get','writable','templateId','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','argv','subdomainId','concat','444738nFfmsO','isEqual','isString','(HTTP\x20status\x20code:\x20','request','quiet','opt','log','invoice','50NnMhuy','askForClusterId','backups','delete','vol','error','credentialId','pagination','4993800TJtLMy','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','askForPipeline','output','required','__createBinding','Update\x20Northflank\x20','readFileSync','agent','nonInteractiveEndpoint','there\x20are\x20more\x20rows,\x20load?','all','__importStar','portFwdCmd','getLogsCommand','parseAsync','./context/contextCommands','join','handleJsonOutput','contextProvider','configurable','opts','jobId','toLowerCase','prj','host','alias','data','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','statusText','branches','svc','map','page','aliases','logSinkId','exitCode','plan','northflank','API\x20request\x20failed\x0a\x09Message:\x20','api.','default','__setModuleDefault','secrets','getCurrentProjectName','CliMetrics','askForTemplate','--verbose','\x20--','rawResponse','cursor','printAsTable','getProgram','login','addHelpCommand','56ZfeyqP','File\x20does\x20not\x20exist:\x20','CliPortForward','VERBOSE:\x20Request\x20body\x20->\x20','filter','loadAll','query','askForSecret','create','./utils','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','includes','plans','repository','backup-destinations','length','hasOwnProperty','underline','addCommand','after','.yaml','askForLogSink','consoleFormat','customUserAgent','assign','replace','askConfirm','count','done','./inquirer-helper','setPathVars','backupId','bind','file','volumes','kebabCase','subdomain','askForTemplateRun','forEach','addon','\x0a\x09details\x20:','__importDefault','yml','getOwnPropertyDescriptor','addons','clearLine','regions','repos','endsWith','addonId','project','-v,\x20--version','body','some','noDefaults','has','hasNextPage','templates','askForAddonBackup','askForSubdomain','brn','getCommand','description','getOwnPropertyNames','path','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','./logs','branch','ApiClientFileContextProvider','domainId','askForJob','assertContextExisting','backup','docsTagsPath','force','projectId','./exec','serviceId','\x20properties','invoices','askForBackupDestination','./formatting/console-format-helpers','requiredPermissions','next','pop','isArray','endpoints','785gIvYlU','prototype','-i,\x20--input\x20<resource-def>','resourceTagId','CliContext','2315397WgCkuT','region','set','type','askForSubdomainPath','CliExec','omit','./formatting/command-overview','split','448047UdNuKv','yaml','askForTag','toUpperCase','restores','json','askForDomain','entries','secretId','domains','askGeneric','tpl','./metrics','secret','keys','volume','stdout','37716NlrRxz','then','VERBOSE:\x20Using\x20endpoint\x20->\x20','domain','find','parse','./port-forward','getMetricsCommand','2045154eRVtXI','@northflank/js-client','lodash','__esModule','custom-columns=','projects','option','Display\x20help\x20for\x20command','service'];a1Y=function(){return Yc;};return a1Y();}exports['getProgram']=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Yf=a1Yv;try{const Y=new js_client_1[(Yf(0x244))]();yield(0x0,utils_1['checkUpdate'])(Y);const k=(0x0,exports['getProgram'])(Y);yield k[Yf(0x1d8)](process['argv']);}catch(X){(0x0,utils_1[Yf(0x1c6)])('Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20'+X['message']),process[Yf(0x1b5)]['find'](B=>B===Yf(0x1f8))&&console[Yf(0x1bf)](X),process[Yf(0x1ed)]=0x1;}}))());function isListCommand(Y){const YN=a1Yv,k=[['get',YN(0x227),YN(0x1c3)],[YN(0x1b1),'job',YN(0x195)]];return Y['find'](X=>X==='list')||k[YN(0x235)](X=>_[YN(0x1b9)](Y,X));}function generateCommands(Y,k,X,B,l,S=defaults['defaults'],C=[]){const YK=a1Yv,j=new inquirer_helper_1[(YK(0x1ae))](new js_client_1['ApiClient'](Y[YK(0x1dc)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[YK(0x217)],'agent':utils_1[YK(0x1d1)]}));function o(v,F){const Yr=YK;return v[Yr(0x1cd)]!==![]&&F===undefined;}function e(v,F){const Yw=YK,{opt:x,name:t}=v,Q=x[Yw(0x1f2)],n=o(x,Q),M=K=>K[Yw(0x20f)]>0x1?'--'+K:'-'+K,p=x===null||x===void 0x0?void 0x0:x[Yw(0x1e3)],d=p?_[Yw(0x14f)](p)?'-'+(p===null||p===void 0x0?void 0x0:p[Yw(0x1e9)](K=>M(K))[Yw(0x1da)](',\x20-'))+',':''+M(p):'',P=n?'':Yw(0x193),f=typeof x[Yw(0x159)]===Yw(0x1a5)||x[Yw(0x159)]===Yw(0x1a5)?d+Yw(0x1f9)+t:d+Yw(0x1f9)+t+'\x20<'+t[Yw(0x162)]()+'>',N=P+x[Yw(0x23e)];F[Yw(0x17e)](f,N,Q);}function O(v,F){const Yh=YK;if(F[Yh(0x1a9)][Yh(0x235)](x=>x[Yh(0x19f)]()===Yh(0x1a3)))return;_[Yh(0x1b9)](v,[Yh(0x1b1),'service'])&&(F[Yh(0x212)](B[Yh(0x1d7)]('service')),F['addCommand'](l[Yh(0x177)](Yh(0x180))),F[Yh(0x212)](B[Yh(0x1d7)]('service',!![])),F['addCommand'](l[Yh(0x177)](Yh(0x180),!![]))),_[Yh(0x1b9)](v,[Yh(0x1b1),Yh(0x1a7)])&&(F[Yh(0x212)](B[Yh(0x1d7)]('job')),F[Yh(0x212)](l[Yh(0x177)](Yh(0x1a7))),F[Yh(0x212)](B[Yh(0x1d7)](Yh(0x1a7),!![])),F[Yh(0x212)](l[Yh(0x177)]('job',!![]))),_[Yh(0x1b9)](v,[Yh(0x1b1),Yh(0x227)])&&(F[Yh(0x212)](B['getLogsCommand']('addon')),F['addCommand'](l['getMetricsCommand'](Yh(0x227)))),_[Yh(0x1b9)](v,[Yh(0x1b1),Yh(0x227),Yh(0x248)])&&F[Yh(0x212)](B[Yh(0x1d7)]('addon',![],!![])),_[Yh(0x1b9)](v,[Yh(0x1b1),Yh(0x227),Yh(0x163)])&&F[Yh(0x212)](B[Yh(0x1d7)](Yh(0x227),![],!![],!![]));}return Object[YK(0x23f)](S)[YK(0x226)](v=>{const Yg=YK,F=k[v],x=S[v],t=C[Yg(0x1b7)]([v]);function Q(w,h){const Yy=Yg,g=Object[Yy(0x23f)](w||{});g['map'](y=>{return{'name':y,'opt':w[y]};})['sort']((y,R)=>!o(y['opt'])?!o(R[Yy(0x1be)])?0x0:0x1:-0x1)[Yy(0x226)](y=>{e(y,h);});}function n(w,h){const YR=Yg,g=[[YR(0x232),YR(0x17d),YR(0x1e1)],[YR(0x180),YR(0x1ab),YR(0x1e8)],['credentials','credential','cred'],[YR(0x227),YR(0x22c),YR(0x191)],['job','jobs'],[YR(0x1ee),YR(0x20c),'pln'],[YR(0x157),YR(0x22e),'rgn'],[YR(0x173),YR(0x168),'dmn'],[YR(0x16c),YR(0x1f4),'scrt'],[YR(0x222),YR(0x16e),YR(0x1c5)],[YR(0x1e7),YR(0x243),YR(0x23c)],[YR(0x1c0),YR(0x149),'inv'],[YR(0x183),YR(0x239),YR(0x16a)],[YR(0x22f),YR(0x20d),YR(0x187),'repo'],['backup-destination',YR(0x20e)],[YR(0x18d),'tags']],y=g[YR(0x174)](R=>R[YR(0x20b)](h));if(y!==undefined)w[YR(0x1eb)](y['filter'](R=>R!==h));}function M(w){var h,g;return __awaiter(this,void 0x0,void 0x0,function*(){const Yq=a1k,y={},{contextProvider:R}=Y,q=t[Yq(0x20b)](Yq(0x1c4)),U=w[Yq(0x236)]===!![];function L(z,A,D){var E,b;return __awaiter(this,void 0x0,void 0x0,function*(){const YU=a1k;if(_[YU(0x237)]((b=(E=x[YU(0x1be)])===null||E===void 0x0?void 0x0:E[YU(0x240)])!==null&&b!==void 0x0?b:{},z)){const a=!U&&!q&&D?D():undefined,Z=w[z]||a||(yield A());_[YU(0x158)](y,z,Z);}});}return yield(0x0,utils_1[Yq(0x1a4)])(Object[Yq(0x166)]((g=(h=x[Yq(0x1be)])===null||h===void 0x0?void 0x0:h[Yq(0x240)])!==null&&g!==void 0x0?g:{}),([z,A])=>__awaiter(this,void 0x0,void 0x0,function*(){const YL=Yq;var D;const E=y===null||y===void 0x0?void 0x0:y['projectId'],b=y===null||y===void 0x0?void 0x0:y['templateId'];switch(z){case YL(0x145):return yield L(YL(0x145),j['askForProject'][YL(0x220)](j),R[YL(0x1f5)][YL(0x220)](R));case YL(0x147):return yield L('serviceId',j['askForService'](E)[YL(0x220)](j),R['getCurrentServiceName'][YL(0x220)](R));case YL(0x231):return yield L(YL(0x231),j[YL(0x192)](E)['bind'](j));case YL(0x1df):return yield L(YL(0x1df),j[YL(0x246)](E)['bind'](j),R['getCurrentJobName'][YL(0x220)](R));case YL(0x18f):return yield L(YL(0x18f),j['askForJobRun'](y[YL(0x1df)],E,![])[YL(0x220)](j));case YL(0x167):return yield L(YL(0x167),j[YL(0x207)](E)['bind'](j));case YL(0x173):case YL(0x245):return yield L('domain',j[YL(0x165)][YL(0x220)](j));case YL(0x1c7):return yield L(YL(0x1c7),j['askForCredentials']['bind'](j));case'volumeId':return yield L(YL(0x19d),j[YL(0x199)](E)[YL(0x220)](j));case'subdomain':return yield L(YL(0x224),j[YL(0x23b)](y[YL(0x173)])[YL(0x220)](j));case'subdomainId':return yield L('subdomainId',j['askForSubdomain'](y[YL(0x245)])[YL(0x220)](j));case YL(0x182):return yield L('subdomainPath',j[YL(0x15a)](y[YL(0x173)],(D=y[YL(0x224)])!==null&&D!==void 0x0?D:y[YL(0x1b6)])[YL(0x220)](j));case YL(0x21f):return yield L('backupId',j[YL(0x23a)](E,y[YL(0x231)])['bind'](j));case'buildId':return yield L(YL(0x198),j[YL(0x1a2)](E,y['serviceId'],y[YL(0x1df)])[YL(0x220)](j));case YL(0x1b3):return yield L(YL(0x1b3),j[YL(0x1f7)]()[YL(0x220)](j));case'templateRunId':return yield L('templateRunId',j[YL(0x225)](b)[YL(0x220)](j));case YL(0x1ec):return yield L(YL(0x1ec),j[YL(0x215)]()[YL(0x220)](j));case YL(0x1a1):return yield L(YL(0x1a1),j[YL(0x1cb)](E)[YL(0x220)](j));case'resourceTagId':return yield L(YL(0x154),j[YL(0x161)]()['bind'](j));case'backupDestinationId':return yield L(YL(0x1a0),j[YL(0x14a)]()['bind'](j));case'clusterId':return yield L('clusterId',j[YL(0x1c2)]()['bind'](j));default:return yield L(z,j[YL(0x169)](z,A===null||A===void 0x0?void 0x0:A[YL(0x23e)])[YL(0x220)](j));}})),y;});}function p(w){var h,g,y;return __awaiter(this,void 0x0,void 0x0,function*(){const Yz=a1k,R={},q=((h=x['opt'])===null||h===void 0x0?void 0x0:h[Yz(0x1a6)])?defaults[Yz(0x194)]:{},U=Object[Yz(0x218)](Object[Yz(0x218)]({},(y=(g=x['opt'])===null||g===void 0x0?void 0x0:g[Yz(0x206)])!==null&&y!==void 0x0?y:{}),q),L=Object[Yz(0x16d)](U)[Yz(0x204)](z=>z!==Yz(0x205));return yield(0x0,utils_1[Yz(0x1a4)])(L,z=>__awaiter(this,void 0x0,void 0x0,function*(){const YA=Yz;if(w[z]!==undefined)return _[YA(0x158)](R,z,w[z]);})),R;});}function d(){const YD=Yg;switch(t[0x0]){case YD(0x1b1):return'Get\x20information\x20about\x20Northflank\x20'+(t[0x1]||YD(0x197))+'s';case'update':return YD(0x1cf)+(t[0x1]||'resource')+YD(0x148);default:return _[YD(0x18b)](v)+'\x20Northflank\x20resources';}}function P(w,h){const YE=Yg;var g,y,R,q,U,L,z,A;if(!h){const J=(0x0,utils_1[YE(0x23d)])()['name'](_[YE(0x223)](v))[YE(0x23e)](d());return n(J,v),J;}const D=(w===null||w===void 0x0?void 0x0:w[YE(0x14c)])?chalk_1[YE(0x1f2)]['grey']('\x0a>\x20Token\x20permissions\x20required:\x20'+w[YE(0x14c)]):'',E=Y[YE(0x1dc)][YE(0x18a)](),b=E!==undefined&&((g=x===null||x===void 0x0?void 0x0:x[YE(0x1be)])===null||g===void 0x0?void 0x0:g[YE(0x249)])!==undefined,a=E===null||E===void 0x0?void 0x0:E[YE(0x1e2)]['replace'](YE(0x1f1),''),Z=b?'Documentation:\x20'+a+'/docs/v1/api/'+((y=x===null||x===void 0x0?void 0x0:x[YE(0x1be)])===null||y===void 0x0?void 0x0:y[YE(0x249)]):'',c=(w===null||w===void 0x0?void 0x0:w['description'])||'',V=(0x0,utils_1[YE(0x23d)])(!![])['name'](_[YE(0x223)](v))[YE(0x23e)](c)[YE(0x18e)](YE(0x213),[D,Z][YE(0x1da)]('\x0a'));n(V,v);(((R=x['opt'])===null||R===void 0x0?void 0x0:R['body'])||((q=x[YE(0x1be)])===null||q===void 0x0?void 0x0:q[YE(0x1d2)]))&&(V[YE(0x17e)](YE(0x1aa),'File\x20to\x20load\x20resource\x20json\x20from'),V['option'](YE(0x153),YE(0x20a)));Q((U=x[YE(0x1be)])===null||U===void 0x0?void 0x0:U[YE(0x240)],V),Q((L=x['opt'])===null||L===void 0x0?void 0x0:L['query'],V);const m=(z=x[YE(0x1be)])===null||z===void 0x0?void 0x0:z[YE(0x1a6)];return m&&Q(defaults[YE(0x194)],V),Q((A=x[YE(0x1be)])===null||A===void 0x0?void 0x0:A['base'],V),V[YE(0x181)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const Yb=YE;var H,G,s,I,u,i;(0x0,utils_1[Yb(0x247)])(Y);const W=V[Yb(0x1de)](),Y0=W[Yb(0x1ea)]!==undefined||W[Yb(0x1fb)]!==undefined;if(W[Yb(0x205)]===!![]&&Y0)throw new Error(Yb(0x19a));const Y1=W===null||W===void 0x0?void 0x0:W['output'],Y2=Y1===Yb(0x164),Y3=Y1==='yaml'||Y1===Yb(0x22a),Y4=yield M(W);j[Yb(0x21e)](Y4);const Y5=yield p(W),Y6=Object['keys']((G=(H=x[Yb(0x1be)])===null||H===void 0x0?void 0x0:H[Yb(0x240)])!==null&&G!==void 0x0?G:{})[Yb(0x1e9)](Yk=>Yk+'='+chalk_1[Yb(0x1f2)]['green'](Y4[Yk]))['join'](',\x20');if(Y6[Yb(0x20f)]>0x0&&!Y2&&!Y3){const Yk='=>\x20running\x20command\x20with:\x20'+Y6;console[Yb(0x1bf)](Yk);}const Y7=((s=x['opt'])===null||s===void 0x0?void 0x0:s[Yb(0x234)])||((I=x[Yb(0x1be)])===null||I===void 0x0?void 0x0:I[Yb(0x1d2)])?yield T(W,x,t):undefined;if(!W[Yb(0x24a)]&&t[Yb(0x20b)](Yb(0x1c4))&&!(yield j['deleteWarningPrompt']())){(0x0,utils_1[Yb(0x185)])('Resource\x20was\x20not\x20deleted.');return;}const Y8=m&&(W[Yb(0x205)]||(W[Yb(0x1cc)]===Yb(0x164)||W['output']===Yb(0x160))&&!Y0);let Y9=Y8&&F instanceof js_client_1['GetApiEndpointPaginated']?yield F[Yb(0x1d4)]({'parameters':Y4,'options':Y5,'data':Y7}):yield F[Yb(0x19b)]({'parameters':Y4,'options':Object[Yb(0x218)]({},Y5),'data':Y7});if(W===null||W===void 0x0?void 0x0:W[Yb(0x196)]){const YX=Y9[Yb(0x1bc)];console[Yb(0x1bf)](Yb(0x172)+YX[Yb(0x18c)][Yb(0x162)]()+':'+YX[Yb(0x186)]);if(Y7!==undefined)console['log'](Yb(0x203)+Y7);}if(Y9[Yb(0x1c6)]){const {details:YB,id:Yl,message:YS,status:YC}=Y9[Yb(0x1c6)],Yj=YB?Yb(0x228)+JSON[Yb(0x188)](YB):'',Yo=Yl?Yb(0x1ac)+Yl:'',Ye=Yb(0x1bb)+YC+Yo+')';throw new Error(Yb(0x1f0)+YS+'\x20'+Ye+Yj);}let YY=0x0;printCallResult(W,Y2,Y9[Yb(0x1e4)],Y3,t,Y1,![],YY,Y9['rawResponse'][Yb(0x1e6)]);if(!W[Yb(0x1bd)]&&!Y8&&!Y0&&((u=Y9[Yb(0x1c8)])===null||u===void 0x0?void 0x0:u[Yb(0x238)]))while((i=Y9[Yb(0x1c8)])===null||i===void 0x0?void 0x0:i[Yb(0x238)]){const YO=yield j[Yb(0x21a)](Yb(0x1d3));if(YO)process[Yb(0x16f)]['moveCursor'](0x0,-0x1),process[Yb(0x16f)][Yb(0x22d)](0x1),YY+=Y9[Yb(0x1c8)][Yb(0x21b)],Y9=yield Y9[Yb(0x1c8)]['getNextPage'](),printCallResult(W,Y2,Y9[Yb(0x1e4)],Y3,t,Y1,!![],YY,Y9[Yb(0x1fa)][Yb(0x1e6)]);else return;}})),V;}const f=_[Yg(0x237)](x,'opt'),N=F,K=P(N,f);O(t,K),X[Yg(0x212)](K);const r=_[Yg(0x15c)](x,Yg(0x1be));Object[Yg(0x16d)](r)[Yg(0x20f)]>0x0&&generateCommands(Y,F,K,B,l,r,t);});function T(v,F,x){var t;return __awaiter(this,void 0x0,void 0x0,function*(){const Ya=a1k,{input:Q,file:n}=v;if(Q!==undefined)try{return JSON[Ya(0x175)](Q);}catch(M){try{return yaml['safeLoad'](Q);}catch(p){throw new Error(Ya(0x1ca));}}if(n!==undefined){if(!fs_1[Ya(0x1f2)]['existsSync'](n))throw new Error(Ya(0x201)+n);const P=fs_1['default'][Ya(0x1d0)](n)[Ya(0x190)]();let f;try{if(_[Ya(0x1ba)](P)){if(v[Ya(0x221)][Ya(0x230)](Ya(0x19e)))f=JSON[Ya(0x175)](P);else{if(v['file'][Ya(0x230)](Ya(0x214))||v[Ya(0x221)][Ya(0x230)](Ya(0x22a)))f=yaml['safeLoad'](P);else throw new Error('Unknown\x20input\x20file\x20type:\x20'+v['file'][Ya(0x15e)]('.')[Ya(0x14e)]());}}else f=P;return f;}catch(N){throw new Error(Ya(0x241)+N['message']);}}if((t=F===null||F===void 0x0?void 0x0:F['opt'])===null||t===void 0x0?void 0x0:t[Ya(0x1d2)])throw new Error(Ya(0x1e5));return yield j['retrievePayloadViaInteractiveCli'](F,{'cmdPath':x,'skipValidation':v['skipValidation']});});}}const printCallResult=(Y,k,X,B,l,S,C,j,o)=>{const YZ=a1Yv;if(!(Y===null||Y===void 0x0?void 0x0:Y['quiet'])){if(k)(0x0,console_format_helpers_1[YZ(0x1db)])(Y===null||Y===void 0x0?void 0x0:Y['output'],X);else{if(B)(0x0,console_format_helpers_1['handleYamlOutput'])(Y===null||Y===void 0x0?void 0x0:Y[YZ(0x1cc)],X);else{if(isListCommand(l)){const e=(S===null||S===void 0x0?void 0x0:S['startsWith'](YZ(0x17c)))?S[YZ(0x219)](YZ(0x17c),'')[YZ(0x15e)](',')[YZ(0x1e9)](x=>x[YZ(0x1e0)]()):undefined,O=l[l['length']-0x1],T=''+O+(O[YZ(0x230)]('s')?'':'s'),v=_[YZ(0x18b)](T),F=_[YZ(0x237)](X,T)?X[T]:X;(0x0,console_format_helpers_1[YZ(0x1fc)])(F,v,e,C,j);}else console[YZ(0x1bf)]((0x0,console_format_helpers_1[YZ(0x216)])(X,o));}}}};
@@ -1 +1 @@
1
- 'use strict';function a2e(F,e){const G=a2F();return a2e=function(u,R){u=u-0x1f1;let b=G[u];return b;},a2e(F,e);}const a2X=a2e;(function(F,e){const l=a2e,G=F();while(!![]){try{const u=-parseInt(l(0x285))/0x1+-parseInt(l(0x253))/0x2+-parseInt(l(0x23d))/0x3*(-parseInt(l(0x265))/0x4)+-parseInt(l(0x243))/0x5+-parseInt(l(0x1f1))/0x6*(-parseInt(l(0x267))/0x7)+parseInt(l(0x218))/0x8*(parseInt(l(0x27c))/0x9)+parseInt(l(0x27b))/0xa*(-parseInt(l(0x25c))/0xb);if(u===e)break;else G['push'](G['shift']());}catch(R){G['push'](G['shift']());}}}(a2F,0x21169));var __createBinding=this&&this['__createBinding']||(Object[a2X(0x20b)]?function(F,e,G,u){const h=a2X;if(u===undefined)u=G;var R=Object[h(0x225)](e,G);(!R||(h(0x20a)in R?!e[h(0x26e)]:R[h(0x25a)]||R['configurable']))&&(R={'enumerable':!![],'get':function(){return e[G];}}),Object[h(0x274)](F,u,R);}:function(F,e,G,u){if(u===undefined)u=G;F[u]=e[G];}),__setModuleDefault=this&&this[a2X(0x22d)]||(Object[a2X(0x20b)]?function(F,e){const d=a2X;Object[d(0x274)](F,'default',{'enumerable':!![],'value':e});}:function(F,e){F['default']=e;}),__importStar=this&&this[a2X(0x212)]||function(F){const B=a2X;if(F&&F[B(0x26e)])return F;var e={};if(F!=null){for(var G in F)if(G!==B(0x1ff)&&Object['prototype']['hasOwnProperty'][B(0x27f)](F,G))__createBinding(e,F,G);}return __setModuleDefault(e,F),e;},__awaiter=this&&this[a2X(0x207)]||function(F,e,G,u){function R(b){return b instanceof G?b:new G(function(W){W(b);});}return new(G||(G=Promise))(function(b,W){const K=a2e;function V(t){const x=a2e;try{m(u[x(0x21a)](t));}catch(T){W(T);}}function a(t){const r=a2e;try{m(u[r(0x1fc)](t));}catch(T){W(T);}}function m(t){const k=a2e;t[k(0x278)]?b(t[k(0x1f3)]):R(t[k(0x1f3)])['then'](V,a);}m((u=u['apply'](F,e||[]))[K(0x21a)]());});},__importDefault=this&&this['__importDefault']||function(F){const p=a2X;return F&&F[p(0x26e)]?F:{'default':F};};Object['defineProperty'](exports,a2X(0x26e),{'value':!![]}),exports[a2X(0x222)]=void 0x0;const _=__importStar(require(a2X(0x223))),chalk_1=__importDefault(require(a2X(0x211))),utils_1=require('../utils'),inquirer_helper_1=require(a2X(0x21b)),console_format_helpers_1=require('../formatting/console-format-helpers'),browser_login_1=require(a2X(0x236)),inquirer=require(a2X(0x1f8));class CliContext{constructor(F,e='https://api.northflank.com'){const O=a2X;this[O(0x231)]=e,this[O(0x287)]=T=>{const D=O;let Z=T;return!/^https?:\/\//i['test'](Z)&&(Z=D(0x272)+Z),Z=Z[D(0x234)](/\/+$/,''),Z;},this[O(0x1f6)]=F;const G=new inquirer_helper_1[(O(0x201))](F);this[O(0x270)]=(0x0,utils_1[O(0x261)])()[O(0x264)](O(0x270))[O(0x227)](O(0x23b))['option'](O(0x25d),O(0x210),![])[O(0x22e)]('--do-not-open-browser',O(0x273),![])[O(0x22e)](O(0x22b),'Name\x20for\x20login\x20context')[O(0x22e)]('-t,\x20--token\x20[TOKEN]',O(0x242))[O(0x22e)](O(0x1fb),O(0x230),this[O(0x231)])['option'](O(0x25b),O(0x254),![])[O(0x282)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const z=O;_[z(0x239)](T,'host',this[z(0x287)](T[z(0x24a)]));const Z=T['tokenLogin']||T[z(0x280)]!==undefined,{name:n,host:v,token:A,override:w}=Z?yield this['apiTokenLogin'](T,G):yield this[z(0x26c)](T,G);try{yield this['apiClient'][z(0x23e)][z(0x260)]({'name':n,'host':v,'token':A},w);}catch(o){(0x0,utils_1[z(0x204)])(o['message']);return;}if(!(yield this[z(0x232)]()))(0x0,utils_1[z(0x204)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.'),yield this[z(0x1f6)][z(0x23e)][z(0x25f)](n);else{const i=Z?z(0x24b):'browser\x20login',c=z(0x1f4)+i+z(0x20f)+chalk_1['default']['italic'](n)+'\x20(api\x20host:\x20'+v+')';(0x0,utils_1['success'])(c);}})),this['contexts']=(0x0,utils_1[O(0x261)])()[O(0x264)](O(0x251))['description']('Retrieve\x20and\x20update\x20local\x20context\x20settings.')['alias'](O(0x1fd))['alias'](O(0x252));const u=(0x0,utils_1[O(0x261)])()[O(0x264)](O(0x24e))[O(0x264)]('ls')[O(0x227)](O(0x21c))['option'](O(0x258),'Shows\x20full\x20context\x20information\x20(including\x20tokens)')[O(0x282)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const C=O;console[C(0x219)](F[C(0x23e)][C(0x240)]());const Z=F[C(0x23e)][C(0x21f)]();if(T['all']===!![]){console[C(0x24c)](Z);return;}const n=Z[C(0x26b)],v=Z['contexts'][C(0x245)]((A,w)=>A[C(0x264)]===n?-0x1:w['name']===n?0x1:0x0)[C(0x27a)](A=>{const N=C,w=n===A[N(0x264)]?N(0x263):'';return{'Name':''+A[N(0x264)]+w,'Host':A[N(0x24a)],'Default\x20Project':A[N(0x247)]||'-','Default\x20Service':A[N(0x226)]||'-'};});(0x0,console_format_helpers_1[C(0x22c)])(v,C(0x220));})),R=(0x0,utils_1[O(0x261)])();R['name'](O(0x25e))['description'](O(0x288))[O(0x22e)]('-n,\x20--name\x20[NAME]',O(0x23a))[O(0x282)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const I=O,Z=(T===null||T===void 0x0?void 0x0:T[I(0x264)])||(yield this[I(0x24d)](I(0x25e)));yield this[I(0x1f6)][I(0x23e)][I(0x1fe)](Z),(0x0,utils_1[I(0x244)])('Changed\x20current\x20context\x20to\x20'+Z);}));const b='-i,\x20--id\x20[ID]',W=(0x0,utils_1[O(0x261)])()[O(0x264)]('project')[O(0x227)](O(0x215))['option'](b,O(0x203))[O(0x282)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const Y=O,Z=(T===null||T===void 0x0?void 0x0:T['id'])||(yield G[Y(0x249)]());yield this['apiClient']['contextProvider'][Y(0x289)](Z),console[Y(0x219)](Y(0x224),Z);})),V=(0x0,utils_1['getCommand'])()[O(0x264)](O(0x226))[O(0x227)](O(0x202))[O(0x22e)](b,O(0x276))[O(0x282)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const g=O,Z=(T===null||T===void 0x0?void 0x0:T['id'])||(yield G[g(0x256)](this[g(0x266)]())());console[g(0x219)](g(0x246),Z),yield this[g(0x1f6)]['contextProvider'][g(0x1f7)](Z);})),a=(0x0,utils_1[O(0x261)])()[O(0x264)]('job')[O(0x227)]('Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context')[O(0x22e)](b,O(0x20d))[O(0x282)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const Q=O,Z=(T===null||T===void 0x0?void 0x0:T['id'])||(yield G[Q(0x217)](this[Q(0x266)]())());console[Q(0x219)](Q(0x209),Z),yield this[Q(0x1f6)][Q(0x23e)][Q(0x26d)](Z);}));R[O(0x1f2)](W),R[O(0x1f2)](a),R[O(0x1f2)](V);const m=(0x0,utils_1[O(0x261)])()[O(0x264)]('remove')[O(0x277)](O(0x26a))[O(0x277)]('rm')[O(0x227)](O(0x237))['option'](b,O(0x255))[O(0x282)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const S=O;var Z;const n=(T===null||T===void 0x0?void 0x0:T['id'])||(yield this[S(0x24d)](S(0x200))),v=(Z=this[S(0x1f6)]['contextProvider'][S(0x21e)]())===null||Z===void 0x0?void 0x0:Z[S(0x264)];yield this[S(0x1f6)]['contextProvider'][S(0x25f)](n),(0x0,utils_1[S(0x244)])('Local\x20context\x20\x27'+n+'\x27\x20successfully\x20removed.');if(!this[S(0x275)]()){(0x0,utils_1[S(0x284)])(S(0x27e));return;}if(v===n){const A=(T===null||T===void 0x0?void 0x0:T[S(0x264)])||(yield this[S(0x24d)]('use\x20from\x20now\x20on'));yield this[S(0x1f6)][S(0x23e)][S(0x1fe)](A),(0x0,utils_1['success'])(S(0x21d)+A);}})),t=(0x0,utils_1['getCommand'])()['name']('update-token')[O(0x277)](O(0x20e))[O(0x227)](O(0x248))['option']('-t,\x20--token\x20[TOKEN]','Token\x20for\x20this\x20context')['action'](T=>__awaiter(this,void 0x0,void 0x0,function*(){const j=O,{contextProvider:Z}=this[j(0x1f6)],n=(T===null||T===void 0x0?void 0x0:T[j(0x280)])||(yield G[j(0x1f5)]()),v=Z[j(0x221)]();yield Z['updateToken'](n);if(yield this['verifyToken']())(0x0,utils_1[j(0x244)])('Token\x20for\x20current\x20context\x20\x27'+Z['getCurrentName']()+j(0x271));else{if(v)yield Z['updateToken'](v);(0x0,utils_1[j(0x204)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed');}}));this[O(0x1fd)][O(0x1f2)](u),this[O(0x1fd)][O(0x1f2)](R),this[O(0x1fd)][O(0x1f2)](m),this[O(0x1fd)]['addCommand'](t);}[a2X(0x26c)](F,e){var G,u,R,b;return __awaiter(this,void 0x0,void 0x0,function*(){const q=a2e,W=!F[q(0x24f)],V=(G=F['host'])!==null&&G!==void 0x0?G:this[q(0x231)],a=new browser_login_1[(q(0x228))](V,W);let m;a['on'](q(0x259),({url:n})=>{const f=q;if(W){const v=n[f(0x234)](/sessionToken=.*/,f(0x250));console[f(0x219)]('Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20'+v+')'),m=inquirer[f(0x286)]([{'type':f(0x22f),'name':f(0x241),'message':f(0x206),'default':![]}]),m['then'](A=>{const H=f;process[H(0x205)][H(0x23f)](0x0,-0x1),process[H(0x205)][H(0x268)](0x1),A['fullUrl']&&console[H(0x219)](H(0x23c)+n+'\x20');});}else console[f(0x219)](f(0x23c)+n+'\x20');});const {token:t,contextName:T}=yield a[q(0x233)]()[q(0x27d)](n=>__awaiter(this,void 0x0,void 0x0,function*(){const s=q;(0x0,utils_1[s(0x204)])(s(0x229)+n['message']+'.\x20Using\x20fallback.');const v=yield this[s(0x235)](F,e);return{'token':v[s(0x280)],'contextName':v[s(0x264)]};}))[q(0x283)](()=>{if(m)m['ui']['close']();}),Z=(R=(u=F[q(0x264)])!==null&&u!==void 0x0?u:T)!==null&&R!==void 0x0?R:q(0x269)+new Date()[q(0x281)]();return{'name':Z,'token':t,'host':V,'override':(b=F[q(0x216)])!==null&&b!==void 0x0?b:![]};});}[a2X(0x235)](F,e){return __awaiter(this,void 0x0,void 0x0,function*(){const y=a2e,G=this[y(0x1f6)][y(0x23e)][y(0x21f)]()[y(0x1fd)],{name:u,token:R,host:b,override:W}=yield e[y(0x213)](F,G);return{'name':u,'token':R,'host':b,'override':W};});}[a2X(0x266)](){const E=a2X,F=this[E(0x1f6)]['contextProvider'][E(0x1fa)]();if(F===undefined)throw new Error(E(0x20c));return F;}[a2X(0x24d)](F){return __awaiter(this,void 0x0,void 0x0,function*(){const J=a2e;if(!this[J(0x275)]())throw new Error(J(0x1f9));const e=this[J(0x1f6)][J(0x23e)]['loadContextWrapper']()[J(0x1fd)][J(0x27a)](u=>u[J(0x264)]),G=e[J(0x214)]>0x4?J(0x257):J(0x24e);return(yield inquirer[J(0x286)]([{'type':G,'name':J(0x264),'message':J(0x22a)+F+':','choices':e}]))[J(0x264)];});}[a2X(0x275)](){const M=a2X;return this[M(0x1f6)][M(0x23e)][M(0x21f)]()[M(0x1fd)][M(0x214)]>0x0;}[a2X(0x232)](){return __awaiter(this,void 0x0,void 0x0,function*(){const L=a2e;try{const F=this['apiClient']['contextProvider'][L(0x208)](),G=this['apiClient'][L(0x23e)][L(0x221)](),u=F+L(0x262),R={'Authorization':'Bearer\x20'+G},b=yield(0x0,utils_1[L(0x279)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const P=L;return(0x0,utils_1['fetch'])(u,{'method':P(0x238),'signal':AbortSignal[P(0x26f)](0xbb8),'headers':R});}));if(b['ok'])return!![];return![];}catch(W){return![];}});}}exports['CliContext']=CliContext;function a2F(){const U=['Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','Local\x20context\x20name\x20to\x20remove.','askForService','search-list','--all','browser-opened','writable','--override','319671vtyyUb','--token-login','use','removeContext','addContext','getCommand','/v1/login','\x20(current)','name','152504FewcDP','getProjectName','602OASiBs','clearLine','autologin-','delete','current','browserLogin','useJobId','__esModule','timeout','login','\x27\x20successfully\x20updated.','https://','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','defineProperty','contextAvailable','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','alias','done','retry','map','10QLDruB','144qYSTJA','catch','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','call','token','valueOf','action','finally','warning','185032LqRleb','prompt','sanitiseHostname','Switch\x20between\x20your\x20local\x20contexts','useProjectId','17478VzcwYJ','addCommand','value','\x0aSuccessfully\x20logged\x20in\x20using\x20','tokenPrompt','apiClient','useServiceId','inquirer','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','getCurrentProjectName','--host\x20[HOST]','throw','contexts','useContext','default','remove','InquirerHelper','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','error','stdout','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','__awaiter','getCurrentBaseUrl','Use\x20job\x20with\x20id:','get','create','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','set-token',',\x20added\x20context\x20with\x20name\x20','Use\x20manual\x20login\x20with\x20API\x20token','chalk','__importStar','loginPrompt','length','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','override','askForJob','94232oFnlfa','log','next','../inquirer-helper','List\x20all\x20available\x20contexts','Changed\x20current\x20context\x20to\x20','getCurrentContext','loadContextWrapper','Contexts','getCurrentToken','CliContext','lodash','Use\x20project\x20with\x20id:','getOwnPropertyDescriptor','service','description','NorthflankApiBrowserLogin','Error\x20occured\x20during\x20browser\x20login:\x20','Choose\x20the\x20context\x20to\x20','-n,\x20--name\x20[NAME]','printAsTable','__setModuleDefault','option','confirm','host\x20url\x20for\x20this\x20context','defaultBaseUrl','verifyToken','startLogin','replace','apiTokenLogin','../login/browser-login','Remove\x20a\x20context','GET','set','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','21iarHyF','contextProvider','moveCursor','getInfo','fullUrl','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','846270rddXKB','success','sort','Use\x20service\x20with\x20id:','project','Update\x20token\x20for\x20current\x20context','askForProject','host','token\x20login','dir','askForContext','list','doNotOpenBrowser','sessionToken=********','context','ctx','373976seBoCs'];a2F=function(){return U;};return a2F();}
1
+ 'use strict';const a2f=a2k;(function(Y,k){const P=a2k,X=Y();while(!![]){try{const B=parseInt(P(0x15f))/0x1+parseInt(P(0xfb))/0x2*(-parseInt(P(0x13c))/0x3)+-parseInt(P(0x119))/0x4*(parseInt(P(0x142))/0x5)+-parseInt(P(0x134))/0x6+-parseInt(P(0x17b))/0x7+-parseInt(P(0x17f))/0x8*(-parseInt(P(0x10f))/0x9)+-parseInt(P(0x180))/0xa*(-parseInt(P(0x109))/0xb);if(B===k)break;else X['push'](X['shift']());}catch(l){X['push'](X['shift']());}}}(a2Y,0x6a42e));function a2Y(){const Y2=['__setModuleDefault','\x27\x20successfully\x20updated.','-n,\x20--name\x20[NAME]','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','3iJuAnk','agent','defaultBaseUrl','../utils','CliContext','retry','1560exhTdH','tokenPrompt','use\x20from\x20now\x20on','--do-not-open-browser','--override','--all','Contexts','message','ProxyAgent','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','askForService','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','context','defineProperty','finally','removeContext','delete','apiTokenLogin','browserLogin','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','host','prompt','--host\x20[HOST]','next','sanitiseHostname','/v1/login','timeout','call','\x20(api\x20host:\x20','380800RgxYvK','\x0aSuccessfully\x20logged\x20in\x20using\x20','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','Use\x20service\x20with\x20id:','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','useJobId','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','Remove\x20a\x20context','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','__createBinding','set-token','service','stdout','addCommand','value','length','name','Switch\x20between\x20your\x20local\x20contexts','startLogin','NorthflankApiBrowserLogin','override','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','clearLine','Token\x20for\x20current\x20context\x20\x27','Use\x20job\x20with\x20id:','prototype','updateToken','getCurrentName','934689YoLFHV','useProjectId','fullUrl','addContext','27760lVJxQR','490CQIKrD','List\x20all\x20available\x20contexts','alias','browser\x20login','\x27\x20successfully\x20removed.','close','token','-i,\x20--id\x20[ID]','InquirerHelper','default','hasOwnProperty','done','Name\x20for\x20login\x20context','ctx','verifyToken','search-list','Update\x20token\x20for\x20current\x20context','throw','project','sessionToken=********','host\x20url\x20for\x20this\x20context','Local\x20context\x20\x27','apply','contextProvider','__importStar','get','map','update-token','__awaiter','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','__importDefault','getCommand','1017064gGvkHK','lodash','error','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','apiClient','Use\x20manual\x20login\x20with\x20API\x20token','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','-t,\x20--token\x20[TOKEN]','option','description',',\x20added\x20context\x20with\x20name\x20','tokenLogin','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','../login/browser-login','183403TyImUG','doNotOpenBrowser','sort','contextAvailable','log','askForJob','333ymoKRn','getCurrentContext','Changed\x20current\x20context\x20to\x20','Error\x20occured\x20during\x20browser\x20login:\x20','writable','replace','action','success','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','contexts','216iNkYve','Token\x20for\x20this\x20context','--token-login','https://','job','Use\x20project\x20with\x20id:','__esModule','\x20(current)','current','list','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','warning','loadContextWrapper','all','useContext','../inquirer-helper','fetch','Retrieve\x20and\x20update\x20local\x20context\x20settings.','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','Local\x20context\x20name\x20to\x20remove.','autologin-','https://api.northflank.com','Bearer\x20','Shows\x20full\x20context\x20information\x20(including\x20tokens)','catch','getCurrentBaseUrl','italic','1392084Evtevu','set','askForProject','askForContext'];a2Y=function(){return Y2;};return a2Y();}function a2k(Y,k){const X=a2Y();return a2k=function(B,l){B=B-0xdd;let S=X[B];return S;},a2k(Y,k);}var __createBinding=this&&this[a2f(0x168)]||(Object['create']?function(Y,X,B,l){const N=a2f;if(l===undefined)l=B;var S=Object['getOwnPropertyDescriptor'](X,B);(!S||(N(0xf4)in S?!X[N(0x11f)]:S[N(0x113)]||S['configurable']))&&(S={'enumerable':!![],'get':function(){return X[B];}}),Object[N(0x14f)](Y,l,S);}:function(Y,X,B,l){if(l===undefined)l=B;Y[l]=X[B];}),__setModuleDefault=this&&this[a2f(0x138)]||(Object['create']?function(Y,k){const K=a2f;Object[K(0x14f)](Y,K(0xe4),{'enumerable':!![],'value':k});}:function(Y,k){const r=a2f;Y[r(0xe4)]=k;}),__importStar=this&&this[a2f(0xf3)]||function(Y){const w=a2f;if(Y&&Y[w(0x11f)])return Y;var X={};if(Y!=null){for(var B in Y)if(B!==w(0xe4)&&Object[w(0x178)][w(0xe5)][w(0x15d)](Y,B))__createBinding(X,Y,B);}return __setModuleDefault(X,Y),X;},__awaiter=this&&this[a2f(0xf7)]||function(Y,k,X,B){function l(S){return S instanceof X?S:new X(function(C){C(S);});}return new(X||(X=Promise))(function(S,C){const R=a2k;function j(O){const h=a2k;try{e(B[h(0x159)](O));}catch(T){C(T);}}function o(O){const g=a2k;try{e(B[g(0xec)](O));}catch(T){C(T);}}function e(O){const y=a2k;O[y(0xe6)]?S(O[y(0x16d)]):l(O[y(0x16d)])['then'](j,o);}e((B=B[R(0xf1)](Y,k||[]))[R(0x159)]());});},__importDefault=this&&this[a2f(0xf9)]||function(Y){const q=a2f;return Y&&Y[q(0x11f)]?Y:{'default':Y};};Object[a2f(0x14f)](exports,'__esModule',{'value':!![]}),exports[a2f(0x140)]=void 0x0;const _=__importStar(require(a2f(0xfc))),proxy_agent_1=require('proxy-agent'),chalk_1=__importDefault(require('chalk')),utils_1=require(a2f(0x13f)),inquirer_helper_1=require(a2f(0x128)),console_format_helpers_1=require('../formatting/console-format-helpers'),browser_login_1=require(a2f(0x108)),inquirer=require('inquirer');class CliContext{constructor(Y,k=undefined,X=a2f(0x12e)){const U=a2f;this['agent']=k,this[U(0x13e)]=X,this['sanitiseHostname']=v=>{const L=U;let F=v;return!/^https?:\/\//i['test'](F)&&(F=L(0x11c)+F),F=F[L(0x114)](/\/+$/,''),F;},this[U(0xff)]=Y;const B=new inquirer_helper_1[(U(0xe3))](Y);this['login']=(0x0,utils_1[U(0xfa)])()[U(0x16f)]('login')[U(0x104)](U(0x101))['option'](U(0x11b),U(0x100),![])['option'](U(0x145),U(0x163),![])[U(0x103)](U(0x13a),U(0xe7))[U(0x103)]('-t,\x20--token\x20[TOKEN]',U(0x13b))[U(0x103)](U(0x158),U(0xef),this['defaultBaseUrl'])[U(0x103)](U(0x146),'Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)',![])['action'](v=>__awaiter(this,void 0x0,void 0x0,function*(){const z=U;_[z(0x135)](v,z(0x156),this[z(0x15a)](v['host']));const F=v[z(0x106)]||v['token']!==undefined,{name:x,host:t,token:Q,override:n}=F?yield this[z(0x153)](v,B):yield this[z(0x154)](v,B);try{yield this['apiClient'][z(0xf2)][z(0x17e)]({'name':x,'host':t,'token':Q},n);}catch(M){(0x0,utils_1[z(0xfd)])(M[z(0x149)]);return;}if(!(yield this['verifyToken']()))(0x0,utils_1['error'])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.'),yield this[z(0xff)][z(0xf2)][z(0x151)](x);else{const p=F?'token\x20login':z(0xde),d=z(0x160)+p+z(0x105)+chalk_1[z(0xe4)][z(0x133)](x)+z(0x15e)+t+')';(0x0,utils_1[z(0x116)])(d);}})),this['contexts']=(0x0,utils_1[U(0xfa)])()[U(0x16f)](U(0x14e))[U(0x104)](U(0x12a))[U(0xdd)](U(0x118))[U(0xdd)](U(0xe8));const l=(0x0,utils_1[U(0xfa)])()['name'](U(0x122))[U(0x16f)]('ls')['description'](U(0x181))[U(0x103)](U(0x147),U(0x130))['action'](v=>__awaiter(this,void 0x0,void 0x0,function*(){const A=U;console[A(0x10d)](Y[A(0xf2)]['getInfo']());const F=Y[A(0xf2)][A(0x125)]();if(v[A(0x126)]===!![]){console['dir'](F);return;}const x=F[A(0x121)],t=F[A(0x118)][A(0x10b)]((Q,n)=>Q[A(0x16f)]===x?-0x1:n[A(0x16f)]===x?0x1:0x0)[A(0xf5)](Q=>{const D=A,n=x===Q[D(0x16f)]?D(0x120):'';return{'Name':''+Q['name']+n,'Host':Q[D(0x156)],'Default\x20Project':Q[D(0xed)]||'-','Default\x20Service':Q[D(0x16a)]||'-'};});(0x0,console_format_helpers_1['printAsTable'])(t,A(0x148));})),S=(0x0,utils_1[U(0xfa)])();S[U(0x16f)]('use')[U(0x104)](U(0x170))[U(0x103)](U(0x13a),U(0x174))['action'](v=>__awaiter(this,void 0x0,void 0x0,function*(){const E=U,F=(v===null||v===void 0x0?void 0x0:v[E(0x16f)])||(yield this['askForContext']('use'));yield this['apiClient'][E(0xf2)][E(0x127)](F),(0x0,utils_1[E(0x116)])(E(0x111)+F);}));const C=U(0xe2),j=(0x0,utils_1['getCommand'])()[U(0x16f)](U(0xed))[U(0x104)](U(0x123))['option'](C,U(0x117))[U(0x115)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const b=U,F=(v===null||v===void 0x0?void 0x0:v['id'])||(yield B[b(0x136)]());yield this[b(0xff)][b(0xf2)][b(0x17c)](F),console[b(0x10d)](b(0x11e),F);})),o=(0x0,utils_1[U(0xfa)])()[U(0x16f)](U(0x16a))[U(0x104)]('Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context')[U(0x103)](C,U(0x107))[U(0x115)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const a=U,F=(v===null||v===void 0x0?void 0x0:v['id'])||(yield B[a(0x14c)](this['getProjectName']())());console[a(0x10d)](a(0x162),F),yield this[a(0xff)][a(0xf2)]['useServiceId'](F);})),e=(0x0,utils_1['getCommand'])()[U(0x16f)](U(0x11d))[U(0x104)](U(0xfe))[U(0x103)](C,U(0xf8))[U(0x115)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const Z=U,F=(v===null||v===void 0x0?void 0x0:v['id'])||(yield B[Z(0x10e)](this['getProjectName']())());console[Z(0x10d)](Z(0x177),F),yield this[Z(0xff)]['contextProvider'][Z(0x164)](F);}));S[U(0x16c)](j),S[U(0x16c)](e),S['addCommand'](o);const O=(0x0,utils_1[U(0xfa)])()[U(0x16f)]('remove')['alias'](U(0x152))['alias']('rm')[U(0x104)](U(0x166))[U(0x103)](C,U(0x12c))[U(0x115)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const c=U;var F;const x=(v===null||v===void 0x0?void 0x0:v['id'])||(yield this[c(0x137)]('remove')),t=(F=this[c(0xff)][c(0xf2)][c(0x110)]())===null||F===void 0x0?void 0x0:F[c(0x16f)];yield this[c(0xff)][c(0xf2)]['removeContext'](x),(0x0,utils_1['success'])(c(0xf0)+x+c(0xdf));if(!this[c(0x10c)]()){(0x0,utils_1[c(0x124)])(c(0x165));return;}if(t===x){const Q=(v===null||v===void 0x0?void 0x0:v[c(0x16f)])||(yield this[c(0x137)](c(0x144)));yield this[c(0xff)][c(0xf2)][c(0x127)](Q),(0x0,utils_1['success'])(c(0x111)+Q);}})),T=(0x0,utils_1[U(0xfa)])()[U(0x16f)](U(0xf6))[U(0xdd)](U(0x169))['description'](U(0xeb))[U(0x103)](U(0x102),U(0x11a))['action'](v=>__awaiter(this,void 0x0,void 0x0,function*(){const V=U,{contextProvider:F}=this[V(0xff)],x=(v===null||v===void 0x0?void 0x0:v['token'])||(yield B[V(0x143)]()),t=F['getCurrentToken']();yield F[V(0x179)](x);if(yield this[V(0xe9)]())(0x0,utils_1[V(0x116)])(V(0x176)+F[V(0x17a)]()+V(0x139));else{if(t)yield F[V(0x179)](t);(0x0,utils_1[V(0xfd)])(V(0x155));}}));this[U(0x118)]['addCommand'](l),this[U(0x118)]['addCommand'](S),this['contexts']['addCommand'](O),this[U(0x118)][U(0x16c)](T);}[a2f(0x154)](Y,k){var X,B,l,S;return __awaiter(this,void 0x0,void 0x0,function*(){const m=a2k,C=!Y[m(0x10a)],j=(X=Y[m(0x156)])!==null&&X!==void 0x0?X:this['defaultBaseUrl'],o=new browser_login_1[(m(0x172))](j,C,this[m(0x13d)]);let e;o['on']('browser-opened',({url:F})=>{const J=m;if(C){const x=F['replace'](/sessionToken=.*/,J(0xee));console[J(0x10d)](J(0x14b)+x+')'),e=inquirer['prompt']([{'type':'confirm','name':J(0x17d),'message':J(0x14d),'default':![]}]),e['then'](t=>{const H=J;process[H(0x16b)]['moveCursor'](0x0,-0x1),process[H(0x16b)][H(0x175)](0x1),t['fullUrl']&&console[H(0x10d)](H(0x161)+F+'\x20');});}else console[J(0x10d)](J(0x161)+F+'\x20');});const {token:O,contextName:T}=yield o[m(0x171)]()[m(0x131)](F=>__awaiter(this,void 0x0,void 0x0,function*(){const G=m;(0x0,utils_1['error'])(G(0x112)+F[G(0x149)]+'.\x20Using\x20fallback.');const x=yield this[G(0x153)](Y,k);return{'token':x[G(0xe1)],'contextName':x[G(0x16f)]};}))[m(0x150)](()=>{const s=m;if(e)e['ui'][s(0xe0)]();}),v=(l=(B=Y[m(0x16f)])!==null&&B!==void 0x0?B:T)!==null&&l!==void 0x0?l:m(0x12d)+new Date()['valueOf']();return{'name':v,'token':O,'host':j,'override':(S=Y[m(0x173)])!==null&&S!==void 0x0?S:![]};});}['apiTokenLogin'](Y,k){return __awaiter(this,void 0x0,void 0x0,function*(){const I=a2k,X=this[I(0xff)]['contextProvider']['loadContextWrapper']()[I(0x118)],{name:B,token:l,host:S,override:C}=yield k['loginPrompt'](Y,X);return{'name':B,'token':l,'host':S,'override':C};});}['getProjectName'](){const u=a2f,Y=this['apiClient'][u(0xf2)]['getCurrentProjectName']();if(Y===undefined)throw new Error(u(0x12b));return Y;}[a2f(0x137)](Y){return __awaiter(this,void 0x0,void 0x0,function*(){const i=a2k;if(!this[i(0x10c)]())throw new Error(i(0x167));const k=this[i(0xff)][i(0xf2)]['loadContextWrapper']()['contexts']['map'](B=>B['name']),X=k[i(0x16e)]>0x4?i(0xea):i(0x122);return(yield inquirer[i(0x157)]([{'type':X,'name':i(0x16f),'message':'Choose\x20the\x20context\x20to\x20'+Y+':','choices':k}]))[i(0x16f)];});}['contextAvailable'](){const W=a2f;return this[W(0xff)][W(0xf2)][W(0x125)]()[W(0x118)][W(0x16e)]>0x0;}[a2f(0xe9)](){return __awaiter(this,void 0x0,void 0x0,function*(){const Y0=a2k;try{const Y=this[Y0(0xff)]['contextProvider'][Y0(0x132)](),k=this[Y0(0xff)][Y0(0xf2)]['getCurrentToken'](),X=Y+Y0(0x15b),B={'Authorization':Y0(0x12f)+k},l=new proxy_agent_1[(Y0(0x14a))](),S=yield(0x0,utils_1[Y0(0x141)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const Y1=Y0;return(0x0,utils_1[Y1(0x129)])(X,{'method':'GET','signal':AbortSignal[Y1(0x15c)](0xbb8),'headers':B,'agent':l});}));if(S['ok'])return!![];return![];}catch(C){return![];}});}}exports[a2f(0x140)]=CliContext;