@northflank/cli
Version:
Provides a command-line interface to the Northflank platform.
1 lines • 30.4 kB
JavaScript
'use strict';const a9K=a9a;(function(S,a){const V=a9a,j=S();while(!![]){try{const v=parseInt(V(0x7a))/0x1+-parseInt(V(0xc6))/0x2*(parseInt(V(0x12f))/0x3)+-parseInt(V(0x11c))/0x4+-parseInt(V(0x7b))/0x5+parseInt(V(0x16a))/0x6+parseInt(V(0x12c))/0x7*(parseInt(V(0x78))/0x8)+-parseInt(V(0x97))/0x9*(parseInt(V(0xad))/0xa);if(v===a)break;else j['push'](j['shift']());}catch(z){j['push'](j['shift']());}}}(a9S,0xbd658));var __createBinding=this&&this[a9K(0xaa)]||(Object['create']?function(S,a,j,v){const L=a9K;if(v===undefined)v=j;var z=Object[L(0x9b)](a,j);(!z||(L(0x156)in z?!a[L(0x16b)]:z['writable']||z[L(0x165)]))&&(z={'enumerable':!![],'get':function(){return a[j];}}),Object[L(0x17e)](S,v,z);}:function(S,a,j,v){if(v===undefined)v=j;S[v]=a[j];}),__setModuleDefault=this&&this[a9K(0xf3)]||(Object[a9K(0x121)]?function(S,a){const A=a9K;Object[A(0x17e)](S,A(0xb6),{'enumerable':!![],'value':a});}:function(S,a){S['default']=a;}),__importStar=this&&this[a9K(0xfb)]||function(S){const Q=a9K;if(S&&S[Q(0x16b)])return S;var a={};if(S!=null){for(var j in S)if(j!==Q(0xb6)&&Object['prototype']['hasOwnProperty'][Q(0xd5)](S,j))__createBinding(a,S,j);}return __setModuleDefault(a,S),a;},__awaiter=this&&this[a9K(0xbc)]||function(S,a,j,v){function z(s){return s instanceof j?s:new j(function(u){u(s);});}return new(j||(j=Promise))(function(s,u){const N=a9a;function g(o){const R=a9a;try{i(v[R(0x15d)](o));}catch(X){u(X);}}function w(o){const M=a9a;try{i(v[M(0x180)](o));}catch(X){u(X);}}function i(o){const x=a9a;o[x(0xd1)]?s(o['value']):z(o['value'])['then'](g,w);}i((v=v[N(0xeb)](S,a||[]))['next']());});},__importDefault=this&&this['__importDefault']||function(S){return S&&S['__esModule']?S:{'default':S};};Object[a9K(0x17e)](exports,a9K(0x16b),{'value':!![]}),exports[a9K(0x94)]=void 0x0;function a9a(S,a){const j=a9S();return a9a=function(v,z){v=v-0x77;let s=j[v];return s;},a9a(S,a);}function a9S(){const Sm=['job\x20builds','tag','yaml','isEmpty','a\x20Northflank\x20resource','fullName','cloud','What\x27s\x20the\x20','apply','cluster\x20id','domain','Unexpected\x20file\x20type:\x20','choice','job','data','concat','__setModuleDefault','object','retrievePayloadViaInteractiveCli','askForTemplateRun','project','clusters','addon','integer','__importStar','green','backups','array','Go\x20to\x20editor','Choose\x20the\x20login\x20token:','rawObject','token','job\x20runs','service','SAVE','getQuestionString','filter','service\x20build','unshift','split','string','cmdPath','runs','validate','tags','safeDump','project:\x20\x27','trim','skipValidation','\x20to\x20use:','defaultPaginationPageSize','getType','askConfirm','registerPrompt','service:\x20\x27','logSinks','properties','4157524fXukBa','askForAddonBackup','minimum','chalk','has','create','Configuration\x20file\x20written\x20to\x20','assign','editedResult','deleteWarningPrompt','maximum','addons','askArrayEntry','editPayload','./pagination/inquirer-pagination-prompt','opt','7lXkRdH','search-list','completedAt','18PvcTWq','test','pagination-prompt','pagination','Writing\x20configuration\x20failed:\x20','maxLength','slice','type','Something\x20unexpected\x20happened.','Yes,\x20send','askForProjectScopedResource','pipeline','toString','secrets','toUpperCase','all-job-runs','subdomainPath','No,\x20but\x20save\x20as\x20file','paths','isObject','restores','fileName','confirm','askForPipeline','Do\x20you\x20want\x20to\x20add','greenBright','not\x20completed','tokenPrompt','subdomains','isUndefined','\x20type?','all','askForJob','askForTemplate','name','confirmation','confirmationPrompt','found','askForResourcePaginated','get','template\x20run','success','loginPrompt','./api-helpers','\x27\x20already\x20exists.\x20Do\x20you\x20want\x20to\x20override\x20this\x20context\x20(y)\x20or\x20enter\x20a\x20new\x20name\x20(N)?','don\x27t\x20change','next','nextCursor','apiClient','EDIT','uri','setPathVars','required','reset','configurable','Default\x20project\x20in\x20context\x20not\x20set\x20and\x20no\x20argument\x20provided.','addon:\x20\x27','join','boolean','5901342ATOwtZ','__esModule','askForLogSink','askForBuild','yellowBright','nextPageCursor','No,\x20repeat','No,\x20edit','\x20(startedAt:\x20','YES','Context\x20name\x20already\x20exists.','addEntry','list','unset','registryCredentials','builds','askForVolume','projects','askForCredentials','askForResource','defineProperty','askForProjectScopedResourcePaginated','throw','Do\x20you\x20want\x20to\x20add\x20more','createdAt','askForAddon','ABORT','tmpCmdPath','input','\x20(completedAt:\x20','credentials','10618040sYbxER','\x20in\x20','1185746AYtiDZ','4989865aAPIzh','writeFileSync','minLength','\x20characters,\x20is\x20','must\x20be\x20longer\x20than\x20or\x20equal\x20to\x20','askForService','backupDestinations','.*\x5c.(json|yaml|yml)$','must\x20be\x20a\x20valid\x20non-empty\x20json\x20string','blueBright','DynamicReloadPaginationPrompt','push','resultCache','pathVars','No,\x20abort','must\x20be\x20bigger\x20than\x20or\x20equal\x20to\x20','getPathString','askForBackupDestination','cursor','log\x20sink','Choose\x20the\x20name\x20of\x20the\x20new\x20local\x20context:','password','No\x20','must\x20be\x20shorter\x20than\x20or\x20equal\x20to\x20','pattern','InquirerHelper','askForAddonRestore','inquirer-search-list','4213242gkYSLj','What\x20do\x20you\x20want\x20to\x20use\x20as','map','editor','getOwnPropertyDescriptor','message','blue','templates','this\x20option\x20is\x20required,\x20please\x20answer','\x20and\x20it\x20','.\x20This\x20is\x20irreversible.\x20Please\x20confirm!','includes','length','inquirer','must\x20be\x20a\x20number,\x20is\x20','contextProvider','body','safeLoad','doesn\x27t\x20match\x20pattern\x20\x27','__createBinding','domains','volume','10PWNpGA','saveFile','getInnerType','askForSubdomain','red','secret','repeat','getCurrentProjectName','job\x20containers','default','pop','volumes','example','services','containers','__awaiter','prompt','override','to\x20use:','retry','askForProject','set','keys','bgGrey','ask','71766iCkpgR','Please\x20confirm\x20following\x20configuration:\x0a','oneOf','\x20characters','isBoolean','all-builds','Context\x20with\x20name\x20\x27','startedAt','description','Template\x20id\x20not\x20provided.','for\x20this\x20','done','bold','askForSecret','Provide\x20a\x20file\x20path\x20to\x20write\x20the\x20configuration\x20to\x20(<name>.[json|yaml|yml])','call','anyOf','REPEAT','then','No\x20containers\x20found','stringify','propToType','job:\x20\x27','jobs','Choose\x20the\x20','subdomain','whiteBright','yml','\x20(full\x20domain:\x20'];a9S=function(){return Sm;};return a9S();}const _=__importStar(require('lodash')),chalk_1=__importDefault(require(a9K(0x11f))),fs=__importStar(require('fs')),utils_1=require('./utils'),api_helpers_1=require(a9K(0x15a)),inquirer_pagination_prompt_1=require(a9K(0x12a)),inquirer=require(a9K(0xa4)),inquirerSearchList=require(a9K(0x96)),yaml=require('js-yaml');var ConfirmChoices;(function(S){const Z=a9K;S['YES']=Z(0x138),S[Z(0xd7)]=Z(0x170),S[Z(0x160)]=Z(0x171),S[Z(0x105)]=Z(0x140),S[Z(0x184)]=Z(0x89);}(ConfirmChoices||(ConfirmChoices={})));class InquirerHelper{constructor(S){const D=a9K;this[D(0x15f)]=S,this[D(0x115)]=0x32,this[D(0x129)]=a=>__awaiter(this,void 0x0,void 0x0,function*(){const e=D,{editedResult:j}=yield inquirer[e(0xbd)]([{'type':e(0x9a),'name':e(0x124),'message':e(0xff),'default':yaml['safeDump'](a)}]);return yaml[e(0xa8)](j);}),this[D(0xae)]=a=>__awaiter(this,void 0x0,void 0x0,function*(){const C=D,j=u=>C(0xee)+u+',\x20supported\x20types:\x20[json|yaml|yml]';function v(){return __awaiter(this,void 0x0,void 0x0,function*(){const q=a9a;return inquirer['prompt']([{'type':q(0x186),'name':q(0x144),'message':q(0xd4),'validate':u=>new RegExp(q(0x82))[q(0x130)](u)?!![]:j(u)}]);});}const {fileName:z}=yield v(),s=z[C(0x13b)]()['split']('.')[C(0xb7)]();try{switch(s){case'json':(0x0,utils_1['success'])(C(0x122)+z);return fs[C(0x7c)](z,JSON['stringify'](a,null,'\x20\x20'));case C(0xe5):case C(0xe1):(0x0,utils_1[C(0x158)])(C(0x122)+z);return fs[C(0x7c)](z,yaml['safeDump'](a));default:(0x0,utils_1['warning'])(j(s));}}catch(u){(0x0,utils_1['warning'])(C(0x133)+u[C(0x9c)]);}return undefined;}),this[D(0x107)]=(a,j)=>v=>{const b=D,z=typeof v===b(0x10b)?v[b(0x112)]():v;return j===![]&&z==='don\x27t\x20change'?'':z;},this[D(0x10e)]=(a,j,v)=>z=>{const O=D;if(this[O(0x113)]===!![])return!![];const s=[];if(z===''||z===O(0x15c)){if(j!==![])s['push'](O(0x9f));else return!![];}a[O(0x136)]==='string'&&!_['isUndefined'](a['pattern'])&&s[O(0x86)](new RegExp(a[O(0x93)])['test'](z)?!![]:O(0xa9)+a[O(0x93)]+'\x27');a['type']===O(0x10b)&&!_[O(0x14c)](a['minLength'])&&s[O(0x86)](z[O(0xa3)]>=a[O(0x7d)]?!![]:O(0x7f)+a['minLength']+O(0x7e)+z[O(0xa3)]+O(0xc9));a['type']===O(0x10b)&&!_['isUndefined'](a[O(0x134)])&&s['push'](z[O(0xa3)]<=a[O(0x134)]?!![]:O(0x92)+a['maxLength']+'\x20characters,\x20is\x20'+z['length']+O(0xc9));v&&Number['isNaN'](parseInt(z,0xa))&&s[O(0x86)](O(0xa5)+z);a[O(0x136)]===O(0xfa)&&!_[O(0x14c)](a[O(0x11e)])&&s['push'](z>=a[O(0x11e)]?!![]:O(0x8a)+a[O(0x11e)]);a[O(0x136)]===O(0xfa)&&!_[O(0x14c)](a[O(0x126)])&&s[O(0x86)](z<=a[O(0x126)]?!![]:'must\x20be\x20smaller\x20than\x20or\x20equal\x20to\x20'+a[O(0x126)]);if(a['type']===O(0x101)){const w=(0x0,utils_1['isValidJSON'])(z);s[O(0x86)](w===![]||_[O(0xe6)](w)?O(0x83):!![]);}const u=s[O(0x107)](i=>i!==!![]),g=(a===null||a===void 0x0?void 0x0:a[O(0xb9)])?'\x0a'+chalk_1[O(0xb6)][O(0xb1)]('>>')+'\x20Example:\x20'+chalk_1['default'][O(0xe0)](JSON[O(0xda)](a[O(0xb9)])):'';return u[O(0xa3)]>0x0?u['join'](chalk_1[O(0xb6)]['underline'](O(0xa0)))+g:!![];},this[D(0x8b)]=(a,j,v)=>{const B=D,z=a[a['length']-0x1];function s(){const h=a9a;return a['slice'](0x0,-0x1)[h(0x99)](w=>w['charAt'](0x0)[h(0x13d)]()+w[h(0x135)](0x1))[h(0x168)]('>');}const u=a[B(0xa3)]>0x1?chalk_1[B(0xb6)][B(0xc4)][B(0xe0)](s())+':\x20':'',g=v?'\x20('+chalk_1[B(0xb6)][B(0x9d)](v)+')':'';return chalk_1[B(0xb6)][B(0x164)](''+u+j+'\x20'+chalk_1[B(0xb6)]['bold'][B(0x148)](z)+g+'?');},this[D(0x17d)]=(a,j,v)=>__awaiter(this,void 0x0,void 0x0,function*(){const F=D;if(j[F(0xa3)]<0x1){const u=v?F(0xd0)+v:F(0x154);throw new Error(F(0x91)+a+'\x20'+u+'.');}const z=F(0xde)+a+F(0x114),s=j[F(0xa3)]>0x4?F(0x12d):F(0x176);return(yield inquirer[F(0xbd)]([{'type':s,'name':F(0x151),'message':z,'choices':j}]))['name'];}),this[D(0x155)]=(a,j,v)=>__awaiter(this,void 0x0,void 0x0,function*(){const P=D,{elements:z,nextCursor:s}=yield j();if(z['length']<0x1){const w=v?'for\x20this\x20'+v:'found';throw new Error(P(0x91)+a+'\x20'+w+'.');}const u=P(0xde)+a+P(0x114);if(s!==undefined){const i=({nextPageCursor:o})=>__awaiter(this,void 0x0,void 0x0,function*(){const m=P,X=yield j(o);return{'elements':X['elements'],'nextPageCursor':X[m(0x15e)]};});return(yield inquirer[P(0xbd)]([{'type':P(0x131),'name':P(0x151),'message':u,'choices':z,'nextPageCursor':s,'loadMore':i}]))[P(0x151)];}const g=z[P(0xa3)]>0x4?P(0x12d):P(0x176);return(yield inquirer[P(0xbd)]([{'type':g,'name':P(0x151),'message':u,'choices':z}]))[P(0x151)];}),this['askGeneric']=(a,j)=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const y=D,v=''+(j?'('+chalk_1[y(0xb6)][y(0x9d)](j)+')\x20':''),z='Enter\x20the\x20'+chalk_1['default'][y(0xfc)](a)+'\x20'+v+y(0xbf),s=this[y(0x10e)]({'type':'string','required':!![]});return(yield inquirer[y(0xbd)]([{'type':y(0x186),'name':y(0x151),'message':z,'validate':s}]))['name'];}),this[D(0x117)]=a=>__awaiter(this,void 0x0,void 0x0,function*(){const U=D;return(yield inquirer[U(0xbd)]([{'type':U(0x145),'name':U(0x151),'message':a,'default':!![]}]))[U(0x151)];}),this[D(0x80)]=a=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const W=D,j=v=>__awaiter(this,void 0x0,void 0x0,function*(){const J=a9a,z=yield this[J(0x15f)][J(0x176)][J(0xba)]['all']({'parameters':{'projectId':v}}),s=z[J(0xf1)][J(0xba)][J(0x99)](u=>u['id']);return s;});return this[W(0x139)](W(0x104),j,a);}),this[D(0x150)]=()=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const f=D,a=j=>__awaiter(this,void 0x0,void 0x0,function*(){const l=a9a;var v;const z=yield this[l(0x15f)][l(0x176)]['templates']({'options':{'per_page':this[l(0x115)],'cursor':j}}),s=z[l(0xf1)][l(0x9e)][l(0x99)](u=>u['id']);return{'elements':s,'nextCursor':(v=z['pagination'])===null||v===void 0x0?void 0x0:v[l(0x8d)]};});return this[f(0x155)]('template',a);}),this['askForTag']=()=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const r=D,a=j=>__awaiter(this,void 0x0,void 0x0,function*(){const I=a9a;var v,z,s;const u=yield this[I(0x15f)][I(0x176)][I(0x10f)]({'options':{'per_page':this[I(0x115)],'cursor':j}}),g=(z=(v=u[I(0xf1)][I(0x10f)])===null||v===void 0x0?void 0x0:v[I(0x99)](w=>w['id']))!==null&&z!==void 0x0?z:[];return{'elements':g,'nextCursor':(s=u[I(0x132)])===null||s===void 0x0?void 0x0:s[I(0x8d)]};});return this[r(0x155)](r(0xe4),a);}),this[D(0x8c)]=()=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const n=D;var a;const j=yield this['apiClient'][n(0x176)][n(0x81)][n(0x14e)]({}),v=(a=j[n(0xf1)][n(0x81)][n(0x99)](z=>z[n(0x151)]))!==null&&a!==void 0x0?a:[];return this[n(0x17d)]('backup\x20destination',v);}),this['askForClusterId']=()=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const p=D,a=j=>__awaiter(this,void 0x0,void 0x0,function*(){const k=a9a;var v,z,s;const u=yield this[k(0x15f)]['list'][k(0xe9)]['clusters']({'options':{'per_page':this[k(0x115)],'cursor':j}}),g=(z=(v=u[k(0xf1)][k(0xf8)])===null||v===void 0x0?void 0x0:v[k(0x99)](w=>w[k(0x151)]))!==null&&z!==void 0x0?z:[];return{'elements':g,'nextCursor':(s=u[k(0x132)])===null||s===void 0x0?void 0x0:s[k(0x8d)]};});return this[p(0x155)](p(0xec),a);}),this[D(0xf6)]=a=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const G=D;if(_[G(0x14c)](a))throw new Error(G(0xcf));const j=v=>__awaiter(this,void 0x0,void 0x0,function*(){const d=G;var z;let s=this[d(0x115)];const u=yield this[d(0x15f)]['list']['templateRuns']({'parameters':{'templateId':a},'options':{'per_page':s,'cursor':v}}),g=u['data']['templateRuns'][d(0x99)](w=>w['id']+d(0x172)+w[d(0x182)]+')');return{'elements':g,'nextCursor':(z=u[d(0x132)])===null||z===void 0x0?void 0x0:z[d(0x8d)]};});return this['askForResourcePaginated'](G(0x157),j)[G(0xd8)](v=>v[G(0x10a)]('\x20')[0x0]);}),this[D(0x16c)]=()=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const S0=D,a=j=>__awaiter(this,void 0x0,void 0x0,function*(){const t=a9a;var v;let z=this['defaultPaginationPageSize'];const s=yield this['apiClient']['list'][t(0x11a)]({'options':{'per_page':z,'cursor':j}}),u=s[t(0xf1)][t(0x11a)][t(0x99)](g=>g['id']);return{'elements':u,'nextCursor':(v=s['pagination'])===null||v===void 0x0?void 0x0:v[t(0x8d)]};});return this[S0(0x155)](S0(0x8e),a);}),this[D(0x146)]=a=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const S2=D,j=v=>__awaiter(this,void 0x0,void 0x0,function*(){const S1=a9a,z=yield this[S1(0x15f)][S1(0x176)]['pipelines'][S1(0x14e)]({'parameters':{'projectId':v}});return z[S1(0xf1)]['pipelines'][S1(0x99)](s=>s['id']);});return this[S2(0x139)](S2(0x13a),j,a);}),this[D(0x14f)]=a=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const j=v=>__awaiter(this,void 0x0,void 0x0,function*(){const S3=a9a,z=yield this[S3(0x15f)][S3(0x176)][S3(0xdd)][S3(0x14e)]({'parameters':{'projectId':v}}),s=z['data'][S3(0xdd)][S3(0x99)](u=>u['id']);return s;});return this['askForProjectScopedResource']('job',j,a);}),this['askForJobRun']=(a,j,v=![])=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const S4=D,z=S4(0x13e),s=u=>g=>__awaiter(this,void 0x0,void 0x0,function*(){const S5=S4;var w;const i=yield this[S5(0x15f)][S5(0x156)][S5(0xf0)][S5(0x10d)]({'parameters':{'projectId':u,'jobId':a},'options':{'per_page':this[S5(0x115)],'cursor':g}}),o=i[S5(0xf1)][S5(0x10d)][S5(0x99)](X=>X['id']+S5(0x172)+X[S5(0xcd)]+')');return v&&o['unshift'](z),{'elements':o,'nextCursor':(w=i[S5(0x132)])===null||w===void 0x0?void 0x0:w[S5(0x8d)]};});return this['askForProjectScopedResourcePaginated'](S4(0x103),s,j,S4(0xdc)+a+'\x27')[S4(0xd8)](u=>{const S6=S4,g=u[S6(0x10a)]('\x20')[0x0];if(g===z)return undefined;return g;});}),this[D(0x16d)]=(a,j,v,z=![])=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const S7=D,s=S7(0xcb);if(v!==undefined){const u=g=>w=>__awaiter(this,void 0x0,void 0x0,function*(){const S8=S7;var i;const o=yield this['apiClient'][S8(0x156)][S8(0xf0)][S8(0x179)]({'parameters':{'projectId':g,'jobId':v},'options':{'per_page':this[S8(0x115)],'cursor':w}}),X=o[S8(0xf1)][S8(0x179)][S8(0x99)](T=>T['id']+'\x20(startedAt:\x20'+T[S8(0x182)]+')');return z&&X[S8(0x109)](s),{'elements':X,'nextCursor':(i=o[S8(0x132)])===null||i===void 0x0?void 0x0:i[S8(0x8d)]};});return this[S7(0x17f)](S7(0xe3),u,a,S7(0xdc)+v+'\x27')['then'](g=>{const S9=S7,w=g[S9(0x10a)]('\x20')[0x0];if(w===s)return undefined;return w;});}if(j!==undefined){const g=w=>i=>__awaiter(this,void 0x0,void 0x0,function*(){const SS=S7;var o;const X=yield this['apiClient'][SS(0x156)][SS(0x104)][SS(0x179)]({'parameters':{'projectId':w,'serviceId':j},'options':{'per_page':this[SS(0x115)],'cursor':i}}),T=X[SS(0xf1)][SS(0x179)]['map'](H=>H['id']+SS(0x172)+H[SS(0x182)]+')');if(z)T[SS(0x109)](s);return{'elements':T,'nextCursor':(o=X[SS(0x132)])===null||o===void 0x0?void 0x0:o[SS(0x8d)]};});return this[S7(0x17f)](S7(0x108),g,a,'service:\x20\x27'+v+'\x27')[S7(0xd8)](w=>{const i=w['split']('\x20')[0x0];if(i===s)return undefined;return i;});}throw new Error('No\x20builds\x20found');}),this['askForContainer']=(a,j,v,z=![])=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const Sj=D,s='all-containers';if(v!==undefined){const u=g=>w=>__awaiter(this,void 0x0,void 0x0,function*(){const Sa=a9a;var i,o;const X=yield this[Sa(0x15f)][Sa(0x156)][Sa(0xf0)][Sa(0xbb)]({'parameters':{'projectId':g,'jobId':v},'options':{'per_page':this[Sa(0x115)],'cursor':w}}),T=(i=X[Sa(0xf1)]['containers'])!==null&&i!==void 0x0?i:[],H=T===null||T===void 0x0?void 0x0:T['map'](E=>E['name']+Sa(0x172)+E[Sa(0x182)]+')');return z&&H[Sa(0x109)](s),{'elements':H,'nextCursor':(o=X[Sa(0x132)])===null||o===void 0x0?void 0x0:o[Sa(0x8d)]};});return this[Sj(0x17f)](Sj(0xb5),u,a,Sj(0xdc)+v+'\x27')[Sj(0xd8)](g=>{const Sv=Sj,w=g[Sv(0x10a)]('\x20')[0x0];if(w===s)return undefined;return w;});}if(j!==undefined){const g=w=>i=>__awaiter(this,void 0x0,void 0x0,function*(){const Sz=Sj;var o,X;const T=yield this[Sz(0x15f)][Sz(0x156)]['service'][Sz(0xbb)]({'parameters':{'projectId':w,'serviceId':j},'options':{'per_page':this[Sz(0x115)],'cursor':i}}),H=(o=T[Sz(0xf1)]['containers'])!==null&&o!==void 0x0?o:[],E=H[Sz(0x99)](Y=>Y[Sz(0x151)]+Sz(0x172)+Y[Sz(0x182)]+')');if(z)E===null||E===void 0x0?void 0x0:E[Sz(0x109)](s);return{'elements':E,'nextCursor':(X=T[Sz(0x132)])===null||X===void 0x0?void 0x0:X[Sz(0x8d)]};});return this[Sj(0x17f)]('service\x20containers',g,a,Sj(0x119)+v+'\x27')[Sj(0xd8)](w=>{const Ss=Sj,i=w[Ss(0x10a)]('\x20')[0x0];if(i===s)return undefined;return i;});}throw new Error(Sj(0xd9));}),this[D(0x183)]=a=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const Sg=D,j=v=>__awaiter(this,void 0x0,void 0x0,function*(){const Su=a9a,z=yield this[Su(0x15f)][Su(0x176)]['addons'][Su(0x14e)]({'parameters':{'projectId':v}});return z['data'][Su(0x127)]['map'](s=>s['id']);});return this[Sg(0x139)](Sg(0xf9),j,a);}),this[D(0x11d)]=(a,j)=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const Si=D,v=z=>s=>__awaiter(this,void 0x0,void 0x0,function*(){const Sw=a9a;var u;const g=yield this[Sw(0x15f)][Sw(0x156)][Sw(0xf9)][Sw(0xfd)]({'parameters':{'projectId':z,'addonId':j},'options':{'per_page':this['defaultPaginationPageSize'],'cursor':s}});return{'elements':g[Sw(0xf1)]['backups'][Sw(0x99)](w=>w['id']+Sw(0x187)+(w[Sw(0x12e)]||Sw(0x149))+')'),'nextCursor':(u=g[Sw(0x132)])===null||u===void 0x0?void 0x0:u[Sw(0x8d)]};});return this[Si(0x17f)](Si(0xfd),v,a,Si(0x167)+j+'\x27')[Si(0xd8)](z=>z[Si(0x10a)]('\x20')[0x0]);}),this[D(0x95)]=(a,j,v)=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const SX=D,z=s=>u=>__awaiter(this,void 0x0,void 0x0,function*(){const So=a9a;var g;const w=yield this['apiClient'][So(0x156)][So(0xf9)]['backup']['restores']({'parameters':{'projectId':s,'addonId':j,'backupId':v},'options':{'per_page':this['defaultPaginationPageSize'],'cursor':u}});return{'elements':w[So(0xf1)][So(0x143)][So(0x99)](i=>i['id']+So(0x187)+(i['completedAt']||'not\x20completed')+')'),'nextCursor':(g=w[So(0x132)])===null||g===void 0x0?void 0x0:g['cursor']};});return this[SX(0x17f)]('restore',z,a,SX(0x167)+j+'\x27')[SX(0xd8)](s=>s[SX(0x10a)]('\x20')[0x0]);}),this[D(0x17a)]=a=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const SH=D,j=v=>__awaiter(this,void 0x0,void 0x0,function*(){const ST=a9a;return(yield this[ST(0x15f)]['list'][ST(0xb8)]({'parameters':{'projectId':v}}))[ST(0xf1)]['map'](z=>z['id']);});return this['askForProjectScopedResource'](SH(0xac),j,a);}),this[D(0xd3)]=a=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const SY=D,j=v=>__awaiter(this,void 0x0,void 0x0,function*(){const SE=a9a,z=yield this[SE(0x15f)][SE(0x176)][SE(0x13c)][SE(0x14e)]({'parameters':{'projectId':v}});return z[SE(0xf1)]['secrets'][SE(0x99)](s=>s['id']);});return this[SY(0x139)](SY(0xb2),j,a);}),this[D(0xb0)]=a=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const SV=D,j=yield this[SV(0x15f)]['get'][SV(0xed)]({'parameters':{'domain':a}}),v=j[SV(0xf1)][SV(0x14b)][SV(0x99)](s=>s[SV(0x151)]+SV(0xe2)+s[SV(0xe8)]+')'),z='domain\x20('+a+')';return this['askForResource'](SV(0xdf),v,z)['then'](s=>s[SV(0x10a)]('\x20')[0x0]);}),this['askForSubdomainPath']=(a,j)=>()=>__awaiter(this,void 0x0,void 0x0,function*(){const SK=D,v=yield this[SK(0x15f)][SK(0x176)][SK(0xdf)]['path']({'parameters':{'domain':a,'subdomain':j}}),z=v[SK(0xf1)][SK(0x141)][SK(0x99)](u=>''+u[SK(0x161)]),s='domain\x20('+a+'),\x20subdomain\x20('+j+')';return this[SK(0x17d)](SK(0x13f),z,s);}),this[D(0x125)]=a=>__awaiter(this,void 0x0,void 0x0,function*(){const SL=D;return(yield inquirer[SL(0xbd)]([{'type':SL(0x145),'name':SL(0x152),'message':chalk_1[SL(0xb6)][SL(0x16e)]('WARNING:\x20You\x20are\x20about\x20to\x20delete\x20'+(a||SL(0xe7))+SL(0xa1)),'default':![]}]))[SL(0x152)];}),this[D(0x159)]=(a,j)=>__awaiter(this,void 0x0,void 0x0,function*(){const SA=D;_[SA(0x14c)](a['name'])&&(j[SA(0xa3)]<=0x0?_['set'](a,SA(0x151),SA(0xb6)):yield(0x0,utils_1[SA(0xc0)])(0xa)(()=>__awaiter(this,void 0x0,void 0x0,function*(){const SQ=SA,{name:v}=yield inquirer['prompt']([{'type':'input','name':SQ(0x151),'message':SQ(0x8f),'default':'main-context'}]);if(!a[SQ(0xbe)]&&j['find'](z=>z[SQ(0x151)]===v)){const {c:z}=yield inquirer[SQ(0xbd)]([{'type':'confirm','name':'c','message':SQ(0xcc)+v+SQ(0x15b),'default':![]}]);if(z===![])throw new Error(SQ(0x174));_[SQ(0xc2)](a,'override',!![]);}_[SQ(0xc2)](a,SQ(0x151),v);})));if(_[SA(0x14c)](a[SA(0x102)])){const v=yield this[SA(0x14a)]();_[SA(0xc2)](a,'token',v);}return a;}),this[D(0x14a)]=()=>__awaiter(this,void 0x0,void 0x0,function*(){const SR=D,{token:a}=yield inquirer[SR(0xbd)]([{'type':SR(0x90),'name':SR(0x102),'mask':'*','message':SR(0x100)}]);return a;}),inquirer[D(0x118)]('search-list',inquirerSearchList),inquirer[D(0x118)](D(0x131),inquirer_pagination_prompt_1[D(0x85)]);}[a9K(0x153)](S,a){return __awaiter(this,void 0x0,void 0x0,function*(){const SM=a9a,j=yaml[SM(0x110)](S),v=_['max'](j['split']('\x0a')['map'](u=>u[SM(0xa3)])),z=chalk_1[SM(0xb6)]['grey']('-'[SM(0xb3)](v)+'\x0a'),{confirm:s}=yield inquirer['prompt']([{'type':SM(0x176),'name':SM(0x145),'message':''+chalk_1['default'][SM(0xd2)]['green'](SM(0xc7))+z+chalk_1[SM(0xb6)][SM(0x84)](j)+z,'choices':Object['values'](ConfirmChoices)}]);switch(s){case ConfirmChoices[SM(0x173)]:return S;case ConfirmChoices[SM(0x184)]:throw new Error('Aborted.');case ConfirmChoices[SM(0xd7)]:return this[SM(0xf5)](a);case ConfirmChoices['EDIT']:return this[SM(0x153)](yield this['editPayload'](S),a);case ConfirmChoices['SAVE']:yield this[SM(0xae)](S);return this['confirmationPrompt'](S,a);default:throw new Error(SM(0x137));}});}[a9K(0xf5)](S,a){return __awaiter(this,void 0x0,void 0x0,function*(){const Sx=a9a;if((a===null||a===void 0x0?void 0x0:a['resultCache'])!==undefined)this[Sx(0x87)]=a===null||a===void 0x0?void 0x0:a[Sx(0x87)];this[Sx(0x185)]=a===null||a===void 0x0?void 0x0:a[Sx(0x10c)],this[Sx(0x113)]=a===null||a===void 0x0?void 0x0:a[Sx(0x113)];const j={};return yield this['propToType']([],S[Sx(0x12b)][Sx(0xa7)],j),this[Sx(0x87)]=j,yield this[Sx(0x153)](j,S);});}[a9K(0xdb)](S,a,j,v){return __awaiter(this,void 0x0,void 0x0,function*(){const Sc=a9a;let z;if(a[Sc(0xc8)]&&!_[Sc(0x120)](a,Sc(0x11b))){if(a[Sc(0xc8)][Sc(0xa3)]>0x1){const {choice:s}=yield inquirer[Sc(0xbd)]([{'type':Sc(0x176),'name':Sc(0xef),'message':Sc(0xea)+(S[S[Sc(0xa3)]-0x1]||'')+Sc(0x14d),'choices':a['oneOf']['map'](u=>{const SN=Sc;var g;return(g=u[SN(0xce)])!==null&&g!==void 0x0?g:'??';})}]);z=yield this[Sc(0x116)](S,a[Sc(0xc8)]['find'](u=>u['description']===s),j,v);}else{const u=a[Sc(0xc8)][0x0];_[Sc(0xc2)](u,Sc(0xce),a[Sc(0xce)]),z=yield this[Sc(0x116)](S,u,j,v);}z={};}else{if(a['anyOf']&&!_[Sc(0x120)](a,Sc(0x11b))){if(a[Sc(0xd6)][Sc(0xa3)]>0x1){const {choice:g}=yield inquirer['prompt']([{'type':Sc(0x176),'name':Sc(0xef),'message':Sc(0xea)+(S[S[Sc(0xa3)]-0x1]||'')+Sc(0x14d),'choices':[...a[Sc(0xd6)][Sc(0x99)](w=>{const SZ=Sc;var i;return(i=w[SZ(0xce)])!==null&&i!==void 0x0?i:'??';}),'don\x27t\x20change']}]);g!==Sc(0x15c)&&(z=yield this['getType'](S,a[Sc(0xd6)]['find'](w=>w[Sc(0xce)]===g),j,v));}else{const w=a[Sc(0xd6)][0x0];_[Sc(0xc2)](w,Sc(0xce),a[Sc(0xce)]),z=yield this[Sc(0x116)](S,w,j,v);}z={};}else z=yield this[Sc(0x116)](S,a,j,v);}return z;});}['getInnerType'](S,a,j,v){var z;return __awaiter(this,void 0x0,void 0x0,function*(){const SD=a9a;if(v===![]){const {addEntry:g}=yield inquirer[SD(0xbd)]([{'type':'confirm','name':'addEntry','message':this[SD(0x8b)](a,SD(0x147),S===null||S===void 0x0?void 0x0:S[SD(0xce)]),'default':![]}]);if(!g)return j;}const s=Object[SD(0xc3)]((z=S===null||S===void 0x0?void 0x0:S['properties'])!==null&&z!==void 0x0?z:[]),u=S[SD(0x163)]||[];if(s['length']>0x0)for(const w of s){const i=a[SD(0xf2)](w);if(a[SD(0xa3)]>0x0&&!_[SD(0x120)](j,a[SD(0x168)]('.')))_['set'](j,a[SD(0x168)]('.'),{});yield this[SD(0xdb)](i,S[SD(0x11b)][w],j,u[SD(0xa2)](w));}else yield this[SD(0x116)](a,Object[SD(0x123)](Object[SD(0x123)]({},S),{'type':SD(0x101)}),j,v);return j;});}[a9K(0x128)](S,a,j,v){return __awaiter(this,void 0x0,void 0x0,function*(){const Se=a9a;if(a&&j)return!![];const z=a?Se(0x147):Se(0x181),{addEntry:s}=yield inquirer[Se(0xbd)]([{'type':Se(0x145),'name':Se(0x175),'message':this[Se(0x8b)](S,z,a?v:undefined),'default':![]}]);return s;});}[a9K(0x116)](S,a,j,v){return __awaiter(this,void 0x0,void 0x0,function*(){const SC=a9a;let z;const s=S[SC(0x168)]('.');switch(a===null||a===void 0x0?void 0x0:a[SC(0x136)]){case SC(0xfe):{let u=!![];while(yield this[SC(0x128)](S,u,v,a===null||a===void 0x0?void 0x0:a[SC(0xce)])){const g=_['get'](j,s);_[SC(0x177)](j,s),yield this[SC(0x116)](S,a['items'],j);const w=_[SC(0x156)](j,s);!_['isArray'](g)?_[SC(0xc2)](j,s,[w]):(g[SC(0x86)](w),_['set'](j,s,g)),u=![];}return z||[];}case SC(0xf4):{return z=yield this[SC(0xaf)](a,S,j,v),z;}case SC(0x101):z=(0x0,utils_1['isValidJSON'])(yield this[SC(0xc5)](S,a,v))||undefined;break;case SC(0x10b):case'boolean':case SC(0xfa):default:z=yield this[SC(0xc5)](S,a,v,j);break;}return!_[SC(0x14c)](z)&&_['set'](j,s,z),z;});}[a9K(0xc5)](S,a,j,v){var z;return __awaiter(this,void 0x0,void 0x0,function*(){const Sq=a9a,s=S[S['length']-0x1],{defaultValue:defaultValue=(z=a===null||a===void 0x0?void 0x0:a[Sq(0xb9)])!==null&&z!==void 0x0?z:a===null||a===void 0x0?void 0x0:a[Sq(0xb6)],choices:choices=a===null||a===void 0x0?void 0x0:a['enum'],pagination:u}=yield(0x0,api_helpers_1['fetchResourceList'])(s,this['apiClient'],this[Sq(0x185)],v,this[Sq(0x88)],S);let g=Sq(0x186);if(!_['isUndefined'](choices)&&choices['length']>0x0){if(u!==undefined&&u[Sq(0x16f)]!==undefined)g='pagination-prompt';else choices[Sq(0xa3)]>0x4&&typeof choices[0x0]==='string'?g='search-list':g=Sq(0x176);}else{if((a===null||a===void 0x0?void 0x0:a['type'])===Sq(0x169))g=Sq(0x145);else{if((a===null||a===void 0x0?void 0x0:a[Sq(0x136)])===Sq(0xfa))g=Sq(0x186);else(a===null||a===void 0x0?void 0x0:a[Sq(0x136)])===Sq(0x101)&&(g=Sq(0x9a));}}let w=j!==![]?!_[Sq(0x142)](defaultValue)?defaultValue:JSON[Sq(0xda)](defaultValue):_[Sq(0xca)](defaultValue)?defaultValue:'don\x27t\x20change';if(choices)w=w['toString']();_[Sq(0x120)](this[Sq(0x87)],S[Sq(0x168)]('.'))&&(w=this[Sq(0x87)][S[Sq(0x168)]('.')]);const i=choices&&j===![]?[Sq(0x15c),...choices]:choices,o=(a===null||a===void 0x0?void 0x0:a['type'])===Sq(0xfa),X=Object[Sq(0x123)]({'type':g,'name':'id','message':this['getQuestionString'](S,a),'choices':i,'default':w,'filter':this['filter'](g,j),'validate':this['validate'](a,j,o)},u),T=(yield inquirer[Sq(0xbd)]([X]))['id'];if(T===Sq(0x15c)||T==='')return undefined;if(o)return parseInt(T,0xa);return T;});}[a9K(0x106)](S,a){const Sb=a9K,j=(a===null||a===void 0x0?void 0x0:a[Sb(0x136)])!==Sb(0x169)?Sb(0x98):'Should\x20it\x20be';return this[Sb(0x8b)](S,j,a===null||a===void 0x0?void 0x0:a['description']);}[a9K(0xc1)](){return __awaiter(this,void 0x0,void 0x0,function*(){const SO=a9a,S=yield this['apiClient']['list'][SO(0x17b)][SO(0x14e)]({})[SO(0xd8)](a=>a['data'][SO(0x17b)][SO(0x99)](j=>j['id']));return yield this[SO(0x17d)](SO(0xf7),S);});}[a9K(0x139)](S,a,j,v){return __awaiter(this,void 0x0,void 0x0,function*(){const Sh=a9a,z=j||this['apiClient']['contextProvider']['getCurrentProjectName']();if(_['isUndefined'](z))throw new Error('Default\x20project\x20in\x20context\x20not\x20set\x20and\x20no\x20argument\x20provided.');const s=yield a(z);return yield this[Sh(0x17d)](S,s,(v?v+Sh(0x79):'')+Sh(0x111)+z+'\x27');});}[a9K(0x17f)](S,a,j,v){return __awaiter(this,void 0x0,void 0x0,function*(){const SB=a9a,z=j||this['apiClient'][SB(0xa6)][SB(0xb4)]();if(_[SB(0x14c)](z))throw new Error(SB(0x166));const s=yield a(z);return yield this[SB(0x155)](S,s,(v?v+SB(0x79):'')+SB(0x111)+z+'\x27');});}['askForDomain'](){return __awaiter(this,void 0x0,void 0x0,function*(){const SF=a9a,S=yield this['apiClient'][SF(0x176)][SF(0xab)][SF(0x14e)]({}),a=S[SF(0xf1)]['domains'][SF(0x99)](j=>j[SF(0x151)]);return this[SF(0x17d)](SF(0xed),a);});}[a9K(0x17c)](){return __awaiter(this,void 0x0,void 0x0,function*(){const SP=a9a,S=yield this[SP(0x15f)][SP(0x176)][SP(0x178)][SP(0x14e)]({}),a=S[SP(0xf1)][SP(0x77)]['map'](j=>j['id']);return this[SP(0x17d)](SP(0x77),a);});}[a9K(0x162)](S){this['pathVars']=S;}}exports['InquirerHelper']=InquirerHelper;