@northflank/cli 0.9.19 → 0.9.21

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 a0u3=a0I;(function(u,I){const u2=a0I,a=u();while(!![]){try{const x=-parseInt(u2(0x112))/0x1+-parseInt(u2(0x119))/0x2+-parseInt(u2(0x10f))/0x3+-parseInt(u2(0x105))/0x4*(parseInt(u2(0x10c))/0x5)+-parseInt(u2(0x102))/0x6+-parseInt(u2(0xf0))/0x7*(-parseInt(u2(0x100))/0x8)+-parseInt(u2(0x107))/0x9*(-parseInt(u2(0xff))/0xa);if(x===I)break;else a['push'](a['shift']());}catch(D){a['push'](a['shift']());}}}(a0u,0xf4186));var __awaiter=this&&this[a0u3(0xe2)]||function(u,I,a,x){function D(K){return K instanceof a?K:new a(function(z){z(K);});}return new(a||(a=Promise))(function(K,z){const u7=a0I;function H(p){const u4=a0I;try{C(x[u4(0xf9)](p));}catch(b){z(b);}}function s(p){const u5=a0I;try{C(x[u5(0x104)](p));}catch(b){z(b);}}function C(p){const u6=a0I;p[u6(0x116)]?K(p[u6(0xfc)]):D(p[u6(0xfc)])[u6(0xf5)](H,s);}C((x=x[u7(0xf3)](u,I||[]))['next']());});};Object['defineProperty'](exports,a0u3(0x109),{'value':!![]}),exports[a0u3(0x118)]=void 0x0;const utils_1=require('./utils'),defaultPaginationPageSize=0x64,getProjects=u=>I=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const u8=a0u3;var a;const x=yield u[u8(0xe8)][u8(0xe5)]({'options':{'per_page':defaultPaginationPageSize,'cursor':I===null||I===void 0x0?void 0x0:I[u8(0x108)]}});return{'elements':x[u8(0x117)][u8(0xe5)][u8(0xec)](D=>D['id']),'nextPageCursor':(a=x['pagination'])===null||a===void 0x0?void 0x0:a[u8(0xe6)]};}),getServices=(u,I)=>a=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const u9=a0u3;var x;const D=yield u[u9(0xe8)]['services']({'parameters':{'projectId':I},'options':{'per_page':defaultPaginationPageSize,'cursor':a===null||a===void 0x0?void 0x0:a[u9(0x108)]}});return{'elements':D[u9(0x117)]['services']['map'](K=>K['id']),'nextPageCursor':(x=D[u9(0xf6)])===null||x===void 0x0?void 0x0:x[u9(0xe6)]};}),getAddons=(u,I)=>a=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const uu=a0u3;var x;const D=yield u[uu(0xe8)]['addons']({'parameters':{'projectId':I},'options':{'per_page':defaultPaginationPageSize,'cursor':a===null||a===void 0x0?void 0x0:a[uu(0x108)]}});return{'elements':D[uu(0x117)][uu(0xe4)][uu(0xec)](K=>K['id']),'nextPageCursor':(x=D['pagination'])===null||x===void 0x0?void 0x0:x[uu(0xe6)]};}),getAddonBackups=(u,I,a)=>x=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const uI=a0u3;var D;const K=yield u[uI(0x11a)][uI(0xe1)][uI(0xee)]({'parameters':{'projectId':I,'addonId':a},'options':{'per_page':defaultPaginationPageSize,'cursor':x===null||x===void 0x0?void 0x0:x[uI(0x108)]}});return{'elements':K['data'][uI(0xee)]['map'](z=>z['id']),'nextPageCursor':(D=K[uI(0xf6)])===null||D===void 0x0?void 0x0:D[uI(0xe6)]};});function a0I(u,I){const a=a0u();return a0I=function(x,D){x=x-0xde;let K=a[x];return K;},a0I(u,I);}function fetchResourceList(u,I,a,x,D,K){var z,H,s,C,p,b,i,j,A,F,X,T;return __awaiter(this,void 0x0,void 0x0,function*(){const ua=a0I,E=undefined;try{if(u===ua(0xfb)){const k=yield I[ua(0xe8)][ua(0x113)]({}),R=k[ua(0x117)][ua(0x113)][ua(0xec)](q=>{var c;return(c=q===null||q===void 0x0?void 0x0:q['internalId'])!==null&&c!==void 0x0?c:q===null||q===void 0x0?void 0x0:q['id'];});return{'choices':R,'defaultValue':E};}if(u===ua(0xeb)&&!(a===null||a===void 0x0?void 0x0:a[ua(0x103)](ua(0x10b)))){const q=yield I[ua(0xe8)][ua(0x10e)]({}),c=q['data'][ua(0x10e)]['map'](M=>{const ux=ua;var r;return(r=M===null||M===void 0x0?void 0x0:M[ux(0xfe)])!==null&&r!==void 0x0?r:M===null||M===void 0x0?void 0x0:M['id'];});return{'choices':c,'defaultValue':E};}if(u==='projectId'){const M=yield getProjects(I),{elements:r,nextPageCursor:o}=yield M();return{'choices':r,'defaultValue':E,'pagination':{'nextPageCursor':o,'loadMore':M}};}if(u===ua(0x101)){const w=yield I[ua(0xe8)]['registryCredentials']({}),h=w['data'][ua(0x101)][ua(0xec)](W=>W['id']);return{'choices':h,'defaultValue':E};}const f=D===null||D===void 0x0?void 0x0:D['projectId'],N=u===ua(0x106)||u==='id'&&(K===null||K===void 0x0?void 0x0:K[ua(0x103)]('owningObject'));if(f!==undefined&&N){const W=yield getServices(I,f),{elements:B,nextPageCursor:J}=yield W();return{'choices':B,'defaultValue':E,'pagination':{'nextPageCursor':J,'loadMore':W}};}const P=a===null||a===void 0x0?void 0x0:a[ua(0x103)](ua(0xe1));if(P){const V=y=>__awaiter(this,void 0x0,void 0x0,function*(){const uD=ua;var U;const S=yield I[uD(0x11a)][uD(0xe1)][uD(0xe7)]({});return(U=S[uD(0x117)][uD(0xf4)])===null||U===void 0x0?void 0x0:U['map'](n=>n[uD(0x10d)])['find'](n=>n[uD(0x10d)]===y);});if(u===ua(0x10d)){const y=yield I['get'][ua(0xe1)][ua(0xe7)]({}),U=(z=y[ua(0x117)][ua(0xf4)])===null||z===void 0x0?void 0x0:z['map'](S=>S[ua(0x10d)]);return{'choices':U,'defaultValue':E};}if(u===ua(0xfd)&&(x===null||x===void 0x0?void 0x0:x['type'])!==undefined){const S=(H=yield V(x[ua(0x10d)]))===null||H===void 0x0?void 0x0:H['versions'],n=S!==undefined?['latest',...S]:undefined;return{'choices':n,'defaultValue':E};}if(u===ua(0xed)&&(x===null||x===void 0x0?void 0x0:x['type'])!==undefined){const L=(C=(s=yield V(x[ua(0x10d)]))===null||s===void 0x0?void 0x0:s['resources'])===null||C===void 0x0?void 0x0:C[ua(0xed)];return{'choices':L===null||L===void 0x0?void 0x0:L[ua(0xea)],'defaultValue':L===null||L===void 0x0?void 0x0:L['default']};}if(u===ua(0xdf)&&(x===null||x===void 0x0?void 0x0:x[ua(0x10d)])!==undefined){const g=(b=(p=yield V(x[ua(0x10d)]))===null||p===void 0x0?void 0x0:p[ua(0xef)])===null||b===void 0x0?void 0x0:b[ua(0xdf)];return{'choices':g===null||g===void 0x0?void 0x0:g[ua(0xea)],'defaultValue':g===null||g===void 0x0?void 0x0:g[ua(0xf1)]};}}if(u===ua(0xe0)&&(D===null||D===void 0x0?void 0x0:D[ua(0x110)])!==undefined){const l=yield getAddons(I,D===null||D===void 0x0?void 0x0:D[ua(0x110)]),{elements:Z,nextPageCursor:G}=yield l();return{'choices':Z,'defaultValue':E,'pagination':{'nextPageCursor':G,'loadMore':l}};}if(u===ua(0xf2)&&(D===null||D===void 0x0?void 0x0:D[ua(0x110)])!==undefined&&((i=x===null||x===void 0x0?void 0x0:x[ua(0x111)])===null||i===void 0x0?void 0x0:i[ua(0xe0)])!==undefined){const O=yield getAddonBackups(I,D===null||D===void 0x0?void 0x0:D[ua(0x110)],(j=x===null||x===void 0x0?void 0x0:x[ua(0x111)])===null||j===void 0x0?void 0x0:j['addonId']),{elements:Q,nextPageCursor:d}=yield O();return{'choices':Q,'defaultValue':E,'pagination':{'nextPageCursor':d,'loadMore':O}};}const m=(A=D===null||D===void 0x0?void 0x0:D[ua(0xe0)])!==null&&A!==void 0x0?A:(F=x===null||x===void 0x0?void 0x0:x[ua(0x114)])===null||F===void 0x0?void 0x0:F['addonId'];if((a===null||a===void 0x0?void 0x0:a['join'](''))==='updateaddonversion'&&u===ua(0xfd)&&(D===null||D===void 0x0?void 0x0:D[ua(0x110)])!==undefined&&m!==undefined){const {upgradeTo:v}=(yield I[ua(0x11a)][ua(0xe1)][ua(0xfd)]({'parameters':{'addonId':m,'projectId':D===null||D===void 0x0?void 0x0:D[ua(0x110)]}}))[ua(0x117)];if(v===undefined||v['length']<=0x0){(0x0,utils_1[ua(0x115)])(ua(0xe9));throw new Error();}return{'choices':v[ua(0xec)](t=>t[ua(0xfd)]),'defaultValue':E};}if(u===ua(0xe3)){const t=yield I[ua(0xe8)][ua(0xfa)]({}),Y=t[ua(0x117)][ua(0xfa)][ua(0xec)](u0=>u0===null||u0===void 0x0?void 0x0:u0['id']);return{'choices':Y,'defaultValue':E};}if(((a===null||a===void 0x0?void 0x0:a[ua(0x103)](ua(0xde)))||(a===null||a===void 0x0?void 0x0:a[ua(0x103)]('secret')))&&u===ua(0xf8)&&m!==undefined&&(D===null||D===void 0x0?void 0x0:D[ua(0x110)])!==undefined){const u0=(yield I['get']['addon']['credentials']({'parameters':{'addonId':m,'projectId':D===null||D===void 0x0?void 0x0:D['projectId']}}))[ua(0x117)];return{'choices':[...(X=Object[ua(0xf7)](u0===null||u0===void 0x0?void 0x0:u0[ua(0x10a)]))!==null&&X!==void 0x0?X:[],...(T=Object[ua(0xf7)](u0===null||u0===void 0x0?void 0x0:u0['secrets']))!==null&&T!==void 0x0?T:[]]};}}catch(u1){}return{'choices':undefined,'defaultValue':E};});}exports[a0u3(0x118)]=fetchResourceList;function a0u(){const uK=['options','region','map','storage','backups','resources','13452740qDtRvW','default','backupId','apply','addonTypes','then','pagination','keys','keyName','next','templates','deploymentPlan','value','version','internalId','1910VTIASI','8hpCcpD','credentials','8616288mMtVuk','includes','throw','868UsfvPK','serviceId','209835uqaQOP','nextPageCursor','__esModule','envs','logSink','15335PKHYGG','type','regions','2359581ezYKrJ','projectId','source','868145Grrbpg','plans','addonDependencies','warning','done','data','fetchResourceList','3237824MvuvJV','get','secretLink','replicas','addonId','addon','__awaiter','templateId','addons','projects','cursor','types','list','No\x20available\x20versions\x20to\x20upgrade\x20to.'];a0u=function(){return uK;};return a0u();}
1
+ 'use strict';const a0e5=a0o;(function(e,o){const e1=a0o,h=e();while(!![]){try{const p=-parseInt(e1(0x15f))/0x1+-parseInt(e1(0x14a))/0x2+parseInt(e1(0x16d))/0x3+parseInt(e1(0x172))/0x4+parseInt(e1(0x14b))/0x5+parseInt(e1(0x14e))/0x6*(-parseInt(e1(0x15d))/0x7)+parseInt(e1(0x161))/0x8;if(p===o)break;else h['push'](h['shift']());}catch(Y){h['push'](h['shift']());}}}(a0e,0x24422));function a0o(e,o){const h=a0e();return a0o=function(p,Y){p=p-0x13b;let q=h[p];return q;},a0o(e,o);}var __awaiter=this&&this['__awaiter']||function(e,o,h,p){function Y(q){return q instanceof h?q:new h(function(J){J(q);});}return new(h||(h=Promise))(function(q,J){const e4=a0o;function v(Z){try{I(p['next'](Z));}catch(k){J(k);}}function s(Z){const e2=a0o;try{I(p[e2(0x16b)](Z));}catch(k){J(k);}}function I(Z){const e3=a0o;Z[e3(0x149)]?q(Z[e3(0x16c)]):Y(Z['value'])[e3(0x16f)](v,s);}I((p=p[e4(0x159)](e,o||[]))['next']());});};function a0e(){const eY=['find','includes','plans','secrets','backups','throw','value','484857qWZoAx','defineProperty','then','owningObject','fetchResourceList','778932UQjYxv','projects','type','storage','addon','credentials','get','keyName','serviceId','join','types','cursor','__esModule','addonTypes','latest','list','./utils','internalId','done','544218LHmanA','811915wLmkkr','secret','projectId','246144JJqopV','pagination','replicas','source','No\x20available\x20versions\x20to\x20upgrade\x20to.','options','templateId','keys','resources','version','region','apply','services','addonDependencies','registryCredentials','7WCOmgk','logSink','215821sxAjOI','nextPageCursor','1269864pzYOBy','data','map','addonId','secretLink'];a0e=function(){return eY;};return a0e();}Object[a0e5(0x16e)](exports,a0e5(0x143),{'value':!![]}),exports[a0e5(0x171)]=void 0x0;const utils_1=require(a0e5(0x147)),defaultPaginationPageSize=0x64,getProjects=e=>o=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const e6=a0e5;var h;const p=yield e[e6(0x146)]['projects']({'options':{'per_page':defaultPaginationPageSize,'cursor':o===null||o===void 0x0?void 0x0:o[e6(0x160)]}});return{'elements':p['data'][e6(0x173)][e6(0x163)](Y=>Y['id']),'nextPageCursor':(h=p[e6(0x14f)])===null||h===void 0x0?void 0x0:h[e6(0x142)]};}),getServices=(e,o)=>h=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const e7=a0e5;var p;const Y=yield e[e7(0x146)][e7(0x15a)]({'parameters':{'projectId':o},'options':{'per_page':defaultPaginationPageSize,'cursor':h===null||h===void 0x0?void 0x0:h['nextPageCursor']}});return{'elements':Y[e7(0x162)][e7(0x15a)][e7(0x163)](q=>q['id']),'nextPageCursor':(p=Y[e7(0x14f)])===null||p===void 0x0?void 0x0:p[e7(0x142)]};}),getAddons=(e,o)=>h=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const e8=a0e5;var p;const Y=yield e[e8(0x146)]['addons']({'parameters':{'projectId':o},'options':{'per_page':defaultPaginationPageSize,'cursor':h===null||h===void 0x0?void 0x0:h[e8(0x160)]}});return{'elements':Y[e8(0x162)]['addons']['map'](q=>q['id']),'nextPageCursor':(p=Y[e8(0x14f)])===null||p===void 0x0?void 0x0:p[e8(0x142)]};}),getAddonBackups=(e,o,h)=>p=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const e9=a0e5;var Y;const q=yield e['get']['addon'][e9(0x16a)]({'parameters':{'projectId':o,'addonId':h},'options':{'per_page':defaultPaginationPageSize,'cursor':p===null||p===void 0x0?void 0x0:p[e9(0x160)]}});return{'elements':q[e9(0x162)]['backups']['map'](J=>J['id']),'nextPageCursor':(Y=q[e9(0x14f)])===null||Y===void 0x0?void 0x0:Y['cursor']};});function fetchResourceList(e,o,h,p,Y,q){var J,v,s,I,Z,k,L,F,W,N,g,w;return __awaiter(this,void 0x0,void 0x0,function*(){const ee=a0o,C=undefined;try{if(e==='deploymentPlan'){const z=yield o['list']['plans']({}),H=z['data'][ee(0x168)][ee(0x163)](P=>{const eo=ee;var V;return(V=P===null||P===void 0x0?void 0x0:P[eo(0x148)])!==null&&V!==void 0x0?V:P===null||P===void 0x0?void 0x0:P['id'];});return{'choices':H,'defaultValue':C};}if(e===ee(0x158)&&!(h===null||h===void 0x0?void 0x0:h[ee(0x167)](ee(0x15e)))){const P=yield o['list']['regions']({}),V=P[ee(0x162)]['regions'][ee(0x163)](u=>{const eh=ee;var c;return(c=u===null||u===void 0x0?void 0x0:u[eh(0x148)])!==null&&c!==void 0x0?c:u===null||u===void 0x0?void 0x0:u['id'];});return{'choices':V,'defaultValue':C};}if(e==='projectId'){const u=yield getProjects(o),{elements:c,nextPageCursor:n}=yield u();return{'choices':c,'defaultValue':C,'pagination':{'nextPageCursor':n,'loadMore':u}};}if(e===ee(0x13c)){const d=yield o[ee(0x146)][ee(0x15c)]({}),j=d[ee(0x162)][ee(0x13c)][ee(0x163)](Q=>Q['id']);return{'choices':j,'defaultValue':C};}const x=Y===null||Y===void 0x0?void 0x0:Y[ee(0x14d)],l=e===ee(0x13f)||e==='id'&&(q===null||q===void 0x0?void 0x0:q[ee(0x167)](ee(0x170)));if(x!==undefined&&l){const Q=yield getServices(o,x),{elements:D,nextPageCursor:f}=yield Q();return{'choices':D,'defaultValue':C,'pagination':{'nextPageCursor':f,'loadMore':Q}};}const b=h===null||h===void 0x0?void 0x0:h[ee(0x167)]('addon');if(b){const i=R=>__awaiter(this,void 0x0,void 0x0,function*(){const ep=ee;var t;const G=yield o[ep(0x13d)][ep(0x13b)][ep(0x141)]({});return(t=G['data'][ep(0x144)])===null||t===void 0x0?void 0x0:t[ep(0x163)](y=>y['type'])[ep(0x166)](y=>y[ep(0x174)]===R);});if(e===ee(0x174)){const R=yield o[ee(0x13d)]['addon'][ee(0x141)]({}),t=(J=R[ee(0x162)][ee(0x144)])===null||J===void 0x0?void 0x0:J[ee(0x163)](G=>G['type']);return{'choices':t,'defaultValue':C};}if(e===ee(0x157)&&(p===null||p===void 0x0?void 0x0:p['type'])!==undefined){const G=(v=yield i(p[ee(0x174)]))===null||v===void 0x0?void 0x0:v['versions'],y=G!==undefined?[ee(0x145),...G]:undefined;return{'choices':y,'defaultValue':C};}if(e===ee(0x175)&&(p===null||p===void 0x0?void 0x0:p[ee(0x174)])!==undefined){const S=(I=(s=yield i(p[ee(0x174)]))===null||s===void 0x0?void 0x0:s[ee(0x156)])===null||I===void 0x0?void 0x0:I[ee(0x175)];return{'choices':S===null||S===void 0x0?void 0x0:S[ee(0x153)],'defaultValue':S===null||S===void 0x0?void 0x0:S['default']};}if(e===ee(0x150)&&(p===null||p===void 0x0?void 0x0:p[ee(0x174)])!==undefined){const X=(k=(Z=yield i(p['type']))===null||Z===void 0x0?void 0x0:Z[ee(0x156)])===null||k===void 0x0?void 0x0:k[ee(0x150)];return{'choices':X===null||X===void 0x0?void 0x0:X[ee(0x153)],'defaultValue':X===null||X===void 0x0?void 0x0:X['default']};}}if(e==='addonId'&&(Y===null||Y===void 0x0?void 0x0:Y[ee(0x14d)])!==undefined){const m=yield getAddons(o,Y===null||Y===void 0x0?void 0x0:Y[ee(0x14d)]),{elements:U,nextPageCursor:T}=yield m();return{'choices':U,'defaultValue':C,'pagination':{'nextPageCursor':T,'loadMore':m}};}if(e==='backupId'&&(Y===null||Y===void 0x0?void 0x0:Y[ee(0x14d)])!==undefined&&((L=p===null||p===void 0x0?void 0x0:p[ee(0x151)])===null||L===void 0x0?void 0x0:L[ee(0x164)])!==undefined){const O=yield getAddonBackups(o,Y===null||Y===void 0x0?void 0x0:Y[ee(0x14d)],(F=p===null||p===void 0x0?void 0x0:p['source'])===null||F===void 0x0?void 0x0:F[ee(0x164)]),{elements:E,nextPageCursor:A}=yield O();return{'choices':E,'defaultValue':C,'pagination':{'nextPageCursor':A,'loadMore':O}};}const a=(W=Y===null||Y===void 0x0?void 0x0:Y['addonId'])!==null&&W!==void 0x0?W:(N=p===null||p===void 0x0?void 0x0:p[ee(0x15b)])===null||N===void 0x0?void 0x0:N[ee(0x164)];if((h===null||h===void 0x0?void 0x0:h[ee(0x140)](''))==='updateaddonversion'&&e===ee(0x157)&&(Y===null||Y===void 0x0?void 0x0:Y[ee(0x14d)])!==undefined&&a!==undefined){const {upgradeTo:M}=(yield o[ee(0x13d)][ee(0x13b)][ee(0x157)]({'parameters':{'addonId':a,'projectId':Y===null||Y===void 0x0?void 0x0:Y[ee(0x14d)]}}))[ee(0x162)];if(M===undefined||M['length']<=0x0){(0x0,utils_1['warning'])(ee(0x152));throw new Error();}return{'choices':M['map'](K=>K['version']),'defaultValue':C};}if(e===ee(0x154)){const K=yield o[ee(0x146)]['templates']({}),r=K[ee(0x162)]['templates'][ee(0x163)](B=>B===null||B===void 0x0?void 0x0:B['id']);return{'choices':r,'defaultValue':C};}if(((h===null||h===void 0x0?void 0x0:h[ee(0x167)](ee(0x165)))||(h===null||h===void 0x0?void 0x0:h[ee(0x167)](ee(0x14c))))&&e===ee(0x13e)&&a!==undefined&&(Y===null||Y===void 0x0?void 0x0:Y[ee(0x14d)])!==undefined){const B=(yield o[ee(0x13d)][ee(0x13b)][ee(0x13c)]({'parameters':{'addonId':a,'projectId':Y===null||Y===void 0x0?void 0x0:Y[ee(0x14d)]}}))[ee(0x162)];return{'choices':[...(g=Object[ee(0x155)](B===null||B===void 0x0?void 0x0:B['envs']))!==null&&g!==void 0x0?g:[],...(w=Object[ee(0x155)](B===null||B===void 0x0?void 0x0:B[ee(0x169)]))!==null&&w!==void 0x0?w:[]]};}}catch(e0){}return{'choices':undefined,'defaultValue':C};});}exports[a0e5(0x171)]=fetchResourceList;
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';const a1ub=a1I;(function(u,I){const up=a1I,a=u();while(!![]){try{const x=-parseInt(up(0x1de))/0x1+-parseInt(up(0x1bd))/0x2+-parseInt(up(0x181))/0x3+parseInt(up(0x1ce))/0x4*(-parseInt(up(0x10e))/0x5)+-parseInt(up(0x1c0))/0x6+-parseInt(up(0x112))/0x7+parseInt(up(0x108))/0x8;if(x===I)break;else a['push'](a['shift']());}catch(D){a['push'](a['shift']());}}}(a1u,0xae5e0));function a1I(u,I){const a=a1u();return a1I=function(x,D){x=x-0xe7;let K=a[x];return K;},a1I(u,I);}var __createBinding=this&&this[a1ub(0x1b1)]||(Object[a1ub(0x120)]?function(u,I,a,x){const ui=a1ub;if(x===undefined)x=a;var D=Object[ui(0x130)](I,a);(!D||(ui(0x152)in D?!I['__esModule']:D[ui(0xfc)]||D[ui(0x12b)]))&&(D={'enumerable':!![],'get':function(){return I[a];}}),Object[ui(0x16d)](u,x,D);}:function(u,I,a,x){if(x===undefined)x=a;u[x]=I[a];}),__setModuleDefault=this&&this[a1ub(0x1f1)]||(Object['create']?function(u,I){const uj=a1ub;Object['defineProperty'](u,uj(0x189),{'enumerable':!![],'value':I});}:function(u,I){const uA=a1ub;u[uA(0x189)]=I;}),__importStar=this&&this[a1ub(0x10b)]||function(u){const uF=a1ub;if(u&&u[uF(0xef)])return u;var I={};if(u!=null){for(var a in u)if(a!=='default'&&Object['prototype'][uF(0x122)]['call'](u,a))__createBinding(I,u,a);}return __setModuleDefault(I,u),I;},__awaiter=this&&this[a1ub(0x167)]||function(u,I,a,x){function D(K){return K instanceof a?K:new a(function(z){z(K);});}return new(a||(a=Promise))(function(K,z){const uf=a1I;function H(p){const uX=a1I;try{C(x[uX(0x1c6)](p));}catch(b){z(b);}}function s(p){const uT=a1I;try{C(x[uT(0x199)](p));}catch(b){z(b);}}function C(p){const uE=a1I;p[uE(0x1a9)]?K(p[uE(0x126)]):D(p['value'])[uE(0x147)](H,s);}C((x=x[uf(0x1bf)](u,I||[]))['next']());});},__importDefault=this&&this['__importDefault']||function(u){const uN=a1ub;return u&&u[uN(0xef)]?u:{'default':u};};Object[a1ub(0x16d)](exports,a1ub(0xef),{'value':!![]}),exports[a1ub(0x1dd)]=void 0x0;const js_client_1=require(a1ub(0x103)),commander_1=__importDefault(require(a1ub(0x16b))),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require(a1ub(0xfb))),_=__importStar(require('lodash')),contextCommands_1=require('./context/contextCommands'),utils_1=require(a1ub(0xe7)),defaults=__importStar(require('./defaults')),inquirer_helper_1=require(a1ub(0xff)),console_format_helpers_1=require(a1ub(0x141)),command_overview_1=require(a1ub(0x11d)),port_forward_1=require(a1ub(0xeb)),exec_1=require(a1ub(0x143)),logs_1=require(a1ub(0x1f3)),metrics_1=require(a1ub(0x175)),pagination_helper_1=require('./pagination/pagination-helper'),yaml=require(a1ub(0x12c)),pgk=require('../package.json'),getProgram=u=>{const uP=a1ub,I=new commander_1['default']['Command']('northflank');I[uP(0x1ad)](uP(0x196)),I[uP(0x188)](!![]),I['version']('Northflank\x20cli\x20version:\x20'+chalk_1[uP(0x189)][uP(0x161)](pgk['version']),uP(0x100),uP(0x155));const a=new js_client_1['ApiClient'](u,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1['customUserAgent']}),x=new contextCommands_1[(uP(0x11b))](a),D=new port_forward_1[(uP(0x18f))](u),K=new exec_1[(uP(0x115))](u),z=new logs_1[(uP(0x1b2))](u),H=new metrics_1['CliMetrics'](u);return I[uP(0x1d0)](D[uP(0xf5)]),I['addCommand'](K[uP(0x1c5)]),I[uP(0x1d0)](x[uP(0x182)]),I['addCommand'](x[uP(0x1ea)]),generateCommands(a,a[uP(0x1e0)],I,z,H),I['addCommand']((0x0,command_overview_1[uP(0x18b)])(I)),I[uP(0x184)](!![],uP(0x1a2)),I[uP(0x117)](undefined,uP(0x1a2)),I;};exports[a1ub(0x1dd)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const um=a1ub;try{const u=new js_client_1[(um(0x150))]();yield(0x0,utils_1[um(0x1dc)])(u);const I=(0x0,exports[um(0x1dd)])(u);yield I[um(0x177)](process[um(0x190)]);}catch(a){(0x0,utils_1['error'])(um(0x1cb)+a[um(0xf7)]),process['argv']['find'](x=>x===um(0x14a))&&console[um(0x173)](a),process['exitCode']=0x1;}}))());function isListCommand(u){const uk=a1ub,I=[[uk(0x152),uk(0x136),uk(0x1c4)],['get',uk(0x1aa),uk(0x1b6)]];return u[uk(0x148)](a=>a===uk(0xf6))||I[uk(0x1c1)](a=>_[uk(0x1cd)](u,a));}function a1u(){const uL=['pipelineId','dmn','=>\x20running\x20command\x20with:\x20','opt','log','askGeneric','./metrics','addonId','parseAsync','getAll','buildId','askForDomain','resourceTagId','InquirerHelper','length','loadAll','secretId','.json','749415OxKGKH','login','askForTag','addHelpCommand',',\x20NF\x20error\x20id:\x20','credentialId','grey','enablePositionalOptions','default','scrt','getCommandOverview','getLogsCommand','askForLogSink','commands','CliPortForward','argv','\x0a\x09details\x20:','\x20Northflank\x20resources','repositories','askForJobRun','invoices','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','askForService','\x20properties','throw','filter','addons','toLowerCase','getCurrentContext','assign','aliases','domains','Update\x20Northflank\x20','Display\x20help\x20for\x20command','requiredPermissions','regions','replace','custom-columns=','host','Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27','done','job','rawResponse','kebabCase','description','moveCursor','region','inv','__createBinding','CliLogs','brn','API\x20request\x20failed\x0a\x09Message:\x20','currentOffset','runs','clusterId','setPathVars','isArray','vol','consoleFormat','service','1269092kuSHpt','Get\x20information\x20about\x20Northflank\x20','apply','5946096SSXygD','some','handleYamlOutput','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','backups','execCmd','next','option','askForPipeline','volumes','hasNext','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','docsTagsPath','isEqual','4aUTsaY','assertContextExisting','addCommand','runId','safeLoad','resource','volumeId','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','concat','repo','method','skipValidation','query','cursor','checkUpdate','getProgram','539200WaSbrF','parse','endpoints','endsWith','logSinkId','set','getMetricsCommand','green','\x20--','includes','json','askForProject','contexts','addHelpText','status','toString','getCurrentProjectName','keys','branches','__setModuleDefault','File\x20to\x20load\x20resource\x20json\x20from','./logs','api.','./utils','there\x20are\x20more\x20rows,\x20load?','forEach','join','./port-forward','verbose','output','services','__esModule','branch','opts','split','domain','(HTTP\x20status\x20code:\x20','portFwdCmd','list','message','rgn','has','subdomainPath','chalk','writable','\x0a>\x20Token\x20permissions\x20required:\x20','tpl','./inquirer-helper','-v,\x20--version','secret','upperFirst','@northflank/js-client','nonInteractiveEndpoint','alias','cred','deleteWarningPrompt','26808544ZfIvvb','warning','getCurrentServiceName','__importStar','retrievePayloadViaInteractiveCli','subdomainId','790300pfQzZn','page','action','clearLine','449631WuEMJV','askForSecret','repository','CliExec','template','helpOption','body','tag','name','CliContext','askForTemplateRun','./formatting/command-overview','secrets','stdout','create','invoice','hasOwnProperty','required','prj','contextProvider','value','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','base','project','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','configurable','js-yaml','bind','yml','jobId','getOwnPropertyDescriptor','toUpperCase','delete','serviceId','backupId','pln','addon','error','type','svc','data','path','quiet','paginationArgs','plan','templateId','plans','./formatting/console-format-helpers','restores','./exec','isPaginatedEndpoint','force','subdomain','then','find','askForCredentials','--verbose','url','after',',\x20-','.yaml','adn','ApiClientFileContextProvider','pop','get','getCurrentJobName','omit','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','entries','getNext','file','askConfirm','askForSubdomainPath','templates','update','askForJob','askForTemplate','isString','-f,\x20--file\x20<file-path>','underline','yaml','askForAddon','map','projectId','domainId','__awaiter','templateRunId','asyncSequential','askForSubdomain','commander','boolean','defineProperty','getOwnPropertyNames'];a1u=function(){return uL;};return a1u();}function generateCommands(u,I,a,x,D,K=defaults['defaults'],z=[]){const uR=a1ub,H=new inquirer_helper_1[(uR(0x17c))](new js_client_1['ApiClient'](u[uR(0x125)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent']}));function s(i,j){const uq=uR;return i[uq(0x123)]!==![]&&j===undefined;}function C(i,j){const uc=uR,{opt:A,name:F}=i,X=A[uc(0x189)],T=s(A,X),E=R=>R[uc(0x17d)]>0x1?'--'+R:'-'+R,f=A===null||A===void 0x0?void 0x0:A[uc(0x105)],N=f?_[uc(0x1b9)](f)?'-'+(f===null||f===void 0x0?void 0x0:f[uc(0x164)](R=>E(R))[uc(0xea)](uc(0x14d)))+',':''+E(f):'',P=T?'':'OPTIONAL:\x20',m=typeof A[uc(0x138)]===uc(0x16c)||A[uc(0x138)]===uc(0x16c)?N+uc(0x1e6)+F:N+uc(0x1e6)+F+'\x20<'+F[uc(0x131)]()+'>',k=P+A[uc(0x1ad)];j['option'](m,k,X);}function p(i,j){const uM=uR;if(j[uM(0x18e)][uM(0x1c1)](A=>A[uM(0x11a)]()==='logs'))return;_['isEqual'](i,['get',uM(0x1bc)])&&(j[uM(0x1d0)](x[uM(0x18c)](uM(0x1bc))),j[uM(0x1d0)](D[uM(0x1e4)](uM(0x1bc))),j[uM(0x1d0)](x[uM(0x18c)](uM(0x1bc),!![])),j[uM(0x1d0)](D[uM(0x1e4)]('service',!![]))),_['isEqual'](i,[uM(0x152),uM(0x1aa)])&&(j[uM(0x1d0)](x['getLogsCommand'](uM(0x1aa))),j['addCommand'](D[uM(0x1e4)]('job')),j[uM(0x1d0)](x[uM(0x18c)](uM(0x1aa),!![])),j[uM(0x1d0)](D[uM(0x1e4)]('job',!![]))),_['isEqual'](i,[uM(0x152),'addon'])&&(j[uM(0x1d0)](x[uM(0x18c)]('addon')),j[uM(0x1d0)](D[uM(0x1e4)]('addon'))),_[uM(0x1cd)](i,['get',uM(0x136),'backup'])&&j[uM(0x1d0)](x['getLogsCommand'](uM(0x136),![],!![])),_[uM(0x1cd)](i,['get',uM(0x136),uM(0x142)])&&j['addCommand'](x['getLogsCommand'](uM(0x136),![],!![],!![]));}return Object[uR(0x16e)](K)[uR(0xe9)](i=>{const ur=uR,j=I[i],A=K[i],F=z[ur(0x1d6)]([i]);function X(c,M){const uo=ur,r=Object[uo(0x16e)](c||{});r[uo(0x164)](o=>{return{'name':o,'opt':c[o]};})['sort']((o,w)=>!s(o[uo(0x172)])?!s(w[uo(0x172)])?0x0:0x1:-0x1)['forEach'](o=>{C(o,M);});}function T(c,M){const uw=ur,r=[[uw(0x129),'projects',uw(0x124)],[uw(0x1bc),uw(0xee),uw(0x139)],['credentials','credential',uw(0x106)],['addon',uw(0x19b),uw(0x14f)],['job','jobs'],[uw(0x13e),uw(0x140),uw(0x135)],[uw(0x1af),uw(0x1a4),uw(0xf8)],['domain',uw(0x1a0),uw(0x170)],[uw(0x101),uw(0x11e),uw(0x18a)],[uw(0x1c9),'volume',uw(0x1ba)],[uw(0x1f0),uw(0xf0),uw(0x1b3)],[uw(0x121),uw(0x195),uw(0x1b0)],[uw(0x116),uw(0x15b),uw(0xfe)],['repos',uw(0x114),uw(0x193),uw(0x1d7)],[uw(0x119),'tags']],o=r[uw(0x148)](w=>w[uw(0x1e7)](M));if(o!==undefined)c[uw(0x19f)](o[uw(0x19a)](w=>w!==M));}function E(c){var M,r;return __awaiter(this,void 0x0,void 0x0,function*(){const uh=a1I,o={},{contextProvider:w}=u,h=F[uh(0x1e7)](uh(0x132)),W=c['noDefaults']===!![];function B(J,V,y){var e,U;return __awaiter(this,void 0x0,void 0x0,function*(){const uW=a1I;if(_[uW(0xf9)]((U=(e=A[uW(0x172)])===null||e===void 0x0?void 0x0:e[uW(0x13b)])!==null&&U!==void 0x0?U:{},J)){const S=!W&&!h&&y?y():undefined,n=c[J]||S||(yield V());_[uW(0x1e3)](o,J,n);}});}return yield(0x0,utils_1[uh(0x169)])(Object[uh(0x156)]((r=(M=A[uh(0x172)])===null||M===void 0x0?void 0x0:M[uh(0x13b)])!==null&&r!==void 0x0?r:{}),([J,V])=>__awaiter(this,void 0x0,void 0x0,function*(){const uB=uh;var y;const e=o===null||o===void 0x0?void 0x0:o[uB(0x165)],U=o===null||o===void 0x0?void 0x0:o[uB(0x13f)];switch(J){case uB(0x165):return yield B('projectId',H[uB(0x1e9)][uB(0x12d)](H),w[uB(0x1ee)][uB(0x12d)](w));case uB(0x133):return yield B(uB(0x133),H[uB(0x197)](e)['bind'](H),w[uB(0x10a)][uB(0x12d)](w));case uB(0x176):return yield B(uB(0x176),H[uB(0x163)](e)[uB(0x12d)](H));case uB(0x12f):return yield B(uB(0x12f),H[uB(0x15d)](e)['bind'](H),w[uB(0x153)][uB(0x12d)](w));case'runId':return yield B(uB(0x1d1),H[uB(0x194)](o[uB(0x12f)],e,![])[uB(0x12d)](H));case uB(0x17f):return yield B('secretId',H[uB(0x113)](e)[uB(0x12d)](H));case'domain':case uB(0x166):return yield B(uB(0xf3),H[uB(0x17a)][uB(0x12d)](H));case'credentialId':return yield B(uB(0x186),H[uB(0x149)][uB(0x12d)](H));case uB(0x1d4):return yield B(uB(0x1d4),H['askForVolume'](e)[uB(0x12d)](H));case uB(0x146):return yield B(uB(0x146),H['askForSubdomain'](o[uB(0xf3)])['bind'](H));case uB(0x10d):return yield B('subdomainId',H[uB(0x16a)](o['domainId'])[uB(0x12d)](H));case'subdomainPath':return yield B(uB(0xfa),H[uB(0x15a)](o[uB(0xf3)],(y=o[uB(0x146)])!==null&&y!==void 0x0?y:o[uB(0x10d)])[uB(0x12d)](H));case uB(0x134):return yield B(uB(0x134),H['askForAddonBackup'](e,o[uB(0x176)])[uB(0x12d)](H));case uB(0x179):return yield B('buildId',H['askForBuild'](e,o[uB(0x133)],o[uB(0x12f)])[uB(0x12d)](H));case uB(0x13f):return yield B(uB(0x13f),H[uB(0x15e)]()[uB(0x12d)](H));case uB(0x168):return yield B(uB(0x168),H[uB(0x11c)](U)['bind'](H));case uB(0x1e2):return yield B(uB(0x1e2),H[uB(0x18d)]()[uB(0x12d)](H));case'pipelineId':return yield B(uB(0x16f),H[uB(0x1c8)](e)['bind'](H));case uB(0x17b):return yield B(uB(0x17b),H[uB(0x183)]()[uB(0x12d)](H));case'clusterId':return yield B(uB(0x1b7),H['askForClusterId']()[uB(0x12d)](H));default:return yield B(J,H[uB(0x174)](J,V===null||V===void 0x0?void 0x0:V[uB(0x1ad)])['bind'](H));}})),o;});}function f(c){var M,r,o;return __awaiter(this,void 0x0,void 0x0,function*(){const uJ=a1I,w={},h=((M=A[uJ(0x172)])===null||M===void 0x0?void 0x0:M[uJ(0x144)])?defaults[uJ(0x13d)]:{},W=Object['assign'](Object[uJ(0x19e)]({},(o=(r=A['opt'])===null||r===void 0x0?void 0x0:r[uJ(0x1da)])!==null&&o!==void 0x0?o:{}),h),B=Object[uJ(0x1ef)](W)['filter'](J=>J!==uJ(0x17e));return yield(0x0,utils_1[uJ(0x169)])(B,J=>__awaiter(this,void 0x0,void 0x0,function*(){const uV=uJ;if(c[J]!==undefined)return _[uV(0x1e3)](w,J,c[J]);})),w;});}function N(){const uy=ur;switch(F[0x0]){case'get':return uy(0x1be)+(F[0x1]||uy(0x1d3))+'s';case uy(0x15c):return uy(0x1a1)+(F[0x1]||uy(0x1d3))+uy(0x198);default:return _[uy(0x102)](i)+uy(0x192);}}function P(c,M){const ue=ur;var r,o,w,h,W,B,J,V;if(!M){const l=(0x0,utils_1['getCommand'])()[ue(0x11a)](_[ue(0x1ac)](i))['description'](N());return T(l,i),l;}const y=(c===null||c===void 0x0?void 0x0:c['requiredPermissions'])?chalk_1[ue(0x189)][ue(0x187)](ue(0xfd)+c[ue(0x1a3)]):'',e=u[ue(0x125)][ue(0x19d)](),U=e!==undefined&&((r=A===null||A===void 0x0?void 0x0:A[ue(0x172)])===null||r===void 0x0?void 0x0:r[ue(0x1cc)])!==undefined,S=e===null||e===void 0x0?void 0x0:e[ue(0x1a7)][ue(0x1a5)](ue(0x1f4),''),n=U?'Documentation:\x20'+S+'/docs/v1/api/'+((o=A===null||A===void 0x0?void 0x0:A[ue(0x172)])===null||o===void 0x0?void 0x0:o[ue(0x1cc)]):'',L=(c===null||c===void 0x0?void 0x0:c[ue(0x1ad)])||'',g=(0x0,utils_1['getCommand'])(!![])[ue(0x11a)](_[ue(0x1ac)](i))[ue(0x1ad)](L)[ue(0x1eb)](ue(0x14c),[y,n][ue(0xea)]('\x0a'));return T(g,i),(((w=A[ue(0x172)])===null||w===void 0x0?void 0x0:w[ue(0x118)])||((h=A[ue(0x172)])===null||h===void 0x0?void 0x0:h[ue(0x104)]))&&(g[ue(0x1c7)](ue(0x160),ue(0x1f2)),g['option']('-i,\x20--input\x20<resource-def>',ue(0x127))),X((W=A[ue(0x172)])===null||W===void 0x0?void 0x0:W[ue(0x13b)],g),X((B=A[ue(0x172)])===null||B===void 0x0?void 0x0:B[ue(0x1da)],g),((J=A['opt'])===null||J===void 0x0?void 0x0:J[ue(0x144)])&&X(defaults['paginationArgs'],g),X((V=A[ue(0x172)])===null||V===void 0x0?void 0x0:V[ue(0x128)],g),g[ue(0x110)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const uU=ue;var Z,G,O,Q;(0x0,utils_1[uU(0x1cf)])(u);const d=g[uU(0xf1)](),v=d[uU(0x10f)]!==undefined||d[uU(0x1db)]!==undefined;if(d[uU(0x17e)]===!![]&&v)throw new Error(uU(0x1a8));const t=d===null||d===void 0x0?void 0x0:d['output'],Y=t===uU(0x1e8),u0=t===uU(0x162)||t==='yml',u1=yield E(d);H[uU(0x1b8)](u1);const u2=yield f(d),u3=Object[uU(0x1ef)]((G=(Z=A['opt'])===null||Z===void 0x0?void 0x0:Z[uU(0x13b)])!==null&&G!==void 0x0?G:{})['map'](u8=>u8+'='+chalk_1[uU(0x189)][uU(0x1e5)](u1[u8]))['join'](',\x20');if(u3[uU(0x17d)]>0x0&&!Y&&!u0){const u8=uU(0x171)+u3;console[uU(0x173)](u8);}const u4=((O=A[uU(0x172)])===null||O===void 0x0?void 0x0:O[uU(0x118)])||((Q=A['opt'])===null||Q===void 0x0?void 0x0:Q[uU(0x104)])?yield yield b(d,A,F):undefined;if(!d[uU(0x145)]&&F[uU(0x1e7)](uU(0x132))&&!(yield H[uU(0x107)]())){(0x0,utils_1[uU(0x109)])('Resource\x20was\x20not\x20deleted.');return;}const u5=new pagination_helper_1['PaginationHelper'](j,u1,u2,u4),u6=d[uU(0x17e)]||(d['output']==='json'||d[uU(0xed)]===uU(0x162))&&!v,u7=u6?yield u5[uU(0x178)]():yield u5[uU(0x157)]();if(d===null||d===void 0x0?void 0x0:d[uU(0xec)]){const u9=u7['request'];console[uU(0x173)]('VERBOSE:\x20Using\x20endpoint\x20->\x20'+u9[uU(0x1d8)][uU(0x131)]()+':'+u9[uU(0x14b)]);if(u4!==undefined)console[uU(0x173)]('VERBOSE:\x20Request\x20body\x20->\x20'+u4);}if(u7[uU(0x137)]){const {details:uu,id:uI,message:ua,status:ux}=u7[uU(0x137)],uD=uu?uU(0x191)+JSON['stringify'](uu):'',uK=uI?uU(0x185)+uI:'',uz=uU(0xf4)+ux+uK+')';throw new Error(uU(0x1b4)+ua+'\x20'+uz+uD);}printCallResult(d,Y,u7[uU(0x13a)],u0,F,t,![],0x0,u7[uU(0x1ab)][uU(0x1ec)]);if(!d[uU(0x13c)]&&!u6&&!v&&u5[uU(0x1ca)]())while(u5[uU(0x1ca)]()){const uH=yield H[uU(0x159)](uU(0xe8));if(uH){process[uU(0x11f)][uU(0x1ae)](0x0,-0x1),process[uU(0x11f)][uU(0x111)](0x1);const us=u5[uU(0x1b5)],uC=yield u5[uU(0x157)]();printCallResult(d,Y,uC[uU(0x13a)],u0,F,t,!![],us,uC['rawResponse'][uU(0x1ec)]);}else return;}})),g;}const m=_[ur(0xf9)](A,ur(0x172)),k=j,R=P(k,m);p(F,R),a[ur(0x1d0)](R);const q=_[ur(0x154)](A,'opt');Object[ur(0x1ef)](q)[ur(0x17d)]>0x0&&generateCommands(u,j,R,x,D,q,F);});function b(i,j,A){var F;return __awaiter(this,void 0x0,void 0x0,function*(){const uS=a1I,{input:X,file:T}=i;if(X!==undefined)try{return JSON[uS(0x1df)](X);}catch(E){try{return yaml[uS(0x1d2)](X);}catch(f){throw new Error(uS(0x12a));}}if(T!==undefined){if(!fs_1[uS(0x189)]['existsSync'](T))throw new Error('File\x20does\x20not\x20exist:\x20'+T);const N=fs_1[uS(0x189)]['readFileSync'](T)[uS(0x1ed)]();let P;try{if(_[uS(0x15f)](N)){if(i[uS(0x158)][uS(0x1e1)](uS(0x180)))P=JSON[uS(0x1df)](N);else{if(i[uS(0x158)]['endsWith'](uS(0x14e))||i[uS(0x158)][uS(0x1e1)](uS(0x12e)))P=yaml['safeLoad'](N);else throw new Error('Unknown\x20input\x20file\x20type:\x20'+i[uS(0x158)]['split']('.')[uS(0x151)]());}}else P=N;return P;}catch(m){throw new Error(uS(0x1c3)+m[uS(0xf7)]);}}if((F=j===null||j===void 0x0?void 0x0:j[uS(0x172)])===null||F===void 0x0?void 0x0:F[uS(0x104)])throw new Error(uS(0x1d5));return yield H[uS(0x10c)](j,{'cmdPath':A,'skipValidation':i[uS(0x1d9)]});});}}const printCallResult=(u,I,a,x,D,K,z,H,s)=>{const un=a1ub;if(!(u===null||u===void 0x0?void 0x0:u['quiet'])){if(I)(0x0,console_format_helpers_1['handleJsonOutput'])(u===null||u===void 0x0?void 0x0:u[un(0xed)],a);else{if(x)(0x0,console_format_helpers_1[un(0x1c2)])(u===null||u===void 0x0?void 0x0:u[un(0xed)],a);else{if(isListCommand(D)){const C=(K===null||K===void 0x0?void 0x0:K['startsWith'](un(0x1a6)))?K[un(0x1a5)](un(0x1a6),'')[un(0xf2)](',')[un(0x164)](A=>A[un(0x19c)]()):undefined,p=D[D[un(0x17d)]-0x1],b=''+p+(p[un(0x1e1)]('s')?'':'s'),i=_[un(0x102)](b),j=_[un(0xf9)](a,b)?a[b]:a;(0x0,console_format_helpers_1['printAsTable'])(j,i,C,z,H);}else console[un(0x173)]((0x0,console_format_helpers_1[un(0x1bb)])(a,s));}}}};
2
+ 'use strict';const a1eL=a1o;(function(e,o){const ek=a1o,h=e();while(!![]){try{const p=-parseInt(ek(0x1f9))/0x1+parseInt(ek(0x1f0))/0x2+-parseInt(ek(0x200))/0x3+parseInt(ek(0x22f))/0x4*(-parseInt(ek(0x21f))/0x5)+-parseInt(ek(0x273))/0x6*(-parseInt(ek(0x190))/0x7)+parseInt(ek(0x19b))/0x8*(parseInt(ek(0x266))/0x9)+-parseInt(ek(0x206))/0xa;if(p===o)break;else h['push'](h['shift']());}catch(Y){h['push'](h['shift']());}}}(a1e,0xa8c99));function a1o(e,o){const h=a1e();return a1o=function(p,Y){p=p-0x190;let q=h[p];return q;},a1o(e,o);}var __createBinding=this&&this[a1eL(0x1b0)]||(Object[a1eL(0x1e8)]?function(e,h,p,Y){const eF=a1eL;if(Y===undefined)Y=p;var q=Object[eF(0x269)](h,p);(!q||(eF(0x290)in q?!h[eF(0x27c)]:q[eF(0x1dc)]||q[eF(0x19a)]))&&(q={'enumerable':!![],'get':function(){return h[p];}}),Object[eF(0x237)](e,Y,q);}:function(e,h,p,Y){if(Y===undefined)Y=p;e[Y]=h[p];}),__setModuleDefault=this&&this[a1eL(0x1b1)]||(Object[a1eL(0x1e8)]?function(e,h){const eW=a1eL;Object[eW(0x237)](e,'default',{'enumerable':!![],'value':h});}:function(e,h){const eN=a1eL;e[eN(0x1e2)]=h;}),__importStar=this&&this[a1eL(0x281)]||function(e){const eg=a1eL;if(e&&e[eg(0x27c)])return e;var o={};if(e!=null){for(var h in e)if(h!=='default'&&Object[eg(0x24e)][eg(0x1eb)]['call'](e,h))__createBinding(o,e,h);}return __setModuleDefault(o,e),o;},__awaiter=this&&this[a1eL(0x1d6)]||function(e,o,h,p){function Y(q){return q instanceof h?q:new h(function(J){J(q);});}return new(h||(h=Promise))(function(q,J){const el=a1o;function v(Z){const ew=a1o;try{I(p[ew(0x1d1)](Z));}catch(k){J(k);}}function s(Z){const eC=a1o;try{I(p[eC(0x1d3)](Z));}catch(k){J(k);}}function I(Z){const ex=a1o;Z[ex(0x239)]?q(Z['value']):Y(Z[ex(0x231)])[ex(0x1ad)](v,s);}I((p=p[el(0x279)](e,o||[]))[el(0x1d1)]());});},__importDefault=this&&this['__importDefault']||function(e){const eb=a1eL;return e&&e[eb(0x27c)]?e:{'default':e};};Object[a1eL(0x237)](exports,'__esModule',{'value':!![]}),exports[a1eL(0x1e7)]=void 0x0;const js_client_1=require('@northflank/js-client'),commander_1=__importDefault(require(a1eL(0x243))),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require('chalk')),_=__importStar(require(a1eL(0x1cf))),contextCommands_1=require(a1eL(0x1a6)),utils_1=require(a1eL(0x20e)),defaults=__importStar(require(a1eL(0x25e))),inquirer_helper_1=require(a1eL(0x1f7)),console_format_helpers_1=require('./formatting/console-format-helpers'),command_overview_1=require(a1eL(0x1de)),port_forward_1=require(a1eL(0x255)),exec_1=require('./exec'),logs_1=require(a1eL(0x256)),metrics_1=require(a1eL(0x225)),pagination_helper_1=require(a1eL(0x1a4)),yaml=require(a1eL(0x248)),pgk=require(a1eL(0x1fc)),getProgram=e=>{const ea=a1eL,o=new commander_1['default'][(ea(0x240))](ea(0x1b2));o[ea(0x1e5)]('Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line'),o[ea(0x213)](!![]),o[ea(0x214)](ea(0x1d5)+chalk_1['default'][ea(0x291)](pgk[ea(0x214)]),ea(0x1bc),ea(0x26d));const h=new js_client_1['ApiClient'](e,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[ea(0x238)]}),p=new contextCommands_1['CliContext'](h),Y=new port_forward_1['CliPortForward'](e),q=new exec_1['CliExec'](e),J=new logs_1[(ea(0x1cd))](e),v=new metrics_1[(ea(0x1b9))](e);return o[ea(0x19e)](Y[ea(0x1bf)]),o[ea(0x19e)](q[ea(0x278)]),o[ea(0x19e)](p['login']),o[ea(0x19e)](p[ea(0x1c7)]),generateCommands(h,h['endpoints'],o,J,v),o['addCommand']((0x0,command_overview_1[ea(0x1a0)])(o)),o[ea(0x1bb)](!![],'Display\x20help\x20for\x20command'),o['helpOption'](undefined,ea(0x282)),o;};function a1e(){const em=['toLowerCase','File\x20does\x20not\x20exist:\x20','isPaginatedEndpoint','./inquirer-helper','dmn','456689imYXWo','askForJobRun','includes','../package.json','restores','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','logs','523800mTYmMO','jobId','ApiClientFileContextProvider','consoleFormat','repo','parse','4315720FvSwLp','askForVolume','aliases','--page','getOwnPropertyNames','credential','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','=>\x20running\x20command\x20with:\x20','./utils','getCurrentContext','there\x20are\x20more\x20rows,\x20load?','toUpperCase','json','enablePositionalOptions','version','bind','resource','find','getMetricsCommand','logSinkId','rawResponse','backupId','has','entries','domains','5SzQjpO','service','getAll','templateId','\x0a\x09details\x20:','tags','./metrics','askForService','host','Unknown\x20input\x20file\x20type:\x20','delete','list','domain','brn','\x20properties','subdomainId','3981100iZssPV','status','value','backups','getCurrentProjectName','grey','getCommand','split','defineProperty','customUserAgent','done','assertContextExisting','tpl','region','askForBuild','moveCursor','option','Command','templateRunId','scrt','commander','repositories','map','askForTag','VERBOSE:\x20Using\x20endpoint\x20->\x20','js-yaml','argv','askForSubdomainPath','hasNext','pln','adn','prototype','setPathVars','assign','-f,\x20--file\x20<file-path>','resourceTagId','addonId','cred','./port-forward','./logs','serviceId','file','PaginationHelper','Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27','message','getNext','\x20Northflank\x20resources','./defaults','name','domainId','askForProject','branch','parseAsync','askForSubdomain','yaml','22266ZPTKgl','force','pipelineId','getOwnPropertyDescriptor','runs','template','project','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','contextProvider','runId','page','safeLoad','stdout','3315774FQIwHD','replace','InquirerHelper','nonInteractiveEndpoint','omit','execCmd','apply','commands','addon','__esModule','secrets','defaults','rgn','exitCode','__importStar','Display\x20help\x20for\x20command','\x20--','regions','repository','after','docsTagsPath','join','(HTTP\x20status\x20code:\x20','projectId','requiredPermissions','concat','url','api.','green','get','underline','\x0a>\x20Token\x20permissions\x20required:\x20','addHelpText','long','noDefaults','opts','forEach','stringify','path','7RlUfcc','ApiClient','isArray','secret','loadAll','subdomain','length','existsSync','handleYamlOutput','output','configurable','2984WSQsbE','Get\x20information\x20about\x20Northflank\x20','askForAddon','addCommand','update','getCommandOverview','error','pop','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','./pagination/pagination-helper','prj','./context/contextCommands','volumeId','paginationArgs','boolean','/docs/v1/api/','templates','keys','then','getCurrentJobName','buildId','__createBinding','__setModuleDefault','northflank','some','isEqual','askConfirm','query','credentialId','body','CliMetrics','toString','addHelpCommand','-v,\x20--version','getLogsCommand','data','portFwdCmd',',\x20-','job','secretId','yml','subdomainPath','alias','getCurrentServiceName','contexts','handleJsonOutput','kebabCase','API\x20request\x20failed\x0a\x09Message:\x20','printAsTable','svc','CliLogs','askForTemplate','lodash','volume','next','askForCredentials','throw','services','Northflank\x20cli\x20version:\x20','__awaiter','Documentation:\x20','tag','plan','startsWith','backup','writable','repos','./formatting/command-overview','set','opt','askForAddonBackup','default','File\x20to\x20load\x20resource\x20json\x20from','inv','description','custom-columns=','getProgram','create','skipValidation','filter','hasOwnProperty','.yaml','request','required','OPTIONAL:\x20','2548116HAXMVg','endsWith','quiet','log'];a1e=function(){return em;};return a1e();}exports['getProgram']=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const ez=a1eL;try{const o=new js_client_1[(ez(0x202))]();yield(0x0,utils_1['checkUpdate'])(o);const h=(0x0,exports[ez(0x1e7)])(o);yield h[ez(0x263)](process[ez(0x249)]);}catch(p){(0x0,utils_1[ez(0x1a1)])('Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20'+p[ez(0x25b)]),process[ez(0x249)][ez(0x217)](Y=>Y==='--verbose')&&console[ez(0x1f3)](p),process[ez(0x280)]=0x1;}}))());function isListCommand(e){const eH=a1eL,o=[[eH(0x290),eH(0x27b),eH(0x232)],[eH(0x290),eH(0x1c1),eH(0x26a)]];return e['find'](h=>h===eH(0x22a))||o[eH(0x1b3)](h=>_[eH(0x1b4)](e,h));}function generateCommands(e,o,h,p,Y,q=defaults[a1eL(0x27e)],J=[]){const eP=a1eL,v=new inquirer_helper_1[(eP(0x275))](new js_client_1[(eP(0x191))](e[eP(0x26e)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[eP(0x238)]}));function s(L,F){const eV=eP;return L[eV(0x1ee)]!==![]&&F===undefined;}function I(L,F){const eu=eP,{opt:W,name:N}=L,g=W['default'],w=s(W,g),C=H=>H[eu(0x196)]>0x1?'--'+H:'-'+H,x=W===null||W===void 0x0?void 0x0:W[eu(0x1c5)],l=x?_[eu(0x192)](x)?'-'+(x===null||x===void 0x0?void 0x0:x['map'](H=>C(H))['join'](eu(0x1c0)))+',':''+C(x):'',b=w?'':eu(0x1ef),a=typeof W['type']===eu(0x1a9)||W['type']===eu(0x1a9)?l+eu(0x283)+N:l+eu(0x283)+N+'\x20<'+N[eu(0x211)]()+'>',z=b+W[eu(0x1e5)];F[eu(0x23f)](a,z,g);}function Z(L,F){const ec=eP;if(F[ec(0x27a)][ec(0x1b3)](W=>W['name']()===ec(0x1ff)))return;_[ec(0x1b4)](L,['get','service'])&&(F[ec(0x19e)](p[ec(0x1bd)](ec(0x220))),F[ec(0x19e)](Y[ec(0x218)](ec(0x220))),F['addCommand'](p[ec(0x1bd)](ec(0x220),!![])),F[ec(0x19e)](Y['getMetricsCommand'](ec(0x220),!![]))),_[ec(0x1b4)](L,[ec(0x290),ec(0x1c1)])&&(F['addCommand'](p[ec(0x1bd)](ec(0x1c1))),F[ec(0x19e)](Y['getMetricsCommand'](ec(0x1c1))),F[ec(0x19e)](p[ec(0x1bd)](ec(0x1c1),!![])),F[ec(0x19e)](Y[ec(0x218)](ec(0x1c1),!![]))),_[ec(0x1b4)](L,[ec(0x290),'addon'])&&(F[ec(0x19e)](p['getLogsCommand'](ec(0x27b))),F[ec(0x19e)](Y['getMetricsCommand'](ec(0x27b)))),_[ec(0x1b4)](L,[ec(0x290),ec(0x27b),ec(0x1db)])&&F[ec(0x19e)](p['getLogsCommand']('addon',![],!![])),_[ec(0x1b4)](L,['get',ec(0x27b),ec(0x1fd)])&&F[ec(0x19e)](p[ec(0x1bd)](ec(0x27b),![],!![],!![]));}return Object['getOwnPropertyNames'](q)[eP(0x297)](L=>{const en=eP,F=o[L],W=q[L],N=J[en(0x28c)]([L]);function g(V,u){const ed=en,c=Object[ed(0x20a)](V||{});c['map'](n=>{return{'name':n,'opt':V[n]};})['sort']((n,d)=>!s(n[ed(0x1e0)])?!s(d['opt'])?0x0:0x1:-0x1)[ed(0x297)](n=>{I(n,u);});}function w(V,u){const ej=en,c=[[ej(0x26c),'projects',ej(0x1a5)],[ej(0x220),ej(0x1d4),ej(0x1cc)],['credentials',ej(0x20b),ej(0x254)],[ej(0x27b),'addons',ej(0x24d)],['job','jobs'],[ej(0x1d9),'plans',ej(0x24c)],[ej(0x23c),ej(0x284),ej(0x27f)],[ej(0x22b),ej(0x21e),ej(0x1f8)],[ej(0x193),ej(0x27d),ej(0x242)],['volumes',ej(0x1d0),'vol'],['branches',ej(0x262),ej(0x22c)],['invoice','invoices',ej(0x1e4)],[ej(0x26b),ej(0x1ab),ej(0x23b)],[ej(0x1dd),ej(0x285),ej(0x244),ej(0x204)],[ej(0x1d8),ej(0x224)]],n=c['find'](d=>d['includes'](u));if(n!==undefined)V[ej(0x208)](n[ej(0x1ea)](d=>d!==u));}function C(V){var u,c;return __awaiter(this,void 0x0,void 0x0,function*(){const eQ=a1o,n={},{contextProvider:d}=e,j=N[eQ(0x1fb)](eQ(0x229)),Q=V[eQ(0x295)]===!![];function D(f,i,R){var t,G;return __awaiter(this,void 0x0,void 0x0,function*(){const eD=a1o;if(_[eD(0x21c)]((G=(t=W['opt'])===null||t===void 0x0?void 0x0:t[eD(0x299)])!==null&&G!==void 0x0?G:{},f)){const y=!Q&&!j&&R?R():undefined,S=V[f]||y||(yield i());_['set'](n,f,S);}});}return yield(0x0,utils_1['asyncSequential'])(Object[eQ(0x21d)]((c=(u=W[eQ(0x1e0)])===null||u===void 0x0?void 0x0:u[eQ(0x299)])!==null&&c!==void 0x0?c:{}),([f,i])=>__awaiter(this,void 0x0,void 0x0,function*(){const ef=eQ;var R;const t=n===null||n===void 0x0?void 0x0:n[ef(0x28a)],G=n===null||n===void 0x0?void 0x0:n[ef(0x222)];switch(f){case ef(0x28a):return yield D(ef(0x28a),v[ef(0x261)][ef(0x215)](v),d[ef(0x233)][ef(0x215)](d));case ef(0x257):return yield D('serviceId',v[ef(0x226)](t)[ef(0x215)](v),d[ef(0x1c6)]['bind'](d));case ef(0x253):return yield D('addonId',v[ef(0x19d)](t)[ef(0x215)](v));case ef(0x201):return yield D(ef(0x201),v['askForJob'](t)[ef(0x215)](v),d[ef(0x1ae)][ef(0x215)](d));case ef(0x26f):return yield D(ef(0x26f),v[ef(0x1fa)](n['jobId'],t,![])[ef(0x215)](v));case ef(0x1c2):return yield D(ef(0x1c2),v['askForSecret'](t)[ef(0x215)](v));case ef(0x22b):case ef(0x260):return yield D(ef(0x22b),v['askForDomain'][ef(0x215)](v));case'credentialId':return yield D(ef(0x1b7),v[ef(0x1d2)][ef(0x215)](v));case'volumeId':return yield D(ef(0x1a7),v[ef(0x207)](t)['bind'](v));case'subdomain':return yield D('subdomain',v[ef(0x264)](n[ef(0x22b)])[ef(0x215)](v));case ef(0x22e):return yield D('subdomainId',v[ef(0x264)](n[ef(0x260)])[ef(0x215)](v));case ef(0x1c4):return yield D(ef(0x1c4),v[ef(0x24a)](n[ef(0x22b)],(R=n[ef(0x195)])!==null&&R!==void 0x0?R:n[ef(0x22e)])[ef(0x215)](v));case'backupId':return yield D(ef(0x21b),v[ef(0x1e1)](t,n[ef(0x253)])[ef(0x215)](v));case ef(0x1af):return yield D(ef(0x1af),v[ef(0x23d)](t,n[ef(0x257)],n[ef(0x201)])['bind'](v));case ef(0x222):return yield D(ef(0x222),v[ef(0x1ce)]()['bind'](v));case ef(0x241):return yield D(ef(0x241),v['askForTemplateRun'](G)[ef(0x215)](v));case ef(0x219):return yield D(ef(0x219),v['askForLogSink']()[ef(0x215)](v));case'pipelineId':return yield D(ef(0x268),v['askForPipeline'](t)['bind'](v));case ef(0x252):return yield D(ef(0x252),v[ef(0x246)]()['bind'](v));case'clusterId':return yield D('clusterId',v['askForClusterId']()[ef(0x215)](v));default:return yield D(f,v['askGeneric'](f,i===null||i===void 0x0?void 0x0:i[ef(0x1e5)])[ef(0x215)](v));}})),n;});}function x(V){var u,c,n;return __awaiter(this,void 0x0,void 0x0,function*(){const ei=a1o,d={},j=((u=W[ei(0x1e0)])===null||u===void 0x0?void 0x0:u[ei(0x1f6)])?defaults[ei(0x1a8)]:{},Q=Object['assign'](Object[ei(0x250)]({},(n=(c=W[ei(0x1e0)])===null||c===void 0x0?void 0x0:c['query'])!==null&&n!==void 0x0?n:{}),j),D=Object[ei(0x1ac)](Q)[ei(0x1ea)](f=>f!==ei(0x194));return yield(0x0,utils_1['asyncSequential'])(D,f=>__awaiter(this,void 0x0,void 0x0,function*(){const eR=ei;if(V[f]!==undefined)return _[eR(0x1df)](d,f,V[f]);})),d;});}function l(){const et=en;switch(N[0x0]){case et(0x290):return et(0x19c)+(N[0x1]||et(0x216))+'s';case et(0x19f):return'Update\x20Northflank\x20'+(N[0x1]||et(0x216))+et(0x22d);default:return _['upperFirst'](L)+et(0x25d);}}function b(V,u){const eG=en;var c,n,d,j,Q,D,f,i;if(!u){const U=(0x0,utils_1[eG(0x235)])()[eG(0x25f)](_['kebabCase'](L))[eG(0x1e5)](l());return w(U,L),U;}const R=(V===null||V===void 0x0?void 0x0:V[eG(0x28b)])?chalk_1[eG(0x1e2)][eG(0x234)](eG(0x292)+V[eG(0x28b)]):'',t=e[eG(0x26e)][eG(0x20f)](),G=t!==undefined&&((c=W===null||W===void 0x0?void 0x0:W['opt'])===null||c===void 0x0?void 0x0:c[eG(0x287)])!==undefined,y=t===null||t===void 0x0?void 0x0:t[eG(0x227)]['replace'](eG(0x28e),''),S=G?eG(0x1d7)+y+eG(0x1aa)+((n=W===null||W===void 0x0?void 0x0:W[eG(0x1e0)])===null||n===void 0x0?void 0x0:n[eG(0x287)]):'',X=(V===null||V===void 0x0?void 0x0:V[eG(0x1e5)])||'',m=(0x0,utils_1[eG(0x235)])(!![])[eG(0x25f)](_[eG(0x1c9)](L))[eG(0x1e5)](X)[eG(0x293)](eG(0x286),[R,S][eG(0x288)]('\x0a'));return w(m,L),(((d=W[eG(0x1e0)])===null||d===void 0x0?void 0x0:d[eG(0x1b8)])||((j=W[eG(0x1e0)])===null||j===void 0x0?void 0x0:j[eG(0x276)]))&&(m[eG(0x23f)](eG(0x251),eG(0x1e3)),m[eG(0x23f)]('-i,\x20--input\x20<resource-def>','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22')),g((Q=W[eG(0x1e0)])===null||Q===void 0x0?void 0x0:Q[eG(0x299)],m),g((D=W[eG(0x1e0)])===null||D===void 0x0?void 0x0:D[eG(0x1b6)],m),((f=W[eG(0x1e0)])===null||f===void 0x0?void 0x0:f['isPaginatedEndpoint'])&&g(defaults[eG(0x1a8)],m),g((i=W[eG(0x1e0)])===null||i===void 0x0?void 0x0:i['base'],m),m['action'](()=>__awaiter(this,void 0x0,void 0x0,function*(){const ey=eG;var T,O,E,A;(0x0,utils_1[ey(0x23a)])(e);const M=m[ey(0x296)](),K=M[ey(0x270)]!==undefined||M['cursor']!==undefined,r=m['options'][ey(0x1b3)](e9=>e9[ey(0x294)]===ey(0x209));if(M[ey(0x194)]===!![]&&K)throw new Error(ey(0x25a));const B=M===null||M===void 0x0?void 0x0:M['output'],e0=B==='json',e1=B==='yaml'||B===ey(0x1c3),e2=yield C(M);v[ey(0x24f)](e2);const e3=yield x(M),e4=Object[ey(0x1ac)]((O=(T=W['opt'])===null||T===void 0x0?void 0x0:T['path'])!==null&&O!==void 0x0?O:{})[ey(0x245)](e9=>e9+'='+chalk_1['default'][ey(0x28f)](e2[e9]))['join'](',\x20');if(e4[ey(0x196)]>0x0&&!e0&&!e1){const e9=ey(0x20d)+e4;console[ey(0x1f3)](e9);}const e5=((E=W[ey(0x1e0)])===null||E===void 0x0?void 0x0:E['body'])||((A=W['opt'])===null||A===void 0x0?void 0x0:A['nonInteractiveEndpoint'])?yield yield k(M,W,N):undefined;if(!M[ey(0x267)]&&N[ey(0x1fb)](ey(0x229))&&!(yield v['deleteWarningPrompt']())){(0x0,utils_1['warning'])('Resource\x20was\x20not\x20deleted.');return;}const e6=new pagination_helper_1[(ey(0x259))](F,e2,e3,e5),e7=r&&(M[ey(0x194)]||(M[ey(0x199)]===ey(0x212)||M[ey(0x199)]===ey(0x265))&&!K),e8=e7?yield e6[ey(0x221)]():yield e6[ey(0x25c)]();if(M===null||M===void 0x0?void 0x0:M['verbose']){const ee=e8[ey(0x1ed)];console[ey(0x1f3)](ey(0x247)+ee['method']['toUpperCase']()+':'+ee[ey(0x28d)]);if(e5!==undefined)console[ey(0x1f3)]('VERBOSE:\x20Request\x20body\x20->\x20'+e5);}if(e8[ey(0x1a1)]){const {details:eo,id:eh,message:ep,status:eY}=e8[ey(0x1a1)],eq=eo?ey(0x223)+JSON[ey(0x298)](eo):'',eJ=eh?',\x20NF\x20error\x20id:\x20'+eh:'',ev=ey(0x289)+eY+eJ+')';throw new Error(ey(0x1ca)+ep+'\x20'+ev+eq);}printCallResult(M,e0,e8[ey(0x1be)],e1,N,B,![],0x0,e8[ey(0x21a)][ey(0x230)]);if(!M[ey(0x1f2)]&&!e7&&!K&&e6['hasNext']())while(e6[ey(0x24b)]()){const es=yield v[ey(0x1b5)](ey(0x210));if(es){process[ey(0x272)][ey(0x23e)](0x0,-0x1),process['stdout']['clearLine'](0x1);const eI=e6['currentOffset'],eZ=yield e6[ey(0x25c)]();printCallResult(M,e0,eZ['data'],e1,N,B,!![],eI,eZ[ey(0x21a)][ey(0x230)]);}else return;}})),m;}const a=_[en(0x21c)](W,'opt'),z=F,H=b(z,a);Z(N,H),h[en(0x19e)](H);const P=_[en(0x277)](W,'opt');Object[en(0x1ac)](P)[en(0x196)]>0x0&&generateCommands(e,F,H,p,Y,P,N);});function k(L,F,W){var N;return __awaiter(this,void 0x0,void 0x0,function*(){const eS=a1o,{input:g,file:w}=L;if(g!==undefined)try{return JSON['parse'](g);}catch(C){try{return yaml[eS(0x271)](g);}catch(x){throw new Error(eS(0x1a3));}}if(w!==undefined){if(!fs_1[eS(0x1e2)][eS(0x197)](w))throw new Error(eS(0x1f5)+w);const l=fs_1['default']['readFileSync'](w)[eS(0x1ba)]();let b;try{if(_['isString'](l)){if(L[eS(0x258)][eS(0x1f1)]('.json'))b=JSON[eS(0x205)](l);else{if(L[eS(0x258)][eS(0x1f1)](eS(0x1ec))||L[eS(0x258)][eS(0x1f1)](eS(0x1c3)))b=yaml[eS(0x271)](l);else throw new Error(eS(0x228)+L['file'][eS(0x236)]('.')[eS(0x1a2)]());}}else b=l;return b;}catch(a){throw new Error(eS(0x20c)+a['message']);}}if((N=F===null||F===void 0x0?void 0x0:F[eS(0x1e0)])===null||N===void 0x0?void 0x0:N['nonInteractiveEndpoint'])throw new Error(eS(0x1fe));return yield v['retrievePayloadViaInteractiveCli'](F,{'cmdPath':W,'skipValidation':L[eS(0x1e9)]});});}}const printCallResult=(e,o,h,p,Y,q,J,v,s)=>{const eX=a1eL;if(!(e===null||e===void 0x0?void 0x0:e[eX(0x1f2)])){if(o)(0x0,console_format_helpers_1[eX(0x1c8)])(e===null||e===void 0x0?void 0x0:e[eX(0x199)],h);else{if(p)(0x0,console_format_helpers_1[eX(0x198)])(e===null||e===void 0x0?void 0x0:e['output'],h);else{if(isListCommand(Y)){const I=(q===null||q===void 0x0?void 0x0:q[eX(0x1da)](eX(0x1e6)))?q[eX(0x274)](eX(0x1e6),'')['split'](',')[eX(0x245)](W=>W[eX(0x1f4)]()):undefined,Z=Y[Y['length']-0x1],k=''+Z+(Z[eX(0x1f1)]('s')?'':'s'),L=_['upperFirst'](k),F=_[eX(0x21c)](h,k)?h[k]:h;(0x0,console_format_helpers_1[eX(0x1cb)])(F,L,I,J,v);}else console[eX(0x1f3)]((0x0,console_format_helpers_1[eX(0x203)])(h,s));}}}};
@@ -1 +1 @@
1
- 'use strict';const a2P=a2I;(function(u,I){const N=a2I,a=u();while(!![]){try{const x=parseInt(N(0x124))/0x1*(-parseInt(N(0x14c))/0x2)+-parseInt(N(0xee))/0x3+-parseInt(N(0xd4))/0x4*(-parseInt(N(0x10f))/0x5)+-parseInt(N(0xdf))/0x6+parseInt(N(0xfd))/0x7+parseInt(N(0x105))/0x8+parseInt(N(0xf9))/0x9*(parseInt(N(0xce))/0xa);if(x===I)break;else a['push'](a['shift']());}catch(D){a['push'](a['shift']());}}}(a2u,0x6d8ca));var __createBinding=this&&this[a2P(0x115)]||(Object[a2P(0x108)]?function(u,I,a,x){const m=a2P;if(x===undefined)x=a;var D=Object[m(0x119)](I,a);(!D||('get'in D?!I[m(0x116)]:D[m(0xf1)]||D['configurable']))&&(D={'enumerable':!![],'get':function(){return I[a];}}),Object['defineProperty'](u,x,D);}:function(u,I,a,x){if(x===undefined)x=a;u[x]=I[a];}),__setModuleDefault=this&&this[a2P(0x100)]||(Object[a2P(0x108)]?function(u,I){const k=a2P;Object[k(0x10c)](u,k(0x127),{'enumerable':!![],'value':I});}:function(u,I){u['default']=I;}),__importStar=this&&this['__importStar']||function(u){const R=a2P;if(u&&u[R(0x116)])return u;var I={};if(u!=null){for(var a in u)if(a!==R(0x127)&&Object[R(0x139)]['hasOwnProperty'][R(0x121)](u,a))__createBinding(I,u,a);}return __setModuleDefault(I,u),I;},__awaiter=this&&this[a2P(0x11c)]||function(u,I,a,x){function D(K){return K instanceof a?K:new a(function(z){z(K);});}return new(a||(a=Promise))(function(K,z){function H(p){const q=a2I;try{C(x[q(0xe2)](p));}catch(b){z(b);}}function s(p){const c=a2I;try{C(x[c(0x11d)](p));}catch(b){z(b);}}function C(p){const M=a2I;p['done']?K(p[M(0x134)]):D(p[M(0x134)])[M(0xe7)](H,s);}C((x=x['apply'](u,I||[]))['next']());});},__importDefault=this&&this['__importDefault']||function(u){const r=a2P;return u&&u[r(0x116)]?u:{'default':u};};Object[a2P(0x10c)](exports,a2P(0x116),{'value':!![]}),exports[a2P(0x112)]=void 0x0;const _=__importStar(require(a2P(0x10a))),node_fetch_1=__importDefault(require(a2P(0x150))),chalk_1=__importDefault(require(a2P(0x12e))),utils_1=require('../utils'),inquirer_helper_1=require(a2P(0x137)),console_format_helpers_1=require('../formatting/console-format-helpers'),browser_login_1=require(a2P(0xd7)),inquirer=require('inquirer');function a2u(){const Y=['success','getOwnPropertyDescriptor','sessionToken=********','current','__awaiter','throw','map','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','tokenPrompt','call','token','useJobId','828955vixjkM','Token\x20for\x20current\x20context\x20\x27','Bearer\x20','default','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','context','getCurrentName','addCommand','Error\x20occured\x20during\x20browser\x20login:\x20','valueOf','chalk','apiClient','search-list','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','askForContext','value','Shows\x20full\x20context\x20information\x20(including\x20tokens)','project','../inquirer-helper','--all','prototype','defaultBaseUrl','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','updateToken','-t,\x20--token\x20[TOKEN]','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','log','error','fullUrl','browserLogin','\x20(current)','job','askForJob','Token\x20for\x20this\x20context','useProjectId','list','Remove\x20a\x20context','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','apiTokenLogin','2xuUhii','host\x20url\x20for\x20this\x20context','dir','contexts','node-fetch','browser-opened','Use\x20manual\x20login\x20with\x20API\x20token','tokenLogin','description','Update\x20token\x20for\x20current\x20context','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','delete','moveCursor','all','warning','getProjectName','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','replace','close','removeContext','https://api.northflank.com','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','-n,\x20--name\x20[NAME]','12633410kTeSAS','\x20(api\x20host:\x20','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','loadContextWrapper','contextAvailable','Local\x20context\x20name\x20to\x20remove.','156312fnvZTz','askForProject','getCurrentBaseUrl','../login/browser-login','https://','action','message','verifyToken','test','sanitiseHostname','host','1142610eiqZPp','remove','Local\x20context\x20\x27','next','alias','override',',\x20added\x20context\x20with\x20name\x20','Retrieve\x20and\x20update\x20local\x20context\x20settings.','then','service','GET','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','finally','printAsTable','prompt','1215501nahyzx','useContext','italic','writable','name','length','stdout','set','getCurrentProjectName','use','ctx','9DalXxv','--override','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','contextProvider','1227674inQJBj','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Changed\x20current\x20context\x20to\x20','__setModuleDefault','token\x20login','sort','/v1/login','browser\x20login','662768eHyQNh','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','NorthflankApiBrowserLogin','create','Choose\x20the\x20context\x20to\x20','lodash','login','defineProperty','InquirerHelper','getCommand','45tsemQJ','retry','confirm','CliContext','option','--host\x20[HOST]','__createBinding','__esModule','useServiceId'];a2u=function(){return Y;};return a2u();}class CliContext{constructor(u,I=a2P(0xcb)){const o=a2P;this[o(0x13a)]=I,this[o(0xdd)]=b=>{const w=o;let i=b;return!/^https?:\/\//i[w(0xdc)](i)&&(i=w(0xd8)+i),i=i[w(0xc8)](/\/+$/,''),i;},this[o(0x12f)]=u;const a=new inquirer_helper_1[(o(0x10d))](u);this['login']=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0x10b))[o(0x154)](o(0x11f))['option']('--token-login',o(0x152),![])[o(0x113)]('--do-not-open-browser',o(0x131),![])[o(0x113)]('-n,\x20--name\x20[NAME]','Name\x20for\x20login\x20context')[o(0x113)](o(0x13d),o(0xfb))['option'](o(0x114),o(0x14d),this[o(0x13a)])[o(0x113)](o(0xfa),o(0x13b),![])[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const h=o;_[h(0xf5)](b,h(0xde),this['sanitiseHostname'](b[h(0xde)]));const i=b[h(0x153)]||b['token']!==undefined,{name:j,host:A,token:F,override:X}=i?yield this[h(0x14b)](b,a):yield this[h(0x142)](b,a);try{yield this[h(0x12f)][h(0xfc)]['addContext']({'name':j,'host':A,'token':F},X);}catch(T){(0x0,utils_1[h(0x140)])(T[h(0xda)]);return;}if(!(yield this[h(0xdb)]()))(0x0,utils_1[h(0x140)])(h(0x132)),yield this['apiClient'][h(0xfc)]['removeContext'](j);else{const E=i?h(0x101):h(0x104),f='\x0aSuccessfully\x20logged\x20in\x20using\x20'+E+h(0xe5)+chalk_1[h(0x127)][h(0xf0)](j)+h(0xcf)+A+')';(0x0,utils_1[h(0x118)])(f);}})),this[o(0x14f)]=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0x129))[o(0x154)](o(0xe6))['alias'](o(0x14f))[o(0xe3)](o(0xf8));const x=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0x148))['name']('ls')[o(0x154)]('List\x20all\x20available\x20contexts')['option'](o(0x138),o(0x135))[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const W=o;console[W(0x13f)](u[W(0xfc)]['getInfo']());const i=u[W(0xfc)][W(0xd1)]();if(b[W(0x159)]===!![]){console[W(0x14e)](i);return;}const j=i[W(0x11b)],A=i[W(0x14f)][W(0x102)]((F,X)=>F[W(0xf2)]===j?-0x1:X[W(0xf2)]===j?0x1:0x0)['map'](F=>{const B=W,X=j===F[B(0xf2)]?B(0x143):'';return{'Name':''+F['name']+X,'Host':F[B(0xde)],'Default\x20Project':F['project']||'-','Default\x20Service':F[B(0xe8)]||'-'};});(0x0,console_format_helpers_1[W(0xec)])(A,'Contexts');})),D=(0x0,utils_1['getCommand'])();D[o(0xf2)](o(0xf7))['description']('Switch\x20between\x20your\x20local\x20contexts')[o(0x113)](o(0xcd),o(0x13e))[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const J=o,i=(b===null||b===void 0x0?void 0x0:b[J(0xf2)])||(yield this[J(0x133)](J(0xf7)));yield this['apiClient'][J(0xfc)]['useContext'](i),(0x0,utils_1[J(0x118)])(J(0xff)+i);}));const K='-i,\x20--id\x20[ID]',z=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0x136))['description'](o(0x106))[o(0x113)](K,o(0xd0))['action'](b=>__awaiter(this,void 0x0,void 0x0,function*(){const V=o,i=(b===null||b===void 0x0?void 0x0:b['id'])||(yield a[V(0xd5)]());yield this['apiClient'][V(0xfc)][V(0x147)](i),console[V(0x13f)]('Use\x20project\x20with\x20id:',i);})),H=(0x0,utils_1[o(0x10e)])()[o(0xf2)]('service')[o(0x154)](o(0xcc))['option'](K,o(0xc7))['action'](b=>__awaiter(this,void 0x0,void 0x0,function*(){const y=o,i=(b===null||b===void 0x0?void 0x0:b['id'])||(yield a['askForService'](this[y(0xc6)]())());console[y(0x13f)]('Use\x20service\x20with\x20id:',i),yield this['apiClient'][y(0xfc)][y(0x117)](i);})),s=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0x144))[o(0x154)]('Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context')[o(0x113)](K,o(0xfe))[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const e=o,i=(b===null||b===void 0x0?void 0x0:b['id'])||(yield a[e(0x145)](this[e(0xc6)]())());console[e(0x13f)]('Use\x20job\x20with\x20id:',i),yield this[e(0x12f)]['contextProvider'][e(0x123)](i);}));D[o(0x12b)](z),D[o(0x12b)](s),D[o(0x12b)](H);const C=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0xe0))[o(0xe3)](o(0x157))[o(0xe3)]('rm')[o(0x154)](o(0x149))[o(0x113)](K,o(0xd3))[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const U=o;var i;const j=(b===null||b===void 0x0?void 0x0:b['id'])||(yield this[U(0x133)]('remove')),A=(i=this[U(0x12f)]['contextProvider']['getCurrentContext']())===null||i===void 0x0?void 0x0:i[U(0xf2)];yield this['apiClient']['contextProvider'][U(0xca)](j),(0x0,utils_1[U(0x118)])(U(0xe1)+j+'\x27\x20successfully\x20removed.');if(!this['contextAvailable']()){(0x0,utils_1[U(0x15a)])('No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.');return;}if(A===j){const F=(b===null||b===void 0x0?void 0x0:b[U(0xf2)])||(yield this[U(0x133)]('use\x20from\x20now\x20on'));yield this['apiClient'][U(0xfc)][U(0xef)](F),(0x0,utils_1[U(0x118)])('Changed\x20current\x20context\x20to\x20'+F);}})),p=(0x0,utils_1['getCommand'])()['name']('update-token')['alias']('set-token')[o(0x154)](o(0x155))['option'](o(0x13d),o(0x146))[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const S=o,{contextProvider:i}=this[S(0x12f)],j=(b===null||b===void 0x0?void 0x0:b['token'])||(yield a[S(0x120)]()),A=i['getCurrentToken']();yield i[S(0x13c)](j);if(yield this['verifyToken']())(0x0,utils_1[S(0x118)])(S(0x125)+i[S(0x12a)]()+'\x27\x20successfully\x20updated.');else{if(A)yield i[S(0x13c)](A);(0x0,utils_1[S(0x140)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed');}}));this[o(0x14f)]['addCommand'](x),this[o(0x14f)][o(0x12b)](D),this[o(0x14f)][o(0x12b)](C),this[o(0x14f)][o(0x12b)](p);}[a2P(0x142)](u,I){var a,x,D,K;return __awaiter(this,void 0x0,void 0x0,function*(){const n=a2I,z=!u['doNotOpenBrowser'],H=(a=u[n(0xde)])!==null&&a!==void 0x0?a:this[n(0x13a)],s=new browser_login_1[(n(0x107))](H,z);let C;s['on'](n(0x151),({url:j})=>{const L=n;if(z){const A=j[L(0xc8)](/sessionToken=.*/,L(0x11a));console['log'](L(0xea)+A+')'),C=inquirer[L(0xed)]([{'type':L(0x111),'name':'fullUrl','message':L(0x156),'default':![]}]),C[L(0xe7)](F=>{const g=L;process[g(0xf4)][g(0x158)](0x0,-0x1),process['stdout']['clearLine'](0x1),F[g(0x141)]&&console['log']('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+j+'\x20');});}else console['log']('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+j+'\x20');});const {token:p,contextName:b}=yield s['startLogin']()['catch'](j=>__awaiter(this,void 0x0,void 0x0,function*(){const l=n;(0x0,utils_1[l(0x140)])(l(0x12c)+j[l(0xda)]+'.\x20Using\x20fallback.');const A=yield this['apiTokenLogin'](u,I);return{'token':A[l(0x122)],'contextName':A[l(0xf2)]};}))[n(0xeb)](()=>{const Z=n;if(C)C['ui'][Z(0xc9)]();}),i=(D=(x=u[n(0xf2)])!==null&&x!==void 0x0?x:b)!==null&&D!==void 0x0?D:'autologin-'+new Date()[n(0x12d)]();return{'name':i,'token':p,'host':H,'override':(K=u[n(0xe4)])!==null&&K!==void 0x0?K:![]};});}[a2P(0x14b)](u,I){return __awaiter(this,void 0x0,void 0x0,function*(){const G=a2I,a=this['apiClient'][G(0xfc)][G(0xd1)]()[G(0x14f)],{name:x,token:D,host:K,override:z}=yield I['loginPrompt'](u,a);return{'name':x,'token':D,'host':K,'override':z};});}[a2P(0xc6)](){const O=a2P,u=this[O(0x12f)]['contextProvider'][O(0xf6)]();if(u===undefined)throw new Error(O(0x128));return u;}[a2P(0x133)](u){return __awaiter(this,void 0x0,void 0x0,function*(){const Q=a2I;if(!this[Q(0xd2)]())throw new Error(Q(0x14a));const I=this[Q(0x12f)][Q(0xfc)][Q(0xd1)]()['contexts'][Q(0x11e)](x=>x[Q(0xf2)]),a=I[Q(0xf3)]>0x4?Q(0x130):Q(0x148);return(yield inquirer[Q(0xed)]([{'type':a,'name':Q(0xf2),'message':Q(0x109)+u+':','choices':I}]))[Q(0xf2)];});}[a2P(0xd2)](){const d=a2P;return this['apiClient'][d(0xfc)]['loadContextWrapper']()[d(0x14f)][d(0xf3)]>0x0;}[a2P(0xdb)](){return __awaiter(this,void 0x0,void 0x0,function*(){const v=a2I;try{const u=this[v(0x12f)][v(0xfc)][v(0xd6)](),I=this['apiClient']['contextProvider']['getCurrentToken'](),a=u+v(0x103),x={'Authorization':v(0x126)+I},D=yield(0x0,utils_1[v(0x110)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const t=v;return(0x0,node_fetch_1[t(0x127)])(a,{'method':t(0xe9),'timeout':0xbb8,'headers':x});}));if(D['ok'])return!![];return![];}catch(K){return![];}});}}function a2I(u,I){const a=a2u();return a2I=function(x,D){x=x-0xc6;let K=a[x];return K;},a2I(u,I);}exports[a2P(0x112)]=CliContext;
1
+ 'use strict';const a2b=a2o;(function(e,o){const l=a2o,h=e();while(!![]){try{const p=-parseInt(l(0x203))/0x1*(-parseInt(l(0x1fb))/0x2)+parseInt(l(0x18a))/0x3*(-parseInt(l(0x19e))/0x4)+-parseInt(l(0x215))/0x5*(-parseInt(l(0x196))/0x6)+-parseInt(l(0x182))/0x7+parseInt(l(0x1b7))/0x8*(parseInt(l(0x183))/0x9)+parseInt(l(0x218))/0xa*(parseInt(l(0x1b6))/0xb)+-parseInt(l(0x1a9))/0xc;if(p===o)break;else h['push'](h['shift']());}catch(Y){h['push'](h['shift']());}}}(a2e,0xb879a));function a2o(e,o){const h=a2e();return a2o=function(p,Y){p=p-0x176;let q=h[p];return q;},a2o(e,o);}var __createBinding=this&&this[a2b(0x19c)]||(Object[a2b(0x1dd)]?function(e,h,p,Y){const a=a2b;if(Y===undefined)Y=p;var q=Object[a(0x1d8)](h,p);(!q||(a(0x19a)in q?!h[a(0x1ce)]:q[a(0x21c)]||q[a(0x18e)]))&&(q={'enumerable':!![],'get':function(){return h[p];}}),Object[a(0x179)](e,Y,q);}:function(e,h,p,Y){if(Y===undefined)Y=p;e[Y]=h[p];}),__setModuleDefault=this&&this[a2b(0x1e0)]||(Object['create']?function(e,h){const z=a2b;Object[z(0x179)](e,'default',{'enumerable':!![],'value':h});}:function(e,h){const H=a2b;e[H(0x20e)]=h;}),__importStar=this&&this[a2b(0x21d)]||function(e){const P=a2b;if(e&&e['__esModule'])return e;var o={};if(e!=null){for(var h in e)if(h!==P(0x20e)&&Object[P(0x187)][P(0x1d3)][P(0x1c1)](e,h))__createBinding(o,e,h);}return __setModuleDefault(o,e),o;},__awaiter=this&&this[a2b(0x201)]||function(e,o,h,p){function Y(q){return q instanceof h?q:new h(function(J){J(q);});}return new(h||(h=Promise))(function(q,J){function v(Z){const V=a2o;try{I(p[V(0x21a)](Z));}catch(k){J(k);}}function s(Z){const u=a2o;try{I(p[u(0x1a4)](Z));}catch(k){J(k);}}function I(Z){const c=a2o;Z[c(0x1bc)]?q(Z['value']):Y(Z['value'])[c(0x1ed)](v,s);}I((p=p['apply'](e,o||[]))['next']());});},__importDefault=this&&this[a2b(0x199)]||function(e){const n=a2b;return e&&e[n(0x1ce)]?e:{'default':e};};Object[a2b(0x179)](exports,a2b(0x1ce),{'value':!![]}),exports[a2b(0x1c9)]=void 0x0;const _=__importStar(require('lodash')),node_fetch_1=__importDefault(require(a2b(0x1f1))),chalk_1=__importDefault(require('chalk')),utils_1=require(a2b(0x1e4)),inquirer_helper_1=require(a2b(0x1fe)),console_format_helpers_1=require(a2b(0x17c)),browser_login_1=require(a2b(0x1c4)),inquirer=require('inquirer');class CliContext{constructor(e,o=a2b(0x1d4)){const d=a2b;this[d(0x191)]=o,this[d(0x19f)]=k=>{const j=d;let L=k;return!/^https?:\/\//i[j(0x1ea)](L)&&(L=j(0x17a)+L),L=L[j(0x1b8)](/\/+$/,''),L;},this[d(0x193)]=e;const h=new inquirer_helper_1[(d(0x185))](e);this['login']=(0x0,utils_1[d(0x1e6)])()[d(0x1f6)](d(0x1f0))[d(0x1cb)](d(0x20d))[d(0x1ac)](d(0x1db),d(0x21b),![])[d(0x1ac)]('--do-not-open-browser',d(0x184),![])[d(0x1ac)](d(0x1ff),'Name\x20for\x20login\x20context')[d(0x1ac)](d(0x1e2),d(0x1d6))[d(0x1ac)](d(0x192),d(0x20b),this[d(0x191)])[d(0x1ac)](d(0x17f),d(0x200),![])[d(0x1be)](k=>__awaiter(this,void 0x0,void 0x0,function*(){const Q=d;_[Q(0x17d)](k,Q(0x1ef),this['sanitiseHostname'](k[Q(0x1ef)]));const L=k[Q(0x1ee)]||k['token']!==undefined,{name:F,host:W,token:N,override:g}=L?yield this[Q(0x1f7)](k,h):yield this[Q(0x217)](k,h);try{yield this[Q(0x193)][Q(0x1b4)][Q(0x1d7)]({'name':F,'host':W,'token':N},g);}catch(w){(0x0,utils_1[Q(0x177)])(w[Q(0x198)]);return;}if(!(yield this[Q(0x1e8)]()))(0x0,utils_1[Q(0x177)])(Q(0x1d9)),yield this[Q(0x193)][Q(0x1b4)]['removeContext'](F);else{const C=L?'token\x20login':Q(0x1a5),x=Q(0x1bb)+C+Q(0x1b9)+chalk_1['default'][Q(0x1a7)](F)+Q(0x1b5)+W+')';(0x0,utils_1[Q(0x1b0)])(x);}})),this[d(0x1aa)]=(0x0,utils_1[d(0x1e6)])()[d(0x1f6)]('context')[d(0x1cb)](d(0x208))[d(0x210)](d(0x1aa))[d(0x210)](d(0x19b));const p=(0x0,utils_1[d(0x1e6)])()['name'](d(0x1c8))[d(0x1f6)]('ls')['description'](d(0x204))['option']('--all',d(0x206))[d(0x1be)](k=>__awaiter(this,void 0x0,void 0x0,function*(){const D=d;console[D(0x176)](e[D(0x1b4)]['getInfo']());const L=e[D(0x1b4)][D(0x1a8)]();if(k[D(0x1c6)]===!![]){console[D(0x1cd)](L);return;}const F=L[D(0x1bf)],W=L[D(0x1aa)][D(0x1b3)]((N,g)=>N[D(0x1f6)]===F?-0x1:g['name']===F?0x1:0x0)[D(0x18d)](N=>{const f=D,g=F===N[f(0x1f6)]?f(0x1c0):'';return{'Name':''+N[f(0x1f6)]+g,'Host':N[f(0x1ef)],'Default\x20Project':N[f(0x186)]||'-','Default\x20Service':N['service']||'-'};});(0x0,console_format_helpers_1[D(0x1ca)])(W,D(0x1c5));})),Y=(0x0,utils_1[d(0x1e6)])();Y[d(0x1f6)](d(0x1ae))[d(0x1cb)]('Switch\x20between\x20your\x20local\x20contexts')[d(0x1ac)](d(0x1ff),d(0x197))[d(0x1be)](k=>__awaiter(this,void 0x0,void 0x0,function*(){const i=d,L=(k===null||k===void 0x0?void 0x0:k['name'])||(yield this[i(0x1d5)](i(0x1ae)));yield this[i(0x193)][i(0x1b4)]['useContext'](L),(0x0,utils_1[i(0x1b0)])('Changed\x20current\x20context\x20to\x20'+L);}));const q=d(0x18f),J=(0x0,utils_1[d(0x1e6)])()[d(0x1f6)](d(0x186))[d(0x1cb)](d(0x1c7))[d(0x1ac)](q,'Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')[d(0x1be)](k=>__awaiter(this,void 0x0,void 0x0,function*(){const R=d,L=(k===null||k===void 0x0?void 0x0:k['id'])||(yield h[R(0x1b1)]());yield this[R(0x193)][R(0x1b4)]['useProjectId'](L),console[R(0x176)](R(0x219),L);})),v=(0x0,utils_1[d(0x1e6)])()[d(0x1f6)](d(0x21e))[d(0x1cb)](d(0x1a0))[d(0x1ac)](q,d(0x1ec))['action'](k=>__awaiter(this,void 0x0,void 0x0,function*(){const t=d,L=(k===null||k===void 0x0?void 0x0:k['id'])||(yield h[t(0x209)](this[t(0x1c2)]())());console[t(0x176)](t(0x211),L),yield this['apiClient'][t(0x1b4)][t(0x1e7)](L);})),s=(0x0,utils_1['getCommand'])()[d(0x1f6)](d(0x1f8))['description'](d(0x1e1))[d(0x1ac)](q,'Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')[d(0x1be)](k=>__awaiter(this,void 0x0,void 0x0,function*(){const G=d,L=(k===null||k===void 0x0?void 0x0:k['id'])||(yield h[G(0x1b2)](this['getProjectName']())());console[G(0x176)]('Use\x20job\x20with\x20id:',L),yield this[G(0x193)]['contextProvider'][G(0x1c3)](L);}));Y[d(0x1a6)](J),Y[d(0x1a6)](s),Y[d(0x1a6)](v);const I=(0x0,utils_1[d(0x1e6)])()[d(0x1f6)]('remove')[d(0x210)](d(0x189))['alias']('rm')[d(0x1cb)](d(0x1ba))[d(0x1ac)](q,d(0x1d2))[d(0x1be)](k=>__awaiter(this,void 0x0,void 0x0,function*(){const y=d;var L;const F=(k===null||k===void 0x0?void 0x0:k['id'])||(yield this[y(0x1d5)]('remove')),W=(L=this[y(0x193)]['contextProvider'][y(0x1e9)]())===null||L===void 0x0?void 0x0:L[y(0x1f6)];yield this[y(0x193)][y(0x1b4)][y(0x202)](F),(0x0,utils_1[y(0x1b0)])('Local\x20context\x20\x27'+F+y(0x20a));if(!this[y(0x1cc)]()){(0x0,utils_1['warning'])(y(0x1bd));return;}if(W===F){const N=(k===null||k===void 0x0?void 0x0:k[y(0x1f6)])||(yield this['askForContext'](y(0x213)));yield this[y(0x193)][y(0x1b4)][y(0x1a2)](N),(0x0,utils_1[y(0x1b0)])(y(0x195)+N);}})),Z=(0x0,utils_1[d(0x1e6)])()[d(0x1f6)](d(0x1de))['alias'](d(0x1eb))['description'](d(0x188))[d(0x1ac)](d(0x1e2),d(0x1af))[d(0x1be)](k=>__awaiter(this,void 0x0,void 0x0,function*(){const S=d,{contextProvider:L}=this['apiClient'],F=(k===null||k===void 0x0?void 0x0:k['token'])||(yield h[S(0x18c)]()),W=L[S(0x1e5)]();yield L[S(0x1df)](F);if(yield this[S(0x1e8)]())(0x0,utils_1['success'])(S(0x190)+L[S(0x1cf)]()+S(0x180));else{if(W)yield L[S(0x1df)](W);(0x0,utils_1['error'])(S(0x181));}}));this[d(0x1aa)]['addCommand'](p),this[d(0x1aa)]['addCommand'](Y),this[d(0x1aa)][d(0x1a6)](I),this[d(0x1aa)]['addCommand'](Z);}[a2b(0x217)](e,o){var h,p,Y,q;return __awaiter(this,void 0x0,void 0x0,function*(){const X=a2o,J=!e['doNotOpenBrowser'],v=(h=e['host'])!==null&&h!==void 0x0?h:this[X(0x191)],s=new browser_login_1['NorthflankApiBrowserLogin'](v,J);let I;s['on'](X(0x1fc),({url:F})=>{const m=X;if(J){const W=F['replace'](/sessionToken=.*/,m(0x18b));console[m(0x176)](m(0x1da)+W+')'),I=inquirer[m(0x1a1)]([{'type':m(0x1dc),'name':m(0x1f2),'message':m(0x1f9),'default':![]}]),I['then'](N=>{const U=m;process[U(0x194)][U(0x216)](0x0,-0x1),process[U(0x194)][U(0x1a3)](0x1),N[U(0x1f2)]&&console[U(0x176)](U(0x1fd)+F+'\x20');});}else console['log']('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+F+'\x20');});const {token:Z,contextName:k}=yield s['startLogin']()[X(0x1f5)](F=>__awaiter(this,void 0x0,void 0x0,function*(){const T=X;(0x0,utils_1['error'])(T(0x17b)+F[T(0x198)]+T(0x214));const W=yield this[T(0x1f7)](e,o);return{'token':W[T(0x207)],'contextName':W[T(0x1f6)]};}))[X(0x212)](()=>{const O=X;if(I)I['ui'][O(0x1f4)]();}),L=(Y=(p=e[X(0x1f6)])!==null&&p!==void 0x0?p:k)!==null&&Y!==void 0x0?Y:X(0x178)+new Date()[X(0x205)]();return{'name':L,'token':Z,'host':v,'override':(q=e[X(0x1e3)])!==null&&q!==void 0x0?q:![]};});}['apiTokenLogin'](e,o){return __awaiter(this,void 0x0,void 0x0,function*(){const E=a2o,h=this[E(0x193)][E(0x1b4)][E(0x1a8)]()[E(0x1aa)],{name:p,token:Y,host:q,override:J}=yield o[E(0x1ad)](e,h);return{'name':p,'token':Y,'host':q,'override':J};});}['getProjectName'](){const A=a2b,e=this['apiClient'][A(0x1b4)][A(0x1d1)]();if(e===undefined)throw new Error(A(0x20c));return e;}[a2b(0x1d5)](e){return __awaiter(this,void 0x0,void 0x0,function*(){const M=a2o;if(!this[M(0x1cc)]())throw new Error('No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.');const o=this[M(0x193)][M(0x1b4)][M(0x1a8)]()[M(0x1aa)][M(0x18d)](p=>p[M(0x1f6)]),h=o[M(0x1d0)]>0x4?M(0x1ab):'list';return(yield inquirer[M(0x1a1)]([{'type':h,'name':M(0x1f6),'message':'Choose\x20the\x20context\x20to\x20'+e+':','choices':o}]))[M(0x1f6)];});}['contextAvailable'](){const K=a2b;return this[K(0x193)][K(0x1b4)][K(0x1a8)]()['contexts'][K(0x1d0)]>0x0;}[a2b(0x1e8)](){return __awaiter(this,void 0x0,void 0x0,function*(){const r=a2o;try{const o=this[r(0x193)]['contextProvider'][r(0x17e)](),h=this['apiClient']['contextProvider'][r(0x1e5)](),p=o+r(0x20f),Y={'Authorization':r(0x1f3)+h},q=yield(0x0,utils_1[r(0x19d)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const B=r;return(0x0,node_fetch_1[B(0x20e)])(p,{'method':B(0x1fa),'timeout':0xbb8,'headers':Y});}));if(q['ok'])return!![];return![];}catch(J){return![];}});}}function a2e(){const e0=['3438492xoYrSF','contexts','search-list','option','loginPrompt','use','Token\x20for\x20this\x20context','success','askForProject','askForJob','sort','contextProvider','\x20(api\x20host:\x20','11bnwxCF','40UIxlpP','replace',',\x20added\x20context\x20with\x20name\x20','Remove\x20a\x20context','\x0aSuccessfully\x20logged\x20in\x20using\x20','done','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','action','current','\x20(current)','call','getProjectName','useJobId','../login/browser-login','Contexts','all','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','list','CliContext','printAsTable','description','contextAvailable','dir','__esModule','getCurrentName','length','getCurrentProjectName','Local\x20context\x20name\x20to\x20remove.','hasOwnProperty','https://api.northflank.com','askForContext','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','addContext','getOwnPropertyDescriptor','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','--token-login','confirm','create','update-token','updateToken','__setModuleDefault','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','-t,\x20--token\x20[TOKEN]','override','../utils','getCurrentToken','getCommand','useServiceId','verifyToken','getCurrentContext','test','set-token','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','then','tokenLogin','host','login','node-fetch','fullUrl','Bearer\x20','close','catch','name','apiTokenLogin','job','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','GET','1226766gXfBrN','browser-opened','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','../inquirer-helper','-n,\x20--name\x20[NAME]','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','__awaiter','removeContext','1cWtwZi','List\x20all\x20available\x20contexts','valueOf','Shows\x20full\x20context\x20information\x20(including\x20tokens)','token','Retrieve\x20and\x20update\x20local\x20context\x20settings.','askForService','\x27\x20successfully\x20removed.','host\x20url\x20for\x20this\x20context','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','default','/v1/login','alias','Use\x20service\x20with\x20id:','finally','use\x20from\x20now\x20on','.\x20Using\x20fallback.','602180RADBEB','moveCursor','browserLogin','12586210pENPRV','Use\x20project\x20with\x20id:','next','Use\x20manual\x20login\x20with\x20API\x20token','writable','__importStar','service','log','error','autologin-','defineProperty','https://','Error\x20occured\x20during\x20browser\x20login:\x20','../formatting/console-format-helpers','set','getCurrentBaseUrl','--override','\x27\x20successfully\x20updated.','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','3538997GtSUCF','751455tqpmqQ','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','InquirerHelper','project','prototype','Update\x20token\x20for\x20current\x20context','delete','2586579VTiPRu','sessionToken=********','tokenPrompt','map','configurable','-i,\x20--id\x20[ID]','Token\x20for\x20current\x20context\x20\x27','defaultBaseUrl','--host\x20[HOST]','apiClient','stdout','Changed\x20current\x20context\x20to\x20','6kGjkix','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','message','__importDefault','get','ctx','__createBinding','retry','4YOJVSP','sanitiseHostname','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','prompt','useContext','clearLine','throw','browser\x20login','addCommand','italic','loadContextWrapper'];a2e=function(){return e0;};return a2e();}exports[a2b(0x1c9)]=CliContext;