@northflank/cli 0.10.1 → 0.10.2
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/copy/index.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 +1 -1
package/dist/metrics/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const a13C=a13E;function a13E(c,E){const S=a13c();return a13E=function(X,u){X=X-0x1da;let Y=S[X];return Y;},a13E(c,E);}(function(c,E){const O=a13E,S=c();while(!![]){try{const X=-parseInt(O(0x20b))/0x1*(parseInt(O(0x270))/0x2)+parseInt(O(0x1ee))/0x3+parseInt(O(0x261))/0x4*(parseInt(O(0x20c))/0x5)+-parseInt(O(0x262))/0x6*(-parseInt(O(0x1ff))/0x7)+-parseInt(O(0x22b))/0x8+-parseInt(O(0x1df))/0x9*(parseInt(O(0x228))/0xa)+parseInt(O(0x272))/0xb;if(X===E)break;else S['push'](S['shift']());}catch(u){S['push'](S['shift']());}}}(a13c,0xf16a5));function a13c(){const c9=['deploymentId','error','split','174080UVcbfv','unshift','option','10490344HJYMNZ','Output\x20formatting.\x20Will\x20use\x20advanced\x20formatting\x20by\x20default.','slice','__awaiter','toUpperCase','filter','apply','throw','Project\x20for\x20logs','\x20for\x20container:\x20','getAsciiChart','choices','--build\x20--buildId\x20[buildId]','json','log','length','argParser','pct','min','--container\x20--containerId\x20[NAME]','tsHint','max','flat','printMetricsTable','InquirerHelper','clear','@northflank/js-client','MetricType','format','startTime','printMetricsSingle','\x20seconds','--timestamp\x20[timestamp]','__esModule','\x20in\x20project\x20','Option','--noDefaults','jobId','service','-t,\x20--metricTypes\x20<metricTypes...>','Id\x20[NAME]','columns','done','addOption','ApiClient','message','parseDateInput','apiClient','No\x20metrics\x20found\x20for\x20this\x20query','--deployment\x20--deploymentId\x20[deploymentId]','getStandardMetricsCommand','askForJobRun','forEach','askForAddon','1011492guGDxI','66UbTKcQ','CliMetrics','exit','\x20--','../formatting/terminal-chart','assign',',\x20volume:\x20','yaml','push','Get\x20metrics\x20for\x20the\x20specified\x20','apiContext','askForBuild','build-','description','6OuKoym','job','10647582xzpBHx','metricId','customUserAgent','askForContainer','metrics','getCommand','--startTime\x20<timestamp>','printAsTable','noDefaults','default','refreshInterval','216IcuHNG','bold','metadata','addonId','values','getCurrentServiceName','rows','--project\x20--projectId\x20[NAME]','containerId','Error\x20while\x20fetching\x20metrics\x20entries:\x20','askForService','Get\x20metrics\x20before\x20this\x20timestamp,\x20','stdout','value','time','1592250BdHHQv','warning','Get\x20metrics\x20at\x20this\x20exact\x20timestamp,\x20if\x20no\x20timestamp\x20set\x20most\x20recent\x20time\x20is\x20used.\x20','commander','__importDefault','next','container\x20','Deployment\x20id,\x20example:\x20my-service-54785f4','flatMap','getPaddingDataEnd','getPaddingDataStart','metricsApiClient','metricsRange',',\x20duration:\x20','metric','Length\x20of\x20timespan\x20in\x20seconds.\x20Only\x20valid\x20if\x20not\x20both,\x20startTime\x20and\x20endTime\x20are\x20set','valueOf','1041698BJnMsw','-o,\x20--output\x20[output]',',\x20to:\x20','--endTime\x20<timestamp>','getTime','toISOString','data','keys','--duration\x20[duration]','\x20to\x20get\x20logs\x20from','Get\x20metrics\x20after\x20this\x20timestamp,\x20','alias','560703ANWHHP','25GgLbjY','../inquirer-helper','metricsSingle','name','defineProperty',',\x20from:\x20','printMetricsGraph','getCurrentProjectName','Metrics\x20overview','Metrics\x20for\x20','map','Only\x20two\x20of\x20\x27startTime\x27,\x20\x27endTime\x27\x20and\x20\x27duration\x27\x20can\x20be\x20set.','N/A','Build\x20to\x20get\x20logs\x20from','printResponse','askForJob','chalk',',\x20metric\x20types:\x20','inquirerHelper','../formatting/console-format-helpers','charAt','handleError','printInitInfo','metricUnit','serviceId'];a13c=function(){return c9;};return a13c();}var __awaiter=this&&this[a13C(0x22e)]||function(c,E,S,X){function u(Y){return Y instanceof S?Y:new S(function(R){R(Y);});}return new(S||(S=Promise))(function(Y,R){const e=a13E;function d(p){const k=a13E;try{U(X[k(0x1f3)](p));}catch(q){R(q);}}function w(p){const o=a13E;try{U(X[o(0x232)](p));}catch(q){R(q);}}function U(p){const y=a13E;p[y(0x255)]?Y(p[y(0x1ec)]):u(p[y(0x1ec)])['then'](d,w);}U((X=X[e(0x231)](c,E||[]))[e(0x1f3)]());});},__importDefault=this&&this[a13C(0x1f2)]||function(c){const D=a13C;return c&&c[D(0x24c)]?c:{'default':c};};Object[a13C(0x210)](exports,a13C(0x24c),{'value':!![]}),exports[a13C(0x263)]=void 0x0;const js_client_1=require(a13C(0x245)),utils_1=require('../utils'),inquirer_helper_1=require(a13C(0x20d)),commander_1=require(a13C(0x1f1)),terminal_chart_1=require(a13C(0x266)),console_format_helpers_1=require(a13C(0x21f)),chalk_1=__importDefault(require(a13C(0x21c)));class CliMetrics{constructor(c,E){const x=a13C;this[x(0x26c)]=c,this[x(0x1de)]=0x2710,this[x(0x25d)]=(S,X)=>{const h=x,u=(0x0,utils_1[h(0x277)])(!![])[h(0x20f)]((X?h(0x26e):'')+h(0x276))[h(0x20a)]((X?h(0x26e):'')+h(0x1fc))[h(0x26f)](h(0x26b)+S)[h(0x22a)](h(0x1e6),h(0x233))[h(0x22a)]('--'+S+h(0x265)+S+h(0x253),S[h(0x220)](0x0)[h(0x22f)]()+S[h(0x22d)](0x1)+h(0x208))[h(0x22a)](h(0x23e),'Container\x20to\x20exec\x20into\x20(logs\x20from\x20all\x20containers\x20will\x20be\x20shown\x20if\x20not\x20specified)')[h(0x22a)](h(0x1da),h(0x209)+utils_1[h(0x23f)],utils_1[h(0x259)])['option'](h(0x202),h(0x1ea)+utils_1[h(0x23f)],utils_1[h(0x259)])[h(0x22a)](h(0x207),h(0x1fd))['addOption'](new commander_1[(h(0x24e))](h(0x200),h(0x22c))[h(0x236)](Object[h(0x1e3)]([h(0x247),h(0x238),h(0x269)])))[h(0x256)](new commander_1['Option'](h(0x252),'Which\x20metric\x20type\x20to\x20fetch')[h(0x236)](Object[h(0x1e3)](js_client_1[h(0x246)])))['addOption'](new commander_1['Option'](h(0x24b),h(0x1f0)+utils_1[h(0x23f)])[h(0x23b)](utils_1['parseDateInput'])['conflicts']([h(0x248),'endTime']))[h(0x22a)](h(0x24f),'Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.',![])['addOption'](new commander_1[(h(0x24e))](h(0x200),'Output\x20formatting.\x20Will\x20use\x20advanced\x20formatting\x20by\x20default.')[h(0x236)](Object[h(0x1e3)](['format','json',h(0x269)])));if(X)u[h(0x22a)](h(0x237),h(0x219));if(S===h(0x271))u['option']('--run\x20--runId\x20[runId]','Job\x20run\x20id,\x20example:\x20162b1977-6636-4000-929b-cc265b862ff0');if(S===h(0x251))u[h(0x22a)](h(0x25c),h(0x1f5));return u;},this[x(0x212)]=(S,X)=>{return u=>{const n=a13E,Y=Object[n(0x206)](u)[n(0x1f6)](R=>{const {values:d,metricInfo:w}=u[R],{metricUnit:P,metricResolution:U}=w;return d['map'](p=>{const s=a13E;var q,B;const {metadata:V,data:g}=p,r=X?(X===null||X===void 0x0?void 0x0:X[s(0x203)]())>new Date()[s(0x203)]()?new Date():X:undefined,H=new Date((q=g===null||g===void 0x0?void 0x0:g[0x0])===null||q===void 0x0?void 0x0:q['ts']),f=new Date((B=g===null||g===void 0x0?void 0x0:g[g[s(0x23a)]-0x1])===null||B===void 0x0?void 0x0:B['ts']),Z=this[s(0x1f8)](S,H,U),K=this[s(0x1f7)](r,f,U),t=[...Z,...g,...K],G=t[s(0x216)](N=>[new Date(N['ts'])[s(0x1fe)](),Number(N[s(0x1ec)])])[s(0x230)](N=>!Number['isNaN'](N[0x0])),b=Math['min'](Math[s(0x240)](process[s(0x1eb)][s(0x254)]-0xa,0xa),0x64),l=Math[s(0x23d)](Math[s(0x240)](process[s(0x1eb)]['rows']-0x9,0xa),0xf),A=P===s(0x23c)?0x64:undefined,I=P===s(0x23c)?'%':P,T=(0x0,terminal_chart_1['downSampleData'])(G,b),M=T[s(0x216)](N=>N[0x1]),m={'min':0x0,'height':l,'max':A,'unit':I,'startTs':S!==null&&S!==void 0x0?S:H,'endTs':r!==null&&r!==void 0x0?r:f};return{'dataSeries':M,'metadata':V,'chartOpts':m,'metricInfo':w};});})[n(0x241)]();if(Y[n(0x23a)]===0x0)(0x0,utils_1[n(0x1ef)])(n(0x25b));else Y['forEach'](R=>{const j=n,{dataSeries:d,metadata:w,chartOpts:P,metricInfo:U}=R,{containerId:p,volumeId:q}=w,B=q?j(0x268)+q:'';console['log'](U[j(0x273)]+j(0x234)+chalk_1[j(0x1dd)][j(0x1e0)](p)+B),console[j(0x239)]((0x0,terminal_chart_1[j(0x235)])(d,P));});};},this[x(0x242)]=(S,X,u)=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const a=x;try{const Y=yield this[a(0x1f9)]['metrics']['metricsSingle'](S,X,u);console[a(0x244)]();if(Y[a(0x226)])(0x0,utils_1['error'])(a(0x1e8)+Y[a(0x226)][a(0x258)]);else this[a(0x249)](Y[a(0x205)]);}catch(R){console[a(0x244)](),(0x0,utils_1['error'])(a(0x1e8)+R[a(0x258)]);}}),this[x(0x221)]=S=>{const Q=x;if(S[Q(0x226)]){const X=JSON['stringify'](S[Q(0x226)]['details']);throw new Error(Q(0x1e8)+S[Q(0x226)][Q(0x258)]+'\x20'+X);}},this[x(0x222)]=(S,X,u,Y,R)=>{const L=x;if(R===!![])return;const {metricTypes:d,endTime:w,startTime:P,duration:U,containerId:p}=Y,q=P?L(0x211)+P[L(0x204)]():'',B=w?L(0x201)+w['toISOString']():'',V=U?L(0x1fb)+U+L(0x24a):'',g=p?L(0x1f4)+chalk_1[L(0x1dd)][L(0x1e0)](p):'all\x20containers',r=S+'\x20'+chalk_1[L(0x1dd)][L(0x1e0)](X)+L(0x24d)+chalk_1[L(0x1dd)][L(0x1e0)](u),H=''+q+B+V,f=d?L(0x21d)+(d===null||d===void 0x0?void 0x0:d['join'](',')):'';console['log'](L(0x215)+g+'\x20of\x20'+r+f+H);},this[x(0x25a)]=new js_client_1[(x(0x257))](c,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[x(0x274)],'agent':E}),this[x(0x1f9)]=this[x(0x25a)],this['inquirerHelper']=new inquirer_helper_1[(x(0x243))](this[x(0x25a)]);}['getMetricsCommand'](c,E=![]){const S=(d,w)=>__awaiter(this,void 0x0,void 0x0,function*(){const W=a13E,P=w[W(0x1dc)],{apiContext:U,inquirerHelper:p}=this;switch(c){case W(0x251):{const q=P?undefined:U[W(0x1e4)]();return w[W(0x224)]||q||(yield p[W(0x1e9)](d)());}case W(0x271):{const B=P?undefined:U[W(0x1e4)]();return w[W(0x250)]||B||(yield p[W(0x21b)](d)());}case'addon':{const V=P?undefined:U['getCurrentServiceName']();return w[W(0x1e2)]||V||(yield p[W(0x260)](d)());}}}),X=(d,w,P)=>__awaiter(this,void 0x0,void 0x0,function*(){const F=a13E;if(E)return P['buildId']||(yield this['inquirerHelper'][F(0x26d)](d,c===F(0x251)?w:undefined,c===F(0x271)?w:undefined,!![])());return undefined;}),u=(d,w,P)=>__awaiter(this,void 0x0,void 0x0,function*(){const i=a13E;if(!E&&P['containerId']!==undefined){if(P['containerId']!==!![])return P['containerId'];return yield this[i(0x21e)][i(0x275)](d,c===i(0x251)?w:undefined,c===i(0x271)?w:undefined,!![])();}return undefined;}),Y=(d,w,P)=>__awaiter(this,void 0x0,void 0x0,function*(){const v=a13E;if(c===v(0x271))return P['runId']||(yield this[v(0x21e)][v(0x25e)](w,d,!![])());return undefined;}),R=(d,w,P)=>__awaiter(this,void 0x0,void 0x0,function*(){const c0=a13E;if(c===c0(0x251)){if(P[c0(0x225)]!==!![])return P[c0(0x225)];return P[c0(0x225)];}return undefined;});return this['getStandardMetricsCommand'](c,E)['action'](d=>__awaiter(this,void 0x0,void 0x0,function*(){const c1=a13E,{noDefaults:w,projectId:P,duration:U,timestamp:p,output:q,startTime:B,endTime:V,metricTypes:g,quiet:r}=d;(0x0,utils_1['assertContextExisting'])(this[c1(0x25a)]);if(B&&V&&U)throw new Error(c1(0x217));const {apiContext:H,inquirerHelper:f,metricsApiClient:Z}=this,K=w?undefined:H[c1(0x213)](),t=P||K||(yield f['askForProject']()),G=yield S(t,d),b=yield X(t,G,d),l=yield Y(t,G,d),A=yield R(t,G,d),I=yield u(t,G,d),T={'projectId':t,'entityId':G},M={'containerName':I,'startTime':B,'endTime':V,'duration':U,'timestamp':p,'metricTypes':g,'runId':l,'buildId':b,'deploymentId':A,'isBuild':E!==null&&E!==void 0x0?E:![]},m=!(B||V||U);if(!r&&q!=='yaml'&&q!=='yml'&&q!==c1(0x238))this[c1(0x222)](c,G,t,M,r);if(m){if(q!==undefined){const N=yield Z[c1(0x276)][c1(0x20e)](T,M,c);this['handleError'](N),(0x0,console_format_helpers_1[c1(0x21a)])(q,N[c1(0x205)]);}else[...Array(process[c1(0x1eb)][c1(0x1e5)]-0x1)][c1(0x25f)]((z,J)=>J===0x0?console[c1(0x239)]('Fetching\x20data..'):console[c1(0x239)]()),yield this[c1(0x242)](T,M,c)(),setInterval(this[c1(0x242)](T,M,c),this['refreshInterval']),yield new Promise(z=>setTimeout(z,this[c1(0x1de)]*0x64));}else{const z=yield Z[c1(0x276)][c1(0x1fa)](T,M,c);this[c1(0x221)](z),q!==undefined?(0x0,console_format_helpers_1['printResponse'])(q,z[c1(0x205)]):this['printMetricsGraph'](B,V!==null&&V!==void 0x0?V:new Date())(z[c1(0x205)]);}process[c1(0x264)]();}));}[a13C(0x249)](c){const c4=a13C,E=(u,Y)=>{const c2=a13E;if(!(Y===null||Y===void 0x0?void 0x0:Y['value']))'N/A';const R=u[c2(0x223)]==='pct'?'%':u[c2(0x223)];return''+Number(Y===null||Y===void 0x0?void 0x0:Y['value'])['toFixed'](0x3)+R;},S=u=>{const c3=a13E;if(!(u===null||u===void 0x0?void 0x0:u['ts']))c3(0x218);return u['ts']['toTimeString']()[c3(0x227)]('\x20')[0x0];},X={};Object[c4(0x206)](c)[c4(0x25f)](u=>{const c5=c4,{values:Y,metricInfo:R}=c[u];return Y[c5(0x25f)](d=>{const c6=c5;var w,P;const U=d[c6(0x1e1)][c6(0x1e7)];Object[c6(0x267)](X,{[U]:Object[c6(0x267)](Object[c6(0x267)]({},X===null||X===void 0x0?void 0x0:X[U]),{[c6(0x1ed)]:S((w=d['data'])===null||w===void 0x0?void 0x0:w[0x0]),'containerId':U,[R['metricId']]:E(R,(P=d[c6(0x205)])===null||P===void 0x0?void 0x0:P[0x0])})});});}),(0x0,console_format_helpers_1[c4(0x1db)])(Object[c4(0x1e3)](X),c4(0x214));}['getPaddingDataStart'](c,E,S){const c7=a13C,X=R=>new Date(R['getTime']()-u),u=S*0x3e8;if(!c)return[];if(!E)return[];if(X(E)[c7(0x203)]()<c[c7(0x203)]())return[];const Y=[{'ts':X(E),'value':0x0}];while(X(Y[Y[c7(0x23a)]-0x1]['ts'])[c7(0x203)]()<=c[c7(0x203)]()){Y[c7(0x229)]({'ts':X(Y[Y['length']-0x1]['ts']),'value':0x0});}return Y;}[a13C(0x1f7)](c,E,S){const c8=a13C,X=R=>new Date(R[c8(0x203)]()+u),u=S*0x3e8;if(!c)return[];if(!E)return[];if(X(E)[c8(0x203)]()>c[c8(0x203)]())return[];const Y=[{'ts':X(E),'value':0x0}];while(X(Y[Y[c8(0x23a)]-0x1]['ts'])[c8(0x203)]()<=c['getTime']()){Y[c8(0x26a)]({'ts':X(Y[Y[c8(0x23a)]-0x1]['ts']),'value':0x0});}return Y;}}exports[a13C(0x263)]=CliMetrics;
|
|
1
|
+
'use strict';function a13K(U,K){const q=a13U();return a13K=function(X,J){X=X-0x1a5;let v=q[X];return v;},a13K(U,K);}const a13C=a13K;(function(U,K){const S=a13K,q=U();while(!![]){try{const X=parseInt(S(0x20a))/0x1*(parseInt(S(0x201))/0x2)+-parseInt(S(0x237))/0x3+parseInt(S(0x238))/0x4+-parseInt(S(0x20b))/0x5*(-parseInt(S(0x1fb))/0x6)+-parseInt(S(0x1ea))/0x7+parseInt(S(0x1ca))/0x8+parseInt(S(0x213))/0x9*(-parseInt(S(0x20c))/0xa);if(X===K)break;else q['push'](q['shift']());}catch(J){q['push'](q['shift']());}}}(a13U,0x7b9b8));var __awaiter=this&&this[a13C(0x1c0)]||function(U,K,q,X){function J(v){return v instanceof q?v:new q(function(f){f(v);});}return new(q||(q=Promise))(function(v,f){const e=a13K;function L(z){const N=a13K;try{E(X[N(0x216)](z));}catch(p){f(p);}}function M(z){try{E(X['throw'](z));}catch(p){f(p);}}function E(z){const Z=a13K;z[Z(0x1f4)]?v(z[Z(0x226)]):J(z[Z(0x226)])[Z(0x22f)](L,M);}E((X=X[e(0x222)](U,K||[]))[e(0x216)]());});},__importDefault=this&&this[a13C(0x21b)]||function(U){return U&&U['__esModule']?U:{'default':U};};Object[a13C(0x20d)](exports,a13C(0x1ec),{'value':!![]}),exports[a13C(0x1c2)]=void 0x0;const js_client_1=require(a13C(0x1b0)),utils_1=require(a13C(0x1e3)),inquirer_helper_1=require(a13C(0x1d6)),commander_1=require(a13C(0x1c8)),terminal_chart_1=require(a13C(0x204)),console_format_helpers_1=require(a13C(0x1a5)),chalk_1=__importDefault(require('chalk'));function a13U(){const U8=['metrics','valueOf','printResponse','--build\x20--buildId\x20[buildId]','max','metricUnit','-t,\x20--metricTypes\x20<metricTypes...>','containerId','__awaiter','--startTime\x20<timestamp>','CliMetrics','assertContextExisting','columns','getAsciiChart','--noDefaults','\x20in\x20project\x20','commander','forEach','5779960MkdrWP','format','data','tsHint','Option','Project\x20for\x20logs','getTime','--project\x20--projectId\x20[NAME]','metadata','Which\x20metric\x20type\x20to\x20fetch','apiClient','bold','../inquirer-helper','assign','getMetricsCommand','map','getCurrentServiceName','conflicts','--run\x20--runId\x20[runId]','container\x20','addon','askForJobRun','unshift','--duration\x20[duration]','Error\x20while\x20fetching\x20metrics\x20entries:\x20','../utils','Only\x20two\x20of\x20\x27startTime\x27,\x20\x27endTime\x27\x20and\x20\x27duration\x27\x20can\x20be\x20set.','jobId','-o,\x20--output\x20[output]','service','name','deploymentId','4690098YeThTt','keys','__esModule','parseDateInput','askForBuild','log','Output\x20formatting.\x20Will\x20use\x20advanced\x20formatting\x20by\x20default.','--endTime\x20<timestamp>','default','toFixed','done','option','json','askForProject','metricsRange','yaml','stringify','3012078dQypTC','getCommand','\x20of\x20','\x20to\x20get\x20logs\x20from','endTime','slice','92nkFloa',',\x20from:\x20','Get\x20metrics\x20for\x20the\x20specified\x20','../formatting/terminal-chart','rows','handleError','noDefaults','metricId','charAt','6642vESaGl','10AayJvk','30eAyWsI','defineProperty','Deployment\x20id,\x20example:\x20my-service-54785f4','flat','printMetricsTable','Get\x20metrics\x20at\x20this\x20exact\x20timestamp,\x20if\x20no\x20timestamp\x20set\x20most\x20recent\x20time\x20is\x20used.\x20','toISOString','3284415sYSoRS','build-','--deployment\x20--deploymentId\x20[deploymentId]','next','metricsSingle','argParser','message','Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.','__importDefault','length','No\x20metrics\x20found\x20for\x20this\x20query','buildId','printInitInfo','startTime','inquirerHelper','apply','join','min','\x20--','value','addOption','stdout','filter','Get\x20metrics\x20before\x20this\x20timestamp,\x20','push','choices','Build\x20to\x20get\x20logs\x20from','getStandardMetricsCommand','then','pct','details','values','printMetricsSingle','printMetricsGraph','action','N/A','397176UDFPpq','1485816gmeQJm','yml','../formatting/console-format-helpers','Get\x20metrics\x20after\x20this\x20timestamp,\x20','isNaN','printAsTable','getPaddingDataStart','clear','refreshInterval','addonId','getPaddingDataEnd','\x20seconds',',\x20volume:\x20','@northflank/js-client','error','\x20for\x20container:\x20','ApiClient','metricsApiClient','exit','description','job'];a13U=function(){return U8;};return a13U();}class CliMetrics{constructor(U,K){const n=a13C;this['apiContext']=U,this[n(0x1ab)]=0x2710,this['getStandardMetricsCommand']=(q,X)=>{const t=n,J=(0x0,utils_1[t(0x1fc)])(!![])[t(0x1e8)]((X?t(0x214):'')+'metrics')['alias']((X?t(0x214):'')+'metric')[t(0x1b6)](t(0x203)+q)[t(0x1f5)](t(0x1d1),t(0x1cf))['option']('--'+q+t(0x225)+q+'Id\x20[NAME]',q[t(0x209)](0x0)['toUpperCase']()+q[t(0x200)](0x1)+t(0x1fe))['option']('--container\x20--containerId\x20[NAME]','Container\x20to\x20exec\x20into\x20(logs\x20from\x20all\x20containers\x20will\x20be\x20shown\x20if\x20not\x20specified)')[t(0x1f5)](t(0x1c1),t(0x1a6)+utils_1[t(0x1cd)],utils_1[t(0x1ed)])['option'](t(0x1f1),t(0x22a)+utils_1[t(0x1cd)],utils_1['parseDateInput'])['option'](t(0x1e1),'Length\x20of\x20timespan\x20in\x20seconds.\x20Only\x20valid\x20if\x20not\x20both,\x20startTime\x20and\x20endTime\x20are\x20set')[t(0x227)](new commander_1[(t(0x1ce))](t(0x1e6),t(0x1f0))[t(0x22c)](Object[t(0x232)](['format',t(0x1f6),'yaml'])))['addOption'](new commander_1[(t(0x1ce))](t(0x1be),t(0x1d3))['choices'](Object[t(0x232)](js_client_1['MetricType'])))[t(0x227)](new commander_1[(t(0x1ce))]('--timestamp\x20[timestamp]',t(0x211)+utils_1[t(0x1cd)])[t(0x218)](utils_1[t(0x1ed)])[t(0x1db)]([t(0x220),t(0x1ff)]))[t(0x1f5)](t(0x1c6),t(0x21a),![])[t(0x227)](new commander_1[(t(0x1ce))]('-o,\x20--output\x20[output]','Output\x20formatting.\x20Will\x20use\x20advanced\x20formatting\x20by\x20default.')[t(0x22c)](Object['values']([t(0x1cb),t(0x1f6),t(0x1f9)])));if(X)J[t(0x1f5)](t(0x1bb),t(0x22d));if(q==='job')J['option'](t(0x1dc),'Job\x20run\x20id,\x20example:\x20162b1977-6636-4000-929b-cc265b862ff0');if(q==='service')J[t(0x1f5)](t(0x215),t(0x20e));return J;},this['printMetricsGraph']=(q,X)=>{return J=>{const Y=a13K,v=Object[Y(0x1eb)](J)['flatMap'](f=>{const l=Y,{values:L,metricInfo:M}=J[f],{metricUnit:E,metricResolution:z}=M;return L[l(0x1d9)](p=>{const T=l;var O,F;const {metadata:o,data:Q}=p,w=X?(X===null||X===void 0x0?void 0x0:X[T(0x1d0)]())>new Date()[T(0x1d0)]()?new Date():X:undefined,R=new Date((O=Q===null||Q===void 0x0?void 0x0:Q[0x0])===null||O===void 0x0?void 0x0:O['ts']),W=new Date((F=Q===null||Q===void 0x0?void 0x0:Q[Q[T(0x21c)]-0x1])===null||F===void 0x0?void 0x0:F['ts']),V=this[T(0x1a9)](q,R,z),b=this[T(0x1ad)](w,W,z),B=[...V,...Q,...b],y=B['map'](D=>[new Date(D['ts'])[T(0x1b9)](),Number(D['value'])])[T(0x229)](D=>!Number[T(0x1a7)](D[0x0])),x=Math[T(0x224)](Math[T(0x1bc)](process[T(0x228)][T(0x1c4)]-0xa,0xa),0x64),a=Math[T(0x224)](Math[T(0x1bc)](process['stdout'][T(0x205)]-0x9,0xa),0xf),m=E===T(0x230)?0x64:undefined,i=E==='pct'?'%':E,G=(0x0,terminal_chart_1['downSampleData'])(y,x),A=G[T(0x1d9)](D=>D[0x1]),s={'min':0x0,'height':a,'max':m,'unit':i,'startTs':q!==null&&q!==void 0x0?q:R,'endTs':w!==null&&w!==void 0x0?w:W};return{'dataSeries':A,'metadata':o,'chartOpts':s,'metricInfo':M};});})[Y(0x20f)]();if(v['length']===0x0)(0x0,utils_1['warning'])(Y(0x21d));else v[Y(0x1c9)](f=>{const I=Y,{dataSeries:L,metadata:M,chartOpts:E,metricInfo:z}=f,{containerId:p,volumeId:O}=M,F=O?I(0x1af)+O:'';console[I(0x1ef)](z['metricId']+I(0x1b2)+chalk_1[I(0x1f2)][I(0x1d5)](p)+F),console['log']((0x0,terminal_chart_1[I(0x1c5)])(L,E));});};},this['printMetricsTable']=(q,X,J)=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const c=n;try{const v=yield this[c(0x1b4)][c(0x1b8)][c(0x217)](q,X,J);console[c(0x1aa)]();if(v['error'])(0x0,utils_1[c(0x1b1)])('Error\x20while\x20fetching\x20metrics\x20entries:\x20'+v[c(0x1b1)]['message']);else this[c(0x233)](v[c(0x1cc)]);}catch(f){console[c(0x1aa)](),(0x0,utils_1[c(0x1b1)])(c(0x1e2)+f[c(0x219)]);}}),this[n(0x206)]=q=>{const h=n;if(q[h(0x1b1)]){const X=JSON[h(0x1fa)](q['error'][h(0x231)]);throw new Error(h(0x1e2)+q[h(0x1b1)][h(0x219)]+'\x20'+X);}},this[n(0x21f)]=(q,X,J,v,f)=>{const P=n;if(f===!![])return;const {metricTypes:L,endTime:M,startTime:E,duration:z,containerId:p}=v,O=E?P(0x202)+E[P(0x212)]():'',F=M?',\x20to:\x20'+M[P(0x212)]():'',o=z?',\x20duration:\x20'+z+P(0x1ae):'',Q=p?P(0x1dd)+chalk_1[P(0x1f2)][P(0x1d5)](p):'all\x20containers',w=q+'\x20'+chalk_1[P(0x1f2)][P(0x1d5)](X)+P(0x1c7)+chalk_1['default'][P(0x1d5)](J),R=''+O+F+o,W=L?',\x20metric\x20types:\x20'+(L===null||L===void 0x0?void 0x0:L[P(0x223)](',')):'';console[P(0x1ef)]('Metrics\x20for\x20'+Q+P(0x1fd)+w+W+R);},this['apiClient']=new js_client_1[(n(0x1b3))](U,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent'],'agent':K}),this[n(0x1b4)]=this[n(0x1d4)],this['inquirerHelper']=new inquirer_helper_1['InquirerHelper'](this['apiClient']);}[a13C(0x1d8)](U,K=![]){const U0=a13C,q=(L,M)=>__awaiter(this,void 0x0,void 0x0,function*(){const k=a13K,E=M[k(0x207)],{apiContext:z,inquirerHelper:p}=this;switch(U){case k(0x1e7):{const O=E?undefined:z[k(0x1da)]();return M['serviceId']||O||(yield p['askForService'](L)());}case k(0x1b7):{const F=E?undefined:z[k(0x1da)]();return M[k(0x1e5)]||F||(yield p['askForJob'](L)());}case k(0x1de):{const o=E?undefined:z[k(0x1da)]();return M[k(0x1ac)]||o||(yield p['askForAddon'](L)());}}}),X=(L,M,E)=>__awaiter(this,void 0x0,void 0x0,function*(){const u=a13K;if(K)return E[u(0x21e)]||(yield this[u(0x221)][u(0x1ee)](L,U==='service'?M:undefined,U==='job'?M:undefined,!![])());return undefined;}),J=(L,M,E)=>__awaiter(this,void 0x0,void 0x0,function*(){const d=a13K;if(!K&&E[d(0x1bf)]!==undefined){if(E[d(0x1bf)]!==!![])return E[d(0x1bf)];return yield this[d(0x221)]['askForContainer'](L,U==='service'?M:undefined,U===d(0x1b7)?M:undefined,!![])();}return undefined;}),v=(L,M,E)=>__awaiter(this,void 0x0,void 0x0,function*(){const r=a13K;if(U===r(0x1b7))return E['runId']||(yield this[r(0x221)][r(0x1df)](M,L,!![])());return undefined;}),f=(L,M,E)=>__awaiter(this,void 0x0,void 0x0,function*(){const j=a13K;if(U==='service'){if(E[j(0x1e9)]!==!![])return E[j(0x1e9)];return E[j(0x1e9)];}return undefined;});return this[U0(0x22e)](U,K)[U0(0x235)](L=>__awaiter(this,void 0x0,void 0x0,function*(){const U1=U0,{noDefaults:M,projectId:E,duration:z,timestamp:p,output:O,startTime:F,endTime:o,metricTypes:Q,quiet:w}=L;(0x0,utils_1[U1(0x1c3)])(this[U1(0x1d4)]);if(F&&o&&z)throw new Error(U1(0x1e4));const {apiContext:R,inquirerHelper:W,metricsApiClient:V}=this,b=M?undefined:R['getCurrentProjectName'](),B=E||b||(yield W[U1(0x1f7)]()),y=yield q(B,L),x=yield X(B,y,L),a=yield v(B,y,L),m=yield f(B,y,L),i=yield J(B,y,L),G={'projectId':B,'entityId':y},A={'containerName':i,'startTime':F,'endTime':o,'duration':z,'timestamp':p,'metricTypes':Q,'runId':a,'buildId':x,'deploymentId':m,'isBuild':K!==null&&K!==void 0x0?K:![]},s=!(F||o||z);if(!w&&O!=='yaml'&&O!==U1(0x239)&&O!==U1(0x1f6))this[U1(0x21f)](U,y,B,A,w);if(s){if(O!==undefined){const D=yield V[U1(0x1b8)][U1(0x217)](G,A,U);this[U1(0x206)](D),(0x0,console_format_helpers_1['printResponse'])(O,D[U1(0x1cc)]);}else[...Array(process[U1(0x228)][U1(0x205)]-0x1)][U1(0x1c9)]((H,g)=>g===0x0?console[U1(0x1ef)]('Fetching\x20data..'):console[U1(0x1ef)]()),yield this[U1(0x210)](G,A,U)(),setInterval(this['printMetricsTable'](G,A,U),this[U1(0x1ab)]),yield new Promise(H=>setTimeout(H,this[U1(0x1ab)]*0x64));}else{const H=yield V[U1(0x1b8)][U1(0x1f8)](G,A,U);this['handleError'](H),O!==undefined?(0x0,console_format_helpers_1[U1(0x1ba)])(O,H[U1(0x1cc)]):this[U1(0x234)](F,o!==null&&o!==void 0x0?o:new Date())(H[U1(0x1cc)]);}process[U1(0x1b5)]();}));}[a13C(0x233)](U){const U4=a13C,K=(J,f)=>{const U2=a13K;if(!(f===null||f===void 0x0?void 0x0:f[U2(0x226)]))U2(0x236);const L=J[U2(0x1bd)]===U2(0x230)?'%':J[U2(0x1bd)];return''+Number(f===null||f===void 0x0?void 0x0:f[U2(0x226)])[U2(0x1f3)](0x3)+L;},q=J=>{const U3=a13K;if(!(J===null||J===void 0x0?void 0x0:J['ts']))U3(0x236);return J['ts']['toTimeString']()['split']('\x20')[0x0];},X={};Object[U4(0x1eb)](U)['forEach'](J=>{const {values:v,metricInfo:f}=U[J];return v['forEach'](L=>{const U5=a13K;var M,E;const z=L[U5(0x1d2)][U5(0x1bf)];Object[U5(0x1d7)](X,{[z]:Object[U5(0x1d7)](Object['assign']({},X===null||X===void 0x0?void 0x0:X[z]),{['time']:q((M=L[U5(0x1cc)])===null||M===void 0x0?void 0x0:M[0x0]),'containerId':z,[f[U5(0x208)]]:K(f,(E=L[U5(0x1cc)])===null||E===void 0x0?void 0x0:E[0x0])})});});}),(0x0,console_format_helpers_1[U4(0x1a8)])(Object[U4(0x232)](X),'Metrics\x20overview');}[a13C(0x1a9)](U,K,q){const U6=a13C,X=f=>new Date(f['getTime']()-J),J=q*0x3e8;if(!U)return[];if(!K)return[];if(X(K)['getTime']()<U[U6(0x1d0)]())return[];const v=[{'ts':X(K),'value':0x0}];while(X(v[v['length']-0x1]['ts'])[U6(0x1d0)]()<=U['getTime']()){v[U6(0x1e0)]({'ts':X(v[v[U6(0x21c)]-0x1]['ts']),'value':0x0});}return v;}['getPaddingDataEnd'](U,K,q){const U7=a13C,X=f=>new Date(f[U7(0x1d0)]()+J),J=q*0x3e8;if(!U)return[];if(!K)return[];if(X(K)['getTime']()>U['getTime']())return[];const v=[{'ts':X(K),'value':0x0}];while(X(v[v['length']-0x1]['ts'])['getTime']()<=U[U7(0x1d0)]()){v[U7(0x22b)]({'ts':X(v[v['length']-0x1]['ts']),'value':0x0});}return v;}}exports[a13C(0x1c2)]=CliMetrics;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a14F=a14K;(function(U,K){const O=a14K,q=U();while(!![]){try{const X=parseInt(O(0x10e))/0x1*(-parseInt(O(0x118))/0x2)+parseInt(O(0x105))/0x3+parseInt(O(0x11b))/0x4*(-parseInt(O(0x102))/0x5)+parseInt(O(0x115))/0x6*(-parseInt(O(0xf3))/0x7)+parseInt(O(0x114))/0x8*(-parseInt(O(0x10f))/0x9)+parseInt(O(0x110))/0xa+parseInt(O(0x116))/0xb*(parseInt(O(0x117))/0xc);if(X===K)break;else q['push'](q['shift']());}catch(J){q['push'](q['shift']());}}}(a14U,0x91843));function a14U(){const m=['next','onUpKey','handleDynamicPageLoad','__awaiter','apply','push','dir\x20must\x20be\x20up\x20or\x20down','24923sFNJOg','6197049gRXGWU','2382940ePXNFt','DynamicReloadPaginationPrompt','nextPageCursor','then','8YUJJNv','6SXjzBB','7102667ueNqKc','36ElwAvz','30HSalbI','defineProperty','italic','84LDldih','down','..\x20Load\x20more\x20options\x20..','loop','7707035jGeSsh','render','__esModule','pagOpt','length','selected','throw','inquirer/lib/objects/choice','map','loading','reloadText','choices','value','name','onDownKey','41255upCFSJ','default','__importDefault','2271996KWRhAf','opt'];a14U=function(){return m;};return a14U();}function a14K(U,K){const q=a14U();return a14K=function(X,J){X=X-0xf3;let v=q[X];return v;},a14K(U,K);}var __awaiter=this&&this[a14F(0x10a)]||function(U,K,q,X){function J(v){return v instanceof q?v:new q(function(f){f(v);});}return new(q||(q=Promise))(function(v,f){const R=a14K;function L(z){const o=a14K;try{E(X[o(0x107)](z));}catch(p){f(p);}}function M(z){const Q=a14K;try{E(X[Q(0xf9)](z));}catch(p){f(p);}}function E(z){const w=a14K;z['done']?v(z[w(0xff)]):J(z[w(0xff)])[w(0x113)](L,M);}E((X=X[R(0x10b)](U,K||[]))[R(0x107)]());});},__importDefault=this&&this[a14F(0x104)]||function(U){const W=a14F;return U&&U[W(0xf5)]?U:{'default':U};};Object[a14F(0x119)](exports,'__esModule',{'value':!![]}),exports[a14F(0x111)]=void 0x0;const list_1=__importDefault(require('inquirer/lib/prompts/list')),choice_1=__importDefault(require(a14F(0xfa))),chalk_1=__importDefault(require('chalk'));function incrementListIndex(U,K,q){const V=a14F,X=q[V(0xfe)]['realLength'],J=V(0x11e)in q?Boolean(q[V(0x11e)]):!![];if(K==='up'){if(U>0x0)return U-0x1;return J?X-0x1:U;}if(K==='down'){if(U<X-0x1)return U+0x1;return J?0x0:U;}throw new Error(V(0x10d));}class DynamicReloadPaginationPrompt extends list_1[a14F(0x103)]{constructor(U,K,X){const b=a14F;super(U,K,X),this['reloadText']=chalk_1[b(0x103)][b(0x11a)](b(0x11d)),this['loading']=![],this[b(0xf6)]=this[b(0x106)],this[b(0x112)]=this[b(0xf6)]['nextPageCursor'],this[b(0x112)]!==undefined&&this[b(0x106)]['choices'][b(0x10c)](new choice_1[(b(0x103))](this[b(0xfd)],this[b(0xfd)]));}[a14F(0x108)](){const B=a14F;if(this[B(0xfc)])return;this['selected']=incrementListIndex(this[B(0xf8)],'up',this['opt']),this['render']();}[a14F(0x101)](){return __awaiter(this,void 0x0,void 0x0,function*(){const y=a14K;if(this['loading'])return;this[y(0xf8)]=incrementListIndex(this[y(0xf8)],y(0x11c),this[y(0x106)]),yield this[y(0x109)](),this[y(0xf4)]();});}[a14F(0x109)](){return __awaiter(this,void 0x0,void 0x0,function*(){const x=a14K;if(this[x(0xf8)]>=this[x(0x106)][x(0xfe)][x(0xf7)]-0x1){if(this[x(0x112)]===undefined)return;this['loading']=!![];let U=0x0;const K=setInterval(()=>{const a=x,v=['⠋','⠙','⠹','⠸','⠼','⠴','⠦','⠧','⠇','⠏'],f=chalk_1[a(0x103)]['italic'](v[U%v[a(0xf7)]]+'\x20Loading\x20more\x20options');this[a(0x106)][a(0xfe)][a(0xfe)][this[a(0xf8)]][a(0x100)]=''+f,U+=0x1,this[a(0xf4)]();},0x50),{elements:q,nextPageCursor:X}=yield this[x(0xf6)]['loadMore']({'nextPageCursor':this[x(0x112)]})['catch'](()=>({'elements':[],'nextPageCursor':undefined}));this[x(0x112)]=X;const J=q[x(0xfb)](v=>new choice_1[(x(0x103))](v,v));this[x(0x106)][x(0xfe)][x(0xfe)]['splice'](this[x(0xf8)],0x1),this[x(0x106)][x(0xfe)]['push'](...J),X!==undefined&&this['opt'][x(0xfe)]['push'](new choice_1[(x(0x103))](this[x(0xfd)],this[x(0xfd)])),clearInterval(K),this[x(0xfc)]=![];}});}}exports['DynamicReloadPaginationPrompt']=DynamicReloadPaginationPrompt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const a15A=a15E;(function(c,E){const l=a15E,S=c();while(!![]){try{const X=-parseInt(l(0x104))/0x1*(parseInt(l(0xac))/0x2)+parseInt(l(0xd7))/0x3*(-parseInt(l(0x10b))/0x4)+-parseInt(l(0xaa))/0x5*(parseInt(l(0xef))/0x6)+parseInt(l(0xb6))/0x7*(-parseInt(l(0x127))/0x8)+-parseInt(l(0xfd))/0x9*(parseInt(l(0xf5))/0xa)+parseInt(l(0x10d))/0xb+parseInt(l(0x12e))/0xc;if(X===E)break;else S['push'](S['shift']());}catch(u){S['push'](S['shift']());}}}(a15c,0x65403));function a15E(c,E){const S=a15c();return a15E=function(X,u){X=X-0xa3;let Y=S[X];return Y;},a15E(c,E);}function a15c(){const c1=['flat','__setModuleDefault','168867ncldCM','connection-error','Connection\x20error\x20occurred\x20when\x20forwarding\x20\x27','\x20\x20-\x20Address:\x20','Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.','get','--noDefaults','220mPTkOv','__createBinding','askForAddon','skipHostnames','Only\x20expose\x20on\x20IP\x20address,\x20not\x20on\x20hostnames.\x20With\x20this\x20option,\x20no\x20root\x20permissions\x20are\x20required.','skipHostnamesText','getCommand','1201908piSzTW','getOwnPropertyDescriptor','7427750nnefnH','\x20is\x20exposed\x20on\x20','repeat','apiClient','stop','--addon\x20--addonId\x20[NAME]','join','action','success','printForwardingInfo','portFwdCmd','with\x20hostname:\x20','\x20flag\x20or\x20manually\x20append\x20following\x20entry\x20to\x20your\x20hosts\x20file\x20(','exit','__awaiter','map','address','__esModule','configurable','Addons:','http://','Services:','hostnames','getCurrentProjectName','addon','forwardService','612872rSPjVt','\x20in\x20project\x20','Error\x20occured\x20while\x20trying\x20to\x20forward\x20','\x20service\x20ports','service','defineProperty','description','16851192QhVZgt','assertContextExisting','uniq','filter','customUserAgent','portName','Project\x20for\x20forwarding','option','reset','Addon\x20to\x20forward','\x20is\x20exposed\x20with\x20multiple\x20','\x20mode:\x20the\x20locally\x20forwarded\x20port\x20differs\x20from\x20the\x20actual\x20port\x20on\x20the\x20forwarded\x20service/addon.','4415cyXrXo','message','2692CIQgmv','hosts','Running\x20in\x20','--skipHostnames','ApiClient','--service\x20--serviceId\x20[NAME]','forwardAddon','Cleaning\x20up\x20open\x20connections\x20failed:\x20','next','forward','14nRtpEF','data','../utils','Stop\x20forwarding\x20traffic\x20from\x20','all','\x20\x20\x20No\x20running\x20container\x20found\x20for\x20','Running\x20on\x20macOS\x20in\x20','/etc/hosts','Failed:\x20','Port-forwarding\x20for\x20the\x20specified\x20service','addCommand','printHostsFileHint','default','../inquirer-helper','green','\x20\x20-\x20port\x20','apply','Forwarding\x20addon\x20','\x20\x20\x20\x20\x20\x20\x20\x20\x20','flatMap','\x20with\x20multiple\x20ports:','\x20\x20If\x20you\x20have\x20added\x20entries\x20to\x20your\x20hosts\x20file,\x20it\x20is\x20recommended\x20to\x20remove\x20them\x20again\x20now.','error','throw','darwin','create','entries','\x20-\x20','prototype','uniqBy','--project\x20--projectId\x20[NAME]','log','noDefaultsText','3Icqxfv','Forwarding\x20service\x20','No\x20services\x20and\x20addons\x20to\x20forward\x20found\x20in\x20project\x20','getProxyForwarder','\x20and\x20','Port-forwarding\x20for\x20the\x20specified\x20addon','askForProject','\x20to\x20','writable','\x20with\x20these\x20hostnames:','call','__importDefault','\x27:\x20\x22','forEach','Port-forwarding\x20for\x20Northflank\x20services\x20and\x20addons.','forwarding','Please\x20ensure\x20the\x20',',\x20hostname:\x20','SIGINT','port','lodash','type','bold','name','990aMvhtS','value','InquirerHelper','\x20addon\x20ports','__importStar','groupBy','410poUWUf','platform','warning','Forwarding\x20','length','getCurrentServiceName'];a15c=function(){return c1;};return a15c();}var __createBinding=this&&this[a15A(0x105)]||(Object[a15A(0xcf)]?function(c,E,S,X){const I=a15A;if(X===undefined)X=S;var u=Object[I(0x10c)](E,S);(!u||(I(0x102)in u?!E[I(0x11e)]:u[I(0xdf)]||u[I(0x11f)]))&&(u={'enumerable':!![],'get':function(){return E[S];}}),Object[I(0x12c)](c,X,u);}:function(c,E,S,X){if(X===undefined)X=S;c[X]=E[S];}),__setModuleDefault=this&&this[a15A(0xfc)]||(Object[a15A(0xcf)]?function(c,E){const T=a15A;Object[T(0x12c)](c,'default',{'enumerable':!![],'value':E});}:function(c,E){const M=a15A;c[M(0xc2)]=E;}),__importStar=this&&this[a15A(0xf3)]||function(c){const m=a15A;if(c&&c[m(0x11e)])return c;var E={};if(c!=null){for(var S in c)if(S!==m(0xc2)&&Object[m(0xd2)]['hasOwnProperty'][m(0xe1)](c,S))__createBinding(E,c,S);}return __setModuleDefault(E,c),E;},__awaiter=this&&this[a15A(0x11b)]||function(c,E,S,X){function u(Y){return Y instanceof S?Y:new S(function(R){R(Y);});}return new(S||(S=Promise))(function(Y,R){const O=a15E;function d(p){const N=a15E;try{U(X[N(0xb4)](p));}catch(q){R(q);}}function w(p){const z=a15E;try{U(X[z(0xcd)](p));}catch(q){R(q);}}function U(p){const J=a15E;p['done']?Y(p['value']):u(p[J(0xf0)])['then'](d,w);}U((X=X[O(0xc6)](c,E||[]))[O(0xb4)]());});},__importDefault=this&&this[a15A(0xe2)]||function(c){const C=a15A;return c&&c[C(0x11e)]?c:{'default':c};};Object[a15A(0x12c)](exports,'__esModule',{'value':!![]}),exports['CliPortForward']=void 0x0;const js_client_1=require('@northflank/js-client'),chalk_1=__importDefault(require('chalk')),utils_1=require(a15A(0xb8)),inquirer_helper_1=require(a15A(0xc3)),os=__importStar(require('os')),lodash_1=require(a15A(0xeb)),{EOL}=require('os');class CliPortForward{constructor(c,E){const k=a15A;this['noDefaultsText']=k(0x101),this[k(0x109)]=k(0x108),this[k(0x110)]=new js_client_1[(k(0xb0))](c,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[k(0x132)],'agent':E});const S=new inquirer_helper_1[(k(0xf1))](this[k(0x110)]);this[k(0x117)]=(0x0,utils_1['getCommand'])()[k(0xee)](k(0xb5))['alias']('fwd')[k(0x12d)](k(0xe5));const X=(0x0,utils_1[k(0x10a)])(!![])[k(0xee)](k(0xba))[k(0x12d)]('Port-forwarding\x20for\x20all\x20services\x20and\x20addons\x20in\x20the\x20given\x20project')['option'](k(0xd4),'project\x20for\x20forwarding')['option'](k(0x103),this['noDefaultsText'],![])[k(0xa5)](k(0xaf),this['skipHostnamesText'],![])[k(0x114)](({noDefaults:R,projectId:d,skipHostnames:w})=>__awaiter(this,void 0x0,void 0x0,function*(){const o=k;(0x0,utils_1[o(0x12f)])(this[o(0x110)]);const P=this[o(0xda)](w),U=R?undefined:c['getCurrentProjectName'](),p=d||U||(yield S[o(0xdd)]());try{const {services:q,addons:B}=yield P['forwardProject']({'projectId':p},w);if(q[o(0xf9)]+B[o(0xf9)]<=0x0)(0x0,utils_1[o(0xf7)])(o(0xd9)+chalk_1[o(0xc2)][o(0xed)](p));else{const V=q[o(0x131)](H=>H[o(0xf9)]>0x0)['length'],g=B[o(0x131)](H=>H[o(0xf9)]>0x0)['length'],r=o(0x128)+chalk_1[o(0xc2)][o(0xed)](p);console[o(0xd5)](o(0xf8)+chalk_1[o(0xc2)][o(0xc4)]['bold'](V+o(0x12a))+o(0xdb)+chalk_1[o(0xc2)][o(0xc4)][o(0xed)](g+o(0xf2))+r),console[o(0xd5)](),console[o(0xd5)](chalk_1[o(0xc2)]['bold'](o(0x122))),q[o(0xe4)](H=>{const y=o;if(H[y(0xf9)]>=0x1&&!H[0x0][y(0xcc)])this[y(0x116)](H,{'type':'service','name':H[0x0][y(0xb7)]['id']},w);}),console['log'](chalk_1[o(0xc2)][o(0xed)](o(0x120))),B[o(0xe4)](H=>{const e=o;if(H[e(0xf9)]>=0x1&&!H[0x0][e(0xcc)])this[e(0x116)](H,{'type':'addon','name':H[0x0][e(0xb7)]['id']},w);}),this[o(0xc1)]([...q[o(0xfb)](),...B[o(0xfb)]()],w);}}catch(H){(0x0,utils_1[o(0xcc)])('Failed:\x20'+H[o(0xab)]);}})),u=(0x0,utils_1[k(0x10a)])(!![])[k(0xee)](k(0x12b))['description'](k(0xbf))[k(0xa5)]('--project\x20--projectId\x20[NAME]',k(0xa4))[k(0xa5)](k(0xb1),'Service\x20to\x20forward')[k(0xa5)](k(0x103),this[k(0xd6)],![])[k(0xa5)](k(0xaf),this[k(0x109)],![])[k(0x114)](({noDefaults:R,projectId:d,serviceId:w,skipHostnames:P})=>__awaiter(this,void 0x0,void 0x0,function*(){const D=k;(0x0,utils_1[D(0x12f)])(this[D(0x110)]);const U=this['getProxyForwarder'](P),p=R?undefined:c[D(0x124)](),q=d||p||(yield S['askForProject']()),B=R?undefined:c[D(0xfa)](),V=w||B||(yield S['askForService'](q)());console[D(0xd5)](D(0xd8)+chalk_1['default'][D(0xed)](V)+D(0x128)+chalk_1['default']['bold'](q));try{const g=yield U[D(0x126)]({'projectId':q,'serviceId':V},P);this[D(0x116)](g,{'name':V,'type':D(0x12b)},P),this[D(0xc1)](g,P);}catch(r){(0x0,utils_1['error'])(D(0xbe)+r[D(0xab)]);}})),Y=(0x0,utils_1[k(0x10a)])(!![])['name'](k(0x125))[k(0x12d)](k(0xdc))[k(0xa5)](k(0xd4),k(0xa4))[k(0xa5)](k(0x112),k(0xa7))[k(0xa5)](k(0xaf),this[k(0x109)],![])['action'](({noDefaults:R,projectId:d,addonId:w,skipHostnames:P})=>__awaiter(this,void 0x0,void 0x0,function*(){const x=k;(0x0,utils_1[x(0x12f)])(this[x(0x110)]);const U=this[x(0xda)](P),p=R?undefined:c[x(0x124)](),q=d||p||(yield S[x(0xdd)]()),B=w||(yield S[x(0x106)](q)());console[x(0xd5)](x(0xc7)+chalk_1[x(0xc2)][x(0xed)](B)+'\x20in\x20project\x20'+chalk_1[x(0xc2)][x(0xed)](q));try{const V={'projectId':q,'addonId':B},g=yield U[x(0xb2)](V,P);this[x(0x116)](g,{'name':B,'type':'addon'},P),this['printHostsFileHint'](g,P);}catch(r){(0x0,utils_1[x(0xcc)])('Failed:\x20'+r['message']);}}));this[k(0x117)][k(0xc0)](X),this[k(0x117)][k(0xc0)](u),this[k(0x117)][k(0xc0)](Y);}[a15A(0xda)](c=![]){const h=a15A,E=this[h(0x110)][h(0xe6)];if(!c){const S=E['canExecuteWithHostnames']();if(S['error'])throw new Error(S[h(0xab)]);}return E['on']('tunnel-close',(X,u)=>{const n=h,Y=chalk_1[n(0xc2)][n(0xed)](u[n(0xec)]+'\x20\x27'+u['id']+'\x27'),R=u[n(0x123)][n(0xf9)]>0x0;(0x0,utils_1[n(0xf7)])(n(0xb9)+u[n(0x11d)]+':'+u[n(0xea)]+n(0xde)+Y),c&&R&&(0x0,utils_1[n(0xf7)])(n(0xcb));}),E['on'](h(0xfe),(X,u,Y)=>{const s=h;(0x0,utils_1[s(0xf7)])(s(0xff)+u[s(0x11d)]+':'+u[s(0xea)]+s(0xe3)+(Y===null||Y===void 0x0?void 0x0:Y[s(0xab)])+'\x22');}),process['on'](h(0xe9),()=>__awaiter(this,void 0x0,void 0x0,function*(){const j=h;try{yield E[j(0x111)]();}catch(X){(0x0,utils_1['error'])(j(0xb3)+X[j(0xab)]);}finally{process[j(0x11a)]();}})),E;}[a15A(0x116)](c,E,S=![]){const a=a15A,{type:X,name:u}=E;if(c[a(0xf9)]<=0x0){const w=a(0xe7)+E[a(0xec)]+'\x20is\x20running\x20and\x20reachable.';(0x0,utils_1[a(0xf7)])(a(0xbb)+X+'\x20'+chalk_1['default']['bold'](u)+'.\x20'+w);return;}const Y=(0x0,lodash_1[a(0xf4)])(c,'data.id'),R=P=>'\x20('+(P[a(0xa3)]?P[a(0xa3)]+a(0xd1):'')+P['protocol']+')';function d(P,U=0x2){const Q=a;if(!S){const p=P['protocol']==='HTTP'?Q(0x121):'';P[Q(0x123)]['forEach'](q=>{const L=Q;console[L(0xd5)]((0x0,lodash_1[L(0x10f)])('\x20',U)+'-\x20'+p+q+':'+P['port']);});}}Object[a(0xd0)](Y)[a(0xe4)](([P,U])=>{const W=a;var p,q;const B='>\x20'+(0x0,lodash_1['capitalize'])(X)+'\x20\x27'+chalk_1[W(0xc2)]['greenBright'][W(0xed)](P)+'\x27';if(X==='addon'){if(U[W(0xf9)]===0x1){const V=U[0x0];if(V[W(0xcc)]){(0x0,utils_1[W(0xcc)])(W(0x129)+P+':\x20'+V['error'][W(0xab)]);return;}const g=V[W(0xb7)],r=!S?'\x20'+chalk_1['default'][W(0xa6)](W(0x118)+g[W(0x123)][W(0x113)](',')):'';(0x0,utils_1['success'])(B+W(0x10e)+g[W(0x11d)]+':'+g[W(0xea)]+R(g)+r);}else{const H=(0x0,lodash_1[W(0xd3)])(U,f=>{const F=W;var Z,K;return(K=(Z=f===null||f===void 0x0?void 0x0:f['data'])===null||Z===void 0x0?void 0x0:Z[F(0x123)])===null||K===void 0x0?void 0x0:K[F(0x113)](',');})['length']>0x1;(0x0,utils_1[W(0x115)])(B+W(0xa8)+(H?W(0xad):'ports')+':'),U['forEach'](f=>{const i=W;if(f[i(0xcc)]){(0x0,utils_1[i(0xcc)])('Error\x20occured\x20while\x20trying\x20to\x20forward\x20'+P+':\x20'+f[i(0xcc)]['message']);return;}const Z=f['data'],K=!S?i(0xe8)+Z[i(0x123)][i(0x113)](','):'';console[i(0xd5)](i(0x100)+Z[i(0x11d)]+':'+Z[i(0xea)]+R(Z)+K);});}}if(X===W(0x12b)){if(U[W(0xf9)]===0x1){const f=U[0x0];if(f['error']){(0x0,utils_1[W(0xcc)])('Error\x20occured\x20while\x20trying\x20to\x20forward\x20'+P+':\x20'+f[W(0xcc)]['message']);return;}const Z=f[W(0xb7)],K=!S?W(0xe0):':',t=Z[W(0x11d)]+':'+Z['port']+R(Z);(0x0,utils_1['success'])(B+W(0x10e)+t+K),d(Z);}else(0x0,utils_1[W(0x115)])(B+W(0x10e)+((q=(p=U[0x0])===null||p===void 0x0?void 0x0:p['data'])===null||q===void 0x0?void 0x0:q[W(0x11d)])+W(0xca)),U[W(0xe4)](G=>{const v=W;if(G['error']){(0x0,utils_1[v(0xcc)])(v(0x129)+P+':\x20'+G['error'][v(0xab)]);return;}const b=G['data'];(0x0,utils_1[v(0x115)])(v(0xc5)+b[v(0xea)]+R(b)),d(b,0x4);});}});}[a15A(0xc1)](c,E=![]){const c0=a15A;if(E){const S=c[c0(0xc9)](U=>U['data'])[c0(0x131)](U=>U!==undefined),X=(process===null||process===void 0x0?void 0x0:process[c0(0xf6)])==='win32',u=os[c0(0xf6)]()===c0(0xce),Y=X?'C:/Windows/System32/drivers/etc/hosts':c0(0xbd),R=chalk_1['default'][c0(0xed)](c0(0x107)),d=u?EOL+c0(0xbc)+R+c0(0xa9):undefined;let w=c0(0xae)+R+'\x20mode.\x20If\x20hostname\x20forwarding\x20is\x20required,\x20remove\x20'+'--skipHostnames'+c0(0x119)+Y+'):';d!==undefined&&(0x0,utils_1[c0(0xf7)])(d!==null&&d!==void 0x0?d:'');(0x0,utils_1['warning'])(w);const P=S[c0(0x11c)](U=>U[c0(0x11d)]+c0(0xc8)+U[c0(0x123)]['join']('\x20'));console[c0(0xd5)]((0x0,lodash_1[c0(0x130)])(P)[c0(0x113)](EOL)),console[c0(0xd5)]();}}}exports['CliPortForward']=CliPortForward;
|
|
1
|
+
'use strict';const a15m=a15K;function a15K(U,K){const q=a15U();return a15K=function(X,J){X=X-0x69;let v=q[X];return v;},a15K(U,K);}(function(U,K){const a=a15K,q=U();while(!![]){try{const X=parseInt(a(0x96))/0x1+-parseInt(a(0xe3))/0x2+-parseInt(a(0xf5))/0x3*(-parseInt(a(0xbf))/0x4)+parseInt(a(0xef))/0x5*(-parseInt(a(0xd8))/0x6)+parseInt(a(0x72))/0x7*(-parseInt(a(0xc3))/0x8)+parseInt(a(0xd5))/0x9*(parseInt(a(0xad))/0xa)+parseInt(a(0xb4))/0xb;if(X===K)break;else q['push'](q['shift']());}catch(J){q['push'](q['shift']());}}}(a15U,0x955c4));var __createBinding=this&&this[a15m(0xab)]||(Object[a15m(0x8a)]?function(U,K,q,X){const i=a15m;if(X===undefined)X=q;var J=Object[i(0xcd)](K,q);(!J||(i(0xc4)in J?!K[i(0x6a)]:J['writable']||J['configurable']))&&(J={'enumerable':!![],'get':function(){return K[q];}}),Object[i(0xda)](U,X,J);}:function(U,K,q,X){if(X===undefined)X=q;U[X]=K[q];}),__setModuleDefault=this&&this[a15m(0x86)]||(Object[a15m(0x8a)]?function(U,K){Object['defineProperty'](U,'default',{'enumerable':!![],'value':K});}:function(U,K){U['default']=K;}),__importStar=this&&this[a15m(0xd2)]||function(U){const G=a15m;if(U&&U[G(0x6a)])return U;var K={};if(U!=null){for(var q in U)if(q!=='default'&&Object['prototype'][G(0x99)][G(0xc6)](U,q))__createBinding(K,U,q);}return __setModuleDefault(K,U),K;},__awaiter=this&&this[a15m(0xcb)]||function(U,K,q,X){function J(v){return v instanceof q?v:new q(function(f){f(v);});}return new(q||(q=Promise))(function(v,f){const s=a15K;function L(z){try{E(X['next'](z));}catch(p){f(p);}}function M(z){try{E(X['throw'](z));}catch(p){f(p);}}function E(z){const A=a15K;z[A(0x76)]?v(z[A(0x95)]):J(z[A(0x95)])['then'](L,M);}E((X=X[s(0xdc)](U,K||[]))[s(0x9c)]());});},__importDefault=this&&this[a15m(0xb1)]||function(U){const D=a15m;return U&&U[D(0x6a)]?U:{'default':U};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[a15m(0x75)]=void 0x0;function a15U(){const d=['\x20is\x20exposed\x20with\x20multiple\x20','\x20and\x20','ports','__importDefault','\x20with\x20these\x20hostnames:','all','12555158jFRiUm','forwardService','printHostsFileHint','forward','length','\x20\x20-\x20port\x20','forwarding','hostnames','darwin','capitalize','/etc/hosts','104fYgYJk','HTTP','\x20is\x20exposed\x20on\x20','map','8540096aeVRds','get','Addon\x20to\x20forward','call','chalk','service','Forwarding\x20','portFwdCmd','__awaiter','flat','getOwnPropertyDescriptor','Connection\x20error\x20occurred\x20when\x20forwarding\x20\x27','Only\x20expose\x20on\x20IP\x20address,\x20not\x20on\x20hostnames.\x20With\x20this\x20option,\x20no\x20root\x20permissions\x20are\x20required.','Port-forwarding\x20for\x20the\x20specified\x20addon','description','__importStar','\x20\x20\x20\x20\x20\x20\x20\x20\x20','--skipHostnames','9dlLwNL','flatMap','\x20mode.\x20If\x20hostname\x20forwarding\x20is\x20required,\x20remove\x20','18OAREKu','http://','defineProperty','\x20\x20\x20No\x20running\x20container\x20found\x20for\x20','apply','Project\x20for\x20forwarding','repeat','getCommand','InquirerHelper','\x20\x20-\x20Address:\x20','getCurrentServiceName','2238776vhxiDw','hosts','Cleaning\x20up\x20open\x20connections\x20failed:\x20','printForwardingInfo','\x20\x20If\x20you\x20have\x20added\x20entries\x20to\x20your\x20hosts\x20file,\x20it\x20is\x20recommended\x20to\x20remove\x20them\x20again\x20now.','getProxyForwarder','Addons:','addCommand','tunnel-close','exit','C:/Windows/System32/drivers/etc/hosts','port','933815cfPVbh','\x20service\x20ports','skipHostnames','apiClient','--service\x20--serviceId\x20[NAME]','message','79344oAHGrh','option','__esModule','Failed:\x20','success','log','\x20flag\x20or\x20manually\x20append\x20following\x20entry\x20to\x20your\x20hosts\x20file\x20(','\x20addon\x20ports','warning','--addon\x20--addonId\x20[NAME]','7FbGbyO','name','askForProject','CliPortForward','done','\x20mode:\x20the\x20locally\x20forwarded\x20port\x20differs\x20from\x20the\x20actual\x20port\x20on\x20the\x20forwarded\x20service/addon.','Forwarding\x20addon\x20','stop','type','ApiClient','address','No\x20services\x20and\x20addons\x20to\x20forward\x20found\x20in\x20project\x20','skipHostnamesText','--project\x20--projectId\x20[NAME]','protocol','lodash','Please\x20ensure\x20the\x20','alias','Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.','portName','__setModuleDefault','Error\x20occured\x20while\x20trying\x20to\x20forward\x20','askForService','bold','create','noDefaultsText','greenBright','forEach','win32','uniq','filter','green','getCurrentProjectName','addon','assertContextExisting','value','1167101oIxskV','default','customUserAgent','hasOwnProperty','entries','connection-error','next','data.id','fwd','../inquirer-helper','platform','data','error','Stop\x20forwarding\x20traffic\x20from\x20','Port-forwarding\x20for\x20Northflank\x20services\x20and\x20addons.','\x20is\x20running\x20and\x20reachable.','../utils','\x20in\x20project\x20','\x27:\x20\x22','Port-forwarding\x20for\x20all\x20services\x20and\x20addons\x20in\x20the\x20given\x20project','join','__createBinding','forwardProject','3628420viwwRm'];a15U=function(){return d;};return a15U();}const js_client_1=require('@northflank/js-client'),chalk_1=__importDefault(require(a15m(0xc7))),utils_1=require(a15m(0xa6)),inquirer_helper_1=require(a15m(0x9f)),os=__importStar(require('os')),lodash_1=require(a15m(0x81)),{EOL}=require('os');class CliPortForward{constructor(U,K){const H=a15m;this[H(0x8b)]=H(0x84),this['skipHostnamesText']=H(0xcf),this[H(0xf2)]=new js_client_1[(H(0x7b))](U,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[H(0x98)],'agent':K});const q=new inquirer_helper_1[(H(0xe0))](this[H(0xf2)]);this['portFwdCmd']=(0x0,utils_1[H(0xdf)])()['name'](H(0xb7))[H(0x83)](H(0x9e))['description'](H(0xa4));const X=(0x0,utils_1[H(0xdf)])(!![])[H(0x73)](H(0xb3))[H(0xd1)](H(0xa9))[H(0x69)](H(0x7f),'project\x20for\x20forwarding')[H(0x69)]('--noDefaults',this[H(0x8b)],![])[H(0x69)](H(0xd4),this['skipHostnamesText'],![])['action'](({noDefaults:f,projectId:L,skipHostnames:M})=>__awaiter(this,void 0x0,void 0x0,function*(){const g=H;(0x0,utils_1[g(0x94)])(this[g(0xf2)]);const E=this['getProxyForwarder'](M),z=f?undefined:U['getCurrentProjectName'](),p=L||z||(yield q['askForProject']());try{const {services:O,addons:F}=yield E[g(0xac)]({'projectId':p},M);if(O[g(0xb8)]+F[g(0xb8)]<=0x0)(0x0,utils_1['warning'])(g(0x7d)+chalk_1[g(0x97)]['bold'](p));else{const o=O[g(0x90)](R=>R[g(0xb8)]>0x0)['length'],Q=F['filter'](R=>R['length']>0x0)['length'],w=g(0xa7)+chalk_1[g(0x97)][g(0x89)](p);console['log'](g(0xc9)+chalk_1[g(0x97)][g(0x91)]['bold'](o+g(0xf0))+g(0xaf)+chalk_1['default'][g(0x91)][g(0x89)](Q+g(0x6f))+w),console['log'](),console[g(0x6d)](chalk_1[g(0x97)][g(0x89)]('Services:')),O[g(0x8d)](R=>{const S=g;if(R[S(0xb8)]>=0x1&&!R[0x0]['error'])this['printForwardingInfo'](R,{'type':S(0xc8),'name':R[0x0]['data']['id']},M);}),console[g(0x6d)](chalk_1[g(0x97)][g(0x89)](g(0xe9))),F[g(0x8d)](R=>{const C=g;if(R[C(0xb8)]>=0x1&&!R[0x0][C(0xa2)])this[C(0xe6)](R,{'type':C(0x93),'name':R[0x0][C(0xa1)]['id']},M);}),this[g(0xb6)]([...O['flat'](),...F[g(0xcc)]()],M);}}catch(R){(0x0,utils_1[g(0xa2)])(g(0x6b)+R[g(0xf4)]);}})),J=(0x0,utils_1[H(0xdf)])(!![])[H(0x73)]('service')[H(0xd1)]('Port-forwarding\x20for\x20the\x20specified\x20service')[H(0x69)](H(0x7f),H(0xdd))[H(0x69)](H(0xf3),'Service\x20to\x20forward')['option']('--noDefaults',this['noDefaultsText'],![])[H(0x69)]('--skipHostnames',this[H(0x7e)],![])['action'](({noDefaults:f,projectId:L,serviceId:M,skipHostnames:E})=>__awaiter(this,void 0x0,void 0x0,function*(){const N=H;(0x0,utils_1['assertContextExisting'])(this['apiClient']);const z=this['getProxyForwarder'](E),p=f?undefined:U[N(0x92)](),O=L||p||(yield q[N(0x74)]()),F=f?undefined:U[N(0xe2)](),o=M||F||(yield q[N(0x88)](O)());console[N(0x6d)]('Forwarding\x20service\x20'+chalk_1['default'][N(0x89)](o)+N(0xa7)+chalk_1[N(0x97)][N(0x89)](O));try{const Q=yield z[N(0xb5)]({'projectId':O,'serviceId':o},E);this[N(0xe6)](Q,{'name':o,'type':N(0xc8)},E),this[N(0xb6)](Q,E);}catch(w){(0x0,utils_1[N(0xa2)])(N(0x6b)+w[N(0xf4)]);}})),v=(0x0,utils_1[H(0xdf)])(!![])[H(0x73)](H(0x93))[H(0xd1)](H(0xd0))[H(0x69)]('--project\x20--projectId\x20[NAME]',H(0xdd))[H(0x69)](H(0x71),H(0xc5))[H(0x69)]('--skipHostnames',this[H(0x7e)],![])['action'](({noDefaults:f,projectId:L,addonId:M,skipHostnames:E})=>__awaiter(this,void 0x0,void 0x0,function*(){const Z=H;(0x0,utils_1[Z(0x94)])(this[Z(0xf2)]);const z=this[Z(0xe8)](E),p=f?undefined:U[Z(0x92)](),O=L||p||(yield q['askForProject']()),F=M||(yield q['askForAddon'](O)());console['log'](Z(0x78)+chalk_1[Z(0x97)]['bold'](F)+Z(0xa7)+chalk_1['default'][Z(0x89)](O));try{const o={'projectId':O,'addonId':F},Q=yield z['forwardAddon'](o,E);this[Z(0xe6)](Q,{'name':F,'type':Z(0x93)},E),this[Z(0xb6)](Q,E);}catch(w){(0x0,utils_1[Z(0xa2)])(Z(0x6b)+w[Z(0xf4)]);}}));this['portFwdCmd'][H(0xea)](X),this[H(0xca)]['addCommand'](J),this[H(0xca)][H(0xea)](v);}[a15m(0xe8)](U=![]){const e=a15m,K=this[e(0xf2)][e(0xba)];if(!U){const q=K['canExecuteWithHostnames']();if(q[e(0xa2)])throw new Error(q[e(0xf4)]);}return K['on'](e(0xeb),(X,J)=>{const n=e,v=chalk_1['default'][n(0x89)](J[n(0x7a)]+'\x20\x27'+J['id']+'\x27'),f=J[n(0xbb)][n(0xb8)]>0x0;(0x0,utils_1[n(0x70)])(n(0xa3)+J[n(0x7c)]+':'+J[n(0xee)]+'\x20to\x20'+v),U&&f&&(0x0,utils_1['warning'])(n(0xe7));}),K['on'](e(0x9b),(X,J,v)=>{const t=e;(0x0,utils_1[t(0x70)])(t(0xce)+J[t(0x7c)]+':'+J['port']+t(0xa8)+(v===null||v===void 0x0?void 0x0:v[t(0xf4)])+'\x22');}),process['on']('SIGINT',()=>__awaiter(this,void 0x0,void 0x0,function*(){const Y=e;try{yield K[Y(0x79)]();}catch(X){(0x0,utils_1[Y(0xa2)])(Y(0xe5)+X[Y(0xf4)]);}finally{process[Y(0xec)]();}})),K;}[a15m(0xe6)](U,K,q=![]){const l=a15m,{type:X,name:J}=K;if(U[l(0xb8)]<=0x0){const M=l(0x82)+K[l(0x7a)]+l(0xa5);(0x0,utils_1[l(0x70)])(l(0xdb)+X+'\x20'+chalk_1['default']['bold'](J)+'.\x20'+M);return;}const v=(0x0,lodash_1['groupBy'])(U,l(0x9d)),f=E=>'\x20('+(E['portName']?E[l(0x85)]+'\x20-\x20':'')+E[l(0x80)]+')';function L(E,z=0x2){const T=l;if(!q){const p=E[T(0x80)]===T(0xc0)?T(0xd9):'';E[T(0xbb)][T(0x8d)](O=>{const I=T;console[I(0x6d)]((0x0,lodash_1[I(0xde)])('\x20',z)+'-\x20'+p+O+':'+E[I(0xee)]);});}}Object[l(0x9a)](v)['forEach'](([E,z])=>{const c=l;var p,O;const F='>\x20'+(0x0,lodash_1[c(0xbd)])(X)+'\x20\x27'+chalk_1[c(0x97)][c(0x8c)][c(0x89)](E)+'\x27';if(X==='addon'){if(z[c(0xb8)]===0x1){const o=z[0x0];if(o[c(0xa2)]){(0x0,utils_1[c(0xa2)])(c(0x87)+E+':\x20'+o[c(0xa2)][c(0xf4)]);return;}const Q=o[c(0xa1)],w=!q?'\x20'+chalk_1[c(0x97)]['reset']('with\x20hostname:\x20'+Q[c(0xbb)][c(0xaa)](',')):'';(0x0,utils_1[c(0x6c)])(F+c(0xc1)+Q[c(0x7c)]+':'+Q['port']+f(Q)+w);}else{const R=(0x0,lodash_1['uniqBy'])(z,W=>{const h=c;var V,b;return(b=(V=W===null||W===void 0x0?void 0x0:W[h(0xa1)])===null||V===void 0x0?void 0x0:V[h(0xbb)])===null||b===void 0x0?void 0x0:b[h(0xaa)](',');})[c(0xb8)]>0x1;(0x0,utils_1['success'])(F+c(0xae)+(R?c(0xe4):c(0xb0))+':'),z[c(0x8d)](W=>{const P=c;if(W[P(0xa2)]){(0x0,utils_1[P(0xa2)])('Error\x20occured\x20while\x20trying\x20to\x20forward\x20'+E+':\x20'+W[P(0xa2)][P(0xf4)]);return;}const V=W[P(0xa1)],b=!q?',\x20hostname:\x20'+V['hostnames'][P(0xaa)](','):'';console[P(0x6d)](P(0xe1)+V['address']+':'+V[P(0xee)]+f(V)+b);});}}if(X===c(0xc8)){if(z[c(0xb8)]===0x1){const W=z[0x0];if(W[c(0xa2)]){(0x0,utils_1[c(0xa2)])(c(0x87)+E+':\x20'+W[c(0xa2)][c(0xf4)]);return;}const V=W[c(0xa1)],b=!q?c(0xb2):':',B=V[c(0x7c)]+':'+V['port']+f(V);(0x0,utils_1[c(0x6c)])(F+c(0xc1)+B+b),L(V);}else(0x0,utils_1['success'])(F+c(0xc1)+((O=(p=z[0x0])===null||p===void 0x0?void 0x0:p[c(0xa1)])===null||O===void 0x0?void 0x0:O[c(0x7c)])+'\x20with\x20multiple\x20ports:'),z[c(0x8d)](y=>{const k=c;if(y[k(0xa2)]){(0x0,utils_1[k(0xa2)])(k(0x87)+E+':\x20'+y['error']['message']);return;}const x=y[k(0xa1)];(0x0,utils_1[k(0x6c)])(k(0xb9)+x[k(0xee)]+f(x)),L(x,0x4);});}});}['printHostsFileHint'](U,K=![]){const u=a15m;if(K){const q=U[u(0xd6)](z=>z[u(0xa1)])[u(0x90)](z=>z!==undefined),X=(process===null||process===void 0x0?void 0x0:process[u(0xa0)])===u(0x8e),J=os[u(0xa0)]()===u(0xbc),v=X?u(0xed):u(0xbe),f=chalk_1[u(0x97)]['bold'](u(0xf1)),L=J?EOL+'Running\x20on\x20macOS\x20in\x20'+f+u(0x77):undefined;let M='Running\x20in\x20'+f+u(0xd7)+u(0xd4)+u(0x6e)+v+'):';L!==undefined&&(0x0,utils_1['warning'])(L!==null&&L!==void 0x0?L:'');(0x0,utils_1[u(0x70)])(M);const E=q[u(0xc2)](z=>z[u(0x7c)]+u(0xd3)+z[u(0xbb)][u(0xaa)]('\x20'));console[u(0x6d)]((0x0,lodash_1[u(0x8f)])(E)[u(0xaa)](EOL)),console['log']();}}}exports[a15m(0x75)]=CliPortForward;
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a16F=a16K;(function(U,K){const O=a16K,q=U();while(!![]){try{const X=parseInt(O(0x148))/0x1*(-parseInt(O(0x13c))/0x2)+-parseInt(O(0x11d))/0x3*(parseInt(O(0x143))/0x4)+-parseInt(O(0x157))/0x5*(-parseInt(O(0x163))/0x6)+parseInt(O(0x160))/0x7+parseInt(O(0x15e))/0x8+parseInt(O(0x165))/0x9*(parseInt(O(0x150))/0xa)+-parseInt(O(0x12d))/0xb;if(X===K)break;else q['push'](q['shift']());}catch(J){q['push'](q['shift']());}}}(a16U,0x2e59a));var __awaiter=this&&this[a16F(0x13f)]||function(U,K,q,X){function J(v){return v instanceof q?v:new q(function(f){f(v);});}return new(q||(q=Promise))(function(v,f){const w=a16K;function L(z){const o=a16K;try{E(X[o(0x169)](z));}catch(p){f(p);}}function M(z){try{E(X['throw'](z));}catch(p){f(p);}}function E(z){const Q=a16K;z[Q(0x141)]?v(z[Q(0x16e)]):J(z['value'])[Q(0x166)](L,M);}E((X=X[w(0x122)](U,K||[]))[w(0x169)]());});},__importDefault=this&&this[a16F(0x13b)]||function(U){const R=a16F;return U&&U[R(0x16c)]?U:{'default':U};};Object[a16F(0x120)](exports,a16F(0x16c),{'value':!![]}),exports[a16F(0x152)]=exports[a16F(0x15a)]=exports['assertContextExisting']=exports[a16F(0x12b)]=exports[a16F(0x12e)]=exports['retry']=exports[a16F(0x140)]=exports[a16F(0x15d)]=exports[a16F(0x12f)]=exports[a16F(0x131)]=exports[a16F(0x159)]=exports[a16F(0x129)]=exports[a16F(0x14f)]=exports[a16F(0x158)]=void 0x0;const chalk_1=__importDefault(require(a16F(0x135))),commander_1=require(a16F(0x151)),proxy_agent_1=require(a16F(0x15f)),node_fetch_1=__importDefault(require(a16F(0x13e)));exports[a16F(0x158)]=new proxy_agent_1['ProxyAgent']();const pgk=require(a16F(0x132));exports[a16F(0x14f)]=a16F(0x14d)+(pgk===null||pgk===void 0x0?void 0x0:pgk['version']),exports[a16F(0x129)]=process['env'][a16F(0x162)]!==undefined||process['env'][a16F(0x12c)]!==undefined;function checkUpdate(U){return __awaiter(this,void 0x0,void 0x0,function*(){const W=a16K;function K(q,X){const J=new Date(Number(q));return J['setDate'](J['getDate']()+X),J;}try{if(K(U[W(0x124)](),0x1)>new Date())return;const q=pgk['version'],{name:X}=pgk;if(!q)return;const J=W(0x127)+X+'/latest',v=yield(0x0,node_fetch_1[W(0x154)])(J,{'agent':exports[W(0x158)],'method':'GET','signal':AbortSignal[W(0x149)](0x1388)}),f=(yield v['json']())[W(0x136)];needsUpdate(q,f)&&warning('**\x20You\x27re\x20running\x20on\x20version\x20'+q+W(0x164)+f+'.'+(W(0x11e)+X+W(0x138)+X+W(0x144))),yield U[W(0x14e)](new Date());}catch(L){}});}exports[a16F(0x159)]=checkUpdate;function needsUpdate(U,K){const V=a16F,q=/(\.0+)+$/,X=U[V(0x142)](q,'')[V(0x15b)]('.'),J=K[V(0x142)](q,'')[V(0x15b)]('.');for(let v=0x0;v<Math[V(0x145)](X[V(0x139)],J[V(0x139)]);v+=0x1){const f=parseInt(J[v],0xa)-parseInt(X[v],0xa);if(f>0x0)return!![];if(f<0x0)return![];}return J['length']>X[V(0x139)];}function error(U){const b=a16F;console[b(0x131)](chalk_1[b(0x154)][b(0x121)](b(0x130)+U));}exports['error']=error;function warning(U){const B=a16F;console[B(0x131)](chalk_1['default'][B(0x13d)](''+U));}function a16K(U,K){const q=a16U();return a16K=function(X,J){X=X-0x11d;let v=q[X];return v;},a16K(U,K);}exports[a16F(0x12f)]=warning;function success(U){const y=a16F;console[y(0x14c)](chalk_1[y(0x154)]['green'](''+U));}function a16U(){const A=['HTTP_PROXY','330OBejOw',',\x20the\x20latest\x20version\x20of\x20the\x20cli\x20is\x20','9VlQhDS','then','--skipValidation','Invalid\x20date\x20received:\x20','next','Command','addHelpCommand','__esModule','getCurrentBaseUrl','value','46236QzUHPK','\x20Consider\x20updating\x20using\x20\x27npm\x20i\x20','storeOptionsAsProperties','defineProperty','redBright','apply','No\x20token\x20in\x20CLI\x20context.\x20Add\x20token\x20with\x20\x27northflank\x20set-token\x27','getLastUpdateCheck','getCurrentContext','assertContextExisting','https://registry.npmjs.org/','push','proxyEnvsSet','retry','isValidJSON','HTTPS_PROXY','4866510ayybVm','asyncSequential','warning','Failed:\x20','error','../package.json','Verbose\x20output','option','chalk','version','resolve','\x20-g\x27\x20or\x20\x27yarn\x20global\x20add\x20','length','example:\x202020-02-02T02:02:02Z\x20(date\x20string)\x20or\x201580608922\x20(unix\x20ts)','__importDefault','1526cnNtgJ','yellow','node-fetch','__awaiter','getCommand','done','replace','28mxNVjP','\x27\x20**','min','setUTCSeconds','reduce','125RONWzk','timeout','--verbose','Do\x20not\x20validate\x20input\x20fields\x20on\x20client\x20side','log','northflank-cli/','setLastUpdateCheck','customUserAgent','1168970AkRZBz','commander','tsHint','No\x20API\x20URL\x20present\x20in\x20context.\x20Create\x20new\x20context\x20with\x20\x27northflank\x20login\x27','default','--quiet','contextProvider','23505tPlmBU','agent','checkUpdate','parseDateInput','split','enablePositionalOptions','success','1200648iCQkSq','proxy-agent','2169902sWWFtZ','getTime'];a16U=function(){return A;};return a16U();}exports[a16F(0x15d)]=success;function getCommand(U=![]){const x=a16F,K=new commander_1[(x(0x16a))]();return K['helpOption'](undefined,'Display\x20help\x20for\x20command'),K[x(0x16b)](![]),K[x(0x11f)](![]),K['allowUnknownOption'](![]),K['allowExcessArguments'](![]),K[x(0x15c)](!![]),U&&(K[x(0x134)](x(0x14a),x(0x133),![]),K['option'](x(0x155),'No\x20console\x20output',![]),K[x(0x134)](x(0x167),x(0x14b),![])),K;}exports[a16F(0x140)]=getCommand;const retry=(U,K=0x32)=>q=>{let X=U;const J=()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){try{return yield q();}catch(v){if(X<=0x0)throw v;return X-=0x1,yield new Promise(f=>setTimeout(()=>f(),K)),J();}});return J();};exports[a16F(0x12a)]=retry;const asyncSequential=(U,K)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const a=a16F,q=Promise[a(0x137)]([]);return U[a(0x147)]((X,J)=>X[a(0x166)](v=>K(J)[a(0x166)](f=>{const m=a;return v[m(0x128)](f),v;})),q);});exports[a16F(0x12e)]=asyncSequential;function isValidJSON(U){try{return JSON['parse'](U);}catch(K){return![];}}exports[a16F(0x12b)]=isValidJSON;function assertContextExisting(U){const i=a16F;if(U['contextProvider'][i(0x125)]()===undefined)throw new Error('No\x20CLI\x20context\x20present.\x20Create\x20context\x20with\x20\x27northflank\x20login\x27');if(U[i(0x156)][i(0x16d)]()===undefined)throw new Error(i(0x153));if(U[i(0x156)]['getCurrentToken']()===undefined)throw new Error(i(0x123));}exports[a16F(0x126)]=assertContextExisting;const parseDateInput=U=>{const G=a16F;try{let K=new Date(U);if(isNaN(K[G(0x161)]())){const q=U['length']===0xd?U/0x3e8:U,X=new Date(0x0);X[G(0x146)](q);if(isNaN(X[G(0x161)]()))throw new Error();return X;}return K;}catch(J){throw new Error(G(0x168)+U+',\x20expected\x20valid\x20date\x20string\x20(example:\x202020-02-02T02:02:02Z)\x20or\x20unix\x20timestamp\x20(example\x201580608922)');}};exports[a16F(0x15a)]=parseDateInput,exports['tsHint']=a16F(0x13a);
|