@northflank/cli
Version:
Provides a command-line interface to the Northflank platform.
1 lines • 5.5 kB
JavaScript
;function a10K(Z,K){const O=a10Z();return a10K=function(g,N){g=g-0x12e;let H=O[g];return H;},a10K(Z,K);}const a10Y=a10K;(function(Z,K){const q=a10K,O=Z();while(!![]){try{const g=parseInt(q(0x164))/0x1+parseInt(q(0x145))/0x2+parseInt(q(0x13a))/0x3+parseInt(q(0x14d))/0x4+parseInt(q(0x152))/0x5+parseInt(q(0x16c))/0x6+-parseInt(q(0x151))/0x7*(parseInt(q(0x14b))/0x8);if(g===K)break;else O['push'](O['shift']());}catch(N){O['push'](O['shift']());}}}(a10Z,0x9dc25));function a10Z(){const i=['done','defineProperty','handleError','http:','write','__esModule','next','end','open','agent','__importDefault','status','duplex','3688113OIaCNx','login-failure','unable\x20to\x20parse\x20message:\x20','NorthflankApiBrowserLogin','idle','finally','type','default','replace','error','__createBinding','1507654upoUgK','Failed\x20to\x20establish\x20connection\x20to\x20command\x20execution\x20proxy:\x20','Unable\x20to\x20open\x20browser:\x20','exit','catch','stringify','3464ryOIOA','success','4707164aftCrO','createWebSocketStream','Failure\x20during\x20login:\x20','toString','75047BVePMn','6065250btvYSE','message','value','throw','SIGINT','ws:','data','EventEmitter','error\x20happened\x20during\x20browser\x20login:\x20','prototype','startLogin','emit','get','events','browser-opened','init','removeListener','create','836353mxqXoM','initPackage','openBrowser','wss:','apply','aborted','baseUrl','https:','473892uAtQNu','init-ack'];a10Z=function(){return i;};return a10Z();}var __createBinding=this&&this[a10Y(0x144)]||(Object[a10Y(0x163)]?function(Z,K,O,g){const P=a10Y;if(g===undefined)g=O;var N=Object['getOwnPropertyDescriptor'](K,O);(!N||(P(0x15e)in N?!K[P(0x132)]:N['writable']||N['configurable']))&&(N={'enumerable':!![],'get':function(){return K[O];}}),Object[P(0x12e)](Z,g,N);}:function(Z,K,O,g){if(g===undefined)g=O;Z[g]=K[O];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object[a10Y(0x163)]?function(Z,K){const C=a10Y;Object['defineProperty'](Z,C(0x141),{'enumerable':!![],'value':K});}:function(Z,K){Z['default']=K;}),__importStar=this&&this['__importStar']||function(Z){const S=a10Y;if(Z&&Z['__esModule'])return Z;var K={};if(Z!=null){for(var O in Z)if(O!==S(0x141)&&Object[S(0x15b)]['hasOwnProperty']['call'](Z,O))__createBinding(K,Z,O);}return __setModuleDefault(K,Z),K;},__awaiter=this&&this['__awaiter']||function(Z,K,O,g){function N(H){return H instanceof O?H:new O(function(o){o(H);});}return new(O||(O=Promise))(function(H,o){const m=a10K;function s(W){const n=a10K;try{y(g[n(0x133)](W));}catch(B){o(B);}}function R(W){const k=a10K;try{y(g[k(0x155)](W));}catch(B){o(B);}}function y(W){const x=a10K;W[x(0x16e)]?H(W['value']):N(W[x(0x154)])['then'](s,R);}y((g=g[m(0x168)](Z,K||[]))['next']());});},__importDefault=this&&this[a10Y(0x137)]||function(Z){const r=a10Y;return Z&&Z[r(0x132)]?Z:{'default':Z};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[a10Y(0x13d)]=void 0x0;const ws_1=__importStar(require('ws')),open_1=__importDefault(require(a10Y(0x135))),events_1=require(a10Y(0x15f));class NorthflankApiBrowserLogin extends events_1[a10Y(0x159)]{constructor(Z,K=!![],O){const D=a10Y;super(),this['baseUrl']=Z,this[D(0x166)]=K,this['agent']=O,this[D(0x138)]=D(0x13e),this[D(0x165)]=()=>JSON[D(0x14a)]({'type':D(0x161)});}[a10Y(0x15c)](){const d=a10Y;var Z;const K=this[d(0x16a)][d(0x142)](d(0x16b),d(0x167))[d(0x142)](d(0x130),d(0x157)),O=K+'/v1/cli-login',g=new ws_1[(d(0x141))](O,{'agent':this[d(0x136)]}),N=()=>__awaiter(this,void 0x0,void 0x0,function*(){const l=d;yield new Promise(o=>{const b=a10K;var s;(s=this[b(0x139)])===null||s===void 0x0?void 0x0:s[b(0x134)](JSON[b(0x14a)]({'type':b(0x169)}),()=>o());}),process[l(0x148)]();}),H=new Promise((o,s)=>{const f=d;var R,y,W;try{this['duplex']=(0x0,ws_1[f(0x14e)])(g),process['on'](f(0x156),N);}catch(B){s(new Error(f(0x146)+B[f(0x153)]));}(R=this[f(0x139)])===null||R===void 0x0?void 0x0:R['on'](f(0x158),V=>{const a=f;var M;const I=JSON['parse'](V[a(0x150)]());switch(I===null||I===void 0x0?void 0x0:I[a(0x140)]){case a(0x16d):{const {loginPage:c}=I;if(c===undefined){this[a(0x12f)]('Unexpected\x20response',s);return;}this[a(0x166)]&&(0x0,open_1[a(0x141)])(c)[a(0x149)](E=>{const v=a,p=v(0x147)+E[v(0x153)];this[v(0x12f)](p,s);});this[a(0x15d)](a(0x160),{'url':c});break;}case'login-success':{const {apiToken:E,contextName:p}=I;if(E===undefined){this[a(0x12f)]('Unexpected\x20response,\x20api\x20token\x20missing',s);return;}(M=this[a(0x139)])===null||M===void 0x0?void 0x0:M[a(0x134)](),o({'token':E,'contextName':p}),this[a(0x138)]=a(0x14c);break;}case a(0x13b):{const T=a(0x14f)+(I===null||I===void 0x0?void 0x0:I['message']);this[a(0x12f)](T,s);break;}default:{const J=a(0x13c)+JSON['stringify'](I);this[a(0x12f)](J,s);}}}),(y=this[f(0x139)])===null||y===void 0x0?void 0x0:y['on'](f(0x143),V=>{const L=f;this['handleError'](L(0x15a)+V[L(0x153)],s);}),(W=this['duplex'])===null||W===void 0x0?void 0x0:W['on'](f(0x134),()=>{const X=f;if(this[X(0x138)]===X(0x14c)){}else this[X(0x12f)]('Login\x20process\x20stopped\x20before\x20completed',s);});});return(Z=this[d(0x139)])===null||Z===void 0x0?void 0x0:Z[d(0x131)](this['initPackage']()),this[d(0x138)]=d(0x161),H[d(0x13f)](()=>{const e=d;process[e(0x162)](e(0x156),N);});}[a10Y(0x12f)](Z,K){const U=a10Y;var O,g;K?(O=this[U(0x139)])===null||O===void 0x0?void 0x0:O['end'](()=>K(new Error(Z))):(g=this[U(0x139)])===null||g===void 0x0?void 0x0:g[U(0x134)](),this[U(0x138)]='error';}}exports[a10Y(0x13d)]=NorthflankApiBrowserLogin;