@northflank/cli 0.9.20 → 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 a0Z6=a0J;(function(Z,J){const Z2=a0J,z=Z();while(!![]){try{const P=parseInt(Z2(0x16d))/0x1+-parseInt(Z2(0x15f))/0x2+parseInt(Z2(0x152))/0x3*(parseInt(Z2(0x151))/0x4)+-parseInt(Z2(0x176))/0x5+-parseInt(Z2(0x18f))/0x6+-parseInt(Z2(0x160))/0x7*(-parseInt(Z2(0x159))/0x8)+parseInt(Z2(0x17b))/0x9;if(P===J)break;else z['push'](z['shift']());}catch(B){z['push'](z['shift']());}}}(a0Z,0x3ca5b));function a0J(Z,J){const z=a0Z();return a0J=function(P,B){P=P-0x150;let U=z[P];return U;},a0J(Z,J);}function a0Z(){const ZU=['projectId','logSink','options','secrets','No\x20available\x20versions\x20to\x20upgrade\x20to.','54621PandTE','owningObject','value','versions','list','keyName','addonId','backups','templates','652075gMHsNB','keys','region','source','plans','8596989qhyPKp','resources','includes','envs','done','secretLink','deploymentPlan','length','next','get','find','replicas','internalId','updateaddonversion','secret','data','map','then','pagination','cursor','2507100uoQNno','registryCredentials','type','28JtlXje','48801lpehFz','fetchResourceList','addon','addonDependencies','types','services','storage','677096PPesSS','defineProperty','warning','version','addons','credentials','823344abBret','7KbjaNg','projects','backupId','regions','addonTypes','default','nextPageCursor','__esModule'];a0Z=function(){return ZU;};return a0Z();}var __awaiter=this&&this['__awaiter']||function(Z,J,z,B){function U(s){return s instanceof z?s:new z(function(A){A(s);});}return new(z||(z=Promise))(function(s,A){const Z5=a0J;function n(v){const Z3=a0J;try{C(B[Z3(0x183)](v));}catch(o){A(o);}}function F(v){try{C(B['throw'](v));}catch(o){A(o);}}function C(v){const Z4=a0J;v[Z4(0x17f)]?s(v[Z4(0x16f)]):U(v[Z4(0x16f)])[Z4(0x18c)](n,F);}C((B=B['apply'](Z,J||[]))[Z5(0x183)]());});};Object[a0Z6(0x15a)](exports,a0Z6(0x167),{'value':!![]}),exports[a0Z6(0x153)]=void 0x0;const utils_1=require('./utils'),defaultPaginationPageSize=0x64,getProjects=Z=>J=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z7=a0Z6;var z;const P=yield Z[Z7(0x171)][Z7(0x161)]({'options':{'per_page':defaultPaginationPageSize,'cursor':J===null||J===void 0x0?void 0x0:J[Z7(0x166)]}});return{'elements':P[Z7(0x18a)][Z7(0x161)]['map'](B=>B['id']),'nextPageCursor':(z=P[Z7(0x18d)])===null||z===void 0x0?void 0x0:z[Z7(0x18e)]};}),getServices=(Z,J)=>z=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z8=a0Z6;var P;const B=yield Z['list']['services']({'parameters':{'projectId':J},'options':{'per_page':defaultPaginationPageSize,'cursor':z===null||z===void 0x0?void 0x0:z[Z8(0x166)]}});return{'elements':B[Z8(0x18a)][Z8(0x157)][Z8(0x18b)](U=>U['id']),'nextPageCursor':(P=B[Z8(0x18d)])===null||P===void 0x0?void 0x0:P[Z8(0x18e)]};}),getAddons=(Z,J)=>z=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z9=a0Z6;var P;const B=yield Z[Z9(0x171)][Z9(0x15d)]({'parameters':{'projectId':J},'options':{'per_page':defaultPaginationPageSize,'cursor':z===null||z===void 0x0?void 0x0:z['nextPageCursor']}});return{'elements':B[Z9(0x18a)][Z9(0x15d)][Z9(0x18b)](U=>U['id']),'nextPageCursor':(P=B[Z9(0x18d)])===null||P===void 0x0?void 0x0:P[Z9(0x18e)]};}),getAddonBackups=(Z,J,z)=>P=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const ZZ=a0Z6;var B;const U=yield Z[ZZ(0x184)][ZZ(0x154)]['backups']({'parameters':{'projectId':J,'addonId':z},'options':{'per_page':defaultPaginationPageSize,'cursor':P===null||P===void 0x0?void 0x0:P[ZZ(0x166)]}});return{'elements':U[ZZ(0x18a)][ZZ(0x174)]['map'](s=>s['id']),'nextPageCursor':(B=U[ZZ(0x18d)])===null||B===void 0x0?void 0x0:B[ZZ(0x18e)]};});function fetchResourceList(Z,J,z,P,B,U){var s,A,n,F,C,v,o,j,V,i,p,S;return __awaiter(this,void 0x0,void 0x0,function*(){const ZJ=a0J,g=undefined;try{if(Z===ZJ(0x181)){const x=yield J[ZJ(0x171)][ZJ(0x17a)]({}),d=x[ZJ(0x18a)][ZJ(0x17a)]['map'](k=>{const Zz=ZJ;var N;return(N=k===null||k===void 0x0?void 0x0:k[Zz(0x187)])!==null&&N!==void 0x0?N:k===null||k===void 0x0?void 0x0:k['id'];});return{'choices':d,'defaultValue':g};}if(Z===ZJ(0x178)&&!(z===null||z===void 0x0?void 0x0:z['includes'](ZJ(0x169)))){const k=yield J[ZJ(0x171)][ZJ(0x163)]({}),N=k[ZJ(0x18a)][ZJ(0x163)][ZJ(0x18b)](W=>{const ZP=ZJ;var X;return(X=W===null||W===void 0x0?void 0x0:W[ZP(0x187)])!==null&&X!==void 0x0?X:W===null||W===void 0x0?void 0x0:W['id'];});return{'choices':N,'defaultValue':g};}if(Z===ZJ(0x168)){const W=yield getProjects(J),{elements:X,nextPageCursor:D}=yield W();return{'choices':X,'defaultValue':g,'pagination':{'nextPageCursor':D,'loadMore':W}};}if(Z===ZJ(0x15e)){const q=yield J['list'][ZJ(0x190)]({}),y=q['data'][ZJ(0x15e)]['map'](O=>O['id']);return{'choices':y,'defaultValue':g};}const I=B===null||B===void 0x0?void 0x0:B['projectId'],m=Z==='serviceId'||Z==='id'&&(U===null||U===void 0x0?void 0x0:U['includes'](ZJ(0x16e)));if(I!==undefined&&m){const O=yield getServices(J,I),{elements:G,nextPageCursor:K}=yield O();return{'choices':G,'defaultValue':g,'pagination':{'nextPageCursor':K,'loadMore':O}};}const L=z===null||z===void 0x0?void 0x0:z[ZJ(0x17d)](ZJ(0x154));if(L){const l=b=>__awaiter(this,void 0x0,void 0x0,function*(){const ZB=ZJ;var f;const r=yield J[ZB(0x184)]['addon']['types']({});return(f=r[ZB(0x18a)][ZB(0x164)])===null||f===void 0x0?void 0x0:f[ZB(0x18b)](w=>w[ZB(0x150)])[ZB(0x185)](w=>w['type']===b);});if(Z===ZJ(0x150)){const b=yield J[ZJ(0x184)]['addon'][ZJ(0x156)]({}),f=(s=b[ZJ(0x18a)][ZJ(0x164)])===null||s===void 0x0?void 0x0:s[ZJ(0x18b)](r=>r[ZJ(0x150)]);return{'choices':f,'defaultValue':g};}if(Z==='version'&&(P===null||P===void 0x0?void 0x0:P[ZJ(0x150)])!==undefined){const r=(A=yield l(P[ZJ(0x150)]))===null||A===void 0x0?void 0x0:A[ZJ(0x170)],w=r!==undefined?['latest',...r]:undefined;return{'choices':w,'defaultValue':g};}if(Z===ZJ(0x158)&&(P===null||P===void 0x0?void 0x0:P[ZJ(0x150)])!==undefined){const Q=(F=(n=yield l(P[ZJ(0x150)]))===null||n===void 0x0?void 0x0:n[ZJ(0x17c)])===null||F===void 0x0?void 0x0:F['storage'];return{'choices':Q===null||Q===void 0x0?void 0x0:Q[ZJ(0x16a)],'defaultValue':Q===null||Q===void 0x0?void 0x0:Q[ZJ(0x165)]};}if(Z===ZJ(0x186)&&(P===null||P===void 0x0?void 0x0:P[ZJ(0x150)])!==undefined){const T=(v=(C=yield l(P[ZJ(0x150)]))===null||C===void 0x0?void 0x0:C[ZJ(0x17c)])===null||v===void 0x0?void 0x0:v['replicas'];return{'choices':T===null||T===void 0x0?void 0x0:T[ZJ(0x16a)],'defaultValue':T===null||T===void 0x0?void 0x0:T[ZJ(0x165)]};}}if(Z==='addonId'&&(B===null||B===void 0x0?void 0x0:B['projectId'])!==undefined){const c=yield getAddons(J,B===null||B===void 0x0?void 0x0:B[ZJ(0x168)]),{elements:t,nextPageCursor:R}=yield c();return{'choices':t,'defaultValue':g,'pagination':{'nextPageCursor':R,'loadMore':c}};}if(Z===ZJ(0x162)&&(B===null||B===void 0x0?void 0x0:B[ZJ(0x168)])!==undefined&&((o=P===null||P===void 0x0?void 0x0:P[ZJ(0x179)])===null||o===void 0x0?void 0x0:o[ZJ(0x173)])!==undefined){const h=yield getAddonBackups(J,B===null||B===void 0x0?void 0x0:B[ZJ(0x168)],(j=P===null||P===void 0x0?void 0x0:P['source'])===null||j===void 0x0?void 0x0:j[ZJ(0x173)]),{elements:a,nextPageCursor:u}=yield h();return{'choices':a,'defaultValue':g,'pagination':{'nextPageCursor':u,'loadMore':h}};}const M=(V=B===null||B===void 0x0?void 0x0:B[ZJ(0x173)])!==null&&V!==void 0x0?V:(i=P===null||P===void 0x0?void 0x0:P[ZJ(0x155)])===null||i===void 0x0?void 0x0:i[ZJ(0x173)];if((z===null||z===void 0x0?void 0x0:z['join'](''))===ZJ(0x188)&&Z===ZJ(0x15c)&&(B===null||B===void 0x0?void 0x0:B[ZJ(0x168)])!==undefined&&M!==undefined){const {upgradeTo:H}=(yield J[ZJ(0x184)][ZJ(0x154)]['version']({'parameters':{'addonId':M,'projectId':B===null||B===void 0x0?void 0x0:B[ZJ(0x168)]}}))['data'];if(H===undefined||H[ZJ(0x182)]<=0x0){(0x0,utils_1[ZJ(0x15b)])(ZJ(0x16c));throw new Error();}return{'choices':H[ZJ(0x18b)](Y=>Y['version']),'defaultValue':g};}if(Z==='templateId'){const Y=yield J[ZJ(0x171)][ZJ(0x175)]({}),E=Y[ZJ(0x18a)][ZJ(0x175)][ZJ(0x18b)](Z0=>Z0===null||Z0===void 0x0?void 0x0:Z0['id']);return{'choices':E,'defaultValue':g};}if(((z===null||z===void 0x0?void 0x0:z[ZJ(0x17d)](ZJ(0x180)))||(z===null||z===void 0x0?void 0x0:z['includes'](ZJ(0x189))))&&Z===ZJ(0x172)&&M!==undefined&&(B===null||B===void 0x0?void 0x0:B['projectId'])!==undefined){const Z0=(yield J['get'][ZJ(0x154)][ZJ(0x15e)]({'parameters':{'addonId':M,'projectId':B===null||B===void 0x0?void 0x0:B['projectId']}}))[ZJ(0x18a)];return{'choices':[...(p=Object[ZJ(0x177)](Z0===null||Z0===void 0x0?void 0x0:Z0[ZJ(0x17e)]))!==null&&p!==void 0x0?p:[],...(S=Object[ZJ(0x177)](Z0===null||Z0===void 0x0?void 0x0:Z0[ZJ(0x16b)]))!==null&&S!==void 0x0?S:[]]};}}catch(Z1){}return{'choices':undefined,'defaultValue':g};});}exports[a0Z6(0x153)]=fetchResourceList;
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 a1Zo=a1J;(function(Z,J){const Zv=a1J,z=Z();while(!![]){try{const P=-parseInt(Zv(0x1ae))/0x1*(parseInt(Zv(0x1d5))/0x2)+-parseInt(Zv(0x1db))/0x3*(parseInt(Zv(0x276))/0x4)+parseInt(Zv(0x18e))/0x5+-parseInt(Zv(0x23a))/0x6+-parseInt(Zv(0x23b))/0x7+parseInt(Zv(0x1c1))/0x8+parseInt(Zv(0x24c))/0x9*(parseInt(Zv(0x259))/0xa);if(P===J)break;else z['push'](z['shift']());}catch(B){z['push'](z['shift']());}}}(a1Z,0xa4791));var __createBinding=this&&this[a1Zo(0x227)]||(Object[a1Zo(0x189)]?function(Z,J,z,P){const Zj=a1Zo;if(P===undefined)P=z;var B=Object[Zj(0x199)](J,z);(!B||(Zj(0x1fa)in B?!J['__esModule']:B[Zj(0x215)]||B[Zj(0x1b1)]))&&(B={'enumerable':!![],'get':function(){return J[z];}}),Object[Zj(0x282)](Z,P,B);}:function(Z,J,z,P){if(P===undefined)P=z;Z[P]=J[z];}),__setModuleDefault=this&&this[a1Zo(0x1ab)]||(Object['create']?function(Z,J){const ZV=a1Zo;Object[ZV(0x282)](Z,ZV(0x226),{'enumerable':!![],'value':J});}:function(Z,J){const Zi=a1Zo;Z[Zi(0x226)]=J;}),__importStar=this&&this[a1Zo(0x25b)]||function(Z){const Zp=a1Zo;if(Z&&Z[Zp(0x26d)])return Z;var J={};if(Z!=null){for(var z in Z)if(z!==Zp(0x226)&&Object[Zp(0x1d4)]['hasOwnProperty'][Zp(0x1a9)](Z,z))__createBinding(J,Z,z);}return __setModuleDefault(J,Z),J;},__awaiter=this&&this[a1Zo(0x283)]||function(Z,J,z,B){function U(s){return s instanceof z?s:new z(function(A){A(s);});}return new(z||(z=Promise))(function(s,A){const Zg=a1J;function n(v){try{C(B['next'](v));}catch(o){A(o);}}function F(v){const ZS=a1J;try{C(B[ZS(0x252)](v));}catch(o){A(o);}}function C(v){const Ze=a1J;v[Ze(0x223)]?s(v[Ze(0x1ad)]):U(v['value'])[Ze(0x1d0)](n,F);}C((B=B[Zg(0x1d9)](Z,J||[]))[Zg(0x21c)]());});},__importDefault=this&&this[a1Zo(0x1bf)]||function(Z){const ZI=a1Zo;return Z&&Z[ZI(0x26d)]?Z:{'default':Z};};Object[a1Zo(0x282)](exports,a1Zo(0x26d),{'value':!![]}),exports[a1Zo(0x275)]=void 0x0;function a1Z(){const Zw=['region','backupId','endpoints','option','login','argv','addHelpCommand','get','safeLoad','PaginationHelper','kebabCase','keys','stdout','opt','askForSubdomainPath','toUpperCase','clusterId','templates','buildId','json','repositories','message','underline','tpl','askForPipeline','helpOption','version','--page','repos','API\x20request\x20failed\x0a\x09Message:\x20','after','Update\x20Northflank\x20','askForCredentials','find','writable','Get\x20information\x20about\x20Northflank\x20','./port-forward','output','branch','./exec','OPTIONAL:\x20','next','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','custom-columns=','checkUpdate','isArray','scrt','invoices','done','askGeneric','data','default','__createBinding','boolean','filter','concat','backups','getCurrentJobName','askForBuild','readFileSync','/docs/v1/api/','hasNext','-i,\x20--input\x20<resource-def>','deleteWarningPrompt','resource','getCommandOverview','consoleFormat','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','list','sort','Northflank\x20cli\x20version:\x20','6326226ZVOEbc','715512ymJTiV','long','plan','getNext','contextProvider','askForLogSink','jobId','customUserAgent','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','ApiClientFileContextProvider','-v,\x20--version','docsTagsPath','omit','\x0a\x09details\x20:','retrievePayloadViaInteractiveCli','existsSync','repo','348444vaQoaX','bind','there\x20are\x20more\x20rows,\x20load?','VERBOSE:\x20Using\x20endpoint\x20->\x20','./utils','path','throw','includes','.yaml','commands','noDefaults','warning','green','290JbdQJk','update','__importStar','askForTemplate','File\x20to\x20load\x20resource\x20json\x20from','endsWith','loadAll','--verbose','askForSubdomain','some','domain','tag','CliContext','yml','page','logSinkId','getCommand','alias','upperFirst','./defaults','__esModule','service','secrets','template','addon','isString','logs','volume','getProgram','4JZExrC','Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27','subdomainPath','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','assign','startsWith','request','CliPortForward',',\x20NF\x20error\x20id:\x20','askForAddonBackup','parseAsync','requiredPermissions','defineProperty','__awaiter','=>\x20running\x20command\x20with:\x20','description','skipValidation','js-yaml','volumeId','error','subdomain','ApiClient','svc','volumes','cursor','job','jobs','(HTTP\x20status\x20code:\x20','subdomainId','forEach','secretId','pop','getCurrentProjectName','create','asyncSequential','inv','parse','addCommand','3246395LGghFY','query','getOwnPropertyNames','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','quiet','Command','delete','adn','domainId','credential','brn','getOwnPropertyDescriptor','pipelineId','northflank','action','\x20Northflank\x20resources','toLowerCase','getLogsCommand','chalk','File\x20does\x20not\x20exist:\x20','map','./metrics','type','regions','templateId','askForClusterId','base','call','askForTag','__setModuleDefault','isEqual','value','12OCQOYx','body','has','configurable','length','templateRunId','clearLine','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','name','getMetricsCommand','Unknown\x20input\x20file\x20type:\x20','\x0a>\x20Token\x20permissions\x20required:\x20','log','split','askForTemplateRun','exitCode','file','__importDefault','defaults','6546424dNeHKY','serviceId','assertContextExisting','@northflank/js-client','\x20--','enablePositionalOptions','credentialId','portFwdCmd','yaml','nonInteractiveEndpoint','required','getCurrentContext','projectId','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','getAll','then','runId','join','dmn','prototype','27914OKjAbL','Documentation:\x20','prj','method','apply','opts','1777782CNpNyU','status','lodash','api.','Resource\x20was\x20not\x20deleted.','addonId',',\x20-','isPaginatedEndpoint','secret','currentOffset','CliMetrics','url','handleJsonOutput','stringify','plans','rgn','Display\x20help\x20for\x20command','grey','replace','askForVolume','./logs','getCurrentServiceName','set','-f,\x20--file\x20<file-path>'];a1Z=function(){return Zw;};return a1Z();}const js_client_1=require(a1Zo(0x1c4)),commander_1=__importDefault(require('commander')),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require(a1Zo(0x1a0))),_=__importStar(require(a1Zo(0x1dd))),contextCommands_1=require('./context/contextCommands'),utils_1=require(a1Zo(0x250)),defaults=__importStar(require(a1Zo(0x26c))),inquirer_helper_1=require('./inquirer-helper'),console_format_helpers_1=require('./formatting/console-format-helpers'),command_overview_1=require('./formatting/command-overview'),port_forward_1=require(a1Zo(0x217)),exec_1=require(a1Zo(0x21a)),logs_1=require(a1Zo(0x1ef)),metrics_1=require(a1Zo(0x1a3)),pagination_helper_1=require('./pagination/pagination-helper'),yaml=require(a1Zo(0x287)),pgk=require('../package.json'),getProgram=Z=>{const Zm=a1Zo,J=new commander_1[(Zm(0x226))][(Zm(0x193))](Zm(0x19b));J[Zm(0x285)](Zm(0x21d)),J[Zm(0x1c6)](!![]),J[Zm(0x20d)](Zm(0x239)+chalk_1['default'][Zm(0x209)](pgk['version']),Zm(0x245),Zm(0x243));const z=new js_client_1['ApiClient'](Z,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[Zm(0x242)]}),P=new contextCommands_1[(Zm(0x265))](z),B=new port_forward_1[(Zm(0x27d))](Z),U=new exec_1['CliExec'](Z),s=new logs_1['CliLogs'](Z),A=new metrics_1[(Zm(0x1e5))](Z);return J['addCommand'](B[Zm(0x1c8)]),J[Zm(0x18d)](U['execCmd']),J[Zm(0x18d)](P[Zm(0x1f7)]),J[Zm(0x18d)](P['contexts']),generateCommands(z,z[Zm(0x1f5)],J,s,A),J[Zm(0x18d)]((0x0,command_overview_1[Zm(0x234)])(J)),J[Zm(0x1f9)](!![],Zm(0x1eb)),J[Zm(0x20c)](undefined,Zm(0x1eb)),J;};exports[a1Zo(0x275)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const ZL=a1Zo;try{const Z=new js_client_1[(ZL(0x244))]();yield(0x0,utils_1[ZL(0x21f)])(Z);const J=(0x0,exports[ZL(0x275)])(Z);yield J[ZL(0x280)](process['argv']);}catch(z){(0x0,utils_1['error'])(ZL(0x1b5)+z[ZL(0x208)]),process[ZL(0x1f8)][ZL(0x214)](P=>P===ZL(0x260))&&console['log'](z),process[ZL(0x1bd)]=0x1;}}))());function isListCommand(Z){const ZM=a1Zo,J=[['get','addon',ZM(0x22b)],['get',ZM(0x181),'runs']];return Z[ZM(0x214)](z=>z===ZM(0x237))||J[ZM(0x262)](z=>_[ZM(0x1ac)](Z,z));}function a1J(Z,J){const z=a1Z();return a1J=function(P,B){P=P-0x181;let U=z[P];return U;},a1J(Z,J);}function generateCommands(Z,J,z,P,B,U=defaults[a1Zo(0x1c0)],s=[]){const Zx=a1Zo,A=new inquirer_helper_1['InquirerHelper'](new js_client_1[(Zx(0x28b))](Z[Zx(0x23f)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[Zx(0x242)]}));function n(o,j){const Zd=Zx;return o[Zd(0x1cb)]!==![]&&j===undefined;}function F(o,j){const Zk=Zx,{opt:V,name:i}=o,p=V[Zk(0x226)],S=n(V,p),e=x=>x[Zk(0x1b2)]>0x1?'--'+x:'-'+x,g=V===null||V===void 0x0?void 0x0:V[Zk(0x26a)],I=g?_[Zk(0x220)](g)?'-'+(g===null||g===void 0x0?void 0x0:g[Zk(0x1a2)](x=>e(x))[Zk(0x1d2)](Zk(0x1e1)))+',':''+e(g):'',m=S?'':Zk(0x21b),L=typeof V[Zk(0x1a4)]===Zk(0x228)||V[Zk(0x1a4)]===Zk(0x228)?I+Zk(0x1c5)+i:I+Zk(0x1c5)+i+'\x20<'+i[Zk(0x202)]()+'>',M=m+V[Zk(0x285)];j[Zk(0x1f6)](L,M,p);}function C(o,j){const ZN=Zx;if(j[ZN(0x255)][ZN(0x262)](V=>V['name']()===ZN(0x273)))return;_['isEqual'](o,[ZN(0x1fa),ZN(0x26e)])&&(j['addCommand'](P[ZN(0x19f)](ZN(0x26e))),j['addCommand'](B[ZN(0x1b7)]('service')),j[ZN(0x18d)](P[ZN(0x19f)]('service',!![])),j[ZN(0x18d)](B[ZN(0x1b7)](ZN(0x26e),!![]))),_[ZN(0x1ac)](o,['get',ZN(0x181)])&&(j['addCommand'](P['getLogsCommand'](ZN(0x181))),j[ZN(0x18d)](B['getMetricsCommand'](ZN(0x181))),j['addCommand'](P[ZN(0x19f)](ZN(0x181),!![])),j[ZN(0x18d)](B[ZN(0x1b7)](ZN(0x181),!![]))),_['isEqual'](o,['get','addon'])&&(j['addCommand'](P[ZN(0x19f)](ZN(0x271))),j[ZN(0x18d)](B[ZN(0x1b7)](ZN(0x271)))),_['isEqual'](o,['get',ZN(0x271),'backup'])&&j[ZN(0x18d)](P['getLogsCommand']('addon',![],!![])),_[ZN(0x1ac)](o,[ZN(0x1fa),ZN(0x271),'restores'])&&j['addCommand'](P[ZN(0x19f)](ZN(0x271),![],!![],!![]));}return Object['getOwnPropertyNames'](U)[Zx(0x185)](o=>{const ZW=Zx,j=J[o],V=U[o],i=s[ZW(0x22a)]([o]);function p(k,N){const ZX=ZW,W=Object[ZX(0x190)](k||{});W[ZX(0x1a2)](X=>{return{'name':X,'opt':k[X]};})[ZX(0x238)]((X,D)=>!n(X[ZX(0x200)])?!n(D[ZX(0x200)])?0x0:0x1:-0x1)[ZX(0x185)](X=>{F(X,N);});}function S(k,N){const ZD=ZW,W=[['project','projects',ZD(0x1d7)],[ZD(0x26e),'services',ZD(0x28c)],['credentials',ZD(0x197),'cred'],[ZD(0x271),'addons',ZD(0x195)],[ZD(0x181),ZD(0x182)],[ZD(0x23d),ZD(0x1e9),'pln'],[ZD(0x1f3),ZD(0x1a5),ZD(0x1ea)],[ZD(0x263),'domains',ZD(0x1d3)],[ZD(0x1e3),ZD(0x26f),ZD(0x221)],[ZD(0x28d),ZD(0x274),'vol'],['branches',ZD(0x219),ZD(0x198)],['invoice',ZD(0x222),ZD(0x18b)],[ZD(0x270),ZD(0x204),ZD(0x20a)],[ZD(0x20f),'repository',ZD(0x207),ZD(0x24b)],[ZD(0x264),'tags']],X=W['find'](D=>D['includes'](N));if(X!==undefined)k['aliases'](X['filter'](D=>D!==N));}function e(k){var N,W;return __awaiter(this,void 0x0,void 0x0,function*(){const Zq=a1J,X={},{contextProvider:D}=Z,q=i['includes'](Zq(0x194)),y=k[Zq(0x256)]===!![];function O(G,K,l){var b,f;return __awaiter(this,void 0x0,void 0x0,function*(){const Zy=a1J;if(_[Zy(0x1b0)]((f=(b=V[Zy(0x200)])===null||b===void 0x0?void 0x0:b[Zy(0x251)])!==null&&f!==void 0x0?f:{},G)){const r=!y&&!q&&l?l():undefined,w=k[G]||r||(yield K());_[Zy(0x1f1)](X,G,w);}});}return yield(0x0,utils_1['asyncSequential'])(Object['entries']((W=(N=V[Zq(0x200)])===null||N===void 0x0?void 0x0:N[Zq(0x251)])!==null&&W!==void 0x0?W:{}),([G,K])=>__awaiter(this,void 0x0,void 0x0,function*(){const ZO=Zq;var l;const b=X===null||X===void 0x0?void 0x0:X['projectId'],f=X===null||X===void 0x0?void 0x0:X[ZO(0x1a6)];switch(G){case ZO(0x1cd):return yield O(ZO(0x1cd),A['askForProject'][ZO(0x24d)](A),D[ZO(0x188)][ZO(0x24d)](D));case ZO(0x1c2):return yield O(ZO(0x1c2),A['askForService'](b)[ZO(0x24d)](A),D[ZO(0x1f0)][ZO(0x24d)](D));case'addonId':return yield O('addonId',A['askForAddon'](b)['bind'](A));case ZO(0x241):return yield O('jobId',A['askForJob'](b)[ZO(0x24d)](A),D[ZO(0x22c)]['bind'](D));case ZO(0x1d1):return yield O(ZO(0x1d1),A['askForJobRun'](X[ZO(0x241)],b,![])[ZO(0x24d)](A));case'secretId':return yield O(ZO(0x186),A['askForSecret'](b)['bind'](A));case ZO(0x263):case'domainId':return yield O(ZO(0x263),A['askForDomain'][ZO(0x24d)](A));case ZO(0x1c7):return yield O('credentialId',A[ZO(0x213)]['bind'](A));case ZO(0x288):return yield O(ZO(0x288),A[ZO(0x1ee)](b)[ZO(0x24d)](A));case ZO(0x28a):return yield O(ZO(0x28a),A[ZO(0x261)](X[ZO(0x263)])[ZO(0x24d)](A));case ZO(0x184):return yield O('subdomainId',A[ZO(0x261)](X[ZO(0x196)])['bind'](A));case ZO(0x278):return yield O(ZO(0x278),A[ZO(0x201)](X[ZO(0x263)],(l=X['subdomain'])!==null&&l!==void 0x0?l:X[ZO(0x184)])[ZO(0x24d)](A));case ZO(0x1f4):return yield O('backupId',A[ZO(0x27f)](b,X[ZO(0x1e0)])['bind'](A));case'buildId':return yield O(ZO(0x205),A[ZO(0x22d)](b,X[ZO(0x1c2)],X[ZO(0x241)])[ZO(0x24d)](A));case'templateId':return yield O(ZO(0x1a6),A[ZO(0x25c)]()[ZO(0x24d)](A));case ZO(0x1b3):return yield O(ZO(0x1b3),A[ZO(0x1bc)](f)['bind'](A));case ZO(0x268):return yield O(ZO(0x268),A[ZO(0x240)]()['bind'](A));case'pipelineId':return yield O(ZO(0x19a),A[ZO(0x20b)](b)[ZO(0x24d)](A));case'resourceTagId':return yield O('resourceTagId',A[ZO(0x1aa)]()[ZO(0x24d)](A));case ZO(0x203):return yield O('clusterId',A[ZO(0x1a7)]()['bind'](A));default:return yield O(G,A[ZO(0x224)](G,K===null||K===void 0x0?void 0x0:K[ZO(0x285)])[ZO(0x24d)](A));}})),X;});}function g(k){var N,W,X;return __awaiter(this,void 0x0,void 0x0,function*(){const ZG=a1J,D={},q=((N=V[ZG(0x200)])===null||N===void 0x0?void 0x0:N[ZG(0x1e2)])?defaults['paginationArgs']:{},y=Object[ZG(0x27a)](Object[ZG(0x27a)]({},(X=(W=V[ZG(0x200)])===null||W===void 0x0?void 0x0:W[ZG(0x18f)])!==null&&X!==void 0x0?X:{}),q),O=Object[ZG(0x1fe)](y)[ZG(0x229)](G=>G!==ZG(0x25f));return yield(0x0,utils_1[ZG(0x18a)])(O,G=>__awaiter(this,void 0x0,void 0x0,function*(){if(k[G]!==undefined)return _['set'](D,G,k[G]);})),D;});}function I(){const ZK=ZW;switch(i[0x0]){case ZK(0x1fa):return ZK(0x216)+(i[0x1]||ZK(0x233))+'s';case ZK(0x25a):return ZK(0x212)+(i[0x1]||'resource')+'\x20properties';default:return _[ZK(0x26b)](o)+ZK(0x19d);}}function m(k,N){const Zl=ZW;var W,X,D,q,y,O,G,K;if(!N){const c=(0x0,utils_1[Zl(0x269)])()[Zl(0x1b6)](_[Zl(0x1fd)](o))[Zl(0x285)](I());return S(c,o),c;}const l=(k===null||k===void 0x0?void 0x0:k[Zl(0x281)])?chalk_1[Zl(0x226)][Zl(0x1ec)](Zl(0x1b9)+k[Zl(0x281)]):'',b=Z[Zl(0x23f)][Zl(0x1cc)](),f=b!==undefined&&((W=V===null||V===void 0x0?void 0x0:V[Zl(0x200)])===null||W===void 0x0?void 0x0:W[Zl(0x246)])!==undefined,r=b===null||b===void 0x0?void 0x0:b['host'][Zl(0x1ed)](Zl(0x1de),''),w=f?Zl(0x1d6)+r+Zl(0x22f)+((X=V===null||V===void 0x0?void 0x0:V[Zl(0x200)])===null||X===void 0x0?void 0x0:X['docsTagsPath']):'',Q=(k===null||k===void 0x0?void 0x0:k['description'])||'',T=(0x0,utils_1[Zl(0x269)])(!![])[Zl(0x1b6)](_[Zl(0x1fd)](o))[Zl(0x285)](Q)['addHelpText'](Zl(0x211),[l,w]['join']('\x0a'));return S(T,o),(((D=V[Zl(0x200)])===null||D===void 0x0?void 0x0:D[Zl(0x1af)])||((q=V['opt'])===null||q===void 0x0?void 0x0:q['nonInteractiveEndpoint']))&&(T[Zl(0x1f6)](Zl(0x1f2),Zl(0x25d)),T['option'](Zl(0x231),Zl(0x191))),p((y=V['opt'])===null||y===void 0x0?void 0x0:y['path'],T),p((O=V[Zl(0x200)])===null||O===void 0x0?void 0x0:O['query'],T),((G=V[Zl(0x200)])===null||G===void 0x0?void 0x0:G[Zl(0x1e2)])&&p(defaults['paginationArgs'],T),p((K=V[Zl(0x200)])===null||K===void 0x0?void 0x0:K[Zl(0x1a8)],T),T[Zl(0x19c)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const Zb=Zl;var t,R,h,a;(0x0,utils_1[Zb(0x1c3)])(Z);const u=T[Zb(0x1da)](),H=u[Zb(0x267)]!==undefined||u[Zb(0x28e)]!==undefined,Y=T['options']['some'](Z9=>Z9[Zb(0x23c)]===Zb(0x20e));if(u[Zb(0x25f)]===!![]&&H)throw new Error(Zb(0x277));const E=u===null||u===void 0x0?void 0x0:u[Zb(0x218)],Z0=E===Zb(0x206),Z1=E==='yaml'||E==='yml',Z2=yield e(u);A['setPathVars'](Z2);const Z3=yield g(u),Z4=Object[Zb(0x1fe)]((R=(t=V['opt'])===null||t===void 0x0?void 0x0:t[Zb(0x251)])!==null&&R!==void 0x0?R:{})[Zb(0x1a2)](Z9=>Z9+'='+chalk_1[Zb(0x226)][Zb(0x258)](Z2[Z9]))['join'](',\x20');if(Z4[Zb(0x1b2)]>0x0&&!Z0&&!Z1){const Z9=Zb(0x284)+Z4;console[Zb(0x1ba)](Z9);}const Z5=((h=V[Zb(0x200)])===null||h===void 0x0?void 0x0:h[Zb(0x1af)])||((a=V['opt'])===null||a===void 0x0?void 0x0:a[Zb(0x1ca)])?yield yield v(u,V,i):undefined;if(!u['force']&&i[Zb(0x253)](Zb(0x194))&&!(yield A[Zb(0x232)]())){(0x0,utils_1[Zb(0x257)])(Zb(0x1df));return;}const Z6=new pagination_helper_1[(Zb(0x1fc))](j,Z2,Z3,Z5),Z7=Y&&(u[Zb(0x25f)]||(u[Zb(0x218)]===Zb(0x206)||u[Zb(0x218)]===Zb(0x1c9))&&!H),Z8=Z7?yield Z6[Zb(0x1cf)]():yield Z6[Zb(0x23e)]();if(u===null||u===void 0x0?void 0x0:u['verbose']){const ZZ=Z8[Zb(0x27c)];console['log'](Zb(0x24f)+ZZ[Zb(0x1d8)][Zb(0x202)]()+':'+ZZ[Zb(0x1e6)]);if(Z5!==undefined)console['log']('VERBOSE:\x20Request\x20body\x20->\x20'+Z5);}if(Z8[Zb(0x289)]){const {details:ZJ,id:Zz,message:ZP,status:ZB}=Z8['error'],ZU=ZJ?Zb(0x248)+JSON[Zb(0x1e8)](ZJ):'',Zs=Zz?Zb(0x27e)+Zz:'',ZA=Zb(0x183)+ZB+Zs+')';throw new Error(Zb(0x210)+ZP+'\x20'+ZA+ZU);}printCallResult(u,Z0,Z8[Zb(0x225)],Z1,i,E,![],0x0,Z8['rawResponse'][Zb(0x1dc)]);if(!u[Zb(0x192)]&&!Z7&&!H&&Z6[Zb(0x230)]())while(Z6['hasNext']()){const Zn=yield A['askConfirm'](Zb(0x24e));if(Zn){process[Zb(0x1ff)]['moveCursor'](0x0,-0x1),process[Zb(0x1ff)][Zb(0x1b4)](0x1);const ZF=Z6[Zb(0x1e4)],ZC=yield Z6[Zb(0x23e)]();printCallResult(u,Z0,ZC[Zb(0x225)],Z1,i,E,!![],ZF,ZC['rawResponse'][Zb(0x1dc)]);}else return;}})),T;}const L=_[ZW(0x1b0)](V,ZW(0x200)),M=j,x=m(M,L);C(i,x),z[ZW(0x18d)](x);const d=_[ZW(0x247)](V,ZW(0x200));Object[ZW(0x1fe)](d)[ZW(0x1b2)]>0x0&&generateCommands(Z,j,x,P,B,d,i);});function v(o,j,V){var i;return __awaiter(this,void 0x0,void 0x0,function*(){const Zf=a1J,{input:p,file:S}=o;if(p!==undefined)try{return JSON[Zf(0x18c)](p);}catch(g){try{return yaml[Zf(0x1fb)](p);}catch(I){throw new Error(Zf(0x236));}}if(S!==undefined){if(!fs_1[Zf(0x226)][Zf(0x24a)](S))throw new Error(Zf(0x1a1)+S);const m=fs_1[Zf(0x226)][Zf(0x22e)](S)['toString']();let L;try{if(_[Zf(0x272)](m)){if(o[Zf(0x1be)][Zf(0x25e)]('.json'))L=JSON[Zf(0x18c)](m);else{if(o['file'][Zf(0x25e)](Zf(0x254))||o[Zf(0x1be)][Zf(0x25e)](Zf(0x266)))L=yaml[Zf(0x1fb)](m);else throw new Error(Zf(0x1b8)+o[Zf(0x1be)]['split']('.')[Zf(0x187)]());}}else L=m;return L;}catch(M){throw new Error(Zf(0x1ce)+M['message']);}}if((i=j===null||j===void 0x0?void 0x0:j[Zf(0x200)])===null||i===void 0x0?void 0x0:i[Zf(0x1ca)])throw new Error(Zf(0x279));return yield A[Zf(0x249)](j,{'cmdPath':V,'skipValidation':o[Zf(0x286)]});});}}const printCallResult=(Z,J,z,P,B,U,s,A,n)=>{const Zr=a1Zo;if(!(Z===null||Z===void 0x0?void 0x0:Z[Zr(0x192)])){if(J)(0x0,console_format_helpers_1[Zr(0x1e7)])(Z===null||Z===void 0x0?void 0x0:Z[Zr(0x218)],z);else{if(P)(0x0,console_format_helpers_1['handleYamlOutput'])(Z===null||Z===void 0x0?void 0x0:Z[Zr(0x218)],z);else{if(isListCommand(B)){const F=(U===null||U===void 0x0?void 0x0:U[Zr(0x27b)](Zr(0x21e)))?U[Zr(0x1ed)](Zr(0x21e),'')[Zr(0x1bb)](',')[Zr(0x1a2)](V=>V[Zr(0x19e)]()):undefined,C=B[B[Zr(0x1b2)]-0x1],v=''+C+(C[Zr(0x25e)]('s')?'':'s'),o=_[Zr(0x26b)](v),j=_[Zr(0x1b0)](z,v)?z[v]:z;(0x0,console_format_helpers_1['printAsTable'])(j,o,F,s,A);}else console['log']((0x0,console_format_helpers_1[Zr(0x235)])(z,n));}}}};
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 a2L=a2J;(function(Z,J){const m=a2J,z=Z();while(!![]){try{const P=-parseInt(m(0x1d4))/0x1+parseInt(m(0x1e6))/0x2*(parseInt(m(0x25d))/0x3)+-parseInt(m(0x21d))/0x4+parseInt(m(0x258))/0x5*(parseInt(m(0x20b))/0x6)+parseInt(m(0x227))/0x7+parseInt(m(0x232))/0x8+parseInt(m(0x24a))/0x9*(-parseInt(m(0x1d7))/0xa);if(P===J)break;else z['push'](z['shift']());}catch(B){z['push'](z['shift']());}}}(a2Z,0xe3d18));var __createBinding=this&&this[a2L(0x202)]||(Object[a2L(0x264)]?function(Z,J,z,P){const M=a2L;if(P===undefined)P=z;var B=Object[M(0x1fe)](J,z);(!B||('get'in B?!J[M(0x231)]:B[M(0x22a)]||B[M(0x1d0)]))&&(B={'enumerable':!![],'get':function(){return J[z];}}),Object['defineProperty'](Z,P,B);}:function(Z,J,z,P){if(P===undefined)P=z;Z[P]=J[z];}),__setModuleDefault=this&&this[a2L(0x246)]||(Object[a2L(0x264)]?function(Z,J){const x=a2L;Object[x(0x1e2)](Z,x(0x234),{'enumerable':!![],'value':J});}:function(Z,J){Z['default']=J;}),__importStar=this&&this[a2L(0x23a)]||function(Z){const d=a2L;if(Z&&Z[d(0x231)])return Z;var J={};if(Z!=null){for(var z in Z)if(z!==d(0x234)&&Object[d(0x1de)][d(0x23f)]['call'](Z,z))__createBinding(J,Z,z);}return __setModuleDefault(J,Z),J;},__awaiter=this&&this['__awaiter']||function(Z,J,z,B){function U(s){return s instanceof z?s:new z(function(A){A(s);});}return new(z||(z=Promise))(function(s,A){const X=a2J;function n(v){const k=a2J;try{C(B[k(0x212)](v));}catch(o){A(o);}}function F(v){const N=a2J;try{C(B[N(0x251)](v));}catch(o){A(o);}}function C(v){const W=a2J;v[W(0x21b)]?s(v[W(0x265)]):U(v[W(0x265)])[W(0x20c)](n,F);}C((B=B[X(0x224)](Z,J||[]))[X(0x212)]());});},__importDefault=this&&this[a2L(0x25b)]||function(Z){const D=a2L;return Z&&Z[D(0x231)]?Z:{'default':Z};};function a2J(Z,J){const z=a2Z();return a2J=function(P,B){P=P-0x1ca;let U=z[P];return U;},a2J(Z,J);}function a2Z(){const Z1=['log','fullUrl','browser\x20login','set-token','service','3840XmgSDj','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','Changed\x20current\x20context\x20to\x20','__importDefault','useServiceId','39NzaEXa','action','removeContext','verifyToken','askForProject','token\x20login','askForContext','create','value','error','List\x20all\x20available\x20contexts','browserLogin','retry','test','NorthflankApiBrowserLogin','configurable','lodash','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','Use\x20project\x20with\x20id:','1088044Rbsgln','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','sort','710xaWNPW','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','list','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','-t,\x20--token\x20[TOKEN]','apiTokenLogin','getCommand','prototype','Name\x20for\x20login\x20context','Bearer\x20','contextAvailable','defineProperty','node-fetch','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','set','41106tIyLtH','Switch\x20between\x20your\x20local\x20contexts','context','token','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20',',\x20added\x20context\x20with\x20name\x20','job','tokenPrompt','getCurrentContext','printAsTable','--all','option','\x27\x20successfully\x20removed.','Token\x20for\x20current\x20context\x20\x27','italic','Remove\x20a\x20context','getCurrentBaseUrl','Shows\x20full\x20context\x20information\x20(including\x20tokens)','\x20(current)','../formatting/console-format-helpers','moveCursor','browser-opened','/v1/login','contextProvider','getOwnPropertyDescriptor','contexts','Token\x20for\x20this\x20context','askForService','__createBinding','defaultBaseUrl','Local\x20context\x20name\x20to\x20remove.','prompt','length','close','use','success','chalk','9834xhtnqF','then','--do-not-open-browser','stdout','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','../utils','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','next','valueOf','\x27\x20successfully\x20updated.','getInfo','useContext','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','update-token','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','sanitiseHostname','done','updateToken','2354856xFqMLE','dir','-n,\x20--name\x20[NAME]','confirm','host','Retrieve\x20and\x20update\x20local\x20context\x20settings.','../inquirer-helper','apply','\x0aSuccessfully\x20logged\x20in\x20using\x20','override','7140112dDSXFQ','getCurrentToken','alias','writable','useProjectId','InquirerHelper','--host\x20[HOST]','ctx','getProjectName','-i,\x20--id\x20[ID]','__esModule','10051120eIrlXw','search-list','default','Use\x20job\x20with\x20id:','https://','Error\x20occured\x20during\x20browser\x20login:\x20','doNotOpenBrowser','apiClient','__importStar','name','\x20(api\x20host:\x20','sessionToken=********','replace','hasOwnProperty','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','loadContextWrapper','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','addCommand','project','current','__setModuleDefault','description','--token-login','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','151155HqAEda','https://api.northflank.com','login','getCurrentProjectName','useJobId','warning','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','throw','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed'];a2Z=function(){return Z1;};return a2Z();}Object[a2L(0x1e2)](exports,a2L(0x231),{'value':!![]}),exports['CliContext']=void 0x0;const _=__importStar(require(a2L(0x1d1))),node_fetch_1=__importDefault(require(a2L(0x1e3))),chalk_1=__importDefault(require(a2L(0x20a))),utils_1=require(a2L(0x210)),inquirer_helper_1=require(a2L(0x223)),console_format_helpers_1=require(a2L(0x1f9)),browser_login_1=require('../login/browser-login'),inquirer=require('inquirer');class CliContext{constructor(Z,J=a2L(0x24b)){const q=a2L;this[q(0x203)]=J,this[q(0x21a)]=v=>{const y=q;let o=v;return!/^https?:\/\//i[y(0x1ce)](o)&&(o=y(0x236)+o),o=o[y(0x23e)](/\/+$/,''),o;},this[q(0x239)]=Z;const z=new inquirer_helper_1[(q(0x22c))](Z);this[q(0x24c)]=(0x0,utils_1['getCommand'])()[q(0x23b)](q(0x24c))['description'](q(0x240))['option'](q(0x248),'Use\x20manual\x20login\x20with\x20API\x20token',![])[q(0x1f1)](q(0x20d),q(0x1d2),![])[q(0x1f1)](q(0x21f),q(0x1df))[q(0x1f1)](q(0x1db),q(0x249))[q(0x1f1)](q(0x22d),'host\x20url\x20for\x20this\x20context',this[q(0x203)])[q(0x1f1)]('--override','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)',![])[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const O=q;_[O(0x1e5)](v,'host',this[O(0x21a)](v[O(0x221)]));const o=v['tokenLogin']||v[O(0x1e9)]!==undefined,{name:j,host:V,token:i,override:p}=o?yield this[O(0x1dc)](v,z):yield this['browserLogin'](v,z);try{yield this[O(0x239)][O(0x1fd)]['addContext']({'name':j,'host':V,'token':i},p);}catch(S){(0x0,utils_1[O(0x1ca)])(S['message']);return;}if(!(yield this[O(0x260)]()))(0x0,utils_1['error'])(O(0x242)),yield this[O(0x239)]['contextProvider'][O(0x25f)](j);else{const g=o?O(0x262):O(0x255),I=O(0x225)+g+O(0x1eb)+chalk_1[O(0x234)][O(0x1f4)](j)+O(0x23c)+V+')';(0x0,utils_1[O(0x209)])(I);}})),this['contexts']=(0x0,utils_1[q(0x1dd)])()['name'](q(0x1e8))[q(0x247)](q(0x222))[q(0x229)](q(0x1ff))[q(0x229)](q(0x22e));const P=(0x0,utils_1[q(0x1dd)])()[q(0x23b)](q(0x1d9))[q(0x23b)]('ls')[q(0x247)](q(0x1cb))[q(0x1f1)](q(0x1f0),q(0x1f7))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const G=q;console[G(0x253)](Z[G(0x1fd)][G(0x215)]());const o=Z['contextProvider'][G(0x241)]();if(v['all']===!![]){console[G(0x21e)](o);return;}const j=o[G(0x245)],V=o[G(0x1ff)][G(0x1d6)]((i,p)=>i['name']===j?-0x1:p['name']===j?0x1:0x0)['map'](i=>{const K=G,p=j===i['name']?K(0x1f8):'';return{'Name':''+i[K(0x23b)]+p,'Host':i[K(0x221)],'Default\x20Project':i[K(0x244)]||'-','Default\x20Service':i['service']||'-'};});(0x0,console_format_helpers_1[G(0x1ef)])(V,'Contexts');})),B=(0x0,utils_1['getCommand'])();B['name'](q(0x208))[q(0x247)](q(0x1e7))[q(0x1f1)](q(0x21f),'Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name')[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const l=q,o=(v===null||v===void 0x0?void 0x0:v[l(0x23b)])||(yield this['askForContext'](l(0x208)));yield this[l(0x239)]['contextProvider'][l(0x216)](o),(0x0,utils_1[l(0x209)])(l(0x25a)+o);}));const U=q(0x230),s=(0x0,utils_1[q(0x1dd)])()['name'](q(0x244))[q(0x247)](q(0x20f))['option'](U,q(0x1e4))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const b=q,o=(v===null||v===void 0x0?void 0x0:v['id'])||(yield z[b(0x261)]());yield this[b(0x239)][b(0x1fd)][b(0x22b)](o),console[b(0x253)](b(0x1d3),o);})),A=(0x0,utils_1[q(0x1dd)])()[q(0x23b)](q(0x257))['description'](q(0x211))[q(0x1f1)](U,q(0x250))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const f=q,o=(v===null||v===void 0x0?void 0x0:v['id'])||(yield z[f(0x201)](this[f(0x22f)]())());console[f(0x253)]('Use\x20service\x20with\x20id:',o),yield this[f(0x239)]['contextProvider'][f(0x25c)](o);})),n=(0x0,utils_1[q(0x1dd)])()[q(0x23b)](q(0x1ec))[q(0x247)](q(0x259))['option'](U,q(0x217))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const r=q,o=(v===null||v===void 0x0?void 0x0:v['id'])||(yield z['askForJob'](this[r(0x22f)]())());console[r(0x253)](r(0x235),o),yield this[r(0x239)][r(0x1fd)][r(0x24e)](o);}));B[q(0x243)](s),B[q(0x243)](n),B['addCommand'](A);const F=(0x0,utils_1[q(0x1dd)])()['name']('remove')['alias']('delete')[q(0x229)]('rm')[q(0x247)](q(0x1f5))['option'](U,q(0x204))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const w=q;var o;const j=(v===null||v===void 0x0?void 0x0:v['id'])||(yield this['askForContext']('remove')),V=(o=this[w(0x239)][w(0x1fd)][w(0x1ee)]())===null||o===void 0x0?void 0x0:o[w(0x23b)];yield this[w(0x239)][w(0x1fd)][w(0x25f)](j),(0x0,utils_1[w(0x209)])('Local\x20context\x20\x27'+j+w(0x1f2));if(!this[w(0x1e1)]()){(0x0,utils_1[w(0x24f)])(w(0x1d8));return;}if(V===j){const i=(v===null||v===void 0x0?void 0x0:v[w(0x23b)])||(yield this[w(0x263)]('use\x20from\x20now\x20on'));yield this[w(0x239)][w(0x1fd)]['useContext'](i),(0x0,utils_1[w(0x209)])(w(0x25a)+i);}})),C=(0x0,utils_1['getCommand'])()[q(0x23b)](q(0x218))['alias'](q(0x256))['description']('Update\x20token\x20for\x20current\x20context')[q(0x1f1)](q(0x1db),q(0x200))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const Q=q,{contextProvider:o}=this[Q(0x239)],j=(v===null||v===void 0x0?void 0x0:v['token'])||(yield z[Q(0x1ed)]()),V=o['getCurrentToken']();yield o[Q(0x21c)](j);if(yield this[Q(0x260)]())(0x0,utils_1[Q(0x209)])(Q(0x1f3)+o['getCurrentName']()+Q(0x214));else{if(V)yield o[Q(0x21c)](V);(0x0,utils_1[Q(0x1ca)])(Q(0x252));}}));this[q(0x1ff)][q(0x243)](P),this[q(0x1ff)][q(0x243)](B),this[q(0x1ff)][q(0x243)](F),this['contexts'][q(0x243)](C);}[a2L(0x1cc)](Z,J){var z,P,B,U;return __awaiter(this,void 0x0,void 0x0,function*(){const T=a2J,s=!Z[T(0x238)],A=(z=Z[T(0x221)])!==null&&z!==void 0x0?z:this[T(0x203)],n=new browser_login_1[(T(0x1cf))](A,s);let F;n['on'](T(0x1fb),({url:j})=>{const c=T;if(s){const V=j[c(0x23e)](/sessionToken=.*/,c(0x23d));console['log'](c(0x1ea)+V+')'),F=inquirer[c(0x205)]([{'type':c(0x220),'name':c(0x254),'message':c(0x1d5),'default':![]}]),F[c(0x20c)](i=>{const t=c;process['stdout'][t(0x1fa)](0x0,-0x1),process[t(0x20e)]['clearLine'](0x1),i[t(0x254)]&&console[t(0x253)](t(0x219)+j+'\x20');});}else console['log'](c(0x219)+j+'\x20');});const {token:C,contextName:v}=yield n['startLogin']()['catch'](j=>__awaiter(this,void 0x0,void 0x0,function*(){const R=T;(0x0,utils_1[R(0x1ca)])(R(0x237)+j['message']+'.\x20Using\x20fallback.');const V=yield this[R(0x1dc)](Z,J);return{'token':V[R(0x1e9)],'contextName':V[R(0x23b)]};}))['finally'](()=>{const h=T;if(F)F['ui'][h(0x207)]();}),o=(B=(P=Z[T(0x23b)])!==null&&P!==void 0x0?P:v)!==null&&B!==void 0x0?B:'autologin-'+new Date()[T(0x213)]();return{'name':o,'token':C,'host':A,'override':(U=Z[T(0x226)])!==null&&U!==void 0x0?U:![]};});}[a2L(0x1dc)](Z,J){return __awaiter(this,void 0x0,void 0x0,function*(){const a=a2J,z=this[a(0x239)][a(0x1fd)][a(0x241)]()[a(0x1ff)],{name:P,token:B,host:U,override:s}=yield J['loginPrompt'](Z,z);return{'name':P,'token':B,'host':U,'override':s};});}['getProjectName'](){const u=a2L,Z=this[u(0x239)][u(0x1fd)][u(0x24d)]();if(Z===undefined)throw new Error(u(0x1da));return Z;}['askForContext'](Z){return __awaiter(this,void 0x0,void 0x0,function*(){const H=a2J;if(!this[H(0x1e1)]())throw new Error('No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.');const J=this[H(0x239)]['contextProvider'][H(0x241)]()[H(0x1ff)]['map'](P=>P[H(0x23b)]),z=J[H(0x206)]>0x4?H(0x233):'list';return(yield inquirer[H(0x205)]([{'type':z,'name':H(0x23b),'message':'Choose\x20the\x20context\x20to\x20'+Z+':','choices':J}]))['name'];});}[a2L(0x1e1)](){const Y=a2L;return this[Y(0x239)][Y(0x1fd)]['loadContextWrapper']()[Y(0x1ff)][Y(0x206)]>0x0;}[a2L(0x260)](){return __awaiter(this,void 0x0,void 0x0,function*(){const E=a2J;try{const Z=this[E(0x239)][E(0x1fd)][E(0x1f6)](),J=this[E(0x239)]['contextProvider'][E(0x228)](),z=Z+E(0x1fc),P={'Authorization':E(0x1e0)+J},B=yield(0x0,utils_1[E(0x1cd)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const Z0=E;return(0x0,node_fetch_1[Z0(0x234)])(z,{'method':'GET','timeout':0xbb8,'headers':P});}));if(B['ok'])return!![];return![];}catch(U){return![];}});}}exports['CliContext']=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;