@northflank/cli 0.9.20 → 0.9.22

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';function a0x(){const xc=['options','data','nextPageCursor','7034190EPwAoD','fetchResourceList','__awaiter','resources','internalId','version','addonId','envs','logSink','addon','780978UYyWeF','default','plans','secret','next','type','addonTypes','credentials','3177228bcspcY','storage','./utils','cursor','templates','replicas','keys','5017885XkHcDU','source','updateaddonversion','45nfDVlu','value','824947JEekTG','owningObject','projectId','map','regions','7751424EojlHl','pagination','versions','list','done','addons','serviceId','region','apply','37749YnxFOh','registryCredentials','includes','secrets','services','__esModule','projects','49kfRtRp','10VIilxZ','find','backups','types','then','get','deploymentPlan','keyName'];a0x=function(){return xc;};return a0x();}const a0x2=a0N;(function(x,N){const x1=a0N,c=x();while(!![]){try{const a=-parseInt(x1(0xbf))/0x1+parseInt(x1(0x96))/0x2*(-parseInt(x1(0x8e))/0x3)+parseInt(x1(0xb3))/0x4+-parseInt(x1(0xba))/0x5+parseInt(x1(0xab))/0x6*(-parseInt(x1(0x95))/0x7)+-parseInt(x1(0xc4))/0x8+-parseInt(x1(0xbd))/0x9*(-parseInt(x1(0xa1))/0xa);if(a===N)break;else c['push'](c['shift']());}catch(J){c['push'](c['shift']());}}}(a0x,0x83cf6));var __awaiter=this&&this[a0x2(0xa3)]||function(x,N,c,a){function J(p){return p instanceof c?p:new c(function(e){e(p);});}return new(c||(c=Promise))(function(p,e){const x4=a0N;function s(M){try{d(a['next'](M));}catch(A){e(A);}}function q(M){try{d(a['throw'](M));}catch(A){e(A);}}function d(M){const x3=a0N;M[x3(0x89)]?p(M[x3(0xbe)]):J(M[x3(0xbe)])[x3(0x9a)](s,q);}d((a=a[x4(0x8d)](x,N||[]))[x4(0xaf)]());});};Object['defineProperty'](exports,a0x2(0x93),{'value':!![]}),exports[a0x2(0xa2)]=void 0x0;const utils_1=require(a0x2(0xb5)),defaultPaginationPageSize=0x64,getProjects=x=>N=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const x5=a0x2;var c;const a=yield x['list'][x5(0x94)]({'options':{'per_page':defaultPaginationPageSize,'cursor':N===null||N===void 0x0?void 0x0:N[x5(0xa0)]}});return{'elements':a[x5(0x9f)]['projects'][x5(0xc2)](J=>J['id']),'nextPageCursor':(c=a[x5(0xc5)])===null||c===void 0x0?void 0x0:c['cursor']};}),getServices=(x,N)=>c=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const x6=a0x2;var a;const J=yield x[x6(0x88)][x6(0x92)]({'parameters':{'projectId':N},'options':{'per_page':defaultPaginationPageSize,'cursor':c===null||c===void 0x0?void 0x0:c['nextPageCursor']}});return{'elements':J[x6(0x9f)]['services'][x6(0xc2)](p=>p['id']),'nextPageCursor':(a=J[x6(0xc5)])===null||a===void 0x0?void 0x0:a[x6(0xb6)]};}),getAddons=(x,N)=>c=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const x7=a0x2;var a;const J=yield x[x7(0x88)]['addons']({'parameters':{'projectId':N},'options':{'per_page':defaultPaginationPageSize,'cursor':c===null||c===void 0x0?void 0x0:c[x7(0xa0)]}});return{'elements':J[x7(0x9f)][x7(0x8a)][x7(0xc2)](p=>p['id']),'nextPageCursor':(a=J[x7(0xc5)])===null||a===void 0x0?void 0x0:a[x7(0xb6)]};}),getAddonBackups=(x,N,c)=>a=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const x8=a0x2;var J;const p=yield x[x8(0x9b)][x8(0xaa)][x8(0x98)]({'parameters':{'projectId':N,'addonId':c},'options':{'per_page':defaultPaginationPageSize,'cursor':a===null||a===void 0x0?void 0x0:a[x8(0xa0)]}});return{'elements':p[x8(0x9f)][x8(0x98)][x8(0xc2)](e=>e['id']),'nextPageCursor':(J=p['pagination'])===null||J===void 0x0?void 0x0:J[x8(0xb6)]};});function a0N(x,N){const c=a0x();return a0N=function(a,J){a=a-0x88;let p=c[a];return p;},a0N(x,N);}function fetchResourceList(x,N,c,a,J,p){var e,s,q,d,M,A,l,Z,V,g,P,n;return __awaiter(this,void 0x0,void 0x0,function*(){const x9=a0N,Q=undefined;try{if(x===x9(0x9c)){const z=yield N['list'][x9(0xad)]({}),w=z['data'][x9(0xad)][x9(0xc2)](j=>{var K;return(K=j===null||j===void 0x0?void 0x0:j['internalId'])!==null&&K!==void 0x0?K:j===null||j===void 0x0?void 0x0:j['id'];});return{'choices':w,'defaultValue':Q};}if(x===x9(0x8c)&&!(c===null||c===void 0x0?void 0x0:c['includes'](x9(0xa9)))){const j=yield N[x9(0x88)][x9(0xc3)]({}),K=j['data'][x9(0xc3)]['map'](m=>{const xx=x9;var S;return(S=m===null||m===void 0x0?void 0x0:m[xx(0xa5)])!==null&&S!==void 0x0?S:m===null||m===void 0x0?void 0x0:m['id'];});return{'choices':K,'defaultValue':Q};}if(x===x9(0xc1)){const m=yield getProjects(N),{elements:S,nextPageCursor:W}=yield m();return{'choices':S,'defaultValue':Q,'pagination':{'nextPageCursor':W,'loadMore':m}};}if(x===x9(0xb2)){const L=yield N['list'][x9(0x8f)]({}),v=L['data'][x9(0xb2)][x9(0xc2)](h=>h['id']);return{'choices':v,'defaultValue':Q};}const k=J===null||J===void 0x0?void 0x0:J['projectId'],b=x===x9(0x8b)||x==='id'&&(p===null||p===void 0x0?void 0x0:p[x9(0x90)](x9(0xc0)));if(k!==undefined&&b){const h=yield getServices(N,k),{elements:B,nextPageCursor:o}=yield h();return{'choices':B,'defaultValue':Q,'pagination':{'nextPageCursor':o,'loadMore':h}};}const F=c===null||c===void 0x0?void 0x0:c['includes'](x9(0xaa));if(F){const G=E=>__awaiter(this,void 0x0,void 0x0,function*(){const xN=x9;var u;const X=yield N[xN(0x9b)][xN(0xaa)]['types']({});return(u=X['data'][xN(0xb1)])===null||u===void 0x0?void 0x0:u[xN(0xc2)](R=>R[xN(0xb0)])[xN(0x97)](R=>R['type']===E);});if(x==='type'){const E=yield N[x9(0x9b)]['addon'][x9(0x99)]({}),u=(e=E[x9(0x9f)]['addonTypes'])===null||e===void 0x0?void 0x0:e[x9(0xc2)](X=>X[x9(0xb0)]);return{'choices':u,'defaultValue':Q};}if(x===x9(0xa6)&&(a===null||a===void 0x0?void 0x0:a[x9(0xb0)])!==undefined){const X=(s=yield G(a[x9(0xb0)]))===null||s===void 0x0?void 0x0:s[x9(0xc6)],R=X!==undefined?['latest',...X]:undefined;return{'choices':R,'defaultValue':Q};}if(x===x9(0xb4)&&(a===null||a===void 0x0?void 0x0:a[x9(0xb0)])!==undefined){const t=(d=(q=yield G(a['type']))===null||q===void 0x0?void 0x0:q['resources'])===null||d===void 0x0?void 0x0:d[x9(0xb4)];return{'choices':t===null||t===void 0x0?void 0x0:t[x9(0x9e)],'defaultValue':t===null||t===void 0x0?void 0x0:t[x9(0xac)]};}if(x==='replicas'&&(a===null||a===void 0x0?void 0x0:a[x9(0xb0)])!==undefined){const f=(A=(M=yield G(a[x9(0xb0)]))===null||M===void 0x0?void 0x0:M[x9(0xa4)])===null||A===void 0x0?void 0x0:A[x9(0xb8)];return{'choices':f===null||f===void 0x0?void 0x0:f[x9(0x9e)],'defaultValue':f===null||f===void 0x0?void 0x0:f['default']};}}if(x==='addonId'&&(J===null||J===void 0x0?void 0x0:J[x9(0xc1)])!==undefined){const Y=yield getAddons(N,J===null||J===void 0x0?void 0x0:J[x9(0xc1)]),{elements:H,nextPageCursor:D}=yield Y();return{'choices':H,'defaultValue':Q,'pagination':{'nextPageCursor':D,'loadMore':Y}};}if(x==='backupId'&&(J===null||J===void 0x0?void 0x0:J['projectId'])!==undefined&&((l=a===null||a===void 0x0?void 0x0:a[x9(0xbb)])===null||l===void 0x0?void 0x0:l[x9(0xa7)])!==undefined){const r=yield getAddonBackups(N,J===null||J===void 0x0?void 0x0:J[x9(0xc1)],(Z=a===null||a===void 0x0?void 0x0:a['source'])===null||Z===void 0x0?void 0x0:Z[x9(0xa7)]),{elements:i,nextPageCursor:U}=yield r();return{'choices':i,'defaultValue':Q,'pagination':{'nextPageCursor':U,'loadMore':r}};}const I=(V=J===null||J===void 0x0?void 0x0:J['addonId'])!==null&&V!==void 0x0?V:(g=a===null||a===void 0x0?void 0x0:a['addonDependencies'])===null||g===void 0x0?void 0x0:g[x9(0xa7)];if((c===null||c===void 0x0?void 0x0:c['join'](''))===x9(0xbc)&&x===x9(0xa6)&&(J===null||J===void 0x0?void 0x0:J[x9(0xc1)])!==undefined&&I!==undefined){const {upgradeTo:y}=(yield N[x9(0x9b)]['addon'][x9(0xa6)]({'parameters':{'addonId':I,'projectId':J===null||J===void 0x0?void 0x0:J['projectId']}}))[x9(0x9f)];if(y===undefined||y['length']<=0x0){(0x0,utils_1['warning'])('No\x20available\x20versions\x20to\x20upgrade\x20to.');throw new Error();}return{'choices':y['map'](C=>C[x9(0xa6)]),'defaultValue':Q};}if(x==='templateId'){const C=yield N[x9(0x88)][x9(0xb7)]({}),T=C[x9(0x9f)][x9(0xb7)]['map'](O=>O===null||O===void 0x0?void 0x0:O['id']);return{'choices':T,'defaultValue':Q};}if(((c===null||c===void 0x0?void 0x0:c['includes']('secretLink'))||(c===null||c===void 0x0?void 0x0:c[x9(0x90)](x9(0xae))))&&x===x9(0x9d)&&I!==undefined&&(J===null||J===void 0x0?void 0x0:J[x9(0xc1)])!==undefined){const O=(yield N[x9(0x9b)]['addon'][x9(0xb2)]({'parameters':{'addonId':I,'projectId':J===null||J===void 0x0?void 0x0:J[x9(0xc1)]}}))[x9(0x9f)];return{'choices':[...(P=Object['keys'](O===null||O===void 0x0?void 0x0:O[x9(0xa8)]))!==null&&P!==void 0x0?P:[],...(n=Object[x9(0xb9)](O===null||O===void 0x0?void 0x0:O[x9(0x91)]))!==null&&n!==void 0x0?n:[]]};}}catch(x0){}return{'choices':undefined,'defaultValue':Q};});}exports[a0x2(0xa2)]=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 a1xl=a1N;function a1x(){const xR=['/docs/v1/api/','askForCredentials','kebabCase','delete','isString','runId','service','option','update','svc','skipValidation','pagination','login','VERBOSE:\x20Using\x20endpoint\x20->\x20','method','./port-forward','getMetricsCommand','asyncSequential','name','status','.json','15298490NdfZjF','plan','cursor','isPaginatedEndpoint','base','after','opt','Update\x20Northflank\x20','there\x20are\x20more\x20rows,\x20load?','startsWith','resourceTagId','getCurrentServiceName','description','secretId','jobId','customUserAgent','(HTTP\x20status\x20code:\x20','nonInteractiveEndpoint','pln','replace','dmn','askForAddonBackup','project','./exec','isArray','rgn','value','askForClusterId','js-yaml','1274bsTGdi','services','volumeId','Display\x20help\x20for\x20command','region','File\x20to\x20load\x20resource\x20json\x20from','required','askForJobRun','backup','\x0a>\x20Token\x20permissions\x20required:\x20','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','retrievePayloadViaInteractiveCli','tags','addon','parseAsync','yml','assign','loadAll','./logs','toUpperCase','endsWith','--verbose','entries','alias','logSinkId','branch','forEach','isEqual','concat','underline','consoleFormat','VERBOSE:\x20Request\x20body\x20->\x20','7557894sWJwIb','call','jobs','defaults','get','adn','__setModuleDefault','-i,\x20--input\x20<resource-def>','338396bugYym','getCurrentContext','green','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','pipelineId','@northflank/js-client','askForSecret','templateId','2497260cJcwZQ','bind','CliPortForward','find','./formatting/command-overview','upperFirst','__awaiter','quiet','output','parse','file','commands','boolean','./context/contextCommands','body','regions','getCommand','join','next','File\x20does\x20not\x20exist:\x20','warning','\x20--','credentials','requiredPermissions','subdomainId','log','backupId','addCommand','keys','printAsTable','create','-f,\x20--file\x20<file-path>','askForProject','addons','api.','addonId','logs','opts','Unknown\x20input\x20file\x20type:\x20','domain','json','done','getProgram','domains','default','getCommandOverview','yaml','./metrics','getNextPage','askForVolume','handleYamlOutput','CliLogs','noDefaults','CliContext','-v,\x20--version','apply','deleteWarningPrompt','plans','buildId','templateRunId','\x0a\x09details\x20:','invoices','credentialId','askForTemplateRun','setPathVars','execCmd','sort','askForPipeline','portFwdCmd','repo','prototype','tpl','includes','has','__esModule','map','assertContextExisting','OPTIONAL:\x20','invoice','all','CliExec','credential','checkUpdate','repository','pop','action','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','message','type','hasNextPage','askForTag','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','secrets','contexts','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','enablePositionalOptions','secret','InquirerHelper','data','API\x20request\x20failed\x0a\x09Message:\x20','getCurrentProjectName','__importStar','hasOwnProperty','1202232tWvJla','subdomain','runs','rawResponse','serviceId','exitCode','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','configurable','getLogsCommand','ApiClient','stringify','argv','backups','safeLoad','aliases','volume','force','askForAddon','1GJhDiF','split','moveCursor','askGeneric','Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27','repos','path','defineProperty','../package.json','getCurrentJobName','getOwnPropertyDescriptor','20JbjeTB','./formatting/console-format-helpers','askConfirm','tag','query','Get\x20information\x20about\x20Northflank\x20','length','resource','Documentation:\x20','paginationArgs','templates','domainId','contextProvider','Command','clusterId','subdomainPath','addHelpText','custom-columns=','18472AOjejC','\x20Northflank\x20resources','askForLogSink','askForTemplate','some','filter','inv','chalk','endpoints','247142NmkRYw','version','=>\x20running\x20command\x20with:\x20','scrt','stdout','addHelpCommand','error','job'];a1x=function(){return xR;};return a1x();}(function(x,N){const xA=a1N,c=x();while(!![]){try{const a=parseInt(xA(0x17e))/0x1*(-parseInt(xA(0x1a4))/0x2)+parseInt(xA(0x20e))/0x3+-parseInt(xA(0x206))/0x4*(parseInt(xA(0x189))/0x5)+-parseInt(xA(0x16c))/0x6+-parseInt(xA(0x1de))/0x7*(parseInt(xA(0x19b))/0x8)+-parseInt(xA(0x1fe))/0x9+parseInt(xA(0x1c1))/0xa;if(a===N)break;else c['push'](c['shift']());}catch(J){c['push'](c['shift']());}}}(a1x,0x6b676));var __createBinding=this&&this['__createBinding']||(Object[a1xl(0x22c)]?function(x,N,c,a){const xZ=a1xl;if(a===undefined)a=c;var J=Object[xZ(0x188)](N,c);(!J||(xZ(0x202)in J?!N['__esModule']:J['writable']||J[xZ(0x173)]))&&(J={'enumerable':!![],'get':function(){return N[c];}}),Object[xZ(0x185)](x,a,J);}:function(x,N,c,a){if(a===undefined)a=c;x[a]=N[c];}),__setModuleDefault=this&&this[a1xl(0x204)]||(Object['create']?function(x,N){const xV=a1xl;Object[xV(0x185)](x,'default',{'enumerable':!![],'value':N});}:function(x,N){x['default']=N;}),__importStar=this&&this[a1xl(0x16a)]||function(x){const xg=a1xl;if(x&&x[xg(0x14f)])return x;var N={};if(x!=null){for(var c in x)if(c!==xg(0x23a)&&Object[xg(0x254)][xg(0x16b)][xg(0x1ff)](x,c))__createBinding(N,x,c);}return __setModuleDefault(N,x),N;},__awaiter=this&&this[a1xl(0x214)]||function(x,N,c,a){function J(p){return p instanceof c?p:new c(function(e){e(p);});}return new(c||(c=Promise))(function(p,e){const xQ=a1N;function s(M){const xP=a1N;try{d(a[xP(0x220)](M));}catch(A){e(A);}}function q(M){try{d(a['throw'](M));}catch(A){e(A);}}function d(M){const xn=a1N;M[xn(0x237)]?p(M[xn(0x1db)]):J(M[xn(0x1db)])['then'](s,q);}d((a=a[xQ(0x245)](x,N||[]))['next']());});},__importDefault=this&&this['__importDefault']||function(x){const xk=a1xl;return x&&x[xk(0x14f)]?x:{'default':x};};Object[a1xl(0x185)](exports,'__esModule',{'value':!![]}),exports[a1xl(0x238)]=void 0x0;const js_client_1=require(a1xl(0x20b)),commander_1=__importDefault(require('commander')),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require(a1xl(0x1a2))),_=__importStar(require('lodash')),contextCommands_1=require(a1xl(0x21b)),utils_1=require('./utils'),defaults=__importStar(require('./defaults')),inquirer_helper_1=require('./inquirer-helper'),console_format_helpers_1=require(a1xl(0x18a)),command_overview_1=require(a1xl(0x212)),port_forward_1=require(a1xl(0x1bb)),exec_1=require(a1xl(0x1d8)),logs_1=require(a1xl(0x1f0)),metrics_1=require(a1xl(0x23d)),yaml=require(a1xl(0x1dd)),pgk=require(a1xl(0x186)),getProgram=x=>{const xb=a1xl,N=new commander_1[(xb(0x23a))][(xb(0x196))]('northflank');N[xb(0x1cd)](xb(0x1e8)),N[xb(0x164)](!![]),N['version']('Northflank\x20cli\x20version:\x20'+chalk_1[xb(0x23a)][xb(0x1fb)](pgk[xb(0x1a5)]),xb(0x244),xb(0x15b));const c=new js_client_1['ApiClient'](x,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[xb(0x1d0)]}),a=new contextCommands_1[(xb(0x243))](c),J=new port_forward_1[(xb(0x210))](x),p=new exec_1[(xb(0x155))](x),e=new logs_1[(xb(0x241))](x),s=new metrics_1['CliMetrics'](x);return N[xb(0x229)](J[xb(0x252)]),N[xb(0x229)](p[xb(0x24f)]),N['addCommand'](a[xb(0x1b8)]),N[xb(0x229)](a[xb(0x162)]),generateCommands(c,c[xb(0x1a3)],N,e,s),N[xb(0x229)]((0x0,command_overview_1[xb(0x23b)])(N)),N[xb(0x1a9)](!![],xb(0x1e1)),N['helpOption'](undefined,xb(0x1e1)),N;};function a1N(x,N){const c=a1x();return a1N=function(a,J){a=a-0x14c;let p=c[a];return p;},a1N(x,N);}exports[a1xl(0x238)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const xF=a1xl;try{const x=new js_client_1['ApiClientFileContextProvider']();yield(0x0,utils_1[xF(0x157)])(x);const N=(0x0,exports[xF(0x238)])(x);yield N[xF(0x1ec)](process[xF(0x177)]);}catch(c){(0x0,utils_1[xF(0x1aa)])(xF(0x160)+c[xF(0x15c)]),process[xF(0x177)][xF(0x211)](a=>a===xF(0x1f3))&&console[xF(0x227)](c),process[xF(0x171)]=0x1;}}))());function isListCommand(x){const xI=a1xl,N=[['get',xI(0x1eb),xI(0x178)],[xI(0x202),xI(0x1ab),xI(0x16e)]];return x[xI(0x211)](c=>c==='list')||N['some'](c=>_['isEqual'](x,c));}function generateCommands(x,N,c,a,J,p=defaults[a1xl(0x201)],e=[]){const xz=a1xl,s=new inquirer_helper_1[(xz(0x166))](new js_client_1[(xz(0x175))](x['contextProvider'],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[xz(0x1d0)]}));function q(l,Z){const xw=xz;return l[xw(0x1e4)]!==![]&&Z===undefined;}function d(l,Z){const xj=xz,{opt:V,name:g}=l,P=V[xj(0x23a)],n=q(V,P),Q=w=>w[xj(0x18f)]>0x1?'--'+w:'-'+w,k=V===null||V===void 0x0?void 0x0:V[xj(0x1f5)],b=k?_[xj(0x1d9)](k)?'-'+(k===null||k===void 0x0?void 0x0:k['map'](w=>Q(w))[xj(0x21f)](',\x20-'))+',':''+Q(k):'',F=n?'':xj(0x152),I=typeof V[xj(0x15d)]===xj(0x21a)||V[xj(0x15d)]===xj(0x21a)?b+xj(0x223)+g:b+xj(0x223)+g+'\x20<'+g[xj(0x1f1)]()+'>',z=F+V[xj(0x1cd)];Z['option'](I,z,P);}function M(l,Z){const xK=xz;if(Z[xK(0x219)][xK(0x19f)](V=>V[xK(0x1be)]()===xK(0x232)))return;_[xK(0x1f9)](l,[xK(0x202),xK(0x1b2)])&&(Z[xK(0x229)](a[xK(0x174)](xK(0x1b2))),Z['addCommand'](J[xK(0x1bc)](xK(0x1b2))),Z[xK(0x229)](a[xK(0x174)](xK(0x1b2),!![])),Z[xK(0x229)](J[xK(0x1bc)]('service',!![]))),_[xK(0x1f9)](l,[xK(0x202),xK(0x1ab)])&&(Z[xK(0x229)](a[xK(0x174)]('job')),Z[xK(0x229)](J['getMetricsCommand'](xK(0x1ab))),Z[xK(0x229)](a['getLogsCommand'](xK(0x1ab),!![])),Z[xK(0x229)](J[xK(0x1bc)]('job',!![]))),_['isEqual'](l,[xK(0x202),xK(0x1eb)])&&(Z[xK(0x229)](a[xK(0x174)](xK(0x1eb))),Z['addCommand'](J[xK(0x1bc)]('addon'))),_['isEqual'](l,['get',xK(0x1eb),xK(0x1e6)])&&Z[xK(0x229)](a[xK(0x174)]('addon',![],!![])),_[xK(0x1f9)](l,[xK(0x202),xK(0x1eb),'restores'])&&Z[xK(0x229)](a[xK(0x174)](xK(0x1eb),![],!![],!![]));}return Object['getOwnPropertyNames'](p)['forEach'](l=>{const xm=xz,Z=N[l],V=p[l],g=e[xm(0x1fa)]([l]);function P(K,m){const xS=xm,S=Object['getOwnPropertyNames'](K||{});S[xS(0x150)](W=>{return{'name':W,'opt':K[W]};})[xS(0x250)]((W,L)=>!q(W[xS(0x1c7)])?!q(L['opt'])?0x0:0x1:-0x1)[xS(0x1f8)](W=>{d(W,m);});}function n(K,m){const xW=xm,S=[[xW(0x1d7),'projects','prj'],[xW(0x1b2),xW(0x1df),xW(0x1b5)],[xW(0x224),xW(0x156),'cred'],['addon',xW(0x22f),xW(0x203)],[xW(0x1ab),xW(0x200)],[xW(0x1c2),xW(0x247),xW(0x1d3)],[xW(0x1e2),xW(0x21d),xW(0x1da)],[xW(0x235),xW(0x239),xW(0x1d5)],[xW(0x165),xW(0x161),xW(0x1a7)],['volumes',xW(0x17b),'vol'],['branches',xW(0x1f7),'brn'],[xW(0x153),xW(0x24b),xW(0x1a1)],['template',xW(0x193),xW(0x14c)],[xW(0x183),xW(0x158),'repositories',xW(0x253)],[xW(0x18c),xW(0x1ea)]],W=S[xW(0x211)](L=>L[xW(0x14d)](m));if(W!==undefined)K[xW(0x17a)](W[xW(0x1a0)](L=>L!==m));}function Q(K){var m,S;return __awaiter(this,void 0x0,void 0x0,function*(){const xL=a1N,W={},{contextProvider:L}=x,v=g[xL(0x14d)](xL(0x1af)),h=K[xL(0x242)]===!![];function B(o,G,E){var u,X;return __awaiter(this,void 0x0,void 0x0,function*(){const xv=a1N;if(_['has']((X=(u=V['opt'])===null||u===void 0x0?void 0x0:u[xv(0x184)])!==null&&X!==void 0x0?X:{},o)){const R=!h&&!v&&E?E():undefined,t=K[o]||R||(yield G());_['set'](W,o,t);}});}return yield(0x0,utils_1[xL(0x1bd)])(Object[xL(0x1f4)]((S=(m=V[xL(0x1c7)])===null||m===void 0x0?void 0x0:m[xL(0x184)])!==null&&S!==void 0x0?S:{}),([o,G])=>__awaiter(this,void 0x0,void 0x0,function*(){const xh=xL;var E;const u=W===null||W===void 0x0?void 0x0:W['projectId'],X=W===null||W===void 0x0?void 0x0:W['templateId'];switch(o){case'projectId':return yield B('projectId',s[xh(0x22e)]['bind'](s),L[xh(0x169)]['bind'](L));case xh(0x170):return yield B(xh(0x170),s['askForService'](u)[xh(0x20f)](s),L[xh(0x1cc)][xh(0x20f)](L));case xh(0x231):return yield B(xh(0x231),s[xh(0x17d)](u)[xh(0x20f)](s));case xh(0x1cf):return yield B(xh(0x1cf),s['askForJob'](u)[xh(0x20f)](s),L[xh(0x187)]['bind'](L));case'runId':return yield B(xh(0x1b1),s[xh(0x1e5)](W[xh(0x1cf)],u,![])[xh(0x20f)](s));case'secretId':return yield B(xh(0x1ce),s[xh(0x20c)](u)[xh(0x20f)](s));case'domain':case xh(0x194):return yield B('domain',s['askForDomain']['bind'](s));case xh(0x24c):return yield B('credentialId',s[xh(0x1ad)][xh(0x20f)](s));case xh(0x1e0):return yield B('volumeId',s[xh(0x23f)](u)[xh(0x20f)](s));case xh(0x16d):return yield B(xh(0x16d),s['askForSubdomain'](W[xh(0x235)])[xh(0x20f)](s));case'subdomainId':return yield B(xh(0x226),s['askForSubdomain'](W[xh(0x194)])['bind'](s));case'subdomainPath':return yield B(xh(0x198),s['askForSubdomainPath'](W[xh(0x235)],(E=W[xh(0x16d)])!==null&&E!==void 0x0?E:W[xh(0x226)])[xh(0x20f)](s));case xh(0x228):return yield B('backupId',s[xh(0x1d6)](u,W[xh(0x231)])[xh(0x20f)](s));case xh(0x248):return yield B(xh(0x248),s['askForBuild'](u,W[xh(0x170)],W[xh(0x1cf)])[xh(0x20f)](s));case xh(0x20d):return yield B(xh(0x20d),s[xh(0x19e)]()[xh(0x20f)](s));case xh(0x249):return yield B(xh(0x249),s[xh(0x24d)](X)['bind'](s));case'logSinkId':return yield B(xh(0x1f6),s[xh(0x19d)]()['bind'](s));case xh(0x20a):return yield B(xh(0x20a),s[xh(0x251)](u)[xh(0x20f)](s));case xh(0x1cb):return yield B('resourceTagId',s[xh(0x15f)]()[xh(0x20f)](s));case xh(0x197):return yield B('clusterId',s[xh(0x1dc)]()[xh(0x20f)](s));default:return yield B(o,s[xh(0x181)](o,G===null||G===void 0x0?void 0x0:G[xh(0x1cd)])[xh(0x20f)](s));}})),W;});}function k(K){var m,S,W;return __awaiter(this,void 0x0,void 0x0,function*(){const xB=a1N,L={},v=((m=V['opt'])===null||m===void 0x0?void 0x0:m['isPaginatedEndpoint'])?defaults[xB(0x192)]:{},h=Object[xB(0x1ee)](Object['assign']({},(W=(S=V[xB(0x1c7)])===null||S===void 0x0?void 0x0:S[xB(0x18d)])!==null&&W!==void 0x0?W:{}),v),B=Object[xB(0x22a)](h)['filter'](o=>o!==xB(0x1ef));return yield(0x0,utils_1[xB(0x1bd)])(B,o=>__awaiter(this,void 0x0,void 0x0,function*(){if(K[o]!==undefined)return _['set'](L,o,K[o]);})),L;});}function b(){const xo=xm;switch(g[0x0]){case xo(0x202):return xo(0x18e)+(g[0x1]||xo(0x190))+'s';case xo(0x1b4):return xo(0x1c8)+(g[0x1]||xo(0x190))+'\x20properties';default:return _[xo(0x213)](l)+xo(0x19c);}}function F(K,m){const xG=xm;var S,W,L,v,h,B,o,G;if(!m){const D=(0x0,utils_1[xG(0x21e)])()[xG(0x1be)](_['kebabCase'](l))[xG(0x1cd)](b());return n(D,l),D;}const E=(K===null||K===void 0x0?void 0x0:K[xG(0x225)])?chalk_1['default']['grey'](xG(0x1e7)+K['requiredPermissions']):'',u=x[xG(0x195)][xG(0x207)](),X=u!==undefined&&((S=V===null||V===void 0x0?void 0x0:V[xG(0x1c7)])===null||S===void 0x0?void 0x0:S['docsTagsPath'])!==undefined,R=u===null||u===void 0x0?void 0x0:u['host']['replace'](xG(0x230),''),t=X?xG(0x191)+R+xG(0x1ac)+((W=V===null||V===void 0x0?void 0x0:V[xG(0x1c7)])===null||W===void 0x0?void 0x0:W['docsTagsPath']):'',f=(K===null||K===void 0x0?void 0x0:K[xG(0x1cd)])||'',Y=(0x0,utils_1[xG(0x21e)])(!![])[xG(0x1be)](_[xG(0x1ae)](l))['description'](f)[xG(0x199)](xG(0x1c6),[E,t]['join']('\x0a'));n(Y,l);(((L=V[xG(0x1c7)])===null||L===void 0x0?void 0x0:L[xG(0x21c)])||((v=V['opt'])===null||v===void 0x0?void 0x0:v[xG(0x1d2)]))&&(Y['option'](xG(0x22d),xG(0x1e3)),Y[xG(0x1b3)](xG(0x205),xG(0x163)));P((h=V[xG(0x1c7)])===null||h===void 0x0?void 0x0:h[xG(0x184)],Y),P((B=V[xG(0x1c7)])===null||B===void 0x0?void 0x0:B['query'],Y);const H=(o=V[xG(0x1c7)])===null||o===void 0x0?void 0x0:o[xG(0x1c4)];return H&&P(defaults[xG(0x192)],Y),P((G=V[xG(0x1c7)])===null||G===void 0x0?void 0x0:G[xG(0x1c5)],Y),Y[xG(0x15a)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const xE=xG;var r,i,U,y,C,T;(0x0,utils_1[xE(0x151)])(x);const O=Y[xE(0x233)](),x0=O['page']!==undefined||O[xE(0x1c3)]!==undefined;if(O[xE(0x1ef)]===!![]&&x0)throw new Error(xE(0x182));const x1=O===null||O===void 0x0?void 0x0:O['output'],x2=x1===xE(0x236),x3=x1===xE(0x23c)||x1===xE(0x1ed),x4=yield Q(O);s[xE(0x24e)](x4);const x5=yield k(O),x6=Object['keys']((i=(r=V[xE(0x1c7)])===null||r===void 0x0?void 0x0:r[xE(0x184)])!==null&&i!==void 0x0?i:{})['map'](xN=>xN+'='+chalk_1[xE(0x23a)][xE(0x208)](x4[xN]))['join'](',\x20');if(x6[xE(0x18f)]>0x0&&!x2&&!x3){const xN=xE(0x1a6)+x6;console[xE(0x227)](xN);}const x7=((U=V[xE(0x1c7)])===null||U===void 0x0?void 0x0:U[xE(0x21c)])||((y=V[xE(0x1c7)])===null||y===void 0x0?void 0x0:y[xE(0x1d2)])?yield yield A(O,V,g):undefined;if(!O[xE(0x17c)]&&g[xE(0x14d)](xE(0x1af))&&!(yield s[xE(0x246)]())){(0x0,utils_1[xE(0x222)])('Resource\x20was\x20not\x20deleted.');return;}const x8=H&&(O[xE(0x1ef)]||(O[xE(0x216)]===xE(0x236)||O['output']===xE(0x23c))&&!x0);let x9=x8&&Z instanceof js_client_1['GetApiEndpointPaginated']?yield Z[xE(0x154)]({'options':x5}):yield Z['call']({'parameters':x4,'options':Object[xE(0x1ee)]({},x5),'data':x7});if(O===null||O===void 0x0?void 0x0:O['verbose']){const xc=x9['request'];console[xE(0x227)](xE(0x1b9)+xc[xE(0x1ba)]['toUpperCase']()+':'+xc['url']);if(x7!==undefined)console['log'](xE(0x1fd)+x7);}if(x9[xE(0x1aa)]){const {details:xa,id:xJ,message:xp,status:xe}=x9[xE(0x1aa)],xs=xa?xE(0x24a)+JSON[xE(0x176)](xa):'',xq=xJ?',\x20NF\x20error\x20id:\x20'+xJ:'',xd=xE(0x1d1)+xe+xq+')';throw new Error(xE(0x168)+xp+'\x20'+xd+xs);}let xx=0x0;printCallResult(O,x2,x9[xE(0x167)],x3,g,x1,![],xx,x9[xE(0x16f)]['status']);if(!O[xE(0x215)]&&!x8&&!x0&&((C=x9[xE(0x1b7)])===null||C===void 0x0?void 0x0:C[xE(0x15e)]))while((T=x9[xE(0x1b7)])===null||T===void 0x0?void 0x0:T['hasNextPage']){const xM=yield s[xE(0x18b)](xE(0x1c9));if(xM)process[xE(0x1a8)][xE(0x180)](0x0,-0x1),process[xE(0x1a8)]['clearLine'](0x1),xx+=x9['pagination']['count'],x9=yield x9[xE(0x1b7)][xE(0x23e)](),printCallResult(O,x2,x9[xE(0x167)],x3,g,x1,!![],xx,x9[xE(0x16f)][xE(0x1bf)]);else return;}})),Y;}const I=_[xm(0x14e)](V,'opt'),z=Z,w=F(z,I);M(g,w),c[xm(0x229)](w);const j=_['omit'](V,xm(0x1c7));Object[xm(0x22a)](j)[xm(0x18f)]>0x0&&generateCommands(x,Z,w,a,J,j,g);});function A(l,Z,V){var g;return __awaiter(this,void 0x0,void 0x0,function*(){const xu=a1N,{input:P,file:n}=l;if(P!==undefined)try{return JSON[xu(0x217)](P);}catch(Q){try{return yaml[xu(0x179)](P);}catch(k){throw new Error(xu(0x209));}}if(n!==undefined){if(!fs_1[xu(0x23a)]['existsSync'](n))throw new Error(xu(0x221)+n);const b=fs_1['default']['readFileSync'](n)['toString']();let F;try{if(_[xu(0x1b0)](b)){if(l[xu(0x218)][xu(0x1f2)](xu(0x1c0)))F=JSON['parse'](b);else{if(l[xu(0x218)][xu(0x1f2)]('.yaml')||l[xu(0x218)][xu(0x1f2)]('yml'))F=yaml['safeLoad'](b);else throw new Error(xu(0x234)+l[xu(0x218)][xu(0x17f)]('.')[xu(0x159)]());}}else F=b;return F;}catch(I){throw new Error('Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20'+I['message']);}}if((g=Z===null||Z===void 0x0?void 0x0:Z['opt'])===null||g===void 0x0?void 0x0:g['nonInteractiveEndpoint'])throw new Error(xu(0x172));return yield s[xu(0x1e9)](Z,{'cmdPath':V,'skipValidation':l[xu(0x1b6)]});});}}const printCallResult=(x,N,c,a,J,p,e,s,q)=>{const xX=a1xl;if(!(x===null||x===void 0x0?void 0x0:x[xX(0x215)])){if(N)(0x0,console_format_helpers_1['handleJsonOutput'])(x===null||x===void 0x0?void 0x0:x[xX(0x216)],c);else{if(a)(0x0,console_format_helpers_1[xX(0x240)])(x===null||x===void 0x0?void 0x0:x[xX(0x216)],c);else{if(isListCommand(J)){const d=(p===null||p===void 0x0?void 0x0:p[xX(0x1ca)](xX(0x19a)))?p[xX(0x1d4)](xX(0x19a),'')['split'](',')['map'](V=>V['toLowerCase']()):undefined,M=J[J[xX(0x18f)]-0x1],A=''+M+(M[xX(0x1f2)]('s')?'':'s'),l=_[xX(0x213)](A),Z=_[xX(0x14e)](c,A)?c[A]:c;(0x0,console_format_helpers_1[xX(0x22b)])(Z,l,d,e,s);}else console[xX(0x227)]((0x0,console_format_helpers_1[xX(0x1fc)])(c,q));}}}};
@@ -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 a2F=a2N;function a2N(x,N){const c=a2x();return a2N=function(a,J){a=a-0x19e;let p=c[a];return p;},a2N(x,N);}(function(x,N){const b=a2N,c=x();while(!![]){try{const a=parseInt(b(0x1b0))/0x1+parseInt(b(0x1d3))/0x2+-parseInt(b(0x1da))/0x3+-parseInt(b(0x212))/0x4+parseInt(b(0x1bb))/0x5*(-parseInt(b(0x220))/0x6)+parseInt(b(0x1c9))/0x7+parseInt(b(0x1ad))/0x8;if(a===N)break;else c['push'](c['shift']());}catch(J){c['push'](c['shift']());}}}(a2x,0x71e23));var __createBinding=this&&this['__createBinding']||(Object[a2F(0x1f8)]?function(x,N,c,a){const I=a2F;if(a===undefined)a=c;var J=Object[I(0x1dd)](N,c);(!J||(I(0x1ca)in J?!N['__esModule']:J['writable']||J[I(0x1dc)]))&&(J={'enumerable':!![],'get':function(){return N[c];}}),Object[I(0x1a0)](x,a,J);}:function(x,N,c,a){if(a===undefined)a=c;x[a]=N[c];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object[a2F(0x1f8)]?function(x,N){const z=a2F;Object[z(0x1a0)](x,z(0x1ed),{'enumerable':!![],'value':N});}:function(x,N){x['default']=N;}),__importStar=this&&this['__importStar']||function(x){const w=a2F;if(x&&x[w(0x1be)])return x;var N={};if(x!=null){for(var c in x)if(c!==w(0x1ed)&&Object[w(0x22f)]['hasOwnProperty'][w(0x224)](x,c))__createBinding(N,x,c);}return __setModuleDefault(N,x),N;},__awaiter=this&&this[a2F(0x226)]||function(x,N,c,a){function J(p){return p instanceof c?p:new c(function(e){e(p);});}return new(c||(c=Promise))(function(p,e){const m=a2N;function s(M){const j=a2N;try{d(a[j(0x1b4)](M));}catch(A){e(A);}}function q(M){try{d(a['throw'](M));}catch(A){e(A);}}function d(M){const K=a2N;M[K(0x1b6)]?p(M[K(0x1bf)]):J(M[K(0x1bf)])[K(0x1ae)](s,q);}d((a=a['apply'](x,N||[]))[m(0x1b4)]());});},__importDefault=this&&this[a2F(0x1cf)]||function(x){const S=a2F;return x&&x[S(0x1be)]?x:{'default':x};};Object[a2F(0x1a0)](exports,a2F(0x1be),{'value':!![]}),exports[a2F(0x1f5)]=void 0x0;const _=__importStar(require(a2F(0x209))),node_fetch_1=__importDefault(require(a2F(0x214))),chalk_1=__importDefault(require('chalk')),utils_1=require(a2F(0x21e)),inquirer_helper_1=require(a2F(0x1ef)),console_format_helpers_1=require(a2F(0x1e7)),browser_login_1=require('../login/browser-login'),inquirer=require('inquirer');class CliContext{constructor(x,N=a2F(0x1a9)){const W=a2F;this[W(0x221)]=N,this[W(0x223)]=A=>{const L=W;let l=A;return!/^https?:\/\//i[L(0x1ff)](l)&&(l=L(0x213)+l),l=l[L(0x1d5)](/\/+$/,''),l;},this[W(0x1ec)]=x;const c=new inquirer_helper_1[(W(0x222))](x);this[W(0x20e)]=(0x0,utils_1['getCommand'])()['name']('login')['description']('Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.')[W(0x21d)]('--token-login','Use\x20manual\x20login\x20with\x20API\x20token',![])[W(0x21d)](W(0x22c),W(0x1a6),![])[W(0x21d)]('-n,\x20--name\x20[NAME]','Name\x20for\x20login\x20context')[W(0x21d)](W(0x1b8),W(0x1bd))['option']('--host\x20[HOST]',W(0x1cb),this[W(0x221)])[W(0x21d)](W(0x219),W(0x1e2),![])[W(0x1f6)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const v=W;_[v(0x228)](A,v(0x218),this[v(0x223)](A[v(0x218)]));const l=A[v(0x225)]||A[v(0x19e)]!==undefined,{name:Z,host:V,token:g,override:P}=l?yield this[v(0x1d2)](A,c):yield this['browserLogin'](A,c);try{yield this['apiClient'][v(0x1f1)]['addContext']({'name':Z,'host':V,'token':g},P);}catch(n){(0x0,utils_1[v(0x22d)])(n[v(0x208)]);return;}if(!(yield this[v(0x20b)]()))(0x0,utils_1[v(0x22d)])(v(0x1e8)),yield this[v(0x1ec)][v(0x1f1)][v(0x1fc)](Z);else{const Q=l?v(0x229):v(0x205),k=v(0x207)+Q+v(0x1af)+chalk_1[v(0x1ed)][v(0x227)](Z)+'\x20(api\x20host:\x20'+V+')';(0x0,utils_1[v(0x1db)])(k);}})),this[W(0x1c2)]=(0x0,utils_1[W(0x1eb)])()[W(0x1c6)](W(0x1b9))[W(0x1d6)](W(0x201))['alias'](W(0x1c2))[W(0x1f0)]('ctx');const a=(0x0,utils_1[W(0x1eb)])()[W(0x1c6)](W(0x1e9))['name']('ls')['description'](W(0x1e5))[W(0x21d)](W(0x1a1),W(0x22b))['action'](A=>__awaiter(this,void 0x0,void 0x0,function*(){const h=W;console[h(0x211)](x['contextProvider'][h(0x1aa)]());const l=x['contextProvider'][h(0x1d1)]();if(A[h(0x1e0)]===!![]){console['dir'](l);return;}const Z=l[h(0x21f)],V=l[h(0x1c2)][h(0x1c3)]((g,P)=>g[h(0x1c6)]===Z?-0x1:P[h(0x1c6)]===Z?0x1:0x0)['map'](g=>{const B=h,P=Z===g[B(0x1c6)]?B(0x1a7):'';return{'Name':''+g[B(0x1c6)]+P,'Host':g[B(0x218)],'Default\x20Project':g['project']||'-','Default\x20Service':g[B(0x1d8)]||'-'};});(0x0,console_format_helpers_1[h(0x1fd)])(V,'Contexts');})),J=(0x0,utils_1[W(0x1eb)])();J[W(0x1c6)](W(0x1c4))[W(0x1d6)]('Switch\x20between\x20your\x20local\x20contexts')[W(0x21d)](W(0x20c),'Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name')[W(0x1f6)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const o=W,l=(A===null||A===void 0x0?void 0x0:A['name'])||(yield this[o(0x1ee)]('use'));yield this[o(0x1ec)][o(0x1f1)][o(0x1ce)](l),(0x0,utils_1[o(0x1db)])(o(0x1d4)+l);}));const p=W(0x21b),e=(0x0,utils_1[W(0x1eb)])()['name'](W(0x1cd))['description']('Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context')[W(0x21d)](p,W(0x21c))[W(0x1f6)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const G=W,l=(A===null||A===void 0x0?void 0x0:A['id'])||(yield c['askForProject']());yield this[G(0x1ec)][G(0x1f1)][G(0x1b2)](l),console[G(0x211)](G(0x1c5),l);})),s=(0x0,utils_1[W(0x1eb)])()[W(0x1c6)](W(0x1d8))[W(0x1d6)](W(0x204))['option'](p,'Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')[W(0x1f6)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const E=W,l=(A===null||A===void 0x0?void 0x0:A['id'])||(yield c['askForService'](this[E(0x1a8)]())());console[E(0x211)]('Use\x20service\x20with\x20id:',l),yield this['apiClient'][E(0x1f1)][E(0x1b7)](l);})),q=(0x0,utils_1[W(0x1eb)])()[W(0x1c6)](W(0x1a2))['description'](W(0x1df))[W(0x21d)](p,W(0x1c8))[W(0x1f6)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const u=W,l=(A===null||A===void 0x0?void 0x0:A['id'])||(yield c['askForJob'](this[u(0x1a8)]())());console[u(0x211)](u(0x1b3),l),yield this['apiClient'][u(0x1f1)][u(0x1f3)](l);}));J[W(0x216)](e),J['addCommand'](q),J['addCommand'](s);const d=(0x0,utils_1[W(0x1eb)])()[W(0x1c6)](W(0x1f7))['alias']('delete')['alias']('rm')['description'](W(0x203))[W(0x21d)](p,W(0x1d0))[W(0x1f6)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const X=W;var l;const Z=(A===null||A===void 0x0?void 0x0:A['id'])||(yield this[X(0x1ee)](X(0x1f7))),V=(l=this['apiClient']['contextProvider'][X(0x20d)]())===null||l===void 0x0?void 0x0:l[X(0x1c6)];yield this[X(0x1ec)][X(0x1f1)][X(0x1fc)](Z),(0x0,utils_1['success'])('Local\x20context\x20\x27'+Z+'\x27\x20successfully\x20removed.');if(!this[X(0x1fa)]()){(0x0,utils_1[X(0x1e6)])(X(0x210));return;}if(V===Z){const g=(A===null||A===void 0x0?void 0x0:A[X(0x1c6)])||(yield this[X(0x1ee)](X(0x1ab)));yield this['apiClient'][X(0x1f1)][X(0x1ce)](g),(0x0,utils_1[X(0x1db)])(X(0x1d4)+g);}})),M=(0x0,utils_1[W(0x1eb)])()[W(0x1c6)](W(0x1cc))[W(0x1f0)]('set-token')[W(0x1d6)](W(0x1ea))[W(0x21d)](W(0x1b8),W(0x20f))[W(0x1f6)](A=>__awaiter(this,void 0x0,void 0x0,function*(){const R=W,{contextProvider:l}=this[R(0x1ec)],Z=(A===null||A===void 0x0?void 0x0:A['token'])||(yield c['tokenPrompt']()),V=l['getCurrentToken']();yield l[R(0x1e4)](Z);if(yield this[R(0x20b)]())(0x0,utils_1[R(0x1db)])(R(0x1e1)+l['getCurrentName']()+'\x27\x20successfully\x20updated.');else{if(V)yield l[R(0x1e4)](V);(0x0,utils_1[R(0x22d)])(R(0x1d7));}}));this[W(0x1c2)][W(0x216)](a),this[W(0x1c2)][W(0x216)](J),this[W(0x1c2)]['addCommand'](d),this['contexts']['addCommand'](M);}[a2F(0x1ba)](x,N){var c,a,J,p;return __awaiter(this,void 0x0,void 0x0,function*(){const t=a2N,e=!x[t(0x1c1)],s=(c=x[t(0x218)])!==null&&c!==void 0x0?c:this[t(0x221)],q=new browser_login_1['NorthflankApiBrowserLogin'](s,e);let d;q['on']('browser-opened',({url:Z})=>{const f=t;if(e){const V=Z['replace'](/sessionToken=.*/,f(0x1f9));console['log'](f(0x20a)+V+')'),d=inquirer['prompt']([{'type':f(0x1c0),'name':f(0x22e),'message':'Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','default':![]}]),d[f(0x1ae)](g=>{const Y=f;process[Y(0x21a)][Y(0x1a4)](0x0,-0x1),process[Y(0x21a)][Y(0x1c7)](0x1),g['fullUrl']&&console['log'](Y(0x1bc)+Z+'\x20');});}else console[f(0x211)]('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+Z+'\x20');});const {token:M,contextName:A}=yield q[t(0x217)]()[t(0x1a3)](Z=>__awaiter(this,void 0x0,void 0x0,function*(){const H=t;(0x0,utils_1['error'])(H(0x206)+Z[H(0x208)]+H(0x1de));const V=yield this[H(0x1d2)](x,N);return{'token':V[H(0x19e)],'contextName':V[H(0x1c6)]};}))['finally'](()=>{const D=t;if(d)d['ui'][D(0x215)]();}),l=(J=(a=x[t(0x1c6)])!==null&&a!==void 0x0?a:A)!==null&&J!==void 0x0?J:'autologin-'+new Date()[t(0x1d9)]();return{'name':l,'token':M,'host':s,'override':(p=x[t(0x19f)])!==null&&p!==void 0x0?p:![]};});}[a2F(0x1d2)](x,N){return __awaiter(this,void 0x0,void 0x0,function*(){const r=a2N,c=this['apiClient'][r(0x1f1)][r(0x1d1)]()['contexts'],{name:a,token:J,host:p,override:e}=yield N[r(0x1f4)](x,c);return{'name':a,'token':J,'host':p,'override':e};});}[a2F(0x1a8)](){const i=a2F,x=this[i(0x1ec)][i(0x1f1)]['getCurrentProjectName']();if(x===undefined)throw new Error(i(0x202));return x;}[a2F(0x1ee)](x){return __awaiter(this,void 0x0,void 0x0,function*(){const U=a2N;if(!this['contextAvailable']())throw new Error(U(0x200));const N=this['apiClient'][U(0x1f1)][U(0x1d1)]()[U(0x1c2)][U(0x1ac)](a=>a[U(0x1c6)]),c=N['length']>0x4?U(0x1fb):U(0x1e9);return(yield inquirer[U(0x22a)]([{'type':c,'name':'name','message':U(0x1b1)+x+':','choices':N}]))[U(0x1c6)];});}[a2F(0x1fa)](){const y=a2F;return this[y(0x1ec)]['contextProvider']['loadContextWrapper']()[y(0x1c2)][y(0x230)]>0x0;}['verifyToken'](){return __awaiter(this,void 0x0,void 0x0,function*(){const C=a2N;try{const x=this['apiClient'][C(0x1f1)][C(0x1a5)](),N=this[C(0x1ec)][C(0x1f1)][C(0x1e3)](),c=x+C(0x1fe),a={'Authorization':C(0x1f2)+N},J=yield(0x0,utils_1['retry'])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const T=C;return(0x0,node_fetch_1[T(0x1ed)])(c,{'method':T(0x1b5),'timeout':0xbb8,'headers':a});}));if(J['ok'])return!![];return![];}catch(p){return![];}});}}function a2x(){const O=['italic','set','token\x20login','prompt','Shows\x20full\x20context\x20information\x20(including\x20tokens)','--do-not-open-browser','error','fullUrl','prototype','length','token','override','defineProperty','--all','job','catch','moveCursor','getCurrentBaseUrl','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','\x20(current)','getProjectName','https://api.northflank.com','getInfo','use\x20from\x20now\x20on','map','10092424wXJhew','then',',\x20added\x20context\x20with\x20name\x20','369519qecEVA','Choose\x20the\x20context\x20to\x20','useProjectId','Use\x20job\x20with\x20id:','next','GET','done','useServiceId','-t,\x20--token\x20[TOKEN]','context','browserLogin','781490eABeOm','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','__esModule','value','confirm','doNotOpenBrowser','contexts','sort','use','Use\x20project\x20with\x20id:','name','clearLine','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','1475803JNSSLT','get','host\x20url\x20for\x20this\x20context','update-token','project','useContext','__importDefault','Local\x20context\x20name\x20to\x20remove.','loadContextWrapper','apiTokenLogin','329576QoQcci','Changed\x20current\x20context\x20to\x20','replace','description','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','service','valueOf','974319pGutXW','success','configurable','getOwnPropertyDescriptor','.\x20Using\x20fallback.','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','all','Token\x20for\x20current\x20context\x20\x27','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','getCurrentToken','updateToken','List\x20all\x20available\x20contexts','warning','../formatting/console-format-helpers','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','list','Update\x20token\x20for\x20current\x20context','getCommand','apiClient','default','askForContext','../inquirer-helper','alias','contextProvider','Bearer\x20','useJobId','loginPrompt','CliContext','action','remove','create','sessionToken=********','contextAvailable','search-list','removeContext','printAsTable','/v1/login','test','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','Retrieve\x20and\x20update\x20local\x20context\x20settings.','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','Remove\x20a\x20context','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','browser\x20login','Error\x20occured\x20during\x20browser\x20login:\x20','\x0aSuccessfully\x20logged\x20in\x20using\x20','message','lodash','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','verifyToken','-n,\x20--name\x20[NAME]','getCurrentContext','login','Token\x20for\x20this\x20context','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','log','2361028rtqVhS','https://','node-fetch','close','addCommand','startLogin','host','--override','stdout','-i,\x20--id\x20[ID]','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','option','../utils','current','24WieOfI','defaultBaseUrl','InquirerHelper','sanitiseHostname','call','tokenLogin','__awaiter'];a2x=function(){return O;};return a2x();}exports[a2F(0x1f5)]=CliContext;