UNPKG

@northflank/cli

Version:

Provides a command-line interface to the Northflank platform.

1 lines 8.59 kB
'use strict';const a0S3=a0a;(function(S,a){const S2=a0a,j=S();while(!![]){try{const v=-parseInt(S2(0x73))/0x1+-parseInt(S2(0xa8))/0x2*(parseInt(S2(0xa1))/0x3)+-parseInt(S2(0x8d))/0x4*(parseInt(S2(0x7a))/0x5)+-parseInt(S2(0x90))/0x6*(-parseInt(S2(0x94))/0x7)+-parseInt(S2(0x85))/0x8+-parseInt(S2(0xa4))/0x9+parseInt(S2(0x87))/0xa*(parseInt(S2(0x79))/0xb);if(v===a)break;else j['push'](j['shift']());}catch(z){j['push'](j['shift']());}}}(a0S,0x589a5));var __awaiter=this&&this[a0S3(0x88)]||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 S6=a0a;function g(o){try{i(v['next'](o));}catch(X){u(X);}}function w(o){const S4=a0a;try{i(v[S4(0x8c)](o));}catch(X){u(X);}}function i(o){const S5=a0a;o[S5(0x7c)]?s(o[S5(0x8a)]):z(o[S5(0x8a)])[S5(0xa6)](g,w);}i((v=v[S6(0xac)](S,a||[]))['next']());});};function a0a(S,a){const j=a0S();return a0a=function(v,z){v=v-0x6e;let s=j[v];return s;},a0a(S,a);}Object[a0S3(0x7b)](exports,a0S3(0xa9),{'value':!![]}),exports[a0S3(0x98)]=void 0x0;function a0S(){const Ss=['owningObject','addonId','length','addonDependencies','options','map','templates','30399JqgYcj','addons','credentials','4531869nCItlc','secrets','then','join','118vZEddw','__esModule','services','get','apply','regions','projects','pagination','default','logSink','replicas','secretLink','addonTypes','types','includes','206936eemJgB','projectId','latest','backups','data','cursor','2849anBOFX','40tOPyOM','defineProperty','done','registryCredentials','version','keys','warning','envs','list','nextPageCursor','addon','297464pcAmBR','type','70020ypccrb','__awaiter','templateId','value','resources','throw','294924jDrWom','deploymentPlan','./utils','1454262MUertJ','internalId','secret','serviceId','14cJIxVv','plans','source','keyName','fetchResourceList','region'];a0S=function(){return Ss;};return a0S();}const utils_1=require(a0S3(0x8f)),defaultPaginationPageSize=0x64,getProjects=S=>a=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const S7=a0S3;var j;const v=yield S[S7(0x82)][S7(0xae)]({'options':{'per_page':defaultPaginationPageSize,'cursor':a===null||a===void 0x0?void 0x0:a[S7(0x83)]}});return{'elements':v[S7(0x77)][S7(0xae)]['map'](z=>z['id']),'nextPageCursor':(j=v['pagination'])===null||j===void 0x0?void 0x0:j[S7(0x78)]};}),getServices=(S,a)=>j=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const S8=a0S3;var v;const z=yield S[S8(0x82)][S8(0xaa)]({'parameters':{'projectId':a},'options':{'per_page':defaultPaginationPageSize,'cursor':j===null||j===void 0x0?void 0x0:j['nextPageCursor']}});return{'elements':z['data']['services']['map'](s=>s['id']),'nextPageCursor':(v=z[S8(0xaf)])===null||v===void 0x0?void 0x0:v['cursor']};}),getAddons=(S,a)=>j=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const S9=a0S3;var v;const z=yield S[S9(0x82)][S9(0xa2)]({'parameters':{'projectId':a},'options':{'per_page':defaultPaginationPageSize,'cursor':j===null||j===void 0x0?void 0x0:j[S9(0x83)]}});return{'elements':z[S9(0x77)][S9(0xa2)]['map'](s=>s['id']),'nextPageCursor':(v=z['pagination'])===null||v===void 0x0?void 0x0:v[S9(0x78)]};}),getAddonBackups=(S,a,j)=>v=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const SS=a0S3;var z;const s=yield S['get'][SS(0x84)]['backups']({'parameters':{'projectId':a,'addonId':j},'options':{'per_page':defaultPaginationPageSize,'cursor':v===null||v===void 0x0?void 0x0:v[SS(0x83)]}});return{'elements':s[SS(0x77)][SS(0x76)][SS(0x9f)](u=>u['id']),'nextPageCursor':(z=s[SS(0xaf)])===null||z===void 0x0?void 0x0:z[SS(0x78)]};});function fetchResourceList(S,a,j,v,z,s){var u,g,w,i,o,X,T,H,E,Y,V,K;return __awaiter(this,void 0x0,void 0x0,function*(){const Sa=a0a,L=undefined;try{if(S===Sa(0x8e)){const x=yield a[Sa(0x82)][Sa(0x95)]({}),c=x[Sa(0x77)]['plans']['map'](N=>{const Sj=Sa;var Z;return(Z=N===null||N===void 0x0?void 0x0:N[Sj(0x91)])!==null&&Z!==void 0x0?Z:N===null||N===void 0x0?void 0x0:N['id'];});return{'choices':c,'defaultValue':L};}if(S===Sa(0x99)&&!(j===null||j===void 0x0?void 0x0:j[Sa(0x72)](Sa(0xb1)))){const N=yield a[Sa(0x82)][Sa(0xad)]({}),Z=N[Sa(0x77)][Sa(0xad)][Sa(0x9f)](D=>{const Sv=Sa;var C;return(C=D===null||D===void 0x0?void 0x0:D[Sv(0x91)])!==null&&C!==void 0x0?C:D===null||D===void 0x0?void 0x0:D['id'];});return{'choices':Z,'defaultValue':L};}if(S===Sa(0x74)){const D=yield getProjects(a),{elements:C,nextPageCursor:q}=yield D();return{'choices':C,'defaultValue':L,'pagination':{'nextPageCursor':q,'loadMore':D}};}if(S==='credentials'){const b=yield a['list'][Sa(0x7d)]({}),O=b['data'][Sa(0xa3)][Sa(0x9f)](h=>h['id']);return{'choices':O,'defaultValue':L};}const A=z===null||z===void 0x0?void 0x0:z[Sa(0x74)],Q=S===Sa(0x93)||S==='id'&&(s===null||s===void 0x0?void 0x0:s[Sa(0x72)](Sa(0x9a)));if(A!==undefined&&Q){const h=yield getServices(a,A),{elements:B,nextPageCursor:F}=yield h();return{'choices':B,'defaultValue':L,'pagination':{'nextPageCursor':F,'loadMore':h}};}const R=j===null||j===void 0x0?void 0x0:j[Sa(0x72)](Sa(0x84));if(R){const P=m=>__awaiter(this,void 0x0,void 0x0,function*(){const Sz=Sa;var y;const U=yield a['get'][Sz(0x84)]['types']({});return(y=U[Sz(0x77)]['addonTypes'])===null||y===void 0x0?void 0x0:y[Sz(0x9f)](J=>J[Sz(0x86)])['find'](J=>J[Sz(0x86)]===m);});if(S==='type'){const m=yield a[Sa(0xab)][Sa(0x84)][Sa(0x71)]({}),y=(u=m[Sa(0x77)][Sa(0x70)])===null||u===void 0x0?void 0x0:u['map'](U=>U[Sa(0x86)]);return{'choices':y,'defaultValue':L};}if(S==='version'&&(v===null||v===void 0x0?void 0x0:v['type'])!==undefined){const U=(g=yield P(v['type']))===null||g===void 0x0?void 0x0:g['versions'],J=U!==undefined?[Sa(0x75),...U]:undefined;return{'choices':J,'defaultValue':L};}if(S==='storage'&&(v===null||v===void 0x0?void 0x0:v['type'])!==undefined){const W=(i=(w=yield P(v[Sa(0x86)]))===null||w===void 0x0?void 0x0:w[Sa(0x8b)])===null||i===void 0x0?void 0x0:i['storage'];return{'choices':W===null||W===void 0x0?void 0x0:W[Sa(0x9e)],'defaultValue':W===null||W===void 0x0?void 0x0:W[Sa(0xb0)]};}if(S==='replicas'&&(v===null||v===void 0x0?void 0x0:v[Sa(0x86)])!==undefined){const l=(X=(o=yield P(v[Sa(0x86)]))===null||o===void 0x0?void 0x0:o[Sa(0x8b)])===null||X===void 0x0?void 0x0:X[Sa(0x6e)];return{'choices':l===null||l===void 0x0?void 0x0:l[Sa(0x9e)],'defaultValue':l===null||l===void 0x0?void 0x0:l['default']};}}if(S===Sa(0x9b)&&(z===null||z===void 0x0?void 0x0:z['projectId'])!==undefined){const f=yield getAddons(a,z===null||z===void 0x0?void 0x0:z['projectId']),{elements:I,nextPageCursor:r}=yield f();return{'choices':I,'defaultValue':L,'pagination':{'nextPageCursor':r,'loadMore':f}};}if(S==='backupId'&&(z===null||z===void 0x0?void 0x0:z[Sa(0x74)])!==undefined&&((T=v===null||v===void 0x0?void 0x0:v[Sa(0x96)])===null||T===void 0x0?void 0x0:T['addonId'])!==undefined){const n=yield getAddonBackups(a,z===null||z===void 0x0?void 0x0:z[Sa(0x74)],(H=v===null||v===void 0x0?void 0x0:v[Sa(0x96)])===null||H===void 0x0?void 0x0:H['addonId']),{elements:k,nextPageCursor:p}=yield n();return{'choices':k,'defaultValue':L,'pagination':{'nextPageCursor':p,'loadMore':n}};}const M=(E=z===null||z===void 0x0?void 0x0:z[Sa(0x9b)])!==null&&E!==void 0x0?E:(Y=v===null||v===void 0x0?void 0x0:v[Sa(0x9d)])===null||Y===void 0x0?void 0x0:Y[Sa(0x9b)];if((j===null||j===void 0x0?void 0x0:j[Sa(0xa7)](''))==='updateaddonversion'&&S===Sa(0x7e)&&(z===null||z===void 0x0?void 0x0:z[Sa(0x74)])!==undefined&&M!==undefined){const {upgradeTo:G}=(yield a[Sa(0xab)]['addon']['version']({'parameters':{'addonId':M,'projectId':z===null||z===void 0x0?void 0x0:z[Sa(0x74)]}}))[Sa(0x77)];if(G===undefined||G[Sa(0x9c)]<=0x0){(0x0,utils_1[Sa(0x80)])('No\x20available\x20versions\x20to\x20upgrade\x20to.');throw new Error();}return{'choices':G['map'](d=>d[Sa(0x7e)]),'defaultValue':L};}if(S===Sa(0x89)){const d=yield a['list'][Sa(0xa0)]({}),t=d[Sa(0x77)]['templates'][Sa(0x9f)](S0=>S0===null||S0===void 0x0?void 0x0:S0['id']);return{'choices':t,'defaultValue':L};}if(((j===null||j===void 0x0?void 0x0:j[Sa(0x72)](Sa(0x6f)))||(j===null||j===void 0x0?void 0x0:j['includes'](Sa(0x92))))&&S===Sa(0x97)&&M!==undefined&&(z===null||z===void 0x0?void 0x0:z[Sa(0x74)])!==undefined){const S0=(yield a[Sa(0xab)][Sa(0x84)]['credentials']({'parameters':{'addonId':M,'projectId':z===null||z===void 0x0?void 0x0:z['projectId']}}))['data'];return{'choices':[...(V=Object[Sa(0x7f)](S0===null||S0===void 0x0?void 0x0:S0[Sa(0x81)]))!==null&&V!==void 0x0?V:[],...(K=Object[Sa(0x7f)](S0===null||S0===void 0x0?void 0x0:S0[Sa(0xa5)]))!==null&&K!==void 0x0?K:[]]};}}catch(S1){}return{'choices':undefined,'defaultValue':L};});}exports[a0S3(0x98)]=fetchResourceList;