@northflank/cli 0.9.24 → 0.9.26
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.
- package/dist/api-helpers.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/context/contextCommands.js +1 -1
- package/dist/defaults.js +1 -1
- package/dist/exec/index.js +1 -1
- package/dist/formatting/command-overview.js +1 -1
- package/dist/formatting/console-format-helpers.js +1 -1
- package/dist/formatting/terminal-chart.js +1 -1
- package/dist/inquirer-helper.js +1 -1
- package/dist/login/browser-login.js +1 -1
- package/dist/logs/index.js +1 -1
- package/dist/logs/log-formatter.js +1 -1
- package/dist/metrics/index.js +1 -1
- package/dist/pagination/inquirer-pagination-prompt.js +1 -1
- package/dist/port-forward/index.js +1 -1
- package/dist/utils.js +1 -1
- package/package.json +4 -4
package/dist/metrics/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const a12N=a12e;(function(F,e){const C=a12e,G=F();while(!![]){try{const u=parseInt(C(0x1ab))/0x1+-parseInt(C(0x12e))/0x2*(-parseInt(C(0x15b))/0x3)+parseInt(C(0x1b9))/0x4+parseInt(C(0x152))/0x5*(parseInt(C(0x1b7))/0x6)+-parseInt(C(0x16d))/0x7+-parseInt(C(0x13b))/0x8+-parseInt(C(0x1b5))/0x9;if(u===e)break;else G['push'](G['shift']());}catch(R){G['push'](G['shift']());}}}(a12F,0x4ff52));var __awaiter=this&&this[a12N(0x13c)]||function(F,e,G,u){function R(b){return b instanceof G?b:new G(function(W){W(b);});}return new(G||(G=Promise))(function(b,W){const g=a12e;function V(t){try{m(u['next'](t));}catch(T){W(T);}}function a(t){const I=a12e;try{m(u[I(0x199)](t));}catch(T){W(T);}}function m(t){const Y=a12e;t[Y(0x19e)]?b(t[Y(0x153)]):R(t['value'])['then'](V,a);}m((u=u[g(0x192)](F,e||[]))[g(0x171)]());});},__importDefault=this&&this[a12N(0x1b1)]||function(F){const Q=a12N;return F&&F[Q(0x194)]?F:{'default':F};};Object[a12N(0x1b8)](exports,a12N(0x194),{'value':!![]}),exports[a12N(0x164)]=void 0x0;function a12e(F,e){const G=a12F();return a12e=function(u,R){u=u-0x12a;let b=G[u];return b;},a12e(F,e);}function a12F(){const FF=['2953552vssSxr','printMetricsSingle','slice','askForContainer','next','apiClient','getCommand','rows','toFixed','map','toUpperCase','--container\x20--containerId\x20[NAME]','charAt','getMetricsCommand','filter','Option','askForJobRun','service','Deployment\x20id,\x20example:\x20my-service-54785f4','assertContextExisting','name','getPaddingDataStart','Container\x20to\x20exec\x20into\x20(logs\x20from\x20all\x20containers\x20will\x20be\x20shown\x20if\x20not\x20specified)','clear','time','job','length','Get\x20metrics\x20for\x20the\x20specified\x20',',\x20volume:\x20','\x20to\x20get\x20logs\x20from','noDefaults','Error\x20while\x20fetching\x20metrics\x20entries:\x20','metrics','getCurrentServiceName','pct','toISOString','metric','apply','getTime','__esModule','keys',',\x20to:\x20','refreshInterval','parseDateInput','throw',',\x20metric\x20types:\x20','chalk','error','Get\x20metrics\x20before\x20this\x20timestamp,\x20','done',',\x20from:\x20','getCurrentProjectName','../utils','conflicts','toTimeString','metricUnit','containerId','stdout','-o,\x20--output\x20[output]','min','deploymentId','Get\x20metrics\x20after\x20this\x20timestamp,\x20','608688xCDCpm','printInitInfo','all\x20containers','flatMap','addon','--deployment\x20--deploymentId\x20[deploymentId]','__importDefault','commander','\x20seconds','details','10975824lDWudN','buildId','129612jxCDUw','defineProperty','2095148NIFtuE','bold','Build\x20to\x20get\x20logs\x20from','printMetricsTable','default','InquirerHelper','data','argParser','Project\x20for\x20logs','tsHint','jobId','yaml','getStandardMetricsCommand','14GMqxgm','--build\x20--buildId\x20[buildId]','addonId','askForAddon','askForJob','addOption','printAsTable','yml','description','log','printMetricsGraph','format','\x20--','1441416KoVGsV','__awaiter','metricsSingle','Metrics\x20for\x20','container\x20','values','handleError','assign','\x20for\x20container:\x20','exit','getPaddingDataEnd','choices','\x20of\x20','push','json','../inquirer-helper','ApiClient','metricsApiClient','Id\x20[NAME]','forEach','--duration\x20[duration]','Job\x20run\x20id,\x20example:\x20162b1977-6636-4000-929b-cc265b862ff0','metricId','95iylZXZ','value','Length\x20of\x20timespan\x20in\x20seconds.\x20Only\x20valid\x20if\x20not\x20both,\x20startTime\x20and\x20endTime\x20are\x20set','max','printResponse','unshift','isNaN','Output\x20formatting.\x20Will\x20use\x20advanced\x20formatting\x20by\x20default.','metadata','259818BOUsFB','customUserAgent','metricsRange','message','-t,\x20--metricTypes\x20<metricTypes...>','inquirerHelper','build-','N/A','askForService','CliMetrics','--noDefaults','Which\x20metric\x20type\x20to\x20fetch','runId','--run\x20--runId\x20[runId]','@northflank/js-client','apiContext','option','--project\x20--projectId\x20[NAME]'];a12F=function(){return FF;};return a12F();}const js_client_1=require(a12N(0x169)),utils_1=require(a12N(0x1a1)),inquirer_helper_1=require(a12N(0x14a)),commander_1=require(a12N(0x1b2)),terminal_chart_1=require('../formatting/terminal-chart'),console_format_helpers_1=require('../formatting/console-format-helpers'),chalk_1=__importDefault(require(a12N(0x19b)));class CliMetrics{constructor(F){const S=a12N;this[S(0x16a)]=F,this[S(0x197)]=0x2710,this[S(0x12d)]=(e,G)=>{const j=S,u=(0x0,utils_1[j(0x173)])(!![])[j(0x181)]((G?j(0x161):'')+j(0x18d))['alias']((G?j(0x161):'')+j(0x191))[j(0x136)](j(0x188)+e)[j(0x16b)](j(0x16c),j(0x1c1))['option']('--'+e+j(0x13a)+e+j(0x14d),e[j(0x179)](0x0)[j(0x177)]()+e[j(0x16f)](0x1)+j(0x18a))[j(0x16b)](j(0x178),j(0x183))[j(0x16b)]('--startTime\x20<timestamp>',j(0x1aa)+utils_1[j(0x12a)],utils_1[j(0x198)])[j(0x16b)]('--endTime\x20<timestamp>',j(0x19d)+utils_1['tsHint'],utils_1['parseDateInput'])[j(0x16b)](j(0x14f),j(0x154))[j(0x133)](new commander_1[(j(0x17c))](j(0x1a7),j(0x159))['choices'](Object[j(0x140)]([j(0x139),j(0x149),j(0x12c)])))[j(0x133)](new commander_1[(j(0x17c))](j(0x15f),j(0x166))[j(0x146)](Object[j(0x140)](js_client_1['MetricType'])))[j(0x133)](new commander_1[(j(0x17c))]('--timestamp\x20[timestamp]','Get\x20metrics\x20at\x20this\x20exact\x20timestamp,\x20if\x20no\x20timestamp\x20set\x20most\x20recent\x20time\x20is\x20used.\x20'+utils_1[j(0x12a)])[j(0x1c0)](utils_1['parseDateInput'])[j(0x1a2)](['startTime','endTime']))[j(0x16b)](j(0x165),'Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.',![])['addOption'](new commander_1['Option'](j(0x1a7),j(0x159))[j(0x146)](Object['values']([j(0x139),j(0x149),'yaml'])));if(G)u[j(0x16b)](j(0x12f),j(0x1bb));if(e==='job')u[j(0x16b)](j(0x168),j(0x150));if(e==='service')u[j(0x16b)](j(0x1b0),j(0x17f));return u;},this[S(0x138)]=(e,G)=>{return u=>{const q=a12e,R=Object['keys'](u)[q(0x1ae)](b=>{const f=q,{values:W,metricInfo:V}=u[b],{metricUnit:a,metricResolution:m}=V;return W[f(0x176)](t=>{const H=f;var T,Z;const {metadata:n,data:v}=t,A=G?(G===null||G===void 0x0?void 0x0:G[H(0x193)]())>new Date()['getTime']()?new Date():G:undefined,w=new Date((T=v===null||v===void 0x0?void 0x0:v[0x0])===null||T===void 0x0?void 0x0:T['ts']),o=new Date((Z=v===null||v===void 0x0?void 0x0:v[v[H(0x187)]-0x1])===null||Z===void 0x0?void 0x0:Z['ts']),i=this[H(0x182)](e,w,m),c=this[H(0x145)](A,o,m),l=[...i,...v,...c],X=l[H(0x176)](p=>[new Date(p['ts'])['valueOf'](),Number(p[H(0x153)])])[H(0x17b)](p=>!Number[H(0x158)](p[0x0])),h=Math[H(0x1a8)](Math[H(0x155)](process['stdout']['columns']-0xa,0xa),0x64),d=Math[H(0x1a8)](Math[H(0x155)](process[H(0x1a6)][H(0x174)]-0x9,0xa),0xf),B=a==='pct'?0x64:undefined,x=a===H(0x18f)?'%':a,r=(0x0,terminal_chart_1['downSampleData'])(X,h),k=r[H(0x176)](p=>p[0x1]),K={'min':0x0,'height':d,'max':B,'unit':x,'startTs':e!==null&&e!==void 0x0?e:w,'endTs':A!==null&&A!==void 0x0?A:o};return{'dataSeries':k,'metadata':n,'chartOpts':K,'metricInfo':V};});})['flat']();if(R[q(0x187)]===0x0)(0x0,utils_1['warning'])('No\x20metrics\x20found\x20for\x20this\x20query');else R[q(0x14e)](b=>{const s=q,{dataSeries:W,metadata:V,chartOpts:a,metricInfo:m}=b,{containerId:t,volumeId:T}=V,Z=T?s(0x189)+T:'';console[s(0x137)](m[s(0x151)]+s(0x143)+chalk_1['default'][s(0x1ba)](t)+Z),console[s(0x137)]((0x0,terminal_chart_1['getAsciiChart'])(W,a));});};},this['printMetricsTable']=(e,G,u)=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const y=S;try{const R=yield this['metricsApiClient'][y(0x18d)]['metricsSingle'](e,G,u);console[y(0x184)]();if(R[y(0x19c)])(0x0,utils_1[y(0x19c)])('Error\x20while\x20fetching\x20metrics\x20entries:\x20'+R[y(0x19c)][y(0x15e)]);else this[y(0x16e)](R[y(0x1bf)]);}catch(b){console[y(0x184)](),(0x0,utils_1[y(0x19c)])(y(0x18c)+b['message']);}}),this[S(0x141)]=e=>{const E=S;if(e[E(0x19c)]){const G=JSON['stringify'](e[E(0x19c)][E(0x1b4)]);throw new Error('Error\x20while\x20fetching\x20metrics\x20entries:\x20'+e[E(0x19c)][E(0x15e)]+'\x20'+G);}},this[S(0x1ac)]=(e,G,u,R,b)=>{const J=S;if(b===!![])return;const {metricTypes:W,endTime:V,startTime:a,duration:m,containerId:t}=R,T=a?J(0x19f)+a[J(0x190)]():'',Z=V?J(0x196)+V[J(0x190)]():'',n=m?',\x20duration:\x20'+m+J(0x1b3):'',v=t?J(0x13f)+chalk_1[J(0x1bd)][J(0x1ba)](t):J(0x1ad),A=e+'\x20'+chalk_1[J(0x1bd)]['bold'](G)+'\x20in\x20project\x20'+chalk_1[J(0x1bd)]['bold'](u),w=''+T+Z+n,o=W?J(0x19a)+(W===null||W===void 0x0?void 0x0:W['join'](',')):'';console['log'](J(0x13e)+v+J(0x147)+A+o+w);},this['apiClient']=new js_client_1[(S(0x14b))](F,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[S(0x15c)]}),this[S(0x14c)]=this[S(0x172)],this[S(0x160)]=new inquirer_helper_1[(S(0x1be))](this[S(0x172)]);}[a12N(0x17a)](F,e=![]){const F1=a12N,G=(V,a)=>__awaiter(this,void 0x0,void 0x0,function*(){const M=a12e,m=a[M(0x18b)],{apiContext:t,inquirerHelper:T}=this;switch(F){case M(0x17e):{const Z=m?undefined:t[M(0x18e)]();return a['serviceId']||Z||(yield T[M(0x163)](V)());}case M(0x186):{const n=m?undefined:t[M(0x18e)]();return a[M(0x12b)]||n||(yield T[M(0x132)](V)());}case M(0x1af):{const v=m?undefined:t[M(0x18e)]();return a[M(0x130)]||v||(yield T[M(0x131)](V)());}}}),u=(V,a,m)=>__awaiter(this,void 0x0,void 0x0,function*(){const L=a12e;if(e)return m[L(0x1b6)]||(yield this['inquirerHelper']['askForBuild'](V,F==='service'?a:undefined,F==='job'?a:undefined,!![])());return undefined;}),R=(V,a,m)=>__awaiter(this,void 0x0,void 0x0,function*(){const P=a12e;if(!e&&m[P(0x1a5)]!==undefined){if(m[P(0x1a5)]!==!![])return m['containerId'];return yield this[P(0x160)][P(0x170)](V,F===P(0x17e)?a:undefined,F===P(0x186)?a:undefined,!![])();}return undefined;}),b=(V,a,m)=>__awaiter(this,void 0x0,void 0x0,function*(){const U=a12e;if(F===U(0x186))return m[U(0x167)]||(yield this[U(0x160)][U(0x17d)](a,V,!![])());return undefined;}),W=(V,a,m)=>__awaiter(this,void 0x0,void 0x0,function*(){const F0=a12e;if(F===F0(0x17e)){if(m[F0(0x1a9)]!==!![])return m[F0(0x1a9)];return m[F0(0x1a9)];}return undefined;});return this[F1(0x12d)](F,e)['action'](V=>__awaiter(this,void 0x0,void 0x0,function*(){const F2=F1,{noDefaults:a,projectId:m,duration:t,timestamp:T,output:Z,startTime:n,endTime:v,metricTypes:A,quiet:w}=V;(0x0,utils_1[F2(0x180)])(this[F2(0x172)]);if(n&&v&&t)throw new Error('Only\x20two\x20of\x20\x27startTime\x27,\x20\x27endTime\x27\x20and\x20\x27duration\x27\x20can\x20be\x20set.');const {apiContext:o,inquirerHelper:i,metricsApiClient:c}=this,l=a?undefined:o[F2(0x1a0)](),X=m||l||(yield i['askForProject']()),h=yield G(X,V),d=yield u(X,h,V),B=yield b(X,h,V),x=yield W(X,h,V),r=yield R(X,h,V),k={'projectId':X,'entityId':h},K={'containerName':r,'startTime':n,'endTime':v,'duration':t,'timestamp':T,'metricTypes':A,'runId':B,'buildId':d,'deploymentId':x,'isBuild':e!==null&&e!==void 0x0?e:![]},p=!(n||v||t);if(!w&&Z!==F2(0x12c)&&Z!==F2(0x135)&&Z!==F2(0x149))this['printInitInfo'](F,h,X,K,w);if(p){if(Z!==undefined){const O=yield c['metrics'][F2(0x13d)](k,K,F);this['handleError'](O),(0x0,console_format_helpers_1[F2(0x156)])(Z,O['data']);}else[...Array(process[F2(0x1a6)]['rows']-0x1)][F2(0x14e)]((D,z)=>z===0x0?console['log']('Fetching\x20data..'):console[F2(0x137)]()),yield this[F2(0x1bc)](k,K,F)(),setInterval(this[F2(0x1bc)](k,K,F),this[F2(0x197)]),yield new Promise(D=>setTimeout(D,this[F2(0x197)]*0x64));}else{const D=yield c[F2(0x18d)][F2(0x15d)](k,K,F);this[F2(0x141)](D),Z!==undefined?(0x0,console_format_helpers_1[F2(0x156)])(Z,D[F2(0x1bf)]):this[F2(0x138)](n,v!==null&&v!==void 0x0?v:new Date())(D['data']);}process[F2(0x144)]();}));}[a12N(0x16e)](F){const F5=a12N,e=(R,b)=>{const F3=a12e;if(!(b===null||b===void 0x0?void 0x0:b[F3(0x153)]))F3(0x162);const W=R[F3(0x1a4)]===F3(0x18f)?'%':R[F3(0x1a4)];return''+Number(b===null||b===void 0x0?void 0x0:b[F3(0x153)])[F3(0x175)](0x3)+W;},G=R=>{const F4=a12e;if(!(R===null||R===void 0x0?void 0x0:R['ts']))F4(0x162);return R['ts'][F4(0x1a3)]()['split']('\x20')[0x0];},u={};Object[F5(0x195)](F)['forEach'](R=>{const F6=F5,{values:b,metricInfo:W}=F[R];return b[F6(0x14e)](V=>{const F7=F6;var a,t;const T=V[F7(0x15a)][F7(0x1a5)];Object[F7(0x142)](u,{[T]:Object['assign'](Object[F7(0x142)]({},u===null||u===void 0x0?void 0x0:u[T]),{[F7(0x185)]:G((a=V['data'])===null||a===void 0x0?void 0x0:a[0x0]),'containerId':T,[W[F7(0x151)]]:e(W,(t=V[F7(0x1bf)])===null||t===void 0x0?void 0x0:t[0x0])})});});}),(0x0,console_format_helpers_1[F5(0x134)])(Object[F5(0x140)](u),'Metrics\x20overview');}[a12N(0x182)](F,e,G){const F8=a12N,u=W=>new Date(W[F8(0x193)]()-R),R=G*0x3e8;if(!F)return[];if(!e)return[];if(u(e)[F8(0x193)]()<F[F8(0x193)]())return[];const b=[{'ts':u(e),'value':0x0}];while(u(b[b[F8(0x187)]-0x1]['ts'])[F8(0x193)]()<=F['getTime']()){b[F8(0x157)]({'ts':u(b[b[F8(0x187)]-0x1]['ts']),'value':0x0});}return b;}[a12N(0x145)](F,e,G){const F9=a12N,u=W=>new Date(W[F9(0x193)]()+R),R=G*0x3e8;if(!F)return[];if(!e)return[];if(u(e)[F9(0x193)]()>F[F9(0x193)]())return[];const b=[{'ts':u(e),'value':0x0}];while(u(b[b['length']-0x1]['ts'])['getTime']()<=F['getTime']()){b[F9(0x148)]({'ts':u(b[b['length']-0x1]['ts']),'value':0x0});}return b;}}exports[a12N(0x164)]=CliMetrics;
|
|
1
|
+
'use strict';const a12i=a12v;function a12T(){const T9=['containerId','@northflank/js-client','printMetricsSingle','Option','serviceId','\x20of\x20','No\x20metrics\x20found\x20for\x20this\x20query','Container\x20to\x20exec\x20into\x20(logs\x20from\x20all\x20containers\x20will\x20be\x20shown\x20if\x20not\x20specified)','printAsTable','chalk','customUserAgent','\x20--','clear','printInitInfo','3630kKbMJn','getTime','getCurrentProjectName','printMetricsGraph','Get\x20metrics\x20after\x20this\x20timestamp,\x20','askForJobRun','\x20for\x20container:\x20','stringify','Output\x20formatting.\x20Will\x20use\x20advanced\x20formatting\x20by\x20default.','getMetricsCommand','jobId','2067016lGnShs','askForAddon','flat','refreshInterval','apiContext','ApiClient','toISOString','askForJob','Job\x20run\x20id,\x20example:\x20162b1977-6636-4000-929b-cc265b862ff0','metricsApiClient','stdout','904131QWvpvW','--endTime\x20<timestamp>','rows','filter','defineProperty','Get\x20metrics\x20before\x20this\x20timestamp,\x20','--duration\x20[duration]','1490148ZHLwwS','1328019cSfgmd','MetricType','valueOf','Metrics\x20overview','details','error','min','forEach','askForProject','--run\x20--runId\x20[runId]','option','parseDateInput','then','5515AnVVre','warning','__esModule','printMetricsTable','printResponse','handleError','../inquirer-helper','metadata',',\x20duration:\x20','data','addonId','getCurrentServiceName','log','tsHint','deploymentId','choices','metricUnit','charAt','toUpperCase','conflicts','columns','action','bold','apply','1125BGNpao','490FbcSrw','description','throw','addOption','__importDefault','metrics','values','CliMetrics','runId','endTime','getPaddingDataStart','toFixed','slice','Build\x20to\x20get\x20logs\x20from','assign','../utils','exit','pct','270KpoLnQ','--project\x20--projectId\x20[NAME]','max','metricsSingle','build-','inquirerHelper','default','service','-o,\x20--output\x20[output]','message','map','Length\x20of\x20timespan\x20in\x20seconds.\x20Only\x20valid\x20if\x20not\x20both,\x20startTime\x20and\x20endTime\x20are\x20set','job','value','--timestamp\x20[timestamp]','done','join','Get\x20metrics\x20at\x20this\x20exact\x20timestamp,\x20if\x20no\x20timestamp\x20set\x20most\x20recent\x20time\x20is\x20used.\x20','getPaddingDataEnd','yaml','next','--container\x20--containerId\x20[NAME]','askForService','alias','metricId','../formatting/console-format-helpers','apiClient','isNaN','getStandardMetricsCommand','getCommand','metric','Which\x20metric\x20type\x20to\x20fetch',',\x20to:\x20','all\x20containers','json','--deployment\x20--deploymentId\x20[deploymentId]',',\x20metric\x20types:\x20','container\x20','yml','length','askForContainer','askForBuild','--startTime\x20<timestamp>','Project\x20for\x20logs','Metrics\x20for\x20','addon','commander','182205YPXHul','keys'];a12T=function(){return T9;};return a12T();}(function(T,v){const S=a12v,W=T();while(!![]){try{const l=-parseInt(S(0x225))/0x1*(-parseInt(S(0x238))/0x2)+parseInt(S(0x1f8))/0x3+parseInt(S(0x1ff))/0x4+parseInt(S(0x20d))/0x5*(parseInt(S(0x1e2))/0x6)+parseInt(S(0x200))/0x7+-parseInt(S(0x1ed))/0x8+parseInt(S(0x1d2))/0x9*(-parseInt(S(0x226))/0xa);if(l===v)break;else W['push'](W['shift']());}catch(N){W['push'](W['shift']());}}}(a12T,0x69937));function a12v(T,v){const W=a12T();return a12v=function(l,N){l=l-0x1b9;let y=W[l];return y;},a12v(T,v);}var __awaiter=this&&this['__awaiter']||function(T,v,W,l){function N(y){return y instanceof W?y:new W(function(D){D(y);});}return new(W||(W=Promise))(function(y,D){const E=a12v;function w(U){try{I(l['next'](U));}catch(k){D(k);}}function e(U){const d=a12v;try{I(l[d(0x228)](U));}catch(k){D(k);}}function I(U){const h=a12v;U[h(0x247)]?y(U['value']):N(U[h(0x245)])[h(0x20c)](w,e);}I((l=l[E(0x224)](T,v||[]))[E(0x24c)]());});},__importDefault=this&&this[a12i(0x22a)]||function(T){const M=a12i;return T&&T[M(0x20f)]?T:{'default':T};};Object[a12i(0x1fc)](exports,'__esModule',{'value':!![]}),exports[a12i(0x22d)]=void 0x0;const js_client_1=require(a12i(0x1d5)),utils_1=require(a12i(0x235)),inquirer_helper_1=require(a12i(0x213)),commander_1=require(a12i(0x1d1)),terminal_chart_1=require('../formatting/terminal-chart'),console_format_helpers_1=require(a12i(0x1bc)),chalk_1=__importDefault(require(a12i(0x1dd)));class CliMetrics{constructor(T){const p=a12i;this[p(0x1f1)]=T,this['refreshInterval']=0x2710,this['getStandardMetricsCommand']=(v,W)=>{const Z=p,l=(0x0,utils_1[Z(0x1c0)])(!![])['name']((W?Z(0x23c):'')+Z(0x22b))[Z(0x1ba)]((W?Z(0x23c):'')+Z(0x1c1))[Z(0x227)]('Get\x20metrics\x20for\x20the\x20specified\x20'+v)['option'](Z(0x239),Z(0x1ce))[Z(0x20a)]('--'+v+Z(0x1df)+v+'Id\x20[NAME]',v[Z(0x21e)](0x0)[Z(0x21f)]()+v[Z(0x232)](0x1)+'\x20to\x20get\x20logs\x20from')[Z(0x20a)](Z(0x24d),Z(0x1db))['option'](Z(0x1cd),Z(0x1e6)+utils_1[Z(0x21a)],utils_1['parseDateInput'])['option'](Z(0x1f9),Z(0x1fd)+utils_1[Z(0x21a)],utils_1[Z(0x20b)])['option'](Z(0x1fe),Z(0x243))[Z(0x229)](new commander_1[(Z(0x1d7))]('-o,\x20--output\x20[output]',Z(0x1ea))[Z(0x21c)](Object[Z(0x22c)](['format',Z(0x1c5),'yaml'])))[Z(0x229)](new commander_1[(Z(0x1d7))]('-t,\x20--metricTypes\x20<metricTypes...>',Z(0x1c2))['choices'](Object[Z(0x22c)](js_client_1[Z(0x201)])))[Z(0x229)](new commander_1[(Z(0x1d7))](Z(0x246),Z(0x249)+utils_1[Z(0x21a)])['argParser'](utils_1[Z(0x20b)])[Z(0x220)](['startTime',Z(0x22f)]))['option']('--noDefaults','Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.',![])[Z(0x229)](new commander_1[(Z(0x1d7))](Z(0x240),Z(0x1ea))[Z(0x21c)](Object[Z(0x22c)](['format','json',Z(0x24b)])));if(W)l[Z(0x20a)]('--build\x20--buildId\x20[buildId]',Z(0x233));if(v==='job')l[Z(0x20a)](Z(0x209),Z(0x1f5));if(v===Z(0x23f))l[Z(0x20a)](Z(0x1c6),'Deployment\x20id,\x20example:\x20my-service-54785f4');return l;},this['printMetricsGraph']=(v,W)=>{return l=>{const r=a12v,N=Object[r(0x1d3)](l)['flatMap'](y=>{const R=r,{values:D,metricInfo:w}=l[y],{metricUnit:e,metricResolution:I}=w;return D[R(0x242)](U=>{const f=R;var k,x;const {metadata:B,data:o}=U,s=W?(W===null||W===void 0x0?void 0x0:W['getTime']())>new Date()[f(0x1e3)]()?new Date():W:undefined,Y=new Date((k=o===null||o===void 0x0?void 0x0:o[0x0])===null||k===void 0x0?void 0x0:k['ts']),a=new Date((x=o===null||o===void 0x0?void 0x0:o[o[f(0x1ca)]-0x1])===null||x===void 0x0?void 0x0:x['ts']),G=this['getPaddingDataStart'](v,Y,I),H=this['getPaddingDataEnd'](s,a,I),A=[...G,...o,...H],m=A[f(0x242)](z=>[new Date(z['ts'])[f(0x202)](),Number(z['value'])])[f(0x1fb)](z=>!Number[f(0x1be)](z[0x0])),g=Math[f(0x206)](Math[f(0x23a)](process[f(0x1f7)][f(0x221)]-0xa,0xa),0x64),F=Math['min'](Math[f(0x23a)](process['stdout'][f(0x1fa)]-0x9,0xa),0xf),K=e===f(0x237)?0x64:undefined,t=e===f(0x237)?'%':e,C=(0x0,terminal_chart_1['downSampleData'])(m,g),b=C['map'](z=>z[0x1]),P={'min':0x0,'height':F,'max':K,'unit':t,'startTs':v!==null&&v!==void 0x0?v:Y,'endTs':s!==null&&s!==void 0x0?s:a};return{'dataSeries':b,'metadata':B,'chartOpts':P,'metricInfo':w};});})[r(0x1ef)]();if(N[r(0x1ca)]===0x0)(0x0,utils_1[r(0x20e)])(r(0x1da));else N[r(0x207)](y=>{const X=r,{dataSeries:D,metadata:w,chartOpts:e,metricInfo:I}=y,{containerId:U,volumeId:k}=w,x=k?',\x20volume:\x20'+k:'';console[X(0x219)](I[X(0x1bb)]+X(0x1e8)+chalk_1[X(0x23e)][X(0x223)](U)+x),console[X(0x219)]((0x0,terminal_chart_1['getAsciiChart'])(D,e));});};},this[p(0x210)]=(v,W,l)=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const V=p;try{const N=yield this['metricsApiClient']['metrics']['metricsSingle'](v,W,l);console['clear']();if(N[V(0x205)])(0x0,utils_1[V(0x205)])('Error\x20while\x20fetching\x20metrics\x20entries:\x20'+N[V(0x205)]['message']);else this[V(0x1d6)](N['data']);}catch(y){console[V(0x1e0)](),(0x0,utils_1[V(0x205)])('Error\x20while\x20fetching\x20metrics\x20entries:\x20'+y['message']);}}),this[p(0x212)]=v=>{const n=p;if(v[n(0x205)]){const W=JSON[n(0x1e9)](v[n(0x205)][n(0x204)]);throw new Error('Error\x20while\x20fetching\x20metrics\x20entries:\x20'+v['error'][n(0x241)]+'\x20'+W);}},this['printInitInfo']=(v,W,l,N,y)=>{const Q=p;if(y===!![])return;const {metricTypes:D,endTime:w,startTime:e,duration:I,containerId:U}=N,k=e?',\x20from:\x20'+e[Q(0x1f3)]():'',x=w?Q(0x1c3)+w[Q(0x1f3)]():'',B=I?Q(0x215)+I+'\x20seconds':'',o=U?Q(0x1c8)+chalk_1[Q(0x23e)][Q(0x223)](U):Q(0x1c4),s=v+'\x20'+chalk_1['default'][Q(0x223)](W)+'\x20in\x20project\x20'+chalk_1['default'][Q(0x223)](l),Y=''+k+x+B,a=D?Q(0x1c7)+(D===null||D===void 0x0?void 0x0:D[Q(0x248)](',')):'';console[Q(0x219)](Q(0x1cf)+o+Q(0x1d9)+s+a+Y);},this[p(0x1bd)]=new js_client_1[(p(0x1f2))](T,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[p(0x1de)]}),this[p(0x1f6)]=this['apiClient'],this['inquirerHelper']=new inquirer_helper_1['InquirerHelper'](this['apiClient']);}[a12i(0x1eb)](T,v=![]){const T1=a12i,W=(w,e)=>__awaiter(this,void 0x0,void 0x0,function*(){const j=a12v,I=e['noDefaults'],{apiContext:U,inquirerHelper:k}=this;switch(T){case j(0x23f):{const x=I?undefined:U[j(0x218)]();return e[j(0x1d8)]||x||(yield k[j(0x1b9)](w)());}case j(0x244):{const B=I?undefined:U[j(0x218)]();return e[j(0x1ec)]||B||(yield k[j(0x1f4)](w)());}case j(0x1d0):{const o=I?undefined:U['getCurrentServiceName']();return e[j(0x217)]||o||(yield k[j(0x1ee)](w)());}}}),l=(w,e,I)=>__awaiter(this,void 0x0,void 0x0,function*(){const u=a12v;if(v)return I['buildId']||(yield this[u(0x23d)][u(0x1cc)](w,T===u(0x23f)?e:undefined,T===u(0x244)?e:undefined,!![])());return undefined;}),N=(w,e,I)=>__awaiter(this,void 0x0,void 0x0,function*(){const q=a12v;if(!v&&I[q(0x1d4)]!==undefined){if(I[q(0x1d4)]!==!![])return I[q(0x1d4)];return yield this['inquirerHelper'][q(0x1cb)](w,T===q(0x23f)?e:undefined,T===q(0x244)?e:undefined,!![])();}return undefined;}),y=(w,e,I)=>__awaiter(this,void 0x0,void 0x0,function*(){const L=a12v;if(T===L(0x244))return I[L(0x22e)]||(yield this[L(0x23d)][L(0x1e7)](e,w,!![])());return undefined;}),D=(w,e,I)=>__awaiter(this,void 0x0,void 0x0,function*(){const T0=a12v;if(T===T0(0x23f)){if(I['deploymentId']!==!![])return I[T0(0x21b)];return I[T0(0x21b)];}return undefined;});return this[T1(0x1bf)](T,v)[T1(0x222)](w=>__awaiter(this,void 0x0,void 0x0,function*(){const T2=T1,{noDefaults:e,projectId:I,duration:U,timestamp:k,output:x,startTime:B,endTime:o,metricTypes:s,quiet:Y}=w;(0x0,utils_1['assertContextExisting'])(this[T2(0x1bd)]);if(B&&o&&U)throw new Error('Only\x20two\x20of\x20\x27startTime\x27,\x20\x27endTime\x27\x20and\x20\x27duration\x27\x20can\x20be\x20set.');const {apiContext:a,inquirerHelper:G,metricsApiClient:H}=this,A=e?undefined:a[T2(0x1e4)](),m=I||A||(yield G[T2(0x208)]()),g=yield W(m,w),F=yield l(m,g,w),K=yield y(m,g,w),t=yield D(m,g,w),C=yield N(m,g,w),b={'projectId':m,'entityId':g},P={'containerName':C,'startTime':B,'endTime':o,'duration':U,'timestamp':k,'metricTypes':s,'runId':K,'buildId':F,'deploymentId':t,'isBuild':v!==null&&v!==void 0x0?v:![]},z=!(B||o||U);if(!Y&&x!==T2(0x24b)&&x!==T2(0x1c9)&&x!==T2(0x1c5))this[T2(0x1e1)](T,g,m,P,Y);if(z){if(x!==undefined){const c=yield H[T2(0x22b)][T2(0x23b)](b,P,T);this[T2(0x212)](c),(0x0,console_format_helpers_1['printResponse'])(x,c[T2(0x216)]);}else[...Array(process['stdout']['rows']-0x1)][T2(0x207)]((O,J)=>J===0x0?console[T2(0x219)]('Fetching\x20data..'):console[T2(0x219)]()),yield this[T2(0x210)](b,P,T)(),setInterval(this[T2(0x210)](b,P,T),this[T2(0x1f0)]),yield new Promise(O=>setTimeout(O,this[T2(0x1f0)]*0x64));}else{const O=yield H['metrics']['metricsRange'](b,P,T);this[T2(0x212)](O),x!==undefined?(0x0,console_format_helpers_1[T2(0x211)])(x,O[T2(0x216)]):this[T2(0x1e5)](B,o!==null&&o!==void 0x0?o:new Date())(O[T2(0x216)]);}process[T2(0x236)]();}));}[a12i(0x1d6)](T){const T4=a12i,v=(N,y)=>{const T3=a12v;if(!(y===null||y===void 0x0?void 0x0:y[T3(0x245)]))'N/A';const D=N[T3(0x21d)]===T3(0x237)?'%':N[T3(0x21d)];return''+Number(y===null||y===void 0x0?void 0x0:y['value'])[T3(0x231)](0x3)+D;},W=N=>{if(!(N===null||N===void 0x0?void 0x0:N['ts']))'N/A';return N['ts']['toTimeString']()['split']('\x20')[0x0];},l={};Object[T4(0x1d3)](T)['forEach'](N=>{const T5=T4,{values:y,metricInfo:D}=T[N];return y[T5(0x207)](w=>{const T6=T5;var e,I;const U=w[T6(0x214)][T6(0x1d4)];Object[T6(0x234)](l,{[U]:Object['assign'](Object[T6(0x234)]({},l===null||l===void 0x0?void 0x0:l[U]),{['time']:W((e=w[T6(0x216)])===null||e===void 0x0?void 0x0:e[0x0]),'containerId':U,[D[T6(0x1bb)]]:v(D,(I=w['data'])===null||I===void 0x0?void 0x0:I[0x0])})});});}),(0x0,console_format_helpers_1[T4(0x1dc)])(Object[T4(0x22c)](l),T4(0x203));}[a12i(0x230)](T,v,W){const T7=a12i,l=D=>new Date(D[T7(0x1e3)]()-N),N=W*0x3e8;if(!T)return[];if(!v)return[];if(l(v)[T7(0x1e3)]()<T[T7(0x1e3)]())return[];const y=[{'ts':l(v),'value':0x0}];while(l(y[y['length']-0x1]['ts'])[T7(0x1e3)]()<=T[T7(0x1e3)]()){y['unshift']({'ts':l(y[y[T7(0x1ca)]-0x1]['ts']),'value':0x0});}return y;}[a12i(0x24a)](T,v,W){const T8=a12i,l=D=>new Date(D['getTime']()+N),N=W*0x3e8;if(!T)return[];if(!v)return[];if(l(v)['getTime']()>T[T8(0x1e3)]())return[];const y=[{'ts':l(v),'value':0x0}];while(l(y[y[T8(0x1ca)]-0x1]['ts'])['getTime']()<=T[T8(0x1e3)]()){y['push']({'ts':l(y[y['length']-0x1]['ts']),'value':0x0});}return y;}}exports[a12i(0x22d)]=CliMetrics;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a13a=a13v;(function(T,v){const x=a13v,W=T();while(!![]){try{const l=parseInt(x(0xb0))/0x1+-parseInt(x(0x9e))/0x2+-parseInt(x(0xbf))/0x3*(parseInt(x(0xbc))/0x4)+-parseInt(x(0xa1))/0x5*(-parseInt(x(0xb7))/0x6)+parseInt(x(0xae))/0x7*(-parseInt(x(0xb5))/0x8)+-parseInt(x(0xbe))/0x9+-parseInt(x(0x99))/0xa*(-parseInt(x(0xad))/0xb);if(l===v)break;else W['push'](W['shift']());}catch(N){W['push'](W['shift']());}}}(a13T,0x7d9da));var __awaiter=this&&this['__awaiter']||function(T,v,W,l){function N(y){return y instanceof W?y:new W(function(D){D(y);});}return new(W||(W=Promise))(function(y,D){const Y=a13v;function w(U){const B=a13v;try{I(l[B(0xb8)](U));}catch(k){D(k);}}function e(U){const o=a13v;try{I(l[o(0xa5)](U));}catch(k){D(k);}}function I(U){const s=a13v;U[s(0xb3)]?y(U[s(0x9c)]):N(U[s(0x9c)])[s(0xc0)](w,e);}I((l=l[Y(0xac)](T,v||[]))[Y(0xb8)]());});},__importDefault=this&&this[a13a(0x9d)]||function(T){return T&&T['__esModule']?T:{'default':T};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[a13a(0xa3)]=void 0x0;const list_1=__importDefault(require(a13a(0xb4))),choice_1=__importDefault(require('inquirer/lib/objects/choice')),chalk_1=__importDefault(require(a13a(0xb6)));function a13T(){const K=['selected','dir\x20must\x20be\x20up\x20or\x20down','loop','loadMore','pagOpt','apply','55FYyIGs','4417iopfAL','handleDynamicPageLoad','6526uPBjXQ','name','italic','done','inquirer/lib/prompts/list','2968XPYCvc','chalk','30wcwiJm','next','opt','..\x20Load\x20more\x20options\x20..','reloadText','11624PIHZbk','down','3052926tgJHjW','1014Zegyxz','then','splice','catch','\x20Loading\x20more\x20options','render','default','2843930ciXBdA','loading','length','value','__importDefault','427262aqmNOL','push','onUpKey','855205PhvPmE','nextPageCursor','DynamicReloadPaginationPrompt','onDownKey','throw','choices'];a13T=function(){return K;};return a13T();}function incrementListIndex(T,v,W){const G=a13a,l=W[G(0xa6)]['realLength'],N='loop'in W?Boolean(W[G(0xa9)]):!![];if(v==='up'){if(T>0x0)return T-0x1;return N?l-0x1:T;}if(v==='down'){if(T<l-0x1)return T+0x1;return N?0x0:T;}throw new Error(G(0xa8));}function a13v(T,v){const W=a13T();return a13v=function(l,N){l=l-0x99;let y=W[l];return y;},a13v(T,v);}class DynamicReloadPaginationPrompt extends list_1[a13a(0xc5)]{constructor(T,v,W){const H=a13a;super(T,v,W),this[H(0xbb)]=chalk_1[H(0xc5)][H(0xb2)](H(0xba)),this[H(0x9a)]=![],this[H(0xab)]=this[H(0xb9)],this[H(0xa2)]=this['pagOpt'][H(0xa2)],this[H(0xa2)]!==undefined&&this[H(0xb9)]['choices'][H(0x9f)](new choice_1[(H(0xc5))](this['reloadText'],this[H(0xbb)]));}[a13a(0xa0)](){const A=a13a;if(this['loading'])return;this['selected']=incrementListIndex(this['selected'],'up',this[A(0xb9)]),this[A(0xc4)]();}[a13a(0xa4)](){return __awaiter(this,void 0x0,void 0x0,function*(){const m=a13v;if(this[m(0x9a)])return;this[m(0xa7)]=incrementListIndex(this[m(0xa7)],m(0xbd),this[m(0xb9)]),yield this['handleDynamicPageLoad'](),this[m(0xc4)]();});}[a13a(0xaf)](){return __awaiter(this,void 0x0,void 0x0,function*(){const g=a13v;if(this['selected']>=this[g(0xb9)][g(0xa6)][g(0x9b)]-0x1){if(this[g(0xa2)]===undefined)return;this[g(0x9a)]=!![];let T=0x0;const v=setInterval(()=>{const F=g,y=['⠋','⠙','⠹','⠸','⠼','⠴','⠦','⠧','⠇','⠏'],D=chalk_1[F(0xc5)][F(0xb2)](y[T%y[F(0x9b)]]+F(0xc3));this[F(0xb9)][F(0xa6)][F(0xa6)][this[F(0xa7)]][F(0xb1)]=''+D,T+=0x1,this[F(0xc4)]();},0x50),{elements:W,nextPageCursor:l}=yield this[g(0xab)][g(0xaa)]({'nextPageCursor':this[g(0xa2)]})[g(0xc2)](()=>({'elements':[],'nextPageCursor':undefined}));this[g(0xa2)]=l;const N=W['map'](y=>new choice_1[(g(0xc5))](y,y));this[g(0xb9)][g(0xa6)][g(0xa6)][g(0xc1)](this[g(0xa7)],0x1),this[g(0xb9)]['choices'][g(0x9f)](...N),l!==undefined&&this[g(0xb9)][g(0xa6)]['push'](new choice_1[(g(0xc5))](this[g(0xbb)],this[g(0xbb)])),clearInterval(v),this[g(0x9a)]=![];}});}}exports['DynamicReloadPaginationPrompt']=DynamicReloadPaginationPrompt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const a14x=a14e;(function(F,e){const B=a14e,G=F();while(!![]){try{const u=-parseInt(B(0x230))/0x1+-parseInt(B(0x1fd))/0x2+parseInt(B(0x236))/0x3+-parseInt(B(0x218))/0x4*(parseInt(B(0x1cd))/0x5)+-parseInt(B(0x1e0))/0x6+-parseInt(B(0x220))/0x7*(-parseInt(B(0x238))/0x8)+parseInt(B(0x1e2))/0x9*(parseInt(B(0x1db))/0xa);if(u===e)break;else G['push'](G['shift']());}catch(R){G['push'](G['shift']());}}}(a14F,0x8aaa8));function a14F(){const F1=['Service\x20to\x20forward','uniq','\x20mode:\x20the\x20locally\x20forwarded\x20port\x20differs\x20from\x20the\x20actual\x20port\x20on\x20the\x20forwarded\x20service/addon.','lodash','chalk','assertContextExisting','/etc/hosts','InquirerHelper','port','exit','hostnames','5GJOzGa','forward','skipHostnamesText','message','Addons:','--skipHostnames','forEach','getCurrentProjectName','throw','get','address','askForAddon','map','CliPortForward','890YAtKxH','forwarding','bold','prototype','tunnel-close','2256126gjtakc','then','72837ofjtUj','\x20\x20If\x20you\x20have\x20added\x20entries\x20to\x20your\x20hosts\x20file,\x20it\x20is\x20recommended\x20to\x20remove\x20them\x20again\x20now.','Please\x20ensure\x20the\x20','C:/Windows/System32/drivers/etc/hosts','\x20\x20\x20No\x20running\x20container\x20found\x20for\x20','apiClient','\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x20with\x20multiple\x20ports:','description','\x20is\x20exposed\x20with\x20multiple\x20',',\x20hostname:\x20','ports','option','flat','name','portFwdCmd','Failed:\x20','Port-forwarding\x20for\x20the\x20specified\x20addon','type','warning','\x20and\x20','next','action','\x20is\x20running\x20and\x20reachable.','connection-error','--project\x20--projectId\x20[NAME]','@northflank/js-client','278514aoZLRK','printForwardingInfo','Running\x20in\x20','Connection\x20error\x20occurred\x20when\x20forwarding\x20\x27','defineProperty','--addon\x20--addonId\x20[NAME]','platform','Only\x20expose\x20on\x20IP\x20address,\x20not\x20on\x20hostnames.\x20With\x20this\x20option,\x20no\x20root\x20permissions\x20are\x20required.','noDefaultsText','all','Cleaning\x20up\x20open\x20connections\x20failed:\x20','--service\x20--serviceId\x20[NAME]','__awaiter','http://','service','Stop\x20forwarding\x20traffic\x20from\x20','with\x20hostname:\x20','askForService','configurable','addon','filter','join','length','getCurrentServiceName','create','printHostsFileHint','log','2618192iVsRrP','Error\x20occured\x20while\x20trying\x20to\x20forward\x20','value','__importStar','reset','askForProject','getProxyForwarder','done','5995871PEfASR','repeat','../utils','Project\x20for\x20forwarding','groupBy','protocol','project\x20for\x20forwarding','--noDefaults','\x20service\x20ports','error','data.id','green','success','uniqBy','forwardService','\x20addon\x20ports','857146RGPNPt','__esModule','ApiClient','hosts','win32','__createBinding','3054354tTlOTM','Forwarding\x20','8jMnEKo','default','greenBright','apply','\x20in\x20project\x20','data','\x20with\x20these\x20hostnames:','__setModuleDefault','\x20flag\x20or\x20manually\x20append\x20following\x20entry\x20to\x20your\x20hosts\x20file\x20(','Port-forwarding\x20for\x20the\x20specified\x20service','\x20\x20-\x20port\x20','\x20\x20-\x20Address:\x20','Addon\x20to\x20forward','alias','portName','\x20is\x20exposed\x20on\x20','getCommand','fwd','skipHostnames'];a14F=function(){return F1;};return a14F();}var __createBinding=this&&this[a14x(0x235)]||(Object[a14x(0x215)]?function(F,e,G,u){const r=a14x;if(u===undefined)u=G;var R=Object['getOwnPropertyDescriptor'](e,G);(!R||(r(0x1d6)in R?!e[r(0x231)]:R['writable']||R[r(0x20f)]))&&(R={'enumerable':!![],'get':function(){return e[G];}}),Object[r(0x201)](F,u,R);}:function(F,e,G,u){if(u===undefined)u=G;F[u]=e[G];}),__setModuleDefault=this&&this[a14x(0x23f)]||(Object[a14x(0x215)]?function(F,e){const k=a14x;Object[k(0x201)](F,'default',{'enumerable':!![],'value':e});}:function(F,e){const K=a14x;F[K(0x239)]=e;}),__importStar=this&&this[a14x(0x21b)]||function(F){const p=a14x;if(F&&F[p(0x231)])return F;var e={};if(F!=null){for(var G in F)if(G!==p(0x239)&&Object[p(0x1de)]['hasOwnProperty']['call'](F,G))__createBinding(e,F,G);}return __setModuleDefault(e,F),e;},__awaiter=this&&this[a14x(0x209)]||function(F,e,G,u){function R(b){return b instanceof G?b:new G(function(W){W(b);});}return new(G||(G=Promise))(function(b,W){const C=a14e;function V(t){const O=a14e;try{m(u[O(0x1f7)](t));}catch(T){W(T);}}function a(t){const D=a14e;try{m(u[D(0x1d5)](t));}catch(T){W(T);}}function m(t){const z=a14e;t[z(0x21f)]?b(t['value']):R(t[z(0x21a)])[z(0x1e1)](V,a);}m((u=u[C(0x23b)](F,e||[]))[C(0x1f7)]());});},__importDefault=this&&this['__importDefault']||function(F){const N=a14x;return F&&F[N(0x231)]?F:{'default':F};};Object[a14x(0x201)](exports,'__esModule',{'value':!![]}),exports[a14x(0x1da)]=void 0x0;function a14e(F,e){const G=a14F();return a14e=function(u,R){u=u-0x1b9;let b=G[u];return b;},a14e(F,e);}const js_client_1=require(a14x(0x1fc)),chalk_1=__importDefault(require(a14x(0x1c6))),utils_1=require(a14x(0x222)),inquirer_helper_1=require('../inquirer-helper'),os=__importStar(require('os')),lodash_1=require(a14x(0x1c5)),{EOL}=require('os');class CliPortForward{constructor(F){const I=a14x;this[I(0x205)]='Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.',this[I(0x1cf)]=I(0x204),this[I(0x1e7)]=new js_client_1[(I(0x232))](F,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent']});const e=new inquirer_helper_1[(I(0x1c9))](this[I(0x1e7)]);this[I(0x1f1)]=(0x0,utils_1[I(0x1bf)])()[I(0x1f0)](I(0x1ce))[I(0x1bc)](I(0x1c0))['description']('Port-forwarding\x20for\x20Northflank\x20services\x20and\x20addons.');const G=(0x0,utils_1[I(0x1bf)])(!![])['name'](I(0x206))[I(0x1ea)]('Port-forwarding\x20for\x20all\x20services\x20and\x20addons\x20in\x20the\x20given\x20project')[I(0x1ee)](I(0x1fb),I(0x226))[I(0x1ee)](I(0x227),this[I(0x205)],![])[I(0x1ee)](I(0x1d2),this[I(0x1cf)],![])[I(0x1f8)](({noDefaults:b,projectId:W,skipHostnames:V})=>__awaiter(this,void 0x0,void 0x0,function*(){const Y=I;(0x0,utils_1[Y(0x1c7)])(this[Y(0x1e7)]);const a=this[Y(0x21e)](V),m=b?undefined:F['getCurrentProjectName'](),t=W||m||(yield e[Y(0x21d)]());try{const {services:T,addons:Z}=yield a['forwardProject']({'projectId':t},V);if(T[Y(0x213)]+Z[Y(0x213)]<=0x0)(0x0,utils_1[Y(0x1f5)])('No\x20services\x20and\x20addons\x20to\x20forward\x20found\x20in\x20project\x20'+chalk_1[Y(0x239)][Y(0x1dd)](t));else{const n=T['filter'](w=>w[Y(0x213)]>0x0)[Y(0x213)],v=Z['filter'](w=>w[Y(0x213)]>0x0)[Y(0x213)],A='\x20in\x20project\x20'+chalk_1[Y(0x239)][Y(0x1dd)](t);console[Y(0x217)](Y(0x237)+chalk_1[Y(0x239)]['green']['bold'](n+Y(0x228))+Y(0x1f6)+chalk_1[Y(0x239)][Y(0x22b)][Y(0x1dd)](v+Y(0x22f))+A),console['log'](),console[Y(0x217)](chalk_1[Y(0x239)][Y(0x1dd)]('Services:')),T['forEach'](w=>{const g=Y;if(w[g(0x213)]>=0x1&&!w[0x0][g(0x229)])this[g(0x1fe)](w,{'type':'service','name':w[0x0][g(0x23d)]['id']},V);}),console[Y(0x217)](chalk_1[Y(0x239)][Y(0x1dd)](Y(0x1d1))),Z[Y(0x1d3)](w=>{const Q=Y;if(w[Q(0x213)]>=0x1&&!w[0x0][Q(0x229)])this[Q(0x1fe)](w,{'type':'addon','name':w[0x0][Q(0x23d)]['id']},V);}),this[Y(0x216)]([...T[Y(0x1ef)](),...Z[Y(0x1ef)]()],V);}}catch(w){(0x0,utils_1[Y(0x229)])('Failed:\x20'+w[Y(0x1d0)]);}})),u=(0x0,utils_1['getCommand'])(!![])['name']('service')[I(0x1ea)](I(0x241))['option'](I(0x1fb),I(0x223))['option'](I(0x208),I(0x1c2))[I(0x1ee)]('--noDefaults',this[I(0x205)],![])[I(0x1ee)]('--skipHostnames',this[I(0x1cf)],![])['action'](({noDefaults:b,projectId:W,serviceId:V,skipHostnames:a})=>__awaiter(this,void 0x0,void 0x0,function*(){const S=I;(0x0,utils_1['assertContextExisting'])(this[S(0x1e7)]);const m=this[S(0x21e)](a),t=b?undefined:F[S(0x1d4)](),T=W||t||(yield e['askForProject']()),Z=b?undefined:F[S(0x214)](),n=V||Z||(yield e[S(0x20e)](T)());console['log']('Forwarding\x20service\x20'+chalk_1[S(0x239)][S(0x1dd)](n)+S(0x23c)+chalk_1['default'][S(0x1dd)](T));try{const v=yield m[S(0x22e)]({'projectId':T,'serviceId':n},a);this[S(0x1fe)](v,{'name':n,'type':'service'},a),this[S(0x216)](v,a);}catch(A){(0x0,utils_1['error'])(S(0x1f2)+A['message']);}})),R=(0x0,utils_1[I(0x1bf)])(!![])[I(0x1f0)](I(0x210))[I(0x1ea)](I(0x1f3))[I(0x1ee)](I(0x1fb),I(0x223))[I(0x1ee)](I(0x202),I(0x1bb))[I(0x1ee)](I(0x1d2),this[I(0x1cf)],![])[I(0x1f8)](({noDefaults:b,projectId:W,addonId:V,skipHostnames:a})=>__awaiter(this,void 0x0,void 0x0,function*(){const j=I;(0x0,utils_1[j(0x1c7)])(this[j(0x1e7)]);const m=this[j(0x21e)](a),t=b?undefined:F['getCurrentProjectName'](),T=W||t||(yield e[j(0x21d)]()),Z=V||(yield e[j(0x1d8)](T)());console[j(0x217)]('Forwarding\x20addon\x20'+chalk_1['default'][j(0x1dd)](Z)+j(0x23c)+chalk_1['default'][j(0x1dd)](T));try{const n={'projectId':T,'addonId':Z},v=yield m['forwardAddon'](n,a);this['printForwardingInfo'](v,{'name':Z,'type':j(0x210)},a),this['printHostsFileHint'](v,a);}catch(A){(0x0,utils_1[j(0x229)])('Failed:\x20'+A['message']);}}));this[I(0x1f1)]['addCommand'](G),this[I(0x1f1)]['addCommand'](u),this[I(0x1f1)]['addCommand'](R);}['getProxyForwarder'](F=![]){const q=a14x,e=this[q(0x1e7)][q(0x1dc)];if(!F){const G=e['canExecuteWithHostnames']();if(G[q(0x229)])throw new Error(G[q(0x1d0)]);}return e['on'](q(0x1df),(u,R)=>{const f=q,b=chalk_1[f(0x239)][f(0x1dd)](R[f(0x1f4)]+'\x20\x27'+R['id']+'\x27'),W=R[f(0x1cc)][f(0x213)]>0x0;(0x0,utils_1[f(0x1f5)])(f(0x20c)+R[f(0x1d7)]+':'+R[f(0x1ca)]+'\x20to\x20'+b),F&&W&&(0x0,utils_1[f(0x1f5)])(f(0x1e3));}),e['on'](q(0x1fa),(u,R,b)=>{const H=q;(0x0,utils_1[H(0x1f5)])(H(0x200)+R[H(0x1d7)]+':'+R[H(0x1ca)]+'\x27:\x20\x22'+(b===null||b===void 0x0?void 0x0:b[H(0x1d0)])+'\x22');}),process['on']('SIGINT',()=>__awaiter(this,void 0x0,void 0x0,function*(){const s=q;try{yield e['stop']();}catch(u){(0x0,utils_1[s(0x229)])(s(0x207)+u['message']);}finally{process[s(0x1cb)]();}})),e;}[a14x(0x1fe)](F,e,G=![]){const y=a14x,{type:u,name:R}=e;if(F['length']<=0x0){const a=y(0x1e4)+e[y(0x1f4)]+y(0x1f9);(0x0,utils_1[y(0x1f5)])(y(0x1e6)+u+'\x20'+chalk_1[y(0x239)][y(0x1dd)](R)+'.\x20'+a);return;}const b=(0x0,lodash_1[y(0x224)])(F,y(0x22a)),W=m=>'\x20('+(m['portName']?m[y(0x1bd)]+'\x20-\x20':'')+m[y(0x225)]+')';function V(m,t=0x2){const E=y;if(!G){const T=m[E(0x225)]==='HTTP'?E(0x20a):'';m['hostnames'][E(0x1d3)](Z=>{const J=E;console[J(0x217)]((0x0,lodash_1[J(0x221)])('\x20',t)+'-\x20'+T+Z+':'+m[J(0x1ca)]);});}}Object['entries'](b)[y(0x1d3)](([m,t])=>{const M=y;var T,Z;const n='>\x20'+(0x0,lodash_1['capitalize'])(u)+'\x20\x27'+chalk_1[M(0x239)][M(0x23a)]['bold'](m)+'\x27';if(u===M(0x210)){if(t[M(0x213)]===0x1){const v=t[0x0];if(v[M(0x229)]){(0x0,utils_1[M(0x229)])(M(0x219)+m+':\x20'+v[M(0x229)][M(0x1d0)]);return;}const A=v[M(0x23d)],w=!G?'\x20'+chalk_1['default'][M(0x21c)](M(0x20d)+A[M(0x1cc)][M(0x212)](',')):'';(0x0,utils_1['success'])(n+M(0x1be)+A['address']+':'+A[M(0x1ca)]+W(A)+w);}else{const o=(0x0,lodash_1[M(0x22d)])(t,i=>{const L=M;var c,l;return(l=(c=i===null||i===void 0x0?void 0x0:i[L(0x23d)])===null||c===void 0x0?void 0x0:c['hostnames'])===null||l===void 0x0?void 0x0:l['join'](',');})[M(0x213)]>0x1;(0x0,utils_1[M(0x22c)])(n+M(0x1eb)+(o?M(0x233):M(0x1ed))+':'),t['forEach'](i=>{const P=M;if(i[P(0x229)]){(0x0,utils_1[P(0x229)])(P(0x219)+m+':\x20'+i[P(0x229)]['message']);return;}const c=i[P(0x23d)],l=!G?P(0x1ec)+c[P(0x1cc)]['join'](','):'';console['log'](P(0x1ba)+c[P(0x1d7)]+':'+c[P(0x1ca)]+W(c)+l);});}}if(u===M(0x20b)){if(t[M(0x213)]===0x1){const i=t[0x0];if(i[M(0x229)]){(0x0,utils_1[M(0x229)])('Error\x20occured\x20while\x20trying\x20to\x20forward\x20'+m+':\x20'+i[M(0x229)][M(0x1d0)]);return;}const c=i[M(0x23d)],l=!G?M(0x23e):':',X=c[M(0x1d7)]+':'+c['port']+W(c);(0x0,utils_1[M(0x22c)])(n+'\x20is\x20exposed\x20on\x20'+X+l),V(c);}else(0x0,utils_1[M(0x22c)])(n+M(0x1be)+((Z=(T=t[0x0])===null||T===void 0x0?void 0x0:T['data'])===null||Z===void 0x0?void 0x0:Z[M(0x1d7)])+M(0x1e9)),t['forEach'](h=>{const U=M;if(h[U(0x229)]){(0x0,utils_1[U(0x229)])(U(0x219)+m+':\x20'+h['error'][U(0x1d0)]);return;}const d=h['data'];(0x0,utils_1[U(0x22c)])(U(0x1b9)+d[U(0x1ca)]+W(d)),V(d,0x4);});}});}['printHostsFileHint'](F,e=![]){const F0=a14x;if(e){const G=F['flatMap'](t=>t[F0(0x23d)])[F0(0x211)](t=>t!==undefined),u=(process===null||process===void 0x0?void 0x0:process[F0(0x203)])===F0(0x234),R=os['platform']()==='darwin',b=u?F0(0x1e5):F0(0x1c8),W=chalk_1[F0(0x239)][F0(0x1dd)](F0(0x1c1)),V=R?EOL+'Running\x20on\x20macOS\x20in\x20'+W+F0(0x1c4):undefined;let a=F0(0x1ff)+W+'\x20mode.\x20If\x20hostname\x20forwarding\x20is\x20required,\x20remove\x20'+F0(0x1d2)+F0(0x240)+b+'):';V!==undefined&&(0x0,utils_1['warning'])(V!==null&&V!==void 0x0?V:'');(0x0,utils_1[F0(0x1f5)])(a);const m=G[F0(0x1d9)](t=>t['address']+F0(0x1e8)+t[F0(0x1cc)][F0(0x212)]('\x20'));console[F0(0x217)]((0x0,lodash_1[F0(0x1c3)])(m)[F0(0x212)](EOL)),console[F0(0x217)]();}}}exports[a14x(0x1da)]=CliPortForward;
|
|
1
|
+
'use strict';const a14t=a14v;(function(T,v){const K=a14v,W=T();while(!![]){try{const l=parseInt(K(0x1bf))/0x1+parseInt(K(0x1f7))/0x2+parseInt(K(0x1e7))/0x3+-parseInt(K(0x1c8))/0x4*(-parseInt(K(0x1ba))/0x5)+parseInt(K(0x20c))/0x6*(parseInt(K(0x1c2))/0x7)+-parseInt(K(0x195))/0x8+parseInt(K(0x207))/0x9*(-parseInt(K(0x1b9))/0xa);if(l===v)break;else W['push'](W['shift']());}catch(N){W['push'](W['shift']());}}}(a14T,0x5b6be));function a14v(T,v){const W=a14T();return a14v=function(l,N){l=l-0x184;let y=W[l];return y;},a14v(T,v);}var __createBinding=this&&this[a14t(0x1d9)]||(Object[a14t(0x20d)]?function(T,v,W,l){const C=a14t;if(l===undefined)l=W;var N=Object['getOwnPropertyDescriptor'](v,W);(!N||(C(0x1be)in N?!v[C(0x1b2)]:N[C(0x189)]||N[C(0x1aa)]))&&(N={'enumerable':!![],'get':function(){return v[W];}}),Object[C(0x18a)](T,l,N);}:function(T,v,W,l){if(l===undefined)l=W;T[l]=v[W];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object[a14t(0x20d)]?function(T,W){const b=a14t;Object['defineProperty'](T,b(0x1a9),{'enumerable':!![],'value':W});}:function(T,W){const P=a14t;T[P(0x1a9)]=W;}),__importStar=this&&this[a14t(0x1d4)]||function(T){const z=a14t;if(T&&T[z(0x1b2)])return T;var v={};if(T!=null){for(var W in T)if(W!=='default'&&Object['prototype'][z(0x18c)][z(0x1f6)](T,W))__createBinding(v,T,W);}return __setModuleDefault(v,T),v;},__awaiter=this&&this[a14t(0x212)]||function(T,v,W,l){function N(y){return y instanceof W?y:new W(function(D){D(y);});}return new(W||(W=Promise))(function(y,D){const S=a14v;function w(U){const c=a14v;try{I(l[c(0x1e5)](U));}catch(k){D(k);}}function e(U){const O=a14v;try{I(l[O(0x1d7)](U));}catch(k){D(k);}}function I(U){const J=a14v;U[J(0x1b4)]?y(U[J(0x1a6)]):N(U[J(0x1a6)])['then'](w,e);}I((l=l[S(0x18d)](T,v||[]))['next']());});},__importDefault=this&&this['__importDefault']||function(T){const d=a14t;return T&&T[d(0x1b2)]?T:{'default':T};};Object[a14t(0x18a)](exports,a14t(0x1b2),{'value':!![]}),exports['CliPortForward']=void 0x0;const js_client_1=require(a14t(0x20b)),chalk_1=__importDefault(require(a14t(0x1e2))),utils_1=require(a14t(0x1d1)),inquirer_helper_1=require('../inquirer-helper'),os=__importStar(require('os')),lodash_1=require('lodash'),{EOL}=require('os');function a14T(){const T1=['../utils','--project\x20--projectId\x20[NAME]','data.id','__importStar',',\x20hostname:\x20','greenBright','throw','CliPortForward','__createBinding','Running\x20in\x20','hosts','\x20\x20-\x20Address:\x20','http://','ports','port','skipHostnames','forwardAddon','chalk','description','ApiClient','next','Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.','78681KeXGCz','\x20-\x20','repeat','error','length','project\x20for\x20forwarding','askForService','name','\x20flag\x20or\x20manually\x20append\x20following\x20entry\x20to\x20your\x20hosts\x20file\x20(','Stop\x20forwarding\x20traffic\x20from\x20','printForwardingInfo','getCurrentProjectName','apiClient','forward','portFwdCmd','call','452802zGpwTg','message','alias','filter','forwardProject','Forwarding\x20service\x20','join','map','win32','connection-error','address','option','uniq','protocol','\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x20with\x20multiple\x20ports:','333vpDTJS','\x20is\x20exposed\x20with\x20multiple\x20','assertContextExisting','\x20is\x20exposed\x20on\x20','@northflank/js-client','414iAqDYl','create','Error\x20occured\x20while\x20trying\x20to\x20forward\x20','Port-forwarding\x20for\x20Northflank\x20services\x20and\x20addons.','askForProject','forEach','__awaiter','\x20addon\x20ports','Forwarding\x20','\x20\x20-\x20port\x20','entries','\x20mode.\x20If\x20hostname\x20forwarding\x20is\x20required,\x20remove\x20','--skipHostnames','writable','defineProperty','noDefaultsText','hasOwnProperty','apply','service','\x20in\x20project\x20','darwin','Service\x20to\x20forward','Services:','/etc/hosts','InquirerHelper','1666920yAeYSX','skipHostnamesText','getCommand','--service\x20--serviceId\x20[NAME]','action','Port-forwarding\x20for\x20the\x20specified\x20service','customUserAgent','getProxyForwarder','with\x20hostname:\x20','C:/Windows/System32/drivers/etc/hosts','bold','flat','getCurrentServiceName','Only\x20expose\x20on\x20IP\x20address,\x20not\x20on\x20hostnames.\x20With\x20this\x20option,\x20no\x20root\x20permissions\x20are\x20required.','forwardService','Addon\x20to\x20forward','Project\x20for\x20forwarding','value','Running\x20on\x20macOS\x20in\x20','exit','default','configurable','fwd','stop','success','\x20to\x20','--noDefaults','tunnel-close','Connection\x20error\x20occurred\x20when\x20forwarding\x20\x27','__esModule','groupBy','done','log','Failed:\x20','\x20mode:\x20the\x20locally\x20forwarded\x20port\x20differs\x20from\x20the\x20actual\x20port\x20on\x20the\x20forwarded\x20service/addon.','Port-forwarding\x20for\x20the\x20specified\x20addon','108600aICjke','152105mOhxhB','--addon\x20--addonId\x20[NAME]','canExecuteWithHostnames','warning','get','213402WtCXGd','addon','Addons:','31010fFBcKw','addCommand','forwarding','portName','uniqBy','Please\x20ensure\x20the\x20','28FvuxsC','\x20is\x20running\x20and\x20reachable.','data','platform','hostnames','type','green','HTTP','printHostsFileHint'];a14T=function(){return T1;};return a14T();}class CliPortForward{constructor(T){const h=a14t;this['noDefaultsText']=h(0x1e6),this[h(0x196)]=h(0x1a2),this['apiClient']=new js_client_1[(h(0x1e4))](T,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[h(0x19b)]});const v=new inquirer_helper_1[(h(0x194))](this[h(0x1f3)]);this[h(0x1f5)]=(0x0,utils_1[h(0x197)])()[h(0x1ee)](h(0x1f4))[h(0x1f9)](h(0x1ab))['description'](h(0x20f));const W=(0x0,utils_1[h(0x197)])(!![])[h(0x1ee)]('all')[h(0x1e3)]('Port-forwarding\x20for\x20all\x20services\x20and\x20addons\x20in\x20the\x20given\x20project')['option'](h(0x1d2),h(0x1ec))['option'](h(0x1af),this[h(0x18b)],![])[h(0x202)](h(0x188),this['skipHostnamesText'],![])[h(0x199)](({noDefaults:y,projectId:D,skipHostnames:w})=>__awaiter(this,void 0x0,void 0x0,function*(){const E=h;(0x0,utils_1['assertContextExisting'])(this[E(0x1f3)]);const I=this['getProxyForwarder'](w),U=y?undefined:T[E(0x1f2)](),k=D||U||(yield v['askForProject']());try{const {services:x,addons:B}=yield I[E(0x1fb)]({'projectId':k},w);if(x['length']+B[E(0x1eb)]<=0x0)(0x0,utils_1[E(0x1bd)])('No\x20services\x20and\x20addons\x20to\x20forward\x20found\x20in\x20project\x20'+chalk_1['default']['bold'](k));else{const o=x[E(0x1fa)](a=>a[E(0x1eb)]>0x0)['length'],s=B[E(0x1fa)](G=>G['length']>0x0)[E(0x1eb)],Y='\x20in\x20project\x20'+chalk_1['default'][E(0x19f)](k);console[E(0x1b5)](E(0x184)+chalk_1[E(0x1a9)]['green'][E(0x19f)](o+'\x20service\x20ports')+'\x20and\x20'+chalk_1[E(0x1a9)][E(0x1ce)][E(0x19f)](s+E(0x213))+Y),console[E(0x1b5)](),console[E(0x1b5)](chalk_1[E(0x1a9)][E(0x19f)](E(0x192))),x[E(0x211)](a=>{const i=E;if(a[i(0x1eb)]>=0x1&&!a[0x0][i(0x1ea)])this[i(0x1f1)](a,{'type':i(0x18e),'name':a[0x0]['data']['id']},w);}),console[E(0x1b5)](chalk_1[E(0x1a9)][E(0x19f)](E(0x1c1))),B[E(0x211)](a=>{const M=E;if(a[M(0x1eb)]>=0x1&&!a[0x0][M(0x1ea)])this[M(0x1f1)](a,{'type':M(0x1c0),'name':a[0x0][M(0x1ca)]['id']},w);}),this[E(0x1d0)]([...x[E(0x1a0)](),...B[E(0x1a0)]()],w);}}catch(a){(0x0,utils_1[E(0x1ea)])(E(0x1b6)+a[E(0x1f8)]);}})),l=(0x0,utils_1['getCommand'])(!![])[h(0x1ee)](h(0x18e))['description'](h(0x19a))[h(0x202)]('--project\x20--projectId\x20[NAME]',h(0x1a5))[h(0x202)](h(0x198),h(0x191))[h(0x202)](h(0x1af),this[h(0x18b)],![])['option'](h(0x188),this[h(0x196)],![])[h(0x199)](({noDefaults:y,projectId:D,serviceId:w,skipHostnames:e})=>__awaiter(this,void 0x0,void 0x0,function*(){const p=h;(0x0,utils_1['assertContextExisting'])(this[p(0x1f3)]);const I=this[p(0x19c)](e),U=y?undefined:T[p(0x1f2)](),k=D||U||(yield v[p(0x210)]()),x=y?undefined:T[p(0x1a1)](),B=w||x||(yield v[p(0x1ed)](k)());console[p(0x1b5)](p(0x1fc)+chalk_1[p(0x1a9)]['bold'](B)+p(0x18f)+chalk_1[p(0x1a9)][p(0x19f)](k));try{const o=yield I[p(0x1a3)]({'projectId':k,'serviceId':B},e);this['printForwardingInfo'](o,{'name':B,'type':p(0x18e)},e),this[p(0x1d0)](o,e);}catch(s){(0x0,utils_1['error'])(p(0x1b6)+s[p(0x1f8)]);}})),N=(0x0,utils_1[h(0x197)])(!![])[h(0x1ee)](h(0x1c0))[h(0x1e3)](h(0x1b8))[h(0x202)](h(0x1d2),'Project\x20for\x20forwarding')[h(0x202)](h(0x1bb),h(0x1a4))['option']('--skipHostnames',this['skipHostnamesText'],![])['action'](({noDefaults:y,projectId:D,addonId:w,skipHostnames:e})=>__awaiter(this,void 0x0,void 0x0,function*(){const Z=h;(0x0,utils_1[Z(0x209)])(this[Z(0x1f3)]);const I=this[Z(0x19c)](e),U=y?undefined:T['getCurrentProjectName'](),k=D||U||(yield v['askForProject']()),x=w||(yield v['askForAddon'](k)());console['log']('Forwarding\x20addon\x20'+chalk_1[Z(0x1a9)][Z(0x19f)](x)+Z(0x18f)+chalk_1[Z(0x1a9)][Z(0x19f)](k));try{const B={'projectId':k,'addonId':x},o=yield I[Z(0x1e1)](B,e);this['printForwardingInfo'](o,{'name':x,'type':Z(0x1c0)},e),this['printHostsFileHint'](o,e);}catch(s){(0x0,utils_1['error'])('Failed:\x20'+s['message']);}}));this[h(0x1f5)]['addCommand'](W),this[h(0x1f5)][h(0x1c3)](l),this[h(0x1f5)][h(0x1c3)](N);}[a14t(0x19c)](T=![]){const r=a14t,v=this[r(0x1f3)][r(0x1c4)];if(!T){const W=v[r(0x1bc)]();if(W[r(0x1ea)])throw new Error(W[r(0x1f8)]);}return v['on'](r(0x1b0),(l,N)=>{const R=r,y=chalk_1[R(0x1a9)]['bold'](N['type']+'\x20\x27'+N['id']+'\x27'),D=N[R(0x1cc)][R(0x1eb)]>0x0;(0x0,utils_1[R(0x1bd)])(R(0x1f0)+N[R(0x201)]+':'+N[R(0x1df)]+R(0x1ae)+y),T&&D&&(0x0,utils_1[R(0x1bd)])('\x20\x20If\x20you\x20have\x20added\x20entries\x20to\x20your\x20hosts\x20file,\x20it\x20is\x20recommended\x20to\x20remove\x20them\x20again\x20now.');}),v['on'](r(0x200),(l,N,y)=>{const f=r;(0x0,utils_1[f(0x1bd)])(f(0x1b1)+N[f(0x201)]+':'+N[f(0x1df)]+'\x27:\x20\x22'+(y===null||y===void 0x0?void 0x0:y[f(0x1f8)])+'\x22');}),process['on']('SIGINT',()=>__awaiter(this,void 0x0,void 0x0,function*(){const X=r;try{yield v[X(0x1ac)]();}catch(l){(0x0,utils_1[X(0x1ea)])('Cleaning\x20up\x20open\x20connections\x20failed:\x20'+l[X(0x1f8)]);}finally{process[X(0x1a8)]();}})),v;}[a14t(0x1f1)](T,v,W=![]){const V=a14t,{type:l,name:N}=v;if(T[V(0x1eb)]<=0x0){const e=V(0x1c7)+v[V(0x1cd)]+V(0x1c9);(0x0,utils_1['warning'])('\x20\x20\x20No\x20running\x20container\x20found\x20for\x20'+l+'\x20'+chalk_1[V(0x1a9)][V(0x19f)](N)+'.\x20'+e);return;}const y=(0x0,lodash_1[V(0x1b3)])(T,V(0x1d3)),D=I=>'\x20('+(I[V(0x1c5)]?I[V(0x1c5)]+V(0x1e8):'')+I[V(0x204)]+')';function w(I,U=0x2){const n=V;if(!W){const k=I[n(0x204)]===n(0x1cf)?n(0x1dd):'';I[n(0x1cc)][n(0x211)](x=>{const Q=n;console[Q(0x1b5)]((0x0,lodash_1[Q(0x1e9)])('\x20',U)+'-\x20'+k+x+':'+I[Q(0x1df)]);});}}Object[V(0x186)](y)[V(0x211)](([I,U])=>{const j=V;var k,x;const B='>\x20'+(0x0,lodash_1['capitalize'])(l)+'\x20\x27'+chalk_1[j(0x1a9)][j(0x1d6)][j(0x19f)](I)+'\x27';if(l===j(0x1c0)){if(U['length']===0x1){const o=U[0x0];if(o[j(0x1ea)]){(0x0,utils_1[j(0x1ea)])(j(0x20e)+I+':\x20'+o[j(0x1ea)][j(0x1f8)]);return;}const s=o[j(0x1ca)],Y=!W?'\x20'+chalk_1[j(0x1a9)]['reset'](j(0x19d)+s[j(0x1cc)]['join'](',')):'';(0x0,utils_1[j(0x1ad)])(B+'\x20is\x20exposed\x20on\x20'+s['address']+':'+s[j(0x1df)]+D(s)+Y);}else{const a=(0x0,lodash_1[j(0x1c6)])(U,G=>{const u=j;var H,A;return(A=(H=G===null||G===void 0x0?void 0x0:G['data'])===null||H===void 0x0?void 0x0:H[u(0x1cc)])===null||A===void 0x0?void 0x0:A[u(0x1fd)](',');})[j(0x1eb)]>0x1;(0x0,utils_1[j(0x1ad)])(B+j(0x208)+(a?j(0x1db):j(0x1de))+':'),U['forEach'](G=>{const q=j;if(G[q(0x1ea)]){(0x0,utils_1[q(0x1ea)])(q(0x20e)+I+':\x20'+G[q(0x1ea)][q(0x1f8)]);return;}const H=G[q(0x1ca)],A=!W?q(0x1d5)+H[q(0x1cc)][q(0x1fd)](','):'';console['log'](q(0x1dc)+H[q(0x201)]+':'+H['port']+D(H)+A);});}}if(l===j(0x18e)){if(U[j(0x1eb)]===0x1){const G=U[0x0];if(G[j(0x1ea)]){(0x0,utils_1[j(0x1ea)])('Error\x20occured\x20while\x20trying\x20to\x20forward\x20'+I+':\x20'+G[j(0x1ea)][j(0x1f8)]);return;}const H=G[j(0x1ca)],A=!W?'\x20with\x20these\x20hostnames:':':',m=H[j(0x201)]+':'+H[j(0x1df)]+D(H);(0x0,utils_1['success'])(B+'\x20is\x20exposed\x20on\x20'+m+A),w(H);}else(0x0,utils_1[j(0x1ad)])(B+j(0x20a)+((x=(k=U[0x0])===null||k===void 0x0?void 0x0:k[j(0x1ca)])===null||x===void 0x0?void 0x0:x['address'])+j(0x206)),U[j(0x211)](g=>{const L=j;if(g[L(0x1ea)]){(0x0,utils_1['error'])(L(0x20e)+I+':\x20'+g[L(0x1ea)][L(0x1f8)]);return;}const F=g['data'];(0x0,utils_1[L(0x1ad)])(L(0x185)+F[L(0x1df)]+D(F)),w(F,0x4);});}});}[a14t(0x1d0)](T,v=![]){const T0=a14t;if(v){const W=T['flatMap'](U=>U[T0(0x1ca)])[T0(0x1fa)](U=>U!==undefined),l=(process===null||process===void 0x0?void 0x0:process[T0(0x1cb)])===T0(0x1ff),N=os[T0(0x1cb)]()===T0(0x190),y=l?T0(0x19e):T0(0x193),D=chalk_1[T0(0x1a9)][T0(0x19f)](T0(0x1e0)),w=N?EOL+T0(0x1a7)+D+T0(0x1b7):undefined;let e=T0(0x1da)+D+T0(0x187)+T0(0x188)+T0(0x1ef)+y+'):';w!==undefined&&(0x0,utils_1[T0(0x1bd)])(w!==null&&w!==void 0x0?w:'');(0x0,utils_1[T0(0x1bd)])(e);const I=W[T0(0x1fe)](U=>U[T0(0x201)]+T0(0x205)+U[T0(0x1cc)][T0(0x1fd)]('\x20'));console[T0(0x1b5)]((0x0,lodash_1[T0(0x203)])(I)[T0(0x1fd)](EOL)),console[T0(0x1b5)]();}}}exports[a14t(0x1d8)]=CliPortForward;
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a15G=a15v;(function(T,v){const x=a15v,W=T();while(!![]){try{const l=parseInt(x(0x149))/0x1*(parseInt(x(0x152))/0x2)+-parseInt(x(0x10a))/0x3+-parseInt(x(0x11c))/0x4+parseInt(x(0x116))/0x5+parseInt(x(0x110))/0x6+parseInt(x(0x13f))/0x7*(parseInt(x(0x109))/0x8)+-parseInt(x(0x150))/0x9;if(l===v)break;else W['push'](W['shift']());}catch(N){W['push'](W['shift']());}}}(a15T,0x20051));var __awaiter=this&&this['__awaiter']||function(T,v,W,l){function N(y){return y instanceof W?y:new W(function(D){D(y);});}return new(W||(W=Promise))(function(y,D){const Y=a15v;function w(U){const B=a15v;try{I(l[B(0x12f)](U));}catch(k){D(k);}}function e(U){const o=a15v;try{I(l[o(0x122)](U));}catch(k){D(k);}}function I(U){const s=a15v;U[s(0x127)]?y(U[s(0x146)]):N(U['value'])[s(0x132)](w,e);}I((l=l['apply'](T,v||[]))[Y(0x12f)]());});},__importDefault=this&&this['__importDefault']||function(T){const a=a15v;return T&&T[a(0x11a)]?T:{'default':T};};Object['defineProperty'](exports,a15G(0x11a),{'value':!![]}),exports[a15G(0x159)]=exports['parseDateInput']=exports[a15G(0x14b)]=exports[a15G(0x13d)]=exports[a15G(0x134)]=exports[a15G(0x14d)]=exports[a15G(0x125)]=exports[a15G(0x143)]=exports[a15G(0x126)]=exports[a15G(0x10b)]=exports[a15G(0x141)]=exports[a15G(0x13c)]=exports[a15G(0x11b)]=exports[a15G(0x124)]=void 0x0;const chalk_1=__importDefault(require(a15G(0x12d))),commander_1=require('commander'),proxy_agent_1=require(a15G(0x11d)),importDynamic=new Function(a15G(0x151),a15G(0x128)),fetch=(T,v)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const H=a15G,W=yield importDynamic('node-fetch');return W[H(0x13e)](T,v);});exports['fetch']=fetch,exports[a15G(0x11b)]=new proxy_agent_1[(a15G(0x11e))]();const pgk=require(a15G(0x138));exports[a15G(0x13c)]='northflank-cli/'+(pgk===null||pgk===void 0x0?void 0x0:pgk[a15G(0x148)]);function checkUpdate(T){return __awaiter(this,void 0x0,void 0x0,function*(){const m=a15v;function v(W,l){const A=a15v,N=new Date(Number(W));return N[A(0x14c)](N[A(0x114)]()+l),N;}try{if(v(T[m(0x12a)](),0x1)>new Date())return;const W=pgk[m(0x148)],{name:l}=pgk;if(!W)return;const N=m(0x10e)+l+m(0x145),y=yield(0x0,exports[m(0x124)])(N,{'agent':exports[m(0x11b)],'method':m(0x111),'signal':AbortSignal['timeout'](0x1388)}),D=(yield y[m(0x10c)]())[m(0x148)];needsUpdate(W,D)&&warning(m(0x135)+W+m(0x118)+D+'.'+(m(0x130)+l+m(0x12e)+l+m(0x14a))),yield T['setLastUpdateCheck'](new Date());}catch(w){}});}exports['checkUpdate']=checkUpdate;function needsUpdate(T,v){const g=a15G,W=/(\.0+)+$/,l=T[g(0x14e)](W,'')[g(0x121)]('.'),N=v[g(0x14e)](W,'')[g(0x121)]('.');for(let y=0x0;y<Math[g(0x144)](l[g(0x153)],N[g(0x153)]);y+=0x1){const D=parseInt(N[y],0xa)-parseInt(l[y],0xa);if(D>0x0)return!![];if(D<0x0)return![];}return N[g(0x153)]>l['length'];}function error(T){const F=a15G;console[F(0x10b)](chalk_1[F(0x13e)]['redBright'](F(0x131)+T));}exports[a15G(0x10b)]=error;function warning(T){const K=a15G;console[K(0x10b)](chalk_1['default'][K(0x115)](''+T));}exports['warning']=warning;function success(T){const t=a15G;console[t(0x147)](chalk_1[t(0x13e)]['green'](''+T));}exports[a15G(0x143)]=success;function getCommand(T=![]){const C=a15G,v=new commander_1[(C(0x10d))]();return v[C(0x112)](undefined,C(0x129)),v[C(0x123)](![]),v[C(0x13b)](![]),v[C(0x120)](![]),v[C(0x133)](![]),v[C(0x11f)](!![]),T&&(v[C(0x117)](C(0x10f),C(0x156),![]),v[C(0x117)](C(0x140),C(0x13a),![]),v['option']('--skipValidation',C(0x12c),![])),v;}exports[a15G(0x125)]=getCommand;const retry=(T,v=0x32)=>W=>{let l=T;const N=()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){try{return yield W();}catch(y){if(l<=0x0)throw y;return l-=0x1,yield new Promise(D=>setTimeout(()=>D(),v)),N();}});return N();};exports[a15G(0x14d)]=retry;const asyncSequential=(T,v)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const b=a15G,W=Promise['resolve']([]);return T['reduce']((l,N)=>l['then'](y=>v(N)[b(0x132)](D=>{const P=b;return y[P(0x119)](D),y;})),W);});function a15v(T,v){const W=a15T();return a15v=function(l,N){l=l-0x109;let y=W[l];return y;},a15v(T,v);}exports[a15G(0x134)]=asyncSequential;function isValidJSON(T){const z=a15G;try{return JSON[z(0x14f)](T);}catch(v){return![];}}exports[a15G(0x13d)]=isValidJSON;function assertContextExisting(T){const c=a15G;if(T[c(0x155)][c(0x157)]()===undefined)throw new Error(c(0x113));if(T[c(0x155)][c(0x142)]()===undefined)throw new Error('No\x20API\x20URL\x20present\x20in\x20context.\x20Create\x20new\x20context\x20with\x20\x27northflank\x20login\x27');if(T[c(0x155)][c(0x137)]()===undefined)throw new Error('No\x20token\x20in\x20CLI\x20context.\x20Add\x20token\x20with\x20\x27northflank\x20set-token\x27');}function a15T(){const J=['543054vWSpAm','error','json','Command','https://registry.npmjs.org/','--verbose','1254738QhBtvI','GET','helpOption','No\x20CLI\x20context\x20present.\x20Create\x20context\x20with\x20\x27northflank\x20login\x27','getDate','yellow','246510VRhgxS','option',',\x20the\x20latest\x20version\x20of\x20the\x20cli\x20is\x20','push','__esModule','agent','410532sTrIFF','proxy-agent','ProxyAgent','enablePositionalOptions','allowUnknownOption','split','throw','addHelpCommand','fetch','getCommand','warning','done','return\x20import(modulePath)','Display\x20help\x20for\x20command','getLastUpdateCheck','parseDateInput','Do\x20not\x20validate\x20input\x20fields\x20on\x20client\x20side','chalk','\x20-g\x27\x20or\x20\x27yarn\x20global\x20add\x20','next','\x20Consider\x20updating\x20using\x20\x27npm\x20i\x20','Failed:\x20','then','allowExcessArguments','asyncSequential','**\x20You\x27re\x20running\x20on\x20version\x20',',\x20expected\x20valid\x20date\x20string\x20(example:\x202020-02-02T02:02:02Z)\x20or\x20unix\x20timestamp\x20(example\x201580608922)','getCurrentToken','../package.json','Invalid\x20date\x20received:\x20','No\x20console\x20output','storeOptionsAsProperties','customUserAgent','isValidJSON','default','1702813NqWrFY','--quiet','checkUpdate','getCurrentBaseUrl','success','min','/latest','value','log','version','9845NxgUWW','\x27\x20**','assertContextExisting','setDate','retry','replace','parse','2465415TZgtWJ','modulePath','38rNhNXr','length','getTime','contextProvider','Verbose\x20output','getCurrentContext','setUTCSeconds','tsHint','8zMXyHa'];a15T=function(){return J;};return a15T();}exports[a15G(0x14b)]=assertContextExisting;const parseDateInput=T=>{const O=a15G;try{let W=new Date(T);if(isNaN(W[O(0x154)]())){const l=T[O(0x153)]===0xd?T/0x3e8:T,N=new Date(0x0);N[O(0x158)](l);if(isNaN(N[O(0x154)]()))throw new Error();return N;}return W;}catch(y){throw new Error(O(0x139)+T+O(0x136));}};exports[a15G(0x12b)]=parseDateInput,exports[a15G(0x159)]='example:\x202020-02-02T02:02:02Z\x20(date\x20string)\x20or\x201580608922\x20(unix\x20ts)';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@northflank/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.26",
|
|
4
4
|
"author": "Marco Suter",
|
|
5
5
|
"description": "Provides a command-line interface to the Northflank platform.",
|
|
6
6
|
"homepage": "https://www.northflank.com",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"LICENSE"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@northflank/js-client": "0.7.
|
|
29
|
+
"@northflank/js-client": "0.7.26",
|
|
30
30
|
"bufferutil": "^4.0.7",
|
|
31
31
|
"chalk": "~4.1.0",
|
|
32
32
|
"columnify": "^1.5.4",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"lodash": "^4.17.15",
|
|
38
38
|
"node-fetch": "^3.3.2",
|
|
39
39
|
"open": "^8.4.0",
|
|
40
|
+
"proxy-agent": "^6.5.0",
|
|
40
41
|
"utf-8-validate": "^5.0.10",
|
|
41
42
|
"ws": "^8.2.1"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@fig/complete-commander": "^2.0.0",
|
|
45
45
|
"ts-node": "^8.10.2",
|
|
46
|
-
"typescript": "^4.
|
|
46
|
+
"typescript": "^4.9.5"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"northflank",
|