@northflank/cli 0.9.2 → 0.9.3
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/command-overview.js +1 -1
- package/dist/console-format-helpers.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/inquirer-helper.js +1 -1
- package/dist/login/browser-login.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 +7 -5
package/dist/api-helpers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a0n5=a0C;(function(n,C){const n1=a0C,k=n();while(!![]){try{const H=-parseInt(n1(0x8f))/0x1*(-parseInt(n1(0x8e))/0x2)+-parseInt(n1(0xa5))/0x3*(-parseInt(n1(0x8c))/0x4)+parseInt(n1(0x82))/0x5+-parseInt(n1(0x8a))/0x6*(parseInt(n1(0x9f))/0x7)+parseInt(n1(0x77))/0x8+-parseInt(n1(0xa8))/0x9*(-parseInt(n1(0x91))/0xa)+-parseInt(n1(0x86))/0xb*(parseInt(n1(0x76))/0xc);if(H===C)break;else k['push'](k['shift']());}catch(R){k['push'](k['shift']());}}}(a0n,0x360b2));function a0C(n,C){const k=a0n();return a0C=function(H,R){H=H-0x70;let W=k[H];return W;},a0C(n,C);}var __awaiter=this&&this['__awaiter']||function(n,C,k,H){function R(W){return W instanceof k?W:new k(function(i){i(W);});}return new(k||(k=Promise))(function(W,i){const n4=a0C;function t(y){const n2=a0C;try{M(H[n2(0x7a)](y));}catch(T){i(T);}}function r(y){try{M(H['throw'](y));}catch(T){i(T);}}function M(y){const n3=a0C;y['done']?W(y[n3(0x96)]):R(y['value'])[n3(0x9e)](t,r);}M((H=H[n4(0x9b)](n,C||[]))[n4(0x7a)]());});};function a0n(){const nH=['apply','storage','list','then','21gftwbL','get','credentials','replicas','warning','plans','162786zaAtFy','fetchResourceList','types','783ARIsHh','defineProperty','versions','version','default','secretLink','pagination','keyName','secret','projects','11911236LJznPg','3005800kxIMvI','templates','nextPageCursor','next','__esModule','resources','includes','source','cursor','owningObject','backupId','1577955UfKkDw','keys','envs','projectId','11eokqnN','map','regions','internalId','121782ppvrWR','registries','16SDNLuM','addon','22AEbALB','20568QFpSQM','data','16120afGHmo','type','addonDependencies','addons','find','value','addonTypes','serviceId','templateId','addonId'];a0n=function(){return nH;};return a0n();}Object[a0n5(0xa9)](exports,a0n5(0x7b),{'value':!![]}),exports['fetchResourceList']=void 0x0;const utils_1=require('./utils'),defaultPaginationPageSize=0x32,getProjects=n=>C=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const n6=a0n5;var k;const H=yield n['list'][n6(0x75)]({'options':{'per_page':defaultPaginationPageSize,'cursor':C===null||C===void 0x0?void 0x0:C[n6(0x79)]}});return{'elements':H['data'][n6(0x75)]['map'](R=>R['id']),'nextPageCursor':(k=H[n6(0x72)])===null||k===void 0x0?void 0x0:k['cursor']};}),getServices=(n,C)=>k=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const n7=a0n5;var H;const R=yield n[n7(0x9d)]['services']({'parameters':{'projectId':C},'options':{'per_page':defaultPaginationPageSize,'cursor':k===null||k===void 0x0?void 0x0:k[n7(0x79)]}});return{'elements':R[n7(0x90)]['services']['map'](W=>W['id']),'nextPageCursor':(H=R[n7(0x72)])===null||H===void 0x0?void 0x0:H[n7(0x7f)]};}),getAddons=(n,C)=>k=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const n8=a0n5;var H;const R=yield n['list'][n8(0x94)]({'parameters':{'projectId':C},'options':{'per_page':defaultPaginationPageSize,'cursor':k===null||k===void 0x0?void 0x0:k['nextPageCursor']}});return{'elements':R[n8(0x90)]['addons'][n8(0x87)](W=>W['id']),'nextPageCursor':(H=R['pagination'])===null||H===void 0x0?void 0x0:H[n8(0x7f)]};}),getAddonBackups=(n,C,k)=>H=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const n9=a0n5;var R;const W=yield n[n9(0xa0)][n9(0x8d)]['backups']({'parameters':{'projectId':C,'addonId':k},'options':{'per_page':defaultPaginationPageSize,'cursor':H===null||H===void 0x0?void 0x0:H[n9(0x79)]}});return{'elements':W[n9(0x90)]['backups'][n9(0x87)](i=>i['id']),'nextPageCursor':(R=W[n9(0x72)])===null||R===void 0x0?void 0x0:R[n9(0x7f)]};});function fetchResourceList(n,C,k,H,R,W){var i,t,r,M,y,T,V,j,U,h,o,A;return __awaiter(this,void 0x0,void 0x0,function*(){const nn=a0C,d=undefined;try{if(n==='deploymentPlan'){const a=yield C[nn(0x9d)]['plans']({}),N=a[nn(0x90)][nn(0xa4)][nn(0x87)](X=>{const nC=nn;var E;return(E=X===null||X===void 0x0?void 0x0:X[nC(0x89)])!==null&&E!==void 0x0?E:X===null||X===void 0x0?void 0x0:X['id'];});return{'choices':N,'defaultValue':d};}if(n==='region'&&!(k===null||k===void 0x0?void 0x0:k[nn(0x7d)]('logSink'))){const X=yield C[nn(0x9d)][nn(0x88)]({}),E=X[nn(0x90)][nn(0x88)][nn(0x87)](g=>{var c;return(c=g===null||g===void 0x0?void 0x0:g['internalId'])!==null&&c!==void 0x0?c:g===null||g===void 0x0?void 0x0:g['id'];});return{'choices':E,'defaultValue':d};}if(n===nn(0x85)){const g=yield getProjects(C),{elements:c,nextPageCursor:b}=yield g();return{'choices':c,'defaultValue':d,'pagination':{'nextPageCursor':b,'loadMore':g}};}if(n===nn(0xa1)){const L=yield C[nn(0x9d)][nn(0x8b)]({}),G=L['data']['credentials'][nn(0x87)](Z=>Z['id']);return{'choices':G,'defaultValue':d};}const Q=R===null||R===void 0x0?void 0x0:R[nn(0x85)],l=n===nn(0x98)||n==='id'&&(W===null||W===void 0x0?void 0x0:W[nn(0x7d)](nn(0x80)));if(Q!==undefined&&l){const Z=yield getServices(C,Q),{elements:q,nextPageCursor:w}=yield Z();return{'choices':q,'defaultValue':d,'pagination':{'nextPageCursor':w,'loadMore':Z}};}const K=k===null||k===void 0x0?void 0x0:k[nn(0x7d)]('addon');if(K){const O=F=>__awaiter(this,void 0x0,void 0x0,function*(){const nk=nn;var D;const Y=yield C[nk(0xa0)][nk(0x8d)][nk(0xa7)]({});return(D=Y[nk(0x90)]['addonTypes'])===null||D===void 0x0?void 0x0:D[nk(0x95)](S=>S[nk(0x92)]===F);});if(n===nn(0x92)){const F=yield C['get'][nn(0x8d)][nn(0xa7)]({}),D=(i=F['data'][nn(0x97)])===null||i===void 0x0?void 0x0:i[nn(0x87)](Y=>Y['type']);return{'choices':D,'defaultValue':d};}if(n===nn(0xab)&&(H===null||H===void 0x0?void 0x0:H[nn(0x92)])!==undefined){const Y=(t=yield O(H['type']))===null||t===void 0x0?void 0x0:t[nn(0xaa)];return{'choices':Y,'defaultValue':d};}if(n==='storage'&&(H===null||H===void 0x0?void 0x0:H[nn(0x92)])!==undefined){const S=(M=(r=yield O(H[nn(0x92)]))===null||r===void 0x0?void 0x0:r['resources'])===null||M===void 0x0?void 0x0:M[nn(0x9c)];return{'choices':S===null||S===void 0x0?void 0x0:S['options'],'defaultValue':S===null||S===void 0x0?void 0x0:S[nn(0x70)]};}if(n===nn(0xa2)&&(H===null||H===void 0x0?void 0x0:H[nn(0x92)])!==undefined){const x=(T=(y=yield O(H[nn(0x92)]))===null||y===void 0x0?void 0x0:y[nn(0x7c)])===null||T===void 0x0?void 0x0:T['replicas'];return{'choices':x===null||x===void 0x0?void 0x0:x['options'],'defaultValue':x===null||x===void 0x0?void 0x0:x[nn(0x70)]};}}if(n==='addonId'&&(R===null||R===void 0x0?void 0x0:R[nn(0x85)])!==undefined){const J=yield getAddons(C,R===null||R===void 0x0?void 0x0:R['projectId']),{elements:z,nextPageCursor:u}=yield J();return{'choices':z,'defaultValue':d,'pagination':{'nextPageCursor':u,'loadMore':J}};}if(n===nn(0x81)&&(R===null||R===void 0x0?void 0x0:R[nn(0x85)])!==undefined&&((V=H===null||H===void 0x0?void 0x0:H[nn(0x7e)])===null||V===void 0x0?void 0x0:V[nn(0x9a)])!==undefined){const f=yield getAddonBackups(C,R===null||R===void 0x0?void 0x0:R[nn(0x85)],(j=H===null||H===void 0x0?void 0x0:H[nn(0x7e)])===null||j===void 0x0?void 0x0:j[nn(0x9a)]),{elements:B,nextPageCursor:v}=yield f();return{'choices':B,'defaultValue':d,'pagination':{'nextPageCursor':v,'loadMore':f}};}const m=(U=R===null||R===void 0x0?void 0x0:R[nn(0x9a)])!==null&&U!==void 0x0?U:(h=H===null||H===void 0x0?void 0x0:H[nn(0x93)])===null||h===void 0x0?void 0x0:h[nn(0x9a)];if((k===null||k===void 0x0?void 0x0:k['join'](''))==='updateaddonversion'&&n===nn(0xab)&&(R===null||R===void 0x0?void 0x0:R[nn(0x85)])!==undefined&&m!==undefined){const {upgradeTo:P}=(yield C[nn(0xa0)][nn(0x8d)][nn(0xab)]({'parameters':{'addonId':m,'projectId':R===null||R===void 0x0?void 0x0:R['projectId']}}))[nn(0x90)];if(P===undefined||P['length']<=0x0){(0x0,utils_1[nn(0xa3)])('No\x20available\x20versions\x20to\x20upgrade\x20to.');throw new Error();}return{'choices':P[nn(0x87)](I=>I[nn(0xab)]),'defaultValue':d};}if(n===nn(0x99)){const I=yield C['list'][nn(0x78)]({}),s=I[nn(0x90)][nn(0x78)]['map'](p=>p===null||p===void 0x0?void 0x0:p['id']);return{'choices':s,'defaultValue':d};}if(((k===null||k===void 0x0?void 0x0:k[nn(0x7d)](nn(0x71)))||(k===null||k===void 0x0?void 0x0:k[nn(0x7d)](nn(0x74))))&&n===nn(0x73)&&m!==undefined&&(R===null||R===void 0x0?void 0x0:R[nn(0x85)])!==undefined){const p=(yield C['get'][nn(0x8d)][nn(0xa1)]({'parameters':{'addonId':m,'projectId':R===null||R===void 0x0?void 0x0:R['projectId']}}))[nn(0x90)];return{'choices':[...(o=Object[nn(0x83)](p===null||p===void 0x0?void 0x0:p[nn(0x84)]))!==null&&o!==void 0x0?o:[],...(A=Object[nn(0x83)](p===null||p===void 0x0?void 0x0:p['secrets']))!==null&&A!==void 0x0?A:[]]};}}catch(n0){}return{'choices':undefined,'defaultValue':d};});}exports[a0n5(0xa6)]=fetchResourceList;
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';const a1iE=a1p;(function(i,p){const iL=a1p,B=i();while(!![]){try{const H=parseInt(iL(0x21d))/0x1+-parseInt(iL(0x241))/0x2+parseInt(iL(0x220))/0x3+-parseInt(iL(0x1ff))/0x4*(parseInt(iL(0x22d))/0x5)+parseInt(iL(0x18e))/0x6+parseInt(iL(0x1d8))/0x7+-parseInt(iL(0x1c2))/0x8;if(H===p)break;else B['push'](B['shift']());}catch(j){B['push'](B['shift']());}}}(a1i,0xe46d5));function a1i(){const iy=['argv','option','Documentation:\x20','askForProject','.yaml','serviceId','query','JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22','isEqual','__createBinding','inv','runId','keys','236naTbhL','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','join','getCommandOverview','upperFirst','errors','after','/docs/v1/api/','next','requiredPermissions','getCommand','getCurrentJobName','message','then','asyncSequential','credentialId','pop','body','yml','subdomain','stringify','__esModule','askGeneric','askForAddon','askForSubdomain','writable','json','version','setPathVars','repos','1204040APJVuk','apply','force','1292604IuDBzl','invoices','askForAddonBackup','--verbose','login','replace','js-yaml','addon','projects','file','opts','toUpperCase','volumeId','8250XNoGTW','plan','regions','./port-forward','green','call','description','sort','services','update','filter','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','has','custom-columns=','path',',\x20-','projectId','base','required','toLowerCase','1550380lnvUzY','safeDump','type','credential','includes','checkUpdate','job','__importStar','portFwdCmd','(HTTP\x20status\x20code:\x20','consoleFormat','split','docsTagsPath','parse','branches','\x20properties','contextProvider','CliPortForward','VERBOSE:\x20Using\x20endpoint\x20->\x20','isArray','create','value','./utils','url','enablePositionalOptions','API\x20request\x20failed\x0a\x09Message:\x20','find','delete','InquirerHelper','name','Northflank\x20cli\x20version:\x20','existsSync','bind','\x20--','entries','@northflank/js-client','log','commander','./exec','6487632kytMtM','askForBuild','askConfirm','CliContext','VERBOSE:\x20Request\x20body\x20->\x20','example','opt','parseAsync','subdomainId','scrt','execCmd','getCurrentContext','defineProperty','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','count','details','./console-format-helpers','some','getOwnPropertyDescriptor','secrets','underline','__awaiter','getProgram','readFileSync','repo','runs','throw','jobId','volumes','-i,\x20--input\x20<resource-def>','toString','domainId','set','File\x20to\x20load\x20resource\x20json\x20from','exitCode','output','deleteWarningPrompt','volume','=>\x20running\x20command\x20with:\x20','addCommand','askForJobRun','region','getOwnPropertyNames','configurable','api.','status','\x0a>\x20Token\x20permissions\x20required:\x20','length','concat','Update\x20Northflank\x20','OPTIONAL:\x20','addHelpText','12580192ppSzxA','runtimeFiles/additionalProperties','cursor','Command','-v,\x20--version','Resource\x20was\x20not\x20deleted.','repositories','adn','customUserAgent','addonId','resource','contexts','noDefaults','default','ApiClient','File\x20does\x20not\x20exist:\x20','__importDefault','get','method','domains','Get\x20information\x20about\x20Northflank\x20','map','4651647OVLrDP','buildId','addons','moveCursor','secret','-f,\x20--file\x20<file-path>','forEach','secretId','domain','endsWith','pln','askForService','backupId','askForVolume','rgn','stdout','done','kebabCase','./defaults','jobs','ApiClientFileContextProvider','repository','prj','grey','yaml','CliExec'];a1i=function(){return iy;};return a1i();}var __createBinding=this&&this[a1iE(0x1fb)]||(Object[a1iE(0x17b)]?function(i,p,B,H){const iC=a1iE;if(H===undefined)H=B;var j=Object[iC(0x1a0)](p,B);(!j||(iC(0x1d3)in j?!p[iC(0x214)]:j[iC(0x218)]||j[iC(0x1b9)]))&&(j={'enumerable':!![],'get':function(){return p[B];}}),Object[iC(0x19a)](i,H,j);}:function(i,p,B,H){if(H===undefined)H=B;i[H]=p[B];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object[a1iE(0x17b)]?function(i,p){const iv=a1iE;Object[iv(0x19a)](i,iv(0x1cf),{'enumerable':!![],'value':p});}:function(i,p){const iO=a1iE;i[iO(0x1cf)]=p;}),__importStar=this&&this[a1iE(0x248)]||function(i){const iQ=a1iE;if(i&&i[iQ(0x214)])return i;var p={};if(i!=null){for(var B in i)if(B!=='default'&&Object['prototype']['hasOwnProperty']['call'](i,B))__createBinding(p,i,B);}return __setModuleDefault(p,i),p;},__awaiter=this&&this[a1iE(0x1a3)]||function(i,p,B,H){function j(l){return l instanceof B?l:new B(function(a){a(l);});}return new(B||(B=Promise))(function(l,a){const ix=a1p;function D(E){const iU=a1p;try{L(H[iU(0x207)](E));}catch(C){a(C);}}function f(E){const ie=a1p;try{L(H[ie(0x1a8)](E));}catch(C){a(C);}}function L(E){const iG=a1p;E[iG(0x1e8)]?l(E[iG(0x17c)]):j(E[iG(0x17c)])[iG(0x20c)](D,f);}L((H=H[ix(0x21e)](i,p||[]))['next']());});},__importDefault=this&&this[a1iE(0x1d2)]||function(i){const ib=a1iE;return i&&i[ib(0x214)]?i:{'default':i};};function a1p(i,p){const B=a1i();return a1p=function(H,j){H=H-0x175;let l=B[H];return l;},a1p(i,p);}Object['defineProperty'](exports,a1iE(0x214),{'value':!![]}),exports[a1iE(0x1a4)]=void 0x0;const js_client_1=require(a1iE(0x18a)),commander_1=__importDefault(require(a1iE(0x18c))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require('ajv')),chalk_1=__importDefault(require('chalk')),_=__importStar(require('lodash')),contextCommands_1=require('./context/contextCommands'),utils_1=require(a1iE(0x17d)),defaults=__importStar(require(a1iE(0x1ea))),inquirer_helper_1=require('./inquirer-helper'),console_format_helpers_1=require(a1iE(0x19e)),command_overview_1=require('./command-overview'),port_forward_1=require(a1iE(0x230)),exec_1=require(a1iE(0x18d)),yaml=require(a1iE(0x226)),pgk=require('../package.json'),getProgram=i=>{const iw=a1iE,p=new commander_1[(iw(0x1cf))][(iw(0x1c5))]('northflank');p['description']('Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line'),p[iw(0x17f)](!![]),p[iw(0x21a)](iw(0x185)+chalk_1[iw(0x1cf)][iw(0x1a2)](pgk[iw(0x21a)]),iw(0x1c6),iw(0x19b));const B=new js_client_1[(iw(0x1d0))](i,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1['customUserAgent']}),H=new contextCommands_1[(iw(0x191))](B),j=new port_forward_1[(iw(0x178))](i),l=new exec_1[(iw(0x1f1))](i);return p['addCommand'](j[iw(0x249)]),p[iw(0x1b5)](l[iw(0x198)]),p['addCommand'](H[iw(0x224)]),p[iw(0x1b5)](H[iw(0x1cd)]),generateCommands(B,B['endpoints'],p),p['addCommand']((0x0,command_overview_1[iw(0x202)])(p)),p;};exports[a1iE(0x1a4)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const iX=a1iE;try{const i=new js_client_1[(iX(0x1ec))]();yield(0x0,utils_1[iX(0x246)])(i);const p=(0x0,exports['getProgram'])(i);yield p[iX(0x195)](process[iX(0x1f2)]);}catch(B){(0x0,utils_1['error'])(iX(0x200)+B['message']),process['argv']['find'](H=>H===iX(0x223))&&console[iX(0x18b)](B),process[iX(0x1b0)]=0x1;}}))());function isListCommand(i){const iK=a1iE,p=[[iK(0x1d3),iK(0x227),'backups'],[iK(0x1d3),iK(0x247),iK(0x1a7)]];return i[iK(0x181)](B=>B==='list')||p[iK(0x19f)](B=>_[iK(0x1fa)](i,B));}function generateCommands(i,p,B,H=defaults['defaults'],j=[]){const iN=a1iE,l=new inquirer_helper_1[(iN(0x183))](new js_client_1['ApiClient'](i[iN(0x177)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[iN(0x1ca)]}));function a(E,C){const im=iN;return E[im(0x23f)]!==![]&&C===undefined;}function D(E,C){const iJ=iN,{opt:v,name:O}=E,Q=v[iJ(0x1cf)],U=a(v,Q),e=K=>K[iJ(0x1bd)]>0x1?'--'+K:'-'+K,G=v===null||v===void 0x0?void 0x0:v['alias'],x=G?_[iJ(0x17a)](G)?'-'+(G===null||G===void 0x0?void 0x0:G[iJ(0x1d7)](K=>e(K))[iJ(0x201)](iJ(0x23c)))+',':''+e(G):'',b=U?'':iJ(0x1c0),w=typeof v[iJ(0x243)]==='boolean'?x+iJ(0x188)+O:x+iJ(0x188)+O+'\x20<'+O[iJ(0x22b)]()+'>',X=b+v[iJ(0x233)];C['option'](w,X,Q);}return Object['getOwnPropertyNames'](H)[iN(0x1de)](E=>{const iY=iN,C=p[E],v=H[E],O=j[iY(0x1be)]([E]);function Q(m,J){const ik=iY,Y=Object[ik(0x1b8)](m||{});Y['map'](k=>{return{'name':k,'opt':m[k]};})[ik(0x234)]((k,M)=>!a(k['opt'])?!a(M[ik(0x194)])?0x0:0x1:-0x1)[ik(0x1de)](k=>{D(k,J);});}function U(m,J){const iM=iY,Y=[['project',iM(0x228),iM(0x1ee)],['service',iM(0x235),'svc'],['credentials',iM(0x244),'cred'],['addon',iM(0x1da),iM(0x1c9)],[iM(0x247),iM(0x1eb)],[iM(0x22e),'plans',iM(0x1e2)],[iM(0x1b7),iM(0x22f),iM(0x1e6)],[iM(0x1e0),iM(0x1d5),'dmn'],[iM(0x1dc),iM(0x1a1),iM(0x197)],[iM(0x1aa),iM(0x1b3),'vol'],[iM(0x175),'branch','brn'],['invoice',iM(0x221),iM(0x1fc)],[iM(0x21c),iM(0x1ed),iM(0x1c8),iM(0x1a6)]],k=Y[iM(0x181)](M=>M[iM(0x245)](J));if(k!==undefined)m['aliases'](k[iM(0x237)](M=>M!==J));}function e(m){var J,Y;return __awaiter(this,void 0x0,void 0x0,function*(){const iF=a1p,k={},{contextProvider:M}=i,F=O[iF(0x245)](iF(0x182)),q=m[iF(0x1ce)]===!![];function g(r,W,R){var n,s;return __awaiter(this,void 0x0,void 0x0,function*(){const iq=a1p;if(_[iq(0x239)]((s=(n=v[iq(0x194)])===null||n===void 0x0?void 0x0:n[iq(0x23b)])!==null&&s!==void 0x0?s:{},r)){const S=!q&&!F&&R?R():undefined,T=m[r]||S||(yield W());_[iq(0x1ae)](k,r,T);}});}return yield(0x0,utils_1[iF(0x20d)])(Object[iF(0x189)]((Y=(J=v[iF(0x194)])===null||J===void 0x0?void 0x0:J['path'])!==null&&Y!==void 0x0?Y:{}),([r,W])=>__awaiter(this,void 0x0,void 0x0,function*(){const ig=iF,R=k===null||k===void 0x0?void 0x0:k['projectId'];switch(r){case'projectId':return yield g(ig(0x23d),l[ig(0x1f5)][ig(0x187)](l),M['getCurrentProjectName']['bind'](M));case ig(0x1f7):return yield g(ig(0x1f7),l[ig(0x1e3)](R)[ig(0x187)](l),M['getCurrentServiceName'][ig(0x187)](M));case ig(0x1cb):return yield g(ig(0x1cb),l[ig(0x216)](R)[ig(0x187)](l));case ig(0x1a9):return yield g(ig(0x1a9),l['askForJob'](R)[ig(0x187)](l),M[ig(0x20a)][ig(0x187)](M));case ig(0x1fd):return yield g(ig(0x1fd),l[ig(0x1b6)](k[ig(0x1a9)],R)[ig(0x187)](l));case ig(0x1df):return yield g(ig(0x1df),l['askForSecret'](R)['bind'](l));case ig(0x1e0):case ig(0x1ad):return yield g(ig(0x1e0),l['askForDomain'][ig(0x187)](l));case ig(0x20e):return yield g(ig(0x20e),l['askForCredentials'][ig(0x187)](l));case ig(0x22c):return yield g(ig(0x22c),l[ig(0x1e5)](R)[ig(0x187)](l));case ig(0x212):return yield g(ig(0x212),l[ig(0x217)](k[ig(0x1e0)])[ig(0x187)](l));case'subdomainId':return yield g(ig(0x196),l[ig(0x217)](k['domainId'])[ig(0x187)](l));case ig(0x1e4):return yield g(ig(0x1e4),l[ig(0x222)](R,k[ig(0x1cb)])[ig(0x187)](l));case ig(0x1d9):return yield g(ig(0x1d9),l[ig(0x18f)](R,k[ig(0x1f7)],k[ig(0x1a9)])[ig(0x187)](l));default:return yield g(r,l[ig(0x215)](r,W===null||W===void 0x0?void 0x0:W['description'])[ig(0x187)](l));}})),k;});}function G(m){var J,Y;return __awaiter(this,void 0x0,void 0x0,function*(){const ir=a1p,k={},M=Object[ir(0x1fe)]((Y=(J=v[ir(0x194)])===null||J===void 0x0?void 0x0:J[ir(0x1f8)])!==null&&Y!==void 0x0?Y:{});return yield(0x0,utils_1['asyncSequential'])(M,F=>__awaiter(this,void 0x0,void 0x0,function*(){const iW=ir,q={},{required:g,schema:r}=v[iW(0x194)][iW(0x1f8)][F];return yield l['propToType']([''+F],r,q,g),q[F]!==undefined&&_[iW(0x1ae)](k,F,q[F]),q;})),k;});}function x(){const iR=iY;switch(O[0x0]){case'get':return iR(0x1d6)+(O[0x1]||iR(0x1cc))+'s';case iR(0x236):return iR(0x1bf)+(O[0x1]||iR(0x1cc))+iR(0x176);default:return _['upperFirst'](E)+'\x20Northflank\x20resources';}}function b(m,J){const is=iY;var Y,k,M,F,q,g;if(!J){const V=(0x0,utils_1[is(0x209)])()[is(0x184)](_[is(0x1e9)](E))[is(0x233)](x());return U(V,E),V;}const r=(m===null||m===void 0x0?void 0x0:m[is(0x208)])?chalk_1[is(0x1cf)][is(0x1ef)](is(0x1bc)+m[is(0x208)]):'',W=i[is(0x177)][is(0x199)](),R=W!==undefined&&((Y=v===null||v===void 0x0?void 0x0:v['opt'])===null||Y===void 0x0?void 0x0:Y[is(0x24d)])!==undefined,n=W===null||W===void 0x0?void 0x0:W['host']['replace'](is(0x1ba),''),s=R?is(0x1f4)+n+is(0x206)+((k=v===null||v===void 0x0?void 0x0:v[is(0x194)])===null||k===void 0x0?void 0x0:k[is(0x24d)]):'',S=(m===null||m===void 0x0?void 0x0:m[is(0x233)])||'',T=(0x0,utils_1['getCommand'])(!![])[is(0x184)](_[is(0x1e9)](E))['description'](S)[is(0x1c1)](is(0x205),[r,s][is(0x201)]('\x0a'));return U(T,E),((M=v[is(0x194)])===null||M===void 0x0?void 0x0:M[is(0x210)])&&(T['option'](is(0x1dd),is(0x1af)),T[is(0x1f3)](is(0x1ab),is(0x1f9))),Q((F=v[is(0x194)])===null||F===void 0x0?void 0x0:F['path'],T),Q((q=v['opt'])===null||q===void 0x0?void 0x0:q[is(0x1f8)],T),Q((g=v[is(0x194)])===null||g===void 0x0?void 0x0:g[is(0x23e)],T),T['action'](()=>__awaiter(this,void 0x0,void 0x0,function*(){const iS=is;var I,o,y,u;(0x0,utils_1['assertContextExisting'])(i);const A=T[iS(0x22a)](),Z=yield e(A);l[iS(0x21b)](Z);const h=yield G(A),P=Object['keys']((o=(I=v['opt'])===null||I===void 0x0?void 0x0:I[iS(0x23b)])!==null&&o!==void 0x0?o:{})['map'](i0=>i0+'='+chalk_1[iS(0x1cf)][iS(0x231)](Z[i0]))[iS(0x201)](',\x20');if(P['length']>0x0){const i0=iS(0x1b4)+P;console[iS(0x18b)](i0);}const d=((y=v[iS(0x194)])===null||y===void 0x0?void 0x0:y[iS(0x210)])?yield L(A,v,O):undefined;if(!A[iS(0x21f)]&&O[iS(0x245)](iS(0x182))&&!(yield l[iS(0x1b2)]())){(0x0,utils_1['warning'])(iS(0x1c7));return;}function z(i1,i2=![],i3=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const iT=a1p,{data:i4,request:i5,error:i6,pagination:i7}=yield C[iT(0x232)]({'parameters':Z,'options':Object['assign'](Object['assign']({},h),{'cursor':i1}),'data':d});(A===null||A===void 0x0?void 0x0:A['verbose'])&&(console[iT(0x18b)](iT(0x179)+i5[iT(0x1d4)]+':'+i5[iT(0x17e)]),console[iT(0x18b)](iT(0x192)+i5['body']));if(i6){const i8=i6[iT(0x19d)]?'\x0a\x09details\x20:'+JSON[iT(0x213)](i6['details']):'',i9=(i6===null||i6===void 0x0?void 0x0:i6['id'])?',\x20NF\x20error\x20id:\x20'+i6['id']:'',ii=iT(0x24a)+i6[iT(0x1bb)]+i9+')';throw new Error(iT(0x180)+i6[iT(0x20b)]+'\x20'+ii+i8);}if(!(A===null||A===void 0x0?void 0x0:A['quiet'])){const ip=A===null||A===void 0x0?void 0x0:A[iT(0x1b1)];if(ip===iT(0x219))console['log']((0x0,console_format_helpers_1[iT(0x24b)])(i4));else{if(ip===iT(0x1f0)||ip===iT(0x211))console[iT(0x18b)](yaml[iT(0x242)](i4));else{if(isListCommand(O)){const iB=(ip===null||ip===void 0x0?void 0x0:ip['startsWith'](iT(0x23a)))?ip[iT(0x225)](iT(0x23a),'')['split'](',')[iT(0x1d7)](iD=>iD[iT(0x240)]()):undefined,iH=O[O[iT(0x1bd)]-0x1],ij=''+iH+(iH[iT(0x1e1)]('s')?'':'s'),il=_[iT(0x203)](ij),ia=_[iT(0x239)](i4,ij)?i4[ij]:i4;(0x0,console_format_helpers_1['printAsTable'])(ia,il,iB,i2,i3);}else console[iT(0x18b)]((0x0,console_format_helpers_1[iT(0x24b)])(i4));}}}return i7;});}let t=yield z(),c=0x0;if(!A['quiet']&&(t===null||t===void 0x0?void 0x0:t[iS(0x1c4)]))while(t[iS(0x1c4)]){const i1=yield l[iS(0x190)]('there\x20are\x20more\x20rows,\x20load?');i1&&(process[iS(0x1e7)][iS(0x1db)](0x0,-0x1),process[iS(0x1e7)]['clearLine'](0x1),c+=(u=t[iS(0x19c)])!==null&&u!==void 0x0?u:0x0,t=yield z(t[iS(0x1c4)],!![],c));}})),T;}const w=_[iY(0x239)](v,iY(0x194)),X=C,K=b(X,w);B[iY(0x1b5)](K);const N=_['omit'](v,iY(0x194));Object[iY(0x1fe)](N)[iY(0x1bd)]>0x0&&generateCommands(i,C,K,N,O);});function f(E,C,v){return __awaiter(this,void 0x0,void 0x0,function*(){const iV=a1p,{input:O,file:Q}=E;if(O!==undefined)try{return JSON[iV(0x24e)](O);}catch(U){try{return yaml['safeLoad'](O);}catch(G){throw new Error('Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.');}}if(Q!==undefined){if(!fs_1[iV(0x1cf)][iV(0x186)](Q))throw new Error(iV(0x1d1)+Q);const x=fs_1['default'][iV(0x1a5)](Q)[iV(0x1ac)]();let b;try{if(_['isString'](x)){if(E[iV(0x229)][iV(0x1e1)]('.json'))b=JSON[iV(0x24e)](x);else{if(E[iV(0x229)][iV(0x1e1)](iV(0x1f6))||E[iV(0x229)][iV(0x1e1)](iV(0x211)))b=yaml['safeLoad'](x);else throw new Error('Unknown\x20input\x20file\x20type:\x20'+E[iV(0x229)][iV(0x24c)]('.')[iV(0x20f)]());}}else b=x;return b;}catch(w){throw new Error('Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20'+w[iV(0x20b)]);}}return yield l['retrievePayloadViaInteractiveCli'](C,{'cmdPath':v});});}function L(E,C,v){var O;return __awaiter(this,void 0x0,void 0x0,function*(){const iI=a1p,Q=yield f(E,C,v),U=new ajv_1[(iI(0x1cf))]({'allErrors':!![],'keywords':[iI(0x193)],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let G=![];try{G=U['validate'](C[iI(0x194)][iI(0x210)],Q);}catch(b){if(b[iI(0x20b)]['includes'](iI(0x1c3)))G=!![];else throw b;}const x=(O=U===null||U===void 0x0?void 0x0:U[iI(0x204)])===null||O===void 0x0?void 0x0:O[iI(0x237)](w=>{const io=iI;var X;return!((X=w===null||w===void 0x0?void 0x0:w['message'])===null||X===void 0x0?void 0x0:X[io(0x245)]('match\x20exactly\x20one\x20schema\x20in\x20oneOf'));});if(!G&&x!==undefined&&(x===null||x===void 0x0?void 0x0:x[iI(0x1bd)])>0x0)throw new Error(iI(0x238)+JSON['stringify'](U[iI(0x204)],null,'\x20'));return Q;});}}
|
|
2
|
+
'use strict';const a1nM=a1C;function a1n(){const nx=['boolean','required','Documentation:\x20','configurable','askForLogSink','./defaults','Get\x20information\x20about\x20Northflank\x20','serviceId','./console-format-helpers','__importDefault','template','secret','getCurrentJobName','getCurrentServiceName','domain','Command','isEqual','customUserAgent','getProgram','addCommand','credentialId','askForVolume','askForJob','CliContext','call','templates','CliExec','value','rgn','addonId','scrt','apply','isArray','errors','create','argv','subdomainId','output','Unknown\x20input\x20file\x20type:\x20','80cZwUFx','startsWith','jobId','plan','./exec','replace','getCurrentContext','validate','askForJobRun','runId','svc','301086roqVLs','\x20Northflank\x20resources','forEach','__esModule','volumeId','/docs/v1/api/','dmn','api.','logSinkId','opts','log','checkUpdate','safeDump','File\x20to\x20load\x20resource\x20json\x20from','askForTemplateRun','quiet','runs','exitCode','yaml','VERBOSE:\x20Using\x20endpoint\x20->\x20','count',',\x20-','endsWith','requiredPermissions','stdout','Failed\x20to\x20validate\x20input\x20(schema\x20mismatch):\x0a','askForDomain','Error\x20occured\x20while\x20trying\x20to\x20run\x20command,\x20error:\x20','invoices','default','\x0a>\x20Token\x20permissions\x20required:\x20','there\x20are\x20more\x20rows,\x20load?','docsTagsPath','after','login','askForTemplate','30672950VDyaBt','throw','@northflank/js-client','details','writable','Unknown\x20input\x20format.\x20Not\x20valid\x20json\x20and\x20not\x20valid\x20yaml.','volume','endpoints','query','getOwnPropertyNames','templateRunId','url','askForSubdomain','adn','parseAsync','__awaiter','Update\x20Northflank\x20','cred','consoleFormat','cursor','project','-v,\x20--version','pln','API\x20request\x20failed\x0a\x09Message:\x20','prj','runtimeFiles/additionalProperties','2984492cXDNKb','CliPortForward','repositories','3KWkNYX','Failed\x20to\x20validate\x20input\x20(incorrect\x20format):\x20','resource','length','-f,\x20--file\x20<file-path>','includes','printAsTable','file','delete','projectId','hasOwnProperty','match\x20exactly\x20one\x20schema\x20in\x20oneOf','../package.json','asyncSequential','948535pXRJmk','prototype','get','credential','brn','repo','projects','__setModuleDefault','chalk','services','message','set','example','commander','some','askForProject','__importStar','assign','entries','--verbose','type','askConfirm','buildId','./port-forward','existsSync','retrievePayloadViaInteractiveCli','templateId','force','upperFirst','secretId','vol','option','askGeneric','askForAddonBackup','OPTIONAL:\x20','branch','body','northflank','toLowerCase','invoice','readFileSync','File\x20does\x20not\x20exist:\x20','9410748keFopA','lodash','Manage\x20your\x20Northflank\x20resources\x20from\x20the\x20command\x20line','setPathVars','region','error','askForAddon','askForCredentials','inv','volumes','has','clearLine','concat','\x20properties','filter','find','kebabCase','1076510KsNFqd','job','description','join','custom-columns=','Resource\x20was\x20not\x20deleted.',',\x20NF\x20error\x20id:\x20','.yaml','=>\x20running\x20command\x20with:\x20','version','portFwdCmd','keys','split','subdomain','-i,\x20--input\x20<resource-def>','contextProvider','path','defineProperty','getCommandOverview','safeLoad','ajv','1896546BODNOh','getCommand','addon','./utils','backupId','\x20--','assertContextExisting','pop','execCmd','7SsCWeD','plans','ApiClient','name','sort','domains','grey','underline','method','.json','map','Print\x20the\x20current\x20version\x20of\x20the\x20Northflank\x20cli','noDefaults','stringify','next','bind','./command-overview','domainId','action','base','warning','askForBuild','opt','list','parse','addHelpText','credentials'];a1n=function(){return nx;};return a1n();}(function(n,C){const nr=a1C,k=n();while(!![]){try{const H=-parseInt(nr(0x191))/0x1+-parseInt(nr(0x1e1))/0x2+parseInt(nr(0x183))/0x3*(parseInt(nr(0x180))/0x4)+parseInt(nr(0x1cc))/0x5+-parseInt(nr(0x1bb))/0x6*(parseInt(nr(0x1ea))/0x7)+-parseInt(nr(0x137))/0x8*(-parseInt(nr(0x142))/0x9)+parseInt(nr(0x166))/0xa;if(H===C)break;else k['push'](k['shift']());}catch(R){k['push'](k['shift']());}}}(a1n,0xdb3ca));var __createBinding=this&&this['__createBinding']||(Object[a1nM(0x132)]?function(n,C,H,R){const ny=a1nM;if(R===undefined)R=H;var W=Object['getOwnPropertyDescriptor'](C,H);(!W||(ny(0x193)in W?!C[ny(0x145)]:W[ny(0x16a)]||W[ny(0x113)]))&&(W={'enumerable':!![],'get':function(){return C[H];}}),Object['defineProperty'](n,R,W);}:function(n,C,H,R){if(R===undefined)R=H;n[R]=C[H];}),__setModuleDefault=this&&this[a1nM(0x198)]||(Object['create']?function(n,C){const nT=a1nM;Object['defineProperty'](n,nT(0x15f),{'enumerable':!![],'value':C});}:function(n,C){const nV=a1nM;n[nV(0x15f)]=C;}),__importStar=this&&this[a1nM(0x1a1)]||function(n){const nj=a1nM;if(n&&n[nj(0x145)])return n;var C={};if(n!=null){for(var H in n)if(H!==nj(0x15f)&&Object[nj(0x192)][nj(0x18d)][nj(0x128)](n,H))__createBinding(C,n,H);}return __setModuleDefault(C,n),C;},__awaiter=this&&this[a1nM(0x175)]||function(n,C,k,H){function R(W){return W instanceof k?W:new k(function(i){i(W);});}return new(k||(k=Promise))(function(W,i){const nA=a1C;function t(y){const nU=a1C;try{M(H[nU(0x1f8)](y));}catch(T){i(T);}}function r(y){const nh=a1C;try{M(H[nh(0x167)](y));}catch(T){i(T);}}function M(y){const no=a1C;y['done']?W(y[no(0x12b)]):R(y['value'])['then'](t,r);}M((H=H[nA(0x12f)](n,C||[]))[nA(0x1f8)]());});},__importDefault=this&&this[a1nM(0x119)]||function(n){const nd=a1nM;return n&&n[nd(0x145)]?n:{'default':n};};Object[a1nM(0x1dd)](exports,a1nM(0x145),{'value':!![]}),exports[a1nM(0x122)]=void 0x0;const js_client_1=require(a1nM(0x168)),commander_1=__importDefault(require(a1nM(0x19e))),fs_1=__importDefault(require('fs')),ajv_1=__importDefault(require(a1nM(0x1e0))),chalk_1=__importDefault(require(a1nM(0x199))),_=__importStar(require(a1nM(0x1bc))),contextCommands_1=require('./context/contextCommands'),utils_1=require(a1nM(0x1e4)),defaults=__importStar(require(a1nM(0x115))),inquirer_helper_1=require('./inquirer-helper'),console_format_helpers_1=require(a1nM(0x118)),command_overview_1=require(a1nM(0x1fa)),port_forward_1=require(a1nM(0x1a8)),exec_1=require(a1nM(0x13b)),yaml=require('js-yaml'),pgk=require(a1nM(0x18f)),getProgram=n=>{const nQ=a1nM,C=new commander_1[(nQ(0x15f))][(nQ(0x11f))](nQ(0x1b6));C['description'](nQ(0x1bd)),C['enablePositionalOptions'](!![]),C['version']('Northflank\x20cli\x20version:\x20'+chalk_1[nQ(0x15f)][nQ(0x1f1)](pgk[nQ(0x1d5)]),nQ(0x17b),nQ(0x1f5));const k=new js_client_1[(nQ(0x1ec))](n,{'throwErrorOnHttpErrorCode':![],'customUserAgent':utils_1[nQ(0x121)]}),H=new contextCommands_1[(nQ(0x127))](k),R=new port_forward_1[(nQ(0x181))](n),W=new exec_1[(nQ(0x12a))](n);return C[nQ(0x123)](R[nQ(0x1d6)]),C[nQ(0x123)](W[nQ(0x1e9)]),C[nQ(0x123)](H[nQ(0x164)]),C[nQ(0x123)](H['contexts']),generateCommands(k,k[nQ(0x16d)],C),C[nQ(0x123)]((0x0,command_overview_1[nQ(0x1de)])(C)),C;};exports[a1nM(0x122)]=getProgram,((()=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const nl=a1nM;try{const n=new js_client_1['ApiClientFileContextProvider']();yield(0x0,utils_1[nl(0x14d)])(n);const C=(0x0,exports[nl(0x122)])(n);yield C[nl(0x174)](process[nl(0x133)]);}catch(k){(0x0,utils_1[nl(0x1c0)])(nl(0x15d)+k['message']),process['argv'][nl(0x1ca)](H=>H===nl(0x1a4))&&console['log'](k),process[nl(0x153)]=0x1;}}))());function isListCommand(n){const nK=a1nM,C=[[nK(0x193),'addon','backups'],[nK(0x193),nK(0x1cd),nK(0x152)]];return n[nK(0x1ca)](k=>k===nK(0x201))||C[nK(0x19f)](k=>_[nK(0x120)](n,k));}function a1C(n,C){const k=a1n();return a1C=function(H,R){H=H-0x112;let W=k[H];return W;},a1C(n,C);}function generateCommands(n,C,k,H=defaults['defaults'],R=[]){const nm=a1nM,W=new inquirer_helper_1['InquirerHelper'](new js_client_1[(nm(0x1ec))](n[nm(0x1db)],{'throwErrorOnHttpErrorCode':!![],'customUserAgent':utils_1[nm(0x121)]}));function i(y,T){const na=nm;return y[na(0x206)]!==![]&&T===undefined;}function t(y,T){const nN=nm,{opt:V,name:j}=y,U=V[nN(0x15f)],h=i(V,U),o=m=>m[nN(0x186)]>0x1?'--'+m:'-'+m,A=V===null||V===void 0x0?void 0x0:V['alias'],d=A?_[nN(0x130)](A)?'-'+(A===null||A===void 0x0?void 0x0:A[nN(0x1f4)](m=>o(m))[nN(0x1cf)](nN(0x157)))+',':''+o(A):'',Q=h?'':nN(0x1b3),l=typeof V[nN(0x1a5)]===nN(0x205)?d+nN(0x1e6)+j:d+nN(0x1e6)+j+'\x20<'+j['toUpperCase']()+'>',K=Q+V['description'];T[nN(0x1b0)](l,K,U);}return Object['getOwnPropertyNames'](H)[nm(0x144)](y=>{const nX=nm,T=C[y],V=H[y],j=R[nX(0x1c7)]([y]);function U(N,X){const nE=nX,E=Object[nE(0x16f)](N||{});E[nE(0x1f4)](g=>{return{'name':g,'opt':N[g]};})[nE(0x1ee)]((g,c)=>!i(g[nE(0x200)])?!i(c[nE(0x200)])?0x0:0x1:-0x1)[nE(0x144)](g=>{t(g,X);});}function h(N,X){const ng=nX,E=[[ng(0x17a),ng(0x197),ng(0x17e)],['service',ng(0x19a),ng(0x141)],[ng(0x204),ng(0x194),ng(0x177)],[ng(0x1e3),'addons',ng(0x173)],[ng(0x1cd),'jobs'],[ng(0x13a),ng(0x1eb),ng(0x17c)],[ng(0x1bf),'regions',ng(0x12c)],[ng(0x11e),ng(0x1ef),ng(0x148)],[ng(0x11b),'secrets',ng(0x12e)],[ng(0x1c4),ng(0x16c),ng(0x1af)],['branches',ng(0x1b4),ng(0x195)],[ng(0x1b8),ng(0x15e),ng(0x1c3)],[ng(0x11a),ng(0x129),'tpl'],['repos','repository',ng(0x182),ng(0x196)]],g=E[ng(0x1ca)](c=>c['includes'](X));if(g!==undefined)N['aliases'](g[ng(0x1c9)](c=>c!==X));}function o(N){var X,E;return __awaiter(this,void 0x0,void 0x0,function*(){const nc=a1C,g={},{contextProvider:c}=n,b=j[nc(0x188)](nc(0x18b)),L=N[nc(0x1f6)]===!![];function G(Z,q,w){var O,F;return __awaiter(this,void 0x0,void 0x0,function*(){const nb=a1C;if(_[nb(0x1c5)]((F=(O=V[nb(0x200)])===null||O===void 0x0?void 0x0:O['path'])!==null&&F!==void 0x0?F:{},Z)){const D=!L&&!b&&w?w():undefined,Y=N[Z]||D||(yield q());_[nb(0x19c)](g,Z,Y);}});}return yield(0x0,utils_1[nc(0x190)])(Object[nc(0x1a3)]((E=(X=V[nc(0x200)])===null||X===void 0x0?void 0x0:X['path'])!==null&&E!==void 0x0?E:{}),([Z,q])=>__awaiter(this,void 0x0,void 0x0,function*(){const nL=nc,w=g===null||g===void 0x0?void 0x0:g[nL(0x18c)],O=g===null||g===void 0x0?void 0x0:g['templateId'];switch(Z){case nL(0x18c):return yield G(nL(0x18c),W[nL(0x1a0)][nL(0x1f9)](W),c['getCurrentProjectName'][nL(0x1f9)](c));case'serviceId':return yield G(nL(0x117),W['askForService'](w)[nL(0x1f9)](W),c[nL(0x11d)][nL(0x1f9)](c));case nL(0x12d):return yield G('addonId',W[nL(0x1c1)](w)[nL(0x1f9)](W));case nL(0x139):return yield G(nL(0x139),W[nL(0x126)](w)[nL(0x1f9)](W),c[nL(0x11c)]['bind'](c));case nL(0x140):return yield G(nL(0x140),W[nL(0x13f)](g['jobId'],w)[nL(0x1f9)](W));case nL(0x1ae):return yield G(nL(0x1ae),W['askForSecret'](w)['bind'](W));case nL(0x11e):case nL(0x1fb):return yield G(nL(0x11e),W[nL(0x15c)][nL(0x1f9)](W));case nL(0x124):return yield G('credentialId',W[nL(0x1c2)]['bind'](W));case nL(0x146):return yield G(nL(0x146),W[nL(0x125)](w)[nL(0x1f9)](W));case nL(0x1d9):return yield G(nL(0x1d9),W[nL(0x172)](g[nL(0x11e)])[nL(0x1f9)](W));case nL(0x134):return yield G(nL(0x134),W['askForSubdomain'](g[nL(0x1fb)])[nL(0x1f9)](W));case nL(0x1e5):return yield G(nL(0x1e5),W[nL(0x1b2)](w,g[nL(0x12d)])[nL(0x1f9)](W));case'buildId':return yield G(nL(0x1a7),W[nL(0x1ff)](w,g[nL(0x117)],g[nL(0x139)])[nL(0x1f9)](W));case nL(0x1ab):return yield G(nL(0x1ab),W[nL(0x165)]()[nL(0x1f9)](W));case nL(0x170):return yield G('templateRunId',W[nL(0x150)](O)['bind'](W));case nL(0x14a):return yield G(nL(0x14a),W[nL(0x114)]()[nL(0x1f9)](W));default:return yield G(Z,W[nL(0x1b1)](Z,q===null||q===void 0x0?void 0x0:q[nL(0x1ce)])[nL(0x1f9)](W));}})),g;});}function A(N){var X,E;return __awaiter(this,void 0x0,void 0x0,function*(){const nG=a1C,g={},c=Object[nG(0x1d7)]((E=(X=V['opt'])===null||X===void 0x0?void 0x0:X['query'])!==null&&E!==void 0x0?E:{});return yield(0x0,utils_1[nG(0x190)])(c,b=>__awaiter(this,void 0x0,void 0x0,function*(){const nZ=nG,L={},{required:G,schema:Z}=V[nZ(0x200)][nZ(0x16e)][b];return yield W['propToType']([''+b],Z,L,G),L[b]!==undefined&&_[nZ(0x19c)](g,b,L[b]),L;})),g;});}function d(){const nq=nX;switch(j[0x0]){case nq(0x193):return nq(0x116)+(j[0x1]||'resource')+'s';case'update':return nq(0x176)+(j[0x1]||nq(0x185))+nq(0x1c8);default:return _['upperFirst'](y)+nq(0x143);}}function Q(N,X){const nw=nX;var E,g,c,b,L,G;if(!X){const S=(0x0,utils_1[nw(0x1e2)])()[nw(0x1ed)](_['kebabCase'](y))[nw(0x1ce)](d());return h(S,y),S;}const Z=(N===null||N===void 0x0?void 0x0:N['requiredPermissions'])?chalk_1['default'][nw(0x1f0)](nw(0x160)+N[nw(0x159)]):'',q=n[nw(0x1db)][nw(0x13d)](),w=q!==undefined&&((E=V===null||V===void 0x0?void 0x0:V[nw(0x200)])===null||E===void 0x0?void 0x0:E[nw(0x162)])!==undefined,O=q===null||q===void 0x0?void 0x0:q['host'][nw(0x13c)](nw(0x149),''),F=w?nw(0x112)+O+nw(0x147)+((g=V===null||V===void 0x0?void 0x0:V[nw(0x200)])===null||g===void 0x0?void 0x0:g[nw(0x162)]):'',D=(N===null||N===void 0x0?void 0x0:N[nw(0x1ce)])||'',Y=(0x0,utils_1[nw(0x1e2)])(!![])[nw(0x1ed)](_[nw(0x1cb)](y))[nw(0x1ce)](D)[nw(0x203)](nw(0x163),[Z,F][nw(0x1cf)]('\x0a'));return h(Y,y),((c=V[nw(0x200)])===null||c===void 0x0?void 0x0:c[nw(0x1b5)])&&(Y[nw(0x1b0)](nw(0x187),nw(0x14f)),Y[nw(0x1b0)](nw(0x1da),'JSON-formatted\x20resource\x20definition,\x20takes\x20precedence\x20over\x20\x22--file\x22')),U((b=V[nw(0x200)])===null||b===void 0x0?void 0x0:b[nw(0x1dc)],Y),U((L=V['opt'])===null||L===void 0x0?void 0x0:L[nw(0x16e)],Y),U((G=V[nw(0x200)])===null||G===void 0x0?void 0x0:G[nw(0x1fd)],Y),Y[nw(0x1fc)](()=>__awaiter(this,void 0x0,void 0x0,function*(){const nO=nw;var x,J,z,u;(0x0,utils_1[nO(0x1e7)])(n);const f=Y[nO(0x14b)](),B=yield o(f);W[nO(0x1be)](B);const e=yield A(f),v=Object[nO(0x1d7)]((J=(x=V[nO(0x200)])===null||x===void 0x0?void 0x0:x['path'])!==null&&J!==void 0x0?J:{})[nO(0x1f4)](n0=>n0+'='+chalk_1['default']['green'](B[n0]))[nO(0x1cf)](',\x20');if(v[nO(0x186)]>0x0){const n0=nO(0x1d4)+v;console[nO(0x14c)](n0);}const P=((z=V[nO(0x200)])===null||z===void 0x0?void 0x0:z[nO(0x1b5)])?yield M(f,V,j):undefined;if(!f[nO(0x1ac)]&&j['includes'](nO(0x18b))&&!(yield W['deleteWarningPrompt']())){(0x0,utils_1[nO(0x1fe)])(nO(0x1d1));return;}function I(n1,n2=![],n3=0x0){return __awaiter(this,void 0x0,void 0x0,function*(){const nF=a1C,{data:n4,request:n5,error:n6,pagination:n7}=yield T[nF(0x128)]({'parameters':B,'options':Object[nF(0x1a2)](Object[nF(0x1a2)]({},e),{'cursor':n1}),'data':P});(f===null||f===void 0x0?void 0x0:f['verbose'])&&(console[nF(0x14c)](nF(0x155)+n5[nF(0x1f2)]+':'+n5[nF(0x171)]),console['log']('VERBOSE:\x20Request\x20body\x20->\x20'+n5[nF(0x1b5)]));if(n6){const n8=n6[nF(0x169)]?'\x0a\x09details\x20:'+JSON[nF(0x1f7)](n6['details']):'',n9=(n6===null||n6===void 0x0?void 0x0:n6['id'])?nF(0x1d2)+n6['id']:'',nn='(HTTP\x20status\x20code:\x20'+n6['status']+n9+')';throw new Error(nF(0x17d)+n6[nF(0x19b)]+'\x20'+nn+n8);}if(!(f===null||f===void 0x0?void 0x0:f['quiet'])){const nC=f===null||f===void 0x0?void 0x0:f[nF(0x135)];if(nC==='json')console[nF(0x14c)]((0x0,console_format_helpers_1[nF(0x178)])(n4));else{if(nC===nF(0x154)||nC==='yml')console[nF(0x14c)](yaml[nF(0x14e)](n4));else{if(isListCommand(j)){const nk=(nC===null||nC===void 0x0?void 0x0:nC[nF(0x138)](nF(0x1d0)))?nC['replace'](nF(0x1d0),'')['split'](',')['map'](nt=>nt[nF(0x1b7)]()):undefined,nH=j[j[nF(0x186)]-0x1],nR=''+nH+(nH['endsWith']('s')?'':'s'),nW=_[nF(0x1ad)](nR),ni=_[nF(0x1c5)](n4,nR)?n4[nR]:n4;(0x0,console_format_helpers_1[nF(0x189)])(ni,nW,nk,n2,n3);}else console['log']((0x0,console_format_helpers_1[nF(0x178)])(n4));}}}return n7;});}let s=yield I(),p=0x0;if(!f[nO(0x151)]&&(s===null||s===void 0x0?void 0x0:s[nO(0x179)]))while(s['cursor']){const n1=yield W[nO(0x1a6)](nO(0x161));n1&&(process[nO(0x15a)]['moveCursor'](0x0,-0x1),process['stdout'][nO(0x1c6)](0x1),p+=(u=s[nO(0x156)])!==null&&u!==void 0x0?u:0x0,s=yield I(s[nO(0x179)],!![],p));}})),Y;}const l=_[nX(0x1c5)](V,nX(0x200)),K=T,m=Q(K,l);k[nX(0x123)](m);const a=_['omit'](V,nX(0x200));Object[nX(0x1d7)](a)['length']>0x0&&generateCommands(n,T,m,a,j);});function r(y,T,V){return __awaiter(this,void 0x0,void 0x0,function*(){const nD=a1C,{input:j,file:U}=y;if(j!==undefined)try{return JSON['parse'](j);}catch(h){try{return yaml[nD(0x1df)](j);}catch(o){throw new Error(nD(0x16b));}}if(U!==undefined){if(!fs_1[nD(0x15f)][nD(0x1a9)](U))throw new Error(nD(0x1ba)+U);const A=fs_1['default'][nD(0x1b9)](U)['toString']();let Q;try{if(_['isString'](A)){if(y[nD(0x18a)][nD(0x158)](nD(0x1f3)))Q=JSON[nD(0x202)](A);else{if(y[nD(0x18a)][nD(0x158)](nD(0x1d3))||y[nD(0x18a)][nD(0x158)]('yml'))Q=yaml[nD(0x1df)](A);else throw new Error(nD(0x136)+y['file'][nD(0x1d8)]('.')[nD(0x1e8)]());}}else Q=A;return Q;}catch(l){throw new Error(nD(0x184)+l[nD(0x19b)]);}}return yield W[nD(0x1aa)](T,{'cmdPath':V});});}function M(y,T,V){var j;return __awaiter(this,void 0x0,void 0x0,function*(){const nY=a1C,U=yield r(y,T,V),h=new ajv_1['default']({'allErrors':!![],'keywords':[nY(0x19d)],'validateFormats':![],'strict':![],'unicodeRegExp':![]});let o=![];try{o=h[nY(0x13e)](T['opt']['body'],U);}catch(d){if(d[nY(0x19b)][nY(0x188)](nY(0x17f)))o=!![];else throw d;}const A=(j=h===null||h===void 0x0?void 0x0:h[nY(0x131)])===null||j===void 0x0?void 0x0:j['filter'](Q=>{const nS=nY;var l;return!((l=Q===null||Q===void 0x0?void 0x0:Q[nS(0x19b)])===null||l===void 0x0?void 0x0:l[nS(0x188)](nS(0x18e)));});if(!o&&A!==undefined&&(A===null||A===void 0x0?void 0x0:A[nY(0x186)])>0x0)throw new Error(nY(0x15b)+JSON[nY(0x1f7)](h[nY(0x131)],null,'\x20'));return U;});}}
|
package/dist/command-overview.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a2m=a2C;(function(n,C){const K=a2C,k=n();while(!![]){try{const H=-parseInt(K(0x1ea))/0x1+-parseInt(K(0x1f0))/0x2+-parseInt(K(0x1dc))/0x3+parseInt(K(0x1e4))/0x4+parseInt(K(0x1de))/0x5*(-parseInt(K(0x1fb))/0x6)+-parseInt(K(0x1db))/0x7*(-parseInt(K(0x1e3))/0x8)+parseInt(K(0x1f3))/0x9*(parseInt(K(0x1fa))/0xa);if(H===C)break;else k['push'](k['shift']());}catch(R){k['push'](k['shift']());}}}(a2n,0x7c9f5));function a2C(n,C){const k=a2n();return a2C=function(H,R){H=H-0x1d9;let W=k[H];return W;},a2C(n,C);}function a2n(){const b=['1560996zsfvdB','keys','default','918cipEJS','name','description','next','option','Prints\x20a\x20tree\x20view\x20of\x20all\x20available\x20commands','--verbose','199720SDOIBv','61638wTLkDO','bold','defineProperty','651YnwXnJ','187104SvtLhc','action','20gpOZmA','value','green','__esModule','opts','2008xCjKfm','653328Bajhej','getCommandOverview','__awaiter','slice','log','commands','829408phmWER','map','__importDefault','done','length','join'];a2n=function(){return b;};return a2n();}var __awaiter=this&&this[a2m(0x1e6)]||function(n,C,k,H){function R(W){return W instanceof k?W:new k(function(i){i(W);});}return new(k||(k=Promise))(function(W,i){const X=a2C;function t(y){const a=a2C;try{M(H[a(0x1f6)](y));}catch(T){i(T);}}function r(y){try{M(H['throw'](y));}catch(T){i(T);}}function M(y){const N=a2C;y[N(0x1ed)]?W(y[N(0x1df)]):R(y[N(0x1df)])['then'](t,r);}M((H=H['apply'](n,C||[]))[X(0x1f6)]());});},__importDefault=this&&this[a2m(0x1ec)]||function(n){const E=a2m;return n&&n[E(0x1e1)]?n:{'default':n};};Object[a2m(0x1da)](exports,'__esModule',{'value':!![]}),exports[a2m(0x1e5)]=void 0x0;const chalk_1=__importDefault(require('chalk')),utils_1=require('./utils');function getCommandOverview(n){const g=a2m;return(0x0,utils_1['getCommand'])()[g(0x1f4)]('command-overview')[g(0x1f5)](g(0x1f8))[g(0x1f7)](g(0x1f9),'Print\x20command\x20descriptions')[g(0x1dd)](C=>__awaiter(this,void 0x0,void 0x0,function*(){const {verbose:k}=C;function H(R,W){const c=a2C;var i;const t=(d,Q=!![])=>Q?chalk_1[c(0x1f2)][c(0x1d9)][c(0x1e0)](d[c(0x1f4)]()):d['name'](),r=W[c(0x1ee)]===0x0,M=R['commands'];let y='';const T=M[c(0x1ee)]===0x0,V=T||((i=Object[c(0x1f1)](R===null||R===void 0x0?void 0x0:R[c(0x1e2)]()))===null||i===void 0x0?void 0x0:i[c(0x1ee)])>0x0;!r&&(y=M&&!T?'┬\x20':'─\x20');const j=k&&V&&R[c(0x1f5)]()?':\x20'+R[c(0x1f5)]():'';console[c(0x1e8)](''+W+y+t(R,V)+j);let U=W;if(!r){const d=W[c(0x1e7)](-0x2)==='└─';U=W[c(0x1e7)](0x0,-0x2)+(d?'\x20\x20':'│\x20');}const h=U+'├─',o=U+'└─',A=M['every'](Q=>Q[c(0x1e9)][c(0x1ee)]===0x0);A&&!T&&!k?console[c(0x1e8)](o+'\x20'+M[c(0x1eb)](Q=>t(Q))[c(0x1ef)](',\x20')):M['forEach']((Q,l)=>{H(Q,M['length']-0x1===l?o:h);});}H(n,'');}));}exports[a2m(0x1e5)]=getCommandOverview;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a3h=a3C;(function(n,C){const U=a3C,k=n();while(!![]){try{const H=parseInt(U(0x1de))/0x1*(-parseInt(U(0x1e2))/0x2)+parseInt(U(0x1dc))/0x3*(-parseInt(U(0x1d7))/0x4)+-parseInt(U(0x1f1))/0x5+parseInt(U(0x1ed))/0x6+parseInt(U(0x1fc))/0x7*(parseInt(U(0x1e9))/0x8)+-parseInt(U(0x20a))/0x9*(-parseInt(U(0x1e1))/0xa)+parseInt(U(0x1f6))/0xb;if(H===C)break;else k['push'](k['shift']());}catch(R){k['push'](k['shift']());}}}(a3n,0x584e5));var __createBinding=this&&this[a3h(0x1d9)]||(Object[a3h(0x20c)]?function(n,C,H,R){const o=a3h;if(R===undefined)R=H;var W=Object[o(0x1df)](C,H);(!W||(o(0x1f4)in W?!C[o(0x1ff)]:W[o(0x1e4)]||W['configurable']))&&(W={'enumerable':!![],'get':function(){return C[H];}}),Object[o(0x1ea)](n,R,W);}:function(n,C,H,R){if(R===undefined)R=H;n[R]=C[H];}),__setModuleDefault=this&&this[a3h(0x1dd)]||(Object[a3h(0x20c)]?function(n,C){Object['defineProperty'](n,'default',{'enumerable':!![],'value':C});}:function(n,C){n['default']=C;}),__importStar=this&&this[a3h(0x1f2)]||function(n){const A=a3h;if(n&&n[A(0x1ff)])return n;var C={};if(n!=null){for(var H in n)if(H!=='default'&&Object[A(0x20e)][A(0x1da)]['call'](n,H))__createBinding(C,n,H);}return __setModuleDefault(C,n),C;},__importDefault=this&&this['__importDefault']||function(n){const d=a3h;return n&&n[d(0x1ff)]?n:{'default':n};};Object[a3h(0x1ea)](exports,a3h(0x1ff),{'value':!![]}),exports[a3h(0x205)]=exports[a3h(0x1e8)]=void 0x0;const chalk_1=__importDefault(require(a3h(0x1fa))),_=__importStar(require(a3h(0x1f0))),util=__importStar(require(a3h(0x1ee))),columnify=require(a3h(0x1e7));function a3C(n,C){const k=a3n();return a3C=function(H,R){H=H-0x1d7;let W=k[H];return W;},a3C(n,C);}function a3n(){const E=['inspect','chalk','sort','4578mdEwnY','updatedat','keys','__esModule','getMinutes','disabled','createdat','isFinite','set','consoleFormat','bold','\x20found','length','isBoolean','4789998rjKLwy','No\x20','create','getSeconds','prototype','4URDihb','getHours','__createBinding','hasOwnProperty','map','2163141GTryaP','__setModuleDefault','3kkuEbj','getOwnPropertyDescriptor','default','10SuwqVC','288950GglWec','isUndefined','writable','isObjectLike','forEach','columnify','printAsTable','4008QlyEQO','defineProperty','getMonth','toLowerCase','2488194bqMZFe','util','toString','lodash','1298030WTVvnG','__importStar','clone','get','log','5513244oKNyQe','includes','getDate'];a3n=function(){return E;};return a3n();}function printAsTable(n,C,k,H=![],R=0x0){const Q=a3h;!H&&console[Q(0x1f5)](''+chalk_1[Q(0x1e0)][Q(0x206)](C));function W(t){const l=Q;return t===l(0x201)?t:t['replace'](l(0x201),'');}function i(t,r){const m=Q;function M(T){const K=a3C,V=new Date(T);return V[K(0x1f8)]()+'/'+V[K(0x1eb)]()+'/'+V['getFullYear']()+'\x0a'+V[K(0x1d8)]()+':'+V[K(0x200)]()+':'+V[K(0x20d)]();}const y=[m(0x202),m(0x1fd)];if(y[m(0x1f7)](r[m(0x1ec)]())&&_[m(0x203)](t)&&t['toString']()[m(0x208)]===0xd)return M(Number(t));if(_[m(0x209)](t)){if(r!=='disabled'&&r[m(0x1f7)](m(0x201)))return t?'x':'✔';return t?'✔':'x';}if(_[m(0x1e5)](t))return util['inspect'](t,{'showHidden':![],'depth':null,'colors':!![],'compact':!![]});return t;}if(_['isArrayLike'](n)){n[Q(0x208)]===0x0&&console[Q(0x1f5)](Q(0x20b)+C['toLowerCase']()+Q(0x207));const t=n[Q(0x1db)]((y,T)=>{const a=Q,V={'i':T+R};return Object[a(0x1fe)](y)[a(0x1e6)](j=>{const N=a;(_[N(0x1e3)](k)||k['includes'](j[N(0x1ec)]()))&&_[N(0x204)](V,W(j),i(y[j],j));}),V;}),r=_[Q(0x1f3)](Object[Q(0x1fe)]((t===null||t===void 0x0?void 0x0:t[0x0])||[]))[Q(0x1fb)]((y,T)=>{const V=j=>j!=='i'?j!=='internalId'?0x0:0x1:0x2;return V(T)-V(y);}),M={'maxWidth':0x1e,'preserveNewLines':!![],'showHeaders':!H,'config':{'_id':{'maxWidth':0x5,'truncate':!![]},'i':{'showHeaders':![]}},'columns':r};console['log'](columnify(t,M));}else console[Q(0x1f5)](n);}exports[a3h(0x1e8)]=printAsTable;function consoleFormat(n){const X=a3h;if(!_[X(0x1e5)](n))return n===null||n===void 0x0?void 0x0:n[X(0x1ef)]();return util[X(0x1f9)](n,{'showHidden':![],'depth':null,'colors':!![],'compact':!![]});}exports[a3h(0x205)]=consoleFormat;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const a4b=a4p;function a4p(i,p){const B=a4i();return a4p=function(H,j){H=H-0x18a;let l=B[H];return l;},a4p(i,p);}(function(i,p){const x=a4p,B=i();while(!![]){try{const H=parseInt(x(0x207))/0x1+parseInt(x(0x1e4))/0x2+-parseInt(x(0x227))/0x3+parseInt(x(0x1ee))/0x4*(parseInt(x(0x1f5))/0x5)+parseInt(x(0x1fe))/0x6*(-parseInt(x(0x222))/0x7)+-parseInt(x(0x1cc))/0x8+-parseInt(x(0x226))/0x9*(parseInt(x(0x206))/0xa);if(H===p)break;else B['push'](B['shift']());}catch(j){B['push'](B['shift']());}}}(a4i,0x77b96));var __createBinding=this&&this[a4b(0x1f6)]||(Object[a4b(0x19d)]?function(i,p,B,H){const w=a4b;if(H===undefined)H=B;var j=Object[w(0x214)](p,B);(!j||('get'in j?!p[w(0x1b6)]:j['writable']||j[w(0x1c6)]))&&(j={'enumerable':!![],'get':function(){return p[B];}}),Object[w(0x19e)](i,H,j);}:function(i,p,B,H){if(H===undefined)H=B;i[H]=p[B];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object['create']?function(i,p){const X=a4b;Object[X(0x19e)](i,X(0x1b9),{'enumerable':!![],'value':p});}:function(i,p){const K=a4b;i[K(0x1b9)]=p;}),__importStar=this&&this[a4b(0x1ab)]||function(i){const N=a4b;if(i&&i['__esModule'])return i;var p={};if(i!=null){for(var B in i)if(B!==N(0x1b9)&&Object[N(0x192)][N(0x1ef)][N(0x1c7)](i,B))__createBinding(p,i,B);}return __setModuleDefault(p,i),p;},__awaiter=this&&this[a4b(0x201)]||function(i,p,B,H){function j(l){return l instanceof B?l:new B(function(a){a(l);});}return new(B||(B=Promise))(function(l,a){const k=a4p;function D(E){const m=a4p;try{L(H[m(0x1f2)](E));}catch(C){a(C);}}function f(E){const J=a4p;try{L(H[J(0x1f7)](E));}catch(C){a(C);}}function L(E){const Y=a4p;E[Y(0x1d8)]?l(E[Y(0x1e2)]):j(E[Y(0x1e2)])[Y(0x1d9)](D,f);}L((H=H[k(0x213)](i,p||[]))[k(0x1f2)]());});},__importDefault=this&&this['__importDefault']||function(i){return i&&i['__esModule']?i:{'default':i};};function a4i(){const z=['defineProperty','Choose\x20the\x20context\x20to\x20','stdout','login','\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20','warning','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','italic','moveCursor','description','Remove\x20a\x20context','useProjectId','.\x20Using\x20fallback.','__importStar','Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','retry','prompt','host\x20url\x20for\x20this\x20context','set-token','apiTokenLogin','useServiceId','context','Token\x20for\x20this\x20context','Local\x20context\x20\x27','__esModule','getCurrentProjectName','clearLine','default','delete','--do-not-open-browser','error','host','updateToken','ctx','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','/v1/login','addCommand','https://api.northflank.com','contextProvider','../inquirer-helper','configurable','call','Use\x20manual\x20login\x20with\x20API\x20token','tokenPrompt','finally','length','90608uiJRlf','Use\x20job\x20with\x20id:','map','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','valueOf','search-list','verifyToken','Login\x20to\x20','\x20(current)','printAsTable','list','apiClient','done','then','-h,\x20--host\x20[HOST]','doNotOpenBrowser','NorthflankApiBrowserLogin','getCurrentToken','current','token','Update\x20token\x20for\x20current\x20context','sessionToken=********','value','../utils','1884052uEztEH','confirm','Contexts','fullUrl','getCurrentContext','Use\x20project\x20with\x20id:','Switch\x20between\x20your\x20local\x20contexts','askForContext','remove','removeContext','350476CfmiuZ','hasOwnProperty','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Use\x20service\x20with\x20id:','next','getCurrentBaseUrl','node-fetch','5ZAylko','__createBinding','throw','getCommand','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','CliContext','action','use','Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context','78942QPxpBw','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','Retrieve\x20and\x20update\x20local\x20context\x20settings.','__awaiter','update-token','Error\x20occured\x20during\x20browser\x20login:\x20','Name\x20for\x20login\x20context','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','10TqWkkb','464502VCgzxe','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','startLogin','askForJob','\x27\x20successfully\x20updated.','loadContextWrapper','service','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','defaultBaseUrl','Changed\x20current\x20context\x20to\x20','Bearer\x20','tokenLogin','apply','getOwnPropertyDescriptor','log','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','Local\x20context\x20name\x20to\x20remove.','chalk','override','useJobId','../console-format-helpers','getInfo','https://','set','sanitiseHostname','browser-opened','contexts','70CZpCea','inquirer','--token-login','../login/browser-login','2783628MNBfPm','1654707cfaWJi','catch','useContext','\x20successful','alias','name','askForProject','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','loginPrompt','all','browserLogin','prototype','-n,\x20--name\x20[NAME]','project','contextAvailable','option','success','getProjectName','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','--override','lodash','--all','create'];a4i=function(){return z;};return a4i();}Object[a4b(0x19e)](exports,a4b(0x1b6),{'value':!![]}),exports[a4b(0x1fa)]=void 0x0;const _=__importStar(require(a4b(0x19b))),node_fetch_1=__importDefault(require(a4b(0x1f4))),chalk_1=__importDefault(require(a4b(0x218))),utils_1=require(a4b(0x1e3)),inquirer_helper_1=require(a4b(0x1c5)),console_format_helpers_1=require(a4b(0x21b)),browser_login_1=require(a4b(0x225)),inquirer=require(a4b(0x223));class CliContext{constructor(i,p=a4b(0x1c3)){const M=a4b;this[M(0x20f)]=p,this['sanitiseHostname']=C=>{const F=M;let v=C;return!/^https?:\/\//i['test'](v)&&(v=F(0x21d)+v),v=v['replace'](/\/+$/,''),v;},this[M(0x1d7)]=i;const B=new inquirer_helper_1['InquirerHelper'](i);this[M(0x1a1)]=(0x0,utils_1[M(0x1f8)])()[M(0x18c)]('login')['description']('Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.')['option'](M(0x224),M(0x1c8),![])['option'](M(0x1bb),'Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login',![])[M(0x196)](M(0x193),M(0x204))['option']('-t,\x20--token\x20[TOKEN]',M(0x1ac))[M(0x196)](M(0x1da),M(0x1af),this[M(0x20f)])[M(0x196)](M(0x19a),M(0x208),![])['action'](C=>__awaiter(this,void 0x0,void 0x0,function*(){const q=M;_[q(0x21e)](C,'host',this[q(0x21f)](C[q(0x1bd)]));const {name:v,host:O,token:Q,override:U}=C[q(0x212)]||C[q(0x1df)]!==undefined?yield this[q(0x1b1)](C,B):yield this[q(0x191)](C,B);try{yield this['apiClient'][q(0x1c4)]['addContext']({'name':v,'host':O,'token':Q},U);}catch(G){(0x0,utils_1[q(0x1bc)])(G['message']);return;}!(yield this[q(0x1d2)]())?((0x0,utils_1['error'])(q(0x1ff)),yield this[q(0x1d7)][q(0x1c4)][q(0x1ed)](v)):(0x0,utils_1[q(0x197)])(q(0x1d3)+O+q(0x18a));})),this[M(0x221)]=(0x0,utils_1[M(0x1f8)])()['name'](M(0x1b3))[M(0x1a7)](M(0x200))['alias']('contexts')['alias'](M(0x1bf));const H=(0x0,utils_1[M(0x1f8)])()['name']('list')[M(0x18c)]('ls')['description']('List\x20all\x20available\x20contexts')[M(0x196)](M(0x19c),'Shows\x20full\x20context\x20information\x20(including\x20tokens)')[M(0x1fb)](C=>__awaiter(this,void 0x0,void 0x0,function*(){const g=M;console[g(0x215)](i[g(0x1c4)][g(0x21c)]());const v=i[g(0x1c4)]['loadContextWrapper']();if(C[g(0x190)]===!![]){console['dir'](v);return;}const O=v[g(0x1de)],Q=v[g(0x221)]['sort']((U,e)=>U['name']===O?-0x1:e[g(0x18c)]===O?0x1:0x0)[g(0x1ce)](U=>{const r=g,e=O===U[r(0x18c)]?r(0x1d4):'';return{'Name':''+U[r(0x18c)]+e,'Host':U[r(0x1bd)],'Default\x20Project':U['project']||'-','Default\x20Service':U[r(0x20d)]||'-'};});(0x0,console_format_helpers_1[g(0x1d5)])(Q,g(0x1e6));})),j=(0x0,utils_1['getCommand'])();j['name'](M(0x1fc))[M(0x1a7)](M(0x1ea))[M(0x196)](M(0x193),M(0x1f9))['action'](C=>__awaiter(this,void 0x0,void 0x0,function*(){const W=M,v=(C===null||C===void 0x0?void 0x0:C[W(0x18c)])||(yield this[W(0x1eb)]('use'));yield this['apiClient'][W(0x1c4)][W(0x229)](v),(0x0,utils_1[W(0x197)])(W(0x210)+v);}));const l='-i,\x20--id\x20[ID]',a=(0x0,utils_1[M(0x1f8)])()['name'](M(0x194))[M(0x1a7)](M(0x1fd))[M(0x196)](l,'Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context')['action'](C=>__awaiter(this,void 0x0,void 0x0,function*(){const R=M,v=(C===null||C===void 0x0?void 0x0:C['id'])||(yield B[R(0x18d)]());yield this[R(0x1d7)][R(0x1c4)][R(0x1a9)](v),console['log'](R(0x1e9),v);})),D=(0x0,utils_1['getCommand'])()['name'](M(0x20d))[M(0x1a7)](M(0x216))[M(0x196)](l,M(0x1cf))[M(0x1fb)](C=>__awaiter(this,void 0x0,void 0x0,function*(){const n=M,v=(C===null||C===void 0x0?void 0x0:C['id'])||(yield B['askForService'](this[n(0x198)]())());console['log'](n(0x1f1),v),yield this[n(0x1d7)][n(0x1c4)][n(0x1b2)](v);})),f=(0x0,utils_1[M(0x1f8)])()[M(0x18c)]('job')[M(0x1a7)](M(0x20e))['option'](l,M(0x1f0))['action'](C=>__awaiter(this,void 0x0,void 0x0,function*(){const s=M,v=(C===null||C===void 0x0?void 0x0:C['id'])||(yield B[s(0x20a)](this[s(0x198)]())());console[s(0x215)](s(0x1cd),v),yield this['apiClient'][s(0x1c4)][s(0x21a)](v);}));j['addCommand'](a),j[M(0x1c2)](f),j[M(0x1c2)](D);const L=(0x0,utils_1[M(0x1f8)])()[M(0x18c)](M(0x1ec))[M(0x18b)](M(0x1ba))[M(0x18b)]('rm')[M(0x1a7)](M(0x1a8))['option'](l,M(0x217))[M(0x1fb)](C=>__awaiter(this,void 0x0,void 0x0,function*(){const S=M;var v;const O=(C===null||C===void 0x0?void 0x0:C['id'])||(yield this['askForContext'](S(0x1ec))),Q=(v=this[S(0x1d7)][S(0x1c4)][S(0x1e8)]())===null||v===void 0x0?void 0x0:v[S(0x18c)];yield this[S(0x1d7)]['contextProvider']['removeContext'](O),(0x0,utils_1[S(0x197)])(S(0x1b5)+O+'\x27\x20successfully\x20removed.');if(!this['contextAvailable']()){(0x0,utils_1[S(0x1a3)])(S(0x18e));return;}if(Q===O){const U=(C===null||C===void 0x0?void 0x0:C[S(0x18c)])||(yield this[S(0x1eb)]('use\x20from\x20now\x20on'));yield this[S(0x1d7)][S(0x1c4)][S(0x229)](U),(0x0,utils_1[S(0x197)])(S(0x210)+U);}})),E=(0x0,utils_1[M(0x1f8)])()[M(0x18c)](M(0x202))[M(0x18b)](M(0x1b0))['description'](M(0x1e0))['option']('-t,\x20--token\x20[TOKEN]',M(0x1b4))[M(0x1fb)](C=>__awaiter(this,void 0x0,void 0x0,function*(){const T=M,{contextProvider:v}=this[T(0x1d7)],O=(C===null||C===void 0x0?void 0x0:C[T(0x1df)])||(yield B[T(0x1c9)]()),Q=v[T(0x1dd)]();yield v[T(0x1be)](O);if(yield this['verifyToken']())(0x0,utils_1[T(0x197)])('Token\x20for\x20current\x20context\x20\x27'+v['getCurrentName']()+T(0x20b));else{if(Q)yield v['updateToken'](Q);(0x0,utils_1[T(0x1bc)])('Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed');}}));this[M(0x221)][M(0x1c2)](H),this[M(0x221)][M(0x1c2)](j),this[M(0x221)][M(0x1c2)](L),this['contexts'][M(0x1c2)](E);}[a4b(0x191)](i,p){var B,H,j,l;return __awaiter(this,void 0x0,void 0x0,function*(){const V=a4p,a=!i[V(0x1db)],D=(B=i['host'])!==null&&B!==void 0x0?B:this['defaultBaseUrl'],f=new browser_login_1[(V(0x1dc))](D,a);let L;f['on'](V(0x220),({url:O})=>{const I=V;if(a){const Q=O['replace'](/sessionToken=.*/,I(0x1e1));console[I(0x215)](I(0x1c0)+Q+')'),L=inquirer[I(0x1ae)]([{'type':I(0x1e5),'name':I(0x1e7),'message':'Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','default':![]}]),L[I(0x1d9)](U=>{const o=I;process[o(0x1a0)][o(0x1a6)](0x0,-0x1),process[o(0x1a0)][o(0x1b8)](0x1),U[o(0x1e7)]&&console['log'](o(0x199)+O+'\x20');});}else console[I(0x215)](I(0x199)+O+'\x20');});const {token:E,contextName:C}=yield f[V(0x209)]()[V(0x228)](O=>__awaiter(this,void 0x0,void 0x0,function*(){const y=V;(0x0,utils_1['error'])(y(0x203)+O['message']+y(0x1aa));const Q=yield this[y(0x1b1)](i,p);return{'token':Q[y(0x1df)],'contextName':Q[y(0x18c)]};}))[V(0x1ca)](()=>{if(L)L['ui']['close']();}),v=(j=(H=i[V(0x18c)])!==null&&H!==void 0x0?H:C)!==null&&j!==void 0x0?j:'autologin-'+new Date()[V(0x1d0)]();return(0x0,utils_1[V(0x197)])(V(0x1a2)+chalk_1[V(0x1b9)][V(0x1a5)](v)),{'name':v,'token':E,'host':D,'override':(l=i[V(0x219)])!==null&&l!==void 0x0?l:![]};});}[a4b(0x1b1)](i,p){return __awaiter(this,void 0x0,void 0x0,function*(){const u=a4p,B=this[u(0x1d7)][u(0x1c4)][u(0x20c)]()[u(0x221)],{name:H,token:j,host:l,override:a}=yield p[u(0x18f)](i,B);return{'name':H,'token':j,'host':l,'override':a};});}[a4b(0x198)](){const A=a4b,i=this[A(0x1d7)][A(0x1c4)][A(0x1b7)]();if(i===undefined)throw new Error(A(0x1a4));return i;}['askForContext'](i){return __awaiter(this,void 0x0,void 0x0,function*(){const Z=a4p;if(!this[Z(0x195)]())throw new Error(Z(0x205));const p=this[Z(0x1d7)][Z(0x1c4)][Z(0x20c)]()[Z(0x221)][Z(0x1ce)](H=>H['name']),B=p[Z(0x1cb)]>0x4?Z(0x1d1):Z(0x1d6);return(yield inquirer[Z(0x1ae)]([{'type':B,'name':Z(0x18c),'message':Z(0x19f)+i+':','choices':p}]))['name'];});}['contextAvailable'](){const h=a4b;return this['apiClient'][h(0x1c4)]['loadContextWrapper']()['contexts'][h(0x1cb)]>0x0;}[a4b(0x1d2)](){return __awaiter(this,void 0x0,void 0x0,function*(){const P=a4p;try{const i=this[P(0x1d7)][P(0x1c4)][P(0x1f3)](),p=this[P(0x1d7)]['contextProvider'][P(0x1dd)](),B=i+P(0x1c1),H={'Authorization':P(0x211)+p},j=yield(0x0,utils_1[P(0x1ad)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const d=P;return(0x0,node_fetch_1[d(0x1b9)])(B,{'method':'GET','timeout':0xbb8,'headers':H});}));if(j['ok'])return!![];return![];}catch(l){return![];}});}}exports['CliContext']=CliContext;
|
|
1
|
+
'use strict';const a4d=a4C;function a4C(n,C){const k=a4n();return a4C=function(H,R){H=H-0xa2;let W=k[H];return W;},a4C(n,C);}(function(n,C){const A=a4C,k=n();while(!![]){try{const H=-parseInt(A(0x10b))/0x1*(parseInt(A(0x143))/0x2)+parseInt(A(0xee))/0x3*(-parseInt(A(0xde))/0x4)+-parseInt(A(0xe2))/0x5*(parseInt(A(0x13c))/0x6)+-parseInt(A(0xa6))/0x7+parseInt(A(0xd8))/0x8+-parseInt(A(0xa7))/0x9+-parseInt(A(0x120))/0xa*(-parseInt(A(0x13f))/0xb);if(H===C)break;else k['push'](k['shift']());}catch(R){k['push'](k['shift']());}}}(a4n,0x99a95));var __createBinding=this&&this[a4d(0xc9)]||(Object[a4d(0xbf)]?function(n,C,H,R){const Q=a4d;if(R===undefined)R=H;var W=Object[Q(0xeb)](C,H);(!W||(Q(0xcb)in W?!C[Q(0xdd)]:W[Q(0xfc)]||W['configurable']))&&(W={'enumerable':!![],'get':function(){return C[H];}}),Object[Q(0xcd)](n,R,W);}:function(n,C,H,R){if(R===undefined)R=H;n[R]=C[H];}),__setModuleDefault=this&&this[a4d(0x12a)]||(Object[a4d(0xbf)]?function(n,C){const l=a4d;Object['defineProperty'](n,l(0x10f),{'enumerable':!![],'value':C});}:function(n,C){const K=a4d;n[K(0x10f)]=C;}),__importStar=this&&this[a4d(0x113)]||function(n){const m=a4d;if(n&&n[m(0xdd)])return n;var C={};if(n!=null){for(var H in n)if(H!==m(0x10f)&&Object[m(0x132)]['hasOwnProperty'][m(0xb3)](n,H))__createBinding(C,n,H);}return __setModuleDefault(C,n),C;},__awaiter=this&&this[a4d(0xc1)]||function(n,C,k,H){function R(W){return W instanceof k?W:new k(function(i){i(W);});}return new(k||(k=Promise))(function(W,i){const E=a4C;function t(y){const a=a4C;try{M(H[a(0x13b)](y));}catch(T){i(T);}}function r(y){const N=a4C;try{M(H[N(0xe7)](y));}catch(T){i(T);}}function M(y){const X=a4C;y['done']?W(y[X(0x144)]):R(y['value'])[X(0xd9)](t,r);}M((H=H[E(0xcf)](n,C||[]))[E(0x13b)]());});},__importDefault=this&&this[a4d(0x12f)]||function(n){const g=a4d;return n&&n[g(0xdd)]?n:{'default':n};};function a4n(){const s=['Token\x20for\x20this\x20context.\x20When\x20set,\x20browser\x20login\x20is\x20not\x20used','__importDefault','stdout','getCurrentToken','prototype','finally','--all','getCurrentBaseUrl','apiTokenLogin','map','autologin-','replace','getCommand','next','6XZshOM','action','prompt','3499177tGAECx','name','Bearer\x20','job','2xnDzdu','value','updateToken','login','Connect\x20the\x20CLI\x20to\x20your\x20Northflank\x20account.','context','1280657WQYmAq','2061693FXdKua','host\x20url\x20for\x20this\x20context','chalk','askForService','--do-not-open-browser','log','loadContextWrapper','alias','sessionToken=********','Update\x20token\x20for\x20current\x20context','\x27\x20successfully\x20removed.','Token\x20for\x20current\x20context\x20\x27','call','--override','catch','sort','host','Shows\x20full\x20context\x20information\x20(including\x20tokens)','error','Use\x20job\x20with\x20id:','askForContext','Follow\x20the\x20steps\x20displayed\x20on\x20the\x20page\x20opened\x20in\x20the\x20browser\x20(URL\x20opened:\x20','Failed\x20to\x20login\x20with\x20the\x20provided\x20token.\x20Token\x20was\x20not\x20changed','description','create','warning','__awaiter','delete','.\x20Using\x20fallback.','InquirerHelper','Token\x20for\x20this\x20context','Change\x20the\x20default\x20job\x20in\x20the\x20current\x20local\x20context','https://','NorthflankApiBrowserLogin','__createBinding','useJobId','get','../inquirer-helper','defineProperty','tokenPrompt','apply','use','getCurrentContext','addContext','Changed\x20current\x20context\x20to\x20','confirm','browserLogin','Contexts','Use\x20service\x20with\x20id:','8413400TpTqLW','then','startLogin','moveCursor','project','__esModule','796pdDLSH','inquirer','addCommand','lodash','3934035XzzYFF','useProjectId','../login/browser-login','update-token','use\x20from\x20now\x20on','throw','getInfo','contextAvailable','-h,\x20--host\x20[HOST]','getOwnPropertyDescriptor','useServiceId','askForJob','1338Goqbhf','Job\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','Local\x20context\x20\x27','current','No\x20project\x20in\x20current\x20context.\x20Please\x20set\x20project\x20before\x20setting\x20a\x20project-scoped\x20resource','defaultBaseUrl','removeContext','retry','Use\x20browser\x20login\x20but\x20only\x20print\x20URL\x20which\x20can\x20be\x20used\x20to\x20login','No\x20context\x20available.\x20Use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','\x0aSuccessfully\x20logged\x20in\x20using\x20browser\x20login,\x20added\x20context\x20with\x20name\x20','No\x20context\x20available.\x20Please\x20use\x20\x27northflank\x20login\x27\x20to\x20create\x20context.','Name\x20for\x20login\x20context','close','writable','-n,\x20--name\x20[NAME]','useContext','contextProvider','search-list','\x20(current)','doNotOpenBrowser','Project\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','remove','Switch\x20between\x20your\x20local\x20contexts','Service\x20name\x20(internal\x20id)\x20to\x20use\x20as\x20default\x20in\x20context','getProjectName','list','success','Error\x20occured\x20during\x20browser\x20login:\x20','407117LsVCbp','Choose\x20the\x20context\x20to\x20','Open\x20this\x20URL\x20in\x20your\x20browser\x20and\x20follow\x20the\x20steps:\x0a\x09','service','default','Remove\x20a\x20context','CliContext','Override\x20existing\x20contexts\x20(this\x20will\x20remove\x20project\x20and\x20service\x20context)','__importStar','sanitiseHostname','apiClient','Failed\x20to\x20login\x20with\x20the\x20provided\x20token,\x20make\x20sure\x20to\x20use\x20a\x20valid\x20token\x20and\x20host.','Display\x20full\x20URL\x20to\x20allow\x20opening\x20the\x20link\x20manually','-t,\x20--token\x20[TOKEN]','browser-opened','Use\x20manual\x20login\x20with\x20API\x20token','Local\x20context\x20name\x20to\x20remove.','message','List\x20all\x20available\x20contexts','test','option','40RscswP','set-token','getCurrentName','Change\x20current\x20context\x20to\x20context\x20identified\x20by\x20this\x20name','fullUrl','verifyToken','getCurrentProjectName','../utils','\x27\x20successfully\x20updated.','Change\x20the\x20default\x20service\x20in\x20the\x20current\x20local\x20context','__setModuleDefault','Retrieve\x20and\x20update\x20local\x20context\x20settings.','contexts','../console-format-helpers'];a4n=function(){return s;};return a4n();}Object[a4d(0xcd)](exports,a4d(0xdd),{'value':!![]}),exports[a4d(0x111)]=void 0x0;const _=__importStar(require(a4d(0xe1))),node_fetch_1=__importDefault(require('node-fetch')),chalk_1=__importDefault(require(a4d(0xa9))),utils_1=require(a4d(0x127)),inquirer_helper_1=require(a4d(0xcc)),console_format_helpers_1=require(a4d(0x12d)),browser_login_1=require(a4d(0xe4)),inquirer=require(a4d(0xdf));class CliContext{constructor(n,C='https://api.northflank.com'){const c=a4d;this[c(0xf3)]=C,this[c(0x114)]=T=>{const b=c;let V=T;return!/^https?:\/\//i[b(0x11e)](V)&&(V=b(0xc7)+V),V=V['replace'](/\/+$/,''),V;},this[c(0x115)]=n;const k=new inquirer_helper_1[(c(0xc4))](n);this['login']=(0x0,utils_1['getCommand'])()[c(0x140)](c(0xa3))[c(0xbe)](c(0xa4))[c(0x11f)]('--token-login',c(0x11a),![])[c(0x11f)](c(0xab),c(0xf6),![])[c(0x11f)](c(0xfd),c(0xfa))[c(0x11f)](c(0x118),c(0x12e))[c(0x11f)](c(0xea),c(0xa8),this[c(0xf3)])[c(0x11f)](c(0xb4),c(0x112),![])[c(0x13d)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const L=c;_['set'](T,L(0xb7),this[L(0x114)](T[L(0xb7)]));const {name:V,host:j,token:U,override:h}=T['tokenLogin']||T['token']!==undefined?yield this[L(0x136)](T,k):yield this[L(0xd5)](T,k);try{yield this['apiClient'][L(0xff)][L(0xd2)]({'name':V,'host':j,'token':U},h);}catch(o){(0x0,utils_1[L(0xb9)])(o[L(0x11c)]);return;}!(yield this[L(0x125)]())?((0x0,utils_1[L(0xb9)])(L(0x116)),yield this[L(0x115)][L(0xff)][L(0xf4)](V)):(0x0,utils_1[L(0x109)])('Login\x20to\x20'+j+'\x20successful');})),this['contexts']=(0x0,utils_1[c(0x13a)])()[c(0x140)](c(0xa5))[c(0xbe)](c(0x12b))[c(0xae)]('contexts')[c(0xae)]('ctx');const H=(0x0,utils_1[c(0x13a)])()[c(0x140)](c(0x108))[c(0x140)]('ls')[c(0xbe)](c(0x11d))[c(0x11f)](c(0x134),c(0xb8))[c(0x13d)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const G=c;console[G(0xac)](n['contextProvider'][G(0xe8)]());const V=n[G(0xff)]['loadContextWrapper']();if(T['all']===!![]){console['dir'](V);return;}const j=V[G(0xf1)],U=V[G(0x12c)][G(0xb6)]((h,o)=>h[G(0x140)]===j?-0x1:o[G(0x140)]===j?0x1:0x0)['map'](h=>{const Z=G,o=j===h[Z(0x140)]?Z(0x101):'';return{'Name':''+h[Z(0x140)]+o,'Host':h[Z(0xb7)],'Default\x20Project':h['project']||'-','Default\x20Service':h[Z(0x10e)]||'-'};});(0x0,console_format_helpers_1['printAsTable'])(U,G(0xd6));})),R=(0x0,utils_1[c(0x13a)])();R['name'](c(0xd0))[c(0xbe)](c(0x105))[c(0x11f)](c(0xfd),c(0x123))[c(0x13d)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const q=c,V=(T===null||T===void 0x0?void 0x0:T[q(0x140)])||(yield this[q(0xbb)](q(0xd0)));yield this[q(0x115)][q(0xff)][q(0xfe)](V),(0x0,utils_1[q(0x109)])(q(0xd3)+V);}));const W='-i,\x20--id\x20[ID]',i=(0x0,utils_1[c(0x13a)])()[c(0x140)](c(0xdc))['description']('Change\x20the\x20default\x20project\x20in\x20the\x20current\x20local\x20context')[c(0x11f)](W,c(0x103))['action'](T=>__awaiter(this,void 0x0,void 0x0,function*(){const w=c,V=(T===null||T===void 0x0?void 0x0:T['id'])||(yield k['askForProject']());yield this['apiClient'][w(0xff)][w(0xe3)](V),console['log']('Use\x20project\x20with\x20id:',V);})),t=(0x0,utils_1[c(0x13a)])()[c(0x140)](c(0x10e))[c(0xbe)](c(0x129))[c(0x11f)](W,c(0x106))[c(0x13d)](T=>__awaiter(this,void 0x0,void 0x0,function*(){const O=c,V=(T===null||T===void 0x0?void 0x0:T['id'])||(yield k[O(0xaa)](this[O(0x107)]())());console['log'](O(0xd7),V),yield this[O(0x115)][O(0xff)][O(0xec)](V);})),r=(0x0,utils_1[c(0x13a)])()[c(0x140)](c(0x142))['description'](c(0xc6))[c(0x11f)](W,c(0xef))['action'](T=>__awaiter(this,void 0x0,void 0x0,function*(){const F=c,V=(T===null||T===void 0x0?void 0x0:T['id'])||(yield k[F(0xed)](this['getProjectName']())());console[F(0xac)](F(0xba),V),yield this[F(0x115)][F(0xff)][F(0xca)](V);}));R[c(0xe0)](i),R[c(0xe0)](r),R['addCommand'](t);const M=(0x0,utils_1[c(0x13a)])()[c(0x140)](c(0x104))['alias'](c(0xc2))[c(0xae)]('rm')['description'](c(0x110))[c(0x11f)](W,c(0x11b))['action'](T=>__awaiter(this,void 0x0,void 0x0,function*(){const D=c;var V;const j=(T===null||T===void 0x0?void 0x0:T['id'])||(yield this['askForContext'](D(0x104))),U=(V=this[D(0x115)][D(0xff)][D(0xd1)]())===null||V===void 0x0?void 0x0:V[D(0x140)];yield this['apiClient'][D(0xff)][D(0xf4)](j),(0x0,utils_1[D(0x109)])(D(0xf0)+j+D(0xb1));if(!this[D(0xe9)]()){(0x0,utils_1[D(0xc0)])(D(0xf7));return;}if(U===j){const h=(T===null||T===void 0x0?void 0x0:T['name'])||(yield this[D(0xbb)](D(0xe6)));yield this[D(0x115)][D(0xff)]['useContext'](h),(0x0,utils_1[D(0x109)])(D(0xd3)+h);}})),y=(0x0,utils_1[c(0x13a)])()['name'](c(0xe5))[c(0xae)](c(0x121))[c(0xbe)](c(0xb0))[c(0x11f)](c(0x118),c(0xc5))['action'](T=>__awaiter(this,void 0x0,void 0x0,function*(){const Y=c,{contextProvider:V}=this[Y(0x115)],j=(T===null||T===void 0x0?void 0x0:T['token'])||(yield k[Y(0xce)]()),U=V[Y(0x131)]();yield V[Y(0xa2)](j);if(yield this[Y(0x125)]())(0x0,utils_1['success'])(Y(0xb2)+V[Y(0x122)]()+Y(0x128));else{if(U)yield V[Y(0xa2)](U);(0x0,utils_1[Y(0xb9)])(Y(0xbd));}}));this['contexts'][c(0xe0)](H),this[c(0x12c)][c(0xe0)](R),this[c(0x12c)][c(0xe0)](M),this[c(0x12c)][c(0xe0)](y);}[a4d(0xd5)](n,C){var k,H,R,W;return __awaiter(this,void 0x0,void 0x0,function*(){const S=a4C,i=!n[S(0x102)],t=(k=n[S(0xb7)])!==null&&k!==void 0x0?k:this['defaultBaseUrl'],r=new browser_login_1[(S(0xc8))](t,i);let M;r['on'](S(0x119),({url:j})=>{const x=S;if(i){const U=j[x(0x139)](/sessionToken=.*/,x(0xaf));console[x(0xac)](x(0xbc)+U+')'),M=inquirer[x(0x13e)]([{'type':x(0xd4),'name':x(0x124),'message':x(0x117),'default':![]}]),M['then'](h=>{const J=x;process[J(0x130)][J(0xdb)](0x0,-0x1),process['stdout']['clearLine'](0x1),h[J(0x124)]&&console[J(0xac)](J(0x10d)+j+'\x20');});}else console[x(0xac)](x(0x10d)+j+'\x20');});const {token:y,contextName:T}=yield r[S(0xda)]()[S(0xb5)](j=>__awaiter(this,void 0x0,void 0x0,function*(){const z=S;(0x0,utils_1[z(0xb9)])(z(0x10a)+j[z(0x11c)]+z(0xc3));const U=yield this[z(0x136)](n,C);return{'token':U['token'],'contextName':U['name']};}))[S(0x133)](()=>{const u=S;if(M)M['ui'][u(0xfb)]();}),V=(R=(H=n[S(0x140)])!==null&&H!==void 0x0?H:T)!==null&&R!==void 0x0?R:S(0x138)+new Date()['valueOf']();return(0x0,utils_1['success'])(S(0xf8)+chalk_1['default']['italic'](V)),{'name':V,'token':y,'host':t,'override':(W=n['override'])!==null&&W!==void 0x0?W:![]};});}[a4d(0x136)](n,C){return __awaiter(this,void 0x0,void 0x0,function*(){const f=a4C,k=this['apiClient']['contextProvider'][f(0xad)]()[f(0x12c)],{name:H,token:R,host:W,override:i}=yield C['loginPrompt'](n,k);return{'name':H,'token':R,'host':W,'override':i};});}[a4d(0x107)](){const B=a4d,n=this[B(0x115)][B(0xff)][B(0x126)]();if(n===undefined)throw new Error(B(0xf2));return n;}[a4d(0xbb)](n){return __awaiter(this,void 0x0,void 0x0,function*(){const e=a4C;if(!this[e(0xe9)]())throw new Error(e(0xf9));const C=this['apiClient'][e(0xff)][e(0xad)]()['contexts'][e(0x137)](H=>H['name']),k=C['length']>0x4?e(0x100):e(0x108);return(yield inquirer[e(0x13e)]([{'type':k,'name':e(0x140),'message':e(0x10c)+n+':','choices':C}]))[e(0x140)];});}[a4d(0xe9)](){const v=a4d;return this[v(0x115)][v(0xff)][v(0xad)]()[v(0x12c)]['length']>0x0;}[a4d(0x125)](){return __awaiter(this,void 0x0,void 0x0,function*(){const P=a4C;try{const n=this[P(0x115)][P(0xff)][P(0x135)](),C=this['apiClient'][P(0xff)][P(0x131)](),k=n+'/v1/login',H={'Authorization':P(0x141)+C},R=yield(0x0,utils_1[P(0xf5)])(0x3)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const I=P;return(0x0,node_fetch_1[I(0x10f)])(k,{'method':'GET','timeout':0xbb8,'headers':H});}));if(R['ok'])return!![];return![];}catch(W){return![];}});}}exports[a4d(0x111)]=CliContext;
|