@northflank/cli 0.9.18 → 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 +1 -1
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';function a1V(){const Vy=['regions','subdomainPath','kebabCase','version','buildId','templates','delete','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','contextProvider','underline','plan','./defaults','getOwnPropertyDescriptor','scrt','quiet','page','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','jobId','askConfirm','join','__createBinding','lodash','./inquirer-helper','templateId','backups','Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27','vol','prj','inv','askForSubdomain','askForProject','76dtxNzI','currentOffset','isString','104072iHxmqH','addCommand','__awaiter','credentialId','data','bind','toUpperCase','body','toString','then','pipelineId','endsWith','yml','File\x20does\x20not\x20exist:\x20','branches','clusterId','next','Documentation:\x20','includes','getAll','subdomain','log','./utils','upperFirst','create','force','opts','grey','map','value','getMetricsCommand','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','docsTagsPath','262024LxaLAw','opt','askForAddonBackup','branch','backup','CliMetrics','Command','Resource\x20was\x20not\x20deleted.','forEach','execCmd','parseAsync','service','repos','required','VERBOSE:\x20Using\x20endpoint\x20->\x20','type','Unknown\x20input\x20file\x20type:\x20',',\x20-','stdout','done','requiredPermissions','volumeId','customUserAgent','printAsTable','default','length','moveCursor','repositories','dmn','adn','green','checkUpdate','nonInteractiveEndpoint','addHelpCommand','method','secrets','./logs','query','PaginationHelper','projects','domain','./context/contextCommands','tpl','6041ykVJWb','cred','warning','restores','logs','alias','.yaml','hasNext','file','omit','repository','clearLine','serviceId','rawResponse','API\x20request\x20failed\x0a\x09Message:\x20','skipValidation','Display\x20help\x20for\x20command','path','getOwnPropertyNames','askForService','resource','secretId','jobs','exitCode','=>\x20running\x20command\x20with:\x20','configurable','set','invoice','CliPortForward','isPaginatedEndpoint','askForVolume','svc','loadAll','templateRunId','error','getNext','-v,\x20--version','isArray','pln','volumes','defineProperty','runs','existsSync','askForTemplate','domains','base','parse','Northflank\x20cli\x20version:\x20','yaml','job','boolean','getCurrentServiceName','list','assign','askForPipeline','template','update','askForDomain','42piZouB','json','askForBuild','File\x20to\x20load\x20resource\x20json\x20from','./exec','after','askGeneric','brn','defaults','\x20properties','\x0a>\x20Token\x20permissions\x20required:\x20','has','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','9625860ahqHTB','176430OjyJSn','js-yaml','CliContext','addon','tags','action','host','commands','getProgram','./formatting/command-overview','custom-columns=','safeLoad','name','backupId','asyncSequential','credentials','isEqual','replace','--verbose','\x0a\x09details\x20:','northflank','apply','description','58nobjml','.json','209OHqRLo','setPathVars','filter','subdomainId','contexts','__importStar','ApiClientFileContextProvider','askForTemplateRun','__esModule','option','get','rgn','argv','noDefaults','\x20Northflank\x20resources','\x20--','portFwdCmd','28482CbrfWo','Get\x20information\x20about\x20Northflank\x20','deleteWarningPrompt','/docs/v1/api/','paginationArgs',',\x20NF\x20error\x20id:\x20','entries','./formatting/console-format-helpers','message','./pagination/pagination-helper','find','region','throw','13WbuZtd','runId','getCurrentJobName','resourceTagId','addonId','askForCredentials','domainId','getLogsCommand','keys','plans','output','logSinkId','projectId','login','ApiClient','963080JkvMlO','askForClusterId','retrievePayloadViaInteractiveCli','207kXhsoJ','credential','split','some','enablePositionalOptions','writable','CliExec','addons','getCurrentContext','askForAddon','OPTIONAL:\x20'];a1V=function(){return Vy;};return a1V();}const a1VB=a1I;(function(V,I){const Vz=a1I,v=V();while(!![]){try{const j=parseInt(Vz(0x25e))/0x1*(-parseInt(Vz(0x1b3))/0x2)+-parseInt(Vz(0x1c6))/0x3*(-parseInt(Vz(0x20f))/0x4)+-parseInt(Vz(0x1e2))/0x5+parseInt(Vz(0x18e))/0x6*(-parseInt(Vz(0x233))/0x7)+-parseInt(Vz(0x212))/0x8*(parseInt(Vz(0x1e5))/0x9)+-parseInt(Vz(0x19c))/0xa*(-parseInt(Vz(0x1b5))/0xb)+parseInt(Vz(0x19b))/0xc*(parseInt(Vz(0x1d3))/0xd);if(j===I)break;else v['push'](v['shift']());}catch(U){v['push'](v['shift']());}}}(a1V,0x5ee72));var __createBinding=this&&this[a1VB(0x204)]||(Object[a1VB(0x22a)]?function(V,I,v,j){const VY=a1VB;if(j===undefined)j=v;var U=Object[VY(0x1fc)](I,v);(!U||('get'in U?!I[VY(0x1bd)]:U[VY(0x1ea)]||U[VY(0x277)]))&&(U={'enumerable':!![],'get':function(){return I[v];}}),Object[VY(0x17c)](V,j,U);}:function(V,I,v,j){if(j===undefined)j=v;V[j]=I[v];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object[a1VB(0x22a)]?function(V,I){const Vi=a1VB;Object[Vi(0x17c)](V,'default',{'enumerable':!![],'value':I});}:function(V,I){V['default']=I;}),__importStar=this&&this[a1VB(0x1ba)]||function(V){const Vo=a1VB;if(V&&V[Vo(0x1bd)])return V;var I={};if(V!=null){for(var v in V)if(v!==Vo(0x24b)&&Object['prototype']['hasOwnProperty']['call'](V,v))__createBinding(I,V,v);}return __setModuleDefault(I,V),I;},__awaiter=this&&this[a1VB(0x214)]||function(V,I,v,j){function U(l){return l instanceof v?l:new v(function(x){x(l);});}return new(v||(v=Promise))(function(l,x){const VM=a1I;function N(z){const VH=a1I;try{D(j[VH(0x222)](z));}catch(B){x(B);}}function e(z){const VT=a1I;try{D(j[VT(0x1d2)](z));}catch(B){x(B);}}function D(z){const Vb=a1I;z[Vb(0x246)]?l(z[Vb(0x22f)]):U(z[Vb(0x22f)])[Vb(0x21b)](N,e);}D((j=j[VM(0x1b1)](V,I||[]))[VM(0x222)]());});},__importDefault=this&&this['__importDefault']||function(V){const VX=a1VB;return V&&V[VX(0x1bd)]?V:{'default':V};};function a1I(V,I){const v=a1V();return a1I=function(j,U){j=j-0x17a;let l=v[j];return l;},a1I(V,I);}Object[a1VB(0x17c)](exports,a1VB(0x1bd),{'value':!![]}),exports['getProgram']=void 0x0;const js_client_1=require('@northflank/js-client'),commander_1=__importDefault(require('commander')),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require('chalk')),_=__importStar(require(a1VB(0x205))),contextCommands_1=require(a1VB(0x25c)),utils_1=require(a1VB(0x228)),defaults=__importStar(require(a1VB(0x1fb))),inquirer_helper_1=require(a1VB(0x206)),console_format_helpers_1=require(a1VB(0x1cd)),command_overview_1=require(a1VB(0x1a5)),port_forward_1=require('./port-forward'),exec_1=require(a1VB(0x192)),logs_1=require(a1VB(0x257)),metrics_1=require('./metrics'),pagination_helper_1=require(a1VB(0x1cf)),yaml=require(a1VB(0x19d)),pgk=require('../package.json'),getProgram=V=>{const VE=a1VB,I=new commander_1[(VE(0x24b))][(VE(0x239))](VE(0x1b0));I[VE(0x1b2)]('Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line'),I[VE(0x1e9)](!![]),I[VE(0x1f3)](VE(0x183)+chalk_1['default'][VE(0x1f9)](pgk[VE(0x1f3)]),VE(0x282),'Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli');const v=new js_client_1['ApiClient'](V,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[VE(0x249)]}),j=new contextCommands_1[(VE(0x19e))](v),U=new port_forward_1[(VE(0x27a))](V),l=new exec_1[(VE(0x1eb))](V),x=new logs_1['CliLogs'](V),N=new metrics_1[(VE(0x238))](V);return I[VE(0x213)](U[VE(0x1c5)]),I[VE(0x213)](l[VE(0x23c)]),I[VE(0x213)](j[VE(0x1e0)]),I['addCommand'](j[VE(0x1b9)]),generateCommands(v,v['endpoints'],I,x,N),I[VE(0x213)]((0x0,command_overview_1['getCommandOverview'])(I)),I[VE(0x254)](!![],VE(0x26e)),I['helpOption'](undefined,VE(0x26e)),I;};exports[a1VB(0x1a4)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Vf=a1VB;try{const V=new js_client_1[(Vf(0x1bb))]();yield(0x0,utils_1[Vf(0x252)])(V);const I=(0x0,exports['getProgram'])(V);yield I[Vf(0x23d)](process['argv']);}catch(v){(0x0,utils_1[Vf(0x280)])(Vf(0x231)+v[Vf(0x1ce)]),process[Vf(0x1c1)][Vf(0x1d0)](j=>j===Vf(0x1ae))&&console[Vf(0x227)](v),process[Vf(0x275)]=0x1;}}))());function isListCommand(V){const VG=a1VB,I=[[VG(0x1bf),'addon',VG(0x208)],[VG(0x1bf),VG(0x185),VG(0x17d)]];return V['find'](v=>v===VG(0x188))||I[VG(0x1e8)](v=>_[VG(0x1ac)](V,v));}function generateCommands(V,I,v,j,U,l=defaults[a1VB(0x196)],x=[]){const VP=a1VB,N=new inquirer_helper_1['InquirerHelper'](new js_client_1[(VP(0x1e1))](V[VP(0x1f8)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent']}));function e(Y,i){const Va=VP;return Y[Va(0x240)]!==![]&&i===undefined;}function D(Y,i){const Vs=VP,{opt:o,name:H}=Y,T=o[Vs(0x24b)],b=e(o,T),M=a=>a['length']>0x1?'--'+a:'-'+a,X=o===null||o===void 0x0?void 0x0:o[Vs(0x263)],E=X?_[Vs(0x283)](X)?'-'+(X===null||X===void 0x0?void 0x0:X[Vs(0x22e)](s=>M(s))[Vs(0x203)](Vs(0x244)))+',':''+M(X):'',f=b?'':Vs(0x1ef),G=typeof o[Vs(0x242)]===Vs(0x186)||o[Vs(0x242)]===Vs(0x186)?E+'\x20--'+H:E+Vs(0x1c4)+H+'\x20<'+H[Vs(0x218)]()+'>',P=f+o[Vs(0x1b2)];i[Vs(0x1be)](G,P,T);}function z(Y,i){const Vd=VP;if(i[Vd(0x1a3)]['some'](o=>o['name']()===Vd(0x262)))return;_[Vd(0x1ac)](Y,[Vd(0x1bf),Vd(0x23e)])&&(i[Vd(0x213)](j[Vd(0x1da)](Vd(0x23e))),i['addCommand'](U[Vd(0x230)](Vd(0x23e))),i['addCommand'](j[Vd(0x1da)](Vd(0x23e),!![])),i[Vd(0x213)](U[Vd(0x230)](Vd(0x23e),!![]))),_[Vd(0x1ac)](Y,[Vd(0x1bf),Vd(0x185)])&&(i[Vd(0x213)](j[Vd(0x1da)](Vd(0x185))),i['addCommand'](U[Vd(0x230)]('job')),i[Vd(0x213)](j['getLogsCommand'](Vd(0x185),!![])),i[Vd(0x213)](U[Vd(0x230)](Vd(0x185),!![]))),_[Vd(0x1ac)](Y,[Vd(0x1bf),Vd(0x19f)])&&(i[Vd(0x213)](j['getLogsCommand'](Vd(0x19f))),i[Vd(0x213)](U[Vd(0x230)](Vd(0x19f)))),_['isEqual'](Y,[Vd(0x1bf),'addon',Vd(0x237)])&&i['addCommand'](j[Vd(0x1da)](Vd(0x19f),![],!![])),_[Vd(0x1ac)](Y,[Vd(0x1bf),Vd(0x19f),Vd(0x261)])&&i['addCommand'](j['getLogsCommand'](Vd(0x19f),![],!![],!![]));}return Object[VP(0x270)](l)[VP(0x23b)](Y=>{const VQ=VP,i=I[Y],o=l[Y],H=x['concat']([Y]);function T(d,t){const Vt=a1I,R=Object[Vt(0x270)](d||{});R[Vt(0x22e)](u=>{return{'name':u,'opt':d[u]};})['sort']((u,n)=>!e(u['opt'])?!e(n[Vt(0x234)])?0x0:0x1:-0x1)[Vt(0x23b)](u=>{D(u,t);});}function b(d,t){const VR=a1I,R=[['project',VR(0x25a),VR(0x20b)],[VR(0x23e),'services',VR(0x27d)],[VR(0x1ab),VR(0x1e6),VR(0x25f)],[VR(0x19f),VR(0x1ec),VR(0x250)],['job',VR(0x274)],[VR(0x1fa),VR(0x1dc),VR(0x17a)],[VR(0x1d1),VR(0x1f0),VR(0x1c0)],[VR(0x25b),VR(0x180),VR(0x24f)],['secret',VR(0x256),VR(0x1fd)],[VR(0x17b),'volume',VR(0x20a)],[VR(0x220),VR(0x236),VR(0x195)],[VR(0x279),'invoices',VR(0x20c)],[VR(0x18b),VR(0x1f5),VR(0x25d)],[VR(0x23f),VR(0x268),VR(0x24e),'repo'],['tag',VR(0x1a0)]],u=R[VR(0x1d0)](n=>n[VR(0x224)](t));if(u!==undefined)d['aliases'](u[VR(0x1b7)](n=>n!==t));}function M(d){var t,R;return __awaiter(this,void 0x0,void 0x0,function*(){const Vu=a1I,u={},{contextProvider:n}=V,q=H[Vu(0x224)](Vu(0x1f6)),J=d[Vu(0x1c2)]===!![];function L(Z,S,h){var Q,F;return __awaiter(this,void 0x0,void 0x0,function*(){const Vn=a1I;if(_[Vn(0x199)]((F=(Q=o[Vn(0x234)])===null||Q===void 0x0?void 0x0:Q[Vn(0x26f)])!==null&&F!==void 0x0?F:{},Z)){const W=!J&&!q&&h?h():undefined,y=d[Z]||W||(yield S());_['set'](u,Z,y);}});}return yield(0x0,utils_1[Vu(0x1aa)])(Object[Vu(0x1cc)]((R=(t=o[Vu(0x234)])===null||t===void 0x0?void 0x0:t[Vu(0x26f)])!==null&&R!==void 0x0?R:{}),([Z,S])=>__awaiter(this,void 0x0,void 0x0,function*(){const Vq=Vu;var h;const Q=u===null||u===void 0x0?void 0x0:u[Vq(0x1df)],F=u===null||u===void 0x0?void 0x0:u[Vq(0x207)];switch(Z){case Vq(0x1df):return yield L(Vq(0x1df),N[Vq(0x20e)][Vq(0x217)](N),n['getCurrentProjectName']['bind'](n));case Vq(0x26a):return yield L(Vq(0x26a),N[Vq(0x271)](Q)[Vq(0x217)](N),n[Vq(0x187)]['bind'](n));case Vq(0x1d7):return yield L(Vq(0x1d7),N[Vq(0x1ee)](Q)[Vq(0x217)](N));case Vq(0x201):return yield L('jobId',N['askForJob'](Q)[Vq(0x217)](N),n[Vq(0x1d5)][Vq(0x217)](n));case Vq(0x1d4):return yield L(Vq(0x1d4),N['askForJobRun'](u[Vq(0x201)],Q,![])[Vq(0x217)](N));case'secretId':return yield L(Vq(0x273),N['askForSecret'](Q)[Vq(0x217)](N));case Vq(0x25b):case Vq(0x1d9):return yield L(Vq(0x25b),N[Vq(0x18d)][Vq(0x217)](N));case Vq(0x215):return yield L(Vq(0x215),N[Vq(0x1d8)]['bind'](N));case Vq(0x248):return yield L('volumeId',N[Vq(0x27c)](Q)[Vq(0x217)](N));case Vq(0x226):return yield L(Vq(0x226),N['askForSubdomain'](u[Vq(0x25b)])['bind'](N));case'subdomainId':return yield L(Vq(0x1b8),N[Vq(0x20d)](u['domainId'])[Vq(0x217)](N));case'subdomainPath':return yield L(Vq(0x1f1),N['askForSubdomainPath'](u[Vq(0x25b)],(h=u['subdomain'])!==null&&h!==void 0x0?h:u[Vq(0x1b8)])[Vq(0x217)](N));case Vq(0x1a9):return yield L('backupId',N[Vq(0x235)](Q,u[Vq(0x1d7)])[Vq(0x217)](N));case'buildId':return yield L(Vq(0x1f4),N[Vq(0x190)](Q,u[Vq(0x26a)],u['jobId'])[Vq(0x217)](N));case'templateId':return yield L(Vq(0x207),N[Vq(0x17f)]()['bind'](N));case Vq(0x27f):return yield L(Vq(0x27f),N[Vq(0x1bc)](F)['bind'](N));case Vq(0x1de):return yield L(Vq(0x1de),N['askForLogSink']()[Vq(0x217)](N));case'pipelineId':return yield L(Vq(0x21c),N[Vq(0x18a)](Q)[Vq(0x217)](N));case Vq(0x1d6):return yield L(Vq(0x1d6),N['askForTag']()[Vq(0x217)](N));case Vq(0x221):return yield L(Vq(0x221),N[Vq(0x1e3)]()[Vq(0x217)](N));default:return yield L(Z,N[Vq(0x194)](Z,S===null||S===void 0x0?void 0x0:S[Vq(0x1b2)])[Vq(0x217)](N));}})),u;});}function X(d){var t,R,u;return __awaiter(this,void 0x0,void 0x0,function*(){const VJ=a1I,n={},q=((t=o[VJ(0x234)])===null||t===void 0x0?void 0x0:t[VJ(0x27b)])?defaults['paginationArgs']:{},J=Object[VJ(0x189)](Object[VJ(0x189)]({},(u=(R=o['opt'])===null||R===void 0x0?void 0x0:R['query'])!==null&&u!==void 0x0?u:{}),q),L=Object[VJ(0x1db)](J)[VJ(0x1b7)](Z=>Z!==VJ(0x27e));return yield(0x0,utils_1[VJ(0x1aa)])(L,Z=>__awaiter(this,void 0x0,void 0x0,function*(){const VL=VJ;if(d[Z]!==undefined)return _[VL(0x278)](n,Z,d[Z]);})),n;});}function E(){const VZ=a1I;switch(H[0x0]){case VZ(0x1bf):return VZ(0x1c7)+(H[0x1]||'resource')+'s';case VZ(0x18c):return'Update\x20Northflank\x20'+(H[0x1]||VZ(0x272))+VZ(0x197);default:return _['upperFirst'](Y)+VZ(0x1c3);}}function f(d,t){const VS=a1I;var R,u,n,q,J,L,Z,S;if(!t){const g=(0x0,utils_1['getCommand'])()[VS(0x1a8)](_[VS(0x1f2)](Y))[VS(0x1b2)](E());return b(g,Y),g;}const h=(d===null||d===void 0x0?void 0x0:d[VS(0x247)])?chalk_1[VS(0x24b)][VS(0x22d)](VS(0x198)+d[VS(0x247)]):'',Q=V[VS(0x1f8)][VS(0x1ed)](),F=Q!==undefined&&((R=o===null||o===void 0x0?void 0x0:o[VS(0x234)])===null||R===void 0x0?void 0x0:R[VS(0x232)])!==undefined,W=Q===null||Q===void 0x0?void 0x0:Q[VS(0x1a2)]['replace']('api.',''),y=F?VS(0x223)+W+VS(0x1c9)+((u=o===null||o===void 0x0?void 0x0:o[VS(0x234)])===null||u===void 0x0?void 0x0:u[VS(0x232)]):'',p=(d===null||d===void 0x0?void 0x0:d[VS(0x1b2)])||'',c=(0x0,utils_1['getCommand'])(!![])[VS(0x1a8)](_['kebabCase'](Y))[VS(0x1b2)](p)['addHelpText'](VS(0x193),[h,y][VS(0x203)]('\x0a'));return b(c,Y),(((n=o[VS(0x234)])===null||n===void 0x0?void 0x0:n['body'])||((q=o[VS(0x234)])===null||q===void 0x0?void 0x0:q[VS(0x253)]))&&(c[VS(0x1be)]('-f,\x20--file\x20<file-path>',VS(0x191)),c['option']('-i,\x20--input\x20<resource-def>',VS(0x1f7))),T((J=o['opt'])===null||J===void 0x0?void 0x0:J[VS(0x26f)],c),T((L=o[VS(0x234)])===null||L===void 0x0?void 0x0:L[VS(0x258)],c),((Z=o[VS(0x234)])===null||Z===void 0x0?void 0x0:Z['isPaginatedEndpoint'])&&T(defaults[VS(0x1ca)],c),T((S=o[VS(0x234)])===null||S===void 0x0?void 0x0:S[VS(0x181)],c),c[VS(0x1a1)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const Vh=VS;var K,C,k,O;(0x0,utils_1['assertContextExisting'])(V);const w=c[Vh(0x22c)](),A=w[Vh(0x1ff)]!==undefined||w['cursor']!==undefined;if(w[Vh(0x27e)]===!![]&&A)throw new Error(Vh(0x209));const m=w===null||w===void 0x0?void 0x0:w[Vh(0x1dd)],r=m===Vh(0x18f),V0=m===Vh(0x184)||m===Vh(0x21e),V1=yield M(w);N[Vh(0x1b6)](V1);const V2=yield X(w),V3=Object['keys']((C=(K=o[Vh(0x234)])===null||K===void 0x0?void 0x0:K[Vh(0x26f)])!==null&&C!==void 0x0?C:{})['map'](V8=>V8+'='+chalk_1[Vh(0x24b)][Vh(0x251)](V1[V8]))[Vh(0x203)](',\x20');if(V3[Vh(0x24c)]>0x0&&!r&&!V0){const V8=Vh(0x276)+V3;console[Vh(0x227)](V8);}const V4=((k=o['opt'])===null||k===void 0x0?void 0x0:k[Vh(0x219)])||((O=o[Vh(0x234)])===null||O===void 0x0?void 0x0:O[Vh(0x253)])?yield yield B(w,o,H):undefined;if(!w[Vh(0x22b)]&&H[Vh(0x224)]('delete')&&!(yield N[Vh(0x1c8)]())){(0x0,utils_1[Vh(0x260)])(Vh(0x23a));return;}const V5=new pagination_helper_1[(Vh(0x259))](i,V1,V2,V4),V6=w[Vh(0x27e)]||(w[Vh(0x1dd)]===Vh(0x18f)||w[Vh(0x1dd)]===Vh(0x184))&&!A,V7=V6?yield V5[Vh(0x225)]():yield V5[Vh(0x281)]();if(w===null||w===void 0x0?void 0x0:w['verbose']){const V9=V7['request'];console[Vh(0x227)](Vh(0x241)+V9[Vh(0x255)][Vh(0x218)]()+':'+V9['url']);if(V4!==undefined)console[Vh(0x227)]('VERBOSE:\x20Request\x20body\x20->\x20'+V4);}if(V7[Vh(0x280)]){const {details:VV,id:VI,message:Vv,status:Vj}=V7[Vh(0x280)],VU=VV?Vh(0x1af)+JSON['stringify'](VV):'',Vl=VI?Vh(0x1cb)+VI:'',Vx='(HTTP\x20status\x20code:\x20'+Vj+Vl+')';throw new Error(Vh(0x26c)+Vv+'\x20'+Vx+VU);}printCallResult(w,r,V7[Vh(0x216)],V0,H,m,![],0x0,V7[Vh(0x26b)]['status']);if(!w[Vh(0x1fe)]&&!V6&&!A&&V5[Vh(0x265)]())while(V5['hasNext']()){const VN=yield N[Vh(0x202)]('there\x20are\x20more\x20rows,\x20load?');if(VN){process[Vh(0x245)][Vh(0x24d)](0x0,-0x1),process[Vh(0x245)][Vh(0x269)](0x1);const Ve=V5[Vh(0x210)],VD=yield V5['getNext']();printCallResult(w,r,VD[Vh(0x216)],V0,H,m,!![],Ve,VD[Vh(0x26b)]['status']);}else return;}})),c;}const G=_[VQ(0x199)](o,'opt'),P=i,a=f(P,G);z(H,a),v[VQ(0x213)](a);const s=_[VQ(0x267)](o,VQ(0x234));Object[VQ(0x1db)](s)[VQ(0x24c)]>0x0&&generateCommands(V,i,a,j,U,s,H);});function B(Y,i,o){var H;return __awaiter(this,void 0x0,void 0x0,function*(){const VF=a1I,{input:T,file:b}=Y;if(T!==undefined)try{return JSON[VF(0x182)](T);}catch(M){try{return yaml[VF(0x1a7)](T);}catch(X){throw new Error(VF(0x200));}}if(b!==undefined){if(!fs_1[VF(0x24b)][VF(0x17e)](b))throw new Error(VF(0x21f)+b);const E=fs_1[VF(0x24b)]['readFileSync'](b)[VF(0x21a)]();let f;try{if(_[VF(0x211)](E)){if(Y[VF(0x266)][VF(0x21d)](VF(0x1b4)))f=JSON['parse'](E);else{if(Y[VF(0x266)]['endsWith'](VF(0x264))||Y['file'][VF(0x21d)](VF(0x21e)))f=yaml[VF(0x1a7)](E);else throw new Error(VF(0x243)+Y[VF(0x266)][VF(0x1e7)]('.')['pop']());}}else f=E;return f;}catch(G){throw new Error('Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20'+G[VF(0x1ce)]);}}if((H=i===null||i===void 0x0?void 0x0:i[VF(0x234)])===null||H===void 0x0?void 0x0:H[VF(0x253)])throw new Error(VF(0x19a));return yield N[VF(0x1e4)](i,{'cmdPath':o,'skipValidation':Y[VF(0x26d)]});});}}const printCallResult=(V,I,v,j,U,l,x,N,e)=>{const VW=a1VB;if(!(V===null||V===void 0x0?void 0x0:V[VW(0x1fe)])){if(I)(0x0,console_format_helpers_1['handleJsonOutput'])(V===null||V===void 0x0?void 0x0:V[VW(0x1dd)],v);else{if(j)(0x0,console_format_helpers_1['handleYamlOutput'])(V===null||V===void 0x0?void 0x0:V['output'],v);else{if(isListCommand(U)){const D=(l===null||l===void 0x0?void 0x0:l['startsWith'](VW(0x1a6)))?l[VW(0x1ad)](VW(0x1a6),'')['split'](',')['map'](o=>o['toLowerCase']()):undefined,z=U[U[VW(0x24c)]-0x1],B=''+z+(z[VW(0x21d)]('s')?'':'s'),Y=_[VW(0x229)](B),i=_[VW(0x199)](v,B)?v[B]:v;(0x0,console_format_helpers_1[VW(0x24a)])(i,Y,D,x,N);}else console[VW(0x227)]((0x0,console_format_helpers_1['consoleFormat'])(v,e));}}}};
|
|
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 a2f=a2I;function a2V(){const V1=['Local\x20context\x20\x27','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','List\x20all\x20available\x20contexts','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','browser-opened','context','sessionToken=********','call','48027dLguXc','112TACqxL','addContext','default','job','GET','then','next','--token-login','useContext','2295816odshbu','clearLine','dir','Contexts','__importDefault','68MQZitK','catch','\x27\x20successfully\x20removed.','contextProvider','name','../inquirer-helper','getCurrentContext','tokenPrompt','Remove\x20a\x20context','use','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','Retrieve\x20and\x20update\x20local\x20context\x20settings.','removeContext','Use\x20job\x20with\x20id:','option','__esModule','update-token','browser\x20login','NorthflankApiBrowserLogin','../formatting/console-format-helpers','lodash','all','Name\x20for\x20login\x20context','apiTokenLogin','../utils','CliContext','https://','--all','InquirerHelper','apiClient','token','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','\x20(api\x20host:\x20','Token\x20for\x20current\x20context\x20\x27','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','override','__importStar','loadContextWrapper','defineProperty','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','prototype','-t,\x20--token\x20[TOKEN]','current','error','contexts','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','action','tokenLogin','addCommand','warning','startLogin','finally',',\x20added\x20context\x20with\x20name\x20','8683880toLJwT','\x27\x20successfully\x20updated.','value','-n,\x20--name\x20[NAME]','sort','https://api.northflank.com','Choose\x20the\x20context\x20to\x20','--host\x20[HOST]','getOwnPropertyDescriptor','5614605tiQrRE','sanitiseHostname','log','close','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','loginPrompt','\x0aSuccessfully\x20logged\x20in\x20using\x20','configurable','ctx','224870lFMlNt','stdout','apply','__awaiter','Use\x20manual\x20login\x20with\x20API\x20token','getCurrentToken','message','\x20(current)','search-list','Update\x20token\x20for\x20current\x20context','Error\x20occured\x20during\x20browser\x20login:\x20','host\x20url\x20for\x20this\x20context','149156sAcZup','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','getProjectName','106362vsQhyK','askForProject','updateToken','useProjectId','use\x20from\x20now\x20on','2JVvaJa','writable','Token\x20for\x20this\x20context','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Bearer\x20','verifyToken','--override','hasOwnProperty','getCurrentName','/v1/login','fullUrl','-i,\x20--id\x20[ID]','success','askForJob','getCommand','Changed\x20current\x20context\x20to\x20','askForService','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','map','--do-not-open-browser','list','host','remove','delete','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','replace','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','prompt','defaultBaseUrl','__createBinding','useServiceId','project','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','throw','valueOf','alias','token\x20login','contextAvailable','set-token','service','askForContext','description','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','../login/browser-login','getInfo','autologin-'];a2V=function(){return V1;};return a2V();}(function(V,I){const E=a2I,v=V();while(!![]){try{const j=parseInt(E(0x163))/0x1+parseInt(E(0x16b))/0x2*(parseInt(E(0x166))/0x3)+parseInt(E(0x110))/0x4*(parseInt(E(0x157))/0x5)+-parseInt(E(0x10b))/0x6+parseInt(E(0x101))/0x7*(parseInt(E(0x102))/0x8)+parseInt(E(0x14e))/0x9+-parseInt(E(0x145))/0xa;if(j===I)break;else v['push'](v['shift']());}catch(U){v['push'](v['shift']());}}}(a2V,0x660fb));var __createBinding=this&&this[a2f(0xe7)]||(Object['create']?function(V,I,v,j){const G=a2f;if(j===undefined)j=v;var U=Object[G(0x14d)](I,v);(!U||('get'in U?!I[G(0x11f)]:U[G(0x16c)]||U[G(0x155)]))&&(U={'enumerable':!![],'get':function(){return I[v];}}),Object[G(0x136)](V,j,U);}:function(V,I,v,j){if(j===undefined)j=v;V[j]=I[v];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object['create']?function(V,I){const P=a2f;Object[P(0x136)](V,P(0x104),{'enumerable':!![],'value':I});}:function(V,I){const a=a2f;V[a(0x104)]=I;}),__importStar=this&&this[a2f(0x134)]||function(V){const s=a2f;if(V&&V[s(0x11f)])return V;var I={};if(V!=null){for(var v in V)if(v!==s(0x104)&&Object[s(0x138)][s(0xd1)][s(0x100)](V,v))__createBinding(I,V,v);}return __setModuleDefault(I,V),I;},__awaiter=this&&this[a2f(0x15a)]||function(V,I,v,j){function U(l){return l instanceof v?l:new v(function(x){x(l);});}return new(v||(v=Promise))(function(l,x){const u=a2I;function N(z){const d=a2I;try{D(j[d(0x108)](z));}catch(B){x(B);}}function e(z){const t=a2I;try{D(j[t(0xeb)](z));}catch(B){x(B);}}function D(z){const R=a2I;z['done']?l(z['value']):U(z[R(0x147)])['then'](N,e);}D((j=j[u(0x159)](V,I||[]))['next']());});},__importDefault=this&&this[a2f(0x10f)]||function(V){const n=a2f;return V&&V[n(0x11f)]?V:{'default':V};};Object[a2f(0x136)](exports,a2f(0x11f),{'value':!![]}),exports[a2f(0x129)]=void 0x0;const _=__importStar(require(a2f(0x124))),node_fetch_1=__importDefault(require('node-fetch')),chalk_1=__importDefault(require('chalk')),utils_1=require(a2f(0x128)),inquirer_helper_1=require(a2f(0x115)),console_format_helpers_1=require(a2f(0x123)),browser_login_1=require(a2f(0xf6)),inquirer=require('inquirer');function a2I(V,I){const v=a2V();return a2I=function(j,U){j=j-0xcd;let l=v[j];return l;},a2I(V,I);}class CliContext{constructor(V,I=a2f(0x14a)){const q=a2f;this[q(0xe6)]=I,this[q(0x14f)]=B=>{const J=q;let Y=B;return!/^https?:\/\//i['test'](Y)&&(Y=J(0x12a)+Y),Y=Y[J(0xe3)](/\/+$/,''),Y;},this[q(0x12d)]=V;const v=new inquirer_helper_1[(q(0x12c))](V);this['login']=(0x0,utils_1['getCommand'])()[q(0x114)]('login')[q(0xf3)]('Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.')[q(0x11e)](q(0x109),q(0x15b),![])['option'](q(0xdd),q(0x152),![])[q(0x11e)]('-n,\x20--name\x20[NAME]',q(0x126))['option'](q(0x139),q(0xe2))[q(0x11e)](q(0x14c),q(0x162),this[q(0xe6)])['option'](q(0xd0),q(0x132),![])[q(0x13e)](B=>__awaiter(this,void 0x0,void 0x0,function*(){const L=q;_['set'](B,L(0xdf),this[L(0x14f)](B[L(0xdf)]));const Y=B[L(0x13f)]||B[L(0x12e)]!==undefined,{name:i,host:o,token:H,override:T}=Y?yield this[L(0x127)](B,v):yield this['browserLogin'](B,v);try{yield this[L(0x12d)][L(0x113)][L(0x103)]({'name':i,'host':o,'token':H},T);}catch(b){(0x0,utils_1[L(0x13b)])(b['message']);return;}if(!(yield this[L(0xcf)]()))(0x0,utils_1['error'])(L(0xf5)),yield this['apiClient'][L(0x113)][L(0x11c)](i);else{const M=Y?L(0xee):L(0x121),X=L(0x154)+M+L(0x144)+chalk_1[L(0x104)]['italic'](i)+L(0x130)+o+')';(0x0,utils_1['success'])(X);}})),this[q(0x13c)]=(0x0,utils_1[q(0xd8)])()['name'](q(0xfe))[q(0xf3)](q(0x11b))[q(0xed)](q(0x13c))['alias'](q(0x156));const j=(0x0,utils_1['getCommand'])()[q(0x114)](q(0xde))[q(0x114)]('ls')[q(0xf3)](q(0xfb))[q(0x11e)](q(0x12b),'Shows\x20full\x20context\x20information\x20(including\x20tokens)')['action'](B=>__awaiter(this,void 0x0,void 0x0,function*(){const Z=q;console[Z(0x150)](V['contextProvider'][Z(0xf7)]());const Y=V['contextProvider']['loadContextWrapper']();if(B[Z(0x125)]===!![]){console[Z(0x10d)](Y);return;}const i=Y[Z(0x13a)],o=Y[Z(0x13c)][Z(0x149)]((H,T)=>H[Z(0x114)]===i?-0x1:T[Z(0x114)]===i?0x1:0x0)[Z(0xdc)](H=>{const S=Z,T=i===H['name']?S(0x15e):'';return{'Name':''+H[S(0x114)]+T,'Host':H['host'],'Default\x20Project':H['project']||'-','Default\x20Service':H['service']||'-'};});(0x0,console_format_helpers_1['printAsTable'])(o,Z(0x10e));})),U=(0x0,utils_1[q(0xd8)])();U[q(0x114)](q(0x119))[q(0xf3)]('Switch\x20between\x20your\x20local\x20contexts')[q(0x11e)](q(0x148),q(0xfa))[q(0x13e)](B=>__awaiter(this,void 0x0,void 0x0,function*(){const h=q,Y=(B===null||B===void 0x0?void 0x0:B[h(0x114)])||(yield this[h(0xf2)](h(0x119)));yield this['apiClient'][h(0x113)][h(0x10a)](Y),(0x0,utils_1[h(0xd6)])(h(0xd9)+Y);}));const l=q(0xd5),x=(0x0,utils_1['getCommand'])()[q(0x114)](q(0xe9))[q(0xf3)](q(0x11a))[q(0x11e)](l,q(0xea))[q(0x13e)](B=>__awaiter(this,void 0x0,void 0x0,function*(){const Q=q,Y=(B===null||B===void 0x0?void 0x0:B['id'])||(yield v[Q(0x167)]());yield this[Q(0x12d)][Q(0x113)][Q(0x169)](Y),console[Q(0x150)]('Use\x20project\x20with\x20id:',Y);})),N=(0x0,utils_1['getCommand'])()[q(0x114)](q(0xf1))[q(0xf3)](q(0x137))[q(0x11e)](l,q(0xcd))[q(0x13e)](B=>__awaiter(this,void 0x0,void 0x0,function*(){const F=q,Y=(B===null||B===void 0x0?void 0x0:B['id'])||(yield v[F(0xda)](this[F(0x165)]())());console['log']('Use\x20service\x20with\x20id:',Y),yield this[F(0x12d)][F(0x113)][F(0xe8)](Y);})),e=(0x0,utils_1['getCommand'])()[q(0x114)](q(0x105))[q(0xf3)]('Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context')['option'](l,q(0xf4))[q(0x13e)](B=>__awaiter(this,void 0x0,void 0x0,function*(){const W=q,Y=(B===null||B===void 0x0?void 0x0:B['id'])||(yield v[W(0xd7)](this[W(0x165)]())());console[W(0x150)](W(0x11d),Y),yield this[W(0x12d)][W(0x113)]['useJobId'](Y);}));U[q(0x140)](x),U['addCommand'](e),U[q(0x140)](N);const D=(0x0,utils_1[q(0xd8)])()[q(0x114)](q(0xe0))[q(0xed)](q(0xe1))[q(0xed)]('rm')[q(0xf3)](q(0x118))['option'](l,'Local\x20context\x20name\x20to\x20remove.')['action'](B=>__awaiter(this,void 0x0,void 0x0,function*(){const y=q;var Y;const i=(B===null||B===void 0x0?void 0x0:B['id'])||(yield this[y(0xf2)]('remove')),o=(Y=this[y(0x12d)][y(0x113)][y(0x116)]())===null||Y===void 0x0?void 0x0:Y[y(0x114)];yield this[y(0x12d)]['contextProvider']['removeContext'](i),(0x0,utils_1[y(0xd6)])(y(0xf9)+i+y(0x112));if(!this['contextAvailable']()){(0x0,utils_1[y(0x141)])(y(0xdb));return;}if(o===i){const H=(B===null||B===void 0x0?void 0x0:B[y(0x114)])||(yield this[y(0xf2)](y(0x16a)));yield this[y(0x12d)][y(0x113)][y(0x10a)](H),(0x0,utils_1[y(0xd6)])(y(0xd9)+H);}})),z=(0x0,utils_1[q(0xd8)])()[q(0x114)](q(0x120))[q(0xed)](q(0xf0))[q(0xf3)](q(0x160))['option']('-t,\x20--token\x20[TOKEN]',q(0x16d))[q(0x13e)](B=>__awaiter(this,void 0x0,void 0x0,function*(){const p=q,{contextProvider:Y}=this['apiClient'],i=(B===null||B===void 0x0?void 0x0:B[p(0x12e)])||(yield v[p(0x117)]()),o=Y[p(0x15c)]();yield Y[p(0x168)](i);if(yield this[p(0xcf)]())(0x0,utils_1[p(0xd6)])(p(0x131)+Y[p(0xd2)]()+p(0x146));else{if(o)yield Y['updateToken'](o);(0x0,utils_1[p(0x13b)])(p(0x12f));}}));this[q(0x13c)][q(0x140)](j),this[q(0x13c)][q(0x140)](U),this[q(0x13c)][q(0x140)](D),this[q(0x13c)][q(0x140)](z);}['browserLogin'](V,I){var v,j,U,l;return __awaiter(this,void 0x0,void 0x0,function*(){const c=a2I,x=!V['doNotOpenBrowser'],N=(v=V[c(0xdf)])!==null&&v!==void 0x0?v:this[c(0xe6)],e=new browser_login_1[(c(0x122))](N,x);let D;e['on'](c(0xfd),({url:i})=>{const g=c;if(x){const o=i[g(0xe3)](/sessionToken=.*/,g(0xff));console[g(0x150)]('Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20'+o+')'),D=inquirer[g(0xe5)]([{'type':'confirm','name':g(0xd4),'message':g(0x164),'default':![]}]),D[g(0x107)](H=>{const K=g;process[K(0x158)]['moveCursor'](0x0,-0x1),process[K(0x158)][K(0x10c)](0x1),H['fullUrl']&&console[K(0x150)](K(0xe4)+i+'\x20');});}else console[g(0x150)](g(0xe4)+i+'\x20');});const {token:z,contextName:B}=yield e[c(0x142)]()[c(0x111)](i=>__awaiter(this,void 0x0,void 0x0,function*(){const C=c;(0x0,utils_1['error'])(C(0x161)+i[C(0x15d)]+'.\x20Using\x20fallback.');const o=yield this[C(0x127)](V,I);return{'token':o['token'],'contextName':o[C(0x114)]};}))[c(0x143)](()=>{const k=c;if(D)D['ui'][k(0x151)]();}),Y=(U=(j=V['name'])!==null&&j!==void 0x0?j:B)!==null&&U!==void 0x0?U:c(0xf8)+new Date()[c(0xec)]();return{'name':Y,'token':z,'host':N,'override':(l=V[c(0x133)])!==null&&l!==void 0x0?l:![]};});}[a2f(0x127)](V,I){return __awaiter(this,void 0x0,void 0x0,function*(){const O=a2I,v=this[O(0x12d)][O(0x113)]['loadContextWrapper']()['contexts'],{name:j,token:U,host:l,override:x}=yield I[O(0x153)](V,v);return{'name':j,'token':U,'host':l,'override':x};});}[a2f(0x165)](){const w=a2f,V=this[w(0x12d)][w(0x113)]['getCurrentProjectName']();if(V===undefined)throw new Error(w(0xfc));return V;}[a2f(0xf2)](V){return __awaiter(this,void 0x0,void 0x0,function*(){const A=a2I;if(!this[A(0xef)]())throw new Error(A(0x13d));const I=this[A(0x12d)][A(0x113)][A(0x135)]()[A(0x13c)][A(0xdc)](j=>j['name']),v=I['length']>0x4?A(0x15f):'list';return(yield inquirer[A(0xe5)]([{'type':v,'name':A(0x114),'message':A(0x14b)+V+':','choices':I}]))['name'];});}[a2f(0xef)](){const m=a2f;return this[m(0x12d)][m(0x113)][m(0x135)]()[m(0x13c)]['length']>0x0;}[a2f(0xcf)](){return __awaiter(this,void 0x0,void 0x0,function*(){const r=a2I;try{const V=this[r(0x12d)][r(0x113)]['getCurrentBaseUrl'](),I=this[r(0x12d)][r(0x113)][r(0x15c)](),v=V+r(0xd3),j={'Authorization':r(0xce)+I},U=yield(0x0,utils_1['retry'])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const V0=r;return(0x0,node_fetch_1[V0(0x104)])(v,{'method':V0(0x106),'timeout':0xbb8,'headers':j});}));if(U['ok'])return!![];return![];}catch(l){return![];}});}}exports[a2f(0x129)]=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;
|