@northflank/cli 0.9.19 → 0.9.20
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 a0Z6=a0J;(function(Z,J){const Z2=a0J,z=Z();while(!![]){try{const P=parseInt(Z2(0x16d))/0x1+-parseInt(Z2(0x15f))/0x2+parseInt(Z2(0x152))/0x3*(parseInt(Z2(0x151))/0x4)+-parseInt(Z2(0x176))/0x5+-parseInt(Z2(0x18f))/0x6+-parseInt(Z2(0x160))/0x7*(-parseInt(Z2(0x159))/0x8)+parseInt(Z2(0x17b))/0x9;if(P===J)break;else z['push'](z['shift']());}catch(B){z['push'](z['shift']());}}}(a0Z,0x3ca5b));function a0J(Z,J){const z=a0Z();return a0J=function(P,B){P=P-0x150;let U=z[P];return U;},a0J(Z,J);}function a0Z(){const ZU=['projectId','logSink','options','secrets','No\x20available\x20versions\x20to\x20upgrade\x20to.','54621PandTE','owningObject','value','versions','list','keyName','addonId','backups','templates','652075gMHsNB','keys','region','source','plans','8596989qhyPKp','resources','includes','envs','done','secretLink','deploymentPlan','length','next','get','find','replicas','internalId','updateaddonversion','secret','data','map','then','pagination','cursor','2507100uoQNno','registryCredentials','type','28JtlXje','48801lpehFz','fetchResourceList','addon','addonDependencies','types','services','storage','677096PPesSS','defineProperty','warning','version','addons','credentials','823344abBret','7KbjaNg','projects','backupId','regions','addonTypes','default','nextPageCursor','__esModule'];a0Z=function(){return ZU;};return a0Z();}var __awaiter=this&&this['__awaiter']||function(Z,J,z,B){function U(s){return s instanceof z?s:new z(function(A){A(s);});}return new(z||(z=Promise))(function(s,A){const Z5=a0J;function n(v){const Z3=a0J;try{C(B[Z3(0x183)](v));}catch(o){A(o);}}function F(v){try{C(B['throw'](v));}catch(o){A(o);}}function C(v){const Z4=a0J;v[Z4(0x17f)]?s(v[Z4(0x16f)]):U(v[Z4(0x16f)])[Z4(0x18c)](n,F);}C((B=B['apply'](Z,J||[]))[Z5(0x183)]());});};Object[a0Z6(0x15a)](exports,a0Z6(0x167),{'value':!![]}),exports[a0Z6(0x153)]=void 0x0;const utils_1=require('./utils'),defaultPaginationPageSize=0x64,getProjects=Z=>J=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z7=a0Z6;var z;const P=yield Z[Z7(0x171)][Z7(0x161)]({'options':{'per_page':defaultPaginationPageSize,'cursor':J===null||J===void 0x0?void 0x0:J[Z7(0x166)]}});return{'elements':P[Z7(0x18a)][Z7(0x161)]['map'](B=>B['id']),'nextPageCursor':(z=P[Z7(0x18d)])===null||z===void 0x0?void 0x0:z[Z7(0x18e)]};}),getServices=(Z,J)=>z=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z8=a0Z6;var P;const B=yield Z['list']['services']({'parameters':{'projectId':J},'options':{'per_page':defaultPaginationPageSize,'cursor':z===null||z===void 0x0?void 0x0:z[Z8(0x166)]}});return{'elements':B[Z8(0x18a)][Z8(0x157)][Z8(0x18b)](U=>U['id']),'nextPageCursor':(P=B[Z8(0x18d)])===null||P===void 0x0?void 0x0:P[Z8(0x18e)]};}),getAddons=(Z,J)=>z=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z9=a0Z6;var P;const B=yield Z[Z9(0x171)][Z9(0x15d)]({'parameters':{'projectId':J},'options':{'per_page':defaultPaginationPageSize,'cursor':z===null||z===void 0x0?void 0x0:z['nextPageCursor']}});return{'elements':B[Z9(0x18a)][Z9(0x15d)][Z9(0x18b)](U=>U['id']),'nextPageCursor':(P=B[Z9(0x18d)])===null||P===void 0x0?void 0x0:P[Z9(0x18e)]};}),getAddonBackups=(Z,J,z)=>P=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const ZZ=a0Z6;var B;const U=yield Z[ZZ(0x184)][ZZ(0x154)]['backups']({'parameters':{'projectId':J,'addonId':z},'options':{'per_page':defaultPaginationPageSize,'cursor':P===null||P===void 0x0?void 0x0:P[ZZ(0x166)]}});return{'elements':U[ZZ(0x18a)][ZZ(0x174)]['map'](s=>s['id']),'nextPageCursor':(B=U[ZZ(0x18d)])===null||B===void 0x0?void 0x0:B[ZZ(0x18e)]};});function fetchResourceList(Z,J,z,P,B,U){var s,A,n,F,C,v,o,j,V,i,p,S;return __awaiter(this,void 0x0,void 0x0,function*(){const ZJ=a0J,g=undefined;try{if(Z===ZJ(0x181)){const x=yield J[ZJ(0x171)][ZJ(0x17a)]({}),d=x[ZJ(0x18a)][ZJ(0x17a)]['map'](k=>{const Zz=ZJ;var N;return(N=k===null||k===void 0x0?void 0x0:k[Zz(0x187)])!==null&&N!==void 0x0?N:k===null||k===void 0x0?void 0x0:k['id'];});return{'choices':d,'defaultValue':g};}if(Z===ZJ(0x178)&&!(z===null||z===void 0x0?void 0x0:z['includes'](ZJ(0x169)))){const k=yield J[ZJ(0x171)][ZJ(0x163)]({}),N=k[ZJ(0x18a)][ZJ(0x163)][ZJ(0x18b)](W=>{const ZP=ZJ;var X;return(X=W===null||W===void 0x0?void 0x0:W[ZP(0x187)])!==null&&X!==void 0x0?X:W===null||W===void 0x0?void 0x0:W['id'];});return{'choices':N,'defaultValue':g};}if(Z===ZJ(0x168)){const W=yield getProjects(J),{elements:X,nextPageCursor:D}=yield W();return{'choices':X,'defaultValue':g,'pagination':{'nextPageCursor':D,'loadMore':W}};}if(Z===ZJ(0x15e)){const q=yield J['list'][ZJ(0x190)]({}),y=q['data'][ZJ(0x15e)]['map'](O=>O['id']);return{'choices':y,'defaultValue':g};}const I=B===null||B===void 0x0?void 0x0:B['projectId'],m=Z==='serviceId'||Z==='id'&&(U===null||U===void 0x0?void 0x0:U['includes'](ZJ(0x16e)));if(I!==undefined&&m){const O=yield getServices(J,I),{elements:G,nextPageCursor:K}=yield O();return{'choices':G,'defaultValue':g,'pagination':{'nextPageCursor':K,'loadMore':O}};}const L=z===null||z===void 0x0?void 0x0:z[ZJ(0x17d)](ZJ(0x154));if(L){const l=b=>__awaiter(this,void 0x0,void 0x0,function*(){const ZB=ZJ;var f;const r=yield J[ZB(0x184)]['addon']['types']({});return(f=r[ZB(0x18a)][ZB(0x164)])===null||f===void 0x0?void 0x0:f[ZB(0x18b)](w=>w[ZB(0x150)])[ZB(0x185)](w=>w['type']===b);});if(Z===ZJ(0x150)){const b=yield J[ZJ(0x184)]['addon'][ZJ(0x156)]({}),f=(s=b[ZJ(0x18a)][ZJ(0x164)])===null||s===void 0x0?void 0x0:s[ZJ(0x18b)](r=>r[ZJ(0x150)]);return{'choices':f,'defaultValue':g};}if(Z==='version'&&(P===null||P===void 0x0?void 0x0:P[ZJ(0x150)])!==undefined){const r=(A=yield l(P[ZJ(0x150)]))===null||A===void 0x0?void 0x0:A[ZJ(0x170)],w=r!==undefined?['latest',...r]:undefined;return{'choices':w,'defaultValue':g};}if(Z===ZJ(0x158)&&(P===null||P===void 0x0?void 0x0:P[ZJ(0x150)])!==undefined){const Q=(F=(n=yield l(P[ZJ(0x150)]))===null||n===void 0x0?void 0x0:n[ZJ(0x17c)])===null||F===void 0x0?void 0x0:F['storage'];return{'choices':Q===null||Q===void 0x0?void 0x0:Q[ZJ(0x16a)],'defaultValue':Q===null||Q===void 0x0?void 0x0:Q[ZJ(0x165)]};}if(Z===ZJ(0x186)&&(P===null||P===void 0x0?void 0x0:P[ZJ(0x150)])!==undefined){const T=(v=(C=yield l(P[ZJ(0x150)]))===null||C===void 0x0?void 0x0:C[ZJ(0x17c)])===null||v===void 0x0?void 0x0:v['replicas'];return{'choices':T===null||T===void 0x0?void 0x0:T[ZJ(0x16a)],'defaultValue':T===null||T===void 0x0?void 0x0:T[ZJ(0x165)]};}}if(Z==='addonId'&&(B===null||B===void 0x0?void 0x0:B['projectId'])!==undefined){const c=yield getAddons(J,B===null||B===void 0x0?void 0x0:B[ZJ(0x168)]),{elements:t,nextPageCursor:R}=yield c();return{'choices':t,'defaultValue':g,'pagination':{'nextPageCursor':R,'loadMore':c}};}if(Z===ZJ(0x162)&&(B===null||B===void 0x0?void 0x0:B[ZJ(0x168)])!==undefined&&((o=P===null||P===void 0x0?void 0x0:P[ZJ(0x179)])===null||o===void 0x0?void 0x0:o[ZJ(0x173)])!==undefined){const h=yield getAddonBackups(J,B===null||B===void 0x0?void 0x0:B[ZJ(0x168)],(j=P===null||P===void 0x0?void 0x0:P['source'])===null||j===void 0x0?void 0x0:j[ZJ(0x173)]),{elements:a,nextPageCursor:u}=yield h();return{'choices':a,'defaultValue':g,'pagination':{'nextPageCursor':u,'loadMore':h}};}const M=(V=B===null||B===void 0x0?void 0x0:B[ZJ(0x173)])!==null&&V!==void 0x0?V:(i=P===null||P===void 0x0?void 0x0:P[ZJ(0x155)])===null||i===void 0x0?void 0x0:i[ZJ(0x173)];if((z===null||z===void 0x0?void 0x0:z['join'](''))===ZJ(0x188)&&Z===ZJ(0x15c)&&(B===null||B===void 0x0?void 0x0:B[ZJ(0x168)])!==undefined&&M!==undefined){const {upgradeTo:H}=(yield J[ZJ(0x184)][ZJ(0x154)]['version']({'parameters':{'addonId':M,'projectId':B===null||B===void 0x0?void 0x0:B[ZJ(0x168)]}}))['data'];if(H===undefined||H[ZJ(0x182)]<=0x0){(0x0,utils_1[ZJ(0x15b)])(ZJ(0x16c));throw new Error();}return{'choices':H[ZJ(0x18b)](Y=>Y['version']),'defaultValue':g};}if(Z==='templateId'){const Y=yield J[ZJ(0x171)][ZJ(0x175)]({}),E=Y[ZJ(0x18a)][ZJ(0x175)][ZJ(0x18b)](Z0=>Z0===null||Z0===void 0x0?void 0x0:Z0['id']);return{'choices':E,'defaultValue':g};}if(((z===null||z===void 0x0?void 0x0:z[ZJ(0x17d)](ZJ(0x180)))||(z===null||z===void 0x0?void 0x0:z['includes'](ZJ(0x189))))&&Z===ZJ(0x172)&&M!==undefined&&(B===null||B===void 0x0?void 0x0:B['projectId'])!==undefined){const Z0=(yield J['get'][ZJ(0x154)][ZJ(0x15e)]({'parameters':{'addonId':M,'projectId':B===null||B===void 0x0?void 0x0:B['projectId']}}))[ZJ(0x18a)];return{'choices':[...(p=Object[ZJ(0x177)](Z0===null||Z0===void 0x0?void 0x0:Z0[ZJ(0x17e)]))!==null&&p!==void 0x0?p:[],...(S=Object[ZJ(0x177)](Z0===null||Z0===void 0x0?void 0x0:Z0[ZJ(0x16b)]))!==null&&S!==void 0x0?S:[]]};}}catch(Z1){}return{'choices':undefined,'defaultValue':g};});}exports[a0Z6(0x153)]=fetchResourceList;
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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));}}}};
|
|
2
|
+
'use strict';const a1Zo=a1J;(function(Z,J){const Zv=a1J,z=Z();while(!![]){try{const P=-parseInt(Zv(0x1ae))/0x1*(parseInt(Zv(0x1d5))/0x2)+-parseInt(Zv(0x1db))/0x3*(parseInt(Zv(0x276))/0x4)+parseInt(Zv(0x18e))/0x5+-parseInt(Zv(0x23a))/0x6+-parseInt(Zv(0x23b))/0x7+parseInt(Zv(0x1c1))/0x8+parseInt(Zv(0x24c))/0x9*(parseInt(Zv(0x259))/0xa);if(P===J)break;else z['push'](z['shift']());}catch(B){z['push'](z['shift']());}}}(a1Z,0xa4791));var __createBinding=this&&this[a1Zo(0x227)]||(Object[a1Zo(0x189)]?function(Z,J,z,P){const Zj=a1Zo;if(P===undefined)P=z;var B=Object[Zj(0x199)](J,z);(!B||(Zj(0x1fa)in B?!J['__esModule']:B[Zj(0x215)]||B[Zj(0x1b1)]))&&(B={'enumerable':!![],'get':function(){return J[z];}}),Object[Zj(0x282)](Z,P,B);}:function(Z,J,z,P){if(P===undefined)P=z;Z[P]=J[z];}),__setModuleDefault=this&&this[a1Zo(0x1ab)]||(Object['create']?function(Z,J){const ZV=a1Zo;Object[ZV(0x282)](Z,ZV(0x226),{'enumerable':!![],'value':J});}:function(Z,J){const Zi=a1Zo;Z[Zi(0x226)]=J;}),__importStar=this&&this[a1Zo(0x25b)]||function(Z){const Zp=a1Zo;if(Z&&Z[Zp(0x26d)])return Z;var J={};if(Z!=null){for(var z in Z)if(z!==Zp(0x226)&&Object[Zp(0x1d4)]['hasOwnProperty'][Zp(0x1a9)](Z,z))__createBinding(J,Z,z);}return __setModuleDefault(J,Z),J;},__awaiter=this&&this[a1Zo(0x283)]||function(Z,J,z,B){function U(s){return s instanceof z?s:new z(function(A){A(s);});}return new(z||(z=Promise))(function(s,A){const Zg=a1J;function n(v){try{C(B['next'](v));}catch(o){A(o);}}function F(v){const ZS=a1J;try{C(B[ZS(0x252)](v));}catch(o){A(o);}}function C(v){const Ze=a1J;v[Ze(0x223)]?s(v[Ze(0x1ad)]):U(v['value'])[Ze(0x1d0)](n,F);}C((B=B[Zg(0x1d9)](Z,J||[]))[Zg(0x21c)]());});},__importDefault=this&&this[a1Zo(0x1bf)]||function(Z){const ZI=a1Zo;return Z&&Z[ZI(0x26d)]?Z:{'default':Z};};Object[a1Zo(0x282)](exports,a1Zo(0x26d),{'value':!![]}),exports[a1Zo(0x275)]=void 0x0;function a1Z(){const Zw=['region','backupId','endpoints','option','login','argv','addHelpCommand','get','safeLoad','PaginationHelper','kebabCase','keys','stdout','opt','askForSubdomainPath','toUpperCase','clusterId','templates','buildId','json','repositories','message','underline','tpl','askForPipeline','helpOption','version','--page','repos','API\x20request\x20failed\x0a\x09Message:\x20','after','Update\x20Northflank\x20','askForCredentials','find','writable','Get\x20information\x20about\x20Northflank\x20','./port-forward','output','branch','./exec','OPTIONAL:\x20','next','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','custom-columns=','checkUpdate','isArray','scrt','invoices','done','askGeneric','data','default','__createBinding','boolean','filter','concat','backups','getCurrentJobName','askForBuild','readFileSync','/docs/v1/api/','hasNext','-i,\x20--input\x20<resource-def>','deleteWarningPrompt','resource','getCommandOverview','consoleFormat','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','list','sort','Northflank\x20cli\x20version:\x20','6326226ZVOEbc','715512ymJTiV','long','plan','getNext','contextProvider','askForLogSink','jobId','customUserAgent','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','ApiClientFileContextProvider','-v,\x20--version','docsTagsPath','omit','\x0a\x09details\x20:','retrievePayloadViaInteractiveCli','existsSync','repo','348444vaQoaX','bind','there\x20are\x20more\x20rows,\x20load?','VERBOSE:\x20Using\x20endpoint\x20->\x20','./utils','path','throw','includes','.yaml','commands','noDefaults','warning','green','290JbdQJk','update','__importStar','askForTemplate','File\x20to\x20load\x20resource\x20json\x20from','endsWith','loadAll','--verbose','askForSubdomain','some','domain','tag','CliContext','yml','page','logSinkId','getCommand','alias','upperFirst','./defaults','__esModule','service','secrets','template','addon','isString','logs','volume','getProgram','4JZExrC','Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27','subdomainPath','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','assign','startsWith','request','CliPortForward',',\x20NF\x20error\x20id:\x20','askForAddonBackup','parseAsync','requiredPermissions','defineProperty','__awaiter','=>\x20running\x20command\x20with:\x20','description','skipValidation','js-yaml','volumeId','error','subdomain','ApiClient','svc','volumes','cursor','job','jobs','(HTTP\x20status\x20code:\x20','subdomainId','forEach','secretId','pop','getCurrentProjectName','create','asyncSequential','inv','parse','addCommand','3246395LGghFY','query','getOwnPropertyNames','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','quiet','Command','delete','adn','domainId','credential','brn','getOwnPropertyDescriptor','pipelineId','northflank','action','\x20Northflank\x20resources','toLowerCase','getLogsCommand','chalk','File\x20does\x20not\x20exist:\x20','map','./metrics','type','regions','templateId','askForClusterId','base','call','askForTag','__setModuleDefault','isEqual','value','12OCQOYx','body','has','configurable','length','templateRunId','clearLine','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','name','getMetricsCommand','Unknown\x20input\x20file\x20type:\x20','\x0a>\x20Token\x20permissions\x20required:\x20','log','split','askForTemplateRun','exitCode','file','__importDefault','defaults','6546424dNeHKY','serviceId','assertContextExisting','@northflank/js-client','\x20--','enablePositionalOptions','credentialId','portFwdCmd','yaml','nonInteractiveEndpoint','required','getCurrentContext','projectId','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','getAll','then','runId','join','dmn','prototype','27914OKjAbL','Documentation:\x20','prj','method','apply','opts','1777782CNpNyU','status','lodash','api.','Resource\x20was\x20not\x20deleted.','addonId',',\x20-','isPaginatedEndpoint','secret','currentOffset','CliMetrics','url','handleJsonOutput','stringify','plans','rgn','Display\x20help\x20for\x20command','grey','replace','askForVolume','./logs','getCurrentServiceName','set','-f,\x20--file\x20<file-path>'];a1Z=function(){return Zw;};return a1Z();}const js_client_1=require(a1Zo(0x1c4)),commander_1=__importDefault(require('commander')),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require(a1Zo(0x1a0))),_=__importStar(require(a1Zo(0x1dd))),contextCommands_1=require('./context/contextCommands'),utils_1=require(a1Zo(0x250)),defaults=__importStar(require(a1Zo(0x26c))),inquirer_helper_1=require('./inquirer-helper'),console_format_helpers_1=require('./formatting/console-format-helpers'),command_overview_1=require('./formatting/command-overview'),port_forward_1=require(a1Zo(0x217)),exec_1=require(a1Zo(0x21a)),logs_1=require(a1Zo(0x1ef)),metrics_1=require(a1Zo(0x1a3)),pagination_helper_1=require('./pagination/pagination-helper'),yaml=require(a1Zo(0x287)),pgk=require('../package.json'),getProgram=Z=>{const Zm=a1Zo,J=new commander_1[(Zm(0x226))][(Zm(0x193))](Zm(0x19b));J[Zm(0x285)](Zm(0x21d)),J[Zm(0x1c6)](!![]),J[Zm(0x20d)](Zm(0x239)+chalk_1['default'][Zm(0x209)](pgk['version']),Zm(0x245),Zm(0x243));const z=new js_client_1['ApiClient'](Z,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[Zm(0x242)]}),P=new contextCommands_1[(Zm(0x265))](z),B=new port_forward_1[(Zm(0x27d))](Z),U=new exec_1['CliExec'](Z),s=new logs_1['CliLogs'](Z),A=new metrics_1[(Zm(0x1e5))](Z);return J['addCommand'](B[Zm(0x1c8)]),J[Zm(0x18d)](U['execCmd']),J[Zm(0x18d)](P[Zm(0x1f7)]),J[Zm(0x18d)](P['contexts']),generateCommands(z,z[Zm(0x1f5)],J,s,A),J[Zm(0x18d)]((0x0,command_overview_1[Zm(0x234)])(J)),J[Zm(0x1f9)](!![],Zm(0x1eb)),J[Zm(0x20c)](undefined,Zm(0x1eb)),J;};exports[a1Zo(0x275)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const ZL=a1Zo;try{const Z=new js_client_1[(ZL(0x244))]();yield(0x0,utils_1[ZL(0x21f)])(Z);const J=(0x0,exports[ZL(0x275)])(Z);yield J[ZL(0x280)](process['argv']);}catch(z){(0x0,utils_1['error'])(ZL(0x1b5)+z[ZL(0x208)]),process[ZL(0x1f8)][ZL(0x214)](P=>P===ZL(0x260))&&console['log'](z),process[ZL(0x1bd)]=0x1;}}))());function isListCommand(Z){const ZM=a1Zo,J=[['get','addon',ZM(0x22b)],['get',ZM(0x181),'runs']];return Z[ZM(0x214)](z=>z===ZM(0x237))||J[ZM(0x262)](z=>_[ZM(0x1ac)](Z,z));}function a1J(Z,J){const z=a1Z();return a1J=function(P,B){P=P-0x181;let U=z[P];return U;},a1J(Z,J);}function generateCommands(Z,J,z,P,B,U=defaults[a1Zo(0x1c0)],s=[]){const Zx=a1Zo,A=new inquirer_helper_1['InquirerHelper'](new js_client_1[(Zx(0x28b))](Z[Zx(0x23f)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[Zx(0x242)]}));function n(o,j){const Zd=Zx;return o[Zd(0x1cb)]!==![]&&j===undefined;}function F(o,j){const Zk=Zx,{opt:V,name:i}=o,p=V[Zk(0x226)],S=n(V,p),e=x=>x[Zk(0x1b2)]>0x1?'--'+x:'-'+x,g=V===null||V===void 0x0?void 0x0:V[Zk(0x26a)],I=g?_[Zk(0x220)](g)?'-'+(g===null||g===void 0x0?void 0x0:g[Zk(0x1a2)](x=>e(x))[Zk(0x1d2)](Zk(0x1e1)))+',':''+e(g):'',m=S?'':Zk(0x21b),L=typeof V[Zk(0x1a4)]===Zk(0x228)||V[Zk(0x1a4)]===Zk(0x228)?I+Zk(0x1c5)+i:I+Zk(0x1c5)+i+'\x20<'+i[Zk(0x202)]()+'>',M=m+V[Zk(0x285)];j[Zk(0x1f6)](L,M,p);}function C(o,j){const ZN=Zx;if(j[ZN(0x255)][ZN(0x262)](V=>V['name']()===ZN(0x273)))return;_['isEqual'](o,[ZN(0x1fa),ZN(0x26e)])&&(j['addCommand'](P[ZN(0x19f)](ZN(0x26e))),j['addCommand'](B[ZN(0x1b7)]('service')),j[ZN(0x18d)](P[ZN(0x19f)]('service',!![])),j[ZN(0x18d)](B[ZN(0x1b7)](ZN(0x26e),!![]))),_[ZN(0x1ac)](o,['get',ZN(0x181)])&&(j['addCommand'](P['getLogsCommand'](ZN(0x181))),j[ZN(0x18d)](B['getMetricsCommand'](ZN(0x181))),j['addCommand'](P[ZN(0x19f)](ZN(0x181),!![])),j[ZN(0x18d)](B[ZN(0x1b7)](ZN(0x181),!![]))),_['isEqual'](o,['get','addon'])&&(j['addCommand'](P[ZN(0x19f)](ZN(0x271))),j[ZN(0x18d)](B[ZN(0x1b7)](ZN(0x271)))),_['isEqual'](o,['get',ZN(0x271),'backup'])&&j[ZN(0x18d)](P['getLogsCommand']('addon',![],!![])),_[ZN(0x1ac)](o,[ZN(0x1fa),ZN(0x271),'restores'])&&j['addCommand'](P[ZN(0x19f)](ZN(0x271),![],!![],!![]));}return Object['getOwnPropertyNames'](U)[Zx(0x185)](o=>{const ZW=Zx,j=J[o],V=U[o],i=s[ZW(0x22a)]([o]);function p(k,N){const ZX=ZW,W=Object[ZX(0x190)](k||{});W[ZX(0x1a2)](X=>{return{'name':X,'opt':k[X]};})[ZX(0x238)]((X,D)=>!n(X[ZX(0x200)])?!n(D[ZX(0x200)])?0x0:0x1:-0x1)[ZX(0x185)](X=>{F(X,N);});}function S(k,N){const ZD=ZW,W=[['project','projects',ZD(0x1d7)],[ZD(0x26e),'services',ZD(0x28c)],['credentials',ZD(0x197),'cred'],[ZD(0x271),'addons',ZD(0x195)],[ZD(0x181),ZD(0x182)],[ZD(0x23d),ZD(0x1e9),'pln'],[ZD(0x1f3),ZD(0x1a5),ZD(0x1ea)],[ZD(0x263),'domains',ZD(0x1d3)],[ZD(0x1e3),ZD(0x26f),ZD(0x221)],[ZD(0x28d),ZD(0x274),'vol'],['branches',ZD(0x219),ZD(0x198)],['invoice',ZD(0x222),ZD(0x18b)],[ZD(0x270),ZD(0x204),ZD(0x20a)],[ZD(0x20f),'repository',ZD(0x207),ZD(0x24b)],[ZD(0x264),'tags']],X=W['find'](D=>D['includes'](N));if(X!==undefined)k['aliases'](X['filter'](D=>D!==N));}function e(k){var N,W;return __awaiter(this,void 0x0,void 0x0,function*(){const Zq=a1J,X={},{contextProvider:D}=Z,q=i['includes'](Zq(0x194)),y=k[Zq(0x256)]===!![];function O(G,K,l){var b,f;return __awaiter(this,void 0x0,void 0x0,function*(){const Zy=a1J;if(_[Zy(0x1b0)]((f=(b=V[Zy(0x200)])===null||b===void 0x0?void 0x0:b[Zy(0x251)])!==null&&f!==void 0x0?f:{},G)){const r=!y&&!q&&l?l():undefined,w=k[G]||r||(yield K());_[Zy(0x1f1)](X,G,w);}});}return yield(0x0,utils_1['asyncSequential'])(Object['entries']((W=(N=V[Zq(0x200)])===null||N===void 0x0?void 0x0:N[Zq(0x251)])!==null&&W!==void 0x0?W:{}),([G,K])=>__awaiter(this,void 0x0,void 0x0,function*(){const ZO=Zq;var l;const b=X===null||X===void 0x0?void 0x0:X['projectId'],f=X===null||X===void 0x0?void 0x0:X[ZO(0x1a6)];switch(G){case ZO(0x1cd):return yield O(ZO(0x1cd),A['askForProject'][ZO(0x24d)](A),D[ZO(0x188)][ZO(0x24d)](D));case ZO(0x1c2):return yield O(ZO(0x1c2),A['askForService'](b)[ZO(0x24d)](A),D[ZO(0x1f0)][ZO(0x24d)](D));case'addonId':return yield O('addonId',A['askForAddon'](b)['bind'](A));case ZO(0x241):return yield O('jobId',A['askForJob'](b)[ZO(0x24d)](A),D[ZO(0x22c)]['bind'](D));case ZO(0x1d1):return yield O(ZO(0x1d1),A['askForJobRun'](X[ZO(0x241)],b,![])[ZO(0x24d)](A));case'secretId':return yield O(ZO(0x186),A['askForSecret'](b)['bind'](A));case ZO(0x263):case'domainId':return yield O(ZO(0x263),A['askForDomain'][ZO(0x24d)](A));case ZO(0x1c7):return yield O('credentialId',A[ZO(0x213)]['bind'](A));case ZO(0x288):return yield O(ZO(0x288),A[ZO(0x1ee)](b)[ZO(0x24d)](A));case ZO(0x28a):return yield O(ZO(0x28a),A[ZO(0x261)](X[ZO(0x263)])[ZO(0x24d)](A));case ZO(0x184):return yield O('subdomainId',A[ZO(0x261)](X[ZO(0x196)])['bind'](A));case ZO(0x278):return yield O(ZO(0x278),A[ZO(0x201)](X[ZO(0x263)],(l=X['subdomain'])!==null&&l!==void 0x0?l:X[ZO(0x184)])[ZO(0x24d)](A));case ZO(0x1f4):return yield O('backupId',A[ZO(0x27f)](b,X[ZO(0x1e0)])['bind'](A));case'buildId':return yield O(ZO(0x205),A[ZO(0x22d)](b,X[ZO(0x1c2)],X[ZO(0x241)])[ZO(0x24d)](A));case'templateId':return yield O(ZO(0x1a6),A[ZO(0x25c)]()[ZO(0x24d)](A));case ZO(0x1b3):return yield O(ZO(0x1b3),A[ZO(0x1bc)](f)['bind'](A));case ZO(0x268):return yield O(ZO(0x268),A[ZO(0x240)]()['bind'](A));case'pipelineId':return yield O(ZO(0x19a),A[ZO(0x20b)](b)[ZO(0x24d)](A));case'resourceTagId':return yield O('resourceTagId',A[ZO(0x1aa)]()[ZO(0x24d)](A));case ZO(0x203):return yield O('clusterId',A[ZO(0x1a7)]()['bind'](A));default:return yield O(G,A[ZO(0x224)](G,K===null||K===void 0x0?void 0x0:K[ZO(0x285)])[ZO(0x24d)](A));}})),X;});}function g(k){var N,W,X;return __awaiter(this,void 0x0,void 0x0,function*(){const ZG=a1J,D={},q=((N=V[ZG(0x200)])===null||N===void 0x0?void 0x0:N[ZG(0x1e2)])?defaults['paginationArgs']:{},y=Object[ZG(0x27a)](Object[ZG(0x27a)]({},(X=(W=V[ZG(0x200)])===null||W===void 0x0?void 0x0:W[ZG(0x18f)])!==null&&X!==void 0x0?X:{}),q),O=Object[ZG(0x1fe)](y)[ZG(0x229)](G=>G!==ZG(0x25f));return yield(0x0,utils_1[ZG(0x18a)])(O,G=>__awaiter(this,void 0x0,void 0x0,function*(){if(k[G]!==undefined)return _['set'](D,G,k[G]);})),D;});}function I(){const ZK=ZW;switch(i[0x0]){case ZK(0x1fa):return ZK(0x216)+(i[0x1]||ZK(0x233))+'s';case ZK(0x25a):return ZK(0x212)+(i[0x1]||'resource')+'\x20properties';default:return _[ZK(0x26b)](o)+ZK(0x19d);}}function m(k,N){const Zl=ZW;var W,X,D,q,y,O,G,K;if(!N){const c=(0x0,utils_1[Zl(0x269)])()[Zl(0x1b6)](_[Zl(0x1fd)](o))[Zl(0x285)](I());return S(c,o),c;}const l=(k===null||k===void 0x0?void 0x0:k[Zl(0x281)])?chalk_1[Zl(0x226)][Zl(0x1ec)](Zl(0x1b9)+k[Zl(0x281)]):'',b=Z[Zl(0x23f)][Zl(0x1cc)](),f=b!==undefined&&((W=V===null||V===void 0x0?void 0x0:V[Zl(0x200)])===null||W===void 0x0?void 0x0:W[Zl(0x246)])!==undefined,r=b===null||b===void 0x0?void 0x0:b['host'][Zl(0x1ed)](Zl(0x1de),''),w=f?Zl(0x1d6)+r+Zl(0x22f)+((X=V===null||V===void 0x0?void 0x0:V[Zl(0x200)])===null||X===void 0x0?void 0x0:X['docsTagsPath']):'',Q=(k===null||k===void 0x0?void 0x0:k['description'])||'',T=(0x0,utils_1[Zl(0x269)])(!![])[Zl(0x1b6)](_[Zl(0x1fd)](o))[Zl(0x285)](Q)['addHelpText'](Zl(0x211),[l,w]['join']('\x0a'));return S(T,o),(((D=V[Zl(0x200)])===null||D===void 0x0?void 0x0:D[Zl(0x1af)])||((q=V['opt'])===null||q===void 0x0?void 0x0:q['nonInteractiveEndpoint']))&&(T[Zl(0x1f6)](Zl(0x1f2),Zl(0x25d)),T['option'](Zl(0x231),Zl(0x191))),p((y=V['opt'])===null||y===void 0x0?void 0x0:y['path'],T),p((O=V[Zl(0x200)])===null||O===void 0x0?void 0x0:O['query'],T),((G=V[Zl(0x200)])===null||G===void 0x0?void 0x0:G[Zl(0x1e2)])&&p(defaults['paginationArgs'],T),p((K=V[Zl(0x200)])===null||K===void 0x0?void 0x0:K[Zl(0x1a8)],T),T[Zl(0x19c)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const Zb=Zl;var t,R,h,a;(0x0,utils_1[Zb(0x1c3)])(Z);const u=T[Zb(0x1da)](),H=u[Zb(0x267)]!==undefined||u[Zb(0x28e)]!==undefined,Y=T['options']['some'](Z9=>Z9[Zb(0x23c)]===Zb(0x20e));if(u[Zb(0x25f)]===!![]&&H)throw new Error(Zb(0x277));const E=u===null||u===void 0x0?void 0x0:u[Zb(0x218)],Z0=E===Zb(0x206),Z1=E==='yaml'||E==='yml',Z2=yield e(u);A['setPathVars'](Z2);const Z3=yield g(u),Z4=Object[Zb(0x1fe)]((R=(t=V['opt'])===null||t===void 0x0?void 0x0:t[Zb(0x251)])!==null&&R!==void 0x0?R:{})[Zb(0x1a2)](Z9=>Z9+'='+chalk_1[Zb(0x226)][Zb(0x258)](Z2[Z9]))['join'](',\x20');if(Z4[Zb(0x1b2)]>0x0&&!Z0&&!Z1){const Z9=Zb(0x284)+Z4;console[Zb(0x1ba)](Z9);}const Z5=((h=V[Zb(0x200)])===null||h===void 0x0?void 0x0:h[Zb(0x1af)])||((a=V['opt'])===null||a===void 0x0?void 0x0:a[Zb(0x1ca)])?yield yield v(u,V,i):undefined;if(!u['force']&&i[Zb(0x253)](Zb(0x194))&&!(yield A[Zb(0x232)]())){(0x0,utils_1[Zb(0x257)])(Zb(0x1df));return;}const Z6=new pagination_helper_1[(Zb(0x1fc))](j,Z2,Z3,Z5),Z7=Y&&(u[Zb(0x25f)]||(u[Zb(0x218)]===Zb(0x206)||u[Zb(0x218)]===Zb(0x1c9))&&!H),Z8=Z7?yield Z6[Zb(0x1cf)]():yield Z6[Zb(0x23e)]();if(u===null||u===void 0x0?void 0x0:u['verbose']){const ZZ=Z8[Zb(0x27c)];console['log'](Zb(0x24f)+ZZ[Zb(0x1d8)][Zb(0x202)]()+':'+ZZ[Zb(0x1e6)]);if(Z5!==undefined)console['log']('VERBOSE:\x20Request\x20body\x20->\x20'+Z5);}if(Z8[Zb(0x289)]){const {details:ZJ,id:Zz,message:ZP,status:ZB}=Z8['error'],ZU=ZJ?Zb(0x248)+JSON[Zb(0x1e8)](ZJ):'',Zs=Zz?Zb(0x27e)+Zz:'',ZA=Zb(0x183)+ZB+Zs+')';throw new Error(Zb(0x210)+ZP+'\x20'+ZA+ZU);}printCallResult(u,Z0,Z8[Zb(0x225)],Z1,i,E,![],0x0,Z8['rawResponse'][Zb(0x1dc)]);if(!u[Zb(0x192)]&&!Z7&&!H&&Z6[Zb(0x230)]())while(Z6['hasNext']()){const Zn=yield A['askConfirm'](Zb(0x24e));if(Zn){process[Zb(0x1ff)]['moveCursor'](0x0,-0x1),process[Zb(0x1ff)][Zb(0x1b4)](0x1);const ZF=Z6[Zb(0x1e4)],ZC=yield Z6[Zb(0x23e)]();printCallResult(u,Z0,ZC[Zb(0x225)],Z1,i,E,!![],ZF,ZC['rawResponse'][Zb(0x1dc)]);}else return;}})),T;}const L=_[ZW(0x1b0)](V,ZW(0x200)),M=j,x=m(M,L);C(i,x),z[ZW(0x18d)](x);const d=_[ZW(0x247)](V,ZW(0x200));Object[ZW(0x1fe)](d)[ZW(0x1b2)]>0x0&&generateCommands(Z,j,x,P,B,d,i);});function v(o,j,V){var i;return __awaiter(this,void 0x0,void 0x0,function*(){const Zf=a1J,{input:p,file:S}=o;if(p!==undefined)try{return JSON[Zf(0x18c)](p);}catch(g){try{return yaml[Zf(0x1fb)](p);}catch(I){throw new Error(Zf(0x236));}}if(S!==undefined){if(!fs_1[Zf(0x226)][Zf(0x24a)](S))throw new Error(Zf(0x1a1)+S);const m=fs_1[Zf(0x226)][Zf(0x22e)](S)['toString']();let L;try{if(_[Zf(0x272)](m)){if(o[Zf(0x1be)][Zf(0x25e)]('.json'))L=JSON[Zf(0x18c)](m);else{if(o['file'][Zf(0x25e)](Zf(0x254))||o[Zf(0x1be)][Zf(0x25e)](Zf(0x266)))L=yaml[Zf(0x1fb)](m);else throw new Error(Zf(0x1b8)+o[Zf(0x1be)]['split']('.')[Zf(0x187)]());}}else L=m;return L;}catch(M){throw new Error(Zf(0x1ce)+M['message']);}}if((i=j===null||j===void 0x0?void 0x0:j[Zf(0x200)])===null||i===void 0x0?void 0x0:i[Zf(0x1ca)])throw new Error(Zf(0x279));return yield A[Zf(0x249)](j,{'cmdPath':V,'skipValidation':o[Zf(0x286)]});});}}const printCallResult=(Z,J,z,P,B,U,s,A,n)=>{const Zr=a1Zo;if(!(Z===null||Z===void 0x0?void 0x0:Z[Zr(0x192)])){if(J)(0x0,console_format_helpers_1[Zr(0x1e7)])(Z===null||Z===void 0x0?void 0x0:Z[Zr(0x218)],z);else{if(P)(0x0,console_format_helpers_1['handleYamlOutput'])(Z===null||Z===void 0x0?void 0x0:Z[Zr(0x218)],z);else{if(isListCommand(B)){const F=(U===null||U===void 0x0?void 0x0:U[Zr(0x27b)](Zr(0x21e)))?U[Zr(0x1ed)](Zr(0x21e),'')[Zr(0x1bb)](',')[Zr(0x1a2)](V=>V[Zr(0x19e)]()):undefined,C=B[B[Zr(0x1b2)]-0x1],v=''+C+(C[Zr(0x25e)]('s')?'':'s'),o=_[Zr(0x26b)](v),j=_[Zr(0x1b0)](z,v)?z[v]:z;(0x0,console_format_helpers_1['printAsTable'])(j,o,F,s,A);}else console['log']((0x0,console_format_helpers_1[Zr(0x235)])(z,n));}}}};
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
'use strict';const a2L=a2J;(function(Z,J){const m=a2J,z=Z();while(!![]){try{const P=-parseInt(m(0x1d4))/0x1+parseInt(m(0x1e6))/0x2*(parseInt(m(0x25d))/0x3)+-parseInt(m(0x21d))/0x4+parseInt(m(0x258))/0x5*(parseInt(m(0x20b))/0x6)+parseInt(m(0x227))/0x7+parseInt(m(0x232))/0x8+parseInt(m(0x24a))/0x9*(-parseInt(m(0x1d7))/0xa);if(P===J)break;else z['push'](z['shift']());}catch(B){z['push'](z['shift']());}}}(a2Z,0xe3d18));var __createBinding=this&&this[a2L(0x202)]||(Object[a2L(0x264)]?function(Z,J,z,P){const M=a2L;if(P===undefined)P=z;var B=Object[M(0x1fe)](J,z);(!B||('get'in B?!J[M(0x231)]:B[M(0x22a)]||B[M(0x1d0)]))&&(B={'enumerable':!![],'get':function(){return J[z];}}),Object['defineProperty'](Z,P,B);}:function(Z,J,z,P){if(P===undefined)P=z;Z[P]=J[z];}),__setModuleDefault=this&&this[a2L(0x246)]||(Object[a2L(0x264)]?function(Z,J){const x=a2L;Object[x(0x1e2)](Z,x(0x234),{'enumerable':!![],'value':J});}:function(Z,J){Z['default']=J;}),__importStar=this&&this[a2L(0x23a)]||function(Z){const d=a2L;if(Z&&Z[d(0x231)])return Z;var J={};if(Z!=null){for(var z in Z)if(z!==d(0x234)&&Object[d(0x1de)][d(0x23f)]['call'](Z,z))__createBinding(J,Z,z);}return __setModuleDefault(J,Z),J;},__awaiter=this&&this['__awaiter']||function(Z,J,z,B){function U(s){return s instanceof z?s:new z(function(A){A(s);});}return new(z||(z=Promise))(function(s,A){const X=a2J;function n(v){const k=a2J;try{C(B[k(0x212)](v));}catch(o){A(o);}}function F(v){const N=a2J;try{C(B[N(0x251)](v));}catch(o){A(o);}}function C(v){const W=a2J;v[W(0x21b)]?s(v[W(0x265)]):U(v[W(0x265)])[W(0x20c)](n,F);}C((B=B[X(0x224)](Z,J||[]))[X(0x212)]());});},__importDefault=this&&this[a2L(0x25b)]||function(Z){const D=a2L;return Z&&Z[D(0x231)]?Z:{'default':Z};};function a2J(Z,J){const z=a2Z();return a2J=function(P,B){P=P-0x1ca;let U=z[P];return U;},a2J(Z,J);}function a2Z(){const Z1=['log','fullUrl','browser\x20login','set-token','service','3840XmgSDj','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','Changed\x20current\x20context\x20to\x20','__importDefault','useServiceId','39NzaEXa','action','removeContext','verifyToken','askForProject','token\x20login','askForContext','create','value','error','List\x20all\x20available\x20contexts','browserLogin','retry','test','NorthflankApiBrowserLogin','configurable','lodash','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','Use\x20project\x20with\x20id:','1088044Rbsgln','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','sort','710xaWNPW','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','list','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','-t,\x20--token\x20[TOKEN]','apiTokenLogin','getCommand','prototype','Name\x20for\x20login\x20context','Bearer\x20','contextAvailable','defineProperty','node-fetch','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','set','41106tIyLtH','Switch\x20between\x20your\x20local\x20contexts','context','token','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20',',\x20added\x20context\x20with\x20name\x20','job','tokenPrompt','getCurrentContext','printAsTable','--all','option','\x27\x20successfully\x20removed.','Token\x20for\x20current\x20context\x20\x27','italic','Remove\x20a\x20context','getCurrentBaseUrl','Shows\x20full\x20context\x20information\x20(including\x20tokens)','\x20(current)','../formatting/console-format-helpers','moveCursor','browser-opened','/v1/login','contextProvider','getOwnPropertyDescriptor','contexts','Token\x20for\x20this\x20context','askForService','__createBinding','defaultBaseUrl','Local\x20context\x20name\x20to\x20remove.','prompt','length','close','use','success','chalk','9834xhtnqF','then','--do-not-open-browser','stdout','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','../utils','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','next','valueOf','\x27\x20successfully\x20updated.','getInfo','useContext','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','update-token','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','sanitiseHostname','done','updateToken','2354856xFqMLE','dir','-n,\x20--name\x20[NAME]','confirm','host','Retrieve\x20and\x20update\x20local\x20context\x20settings.','../inquirer-helper','apply','\x0aSuccessfully\x20logged\x20in\x20using\x20','override','7140112dDSXFQ','getCurrentToken','alias','writable','useProjectId','InquirerHelper','--host\x20[HOST]','ctx','getProjectName','-i,\x20--id\x20[ID]','__esModule','10051120eIrlXw','search-list','default','Use\x20job\x20with\x20id:','https://','Error\x20occured\x20during\x20browser\x20login:\x20','doNotOpenBrowser','apiClient','__importStar','name','\x20(api\x20host:\x20','sessionToken=********','replace','hasOwnProperty','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','loadContextWrapper','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','addCommand','project','current','__setModuleDefault','description','--token-login','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','151155HqAEda','https://api.northflank.com','login','getCurrentProjectName','useJobId','warning','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','throw','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed'];a2Z=function(){return Z1;};return a2Z();}Object[a2L(0x1e2)](exports,a2L(0x231),{'value':!![]}),exports['CliContext']=void 0x0;const _=__importStar(require(a2L(0x1d1))),node_fetch_1=__importDefault(require(a2L(0x1e3))),chalk_1=__importDefault(require(a2L(0x20a))),utils_1=require(a2L(0x210)),inquirer_helper_1=require(a2L(0x223)),console_format_helpers_1=require(a2L(0x1f9)),browser_login_1=require('../login/browser-login'),inquirer=require('inquirer');class CliContext{constructor(Z,J=a2L(0x24b)){const q=a2L;this[q(0x203)]=J,this[q(0x21a)]=v=>{const y=q;let o=v;return!/^https?:\/\//i[y(0x1ce)](o)&&(o=y(0x236)+o),o=o[y(0x23e)](/\/+$/,''),o;},this[q(0x239)]=Z;const z=new inquirer_helper_1[(q(0x22c))](Z);this[q(0x24c)]=(0x0,utils_1['getCommand'])()[q(0x23b)](q(0x24c))['description'](q(0x240))['option'](q(0x248),'Use\x20manual\x20login\x20with\x20API\x20token',![])[q(0x1f1)](q(0x20d),q(0x1d2),![])[q(0x1f1)](q(0x21f),q(0x1df))[q(0x1f1)](q(0x1db),q(0x249))[q(0x1f1)](q(0x22d),'host\x20url\x20for\x20this\x20context',this[q(0x203)])[q(0x1f1)]('--override','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)',![])[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const O=q;_[O(0x1e5)](v,'host',this[O(0x21a)](v[O(0x221)]));const o=v['tokenLogin']||v[O(0x1e9)]!==undefined,{name:j,host:V,token:i,override:p}=o?yield this[O(0x1dc)](v,z):yield this['browserLogin'](v,z);try{yield this[O(0x239)][O(0x1fd)]['addContext']({'name':j,'host':V,'token':i},p);}catch(S){(0x0,utils_1[O(0x1ca)])(S['message']);return;}if(!(yield this[O(0x260)]()))(0x0,utils_1['error'])(O(0x242)),yield this[O(0x239)]['contextProvider'][O(0x25f)](j);else{const g=o?O(0x262):O(0x255),I=O(0x225)+g+O(0x1eb)+chalk_1[O(0x234)][O(0x1f4)](j)+O(0x23c)+V+')';(0x0,utils_1[O(0x209)])(I);}})),this['contexts']=(0x0,utils_1[q(0x1dd)])()['name'](q(0x1e8))[q(0x247)](q(0x222))[q(0x229)](q(0x1ff))[q(0x229)](q(0x22e));const P=(0x0,utils_1[q(0x1dd)])()[q(0x23b)](q(0x1d9))[q(0x23b)]('ls')[q(0x247)](q(0x1cb))[q(0x1f1)](q(0x1f0),q(0x1f7))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const G=q;console[G(0x253)](Z[G(0x1fd)][G(0x215)]());const o=Z['contextProvider'][G(0x241)]();if(v['all']===!![]){console[G(0x21e)](o);return;}const j=o[G(0x245)],V=o[G(0x1ff)][G(0x1d6)]((i,p)=>i['name']===j?-0x1:p['name']===j?0x1:0x0)['map'](i=>{const K=G,p=j===i['name']?K(0x1f8):'';return{'Name':''+i[K(0x23b)]+p,'Host':i[K(0x221)],'Default\x20Project':i[K(0x244)]||'-','Default\x20Service':i['service']||'-'};});(0x0,console_format_helpers_1[G(0x1ef)])(V,'Contexts');})),B=(0x0,utils_1['getCommand'])();B['name'](q(0x208))[q(0x247)](q(0x1e7))[q(0x1f1)](q(0x21f),'Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name')[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const l=q,o=(v===null||v===void 0x0?void 0x0:v[l(0x23b)])||(yield this['askForContext'](l(0x208)));yield this[l(0x239)]['contextProvider'][l(0x216)](o),(0x0,utils_1[l(0x209)])(l(0x25a)+o);}));const U=q(0x230),s=(0x0,utils_1[q(0x1dd)])()['name'](q(0x244))[q(0x247)](q(0x20f))['option'](U,q(0x1e4))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const b=q,o=(v===null||v===void 0x0?void 0x0:v['id'])||(yield z[b(0x261)]());yield this[b(0x239)][b(0x1fd)][b(0x22b)](o),console[b(0x253)](b(0x1d3),o);})),A=(0x0,utils_1[q(0x1dd)])()[q(0x23b)](q(0x257))['description'](q(0x211))[q(0x1f1)](U,q(0x250))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const f=q,o=(v===null||v===void 0x0?void 0x0:v['id'])||(yield z[f(0x201)](this[f(0x22f)]())());console[f(0x253)]('Use\x20service\x20with\x20id:',o),yield this[f(0x239)]['contextProvider'][f(0x25c)](o);})),n=(0x0,utils_1[q(0x1dd)])()[q(0x23b)](q(0x1ec))[q(0x247)](q(0x259))['option'](U,q(0x217))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const r=q,o=(v===null||v===void 0x0?void 0x0:v['id'])||(yield z['askForJob'](this[r(0x22f)]())());console[r(0x253)](r(0x235),o),yield this[r(0x239)][r(0x1fd)][r(0x24e)](o);}));B[q(0x243)](s),B[q(0x243)](n),B['addCommand'](A);const F=(0x0,utils_1[q(0x1dd)])()['name']('remove')['alias']('delete')[q(0x229)]('rm')[q(0x247)](q(0x1f5))['option'](U,q(0x204))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const w=q;var o;const j=(v===null||v===void 0x0?void 0x0:v['id'])||(yield this['askForContext']('remove')),V=(o=this[w(0x239)][w(0x1fd)][w(0x1ee)]())===null||o===void 0x0?void 0x0:o[w(0x23b)];yield this[w(0x239)][w(0x1fd)][w(0x25f)](j),(0x0,utils_1[w(0x209)])('Local\x20context\x20\x27'+j+w(0x1f2));if(!this[w(0x1e1)]()){(0x0,utils_1[w(0x24f)])(w(0x1d8));return;}if(V===j){const i=(v===null||v===void 0x0?void 0x0:v[w(0x23b)])||(yield this[w(0x263)]('use\x20from\x20now\x20on'));yield this[w(0x239)][w(0x1fd)]['useContext'](i),(0x0,utils_1[w(0x209)])(w(0x25a)+i);}})),C=(0x0,utils_1['getCommand'])()[q(0x23b)](q(0x218))['alias'](q(0x256))['description']('Update\x20token\x20for\x20current\x20context')[q(0x1f1)](q(0x1db),q(0x200))[q(0x25e)](v=>__awaiter(this,void 0x0,void 0x0,function*(){const Q=q,{contextProvider:o}=this[Q(0x239)],j=(v===null||v===void 0x0?void 0x0:v['token'])||(yield z[Q(0x1ed)]()),V=o['getCurrentToken']();yield o[Q(0x21c)](j);if(yield this[Q(0x260)]())(0x0,utils_1[Q(0x209)])(Q(0x1f3)+o['getCurrentName']()+Q(0x214));else{if(V)yield o[Q(0x21c)](V);(0x0,utils_1[Q(0x1ca)])(Q(0x252));}}));this[q(0x1ff)][q(0x243)](P),this[q(0x1ff)][q(0x243)](B),this[q(0x1ff)][q(0x243)](F),this['contexts'][q(0x243)](C);}[a2L(0x1cc)](Z,J){var z,P,B,U;return __awaiter(this,void 0x0,void 0x0,function*(){const T=a2J,s=!Z[T(0x238)],A=(z=Z[T(0x221)])!==null&&z!==void 0x0?z:this[T(0x203)],n=new browser_login_1[(T(0x1cf))](A,s);let F;n['on'](T(0x1fb),({url:j})=>{const c=T;if(s){const V=j[c(0x23e)](/sessionToken=.*/,c(0x23d));console['log'](c(0x1ea)+V+')'),F=inquirer[c(0x205)]([{'type':c(0x220),'name':c(0x254),'message':c(0x1d5),'default':![]}]),F[c(0x20c)](i=>{const t=c;process['stdout'][t(0x1fa)](0x0,-0x1),process[t(0x20e)]['clearLine'](0x1),i[t(0x254)]&&console[t(0x253)](t(0x219)+j+'\x20');});}else console['log'](c(0x219)+j+'\x20');});const {token:C,contextName:v}=yield n['startLogin']()['catch'](j=>__awaiter(this,void 0x0,void 0x0,function*(){const R=T;(0x0,utils_1[R(0x1ca)])(R(0x237)+j['message']+'.\x20Using\x20fallback.');const V=yield this[R(0x1dc)](Z,J);return{'token':V[R(0x1e9)],'contextName':V[R(0x23b)]};}))['finally'](()=>{const h=T;if(F)F['ui'][h(0x207)]();}),o=(B=(P=Z[T(0x23b)])!==null&&P!==void 0x0?P:v)!==null&&B!==void 0x0?B:'autologin-'+new Date()[T(0x213)]();return{'name':o,'token':C,'host':A,'override':(U=Z[T(0x226)])!==null&&U!==void 0x0?U:![]};});}[a2L(0x1dc)](Z,J){return __awaiter(this,void 0x0,void 0x0,function*(){const a=a2J,z=this[a(0x239)][a(0x1fd)][a(0x241)]()[a(0x1ff)],{name:P,token:B,host:U,override:s}=yield J['loginPrompt'](Z,z);return{'name':P,'token':B,'host':U,'override':s};});}['getProjectName'](){const u=a2L,Z=this[u(0x239)][u(0x1fd)][u(0x24d)]();if(Z===undefined)throw new Error(u(0x1da));return Z;}['askForContext'](Z){return __awaiter(this,void 0x0,void 0x0,function*(){const H=a2J;if(!this[H(0x1e1)]())throw new Error('No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.');const J=this[H(0x239)]['contextProvider'][H(0x241)]()[H(0x1ff)]['map'](P=>P[H(0x23b)]),z=J[H(0x206)]>0x4?H(0x233):'list';return(yield inquirer[H(0x205)]([{'type':z,'name':H(0x23b),'message':'Choose\x20the\x20context\x20to\x20'+Z+':','choices':J}]))['name'];});}[a2L(0x1e1)](){const Y=a2L;return this[Y(0x239)][Y(0x1fd)]['loadContextWrapper']()[Y(0x1ff)][Y(0x206)]>0x0;}[a2L(0x260)](){return __awaiter(this,void 0x0,void 0x0,function*(){const E=a2J;try{const Z=this[E(0x239)][E(0x1fd)][E(0x1f6)](),J=this[E(0x239)]['contextProvider'][E(0x228)](),z=Z+E(0x1fc),P={'Authorization':E(0x1e0)+J},B=yield(0x0,utils_1[E(0x1cd)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const Z0=E;return(0x0,node_fetch_1[Z0(0x234)])(z,{'method':'GET','timeout':0xbb8,'headers':P});}));if(B['ok'])return!![];return![];}catch(U){return![];}});}}exports['CliContext']=CliContext;
|