UNPKG

@northflank/cli

Version:

Provides a command-line interface to the Northflank platform.

1 lines 8.55 kB
'use strict';const a0Z3=a0K;(function(Z,K){const Z2=a0K,O=Z();while(!![]){try{const g=-parseInt(Z2(0xd4))/0x1*(-parseInt(Z2(0xc8))/0x2)+-parseInt(Z2(0xc7))/0x3+-parseInt(Z2(0x9c))/0x4*(-parseInt(Z2(0xd9))/0x5)+-parseInt(Z2(0xba))/0x6+parseInt(Z2(0xbf))/0x7+parseInt(Z2(0xc3))/0x8+parseInt(Z2(0xcd))/0x9*(-parseInt(Z2(0xc0))/0xa);if(g===K)break;else O['push'](O['shift']());}catch(N){O['push'](O['shift']());}}}(a0Z,0x9239e));function a0K(Z,K){const O=a0Z();return a0K=function(g,N){g=g-0x9c;let H=O[g];return H;},a0K(Z,K);}var __awaiter=this&&this[a0Z3(0xbd)]||function(Z,K,O,g){function N(H){return H instanceof O?H:new O(function(o){o(H);});}return new(O||(O=Promise))(function(H,o){function s(W){const Z4=a0K;try{y(g[Z4(0x9f)](W));}catch(B){o(B);}}function R(W){const Z5=a0K;try{y(g[Z5(0xd0)](W));}catch(B){o(B);}}function y(W){const Z6=a0K;W[Z6(0xd7)]?H(W[Z6(0xda)]):N(W[Z6(0xda)])[Z6(0xbb)](s,R);}y((g=g['apply'](Z,K||[]))['next']());});};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['fetchResourceList']=void 0x0;const utils_1=require(a0Z3(0x9d)),defaultPaginationPageSize=0x64,getProjects=Z=>K=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z7=a0Z3;var O;const g=yield Z[Z7(0xa5)][Z7(0xb2)]({'options':{'per_page':defaultPaginationPageSize,'cursor':K===null||K===void 0x0?void 0x0:K['nextPageCursor']}});return{'elements':g['data']['projects']['map'](N=>N['id']),'nextPageCursor':(O=g['pagination'])===null||O===void 0x0?void 0x0:O[Z7(0xd5)]};}),getServices=(Z,K)=>O=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z8=a0Z3;var g;const N=yield Z[Z8(0xa5)]['services']({'parameters':{'projectId':K},'options':{'per_page':defaultPaginationPageSize,'cursor':O===null||O===void 0x0?void 0x0:O[Z8(0xb7)]}});return{'elements':N[Z8(0xae)]['services'][Z8(0xdc)](H=>H['id']),'nextPageCursor':(g=N[Z8(0xa7)])===null||g===void 0x0?void 0x0:g[Z8(0xd5)]};}),getAddons=(Z,K)=>O=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const Z9=a0Z3;var g;const N=yield Z[Z9(0xa5)][Z9(0xa9)]({'parameters':{'projectId':K},'options':{'per_page':defaultPaginationPageSize,'cursor':O===null||O===void 0x0?void 0x0:O[Z9(0xb7)]}});return{'elements':N[Z9(0xae)][Z9(0xa9)][Z9(0xdc)](H=>H['id']),'nextPageCursor':(g=N[Z9(0xa7)])===null||g===void 0x0?void 0x0:g[Z9(0xd5)]};}),getAddonBackups=(Z,K,O)=>g=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const ZZ=a0Z3;var N;const H=yield Z[ZZ(0xad)]['addon']['backups']({'parameters':{'projectId':K,'addonId':O},'options':{'per_page':defaultPaginationPageSize,'cursor':g===null||g===void 0x0?void 0x0:g[ZZ(0xb7)]}});return{'elements':H[ZZ(0xae)][ZZ(0xb4)][ZZ(0xdc)](o=>o['id']),'nextPageCursor':(N=H[ZZ(0xa7)])===null||N===void 0x0?void 0x0:N[ZZ(0xd5)]};});function fetchResourceList(Z,K,O,g,N,H){var o,s,R,y,W,B,V,M,I,c,E,p;return __awaiter(this,void 0x0,void 0x0,function*(){const ZK=a0K,T=undefined;try{if(Z===ZK(0xc2)){const C=yield K[ZK(0xa5)][ZK(0xca)]({}),S=C[ZK(0xae)][ZK(0xca)][ZK(0xdc)](n=>{const ZO=ZK;var k;return(k=n===null||n===void 0x0?void 0x0:n[ZO(0xd2)])!==null&&k!==void 0x0?k:n===null||n===void 0x0?void 0x0:n['id'];});return{'choices':S,'defaultValue':T};}if(Z===ZK(0xa1)&&!(O===null||O===void 0x0?void 0x0:O[ZK(0xaf)](ZK(0xb1)))){const n=yield K[ZK(0xa5)][ZK(0x9e)]({}),k=n[ZK(0xae)]['regions'][ZK(0xdc)](x=>{const Zg=ZK;var m;return(m=x===null||x===void 0x0?void 0x0:x[Zg(0xd2)])!==null&&m!==void 0x0?m:x===null||x===void 0x0?void 0x0:x['id'];});return{'choices':k,'defaultValue':T};}if(Z===ZK(0xa3)){const x=yield getProjects(K),{elements:m,nextPageCursor:r}=yield x();return{'choices':m,'defaultValue':T,'pagination':{'nextPageCursor':r,'loadMore':x}};}if(Z===ZK(0xab)){const D=yield K[ZK(0xa5)][ZK(0xa2)]({}),d=D['data'][ZK(0xab)][ZK(0xdc)](b=>b['id']);return{'choices':d,'defaultValue':T};}const J=N===null||N===void 0x0?void 0x0:N[ZK(0xa3)],q=Z===ZK(0xb8)||Z==='id'&&(H===null||H===void 0x0?void 0x0:H[ZK(0xaf)](ZK(0xc1)));if(J!==undefined&&q){const b=yield getServices(K,J),{elements:l,nextPageCursor:f}=yield b();return{'choices':l,'defaultValue':T,'pagination':{'nextPageCursor':f,'loadMore':b}};}const Y=O===null||O===void 0x0?void 0x0:O[ZK(0xaf)](ZK(0xdb));if(Y){const a=v=>__awaiter(this,void 0x0,void 0x0,function*(){const ZN=ZK;var L;const X=yield K[ZN(0xad)][ZN(0xdb)][ZN(0xc4)]({});return(L=X['data'][ZN(0xce)])===null||L===void 0x0?void 0x0:L['map'](U=>U[ZN(0xa8)])['find'](U=>U['type']===v);});if(Z===ZK(0xa8)){const v=yield K[ZK(0xad)]['addon']['types']({}),L=(o=v['data'][ZK(0xce)])===null||o===void 0x0?void 0x0:o[ZK(0xdc)](X=>X[ZK(0xa8)]);return{'choices':L,'defaultValue':T};}if(Z==='version'&&(g===null||g===void 0x0?void 0x0:g[ZK(0xa8)])!==undefined){const X=(s=yield a(g[ZK(0xa8)]))===null||s===void 0x0?void 0x0:s[ZK(0xcf)],U=X!==undefined?[ZK(0xb3),...X]:undefined;return{'choices':U,'defaultValue':T};}if(Z===ZK(0xac)&&(g===null||g===void 0x0?void 0x0:g['type'])!==undefined){const i=(y=(R=yield a(g['type']))===null||R===void 0x0?void 0x0:R[ZK(0xa6)])===null||y===void 0x0?void 0x0:y[ZK(0xac)];return{'choices':i===null||i===void 0x0?void 0x0:i[ZK(0xaa)],'defaultValue':i===null||i===void 0x0?void 0x0:i[ZK(0xd1)]};}if(Z===ZK(0xc6)&&(g===null||g===void 0x0?void 0x0:g[ZK(0xa8)])!==undefined){const z=(B=(W=yield a(g[ZK(0xa8)]))===null||W===void 0x0?void 0x0:W['resources'])===null||B===void 0x0?void 0x0:B['replicas'];return{'choices':z===null||z===void 0x0?void 0x0:z['options'],'defaultValue':z===null||z===void 0x0?void 0x0:z[ZK(0xd1)]};}}if(Z===ZK(0xb9)&&(N===null||N===void 0x0?void 0x0:N['projectId'])!==undefined){const j=yield getAddons(K,N===null||N===void 0x0?void 0x0:N[ZK(0xa3)]),{elements:G,nextPageCursor:w}=yield j();return{'choices':G,'defaultValue':T,'pagination':{'nextPageCursor':w,'loadMore':j}};}if(Z===ZK(0xb6)&&(N===null||N===void 0x0?void 0x0:N[ZK(0xa3)])!==undefined&&((V=g===null||g===void 0x0?void 0x0:g[ZK(0xd3)])===null||V===void 0x0?void 0x0:V[ZK(0xb9)])!==undefined){const Q=yield getAddonBackups(K,N===null||N===void 0x0?void 0x0:N['projectId'],(M=g===null||g===void 0x0?void 0x0:g['source'])===null||M===void 0x0?void 0x0:M[ZK(0xb9)]),{elements:u,nextPageCursor:F}=yield Q();return{'choices':u,'defaultValue':T,'pagination':{'nextPageCursor':F,'loadMore':Q}};}const P=(I=N===null||N===void 0x0?void 0x0:N[ZK(0xb9)])!==null&&I!==void 0x0?I:(c=g===null||g===void 0x0?void 0x0:g[ZK(0xb0)])===null||c===void 0x0?void 0x0:c['addonId'];if((O===null||O===void 0x0?void 0x0:O[ZK(0xcb)](''))===ZK(0xc9)&&Z===ZK(0xcc)&&(N===null||N===void 0x0?void 0x0:N['projectId'])!==undefined&&P!==undefined){const {upgradeTo:A}=(yield K[ZK(0xad)][ZK(0xdb)]['version']({'parameters':{'addonId':P,'projectId':N===null||N===void 0x0?void 0x0:N[ZK(0xa3)]}}))[ZK(0xae)];if(A===undefined||A['length']<=0x0){(0x0,utils_1['warning'])('No\x20available\x20versions\x20to\x20upgrade\x20to.');throw new Error();}return{'choices':A['map'](h=>h[ZK(0xcc)]),'defaultValue':T};}if(Z===ZK(0xd8)){const h=yield K[ZK(0xa5)][ZK(0xc5)]({}),t=h[ZK(0xae)]['templates']['map'](Z0=>Z0===null||Z0===void 0x0?void 0x0:Z0['id']);return{'choices':t,'defaultValue':T};}if(((O===null||O===void 0x0?void 0x0:O[ZK(0xaf)]('secretLink'))||(O===null||O===void 0x0?void 0x0:O['includes'](ZK(0xd6))))&&Z===ZK(0xbe)&&P!==undefined&&(N===null||N===void 0x0?void 0x0:N['projectId'])!==undefined){const Z0=(yield K[ZK(0xad)][ZK(0xdb)]['credentials']({'parameters':{'addonId':P,'projectId':N===null||N===void 0x0?void 0x0:N['projectId']}}))[ZK(0xae)];return{'choices':[...(E=Object[ZK(0xbc)](Z0===null||Z0===void 0x0?void 0x0:Z0[ZK(0xa4)]))!==null&&E!==void 0x0?E:[],...(p=Object[ZK(0xbc)](Z0===null||Z0===void 0x0?void 0x0:Z0[ZK(0xb5)]))!==null&&p!==void 0x0?p:[]]};}}catch(Z1){}return{'choices':undefined,'defaultValue':T};});}function a0Z(){const ZH=['replicas','2457822QawYDc','2778BHZOfO','updateaddonversion','plans','join','version','6633XZUrqk','addonTypes','versions','throw','default','internalId','source','535pQqjDr','cursor','secret','done','templateId','167665LNXMPw','value','addon','map','88WBRCIV','./utils','regions','next','fetchResourceList','region','registryCredentials','projectId','envs','list','resources','pagination','type','addons','options','credentials','storage','get','data','includes','addonDependencies','logSink','projects','latest','backups','secrets','backupId','nextPageCursor','serviceId','addonId','1485882ZqSOwP','then','keys','__awaiter','keyName','869442rDfSXx','4410qrWsmY','owningObject','deploymentPlan','3086664CDkdna','types','templates'];a0Z=function(){return ZH;};return a0Z();}exports[a0Z3(0xa0)]=fetchResourceList;