@northflank/cli 0.9.11 → 0.9.12

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 a0w2=a0h;(function(w,h){const w1=a0h,G=w();while(!![]){try{const P=-parseInt(w1(0x15e))/0x1*(-parseInt(w1(0x13e))/0x2)+parseInt(w1(0x163))/0x3*(-parseInt(w1(0x168))/0x4)+parseInt(w1(0x160))/0x5*(-parseInt(w1(0x13a))/0x6)+-parseInt(w1(0x13f))/0x7+parseInt(w1(0x15b))/0x8*(-parseInt(w1(0x164))/0x9)+-parseInt(w1(0x15f))/0xa+parseInt(w1(0x159))/0xb*(parseInt(w1(0x149))/0xc);if(P===h)break;else G['push'](G['shift']());}catch(v){G['push'](G['shift']());}}}(a0w,0xd2829));var __awaiter=this&&this[a0w2(0x171)]||function(w,h,G,v){function O(Z){return Z instanceof G?Z:new G(function(a){a(Z);});}return new(G||(G=Promise))(function(Z,a){const w4=a0h;function l(A){try{U(v['next'](A));}catch(D){a(D);}}function B(A){try{U(v['throw'](A));}catch(D){a(D);}}function U(A){const w3=a0h;A[w3(0x166)]?Z(A[w3(0x165)]):O(A[w3(0x165)])[w3(0x177)](l,B);}U((v=v[w4(0x138)](w,h||[]))['next']());});};Object[a0w2(0x16b)](exports,a0w2(0x156),{'value':!![]}),exports[a0w2(0x16e)]=void 0x0;function a0h(w,h){const G=a0w();return a0h=function(P,v){P=P-0x138;let O=G[P];return O;},a0h(w,h);}const utils_1=require(a0w2(0x175)),defaultPaginationPageSize=0x32,getProjects=w=>h=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const w5=a0w2;var G;const P=yield w['list'][w5(0x173)]({'options':{'per_page':defaultPaginationPageSize,'cursor':h===null||h===void 0x0?void 0x0:h[w5(0x157)]}});return{'elements':P[w5(0x155)][w5(0x173)][w5(0x14a)](v=>v['id']),'nextPageCursor':(G=P['pagination'])===null||G===void 0x0?void 0x0:G['cursor']};}),getServices=(w,h)=>G=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const w6=a0w2;var P;const v=yield w[w6(0x16a)][w6(0x176)]({'parameters':{'projectId':h},'options':{'per_page':defaultPaginationPageSize,'cursor':G===null||G===void 0x0?void 0x0:G[w6(0x157)]}});return{'elements':v[w6(0x155)][w6(0x176)][w6(0x14a)](O=>O['id']),'nextPageCursor':(P=v[w6(0x169)])===null||P===void 0x0?void 0x0:P['cursor']};}),getAddons=(w,h)=>G=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const w7=a0w2;var P;const v=yield w[w7(0x16a)][w7(0x14f)]({'parameters':{'projectId':h},'options':{'per_page':defaultPaginationPageSize,'cursor':G===null||G===void 0x0?void 0x0:G[w7(0x157)]}});return{'elements':v['data'][w7(0x14f)][w7(0x14a)](O=>O['id']),'nextPageCursor':(P=v[w7(0x169)])===null||P===void 0x0?void 0x0:P['cursor']};}),getAddonBackups=(w,h,G)=>P=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const w8=a0w2;var v;const O=yield w[w8(0x146)][w8(0x152)][w8(0x147)]({'parameters':{'projectId':h,'addonId':G},'options':{'per_page':defaultPaginationPageSize,'cursor':P===null||P===void 0x0?void 0x0:P[w8(0x157)]}});return{'elements':O[w8(0x155)][w8(0x147)][w8(0x14a)](Z=>Z['id']),'nextPageCursor':(v=O[w8(0x169)])===null||v===void 0x0?void 0x0:v['cursor']};});function fetchResourceList(w,h,G,P,v,O){var Z,a,l,B,U,A,D,p,s,W,X,T;return __awaiter(this,void 0x0,void 0x0,function*(){const w9=a0h,I=undefined;try{if(w===w9(0x167)){const q=yield h[w9(0x16a)][w9(0x151)]({}),f=q['data'][w9(0x151)]['map'](i=>{const ww=w9;var u;return(u=i===null||i===void 0x0?void 0x0:i[ww(0x14c)])!==null&&u!==void 0x0?u:i===null||i===void 0x0?void 0x0:i['id'];});return{'choices':f,'defaultValue':I};}if(w===w9(0x15a)&&!(G===null||G===void 0x0?void 0x0:G[w9(0x145)](w9(0x153)))){const i=yield h[w9(0x16a)][w9(0x16f)]({}),u=i[w9(0x155)][w9(0x16f)][w9(0x14a)](t=>{const wh=w9;var S;return(S=t===null||t===void 0x0?void 0x0:t[wh(0x14c)])!==null&&S!==void 0x0?S:t===null||t===void 0x0?void 0x0:t['id'];});return{'choices':u,'defaultValue':I};}if(w===w9(0x15c)){const t=yield getProjects(h),{elements:S,nextPageCursor:V}=yield t();return{'choices':S,'defaultValue':I,'pagination':{'nextPageCursor':V,'loadMore':t}};}if(w===w9(0x14e)){const C=yield h[w9(0x16a)]['registryCredentials']({}),M=C[w9(0x155)][w9(0x14e)][w9(0x14a)](Q=>Q['id']);return{'choices':M,'defaultValue':I};}const k=v===null||v===void 0x0?void 0x0:v[w9(0x15c)],Y=w===w9(0x170)||w==='id'&&(O===null||O===void 0x0?void 0x0:O['includes'](w9(0x16c)));if(k!==undefined&&Y){const Q=yield getServices(h,k),{elements:H,nextPageCursor:n}=yield Q();return{'choices':H,'defaultValue':I,'pagination':{'nextPageCursor':n,'loadMore':Q}};}const x=G===null||G===void 0x0?void 0x0:G[w9(0x145)](w9(0x152));if(x){const c=r=>__awaiter(this,void 0x0,void 0x0,function*(){const wG=w9;var j;const m=yield h[wG(0x146)][wG(0x152)]['types']({});return(j=m[wG(0x155)][wG(0x141)])===null||j===void 0x0?void 0x0:j['find'](y=>y['type']===r);});if(w===w9(0x158)){const r=yield h[w9(0x146)][w9(0x152)][w9(0x143)]({}),j=(Z=r[w9(0x155)][w9(0x141)])===null||Z===void 0x0?void 0x0:Z[w9(0x14a)](m=>m[w9(0x158)]);return{'choices':j,'defaultValue':I};}if(w===w9(0x140)&&(P===null||P===void 0x0?void 0x0:P[w9(0x158)])!==undefined){const m=(a=yield c(P[w9(0x158)]))===null||a===void 0x0?void 0x0:a[w9(0x15d)];return{'choices':m,'defaultValue':I};}if(w===w9(0x178)&&(P===null||P===void 0x0?void 0x0:P[w9(0x158)])!==undefined){const y=(B=(l=yield c(P[w9(0x158)]))===null||l===void 0x0?void 0x0:l[w9(0x14b)])===null||B===void 0x0?void 0x0:B[w9(0x178)];return{'choices':y===null||y===void 0x0?void 0x0:y[w9(0x172)],'defaultValue':y===null||y===void 0x0?void 0x0:y['default']};}if(w==='replicas'&&(P===null||P===void 0x0?void 0x0:P['type'])!==undefined){const E=(A=(U=yield c(P[w9(0x158)]))===null||U===void 0x0?void 0x0:U[w9(0x14b)])===null||A===void 0x0?void 0x0:A['replicas'];return{'choices':E===null||E===void 0x0?void 0x0:E[w9(0x172)],'defaultValue':E===null||E===void 0x0?void 0x0:E[w9(0x161)]};}}if(w===w9(0x16d)&&(v===null||v===void 0x0?void 0x0:v[w9(0x15c)])!==undefined){const K=yield getAddons(h,v===null||v===void 0x0?void 0x0:v[w9(0x15c)]),{elements:g,nextPageCursor:J}=yield K();return{'choices':g,'defaultValue':I,'pagination':{'nextPageCursor':J,'loadMore':K}};}if(w===w9(0x150)&&(v===null||v===void 0x0?void 0x0:v['projectId'])!==undefined&&((D=P===null||P===void 0x0?void 0x0:P[w9(0x148)])===null||D===void 0x0?void 0x0:D[w9(0x16d)])!==undefined){const R=yield getAddonBackups(h,v===null||v===void 0x0?void 0x0:v[w9(0x15c)],(p=P===null||P===void 0x0?void 0x0:P[w9(0x148)])===null||p===void 0x0?void 0x0:p[w9(0x16d)]),{elements:N,nextPageCursor:z}=yield R();return{'choices':N,'defaultValue':I,'pagination':{'nextPageCursor':z,'loadMore':R}};}const b=(s=v===null||v===void 0x0?void 0x0:v[w9(0x16d)])!==null&&s!==void 0x0?s:(W=P===null||P===void 0x0?void 0x0:P[w9(0x13d)])===null||W===void 0x0?void 0x0:W[w9(0x16d)];if((G===null||G===void 0x0?void 0x0:G['join'](''))===w9(0x13c)&&w===w9(0x140)&&(v===null||v===void 0x0?void 0x0:v[w9(0x15c)])!==undefined&&b!==undefined){const {upgradeTo:F}=(yield h['get'][w9(0x152)][w9(0x140)]({'parameters':{'addonId':b,'projectId':v===null||v===void 0x0?void 0x0:v[w9(0x15c)]}}))[w9(0x155)];if(F===undefined||F['length']<=0x0){(0x0,utils_1[w9(0x174)])(w9(0x14d));throw new Error();}return{'choices':F[w9(0x14a)](o=>o[w9(0x140)]),'defaultValue':I};}if(w===w9(0x144)){const o=yield h[w9(0x16a)][w9(0x162)]({}),L=o[w9(0x155)]['templates'][w9(0x14a)](d=>d===null||d===void 0x0?void 0x0:d['id']);return{'choices':L,'defaultValue':I};}if(((G===null||G===void 0x0?void 0x0:G[w9(0x145)](w9(0x13b)))||(G===null||G===void 0x0?void 0x0:G[w9(0x145)](w9(0x142))))&&w==='keyName'&&b!==undefined&&(v===null||v===void 0x0?void 0x0:v[w9(0x15c)])!==undefined){const d=(yield h[w9(0x146)][w9(0x152)][w9(0x14e)]({'parameters':{'addonId':b,'projectId':v===null||v===void 0x0?void 0x0:v[w9(0x15c)]}}))[w9(0x155)];return{'choices':[...(X=Object[w9(0x139)](d===null||d===void 0x0?void 0x0:d['envs']))!==null&&X!==void 0x0?X:[],...(T=Object[w9(0x139)](d===null||d===void 0x0?void 0x0:d[w9(0x154)]))!==null&&T!==void 0x0?T:[]]};}}catch(w0){}return{'choices':undefined,'defaultValue':I};});}function a0w(){const wP=['addonTypes','secret','types','templateId','includes','get','backups','source','12OzEFjz','map','resources','internalId','No\x20available\x20versions\x20to\x20upgrade\x20to.','credentials','addons','backupId','plans','addon','logSink','secrets','data','__esModule','nextPageCursor','type','31372385fcwnFH','region','9752KjQcSP','projectId','versions','11609MMkUEP','7325220oZDRes','5FBxeQE','default','templates','111VmUUBP','6336HSuuLt','value','done','deploymentPlan','75860RomyLT','pagination','list','defineProperty','owningObject','addonId','fetchResourceList','regions','serviceId','__awaiter','options','projects','warning','./utils','services','then','storage','apply','keys','3456282DfWpch','secretLink','updateaddonversion','addonDependencies','170KvWUNr','756707JsArGB','version'];a0w=function(){return wP;};return a0w();}exports['fetchResourceList']=fetchResourceList;
1
+ 'use strict';function a0H(){const HZ=['8yfiXDE','version','get','throw','warning','resources','length','replicas','225yiAVQg','type','internalId','deploymentPlan','storage','done','keys','addonTypes','updateaddonversion','region','default','options','services','256908ajrRMZ','addonId','join','value','./utils','types','12463689ggrhho','includes','next','265516HhhBnZ','list','192556RQZBNV','fetchResourceList','secret','nextPageCursor','registryCredentials','secrets','versions','owningObject','secretLink','data','find','15nceheG','14567289EKTuZs','__awaiter','apply','addon','216800MpkLwP','projectId','1011216DLrkdv','serviceId','credentials','No\x20available\x20versions\x20to\x20upgrade\x20to.','addons','20WFYOyS','map','backups','regions','cursor','pagination','source','plans','templateId','logSink'];a0H=function(){return HZ;};return a0H();}const a0H2=a0k;(function(H,k){const H1=a0k,S=H();while(!![]){try{const W=parseInt(H1(0x13c))/0x1+-parseInt(H1(0x13a))/0x2+-parseInt(H1(0x131))/0x3*(-parseInt(H1(0x11c))/0x4)+-parseInt(H1(0x106))/0x5*(-parseInt(H1(0x10d))/0x6)+-parseInt(H1(0x137))/0x7+-parseInt(H1(0x10b))/0x8*(parseInt(H1(0x124))/0x9)+parseInt(H1(0x112))/0xa*(parseInt(H1(0x107))/0xb);if(W===k)break;else S['push'](S['shift']());}catch(Z){S['push'](S['shift']());}}}(a0H,0xe2611));function a0k(H,k){const S=a0H();return a0k=function(W,Z){W=W-0x102;let y=S[W];return y;},a0k(H,k);}var __awaiter=this&&this[a0H2(0x108)]||function(H,k,S,W){function Z(y){return y instanceof S?y:new S(function(O){O(y);});}return new(S||(S=Promise))(function(y,O){const H6=a0k;function b(r){const H3=a0k;try{j(W[H3(0x139)](r));}catch(V){O(V);}}function h(r){const H4=a0k;try{j(W[H4(0x11f)](r));}catch(V){O(V);}}function j(r){const H5=a0k;r[H5(0x129)]?y(r['value']):Z(r[H5(0x134)])['then'](b,h);}j((W=W[H6(0x109)](H,k||[]))[H6(0x139)]());});};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[a0H2(0x13d)]=void 0x0;const utils_1=require(a0H2(0x135)),defaultPaginationPageSize=0x32,getProjects=H=>k=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const H7=a0H2;var S;const W=yield H[H7(0x13b)]['projects']({'options':{'per_page':defaultPaginationPageSize,'cursor':k===null||k===void 0x0?void 0x0:k['nextPageCursor']}});return{'elements':W[H7(0x104)]['projects'][H7(0x113)](Z=>Z['id']),'nextPageCursor':(S=W[H7(0x117)])===null||S===void 0x0?void 0x0:S[H7(0x116)]};}),getServices=(H,k)=>S=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const H8=a0H2;var W;const Z=yield H[H8(0x13b)][H8(0x130)]({'parameters':{'projectId':k},'options':{'per_page':defaultPaginationPageSize,'cursor':S===null||S===void 0x0?void 0x0:S[H8(0x13f)]}});return{'elements':Z[H8(0x104)][H8(0x130)][H8(0x113)](y=>y['id']),'nextPageCursor':(W=Z['pagination'])===null||W===void 0x0?void 0x0:W[H8(0x116)]};}),getAddons=(H,k)=>S=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const H9=a0H2;var W;const Z=yield H[H9(0x13b)]['addons']({'parameters':{'projectId':k},'options':{'per_page':defaultPaginationPageSize,'cursor':S===null||S===void 0x0?void 0x0:S[H9(0x13f)]}});return{'elements':Z[H9(0x104)][H9(0x111)][H9(0x113)](y=>y['id']),'nextPageCursor':(W=Z[H9(0x117)])===null||W===void 0x0?void 0x0:W[H9(0x116)]};}),getAddonBackups=(H,k,S)=>W=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const HH=a0H2;var Z;const y=yield H[HH(0x11e)][HH(0x10a)][HH(0x114)]({'parameters':{'projectId':k,'addonId':S},'options':{'per_page':defaultPaginationPageSize,'cursor':W===null||W===void 0x0?void 0x0:W[HH(0x13f)]}});return{'elements':y[HH(0x104)]['backups']['map'](O=>O['id']),'nextPageCursor':(Z=y['pagination'])===null||Z===void 0x0?void 0x0:Z[HH(0x116)]};});function fetchResourceList(H,k,S,W,Z,y){var O,b,h,j,r,V,f,M,C,z,G,d;return __awaiter(this,void 0x0,void 0x0,function*(){const Hk=a0k,m=undefined;try{if(H===Hk(0x127)){const q=yield k[Hk(0x13b)][Hk(0x119)]({}),n=q[Hk(0x104)]['plans'][Hk(0x113)](v=>{var N;return(N=v===null||v===void 0x0?void 0x0:v['internalId'])!==null&&N!==void 0x0?N:v===null||v===void 0x0?void 0x0:v['id'];});return{'choices':n,'defaultValue':m};}if(H===Hk(0x12d)&&!(S===null||S===void 0x0?void 0x0:S[Hk(0x138)](Hk(0x11b)))){const v=yield k[Hk(0x13b)]['regions']({}),N=v[Hk(0x104)][Hk(0x115)][Hk(0x113)](i=>{const HS=Hk;var o;return(o=i===null||i===void 0x0?void 0x0:i[HS(0x126)])!==null&&o!==void 0x0?o:i===null||i===void 0x0?void 0x0:i['id'];});return{'choices':N,'defaultValue':m};}if(H==='projectId'){const i=yield getProjects(k),{elements:o,nextPageCursor:c}=yield i();return{'choices':o,'defaultValue':m,'pagination':{'nextPageCursor':c,'loadMore':i}};}if(H===Hk(0x10f)){const x=yield k[Hk(0x13b)][Hk(0x140)]({}),Y=x[Hk(0x104)][Hk(0x10f)][Hk(0x113)](R=>R['id']);return{'choices':Y,'defaultValue':m};}const U=Z===null||Z===void 0x0?void 0x0:Z[Hk(0x10c)],K=H===Hk(0x10e)||H==='id'&&(y===null||y===void 0x0?void 0x0:y[Hk(0x138)](Hk(0x102)));if(U!==undefined&&K){const R=yield getServices(k,U),{elements:g,nextPageCursor:F}=yield R();return{'choices':g,'defaultValue':m,'pagination':{'nextPageCursor':F,'loadMore':R}};}const l=S===null||S===void 0x0?void 0x0:S[Hk(0x138)](Hk(0x10a));if(l){const A=L=>__awaiter(this,void 0x0,void 0x0,function*(){const HW=Hk;var s;const a=yield k[HW(0x11e)][HW(0x10a)][HW(0x136)]({});return(s=a[HW(0x104)][HW(0x12b)])===null||s===void 0x0?void 0x0:s[HW(0x105)](T=>T['type']===L);});if(H===Hk(0x125)){const L=yield k[Hk(0x11e)][Hk(0x10a)][Hk(0x136)]({}),s=(O=L[Hk(0x104)][Hk(0x12b)])===null||O===void 0x0?void 0x0:O[Hk(0x113)](a=>a['type']);return{'choices':s,'defaultValue':m};}if(H===Hk(0x11d)&&(W===null||W===void 0x0?void 0x0:W[Hk(0x125)])!==undefined){const a=(b=yield A(W['type']))===null||b===void 0x0?void 0x0:b[Hk(0x142)];return{'choices':a,'defaultValue':m};}if(H===Hk(0x128)&&(W===null||W===void 0x0?void 0x0:W['type'])!==undefined){const T=(j=(h=yield A(W['type']))===null||h===void 0x0?void 0x0:h[Hk(0x121)])===null||j===void 0x0?void 0x0:j[Hk(0x128)];return{'choices':T===null||T===void 0x0?void 0x0:T[Hk(0x12f)],'defaultValue':T===null||T===void 0x0?void 0x0:T['default']};}if(H===Hk(0x123)&&(W===null||W===void 0x0?void 0x0:W[Hk(0x125)])!==undefined){const Q=(V=(r=yield A(W['type']))===null||r===void 0x0?void 0x0:r[Hk(0x121)])===null||V===void 0x0?void 0x0:V[Hk(0x123)];return{'choices':Q===null||Q===void 0x0?void 0x0:Q[Hk(0x12f)],'defaultValue':Q===null||Q===void 0x0?void 0x0:Q[Hk(0x12e)]};}}if(H===Hk(0x132)&&(Z===null||Z===void 0x0?void 0x0:Z[Hk(0x10c)])!==undefined){const u=yield getAddons(k,Z===null||Z===void 0x0?void 0x0:Z[Hk(0x10c)]),{elements:B,nextPageCursor:p}=yield u();return{'choices':B,'defaultValue':m,'pagination':{'nextPageCursor':p,'loadMore':u}};}if(H==='backupId'&&(Z===null||Z===void 0x0?void 0x0:Z[Hk(0x10c)])!==undefined&&((f=W===null||W===void 0x0?void 0x0:W[Hk(0x118)])===null||f===void 0x0?void 0x0:f[Hk(0x132)])!==undefined){const P=yield getAddonBackups(k,Z===null||Z===void 0x0?void 0x0:Z[Hk(0x10c)],(M=W===null||W===void 0x0?void 0x0:W[Hk(0x118)])===null||M===void 0x0?void 0x0:M['addonId']),{elements:E,nextPageCursor:D}=yield P();return{'choices':E,'defaultValue':m,'pagination':{'nextPageCursor':D,'loadMore':P}};}const J=(C=Z===null||Z===void 0x0?void 0x0:Z[Hk(0x132)])!==null&&C!==void 0x0?C:(z=W===null||W===void 0x0?void 0x0:W['addonDependencies'])===null||z===void 0x0?void 0x0:z[Hk(0x132)];if((S===null||S===void 0x0?void 0x0:S[Hk(0x133)](''))===Hk(0x12c)&&H===Hk(0x11d)&&(Z===null||Z===void 0x0?void 0x0:Z[Hk(0x10c)])!==undefined&&J!==undefined){const {upgradeTo:w}=(yield k[Hk(0x11e)]['addon']['version']({'parameters':{'addonId':J,'projectId':Z===null||Z===void 0x0?void 0x0:Z[Hk(0x10c)]}}))['data'];if(w===undefined||w[Hk(0x122)]<=0x0){(0x0,utils_1[Hk(0x120)])(Hk(0x110));throw new Error();}return{'choices':w[Hk(0x113)](t=>t[Hk(0x11d)]),'defaultValue':m};}if(H===Hk(0x11a)){const t=yield k[Hk(0x13b)]['templates']({}),I=t['data']['templates'][Hk(0x113)](X=>X===null||X===void 0x0?void 0x0:X['id']);return{'choices':I,'defaultValue':m};}if(((S===null||S===void 0x0?void 0x0:S['includes'](Hk(0x103)))||(S===null||S===void 0x0?void 0x0:S[Hk(0x138)](Hk(0x13e))))&&H==='keyName'&&J!==undefined&&(Z===null||Z===void 0x0?void 0x0:Z[Hk(0x10c)])!==undefined){const X=(yield k['get']['addon'][Hk(0x10f)]({'parameters':{'addonId':J,'projectId':Z===null||Z===void 0x0?void 0x0:Z[Hk(0x10c)]}}))['data'];return{'choices':[...(G=Object[Hk(0x12a)](X===null||X===void 0x0?void 0x0:X['envs']))!==null&&G!==void 0x0?G:[],...(d=Object[Hk(0x12a)](X===null||X===void 0x0?void 0x0:X[Hk(0x141)]))!==null&&d!==void 0x0?d:[]]};}}catch(H0){}return{'choices':undefined,'defaultValue':m};});}exports[a0H2(0x13d)]=fetchResourceList;
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';const a1wW=a1h;(function(w,h){const ws=a1h,G=w();while(!![]){try{const P=-parseInt(ws(0x2a7))/0x1+parseInt(ws(0x2b4))/0x2+parseInt(ws(0x1da))/0x3*(-parseInt(ws(0x29c))/0x4)+-parseInt(ws(0x1e2))/0x5+-parseInt(ws(0x233))/0x6*(-parseInt(ws(0x2a3))/0x7)+parseInt(ws(0x1f4))/0x8+parseInt(ws(0x230))/0x9;if(P===h)break;else G['push'](G['shift']());}catch(v){G['push'](G['shift']());}}}(a1w,0x2031a));var __createBinding=this&&this[a1wW(0x22d)]||(Object[a1wW(0x26a)]?function(w,h,G,P){const wX=a1wW;if(P===undefined)P=G;var v=Object[wX(0x25f)](h,G);(!v||('get'in v?!h[wX(0x1f6)]:v[wX(0x239)]||v[wX(0x23b)]))&&(v={'enumerable':!![],'get':function(){return h[G];}}),Object[wX(0x288)](w,P,v);}:function(w,h,G,P){if(P===undefined)P=G;w[P]=h[G];}),__setModuleDefault=this&&this[a1wW(0x279)]||(Object[a1wW(0x26a)]?function(w,h){const wT=a1wW;Object[wT(0x288)](w,wT(0x246),{'enumerable':!![],'value':h});}:function(w,h){const wI=a1wW;w[wI(0x246)]=h;}),__importStar=this&&this['__importStar']||function(w){const wk=a1wW;if(w&&w[wk(0x1f6)])return w;var h={};if(w!=null){for(var G in w)if(G!=='default'&&Object[wk(0x232)][wk(0x275)][wk(0x1ce)](w,G))__createBinding(h,w,G);}return __setModuleDefault(h,w),h;},__awaiter=this&&this[a1wW(0x237)]||function(w,h,G,v){function O(Z){return Z instanceof G?Z:new G(function(a){a(Z);});}return new(G||(G=Promise))(function(Z,a){const wb=a1h;function l(A){try{U(v['next'](A));}catch(D){a(D);}}function B(A){const wY=a1h;try{U(v[wY(0x258)](A));}catch(D){a(D);}}function U(A){const wx=a1h;A[wx(0x202)]?Z(A['value']):O(A[wx(0x262)])['then'](l,B);}U((v=v['apply'](w,h||[]))[wb(0x236)]());});},__importDefault=this&&this[a1wW(0x201)]||function(w){const wq=a1wW;return w&&w[wq(0x1f6)]?w:{'default':w};};Object['defineProperty'](exports,a1wW(0x1f6),{'value':!![]}),exports[a1wW(0x22b)]=void 0x0;const js_client_1=require(a1wW(0x20f)),commander_1=__importDefault(require(a1wW(0x289))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require('ajv')),chalk_1=__importDefault(require(a1wW(0x1d4))),_=__importStar(require(a1wW(0x2ab))),contextCommands_1=require(a1wW(0x224)),utils_1=require(a1wW(0x205)),defaults=__importStar(require(a1wW(0x1e4))),inquirer_helper_1=require(a1wW(0x280)),console_format_helpers_1=require(a1wW(0x23f)),command_overview_1=require('./formatting/command-overview'),port_forward_1=require(a1wW(0x1cf)),exec_1=require('./exec'),logs_1=require(a1wW(0x1dd)),metrics_1=require(a1wW(0x217)),yaml=require(a1wW(0x271)),pgk=require('../package.json'),getProgram=w=>{const wf=a1wW,h=new commander_1[(wf(0x246))][(wf(0x231))](wf(0x295));h[wf(0x1e9)](wf(0x2a6)),h['enablePositionalOptions'](!![]),h[wf(0x221)](wf(0x1d5)+chalk_1[wf(0x246)]['underline'](pgk[wf(0x221)]),wf(0x23e),'Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli');const G=new js_client_1[(wf(0x218))](w,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[wf(0x2bc)]}),P=new contextCommands_1['CliContext'](G),v=new port_forward_1['CliPortForward'](w),O=new exec_1[(wf(0x1d2))](w),Z=new logs_1[(wf(0x268))](w),a=new metrics_1[(wf(0x24d))](w);return h[wf(0x282)](v['portFwdCmd']),h[wf(0x282)](O[wf(0x1fc)]),h[wf(0x282)](P[wf(0x1cd)]),h[wf(0x282)](P[wf(0x244)]),generateCommands(G,G[wf(0x21f)],h,Z,a),h[wf(0x282)]((0x0,command_overview_1[wf(0x234)])(h)),h[wf(0x25e)](!![],'Display\x20help\x20for\x20command'),h['helpOption'](undefined,'Display\x20help\x20for\x20command'),h;};function a1w(){const wN=['error','askForTemplate','credential','serviceId','askForVolume','repo','.json','argv','aliases','repositories','northflank','length','askForTemplateRun','required','File\x20does\x20not\x20exist:\x20','file','status','1003188aysFOn','resource','name','askForProject','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','File\x20to\x20load\x20resource\x20json\x20from','\x20--','25501KMqtzO','opt','action','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','76923phFKIW','commands','/docs/v1/api/','option','lodash','url','bind','askForAddon','delete','details','isArray','domains','getCurrentJobName','362490POfsAS','runtimeFiles/additionalProperties','cursor','some','concat','isString','printAsTable','validate','customUserAgent','join','backups','invoices','ApiClientFileContextProvider','askConfirm','map','endsWith','update','login','call','./port-forward','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','branches','CliExec','volumes','chalk','Northflank\x20cli\x20version:\x20','secrets','getMetricsCommand','yaml','getCurrentProjectName','3EnpaZa','askForSecret','jobs','./logs','askForCredentials','exitCode','boolean','count','1270195BsuPWI','Get\x20information\x20about\x20Northflank\x20','./defaults','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','kebabCase','startsWith','retrievePayloadViaInteractiveCli','description','credentials','path','OPTIONAL:\x20','there\x20are\x20more\x20rows,\x20load?','cred','quiet','deleteWarningPrompt','brn','list','warning','165416Huwwoa','-i,\x20--input\x20<resource-def>','__esModule','jobId','readFileSync','existsSync','projects','set','execCmd','getCommand','output','plans','find','__importDefault','done','base','parseAsync','./utils','alias','custom-columns=','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','assign','asyncSequential','requiredPermissions','projectId','grey','keys','@northflank/js-client','askForPipeline','sort','verbose','getCurrentContext','toUpperCase','force','isEqual','./metrics','ApiClient','secret','askForLogSink','body','split','branch','pipelineId','endpoints','logSinkId','version','vol','addons','./context/contextCommands','templateRunId','askForJobRun','defaults','clearLine',',\x20NF\x20error\x20id:\x20','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','getProgram','askForAddonBackup','__createBinding','addonId','askForService','3785652jGVAZV','Command','prototype','150ikUsUF','getCommandOverview','entries','next','__awaiter','project','writable','repository','configurable','runId','query','-v,\x20--version','./formatting/console-format-helpers','domain','getOwnPropertyNames','getLogsCommand','addon','contexts','upperFirst','default','match\x20exactly\x20one\x20schema\x20in\x20oneOf','-f,\x20--file\x20<file-path>','pln','toString','errors','logs','CliMetrics','stdout','checkUpdate','templates','handleYamlOutput','VERBOSE:\x20Request\x20body\x20->\x20','backupId','askForBuild','stringify','opts','credentialId','throw','safeLoad','.yaml','addHelpText','log','askForSubdomain','addHelpCommand','getOwnPropertyDescriptor','yml','subdomain','value','contextProvider','parse','template','consoleFormat','askGeneric','CliLogs','volumeId','create','backup','docsTagsPath','prj','regions','=>\x20running\x20command\x20with:\x20','askForJob','js-yaml','\x20properties','forEach','has','hasOwnProperty','includes','Update\x20Northflank\x20','after','__setModuleDefault','adn','domainId','rgn','method','plan','get','./inquirer-helper','service','addCommand','buildId','message','job','secretId','json','defineProperty','commander','templateId'];a1w=function(){return wN;};return a1w();}exports[a1wW(0x22b)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const we=a1wW;try{const w=new js_client_1[(we(0x2c0))]();yield(0x0,utils_1[we(0x24f)])(w);const h=(0x0,exports[we(0x22b)])(w);yield h[we(0x204)](process[we(0x292)]);}catch(G){(0x0,utils_1[we(0x28b)])(we(0x2a0)+G[we(0x284)]),process[we(0x292)][we(0x200)](P=>P==='--verbose')&&console[we(0x25c)](G),process[we(0x1df)]=0x1;}}))());function a1h(w,h){const G=a1w();return a1h=function(P,v){P=P-0x1cd;let O=G[P];return O;},a1h(w,h);}function isListCommand(w){const wi=a1wW,h=[[wi(0x27f),wi(0x243),wi(0x2be)],['get',wi(0x285),'runs']];return w[wi(0x200)](G=>G===wi(0x1f2))||h[wi(0x2b7)](G=>_[wi(0x216)](w,G));}function generateCommands(w,h,G,P,v,O=defaults[a1wW(0x227)],Z=[]){const wu=a1wW,a=new inquirer_helper_1['InquirerHelper'](new js_client_1[(wu(0x218))](w[wu(0x263)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[wu(0x2bc)]}));function l(p,s){const wt=wu;return p[wt(0x298)]!==![]&&s===undefined;}function B(p,s){const wS=wu,{opt:W,name:X}=p,T=W['default'],I=l(W,T),k=e=>e[wS(0x296)]>0x1?'--'+e:'-'+e,Y=W===null||W===void 0x0?void 0x0:W[wS(0x206)],x=Y?_[wS(0x2b1)](Y)?'-'+(Y===null||Y===void 0x0?void 0x0:Y[wS(0x2c2)](e=>k(e))[wS(0x2bd)](',\x20-'))+',':''+k(Y):'',b=I?'':wS(0x1ec),q=typeof W['type']===wS(0x1e0)?x+wS(0x2a2)+X:x+wS(0x2a2)+X+'\x20<'+X[wS(0x214)]()+'>',f=b+W[wS(0x1e9)];s[wS(0x2aa)](q,f,T);}function U(p,s){const wV=wu;if(s[wV(0x2a8)][wV(0x2b7)](W=>W[wV(0x29e)]()===wV(0x24c)))return;_[wV(0x216)](p,[wV(0x27f),'service'])&&(s[wV(0x282)](P['getLogsCommand'](wV(0x281))),s[wV(0x282)](v[wV(0x1d7)]('service')),s[wV(0x282)](P[wV(0x242)]('service',!![])),s[wV(0x282)](v[wV(0x1d7)](wV(0x281),!![]))),_[wV(0x216)](p,['get','job'])&&(s['addCommand'](P[wV(0x242)](wV(0x285))),s['addCommand'](v[wV(0x1d7)](wV(0x285))),s[wV(0x282)](P[wV(0x242)](wV(0x285),!![])),s[wV(0x282)](v[wV(0x1d7)](wV(0x285),!![]))),_[wV(0x216)](p,[wV(0x27f),wV(0x243)])&&(s[wV(0x282)](P[wV(0x242)](wV(0x243))),s[wV(0x282)](v[wV(0x1d7)](wV(0x243)))),_[wV(0x216)](p,[wV(0x27f),wV(0x243),wV(0x26b)])&&s[wV(0x282)](P[wV(0x242)](wV(0x243),![],!![])),_[wV(0x216)](p,[wV(0x27f),'addon','restores'])&&s[wV(0x282)](P[wV(0x242)](wV(0x243),![],!![],!![]));}return Object[wu(0x241)](O)[wu(0x273)](p=>{const wC=wu,s=h[p],W=O[p],X=Z[wC(0x2b8)]([p]);function T(u,t){const wM=wC,S=Object['getOwnPropertyNames'](u||{});S['map'](V=>{return{'name':V,'opt':u[V]};})[wM(0x211)]((V,C)=>!l(V[wM(0x2a4)])?!l(C[wM(0x2a4)])?0x0:0x1:-0x1)[wM(0x273)](V=>{B(V,t);});}function I(u,t){const wQ=wC,S=[[wQ(0x238),wQ(0x1fa),wQ(0x26d)],[wQ(0x281),'services','svc'],[wQ(0x1ea),wQ(0x28d),wQ(0x1ee)],[wQ(0x243),wQ(0x223),wQ(0x27a)],[wQ(0x285),wQ(0x1dc)],[wQ(0x27e),wQ(0x1ff),wQ(0x249)],['region',wQ(0x26e),wQ(0x27c)],['domain',wQ(0x2b2),'dmn'],[wQ(0x219),wQ(0x1d6),'scrt'],[wQ(0x1d3),'volume',wQ(0x222)],[wQ(0x1d1),wQ(0x21d),wQ(0x1f1)],['invoice',wQ(0x2bf),'inv'],[wQ(0x265),wQ(0x250),'tpl'],['repos',wQ(0x23a),wQ(0x294),wQ(0x290)]],V=S[wQ(0x200)](C=>C[wQ(0x276)](t));if(V!==undefined)u[wQ(0x293)](V['filter'](C=>C!==t));}function k(u){var t,S;return __awaiter(this,void 0x0,void 0x0,function*(){const wH=a1h,V={},{contextProvider:C}=w,M=X[wH(0x276)](wH(0x2af)),Q=u['noDefaults']===!![];function H(n,c,r){var j,m;return __awaiter(this,void 0x0,void 0x0,function*(){const wn=a1h;if(_['has']((m=(j=W[wn(0x2a4)])===null||j===void 0x0?void 0x0:j[wn(0x1eb)])!==null&&m!==void 0x0?m:{},n)){const y=!Q&&!M&&r?r():undefined,E=u[n]||y||(yield c());_[wn(0x1fb)](V,n,E);}});}return yield(0x0,utils_1['asyncSequential'])(Object[wH(0x235)]((S=(t=W[wH(0x2a4)])===null||t===void 0x0?void 0x0:t['path'])!==null&&S!==void 0x0?S:{}),([n,c])=>__awaiter(this,void 0x0,void 0x0,function*(){const wc=wH,r=V===null||V===void 0x0?void 0x0:V[wc(0x20c)],j=V===null||V===void 0x0?void 0x0:V[wc(0x28a)];switch(n){case wc(0x20c):return yield H(wc(0x20c),a[wc(0x29f)][wc(0x2ad)](a),C[wc(0x1d9)]['bind'](C));case wc(0x28e):return yield H('serviceId',a[wc(0x22f)](r)[wc(0x2ad)](a),C['getCurrentServiceName']['bind'](C));case wc(0x22e):return yield H('addonId',a[wc(0x2ae)](r)[wc(0x2ad)](a));case wc(0x1f7):return yield H(wc(0x1f7),a[wc(0x270)](r)['bind'](a),C[wc(0x2b3)][wc(0x2ad)](C));case wc(0x23c):return yield H('runId',a[wc(0x226)](V[wc(0x1f7)],r,![])['bind'](a));case'secretId':return yield H(wc(0x286),a[wc(0x1db)](r)[wc(0x2ad)](a));case wc(0x240):case wc(0x27b):return yield H(wc(0x240),a['askForDomain'][wc(0x2ad)](a));case wc(0x257):return yield H(wc(0x257),a[wc(0x1de)]['bind'](a));case'volumeId':return yield H(wc(0x269),a[wc(0x28f)](r)['bind'](a));case wc(0x261):return yield H('subdomain',a[wc(0x25d)](V['domain'])['bind'](a));case'subdomainId':return yield H('subdomainId',a[wc(0x25d)](V['domainId'])[wc(0x2ad)](a));case'backupId':return yield H(wc(0x253),a[wc(0x22c)](r,V[wc(0x22e)])[wc(0x2ad)](a));case wc(0x283):return yield H(wc(0x283),a[wc(0x254)](r,V[wc(0x28e)],V[wc(0x1f7)])[wc(0x2ad)](a));case wc(0x28a):return yield H(wc(0x28a),a[wc(0x28c)]()[wc(0x2ad)](a));case'templateRunId':return yield H(wc(0x225),a[wc(0x297)](j)['bind'](a));case wc(0x220):return yield H(wc(0x220),a[wc(0x21a)]()['bind'](a));case wc(0x21e):return yield H(wc(0x21e),a[wc(0x210)](r)['bind'](a));default:return yield H(n,a[wc(0x267)](n,c===null||c===void 0x0?void 0x0:c[wc(0x1e9)])['bind'](a));}})),V;});}function Y(u){var t,S;return __awaiter(this,void 0x0,void 0x0,function*(){const wr=a1h,V={},C=Object[wr(0x20e)]((S=(t=W['opt'])===null||t===void 0x0?void 0x0:t[wr(0x23d)])!==null&&S!==void 0x0?S:{});return yield(0x0,utils_1[wr(0x20a)])(C,M=>__awaiter(this,void 0x0,void 0x0,function*(){const wj=wr;if(u[M]!==undefined)return u[M];const Q={},{required:H,schema:n}=W['opt'][wj(0x23d)][M];return yield a['propToType']([''+M],n,Q,H),Q[M]!==undefined&&_[wj(0x1fb)](V,M,Q[M]),Q;})),V;});}function x(){const wm=wC;switch(X[0x0]){case wm(0x27f):return wm(0x1e3)+(X[0x1]||wm(0x29d))+'s';case wm(0x2c4):return wm(0x277)+(X[0x1]||wm(0x29d))+wm(0x272);default:return _[wm(0x245)](p)+'\x20Northflank\x20resources';}}function b(u,t){const wy=wC;var S,V,C,M,Q,H;if(!t){const K=(0x0,utils_1[wy(0x1fd)])()[wy(0x29e)](_[wy(0x1e6)](p))[wy(0x1e9)](x());return I(K,p),K;}const n=(u===null||u===void 0x0?void 0x0:u[wy(0x20b)])?chalk_1[wy(0x246)][wy(0x20d)]('\x0a>\x20Token\x20permissions\x20required:\x20'+u[wy(0x20b)]):'',c=w[wy(0x263)][wy(0x213)](),r=c!==undefined&&((S=W===null||W===void 0x0?void 0x0:W['opt'])===null||S===void 0x0?void 0x0:S[wy(0x26c)])!==undefined,j=c===null||c===void 0x0?void 0x0:c['host']['replace']('api.',''),m=r?'Documentation:\x20'+j+wy(0x2a9)+((V=W===null||W===void 0x0?void 0x0:W[wy(0x2a4)])===null||V===void 0x0?void 0x0:V['docsTagsPath']):'',y=(u===null||u===void 0x0?void 0x0:u[wy(0x1e9)])||'',E=(0x0,utils_1['getCommand'])(!![])[wy(0x29e)](_[wy(0x1e6)](p))[wy(0x1e9)](y)[wy(0x25b)](wy(0x278),[n,m][wy(0x2bd)]('\x0a'));return I(E,p),((C=W[wy(0x2a4)])===null||C===void 0x0?void 0x0:C['body'])&&(E[wy(0x2aa)](wy(0x248),wy(0x2a1)),E[wy(0x2aa)](wy(0x1f5),wy(0x1d0))),T((M=W['opt'])===null||M===void 0x0?void 0x0:M['path'],E),T((Q=W['opt'])===null||Q===void 0x0?void 0x0:Q['query'],E),T((H=W['opt'])===null||H===void 0x0?void 0x0:H[wy(0x203)],E),E[wy(0x2a5)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const wE=wy;var g,J,R,N;(0x0,utils_1['assertContextExisting'])(w);const z=E[wE(0x256)](),F=z===null||z===void 0x0?void 0x0:z[wE(0x1fe)],o=F===wE(0x287),L=F===wE(0x1d8)||F===wE(0x260),d=yield k(z);a['setPathVars'](d);const w0=yield Y(z),w1=Object[wE(0x20e)]((J=(g=W['opt'])===null||g===void 0x0?void 0x0:g[wE(0x1eb)])!==null&&J!==void 0x0?J:{})['map'](w6=>w6+'='+chalk_1[wE(0x246)]['green'](d[w6]))[wE(0x2bd)](',\x20');if(w1[wE(0x296)]>0x0&&!o&&!L){const w6=wE(0x26f)+w1;console[wE(0x25c)](w6);}const w2=((R=W[wE(0x2a4)])===null||R===void 0x0?void 0x0:R[wE(0x21b)])?yield D(z,W,X):undefined;if(!z[wE(0x215)]&&X[wE(0x276)](wE(0x2af))&&!(yield a[wE(0x1f0)]())){(0x0,utils_1[wE(0x1f3)])('Resource\x20was\x20not\x20deleted.');return;}function w3(w7,w8=![],w9=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const wK=a1h,{data:ww,request:wh,error:wG,pagination:wP,rawResponse:wv}=yield s['call']({'parameters':d,'options':Object[wK(0x209)](Object['assign']({},w0),{'cursor':w7}),'data':w2});(z===null||z===void 0x0?void 0x0:z[wK(0x212)])&&(console['log']('VERBOSE:\x20Using\x20endpoint\x20->\x20'+wh[wK(0x27d)]+':'+wh[wK(0x2ac)]),console[wK(0x25c)](wK(0x252)+wh[wK(0x21b)]));if(wG){const wO=wG[wK(0x2b0)]?'\x0a\x09details\x20:'+JSON[wK(0x255)](wG[wK(0x2b0)]):'',wZ=(wG===null||wG===void 0x0?void 0x0:wG['id'])?wK(0x229)+wG['id']:'',wa='(HTTP\x20status\x20code:\x20'+wG[wK(0x29b)]+wZ+')';throw new Error('API\x20request\x20failed\x0a\x09Message:\x20'+wG[wK(0x284)]+'\x20'+wa+wO);}if(!(z===null||z===void 0x0?void 0x0:z[wK(0x1ef)])){if(o)(0x0,console_format_helpers_1['handleJsonOutput'])(z===null||z===void 0x0?void 0x0:z['output'],ww);else{if(L)(0x0,console_format_helpers_1[wK(0x251)])(z===null||z===void 0x0?void 0x0:z[wK(0x1fe)],ww);else{if(isListCommand(X)){const wl=(F===null||F===void 0x0?void 0x0:F[wK(0x1e7)]('custom-columns='))?F['replace'](wK(0x207),'')[wK(0x21c)](',')[wK(0x2c2)](wp=>wp['toLowerCase']()):undefined,wB=X[X[wK(0x296)]-0x1],wU=''+wB+(wB[wK(0x2c3)]('s')?'':'s'),wA=_[wK(0x245)](wU),wD=_[wK(0x274)](ww,wU)?ww[wU]:ww;(0x0,console_format_helpers_1[wK(0x2ba)])(wD,wA,wl,w8,w9);}else console[wK(0x25c)]((0x0,console_format_helpers_1[wK(0x266)])(ww,wv['status']));}}}return wP;});}let w4=yield w3(),w5=0x0;if(!z['quiet']&&(w4===null||w4===void 0x0?void 0x0:w4[wE(0x2b6)]))while(w4[wE(0x2b6)]){const w7=yield a[wE(0x2c1)](wE(0x1ed));w7&&(process['stdout']['moveCursor'](0x0,-0x1),process[wE(0x24e)][wE(0x228)](0x1),w5+=(N=w4[wE(0x1e1)])!==null&&N!==void 0x0?N:0x0,w4=yield w3(w4[wE(0x2b6)],!![],w5));}})),E;}const q=_['has'](W,wC(0x2a4)),f=s,e=b(f,q);U(X,e),G[wC(0x282)](e);const i=_['omit'](W,wC(0x2a4));Object[wC(0x20e)](i)[wC(0x296)]>0x0&&generateCommands(w,s,e,P,v,i,X);});function A(p,s,W){return __awaiter(this,void 0x0,void 0x0,function*(){const wg=a1h,{input:X,file:T}=p;if(X!==undefined)try{return JSON[wg(0x264)](X);}catch(I){try{return yaml[wg(0x259)](X);}catch(k){throw new Error(wg(0x208));}}if(T!==undefined){if(!fs_1[wg(0x246)][wg(0x1f9)](T))throw new Error(wg(0x299)+T);const Y=fs_1[wg(0x246)][wg(0x1f8)](T)[wg(0x24a)]();let x;try{if(_[wg(0x2b9)](Y)){if(p[wg(0x29a)][wg(0x2c3)](wg(0x291)))x=JSON['parse'](Y);else{if(p[wg(0x29a)]['endsWith'](wg(0x25a))||p['file'][wg(0x2c3)]('yml'))x=yaml[wg(0x259)](Y);else throw new Error('Unknown\x20input\x20file\x20type:\x20'+p[wg(0x29a)]['split']('.')['pop']());}}else x=Y;return x;}catch(b){throw new Error(wg(0x22a)+b['message']);}}return yield a[wg(0x1e8)](s,{'cmdPath':W});});}function D(p,s,W){var X;return __awaiter(this,void 0x0,void 0x0,function*(){const wJ=a1h,T=yield A(p,s,W),I=new ajv_1[(wJ(0x246))]({'allErrors':!![],'keywords':['example'],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let k=![];try{k=I[wJ(0x2bb)](s['opt'][wJ(0x21b)],T);}catch(x){if(x[wJ(0x284)]['includes'](wJ(0x2b5)))k=!![];else throw x;}const Y=(X=I===null||I===void 0x0?void 0x0:I['errors'])===null||X===void 0x0?void 0x0:X['filter'](b=>{const wR=wJ;var q;return!((q=b===null||b===void 0x0?void 0x0:b[wR(0x284)])===null||q===void 0x0?void 0x0:q[wR(0x276)](wR(0x247)));});if(!k&&Y!==undefined&&(Y===null||Y===void 0x0?void 0x0:Y['length'])>0x0)throw new Error(wJ(0x1e5)+JSON[wJ(0x255)](I[wJ(0x24b)],null,'\x20'));return T;});}}
2
+ 'use strict';function a1H(){const HE=['JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','action','3171870evrWxy','askForBuild','existsSync','domain','lodash','js-yaml','resource','portFwdCmd','130422AoOpBY','stdout','force','askForService','required','__createBinding','file','jobId','branches','\x0a\x09details\x20:','Documentation:\x20','templateId','contextProvider','pln','credentialId','name','subdomain','./exec','vol','asyncSequential','call','service','inv','projects','askForPipeline','docsTagsPath','pipelineId','services','enablePositionalOptions','helpOption','=>\x20running\x20command\x20with:\x20','adn','getProgram','length','plan','/docs/v1/api/','warning','volumes','\x20--','isArray','runId','-i,\x20--input\x20<resource-def>','handleYamlOutput','update','omit','File\x20does\x20not\x20exist:\x20','3wdEbFG','.yaml','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','./context/contextCommands','invoice','exitCode','list','error','regions','getCommandOverview','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','getOwnPropertyNames','split','CliExec','templateRunId','logs','type','tpl','alias','repositories','consoleFormat','\x20properties','1031148sZpIWF','some','deleteWarningPrompt','grey','kebabCase','addHelpCommand','8460801xPPVRO','checkUpdate','endpoints','9912vlxYwk','argv','url','default','prj','writable','askForSecret','backup','(HTTP\x20status\x20code:\x20','keys','concat','count','commander','Unknown\x20input\x20file\x20type:\x20','__esModule','forEach','File\x20to\x20load\x20resource\x20json\x20from','body','entries','@northflank/js-client','assertContextExisting','chalk','output','isEqual','addon','sort','API\x20request\x20failed\x0a\x09Message:\x20','105nGjLHx','ajv','buildId','safeLoad','askGeneric','stringify','OPTIONAL:\x20','retrievePayloadViaInteractiveCli','example','there\x20are\x20more\x20rows,\x20load?','\x0a>\x20Token\x20permissions\x20required:\x20','.json','value','838726jlEqcq','repo','templates','volume','errors','askForJob','get','Update\x20Northflank\x20','./inquirer-helper','requiredPermissions','yml','InquirerHelper','./formatting/console-format-helpers','map','domainId','cred','login','query','filter','endsWith','askForAddon','cursor','job','path','Resource\x20was\x20not\x20deleted.','getCurrentProjectName','apply','message','runtimeFiles/additionalProperties','addons','__importDefault','green','ApiClientFileContextProvider','base','throw','customUserAgent','addonId','printAsTable','VERBOSE:\x20Request\x20body\x20->\x20','upperFirst','includes','serviceId','1365cVPsvX','dmn','getLogsCommand','logSinkId','next','description','jobs','setPathVars','details','delete','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','quiet','askForTemplate','askConfirm','opt','subdomainId','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','create','repository','getCurrentServiceName','toUpperCase','3187984EJXQol','-f,\x20--file\x20<file-path>','hasOwnProperty','json','projectId','addCommand','./defaults','Northflank\x20cli\x20version:\x20','credential','-v,\x20--version','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','join','propToType','askForSubdomain','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','Get\x20information\x20about\x20Northflank\x20','rgn','isString','__setModuleDefault','option','./utils','secretId','defaults','aliases','verbose','ApiClient','__importStar','bind','backups','getOwnPropertyDescriptor','plans','api.','commands','branch','askForTemplateRun','startsWith','underline','./formatting/command-overview','runs','opts','Command','toString','find','getCommand','match\x20exactly\x20one\x20schema\x20in\x20oneOf','version','region','parse','Display\x20help\x20for\x20command','replace','validate','assign',',\x20-','getMetricsCommand','log','toLowerCase','defineProperty','CliPortForward','status','brn','backupId'];a1H=function(){return HE;};return a1H();}const a1Hz=a1k;(function(H,k){const HC=a1k,S=H();while(!![]){try{const W=-parseInt(HC(0x15b))/0x1+parseInt(HC(0x12a))/0x2+parseInt(HC(0x114))/0x3*(parseInt(HC(0x9f))/0x4)+-parseInt(HC(0x14e))/0x5*(-parseInt(HC(0xe6))/0x6)+parseInt(HC(0x8a))/0x7*(parseInt(HC(0x133))/0x8)+-parseInt(HC(0x130))/0x9+parseInt(HC(0xde))/0xa;if(W===k)break;else S['push'](S['shift']());}catch(Z){S['push'](S['shift']());}}}(a1H,0x860a0));var __createBinding=this&&this[a1Hz(0xeb)]||(Object['create']?function(H,S,W,Z){const HG=a1Hz;if(Z===undefined)Z=W;var y=Object[HG(0xbc)](S,W);(!y||(HG(0x66)in y?!S[HG(0x141)]:y[HG(0x138)]||y['configurable']))&&(y={'enumerable':!![],'get':function(){return S[W];}}),Object[HG(0xd7)](H,Z,y);}:function(H,S,W,Z){if(Z===undefined)Z=W;H[Z]=S[W];}),__setModuleDefault=this&&this[a1Hz(0xb1)]||(Object[a1Hz(0x9b)]?function(H,k){const Hd=a1Hz;Object[Hd(0xd7)](H,Hd(0x136),{'enumerable':!![],'value':k});}:function(H,k){const He=a1Hz;H[He(0x136)]=k;}),__importStar=this&&this[a1Hz(0xb9)]||function(H){const Hm=a1Hz;if(H&&H['__esModule'])return H;var S={};if(H!=null){for(var W in H)if(W!==Hm(0x136)&&Object['prototype'][Hm(0xa1)][Hm(0xfa)](H,W))__createBinding(S,H,W);}return __setModuleDefault(S,H),S;},__awaiter=this&&this['__awaiter']||function(H,k,S,W){function Z(y){return y instanceof S?y:new S(function(O){O(y);});}return new(S||(S=Promise))(function(y,O){const Hl=a1k;function b(r){try{j(W['next'](r));}catch(V){O(V);}}function h(r){const HU=a1k;try{j(W[HU(0x82)](r));}catch(V){O(V);}}function j(r){const HK=a1k;r['done']?y(r[HK(0x15a)]):Z(r[HK(0x15a)])['then'](b,h);}j((W=W[Hl(0x7a)](H,k||[]))[Hl(0x8e)]());});},__importDefault=this&&this[a1Hz(0x7e)]||function(H){const HJ=a1Hz;return H&&H[HJ(0x141)]?H:{'default':H};};Object[a1Hz(0xd7)](exports,'__esModule',{'value':!![]}),exports[a1Hz(0x106)]=void 0x0;const js_client_1=require(a1Hz(0x146)),commander_1=__importDefault(require(a1Hz(0x13f))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require(a1Hz(0x14f))),chalk_1=__importDefault(require(a1Hz(0x148))),_=__importStar(require(a1Hz(0xe2))),contextCommands_1=require(a1Hz(0x117)),utils_1=require(a1Hz(0xb3)),defaults=__importStar(require(a1Hz(0xa5))),inquirer_helper_1=require(a1Hz(0x68)),console_format_helpers_1=require(a1Hz(0x6c)),command_overview_1=require(a1Hz(0xc4)),port_forward_1=require('./port-forward'),exec_1=require(a1Hz(0xf7)),logs_1=require('./logs'),metrics_1=require('./metrics'),yaml=require(a1Hz(0xe3)),pgk=require('../package.json'),getProgram=H=>{const Hq=a1Hz,k=new commander_1[(Hq(0x136))][(Hq(0xc7))]('northflank');k['description'](Hq(0x11e)),k[Hq(0x102)](!![]),k[Hq(0xcc)](Hq(0xa6)+chalk_1[Hq(0x136)][Hq(0xc3)](pgk[Hq(0xcc)]),Hq(0xa8),Hq(0xa9));const S=new js_client_1['ApiClient'](H,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[Hq(0x83)]}),W=new contextCommands_1['CliContext'](S),Z=new port_forward_1[(Hq(0xd8))](H),y=new exec_1[(Hq(0x121))](H),O=new logs_1['CliLogs'](H),b=new metrics_1['CliMetrics'](H);return k[Hq(0xa4)](Z[Hq(0xe5)]),k['addCommand'](y['execCmd']),k[Hq(0xa4)](W[Hq(0x70)]),k[Hq(0xa4)](W['contexts']),generateCommands(S,S[Hq(0x132)],k,O,b),k[Hq(0xa4)]((0x0,command_overview_1[Hq(0x11d)])(k)),k[Hq(0x12f)](!![],'Display\x20help\x20for\x20command'),k[Hq(0x103)](undefined,Hq(0xcf)),k;};function a1k(H,k){const S=a1H();return a1k=function(W,Z){W=W-0x65;let y=S[W];return y;},a1k(H,k);}exports[a1Hz(0x106)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Hn=a1Hz;try{const H=new js_client_1[(Hn(0x80))]();yield(0x0,utils_1[Hn(0x131)])(H);const k=(0x0,exports[Hn(0x106)])(H);yield k['parseAsync'](process[Hn(0x134)]);}catch(S){(0x0,utils_1[Hn(0x11b)])(Hn(0x9a)+S[Hn(0x7b)]),process[Hn(0x134)][Hn(0xc9)](W=>W==='--verbose')&&console[Hn(0xd5)](S),process[Hn(0x119)]=0x1;}}))());function isListCommand(H){const Hv=a1Hz,k=[[Hv(0x66),Hv(0x14b),Hv(0xbb)],[Hv(0x66),Hv(0x76),Hv(0xc5)]];return H[Hv(0xc9)](S=>S===Hv(0x11a))||k[Hv(0x12b)](S=>_[Hv(0x14a)](H,S));}function generateCommands(H,k,S,W,Z,y=defaults[a1Hz(0xb5)],O=[]){const HN=a1Hz,b=new inquirer_helper_1[(HN(0x6b))](new js_client_1[(HN(0xb8))](H[HN(0xf2)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[HN(0x83)]}));function h(M,C){const Hi=HN;return M[Hi(0xea)]!==![]&&C===undefined;}function j(M,C){const Ho=HN,{opt:z,name:G}=M,d=z[Ho(0x136)],e=h(z,d),m=n=>n[Ho(0x107)]>0x1?'--'+n:'-'+n,U=z===null||z===void 0x0?void 0x0:z[Ho(0x126)],K=U?_[Ho(0x10d)](U)?'-'+(U===null||U===void 0x0?void 0x0:U[Ho(0x6d)](n=>m(n))[Ho(0xaa)](Ho(0xd3)))+',':''+m(U):'',l=e?'':Ho(0x154),J=typeof z[Ho(0x124)]==='boolean'?K+Ho(0x10c)+G:K+Ho(0x10c)+G+'\x20<'+G[Ho(0x9e)]()+'>',q=l+z[Ho(0x8f)];C[Ho(0xb2)](J,q,d);}function r(M,C){const Hc=HN;if(C[Hc(0xbf)][Hc(0x12b)](z=>z[Hc(0xf5)]()===Hc(0x123)))return;_[Hc(0x14a)](M,[Hc(0x66),Hc(0xfb)])&&(C[Hc(0xa4)](W[Hc(0x8c)](Hc(0xfb))),C[Hc(0xa4)](Z[Hc(0xd4)](Hc(0xfb))),C['addCommand'](W[Hc(0x8c)](Hc(0xfb),!![])),C[Hc(0xa4)](Z[Hc(0xd4)]('service',!![]))),_[Hc(0x14a)](M,['get','job'])&&(C[Hc(0xa4)](W[Hc(0x8c)](Hc(0x76))),C[Hc(0xa4)](Z[Hc(0xd4)](Hc(0x76))),C['addCommand'](W['getLogsCommand']('job',!![])),C[Hc(0xa4)](Z[Hc(0xd4)](Hc(0x76),!![]))),_['isEqual'](M,[Hc(0x66),Hc(0x14b)])&&(C[Hc(0xa4)](W[Hc(0x8c)](Hc(0x14b))),C['addCommand'](Z[Hc(0xd4)](Hc(0x14b)))),_[Hc(0x14a)](M,[Hc(0x66),Hc(0x14b),Hc(0x13a)])&&C[Hc(0xa4)](W[Hc(0x8c)](Hc(0x14b),![],!![])),_[Hc(0x14a)](M,[Hc(0x66),Hc(0x14b),'restores'])&&C['addCommand'](W['getLogsCommand'](Hc(0x14b),![],!![],!![]));}return Object[HN(0x11f)](y)[HN(0x142)](M=>{const Hx=HN,C=k[M],z=y[M],G=O[Hx(0x13d)]([M]);function d(N,i){const HY=Hx,o=Object[HY(0x11f)](N||{});o['map'](c=>{return{'name':c,'opt':N[c]};})[HY(0x14c)]((c,x)=>!h(c[HY(0x98)])?!h(x[HY(0x98)])?0x0:0x1:-0x1)['forEach'](c=>{j(c,i);});}function e(N,i){const HR=Hx,o=[['project',HR(0xfd),HR(0x137)],[HR(0xfb),HR(0x101),'svc'],['credentials',HR(0xa7),HR(0x6f)],['addon',HR(0x7d),HR(0x105)],[HR(0x76),HR(0x90)],[HR(0x108),HR(0xbd),HR(0xf3)],[HR(0xcd),HR(0x11c),HR(0xaf)],[HR(0xe1),'domains',HR(0x8b)],['secret','secrets','scrt'],[HR(0x10b),HR(0x15e),HR(0xf8)],[HR(0xee),HR(0xc0),HR(0xda)],[HR(0x118),'invoices',HR(0xfc)],['template',HR(0x15d),HR(0x125)],['repos',HR(0x9c),HR(0x127),HR(0x15c)]],c=o[HR(0xc9)](x=>x[HR(0x88)](i));if(c!==undefined)N[HR(0xb6)](c[HR(0x72)](x=>x!==i));}function m(N){var i,o;return __awaiter(this,void 0x0,void 0x0,function*(){const Hg=a1k,c={},{contextProvider:x}=H,Y=G[Hg(0x88)](Hg(0x93)),R=N['noDefaults']===!![];function g(F,A,L){var s,a;return __awaiter(this,void 0x0,void 0x0,function*(){const HF=a1k;if(_['has']((a=(s=z[HF(0x98)])===null||s===void 0x0?void 0x0:s[HF(0x77)])!==null&&a!==void 0x0?a:{},F)){const T=!R&&!Y&&L?L():undefined,Q=N[F]||T||(yield A());_['set'](c,F,Q);}});}return yield(0x0,utils_1['asyncSequential'])(Object[Hg(0x145)]((o=(i=z[Hg(0x98)])===null||i===void 0x0?void 0x0:i[Hg(0x77)])!==null&&o!==void 0x0?o:{}),([F,A])=>__awaiter(this,void 0x0,void 0x0,function*(){const HA=Hg,L=c===null||c===void 0x0?void 0x0:c[HA(0xa3)],s=c===null||c===void 0x0?void 0x0:c['templateId'];switch(F){case HA(0xa3):return yield g(HA(0xa3),b['askForProject'][HA(0xba)](b),x[HA(0x79)]['bind'](x));case'serviceId':return yield g(HA(0x89),b[HA(0xe9)](L)[HA(0xba)](b),x[HA(0x9d)]['bind'](x));case HA(0x84):return yield g('addonId',b[HA(0x74)](L)[HA(0xba)](b));case'jobId':return yield g('jobId',b[HA(0x65)](L)['bind'](b),x['getCurrentJobName'][HA(0xba)](x));case HA(0x10e):return yield g(HA(0x10e),b['askForJobRun'](c[HA(0xed)],L,![])[HA(0xba)](b));case HA(0xb4):return yield g(HA(0xb4),b[HA(0x139)](L)[HA(0xba)](b));case HA(0xe1):case'domainId':return yield g('domain',b['askForDomain']['bind'](b));case HA(0xf4):return yield g('credentialId',b['askForCredentials'][HA(0xba)](b));case'volumeId':return yield g('volumeId',b['askForVolume'](L)[HA(0xba)](b));case HA(0xf6):return yield g(HA(0xf6),b[HA(0xac)](c[HA(0xe1)])[HA(0xba)](b));case HA(0x99):return yield g(HA(0x99),b[HA(0xac)](c[HA(0x6e)])[HA(0xba)](b));case HA(0xdb):return yield g(HA(0xdb),b['askForAddonBackup'](L,c[HA(0x84)])[HA(0xba)](b));case HA(0x150):return yield g('buildId',b[HA(0xdf)](L,c['serviceId'],c['jobId'])[HA(0xba)](b));case HA(0xf1):return yield g(HA(0xf1),b[HA(0x96)]()[HA(0xba)](b));case HA(0x122):return yield g(HA(0x122),b[HA(0xc1)](s)['bind'](b));case'logSinkId':return yield g(HA(0x8d),b['askForLogSink']()[HA(0xba)](b));case'pipelineId':return yield g(HA(0x100),b[HA(0xfe)](L)[HA(0xba)](b));default:return yield g(F,b[HA(0x152)](F,A===null||A===void 0x0?void 0x0:A[HA(0x8f)])[HA(0xba)](b));}})),c;});}function U(N){var i,o;return __awaiter(this,void 0x0,void 0x0,function*(){const HL=a1k,c={},x=Object[HL(0x13c)]((o=(i=z[HL(0x98)])===null||i===void 0x0?void 0x0:i[HL(0x71)])!==null&&o!==void 0x0?o:{});return yield(0x0,utils_1[HL(0xf9)])(x,Y=>__awaiter(this,void 0x0,void 0x0,function*(){const Hs=HL;if(N[Y]!==undefined)return N[Y];const R={},{required:g,schema:F}=z[Hs(0x98)][Hs(0x71)][Y];return yield b[Hs(0xab)]([''+Y],F,R,g),R[Y]!==undefined&&_['set'](c,Y,R[Y]),R;})),c;});}function K(){const Ha=Hx;switch(G[0x0]){case Ha(0x66):return Ha(0xae)+(G[0x1]||Ha(0xe4))+'s';case Ha(0x111):return Ha(0x67)+(G[0x1]||Ha(0xe4))+Ha(0x129);default:return _[Ha(0x87)](M)+'\x20Northflank\x20resources';}}function l(N,i){const HT=Hx;var o,c,x,Y,R,g;if(!i){const u=(0x0,utils_1[HT(0xca)])()['name'](_[HT(0x12e)](M))[HT(0x8f)](K());return e(u,M),u;}const F=(N===null||N===void 0x0?void 0x0:N[HT(0x69)])?chalk_1['default'][HT(0x12d)](HT(0x158)+N[HT(0x69)]):'',A=H[HT(0xf2)]['getCurrentContext'](),L=A!==undefined&&((o=z===null||z===void 0x0?void 0x0:z[HT(0x98)])===null||o===void 0x0?void 0x0:o[HT(0xff)])!==undefined,s=A===null||A===void 0x0?void 0x0:A['host'][HT(0xd0)](HT(0xbe),''),a=L?HT(0xf0)+s+HT(0x109)+((c=z===null||z===void 0x0?void 0x0:z[HT(0x98)])===null||c===void 0x0?void 0x0:c['docsTagsPath']):'',T=(N===null||N===void 0x0?void 0x0:N[HT(0x8f)])||'',Q=(0x0,utils_1[HT(0xca)])(!![])[HT(0xf5)](_['kebabCase'](M))['description'](T)['addHelpText']('after',[F,a][HT(0xaa)]('\x0a'));return e(Q,M),((x=z[HT(0x98)])===null||x===void 0x0?void 0x0:x['body'])&&(Q['option'](HT(0xa0),HT(0x143)),Q[HT(0xb2)](HT(0x10f),HT(0xdc))),d((Y=z[HT(0x98)])===null||Y===void 0x0?void 0x0:Y[HT(0x77)],Q),d((R=z[HT(0x98)])===null||R===void 0x0?void 0x0:R['query'],Q),d((g=z[HT(0x98)])===null||g===void 0x0?void 0x0:g[HT(0x81)],Q),Q[HT(0xdd)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const HQ=HT;var B,p,P,E;(0x0,utils_1[HQ(0x147)])(H);const D=Q[HQ(0xc6)](),w=D===null||D===void 0x0?void 0x0:D[HQ(0x149)],t=w===HQ(0xa2),I=w==='yaml'||w===HQ(0x6a),X=yield m(D);b[HQ(0x91)](X);const H0=yield U(D),H1=Object[HQ(0x13c)]((p=(B=z[HQ(0x98)])===null||B===void 0x0?void 0x0:B[HQ(0x77)])!==null&&p!==void 0x0?p:{})['map'](H6=>H6+'='+chalk_1[HQ(0x136)][HQ(0x7f)](X[H6]))[HQ(0xaa)](',\x20');if(H1[HQ(0x107)]>0x0&&!t&&!I){const H6=HQ(0x104)+H1;console[HQ(0xd5)](H6);}const H2=((P=z[HQ(0x98)])===null||P===void 0x0?void 0x0:P[HQ(0x144)])?yield f(D,z,G):undefined;if(!D[HQ(0xe8)]&&G['includes'](HQ(0x93))&&!(yield b[HQ(0x12c)]())){(0x0,utils_1[HQ(0x10a)])(HQ(0x78));return;}function H3(H7,H8=![],H9=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const Hu=a1k,{data:HH,request:Hk,error:HS,pagination:HW,rawResponse:HZ}=yield C[Hu(0xfa)]({'parameters':X,'options':Object['assign'](Object[Hu(0xd2)]({},H0),{'cursor':H7}),'data':H2});(D===null||D===void 0x0?void 0x0:D[Hu(0xb7)])&&(console[Hu(0xd5)]('VERBOSE:\x20Using\x20endpoint\x20->\x20'+Hk['method']+':'+Hk[Hu(0x135)]),console[Hu(0xd5)](Hu(0x86)+Hk[Hu(0x144)]));if(HS){const Hy=HS[Hu(0x92)]?Hu(0xef)+JSON[Hu(0x153)](HS['details']):'',HO=(HS===null||HS===void 0x0?void 0x0:HS['id'])?',\x20NF\x20error\x20id:\x20'+HS['id']:'',Hb=Hu(0x13b)+HS[Hu(0xd9)]+HO+')';throw new Error(Hu(0x14d)+HS[Hu(0x7b)]+'\x20'+Hb+Hy);}if(!(D===null||D===void 0x0?void 0x0:D[Hu(0x95)])){if(t)(0x0,console_format_helpers_1['handleJsonOutput'])(D===null||D===void 0x0?void 0x0:D['output'],HH);else{if(I)(0x0,console_format_helpers_1[Hu(0x110)])(D===null||D===void 0x0?void 0x0:D[Hu(0x149)],HH);else{if(isListCommand(G)){const Hh=(w===null||w===void 0x0?void 0x0:w[Hu(0xc2)]('custom-columns='))?w[Hu(0xd0)]('custom-columns=','')[Hu(0x120)](',')['map'](HM=>HM[Hu(0xd6)]()):undefined,Hj=G[G['length']-0x1],Hr=''+Hj+(Hj[Hu(0x73)]('s')?'':'s'),HV=_['upperFirst'](Hr),Hf=_['has'](HH,Hr)?HH[Hr]:HH;(0x0,console_format_helpers_1[Hu(0x85)])(Hf,HV,Hh,H8,H9);}else console[Hu(0xd5)]((0x0,console_format_helpers_1[Hu(0x128)])(HH,HZ['status']));}}}return HW;});}let H4=yield H3(),H5=0x0;if(!D[HQ(0x95)]&&(H4===null||H4===void 0x0?void 0x0:H4['cursor']))while(H4['cursor']){const H7=yield b[HQ(0x97)](HQ(0x157));H7&&(process[HQ(0xe7)]['moveCursor'](0x0,-0x1),process[HQ(0xe7)]['clearLine'](0x1),H5+=(E=H4[HQ(0x13e)])!==null&&E!==void 0x0?E:0x0,H4=yield H3(H4[HQ(0x75)],!![],H5));}})),Q;}const J=_['has'](z,Hx(0x98)),q=C,n=l(q,J);r(G,n),S[Hx(0xa4)](n);const v=_[Hx(0x112)](z,Hx(0x98));Object[Hx(0x13c)](v)[Hx(0x107)]>0x0&&generateCommands(H,C,n,W,Z,v,G);});function V(M,C,z){return __awaiter(this,void 0x0,void 0x0,function*(){const HB=a1k,{input:G,file:m}=M;if(G!==undefined)try{return JSON[HB(0xce)](G);}catch(U){try{return yaml[HB(0x151)](G);}catch(K){throw new Error(HB(0x116));}}if(m!==undefined){if(!fs_1[HB(0x136)][HB(0xe0)](m))throw new Error(HB(0x113)+m);const l=fs_1[HB(0x136)]['readFileSync'](m)[HB(0xc8)]();let J;try{if(_[HB(0xb0)](l)){if(M[HB(0xec)][HB(0x73)](HB(0x159)))J=JSON['parse'](l);else{if(M[HB(0xec)]['endsWith'](HB(0x115))||M[HB(0xec)][HB(0x73)](HB(0x6a)))J=yaml[HB(0x151)](l);else throw new Error(HB(0x140)+M[HB(0xec)][HB(0x120)]('.')['pop']());}}else J=l;return J;}catch(q){throw new Error(HB(0xad)+q[HB(0x7b)]);}}return yield b[HB(0x155)](C,{'cmdPath':z});});}function f(M,C,z){var G;return __awaiter(this,void 0x0,void 0x0,function*(){const Hp=a1k,d=yield V(M,C,z),m=new ajv_1[(Hp(0x136))]({'allErrors':!![],'keywords':[Hp(0x156)],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let U=![];try{U=m[Hp(0xd1)](C[Hp(0x98)][Hp(0x144)],d);}catch(l){if(l[Hp(0x7b)]['includes'](Hp(0x7c)))U=!![];else throw l;}const K=(G=m===null||m===void 0x0?void 0x0:m['errors'])===null||G===void 0x0?void 0x0:G[Hp(0x72)](J=>{const HP=Hp;var q;return!((q=J===null||J===void 0x0?void 0x0:J['message'])===null||q===void 0x0?void 0x0:q[HP(0x88)](HP(0xcb)));});if(!U&&K!==undefined&&(K===null||K===void 0x0?void 0x0:K[Hp(0x107)])>0x0)throw new Error(Hp(0x94)+JSON['stringify'](m[Hp(0x15f)],null,'\x20'));return d;});}}
@@ -1 +1 @@
1
- 'use strict';const a2I=a2h;function a2h(w,h){const G=a2w();return a2h=function(P,v){P=P-0x14e;let O=G[P];return O;},a2h(w,h);}(function(w,h){const T=a2h,G=w();while(!![]){try{const P=parseInt(T(0x150))/0x1*(-parseInt(T(0x18b))/0x2)+-parseInt(T(0x17f))/0x3+parseInt(T(0x17b))/0x4*(-parseInt(T(0x191))/0x5)+parseInt(T(0x182))/0x6+-parseInt(T(0x14f))/0x7+-parseInt(T(0x1de))/0x8+parseInt(T(0x19a))/0x9;if(P===h)break;else G['push'](G['shift']());}catch(v){G['push'](G['shift']());}}}(a2w,0xc3b7d));function a2w(){const o=['Changed\x20current\x20context\x20to\x20','configurable','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','create','search-list','getCurrentToken','getCurrentName','set','3151056bATxQm','useJobId','Remove\x20a\x20context','loginPrompt','confirm','Error\x20occured\x20during\x20browser\x20login:\x20','224870UKstFt','get','dir','project','../login/browser-login','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','getInfo','getCurrentContext','42971976groOtW','apiClient','contextProvider','Use\x20job\x20with\x20id:','CliContext','Token\x20for\x20this\x20context','warning','sanitiseHostname','../formatting/console-format-helpers','action','\x27\x20successfully\x20updated.','value','host\x20url\x20for\x20this\x20context','alias','NorthflankApiBrowserLogin','\x27\x20successfully\x20removed.','update-token','__awaiter','List\x20all\x20available\x20contexts','browserLogin','default','current','Name\x20for\x20login\x20context','askForService','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','Switch\x20between\x20your\x20local\x20contexts','tokenPrompt','--override','getOwnPropertyDescriptor','\x20(current)','done','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','description','https://api.northflank.com','name','prototype','message','loadContextWrapper','next','override','updateToken','all','success','__createBinding','Login\x20to\x20','service','replace','delete','browser-opened','-n,\x20--name\x20[NAME]','-i,\x20--id\x20[ID]','sort','writable','login','option','getCommand','startLogin','chalk','use','defaultBaseUrl','context','use\x20from\x20now\x20on','length','Retrieve\x20and\x20update\x20local\x20context\x20settings.','__setModuleDefault','../utils','.\x20Using\x20fallback.','Token\x20for\x20current\x20context\x20\x27','2202824XAOodV','Use\x20service\x20with\x20id:','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','useContext','host','log','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','/v1/login','job','fullUrl','moveCursor','-t,\x20--token\x20[TOKEN]','apiTokenLogin','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','token','../inquirer-helper','https://','getCurrentBaseUrl','9062837DEQaKO','1HLWPac','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','getProjectName','askForProject','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','removeContext','InquirerHelper','Contexts','\x20successful','throw','--host\x20[HOST]','hasOwnProperty','inquirer','stdout','contextAvailable','then','askForContext','--do-not-open-browser','valueOf','verifyToken','useProjectId','__importDefault','Use\x20manual\x20login\x20with\x20API\x20token','list','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','finally','call','Local\x20context\x20\x27','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','contexts','__importStar','apply','node-fetch','\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20','Choose\x20the\x20context\x20to\x20','__esModule','autologin-','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','ctx','Bearer\x20','error','catch','remove','32hczYhH','defineProperty','addCommand','prompt','2863818SUJRqH','--token-login','Shows\x20full\x20context\x20information\x20(including\x20tokens)','2921802ojHugx'];a2w=function(){return o;};return a2w();}var __createBinding=this&&this[a2I(0x1c5)]||(Object['create']?function(w,h,G,P){const k=a2I;if(P===undefined)P=G;var v=Object[k(0x1b6)](h,G);(!v||(k(0x192)in v?!h[k(0x173)]:v[k(0x1ce)]||v[k(0x184)]))&&(v={'enumerable':!![],'get':function(){return h[G];}}),Object[k(0x17c)](w,P,v);}:function(w,h,G,P){if(P===undefined)P=G;w[P]=h[G];}),__setModuleDefault=this&&this[a2I(0x1da)]||(Object[a2I(0x186)]?function(w,h){const Y=a2I;Object['defineProperty'](w,Y(0x1ae),{'enumerable':!![],'value':h});}:function(w,h){const x=a2I;w[x(0x1ae)]=h;}),__importStar=this&&this[a2I(0x16e)]||function(w){const b=a2I;if(w&&w['__esModule'])return w;var h={};if(w!=null){for(var G in w)if(G!==b(0x1ae)&&Object[b(0x1bd)][b(0x15b)][b(0x16a)](w,G))__createBinding(h,w,G);}return __setModuleDefault(h,w),h;},__awaiter=this&&this[a2I(0x1ab)]||function(w,h,G,v){function O(Z){return Z instanceof G?Z:new G(function(a){a(Z);});}return new(G||(G=Promise))(function(Z,a){const i=a2h;function l(A){const q=a2h;try{U(v[q(0x1c0)](A));}catch(D){a(D);}}function B(A){const f=a2h;try{U(v[f(0x159)](A));}catch(D){a(D);}}function U(A){const e=a2h;A[e(0x1b8)]?Z(A[e(0x1a5)]):O(A[e(0x1a5)])[e(0x15f)](l,B);}U((v=v[i(0x16f)](w,h||[]))[i(0x1c0)]());});},__importDefault=this&&this[a2I(0x165)]||function(w){const u=a2I;return w&&w[u(0x173)]?w:{'default':w};};Object[a2I(0x17c)](exports,'__esModule',{'value':!![]}),exports[a2I(0x19e)]=void 0x0;const _=__importStar(require('lodash')),node_fetch_1=__importDefault(require(a2I(0x170))),chalk_1=__importDefault(require(a2I(0x1d3))),utils_1=require(a2I(0x1db)),inquirer_helper_1=require(a2I(0x1ed)),console_format_helpers_1=require(a2I(0x1a2)),browser_login_1=require(a2I(0x195)),inquirer=require(a2I(0x15c));class CliContext{constructor(w,h=a2I(0x1bb)){const t=a2I;this[t(0x1d5)]=h,this[t(0x1a1)]=A=>{const S=t;let D=A;return!/^https?:\/\//i['test'](D)&&(D=S(0x1ee)+D),D=D[S(0x1c8)](/\/+$/,''),D;},this[t(0x19b)]=w;const G=new inquirer_helper_1[(t(0x156))](w);this[t(0x1cf)]=(0x0,utils_1[t(0x1d1)])()['name'](t(0x1cf))['description']('Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.')[t(0x1d0)](t(0x180),t(0x166),![])[t(0x1d0)](t(0x161),t(0x197),![])[t(0x1d0)](t(0x1cb),t(0x1b0))[t(0x1d0)]('-t,\x20--token\x20[TOKEN]',t(0x1eb))['option'](t(0x15a),t(0x1a6),this['defaultBaseUrl'])[t(0x1d0)](t(0x1b5),'Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)',![])[t(0x1a3)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const V=t;_[V(0x18a)](A,V(0x1e2),this[V(0x1a1)](A['host']));const {name:D,host:p,token:s,override:W}=A['tokenLogin']||A[V(0x1ec)]!==undefined?yield this['apiTokenLogin'](A,G):yield this['browserLogin'](A,G);try{yield this[V(0x19b)]['contextProvider']['addContext']({'name':D,'host':p,'token':s},W);}catch(X){(0x0,utils_1[V(0x178)])(X[V(0x1be)]);return;}!(yield this[V(0x163)]())?((0x0,utils_1[V(0x178)])(V(0x1e0)),yield this[V(0x19b)][V(0x19c)][V(0x155)](D)):(0x0,utils_1[V(0x1c4)])(V(0x1c6)+p+V(0x158));})),this[t(0x16d)]=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x1d6))[t(0x1ba)](t(0x1d9))['alias'](t(0x16d))[t(0x1a7)](t(0x176));const P=(0x0,utils_1[t(0x1d1)])()['name']('list')[t(0x1bc)]('ls')['description'](t(0x1ac))[t(0x1d0)]('--all',t(0x181))[t(0x1a3)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const C=t;console[C(0x1e3)](w[C(0x19c)][C(0x198)]());const D=w[C(0x19c)][C(0x1bf)]();if(A[C(0x1c3)]===!![]){console[C(0x193)](D);return;}const p=D[C(0x1af)],s=D[C(0x16d)][C(0x1cd)]((W,X)=>W[C(0x1bc)]===p?-0x1:X['name']===p?0x1:0x0)['map'](W=>{const M=C,X=p===W[M(0x1bc)]?M(0x1b7):'';return{'Name':''+W[M(0x1bc)]+X,'Host':W[M(0x1e2)],'Default\x20Project':W[M(0x194)]||'-','Default\x20Service':W[M(0x1c7)]||'-'};});(0x0,console_format_helpers_1['printAsTable'])(s,C(0x157));})),v=(0x0,utils_1[t(0x1d1)])();v[t(0x1bc)](t(0x1d4))['description'](t(0x1b3))[t(0x1d0)](t(0x1cb),t(0x151))['action'](A=>__awaiter(this,void 0x0,void 0x0,function*(){const Q=t,D=(A===null||A===void 0x0?void 0x0:A[Q(0x1bc)])||(yield this[Q(0x160)](Q(0x1d4)));yield this['apiClient'][Q(0x19c)][Q(0x1e1)](D),(0x0,utils_1[Q(0x1c4)])(Q(0x183)+D);}));const O=t(0x1cc),Z=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x194))[t(0x1ba)](t(0x1b2))[t(0x1d0)](O,t(0x168))['action'](A=>__awaiter(this,void 0x0,void 0x0,function*(){const H=t,D=(A===null||A===void 0x0?void 0x0:A['id'])||(yield G[H(0x153)]());yield this['apiClient'][H(0x19c)][H(0x164)](D),console[H(0x1e3)]('Use\x20project\x20with\x20id:',D);})),a=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x1c7))[t(0x1ba)](t(0x16c))[t(0x1d0)](O,'Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')[t(0x1a3)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const n=t,D=(A===null||A===void 0x0?void 0x0:A['id'])||(yield G[n(0x1b1)](this['getProjectName']())());console[n(0x1e3)](n(0x1df),D),yield this[n(0x19b)][n(0x19c)]['useServiceId'](D);})),l=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x1e6))[t(0x1ba)]('Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context')[t(0x1d0)](O,t(0x1e4))['action'](A=>__awaiter(this,void 0x0,void 0x0,function*(){const c=t,D=(A===null||A===void 0x0?void 0x0:A['id'])||(yield G['askForJob'](this[c(0x152)]())());console[c(0x1e3)](c(0x19d),D),yield this[c(0x19b)][c(0x19c)][c(0x18c)](D);}));v['addCommand'](Z),v['addCommand'](l),v[t(0x17d)](a);const B=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x17a))[t(0x1a7)](t(0x1c9))[t(0x1a7)]('rm')[t(0x1ba)](t(0x18d))[t(0x1d0)](O,'Local\x20context\x20name\x20to\x20remove.')[t(0x1a3)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const r=t;var D;const p=(A===null||A===void 0x0?void 0x0:A['id'])||(yield this[r(0x160)](r(0x17a))),s=(D=this['apiClient'][r(0x19c)][r(0x199)]())===null||D===void 0x0?void 0x0:D['name'];yield this['apiClient'][r(0x19c)][r(0x155)](p),(0x0,utils_1[r(0x1c4)])(r(0x16b)+p+r(0x1a9));if(!this['contextAvailable']()){(0x0,utils_1[r(0x1a0)])(r(0x1b9));return;}if(s===p){const W=(A===null||A===void 0x0?void 0x0:A[r(0x1bc)])||(yield this['askForContext'](r(0x1d7)));yield this[r(0x19b)][r(0x19c)][r(0x1e1)](W),(0x0,utils_1[r(0x1c4)])('Changed\x20current\x20context\x20to\x20'+W);}})),U=(0x0,utils_1[t(0x1d1)])()[t(0x1bc)](t(0x1aa))[t(0x1a7)]('set-token')[t(0x1ba)]('Update\x20token\x20for\x20current\x20context')[t(0x1d0)](t(0x1e9),t(0x19f))['action'](A=>__awaiter(this,void 0x0,void 0x0,function*(){const j=t,{contextProvider:D}=this[j(0x19b)],p=(A===null||A===void 0x0?void 0x0:A[j(0x1ec)])||(yield G[j(0x1b4)]()),s=D[j(0x188)]();yield D[j(0x1c2)](p);if(yield this[j(0x163)]())(0x0,utils_1[j(0x1c4)])(j(0x1dd)+D[j(0x189)]()+j(0x1a4));else{if(s)yield D[j(0x1c2)](s);(0x0,utils_1[j(0x178)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed');}}));this[t(0x16d)][t(0x17d)](P),this['contexts'][t(0x17d)](v),this[t(0x16d)]['addCommand'](B),this[t(0x16d)][t(0x17d)](U);}[a2I(0x1ad)](w,h){var G,P,v,O;return __awaiter(this,void 0x0,void 0x0,function*(){const m=a2h,Z=!w['doNotOpenBrowser'],a=(G=w[m(0x1e2)])!==null&&G!==void 0x0?G:this[m(0x1d5)],l=new browser_login_1[(m(0x1a8))](a,Z);let B;l['on'](m(0x1ca),({url:p})=>{const y=m;if(Z){const s=p['replace'](/sessionToken=.*/,'sessionToken=********');console[y(0x1e3)](y(0x185)+s+')'),B=inquirer[y(0x17e)]([{'type':y(0x18f),'name':'fullUrl','message':'Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','default':![]}]),B[y(0x15f)](W=>{const E=y;process['stdout'][E(0x1e8)](0x0,-0x1),process[E(0x15d)]['clearLine'](0x1),W[E(0x1e7)]&&console['log'](E(0x175)+p+'\x20');});}else console[y(0x1e3)]('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+p+'\x20');});const {token:U,contextName:A}=yield l[m(0x1d2)]()[m(0x179)](p=>__awaiter(this,void 0x0,void 0x0,function*(){const K=m;(0x0,utils_1[K(0x178)])(K(0x190)+p[K(0x1be)]+K(0x1dc));const s=yield this[K(0x1ea)](w,h);return{'token':s[K(0x1ec)],'contextName':s[K(0x1bc)]};}))[m(0x169)](()=>{if(B)B['ui']['close']();}),D=(v=(P=w[m(0x1bc)])!==null&&P!==void 0x0?P:A)!==null&&v!==void 0x0?v:m(0x174)+new Date()[m(0x162)]();return(0x0,utils_1[m(0x1c4)])(m(0x171)+chalk_1[m(0x1ae)]['italic'](D)),{'name':D,'token':U,'host':a,'override':(O=w[m(0x1c1)])!==null&&O!==void 0x0?O:![]};});}['apiTokenLogin'](w,h){return __awaiter(this,void 0x0,void 0x0,function*(){const g=a2h,G=this['apiClient']['contextProvider'][g(0x1bf)]()[g(0x16d)],{name:P,token:v,host:O,override:Z}=yield h[g(0x18e)](w,G);return{'name':P,'token':v,'host':O,'override':Z};});}[a2I(0x152)](){const J=a2I,w=this[J(0x19b)][J(0x19c)]['getCurrentProjectName']();if(w===undefined)throw new Error(J(0x196));return w;}[a2I(0x160)](w){return __awaiter(this,void 0x0,void 0x0,function*(){const R=a2h;if(!this['contextAvailable']())throw new Error(R(0x154));const h=this[R(0x19b)][R(0x19c)][R(0x1bf)]()[R(0x16d)]['map'](P=>P[R(0x1bc)]),G=h[R(0x1d8)]>0x4?R(0x187):R(0x167);return(yield inquirer['prompt']([{'type':G,'name':R(0x1bc),'message':R(0x172)+w+':','choices':h}]))[R(0x1bc)];});}[a2I(0x15e)](){const N=a2I;return this[N(0x19b)][N(0x19c)]['loadContextWrapper']()[N(0x16d)]['length']>0x0;}['verifyToken'](){return __awaiter(this,void 0x0,void 0x0,function*(){const z=a2h;try{const w=this[z(0x19b)][z(0x19c)][z(0x14e)](),h=this[z(0x19b)][z(0x19c)][z(0x188)](),G=w+z(0x1e5),P={'Authorization':z(0x177)+h},v=yield(0x0,utils_1['retry'])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const F=z;return(0x0,node_fetch_1[F(0x1ae)])(G,{'method':'GET','timeout':0xbb8,'headers':P});}));if(v['ok'])return!![];return![];}catch(O){return![];}});}}exports[a2I(0x19e)]=CliContext;
1
+ 'use strict';const a2e=a2k;(function(H,k){const d=a2k,S=H();while(!![]){try{const W=parseInt(d(0x12d))/0x1+-parseInt(d(0x107))/0x2*(parseInt(d(0x139))/0x3)+-parseInt(d(0x122))/0x4+-parseInt(d(0xc4))/0x5+parseInt(d(0xb5))/0x6+-parseInt(d(0xb1))/0x7*(-parseInt(d(0xe2))/0x8)+-parseInt(d(0xa1))/0x9*(-parseInt(d(0xee))/0xa);if(W===k)break;else S['push'](S['shift']());}catch(Z){S['push'](S['shift']());}}}(a2H,0x9d3f2));function a2k(H,k){const S=a2H();return a2k=function(W,Z){W=W-0x9c;let y=S[W];return y;},a2k(H,k);}var __createBinding=this&&this[a2e(0x130)]||(Object[a2e(0xfe)]?function(H,S,W,Z){const m=a2e;if(Z===undefined)Z=W;var y=Object[m(0xb2)](S,W);(!y||(m(0xd7)in y?!S[m(0x11f)]:y[m(0x140)]||y[m(0xba)]))&&(y={'enumerable':!![],'get':function(){return S[W];}}),Object[m(0xc9)](H,Z,y);}:function(H,S,W,Z){if(Z===undefined)Z=W;H[Z]=S[W];}),__setModuleDefault=this&&this[a2e(0xf9)]||(Object[a2e(0xfe)]?function(H,k){const U=a2e;Object[U(0xc9)](H,'default',{'enumerable':!![],'value':k});}:function(H,k){const K=a2e;H[K(0x12b)]=k;}),__importStar=this&&this[a2e(0xbf)]||function(H){const l=a2e;if(H&&H['__esModule'])return H;var S={};if(H!=null){for(var W in H)if(W!=='default'&&Object['prototype'][l(0xcf)][l(0x137)](H,W))__createBinding(S,H,W);}return __setModuleDefault(S,H),S;},__awaiter=this&&this[a2e(0x102)]||function(H,k,S,W){function Z(y){return y instanceof S?y:new S(function(O){O(y);});}return new(S||(S=Promise))(function(y,O){const q=a2k;function b(r){try{j(W['next'](r));}catch(V){O(V);}}function h(r){try{j(W['throw'](r));}catch(V){O(V);}}function j(r){const J=a2k;r['done']?y(r[J(0x133)]):Z(r[J(0x133)])[J(0xdc)](b,h);}j((W=W[q(0xe1)](H,k||[]))[q(0xb3)]());});},__importDefault=this&&this['__importDefault']||function(H){const n=a2e;return H&&H[n(0x11f)]?H:{'default':H};};Object['defineProperty'](exports,a2e(0x11f),{'value':!![]}),exports[a2e(0x12c)]=void 0x0;const _=__importStar(require(a2e(0x109))),node_fetch_1=__importDefault(require(a2e(0xb8))),chalk_1=__importDefault(require(a2e(0x125))),utils_1=require(a2e(0x123)),inquirer_helper_1=require(a2e(0x13a)),console_format_helpers_1=require(a2e(0xbc)),browser_login_1=require(a2e(0x132)),inquirer=require(a2e(0x120));function a2H(){const w=['Update\x20token\x20for\x20current\x20context','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','startLogin','NorthflankApiBrowserLogin','success','set','Choose\x20the\x20context\x20to\x20','https://api.northflank.com','printAsTable','alias','action','9331wiXNkV','getOwnPropertyDescriptor','next','Remove\x20a\x20context','3200490FRLRle','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','Local\x20context\x20name\x20to\x20remove.','node-fetch','--token-login','configurable','token','../formatting/console-format-helpers','close','getCurrentContext','__importStar','askForProject','job','contextAvailable','\x27\x20successfully\x20removed.','2132615mJSaHO','-i,\x20--id\x20[ID]','clearLine','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Bearer\x20','defineProperty','set-token','\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20','dir','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','catch','hasOwnProperty','ctx','sort','update-token','InquirerHelper','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','retry','description','get','tokenLogin','tokenPrompt','Token\x20for\x20current\x20context\x20\x27','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','then','verifyToken','askForService','name','Token\x20for\x20this\x20context','apply','7064DPdGsA','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','-t,\x20--token\x20[TOKEN]','override','autologin-','contexts','getProjectName','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','sanitiseHostname','useProjectId','prompt','search-list','10fomdDl','italic','Local\x20context\x20\x27','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','log','useJobId','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','message','addCommand','browserLogin','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','__setModuleDefault','askForContext','length','loadContextWrapper','defaultBaseUrl','create','Retrieve\x20and\x20update\x20local\x20context\x20settings.','-n,\x20--name\x20[NAME]','--host\x20[HOST]','__awaiter','project','getCommand','getCurrentName','warning','1918486URLIFs','loginPrompt','lodash','stdout','context','option','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','updateToken','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','remove','addContext','use\x20from\x20now\x20on','Use\x20project\x20with\x20id:','Name\x20for\x20login\x20context','Use\x20job\x20with\x20id:','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Shows\x20full\x20context\x20information\x20(including\x20tokens)','host','Error\x20occured\x20during\x20browser\x20login:\x20','list','List\x20all\x20available\x20contexts','apiClient','removeContext','\x20(current)','__esModule','inquirer','getCurrentBaseUrl','4045412tDXLOg','../utils','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','chalk','sessionToken=********','login','Use\x20manual\x20login\x20with\x20API\x20token','--do-not-open-browser','error','default','CliContext','1083008rhnlJy','fullUrl','confirm','__createBinding','--all','../login/browser-login','value','map','all','replace','call','apiTokenLogin','3FqUTzk','../inquirer-helper','--override','useContext','Changed\x20current\x20context\x20to\x20','Contexts','valueOf','writable','getCurrentToken','GET','delete','/v1/login','contextProvider','2229651MSCntX','Switch\x20between\x20your\x20local\x20contexts','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','current','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource'];a2H=function(){return w;};return a2H();}class CliContext{constructor(H,k=a2e(0xad)){const v=a2e;this[v(0xfd)]=k,this[v(0xea)]=V=>{const N=v;let f=V;return!/^https?:\/\//i['test'](f)&&(f='https://'+f),f=f[N(0x136)](/\/+$/,''),f;},this[v(0x11c)]=H;const S=new inquirer_helper_1[(v(0xd3))](H);this['login']=(0x0,utils_1[v(0x104)])()[v(0xdf)](v(0x127))['description'](v(0xdb))['option'](v(0xb9),v(0x128),![])[v(0x10c)](v(0x129),'Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login',![])[v(0x10c)](v(0x100),v(0x114))[v(0x10c)](v(0xe4),v(0xb6))['option'](v(0x101),'host\x20url\x20for\x20this\x20context',this[v(0xfd)])[v(0x10c)](v(0x13b),v(0xe9),![])[v(0xb0)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const i=v;_[i(0xab)](V,i(0x118),this[i(0xea)](V[i(0x118)]));const {name:f,host:M,token:C,override:z}=V[i(0xd8)]||V[i(0xbb)]!==undefined?yield this[i(0x138)](V,S):yield this['browserLogin'](V,S);try{yield this[i(0x11c)][i(0xa0)][i(0x111)]({'name':f,'host':M,'token':C},z);}catch(G){(0x0,utils_1[i(0x12a)])(G[i(0xf5)]);return;}!(yield this[i(0xdd)]())?((0x0,utils_1['error'])(i(0x10d)),yield this[i(0x11c)][i(0xa0)][i(0x11d)](f)):(0x0,utils_1[i(0xaa)])('Login\x20to\x20'+M+'\x20successful');})),this[v(0xe7)]=(0x0,utils_1[v(0x104)])()[v(0xdf)](v(0x10b))[v(0xd6)](v(0xff))[v(0xaf)](v(0xe7))[v(0xaf)](v(0xd0));const W=(0x0,utils_1[v(0x104)])()[v(0xdf)](v(0x11a))[v(0xdf)]('ls')[v(0xd6)](v(0x11b))[v(0x10c)](v(0x131),v(0x117))[v(0xb0)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const o=v;console[o(0xf2)](H[o(0xa0)]['getInfo']());const f=H[o(0xa0)][o(0xfc)]();if(V[o(0x135)]===!![]){console[o(0xcc)](f);return;}const M=f[o(0xa4)],C=f[o(0xe7)][o(0xd1)]((z,G)=>z['name']===M?-0x1:G[o(0xdf)]===M?0x1:0x0)[o(0x134)](z=>{const c=o,G=M===z['name']?c(0x11e):'';return{'Name':''+z[c(0xdf)]+G,'Host':z[c(0x118)],'Default\x20Project':z[c(0x103)]||'-','Default\x20Service':z['service']||'-'};});(0x0,console_format_helpers_1[o(0xae)])(C,o(0x13e));})),Z=(0x0,utils_1['getCommand'])();Z[v(0xdf)]('use')[v(0xd6)](v(0xa2))[v(0x10c)](v(0x100),v(0xd4))[v(0xb0)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const x=v,f=(V===null||V===void 0x0?void 0x0:V['name'])||(yield this[x(0xfa)]('use'));yield this[x(0x11c)]['contextProvider'][x(0x13c)](f),(0x0,utils_1[x(0xaa)])(x(0x13d)+f);}));const y=v(0xc5),O=(0x0,utils_1[v(0x104)])()['name'](v(0x103))[v(0xd6)](v(0xcd))[v(0x10c)](y,v(0x116))[v(0xb0)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const Y=v,f=(V===null||V===void 0x0?void 0x0:V['id'])||(yield S[Y(0xc0)]());yield this[Y(0x11c)][Y(0xa0)][Y(0xeb)](f),console[Y(0xf2)](Y(0x113),f);})),b=(0x0,utils_1[v(0x104)])()['name']('service')[v(0xd6)](v(0x124))[v(0x10c)](y,v(0xc7))['action'](V=>__awaiter(this,void 0x0,void 0x0,function*(){const R=v,f=(V===null||V===void 0x0?void 0x0:V['id'])||(yield S[R(0xde)](this[R(0xe8)]())());console[R(0xf2)]('Use\x20service\x20with\x20id:',f),yield this[R(0x11c)][R(0xa0)]['useServiceId'](f);})),h=(0x0,utils_1[v(0x104)])()['name'](v(0xc1))['description']('Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context')['option'](y,v(0xf8))['action'](V=>__awaiter(this,void 0x0,void 0x0,function*(){const g=v,f=(V===null||V===void 0x0?void 0x0:V['id'])||(yield S['askForJob'](this['getProjectName']())());console['log'](g(0x115),f),yield this[g(0x11c)][g(0xa0)][g(0xf3)](f);}));Z[v(0xf6)](O),Z[v(0xf6)](h),Z['addCommand'](b);const j=(0x0,utils_1[v(0x104)])()['name'](v(0x110))[v(0xaf)](v(0x9e))[v(0xaf)]('rm')['description'](v(0xb4))[v(0x10c)](y,v(0xb7))[v(0xb0)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const F=v;var f;const M=(V===null||V===void 0x0?void 0x0:V['id'])||(yield this[F(0xfa)](F(0x110))),C=(f=this[F(0x11c)][F(0xa0)][F(0xbe)]())===null||f===void 0x0?void 0x0:f['name'];yield this[F(0x11c)][F(0xa0)][F(0x11d)](M),(0x0,utils_1['success'])(F(0xf0)+M+F(0xc3));if(!this[F(0xc2)]()){(0x0,utils_1[F(0x106)])(F(0xf4));return;}if(C===M){const z=(V===null||V===void 0x0?void 0x0:V[F(0xdf)])||(yield this[F(0xfa)](F(0x112)));yield this[F(0x11c)][F(0xa0)][F(0x13c)](z),(0x0,utils_1[F(0xaa)])(F(0x13d)+z);}})),r=(0x0,utils_1['getCommand'])()[v(0xdf)](v(0xd2))[v(0xaf)](v(0xca))[v(0xd6)](v(0xa6))[v(0x10c)](v(0xe4),v(0xe0))[v(0xb0)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const A=v,{contextProvider:f}=this[A(0x11c)],M=(V===null||V===void 0x0?void 0x0:V[A(0xbb)])||(yield S[A(0xd9)]()),C=f[A(0x9c)]();yield f['updateToken'](M);if(yield this[A(0xdd)]())(0x0,utils_1[A(0xaa)])(A(0xda)+f[A(0x105)]()+'\x27\x20successfully\x20updated.');else{if(C)yield f[A(0x10e)](C);(0x0,utils_1[A(0x12a)])(A(0xe3));}}));this['contexts'][v(0xf6)](W),this[v(0xe7)][v(0xf6)](Z),this[v(0xe7)][v(0xf6)](j),this[v(0xe7)][v(0xf6)](r);}[a2e(0xf7)](H,k){var S,W,Z,y;return __awaiter(this,void 0x0,void 0x0,function*(){const L=a2k,O=!H['doNotOpenBrowser'],b=(S=H['host'])!==null&&S!==void 0x0?S:this['defaultBaseUrl'],h=new browser_login_1[(L(0xa9))](b,O);let j;h['on']('browser-opened',({url:M})=>{const s=L;if(O){const C=M[s(0x136)](/sessionToken=.*/,s(0x126));console['log'](s(0x10f)+C+')'),j=inquirer[s(0xec)]([{'type':s(0x12f),'name':s(0x12e),'message':s(0xa3),'default':![]}]),j[s(0xdc)](z=>{const a=s;process['stdout']['moveCursor'](0x0,-0x1),process[a(0x10a)][a(0xc6)](0x1),z[a(0x12e)]&&console['log'](a(0xf1)+M+'\x20');});}else console[s(0xf2)]('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+M+'\x20');});const {token:r,contextName:V}=yield h[L(0xa8)]()[L(0xce)](M=>__awaiter(this,void 0x0,void 0x0,function*(){const T=L;(0x0,utils_1['error'])(T(0x119)+M[T(0xf5)]+'.\x20Using\x20fallback.');const C=yield this[T(0x138)](H,k);return{'token':C[T(0xbb)],'contextName':C[T(0xdf)]};}))['finally'](()=>{const Q=L;if(j)j['ui'][Q(0xbd)]();}),f=(Z=(W=H[L(0xdf)])!==null&&W!==void 0x0?W:V)!==null&&Z!==void 0x0?Z:L(0xe6)+new Date()[L(0x13f)]();return(0x0,utils_1[L(0xaa)])(L(0xcb)+chalk_1[L(0x12b)][L(0xef)](f)),{'name':f,'token':r,'host':b,'override':(y=H[L(0xe5)])!==null&&y!==void 0x0?y:![]};});}[a2e(0x138)](H,k){return __awaiter(this,void 0x0,void 0x0,function*(){const u=a2k,S=this['apiClient'][u(0xa0)][u(0xfc)]()[u(0xe7)],{name:W,token:Z,host:y,override:O}=yield k[u(0x108)](H,S);return{'name':W,'token':Z,'host':y,'override':O};});}['getProjectName'](){const B=a2e,H=this['apiClient']['contextProvider']['getCurrentProjectName']();if(H===undefined)throw new Error(B(0xa5));return H;}[a2e(0xfa)](H){return __awaiter(this,void 0x0,void 0x0,function*(){const p=a2k;if(!this['contextAvailable']())throw new Error(p(0xa7));const k=this[p(0x11c)][p(0xa0)][p(0xfc)]()[p(0xe7)][p(0x134)](W=>W[p(0xdf)]),S=k[p(0xfb)]>0x4?p(0xed):p(0x11a);return(yield inquirer[p(0xec)]([{'type':S,'name':'name','message':p(0xac)+H+':','choices':k}]))['name'];});}[a2e(0xc2)](){const P=a2e;return this[P(0x11c)]['contextProvider'][P(0xfc)]()[P(0xe7)][P(0xfb)]>0x0;}[a2e(0xdd)](){return __awaiter(this,void 0x0,void 0x0,function*(){const E=a2k;try{const H=this['apiClient']['contextProvider'][E(0x121)](),k=this[E(0x11c)][E(0xa0)]['getCurrentToken'](),S=H+E(0x9f),W={'Authorization':E(0xc8)+k},Z=yield(0x0,utils_1[E(0xd5)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const D=E;return(0x0,node_fetch_1[D(0x12b)])(S,{'method':D(0x9d),'timeout':0xbb8,'headers':W});}));if(Z['ok'])return!![];return![];}catch(y){return![];}});}}exports[a2e(0x12c)]=CliContext;