@platforma-sdk/bootstrap 3.1.8 → 3.1.9

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/index.js CHANGED
@@ -114,5 +114,5 @@ The license file can also be set with the variables 'MI_LICENSE_FILE' or 'PL_LIC
114
114
  or stored in '$HOME/.pl.license'.
115
115
 
116
116
  You can obtain the license from "https://licensing.milaboratories.com".`),new Error("The license was not provided.")}configureDockerStorage(e,t){const r={},n=t.type;switch(e=e.toUpperCase(),n){case"S3":return r[`PL_DATA_${e}_TYPE`]="S3",r[`PL_DATA_${e}_S3_BUCKET`]=t.bucketName,t.endpoint&&(r[`PL_DATA_${e}_S3_ENDPOINT`]=t.endpoint),t.presignEndpoint&&(r[`PL_DATA_${e}_S3_PRESIGN_ENDPOINT`]=t.presignEndpoint),t.region&&(r[`PL_DATA_${e}_S3_REGION`]=t.region),t.key&&(r[`PL_DATA_${e}_S3_KEY`]=t.key),t.secret&&(r[`PL_DATA_${e}_S3_SECRET`]=t.secret),r;case"FS":return r[`PL_DATA_${e}_TYPE`]="FS",r;default:U()}return{}}renderRunInfo(e,t=10){var c,o;const r=[],n=d=>d.padStart(t," ");switch(e.configPath&&r.push(`${n("config")}: ${e.configPath}`),e.apiAddr?r.push(`${n("API")}: ${e.apiAddr}`):e.apiPort?r.push(`${n("API")}: 127.0.0.1:${e.apiPort.toString()}`):r.push(`${n("API")}: 127.0.0.1:6345`),e.logPath&&r.push(`${n("log")}: ${e.logPath}`),(c=e.primary)==null?void 0:c.type){case void 0:break;case"FS":r.push(`${n("primary")}: ${e.primary.rootPath}`);break;case"S3":r.push(`${n("primary")}: S3 at '${e.primary.endpoint??"AWS"}', bucket '${e.primary.bucketName}', prefix: '${e.primary.keyPrefix??""}'`);break;default:U()}switch((o=e.library)==null?void 0:o.type){case void 0:break;case"FS":r.push(`${n("library")}: ${e.library.rootPath}`);break;case"S3":r.push(`${n("library")}: S3 at '${e.library.endpoint??"AWS"}', bucket '${e.library.bucketName}', prefix: '${e.library.keyPrefix??""}'`);break;default:U()}return e.work&&r.push(`${n("workdirs")}: ${e.work.rootPath}`),e.dbPath&&r.push(`${n("db")}: ${e.dbPath}`),r.join(`
117
- `)}}function ge(a,e){for(const t of a){if(t.error)throw t.error;const r=e??"failed to run command";if(t.status!==0)throw new Error(`${r}, process exited with code '${t.status}'`)}}const ee=class ee extends u.Command{async run(){const{flags:e}=await this.parse(ee),t=A(e["log-level"]);new I(t).cleanupInstance()}};l(ee,"description","Clear service state (forget last run command, destroy docker services, volumes and so on)"),l(ee,"examples",["<%= config.bin %> <%= command.id %>"]),l(ee,"flags",{...L});let Fe=ee;const re=class re extends u.Command{async run(){const{flags:e}=await this.parse(re),t=A(e["log-level"]);new I(t).startLast()}};l(re,"description","Start last run service configuraiton"),l(re,"examples",["<%= config.bin %> <%= command.id %>"]),l(re,"flags",{...L});let Re=re;const te=class te extends u.Command{async run(){const{flags:e}=await this.parse(te),t=A(e["log-level"]),r=new I(t);f.currentInstance?r.stopInstance(f.currentInstance):t.warn("up/start command was not called for any instance, nothing to stop")}};l(te,"description","Stop platforma service"),l(te,"examples",["<%= config.bin %> <%= command.id %>"]),l(te,"flags",{...L});let Ee=te;var F;let it=(F=class extends u.Command{async run(){const{flags:e}=await this.parse(F),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="docker",s=e["auth-enabled"],i=s?{enabled:s,drivers:r.initAuthDriversList(e,".")}:void 0,c=e.storage?h.join(".",e.storage):f.instanceDir(n),o=[];for(const y of e.mount??[])o.push({hostPath:y});const d=e.arch?`linux/${e.arch}`:void 0,g=r.createDocker(n,c,{primaryStorageURL:e["storage-primary"],workStoragePath:e["storage-work"],libraryStorageURL:e["storage-library"],image:e.image,version:e.version,platformOverride:d,customMounts:o,license:e.license,licenseFile:e["license-file"],auth:i,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"]});r.switchInstance(g)}},l(F,"description","Run platforma backend service with 'FS' primary storage type"),l(F,"examples",["<%= config.bin %> <%= command.id %>"]),l(F,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...ie,...se,...ce}),F);var R;let ct=(R=class extends u.Command{async run(){const{flags:e}=await this.parse(R),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="local",s=e["pl-workdir"]??".",i=e.storage?h.join(s,e.storage):f.instanceDir(n),c=e["pl-log-file"]?h.join(s,e["pl-log-file"]):void 0,o=r.initAuthDriversList(e,s),d=e["auth-enabled"]??o!==void 0;let g=e["pl-binary"];e["pl-sources"]&&(g=r.buildPlatforma({repoRoot:e["pl-sources"]}));let y="127.0.0.1:6345";e["grpc-listen"]?y=e["grpc-listen"]:e["grpc-port"]&&(y=`127.0.0.1:${e["grpc-port"]}`);let w="127.0.0.1:9090";e["monitoring-listen"]?w=e["monitoring-listen"]:e["monitoring-port"]&&(w=`127.0.0.1:${e["monitoring-port"]}`);let v="127.0.0.1:9091";e["debug-listen"]?v=e["debug-listen"]:e["debug-port"]&&(v=`127.0.0.1:${e["debug-port"]}`);const b={binaryPath:g,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],configOptions:{grpc:{listen:y},monitoring:{listen:w},debug:{listen:v},license:{value:e.license,file:e["license-file"]},log:{path:c},localRoot:i,core:{auth:{enabled:d,drivers:o}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}},P=r.createLocal(n,b);b.binaryPath?r.switchInstance(P):Pe(t,{version:e.version}).then(()=>{const S=r.switchInstance(P);setTimeout(()=>{for(const k of S)k.unref()},1e3)}).catch(function(S){t.error(S.message)})}},l(R,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(R,"examples",["<%= config.bin %> <%= command.id %>"]),l(R,"flags",{...L,...N,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),R);const q=class q extends u.Command{async run(){const{flags:e,args:t}=await this.parse(q),r=A(e["log-level"]),n=new I(r),s=t.name;e.all&&(n.cleanupInstance(),process.exit(0)),s||(r.error("Please, specify name of instance to be removed or set '--all' flag instead"),process.exit(1)),n.cleanupInstance(s)}};l(q,"description","List available instances"),l(q,"examples",["<%= config.bin %> <%= command.id %>"]),l(q,"flags",{...L,all:u.Flags.boolean({description:"remove all known instances",required:!1})}),l(q,"args",{name:u.Args.string({required:!1})});let Te=q;const J=class J extends u.Command{async run(){const{flags:e,args:t}=await this.parse(J),r=A(e["log-level"]),n=new I(r),s=t.name??f.currentInstanceName;s||(r.info("no pl service instance selected. No service was stopped"),process.exit(0)),n.stopInstance(f.getInstanceInfo(s))}};l(J,"description","List available instances"),l(J,"examples",["<%= config.bin %> <%= command.id %>"]),l(J,"flags",{...L}),l(J,"args",{name:u.Args.string({required:!1})});let De=J;const ae=class ae extends u.Command{async run(){await this.parse(ae);const e=f.instanceList,t=f.currentInstanceName;for(const r of e){const n=[],s=f.getInstanceInfo(r);f.isInstanceActive(s)&&n.push("status:up"),n.push(`type:${s.type}`),console.log(r===t?` * ${r} (${n.join(", ")})`:` ${r} (${n.join(", ")})`)}}};l(ae,"description","List available instances"),l(ae,"examples",["<%= config.bin %> <%= command.id %>"]),l(ae,"flags",{});let xe=ae;const H=class H extends u.Command{async run(){const{flags:e,args:t}=await this.parse(H),r=A(e["log-level"]),n=new I(r),s=t.name??f.currentInstanceName;s||(r.error("no pl service instance is selected. Select instance with 'select' command or provide name to 'up'"),process.exit(1));const i=n.switchInstance(f.getInstanceInfo(s)),c=[];for(const o of i)c.push(new Promise((d,g)=>{o.on("close",d),o.on("error",g)}));await Promise.all(c)}};l(H,"description","List available instances"),l(H,"examples",["<%= config.bin %> <%= command.id %>"]),l(H,"flags",{...L}),l(H,"args",{name:u.Args.string({required:!1})});let _e=H;var E;let ot=(E=class extends u.Command{async run(){const{flags:e}=await this.parse(E),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="docker-s3",s=e["auth-enabled"],i=s?{enabled:s,drivers:r.initAuthDriversList(e,".")}:void 0,c=e.storage?h.join(".",e.storage):f.instanceDir(n),o=[];for(const w of e.mount??[])o.push({hostPath:w});const d=e.arch?`linux/${e.arch}`:void 0,g=e["minio-presign-host"]?"minio":"localhost",y=r.createDockerS3(n,c,{image:e.image,version:e.version,license:e.license,licenseFile:e["license-file"],platformOverride:d,customMounts:o,auth:i,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"],presignHost:g});r.switchInstance(y)}},l(E,"description","Run platforma backend service with 'S3' primary storage type"),l(E,"examples",["<%= config.bin %> <%= command.id %>"]),l(E,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...mr}),E);var T;let lt=(T=class extends u.Command{async run(){const{flags:e}=await this.parse(T),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="local-s3",s=e["pl-workdir"]??".",i=e.storage?h.join(s,e.storage):f.instanceDir(n),c=e["pl-log-file"]?h.join(s,e["pl-log-file"]):void 0,o=r.initAuthDriversList(e,s),d=e["auth-enabled"]??o!==void 0;let g=e["pl-binary"];e["pl-sources"]&&(g=r.buildPlatforma({repoRoot:e["pl-sources"]}));let y="127.0.0.1:6345";e["grpc-listen"]?y=e["grpc-listen"]:e["grpc-port"]&&(y=`127.0.0.1:${e["grpc-port"]}`);let w="127.0.0.1:9090";e["monitoring-listen"]?w=e["monitoring-listen"]:e["monitoring-port"]&&(w=`127.0.0.1:${e["monitoring-port"]}`);let v="127.0.0.1:9091";e["debug-listen"]?v=e["debug-listen"]:e["debug-port"]&&(v=`127.0.0.1:${e["debug-port"]}`);const b={binaryPath:g,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],minioPort:e["s3-port"],minioConsolePort:e["s3-console-port"],configOptions:{grpc:{listen:y},monitoring:{listen:w},debug:{listen:v},license:{value:e.license,file:e["license-file"]},log:{path:c},localRoot:i,core:{auth:{enabled:d,drivers:o}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}},P=r.createLocalS3(n,b);b.binaryPath?r.switchInstance(P):Pe(t,{version:e.version}).then(()=>{const S=r.switchInstance(P);setTimeout(()=>{for(const k of S)k.unref()},1e3)}).catch(function(S){t.error(S.message)})}},l(T,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(T,"examples",["<%= config.bin %> <%= command.id %>"]),l(T,"flags",{...L,...N,...M,...fr,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),T);const W=class W extends u.Command{async run(){const{flags:e,args:t}=await this.parse(W),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["auth-enabled"],c=i?{enabled:i,drivers:n.initAuthDriversList(e,".")}:void 0,o=e.storage?h.join(".",e.storage):f.instanceDir(s),d=[];for(const y of e.mount??[])d.push({hostPath:y});const g=e.arch?`linux/${e.arch}`:void 0;n.createDocker(s,o,{primaryStorageURL:e["storage-primary"],workStoragePath:e["storage-work"],libraryStorageURL:e["storage-library"],image:e.image,version:e.version,platformOverride:g,customMounts:d,license:e.license,licenseFile:e["license-file"],auth:c,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"]}),r.info(`Instance '${s}' was created. To start it run 'up' command`)}};l(W,"description","Run Platforma Backend service as docker container on current host"),l(W,"examples",["<%= config.bin %> <%= command.id %>"]),l(W,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...ie,...se,...ce}),l(W,"args",{name:u.Args.string({required:!0})});let Ne=W;var O;let dt=(O=class extends u.Command{async run(){const{flags:e,args:t}=await this.parse(O),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["pl-workdir"]??".",c=e.storage?h.join(i,e.storage):f.instanceDir(s),o=e["pl-log-file"]?h.join(i,e["pl-log-file"]):void 0,d=n.initAuthDriversList(e,i),g=e["auth-enabled"]??d!==void 0;let y=e["pl-binary"];e["pl-sources"]&&(y=n.buildPlatforma({repoRoot:e["pl-sources"]}));let w="127.0.0.1:6345";e["grpc-listen"]?w=e["grpc-listen"]:e["grpc-port"]&&(w=`127.0.0.1:${e["grpc-port"]}`);let v="127.0.0.1:9090";e["monitoring-listen"]?v=e["monitoring-listen"]:e["monitoring-port"]&&(v=`127.0.0.1:${e["monitoring-port"]}`);let b="127.0.0.1:9091";e["debug-listen"]?b=e["debug-listen"]:e["debug-port"]&&(b=`127.0.0.1:${e["debug-port"]}`);const P={binaryPath:y,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],configOptions:{grpc:{listen:w},monitoring:{listen:v},debug:{listen:b},license:{value:e.license,file:e["license-file"]},log:{path:o},localRoot:c,core:{auth:{enabled:g,drivers:d}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}};if(n.createLocal(s,P),P.binaryPath){r.info(`Instance '${s}' was created. To start it run 'up' command`);return}Pe(r,{version:e.version}).then(()=>r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S){r.error(S.message)})}},l(O,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(O,"examples",["<%= config.bin %> <%= command.id %>"]),l(O,"flags",{...L,...N,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),l(O,"args",{name:u.Args.string({required:!0})}),O);const z=class z extends u.Command{async run(){const{flags:e,args:t}=await this.parse(z),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["auth-enabled"],c=i?{enabled:i,drivers:n.initAuthDriversList(e,".")}:void 0,o=e.storage?h.join(".",e.storage):f.instanceDir(s),d=[];for(const w of e.mount??[])d.push({hostPath:w});const g=e.arch?`linux/${e.arch}`:void 0,y=e["minio-presign-host"]?"minio":"localhost";n.createDockerS3(s,o,{image:e.image,version:e.version,license:e.license,licenseFile:e["license-file"],platformOverride:g,customMounts:d,auth:c,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"],presignHost:y}),r.info(`Instance '${s}' was created. To start it run 'up' command`),e["minio-presign-host"]&&r.info(" NOTE: make sure you have 'minio' host in your hosts file as 127.0.0.1 address")}};l(z,"description","Run Platforma Backend service as docker container on current host with MinIO as local S3 storage"),l(z,"examples",["<%= config.bin %> <%= command.id %>"]),l(z,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...mr}),l(z,"args",{name:u.Args.string({required:!0})});let Ce=z;const Y=class Y extends u.Command{async run(){const{flags:e,args:t}=await this.parse(Y),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["pl-workdir"]??".",c=e.storage?h.join(i,e.storage):f.instanceDir(s),o=e["pl-log-file"]?h.join(i,e["pl-log-file"]):void 0,d=n.initAuthDriversList(e,i),g=e["auth-enabled"]??d!==void 0;let y=e["pl-binary"];e["pl-sources"]&&(y=n.buildPlatforma({repoRoot:e["pl-sources"]}));let w="127.0.0.1:6345";e["grpc-listen"]?w=e["grpc-listen"]:e["grpc-port"]&&(w=`127.0.0.1:${e["grpc-port"]}`);let v="127.0.0.1:9090";e["monitoring-listen"]?v=e["monitoring-listen"]:e["monitoring-port"]&&(v=`127.0.0.1:${e["monitoring-port"]}`);let b="127.0.0.1:9091";e["debug-listen"]?b=e["debug-listen"]:e["debug-port"]&&(b=`127.0.0.1:${e["debug-port"]}`);const P={binaryPath:y,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],minioPort:e["s3-port"],minioConsolePort:e["s3-console-port"],configOptions:{grpc:{listen:w},monitoring:{listen:v},debug:{listen:b},license:{value:e.license,file:e["license-file"]},log:{path:o},localRoot:c,core:{auth:{enabled:g,drivers:d}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}};if(r.info("Creating instance configuration, data directory and other stuff..."),n.createLocalS3(s,P),P.binaryPath){r.info(`Instance '${s}' was created. To start it run 'up' command`);return}Pe(r,{version:e.version}).then(()=>r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S){r.error(S.message)})}};l(Y,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(Y,"examples",["<%= config.bin %> <%= command.id %>"]),l(Y,"flags",{...L,...N,...fr,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),l(Y,"args",{name:u.Args.string({required:!0})});let Me=Y;const gt={"create-block":Ie,reset:Fe,start:Re,stop:Ee,"start:docker":it,"start:local":ct,"svc:delete":Te,"svc:down":De,"svc:list":xe,"svc:up":_e,"start:docker:s3":ot,"start:local:s3":lt,"svc:create:docker":Ne,"svc:create:local":dt,"svc:create:docker:s3":Ce,"svc:create:local:s3":Me};exports.COMMANDS=gt;
117
+ `)}}function ge(a,e){for(const t of a){if(t.error)throw t.error;const r=e??"failed to run command";if(t.status!==0)throw new Error(`${r}, process exited with code '${t.status}'`)}}const ee=class ee extends u.Command{async run(){const{flags:e}=await this.parse(ee),t=A(e["log-level"]);new I(t).cleanupInstance()}};l(ee,"description","Clear service state (forget last run command, destroy docker services, volumes and so on)"),l(ee,"examples",["<%= config.bin %> <%= command.id %>"]),l(ee,"flags",{...L});let Fe=ee;const re=class re extends u.Command{async run(){const{flags:e}=await this.parse(re),t=A(e["log-level"]);new I(t).startLast()}};l(re,"description","Start last run service configuraiton"),l(re,"examples",["<%= config.bin %> <%= command.id %>"]),l(re,"flags",{...L});let Re=re;const te=class te extends u.Command{async run(){const{flags:e}=await this.parse(te),t=A(e["log-level"]),r=new I(t);f.currentInstance?r.stopInstance(f.currentInstance):t.warn("up/start command was not called for any instance, nothing to stop")}};l(te,"description","Stop platforma service"),l(te,"examples",["<%= config.bin %> <%= command.id %>"]),l(te,"flags",{...L});let Ee=te;var F;let it=(F=class extends u.Command{async run(){const{flags:e}=await this.parse(F),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="docker",s=e["auth-enabled"],i=s?{enabled:s,drivers:r.initAuthDriversList(e,".")}:void 0,c=e.storage?h.join(".",e.storage):f.instanceDir(n),o=[];for(const y of e.mount??[])o.push({hostPath:y});const d=e.arch?`linux/${e.arch}`:void 0,g=r.createDocker(n,c,{primaryStorageURL:e["storage-primary"],workStoragePath:e["storage-work"],libraryStorageURL:e["storage-library"],image:e.image,version:e.version,platformOverride:d,customMounts:o,license:e.license,licenseFile:e["license-file"],auth:i,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"]});r.switchInstance(g)}},l(F,"description","Run platforma backend service with 'FS' primary storage type"),l(F,"examples",["<%= config.bin %> <%= command.id %>"]),l(F,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...ie,...se,...ce}),F);var R;let ct=(R=class extends u.Command{async run(){const{flags:e}=await this.parse(R),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="local",s=e["pl-workdir"]??".",i=e.storage?h.join(s,e.storage):f.instanceDir(n),c=e["pl-log-file"]?h.join(s,e["pl-log-file"]):void 0,o=r.initAuthDriversList(e,s),d=e["auth-enabled"]??o!==void 0;let g=e["pl-binary"];e["pl-sources"]&&(g=r.buildPlatforma({repoRoot:e["pl-sources"]}));let y="127.0.0.1:6345";e["grpc-listen"]?y=e["grpc-listen"]:e["grpc-port"]&&(y=`127.0.0.1:${e["grpc-port"]}`);let w="127.0.0.1:9090";e["monitoring-listen"]?w=e["monitoring-listen"]:e["monitoring-port"]&&(w=`127.0.0.1:${e["monitoring-port"]}`);let v="127.0.0.1:9091";e["debug-listen"]?v=e["debug-listen"]:e["debug-port"]&&(v=`127.0.0.1:${e["debug-port"]}`);const b={binaryPath:g,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],configOptions:{grpc:{listen:y},monitoring:{listen:w},debug:{listen:v},license:{value:e.license,file:e["license-file"]},log:{path:c},localRoot:i,core:{auth:{enabled:d,drivers:o}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}},P=r.createLocal(n,b);b.binaryPath?r.switchInstance(P):Pe(t,{version:e.version}).then(()=>{const S=r.switchInstance(P);setTimeout(()=>{for(const k of S)k.unref()},1e3)}).catch(function(S){t.error(S.message)})}},l(R,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(R,"examples",["<%= config.bin %> <%= command.id %>"]),l(R,"flags",{...L,...N,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),R);const q=class q extends u.Command{async run(){const{flags:e,args:t}=await this.parse(q),r=A(e["log-level"]),n=new I(r),s=t.name;e.all&&(n.cleanupInstance(),process.exit(0)),s||(r.error("Please, specify name of instance to be removed or set '--all' flag instead"),process.exit(1)),n.cleanupInstance(s)}};l(q,"description","List available instances"),l(q,"examples",["<%= config.bin %> <%= command.id %>"]),l(q,"flags",{...L,all:u.Flags.boolean({description:"remove all known instances",required:!1})}),l(q,"args",{name:u.Args.string({required:!1})});let Te=q;const J=class J extends u.Command{async run(){const{flags:e,args:t}=await this.parse(J),r=A(e["log-level"]),n=new I(r),s=t.name??f.currentInstanceName;s||(r.info("no pl service instance selected. No service was stopped"),process.exit(0)),n.stopInstance(f.getInstanceInfo(s))}};l(J,"description","List available instances"),l(J,"examples",["<%= config.bin %> <%= command.id %>"]),l(J,"flags",{...L}),l(J,"args",{name:u.Args.string({required:!1})});let De=J;const ae=class ae extends u.Command{async run(){await this.parse(ae);const e=f.instanceList,t=f.currentInstanceName;for(const r of e){const n=[],s=f.getInstanceInfo(r);f.isInstanceActive(s)&&n.push("status:up"),n.push(`type:${s.type}`),console.log(r===t?` * ${r} (${n.join(", ")})`:` ${r} (${n.join(", ")})`)}}};l(ae,"description","List available instances"),l(ae,"examples",["<%= config.bin %> <%= command.id %>"]),l(ae,"flags",{});let xe=ae;const H=class H extends u.Command{async run(){const{flags:e,args:t}=await this.parse(H),r=A(e["log-level"]),n=new I(r),s=t.name??f.currentInstanceName;s||(r.error("no pl service instance is selected. Select instance with 'select' command or provide name to 'up'"),process.exit(1));const i=n.switchInstance(f.getInstanceInfo(s)),c=[];for(const o of i)c.push(new Promise((d,g)=>{o.on("close",d),o.on("error",g)}));await Promise.all(c)}};l(H,"description","List available instances"),l(H,"examples",["<%= config.bin %> <%= command.id %>"]),l(H,"flags",{...L}),l(H,"args",{name:u.Args.string({required:!1})});let _e=H;var E;let ot=(E=class extends u.Command{async run(){const{flags:e}=await this.parse(E),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="docker-s3",s=e["auth-enabled"],i=s?{enabled:s,drivers:r.initAuthDriversList(e,".")}:void 0,c=e.storage?h.join(".",e.storage):f.instanceDir(n),o=[];for(const w of e.mount??[])o.push({hostPath:w});const d=e.arch?`linux/${e.arch}`:void 0,g=e["minio-presign-host"]?"minio":"localhost",y=r.createDockerS3(n,c,{image:e.image,version:e.version,license:e.license,licenseFile:e["license-file"],platformOverride:d,customMounts:o,auth:i,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"],presignHost:g});r.switchInstance(y)}},l(E,"description","Run platforma backend service with 'S3' primary storage type"),l(E,"examples",["<%= config.bin %> <%= command.id %>"]),l(E,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...mr}),E);var T;let lt=(T=class extends u.Command{async run(){const{flags:e}=await this.parse(T),t=A(e["log-level"]),r=new I(t);r.mergeLicenseEnvs(e);const n="local-s3",s=e["pl-workdir"]??".",i=e.storage?h.join(s,e.storage):f.instanceDir(n),c=e["pl-log-file"]?h.join(s,e["pl-log-file"]):void 0,o=r.initAuthDriversList(e,s),d=e["auth-enabled"]??o!==void 0;let g=e["pl-binary"];e["pl-sources"]&&(g=r.buildPlatforma({repoRoot:e["pl-sources"]}));let y="127.0.0.1:6345";e["grpc-listen"]?y=e["grpc-listen"]:e["grpc-port"]&&(y=`127.0.0.1:${e["grpc-port"]}`);let w="127.0.0.1:9090";e["monitoring-listen"]?w=e["monitoring-listen"]:e["monitoring-port"]&&(w=`127.0.0.1:${e["monitoring-port"]}`);let v="127.0.0.1:9091";e["debug-listen"]?v=e["debug-listen"]:e["debug-port"]&&(v=`127.0.0.1:${e["debug-port"]}`);const b={binaryPath:g,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],minioPort:e["s3-port"],minioConsolePort:e["s3-console-port"],configOptions:{grpc:{listen:y},monitoring:{listen:w},debug:{listen:v},license:{value:e.license,file:e["license-file"]},log:{path:c},localRoot:i,core:{auth:{enabled:d,drivers:o}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}},P=r.createLocalS3(n,b);b.binaryPath?r.switchInstance(P):Pe(t,{version:e.version}).then(()=>{const S=r.switchInstance(P);setTimeout(()=>{for(const k of S)k.unref()},1e3)}).catch(function(S){t.error(S.message)})}},l(T,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(T,"examples",["<%= config.bin %> <%= command.id %>"]),l(T,"flags",{...L,...N,...M,...fr,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),T);const W=class W extends u.Command{async run(){const{flags:e,args:t}=await this.parse(W),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["auth-enabled"],c=i?{enabled:i,drivers:n.initAuthDriversList(e,".")}:void 0,o=e.storage?h.join(".",e.storage):f.instanceDir(s),d=[];for(const y of e.mount??[])d.push({hostPath:y});const g=e.arch?`linux/${e.arch}`:void 0;n.createDocker(s,o,{primaryStorageURL:e["storage-primary"],workStoragePath:e["storage-work"],libraryStorageURL:e["storage-library"],image:e.image,version:e.version,platformOverride:g,customMounts:d,license:e.license,licenseFile:e["license-file"],auth:c,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"]}),r.info(`Instance '${s}' was created. To start it run 'up' command`)}};l(W,"description","Run Platforma Backend service as docker container on current host"),l(W,"examples",["<%= config.bin %> <%= command.id %>"]),l(W,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...ie,...se,...ce}),l(W,"args",{name:u.Args.string({required:!0})});let Ne=W;var O;let dt=(O=class extends u.Command{async run(){const{flags:e,args:t}=await this.parse(O),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["pl-workdir"]??".",c=e.storage?h.join(i,e.storage):f.instanceDir(s),o=e["pl-log-file"]?h.join(i,e["pl-log-file"]):void 0,d=n.initAuthDriversList(e,i),g=e["auth-enabled"]??d!==void 0;let y=e["pl-binary"];e["pl-sources"]&&(y=n.buildPlatforma({repoRoot:e["pl-sources"]}));let w="127.0.0.1:6345";e["grpc-listen"]?w=e["grpc-listen"]:e["grpc-port"]&&(w=`127.0.0.1:${e["grpc-port"]}`);let v="127.0.0.1:9090";e["monitoring-listen"]?v=e["monitoring-listen"]:e["monitoring-port"]&&(v=`127.0.0.1:${e["monitoring-port"]}`);let b="127.0.0.1:9091";e["debug-listen"]?b=e["debug-listen"]:e["debug-port"]&&(b=`127.0.0.1:${e["debug-port"]}`);const P={binaryPath:y,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],configOptions:{grpc:{listen:w},monitoring:{listen:v},debug:{listen:b},license:{value:e.license,file:e["license-file"]},log:{path:o},localRoot:c,core:{auth:{enabled:g,drivers:d}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}};if(n.createLocal(s,P),P.binaryPath){r.info(`Instance '${s}' was created. To start it run 'up' command`);return}Pe(r,{version:e.version}).then(()=>r.info(`Instance '${s}' was created. To start it run 'svc up' command`)).catch(function(S){r.error(S.message)})}},l(O,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(O,"examples",["<%= config.bin %> <%= command.id %>"]),l(O,"flags",{...L,...N,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),l(O,"args",{name:u.Args.string({required:!0})}),O);const z=class z extends u.Command{async run(){const{flags:e,args:t}=await this.parse(z),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["auth-enabled"],c=i?{enabled:i,drivers:n.initAuthDriversList(e,".")}:void 0,o=e.storage?h.join(".",e.storage):f.instanceDir(s),d=[];for(const w of e.mount??[])d.push({hostPath:w});const g=e.arch?`linux/${e.arch}`:void 0,y=e["minio-presign-host"]?"minio":"localhost";n.createDockerS3(s,o,{image:e.image,version:e.version,license:e.license,licenseFile:e["license-file"],platformOverride:g,customMounts:d,auth:c,grpcAddr:e["grpc-listen"],grpcPort:e["grpc-port"],monitoringAddr:e["monitoring-listen"],monitoringPort:e["monitoring-port"],debugAddr:e["debug-listen"],debugPort:e["debug-port"],presignHost:y}),r.info(`Instance '${s}' was created. To start it run 'up' command`),e["minio-presign-host"]&&r.info(" NOTE: make sure you have 'minio' host in your hosts file as 127.0.0.1 address")}};l(z,"description","Run Platforma Backend service as docker container on current host with MinIO as local S3 storage"),l(z,"examples",["<%= config.bin %> <%= command.id %>"]),l(z,"flags",{...L,...M,...fe,...N,...me,...B,...C,...he,...j,...mr}),l(z,"args",{name:u.Args.string({required:!0})});let Ce=z;const Y=class Y extends u.Command{async run(){const{flags:e,args:t}=await this.parse(Y),r=A(e["log-level"]),n=new I(r);n.mergeLicenseEnvs(e);const s=t.name,i=e["pl-workdir"]??".",c=e.storage?h.join(i,e.storage):f.instanceDir(s),o=e["pl-log-file"]?h.join(i,e["pl-log-file"]):void 0,d=n.initAuthDriversList(e,i),g=e["auth-enabled"]??d!==void 0;let y=e["pl-binary"];e["pl-sources"]&&(y=n.buildPlatforma({repoRoot:e["pl-sources"]}));let w="127.0.0.1:6345";e["grpc-listen"]?w=e["grpc-listen"]:e["grpc-port"]&&(w=`127.0.0.1:${e["grpc-port"]}`);let v="127.0.0.1:9090";e["monitoring-listen"]?v=e["monitoring-listen"]:e["monitoring-port"]&&(v=`127.0.0.1:${e["monitoring-port"]}`);let b="127.0.0.1:9091";e["debug-listen"]?b=e["debug-listen"]:e["debug-port"]&&(b=`127.0.0.1:${e["debug-port"]}`);const P={binaryPath:y,version:e.version,configPath:e.config,workdir:e["pl-workdir"],primaryURL:e["storage-primary"],libraryURL:e["storage-library"],minioPort:e["s3-port"],minioConsolePort:e["s3-console-port"],configOptions:{grpc:{listen:w},monitoring:{listen:v},debug:{listen:b},license:{value:e.license,file:e["license-file"]},log:{path:o},localRoot:c,core:{auth:{enabled:g,drivers:d}},storages:{work:{type:"FS",rootPath:e["storage-work"]}}}};if(r.info("Creating instance configuration, data directory and other stuff..."),n.createLocalS3(s,P),P.binaryPath){r.info(`Instance '${s}' was created. To start it run 'up' command`);return}Pe(r,{version:e.version}).then(()=>r.info(`Instance '${s}' was created. To start it run 'svc up' command`)).catch(function(S){r.error(S.message)})}};l(Y,"description","Run Platforma Backend service as local process on current host (no docker container)"),l(Y,"examples",["<%= config.bin %> <%= command.id %>"]),l(Y,"flags",{...L,...N,...fr,...M,...pe,...we,...ve,...C,...j,...ie,...se,...ce,...ye,...be,...B}),l(Y,"args",{name:u.Args.string({required:!0})});let Me=Y;const gt={"create-block":Ie,reset:Fe,start:Re,stop:Ee,"start:docker":it,"start:local":ct,"svc:delete":Te,"svc:down":De,"svc:list":xe,"svc:up":_e,"start:docker:s3":ot,"start:local:s3":lt,"svc:create:docker":Ne,"svc:create:local":dt,"svc:create:docker:s3":Ce,"svc:create:local:s3":Me};exports.COMMANDS=gt;
118
118
  //# sourceMappingURL=index.js.map