@northflank/cli
Version:
Provides a command-line interface to the Northflank platform.
1 lines • 8.61 kB
JavaScript
'use strict';const a0I3=a0B;(function(I,B){const I2=a0B,J=I();while(!![]){try{const C=-parseInt(I2(0x89))/0x1*(parseInt(I2(0xae))/0x2)+parseInt(I2(0x8e))/0x3*(parseInt(I2(0x71))/0x4)+-parseInt(I2(0xa1))/0x5*(parseInt(I2(0x7c))/0x6)+-parseInt(I2(0x8d))/0x7*(parseInt(I2(0x8a))/0x8)+-parseInt(I2(0x91))/0x9*(parseInt(I2(0x96))/0xa)+-parseInt(I2(0xa4))/0xb+parseInt(I2(0x94))/0xc;if(C===B)break;else J['push'](J['shift']());}catch(G){J['push'](J['shift']());}}}(a0I,0x23521));function a0I(){const IF=['2491EjgQMc','856IdkEWQ','addonTypes','backups','7931YYpjkD','3oCBozY','length','latest','372024iGxold','map','projects','7846704hyQjbo','versions','40HOiMva','types','secret','secretLink','replicas','logSink','registryCredentials','then','data','default','keys','374210VBDIbN','defineProperty','credentials','2778094uYXUOH','throw','fetchResourceList','version','__esModule','done','regions','plans','includes','serviceId','2GMbedc','storage','find','resources','nextPageCursor','__awaiter','./utils','428972qeAAIA','projectId','apply','options','services','addonDependencies','get','cursor','addon','next','internalId','6zQDZks','pagination','warning','templateId','keyName','deploymentPlan','list','No\x20available\x20versions\x20to\x20upgrade\x20to.','addonId','value','templates','type','source'];a0I=function(){return IF;};return a0I();}var __awaiter=this&&this[a0I3(0x6f)]||function(I,B,J,C){function G(F){return F instanceof J?F:new J(function(A){A(F);});}return new(J||(J=Promise))(function(F,A){const I7=a0B;function H(X){const I4=a0B;try{d(C[I4(0x7a)](X));}catch(S){A(S);}}function t(X){const I5=a0B;try{d(C[I5(0xa5)](X));}catch(S){A(S);}}function d(X){const I6=a0B;X[I6(0xa9)]?F(X['value']):G(X[I6(0x85)])[I6(0x9d)](H,t);}d((C=C[I7(0x73)](I,B||[]))[I7(0x7a)]());});};Object[a0I3(0xa2)](exports,a0I3(0xa8),{'value':!![]}),exports[a0I3(0xa6)]=fetchResourceList;const utils_1=require(a0I3(0x70)),defaultPaginationPageSize=0x64,getProjects=I=>B=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const I8=a0I3;var J;const C=yield I[I8(0x82)]['projects']({'options':{'per_page':defaultPaginationPageSize,'cursor':B===null||B===void 0x0?void 0x0:B[I8(0xb2)]}});return{'elements':C[I8(0x9e)][I8(0x93)][I8(0x92)](G=>G['id']),'nextPageCursor':(J=C['pagination'])===null||J===void 0x0?void 0x0:J[I8(0x78)]};}),getServices=(I,B)=>J=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const I9=a0I3;var C;const G=yield I['list'][I9(0x75)]({'parameters':{'projectId':B},'options':{'per_page':defaultPaginationPageSize,'cursor':J===null||J===void 0x0?void 0x0:J[I9(0xb2)]}});return{'elements':G['data'][I9(0x75)][I9(0x92)](F=>F['id']),'nextPageCursor':(C=G[I9(0x7d)])===null||C===void 0x0?void 0x0:C[I9(0x78)]};}),getAddons=(I,B)=>J=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const II=a0I3;var C;const G=yield I[II(0x82)]['addons']({'parameters':{'projectId':B},'options':{'per_page':defaultPaginationPageSize,'cursor':J===null||J===void 0x0?void 0x0:J[II(0xb2)]}});return{'elements':G[II(0x9e)]['addons'][II(0x92)](F=>F['id']),'nextPageCursor':(C=G['pagination'])===null||C===void 0x0?void 0x0:C[II(0x78)]};}),getAddonBackups=(I,B,J)=>C=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){const IB=a0I3;var G;const F=yield I['get'][IB(0x79)]['backups']({'parameters':{'projectId':B,'addonId':J},'options':{'per_page':defaultPaginationPageSize,'cursor':C===null||C===void 0x0?void 0x0:C['nextPageCursor']}});return{'elements':F['data'][IB(0x8c)][IB(0x92)](A=>A['id']),'nextPageCursor':(G=F[IB(0x7d)])===null||G===void 0x0?void 0x0:G[IB(0x78)]};});function a0B(I,B){const J=a0I();return a0B=function(C,G){C=C-0x6f;let F=J[C];return F;},a0B(I,B);}function fetchResourceList(I,B,J,C,G,F){return __awaiter(this,void 0x0,void 0x0,function*(){const IJ=a0B;var A,H,t,d,X,S,f,v,a,V,r,s;const K=undefined;try{if(I===IJ(0x81)){const q=yield B['list'][IJ(0xab)]({}),x=q[IJ(0x9e)][IJ(0xab)][IJ(0x92)](g=>{const IC=IJ;var o;return(o=g===null||g===void 0x0?void 0x0:g[IC(0x7b)])!==null&&o!==void 0x0?o:g===null||g===void 0x0?void 0x0:g['id'];});return{'choices':x,'defaultValue':K};}if(I==='region'&&!(J===null||J===void 0x0?void 0x0:J[IJ(0xac)](IJ(0x9b)))){const g=yield B['list'][IJ(0xaa)]({}),o=g[IJ(0x9e)][IJ(0xaa)]['map'](O=>{var p;return(p=O===null||O===void 0x0?void 0x0:O['internalId'])!==null&&p!==void 0x0?p:O===null||O===void 0x0?void 0x0:O['id'];});return{'choices':o,'defaultValue':K};}if(I==='projectId'){const O=yield getProjects(B),{elements:p,nextPageCursor:w}=yield O();return{'choices':p,'defaultValue':K,'pagination':{'nextPageCursor':w,'loadMore':O}};}if(I==='credentials'){const Z=yield B[IJ(0x82)][IJ(0x9c)]({}),z=Z['data']['credentials'][IJ(0x92)](Q=>Q['id']);return{'choices':z,'defaultValue':K};}const b=G===null||G===void 0x0?void 0x0:G['projectId'],W=I===IJ(0xad)||I==='id'&&(F===null||F===void 0x0?void 0x0:F[IJ(0xac)]('owningObject'));if(b!==undefined&&W){const Q=yield getServices(B,b),{elements:c,nextPageCursor:l}=yield Q();return{'choices':c,'defaultValue':K,'pagination':{'nextPageCursor':l,'loadMore':Q}};}const u=J===null||J===void 0x0?void 0x0:J['includes'](IJ(0x79));if(u){const n=m=>__awaiter(this,void 0x0,void 0x0,function*(){const IG=IJ;var E;const j=yield B[IG(0x77)][IG(0x79)]['types']({});return(E=j[IG(0x9e)]['addonTypes'])===null||E===void 0x0?void 0x0:E[IG(0x92)](U=>U[IG(0x87)])[IG(0xb0)](U=>U[IG(0x87)]===m);});if(I===IJ(0x87)){const m=yield B[IJ(0x77)][IJ(0x79)][IJ(0x97)]({}),E=(A=m[IJ(0x9e)][IJ(0x8b)])===null||A===void 0x0?void 0x0:A[IJ(0x92)](j=>j['type']);return{'choices':E,'defaultValue':K};}if(I===IJ(0xa7)&&(C===null||C===void 0x0?void 0x0:C['type'])!==undefined){const j=(H=yield n(C['type']))===null||H===void 0x0?void 0x0:H[IJ(0x95)],U=j!==undefined?[IJ(0x90),...j]:undefined;return{'choices':U,'defaultValue':K};}if(I===IJ(0xaf)&&(C===null||C===void 0x0?void 0x0:C[IJ(0x87)])!==undefined){const D=(d=(t=yield n(C[IJ(0x87)]))===null||t===void 0x0?void 0x0:t[IJ(0xb1)])===null||d===void 0x0?void 0x0:d['storage'];return{'choices':D===null||D===void 0x0?void 0x0:D[IJ(0x74)],'defaultValue':D===null||D===void 0x0?void 0x0:D['default']};}if(I===IJ(0x9a)&&(C===null||C===void 0x0?void 0x0:C[IJ(0x87)])!==undefined){const M=(S=(X=yield n(C[IJ(0x87)]))===null||X===void 0x0?void 0x0:X[IJ(0xb1)])===null||S===void 0x0?void 0x0:S[IJ(0x9a)];return{'choices':M===null||M===void 0x0?void 0x0:M[IJ(0x74)],'defaultValue':M===null||M===void 0x0?void 0x0:M[IJ(0x9f)]};}}if(I===IJ(0x84)&&(G===null||G===void 0x0?void 0x0:G['projectId'])!==undefined){const R=yield getAddons(B,G===null||G===void 0x0?void 0x0:G['projectId']),{elements:Y,nextPageCursor:P}=yield R();return{'choices':Y,'defaultValue':K,'pagination':{'nextPageCursor':P,'loadMore':R}};}if(I==='backupId'&&(G===null||G===void 0x0?void 0x0:G['projectId'])!==undefined&&((f=C===null||C===void 0x0?void 0x0:C['source'])===null||f===void 0x0?void 0x0:f[IJ(0x84)])!==undefined){const k=yield getAddonBackups(B,G===null||G===void 0x0?void 0x0:G[IJ(0x72)],(v=C===null||C===void 0x0?void 0x0:C[IJ(0x88)])===null||v===void 0x0?void 0x0:v[IJ(0x84)]),{elements:L,nextPageCursor:N}=yield k();return{'choices':L,'defaultValue':K,'pagination':{'nextPageCursor':N,'loadMore':k}};}const h=(a=G===null||G===void 0x0?void 0x0:G['addonId'])!==null&&a!==void 0x0?a:(V=C===null||C===void 0x0?void 0x0:C[IJ(0x76)])===null||V===void 0x0?void 0x0:V[IJ(0x84)];if((J===null||J===void 0x0?void 0x0:J['join'](''))==='updateaddonversion'&&I==='version'&&(G===null||G===void 0x0?void 0x0:G[IJ(0x72)])!==undefined&&h!==undefined){const {upgradeTo:T}=(yield B[IJ(0x77)]['addon']['version']({'parameters':{'addonId':h,'projectId':G===null||G===void 0x0?void 0x0:G[IJ(0x72)]}}))[IJ(0x9e)];if(T===undefined||T[IJ(0x8f)]<=0x0){(0x0,utils_1[IJ(0x7e)])(IJ(0x83));throw new Error();}return{'choices':T[IJ(0x92)](y=>y[IJ(0xa7)]),'defaultValue':K};}if(I===IJ(0x7f)){const y=yield B['list'][IJ(0x86)]({}),i=y[IJ(0x9e)][IJ(0x86)]['map'](I0=>I0===null||I0===void 0x0?void 0x0:I0['id']);return{'choices':i,'defaultValue':K};}if(((J===null||J===void 0x0?void 0x0:J['includes'](IJ(0x99)))||(J===null||J===void 0x0?void 0x0:J[IJ(0xac)](IJ(0x98))))&&I===IJ(0x80)&&h!==undefined&&(G===null||G===void 0x0?void 0x0:G[IJ(0x72)])!==undefined){const I0=(yield B[IJ(0x77)][IJ(0x79)][IJ(0xa3)]({'parameters':{'addonId':h,'projectId':G===null||G===void 0x0?void 0x0:G['projectId']}}))[IJ(0x9e)];return{'choices':[...(r=Object[IJ(0xa0)](I0===null||I0===void 0x0?void 0x0:I0['envs']))!==null&&r!==void 0x0?r:[],...(s=Object[IJ(0xa0)](I0===null||I0===void 0x0?void 0x0:I0['secrets']))!==null&&s!==void 0x0?s:[]]};}}catch(I1){}return{'choices':undefined,'defaultValue':K};});}