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