@northflank/cli 0.9.27 → 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 +2 -2
- package/dist/context/contextCommands.js +1 -1
- package/dist/copy/index.js +1 -0
- 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 +16 -4
package/dist/metrics/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const a12z=a12k;(function(Y,k){const L=a12k,X=Y();while(!![]){try{const B=parseInt(L(0xe6))/0x1+parseInt(L(0x109))/0x2*(-parseInt(L(0xf1))/0x3)+parseInt(L(0x147))/0x4+parseInt(L(0x167))/0x5*(-parseInt(L(0x16c))/0x6)+parseInt(L(0x136))/0x7+parseInt(L(0x11f))/0x8+-parseInt(L(0x146))/0x9;if(B===k)break;else X['push'](X['shift']());}catch(l){X['push'](X['shift']());}}}(a12Y,0x720fb));function a12k(Y,k){const X=a12Y();return a12k=function(B,l){B=B-0xe3;let S=X[B];return S;},a12k(Y,k);}function a12Y(){const Y8=['getPaddingDataStart','stdout','Get\x20metrics\x20before\x20this\x20timestamp,\x20','metricsRange','jobId','forEach','length','Container\x20to\x20exec\x20into\x20(logs\x20from\x20all\x20containers\x20will\x20be\x20shown\x20if\x20not\x20specified)','warning','json','getTime','Error\x20while\x20fetching\x20metrics\x20entries:\x20','askForJob','Deployment\x20id,\x20example:\x20my-service-54785f4','printMetricsSingle','255Qoejxe','printInitInfo','CliMetrics','-o,\x20--output\x20[output]','--noDefaults','15534WGTWFf','unshift','tsHint','askForContainer','commander','action',',\x20to:\x20','--build\x20--buildId\x20[buildId]','Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.','container\x20','354751mBJLpU','serviceId','metricsApiClient','refreshInterval',',\x20duration:\x20','No\x20metrics\x20found\x20for\x20this\x20query','Get\x20metrics\x20after\x20this\x20timestamp,\x20','metricId','printAsTable','time','toISOString','42zjCrRP','description','getStandardMetricsCommand','Build\x20to\x20get\x20logs\x20from','values','--deployment\x20--deploymentId\x20[deploymentId]','MetricType','done','service','--container\x20--containerId\x20[NAME]','\x20--','printMetricsTable','slice','-t,\x20--metricTypes\x20<metricTypes...>','printResponse','startTime','option','Metrics\x20for\x20','choices','clear','max','InquirerHelper','--timestamp\x20[timestamp]','getPaddingDataEnd','63106DHOols','Option','metricUnit','apiContext','pct','flatMap','bold','chalk','keys','exit','format','\x20for\x20container:\x20','throw','addOption','alias','message','getCommand','flat','name','containerId','stringify','--run\x20--runId\x20[runId]','3494304VbonAJ','../formatting/console-format-helpers','value','buildId','apiClient','askForAddon','rows','noDefaults','ApiClient','toFixed','default','runId','assign','charAt','getCurrentServiceName','--duration\x20[duration]','__awaiter','addon','data','askForBuild','N/A','Metrics\x20overview','min','2868012LEpwFt','yml','assertContextExisting','deploymentId','filter','push','__esModule',',\x20from:\x20','Id\x20[NAME]','handleError','getMetricsCommand','map','endTime','job','Length\x20of\x20timespan\x20in\x20seconds.\x20Only\x20valid\x20if\x20not\x20both,\x20startTime\x20and\x20endTime\x20are\x20set','columns','4050990IXHRhG','1159324epyvFJ','--startTime\x20<timestamp>','log','__importDefault','inquirerHelper','--endTime\x20<timestamp>','metrics','metricsSingle','\x20of\x20','metric','--project\x20--projectId\x20[NAME]','parseDateInput','build-','error','customUserAgent','../utils','askForService'];a12Y=function(){return Y8;};return a12Y();}var __awaiter=this&&this[a12z(0x12f)]||function(Y,k,X,B){function l(S){return S instanceof X?S:new X(function(C){C(S);});}return new(X||(X=Promise))(function(S,C){function j(O){try{e(B['next'](O));}catch(T){C(T);}}function o(O){const A=a12k;try{e(B[A(0x115)](O));}catch(T){C(T);}}function e(O){const D=a12k;O[D(0xf8)]?S(O[D(0x121)]):l(O[D(0x121)])['then'](j,o);}e((B=B['apply'](Y,k||[]))['next']());});},__importDefault=this&&this[a12z(0x14a)]||function(Y){const E=a12z;return Y&&Y[E(0x13c)]?Y:{'default':Y};};Object['defineProperty'](exports,a12z(0x13c),{'value':!![]}),exports[a12z(0x169)]=void 0x0;const js_client_1=require('@northflank/js-client'),utils_1=require(a12z(0x156)),inquirer_helper_1=require('../inquirer-helper'),commander_1=require(a12z(0x170)),terminal_chart_1=require('../formatting/terminal-chart'),console_format_helpers_1=require(a12z(0x120)),chalk_1=__importDefault(require(a12z(0x110)));class CliMetrics{constructor(Y,k){const b=a12z;this[b(0x10c)]=Y,this['refreshInterval']=0x2710,this['getStandardMetricsCommand']=(X,B)=>{const a=b,l=(0x0,utils_1[a(0x119)])(!![])[a(0x11b)]((B?a(0x153):'')+a(0x14d))[a(0x117)]((B?a(0x153):'')+a(0x150))[a(0xf2)]('Get\x20metrics\x20for\x20the\x20specified\x20'+X)[a(0x101)](a(0x151),'Project\x20for\x20logs')['option']('--'+X+a(0xfb)+X+a(0x13e),X[a(0x12c)](0x0)['toUpperCase']()+X[a(0xfd)](0x1)+'\x20to\x20get\x20logs\x20from')['option'](a(0xfa),a(0x15f))[a(0x101)](a(0x148),a(0xec)+utils_1[a(0x16e)],utils_1[a(0x152)])[a(0x101)](a(0x14c),a(0x15a)+utils_1[a(0x16e)],utils_1[a(0x152)])['option'](a(0x12e),a(0x144))['addOption'](new commander_1['Option'](a(0x16a),'Output\x20formatting.\x20Will\x20use\x20advanced\x20formatting\x20by\x20default.')[a(0x103)](Object[a(0xf5)](['format',a(0x161),'yaml'])))[a(0x116)](new commander_1[(a(0x10a))](a(0xfe),'Which\x20metric\x20type\x20to\x20fetch')['choices'](Object[a(0xf5)](js_client_1[a(0xf7)])))[a(0x116)](new commander_1[(a(0x10a))](a(0x107),'Get\x20metrics\x20at\x20this\x20exact\x20timestamp,\x20if\x20no\x20timestamp\x20set\x20most\x20recent\x20time\x20is\x20used.\x20'+utils_1[a(0x16e)])['argParser'](utils_1[a(0x152)])['conflicts']([a(0x100),a(0x142)]))[a(0x101)](a(0x16b),a(0xe4),![])[a(0x116)](new commander_1['Option'](a(0x16a),'Output\x20formatting.\x20Will\x20use\x20advanced\x20formatting\x20by\x20default.')[a(0x103)](Object[a(0xf5)]([a(0x113),'json','yaml'])));if(B)l['option'](a(0xe3),a(0xf4));if(X==='job')l[a(0x101)](a(0x11e),'Job\x20run\x20id,\x20example:\x20162b1977-6636-4000-929b-cc265b862ff0');if(X===a(0xf9))l['option'](a(0xf6),a(0x165));return l;},this['printMetricsGraph']=(X,B)=>{return l=>{const Z=a12k,S=Object[Z(0x111)](l)[Z(0x10e)](C=>{const c=Z,{values:j,metricInfo:o}=l[C],{metricUnit:e,metricResolution:O}=o;return j[c(0x141)](T=>{const V=c;var v,F;const {metadata:x,data:t}=T,Q=B?(B===null||B===void 0x0?void 0x0:B[V(0x162)]())>new Date()[V(0x162)]()?new Date():B:undefined,n=new Date((v=t===null||t===void 0x0?void 0x0:t[0x0])===null||v===void 0x0?void 0x0:v['ts']),M=new Date((F=t===null||t===void 0x0?void 0x0:t[t[V(0x15e)]-0x1])===null||F===void 0x0?void 0x0:F['ts']),p=this[V(0x158)](X,n,O),d=this[V(0x108)](Q,M,O),P=[...p,...t,...d],f=P['map'](R=>[new Date(R['ts'])['valueOf'](),Number(R[V(0x121)])])[V(0x13a)](R=>!Number['isNaN'](R[0x0])),N=Math['min'](Math[V(0x105)](process['stdout'][V(0x145)]-0xa,0xa),0x64),K=Math[V(0x135)](Math[V(0x105)](process[V(0x159)][V(0x125)]-0x9,0xa),0xf),r=e===V(0x10d)?0x64:undefined,w=e===V(0x10d)?'%':e,h=(0x0,terminal_chart_1['downSampleData'])(f,N),g=h[V(0x141)](R=>R[0x1]),y={'min':0x0,'height':K,'max':r,'unit':w,'startTs':X!==null&&X!==void 0x0?X:n,'endTs':Q!==null&&Q!==void 0x0?Q:M};return{'dataSeries':g,'metadata':x,'chartOpts':y,'metricInfo':o};});})[Z(0x11a)]();if(S[Z(0x15e)]===0x0)(0x0,utils_1[Z(0x160)])(Z(0xeb));else S[Z(0x15d)](C=>{const m=Z,{dataSeries:j,metadata:o,chartOpts:e,metricInfo:O}=C,{containerId:T,volumeId:v}=o,F=v?',\x20volume:\x20'+v:'';console[m(0x149)](O[m(0xed)]+m(0x114)+chalk_1[m(0x129)]['bold'](T)+F),console[m(0x149)]((0x0,terminal_chart_1['getAsciiChart'])(j,e));});};},this[b(0xfc)]=(X,B,l)=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const J=b;try{const S=yield this[J(0xe8)][J(0x14d)][J(0x14e)](X,B,l);console[J(0x104)]();if(S[J(0x154)])(0x0,utils_1[J(0x154)])(J(0x163)+S[J(0x154)][J(0x118)]);else this[J(0x166)](S[J(0x131)]);}catch(C){console[J(0x104)](),(0x0,utils_1[J(0x154)])(J(0x163)+C[J(0x118)]);}}),this[b(0x13f)]=X=>{const H=b;if(X[H(0x154)]){const B=JSON[H(0x11d)](X[H(0x154)]['details']);throw new Error(H(0x163)+X['error'][H(0x118)]+'\x20'+B);}},this[b(0x168)]=(X,B,l,S,C)=>{const G=b;if(C===!![])return;const {metricTypes:j,endTime:o,startTime:e,duration:O,containerId:T}=S,v=e?G(0x13d)+e[G(0xf0)]():'',F=o?G(0x172)+o[G(0xf0)]():'',x=O?G(0xea)+O+'\x20seconds':'',t=T?G(0xe5)+chalk_1[G(0x129)][G(0x10f)](T):'all\x20containers',Q=X+'\x20'+chalk_1[G(0x129)][G(0x10f)](B)+'\x20in\x20project\x20'+chalk_1[G(0x129)][G(0x10f)](l),n=''+v+F+x,M=j?',\x20metric\x20types:\x20'+(j===null||j===void 0x0?void 0x0:j['join'](',')):'';console[G(0x149)](G(0x102)+t+G(0x14f)+Q+M+n);},this[b(0x123)]=new js_client_1[(b(0x127))](Y,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[b(0x155)],'agent':k}),this['metricsApiClient']=this[b(0x123)],this[b(0x14b)]=new inquirer_helper_1[(b(0x106))](this['apiClient']);}[a12z(0x140)](Y,k=![]){const Y0=a12z,X=(j,o)=>__awaiter(this,void 0x0,void 0x0,function*(){const s=a12k,e=o[s(0x126)],{apiContext:O,inquirerHelper:T}=this;switch(Y){case'service':{const v=e?undefined:O[s(0x12d)]();return o[s(0xe7)]||v||(yield T[s(0x157)](j)());}case s(0x143):{const F=e?undefined:O[s(0x12d)]();return o[s(0x15c)]||F||(yield T[s(0x164)](j)());}case s(0x130):{const x=e?undefined:O[s(0x12d)]();return o['addonId']||x||(yield T[s(0x124)](j)());}}}),B=(j,o,e)=>__awaiter(this,void 0x0,void 0x0,function*(){const I=a12k;if(k)return e[I(0x122)]||(yield this['inquirerHelper'][I(0x132)](j,Y===I(0xf9)?o:undefined,Y===I(0x143)?o:undefined,!![])());return undefined;}),l=(j,o,e)=>__awaiter(this,void 0x0,void 0x0,function*(){const u=a12k;if(!k&&e[u(0x11c)]!==undefined){if(e[u(0x11c)]!==!![])return e[u(0x11c)];return yield this[u(0x14b)][u(0x16f)](j,Y===u(0xf9)?o:undefined,Y==='job'?o:undefined,!![])();}return undefined;}),S=(j,o,e)=>__awaiter(this,void 0x0,void 0x0,function*(){const i=a12k;if(Y===i(0x143))return e[i(0x12a)]||(yield this[i(0x14b)]['askForJobRun'](o,j,!![])());return undefined;}),C=(j,o,e)=>__awaiter(this,void 0x0,void 0x0,function*(){const W=a12k;if(Y==='service'){if(e[W(0x139)]!==!![])return e[W(0x139)];return e[W(0x139)];}return undefined;});return this[Y0(0xf3)](Y,k)[Y0(0x171)](j=>__awaiter(this,void 0x0,void 0x0,function*(){const Y1=Y0,{noDefaults:o,projectId:e,duration:O,timestamp:T,output:v,startTime:F,endTime:x,metricTypes:t,quiet:Q}=j;(0x0,utils_1[Y1(0x138)])(this[Y1(0x123)]);if(F&&x&&O)throw new Error('Only\x20two\x20of\x20\x27startTime\x27,\x20\x27endTime\x27\x20and\x20\x27duration\x27\x20can\x20be\x20set.');const {apiContext:n,inquirerHelper:M,metricsApiClient:p}=this,d=o?undefined:n['getCurrentProjectName'](),P=e||d||(yield M['askForProject']()),f=yield X(P,j),N=yield B(P,f,j),K=yield S(P,f,j),r=yield C(P,f,j),w=yield l(P,f,j),h={'projectId':P,'entityId':f},g={'containerName':w,'startTime':F,'endTime':x,'duration':O,'timestamp':T,'metricTypes':t,'runId':K,'buildId':N,'deploymentId':r,'isBuild':k!==null&&k!==void 0x0?k:![]},y=!(F||x||O);if(!Q&&v!=='yaml'&&v!==Y1(0x137)&&v!==Y1(0x161))this['printInitInfo'](Y,f,P,g,Q);if(y){if(v!==undefined){const R=yield p[Y1(0x14d)]['metricsSingle'](h,g,Y);this[Y1(0x13f)](R),(0x0,console_format_helpers_1[Y1(0xff)])(v,R['data']);}else[...Array(process[Y1(0x159)][Y1(0x125)]-0x1)]['forEach']((q,U)=>U===0x0?console['log']('Fetching\x20data..'):console[Y1(0x149)]()),yield this['printMetricsTable'](h,g,Y)(),setInterval(this[Y1(0xfc)](h,g,Y),this[Y1(0xe9)]),yield new Promise(q=>setTimeout(q,this[Y1(0xe9)]*0x64));}else{const q=yield p[Y1(0x14d)][Y1(0x15b)](h,g,Y);this[Y1(0x13f)](q),v!==undefined?(0x0,console_format_helpers_1[Y1(0xff)])(v,q['data']):this['printMetricsGraph'](F,x!==null&&x!==void 0x0?x:new Date())(q[Y1(0x131)]);}process[Y1(0x112)]();}));}[a12z(0x166)](Y){const Y3=a12z,k=(S,C)=>{const Y2=a12k;if(!(C===null||C===void 0x0?void 0x0:C[Y2(0x121)]))Y2(0x133);const j=S[Y2(0x10b)]==='pct'?'%':S['metricUnit'];return''+Number(C===null||C===void 0x0?void 0x0:C[Y2(0x121)])[Y2(0x128)](0x3)+j;},X=l=>{if(!(l===null||l===void 0x0?void 0x0:l['ts']))'N/A';return l['ts']['toTimeString']()['split']('\x20')[0x0];},B={};Object[Y3(0x111)](Y)['forEach'](l=>{const Y4=Y3,{values:S,metricInfo:C}=Y[l];return S[Y4(0x15d)](j=>{const Y5=Y4;var o,e;const O=j['metadata'][Y5(0x11c)];Object[Y5(0x12b)](B,{[O]:Object[Y5(0x12b)](Object[Y5(0x12b)]({},B===null||B===void 0x0?void 0x0:B[O]),{[Y5(0xef)]:X((o=j['data'])===null||o===void 0x0?void 0x0:o[0x0]),'containerId':O,[C[Y5(0xed)]]:k(C,(e=j['data'])===null||e===void 0x0?void 0x0:e[0x0])})});});}),(0x0,console_format_helpers_1[Y3(0xee)])(Object[Y3(0xf5)](B),Y3(0x134));}[a12z(0x158)](Y,k,X){const Y6=a12z,B=C=>new Date(C[Y6(0x162)]()-l),l=X*0x3e8;if(!Y)return[];if(!k)return[];if(B(k)[Y6(0x162)]()<Y['getTime']())return[];const S=[{'ts':B(k),'value':0x0}];while(B(S[S['length']-0x1]['ts'])[Y6(0x162)]()<=Y[Y6(0x162)]()){S[Y6(0x16d)]({'ts':B(S[S['length']-0x1]['ts']),'value':0x0});}return S;}['getPaddingDataEnd'](Y,k,X){const Y7=a12z,B=C=>new Date(C[Y7(0x162)]()+l),l=X*0x3e8;if(!Y)return[];if(!k)return[];if(B(k)['getTime']()>Y[Y7(0x162)]())return[];const S=[{'ts':B(k),'value':0x0}];while(B(S[S[Y7(0x15e)]-0x1]['ts'])['getTime']()<=Y[Y7(0x162)]()){S[Y7(0x13b)]({'ts':B(S[S[Y7(0x15e)]-0x1]['ts']),'value':0x0});}return S;}}exports['CliMetrics']=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 a14r=a14k;(function(Y,k){const K=a14k,X=Y();while(!![]){try{const B=parseInt(K(0x1a6))/0x1*(parseInt(K(0x122))/0x2)+parseInt(K(0x12c))/0x3+-parseInt(K(0x173))/0x4+-parseInt(K(0x189))/0x5*(parseInt(K(0x174))/0x6)+-parseInt(K(0x179))/0x7+parseInt(K(0x158))/0x8*(parseInt(K(0x141))/0x9)+-parseInt(K(0x178))/0xa;if(B===k)break;else X['push'](X['shift']());}catch(l){X['push'](X['shift']());}}}(a14Y,0xc1953));function a14k(Y,k){const X=a14Y();return a14k=function(B,l){B=B-0x121;let S=X[B];return S;},a14k(Y,k);}var __createBinding=this&&this[a14r(0x133)]||(Object[a14r(0x14b)]?function(Y,X,B,l){const w=a14r;if(l===undefined)l=B;var S=Object[w(0x13a)](X,B);(!S||(w(0x163)in S?!X[w(0x16e)]:S[w(0x19a)]||S[w(0x152)]))&&(S={'enumerable':!![],'get':function(){return X[B];}}),Object['defineProperty'](Y,l,S);}:function(Y,X,B,l){if(l===undefined)l=B;Y[l]=X[B];}),__setModuleDefault=this&&this[a14r(0x198)]||(Object[a14r(0x14b)]?function(Y,k){const h=a14r;Object['defineProperty'](Y,h(0x1a4),{'enumerable':!![],'value':k});}:function(Y,k){Y['default']=k;}),__importStar=this&&this[a14r(0x18e)]||function(Y){const g=a14r;if(Y&&Y['__esModule'])return Y;var X={};if(Y!=null){for(var B in Y)if(B!=='default'&&Object[g(0x162)][g(0x146)][g(0x18c)](Y,B))__createBinding(X,Y,B);}return __setModuleDefault(X,Y),X;},__awaiter=this&&this[a14r(0x1b2)]||function(Y,k,X,B){function l(S){return S instanceof X?S:new X(function(C){C(S);});}return new(X||(X=Promise))(function(S,C){const q=a14k;function j(O){try{e(B['next'](O));}catch(T){C(T);}}function o(O){const y=a14k;try{e(B[y(0x121)](O));}catch(T){C(T);}}function e(O){const R=a14k;O['done']?S(O['value']):l(O[R(0x140)])[R(0x124)](j,o);}e((B=B[q(0x128)](Y,k||[]))[q(0x194)]());});},__importDefault=this&&this[a14r(0x19b)]||function(Y){const U=a14r;return Y&&Y[U(0x16e)]?Y:{'default':Y};};Object[a14r(0x16a)](exports,a14r(0x16e),{'value':!![]}),exports[a14r(0x14c)]=void 0x0;const js_client_1=require(a14r(0x190)),chalk_1=__importDefault(require('chalk')),utils_1=require(a14r(0x1a8)),inquirer_helper_1=require(a14r(0x172)),os=__importStar(require('os')),lodash_1=require(a14r(0x182)),{EOL}=require('os');class CliPortForward{constructor(Y,k){const L=a14r;this[L(0x16c)]=L(0x143),this[L(0x150)]=L(0x187),this['apiClient']=new js_client_1[(L(0x18f))](Y,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[L(0x131)],'agent':k});const X=new inquirer_helper_1[(L(0x168))](this[L(0x12d)]);this['portFwdCmd']=(0x0,utils_1['getCommand'])()[L(0x1b0)](L(0x1a1))[L(0x149)](L(0x18d))[L(0x17d)]('Port-forwarding\x20for\x20Northflank\x20services\x20and\x20addons.');const B=(0x0,utils_1['getCommand'])(!![])[L(0x1b0)]('all')[L(0x17d)](L(0x16b))[L(0x126)]('--project\x20--projectId\x20[NAME]',L(0x139))['option']('--noDefaults',this[L(0x16c)],![])[L(0x126)]('--skipHostnames',this[L(0x150)],![])['action'](({noDefaults:C,projectId:j,skipHostnames:o})=>__awaiter(this,void 0x0,void 0x0,function*(){const z=L;(0x0,utils_1['assertContextExisting'])(this[z(0x12d)]);const O=this[z(0x15d)](o),T=C?undefined:Y['getCurrentProjectName'](),v=j||T||(yield X[z(0x1b3)]());try{const {services:F,addons:x}=yield O['forwardProject']({'projectId':v},o);if(F[z(0x1a3)]+x[z(0x1a3)]<=0x0)(0x0,utils_1[z(0x15f)])(z(0x180)+chalk_1['default'][z(0x196)](v));else{const t=F[z(0x155)](M=>M[z(0x1a3)]>0x0)[z(0x1a3)],Q=x[z(0x155)](M=>M[z(0x1a3)]>0x0)[z(0x1a3)],n='\x20in\x20project\x20'+chalk_1['default'][z(0x196)](v);console[z(0x15c)](z(0x12a)+chalk_1[z(0x1a4)][z(0x17a)][z(0x196)](t+z(0x14d))+z(0x1a9)+chalk_1[z(0x1a4)]['green'][z(0x196)](Q+z(0x1af))+n),console[z(0x15c)](),console[z(0x15c)](chalk_1[z(0x1a4)][z(0x196)](z(0x195))),F['forEach'](M=>{const A=z;if(M[A(0x1a3)]>=0x1&&!M[0x0][A(0x18a)])this[A(0x1ac)](M,{'type':A(0x142),'name':M[0x0][A(0x164)]['id']},o);}),console[z(0x15c)](chalk_1[z(0x1a4)][z(0x196)](z(0x134))),x[z(0x166)](M=>{const D=z;if(M[D(0x1a3)]>=0x1&&!M[0x0][D(0x18a)])this[D(0x1ac)](M,{'type':D(0x16f),'name':M[0x0]['data']['id']},o);}),this[z(0x170)]([...F['flat'](),...x[z(0x13d)]()],o);}}catch(M){(0x0,utils_1[z(0x18a)])(z(0x147)+M[z(0x1aa)]);}})),l=(0x0,utils_1[L(0x145)])(!![])[L(0x1b0)](L(0x142))[L(0x17d)](L(0x14e))[L(0x126)](L(0x12e),'Project\x20for\x20forwarding')[L(0x126)](L(0x127),L(0x17c))['option']('--noDefaults',this[L(0x16c)],![])[L(0x126)](L(0x129),this['skipHostnamesText'],![])[L(0x176)](({noDefaults:C,projectId:j,serviceId:o,skipHostnames:e})=>__awaiter(this,void 0x0,void 0x0,function*(){const E=L;(0x0,utils_1[E(0x12f)])(this[E(0x12d)]);const O=this[E(0x15d)](e),T=C?undefined:Y[E(0x1ab)](),v=j||T||(yield X[E(0x1b3)]()),F=C?undefined:Y[E(0x169)](),x=o||F||(yield X['askForService'](v)());console[E(0x15c)](E(0x191)+chalk_1[E(0x1a4)][E(0x196)](x)+E(0x197)+chalk_1[E(0x1a4)][E(0x196)](v));try{const t=yield O[E(0x153)]({'projectId':v,'serviceId':x},e);this[E(0x1ac)](t,{'name':x,'type':E(0x142)},e),this[E(0x170)](t,e);}catch(Q){(0x0,utils_1[E(0x18a)])('Failed:\x20'+Q[E(0x1aa)]);}})),S=(0x0,utils_1['getCommand'])(!![])[L(0x1b0)](L(0x16f))[L(0x17d)](L(0x13f))[L(0x126)]('--project\x20--projectId\x20[NAME]','Project\x20for\x20forwarding')[L(0x126)](L(0x17f),'Addon\x20to\x20forward')[L(0x126)](L(0x129),this['skipHostnamesText'],![])['action'](({noDefaults:C,projectId:j,addonId:o,skipHostnames:e})=>__awaiter(this,void 0x0,void 0x0,function*(){const b=L;(0x0,utils_1[b(0x12f)])(this[b(0x12d)]);const O=this[b(0x15d)](e),T=C?undefined:Y['getCurrentProjectName'](),v=j||T||(yield X[b(0x1b3)]()),F=o||(yield X[b(0x136)](v)());console[b(0x15c)](b(0x19d)+chalk_1[b(0x1a4)]['bold'](F)+b(0x197)+chalk_1[b(0x1a4)][b(0x196)](v));try{const x={'projectId':v,'addonId':F},t=yield O['forwardAddon'](x,e);this[b(0x1ac)](t,{'name':F,'type':b(0x16f)},e),this[b(0x170)](t,e);}catch(Q){(0x0,utils_1[b(0x18a)])(b(0x147)+Q['message']);}}));this[L(0x13c)]['addCommand'](B),this[L(0x13c)][L(0x1a2)](l),this[L(0x13c)][L(0x1a2)](S);}['getProxyForwarder'](Y=![]){const a=a14r,k=this['apiClient'][a(0x17e)];if(!Y){const X=k[a(0x13b)]();if(X[a(0x18a)])throw new Error(X['message']);}return k['on'](a(0x132),(B,l)=>{const Z=a,S=chalk_1[Z(0x1a4)][Z(0x196)](l[Z(0x192)]+'\x20\x27'+l['id']+'\x27'),C=l[Z(0x1ad)]['length']>0x0;(0x0,utils_1[Z(0x15f)])(Z(0x167)+l[Z(0x188)]+':'+l[Z(0x15b)]+'\x20to\x20'+S),Y&&C&&(0x0,utils_1['warning'])(Z(0x1b1));}),k['on'](a(0x130),(B,l,S)=>{const c=a;(0x0,utils_1[c(0x15f)])(c(0x1a5)+l[c(0x188)]+':'+l[c(0x15b)]+c(0x193)+(S===null||S===void 0x0?void 0x0:S[c(0x1aa)])+'\x22');}),process['on'](a(0x15a),()=>__awaiter(this,void 0x0,void 0x0,function*(){const V=a;try{yield k[V(0x19f)]();}catch(B){(0x0,utils_1[V(0x18a)])(V(0x183)+B[V(0x1aa)]);}finally{process[V(0x151)]();}})),k;}[a14r(0x1ac)](Y,k,X=![]){const m=a14r,{type:B,name:l}=k;if(Y[m(0x1a3)]<=0x0){const o=m(0x177)+k['type']+m(0x19e);(0x0,utils_1['warning'])('\x20\x20\x20No\x20running\x20container\x20found\x20for\x20'+B+'\x20'+chalk_1[m(0x1a4)]['bold'](l)+'.\x20'+o);return;}const S=(0x0,lodash_1['groupBy'])(Y,m(0x199)),C=e=>'\x20('+(e[m(0x159)]?e[m(0x159)]+m(0x148):'')+e[m(0x156)]+')';function j(e,O=0x2){const J=m;if(!X){const T=e[J(0x156)]==='HTTP'?J(0x184):'';e[J(0x1ad)]['forEach'](v=>{const H=J;console[H(0x15c)]((0x0,lodash_1['repeat'])('\x20',O)+'-\x20'+T+v+':'+e[H(0x15b)]);});}}Object[m(0x14a)](S)[m(0x166)](([e,O])=>{const G=m;var T,v;const F='>\x20'+(0x0,lodash_1[G(0x186)])(B)+'\x20\x27'+chalk_1[G(0x1a4)]['greenBright'][G(0x196)](e)+'\x27';if(B===G(0x16f)){if(O[G(0x1a3)]===0x1){const x=O[0x0];if(x[G(0x18a)]){(0x0,utils_1[G(0x18a)])(G(0x144)+e+':\x20'+x[G(0x18a)][G(0x1aa)]);return;}const t=x['data'],Q=!X?'\x20'+chalk_1[G(0x1a4)][G(0x125)]('with\x20hostname:\x20'+t[G(0x1ad)][G(0x157)](',')):'';(0x0,utils_1[G(0x18b)])(F+G(0x19c)+t['address']+':'+t[G(0x15b)]+C(t)+Q);}else{const n=(0x0,lodash_1[G(0x160)])(O,M=>{const s=G;var d,P;return(P=(d=M===null||M===void 0x0?void 0x0:M[s(0x164)])===null||d===void 0x0?void 0x0:d[s(0x1ad)])===null||P===void 0x0?void 0x0:P[s(0x157)](',');})[G(0x1a3)]>0x1;(0x0,utils_1[G(0x18b)])(F+G(0x154)+(n?'hosts':G(0x12b))+':'),O['forEach'](M=>{const I=G;if(M['error']){(0x0,utils_1[I(0x18a)])(I(0x144)+e+':\x20'+M[I(0x18a)][I(0x1aa)]);return;}const d=M['data'],P=!X?I(0x14f)+d[I(0x1ad)][I(0x157)](','):'';console['log'](I(0x171)+d[I(0x188)]+':'+d[I(0x15b)]+C(d)+P);});}}if(B===G(0x142)){if(O[G(0x1a3)]===0x1){const M=O[0x0];if(M[G(0x18a)]){(0x0,utils_1['error'])(G(0x144)+e+':\x20'+M['error'][G(0x1aa)]);return;}const p=M[G(0x164)],d=!X?G(0x165):':',P=p[G(0x188)]+':'+p['port']+C(p);(0x0,utils_1['success'])(F+G(0x19c)+P+d),j(p);}else(0x0,utils_1[G(0x18b)])(F+G(0x19c)+((v=(T=O[0x0])===null||T===void 0x0?void 0x0:T[G(0x164)])===null||v===void 0x0?void 0x0:v['address'])+G(0x161)),O[G(0x166)](f=>{const u=G;if(f[u(0x18a)]){(0x0,utils_1[u(0x18a)])('Error\x20occured\x20while\x20trying\x20to\x20forward\x20'+e+':\x20'+f[u(0x18a)]['message']);return;}const N=f[u(0x164)];(0x0,utils_1[u(0x18b)])(u(0x181)+N['port']+C(N)),j(N,0x4);});}});}[a14r(0x170)](Y,k=![]){const i=a14r;if(k){const X=Y[i(0x1a0)](O=>O['data'])[i(0x155)](O=>O!==undefined),B=(process===null||process===void 0x0?void 0x0:process[i(0x137)])===i(0x135),l=os[i(0x137)]()===i(0x16d),S=B?'C:/Windows/System32/drivers/etc/hosts':i(0x185),C=chalk_1[i(0x1a4)]['bold'](i(0x13e)),j=l?EOL+i(0x17b)+C+i(0x138):undefined;let o=i(0x1a7)+C+i(0x175)+'--skipHostnames'+i(0x123)+S+'):';j!==undefined&&(0x0,utils_1[i(0x15f)])(j!==null&&j!==void 0x0?j:'');(0x0,utils_1[i(0x15f)])(o);const e=X['map'](O=>O[i(0x188)]+i(0x1ae)+O['hostnames']['join']('\x20'));console[i(0x15c)]((0x0,lodash_1[i(0x15e)])(e)[i(0x157)](EOL)),console[i(0x15c)]();}}}exports[a14r(0x14c)]=CliPortForward;function a14Y(){const W=['forward','addCommand','length','default','Connection\x20error\x20occurred\x20when\x20forwarding\x20\x27','71IRqYMU','Running\x20in\x20','../utils','\x20and\x20','message','getCurrentProjectName','printForwardingInfo','hostnames','\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x20addon\x20ports','name','\x20\x20If\x20you\x20have\x20added\x20entries\x20to\x20your\x20hosts\x20file,\x20it\x20is\x20recommended\x20to\x20remove\x20them\x20again\x20now.','__awaiter','askForProject','throw','16020wCkfsv','\x20flag\x20or\x20manually\x20append\x20following\x20entry\x20to\x20your\x20hosts\x20file\x20(','then','reset','option','--service\x20--serviceId\x20[NAME]','apply','--skipHostnames','Forwarding\x20','ports','2564442YJvfMw','apiClient','--project\x20--projectId\x20[NAME]','assertContextExisting','connection-error','customUserAgent','tunnel-close','__createBinding','Addons:','win32','askForAddon','platform','\x20mode:\x20the\x20locally\x20forwarded\x20port\x20differs\x20from\x20the\x20actual\x20port\x20on\x20the\x20forwarded\x20service/addon.','project\x20for\x20forwarding','getOwnPropertyDescriptor','canExecuteWithHostnames','portFwdCmd','flat','skipHostnames','Port-forwarding\x20for\x20the\x20specified\x20addon','value','27YrZJOo','service','Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.','Error\x20occured\x20while\x20trying\x20to\x20forward\x20','getCommand','hasOwnProperty','Failed:\x20','\x20-\x20','alias','entries','create','CliPortForward','\x20service\x20ports','Port-forwarding\x20for\x20the\x20specified\x20service',',\x20hostname:\x20','skipHostnamesText','exit','configurable','forwardService','\x20is\x20exposed\x20with\x20multiple\x20','filter','protocol','join','3124336kAOkgB','portName','SIGINT','port','log','getProxyForwarder','uniq','warning','uniqBy','\x20with\x20multiple\x20ports:','prototype','get','data','\x20with\x20these\x20hostnames:','forEach','Stop\x20forwarding\x20traffic\x20from\x20','InquirerHelper','getCurrentServiceName','defineProperty','Port-forwarding\x20for\x20all\x20services\x20and\x20addons\x20in\x20the\x20given\x20project','noDefaultsText','darwin','__esModule','addon','printHostsFileHint','\x20\x20-\x20Address:\x20','../inquirer-helper','1721448DfkXxl','164088sRXXET','\x20mode.\x20If\x20hostname\x20forwarding\x20is\x20required,\x20remove\x20','action','Please\x20ensure\x20the\x20','2674070RBTxNK','7539826tJjOoM','green','Running\x20on\x20macOS\x20in\x20','Service\x20to\x20forward','description','forwarding','--addon\x20--addonId\x20[NAME]','No\x20services\x20and\x20addons\x20to\x20forward\x20found\x20in\x20project\x20','\x20\x20-\x20port\x20','lodash','Cleaning\x20up\x20open\x20connections\x20failed:\x20','http://','/etc/hosts','capitalize','Only\x20expose\x20on\x20IP\x20address,\x20not\x20on\x20hostnames.\x20With\x20this\x20option,\x20no\x20root\x20permissions\x20are\x20required.','address','5fDqIsd','error','success','call','fwd','__importStar','ApiClient','@northflank/js-client','Forwarding\x20service\x20','type','\x27:\x20\x22','next','Services:','bold','\x20in\x20project\x20','__setModuleDefault','data.id','writable','__importDefault','\x20is\x20exposed\x20on\x20','Forwarding\x20addon\x20','\x20is\x20running\x20and\x20reachable.','stop','flatMap'];a14Y=function(){return W;};return a14Y();}
|
|
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);
|
package/package.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@northflank/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"author": "Marco Suter",
|
|
5
5
|
"description": "Provides a command-line interface to the Northflank platform.",
|
|
6
6
|
"homepage": "https://www.northflank.com",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"typings": "./dist/cli.d.js",
|
|
9
9
|
"main": "./dist/cli.js",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=18.0.0"
|
|
12
|
+
},
|
|
10
13
|
"scripts": {
|
|
11
14
|
"build": "tsc",
|
|
12
|
-
"clin": "node dist/cli.js",
|
|
15
|
+
"clin": "node --no-deprecation dist/cli.js",
|
|
13
16
|
"cli": "ts-node src/cli.ts",
|
|
14
17
|
"inq-pag": "ts-node src/pagination/_dev/index.ts",
|
|
15
18
|
"gen-fig-spec": "ts-node src/_dev/gen-fig-spec.ts",
|
|
@@ -26,7 +29,7 @@
|
|
|
26
29
|
"LICENSE"
|
|
27
30
|
],
|
|
28
31
|
"dependencies": {
|
|
29
|
-
"@northflank/js-client": "0.
|
|
32
|
+
"@northflank/js-client": "0.8.1",
|
|
30
33
|
"bufferutil": "^4.0.7",
|
|
31
34
|
"chalk": "~4.1.0",
|
|
32
35
|
"columnify": "^1.5.4",
|
|
@@ -35,16 +38,25 @@
|
|
|
35
38
|
"inquirer-search-list": "^1.2.6",
|
|
36
39
|
"js-yaml": "^3.14.0",
|
|
37
40
|
"lodash": "^4.17.15",
|
|
38
|
-
"node-fetch": "
|
|
41
|
+
"node-fetch": "2.6.7",
|
|
39
42
|
"open": "^8.4.0",
|
|
40
43
|
"proxy-agent": "^6.5.0",
|
|
41
44
|
"utf-8-validate": "^5.0.10",
|
|
45
|
+
"whatwg-url": "14.2.0",
|
|
42
46
|
"ws": "^8.2.1"
|
|
43
47
|
},
|
|
44
48
|
"devDependencies": {
|
|
45
49
|
"ts-node": "^8.10.2",
|
|
46
50
|
"typescript": "^4.9.5"
|
|
47
51
|
},
|
|
52
|
+
"overrides": {
|
|
53
|
+
"node-fetch@2.6.7": {
|
|
54
|
+
"whatwg-url": "14.2.0"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"resolutions": {
|
|
58
|
+
"node-fetch/whatwg-url": "14.2.0"
|
|
59
|
+
},
|
|
48
60
|
"keywords": [
|
|
49
61
|
"northflank",
|
|
50
62
|
"cli",
|