@northflank/cli 0.9.17 → 0.9.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-helpers.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/context/contextCommands.js +1 -1
- package/dist/defaults.js +1 -1
- package/dist/exec/index.js +1 -1
- package/dist/formatting/command-overview.js +1 -1
- package/dist/formatting/console-format-helpers.js +1 -1
- package/dist/formatting/terminal-chart.js +1 -1
- package/dist/inquirer-helper.js +1 -1
- package/dist/login/browser-login.js +1 -1
- package/dist/logs/index.js +1 -1
- package/dist/logs/log-formatter.js +1 -1
- package/dist/metrics/index.js +1 -1
- package/dist/pagination/inquirer-pagination-prompt.js +1 -1
- package/dist/pagination/pagination-helper.js +1 -1
- package/dist/port-forward/index.js +1 -1
- package/dist/utils.js +1 -1
- package/package.json +2 -2
package/dist/api-helpers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a0u3=a0I;(function(u,I){const u2=a0I,a=u();while(!![]){try{const x=-parseInt(u2(0x112))/0x1+-parseInt(u2(0x119))/0x2+-parseInt(u2(0x10f))/0x3+-parseInt(u2(0x105))/0x4*(parseInt(u2(0x10c))/0x5)+-parseInt(u2(0x102))/0x6+-parseInt(u2(0xf0))/0x7*(-parseInt(u2(0x100))/0x8)+-parseInt(u2(0x107))/0x9*(-parseInt(u2(0xff))/0xa);if(x===I)break;else a['push'](a['shift']());}catch(D){a['push'](a['shift']());}}}(a0u,0xf4186));var __awaiter=this&&this[a0u3(0xe2)]||function(u,I,a,x){function D(K){return K instanceof a?K:new a(function(z){z(K);});}return new(a||(a=Promise))(function(K,z){const u7=a0I;function H(p){const u4=a0I;try{C(x[u4(0xf9)](p));}catch(b){z(b);}}function s(p){const u5=a0I;try{C(x[u5(0x104)](p));}catch(b){z(b);}}function C(p){const u6=a0I;p[u6(0x116)]?K(p[u6(0xfc)]):D(p[u6(0xfc)])[u6(0xf5)](H,s);}C((x=x[u7(0xf3)](u,I||[]))['next']());});};Object['defineProperty'](exports,a0u3(0x109),{'value':!![]}),exports[a0u3(0x118)]=void 0x0;const utils_1=require('./utils'),defaultPaginationPageSize=0x64,getProjects=u=>I=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const u8=a0u3;var a;const x=yield u[u8(0xe8)][u8(0xe5)]({'options':{'per_page':defaultPaginationPageSize,'cursor':I===null||I===void 0x0?void 0x0:I[u8(0x108)]}});return{'elements':x[u8(0x117)][u8(0xe5)][u8(0xec)](D=>D['id']),'nextPageCursor':(a=x['pagination'])===null||a===void 0x0?void 0x0:a[u8(0xe6)]};}),getServices=(u,I)=>a=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const u9=a0u3;var x;const D=yield u[u9(0xe8)]['services']({'parameters':{'projectId':I},'options':{'per_page':defaultPaginationPageSize,'cursor':a===null||a===void 0x0?void 0x0:a[u9(0x108)]}});return{'elements':D[u9(0x117)]['services']['map'](K=>K['id']),'nextPageCursor':(x=D[u9(0xf6)])===null||x===void 0x0?void 0x0:x[u9(0xe6)]};}),getAddons=(u,I)=>a=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const uu=a0u3;var x;const D=yield u[uu(0xe8)]['addons']({'parameters':{'projectId':I},'options':{'per_page':defaultPaginationPageSize,'cursor':a===null||a===void 0x0?void 0x0:a[uu(0x108)]}});return{'elements':D[uu(0x117)][uu(0xe4)][uu(0xec)](K=>K['id']),'nextPageCursor':(x=D['pagination'])===null||x===void 0x0?void 0x0:x[uu(0xe6)]};}),getAddonBackups=(u,I,a)=>x=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const uI=a0u3;var D;const K=yield u[uI(0x11a)][uI(0xe1)][uI(0xee)]({'parameters':{'projectId':I,'addonId':a},'options':{'per_page':defaultPaginationPageSize,'cursor':x===null||x===void 0x0?void 0x0:x[uI(0x108)]}});return{'elements':K['data'][uI(0xee)]['map'](z=>z['id']),'nextPageCursor':(D=K[uI(0xf6)])===null||D===void 0x0?void 0x0:D[uI(0xe6)]};});function a0I(u,I){const a=a0u();return a0I=function(x,D){x=x-0xde;let K=a[x];return K;},a0I(u,I);}function fetchResourceList(u,I,a,x,D,K){var z,H,s,C,p,b,i,j,A,F,X,T;return __awaiter(this,void 0x0,void 0x0,function*(){const ua=a0I,E=undefined;try{if(u===ua(0xfb)){const k=yield I[ua(0xe8)][ua(0x113)]({}),R=k[ua(0x117)][ua(0x113)][ua(0xec)](q=>{var c;return(c=q===null||q===void 0x0?void 0x0:q['internalId'])!==null&&c!==void 0x0?c:q===null||q===void 0x0?void 0x0:q['id'];});return{'choices':R,'defaultValue':E};}if(u===ua(0xeb)&&!(a===null||a===void 0x0?void 0x0:a[ua(0x103)](ua(0x10b)))){const q=yield I[ua(0xe8)][ua(0x10e)]({}),c=q['data'][ua(0x10e)]['map'](M=>{const ux=ua;var r;return(r=M===null||M===void 0x0?void 0x0:M[ux(0xfe)])!==null&&r!==void 0x0?r:M===null||M===void 0x0?void 0x0:M['id'];});return{'choices':c,'defaultValue':E};}if(u==='projectId'){const M=yield getProjects(I),{elements:r,nextPageCursor:o}=yield M();return{'choices':r,'defaultValue':E,'pagination':{'nextPageCursor':o,'loadMore':M}};}if(u===ua(0x101)){const w=yield I[ua(0xe8)]['registryCredentials']({}),h=w['data'][ua(0x101)][ua(0xec)](W=>W['id']);return{'choices':h,'defaultValue':E};}const f=D===null||D===void 0x0?void 0x0:D['projectId'],N=u===ua(0x106)||u==='id'&&(K===null||K===void 0x0?void 0x0:K[ua(0x103)]('owningObject'));if(f!==undefined&&N){const W=yield getServices(I,f),{elements:B,nextPageCursor:J}=yield W();return{'choices':B,'defaultValue':E,'pagination':{'nextPageCursor':J,'loadMore':W}};}const P=a===null||a===void 0x0?void 0x0:a[ua(0x103)](ua(0xe1));if(P){const V=y=>__awaiter(this,void 0x0,void 0x0,function*(){const uD=ua;var U;const S=yield I[uD(0x11a)][uD(0xe1)][uD(0xe7)]({});return(U=S[uD(0x117)][uD(0xf4)])===null||U===void 0x0?void 0x0:U['map'](n=>n[uD(0x10d)])['find'](n=>n[uD(0x10d)]===y);});if(u===ua(0x10d)){const y=yield I['get'][ua(0xe1)][ua(0xe7)]({}),U=(z=y[ua(0x117)][ua(0xf4)])===null||z===void 0x0?void 0x0:z['map'](S=>S[ua(0x10d)]);return{'choices':U,'defaultValue':E};}if(u===ua(0xfd)&&(x===null||x===void 0x0?void 0x0:x['type'])!==undefined){const S=(H=yield V(x[ua(0x10d)]))===null||H===void 0x0?void 0x0:H['versions'],n=S!==undefined?['latest',...S]:undefined;return{'choices':n,'defaultValue':E};}if(u===ua(0xed)&&(x===null||x===void 0x0?void 0x0:x['type'])!==undefined){const L=(C=(s=yield V(x[ua(0x10d)]))===null||s===void 0x0?void 0x0:s['resources'])===null||C===void 0x0?void 0x0:C[ua(0xed)];return{'choices':L===null||L===void 0x0?void 0x0:L[ua(0xea)],'defaultValue':L===null||L===void 0x0?void 0x0:L['default']};}if(u===ua(0xdf)&&(x===null||x===void 0x0?void 0x0:x[ua(0x10d)])!==undefined){const g=(b=(p=yield V(x[ua(0x10d)]))===null||p===void 0x0?void 0x0:p[ua(0xef)])===null||b===void 0x0?void 0x0:b[ua(0xdf)];return{'choices':g===null||g===void 0x0?void 0x0:g[ua(0xea)],'defaultValue':g===null||g===void 0x0?void 0x0:g[ua(0xf1)]};}}if(u===ua(0xe0)&&(D===null||D===void 0x0?void 0x0:D[ua(0x110)])!==undefined){const l=yield getAddons(I,D===null||D===void 0x0?void 0x0:D[ua(0x110)]),{elements:Z,nextPageCursor:G}=yield l();return{'choices':Z,'defaultValue':E,'pagination':{'nextPageCursor':G,'loadMore':l}};}if(u===ua(0xf2)&&(D===null||D===void 0x0?void 0x0:D[ua(0x110)])!==undefined&&((i=x===null||x===void 0x0?void 0x0:x[ua(0x111)])===null||i===void 0x0?void 0x0:i[ua(0xe0)])!==undefined){const O=yield getAddonBackups(I,D===null||D===void 0x0?void 0x0:D[ua(0x110)],(j=x===null||x===void 0x0?void 0x0:x[ua(0x111)])===null||j===void 0x0?void 0x0:j['addonId']),{elements:Q,nextPageCursor:d}=yield O();return{'choices':Q,'defaultValue':E,'pagination':{'nextPageCursor':d,'loadMore':O}};}const m=(A=D===null||D===void 0x0?void 0x0:D[ua(0xe0)])!==null&&A!==void 0x0?A:(F=x===null||x===void 0x0?void 0x0:x[ua(0x114)])===null||F===void 0x0?void 0x0:F['addonId'];if((a===null||a===void 0x0?void 0x0:a['join'](''))==='updateaddonversion'&&u===ua(0xfd)&&(D===null||D===void 0x0?void 0x0:D[ua(0x110)])!==undefined&&m!==undefined){const {upgradeTo:v}=(yield I[ua(0x11a)][ua(0xe1)][ua(0xfd)]({'parameters':{'addonId':m,'projectId':D===null||D===void 0x0?void 0x0:D[ua(0x110)]}}))[ua(0x117)];if(v===undefined||v['length']<=0x0){(0x0,utils_1[ua(0x115)])(ua(0xe9));throw new Error();}return{'choices':v[ua(0xec)](t=>t[ua(0xfd)]),'defaultValue':E};}if(u===ua(0xe3)){const t=yield I[ua(0xe8)][ua(0xfa)]({}),Y=t[ua(0x117)][ua(0xfa)][ua(0xec)](u0=>u0===null||u0===void 0x0?void 0x0:u0['id']);return{'choices':Y,'defaultValue':E};}if(((a===null||a===void 0x0?void 0x0:a[ua(0x103)](ua(0xde)))||(a===null||a===void 0x0?void 0x0:a[ua(0x103)]('secret')))&&u===ua(0xf8)&&m!==undefined&&(D===null||D===void 0x0?void 0x0:D[ua(0x110)])!==undefined){const u0=(yield I['get']['addon']['credentials']({'parameters':{'addonId':m,'projectId':D===null||D===void 0x0?void 0x0:D['projectId']}}))[ua(0x117)];return{'choices':[...(X=Object[ua(0xf7)](u0===null||u0===void 0x0?void 0x0:u0[ua(0x10a)]))!==null&&X!==void 0x0?X:[],...(T=Object[ua(0xf7)](u0===null||u0===void 0x0?void 0x0:u0['secrets']))!==null&&T!==void 0x0?T:[]]};}}catch(u1){}return{'choices':undefined,'defaultValue':E};});}exports[a0u3(0x118)]=fetchResourceList;function a0u(){const uK=['options','region','map','storage','backups','resources','13452740qDtRvW','default','backupId','apply','addonTypes','then','pagination','keys','keyName','next','templates','deploymentPlan','value','version','internalId','1910VTIASI','8hpCcpD','credentials','8616288mMtVuk','includes','throw','868UsfvPK','serviceId','209835uqaQOP','nextPageCursor','__esModule','envs','logSink','15335PKHYGG','type','regions','2359581ezYKrJ','projectId','source','868145Grrbpg','plans','addonDependencies','warning','done','data','fetchResourceList','3237824MvuvJV','get','secretLink','replicas','addonId','addon','__awaiter','templateId','addons','projects','cursor','types','list','No\x20available\x20versions\x20to\x20upgrade\x20to.'];a0u=function(){return uK;};return a0u();}
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';const a1CI=a1D;(function(C,D){const Ci=a1D,V=C();while(!![]){try{const Y=parseInt(Ci(0x11c))/0x1*(-parseInt(Ci(0x1ab))/0x2)+-parseInt(Ci(0x1c6))/0x3+parseInt(Ci(0x1b3))/0x4*(parseInt(Ci(0x149))/0x5)+-parseInt(Ci(0x10e))/0x6+parseInt(Ci(0x199))/0x7+parseInt(Ci(0x185))/0x8*(parseInt(Ci(0x107))/0x9)+parseInt(Ci(0x1a6))/0xa;if(Y===D)break;else V['push'](V['shift']());}catch(e){V['push'](V['shift']());}}}(a1C,0x49c61));var __createBinding=this&&this[a1CI(0xe3)]||(Object[a1CI(0xcb)]?function(C,D,V,Y){const Cm=a1CI;if(Y===undefined)Y=V;var e=Object[Cm(0x19c)](D,V);(!e||(Cm(0x12e)in e?!D['__esModule']:e[Cm(0x16d)]||e[Cm(0x122)]))&&(e={'enumerable':!![],'get':function(){return D[V];}}),Object[Cm(0xc6)](C,Y,e);}:function(C,D,V,Y){if(Y===undefined)Y=V;C[Y]=D[V];}),__setModuleDefault=this&&this[a1CI(0x18e)]||(Object[a1CI(0xcb)]?function(C,D){const CQ=a1CI;Object[CQ(0xc6)](C,CQ(0x105),{'enumerable':!![],'value':D});}:function(C,D){const CJ=a1CI;C[CJ(0x105)]=D;}),__importStar=this&&this['__importStar']||function(C){const Cz=a1CI;if(C&&C[Cz(0x19a)])return C;var D={};if(C!=null){for(var V in C)if(V!=='default'&&Object[Cz(0x156)][Cz(0x17a)]['call'](C,V))__createBinding(D,C,V);}return __setModuleDefault(D,C),D;},__awaiter=this&&this['__awaiter']||function(C,D,V,Y){function e(T){return T instanceof V?T:new V(function(W){W(T);});}return new(V||(V=Promise))(function(T,W){const Ck=a1D;function f(i){const Cu=a1D;try{G(Y[Cu(0xd1)](i));}catch(I){W(I);}}function q(i){const CL=a1D;try{G(Y[CL(0x138)](i));}catch(I){W(I);}}function G(i){const Cv=a1D;i[Cv(0x16c)]?T(i['value']):e(i['value'])[Cv(0x1b0)](f,q);}G((Y=Y['apply'](C,D||[]))[Ck(0xd1)]());});},__importDefault=this&&this['__importDefault']||function(C){return C&&C['__esModule']?C:{'default':C};};function a1C(){const CN=['Update\x20Northflank\x20','getCommand','.yaml','buildId','getCurrentJobName','url','backups','log','askForBuild','get','CliLogs','CliMetrics','endsWith','./defaults','yml','resourceTagId','find','askForLogSink','yaml','throw','./port-forward','query','status','stringify','askGeneric','noDefaults','replace','runs','-f,\x20--file\x20<file-path>','subdomainPath','addons','Northflank\x20cli\x20version:\x20','has','regions','version','branches','85whDJWG','project','Display\x20help\x20for\x20command','cursor','template','hasNext','ApiClient','isArray','path','docsTagsPath','credentialId','northflank','execCmd','prototype','map','credentials','green','domainId','pln','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','method','name','upperFirst','custom-columns=','subdomain','getCurrentContext','volume','-v,\x20--version','toLowerCase','required','parse','restores','includes','--verbose','boolean','done','writable','js-yaml','set','secrets','toUpperCase','exitCode','./logs','vol','askForService','resource','requiredPermissions','handleJsonOutput','forEach','hasOwnProperty','askForSubdomainPath','projectId','chalk','getCurrentServiceName','portFwdCmd','/docs/v1/api/','filter','repo','verbose','getProgram','24XDzVRB','opt','domain','request','brn','quiet','volumeId','some','enablePositionalOptions','__setModuleDefault','prj','invoices','contextProvider','logs','data','pipelineId','askForVolume','./metrics','askForProject','\x0a>\x20Token\x20permissions\x20required:\x20','3803009FouaUn','__esModule','\x20--','getOwnPropertyDescriptor','ApiClientFileContextProvider','askForSubdomain','getMetricsCommand',',\x20-','./utils','backupId','askConfirm','host','askForTag','12190310ishQVj','length','asyncSequential','split','./formatting/command-overview','2710YOdaWs','addon','isString','grey','nonInteractiveEndpoint','then','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','./pagination/pagination-helper','13516mUhImA','error','moveCursor','templateId','credential','pop','\x20properties','option','handleYamlOutput','skipValidation','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','CliExec','\x0a\x09details\x20:','jobId','stdout','Documentation:\x20','printAsTable','safeLoad','alias','1466904mNbhIF','there\x20are\x20more\x20rows,\x20load?','askForCredentials','output','commands','consoleFormat','plan','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','getLogsCommand','svc','PaginationHelper','addonId','repositories','defineProperty','keys','sort','description','job','create','Resource\x20was\x20not\x20deleted.','services','endpoints','askForJob','adn','next','./context/contextCommands','getOwnPropertyNames','message','./formatting/console-format-helpers','warning','page','getCommandOverview','concat','join','clearLine','body','tpl','repos','domains','helpOption','rgn','file','__createBinding','.json','serviceId','CliContext','entries','customUserAgent','opts','startsWith','login','parseAsync','bind','deleteWarningPrompt','VERBOSE:\x20Using\x20endpoint\x20->\x20','rawResponse','File\x20does\x20not\x20exist:\x20','contexts','argv','base','runId','setPathVars','omit','getAll','isEqual','inv','askForJobRun','../package.json','jobs','commander','loadAll','askForAddonBackup','json','checkUpdate','askForTemplateRun','logSinkId','default','scrt','472086wxZOBb','askForTemplate','./exec','repository','-i,\x20--input\x20<resource-def>','underline','askForDomain','3611838ZYOQRj','templateRunId','currentOffset','=>\x20running\x20command\x20with:\x20','dmn','secretId','service','isPaginatedEndpoint','force','assertContextExisting','type','invoice','addHelpText','volumes','431StMTYk','addCommand','@northflank/js-client','\x20Northflank\x20resources','list','assign','configurable','(HTTP\x20status\x20code:\x20','api.'];a1C=function(){return CN;};return a1C();}Object[a1CI(0xc6)](exports,a1CI(0x19a),{'value':!![]}),exports[a1CI(0x184)]=void 0x0;const js_client_1=require(a1CI(0x11e)),commander_1=__importDefault(require(a1CI(0xfe))),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require(a1CI(0x17d))),_=__importStar(require('lodash')),contextCommands_1=require(a1CI(0xd2)),utils_1=require(a1CI(0x1a1)),defaults=__importStar(require(a1CI(0x132))),inquirer_helper_1=require('./inquirer-helper'),console_format_helpers_1=require(a1CI(0xd5)),command_overview_1=require(a1CI(0x1aa)),port_forward_1=require(a1CI(0x139)),exec_1=require(a1CI(0x109)),logs_1=require(a1CI(0x173)),metrics_1=require(a1CI(0x196)),pagination_helper_1=require(a1CI(0x1b2)),yaml=require(a1CI(0x16e)),pgk=require(a1CI(0xfc)),getProgram=C=>{const Cs=a1CI,D=new commander_1[(Cs(0x105))]['Command'](Cs(0x154));D[Cs(0xc9)](Cs(0x1bd)),D[Cs(0x18d)](!![]),D[Cs(0x147)](Cs(0x144)+chalk_1[Cs(0x105)][Cs(0x10c)](pgk[Cs(0x147)]),Cs(0x164),'Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli');const V=new js_client_1['ApiClient'](C,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1['customUserAgent']}),Y=new contextCommands_1[(Cs(0xe6))](V),e=new port_forward_1['CliPortForward'](C),T=new exec_1[(Cs(0x1be))](C),W=new logs_1[(Cs(0x12f))](C),f=new metrics_1[(Cs(0x130))](C);return D[Cs(0x11d)](e[Cs(0x17f)]),D[Cs(0x11d)](T[Cs(0x155)]),D[Cs(0x11d)](Y[Cs(0xeb)]),D[Cs(0x11d)](Y[Cs(0xf2)]),generateCommands(V,V[Cs(0xce)],D,W,f),D[Cs(0x11d)]((0x0,command_overview_1[Cs(0xd8)])(D)),D['addHelpCommand'](!![],Cs(0x14b)),D[Cs(0xe0)](undefined,Cs(0x14b)),D;};exports[a1CI(0x184)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Ch=a1CI;try{const C=new js_client_1[(Ch(0x19d))]();yield(0x0,utils_1[Ch(0x102)])(C);const D=(0x0,exports[Ch(0x184)])(C);yield D[Ch(0xec)](process[Ch(0xf3)]);}catch(V){(0x0,utils_1['error'])(Ch(0x1b1)+V[Ch(0xd4)]),process[Ch(0xf3)][Ch(0x135)](Y=>Y===Ch(0x16a))&&console[Ch(0x12c)](V),process[Ch(0x172)]=0x1;}}))());function a1D(C,D){const V=a1C();return a1D=function(Y,e){Y=Y-0xbe;let T=V[Y];return T;},a1D(C,D);}function isListCommand(C){const Cj=a1CI,D=[['get',Cj(0x1ac),Cj(0x12b)],['get',Cj(0xca),Cj(0x140)]];return C[Cj(0x135)](V=>V===Cj(0x120))||D[Cj(0x18c)](V=>_[Cj(0xf9)](C,V));}function generateCommands(C,D,V,Y,e,T=defaults['defaults'],W=[]){const CU=a1CI,f=new inquirer_helper_1['InquirerHelper'](new js_client_1[(CU(0x14f))](C[CU(0x191)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[CU(0xe8)]}));function q(m,Q){const Ct=CU;return m[Ct(0x166)]!==![]&&Q===undefined;}function G(m,Q){const Cy=CU,{opt:J,name:z}=m,u=J['default'],L=q(J,u),v=t=>t['length']>0x1?'--'+t:'-'+t,k=J===null||J===void 0x0?void 0x0:J[Cy(0x1c5)],s=k?_[Cy(0x150)](k)?'-'+(k===null||k===void 0x0?void 0x0:k[Cy(0x157)](t=>v(t))[Cy(0xda)](Cy(0x1a0)))+',':''+v(k):'',h=L?'':'OPTIONAL:\x20',j=typeof J['type']==='boolean'||J[Cy(0x118)]===Cy(0x16b)?s+Cy(0x19b)+z:s+Cy(0x19b)+z+'\x20<'+z[Cy(0x171)]()+'>',U=h+J['description'];Q[Cy(0x1ba)](j,U,u);}function i(m,Q){const CZ=CU;if(Q[CZ(0x1ca)][CZ(0x18c)](J=>J[CZ(0x15e)]()===CZ(0x192)))return;_['isEqual'](m,[CZ(0x12e),CZ(0x114)])&&(Q['addCommand'](Y[CZ(0xc1)](CZ(0x114))),Q[CZ(0x11d)](e[CZ(0x19f)](CZ(0x114))),Q['addCommand'](Y[CZ(0xc1)](CZ(0x114),!![])),Q[CZ(0x11d)](e[CZ(0x19f)]('service',!![]))),_['isEqual'](m,[CZ(0x12e),'job'])&&(Q[CZ(0x11d)](Y[CZ(0xc1)](CZ(0xca))),Q[CZ(0x11d)](e['getMetricsCommand'](CZ(0xca))),Q[CZ(0x11d)](Y[CZ(0xc1)](CZ(0xca),!![])),Q[CZ(0x11d)](e[CZ(0x19f)](CZ(0xca),!![]))),_['isEqual'](m,[CZ(0x12e),CZ(0x1ac)])&&(Q['addCommand'](Y['getLogsCommand'](CZ(0x1ac))),Q[CZ(0x11d)](e[CZ(0x19f)](CZ(0x1ac)))),_['isEqual'](m,['get',CZ(0x1ac),'backup'])&&Q[CZ(0x11d)](Y['getLogsCommand'](CZ(0x1ac),![],!![])),_[CZ(0xf9)](m,[CZ(0x12e),CZ(0x1ac),CZ(0x168)])&&Q['addCommand'](Y[CZ(0xc1)](CZ(0x1ac),![],!![],!![]));}return Object[CU(0xd3)](T)[CU(0x179)](m=>{const CX=CU,Q=D[m],J=T[m],z=W[CX(0xd9)]([m]);function u(Z,X){const Cp=CX,p=Object[Cp(0xd3)](Z||{});p[Cp(0x157)](M=>{return{'name':M,'opt':Z[M]};})[Cp(0xc8)]((M,n)=>!q(M[Cp(0x186)])?!q(n[Cp(0x186)])?0x0:0x1:-0x1)[Cp(0x179)](M=>{G(M,X);});}function L(Z,X){const CM=CX,p=[[CM(0x14a),'projects',CM(0x18f)],[CM(0x114),CM(0xcd),CM(0xc2)],[CM(0x158),CM(0x1b7),'cred'],[CM(0x1ac),CM(0x143),CM(0xd0)],[CM(0xca),CM(0xfd)],[CM(0xbe),'plans',CM(0x15b)],['region',CM(0x146),CM(0xe1)],[CM(0x187),CM(0xdf),CM(0x112)],['secret',CM(0x170),CM(0x106)],[CM(0x11b),CM(0x163),CM(0x174)],[CM(0x148),'branch',CM(0x189)],[CM(0x119),CM(0x190),CM(0xfa)],[CM(0x14d),'templates',CM(0xdd)],[CM(0xde),CM(0x10a),CM(0xc5),CM(0x182)],['tag','tags']],M=p[CM(0x135)](n=>n[CM(0x169)](X));if(M!==undefined)Z['aliases'](M[CM(0x181)](n=>n!==X));}function v(Z){var X,p;return __awaiter(this,void 0x0,void 0x0,function*(){const Cn=a1D,M={},{contextProvider:n}=C,r=z['includes']('delete'),l=Z[Cn(0x13e)]===!![];function b(P,g,E){var o,w;return __awaiter(this,void 0x0,void 0x0,function*(){const Cr=a1D;if(_[Cr(0x145)]((w=(o=J[Cr(0x186)])===null||o===void 0x0?void 0x0:o['path'])!==null&&w!==void 0x0?w:{},P)){const A=!l&&!r&&E?E():undefined,N=Z[P]||A||(yield g());_['set'](M,P,N);}});}return yield(0x0,utils_1[Cn(0x1a8)])(Object[Cn(0xe7)]((p=(X=J[Cn(0x186)])===null||X===void 0x0?void 0x0:X[Cn(0x151)])!==null&&p!==void 0x0?p:{}),([P,g])=>__awaiter(this,void 0x0,void 0x0,function*(){const Cl=Cn;var E;const o=M===null||M===void 0x0?void 0x0:M[Cl(0x17c)],w=M===null||M===void 0x0?void 0x0:M['templateId'];switch(P){case Cl(0x17c):return yield b(Cl(0x17c),f[Cl(0x197)][Cl(0xed)](f),n['getCurrentProjectName']['bind'](n));case'serviceId':return yield b(Cl(0xe5),f[Cl(0x175)](o)[Cl(0xed)](f),n[Cl(0x17e)][Cl(0xed)](n));case'addonId':return yield b(Cl(0xc4),f['askForAddon'](o)[Cl(0xed)](f));case'jobId':return yield b(Cl(0x1c0),f[Cl(0xcf)](o)[Cl(0xed)](f),n[Cl(0x129)]['bind'](n));case Cl(0xf5):return yield b(Cl(0xf5),f[Cl(0xfb)](M['jobId'],o,![])[Cl(0xed)](f));case Cl(0x113):return yield b(Cl(0x113),f['askForSecret'](o)[Cl(0xed)](f));case Cl(0x187):case'domainId':return yield b('domain',f[Cl(0x10d)][Cl(0xed)](f));case Cl(0x153):return yield b(Cl(0x153),f[Cl(0x1c8)]['bind'](f));case Cl(0x18b):return yield b(Cl(0x18b),f[Cl(0x195)](o)[Cl(0xed)](f));case Cl(0x161):return yield b('subdomain',f[Cl(0x19e)](M[Cl(0x187)])[Cl(0xed)](f));case'subdomainId':return yield b('subdomainId',f[Cl(0x19e)](M[Cl(0x15a)])[Cl(0xed)](f));case Cl(0x142):return yield b(Cl(0x142),f[Cl(0x17b)](M[Cl(0x187)],(E=M['subdomain'])!==null&&E!==void 0x0?E:M['subdomainId'])['bind'](f));case Cl(0x1a2):return yield b('backupId',f[Cl(0x100)](o,M[Cl(0xc4)])[Cl(0xed)](f));case Cl(0x128):return yield b('buildId',f[Cl(0x12d)](o,M[Cl(0xe5)],M[Cl(0x1c0)])[Cl(0xed)](f));case Cl(0x1b6):return yield b('templateId',f[Cl(0x108)]()[Cl(0xed)](f));case Cl(0x10f):return yield b('templateRunId',f[Cl(0x103)](w)[Cl(0xed)](f));case'logSinkId':return yield b(Cl(0x104),f[Cl(0x136)]()[Cl(0xed)](f));case Cl(0x194):return yield b(Cl(0x194),f['askForPipeline'](o)['bind'](f));case Cl(0x134):return yield b('resourceTagId',f[Cl(0x1a5)]()['bind'](f));default:return yield b(P,f[Cl(0x13d)](P,g===null||g===void 0x0?void 0x0:g[Cl(0xc9)])[Cl(0xed)](f));}})),M;});}function k(Z){var X,p,M;return __awaiter(this,void 0x0,void 0x0,function*(){const Cb=a1D,n={},r=((X=J['opt'])===null||X===void 0x0?void 0x0:X['isPaginatedEndpoint'])?defaults['paginationArgs']:{},l=Object[Cb(0x121)](Object[Cb(0x121)]({},(M=(p=J[Cb(0x186)])===null||p===void 0x0?void 0x0:p[Cb(0x13a)])!==null&&M!==void 0x0?M:{}),r),b=Object[Cb(0xc7)](l)[Cb(0x181)](P=>P!==Cb(0xff));return yield(0x0,utils_1[Cb(0x1a8)])(b,P=>__awaiter(this,void 0x0,void 0x0,function*(){const CP=Cb;if(Z[P]!==undefined)return _[CP(0x16f)](n,P,Z[P]);})),n;});}function s(){const Cg=CX;switch(z[0x0]){case Cg(0x12e):return'Get\x20information\x20about\x20Northflank\x20'+(z[0x1]||Cg(0x176))+'s';case'update':return Cg(0x125)+(z[0x1]||'resource')+Cg(0x1b9);default:return _[Cg(0x15f)](m)+Cg(0x11f);}}function h(Z,X){const CE=CX;var p,M,n,r,l,b,P,g;if(!X){const H=(0x0,utils_1['getCommand'])()[CE(0x15e)](_['kebabCase'](m))[CE(0xc9)](s());return L(H,m),H;}const E=(Z===null||Z===void 0x0?void 0x0:Z[CE(0x177)])?chalk_1[CE(0x105)][CE(0x1ae)](CE(0x198)+Z[CE(0x177)]):'',o=C[CE(0x191)][CE(0x162)](),w=o!==undefined&&((p=J===null||J===void 0x0?void 0x0:J[CE(0x186)])===null||p===void 0x0?void 0x0:p[CE(0x152)])!==undefined,A=o===null||o===void 0x0?void 0x0:o[CE(0x1a4)][CE(0x13f)](CE(0x124),''),N=w?CE(0x1c2)+A+CE(0x180)+((M=J===null||J===void 0x0?void 0x0:J['opt'])===null||M===void 0x0?void 0x0:M[CE(0x152)]):'',S=(Z===null||Z===void 0x0?void 0x0:Z[CE(0xc9)])||'',B=(0x0,utils_1[CE(0x126)])(!![])[CE(0x15e)](_['kebabCase'](m))['description'](S)[CE(0x11a)]('after',[E,N][CE(0xda)]('\x0a'));return L(B,m),(((n=J[CE(0x186)])===null||n===void 0x0?void 0x0:n[CE(0xdc)])||((r=J[CE(0x186)])===null||r===void 0x0?void 0x0:r[CE(0x1af)]))&&(B[CE(0x1ba)](CE(0x141),'File\x20to\x20load\x20resource\x20json\x20from'),B['option'](CE(0x10b),CE(0x15c))),u((l=J[CE(0x186)])===null||l===void 0x0?void 0x0:l[CE(0x151)],B),u((b=J[CE(0x186)])===null||b===void 0x0?void 0x0:b[CE(0x13a)],B),((P=J[CE(0x186)])===null||P===void 0x0?void 0x0:P[CE(0x115)])&&u(defaults['paginationArgs'],B),u((g=J[CE(0x186)])===null||g===void 0x0?void 0x0:g[CE(0xf4)],B),B['action'](()=>__awaiter(this,void 0x0,void 0x0,function*(){const Co=CE;var K,c,d,O;(0x0,utils_1[Co(0x117)])(C);const F=B[Co(0xe9)](),a=F[Co(0xd7)]!==undefined||F[Co(0x14c)]!==undefined;if(F[Co(0xff)]===!![]&&a)throw new Error('Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27');const R=F===null||F===void 0x0?void 0x0:F['output'],x=R==='json',C0=R===Co(0x137)||R===Co(0x133),C1=yield v(F);f[Co(0xf6)](C1);const C2=yield k(F),C3=Object[Co(0xc7)]((c=(K=J[Co(0x186)])===null||K===void 0x0?void 0x0:K[Co(0x151)])!==null&&c!==void 0x0?c:{})['map'](C8=>C8+'='+chalk_1[Co(0x105)][Co(0x159)](C1[C8]))[Co(0xda)](',\x20');if(C3[Co(0x1a7)]>0x0&&!x&&!C0){const C8=Co(0x111)+C3;console[Co(0x12c)](C8);}const C4=((d=J[Co(0x186)])===null||d===void 0x0?void 0x0:d[Co(0xdc)])||((O=J['opt'])===null||O===void 0x0?void 0x0:O['nonInteractiveEndpoint'])?yield yield I(F,J,z):undefined;if(!F[Co(0x116)]&&z[Co(0x169)]('delete')&&!(yield f[Co(0xee)]())){(0x0,utils_1[Co(0xd6)])(Co(0xcc));return;}const C5=new pagination_helper_1[(Co(0xc3))](Q,C1,C2,C4),C6=F[Co(0xff)]||(F[Co(0x1c9)]===Co(0x101)||F[Co(0x1c9)]==='yaml')&&!a,C7=C6?yield C5[Co(0xf8)]():yield C5['getNext']();if(F===null||F===void 0x0?void 0x0:F[Co(0x183)]){const C9=C7[Co(0x188)];console[Co(0x12c)](Co(0xef)+C9[Co(0x15d)][Co(0x171)]()+':'+C9[Co(0x12a)]);if(C4!==undefined)console[Co(0x12c)]('VERBOSE:\x20Request\x20body\x20->\x20'+C4);}if(C7[Co(0x1b4)]){const {details:CC,id:CD,message:CV,status:CY}=C7['error'],Ce=CC?Co(0x1bf)+JSON[Co(0x13c)](CC):'',CT=CD?',\x20NF\x20error\x20id:\x20'+CD:'',CW=Co(0x123)+CY+CT+')';throw new Error('API\x20request\x20failed\x0a\x09Message:\x20'+CV+'\x20'+CW+Ce);}printCallResult(F,x,C7[Co(0x193)],C0,z,R,![],0x0,C7[Co(0xf0)][Co(0x13b)]);if(!F[Co(0x18a)]&&!C6&&!a&&C5[Co(0x14e)]())while(C5['hasNext']()){const Cf=yield f[Co(0x1a3)](Co(0x1c7));if(Cf){process[Co(0x1c1)][Co(0x1b5)](0x0,-0x1),process['stdout'][Co(0xdb)](0x1);const Cq=C5[Co(0x110)],CG=yield C5['getNext']();printCallResult(F,x,CG[Co(0x193)],C0,z,R,!![],Cq,CG[Co(0xf0)][Co(0x13b)]);}else return;}})),B;}const j=_['has'](J,CX(0x186)),U=Q,t=h(U,j);i(z,t),V['addCommand'](t);const y=_[CX(0xf7)](J,CX(0x186));Object['keys'](y)[CX(0x1a7)]>0x0&&generateCommands(C,Q,t,Y,e,y,z);});function I(m,Q,J){var z;return __awaiter(this,void 0x0,void 0x0,function*(){const Cw=a1D,{input:u,file:L}=m;if(u!==undefined)try{return JSON['parse'](u);}catch(v){try{return yaml['safeLoad'](u);}catch(k){throw new Error(Cw(0xbf));}}if(L!==undefined){if(!fs_1[Cw(0x105)]['existsSync'](L))throw new Error(Cw(0xf1)+L);const s=fs_1[Cw(0x105)]['readFileSync'](L)['toString']();let h;try{if(_[Cw(0x1ad)](s)){if(m[Cw(0xe2)][Cw(0x131)](Cw(0xe4)))h=JSON[Cw(0x167)](s);else{if(m['file'][Cw(0x131)](Cw(0x127))||m[Cw(0xe2)]['endsWith'](Cw(0x133)))h=yaml[Cw(0x1c4)](s);else throw new Error('Unknown\x20input\x20file\x20type:\x20'+m[Cw(0xe2)][Cw(0x1a9)]('.')[Cw(0x1b8)]());}}else h=s;return h;}catch(j){throw new Error('Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20'+j[Cw(0xd4)]);}}if((z=Q===null||Q===void 0x0?void 0x0:Q[Cw(0x186)])===null||z===void 0x0?void 0x0:z['nonInteractiveEndpoint'])throw new Error(Cw(0xc0));return yield f['retrievePayloadViaInteractiveCli'](Q,{'cmdPath':J,'skipValidation':m[Cw(0x1bc)]});});}}const printCallResult=(C,D,V,Y,e,T,W,f,q)=>{const CA=a1CI;if(!(C===null||C===void 0x0?void 0x0:C[CA(0x18a)])){if(D)(0x0,console_format_helpers_1[CA(0x178)])(C===null||C===void 0x0?void 0x0:C['output'],V);else{if(Y)(0x0,console_format_helpers_1[CA(0x1bb)])(C===null||C===void 0x0?void 0x0:C[CA(0x1c9)],V);else{if(isListCommand(e)){const G=(T===null||T===void 0x0?void 0x0:T[CA(0xea)](CA(0x160)))?T[CA(0x13f)]('custom-columns=','')[CA(0x1a9)](',')['map'](J=>J[CA(0x165)]()):undefined,i=e[e[CA(0x1a7)]-0x1],I=''+i+(i['endsWith']('s')?'':'s'),m=_[CA(0x15f)](I),Q=_['has'](V,I)?V[I]:V;(0x0,console_format_helpers_1[CA(0x1c3)])(Q,m,G,W,f);}else console[CA(0x12c)]((0x0,console_format_helpers_1[CA(0x1cb)])(V,q));}}}};
|
|
2
|
+
'use strict';const a1ub=a1I;(function(u,I){const up=a1I,a=u();while(!![]){try{const x=-parseInt(up(0x1de))/0x1+-parseInt(up(0x1bd))/0x2+-parseInt(up(0x181))/0x3+parseInt(up(0x1ce))/0x4*(-parseInt(up(0x10e))/0x5)+-parseInt(up(0x1c0))/0x6+-parseInt(up(0x112))/0x7+parseInt(up(0x108))/0x8;if(x===I)break;else a['push'](a['shift']());}catch(D){a['push'](a['shift']());}}}(a1u,0xae5e0));function a1I(u,I){const a=a1u();return a1I=function(x,D){x=x-0xe7;let K=a[x];return K;},a1I(u,I);}var __createBinding=this&&this[a1ub(0x1b1)]||(Object[a1ub(0x120)]?function(u,I,a,x){const ui=a1ub;if(x===undefined)x=a;var D=Object[ui(0x130)](I,a);(!D||(ui(0x152)in D?!I['__esModule']:D[ui(0xfc)]||D[ui(0x12b)]))&&(D={'enumerable':!![],'get':function(){return I[a];}}),Object[ui(0x16d)](u,x,D);}:function(u,I,a,x){if(x===undefined)x=a;u[x]=I[a];}),__setModuleDefault=this&&this[a1ub(0x1f1)]||(Object['create']?function(u,I){const uj=a1ub;Object['defineProperty'](u,uj(0x189),{'enumerable':!![],'value':I});}:function(u,I){const uA=a1ub;u[uA(0x189)]=I;}),__importStar=this&&this[a1ub(0x10b)]||function(u){const uF=a1ub;if(u&&u[uF(0xef)])return u;var I={};if(u!=null){for(var a in u)if(a!=='default'&&Object['prototype'][uF(0x122)]['call'](u,a))__createBinding(I,u,a);}return __setModuleDefault(I,u),I;},__awaiter=this&&this[a1ub(0x167)]||function(u,I,a,x){function D(K){return K instanceof a?K:new a(function(z){z(K);});}return new(a||(a=Promise))(function(K,z){const uf=a1I;function H(p){const uX=a1I;try{C(x[uX(0x1c6)](p));}catch(b){z(b);}}function s(p){const uT=a1I;try{C(x[uT(0x199)](p));}catch(b){z(b);}}function C(p){const uE=a1I;p[uE(0x1a9)]?K(p[uE(0x126)]):D(p['value'])[uE(0x147)](H,s);}C((x=x[uf(0x1bf)](u,I||[]))['next']());});},__importDefault=this&&this['__importDefault']||function(u){const uN=a1ub;return u&&u[uN(0xef)]?u:{'default':u};};Object[a1ub(0x16d)](exports,a1ub(0xef),{'value':!![]}),exports[a1ub(0x1dd)]=void 0x0;const js_client_1=require(a1ub(0x103)),commander_1=__importDefault(require(a1ub(0x16b))),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require(a1ub(0xfb))),_=__importStar(require('lodash')),contextCommands_1=require('./context/contextCommands'),utils_1=require(a1ub(0xe7)),defaults=__importStar(require('./defaults')),inquirer_helper_1=require(a1ub(0xff)),console_format_helpers_1=require(a1ub(0x141)),command_overview_1=require(a1ub(0x11d)),port_forward_1=require(a1ub(0xeb)),exec_1=require(a1ub(0x143)),logs_1=require(a1ub(0x1f3)),metrics_1=require(a1ub(0x175)),pagination_helper_1=require('./pagination/pagination-helper'),yaml=require(a1ub(0x12c)),pgk=require('../package.json'),getProgram=u=>{const uP=a1ub,I=new commander_1['default']['Command']('northflank');I[uP(0x1ad)](uP(0x196)),I[uP(0x188)](!![]),I['version']('Northflank\x20cli\x20version:\x20'+chalk_1[uP(0x189)][uP(0x161)](pgk['version']),uP(0x100),uP(0x155));const a=new js_client_1['ApiClient'](u,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1['customUserAgent']}),x=new contextCommands_1[(uP(0x11b))](a),D=new port_forward_1[(uP(0x18f))](u),K=new exec_1[(uP(0x115))](u),z=new logs_1[(uP(0x1b2))](u),H=new metrics_1['CliMetrics'](u);return I[uP(0x1d0)](D[uP(0xf5)]),I['addCommand'](K[uP(0x1c5)]),I[uP(0x1d0)](x[uP(0x182)]),I['addCommand'](x[uP(0x1ea)]),generateCommands(a,a[uP(0x1e0)],I,z,H),I['addCommand']((0x0,command_overview_1[uP(0x18b)])(I)),I[uP(0x184)](!![],uP(0x1a2)),I[uP(0x117)](undefined,uP(0x1a2)),I;};exports[a1ub(0x1dd)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const um=a1ub;try{const u=new js_client_1[(um(0x150))]();yield(0x0,utils_1[um(0x1dc)])(u);const I=(0x0,exports[um(0x1dd)])(u);yield I[um(0x177)](process[um(0x190)]);}catch(a){(0x0,utils_1['error'])(um(0x1cb)+a[um(0xf7)]),process['argv']['find'](x=>x===um(0x14a))&&console[um(0x173)](a),process['exitCode']=0x1;}}))());function isListCommand(u){const uk=a1ub,I=[[uk(0x152),uk(0x136),uk(0x1c4)],['get',uk(0x1aa),uk(0x1b6)]];return u[uk(0x148)](a=>a===uk(0xf6))||I[uk(0x1c1)](a=>_[uk(0x1cd)](u,a));}function a1u(){const uL=['pipelineId','dmn','=>\x20running\x20command\x20with:\x20','opt','log','askGeneric','./metrics','addonId','parseAsync','getAll','buildId','askForDomain','resourceTagId','InquirerHelper','length','loadAll','secretId','.json','749415OxKGKH','login','askForTag','addHelpCommand',',\x20NF\x20error\x20id:\x20','credentialId','grey','enablePositionalOptions','default','scrt','getCommandOverview','getLogsCommand','askForLogSink','commands','CliPortForward','argv','\x0a\x09details\x20:','\x20Northflank\x20resources','repositories','askForJobRun','invoices','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','askForService','\x20properties','throw','filter','addons','toLowerCase','getCurrentContext','assign','aliases','domains','Update\x20Northflank\x20','Display\x20help\x20for\x20command','requiredPermissions','regions','replace','custom-columns=','host','Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27','done','job','rawResponse','kebabCase','description','moveCursor','region','inv','__createBinding','CliLogs','brn','API\x20request\x20failed\x0a\x09Message:\x20','currentOffset','runs','clusterId','setPathVars','isArray','vol','consoleFormat','service','1269092kuSHpt','Get\x20information\x20about\x20Northflank\x20','apply','5946096SSXygD','some','handleYamlOutput','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','backups','execCmd','next','option','askForPipeline','volumes','hasNext','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','docsTagsPath','isEqual','4aUTsaY','assertContextExisting','addCommand','runId','safeLoad','resource','volumeId','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','concat','repo','method','skipValidation','query','cursor','checkUpdate','getProgram','539200WaSbrF','parse','endpoints','endsWith','logSinkId','set','getMetricsCommand','green','\x20--','includes','json','askForProject','contexts','addHelpText','status','toString','getCurrentProjectName','keys','branches','__setModuleDefault','File\x20to\x20load\x20resource\x20json\x20from','./logs','api.','./utils','there\x20are\x20more\x20rows,\x20load?','forEach','join','./port-forward','verbose','output','services','__esModule','branch','opts','split','domain','(HTTP\x20status\x20code:\x20','portFwdCmd','list','message','rgn','has','subdomainPath','chalk','writable','\x0a>\x20Token\x20permissions\x20required:\x20','tpl','./inquirer-helper','-v,\x20--version','secret','upperFirst','@northflank/js-client','nonInteractiveEndpoint','alias','cred','deleteWarningPrompt','26808544ZfIvvb','warning','getCurrentServiceName','__importStar','retrievePayloadViaInteractiveCli','subdomainId','790300pfQzZn','page','action','clearLine','449631WuEMJV','askForSecret','repository','CliExec','template','helpOption','body','tag','name','CliContext','askForTemplateRun','./formatting/command-overview','secrets','stdout','create','invoice','hasOwnProperty','required','prj','contextProvider','value','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','base','project','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','configurable','js-yaml','bind','yml','jobId','getOwnPropertyDescriptor','toUpperCase','delete','serviceId','backupId','pln','addon','error','type','svc','data','path','quiet','paginationArgs','plan','templateId','plans','./formatting/console-format-helpers','restores','./exec','isPaginatedEndpoint','force','subdomain','then','find','askForCredentials','--verbose','url','after',',\x20-','.yaml','adn','ApiClientFileContextProvider','pop','get','getCurrentJobName','omit','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','entries','getNext','file','askConfirm','askForSubdomainPath','templates','update','askForJob','askForTemplate','isString','-f,\x20--file\x20<file-path>','underline','yaml','askForAddon','map','projectId','domainId','__awaiter','templateRunId','asyncSequential','askForSubdomain','commander','boolean','defineProperty','getOwnPropertyNames'];a1u=function(){return uL;};return a1u();}function generateCommands(u,I,a,x,D,K=defaults['defaults'],z=[]){const uR=a1ub,H=new inquirer_helper_1[(uR(0x17c))](new js_client_1['ApiClient'](u[uR(0x125)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent']}));function s(i,j){const uq=uR;return i[uq(0x123)]!==![]&&j===undefined;}function C(i,j){const uc=uR,{opt:A,name:F}=i,X=A[uc(0x189)],T=s(A,X),E=R=>R[uc(0x17d)]>0x1?'--'+R:'-'+R,f=A===null||A===void 0x0?void 0x0:A[uc(0x105)],N=f?_[uc(0x1b9)](f)?'-'+(f===null||f===void 0x0?void 0x0:f[uc(0x164)](R=>E(R))[uc(0xea)](uc(0x14d)))+',':''+E(f):'',P=T?'':'OPTIONAL:\x20',m=typeof A[uc(0x138)]===uc(0x16c)||A[uc(0x138)]===uc(0x16c)?N+uc(0x1e6)+F:N+uc(0x1e6)+F+'\x20<'+F[uc(0x131)]()+'>',k=P+A[uc(0x1ad)];j['option'](m,k,X);}function p(i,j){const uM=uR;if(j[uM(0x18e)][uM(0x1c1)](A=>A[uM(0x11a)]()==='logs'))return;_['isEqual'](i,['get',uM(0x1bc)])&&(j[uM(0x1d0)](x[uM(0x18c)](uM(0x1bc))),j[uM(0x1d0)](D[uM(0x1e4)](uM(0x1bc))),j[uM(0x1d0)](x[uM(0x18c)](uM(0x1bc),!![])),j[uM(0x1d0)](D[uM(0x1e4)]('service',!![]))),_['isEqual'](i,[uM(0x152),uM(0x1aa)])&&(j[uM(0x1d0)](x['getLogsCommand'](uM(0x1aa))),j['addCommand'](D[uM(0x1e4)]('job')),j[uM(0x1d0)](x[uM(0x18c)](uM(0x1aa),!![])),j[uM(0x1d0)](D[uM(0x1e4)]('job',!![]))),_['isEqual'](i,[uM(0x152),'addon'])&&(j[uM(0x1d0)](x[uM(0x18c)]('addon')),j[uM(0x1d0)](D[uM(0x1e4)]('addon'))),_[uM(0x1cd)](i,['get',uM(0x136),'backup'])&&j[uM(0x1d0)](x['getLogsCommand'](uM(0x136),![],!![])),_[uM(0x1cd)](i,['get',uM(0x136),uM(0x142)])&&j['addCommand'](x['getLogsCommand'](uM(0x136),![],!![],!![]));}return Object[uR(0x16e)](K)[uR(0xe9)](i=>{const ur=uR,j=I[i],A=K[i],F=z[ur(0x1d6)]([i]);function X(c,M){const uo=ur,r=Object[uo(0x16e)](c||{});r[uo(0x164)](o=>{return{'name':o,'opt':c[o]};})['sort']((o,w)=>!s(o[uo(0x172)])?!s(w[uo(0x172)])?0x0:0x1:-0x1)['forEach'](o=>{C(o,M);});}function T(c,M){const uw=ur,r=[[uw(0x129),'projects',uw(0x124)],[uw(0x1bc),uw(0xee),uw(0x139)],['credentials','credential',uw(0x106)],['addon',uw(0x19b),uw(0x14f)],['job','jobs'],[uw(0x13e),uw(0x140),uw(0x135)],[uw(0x1af),uw(0x1a4),uw(0xf8)],['domain',uw(0x1a0),uw(0x170)],[uw(0x101),uw(0x11e),uw(0x18a)],[uw(0x1c9),'volume',uw(0x1ba)],[uw(0x1f0),uw(0xf0),uw(0x1b3)],[uw(0x121),uw(0x195),uw(0x1b0)],[uw(0x116),uw(0x15b),uw(0xfe)],['repos',uw(0x114),uw(0x193),uw(0x1d7)],[uw(0x119),'tags']],o=r[uw(0x148)](w=>w[uw(0x1e7)](M));if(o!==undefined)c[uw(0x19f)](o[uw(0x19a)](w=>w!==M));}function E(c){var M,r;return __awaiter(this,void 0x0,void 0x0,function*(){const uh=a1I,o={},{contextProvider:w}=u,h=F[uh(0x1e7)](uh(0x132)),W=c['noDefaults']===!![];function B(J,V,y){var e,U;return __awaiter(this,void 0x0,void 0x0,function*(){const uW=a1I;if(_[uW(0xf9)]((U=(e=A[uW(0x172)])===null||e===void 0x0?void 0x0:e[uW(0x13b)])!==null&&U!==void 0x0?U:{},J)){const S=!W&&!h&&y?y():undefined,n=c[J]||S||(yield V());_[uW(0x1e3)](o,J,n);}});}return yield(0x0,utils_1[uh(0x169)])(Object[uh(0x156)]((r=(M=A[uh(0x172)])===null||M===void 0x0?void 0x0:M[uh(0x13b)])!==null&&r!==void 0x0?r:{}),([J,V])=>__awaiter(this,void 0x0,void 0x0,function*(){const uB=uh;var y;const e=o===null||o===void 0x0?void 0x0:o[uB(0x165)],U=o===null||o===void 0x0?void 0x0:o[uB(0x13f)];switch(J){case uB(0x165):return yield B('projectId',H[uB(0x1e9)][uB(0x12d)](H),w[uB(0x1ee)][uB(0x12d)](w));case uB(0x133):return yield B(uB(0x133),H[uB(0x197)](e)['bind'](H),w[uB(0x10a)][uB(0x12d)](w));case uB(0x176):return yield B(uB(0x176),H[uB(0x163)](e)[uB(0x12d)](H));case uB(0x12f):return yield B(uB(0x12f),H[uB(0x15d)](e)['bind'](H),w[uB(0x153)][uB(0x12d)](w));case'runId':return yield B(uB(0x1d1),H[uB(0x194)](o[uB(0x12f)],e,![])[uB(0x12d)](H));case uB(0x17f):return yield B('secretId',H[uB(0x113)](e)[uB(0x12d)](H));case'domain':case uB(0x166):return yield B(uB(0xf3),H[uB(0x17a)][uB(0x12d)](H));case'credentialId':return yield B(uB(0x186),H[uB(0x149)][uB(0x12d)](H));case uB(0x1d4):return yield B(uB(0x1d4),H['askForVolume'](e)[uB(0x12d)](H));case uB(0x146):return yield B(uB(0x146),H['askForSubdomain'](o[uB(0xf3)])['bind'](H));case uB(0x10d):return yield B('subdomainId',H[uB(0x16a)](o['domainId'])[uB(0x12d)](H));case'subdomainPath':return yield B(uB(0xfa),H[uB(0x15a)](o[uB(0xf3)],(y=o[uB(0x146)])!==null&&y!==void 0x0?y:o[uB(0x10d)])[uB(0x12d)](H));case uB(0x134):return yield B(uB(0x134),H['askForAddonBackup'](e,o[uB(0x176)])[uB(0x12d)](H));case uB(0x179):return yield B('buildId',H['askForBuild'](e,o[uB(0x133)],o[uB(0x12f)])[uB(0x12d)](H));case uB(0x13f):return yield B(uB(0x13f),H[uB(0x15e)]()[uB(0x12d)](H));case uB(0x168):return yield B(uB(0x168),H[uB(0x11c)](U)['bind'](H));case uB(0x1e2):return yield B(uB(0x1e2),H[uB(0x18d)]()[uB(0x12d)](H));case'pipelineId':return yield B(uB(0x16f),H[uB(0x1c8)](e)['bind'](H));case uB(0x17b):return yield B(uB(0x17b),H[uB(0x183)]()[uB(0x12d)](H));case'clusterId':return yield B(uB(0x1b7),H['askForClusterId']()[uB(0x12d)](H));default:return yield B(J,H[uB(0x174)](J,V===null||V===void 0x0?void 0x0:V[uB(0x1ad)])['bind'](H));}})),o;});}function f(c){var M,r,o;return __awaiter(this,void 0x0,void 0x0,function*(){const uJ=a1I,w={},h=((M=A[uJ(0x172)])===null||M===void 0x0?void 0x0:M[uJ(0x144)])?defaults[uJ(0x13d)]:{},W=Object['assign'](Object[uJ(0x19e)]({},(o=(r=A['opt'])===null||r===void 0x0?void 0x0:r[uJ(0x1da)])!==null&&o!==void 0x0?o:{}),h),B=Object[uJ(0x1ef)](W)['filter'](J=>J!==uJ(0x17e));return yield(0x0,utils_1[uJ(0x169)])(B,J=>__awaiter(this,void 0x0,void 0x0,function*(){const uV=uJ;if(c[J]!==undefined)return _[uV(0x1e3)](w,J,c[J]);})),w;});}function N(){const uy=ur;switch(F[0x0]){case'get':return uy(0x1be)+(F[0x1]||uy(0x1d3))+'s';case uy(0x15c):return uy(0x1a1)+(F[0x1]||uy(0x1d3))+uy(0x198);default:return _[uy(0x102)](i)+uy(0x192);}}function P(c,M){const ue=ur;var r,o,w,h,W,B,J,V;if(!M){const l=(0x0,utils_1['getCommand'])()[ue(0x11a)](_[ue(0x1ac)](i))['description'](N());return T(l,i),l;}const y=(c===null||c===void 0x0?void 0x0:c['requiredPermissions'])?chalk_1[ue(0x189)][ue(0x187)](ue(0xfd)+c[ue(0x1a3)]):'',e=u[ue(0x125)][ue(0x19d)](),U=e!==undefined&&((r=A===null||A===void 0x0?void 0x0:A[ue(0x172)])===null||r===void 0x0?void 0x0:r[ue(0x1cc)])!==undefined,S=e===null||e===void 0x0?void 0x0:e[ue(0x1a7)][ue(0x1a5)](ue(0x1f4),''),n=U?'Documentation:\x20'+S+'/docs/v1/api/'+((o=A===null||A===void 0x0?void 0x0:A[ue(0x172)])===null||o===void 0x0?void 0x0:o[ue(0x1cc)]):'',L=(c===null||c===void 0x0?void 0x0:c[ue(0x1ad)])||'',g=(0x0,utils_1['getCommand'])(!![])[ue(0x11a)](_[ue(0x1ac)](i))[ue(0x1ad)](L)[ue(0x1eb)](ue(0x14c),[y,n][ue(0xea)]('\x0a'));return T(g,i),(((w=A[ue(0x172)])===null||w===void 0x0?void 0x0:w[ue(0x118)])||((h=A[ue(0x172)])===null||h===void 0x0?void 0x0:h[ue(0x104)]))&&(g[ue(0x1c7)](ue(0x160),ue(0x1f2)),g['option']('-i,\x20--input\x20<resource-def>',ue(0x127))),X((W=A[ue(0x172)])===null||W===void 0x0?void 0x0:W[ue(0x13b)],g),X((B=A[ue(0x172)])===null||B===void 0x0?void 0x0:B[ue(0x1da)],g),((J=A['opt'])===null||J===void 0x0?void 0x0:J[ue(0x144)])&&X(defaults['paginationArgs'],g),X((V=A[ue(0x172)])===null||V===void 0x0?void 0x0:V[ue(0x128)],g),g[ue(0x110)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const uU=ue;var Z,G,O,Q;(0x0,utils_1[uU(0x1cf)])(u);const d=g[uU(0xf1)](),v=d[uU(0x10f)]!==undefined||d[uU(0x1db)]!==undefined;if(d[uU(0x17e)]===!![]&&v)throw new Error(uU(0x1a8));const t=d===null||d===void 0x0?void 0x0:d['output'],Y=t===uU(0x1e8),u0=t===uU(0x162)||t==='yml',u1=yield E(d);H[uU(0x1b8)](u1);const u2=yield f(d),u3=Object[uU(0x1ef)]((G=(Z=A['opt'])===null||Z===void 0x0?void 0x0:Z[uU(0x13b)])!==null&&G!==void 0x0?G:{})['map'](u8=>u8+'='+chalk_1[uU(0x189)][uU(0x1e5)](u1[u8]))['join'](',\x20');if(u3[uU(0x17d)]>0x0&&!Y&&!u0){const u8=uU(0x171)+u3;console[uU(0x173)](u8);}const u4=((O=A[uU(0x172)])===null||O===void 0x0?void 0x0:O[uU(0x118)])||((Q=A['opt'])===null||Q===void 0x0?void 0x0:Q[uU(0x104)])?yield yield b(d,A,F):undefined;if(!d[uU(0x145)]&&F[uU(0x1e7)](uU(0x132))&&!(yield H[uU(0x107)]())){(0x0,utils_1[uU(0x109)])('Resource\x20was\x20not\x20deleted.');return;}const u5=new pagination_helper_1['PaginationHelper'](j,u1,u2,u4),u6=d[uU(0x17e)]||(d['output']==='json'||d[uU(0xed)]===uU(0x162))&&!v,u7=u6?yield u5[uU(0x178)]():yield u5[uU(0x157)]();if(d===null||d===void 0x0?void 0x0:d[uU(0xec)]){const u9=u7['request'];console[uU(0x173)]('VERBOSE:\x20Using\x20endpoint\x20->\x20'+u9[uU(0x1d8)][uU(0x131)]()+':'+u9[uU(0x14b)]);if(u4!==undefined)console[uU(0x173)]('VERBOSE:\x20Request\x20body\x20->\x20'+u4);}if(u7[uU(0x137)]){const {details:uu,id:uI,message:ua,status:ux}=u7[uU(0x137)],uD=uu?uU(0x191)+JSON['stringify'](uu):'',uK=uI?uU(0x185)+uI:'',uz=uU(0xf4)+ux+uK+')';throw new Error(uU(0x1b4)+ua+'\x20'+uz+uD);}printCallResult(d,Y,u7[uU(0x13a)],u0,F,t,![],0x0,u7[uU(0x1ab)][uU(0x1ec)]);if(!d[uU(0x13c)]&&!u6&&!v&&u5[uU(0x1ca)]())while(u5[uU(0x1ca)]()){const uH=yield H[uU(0x159)](uU(0xe8));if(uH){process[uU(0x11f)][uU(0x1ae)](0x0,-0x1),process[uU(0x11f)][uU(0x111)](0x1);const us=u5[uU(0x1b5)],uC=yield u5[uU(0x157)]();printCallResult(d,Y,uC[uU(0x13a)],u0,F,t,!![],us,uC['rawResponse'][uU(0x1ec)]);}else return;}})),g;}const m=_[ur(0xf9)](A,ur(0x172)),k=j,R=P(k,m);p(F,R),a[ur(0x1d0)](R);const q=_[ur(0x154)](A,'opt');Object[ur(0x1ef)](q)[ur(0x17d)]>0x0&&generateCommands(u,j,R,x,D,q,F);});function b(i,j,A){var F;return __awaiter(this,void 0x0,void 0x0,function*(){const uS=a1I,{input:X,file:T}=i;if(X!==undefined)try{return JSON[uS(0x1df)](X);}catch(E){try{return yaml[uS(0x1d2)](X);}catch(f){throw new Error(uS(0x12a));}}if(T!==undefined){if(!fs_1[uS(0x189)]['existsSync'](T))throw new Error('File\x20does\x20not\x20exist:\x20'+T);const N=fs_1[uS(0x189)]['readFileSync'](T)[uS(0x1ed)]();let P;try{if(_[uS(0x15f)](N)){if(i[uS(0x158)][uS(0x1e1)](uS(0x180)))P=JSON[uS(0x1df)](N);else{if(i[uS(0x158)]['endsWith'](uS(0x14e))||i[uS(0x158)][uS(0x1e1)](uS(0x12e)))P=yaml['safeLoad'](N);else throw new Error('Unknown\x20input\x20file\x20type:\x20'+i[uS(0x158)]['split']('.')[uS(0x151)]());}}else P=N;return P;}catch(m){throw new Error(uS(0x1c3)+m[uS(0xf7)]);}}if((F=j===null||j===void 0x0?void 0x0:j[uS(0x172)])===null||F===void 0x0?void 0x0:F[uS(0x104)])throw new Error(uS(0x1d5));return yield H[uS(0x10c)](j,{'cmdPath':A,'skipValidation':i[uS(0x1d9)]});});}}const printCallResult=(u,I,a,x,D,K,z,H,s)=>{const un=a1ub;if(!(u===null||u===void 0x0?void 0x0:u['quiet'])){if(I)(0x0,console_format_helpers_1['handleJsonOutput'])(u===null||u===void 0x0?void 0x0:u[un(0xed)],a);else{if(x)(0x0,console_format_helpers_1[un(0x1c2)])(u===null||u===void 0x0?void 0x0:u[un(0xed)],a);else{if(isListCommand(D)){const C=(K===null||K===void 0x0?void 0x0:K['startsWith'](un(0x1a6)))?K[un(0x1a5)](un(0x1a6),'')[un(0xf2)](',')[un(0x164)](A=>A[un(0x19c)]()):undefined,p=D[D[un(0x17d)]-0x1],b=''+p+(p[un(0x1e1)]('s')?'':'s'),i=_[un(0x102)](b),j=_[un(0xf9)](a,b)?a[b]:a;(0x0,console_format_helpers_1['printAsTable'])(j,i,C,z,H);}else console[un(0x173)]((0x0,console_format_helpers_1[un(0x1bb)])(a,s));}}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const a2h=a2D;(function(C,D){const s=a2D,V=C();while(!![]){try{const Y=parseInt(s(0x1da))/0x1+-parseInt(s(0x1bc))/0x2+parseInt(s(0x1b1))/0x3*(parseInt(s(0x1a1))/0x4)+-parseInt(s(0x1d4))/0x5+-parseInt(s(0x199))/0x6*(-parseInt(s(0x18a))/0x7)+-parseInt(s(0x1c8))/0x8*(parseInt(s(0x1cd))/0x9)+parseInt(s(0x1c3))/0xa*(parseInt(s(0x1ef))/0xb);if(Y===D)break;else V['push'](V['shift']());}catch(e){V['push'](V['shift']());}}}(a2C,0x305c4));var __createBinding=this&&this[a2h(0x1d0)]||(Object[a2h(0x18c)]?function(C,D,V,Y){const j=a2h;if(Y===undefined)Y=V;var e=Object[j(0x1b3)](D,V);(!e||(j(0x1e7)in e?!D[j(0x1a0)]:e[j(0x168)]||e['configurable']))&&(e={'enumerable':!![],'get':function(){return D[V];}}),Object['defineProperty'](C,Y,e);}:function(C,D,V,Y){if(Y===undefined)Y=V;C[Y]=D[V];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object['create']?function(C,D){const U=a2h;Object[U(0x16a)](C,U(0x1df),{'enumerable':!![],'value':D});}:function(C,D){const t=a2h;C[t(0x1df)]=D;}),__importStar=this&&this[a2h(0x1e8)]||function(C){const y=a2h;if(C&&C[y(0x1a0)])return C;var D={};if(C!=null){for(var V in C)if(V!==y(0x1df)&&Object['prototype'][y(0x1ca)][y(0x192)](C,V))__createBinding(D,C,V);}return __setModuleDefault(D,C),D;},__awaiter=this&&this[a2h(0x197)]||function(C,D,V,Y){function e(T){return T instanceof V?T:new V(function(W){W(T);});}return new(V||(V=Promise))(function(T,W){const M=a2D;function f(i){const Z=a2D;try{G(Y[Z(0x188)](i));}catch(I){W(I);}}function q(i){const X=a2D;try{G(Y[X(0x181)](i));}catch(I){W(I);}}function G(i){const p=a2D;i[p(0x18d)]?T(i[p(0x1e0)]):e(i[p(0x1e0)])['then'](f,q);}G((Y=Y[M(0x19b)](C,D||[]))['next']());});},__importDefault=this&&this['__importDefault']||function(C){return C&&C['__esModule']?C:{'default':C};};function a2C(){const R=['defineProperty','startLogin','-i,\x20--id\x20[ID]','error','confirm','delete','InquirerHelper','Use\x20project\x20with\x20id:','description','finally','message','use','italic','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','.\x20Using\x20fallback.','Remove\x20a\x20context','loginPrompt','../login/browser-login','https://api.northflank.com','browserLogin','browser\x20login','\x27\x20successfully\x20updated.','throw','askForContext','useContext','../utils','Retrieve\x20and\x20update\x20local\x20context\x20settings.','--all','contextProvider','next','moveCursor','497aNJJYu','tokenPrompt','create','done','map','Update\x20token\x20for\x20current\x20context','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','host\x20url\x20for\x20this\x20context','call','--host\x20[HOST]','Bearer\x20','apiClient','autologin-','__awaiter','browser-opened','20118KIvqVG','clearLine','apply','override','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','chalk','GET','__esModule','615248oiyJnI','Choose\x20the\x20context\x20to\x20','token','-t,\x20--token\x20[TOKEN]','--do-not-open-browser','useServiceId','defaultBaseUrl','doNotOpenBrowser','action','all','project','Shows\x20full\x20context\x20information\x20(including\x20tokens)','then','sort','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','updateToken','6sLlCNR','update-token','getOwnPropertyDescriptor','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','loadContextWrapper','host','current','printAsTable','Local\x20context\x20\x27','NorthflankApiBrowserLogin','sessionToken=********','578238rZDUav','Changed\x20current\x20context\x20to\x20','contexts','addCommand','Use\x20manual\x20login\x20with\x20API\x20token','getCurrentProjectName','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','120DTWsKI','Local\x20context\x20name\x20to\x20remove.','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','set','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','593856MiNGwC','CliContext','hasOwnProperty','\x27\x20successfully\x20removed.','node-fetch','9elkLOR','contextAvailable','dir','__createBinding','../inquirer-helper','name','getCurrentToken','1535975PJoBoz','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','tokenLogin','log','Name\x20for\x20login\x20context','getProjectName','11171tgwQBS','getCurrentBaseUrl','sanitiseHostname','askForProject','replace','default','value','getCommand','alias','removeContext','success','prompt','Contexts','get','__importStar','retry','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','-n,\x20--name\x20[NAME]','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','fullUrl','remove','285791DaHRbZ','Token\x20for\x20this\x20context','apiTokenLogin','Use\x20job\x20with\x20id:','service','\x0aSuccessfully\x20logged\x20in\x20using\x20','inquirer','valueOf','/v1/login','verifyToken','option','stdout','set-token','\x20(current)','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','list','askForJob','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','writable','--token-login'];a2C=function(){return R;};return a2C();}Object[a2h(0x16a)](exports,a2h(0x1a0),{'value':!![]}),exports[a2h(0x1c9)]=void 0x0;const _=__importStar(require('lodash')),node_fetch_1=__importDefault(require(a2h(0x1cc))),chalk_1=__importDefault(require(a2h(0x19e))),utils_1=require(a2h(0x184)),inquirer_helper_1=require(a2h(0x1d1)),console_format_helpers_1=require('../formatting/console-format-helpers'),browser_login_1=require(a2h(0x17c)),inquirer=require(a2h(0x1f5));class CliContext{constructor(C,D=a2h(0x17d)){const n=a2h;this['defaultBaseUrl']=D,this[n(0x1dc)]=I=>{let m=I;return!/^https?:\/\//i['test'](m)&&(m='https://'+m),m=m['replace'](/\/+$/,''),m;},this[n(0x195)]=C;const V=new inquirer_helper_1[(n(0x170))](C);this['login']=(0x0,utils_1['getCommand'])()[n(0x1d2)]('login')['description'](n(0x178))[n(0x1f9)](n(0x169),n(0x1c0),![])['option'](n(0x1a5),n(0x1b4),![])[n(0x1f9)](n(0x1eb),n(0x1d8))[n(0x1f9)](n(0x1a4),'Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used')[n(0x1f9)](n(0x193),n(0x191),this[n(0x1a7)])['option']('--override',n(0x1c5),![])[n(0x1a9)](I=>__awaiter(this,void 0x0,void 0x0,function*(){const r=n;_[r(0x1c6)](I,'host',this[r(0x1dc)](I[r(0x1b6)]));const m=I[r(0x1d6)]||I[r(0x1a3)]!==undefined,{name:Q,host:J,token:z,override:u}=m?yield this[r(0x1f1)](I,V):yield this[r(0x17e)](I,V);try{yield this['apiClient'][r(0x187)]['addContext']({'name':Q,'host':J,'token':z},u);}catch(L){(0x0,utils_1[r(0x16d)])(L[r(0x174)]);return;}if(!(yield this[r(0x1f8)]()))(0x0,utils_1[r(0x16d)])(r(0x1ec)),yield this[r(0x195)][r(0x187)][r(0x1e3)](Q);else{const v=m?'token\x20login':r(0x17f),k=r(0x1f4)+v+',\x20added\x20context\x20with\x20name\x20'+chalk_1[r(0x1df)][r(0x176)](Q)+'\x20(api\x20host:\x20'+J+')';(0x0,utils_1['success'])(k);}})),this['contexts']=(0x0,utils_1[n(0x1e1)])()[n(0x1d2)]('context')['description'](n(0x185))[n(0x1e2)](n(0x1be))[n(0x1e2)]('ctx');const Y=(0x0,utils_1['getCommand'])()[n(0x1d2)](n(0x165))[n(0x1d2)]('ls')[n(0x172)]('List\x20all\x20available\x20contexts')[n(0x1f9)](n(0x186),n(0x1ac))[n(0x1a9)](I=>__awaiter(this,void 0x0,void 0x0,function*(){const l=n;console['log'](C[l(0x187)]['getInfo']());const m=C[l(0x187)][l(0x1b5)]();if(I[l(0x1aa)]===!![]){console[l(0x1cf)](m);return;}const Q=m[l(0x1b7)],J=m['contexts'][l(0x1ae)]((z,u)=>z[l(0x1d2)]===Q?-0x1:u[l(0x1d2)]===Q?0x1:0x0)[l(0x18e)](z=>{const b=l,u=Q===z[b(0x1d2)]?b(0x1fc):'';return{'Name':''+z[b(0x1d2)]+u,'Host':z[b(0x1b6)],'Default\x20Project':z[b(0x1ab)]||'-','Default\x20Service':z[b(0x1f3)]||'-'};});(0x0,console_format_helpers_1[l(0x1b8)])(J,l(0x1e6));})),e=(0x0,utils_1[n(0x1e1)])();e['name']('use')[n(0x172)]('Switch\x20between\x20your\x20local\x20contexts')[n(0x1f9)](n(0x1eb),'Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name')['action'](I=>__awaiter(this,void 0x0,void 0x0,function*(){const P=n,m=(I===null||I===void 0x0?void 0x0:I[P(0x1d2)])||(yield this['askForContext'](P(0x175)));yield this[P(0x195)][P(0x187)][P(0x183)](m),(0x0,utils_1[P(0x1e4)])(P(0x1bd)+m);}));const T=n(0x16c),W=(0x0,utils_1[n(0x1e1)])()['name'](n(0x1ab))[n(0x172)]('Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context')[n(0x1f9)](T,n(0x190))[n(0x1a9)](I=>__awaiter(this,void 0x0,void 0x0,function*(){const g=n,m=(I===null||I===void 0x0?void 0x0:I['id'])||(yield V[g(0x1dd)]());yield this[g(0x195)][g(0x187)]['useProjectId'](m),console['log'](g(0x171),m);})),f=(0x0,utils_1[n(0x1e1)])()['name'](n(0x1f3))['description']('Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context')['option'](T,n(0x1c2))[n(0x1a9)](I=>__awaiter(this,void 0x0,void 0x0,function*(){const E=n,m=(I===null||I===void 0x0?void 0x0:I['id'])||(yield V['askForService'](this[E(0x1d9)]())());console[E(0x1d7)]('Use\x20service\x20with\x20id:',m),yield this[E(0x195)]['contextProvider'][E(0x1a6)](m);})),q=(0x0,utils_1[n(0x1e1)])()[n(0x1d2)]('job')['description'](n(0x164))[n(0x1f9)](T,n(0x1af))[n(0x1a9)](I=>__awaiter(this,void 0x0,void 0x0,function*(){const o=n,m=(I===null||I===void 0x0?void 0x0:I['id'])||(yield V[o(0x166)](this[o(0x1d9)]())());console[o(0x1d7)](o(0x1f2),m),yield this[o(0x195)][o(0x187)]['useJobId'](m);}));e[n(0x1bf)](W),e['addCommand'](q),e[n(0x1bf)](f);const G=(0x0,utils_1['getCommand'])()['name']('remove')['alias'](n(0x16f))[n(0x1e2)]('rm')[n(0x172)](n(0x17a))[n(0x1f9)](T,n(0x1c4))['action'](I=>__awaiter(this,void 0x0,void 0x0,function*(){const w=n;var m;const Q=(I===null||I===void 0x0?void 0x0:I['id'])||(yield this[w(0x182)](w(0x1ee))),J=(m=this[w(0x195)][w(0x187)]['getCurrentContext']())===null||m===void 0x0?void 0x0:m[w(0x1d2)];yield this['apiClient'][w(0x187)][w(0x1e3)](Q),(0x0,utils_1[w(0x1e4)])(w(0x1b9)+Q+w(0x1cb));if(!this[w(0x1ce)]()){(0x0,utils_1['warning'])('No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.');return;}if(J===Q){const z=(I===null||I===void 0x0?void 0x0:I[w(0x1d2)])||(yield this['askForContext']('use\x20from\x20now\x20on'));yield this[w(0x195)]['contextProvider'][w(0x183)](z),(0x0,utils_1[w(0x1e4)])(w(0x1bd)+z);}})),i=(0x0,utils_1['getCommand'])()[n(0x1d2)](n(0x1b2))[n(0x1e2)](n(0x1fb))['description'](n(0x18f))[n(0x1f9)]('-t,\x20--token\x20[TOKEN]',n(0x1f0))[n(0x1a9)](I=>__awaiter(this,void 0x0,void 0x0,function*(){const A=n,{contextProvider:m}=this[A(0x195)],Q=(I===null||I===void 0x0?void 0x0:I['token'])||(yield V[A(0x18b)]()),J=m[A(0x1d3)]();yield m[A(0x1b0)](Q);if(yield this['verifyToken']())(0x0,utils_1[A(0x1e4)])('Token\x20for\x20current\x20context\x20\x27'+m['getCurrentName']()+A(0x180));else{if(J)yield m[A(0x1b0)](J);(0x0,utils_1['error'])(A(0x1ea));}}));this['contexts'][n(0x1bf)](Y),this['contexts'][n(0x1bf)](e),this[n(0x1be)][n(0x1bf)](G),this[n(0x1be)][n(0x1bf)](i);}[a2h(0x17e)](C,D){var V,Y,e,T;return __awaiter(this,void 0x0,void 0x0,function*(){const N=a2D,W=!C[N(0x1a8)],f=(V=C[N(0x1b6)])!==null&&V!==void 0x0?V:this[N(0x1a7)],q=new browser_login_1[(N(0x1ba))](f,W);let G;q['on'](N(0x198),({url:Q})=>{const S=N;if(W){const J=Q[S(0x1de)](/sessionToken=.*/,S(0x1bb));console['log'](S(0x177)+J+')'),G=inquirer[S(0x1e5)]([{'type':S(0x16e),'name':S(0x1ed),'message':S(0x1d5),'default':![]}]),G[S(0x1ad)](z=>{const B=S;process[B(0x1fa)][B(0x189)](0x0,-0x1),process[B(0x1fa)][B(0x19a)](0x1),z[B(0x1ed)]&&console[B(0x1d7)](B(0x1c7)+Q+'\x20');});}else console[S(0x1d7)]('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+Q+'\x20');});const {token:i,contextName:I}=yield q[N(0x16b)]()['catch'](Q=>__awaiter(this,void 0x0,void 0x0,function*(){const H=N;(0x0,utils_1[H(0x16d)])('Error\x20occured\x20during\x20browser\x20login:\x20'+Q[H(0x174)]+H(0x179));const J=yield this[H(0x1f1)](C,D);return{'token':J[H(0x1a3)],'contextName':J[H(0x1d2)]};}))[N(0x173)](()=>{if(G)G['ui']['close']();}),m=(e=(Y=C[N(0x1d2)])!==null&&Y!==void 0x0?Y:I)!==null&&e!==void 0x0?e:N(0x196)+new Date()[N(0x1f6)]();return{'name':m,'token':i,'host':f,'override':(T=C[N(0x19c)])!==null&&T!==void 0x0?T:![]};});}['apiTokenLogin'](C,D){return __awaiter(this,void 0x0,void 0x0,function*(){const K=a2D,V=this[K(0x195)]['contextProvider']['loadContextWrapper']()[K(0x1be)],{name:Y,token:e,host:T,override:W}=yield D[K(0x17b)](C,V);return{'name':Y,'token':e,'host':T,'override':W};});}[a2h(0x1d9)](){const c=a2h,C=this[c(0x195)][c(0x187)][c(0x1c1)]();if(C===undefined)throw new Error(c(0x167));return C;}['askForContext'](C){return __awaiter(this,void 0x0,void 0x0,function*(){const d=a2D;if(!this[d(0x1ce)]())throw new Error(d(0x19d));const D=this['apiClient'][d(0x187)]['loadContextWrapper']()[d(0x1be)]['map'](Y=>Y[d(0x1d2)]),V=D['length']>0x4?'search-list':d(0x165);return(yield inquirer['prompt']([{'type':V,'name':d(0x1d2),'message':d(0x1a2)+C+':','choices':D}]))[d(0x1d2)];});}[a2h(0x1ce)](){const O=a2h;return this[O(0x195)][O(0x187)]['loadContextWrapper']()[O(0x1be)]['length']>0x0;}[a2h(0x1f8)](){return __awaiter(this,void 0x0,void 0x0,function*(){const F=a2D;try{const C=this[F(0x195)][F(0x187)][F(0x1db)](),D=this[F(0x195)][F(0x187)][F(0x1d3)](),V=C+F(0x1f7),Y={'Authorization':F(0x194)+D},T=yield(0x0,utils_1[F(0x1e9)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const a=F;return(0x0,node_fetch_1['default'])(V,{'method':a(0x19f),'timeout':0xbb8,'headers':Y});}));if(T['ok'])return!![];return![];}catch(W){return![];}});}}function a2D(C,D){const V=a2C();return a2D=function(Y,e){Y=Y-0x164;let T=V[Y];return T;},a2D(C,D);}exports[a2h(0x1c9)]=CliContext;
|
|
1
|
+
'use strict';const a2P=a2I;(function(u,I){const N=a2I,a=u();while(!![]){try{const x=parseInt(N(0x124))/0x1*(-parseInt(N(0x14c))/0x2)+-parseInt(N(0xee))/0x3+-parseInt(N(0xd4))/0x4*(-parseInt(N(0x10f))/0x5)+-parseInt(N(0xdf))/0x6+parseInt(N(0xfd))/0x7+parseInt(N(0x105))/0x8+parseInt(N(0xf9))/0x9*(parseInt(N(0xce))/0xa);if(x===I)break;else a['push'](a['shift']());}catch(D){a['push'](a['shift']());}}}(a2u,0x6d8ca));var __createBinding=this&&this[a2P(0x115)]||(Object[a2P(0x108)]?function(u,I,a,x){const m=a2P;if(x===undefined)x=a;var D=Object[m(0x119)](I,a);(!D||('get'in D?!I[m(0x116)]:D[m(0xf1)]||D['configurable']))&&(D={'enumerable':!![],'get':function(){return I[a];}}),Object['defineProperty'](u,x,D);}:function(u,I,a,x){if(x===undefined)x=a;u[x]=I[a];}),__setModuleDefault=this&&this[a2P(0x100)]||(Object[a2P(0x108)]?function(u,I){const k=a2P;Object[k(0x10c)](u,k(0x127),{'enumerable':!![],'value':I});}:function(u,I){u['default']=I;}),__importStar=this&&this['__importStar']||function(u){const R=a2P;if(u&&u[R(0x116)])return u;var I={};if(u!=null){for(var a in u)if(a!==R(0x127)&&Object[R(0x139)]['hasOwnProperty'][R(0x121)](u,a))__createBinding(I,u,a);}return __setModuleDefault(I,u),I;},__awaiter=this&&this[a2P(0x11c)]||function(u,I,a,x){function D(K){return K instanceof a?K:new a(function(z){z(K);});}return new(a||(a=Promise))(function(K,z){function H(p){const q=a2I;try{C(x[q(0xe2)](p));}catch(b){z(b);}}function s(p){const c=a2I;try{C(x[c(0x11d)](p));}catch(b){z(b);}}function C(p){const M=a2I;p['done']?K(p[M(0x134)]):D(p[M(0x134)])[M(0xe7)](H,s);}C((x=x['apply'](u,I||[]))['next']());});},__importDefault=this&&this['__importDefault']||function(u){const r=a2P;return u&&u[r(0x116)]?u:{'default':u};};Object[a2P(0x10c)](exports,a2P(0x116),{'value':!![]}),exports[a2P(0x112)]=void 0x0;const _=__importStar(require(a2P(0x10a))),node_fetch_1=__importDefault(require(a2P(0x150))),chalk_1=__importDefault(require(a2P(0x12e))),utils_1=require('../utils'),inquirer_helper_1=require(a2P(0x137)),console_format_helpers_1=require('../formatting/console-format-helpers'),browser_login_1=require(a2P(0xd7)),inquirer=require('inquirer');function a2u(){const Y=['success','getOwnPropertyDescriptor','sessionToken=********','current','__awaiter','throw','map','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','tokenPrompt','call','token','useJobId','828955vixjkM','Token\x20for\x20current\x20context\x20\x27','Bearer\x20','default','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','context','getCurrentName','addCommand','Error\x20occured\x20during\x20browser\x20login:\x20','valueOf','chalk','apiClient','search-list','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','askForContext','value','Shows\x20full\x20context\x20information\x20(including\x20tokens)','project','../inquirer-helper','--all','prototype','defaultBaseUrl','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','updateToken','-t,\x20--token\x20[TOKEN]','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','log','error','fullUrl','browserLogin','\x20(current)','job','askForJob','Token\x20for\x20this\x20context','useProjectId','list','Remove\x20a\x20context','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','apiTokenLogin','2xuUhii','host\x20url\x20for\x20this\x20context','dir','contexts','node-fetch','browser-opened','Use\x20manual\x20login\x20with\x20API\x20token','tokenLogin','description','Update\x20token\x20for\x20current\x20context','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','delete','moveCursor','all','warning','getProjectName','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','replace','close','removeContext','https://api.northflank.com','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','-n,\x20--name\x20[NAME]','12633410kTeSAS','\x20(api\x20host:\x20','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','loadContextWrapper','contextAvailable','Local\x20context\x20name\x20to\x20remove.','156312fnvZTz','askForProject','getCurrentBaseUrl','../login/browser-login','https://','action','message','verifyToken','test','sanitiseHostname','host','1142610eiqZPp','remove','Local\x20context\x20\x27','next','alias','override',',\x20added\x20context\x20with\x20name\x20','Retrieve\x20and\x20update\x20local\x20context\x20settings.','then','service','GET','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','finally','printAsTable','prompt','1215501nahyzx','useContext','italic','writable','name','length','stdout','set','getCurrentProjectName','use','ctx','9DalXxv','--override','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','contextProvider','1227674inQJBj','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Changed\x20current\x20context\x20to\x20','__setModuleDefault','token\x20login','sort','/v1/login','browser\x20login','662768eHyQNh','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','NorthflankApiBrowserLogin','create','Choose\x20the\x20context\x20to\x20','lodash','login','defineProperty','InquirerHelper','getCommand','45tsemQJ','retry','confirm','CliContext','option','--host\x20[HOST]','__createBinding','__esModule','useServiceId'];a2u=function(){return Y;};return a2u();}class CliContext{constructor(u,I=a2P(0xcb)){const o=a2P;this[o(0x13a)]=I,this[o(0xdd)]=b=>{const w=o;let i=b;return!/^https?:\/\//i[w(0xdc)](i)&&(i=w(0xd8)+i),i=i[w(0xc8)](/\/+$/,''),i;},this[o(0x12f)]=u;const a=new inquirer_helper_1[(o(0x10d))](u);this['login']=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0x10b))[o(0x154)](o(0x11f))['option']('--token-login',o(0x152),![])[o(0x113)]('--do-not-open-browser',o(0x131),![])[o(0x113)]('-n,\x20--name\x20[NAME]','Name\x20for\x20login\x20context')[o(0x113)](o(0x13d),o(0xfb))['option'](o(0x114),o(0x14d),this[o(0x13a)])[o(0x113)](o(0xfa),o(0x13b),![])[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const h=o;_[h(0xf5)](b,h(0xde),this['sanitiseHostname'](b[h(0xde)]));const i=b[h(0x153)]||b['token']!==undefined,{name:j,host:A,token:F,override:X}=i?yield this[h(0x14b)](b,a):yield this[h(0x142)](b,a);try{yield this[h(0x12f)][h(0xfc)]['addContext']({'name':j,'host':A,'token':F},X);}catch(T){(0x0,utils_1[h(0x140)])(T[h(0xda)]);return;}if(!(yield this[h(0xdb)]()))(0x0,utils_1[h(0x140)])(h(0x132)),yield this['apiClient'][h(0xfc)]['removeContext'](j);else{const E=i?h(0x101):h(0x104),f='\x0aSuccessfully\x20logged\x20in\x20using\x20'+E+h(0xe5)+chalk_1[h(0x127)][h(0xf0)](j)+h(0xcf)+A+')';(0x0,utils_1[h(0x118)])(f);}})),this[o(0x14f)]=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0x129))[o(0x154)](o(0xe6))['alias'](o(0x14f))[o(0xe3)](o(0xf8));const x=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0x148))['name']('ls')[o(0x154)]('List\x20all\x20available\x20contexts')['option'](o(0x138),o(0x135))[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const W=o;console[W(0x13f)](u[W(0xfc)]['getInfo']());const i=u[W(0xfc)][W(0xd1)]();if(b[W(0x159)]===!![]){console[W(0x14e)](i);return;}const j=i[W(0x11b)],A=i[W(0x14f)][W(0x102)]((F,X)=>F[W(0xf2)]===j?-0x1:X[W(0xf2)]===j?0x1:0x0)['map'](F=>{const B=W,X=j===F[B(0xf2)]?B(0x143):'';return{'Name':''+F['name']+X,'Host':F[B(0xde)],'Default\x20Project':F['project']||'-','Default\x20Service':F[B(0xe8)]||'-'};});(0x0,console_format_helpers_1[W(0xec)])(A,'Contexts');})),D=(0x0,utils_1['getCommand'])();D[o(0xf2)](o(0xf7))['description']('Switch\x20between\x20your\x20local\x20contexts')[o(0x113)](o(0xcd),o(0x13e))[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const J=o,i=(b===null||b===void 0x0?void 0x0:b[J(0xf2)])||(yield this[J(0x133)](J(0xf7)));yield this['apiClient'][J(0xfc)]['useContext'](i),(0x0,utils_1[J(0x118)])(J(0xff)+i);}));const K='-i,\x20--id\x20[ID]',z=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0x136))['description'](o(0x106))[o(0x113)](K,o(0xd0))['action'](b=>__awaiter(this,void 0x0,void 0x0,function*(){const V=o,i=(b===null||b===void 0x0?void 0x0:b['id'])||(yield a[V(0xd5)]());yield this['apiClient'][V(0xfc)][V(0x147)](i),console[V(0x13f)]('Use\x20project\x20with\x20id:',i);})),H=(0x0,utils_1[o(0x10e)])()[o(0xf2)]('service')[o(0x154)](o(0xcc))['option'](K,o(0xc7))['action'](b=>__awaiter(this,void 0x0,void 0x0,function*(){const y=o,i=(b===null||b===void 0x0?void 0x0:b['id'])||(yield a['askForService'](this[y(0xc6)]())());console[y(0x13f)]('Use\x20service\x20with\x20id:',i),yield this['apiClient'][y(0xfc)][y(0x117)](i);})),s=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0x144))[o(0x154)]('Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context')[o(0x113)](K,o(0xfe))[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const e=o,i=(b===null||b===void 0x0?void 0x0:b['id'])||(yield a[e(0x145)](this[e(0xc6)]())());console[e(0x13f)]('Use\x20job\x20with\x20id:',i),yield this[e(0x12f)]['contextProvider'][e(0x123)](i);}));D[o(0x12b)](z),D[o(0x12b)](s),D[o(0x12b)](H);const C=(0x0,utils_1[o(0x10e)])()[o(0xf2)](o(0xe0))[o(0xe3)](o(0x157))[o(0xe3)]('rm')[o(0x154)](o(0x149))[o(0x113)](K,o(0xd3))[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const U=o;var i;const j=(b===null||b===void 0x0?void 0x0:b['id'])||(yield this[U(0x133)]('remove')),A=(i=this[U(0x12f)]['contextProvider']['getCurrentContext']())===null||i===void 0x0?void 0x0:i[U(0xf2)];yield this['apiClient']['contextProvider'][U(0xca)](j),(0x0,utils_1[U(0x118)])(U(0xe1)+j+'\x27\x20successfully\x20removed.');if(!this['contextAvailable']()){(0x0,utils_1[U(0x15a)])('No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.');return;}if(A===j){const F=(b===null||b===void 0x0?void 0x0:b[U(0xf2)])||(yield this[U(0x133)]('use\x20from\x20now\x20on'));yield this['apiClient'][U(0xfc)][U(0xef)](F),(0x0,utils_1[U(0x118)])('Changed\x20current\x20context\x20to\x20'+F);}})),p=(0x0,utils_1['getCommand'])()['name']('update-token')['alias']('set-token')[o(0x154)](o(0x155))['option'](o(0x13d),o(0x146))[o(0xd9)](b=>__awaiter(this,void 0x0,void 0x0,function*(){const S=o,{contextProvider:i}=this[S(0x12f)],j=(b===null||b===void 0x0?void 0x0:b['token'])||(yield a[S(0x120)]()),A=i['getCurrentToken']();yield i[S(0x13c)](j);if(yield this['verifyToken']())(0x0,utils_1[S(0x118)])(S(0x125)+i[S(0x12a)]()+'\x27\x20successfully\x20updated.');else{if(A)yield i[S(0x13c)](A);(0x0,utils_1[S(0x140)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed');}}));this[o(0x14f)]['addCommand'](x),this[o(0x14f)][o(0x12b)](D),this[o(0x14f)][o(0x12b)](C),this[o(0x14f)][o(0x12b)](p);}[a2P(0x142)](u,I){var a,x,D,K;return __awaiter(this,void 0x0,void 0x0,function*(){const n=a2I,z=!u['doNotOpenBrowser'],H=(a=u[n(0xde)])!==null&&a!==void 0x0?a:this[n(0x13a)],s=new browser_login_1[(n(0x107))](H,z);let C;s['on'](n(0x151),({url:j})=>{const L=n;if(z){const A=j[L(0xc8)](/sessionToken=.*/,L(0x11a));console['log'](L(0xea)+A+')'),C=inquirer[L(0xed)]([{'type':L(0x111),'name':'fullUrl','message':L(0x156),'default':![]}]),C[L(0xe7)](F=>{const g=L;process[g(0xf4)][g(0x158)](0x0,-0x1),process['stdout']['clearLine'](0x1),F[g(0x141)]&&console['log']('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+j+'\x20');});}else console['log']('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+j+'\x20');});const {token:p,contextName:b}=yield s['startLogin']()['catch'](j=>__awaiter(this,void 0x0,void 0x0,function*(){const l=n;(0x0,utils_1[l(0x140)])(l(0x12c)+j[l(0xda)]+'.\x20Using\x20fallback.');const A=yield this['apiTokenLogin'](u,I);return{'token':A[l(0x122)],'contextName':A[l(0xf2)]};}))[n(0xeb)](()=>{const Z=n;if(C)C['ui'][Z(0xc9)]();}),i=(D=(x=u[n(0xf2)])!==null&&x!==void 0x0?x:b)!==null&&D!==void 0x0?D:'autologin-'+new Date()[n(0x12d)]();return{'name':i,'token':p,'host':H,'override':(K=u[n(0xe4)])!==null&&K!==void 0x0?K:![]};});}[a2P(0x14b)](u,I){return __awaiter(this,void 0x0,void 0x0,function*(){const G=a2I,a=this['apiClient'][G(0xfc)][G(0xd1)]()[G(0x14f)],{name:x,token:D,host:K,override:z}=yield I['loginPrompt'](u,a);return{'name':x,'token':D,'host':K,'override':z};});}[a2P(0xc6)](){const O=a2P,u=this[O(0x12f)]['contextProvider'][O(0xf6)]();if(u===undefined)throw new Error(O(0x128));return u;}[a2P(0x133)](u){return __awaiter(this,void 0x0,void 0x0,function*(){const Q=a2I;if(!this[Q(0xd2)]())throw new Error(Q(0x14a));const I=this[Q(0x12f)][Q(0xfc)][Q(0xd1)]()['contexts'][Q(0x11e)](x=>x[Q(0xf2)]),a=I[Q(0xf3)]>0x4?Q(0x130):Q(0x148);return(yield inquirer[Q(0xed)]([{'type':a,'name':Q(0xf2),'message':Q(0x109)+u+':','choices':I}]))[Q(0xf2)];});}[a2P(0xd2)](){const d=a2P;return this['apiClient'][d(0xfc)]['loadContextWrapper']()[d(0x14f)][d(0xf3)]>0x0;}[a2P(0xdb)](){return __awaiter(this,void 0x0,void 0x0,function*(){const v=a2I;try{const u=this[v(0x12f)][v(0xfc)][v(0xd6)](),I=this['apiClient']['contextProvider']['getCurrentToken'](),a=u+v(0x103),x={'Authorization':v(0x126)+I},D=yield(0x0,utils_1[v(0x110)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const t=v;return(0x0,node_fetch_1[t(0x127)])(a,{'method':t(0xe9),'timeout':0xbb8,'headers':x});}));if(D['ok'])return!![];return![];}catch(K){return![];}});}}function a2I(u,I){const a=a2u();return a2I=function(x,D){x=x-0xc6;let K=a[x];return K;},a2I(u,I);}exports[a2P(0x112)]=CliContext;
|