@platforma-sdk/bootstrap 3.1.4 → 3.1.5

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.mjs CHANGED
@@ -2,10 +2,10 @@ var Sr = Object.defineProperty;
2
2
  var $r = (a, e, t) => e in a ? Sr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
3
  var l = (a, e, t) => $r(a, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { Flags as v, Command as L, Args as K } from "@oclif/core";
5
- import D from "node:os";
5
+ import F from "node:os";
6
6
  import f, { createWriteStream as Lr } from "node:fs";
7
7
  import m, { resolve as Ir } from "node:path";
8
- import { execSync as Oe, spawn as Ar, spawnSync as mr } from "node:child_process";
8
+ import { execSync as Ae, spawn as Ar, spawnSync as mr } from "node:child_process";
9
9
  import ge from "winston";
10
10
  import { randomBytes as Or } from "node:crypto";
11
11
  import Z from "readline-sync";
@@ -13,10 +13,10 @@ import * as _ from "node:fs/promises";
13
13
  import { Writable as Rr } from "node:stream";
14
14
  import { z as N } from "zod";
15
15
  import Er from "decompress";
16
- import fe from "yaml";
17
- import { getDefaultPlVersion as me } from "@milaboratories/pl-deployments";
16
+ import { getDefaultPlVersion as fe } from "@milaboratories/pl-deployments";
17
+ import dr from "yaml";
18
18
  import Tr from "node:https";
19
- import * as Fr from "tar";
19
+ import * as xr from "tar";
20
20
  const I = {
21
21
  "log-level": v.string({
22
22
  description: "logging level",
@@ -29,7 +29,7 @@ v.string({
29
29
  description: "name of instance",
30
30
  required: !1
31
31
  });
32
- const he = {
32
+ const me = {
33
33
  image: v.string({
34
34
  description: "use custom docker image to run platforma"
35
35
  })
@@ -37,7 +37,7 @@ const he = {
37
37
  version: v.string({
38
38
  description: "use custom platforma release (official docker image or binary package)"
39
39
  })
40
- }, pe = {
40
+ }, he = {
41
41
  arch: v.string({
42
42
  description: "override architecture. You can start amd64 linux image on arm-based host (say, Apple M family processor). I.e. arm64, amd64, amd64/v2"
43
43
  })
@@ -89,7 +89,7 @@ const he = {
89
89
  storage: v.string({
90
90
  description: "specify path on host to be used as storage for all Platforma Backend data"
91
91
  })
92
- }, pr = {
92
+ }, yr = {
93
93
  "minio-presign-host": v.boolean({
94
94
  description: "use 'minio' host instead of 'localhost' in presign URLs"
95
95
  })
@@ -98,23 +98,23 @@ const he = {
98
98
  multiple: !0,
99
99
  description: "things to be mounted into platforma docker container. Targets will appear inside the container under the same absolute paths"
100
100
  })
101
- }, be = {
101
+ }, pe = {
102
102
  "pl-log-file": v.file({
103
103
  description: "specify path for Platforma Backend log file"
104
104
  })
105
- }, we = {
105
+ }, be = {
106
106
  "pl-workdir": v.file({
107
107
  description: "specify working directory for Platforma Backend process"
108
108
  })
109
- }, ve = {
109
+ }, we = {
110
110
  "pl-binary": v.file({
111
111
  description: "start given Platforma Backend binary instead of automatically downloaded version"
112
112
  })
113
- }, Pe = {
113
+ }, ve = {
114
114
  "pl-sources": v.file({
115
115
  description: "path to pl repository root: build Platforma Backend from sources and start the resulting binary"
116
116
  })
117
- }, ke = {
117
+ }, Pe = {
118
118
  config: v.string({
119
119
  description: "use custom Platforma Backend config"
120
120
  })
@@ -146,11 +146,11 @@ const ce = {
146
146
  s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
147
147
  s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
148
148
  })
149
- }, xr = {
149
+ }, Dr = {
150
150
  "auth-enabled": v.boolean({
151
151
  description: "enable authorization"
152
152
  })
153
- }, Dr = {
153
+ }, Fr = {
154
154
  "auth-htpasswd-file": v.file({
155
155
  description: "path to .htpasswd file with Platforma users (static user DB auth source)"
156
156
  })
@@ -163,8 +163,8 @@ const ce = {
163
163
  description: "DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com"
164
164
  })
165
165
  }, U = {
166
- ...xr,
167
166
  ...Dr,
167
+ ...Fr,
168
168
  ...Nr,
169
169
  ..._r
170
170
  };
@@ -200,16 +200,16 @@ function Mr(a) {
200
200
  return Or(Math.ceil(a / 2)).toString("hex").slice(0, a);
201
201
  }
202
202
  function jr(a) {
203
- return a.startsWith("~") ? m.join(D.homedir(), a.slice(1)) : a;
203
+ return a.startsWith("~") ? m.join(F.homedir(), a.slice(1)) : a;
204
204
  }
205
- function $e(a, e) {
205
+ function Se(a, e) {
206
206
  f.existsSync(a) || (f.mkdirSync(a, { recursive: !0 }), e != null && e.mode && f.chmodSync(a, e.mode));
207
207
  }
208
208
  function Br(a) {
209
209
  try {
210
- if (D.platform() !== "win32")
211
- return Oe(`ps -p ${a} -o comm=`, { encoding: "utf8" }).trim();
212
- const e = `wmic process where processid=${a} get Caption`, t = Oe(e, { encoding: "utf8" }).split(`
210
+ if (F.platform() !== "win32")
211
+ return Ae(`ps -p ${a} -o comm=`, { encoding: "utf8" }).trim();
212
+ const e = `wmic process where processid=${a} get Caption`, t = Ae(e, { encoding: "utf8" }).split(`
213
213
  `);
214
214
  return t.length <= 1 ? "" : t[1].trim();
215
215
  } catch {
@@ -217,12 +217,12 @@ function Br(a) {
217
217
  }
218
218
  }
219
219
  function Ur(a) {
220
- const e = Oe(`docker compose ls --filter name=${a} --format json`, { encoding: "utf8" }).trim(), t = JSON.parse(e);
220
+ const e = Ae(`docker compose ls --filter name=${a} --format json`, { encoding: "utf8" }).trim(), t = JSON.parse(e);
221
221
  for (const r of t)
222
222
  if (r.Name === a)
223
223
  return r;
224
224
  }
225
- const Re = ["Python"], yr = ["Tengo", "Python"], Gr = N.union([N.literal("Tengo"), N.literal("Python")]), Jr = N.object({
225
+ const Oe = ["Python"], pr = ["Tengo", "Python"], Gr = N.union([N.literal("Tengo"), N.literal("Python")]), Jr = N.object({
226
226
  npmOrgName: N.string().min(1),
227
227
  orgName: N.string().min(1),
228
228
  blockName: N.string().min(1),
@@ -239,7 +239,7 @@ async function Hr(a) {
239
239
  "platforma-block-boilerplate-main",
240
240
  s
241
241
  );
242
- const i = yr.filter((o) => n.indexOf(o) < 0), c = Re.length == i.length;
242
+ const i = pr.filter((o) => n.indexOf(o) < 0), c = Oe.length == i.length;
243
243
  a.info(`Keep platforms '${n}', remove: '${i}'. Will remove all platforms? ${c}`);
244
244
  for (const o of i)
245
245
  await zr(s, o);
@@ -260,15 +260,15 @@ function Wr() {
260
260
  const e = Z.question('Write an organization name, e.g. "my-org": '), t = Z.question('Write a name of the block, e.g. "hello-world": '), r = Z.keyInYN("Create package for block's software?");
261
261
  let n = ["Tengo"];
262
262
  if (r)
263
- for (; n.length < yr.length; ) {
264
- const s = Z.keyInSelect(Re, "Choose software platform:");
263
+ for (; n.length < pr.length; ) {
264
+ const s = Z.keyInSelect(Oe, "Choose software platform:");
265
265
  if (s < 0) break;
266
- n.push(Re[s]);
266
+ n.push(Oe[s]);
267
267
  }
268
268
  return n = Array.from(new Set(n)).sort(), Jr.parse({ npmOrgName: a, orgName: e, blockName: t, softwarePlatforms: n });
269
269
  }
270
270
  async function qr(a, e, t) {
271
- const n = await (await fetch(a)).blob(), s = await _.mkdtemp(m.join(D.tmpdir(), "create-repo")), i = m.join(s, "packed-repo.zip"), c = Rr.toWeb(Lr(i));
271
+ const n = await (await fetch(a)).blob(), s = await _.mkdtemp(m.join(F.tmpdir(), "create-repo")), i = m.join(s, "packed-repo.zip"), c = Rr.toWeb(Lr(i));
272
272
  await n.stream().pipeTo(c);
273
273
  const o = m.join(s, "unpacked-repo");
274
274
  await _.mkdir(o), await Er(i, o), await _.cp(m.join(o, e), t, { recursive: !0 });
@@ -290,7 +290,7 @@ async function zr(a, e) {
290
290
  ), await ee(
291
291
  m.join(a, "workflow", "src", "wf.test.ts"),
292
292
  new RegExp(`.*${t}Message.*\\n.*expect.*\\n\\n`, "g")
293
- ), await _.rm(m.join(a, "software", `src_${t}`), { recursive: !0 }), await Ge(
293
+ ), await _.rm(m.join(a, "software", `src_${t}`), { recursive: !0 }), await Ue(
294
294
  m.join(a, "software", "package.json"),
295
295
  (r) => {
296
296
  const n = JSON.parse(r);
@@ -299,7 +299,7 @@ async function zr(a, e) {
299
299
  );
300
300
  }
301
301
  async function Yr(a) {
302
- await _.rm(m.join(a, "software"), { recursive: !0 }), await Ge(
302
+ await _.rm(m.join(a, "software"), { recursive: !0 }), await Ue(
303
303
  m.join(a, "workflow", "package.json"),
304
304
  (e) => {
305
305
  const t = JSON.parse(e);
@@ -322,12 +322,12 @@ async function Kr(a) {
322
322
  recursive: !0
323
323
  })).filter((t) => t.isFile()).map((t) => m.join(t.parentPath, t.name));
324
324
  }
325
- async function Ge(a, e) {
325
+ async function Ue(a, e) {
326
326
  const t = await _.readFile(a), r = e(t.toString());
327
327
  await _.writeFile(a, r);
328
328
  }
329
329
  async function br(a, e, t) {
330
- return await Ge(a, (r) => r.replaceAll(e, t));
330
+ return await Ue(a, (r) => r.replaceAll(e, t));
331
331
  }
332
332
  async function ee(a, e) {
333
333
  return await br(a, e, "");
@@ -341,18 +341,18 @@ const re = class re extends L {
341
341
  l(re, "description", "Helps to create a new block by downloading a block's template."), l(re, "examples", ["<%= name %>"]), l(re, "flags", {
342
342
  ...I
343
343
  });
344
- let Ee = re;
344
+ let Re = re;
345
345
  function wr(...a) {
346
346
  return Ir(__dirname, "..", ...a);
347
347
  }
348
348
  function Q(...a) {
349
349
  return wr("assets", ...a);
350
350
  }
351
- function Le(...a) {
351
+ function $e(...a) {
352
352
  return f.readFileSync(wr(...a));
353
353
  }
354
354
  function gr(a) {
355
- return a || (a = me()), `quay.io/milaboratories/platforma:${a}`;
355
+ return a || (a = fe()), `quay.io/milaboratories/platforma:${a}`;
356
356
  }
357
357
  const J = class J {
358
358
  constructor(e) {
@@ -361,9 +361,9 @@ const J = class J {
361
361
  });
362
362
  l(this, "filePath");
363
363
  l(this, "dirPath");
364
- e = e ?? m.resolve(D.homedir(), ".config", "pl-bootstrap");
364
+ e = e ?? m.resolve(F.homedir(), ".config", "pl-bootstrap");
365
365
  const t = m.join(e, "state.json");
366
- this.dirPath = e, this.filePath = t, f.existsSync(e) || f.mkdirSync(e, { recursive: !0 }), f.existsSync(t) && (this.state = JSON.parse(Le(t).toString()));
366
+ this.dirPath = e, this.filePath = t, f.existsSync(e) || f.mkdirSync(e, { recursive: !0 }), f.existsSync(t) && (this.state = JSON.parse($e(t).toString()));
367
367
  }
368
368
  static getStateInstance() {
369
369
  return J.instance || (J.instance = new J()), J.instance;
@@ -390,7 +390,7 @@ const J = class J {
390
390
  const t = this.instanceDir(e, "instance.json");
391
391
  if (!f.existsSync(t))
392
392
  throw new Error(`platforma backend instance '${e}' does not exist or is corrupted`);
393
- const r = JSON.parse(Le(t).toString());
393
+ const r = JSON.parse($e(t).toString());
394
394
  return {
395
395
  name: e,
396
396
  ...r
@@ -400,7 +400,7 @@ const J = class J {
400
400
  f.existsSync(this.instanceDir(e)) || f.mkdirSync(this.instanceDir(e), { recursive: !0 });
401
401
  const r = this.instanceDir(e, "instance.json");
402
402
  let n = {};
403
- f.existsSync(r) && (n = JSON.parse(Le(r).toString())), f.writeFileSync(r, JSON.stringify({ ...n, ...t }));
403
+ f.existsSync(r) && (n = JSON.parse($e(r).toString())), f.writeFileSync(r, JSON.stringify({ ...n, ...t }));
404
404
  }
405
405
  isInstanceActive(e) {
406
406
  switch (e.type) {
@@ -443,13 +443,13 @@ const J = class J {
443
443
  }
444
444
  };
445
445
  l(J, "instance");
446
- let Te = J;
446
+ let Ee = J;
447
447
  function ur(a) {
448
448
  const e = Br(a);
449
449
  return e === "platforma" || e.endsWith("/platforma") || e.endsWith("\\platforma");
450
450
  }
451
- const u = Te.getStateInstance();
452
- function Ie(a, e, t) {
451
+ const u = Ee.getStateInstance();
452
+ function Le(a, e, t) {
453
453
  const r = [], n = [];
454
454
  for (const s of e)
455
455
  if (t = {
@@ -497,8 +497,8 @@ function Xr(a, e, t, r) {
497
497
  opts: ${JSON.stringify(r)}`
498
498
  ), r.env = { ...process.env, ...r.env }, mr(e, t, r);
499
499
  }
500
- function Ae(a, e, t, r, n) {
501
- const s = f.readFileSync(a, { encoding: "utf-8" }), i = fe.parse(s.toString());
500
+ function Ie(a, e, t, r, n) {
501
+ const s = f.readFileSync(a, { encoding: "utf-8" }), i = dr.parse(s.toString());
502
502
  if (!i.services)
503
503
  throw new Error(`file '${a}' seems to be not a docker-compose file or has unsupported version`);
504
504
  if (r)
@@ -528,7 +528,7 @@ function Ae(a, e, t, r, n) {
528
528
  d.volumes.push(`${g.hostPath}:${g.containerPath}`);
529
529
  }
530
530
  }
531
- n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e, fe.stringify(i));
531
+ n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e, dr.stringify(i));
532
532
  }
533
533
  function Zr(a) {
534
534
  return {
@@ -537,7 +537,6 @@ function Zr(a) {
537
537
  indexCachePeriod: "0s",
538
538
  endpoint: "",
539
539
  region: "",
540
- presignEndpoint: "",
541
540
  bucketName: "",
542
541
  createBucket: !1,
543
542
  forcePathStyle: !1,
@@ -560,38 +559,42 @@ function X(a, e, t) {
560
559
  a = jr(a);
561
560
  const r = new URL(a, `file:${e}`);
562
561
  switch (r.protocol) {
563
- case "s3:":
564
- var i = r.hostname, n = r.searchParams.get("region");
562
+ case "s3:": {
563
+ const n = r.hostname, s = r.searchParams.get("region"), i = r.pathname.slice(1);
565
564
  return {
566
565
  ...t,
567
566
  type: "S3",
568
- bucketName: i,
569
- region: n
567
+ bucketName: n,
568
+ region: s,
569
+ keyPrefix: i
570
570
  };
571
- case "s3e:":
572
- var s = r.pathname.split("/").slice(1), i = s[0], c = s.length > 1 ? s[1] : "";
571
+ }
572
+ case "s3e:": {
573
+ const n = r.pathname.split("/").slice(1), s = n[0], i = n.length > 1 ? n.slice(1).join("/") : "";
573
574
  return {
574
575
  ...t,
575
576
  type: "S3",
576
577
  endpoint: `http://${r.host}/`,
577
- bucketName: i,
578
- keyPrefix: c,
578
+ bucketName: s,
579
+ keyPrefix: i,
579
580
  region: r.searchParams.get("region"),
580
581
  key: r.username ? `static:${r.username}` : "",
581
582
  secret: r.password ? `static:${r.password}` : ""
582
583
  };
583
- case "s3es:":
584
- var s = r.pathname.split("/").slice(1), i = s[0], c = s.length > 1 ? s[1] : "";
584
+ }
585
+ case "s3es:": {
586
+ const n = r.pathname.split("/").slice(1), s = n[0], i = n.length > 1 ? n.slice(1).join("/") : "";
585
587
  return {
586
588
  ...t,
587
589
  type: "S3",
588
590
  endpoint: `https://${r.host}/`,
589
- bucketName: i,
590
- keyPrefix: c,
591
+ bucketName: s,
592
+ keyPrefix: i,
591
593
  region: r.searchParams.get("region"),
592
594
  key: r.username ? `static:${r.username}` : "",
593
595
  secret: r.password ? `static:${r.password}` : ""
594
596
  };
597
+ }
595
598
  case "file:":
596
599
  return {
597
600
  type: "FS",
@@ -602,23 +605,23 @@ function X(a, e, t) {
602
605
  }
603
606
  }
604
607
  function et(a, e) {
605
- var w, p, P, S, k, y, $, le, Je, He, We, qe, ze, Ye, Ve, Ke, Qe, Xe, Ze, er, rr, tr, ar, nr, sr, ir, cr, or, lr, dr;
608
+ var w, y, P, S, k, p, $, le, Ge, Je, He, We, qe, ze, Ye, Ve, Ke, Qe, Xe, Ze, er, rr, tr, ar, nr, sr, ir, cr, or, lr;
606
609
  const t = (e == null ? void 0 : e.localRoot) ?? u.instanceDir("default"), r = {
607
610
  level: ((w = e == null ? void 0 : e.log) == null ? void 0 : w.level) ?? "info",
608
- path: ((p = e == null ? void 0 : e.log) == null ? void 0 : p.path) ?? `${t}/logs/platforma.log`
611
+ path: ((y = e == null ? void 0 : e.log) == null ? void 0 : y.path) ?? `${t}/logs/platforma.log`
609
612
  }, n = {
610
613
  listen: ((P = e == null ? void 0 : e.grpc) == null ? void 0 : P.listen) ?? "localhost:6345",
611
614
  tls: {
612
615
  enable: de((k = (S = e == null ? void 0 : e.grpc) == null ? void 0 : S.tls) == null ? void 0 : k.enable, !1),
613
- clientAuthMode: (($ = (y = e == null ? void 0 : e.grpc) == null ? void 0 : y.tls) == null ? void 0 : $.clientAuthMode) ?? "NoAuth",
614
- certFile: ((Je = (le = e == null ? void 0 : e.grpc) == null ? void 0 : le.tls) == null ? void 0 : Je.certFile) ?? `${t}/certs/tls.cert`,
615
- keyFile: ((We = (He = e == null ? void 0 : e.grpc) == null ? void 0 : He.tls) == null ? void 0 : We.keyFile) ?? `${t}/certs/tls.key`,
616
- ...(qe = e == null ? void 0 : e.grpc) == null ? void 0 : qe.tls
616
+ clientAuthMode: (($ = (p = e == null ? void 0 : e.grpc) == null ? void 0 : p.tls) == null ? void 0 : $.clientAuthMode) ?? "NoAuth",
617
+ certFile: ((Ge = (le = e == null ? void 0 : e.grpc) == null ? void 0 : le.tls) == null ? void 0 : Ge.certFile) ?? `${t}/certs/tls.cert`,
618
+ keyFile: ((He = (Je = e == null ? void 0 : e.grpc) == null ? void 0 : Je.tls) == null ? void 0 : He.keyFile) ?? `${t}/certs/tls.key`,
619
+ ...(We = e == null ? void 0 : e.grpc) == null ? void 0 : We.tls
617
620
  }
618
621
  }, s = {
619
622
  auth: {
620
- enabled: ((Ye = (ze = e == null ? void 0 : e.core) == null ? void 0 : ze.auth) == null ? void 0 : Ye.enabled) ?? !1,
621
- drivers: ((Ke = (Ve = e == null ? void 0 : e.core) == null ? void 0 : Ve.auth) == null ? void 0 : Ke.drivers) ?? [
623
+ enabled: ((ze = (qe = e == null ? void 0 : e.core) == null ? void 0 : qe.auth) == null ? void 0 : ze.enabled) ?? !1,
624
+ drivers: ((Ve = (Ye = e == null ? void 0 : e.core) == null ? void 0 : Ye.auth) == null ? void 0 : Ve.drivers) ?? [
622
625
  { driver: "jwt", key: a },
623
626
  { driver: "htpasswd", path: `${t}/users.htpasswd` }
624
627
  ]
@@ -630,13 +633,13 @@ function et(a, e) {
630
633
  "main",
631
634
  `${t}/storages/main`,
632
635
  "main-bucket",
633
- (Qe = e == null ? void 0 : e.storages) == null ? void 0 : Qe.primary
636
+ (Ke = e == null ? void 0 : e.storages) == null ? void 0 : Ke.primary
634
637
  );
635
638
  let c;
636
- switch ((Ze = (Xe = e == null ? void 0 : e.storages) == null ? void 0 : Xe.work) == null ? void 0 : Ze.type) {
639
+ switch ((Xe = (Qe = e == null ? void 0 : e.storages) == null ? void 0 : Qe.work) == null ? void 0 : Xe.type) {
637
640
  case void 0:
638
641
  case "FS":
639
- c = vr("work"), c.rootPath = ((rr = (er = e == null ? void 0 : e.storages) == null ? void 0 : er.work) == null ? void 0 : rr.rootPath) ?? `${t}/storages/work`, c.indexCachePeriod = ((ar = (tr = e == null ? void 0 : e.storages) == null ? void 0 : tr.work) == null ? void 0 : ar.indexCachePeriod) ?? "1m";
642
+ c = vr("work"), c.rootPath = ((er = (Ze = e == null ? void 0 : e.storages) == null ? void 0 : Ze.work) == null ? void 0 : er.rootPath) ?? `${t}/storages/work`, c.indexCachePeriod = ((tr = (rr = e == null ? void 0 : e.storages) == null ? void 0 : rr.work) == null ? void 0 : tr.indexCachePeriod) ?? "1m";
640
643
  break;
641
644
  default:
642
645
  throw new Error("work storage MUST have 'FS' type as it is used for working directories management");
@@ -645,16 +648,16 @@ function et(a, e) {
645
648
  "library",
646
649
  `${t}/storages/library`,
647
650
  "library-bucket",
648
- (nr = e == null ? void 0 : e.storages) == null ? void 0 : nr.library
651
+ (ar = e == null ? void 0 : e.storages) == null ? void 0 : ar.library
649
652
  ), g = {
650
- enabled: de((sr = e == null ? void 0 : e.monitoring) == null ? void 0 : sr.enabled, !0),
651
- listen: ((ir = e == null ? void 0 : e.monitoring) == null ? void 0 : ir.listen) ?? "127.0.0.1:9090"
653
+ enabled: de((nr = e == null ? void 0 : e.monitoring) == null ? void 0 : nr.enabled, !0),
654
+ listen: ((sr = e == null ? void 0 : e.monitoring) == null ? void 0 : sr.listen) ?? "127.0.0.1:9090"
652
655
  }, h = {
653
- enabled: de((cr = e == null ? void 0 : e.debug) == null ? void 0 : cr.enabled, !0),
654
- listen: ((or = e == null ? void 0 : e.debug) == null ? void 0 : or.listen) ?? "127.0.0.1:9091"
656
+ enabled: de((ir = e == null ? void 0 : e.debug) == null ? void 0 : ir.enabled, !0),
657
+ listen: ((cr = e == null ? void 0 : e.debug) == null ? void 0 : cr.listen) ?? "127.0.0.1:9091"
655
658
  }, b = {
656
- value: ((lr = e == null ? void 0 : e.license) == null ? void 0 : lr.value) ?? "",
657
- file: ((dr = e == null ? void 0 : e.license) == null ? void 0 : dr.file) ?? ""
659
+ value: ((or = e == null ? void 0 : e.license) == null ? void 0 : or.value) ?? "",
660
+ file: ((lr = e == null ? void 0 : e.license) == null ? void 0 : lr.file) ?? ""
658
661
  };
659
662
  return {
660
663
  localRoot: t,
@@ -676,7 +679,7 @@ function fr(a, e, t, r) {
676
679
  n = vr(a), n.rootPath = (r == null ? void 0 : r.rootPath) ?? e;
677
680
  break;
678
681
  case "S3":
679
- n = Zr(a), n.endpoint = (r == null ? void 0 : r.endpoint) ?? "http://localhost:9000", n.presignEndpoint = (r == null ? void 0 : r.presignEndpoint) ?? "http://localhost:9000", n.bucketName = (r == null ? void 0 : r.bucketName) ?? t, n.createBucket = de(r == null ? void 0 : r.createBucket, !0), n.forcePathStyle = de(r == null ? void 0 : r.forcePathStyle, !0), n.key = (r == null ? void 0 : r.key) ?? "", n.secret = (r == null ? void 0 : r.secret) ?? "", n.keyPrefix = (r == null ? void 0 : r.keyPrefix) ?? "", n.accessPrefixes = (r == null ? void 0 : r.accessPrefixes) ?? [""], n.uploadKeyPrefix = (r == null ? void 0 : r.uploadKeyPrefix) ?? "";
682
+ n = Zr(a), n.endpoint = r == null ? void 0 : r.endpoint, n.region = r == null ? void 0 : r.region, n.presignEndpoint = (r == null ? void 0 : r.presignEndpoint) ?? (r == null ? void 0 : r.endpoint), n.bucketName = (r == null ? void 0 : r.bucketName) ?? t, n.createBucket = de(r == null ? void 0 : r.createBucket, !0), n.forcePathStyle = de(r == null ? void 0 : r.forcePathStyle, !0), n.key = (r == null ? void 0 : r.key) ?? "", n.secret = (r == null ? void 0 : r.secret) ?? "", n.keyPrefix = (r == null ? void 0 : r.keyPrefix) ?? "", n.accessPrefixes = (r == null ? void 0 : r.accessPrefixes) ?? [""], n.uploadKeyPrefix = (r == null ? void 0 : r.uploadKeyPrefix) ?? "";
680
683
  break;
681
684
  default:
682
685
  throw G(), new Error("unknown storage type");
@@ -767,7 +770,7 @@ function de(a, e) {
767
770
  }
768
771
  const tt = ["linux", "macos", "windows"];
769
772
  function at(a) {
770
- const e = D.platform();
773
+ const e = F.platform();
771
774
  switch (e) {
772
775
  case "darwin":
773
776
  return "macos";
@@ -783,7 +786,7 @@ function at(a) {
783
786
  }
784
787
  const nt = ["amd64", "arm64"];
785
788
  function Pr(a) {
786
- const e = D.arch();
789
+ const e = F.arch();
787
790
  switch (e) {
788
791
  case "arm64":
789
792
  return "arm64";
@@ -796,7 +799,7 @@ function Pr(a) {
796
799
  }
797
800
  }
798
801
  function st(a, e) {
799
- const t = (e == null ? void 0 : e.version) ?? me(), r = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, n = `pl-${t}-${Pr()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${at()}/${n}`, i = (e == null ? void 0 : e.saveTo) ?? u.binaries(n);
802
+ const t = (e == null ? void 0 : e.version) ?? fe(), r = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, n = `pl-${t}-${Pr()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${at()}/${n}`, i = (e == null ? void 0 : e.saveTo) ?? u.binaries(n);
800
803
  if (f.existsSync(i))
801
804
  return a.info(`Platforma Backend archive download skipped: '${i}' already exists`), Promise.resolve(i);
802
805
  f.mkdirSync(m.dirname(i), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
@@ -806,24 +809,24 @@ function st(a, e) {
806
809
  return new Promise((o, d) => {
807
810
  c.on("response", (g) => {
808
811
  if (!g.statusCode) {
809
- const p = new Error("failed to download archive: no HTTP status code in response from server");
810
- c.destroy(), d(p);
812
+ const y = new Error("failed to download archive: no HTTP status code in response from server");
813
+ c.destroy(), d(y);
811
814
  return;
812
815
  }
813
816
  if (g.statusCode !== 200) {
814
- const p = new Error(`failed to download archive: ${g.statusCode} ${g.statusMessage}`);
815
- c.destroy(), d(p);
817
+ const y = new Error(`failed to download archive: ${g.statusCode} ${g.statusMessage}`);
818
+ c.destroy(), d(y);
816
819
  return;
817
820
  }
818
821
  const h = parseInt(g.headers["content-length"] || "0", 10);
819
822
  let b = 0;
820
823
  const w = f.createWriteStream(i);
821
- g.pipe(w), g.on("data", (p) => {
822
- b += p.length;
824
+ g.pipe(w), g.on("data", (y) => {
825
+ b += y.length;
823
826
  const P = b / h * 100;
824
827
  r && process.stdout.write(` downloading: ${P.toFixed(2)}%\r`);
825
- }), g.on("error", (p) => {
826
- f.unlinkSync(i), a.error(`Failed to download Platforma Binary: ${p.message}`), c.destroy(), d(p);
828
+ }), g.on("error", (y) => {
829
+ f.unlinkSync(i), a.error(`Failed to download Platforma Binary: ${y.message}`), c.destroy(), d(y);
827
830
  }), w.on("finish", () => {
828
831
  w.close(), a.info(" ... download done."), c.destroy(), o(i);
829
832
  });
@@ -832,7 +835,7 @@ function st(a, e) {
832
835
  }
833
836
  function it(a, e) {
834
837
  a.debug("extracting archive...");
835
- const t = (e == null ? void 0 : e.version) ?? me();
838
+ const t = (e == null ? void 0 : e.version) ?? fe();
836
839
  a.debug(` version: '${t}'`);
837
840
  const r = `${kr({ version: t })}.tgz`, n = (e == null ? void 0 : e.archivePath) ?? u.binaries(r);
838
841
  a.debug(` archive path: '${n}'`);
@@ -845,18 +848,18 @@ function it(a, e) {
845
848
  }
846
849
  return f.existsSync(s) || (a.debug(` creating target dir '${s}'`), f.mkdirSync(s, { recursive: !0 })), a.info(`Unpacking Platforma Backend archive:
847
850
  Archive: ${n}
848
- Target dir: ${s}`), Fr.x({
851
+ Target dir: ${s}`), xr.x({
849
852
  file: n,
850
853
  cwd: s,
851
854
  gzip: !0,
852
855
  sync: !0
853
856
  }), a.info(" ... unpack done."), s;
854
857
  }
855
- function Se(a, e) {
858
+ function ke(a, e) {
856
859
  return st(a, e).then((t) => it(a, { archivePath: t }));
857
860
  }
858
861
  function kr(a) {
859
- return `pl-${(a == null ? void 0 : a.version) ?? me()}-${Pr()}`;
862
+ return `pl-${(a == null ? void 0 : a.version) ?? fe()}-${Pr()}`;
860
863
  }
861
864
  function ct(a, ...e) {
862
865
  return u.binaries(kr({ version: a }), ...e);
@@ -881,7 +884,7 @@ class O {
881
884
  this.logger.info(`Starting platforma backend instance '${e.name}':
882
885
  ${r}`);
883
886
  }
884
- const t = Ie(
887
+ const t = Le(
885
888
  this.logger,
886
889
  e.upCommands
887
890
  );
@@ -893,7 +896,7 @@ ${r}`);
893
896
  return;
894
897
  }
895
898
  this.logger.info(`stopping platforma backend instance '${e.name}'...`);
896
- const t = Ie(this.logger, e.downCommands);
899
+ const t = Le(this.logger, e.downCommands);
897
900
  switch (ue(t.executed), e.type) {
898
901
  case "docker":
899
902
  return;
@@ -914,7 +917,7 @@ ${r}`);
914
917
  return this.startInstance(e);
915
918
  }
916
919
  createLocal(e, t) {
917
- var o, d, g, h, b, w, p, P, S, k;
920
+ var o, d, g, h, b, w, y, P, S, k;
918
921
  const r = (t == null ? void 0 : t.binaryPath) ?? ct(t == null ? void 0 : t.version, "binaries", "platforma");
919
922
  let n = t == null ? void 0 : t.configPath;
920
923
  const s = (t == null ? void 0 : t.workdir) ?? (n ? process.cwd() : u.instanceDir(e));
@@ -932,17 +935,17 @@ ${r}`);
932
935
  }
933
936
  });
934
937
  const i = et(this.getLastJwt(), t == null ? void 0 : t.configOptions);
935
- this.logger.debug(" checking license..."), this.checkLicense((P = (p = t == null ? void 0 : t.configOptions) == null ? void 0 : p.license) == null ? void 0 : P.value, (k = (S = t == null ? void 0 : t.configOptions) == null ? void 0 : S.license) == null ? void 0 : k.file);
938
+ this.logger.debug(" checking license..."), this.checkLicense((P = (y = t == null ? void 0 : t.configOptions) == null ? void 0 : y.license) == null ? void 0 : P.value, (k = (S = t == null ? void 0 : t.configOptions) == null ? void 0 : S.license) == null ? void 0 : k.file);
936
939
  const c = [
937
940
  `${i.localRoot}/packages`,
938
941
  `${i.localRoot}/packages-local`,
939
942
  `${i.localRoot}/blocks-local`
940
943
  ];
941
944
  i.storages.primary.type === "FS" && c.push(i.storages.primary.rootPath), i.storages.library.type === "FS" && (c.push(i.storages.library.rootPath), i.hacks.libraryDownloadable = !1), i.storages.work.type === "FS" && c.push(i.storages.work.rootPath), this.logger.debug(" creating pl state directories...");
942
- for (const y of c)
943
- f.existsSync(y) || (this.logger.debug(` '${y}'`), f.mkdirSync(y, { recursive: !0 }));
944
- for (const y of i.core.auth.drivers)
945
- y.driver === "htpasswd" && (f.existsSync(y.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${y.path}...`), f.copyFileSync(Q("users.htpasswd"), y.path)));
945
+ for (const p of c)
946
+ f.existsSync(p) || (this.logger.debug(` '${p}'`), f.mkdirSync(p, { recursive: !0 }));
947
+ for (const p of i.core.auth.drivers)
948
+ p.driver === "htpasswd" && (f.existsSync(p.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${p.path}...`), f.copyFileSync(Q("users.htpasswd"), p.path)));
946
949
  return n || (n = m.join(i.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${n}'...`), f.writeFileSync(n, rt(i))), u.setInstanceInfo(e, {
947
950
  type: "process",
948
951
  upCommands: [
@@ -993,7 +996,7 @@ ${r}`);
993
996
  createMinio(e, t) {
994
997
  this.logger.debug(" creating docker compose for minio service...");
995
998
  const r = Q("compose-backend.yaml"), n = u.instanceDir(e, "compose-minio.yaml");
996
- Ae(
999
+ Ie(
997
1000
  r,
998
1001
  n,
999
1002
  `pl-${e}-minio`,
@@ -1007,7 +1010,7 @@ ${r}`);
1007
1010
  const i = (t == null ? void 0 : t.image) ?? `quay.io/minio/minio${s}`;
1008
1011
  this.logger.debug(` minio image: ${i}`);
1009
1012
  const c = (t == null ? void 0 : t.storage) ?? u.instanceDir(e, "minio");
1010
- $e(c, { mode: "0775" });
1013
+ Se(c, { mode: "0775" });
1011
1014
  const o = (t == null ? void 0 : t.minioPort) ?? 9e3, d = (t == null ? void 0 : t.minioConsolePort) ?? 9001, g = {
1012
1015
  MINIO_IMAGE: i,
1013
1016
  MINIO_STORAGE: m.resolve(c),
@@ -1039,7 +1042,7 @@ ${r}`);
1039
1042
  };
1040
1043
  }
1041
1044
  buildPlatforma(e) {
1042
- const t = m.resolve(e.repoRoot, "cmd", "platforma"), r = e.binPath ?? m.join(D.tmpdir(), "platforma-local-build");
1045
+ const t = m.resolve(e.repoRoot, "cmd", "platforma"), r = e.binPath ?? m.join(F.tmpdir(), "platforma-local-build");
1043
1046
  this.logger.info("Building Platforma Backend binary from sources"), this.logger.info(` sources path: ${e.repoRoot}`), this.logger.info(` binary path: ${r}`);
1044
1047
  const n = mr("go", ["build", "-o", r, "."], {
1045
1048
  cwd: t,
@@ -1051,9 +1054,9 @@ ${r}`);
1051
1054
  this.logger.debug("creating platforma instance in 'docker s3' mode...");
1052
1055
  const n = Q("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? gr(r == null ? void 0 : r.version);
1053
1056
  this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
1054
- const i = (...y) => m.join(t, ...y), c = (y) => {
1055
- const $ = i(y);
1056
- return $e($, { mode: "0775" }), $;
1057
+ const i = (...p) => m.join(t, ...p), c = (p) => {
1058
+ const $ = i(p);
1059
+ return Se($, { mode: "0775" }), $;
1057
1060
  }, o = i("logs", "platforma.log");
1058
1061
  f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
1059
1062
  const d = (r == null ? void 0 : r.presignHost) ?? "localhost", g = X("s3e://testuser:testpassword@minio:9000/main-bucket");
@@ -1064,17 +1067,17 @@ ${r}`);
1064
1067
  if (h.type !== "S3")
1065
1068
  throw new Error(`${h.type} storage type is not supported for library storage`);
1066
1069
  h.presignEndpoint = `http://${d}:9000`;
1067
- const b = c("db"), w = c("work"), p = i("users.htpasswd");
1068
- f.existsSync(p) || f.copyFileSync(Q("users.htpasswd"), p);
1070
+ const b = c("db"), w = c("work"), y = i("users.htpasswd");
1071
+ f.existsSync(y) || f.copyFileSync(Q("users.htpasswd"), y);
1069
1072
  const P = i("compose.yaml");
1070
1073
  f.existsSync(P) && this.logger.info(`replacing docker compose file ${P}`);
1071
1074
  const S = [];
1072
- for (const y of (r == null ? void 0 : r.customMounts) ?? [])
1075
+ for (const p of (r == null ? void 0 : r.customMounts) ?? [])
1073
1076
  S.push({
1074
- hostPath: y.hostPath,
1075
- containerPath: y.containerPath ?? y.hostPath
1077
+ hostPath: p.hostPath,
1078
+ containerPath: p.containerPath ?? p.hostPath
1076
1079
  });
1077
- Ae(n, P, `pl-${e}`, /* @__PURE__ */ new Map([
1080
+ Ie(n, P, `pl-${e}`, /* @__PURE__ */ new Map([
1078
1081
  ["minio", {}],
1079
1082
  ["backend", {
1080
1083
  platform: r == null ? void 0 : r.platformOverride,
@@ -1085,7 +1088,7 @@ ${r}`);
1085
1088
  MINIO_IMAGE: "quay.io/minio/minio",
1086
1089
  MINIO_STORAGE: c("minio"),
1087
1090
  PL_IMAGE: s,
1088
- PL_AUTH_HTPASSWD_PATH: p,
1091
+ PL_AUTH_HTPASSWD_PATH: y,
1089
1092
  PL_LICENSE: r == null ? void 0 : r.license,
1090
1093
  PL_LICENSE_FILE: r == null ? void 0 : r.licenseFile,
1091
1094
  PL_LOG_LEVEL: (r == null ? void 0 : r.logLevel) ?? "info",
@@ -1101,8 +1104,8 @@ ${r}`);
1101
1104
  ...this.configureDockerStorage("library", h)
1102
1105
  };
1103
1106
  if (r != null && r.grpcAddr && (k.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (k.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (k.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (k.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (k.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (k.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (k.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
1104
- for (const y of r.auth.drivers)
1105
- y.driver === "htpasswd" && (k.PL_AUTH_HTPASSWD_PATH = m.resolve(y.path), y.path = "/etc/platforma/users.htpasswd");
1107
+ for (const p of r.auth.drivers)
1108
+ p.driver === "htpasswd" && (k.PL_AUTH_HTPASSWD_PATH = m.resolve(p.path), p.path = "/etc/platforma/users.htpasswd");
1106
1109
  k.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
1107
1110
  }
1108
1111
  return u.setInstanceInfo(e, {
@@ -1142,26 +1145,26 @@ ${r}`);
1142
1145
  this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
1143
1146
  const i = (...$) => m.join(t, ...$), c = ($) => {
1144
1147
  const le = i($);
1145
- return $e(le, { mode: "0775" }), le;
1148
+ return Se(le, { mode: "0775" }), le;
1146
1149
  }, o = i("logs", "platforma.log");
1147
1150
  f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
1148
1151
  const d = c("db"), g = c("primary"), h = c("library"), b = c("work"), w = i("users.htpasswd");
1149
1152
  f.existsSync(w) || f.copyFileSync(Q("users.htpasswd"), w);
1150
- const p = i("compose.yaml");
1151
- f.existsSync(p) && this.logger.info(`replacing docker compose file ${p}`);
1153
+ const y = i("compose.yaml");
1154
+ f.existsSync(y) && this.logger.info(`replacing docker compose file ${y}`);
1152
1155
  const P = [];
1153
1156
  for (const $ of (r == null ? void 0 : r.customMounts) ?? [])
1154
1157
  P.push({
1155
1158
  hostPath: $.hostPath,
1156
1159
  containerPath: $.containerPath ?? $.hostPath
1157
1160
  });
1158
- this.logger.debug(`Rendering docker compose file '${p}' using '${n}' as base template`), Ae(n, p, `pl-${e}`, /* @__PURE__ */ new Map([
1161
+ this.logger.debug(`Rendering docker compose file '${y}' using '${n}' as base template`), Ie(n, y, `pl-${e}`, /* @__PURE__ */ new Map([
1159
1162
  ["backend", {
1160
1163
  platform: r == null ? void 0 : r.platformOverride,
1161
1164
  mounts: P
1162
1165
  }]
1163
1166
  ]));
1164
- const S = X((r == null ? void 0 : r.primaryStorageURL) ?? `file:${g}`, "."), k = X((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."), y = {
1167
+ const S = X((r == null ? void 0 : r.primaryStorageURL) ?? `file:${g}`, "."), k = X((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."), p = {
1165
1168
  MINIO_IMAGE: "quay.io/minio/minio",
1166
1169
  MINIO_STORAGE: c("minio"),
1167
1170
  PL_IMAGE: s,
@@ -1179,29 +1182,29 @@ ${r}`);
1179
1182
  ...this.configureDockerStorage("primary", S),
1180
1183
  ...this.configureDockerStorage("library", k)
1181
1184
  };
1182
- if (r != null && r.grpcAddr && (y.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (y.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (y.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (y.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (y.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (y.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (y.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
1185
+ if (r != null && r.grpcAddr && (p.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (p.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (p.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (p.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (p.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (p.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (p.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
1183
1186
  for (const $ of r.auth.drivers)
1184
- $.driver === "htpasswd" && (y.PL_AUTH_HTPASSWD_PATH = m.resolve($.path), $.path = "/etc/platforma/users.htpasswd");
1185
- y.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
1187
+ $.driver === "htpasswd" && (p.PL_AUTH_HTPASSWD_PATH = m.resolve($.path), $.path = "/etc/platforma/users.htpasswd");
1188
+ p.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
1186
1189
  }
1187
1190
  return u.setInstanceInfo(e, {
1188
1191
  type: "docker",
1189
1192
  upCommands: [{
1190
1193
  cmd: "docker",
1191
- args: ["compose", `--file=${p}`, "up", "--detach", "--remove-orphans", "--pull=missing"],
1192
- envs: y,
1194
+ args: ["compose", `--file=${y}`, "up", "--detach", "--remove-orphans", "--pull=missing"],
1195
+ envs: p,
1193
1196
  runOpts: { stdio: "inherit" }
1194
1197
  }],
1195
1198
  downCommands: [{
1196
1199
  cmd: "docker",
1197
- args: ["compose", `--file=${p}`, "down"],
1198
- envs: y,
1200
+ args: ["compose", `--file=${y}`, "down"],
1201
+ envs: p,
1199
1202
  runOpts: { stdio: "inherit" }
1200
1203
  }],
1201
1204
  cleanupCommands: [{
1202
1205
  cmd: "docker",
1203
- args: ["compose", `--file=${p}`, "down", "--volumes", "--remove-orphans"],
1204
- envs: y,
1206
+ args: ["compose", `--file=${y}`, "down", "--volumes", "--remove-orphans"],
1207
+ envs: p,
1205
1208
  runOpts: { stdio: "inherit" }
1206
1209
  }],
1207
1210
  runInfo: {
@@ -1258,7 +1261,7 @@ You are going to reset the state of all platforma services configured with pl-bo
1258
1261
  for (const [s, i] of r.entries()) {
1259
1262
  if (i.cleanupCommands.length) {
1260
1263
  this.logger.info(`Wiping instance ${s} services`);
1261
- const c = Ie(this.logger, i.cleanupCommands);
1264
+ const c = Le(this.logger, i.cleanupCommands);
1262
1265
  ue(c.executed, `failed to wipe instance ${s} services`);
1263
1266
  }
1264
1267
  this.logger.info(`Destroying instance '${s}' data directory`), f.rmSync(u.instanceDir(s), { recursive: !0, force: !0 });
@@ -1270,7 +1273,7 @@ If you want to remove all downloaded platforma binaries, delete '${u.binaries()}
1270
1273
  );
1271
1274
  }
1272
1275
  mergeLicenseEnvs(e) {
1273
- e.license === void 0 && ((process.env.MI_LICENSE ?? "") != "" ? e.license = process.env.MI_LICENSE : (process.env.PL_LICENSE ?? "") != "" && (e.license = process.env.PL_LICENSE)), e["license-file"] === void 0 && e.license === void 0 && ((process.env.MI_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.MI_LICENSE_FILE : (process.env.PL_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.PL_LICENSE_FILE : f.existsSync(m.resolve(D.homedir(), ".pl.license")) && (e["license-file"] = m.resolve(D.homedir(), ".pl.license")));
1276
+ e.license === void 0 && ((process.env.MI_LICENSE ?? "") != "" ? e.license = process.env.MI_LICENSE : (process.env.PL_LICENSE ?? "") != "" && (e.license = process.env.PL_LICENSE)), e["license-file"] === void 0 && e.license === void 0 && ((process.env.MI_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.MI_LICENSE_FILE : (process.env.PL_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.PL_LICENSE_FILE : f.existsSync(m.resolve(F.homedir(), ".pl.license")) && (e["license-file"] = m.resolve(F.homedir(), ".pl.license")));
1274
1277
  }
1275
1278
  initAuthDriversList(e, t) {
1276
1279
  const r = [];
@@ -1352,14 +1355,6 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
1352
1355
  return e.work && r.push(`${n("workdirs")}: ${e.work.rootPath}`), e.dbPath && r.push(`${n("db")}: ${e.dbPath}`), r.join(`
1353
1356
  `);
1354
1357
  }
1355
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1356
- readComposeFile(e) {
1357
- const t = f.readFileSync(e);
1358
- return fe.parse(t.toString());
1359
- }
1360
- writeComposeFile(e, t) {
1361
- f.writeFileSync(e, fe.stringify(t));
1362
- }
1363
1358
  }
1364
1359
  function ue(a, e) {
1365
1360
  for (const t of a) {
@@ -1379,7 +1374,7 @@ const te = class te extends L {
1379
1374
  l(te, "description", "Clear service state (forget last run command, destroy docker services, volumes and so on)"), l(te, "examples", ["<%= config.bin %> <%= command.id %>"]), l(te, "flags", {
1380
1375
  ...I
1381
1376
  });
1382
- let Fe = te;
1377
+ let Te = te;
1383
1378
  const ae = class ae extends L {
1384
1379
  async run() {
1385
1380
  const { flags: e } = await this.parse(ae), t = A(e["log-level"]);
@@ -1434,9 +1429,9 @@ let lt = (E = class extends L {
1434
1429
  }, l(E, "description", "Run platforma backend service with 'FS' primary storage type"), l(E, "examples", ["<%= config.bin %> <%= command.id %>"]), l(E, "flags", {
1435
1430
  ...I,
1436
1431
  ...j,
1437
- ...he,
1432
+ ...me,
1438
1433
  ...C,
1439
- ...pe,
1434
+ ...he,
1440
1435
  ...U,
1441
1436
  ...M,
1442
1437
  ...ye,
@@ -1459,7 +1454,7 @@ let dt = (T = class extends L {
1459
1454
  e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
1460
1455
  let w = "127.0.0.1:9091";
1461
1456
  e["debug-listen"] ? w = e["debug-listen"] : e["debug-port"] && (w = `127.0.0.1:${e["debug-port"]}`);
1462
- const p = {
1457
+ const y = {
1463
1458
  binaryPath: g,
1464
1459
  version: e.version,
1465
1460
  configPath: e.config,
@@ -1478,8 +1473,8 @@ let dt = (T = class extends L {
1478
1473
  work: { type: "FS", rootPath: e["storage-work"] }
1479
1474
  }
1480
1475
  }
1481
- }, P = r.createLocal(n, p);
1482
- p.binaryPath ? r.switchInstance(P) : Se(t, { version: e.version }).then(() => {
1476
+ }, P = r.createLocal(n, y);
1477
+ y.binaryPath ? r.switchInstance(P) : ke(t, { version: e.version }).then(() => {
1483
1478
  const S = r.switchInstance(P);
1484
1479
  setTimeout(() => {
1485
1480
  for (const k of S)
@@ -1493,16 +1488,16 @@ let dt = (T = class extends L {
1493
1488
  ...I,
1494
1489
  ...C,
1495
1490
  ...j,
1491
+ ...we,
1496
1492
  ...ve,
1497
1493
  ...Pe,
1498
- ...ke,
1499
1494
  ...M,
1500
1495
  ...B,
1501
1496
  ...ce,
1502
1497
  ...ie,
1503
1498
  ...oe,
1499
+ ...pe,
1504
1500
  ...be,
1505
- ...we,
1506
1501
  ...U
1507
1502
  }), T);
1508
1503
  const H = class H extends L {
@@ -1520,7 +1515,7 @@ l(H, "description", "List available instances"), l(H, "examples", ["<%= config.b
1520
1515
  }), l(H, "args", {
1521
1516
  name: K.string({ required: !1 })
1522
1517
  });
1523
- let Ne = H;
1518
+ let Fe = H;
1524
1519
  const W = class W extends L {
1525
1520
  async run() {
1526
1521
  const { flags: e, args: t } = await this.parse(W), r = A(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
@@ -1532,7 +1527,7 @@ l(W, "description", "List available instances"), l(W, "examples", ["<%= config.b
1532
1527
  }), l(W, "args", {
1533
1528
  name: K.string({ required: !1 })
1534
1529
  });
1535
- let _e = W;
1530
+ let Ne = W;
1536
1531
  const se = class se extends L {
1537
1532
  async run() {
1538
1533
  await this.parse(se);
@@ -1544,7 +1539,7 @@ const se = class se extends L {
1544
1539
  }
1545
1540
  };
1546
1541
  l(se, "description", "List available instances"), l(se, "examples", ["<%= config.bin %> <%= command.id %>"]), l(se, "flags", {});
1547
- let Ce = se;
1542
+ let _e = se;
1548
1543
  const q = class q extends L {
1549
1544
  async run() {
1550
1545
  const { flags: e, args: t } = await this.parse(q), r = A(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
@@ -1562,11 +1557,11 @@ l(q, "description", "List available instances"), l(q, "examples", ["<%= config.b
1562
1557
  }), l(q, "args", {
1563
1558
  name: K.string({ required: !1 })
1564
1559
  });
1565
- let Me = q;
1566
- var F;
1567
- let gt = (F = class extends L {
1560
+ let Ce = q;
1561
+ var x;
1562
+ let gt = (x = class extends L {
1568
1563
  async run() {
1569
- const { flags: e } = await this.parse(F), t = A(e["log-level"]), r = new O(t);
1564
+ const { flags: e } = await this.parse(x), t = A(e["log-level"]), r = new O(t);
1570
1565
  r.mergeLicenseEnvs(e);
1571
1566
  const n = "docker-s3", s = e["auth-enabled"], i = s ? {
1572
1567
  enabled: s,
@@ -1592,22 +1587,22 @@ let gt = (F = class extends L {
1592
1587
  });
1593
1588
  r.switchInstance(h);
1594
1589
  }
1595
- }, l(F, "description", "Run platforma backend service with 'S3' primary storage type"), l(F, "examples", ["<%= config.bin %> <%= command.id %>"]), l(F, "flags", {
1590
+ }, l(x, "description", "Run platforma backend service with 'S3' primary storage type"), l(x, "examples", ["<%= config.bin %> <%= command.id %>"]), l(x, "flags", {
1596
1591
  ...I,
1597
1592
  ...j,
1598
- ...he,
1593
+ ...me,
1599
1594
  ...C,
1600
- ...pe,
1595
+ ...he,
1601
1596
  ...U,
1602
1597
  ...M,
1603
1598
  ...ye,
1604
1599
  ...B,
1605
- ...pr
1606
- }), F);
1607
- var x;
1608
- let ut = (x = class extends L {
1600
+ ...yr
1601
+ }), x);
1602
+ var D;
1603
+ let ut = (D = class extends L {
1609
1604
  async run() {
1610
- const { flags: e } = await this.parse(x), t = A(e["log-level"]), r = new O(t);
1605
+ const { flags: e } = await this.parse(D), t = A(e["log-level"]), r = new O(t);
1611
1606
  r.mergeLicenseEnvs(e);
1612
1607
  const n = "local-s3", s = e["pl-workdir"] ?? ".", i = e.storage ? m.join(s, e.storage) : u.instanceDir(n), c = e["pl-log-file"] ? m.join(s, e["pl-log-file"]) : void 0, o = r.initAuthDriversList(e, s), d = e["auth-enabled"] ?? o !== void 0;
1613
1608
  let g = e["pl-binary"];
@@ -1618,7 +1613,7 @@ let ut = (x = class extends L {
1618
1613
  e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
1619
1614
  let w = "127.0.0.1:9091";
1620
1615
  e["debug-listen"] ? w = e["debug-listen"] : e["debug-port"] && (w = `127.0.0.1:${e["debug-port"]}`);
1621
- const p = {
1616
+ const y = {
1622
1617
  binaryPath: g,
1623
1618
  version: e.version,
1624
1619
  configPath: e.config,
@@ -1641,8 +1636,8 @@ let ut = (x = class extends L {
1641
1636
  work: { type: "FS", rootPath: e["storage-work"] }
1642
1637
  }
1643
1638
  }
1644
- }, P = r.createLocalS3(n, p);
1645
- p.binaryPath ? r.switchInstance(P) : Se(t, { version: e.version }).then(() => {
1639
+ }, P = r.createLocalS3(n, y);
1640
+ y.binaryPath ? r.switchInstance(P) : ke(t, { version: e.version }).then(() => {
1646
1641
  const S = r.switchInstance(P);
1647
1642
  setTimeout(() => {
1648
1643
  for (const k of S)
@@ -1652,23 +1647,23 @@ let ut = (x = class extends L {
1652
1647
  t.error(S.message);
1653
1648
  });
1654
1649
  }
1655
- }, l(x, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(x, "examples", ["<%= config.bin %> <%= command.id %>"]), l(x, "flags", {
1650
+ }, l(D, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(D, "examples", ["<%= config.bin %> <%= command.id %>"]), l(D, "flags", {
1656
1651
  ...I,
1657
1652
  ...C,
1658
1653
  ...j,
1659
1654
  ...hr,
1655
+ ...we,
1660
1656
  ...ve,
1661
1657
  ...Pe,
1662
- ...ke,
1663
1658
  ...M,
1664
1659
  ...B,
1665
1660
  ...ce,
1666
1661
  ...ie,
1667
1662
  ...oe,
1663
+ ...pe,
1668
1664
  ...be,
1669
- ...we,
1670
1665
  ...U
1671
- }), x);
1666
+ }), D);
1672
1667
  const z = class z extends L {
1673
1668
  async run() {
1674
1669
  const { flags: e, args: t } = await this.parse(z), r = A(e["log-level"]), n = new O(r);
@@ -1703,9 +1698,9 @@ const z = class z extends L {
1703
1698
  l(z, "description", "Run Platforma Backend service as docker container on current host"), l(z, "examples", ["<%= config.bin %> <%= command.id %>"]), l(z, "flags", {
1704
1699
  ...I,
1705
1700
  ...j,
1706
- ...he,
1701
+ ...me,
1707
1702
  ...C,
1708
- ...pe,
1703
+ ...he,
1709
1704
  ...U,
1710
1705
  ...M,
1711
1706
  ...ye,
@@ -1716,7 +1711,7 @@ l(z, "description", "Run Platforma Backend service as docker container on curren
1716
1711
  }), l(z, "args", {
1717
1712
  name: K.string({ required: !0 })
1718
1713
  });
1719
- let je = z;
1714
+ let Me = z;
1720
1715
  var R;
1721
1716
  let ft = (R = class extends L {
1722
1717
  async run() {
@@ -1729,8 +1724,8 @@ let ft = (R = class extends L {
1729
1724
  e["grpc-listen"] ? b = e["grpc-listen"] : e["grpc-port"] && (b = `127.0.0.1:${e["grpc-port"]}`);
1730
1725
  let w = "127.0.0.1:9090";
1731
1726
  e["monitoring-listen"] ? w = e["monitoring-listen"] : e["monitoring-port"] && (w = `127.0.0.1:${e["monitoring-port"]}`);
1732
- let p = "127.0.0.1:9091";
1733
- e["debug-listen"] ? p = e["debug-listen"] : e["debug-port"] && (p = `127.0.0.1:${e["debug-port"]}`);
1727
+ let y = "127.0.0.1:9091";
1728
+ e["debug-listen"] ? y = e["debug-listen"] : e["debug-port"] && (y = `127.0.0.1:${e["debug-port"]}`);
1734
1729
  const P = {
1735
1730
  binaryPath: h,
1736
1731
  version: e.version,
@@ -1741,7 +1736,7 @@ let ft = (R = class extends L {
1741
1736
  configOptions: {
1742
1737
  grpc: { listen: b },
1743
1738
  monitoring: { listen: w },
1744
- debug: { listen: p },
1739
+ debug: { listen: y },
1745
1740
  license: { value: e.license, file: e["license-file"] },
1746
1741
  log: { path: o },
1747
1742
  localRoot: c,
@@ -1755,7 +1750,7 @@ let ft = (R = class extends L {
1755
1750
  r.info(`Instance '${s}' was created. To start it run 'up' command`);
1756
1751
  return;
1757
1752
  }
1758
- Se(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S) {
1753
+ ke(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S) {
1759
1754
  r.error(S.message);
1760
1755
  });
1761
1756
  }
@@ -1763,16 +1758,16 @@ let ft = (R = class extends L {
1763
1758
  ...I,
1764
1759
  ...C,
1765
1760
  ...j,
1761
+ ...we,
1766
1762
  ...ve,
1767
1763
  ...Pe,
1768
- ...ke,
1769
1764
  ...M,
1770
1765
  ...B,
1771
1766
  ...ce,
1772
1767
  ...ie,
1773
1768
  ...oe,
1769
+ ...pe,
1774
1770
  ...be,
1775
- ...we,
1776
1771
  ...U
1777
1772
  }), l(R, "args", {
1778
1773
  name: K.string({ required: !0 })
@@ -1809,18 +1804,18 @@ const Y = class Y extends L {
1809
1804
  l(Y, "description", "Run Platforma Backend service as docker container on current host with MinIO as local S3 storage"), l(Y, "examples", ["<%= config.bin %> <%= command.id %>"]), l(Y, "flags", {
1810
1805
  ...I,
1811
1806
  ...j,
1812
- ...he,
1807
+ ...me,
1813
1808
  ...C,
1814
- ...pe,
1809
+ ...he,
1815
1810
  ...U,
1816
1811
  ...M,
1817
1812
  ...ye,
1818
1813
  ...B,
1819
- ...pr
1814
+ ...yr
1820
1815
  }), l(Y, "args", {
1821
1816
  name: K.string({ required: !0 })
1822
1817
  });
1823
- let Be = Y;
1818
+ let je = Y;
1824
1819
  const V = class V extends L {
1825
1820
  async run() {
1826
1821
  const { flags: e, args: t } = await this.parse(V), r = A(e["log-level"]), n = new O(r);
@@ -1832,8 +1827,8 @@ const V = class V extends L {
1832
1827
  e["grpc-listen"] ? b = e["grpc-listen"] : e["grpc-port"] && (b = `127.0.0.1:${e["grpc-port"]}`);
1833
1828
  let w = "127.0.0.1:9090";
1834
1829
  e["monitoring-listen"] ? w = e["monitoring-listen"] : e["monitoring-port"] && (w = `127.0.0.1:${e["monitoring-port"]}`);
1835
- let p = "127.0.0.1:9091";
1836
- e["debug-listen"] ? p = e["debug-listen"] : e["debug-port"] && (p = `127.0.0.1:${e["debug-port"]}`);
1830
+ let y = "127.0.0.1:9091";
1831
+ e["debug-listen"] ? y = e["debug-listen"] : e["debug-port"] && (y = `127.0.0.1:${e["debug-port"]}`);
1837
1832
  const P = {
1838
1833
  binaryPath: h,
1839
1834
  version: e.version,
@@ -1846,7 +1841,7 @@ const V = class V extends L {
1846
1841
  configOptions: {
1847
1842
  grpc: { listen: b },
1848
1843
  monitoring: { listen: w },
1849
- debug: { listen: p },
1844
+ debug: { listen: y },
1850
1845
  license: { value: e.license, file: e["license-file"] },
1851
1846
  log: { path: o },
1852
1847
  localRoot: c,
@@ -1860,7 +1855,7 @@ const V = class V extends L {
1860
1855
  r.info(`Instance '${s}' was created. To start it run 'up' command`);
1861
1856
  return;
1862
1857
  }
1863
- Se(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S) {
1858
+ ke(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S) {
1864
1859
  r.error(S.message);
1865
1860
  });
1866
1861
  }
@@ -1870,38 +1865,38 @@ l(V, "description", "Run Platforma Backend service as local process on current h
1870
1865
  ...C,
1871
1866
  ...hr,
1872
1867
  ...j,
1868
+ ...we,
1873
1869
  ...ve,
1874
1870
  ...Pe,
1875
- ...ke,
1876
1871
  ...M,
1877
1872
  ...B,
1878
1873
  ...ce,
1879
1874
  ...ie,
1880
1875
  ...oe,
1876
+ ...pe,
1881
1877
  ...be,
1882
- ...we,
1883
1878
  ...U
1884
1879
  }), l(V, "args", {
1885
1880
  name: K.string({ required: !0 })
1886
1881
  });
1887
- let Ue = V;
1882
+ let Be = V;
1888
1883
  const Rt = {
1889
- "create-block": Ee,
1890
- reset: Fe,
1884
+ "create-block": Re,
1885
+ reset: Te,
1891
1886
  start: xe,
1892
1887
  stop: De,
1893
1888
  "start:docker": lt,
1894
1889
  "start:local": dt,
1895
- "svc:delete": Ne,
1896
- "svc:down": _e,
1897
- "svc:list": Ce,
1898
- "svc:up": Me,
1890
+ "svc:delete": Fe,
1891
+ "svc:down": Ne,
1892
+ "svc:list": _e,
1893
+ "svc:up": Ce,
1899
1894
  "start:docker:s3": gt,
1900
1895
  "start:local:s3": ut,
1901
- "svc:create:docker": je,
1896
+ "svc:create:docker": Me,
1902
1897
  "svc:create:local": ft,
1903
- "svc:create:docker:s3": Be,
1904
- "svc:create:local:s3": Ue
1898
+ "svc:create:docker:s3": je,
1899
+ "svc:create:local:s3": Be
1905
1900
  };
1906
1901
  export {
1907
1902
  Rt as COMMANDS