@northflank/cli 0.10.3 → 0.10.4
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/copy/index.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/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';
|
|
1
|
+
'use strict';const a0Z3=a0K;(function(Z,K){const Z2=a0K,O=Z();while(!![]){try{const g=-parseInt(Z2(0xd4))/0x1*(-parseInt(Z2(0xc8))/0x2)+-parseInt(Z2(0xc7))/0x3+-parseInt(Z2(0x9c))/0x4*(-parseInt(Z2(0xd9))/0x5)+-parseInt(Z2(0xba))/0x6+parseInt(Z2(0xbf))/0x7+parseInt(Z2(0xc3))/0x8+parseInt(Z2(0xcd))/0x9*(-parseInt(Z2(0xc0))/0xa);if(g===K)break;else O['push'](O['shift']());}catch(N){O['push'](O['shift']());}}}(a0Z,0x9239e));function a0K(Z,K){const O=a0Z();return a0K=function(g,N){g=g-0x9c;let H=O[g];return H;},a0K(Z,K);}var __awaiter=this&&this[a0Z3(0xbd)]||function(Z,K,O,g){function N(H){return H instanceof O?H:new O(function(o){o(H);});}return new(O||(O=Promise))(function(H,o){function s(W){const Z4=a0K;try{y(g[Z4(0x9f)](W));}catch(B){o(B);}}function R(W){const Z5=a0K;try{y(g[Z5(0xd0)](W));}catch(B){o(B);}}function y(W){const Z6=a0K;W[Z6(0xd7)]?H(W[Z6(0xda)]):N(W[Z6(0xda)])[Z6(0xbb)](s,R);}y((g=g['apply'](Z,K||[]))['next']());});};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['fetchResourceList']=void 0x0;const utils_1=require(a0Z3(0x9d)),defaultPaginationPageSize=0x64,getProjects=Z=>K=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z7=a0Z3;var O;const g=yield Z[Z7(0xa5)][Z7(0xb2)]({'options':{'per_page':defaultPaginationPageSize,'cursor':K===null||K===void 0x0?void 0x0:K['nextPageCursor']}});return{'elements':g['data']['projects']['map'](N=>N['id']),'nextPageCursor':(O=g['pagination'])===null||O===void 0x0?void 0x0:O[Z7(0xd5)]};}),getServices=(Z,K)=>O=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z8=a0Z3;var g;const N=yield Z[Z8(0xa5)]['services']({'parameters':{'projectId':K},'options':{'per_page':defaultPaginationPageSize,'cursor':O===null||O===void 0x0?void 0x0:O[Z8(0xb7)]}});return{'elements':N[Z8(0xae)]['services'][Z8(0xdc)](H=>H['id']),'nextPageCursor':(g=N[Z8(0xa7)])===null||g===void 0x0?void 0x0:g[Z8(0xd5)]};}),getAddons=(Z,K)=>O=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z9=a0Z3;var g;const N=yield Z[Z9(0xa5)][Z9(0xa9)]({'parameters':{'projectId':K},'options':{'per_page':defaultPaginationPageSize,'cursor':O===null||O===void 0x0?void 0x0:O[Z9(0xb7)]}});return{'elements':N[Z9(0xae)][Z9(0xa9)][Z9(0xdc)](H=>H['id']),'nextPageCursor':(g=N[Z9(0xa7)])===null||g===void 0x0?void 0x0:g[Z9(0xd5)]};}),getAddonBackups=(Z,K,O)=>g=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const ZZ=a0Z3;var N;const H=yield Z[ZZ(0xad)]['addon']['backups']({'parameters':{'projectId':K,'addonId':O},'options':{'per_page':defaultPaginationPageSize,'cursor':g===null||g===void 0x0?void 0x0:g[ZZ(0xb7)]}});return{'elements':H[ZZ(0xae)][ZZ(0xb4)][ZZ(0xdc)](o=>o['id']),'nextPageCursor':(N=H[ZZ(0xa7)])===null||N===void 0x0?void 0x0:N[ZZ(0xd5)]};});function fetchResourceList(Z,K,O,g,N,H){var o,s,R,y,W,B,V,M,I,c,E,p;return __awaiter(this,void 0x0,void 0x0,function*(){const ZK=a0K,T=undefined;try{if(Z===ZK(0xc2)){const C=yield K[ZK(0xa5)][ZK(0xca)]({}),S=C[ZK(0xae)][ZK(0xca)][ZK(0xdc)](n=>{const ZO=ZK;var k;return(k=n===null||n===void 0x0?void 0x0:n[ZO(0xd2)])!==null&&k!==void 0x0?k:n===null||n===void 0x0?void 0x0:n['id'];});return{'choices':S,'defaultValue':T};}if(Z===ZK(0xa1)&&!(O===null||O===void 0x0?void 0x0:O[ZK(0xaf)](ZK(0xb1)))){const n=yield K[ZK(0xa5)][ZK(0x9e)]({}),k=n[ZK(0xae)]['regions'][ZK(0xdc)](x=>{const Zg=ZK;var m;return(m=x===null||x===void 0x0?void 0x0:x[Zg(0xd2)])!==null&&m!==void 0x0?m:x===null||x===void 0x0?void 0x0:x['id'];});return{'choices':k,'defaultValue':T};}if(Z===ZK(0xa3)){const x=yield getProjects(K),{elements:m,nextPageCursor:r}=yield x();return{'choices':m,'defaultValue':T,'pagination':{'nextPageCursor':r,'loadMore':x}};}if(Z===ZK(0xab)){const D=yield K[ZK(0xa5)][ZK(0xa2)]({}),d=D['data'][ZK(0xab)][ZK(0xdc)](b=>b['id']);return{'choices':d,'defaultValue':T};}const J=N===null||N===void 0x0?void 0x0:N[ZK(0xa3)],q=Z===ZK(0xb8)||Z==='id'&&(H===null||H===void 0x0?void 0x0:H[ZK(0xaf)](ZK(0xc1)));if(J!==undefined&&q){const b=yield getServices(K,J),{elements:l,nextPageCursor:f}=yield b();return{'choices':l,'defaultValue':T,'pagination':{'nextPageCursor':f,'loadMore':b}};}const Y=O===null||O===void 0x0?void 0x0:O[ZK(0xaf)](ZK(0xdb));if(Y){const a=v=>__awaiter(this,void 0x0,void 0x0,function*(){const ZN=ZK;var L;const X=yield K[ZN(0xad)][ZN(0xdb)][ZN(0xc4)]({});return(L=X['data'][ZN(0xce)])===null||L===void 0x0?void 0x0:L['map'](U=>U[ZN(0xa8)])['find'](U=>U['type']===v);});if(Z===ZK(0xa8)){const v=yield K[ZK(0xad)]['addon']['types']({}),L=(o=v['data'][ZK(0xce)])===null||o===void 0x0?void 0x0:o[ZK(0xdc)](X=>X[ZK(0xa8)]);return{'choices':L,'defaultValue':T};}if(Z==='version'&&(g===null||g===void 0x0?void 0x0:g[ZK(0xa8)])!==undefined){const X=(s=yield a(g[ZK(0xa8)]))===null||s===void 0x0?void 0x0:s[ZK(0xcf)],U=X!==undefined?[ZK(0xb3),...X]:undefined;return{'choices':U,'defaultValue':T};}if(Z===ZK(0xac)&&(g===null||g===void 0x0?void 0x0:g['type'])!==undefined){const i=(y=(R=yield a(g['type']))===null||R===void 0x0?void 0x0:R[ZK(0xa6)])===null||y===void 0x0?void 0x0:y[ZK(0xac)];return{'choices':i===null||i===void 0x0?void 0x0:i[ZK(0xaa)],'defaultValue':i===null||i===void 0x0?void 0x0:i[ZK(0xd1)]};}if(Z===ZK(0xc6)&&(g===null||g===void 0x0?void 0x0:g[ZK(0xa8)])!==undefined){const z=(B=(W=yield a(g[ZK(0xa8)]))===null||W===void 0x0?void 0x0:W['resources'])===null||B===void 0x0?void 0x0:B['replicas'];return{'choices':z===null||z===void 0x0?void 0x0:z['options'],'defaultValue':z===null||z===void 0x0?void 0x0:z[ZK(0xd1)]};}}if(Z===ZK(0xb9)&&(N===null||N===void 0x0?void 0x0:N['projectId'])!==undefined){const j=yield getAddons(K,N===null||N===void 0x0?void 0x0:N[ZK(0xa3)]),{elements:G,nextPageCursor:w}=yield j();return{'choices':G,'defaultValue':T,'pagination':{'nextPageCursor':w,'loadMore':j}};}if(Z===ZK(0xb6)&&(N===null||N===void 0x0?void 0x0:N[ZK(0xa3)])!==undefined&&((V=g===null||g===void 0x0?void 0x0:g[ZK(0xd3)])===null||V===void 0x0?void 0x0:V[ZK(0xb9)])!==undefined){const Q=yield getAddonBackups(K,N===null||N===void 0x0?void 0x0:N['projectId'],(M=g===null||g===void 0x0?void 0x0:g['source'])===null||M===void 0x0?void 0x0:M[ZK(0xb9)]),{elements:u,nextPageCursor:F}=yield Q();return{'choices':u,'defaultValue':T,'pagination':{'nextPageCursor':F,'loadMore':Q}};}const P=(I=N===null||N===void 0x0?void 0x0:N[ZK(0xb9)])!==null&&I!==void 0x0?I:(c=g===null||g===void 0x0?void 0x0:g[ZK(0xb0)])===null||c===void 0x0?void 0x0:c['addonId'];if((O===null||O===void 0x0?void 0x0:O[ZK(0xcb)](''))===ZK(0xc9)&&Z===ZK(0xcc)&&(N===null||N===void 0x0?void 0x0:N['projectId'])!==undefined&&P!==undefined){const {upgradeTo:A}=(yield K[ZK(0xad)][ZK(0xdb)]['version']({'parameters':{'addonId':P,'projectId':N===null||N===void 0x0?void 0x0:N[ZK(0xa3)]}}))[ZK(0xae)];if(A===undefined||A['length']<=0x0){(0x0,utils_1['warning'])('No\x20available\x20versions\x20to\x20upgrade\x20to.');throw new Error();}return{'choices':A['map'](h=>h[ZK(0xcc)]),'defaultValue':T};}if(Z===ZK(0xd8)){const h=yield K[ZK(0xa5)][ZK(0xc5)]({}),t=h[ZK(0xae)]['templates']['map'](Z0=>Z0===null||Z0===void 0x0?void 0x0:Z0['id']);return{'choices':t,'defaultValue':T};}if(((O===null||O===void 0x0?void 0x0:O[ZK(0xaf)]('secretLink'))||(O===null||O===void 0x0?void 0x0:O['includes'](ZK(0xd6))))&&Z===ZK(0xbe)&&P!==undefined&&(N===null||N===void 0x0?void 0x0:N['projectId'])!==undefined){const Z0=(yield K[ZK(0xad)][ZK(0xdb)]['credentials']({'parameters':{'addonId':P,'projectId':N===null||N===void 0x0?void 0x0:N['projectId']}}))[ZK(0xae)];return{'choices':[...(E=Object[ZK(0xbc)](Z0===null||Z0===void 0x0?void 0x0:Z0[ZK(0xa4)]))!==null&&E!==void 0x0?E:[],...(p=Object[ZK(0xbc)](Z0===null||Z0===void 0x0?void 0x0:Z0[ZK(0xb5)]))!==null&&p!==void 0x0?p:[]]};}}catch(Z1){}return{'choices':undefined,'defaultValue':T};});}function a0Z(){const ZH=['replicas','2457822QawYDc','2778BHZOfO','updateaddonversion','plans','join','version','6633XZUrqk','addonTypes','versions','throw','default','internalId','source','535pQqjDr','cursor','secret','done','templateId','167665LNXMPw','value','addon','map','88WBRCIV','./utils','regions','next','fetchResourceList','region','registryCredentials','projectId','envs','list','resources','pagination','type','addons','options','credentials','storage','get','data','includes','addonDependencies','logSink','projects','latest','backups','secrets','backupId','nextPageCursor','serviceId','addonId','1485882ZqSOwP','then','keys','__awaiter','keyName','869442rDfSXx','4410qrWsmY','owningObject','deploymentPlan','3086664CDkdna','types','templates'];a0Z=function(){return ZH;};return a0Z();}exports[a0Z3(0xa0)]=fetchResourceList;
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --no-deprecation
|
|
2
|
-
'use strict';const a1UO=a1K;(function(U,K){const Up=a1K,q=U();while(!![]){try{const X=-parseInt(Up(0x1e4))/0x1+-parseInt(Up(0x179))/0x2*(parseInt(Up(0x1c8))/0x3)+-parseInt(Up(0x190))/0x4+-parseInt(Up(0x1ba))/0x5*(parseInt(Up(0x220))/0x6)+parseInt(Up(0x1e0))/0x7+parseInt(Up(0x1c5))/0x8*(parseInt(Up(0x1eb))/0x9)+parseInt(Up(0x12c))/0xa*(parseInt(Up(0x1e6))/0xb);if(X===K)break;else q['push'](q['shift']());}catch(J){q['push'](q['shift']());}}}(a1U,0xa4cfa));var __createBinding=this&&this[a1UO(0x1cd)]||(Object['create']?function(U,K,q,X){const UF=a1UO;if(X===undefined)X=q;var J=Object[UF(0x182)](K,q);(!J||(UF(0x1d0)in J?!K[UF(0x119)]:J[UF(0x152)]||J[UF(0x20c)]))&&(J={'enumerable':!![],'get':function(){return K[q];}}),Object['defineProperty'](U,X,J);}:function(U,K,q,X){if(X===undefined)X=q;U[X]=K[q];}),__setModuleDefault=this&&this[a1UO(0x18d)]||(Object['create']?function(U,K){const Uo=a1UO;Object[Uo(0x183)](U,'default',{'enumerable':!![],'value':K});}:function(U,K){const UQ=a1UO;U[UQ(0x1b1)]=K;}),__importStar=this&&this[a1UO(0x1d5)]||function(U){const Uw=a1UO;if(U&&U['__esModule'])return U;var K={};if(U!=null){for(var q in U)if(q!==Uw(0x1b1)&&Object['prototype']['hasOwnProperty'][Uw(0x130)](U,q))__createBinding(K,U,q);}return __setModuleDefault(K,U),K;},__awaiter=this&&this[a1UO(0x204)]||function(U,K,q,X){function J(v){return v instanceof q?v:new q(function(f){f(v);});}return new(q||(q=Promise))(function(v,f){const UW=a1K;function L(z){try{E(X['next'](z));}catch(p){f(p);}}function M(z){try{E(X['throw'](z));}catch(p){f(p);}}function E(z){const UR=a1K;z['done']?v(z[UR(0x196)]):J(z[UR(0x196)])[UR(0x224)](L,M);}E((X=X['apply'](U,K||[]))[UW(0x213)]());});},__importDefault=this&&this[a1UO(0x176)]||function(U){return U&&U['__esModule']?U:{'default':U};};Object[a1UO(0x183)](exports,a1UO(0x119),{'value':!![]}),exports['getProgram']=void 0x0;function a1K(U,K){const q=a1U();return a1K=function(X,J){X=X-0x111;let v=q[X];return v;},a1K(U,K);}function a1U(){const Un=['assertContextExisting','./metrics','value','askForAddon','hasNextPage','=>\x20running\x20command\x20with:\x20','portFwdCmd','assign','addonId','./defaults','docsTagsPath','--verbose','resourceTagId','./copy','invoice','CliContext','.yaml','addon','handleYamlOutput','statusText','backupDestinationId','askForAddonBackup','job','branch','./utils','templateId','bind','opts','clearLine','default','service','downloadCmd','Display\x20help\x20for\x20command','skipValidation','vol','askForBuild','printAsTable','Get\x20information\x20about\x20Northflank\x20','60iLPJEL','scrt','length','askForJobRun','query','output','svc','runs','entries','grey','getCommandOverview','1214936CaZRcq','error','rawResponse','3273QiyWBv','kebabCase','OPTIONAL:\x20','resource','required','__createBinding','cursor','isArray','get','delete','consoleFormat','./port-forward','templates','__importStar','VERBOSE:\x20Using\x20endpoint\x20->\x20','InquirerHelper','stringify','clusterId','CliLogs','brn','template','set','toLowerCase','repository','6727483dYIkxm','askForSecret','-v,\x20--version','askForJob','1003857oDtweL','\x0a>\x20Token\x20permissions\x20required:\x20','26622926IEVGyI','askForVolume','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','path','getCurrentJobName','18XNiQGC','isString','subdomainId','addHelpText','body','agent','./formatting/command-overview','askForProject','enablePositionalOptions','execCmd','askForService','askForTemplateRun','plan','domains','rgn','credentialId','getLogsCommand','retrievePayloadViaInteractiveCli','adn','./logs','omit','pipelineId','askForLogSink','verbose','commander','__awaiter','customUserAgent','has','parseAsync','asyncSequential','askForSubdomain','cred','replace','configurable','dmn','existsSync','map','branches','login','page','next','secret','stdout','File\x20does\x20not\x20exist:\x20','/docs/v1/api/','domainId','aliases','after','pop','safeLoad','subdomain','opt','tag','658248vrgOwk','getOwnPropertyNames','js-yaml','project','then','join','url','some','type','templateRunId','backup-destination','VERBOSE:\x20Request\x20body\x20->\x20','checkUpdate','repositories','Resource\x20was\x20not\x20deleted.','green','jobId','./formatting/console-format-helpers','__esModule','volumes','toUpperCase','secretId',',\x20NF\x20error\x20id:\x20','credential','getProgram','there\x20are\x20more\x20rows,\x20load?','commands','all','restores','backupId','projects','description','pagination','underline','secrets','keys','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','10GtqDIv','action','split','subdomainPath','call','startsWith','update','buildId','Northflank\x20cli\x20version:\x20','askForSubdomainPath','askForPipeline','requiredPermissions','api.','getMetricsCommand','\x20--','filter','paginationArgs','uploadCmd','repos','addHelpCommand','Update\x20Northflank\x20','inv','json','setPathVars','moveCursor','regions','list','toString','yml','force','helpOption','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','addCommand','Unknown\x20input\x20file\x20type:\x20','loadAll','yaml','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','./exec','writable','askForBackupDestination','./context/contextCommands','quiet','base','./inquirer-helper','volumeId','.json','count','defaults','file','find','getCurrentProjectName','plans','backup','region','credentials','domain','logs','includes','endpoints','askForCredentials','chalk','upperFirst','concat','option','host','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','isPaginatedEndpoint','lodash','pln','ApiClient','Documentation:\x20','parse','-f,\x20--file\x20<file-path>','isEqual','__importDefault','argv','version','110dsTtcq','CliExec','../package.json','contexts','repo','log','exitCode','projectId','serviceId','getOwnPropertyDescriptor','defineProperty','data','endsWith','-i,\x20--input\x20<resource-def>','custom-columns=','jobs','boolean','backups','CliFileCopy','tpl','__setModuleDefault','invoices','message','2518580xRMIal','askForClusterId','nonInteractiveEndpoint','forEach'];a1U=function(){return Un;};return a1U();}const js_client_1=require('@northflank/js-client'),commander_1=__importDefault(require(a1UO(0x203))),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require(a1UO(0x168))),_=__importStar(require(a1UO(0x16f))),contextCommands_1=require(a1UO(0x154)),utils_1=require(a1UO(0x1ac)),defaults=__importStar(require(a1UO(0x19d))),inquirer_helper_1=require(a1UO(0x157)),console_format_helpers_1=require(a1UO(0x118)),command_overview_1=require(a1UO(0x1f1)),port_forward_1=require(a1UO(0x1d3)),exec_1=require(a1UO(0x151)),logs_1=require(a1UO(0x1fe)),metrics_1=require(a1UO(0x195)),copy_1=require(a1UO(0x1a1)),yaml=require(a1UO(0x222)),pgk=require(a1UO(0x17b)),getProgram=U=>{const UV=a1UO,K=new commander_1[(UV(0x1b1))]['Command']('northflank');K['description']('Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line'),K[UV(0x1f3)](!![]),K[UV(0x178)](UV(0x134)+chalk_1['default'][UV(0x128)](pgk[UV(0x178)]),UV(0x1e2),UV(0x12b));const q=new js_client_1[(UV(0x171))](U,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[UV(0x205)],'agent':utils_1[UV(0x1f0)]}),X=new contextCommands_1[(UV(0x1a3))](q,utils_1[UV(0x1f0)]),J=new port_forward_1['CliPortForward'](U,utils_1[UV(0x1f0)]),v=new exec_1[(UV(0x17a))](U,utils_1['agent']),f=new copy_1[(UV(0x18b))](U,utils_1[UV(0x1f0)]),L=new logs_1[(UV(0x1da))](U,utils_1[UV(0x1f0)]),M=new metrics_1['CliMetrics'](U,utils_1[UV(0x1f0)]);return K['addCommand'](J[UV(0x19a)]),K[UV(0x14c)](v[UV(0x1f4)]),K[UV(0x14c)](f[UV(0x1b3)]),K[UV(0x14c)](f[UV(0x13d)]),K[UV(0x14c)](X[UV(0x211)]),K[UV(0x14c)](X[UV(0x17c)]),generateCommands(q,q[UV(0x166)],K,L,M),K[UV(0x14c)]((0x0,command_overview_1[UV(0x1c4)])(K)),K[UV(0x13f)](!![],'Display\x20help\x20for\x20command'),K[UV(0x14a)](undefined,UV(0x1b4)),K;};exports[a1UO(0x11f)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Ub=a1UO;try{const U=new js_client_1['ApiClientFileContextProvider']();yield(0x0,utils_1[Ub(0x113)])(U);const K=(0x0,exports[Ub(0x11f)])(U);yield K[Ub(0x207)](process[Ub(0x177)]);}catch(q){(0x0,utils_1[Ub(0x1c6)])(Ub(0x16d)+q[Ub(0x18f)]),process[Ub(0x177)][Ub(0x15d)](X=>X===Ub(0x19f))&&console[Ub(0x17e)](q),process[Ub(0x17f)]=0x1;}}))());function isListCommand(U){const UB=a1UO,K=[[UB(0x1d0),'addon',UB(0x18a)],[UB(0x1d0),UB(0x1aa),UB(0x1c1)]];return U[UB(0x15d)](q=>q===UB(0x146))||K[UB(0x227)](q=>_[UB(0x175)](U,q));}function generateCommands(U,K,q,X,J,v=defaults[a1UO(0x15b)],f=[]){const Uy=a1UO,L=new inquirer_helper_1[(Uy(0x1d7))](new js_client_1[(Uy(0x171))](U['contextProvider'],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent'],'agent':utils_1[Uy(0x1f0)]}));function M(O,F){const Ux=Uy;return O[Ux(0x1cc)]!==![]&&F===undefined;}function E(O,F){const Ua=Uy,{opt:o,name:Q}=O,w=o['default'],R=M(o,w),W=a=>a[Ua(0x1bc)]>0x1?'--'+a:'-'+a,V=o===null||o===void 0x0?void 0x0:o['alias'],b=V?_[Ua(0x1cf)](V)?'-'+(V===null||V===void 0x0?void 0x0:V['map'](m=>W(m))[Ua(0x225)](',\x20-'))+',':''+W(V):'',B=R?'':Ua(0x1ca),y=typeof o[Ua(0x228)]===Ua(0x189)||o[Ua(0x228)]===Ua(0x189)?b+Ua(0x13a)+Q:b+Ua(0x13a)+Q+'\x20<'+Q[Ua(0x11b)]()+'>',x=B+o['description'];F[Ua(0x16b)](y,x,w);}function z(O,F){const Um=Uy;if(F[Um(0x121)][Um(0x227)](o=>o['name']()===Um(0x164)))return;_[Um(0x175)](O,[Um(0x1d0),'service'])&&(F['addCommand'](X['getLogsCommand']('service')),F[Um(0x14c)](J['getMetricsCommand'](Um(0x1b2))),F[Um(0x14c)](X[Um(0x1fb)]('service',!![])),F[Um(0x14c)](J[Um(0x139)](Um(0x1b2),!![]))),_[Um(0x175)](O,[Um(0x1d0),'job'])&&(F['addCommand'](X[Um(0x1fb)](Um(0x1aa))),F[Um(0x14c)](J[Um(0x139)]('job')),F['addCommand'](X['getLogsCommand'](Um(0x1aa),!![])),F['addCommand'](J[Um(0x139)](Um(0x1aa),!![]))),_[Um(0x175)](O,[Um(0x1d0),Um(0x1a5)])&&(F[Um(0x14c)](X['getLogsCommand'](Um(0x1a5))),F[Um(0x14c)](J['getMetricsCommand'](Um(0x1a5)))),_['isEqual'](O,[Um(0x1d0),Um(0x1a5),Um(0x160)])&&F[Um(0x14c)](X[Um(0x1fb)]('addon',![],!![])),_['isEqual'](O,[Um(0x1d0),'addon',Um(0x123)])&&F[Um(0x14c)](X[Um(0x1fb)](Um(0x1a5),![],!![],!![]));}return Object['getOwnPropertyNames'](v)[Uy(0x193)](O=>{const Ui=Uy,F=K[O],o=v[O],Q=f[Ui(0x16a)]([O]);function w(i,G){const UG=Ui,A=Object[UG(0x221)](i||{});A[UG(0x20f)](s=>{return{'name':s,'opt':i[s]};})['sort']((s,D)=>!M(s[UG(0x21e)])?!M(D[UG(0x21e)])?0x0:0x1:-0x1)[UG(0x193)](s=>{E(s,G);});}function R(i,G){const UA=Ui,A=[[UA(0x223),UA(0x125),'prj'],[UA(0x1b2),'services',UA(0x1c0)],[UA(0x162),UA(0x11e),UA(0x20a)],[UA(0x1a5),'addons',UA(0x1fd)],[UA(0x1aa),UA(0x188)],[UA(0x1f7),UA(0x15f),UA(0x170)],[UA(0x161),UA(0x145),UA(0x1f9)],['domain',UA(0x1f8),UA(0x20d)],[UA(0x214),UA(0x129),UA(0x1bb)],[UA(0x11a),'volume',UA(0x1b6)],[UA(0x210),UA(0x1ab),UA(0x1db)],[UA(0x1a2),UA(0x18e),UA(0x141)],[UA(0x1dc),UA(0x1d4),UA(0x18c)],[UA(0x13e),UA(0x1df),UA(0x114),UA(0x17d)],[UA(0x111),'backup-destinations'],[UA(0x21f),'tags']],s=A[UA(0x15d)](D=>D[UA(0x165)](G));if(s!==undefined)i[UA(0x219)](s[UA(0x13b)](D=>D!==G));}function W(i){var G,A;return __awaiter(this,void 0x0,void 0x0,function*(){const Us=a1K,s={},{contextProvider:D}=U,H=Q[Us(0x165)](Us(0x1d1)),g=i['noDefaults']===!![];function S(C,N,Z){var e,n;return __awaiter(this,void 0x0,void 0x0,function*(){const UD=a1K;if(_['has']((n=(e=o['opt'])===null||e===void 0x0?void 0x0:e[UD(0x1e9)])!==null&&n!==void 0x0?n:{},C)){const t=!g&&!H&&Z?Z():undefined,Y=i[C]||t||(yield N());_[UD(0x1dd)](s,C,Y);}});}return yield(0x0,utils_1['asyncSequential'])(Object[Us(0x1c2)]((A=(G=o[Us(0x21e)])===null||G===void 0x0?void 0x0:G['path'])!==null&&A!==void 0x0?A:{}),([C,N])=>__awaiter(this,void 0x0,void 0x0,function*(){const UH=Us;var Z;const e=s===null||s===void 0x0?void 0x0:s[UH(0x180)],n=s===null||s===void 0x0?void 0x0:s[UH(0x1ad)];switch(C){case UH(0x180):return yield S(UH(0x180),L[UH(0x1f2)]['bind'](L),D[UH(0x15e)][UH(0x1ae)](D));case UH(0x181):return yield S(UH(0x181),L[UH(0x1f5)](e)[UH(0x1ae)](L),D['getCurrentServiceName'][UH(0x1ae)](D));case UH(0x19c):return yield S(UH(0x19c),L[UH(0x197)](e)[UH(0x1ae)](L));case UH(0x117):return yield S(UH(0x117),L[UH(0x1e3)](e)[UH(0x1ae)](L),D[UH(0x1ea)]['bind'](D));case'runId':return yield S('runId',L[UH(0x1bd)](s[UH(0x117)],e,![])[UH(0x1ae)](L));case UH(0x11c):return yield S('secretId',L[UH(0x1e1)](e)[UH(0x1ae)](L));case UH(0x163):case UH(0x218):return yield S(UH(0x163),L['askForDomain'][UH(0x1ae)](L));case UH(0x1fa):return yield S('credentialId',L[UH(0x167)]['bind'](L));case UH(0x158):return yield S(UH(0x158),L[UH(0x1e7)](e)[UH(0x1ae)](L));case UH(0x21d):return yield S('subdomain',L[UH(0x209)](s[UH(0x163)])[UH(0x1ae)](L));case'subdomainId':return yield S(UH(0x1ed),L[UH(0x209)](s['domainId'])[UH(0x1ae)](L));case'subdomainPath':return yield S(UH(0x12f),L[UH(0x135)](s[UH(0x163)],(Z=s['subdomain'])!==null&&Z!==void 0x0?Z:s[UH(0x1ed)])['bind'](L));case'backupId':return yield S(UH(0x124),L[UH(0x1a9)](e,s[UH(0x19c)])[UH(0x1ae)](L));case UH(0x133):return yield S('buildId',L[UH(0x1b7)](e,s[UH(0x181)],s[UH(0x117)])[UH(0x1ae)](L));case UH(0x1ad):return yield S(UH(0x1ad),L['askForTemplate']()[UH(0x1ae)](L));case UH(0x229):return yield S('templateRunId',L[UH(0x1f6)](n)[UH(0x1ae)](L));case'logSinkId':return yield S('logSinkId',L[UH(0x201)]()[UH(0x1ae)](L));case UH(0x200):return yield S(UH(0x200),L[UH(0x136)](e)[UH(0x1ae)](L));case UH(0x1a0):return yield S(UH(0x1a0),L['askForTag']()[UH(0x1ae)](L));case UH(0x1a8):return yield S(UH(0x1a8),L[UH(0x153)]()['bind'](L));case UH(0x1d9):return yield S(UH(0x1d9),L[UH(0x191)]()[UH(0x1ae)](L));default:return yield S(C,L['askGeneric'](C,N===null||N===void 0x0?void 0x0:N['description'])[UH(0x1ae)](L));}})),s;});}function V(i){var G,A,s;return __awaiter(this,void 0x0,void 0x0,function*(){const Ug=a1K,D={},H=((G=o[Ug(0x21e)])===null||G===void 0x0?void 0x0:G[Ug(0x16e)])?defaults[Ug(0x13c)]:{},g=Object[Ug(0x19b)](Object[Ug(0x19b)]({},(s=(A=o['opt'])===null||A===void 0x0?void 0x0:A[Ug(0x1be)])!==null&&s!==void 0x0?s:{}),H),S=Object['keys'](g)[Ug(0x13b)](C=>C!=='loadAll');return yield(0x0,utils_1[Ug(0x208)])(S,C=>__awaiter(this,void 0x0,void 0x0,function*(){if(i[C]!==undefined)return _['set'](D,C,i[C]);})),D;});}function b(){const US=Ui;switch(Q[0x0]){case'get':return US(0x1b9)+(Q[0x1]||US(0x1cb))+'s';case US(0x132):return US(0x140)+(Q[0x1]||US(0x1cb))+'\x20properties';default:return _[US(0x169)](O)+'\x20Northflank\x20resources';}}function B(i,G){const UC=Ui;var A,s,D,H,g,S,C,N;if(!G){const c=(0x0,utils_1['getCommand'])()['name'](_[UC(0x1c9)](O))[UC(0x126)](b());return R(c,O),c;}const Z=(i===null||i===void 0x0?void 0x0:i[UC(0x137)])?chalk_1[UC(0x1b1)][UC(0x1c3)](UC(0x1e5)+i[UC(0x137)]):'',e=U['contextProvider']['getCurrentContext'](),n=e!==undefined&&((A=o===null||o===void 0x0?void 0x0:o[UC(0x21e)])===null||A===void 0x0?void 0x0:A['docsTagsPath'])!==undefined,t=e===null||e===void 0x0?void 0x0:e[UC(0x16c)]['replace'](UC(0x138),''),Y=n?UC(0x172)+t+UC(0x217)+((s=o===null||o===void 0x0?void 0x0:o[UC(0x21e)])===null||s===void 0x0?void 0x0:s[UC(0x19e)]):'',l=(i===null||i===void 0x0?void 0x0:i[UC(0x126)])||'',T=(0x0,utils_1['getCommand'])(!![])['name'](_[UC(0x1c9)](O))[UC(0x126)](l)[UC(0x1ee)](UC(0x21a),[Z,Y]['join']('\x0a'));R(T,O);(((D=o['opt'])===null||D===void 0x0?void 0x0:D[UC(0x1ef)])||((H=o[UC(0x21e)])===null||H===void 0x0?void 0x0:H[UC(0x192)]))&&(T[UC(0x16b)](UC(0x174),'File\x20to\x20load\x20resource\x20json\x20from'),T[UC(0x16b)](UC(0x186),UC(0x14b)));w((g=o[UC(0x21e)])===null||g===void 0x0?void 0x0:g[UC(0x1e9)],T),w((S=o['opt'])===null||S===void 0x0?void 0x0:S['query'],T);const I=(C=o['opt'])===null||C===void 0x0?void 0x0:C['isPaginatedEndpoint'];return I&&w(defaults[UC(0x13c)],T),w((N=o[UC(0x21e)])===null||N===void 0x0?void 0x0:N[UC(0x156)],T),T[UC(0x12d)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const UN=UC;var h,P,k,u,d,r;(0x0,utils_1[UN(0x194)])(U);const j=T[UN(0x1af)]();(j===null||j===void 0x0?void 0x0:j[UN(0x202)])&&utils_1['proxyEnvsSet']&&(0x0,utils_1['warning'])('VERBOSE:\x20HTTP_PROXY\x20or\x20HTTPS_PROXY\x20environment\x20variable\x20set:\x20tunnelling\x20traffic\x20through\x20HTTP\x20proxy.');const U0=j[UN(0x212)]!==undefined||j[UN(0x1ce)]!==undefined;if(j[UN(0x14e)]===!![]&&U0)throw new Error('Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27');const U1=j===null||j===void 0x0?void 0x0:j[UN(0x1bf)],U2=U1===UN(0x142),U3=U1===UN(0x14f)||U1===UN(0x148),U4=yield W(j);L[UN(0x143)](U4);const U5=yield V(j),U6=Object[UN(0x12a)]((P=(h=o[UN(0x21e)])===null||h===void 0x0?void 0x0:h['path'])!==null&&P!==void 0x0?P:{})[UN(0x20f)](UK=>UK+'='+chalk_1[UN(0x1b1)][UN(0x116)](U4[UK]))[UN(0x225)](',\x20');if(U6['length']>0x0&&!U2&&!U3){const UK=UN(0x199)+U6;console[UN(0x17e)](UK);}const U7=((k=o['opt'])===null||k===void 0x0?void 0x0:k[UN(0x1ef)])||((u=o[UN(0x21e)])===null||u===void 0x0?void 0x0:u[UN(0x192)])?yield p(j,o,Q):undefined;if(!j[UN(0x149)]&&Q['includes'](UN(0x1d1))&&!(yield L['deleteWarningPrompt']())){(0x0,utils_1['warning'])(UN(0x115));return;}const U8=I&&(j['loadAll']||(j[UN(0x1bf)]===UN(0x142)||j[UN(0x1bf)]===UN(0x14f))&&!U0);let U9=U8&&F instanceof js_client_1['GetApiEndpointPaginated']?yield F[UN(0x122)]({'parameters':U4,'options':U5,'data':U7}):yield F[UN(0x130)]({'parameters':U4,'options':Object[UN(0x19b)]({},U5),'data':U7});if(j===null||j===void 0x0?void 0x0:j[UN(0x202)]){const Uq=U9['request'];console[UN(0x17e)](UN(0x1d6)+Uq['method'][UN(0x11b)]()+':'+Uq[UN(0x226)]);if(U7!==undefined)console[UN(0x17e)](UN(0x112)+U7);}if(U9[UN(0x1c6)]){const {details:UX,id:UJ,message:Uv,status:Uf}=U9[UN(0x1c6)],UL=UX?'\x0a\x09details\x20:'+JSON[UN(0x1d8)](UX):'',UM=UJ?UN(0x11d)+UJ:'',UE='(HTTP\x20status\x20code:\x20'+Uf+UM+')';throw new Error('API\x20request\x20failed\x0a\x09Message:\x20'+Uv+'\x20'+UE+UL);}let UU=0x0;printCallResult(j,U2,U9[UN(0x184)],U3,Q,U1,![],UU,U9[UN(0x1c7)][UN(0x1a7)]);if(!j[UN(0x155)]&&!U8&&!U0&&((d=U9['pagination'])===null||d===void 0x0?void 0x0:d[UN(0x198)]))while((r=U9[UN(0x127)])===null||r===void 0x0?void 0x0:r[UN(0x198)]){const Uz=yield L['askConfirm'](UN(0x120));if(Uz)process[UN(0x215)][UN(0x144)](0x0,-0x1),process[UN(0x215)][UN(0x1b0)](0x1),UU+=U9['pagination'][UN(0x15a)],U9=yield U9[UN(0x127)]['getNextPage'](),printCallResult(j,U2,U9['data'],U3,Q,U1,!![],UU,U9['rawResponse'][UN(0x1a7)]);else return;}})),T;}const y=_[Ui(0x206)](o,Ui(0x21e)),x=F,a=B(x,y);z(Q,a),q[Ui(0x14c)](a);const m=_[Ui(0x1ff)](o,Ui(0x21e));Object[Ui(0x12a)](m)[Ui(0x1bc)]>0x0&&generateCommands(U,F,a,X,J,m,Q);});function p(O,F,o){var Q;return __awaiter(this,void 0x0,void 0x0,function*(){const UZ=a1K,{input:w,file:R}=O;if(w!==undefined)try{return JSON[UZ(0x173)](w);}catch(W){try{return yaml[UZ(0x21c)](w);}catch(V){throw new Error('Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.');}}if(R!==undefined){if(!fs_1['default'][UZ(0x20e)](R))throw new Error(UZ(0x216)+R);const b=fs_1[UZ(0x1b1)]['readFileSync'](R)[UZ(0x147)]();let B;try{if(_[UZ(0x1ec)](b)){if(O[UZ(0x15c)]['endsWith'](UZ(0x159)))B=JSON[UZ(0x173)](b);else{if(O['file'][UZ(0x185)](UZ(0x1a4))||O[UZ(0x15c)]['endsWith'](UZ(0x148)))B=yaml[UZ(0x21c)](b);else throw new Error(UZ(0x14d)+O[UZ(0x15c)]['split']('.')[UZ(0x21b)]());}}else B=b;return B;}catch(y){throw new Error(UZ(0x150)+y[UZ(0x18f)]);}}if((Q=F===null||F===void 0x0?void 0x0:F['opt'])===null||Q===void 0x0?void 0x0:Q[UZ(0x192)])throw new Error(UZ(0x1e8));return yield L[UZ(0x1fc)](F,{'cmdPath':o,'skipValidation':O[UZ(0x1b5)]});});}}const printCallResult=(U,K,q,X,J,v,f,L,M)=>{const Ue=a1UO;if(!(U===null||U===void 0x0?void 0x0:U[Ue(0x155)])){if(K)(0x0,console_format_helpers_1['handleJsonOutput'])(U===null||U===void 0x0?void 0x0:U[Ue(0x1bf)],q);else{if(X)(0x0,console_format_helpers_1[Ue(0x1a6)])(U===null||U===void 0x0?void 0x0:U[Ue(0x1bf)],q);else{if(isListCommand(J)){const E=(v===null||v===void 0x0?void 0x0:v[Ue(0x131)](Ue(0x187)))?v[Ue(0x20b)]('custom-columns=','')[Ue(0x12e)](',')[Ue(0x20f)](o=>o[Ue(0x1de)]()):undefined,z=J[J[Ue(0x1bc)]-0x1],p=''+z+(z['endsWith']('s')?'':'s'),O=_['upperFirst'](p),F=_[Ue(0x206)](q,p)?q[p]:q;(0x0,console_format_helpers_1[Ue(0x1b8)])(F,O,E,f,L);}else console[Ue(0x17e)]((0x0,console_format_helpers_1[Ue(0x1d2)])(q,M));}}}};
|
|
2
|
+
'use strict';const a1ZV=a1K;(function(Z,K){const ZB=a1K,O=Z();while(!![]){try{const g=parseInt(ZB(0x10b))/0x1*(parseInt(ZB(0x19d))/0x2)+parseInt(ZB(0x126))/0x3+parseInt(ZB(0x142))/0x4+parseInt(ZB(0x141))/0x5*(-parseInt(ZB(0x18c))/0x6)+-parseInt(ZB(0x1c8))/0x7*(-parseInt(ZB(0x17e))/0x8)+-parseInt(ZB(0x1a9))/0x9*(parseInt(ZB(0x11d))/0xa)+-parseInt(ZB(0x132))/0xb*(parseInt(ZB(0xeb))/0xc);if(g===K)break;else O['push'](O['shift']());}catch(N){O['push'](O['shift']());}}}(a1Z,0xe02f1));function a1K(Z,K){const O=a1Z();return a1K=function(g,N){g=g-0xe7;let H=O[g];return H;},a1K(Z,K);}var __createBinding=this&&this[a1ZV(0xf7)]||(Object[a1ZV(0x177)]?function(Z,K,O,g){const ZM=a1ZV;if(g===undefined)g=O;var N=Object[ZM(0x1b7)](K,O);(!N||(ZM(0x117)in N?!K[ZM(0x1d7)]:N[ZM(0x14d)]||N[ZM(0x122)]))&&(N={'enumerable':!![],'get':function(){return K[O];}}),Object[ZM(0x12e)](Z,g,N);}:function(Z,K,O,g){if(g===undefined)g=O;Z[g]=K[O];}),__setModuleDefault=this&&this[a1ZV(0x136)]||(Object[a1ZV(0x177)]?function(Z,K){const ZI=a1ZV;Object['defineProperty'](Z,ZI(0x1b4),{'enumerable':!![],'value':K});}:function(Z,K){const Zc=a1ZV;Z[Zc(0x1b4)]=K;}),__importStar=this&&this[a1ZV(0x172)]||function(Z){const ZE=a1ZV;if(Z&&Z['__esModule'])return Z;var K={};if(Z!=null){for(var O in Z)if(O!==ZE(0x1b4)&&Object[ZE(0x11b)]['hasOwnProperty'][ZE(0x1a6)](Z,O))__createBinding(K,Z,O);}return __setModuleDefault(K,Z),K;},__awaiter=this&&this[a1ZV(0x1ac)]||function(Z,K,O,g){function N(H){return H instanceof O?H:new O(function(o){o(H);});}return new(O||(O=Promise))(function(H,o){const Zq=a1K;function s(W){const Zp=a1K;try{y(g[Zp(0xfb)](W));}catch(B){o(B);}}function R(W){const ZT=a1K;try{y(g[ZT(0xfc)](W));}catch(B){o(B);}}function y(W){const ZJ=a1K;W['done']?H(W['value']):N(W[ZJ(0x105)])['then'](s,R);}y((g=g[Zq(0x186)](Z,K||[]))[Zq(0xfb)]());});},__importDefault=this&&this[a1ZV(0x174)]||function(Z){const ZY=a1ZV;return Z&&Z[ZY(0x1d7)]?Z:{'default':Z};};Object[a1ZV(0x12e)](exports,a1ZV(0x1d7),{'value':!![]}),exports[a1ZV(0x13f)]=void 0x0;const js_client_1=require('@northflank/js-client'),commander_1=__importDefault(require(a1ZV(0xf5))),fs_1=__importDefault(require('fs')),chalk_1=__importDefault(require(a1ZV(0x193))),_=__importStar(require(a1ZV(0xf1))),contextCommands_1=require('./context/contextCommands'),utils_1=require('./utils'),defaults=__importStar(require(a1ZV(0x1e6))),inquirer_helper_1=require(a1ZV(0x107)),console_format_helpers_1=require(a1ZV(0x1d4)),command_overview_1=require(a1ZV(0x16a)),port_forward_1=require('./port-forward'),exec_1=require(a1ZV(0x106)),logs_1=require(a1ZV(0x1b6)),metrics_1=require(a1ZV(0x192)),copy_1=require(a1ZV(0x1c3)),yaml=require(a1ZV(0x10c)),pgk=require(a1ZV(0x103)),getProgram=Z=>{const ZP=a1ZV,K=new commander_1[(ZP(0x1b4))][(ZP(0x1c0))](ZP(0x12d));K[ZP(0x1bd)](ZP(0x1d0)),K[ZP(0x16b)](!![]),K[ZP(0x183)](ZP(0x1dd)+chalk_1[ZP(0x1b4)][ZP(0x150)](pgk[ZP(0x183)]),'-v,\x20--version',ZP(0x111));const O=new js_client_1[(ZP(0x165))](Z,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1['customUserAgent'],'agent':utils_1[ZP(0x13b)]}),g=new contextCommands_1['CliContext'](O,utils_1[ZP(0x13b)]),N=new port_forward_1[(ZP(0x1e9))](Z,utils_1[ZP(0x13b)]),H=new exec_1[(ZP(0x180))](Z,utils_1['agent']),o=new copy_1[(ZP(0x140))](Z,utils_1[ZP(0x13b)]),s=new logs_1['CliLogs'](Z,utils_1[ZP(0x13b)]),R=new metrics_1[(ZP(0x196))](Z,utils_1['agent']);return K[ZP(0x18b)](N[ZP(0x18a)]),K['addCommand'](H['execCmd']),K['addCommand'](o[ZP(0x1f3)]),K[ZP(0x18b)](o[ZP(0x12b)]),K[ZP(0x18b)](g[ZP(0x1ba)]),K[ZP(0x18b)](g['contexts']),generateCommands(O,O[ZP(0x1b0)],K,s,R),K[ZP(0x18b)]((0x0,command_overview_1[ZP(0x1ca)])(K)),K[ZP(0x14e)](!![],ZP(0x168)),K['helpOption'](undefined,ZP(0x168)),K;};exports['getProgram']=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const ZC=a1ZV;try{const Z=new js_client_1[(ZC(0x1be))]();yield(0x0,utils_1[ZC(0x181)])(Z);const K=(0x0,exports[ZC(0x13f)])(Z);yield K['parseAsync'](process[ZC(0x16f)]);}catch(O){(0x0,utils_1[ZC(0x1e7)])('Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20'+O[ZC(0x101)]),process[ZC(0x16f)][ZC(0x1f8)](g=>g===ZC(0x1f1))&&console[ZC(0x19f)](O),process[ZC(0xe9)]=0x1;}}))());function isListCommand(Z){const ZS=a1ZV,K=[['get',ZS(0x146),'backups'],[ZS(0x117),ZS(0x13c),ZS(0x1c5)]];return Z[ZS(0x1f8)](O=>O===ZS(0x1fa))||K[ZS(0x13d)](O=>_[ZS(0x1bf)](Z,O));}function generateCommands(Z,K,O,g,N,H=defaults[a1ZV(0x185)],o=[]){const Zn=a1ZV,s=new inquirer_helper_1['InquirerHelper'](new js_client_1[(Zn(0x165))](Z[Zn(0x19b)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent'],'agent':utils_1[Zn(0x13b)]}));function R(V,M){const Zk=Zn;return V[Zk(0x1fc)]!==![]&&M===undefined;}function y(V,M){const Zx=Zn,{opt:I,name:c}=V,E=I[Zx(0x1b4)],p=R(I,E),T=S=>S[Zx(0xef)]>0x1?'--'+S:'-'+S,J=I===null||I===void 0x0?void 0x0:I['alias'],q=J?_[Zx(0xe7)](J)?'-'+(J===null||J===void 0x0?void 0x0:J[Zx(0x15b)](S=>T(S))[Zx(0x1e4)](',\x20-'))+',':''+T(J):'',Y=p?'':Zx(0x139),P=typeof I[Zx(0x19e)]==='boolean'||I[Zx(0x19e)]==='boolean'?q+'\x20--'+c:q+Zx(0x19c)+c+'\x20<'+c['toUpperCase']()+'>',C=Y+I[Zx(0x1bd)];M['option'](P,C,E);}function W(V,M){const Zm=Zn;if(M[Zm(0x157)][Zm(0x13d)](I=>I[Zm(0x130)]()===Zm(0x10e)))return;_[Zm(0x1bf)](V,['get','service'])&&(M[Zm(0x18b)](g['getLogsCommand'](Zm(0x1fd))),M['addCommand'](N[Zm(0x1cb)]('service')),M[Zm(0x18b)](g['getLogsCommand']('service',!![])),M[Zm(0x18b)](N[Zm(0x1cb)](Zm(0x1fd),!![]))),_['isEqual'](V,['get','job'])&&(M['addCommand'](g['getLogsCommand'](Zm(0x13c))),M['addCommand'](N[Zm(0x1cb)](Zm(0x13c))),M[Zm(0x18b)](g[Zm(0x1b8)](Zm(0x13c),!![])),M[Zm(0x18b)](N[Zm(0x1cb)]('job',!![]))),_[Zm(0x1bf)](V,['get',Zm(0x146)])&&(M['addCommand'](g[Zm(0x1b8)](Zm(0x146))),M[Zm(0x18b)](N['getMetricsCommand'](Zm(0x146)))),_[Zm(0x1bf)](V,[Zm(0x117),Zm(0x146),Zm(0x151)])&&M[Zm(0x18b)](g[Zm(0x1b8)](Zm(0x146),![],!![])),_[Zm(0x1bf)](V,[Zm(0x117),Zm(0x146),Zm(0xf0)])&&M[Zm(0x18b)](g[Zm(0x1b8)](Zm(0x146),![],!![],!![]));}return Object[Zn(0x17f)](H)[Zn(0x1da)](V=>{const Zr=Zn,M=K[V],I=H[V],c=o[Zr(0x1d2)]([V]);function E(k,x){const ZD=Zr,m=Object['getOwnPropertyNames'](k||{});m[ZD(0x15b)](r=>{return{'name':r,'opt':k[r]};})['sort']((r,D)=>!R(r[ZD(0x135)])?!R(D[ZD(0x135)])?0x0:0x1:-0x1)[ZD(0x1da)](r=>{y(r,x);});}function p(k,x){const Zd=Zr,m=[[Zd(0x1de),Zd(0x176),Zd(0x198)],[Zd(0x1fd),Zd(0x124),Zd(0x194)],[Zd(0x1a7),'credential',Zd(0x145)],[Zd(0x146),'addons','adn'],[Zd(0x13c),'jobs'],[Zd(0x156),'plans',Zd(0xf9)],['region','regions',Zd(0x127)],['domain',Zd(0x1f5),Zd(0x1a8)],['secret',Zd(0x197),Zd(0x1ab)],[Zd(0x1cc),'volume',Zd(0x162)],[Zd(0x129),Zd(0x12c),'brn'],[Zd(0x199),Zd(0x179),'inv'],[Zd(0x1c2),Zd(0x1a3),Zd(0x121)],[Zd(0x1b3),Zd(0x13e),Zd(0x18d),Zd(0x119)],[Zd(0x1d5),Zd(0xea)],[Zd(0x188),'tags']],r=m[Zd(0x1f8)](D=>D[Zd(0x1aa)](x));if(r!==undefined)k[Zd(0x163)](r[Zd(0x1e3)](D=>D!==x));}function T(k){var x,m;return __awaiter(this,void 0x0,void 0x0,function*(){const Zb=a1K,r={},{contextProvider:D}=Z,d=c[Zb(0x1aa)](Zb(0xff)),b=k[Zb(0x1d1)]===!![];function l(f,a,v){var L,X;return __awaiter(this,void 0x0,void 0x0,function*(){const Zl=a1K;if(_[Zl(0x1f9)]((X=(L=I['opt'])===null||L===void 0x0?void 0x0:L['path'])!==null&&X!==void 0x0?X:{},f)){const e=!b&&!d&&v?v():undefined,U=k[f]||e||(yield a());_[Zl(0x1d9)](r,f,U);}});}return yield(0x0,utils_1[Zb(0x100)])(Object['entries']((m=(x=I[Zb(0x135)])===null||x===void 0x0?void 0x0:x[Zb(0x10a)])!==null&&m!==void 0x0?m:{}),([f,a])=>__awaiter(this,void 0x0,void 0x0,function*(){const Zf=Zb;var v;const L=r===null||r===void 0x0?void 0x0:r['projectId'],X=r===null||r===void 0x0?void 0x0:r[Zf(0x15a)];switch(f){case Zf(0x16d):return yield l(Zf(0x16d),s[Zf(0x123)][Zf(0x12a)](s),D[Zf(0x190)][Zf(0x12a)](D));case'serviceId':return yield l(Zf(0x159),s[Zf(0x17b)](L)[Zf(0x12a)](s),D[Zf(0x175)][Zf(0x12a)](D));case Zf(0x1eb):return yield l(Zf(0x1eb),s[Zf(0xf3)](L)['bind'](s));case Zf(0x178):return yield l(Zf(0x178),s[Zf(0x164)](L)[Zf(0x12a)](s),D[Zf(0x166)][Zf(0x12a)](D));case'runId':return yield l(Zf(0x11f),s[Zf(0xf6)](r[Zf(0x178)],L,![])['bind'](s));case Zf(0x1df):return yield l(Zf(0x1df),s['askForSecret'](L)[Zf(0x12a)](s));case Zf(0x116):case Zf(0x148):return yield l(Zf(0x116),s[Zf(0x173)]['bind'](s));case'credentialId':return yield l(Zf(0xfe),s['askForCredentials']['bind'](s));case Zf(0x108):return yield l('volumeId',s[Zf(0x115)](L)[Zf(0x12a)](s));case'subdomain':return yield l(Zf(0x13a),s[Zf(0x171)](r[Zf(0x116)])[Zf(0x12a)](s));case Zf(0x10d):return yield l(Zf(0x10d),s[Zf(0x171)](r[Zf(0x148)])[Zf(0x12a)](s));case'subdomainPath':return yield l(Zf(0x1e1),s[Zf(0x144)](r['domain'],(v=r[Zf(0x13a)])!==null&&v!==void 0x0?v:r[Zf(0x10d)])[Zf(0x12a)](s));case'backupId':return yield l(Zf(0x1bb),s[Zf(0x1e5)](L,r[Zf(0x1eb)])['bind'](s));case Zf(0x120):return yield l('buildId',s[Zf(0x138)](L,r[Zf(0x159)],r[Zf(0x178)])[Zf(0x12a)](s));case Zf(0x15a):return yield l(Zf(0x15a),s['askForTemplate']()[Zf(0x12a)](s));case Zf(0x133):return yield l('templateRunId',s[Zf(0x154)](X)[Zf(0x12a)](s));case Zf(0xfa):return yield l(Zf(0xfa),s[Zf(0x1c6)]()[Zf(0x12a)](s));case Zf(0xf2):return yield l(Zf(0xf2),s[Zf(0x16e)](L)['bind'](s));case Zf(0x170):return yield l(Zf(0x170),s['askForTag']()[Zf(0x12a)](s));case Zf(0xee):return yield l(Zf(0xee),s[Zf(0x143)]()['bind'](s));case Zf(0x1d3):return yield l(Zf(0x1d3),s['askForClusterId']()[Zf(0x12a)](s));default:return yield l(f,s[Zf(0x1b1)](f,a===null||a===void 0x0?void 0x0:a[Zf(0x1bd)])[Zf(0x12a)](s));}})),r;});}function J(k){var x,m,r;return __awaiter(this,void 0x0,void 0x0,function*(){const Za=a1K,D={},d=((x=I['opt'])===null||x===void 0x0?void 0x0:x[Za(0x14c)])?defaults[Za(0x152)]:{},b=Object[Za(0x1ec)](Object[Za(0x1ec)]({},(r=(m=I[Za(0x135)])===null||m===void 0x0?void 0x0:m[Za(0x1b5)])!==null&&r!==void 0x0?r:{}),d),l=Object[Za(0xec)](b)[Za(0x1e3)](f=>f!==Za(0x1a5));return yield(0x0,utils_1['asyncSequential'])(l,f=>__awaiter(this,void 0x0,void 0x0,function*(){const Zv=Za;if(k[f]!==undefined)return _[Zv(0x1d9)](D,f,k[f]);})),D;});}function q(){const ZL=Zr;switch(c[0x0]){case ZL(0x117):return'Get\x20information\x20about\x20Northflank\x20'+(c[0x1]||ZL(0x14f))+'s';case ZL(0x114):return'Update\x20Northflank\x20'+(c[0x1]||ZL(0x14f))+ZL(0x1b9);default:return _['upperFirst'](V)+ZL(0x1b2);}}function Y(k,x){const ZX=Zr;var m,r,D,d,b,l,f,a;if(!x){const G=(0x0,utils_1[ZX(0x161)])()['name'](_['kebabCase'](V))[ZX(0x1bd)](q());return p(G,V),G;}const v=(k===null||k===void 0x0?void 0x0:k[ZX(0x11e)])?chalk_1[ZX(0x1b4)]['grey'](ZX(0x187)+k['requiredPermissions']):'',L=Z[ZX(0x19b)][ZX(0x128)](),X=L!==undefined&&((m=I===null||I===void 0x0?void 0x0:I[ZX(0x135)])===null||m===void 0x0?void 0x0:m[ZX(0x1ea)])!==undefined,e=L===null||L===void 0x0?void 0x0:L['host'][ZX(0x12f)](ZX(0x104),''),U=X?ZX(0x1ce)+e+ZX(0x1a1)+((r=I===null||I===void 0x0?void 0x0:I[ZX(0x135)])===null||r===void 0x0?void 0x0:r[ZX(0x1ea)]):'',i=(k===null||k===void 0x0?void 0x0:k[ZX(0x1bd)])||'',z=(0x0,utils_1['getCommand'])(!![])['name'](_[ZX(0x1bc)](V))[ZX(0x1bd)](i)[ZX(0x17d)](ZX(0x125),[v,U][ZX(0x1e4)]('\x0a'));p(z,V);(((D=I['opt'])===null||D===void 0x0?void 0x0:D[ZX(0xf8)])||((d=I[ZX(0x135)])===null||d===void 0x0?void 0x0:d[ZX(0xe8)]))&&(z[ZX(0x184)](ZX(0x102),ZX(0x16c)),z[ZX(0x184)](ZX(0xed),'JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22'));E((b=I['opt'])===null||b===void 0x0?void 0x0:b[ZX(0x10a)],z),E((l=I[ZX(0x135)])===null||l===void 0x0?void 0x0:l['query'],z);const j=(f=I[ZX(0x135)])===null||f===void 0x0?void 0x0:f['isPaginatedEndpoint'];return j&&E(defaults[ZX(0x152)],z),E((a=I[ZX(0x135)])===null||a===void 0x0?void 0x0:a[ZX(0x1ee)],z),z[ZX(0x1e2)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const Ze=ZX;var w,Q,u,F,A,h;(0x0,utils_1[Ze(0x1f0)])(Z);const t=z[Ze(0x113)]();(t===null||t===void 0x0?void 0x0:t[Ze(0x1c4)])&&utils_1[Ze(0x1ed)]&&(0x0,utils_1[Ze(0x15d)])(Ze(0x15e));const Z0=t[Ze(0x182)]!==undefined||t[Ze(0x147)]!==undefined;if(t[Ze(0x1a5)]===!![]&&Z0)throw new Error(Ze(0x155));const Z1=t===null||t===void 0x0?void 0x0:t[Ze(0x11c)],Z2=Z1===Ze(0x17c),Z3=Z1===Ze(0x1fb)||Z1==='yml',Z4=yield T(t);s['setPathVars'](Z4);const Z5=yield J(t),Z6=Object[Ze(0xec)]((Q=(w=I[Ze(0x135)])===null||w===void 0x0?void 0x0:w[Ze(0x10a)])!==null&&Q!==void 0x0?Q:{})['map'](ZK=>ZK+'='+chalk_1[Ze(0x1b4)]['green'](Z4[ZK]))[Ze(0x1e4)](',\x20');if(Z6['length']>0x0&&!Z2&&!Z3){const ZK=Ze(0x1d8)+Z6;console['log'](ZK);}const Z7=((u=I[Ze(0x135)])===null||u===void 0x0?void 0x0:u['body'])||((F=I[Ze(0x135)])===null||F===void 0x0?void 0x0:F[Ze(0xe8)])?yield B(t,I,c):undefined;if(!t[Ze(0x1c7)]&&c['includes']('delete')&&!(yield s['deleteWarningPrompt']())){(0x0,utils_1[Ze(0x15d)])(Ze(0x14b));return;}const Z8=j&&(t['loadAll']||(t[Ze(0x11c)]===Ze(0x17c)||t[Ze(0x11c)]===Ze(0x1fb))&&!Z0);let Z9=Z8&&M instanceof js_client_1[Ze(0x191)]?yield M[Ze(0x1f2)]({'parameters':Z4,'options':Z5,'data':Z7}):yield M['call']({'parameters':Z4,'options':Object['assign']({},Z5),'data':Z7});if(t===null||t===void 0x0?void 0x0:t[Ze(0x1c4)]){const ZO=Z9[Ze(0x18f)];console[Ze(0x19f)](Ze(0xfd)+ZO[Ze(0x153)][Ze(0x118)]()+':'+ZO[Ze(0x17a)]);if(Z7!==undefined)console[Ze(0x19f)](Ze(0x1f7)+Z7);}if(Z9[Ze(0x1e7)]){const {details:Zg,id:ZN,message:ZH,status:Zo}=Z9[Ze(0x1e7)],Zs=Zg?Ze(0x1e0)+JSON['stringify'](Zg):'',ZR=ZN?',\x20NF\x20error\x20id:\x20'+ZN:'',Zy=Ze(0xf4)+Zo+ZR+')';throw new Error(Ze(0x195)+ZH+'\x20'+Zy+Zs);}let ZZ=0x0;printCallResult(t,Z2,Z9['data'],Z3,c,Z1,![],ZZ,Z9[Ze(0x149)][Ze(0x14a)]);if(!t[Ze(0x1d6)]&&!Z8&&!Z0&&((A=Z9[Ze(0x1cd)])===null||A===void 0x0?void 0x0:A[Ze(0x1af)]))while((h=Z9['pagination'])===null||h===void 0x0?void 0x0:h[Ze(0x1af)]){const ZW=yield s[Ze(0x169)](Ze(0x134));if(ZW)process['stdout'][Ze(0x158)](0x0,-0x1),process[Ze(0x189)][Ze(0x18e)](0x1),ZZ+=Z9['pagination'][Ze(0x110)],Z9=yield Z9[Ze(0x1cd)][Ze(0x19a)](),printCallResult(t,Z2,Z9[Ze(0x10f)],Z3,c,Z1,!![],ZZ,Z9['rawResponse'][Ze(0x14a)]);else return;}})),z;}const P=_['has'](I,Zr(0x135)),C=M,S=Y(C,P);W(c,S),O['addCommand'](S);const n=_[Zr(0x137)](I,Zr(0x135));Object[Zr(0xec)](n)['length']>0x0&&generateCommands(Z,M,S,g,N,n,c);});function B(V,M,I){var c;return __awaiter(this,void 0x0,void 0x0,function*(){const ZU=a1K,{input:E,file:p}=V;if(E!==undefined)try{return JSON['parse'](E);}catch(T){try{return yaml[ZU(0x1cf)](E);}catch(J){throw new Error(ZU(0x1a2));}}if(p!==undefined){if(!fs_1[ZU(0x1b4)][ZU(0x1a4)](p))throw new Error(ZU(0x167)+p);const q=fs_1[ZU(0x1b4)][ZU(0x11a)](p)[ZU(0x1db)]();let Y;try{if(_[ZU(0x109)](q)){if(V[ZU(0x131)][ZU(0x15c)](ZU(0x1ef)))Y=JSON[ZU(0x1a0)](q);else{if(V[ZU(0x131)][ZU(0x15c)](ZU(0x1ad))||V['file'][ZU(0x15c)]('yml'))Y=yaml['safeLoad'](q);else throw new Error(ZU(0x112)+V['file']['split']('.')[ZU(0x1dc)]());}}else Y=q;return Y;}catch(P){throw new Error('Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20'+P[ZU(0x101)]);}}if((c=M===null||M===void 0x0?void 0x0:M['opt'])===null||c===void 0x0?void 0x0:c[ZU(0xe8)])throw new Error(ZU(0x1e8));return yield s['retrievePayloadViaInteractiveCli'](M,{'cmdPath':I,'skipValidation':V['skipValidation']});});}}const printCallResult=(Z,K,O,g,N,H,o,s,R)=>{const Zi=a1ZV;if(!(Z===null||Z===void 0x0?void 0x0:Z['quiet'])){if(K)(0x0,console_format_helpers_1['handleJsonOutput'])(Z===null||Z===void 0x0?void 0x0:Z['output'],O);else{if(g)(0x0,console_format_helpers_1[Zi(0x160)])(Z===null||Z===void 0x0?void 0x0:Z['output'],O);else{if(isListCommand(N)){const y=(H===null||H===void 0x0?void 0x0:H[Zi(0x15f)](Zi(0x1c9)))?H['replace'](Zi(0x1c9),'')[Zi(0x1ae)](',')[Zi(0x15b)](I=>I['toLowerCase']()):undefined,W=N[N[Zi(0xef)]-0x1],B=''+W+(W[Zi(0x15c)]('s')?'':'s'),V=_[Zi(0x1f4)](B),M=_[Zi(0x1f9)](O,B)?O[B]:O;(0x0,console_format_helpers_1[Zi(0x1c1)])(M,V,y,o,s);}else console[Zi(0x19f)]((0x0,console_format_helpers_1[Zi(0x1f6)])(O,R));}}}};function a1Z(){const Zz=['northflank','defineProperty','replace','name','file','9258579GIjKGt','templateRunId','there\x20are\x20more\x20rows,\x20load?','opt','__setModuleDefault','omit','askForBuild','OPTIONAL:\x20','subdomain','agent','job','some','repository','getProgram','CliFileCopy','128670zKfAdC','6170704hnZmVN','askForBackupDestination','askForSubdomainPath','cred','addon','cursor','domainId','rawResponse','statusText','Resource\x20was\x20not\x20deleted.','isPaginatedEndpoint','writable','addHelpCommand','resource','underline','backup','paginationArgs','method','askForTemplateRun','Options\x20\x27loadAll\x27\x20can\x20not\x20be\x20combined\x20with\x20\x27page\x27\x20or\x20\x27cursor\x27','plan','commands','moveCursor','serviceId','templateId','map','endsWith','warning','VERBOSE:\x20HTTP_PROXY\x20or\x20HTTPS_PROXY\x20environment\x20variable\x20set:\x20tunnelling\x20traffic\x20through\x20HTTP\x20proxy.','startsWith','handleYamlOutput','getCommand','vol','aliases','askForJob','ApiClient','getCurrentJobName','File\x20does\x20not\x20exist:\x20','Display\x20help\x20for\x20command','askConfirm','./formatting/command-overview','enablePositionalOptions','File\x20to\x20load\x20resource\x20json\x20from','projectId','askForPipeline','argv','resourceTagId','askForSubdomain','__importStar','askForDomain','__importDefault','getCurrentServiceName','projects','create','jobId','invoices','url','askForService','json','addHelpText','32YaPzjT','getOwnPropertyNames','CliExec','checkUpdate','page','version','option','defaults','apply','\x0a>\x20Token\x20permissions\x20required:\x20','tag','stdout','portFwdCmd','addCommand','108GtMndE','repositories','clearLine','request','getCurrentProjectName','GetApiEndpointPaginated','./metrics','chalk','svc','API\x20request\x20failed\x0a\x09Message:\x20','CliMetrics','secrets','prj','invoice','getNextPage','contextProvider','\x20--','2EBFMqx','type','log','parse','/docs/v1/api/','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','templates','existsSync','loadAll','call','credentials','dmn','9TfFqmr','includes','scrt','__awaiter','.yaml','split','hasNextPage','endpoints','askGeneric','\x20Northflank\x20resources','repos','default','query','./logs','getOwnPropertyDescriptor','getLogsCommand','\x20properties','login','backupId','kebabCase','description','ApiClientFileContextProvider','isEqual','Command','printAsTable','template','./copy','verbose','runs','askForLogSink','force','3110457edKKOH','custom-columns=','getCommandOverview','getMetricsCommand','volumes','pagination','Documentation:\x20','safeLoad','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','noDefaults','concat','clusterId','./formatting/console-format-helpers','backup-destination','quiet','__esModule','=>\x20running\x20command\x20with:\x20','set','forEach','toString','pop','Northflank\x20cli\x20version:\x20','project','secretId','\x0a\x09details\x20:','subdomainPath','action','filter','join','askForAddonBackup','./defaults','error','Expecting\x20resource\x20input\x20with\x20\x27--input\x27\x20or\x20\x27--file\x27\x20argument','CliPortForward','docsTagsPath','addonId','assign','proxyEnvsSet','base','.json','assertContextExisting','--verbose','all','downloadCmd','upperFirst','domains','consoleFormat','VERBOSE:\x20Request\x20body\x20->\x20','find','has','list','yaml','required','service','isArray','nonInteractiveEndpoint','exitCode','backup-destinations','36yyamrT','keys','-i,\x20--input\x20<resource-def>','backupDestinationId','length','restores','lodash','pipelineId','askForAddon','(HTTP\x20status\x20code:\x20','commander','askForJobRun','__createBinding','body','pln','logSinkId','next','throw','VERBOSE:\x20Using\x20endpoint\x20->\x20','credentialId','delete','asyncSequential','message','-f,\x20--file\x20<file-path>','../package.json','api.','value','./exec','./inquirer-helper','volumeId','isString','path','334223binfaU','js-yaml','subdomainId','logs','data','count','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','Unknown\x20input\x20file\x20type:\x20','opts','update','askForVolume','domain','get','toUpperCase','repo','readFileSync','prototype','output','15358130eikjLv','requiredPermissions','runId','buildId','tpl','configurable','askForProject','services','after','5364138aTtani','rgn','getCurrentContext','branches','bind','uploadCmd','branch'];a1Z=function(){return Zz;};return a1Z();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const a2y=a2K;(function(U,K){const B=a2K,q=U();while(!![]){try{const X=parseInt(B(0x15a))/0x1+-parseInt(B(0x179))/0x2*(parseInt(B(0x178))/0x3)+parseInt(B(0x197))/0x4*(parseInt(B(0x14a))/0x5)+parseInt(B(0x13d))/0x6+parseInt(B(0x1b5))/0x7+-parseInt(B(0x1a0))/0x8*(parseInt(B(0x14c))/0x9)+parseInt(B(0x19b))/0xa;if(X===K)break;else q['push'](q['shift']());}catch(J){q['push'](q['shift']());}}}(a2U,0x67dff));var __createBinding=this&&this[a2y(0x193)]||(Object[a2y(0x172)]?function(U,K,q,X){const x=a2y;if(X===undefined)X=q;var J=Object['getOwnPropertyDescriptor'](K,q);(!J||(x(0x125)in J?!K['__esModule']:J[x(0x142)]||J['configurable']))&&(J={'enumerable':!![],'get':function(){return K[q];}}),Object[x(0x199)](U,X,J);}:function(U,K,q,X){if(X===undefined)X=q;U[X]=K[q];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object[a2y(0x172)]?function(U,K){Object['defineProperty'](U,'default',{'enumerable':!![],'value':K});}:function(U,K){const a=a2y;U[a(0x15c)]=K;}),__importStar=this&&this[a2y(0x13b)]||function(U){const m=a2y;if(U&&U[m(0x12a)])return U;var K={};if(U!=null){for(var q in U)if(q!=='default'&&Object[m(0x141)][m(0x133)]['call'](U,q))__createBinding(K,U,q);}return __setModuleDefault(K,U),K;},__awaiter=this&&this[a2y(0x1ac)]||function(U,K,q,X){function J(v){return v instanceof q?v:new q(function(f){f(v);});}return new(q||(q=Promise))(function(v,f){const s=a2K;function L(z){const i=a2K;try{E(X[i(0x17e)](z));}catch(p){f(p);}}function M(z){const G=a2K;try{E(X[G(0x16c)](z));}catch(p){f(p);}}function E(z){const A=a2K;z[A(0x155)]?v(z[A(0x14f)]):J(z['value'])['then'](L,M);}E((X=X[s(0x162)](U,K||[]))[s(0x17e)]());});},__importDefault=this&&this['__importDefault']||function(U){const D=a2y;return U&&U[D(0x12a)]?U:{'default':U};};function a2U(){const U1=['getCurrentContext','warning','__importStar','catch','298884PflXku','log','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','action','prototype','writable','finally','\x27\x20successfully\x20updated.','token\x20login','browserLogin','Contexts','getCommand','host','55OrUhLR','clearLine','1243332wpWlNo','autologin-','replace','value','startLogin','useProjectId','-n,\x20--name\x20[NAME]','askForService','list','done','askForProject','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','contextProvider','../formatting/console-format-helpers','633745wwLuwK','getCurrentName','default','doNotOpenBrowser','login','chalk','contextAvailable','set','apply','Shows\x20full\x20context\x20information\x20(including\x20tokens)','host\x20url\x20for\x20this\x20context','update-token','all','\x0aSuccessfully\x20logged\x20in\x20using\x20','--all','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','agent','CliContext','throw','../inquirer-helper','getCurrentToken','Error\x20occured\x20during\x20browser\x20login:\x20','map','-t,\x20--token\x20[TOKEN]','create','Token\x20for\x20this\x20context','tokenLogin','Name\x20for\x20login\x20context','updateToken','search-list','3MjpbfC','1656366gBJlef','use','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','message','next','project','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','Use\x20job\x20with\x20id:','description','success','remove',',\x20added\x20context\x20with\x20name\x20','italic','Use\x20service\x20with\x20id:','Token\x20for\x20current\x20context\x20\x27','loadContextWrapper','current','confirm','close','useJobId','../utils','Choose\x20the\x20context\x20to\x20','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','node-fetch','__createBinding','addCommand','getProjectName','List\x20all\x20available\x20contexts','64164GbrgrX','override','defineProperty','Changed\x20current\x20context\x20to\x20','8036460llSaep','then','name','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','job','24cZzBny','--token-login','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','\x20(current)','askForContext','set-token','--host\x20[HOST]','useContext','verifyToken','proxy-agent','\x20(api\x20host:\x20','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','__awaiter','option','moveCursor','defaultBaseUrl','printAsTable','NorthflankApiBrowserLogin','askForJob','delete','error','31094ByPJRb','useServiceId','.\x20Using\x20fallback.','alias','stdout','--do-not-open-browser','token','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','get','tokenPrompt','Remove\x20a\x20context','service','sanitiseHostname','__esModule','retry','prompt','apiTokenLogin','\x27\x20successfully\x20removed.','ctx','Bearer\x20','contexts','Switch\x20between\x20your\x20local\x20contexts','hasOwnProperty','apiClient','Update\x20token\x20for\x20current\x20context','browser\x20login','context','addContext'];a2U=function(){return U1;};return a2U();}function a2K(U,K){const q=a2U();return a2K=function(X,J){X=X-0x11e;let v=q[X];return v;},a2K(U,K);}Object[a2y(0x199)](exports,a2y(0x12a),{'value':!![]}),exports['CliContext']=void 0x0;const _=__importStar(require('lodash')),proxy_agent_1=require(a2y(0x1a9)),chalk_1=__importDefault(require(a2y(0x15f))),utils_1=require(a2y(0x18f)),inquirer_helper_1=require(a2y(0x16d)),console_format_helpers_1=require(a2y(0x159)),browser_login_1=require('../login/browser-login'),node_fetch_1=__importDefault(require(a2y(0x192))),inquirer=require('inquirer');class CliContext{constructor(U,K=undefined,q='https://api.northflank.com'){const H=a2y;this[H(0x16a)]=K,this[H(0x1af)]=q,this[H(0x129)]=O=>{const g=H;let F=O;return!/^https?:\/\//i['test'](F)&&(F='https://'+F),F=F[g(0x14e)](/\/+$/,''),F;},this[H(0x134)]=U;const X=new inquirer_helper_1['InquirerHelper'](U);this[H(0x15e)]=(0x0,utils_1['getCommand'])()[H(0x19d)](H(0x15e))[H(0x183)]('Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.')[H(0x1ad)](H(0x1a1),'Use\x20manual\x20login\x20with\x20API\x20token',![])[H(0x1ad)](H(0x122),H(0x157),![])[H(0x1ad)](H(0x152),H(0x175))[H(0x1ad)]('-t,\x20--token\x20[TOKEN]','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used')[H(0x1ad)](H(0x1a6),H(0x164),this[H(0x1af)])['option']('--override',H(0x19e),![])[H(0x140)](O=>__awaiter(this,void 0x0,void 0x0,function*(){const S=H;_[S(0x161)](O,'host',this['sanitiseHostname'](O[S(0x149)]));const F=O[S(0x174)]||O[S(0x123)]!==undefined,{name:o,host:Q,token:w,override:R}=F?yield this['apiTokenLogin'](O,X):yield this[S(0x146)](O,X);try{yield this[S(0x134)][S(0x158)][S(0x138)]({'name':o,'host':Q,'token':w},R);}catch(W){(0x0,utils_1[S(0x1b4)])(W[S(0x17d)]);return;}if(!(yield this[S(0x1a8)]()))(0x0,utils_1['error'])(S(0x1a2)),yield this[S(0x134)][S(0x158)]['removeContext'](o);else{const V=F?S(0x145):S(0x136),b=S(0x167)+V+S(0x186)+chalk_1[S(0x15c)][S(0x187)](o)+S(0x1aa)+Q+')';(0x0,utils_1[S(0x184)])(b);}})),this['contexts']=(0x0,utils_1['getCommand'])()[H(0x19d)](H(0x137))[H(0x183)]('Retrieve\x20and\x20update\x20local\x20context\x20settings.')[H(0x120)]('contexts')['alias'](H(0x12f));const J=(0x0,utils_1[H(0x148)])()['name'](H(0x154))[H(0x19d)]('ls')[H(0x183)](H(0x196))[H(0x1ad)](H(0x168),H(0x163))[H(0x140)](O=>__awaiter(this,void 0x0,void 0x0,function*(){const C=H;console[C(0x13e)](U[C(0x158)]['getInfo']());const F=U['contextProvider'][C(0x18a)]();if(O[C(0x166)]===!![]){console['dir'](F);return;}const o=F[C(0x18b)],Q=F[C(0x131)]['sort']((w,R)=>w[C(0x19d)]===o?-0x1:R['name']===o?0x1:0x0)[C(0x170)](w=>{const N=C,R=o===w[N(0x19d)]?N(0x1a3):'';return{'Name':''+w[N(0x19d)]+R,'Host':w[N(0x149)],'Default\x20Project':w[N(0x17f)]||'-','Default\x20Service':w[N(0x128)]||'-'};});(0x0,console_format_helpers_1[C(0x1b0)])(Q,C(0x147));})),v=(0x0,utils_1[H(0x148)])();v[H(0x19d)](H(0x17a))[H(0x183)](H(0x132))[H(0x1ad)]('-n,\x20--name\x20[NAME]',H(0x13f))['action'](O=>__awaiter(this,void 0x0,void 0x0,function*(){const Z=H,F=(O===null||O===void 0x0?void 0x0:O[Z(0x19d)])||(yield this['askForContext']('use'));yield this['apiClient'][Z(0x158)][Z(0x1a7)](F),(0x0,utils_1[Z(0x184)])('Changed\x20current\x20context\x20to\x20'+F);}));const f='-i,\x20--id\x20[ID]',L=(0x0,utils_1[H(0x148)])()[H(0x19d)](H(0x17f))['description']('Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context')[H(0x1ad)](f,H(0x17b))[H(0x140)](O=>__awaiter(this,void 0x0,void 0x0,function*(){const e=H,F=(O===null||O===void 0x0?void 0x0:O['id'])||(yield X[e(0x156)]());yield this[e(0x134)][e(0x158)][e(0x151)](F),console[e(0x13e)]('Use\x20project\x20with\x20id:',F);})),M=(0x0,utils_1[H(0x148)])()[H(0x19d)](H(0x128))[H(0x183)](H(0x191))[H(0x1ad)](f,'Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')['action'](O=>__awaiter(this,void 0x0,void 0x0,function*(){const n=H,F=(O===null||O===void 0x0?void 0x0:O['id'])||(yield X[n(0x153)](this[n(0x195)]())());console['log'](n(0x188),F),yield this['apiClient'][n(0x158)][n(0x11e)](F);})),E=(0x0,utils_1[H(0x148)])()[H(0x19d)](H(0x19f))[H(0x183)](H(0x181))[H(0x1ad)](f,H(0x180))[H(0x140)](O=>__awaiter(this,void 0x0,void 0x0,function*(){const t=H,F=(O===null||O===void 0x0?void 0x0:O['id'])||(yield X[t(0x1b2)](this['getProjectName']())());console[t(0x13e)](t(0x182),F),yield this['apiClient'][t(0x158)][t(0x18e)](F);}));v[H(0x194)](L),v['addCommand'](E),v['addCommand'](M);const z=(0x0,utils_1[H(0x148)])()[H(0x19d)](H(0x185))[H(0x120)](H(0x1b3))['alias']('rm')[H(0x183)](H(0x127))[H(0x1ad)](f,'Local\x20context\x20name\x20to\x20remove.')['action'](O=>__awaiter(this,void 0x0,void 0x0,function*(){const Y=H;var F;const o=(O===null||O===void 0x0?void 0x0:O['id'])||(yield this['askForContext']('remove')),Q=(F=this['apiClient'][Y(0x158)][Y(0x139)]())===null||F===void 0x0?void 0x0:F[Y(0x19d)];yield this[Y(0x134)][Y(0x158)]['removeContext'](o),(0x0,utils_1[Y(0x184)])('Local\x20context\x20\x27'+o+Y(0x12e));if(!this[Y(0x160)]()){(0x0,utils_1[Y(0x13a)])(Y(0x17c));return;}if(Q===o){const w=(O===null||O===void 0x0?void 0x0:O[Y(0x19d)])||(yield this[Y(0x1a4)]('use\x20from\x20now\x20on'));yield this[Y(0x134)][Y(0x158)][Y(0x1a7)](w),(0x0,utils_1[Y(0x184)])(Y(0x19a)+w);}})),p=(0x0,utils_1[H(0x148)])()[H(0x19d)](H(0x165))[H(0x120)](H(0x1a5))[H(0x183)](H(0x135))['option'](H(0x171),H(0x173))[H(0x140)](O=>__awaiter(this,void 0x0,void 0x0,function*(){const l=H,{contextProvider:F}=this[l(0x134)],o=(O===null||O===void 0x0?void 0x0:O['token'])||(yield X[l(0x126)]()),Q=F[l(0x16e)]();yield F['updateToken'](o);if(yield this[l(0x1a8)]())(0x0,utils_1['success'])(l(0x189)+F[l(0x15b)]()+l(0x144));else{if(Q)yield F[l(0x176)](Q);(0x0,utils_1[l(0x1b4)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed');}}));this[H(0x131)]['addCommand'](J),this[H(0x131)][H(0x194)](v),this[H(0x131)][H(0x194)](z),this[H(0x131)]['addCommand'](p);}[a2y(0x146)](U,K){var q,X,J,v;return __awaiter(this,void 0x0,void 0x0,function*(){const T=a2K,f=!U[T(0x15d)],L=(q=U[T(0x149)])!==null&&q!==void 0x0?q:this[T(0x1af)],M=new browser_login_1[(T(0x1b1))](L,f,this[T(0x16a)]);let E;M['on']('browser-opened',({url:F})=>{const I=T;if(f){const o=F[I(0x14e)](/sessionToken=.*/,'sessionToken=********');console[I(0x13e)]('Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20'+o+')'),E=inquirer[I(0x12c)]([{'type':I(0x18c),'name':'fullUrl','message':'Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','default':![]}]),E[I(0x19c)](Q=>{const c=I;process[c(0x121)][c(0x1ae)](0x0,-0x1),process[c(0x121)][c(0x14b)](0x1),Q['fullUrl']&&console[c(0x13e)](c(0x1ab)+F+'\x20');});}else console[I(0x13e)](I(0x1ab)+F+'\x20');});const {token:z,contextName:p}=yield M[T(0x150)]()[T(0x13c)](F=>__awaiter(this,void 0x0,void 0x0,function*(){const h=T;(0x0,utils_1[h(0x1b4)])(h(0x16f)+F[h(0x17d)]+h(0x11f));const o=yield this['apiTokenLogin'](U,K);return{'token':o['token'],'contextName':o[h(0x19d)]};}))[T(0x143)](()=>{const P=T;if(E)E['ui'][P(0x18d)]();}),O=(J=(X=U[T(0x19d)])!==null&&X!==void 0x0?X:p)!==null&&J!==void 0x0?J:T(0x14d)+new Date()['valueOf']();return{'name':O,'token':z,'host':L,'override':(v=U[T(0x198)])!==null&&v!==void 0x0?v:![]};});}[a2y(0x12d)](U,K){return __awaiter(this,void 0x0,void 0x0,function*(){const k=a2K,q=this[k(0x134)]['contextProvider'][k(0x18a)]()[k(0x131)],{name:X,token:J,host:v,override:f}=yield K['loginPrompt'](U,q);return{'name':X,'token':J,'host':v,'override':f};});}['getProjectName'](){const u=a2y,U=this[u(0x134)]['contextProvider']['getCurrentProjectName']();if(U===undefined)throw new Error(u(0x169));return U;}[a2y(0x1a4)](U){return __awaiter(this,void 0x0,void 0x0,function*(){const d=a2K;if(!this[d(0x160)]())throw new Error(d(0x124));const K=this[d(0x134)][d(0x158)][d(0x18a)]()['contexts'][d(0x170)](X=>X[d(0x19d)]),q=K['length']>0x4?d(0x177):'list';return(yield inquirer[d(0x12c)]([{'type':q,'name':d(0x19d),'message':d(0x190)+U+':','choices':K}]))['name'];});}['contextAvailable'](){const r=a2y;return this['apiClient'][r(0x158)]['loadContextWrapper']()[r(0x131)]['length']>0x0;}[a2y(0x1a8)](){return __awaiter(this,void 0x0,void 0x0,function*(){const j=a2K;try{const U=this[j(0x134)][j(0x158)]['getCurrentBaseUrl'](),K=this[j(0x134)][j(0x158)][j(0x16e)](),q=U+'/v1/login',X={'Authorization':j(0x130)+K},J=new proxy_agent_1['ProxyAgent'](),v=yield(0x0,utils_1[j(0x12b)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const U0=j;return(0x0,node_fetch_1[U0(0x15c)])(q,{'method':'GET','signal':AbortSignal['timeout'](0xbb8),'headers':X,'agent':J});}));if(v['ok'])return!![];return![];}catch(f){return![];}});}}exports[a2y(0x16b)]=CliContext;
|
|
1
|
+
'use strict';const a2P=a2K;function a2K(Z,K){const O=a2Z();return a2K=function(g,N){g=g-0x11b;let H=O[g];return H;},a2K(Z,K);}(function(Z,K){const Y=a2K,O=Z();while(!![]){try{const g=parseInt(Y(0x150))/0x1*(parseInt(Y(0x17f))/0x2)+parseInt(Y(0x1a1))/0x3+-parseInt(Y(0x181))/0x4+parseInt(Y(0x144))/0x5+-parseInt(Y(0x1b7))/0x6*(-parseInt(Y(0x121))/0x7)+parseInt(Y(0x14e))/0x8*(parseInt(Y(0x1bb))/0x9)+-parseInt(Y(0x1a2))/0xa;if(g===K)break;else O['push'](O['shift']());}catch(N){O['push'](O['shift']());}}}(a2Z,0x6f63b));var __createBinding=this&&this[a2P(0x192)]||(Object['create']?function(Z,K,O,g){const C=a2P;if(g===undefined)g=O;var N=Object[C(0x16b)](K,O);(!N||(C(0x182)in N?!K[C(0x180)]:N[C(0x165)]||N['configurable']))&&(N={'enumerable':!![],'get':function(){return K[O];}}),Object[C(0x162)](Z,g,N);}:function(Z,K,O,g){if(g===undefined)g=O;Z[g]=K[O];}),__setModuleDefault=this&&this[a2P(0x1aa)]||(Object[a2P(0x13f)]?function(Z,K){const S=a2P;Object[S(0x162)](Z,S(0x136),{'enumerable':!![],'value':K});}:function(Z,K){const n=a2P;Z[n(0x136)]=K;}),__importStar=this&&this[a2P(0x133)]||function(Z){const k=a2P;if(Z&&Z[k(0x180)])return Z;var K={};if(Z!=null){for(var O in Z)if(O!==k(0x136)&&Object[k(0x153)][k(0x12c)][k(0x199)](Z,O))__createBinding(K,Z,O);}return __setModuleDefault(K,Z),K;},__awaiter=this&&this[a2P(0x16f)]||function(Z,K,O,g){function N(H){return H instanceof O?H:new O(function(o){o(H);});}return new(O||(O=Promise))(function(H,o){const r=a2K;function s(W){const x=a2K;try{y(g[x(0x18d)](W));}catch(B){o(B);}}function R(W){try{y(g['throw'](W));}catch(B){o(B);}}function y(W){const m=a2K;W['done']?H(W[m(0x11d)]):N(W[m(0x11d)])[m(0x15c)](s,R);}y((g=g[r(0x138)](Z,K||[]))['next']());});},__importDefault=this&&this[a2P(0x159)]||function(Z){return Z&&Z['__esModule']?Z:{'default':Z};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[a2P(0x11e)]=void 0x0;function a2Z(){const t=['test','replace','name','InquirerHelper','__setModuleDefault','Shows\x20full\x20context\x20information\x20(including\x20tokens)','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','Update\x20token\x20for\x20current\x20context','remove','../inquirer-helper','verifyToken','map','askForService','clearLine','Retrieve\x20and\x20update\x20local\x20context\x20settings.','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','contextAvailable','12LbgDxV','getInfo','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','8451UXUtia','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','Bearer\x20','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','contextProvider','value','CliContext','error','Name\x20for\x20login\x20context','1670221RCrBas','action','useJobId','service','defaultBaseUrl','finally','Local\x20context\x20name\x20to\x20remove.','\x20(api\x20host:\x20','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','list','search-list','hasOwnProperty','--token-login','ProxyAgent','alias','project','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','-i,\x20--id\x20[ID]','__importStar','success','\x20(current)','default','token','apply','addContext','getCurrentBaseUrl','set','tokenPrompt','moveCursor','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','create','removeContext','all','use','chalk','3201475SQWCSK','apiTokenLogin','getProjectName','browser-opened','Use\x20job\x20with\x20id:','message','askForContext','--host\x20[HOST]','-t,\x20--token\x20[TOKEN]','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','1624vqYQGa','context','3233fhXMUV','useServiceId','getCommand','prototype','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','sessionToken=********','description','sort','prompt','__importDefault','valueOf','useContext','then','node-fetch','getCurrentContext','Token\x20for\x20this\x20context','dir','useProjectId','defineProperty','loginPrompt','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','writable','current','log','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','apiClient','use\x20from\x20now\x20on','getOwnPropertyDescriptor','length','autologin-','Changed\x20current\x20context\x20to\x20','__awaiter','browser\x20login','Use\x20manual\x20login\x20with\x20API\x20token','Remove\x20a\x20context','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','https://api.northflank.com','host','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','ctx','contexts','doNotOpenBrowser','Contexts','sanitiseHostname','getCurrentName','host\x20url\x20for\x20this\x20context','Use\x20project\x20with\x20id:','236nBHkku','__esModule','3277056KQYjya','get','proxy-agent',',\x20added\x20context\x20with\x20name\x20','loadContextWrapper','override','https://','List\x20all\x20available\x20contexts','Use\x20service\x20with\x20id:','agent','--do-not-open-browser','stdout','next','delete','login','askForJob','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','__createBinding','warning','addCommand','/v1/login','option','browserLogin','.\x20Using\x20fallback.','call','startLogin','token\x20login','../utils','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','set-token','timeout','job','2559882sFvcoG','12673910kuIjGM','--all','GET','updateToken'];a2Z=function(){return t;};return a2Z();}const _=__importStar(require('lodash')),proxy_agent_1=require(a2P(0x183)),chalk_1=__importDefault(require(a2P(0x143))),utils_1=require(a2P(0x19c)),inquirer_helper_1=require(a2P(0x1af)),console_format_helpers_1=require('../formatting/console-format-helpers'),browser_login_1=require('../login/browser-login'),node_fetch_1=__importDefault(require(a2P(0x15d))),inquirer=require('inquirer');class CliContext{constructor(Z,K=undefined,O=a2P(0x174)){const D=a2P;this[D(0x18a)]=K,this['defaultBaseUrl']=O,this['sanitiseHostname']=V=>{const d=D;let M=V;return!/^https?:\/\//i[d(0x1a6)](M)&&(M=d(0x187)+M),M=M[d(0x1a7)](/\/+$/,''),M;},this['apiClient']=Z;const g=new inquirer_helper_1[(D(0x1a9))](Z);this[D(0x18f)]=(0x0,utils_1[D(0x152)])()[D(0x1a8)](D(0x18f))['description'](D(0x11b))['option'](D(0x12d),D(0x171),![])[D(0x196)](D(0x18b),D(0x1b5),![])[D(0x196)]('-n,\x20--name\x20[NAME]',D(0x120))[D(0x196)](D(0x14c),D(0x14d))['option'](D(0x14b),D(0x17d),this[D(0x125)])['option']('--override','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)',![])['action'](V=>__awaiter(this,void 0x0,void 0x0,function*(){const b=D;_[b(0x13b)](V,b(0x175),this[b(0x17b)](V[b(0x175)]));const M=V['tokenLogin']||V[b(0x137)]!==undefined,{name:I,host:c,token:E,override:p}=M?yield this[b(0x145)](V,g):yield this[b(0x197)](V,g);try{yield this[b(0x169)][b(0x11c)][b(0x139)]({'name':I,'host':c,'token':E},p);}catch(T){(0x0,utils_1[b(0x11f)])(T[b(0x149)]);return;}if(!(yield this[b(0x1b0)]()))(0x0,utils_1[b(0x11f)])(b(0x129)),yield this[b(0x169)][b(0x11c)][b(0x140)](I);else{const J=M?b(0x19b):b(0x170),q='\x0aSuccessfully\x20logged\x20in\x20using\x20'+J+b(0x184)+chalk_1[b(0x136)]['italic'](I)+b(0x128)+c+')';(0x0,utils_1['success'])(q);}})),this[D(0x178)]=(0x0,utils_1['getCommand'])()['name'](D(0x14f))[D(0x156)](D(0x1b4))[D(0x12f)](D(0x178))[D(0x12f)](D(0x177));const N=(0x0,utils_1[D(0x152)])()[D(0x1a8)]('list')['name']('ls')[D(0x156)](D(0x188))[D(0x196)](D(0x1a3),D(0x1ab))[D(0x122)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const l=D;console[l(0x167)](Z['contextProvider'][l(0x1b8)]());const M=Z['contextProvider'][l(0x185)]();if(V[l(0x141)]===!![]){console[l(0x160)](M);return;}const I=M[l(0x166)],c=M[l(0x178)][l(0x157)]((E,p)=>E[l(0x1a8)]===I?-0x1:p['name']===I?0x1:0x0)[l(0x1b1)](E=>{const f=l,p=I===E['name']?f(0x135):'';return{'Name':''+E[f(0x1a8)]+p,'Host':E[f(0x175)],'Default\x20Project':E['project']||'-','Default\x20Service':E[f(0x124)]||'-'};});(0x0,console_format_helpers_1['printAsTable'])(c,l(0x17a));})),H=(0x0,utils_1['getCommand'])();H[D(0x1a8)](D(0x142))[D(0x156)]('Switch\x20between\x20your\x20local\x20contexts')[D(0x196)]('-n,\x20--name\x20[NAME]',D(0x1bc))[D(0x122)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const a=D,M=(V===null||V===void 0x0?void 0x0:V[a(0x1a8)])||(yield this['askForContext'](a(0x142)));yield this[a(0x169)][a(0x11c)][a(0x15b)](M),(0x0,utils_1[a(0x134)])(a(0x16e)+M);}));const o=D(0x132),s=(0x0,utils_1[D(0x152)])()[D(0x1a8)](D(0x130))[D(0x156)](D(0x131))[D(0x196)](o,D(0x1b9))['action'](V=>__awaiter(this,void 0x0,void 0x0,function*(){const v=D,M=(V===null||V===void 0x0?void 0x0:V['id'])||(yield g['askForProject']());yield this[v(0x169)]['contextProvider'][v(0x161)](M),console[v(0x167)](v(0x17e),M);})),R=(0x0,utils_1['getCommand'])()[D(0x1a8)](D(0x124))[D(0x156)](D(0x173))[D(0x196)](o,D(0x19d))[D(0x122)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const L=D,M=(V===null||V===void 0x0?void 0x0:V['id'])||(yield g[L(0x1b2)](this[L(0x146)]())());console['log'](L(0x189),M),yield this['apiClient']['contextProvider'][L(0x151)](M);})),y=(0x0,utils_1[D(0x152)])()[D(0x1a8)](D(0x1a0))[D(0x156)](D(0x176))['option'](o,D(0x168))[D(0x122)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const X=D,M=(V===null||V===void 0x0?void 0x0:V['id'])||(yield g[X(0x190)](this[X(0x146)]())());console[X(0x167)](X(0x148),M),yield this[X(0x169)][X(0x11c)][X(0x123)](M);}));H[D(0x194)](s),H[D(0x194)](y),H[D(0x194)](R);const W=(0x0,utils_1['getCommand'])()[D(0x1a8)](D(0x1ae))['alias'](D(0x18e))['alias']('rm')[D(0x156)](D(0x172))[D(0x196)](o,D(0x127))[D(0x122)](V=>__awaiter(this,void 0x0,void 0x0,function*(){const e=D;var M;const I=(V===null||V===void 0x0?void 0x0:V['id'])||(yield this[e(0x14a)](e(0x1ae))),c=(M=this[e(0x169)][e(0x11c)][e(0x15e)]())===null||M===void 0x0?void 0x0:M[e(0x1a8)];yield this['apiClient'][e(0x11c)][e(0x140)](I),(0x0,utils_1[e(0x134)])('Local\x20context\x20\x27'+I+'\x27\x20successfully\x20removed.');if(!this[e(0x1b6)]()){(0x0,utils_1[e(0x193)])(e(0x191));return;}if(c===I){const E=(V===null||V===void 0x0?void 0x0:V[e(0x1a8)])||(yield this[e(0x14a)](e(0x16a)));yield this[e(0x169)]['contextProvider'][e(0x15b)](E),(0x0,utils_1[e(0x134)])(e(0x16e)+E);}})),B=(0x0,utils_1['getCommand'])()['name']('update-token')[D(0x12f)](D(0x19e))[D(0x156)](D(0x1ad))[D(0x196)]('-t,\x20--token\x20[TOKEN]',D(0x15f))['action'](V=>__awaiter(this,void 0x0,void 0x0,function*(){const U=D,{contextProvider:M}=this['apiClient'],I=(V===null||V===void 0x0?void 0x0:V[U(0x137)])||(yield g[U(0x13c)]()),c=M['getCurrentToken']();yield M[U(0x1a5)](I);if(yield this[U(0x1b0)]())(0x0,utils_1[U(0x134)])('Token\x20for\x20current\x20context\x20\x27'+M[U(0x17c)]()+'\x27\x20successfully\x20updated.');else{if(c)yield M[U(0x1a5)](c);(0x0,utils_1['error'])(U(0x1ba));}}));this[D(0x178)][D(0x194)](N),this[D(0x178)][D(0x194)](H),this[D(0x178)][D(0x194)](W),this[D(0x178)][D(0x194)](B);}[a2P(0x197)](Z,K){var O,g,N,H;return __awaiter(this,void 0x0,void 0x0,function*(){const i=a2K,o=!Z[i(0x179)],s=(O=Z[i(0x175)])!==null&&O!==void 0x0?O:this[i(0x125)],R=new browser_login_1['NorthflankApiBrowserLogin'](s,o,this[i(0x18a)]);let y;R['on'](i(0x147),({url:M})=>{const z=i;if(o){const I=M['replace'](/sessionToken=.*/,z(0x155));console[z(0x167)](z(0x164)+I+')'),y=inquirer[z(0x158)]([{'type':'confirm','name':'fullUrl','message':'Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','default':![]}]),y[z(0x15c)](c=>{const j=z;process['stdout'][j(0x13d)](0x0,-0x1),process[j(0x18c)][j(0x1b3)](0x1),c['fullUrl']&&console[j(0x167)](j(0x154)+M+'\x20');});}else console['log']('Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09'+M+'\x20');});const {token:W,contextName:B}=yield R[i(0x19a)]()['catch'](M=>__awaiter(this,void 0x0,void 0x0,function*(){const G=i;(0x0,utils_1[G(0x11f)])('Error\x20occured\x20during\x20browser\x20login:\x20'+M[G(0x149)]+G(0x198));const I=yield this[G(0x145)](Z,K);return{'token':I[G(0x137)],'contextName':I[G(0x1a8)]};}))[i(0x126)](()=>{if(y)y['ui']['close']();}),V=(N=(g=Z['name'])!==null&&g!==void 0x0?g:B)!==null&&N!==void 0x0?N:i(0x16d)+new Date()[i(0x15a)]();return{'name':V,'token':W,'host':s,'override':(H=Z[i(0x186)])!==null&&H!==void 0x0?H:![]};});}[a2P(0x145)](Z,K){return __awaiter(this,void 0x0,void 0x0,function*(){const w=a2K,O=this['apiClient'][w(0x11c)][w(0x185)]()['contexts'],{name:g,token:N,host:H,override:o}=yield K[w(0x163)](Z,O);return{'name':g,'token':N,'host':H,'override':o};});}['getProjectName'](){const Q=a2P,Z=this[Q(0x169)][Q(0x11c)]['getCurrentProjectName']();if(Z===undefined)throw new Error(Q(0x1ac));return Z;}[a2P(0x14a)](Z){return __awaiter(this,void 0x0,void 0x0,function*(){const u=a2K;if(!this['contextAvailable']())throw new Error(u(0x13e));const K=this[u(0x169)]['contextProvider'][u(0x185)]()['contexts'][u(0x1b1)](g=>g[u(0x1a8)]),O=K[u(0x16c)]>0x4?u(0x12b):u(0x12a);return(yield inquirer[u(0x158)]([{'type':O,'name':u(0x1a8),'message':'Choose\x20the\x20context\x20to\x20'+Z+':','choices':K}]))['name'];});}[a2P(0x1b6)](){const F=a2P;return this[F(0x169)][F(0x11c)]['loadContextWrapper']()[F(0x178)][F(0x16c)]>0x0;}[a2P(0x1b0)](){return __awaiter(this,void 0x0,void 0x0,function*(){const A=a2K;try{const Z=this[A(0x169)][A(0x11c)][A(0x13a)](),K=this[A(0x169)][A(0x11c)]['getCurrentToken'](),O=Z+A(0x195),g={'Authorization':A(0x1bd)+K},N=new proxy_agent_1[(A(0x12e))](),H=yield(0x0,utils_1['retry'])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const h=A;return(0x0,node_fetch_1['default'])(O,{'method':h(0x1a4),'signal':AbortSignal[h(0x19f)](0xbb8),'headers':g,'agent':N});}));if(H['ok'])return!![];return![];}catch(o){return![];}});}}exports[a2P(0x11e)]=CliContext;
|
package/dist/copy/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';const a3n=a3K;(function(Z,K){const S=a3K,O=Z();while(!![]){try{const g=-parseInt(S(0xc4))/0x1*(parseInt(S(0xb9))/0x2)+-parseInt(S(0x112))/0x3*(parseInt(S(0xb5))/0x4)+-parseInt(S(0x104))/0x5*(-parseInt(S(0xe3))/0x6)+-parseInt(S(0x100))/0x7+-parseInt(S(0xe1))/0x8+-parseInt(S(0x103))/0x9*(-parseInt(S(0xd2))/0xa)+parseInt(S(0xc2))/0xb;if(g===K)break;else O['push'](O['shift']());}catch(N){O['push'](O['shift']());}}}(a3Z,0xc3302));var __awaiter=this&&this[a3n(0xe8)]||function(Z,K,O,g){function N(H){return H instanceof O?H:new O(function(o){o(H);});}return new(O||(O=Promise))(function(H,o){const r=a3K;function s(W){const k=a3K;try{y(g[k(0xb7)](W));}catch(B){o(B);}}function R(W){const x=a3K;try{y(g[x(0xfd)](W));}catch(B){o(B);}}function y(W){const m=a3K;W[m(0xdc)]?H(W[m(0xc9)]):N(W[m(0xc9)])[m(0xcb)](s,R);}y((g=g[r(0xc6)](Z,K||[]))[r(0xb7)]());});};function a3K(Z,K){const O=a3Z();return a3K=function(g,N){g=g-0xb1;let H=O[g];return H;},a3K(Z,K);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[a3n(0xd7)]=void 0x0;const js_client_1=require('@northflank/js-client'),utils_1=require(a3n(0x10f)),inquirer_helper_1=require(a3n(0xde)),lodash_1=require(a3n(0xf1)),inquirer=require('inquirer');class CliFileCopy{constructor(Z,K){const D=a3n;this[D(0xe9)]=(y,W)=>{const d=D,B=(0x0,lodash_1[d(0xd9)])(W),V=W===d(0xe5)?d(0xc5):d(0xf9),M=W===d(0xe5)?d(0x111):'current\x20working',I=W===d(0xe5)?'to':d(0xb1);return(0x0,utils_1[d(0xf5)])(!![])[d(0xd8)]('file')[d(0x101)](B+d(0xbf)+I+d(0xb3)+y+d(0xd6)+V+'Path\x20is\x20not\x20specified,\x20the\x20'+M+'\x20directory\x20is\x20used.\x20If\x20the\x20directory\x20for\x20'+V+d(0xe7)+B+'\x20single\x20file:\x20\x20\x20northflank\x20'+W+'\x20'+y+d(0xfb)+W+'ed-file.txt\x0a\x20\x20'+B+d(0xdb)+W+'\x20'+y+'\x20file\x20--localPath\x20my_directory\x20--remotePath\x20/home/'+W+d(0xcd))[d(0xb8)]('--project\x20--projectId\x20[NAME]',d(0xd5)+W)[d(0xb8)]('--'+y+d(0xcc)+y+d(0x106),y[d(0xda)](0x0)[d(0x10e)]()+y[d(0x113)](0x1)+d(0xdd)+W+d(0xea))['option']('--container\x20--containerId\x20[NAME]',d(0xba)+W+'\x20(random\x20container\x20will\x20be\x20chosen\x20if\x20not\x20specified)')[d(0xb8)](d(0xc0),d(0xb2))[d(0xb8)](d(0xc7),d(0xce))[d(0xb8)](d(0xfe),d(0x102),![]);},this[D(0xf0)]=(y,W)=>{const b=D;if(W)return;const {sourceDirectory:B,targetDirectory:V,sourceFile:M,targetFile:I}=y;switch(y[b(0xbe)]){case js_client_1[b(0xeb)][b(0xca)]:{(0x0,utils_1['success'])(b(0x10b)+B+b(0xf6)+V+'\x27');break;}case js_client_1[b(0xeb)][b(0xef)]:{(0x0,utils_1[b(0x105)])(b(0xf3)+B+'/'+M+b(0xdf)+V+'/'+I+'\x27');break;}case js_client_1[b(0xeb)][b(0xc8)]:{(0x0,utils_1[b(0x105)])('Uploaded\x20all\x20directory\x20contents\x20from\x20\x27'+B+b(0xe4)+V+'\x27');break;}case js_client_1[b(0xeb)][b(0x108)]:{(0x0,utils_1['success'])(b(0xd4)+B+'/'+M+b(0xdf)+V+'/'+I+'\x27');break;}}},this[D(0x10c)]=(y,W)=>__awaiter(this,void 0x0,void 0x0,function*(){const l=D,B=y===l(0x109)&&W[l(0xb6)]===undefined?yield this[l(0xbc)]('\x27remotePath\x27','download'):W['remotePath'],V=y===l(0xe5)&&W[l(0xb4)]===undefined?yield this[l(0xbc)](l(0xf4),l(0xe5)):W[l(0xb4)];return{'localPath':V,'remotePath':B};}),this[D(0xbc)]=(y,W)=>__awaiter(this,void 0x0,void 0x0,function*(){const f=D,B=y+'\x20is\x20required\x20for\x20'+W+f(0xec);return(yield inquirer[f(0x110)]([{'type':f(0x107),'name':f(0xd8),'message':B}]))[f(0xd8)];}),this[D(0xee)]=new js_client_1[(D(0xed))](Z,{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1['customUserAgent'],'agent':K});const O=new inquirer_helper_1[(D(0xf7))](this[D(0xee)]);this[D(0xbd)]=(0x0,utils_1[D(0xf5)])()[D(0xd8)]('download')['alias']('dl')['description'](D(0xd0)),this['uploadCmd']=(0x0,utils_1[D(0xf5)])()['name'](D(0xe5))['alias']('ul')[D(0x101)](D(0xc3));const g=(0x0,utils_1[D(0xf5)])()[D(0xd8)](D(0xd1))[D(0x101)](D(0xf2)),N=(0x0,utils_1[D(0xf5)])()[D(0xd8)](D(0xd1))['description'](D(0xe0)),H=(0x0,utils_1[D(0xf5)])()[D(0xd8)](D(0xfa))[D(0x101)](D(0xbb)),o=(0x0,utils_1['getCommand'])()['name']('job')[D(0x101)](D(0xff)),s=y=>{const a=D;return this[a(0xe9)]('service',y)[a(0xe6)](W=>__awaiter(this,void 0x0,void 0x0,function*(){const v=a,{projectId:B,serviceId:V,containerId:M,noDefaults:I,quiet:c}=W;(0x0,utils_1[v(0xc1)])(this[v(0xee)]);const E=I?undefined:Z[v(0xe2)](),p=B||E||(yield O[v(0x10a)]()),T=I?undefined:Z[v(0xcf)](),J=V||T||(yield O['askForService'](p)()),{remotePath:q,localPath:Y}=yield this[v(0x10c)](y,W),P={'projectId':p,'serviceId':J},C=yield this[v(0xee)][y][v(0xd1)]['files'](P,{'containerName':M,'localPath':Y,'remotePath':q});this[v(0xf0)](C,c);}));},R=y=>{const L=D;return this[L(0xe9)](L(0xfa),y)['action'](W=>__awaiter(this,void 0x0,void 0x0,function*(){const X=L,{projectId:B,jobId:V,containerId:M,noDefaults:I,quiet:c}=W;(0x0,utils_1['assertContextExisting'])(this[X(0xee)]);const E=I?undefined:Z[X(0xe2)](),p=B||E||(yield O[X(0x10a)]()),T=V||(yield O[X(0xd3)](p)()),{remotePath:J,localPath:q}=yield this[X(0x10c)](y,W),Y={'projectId':p,'jobId':T},P=yield this['apiClient'][y][X(0xfa)][X(0xfc)](Y,{'containerName':M,'localPath':q,'remotePath':J});this[X(0xf0)](P,c);}));};g['addCommand'](s(D(0x109))),H[D(0x10d)](R(D(0x109))),N[D(0x10d)](s(D(0xe5))),o[D(0x10d)](R('upload')),this[D(0xbd)][D(0x10d)](g),this['downloadCmd']['addCommand'](H),this[D(0xf8)]['addCommand'](N),this[D(0xf8)][D(0x10d)](o);}}function a3Z(){const e=['charAt','\x20directory:\x20\x20\x20\x20\x20northflank\x20','done','\x20to\x20','../inquirer-helper','\x27\x20to\x20\x27','File\x20and\x20directory\x20upload\x20for\x20Northflank\x20service.','11032016OdMFje','getCurrentProjectName','6370326KJzHYn','\x27\x20to\x20container\x20directory\x20\x27','upload','action','Path\x20does\x20not\x20exist,\x20it\x20will\x20be\x20created.\x0aExamples:\x0a\x20\x20','__awaiter','getStandardCopyCommand','\x20files','CopyType','s.\x20Please\x20enter\x20a\x20path:','ApiClient','apiClient','FILE_DOWNLOAD','logCopyResult','lodash','File\x20and\x20directory\x20download\x20for\x20Northflank\x20service.','Downloaded\x20file\x20\x27','\x27localPath\x27','getCommand','\x27\x20to\x20local\x20directory\x20\x27','InquirerHelper','uploadCmd','local','job','\x20file\x20--localPath\x20my_directory/my-file.txt\x20--remotePath\x20/home/my-','files','throw','--noDefaults','File\x20and\x20directory\x20upload\x20for\x20Northflank\x20job.','6740048frbGUY','description','Don\x27t\x20use\x20context\x20default\x20values,\x20explicitly\x20use\x20options\x20or\x20ask.','4047561oZxRYu','5xagdbi','success','Id\x20[NAME]','input','FILE_UPLOAD','download','askForProject','Downloaded\x20all\x20directory\x20contents\x20from\x20\x27','ensureRelevantPathIsSet','addCommand','toUpperCase','../utils','prompt','user\x20home','6753PTlRjY','slice','from','Local\x20file\x20or\x20directory','\x20the\x20specified\x20','localPath','2740ufUagQ','remotePath','next','option','745348pavVNn','Container\x20used\x20to\x20','File\x20and\x20directory\x20download\x20for\x20Northflank\x20job.','askForPath','downloadCmd','type','\x20files\x20','--local\x20--localPath\x20[LOCALPATH]','assertContextExisting','38989665lEczHc','File\x20and\x20directory\x20upload\x20for\x20Northflank\x20services\x20and\x20jobs.','1wHUthx','remote','apply','--remote\x20--remotePath\x20[REMOTEPATH]','DIRECTORY_UPLOAD','value','DIRECTORY_DOWNLOAD','then','\x20--','-dir','Remote\x20file\x20or\x20directory','getCurrentServiceName','File\x20and\x20directory\x20download\x20for\x20Northflank\x20services\x20and\x20jobs.','service','10nihzxN','askForJob','Uploaded\x20file\x20from\x20\x27','Project\x20for\x20','.\x20If\x20the\x20','CliFileCopy','name','capitalize'];a3Z=function(){return e;};return a3Z();}exports[a3n(0xd7)]=CliFileCopy;
|