@platforma-sdk/bootstrap 2.1.0 → 2.1.2

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
@@ -1,12 +1,12 @@
1
1
  var er = Object.defineProperty;
2
2
  var rr = (a, e, r) => e in a ? er(a, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[e] = r;
3
3
  var m = (a, e, r) => rr(a, typeof e != "symbol" ? e + "" : e, r);
4
- import { Flags as y, Command as O } from "@oclif/core";
5
- import p from "node:os";
6
- import o, { createWriteStream as tr } from "node:fs";
7
- import f, { resolve as ar } from "node:path";
4
+ import { Flags as y, Command as $ } from "@oclif/core";
5
+ import _ from "node:os";
6
+ import l, { createWriteStream as tr } from "node:fs";
7
+ import u, { resolve as ar } from "node:path";
8
8
  import { execSync as Me, spawn as ir, spawnSync as H } from "node:child_process";
9
- import j from "winston";
9
+ import W from "winston";
10
10
  import { randomBytes as sr } from "node:crypto";
11
11
  import V from "readline-sync";
12
12
  import { Writable as cr } from "node:stream";
@@ -78,11 +78,11 @@ const T = {
78
78
  storage: y.string({
79
79
  description: "specify path on host to be used as storage for all Platforma Backend data"
80
80
  })
81
- }, We = {
81
+ }, je = {
82
82
  "pl-log-file": y.file({
83
83
  description: "specify path for Platforma Backend log file"
84
84
  })
85
- }, je = {
85
+ }, We = {
86
86
  "pl-workdir": y.file({
87
87
  description: "specify working directory for Platforma Backend process"
88
88
  })
@@ -155,18 +155,18 @@ function Y(a) {
155
155
  throw new Error("this should never happen");
156
156
  }
157
157
  function E(a = "debug") {
158
- return j.createLogger({
158
+ return W.createLogger({
159
159
  level: a,
160
- format: j.format.combine(
161
- j.format.printf(({ level: e, message: r }) => {
160
+ format: W.format.combine(
161
+ W.format.printf(({ level: e, message: r }) => {
162
162
  const t = " ".repeat(e.length + 2), i = r.split(`
163
163
  `).map((c, n) => n === 0 ? c : t + c).join(`
164
164
  `);
165
- return `${((c) => j.format.colorize().colorize(c, c))(e)}: ${i}`;
165
+ return `${((c) => W.format.colorize().colorize(c, c))(e)}: ${i}`;
166
166
  })
167
167
  ),
168
168
  transports: [
169
- new j.transports.Console({
169
+ new W.transports.Console({
170
170
  stderrLevels: ["error", "warn", "info", "debug"],
171
171
  handleExceptions: !0
172
172
  })
@@ -177,14 +177,14 @@ function yr(a) {
177
177
  return sr(Math.ceil(a / 2)).toString("hex").slice(0, a);
178
178
  }
179
179
  function Pr(a) {
180
- return a.startsWith("~") ? f.join(p.homedir(), a.slice(1)) : a;
180
+ return a.startsWith("~") ? u.join(_.homedir(), a.slice(1)) : a;
181
181
  }
182
- function q(a) {
183
- o.existsSync(a) || o.mkdirSync(a, { recursive: !0 });
182
+ function q(a, e) {
183
+ l.existsSync(a) || (l.mkdirSync(a, { recursive: !0 }), e != null && e.mode && l.chmodSync(a, e.mode));
184
184
  }
185
185
  function br(a) {
186
186
  try {
187
- if (p.platform() !== "win32")
187
+ if (_.platform() !== "win32")
188
188
  return Me(`ps -p ${a} -o comm=`, { encoding: "utf8" }).trim();
189
189
  const e = `wmic process where processid=${a} get Caption`, r = Me(e, { encoding: "utf8" }).split(`
190
190
  `);
@@ -199,43 +199,49 @@ const vr = K.object({
199
199
  blockName: K.string().min(1)
200
200
  });
201
201
  async function wr(a) {
202
- const e = kr(), r = f.join(process.cwd(), e.blockName);
202
+ const e = kr(), r = u.join(process.cwd(), e.blockName);
203
203
  a.info("Downloading boilerplate code..."), await Sr(
204
204
  "https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip",
205
205
  "platforma-block-boilerplate-main",
206
206
  r
207
207
  ), a.info("Replace everything in the template with provided options..."), Ar(
208
208
  r,
209
- /pl-open\/my-org.block-boilerplate/g,
210
- `${e.npmOrgName}/${e.orgName}.${e.blockName}`
211
- );
209
+ [
210
+ { from: /platforma-open/g, to: e.npmOrgName },
211
+ { from: /my-org/g, to: e.orgName },
212
+ { from: /block-boilerplate/g, to: e.blockName }
213
+ ]
214
+ ), a.info("Remove github actions directory"), l.rmSync(u.join(r, ".github"), { recursive: !0, force: !0 });
212
215
  }
213
216
  function kr() {
214
- let a = V.question('Write an organization name for npm. Default is "pl-open": ');
215
- a === "" && (a = "pl-open");
217
+ let a = V.question('Write an organization name for npm. Default is "platforma-open": ');
218
+ a === "" && (a = "platforma-open");
216
219
  const e = V.question('Write an organization name, e.g. "my-org": '), r = V.question('Write a name of the block, e.g. "hello-world": ');
217
220
  return vr.parse({ npmOrgName: a, orgName: e, blockName: r });
218
221
  }
219
222
  async function Sr(a, e, r) {
220
- const i = await (await fetch(a)).blob(), s = o.mkdtempSync(f.join(p.tmpdir(), "create-repo")), c = f.join(s, "packed-repo.zip"), n = cr.toWeb(tr(c));
223
+ const i = await (await fetch(a)).blob(), s = l.mkdtempSync(u.join(_.tmpdir(), "create-repo")), c = u.join(s, "packed-repo.zip"), n = cr.toWeb(tr(c));
221
224
  await i.stream().pipeTo(n);
222
- const h = f.join(s, "unpacked-repo");
223
- o.mkdirSync(h), await nr(c, h), o.cpSync(f.join(h, e), r, { recursive: !0 });
225
+ const h = u.join(s, "unpacked-repo");
226
+ l.mkdirSync(h), await nr(c, h), l.cpSync(u.join(h, e), r, { recursive: !0 });
224
227
  }
225
- function Ar(a, e, r) {
226
- Lr(a).forEach((t) => Rr(t, e, r));
228
+ function Ar(a, e) {
229
+ const r = Lr(a);
230
+ e.forEach(({ from: t, to: i }) => {
231
+ r.forEach((s) => Rr(s, t, i));
232
+ });
227
233
  }
228
234
  function Lr(a) {
229
- return o.readdirSync(a, {
235
+ return l.readdirSync(a, {
230
236
  withFileTypes: !0,
231
237
  recursive: !0
232
- }).filter((r) => r.isFile()).map((r) => f.join(r.parentPath, r.name));
238
+ }).filter((r) => r.isFile()).map((r) => u.join(r.parentPath, r.name));
233
239
  }
234
240
  function Rr(a, e, r) {
235
- const i = o.readFileSync(a).toString().replaceAll(e, r);
236
- o.writeFileSync(a, i);
241
+ const i = l.readFileSync(a).toString().replaceAll(e, r);
242
+ l.writeFileSync(a, i);
237
243
  }
238
- const I = class I extends O {
244
+ const I = class I extends $ {
239
245
  async run() {
240
246
  const { flags: e } = await this.parse(I), r = E(e["log-level"]);
241
247
  await wr(r);
@@ -248,14 +254,14 @@ let se = I;
248
254
  function ze(...a) {
249
255
  return ar(__dirname, "..", ...a);
250
256
  }
251
- function $(...a) {
257
+ function O(...a) {
252
258
  return ze("assets", ...a);
253
259
  }
254
- function pr() {
255
- return o.readdirSync($()).filter((e) => e.startsWith("compose-") && e.endsWith(".yaml")).map((e) => $(e));
260
+ function _r() {
261
+ return l.readdirSync(O()).filter((e) => e.startsWith("compose-") && e.endsWith(".yaml")).map((e) => O(e));
256
262
  }
257
263
  function Ke(...a) {
258
- return o.readFileSync(ze(...a));
264
+ return l.readFileSync(ze(...a));
259
265
  }
260
266
  var ae;
261
267
  function te() {
@@ -272,15 +278,15 @@ const F = class F {
272
278
  });
273
279
  m(this, "filePath");
274
280
  m(this, "dirPath");
275
- e = e ?? f.resolve(p.homedir(), ".config", "pl-bootstrap");
276
- const r = f.join(e, "state.json");
277
- this.dirPath = e, this.filePath = r, o.existsSync(e) || o.mkdirSync(e, { recursive: !0 }), o.existsSync(r) && (this.state = JSON.parse(Ke(r).toString()));
281
+ e = e ?? u.resolve(_.homedir(), ".config", "pl-bootstrap");
282
+ const r = u.join(e, "state.json");
283
+ this.dirPath = e, this.filePath = r, l.existsSync(e) || l.mkdirSync(e, { recursive: !0 }), l.existsSync(r) && (this.state = JSON.parse(Ke(r).toString()));
278
284
  }
279
285
  static getInstance() {
280
286
  return F.instance || (F.instance = new F()), F.instance;
281
287
  }
282
288
  path(...e) {
283
- return f.join(this.dirPath, ...e);
289
+ return u.join(this.dirPath, ...e);
284
290
  }
285
291
  data(...e) {
286
292
  return this.path("data", ...e);
@@ -289,7 +295,7 @@ const F = class F {
289
295
  return this.path("binaries", ...e);
290
296
  }
291
297
  writeState() {
292
- o.writeFileSync(this.filePath, JSON.stringify(this.state));
298
+ l.writeFileSync(this.filePath, JSON.stringify(this.state));
293
299
  }
294
300
  get isActive() {
295
301
  var e, r;
@@ -314,55 +320,55 @@ const F = class F {
314
320
  };
315
321
  m(F, "instance");
316
322
  let ce = F;
317
- const l = ce.getInstance();
323
+ const o = ce.getInstance();
318
324
  function Be(a, e, r, t) {
319
325
  var i;
320
- return l.lastRun = {
321
- ...l.lastRun,
326
+ return o.lastRun = {
327
+ ...o.lastRun,
322
328
  mode: "docker",
323
329
  cmd: "docker",
324
330
  args: e,
325
331
  workdir: r.cwd,
326
332
  envs: r.env,
327
333
  docker: {
328
- ...(i = l.lastRun) == null ? void 0 : i.docker,
334
+ ...(i = o.lastRun) == null ? void 0 : i.docker,
329
335
  ...t
330
336
  }
331
337
  }, qe(a, "docker", e, r);
332
338
  }
333
- function _r(a, e, r, t, i) {
339
+ function pr(a, e, r, t, i) {
334
340
  var c;
335
- l.lastRun = {
336
- ...l.lastRun,
341
+ o.lastRun = {
342
+ ...o.lastRun,
337
343
  mode: "process",
338
344
  cmd: e,
339
345
  args: r,
340
346
  workdir: t.cwd,
341
347
  envs: t.env,
342
348
  process: {
343
- ...(c = l.lastRun) == null ? void 0 : c.process,
349
+ ...(c = o.lastRun) == null ? void 0 : c.process,
344
350
  ...i
345
351
  }
346
352
  };
347
- const s = Or(a, e, r, t);
348
- return l.lastRun.process = {
349
- ...l.lastRun.process,
353
+ const s = $r(a, e, r, t);
354
+ return o.lastRun.process = {
355
+ ...o.lastRun.process,
350
356
  pid: s.pid
351
357
  }, s;
352
358
  }
353
- function $r(a, e) {
354
- if (!l.lastRun)
359
+ function Or(a, e) {
360
+ if (!o.lastRun)
355
361
  throw new Error("no previous run info found: this is the first run after package installation");
356
362
  return e = {
357
- cwd: l.lastRun.workdir,
363
+ cwd: o.lastRun.workdir,
358
364
  env: {
359
- ...l.lastRun.envs,
365
+ ...o.lastRun.envs,
360
366
  ...e.env
361
367
  },
362
368
  ...e
363
- }, qe(a, l.lastRun.cmd, l.lastRun.args, e);
369
+ }, qe(a, o.lastRun.cmd, o.lastRun.args, e);
364
370
  }
365
- function Or(a, e, r, t) {
371
+ function $r(a, e, r, t) {
366
372
  a.debug(
367
373
  `Running:
368
374
  env: ${JSON.stringify(t.env)}
@@ -458,16 +464,16 @@ function N(a, e, r) {
458
464
  }
459
465
  }
460
466
  function Er(a, e) {
461
- var d, b, w, S, L, k, _, W, A, ye, Pe, be, ve, we, ke, Se, Ae, Le, Re, pe, _e, $e, Oe, Te, Ee, Fe, De, Ne, Ie, xe;
462
- const r = (e == null ? void 0 : e.localRoot) ?? l.data("local-custom"), t = {
467
+ var d, b, w, S, L, k, p, j, A, ye, Pe, be, ve, we, ke, Se, Ae, Le, Re, _e, pe, Oe, $e, Te, Ee, Fe, De, Ne, Ie, xe;
468
+ const r = (e == null ? void 0 : e.localRoot) ?? o.data("local-custom"), t = {
463
469
  level: ((d = e == null ? void 0 : e.log) == null ? void 0 : d.level) ?? "info",
464
470
  path: ((b = e == null ? void 0 : e.log) == null ? void 0 : b.path) ?? `${r}/platforma.log`
465
471
  }, i = {
466
472
  listen: ((w = e == null ? void 0 : e.grpc) == null ? void 0 : w.listen) ?? "localhost:6345",
467
473
  tls: {
468
474
  enable: z((L = (S = e == null ? void 0 : e.grpc) == null ? void 0 : S.tls) == null ? void 0 : L.enable, !1),
469
- clientAuthMode: ((_ = (k = e == null ? void 0 : e.grpc) == null ? void 0 : k.tls) == null ? void 0 : _.clientAuthMode) ?? "NoAuth",
470
- certFile: ((A = (W = e == null ? void 0 : e.grpc) == null ? void 0 : W.tls) == null ? void 0 : A.certFile) ?? `${r}/certs/tls.cert`,
475
+ clientAuthMode: ((p = (k = e == null ? void 0 : e.grpc) == null ? void 0 : k.tls) == null ? void 0 : p.clientAuthMode) ?? "NoAuth",
476
+ certFile: ((A = (j = e == null ? void 0 : e.grpc) == null ? void 0 : j.tls) == null ? void 0 : A.certFile) ?? `${r}/certs/tls.cert`,
471
477
  keyFile: ((Pe = (ye = e == null ? void 0 : e.grpc) == null ? void 0 : ye.tls) == null ? void 0 : Pe.keyFile) ?? `${r}/certs/tls.key`,
472
478
  ...(be = e == null ? void 0 : e.grpc) == null ? void 0 : be.tls
473
479
  }
@@ -492,12 +498,12 @@ function Er(a, e) {
492
498
  switch ((Re = (Le = e == null ? void 0 : e.storages) == null ? void 0 : Le.work) == null ? void 0 : Re.type) {
493
499
  case void 0:
494
500
  case "FS":
495
- n = Ve("work"), n.rootPath = ((_e = (pe = e == null ? void 0 : e.storages) == null ? void 0 : pe.work) == null ? void 0 : _e.rootPath) ?? `${r}/storages/work`, n.indexCachePeriod = ((Oe = ($e = e == null ? void 0 : e.storages) == null ? void 0 : $e.work) == null ? void 0 : Oe.indexCachePeriod) ?? "1m";
501
+ n = Ve("work"), n.rootPath = ((pe = (_e = e == null ? void 0 : e.storages) == null ? void 0 : _e.work) == null ? void 0 : pe.rootPath) ?? `${r}/storages/work`, n.indexCachePeriod = (($e = (Oe = e == null ? void 0 : e.storages) == null ? void 0 : Oe.work) == null ? void 0 : $e.indexCachePeriod) ?? "1m";
496
502
  break;
497
503
  default:
498
504
  throw new Error("work storage MUST have 'FS' type as it is used for working directories management");
499
505
  }
500
- const u = Ge(
506
+ const f = Ge(
501
507
  "library",
502
508
  `${r}/storages/library`,
503
509
  "library-bucket",
@@ -520,7 +526,7 @@ function Er(a, e) {
520
526
  core: s,
521
527
  monitoring: g,
522
528
  debug: v,
523
- storages: { primary: c, work: n, library: u },
529
+ storages: { primary: c, work: n, library: f },
524
530
  hacks: { libraryDownloadable: !0 }
525
531
  };
526
532
  }
@@ -542,7 +548,7 @@ function Ge(a, e, r, t) {
542
548
  function Fr(a) {
543
549
  const e = a.monitoring.enabled ? "" : " disabled", r = a.debug.enabled ? "" : " disabled", t = a.hacks.libraryDownloadable ? "true" : "false";
544
550
  var i = a.license.value;
545
- return a.license.file != "" && (i = o.readFileSync(a.license.file).toString().trimEnd()), `
551
+ return a.license.file != "" && (i = l.readFileSync(a.license.file).toString().trimEnd()), `
546
552
  license:
547
553
  value: '${a.license.value}'
548
554
  file: '${a.license.file}'
@@ -618,7 +624,7 @@ function z(a, e) {
618
624
  }
619
625
  const Dr = ["linux", "macos", "windows"];
620
626
  function Nr(a) {
621
- const e = p.platform();
627
+ const e = _.platform();
622
628
  switch (e) {
623
629
  case "darwin":
624
630
  return "macos";
@@ -634,7 +640,7 @@ function Nr(a) {
634
640
  }
635
641
  const Ir = ["amd64", "arm64"];
636
642
  function Qe(a) {
637
- const e = p.arch();
643
+ const e = _.arch();
638
644
  switch (e) {
639
645
  case "arm64":
640
646
  return "arm64";
@@ -647,34 +653,34 @@ function Qe(a) {
647
653
  }
648
654
  }
649
655
  function xr(a, e) {
650
- const r = (e == null ? void 0 : e.version) ?? te()["pl-version"], t = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, i = `pl-${r}-${Qe()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${Nr()}/${i}`, c = (e == null ? void 0 : e.saveTo) ?? l.binaries(i);
651
- if (o.existsSync(c))
656
+ const r = (e == null ? void 0 : e.version) ?? te()["pl-version"], t = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, i = `pl-${r}-${Qe()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${Nr()}/${i}`, c = (e == null ? void 0 : e.saveTo) ?? o.binaries(i);
657
+ if (l.existsSync(c))
652
658
  return a.info(`Platforma Backend archive download skipped: '${c}' already exists`), Promise.resolve(c);
653
- o.mkdirSync(f.dirname(c), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
659
+ l.mkdirSync(u.dirname(c), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
654
660
  URL: ${s}
655
661
  Save to: ${c}`);
656
662
  const n = lr.get(s);
657
- return new Promise((h, u) => {
663
+ return new Promise((h, f) => {
658
664
  n.on("response", (g) => {
659
665
  if (!g.statusCode) {
660
666
  const b = new Error("failed to download archive: no HTTP status code in response from server");
661
- n.destroy(), u(b);
667
+ n.destroy(), f(b);
662
668
  return;
663
669
  }
664
670
  if (g.statusCode !== 200) {
665
671
  const b = new Error(`failed to download archive: ${g.statusCode} ${g.statusMessage}`);
666
- n.destroy(), u(b);
672
+ n.destroy(), f(b);
667
673
  return;
668
674
  }
669
675
  const v = parseInt(g.headers["content-length"] || "0", 10);
670
676
  let P = 0;
671
- const d = o.createWriteStream(c);
677
+ const d = l.createWriteStream(c);
672
678
  g.pipe(d), g.on("data", (b) => {
673
679
  P += b.length;
674
680
  const w = P / v * 100;
675
681
  t && process.stdout.write(` downloading: ${w.toFixed(2)}%\r`);
676
682
  }), g.on("error", (b) => {
677
- o.unlinkSync(c), a.error(`Failed to download Platforma Binary: ${b.message}`), n.destroy(), u(b);
683
+ l.unlinkSync(c), a.error(`Failed to download Platforma Binary: ${b.message}`), n.destroy(), f(b);
678
684
  }), d.on("finish", () => {
679
685
  d.close(), a.info(" ... download done."), n.destroy(), h(c);
680
686
  });
@@ -685,16 +691,16 @@ function Mr(a, e) {
685
691
  a.debug("extracting archive...");
686
692
  const r = (e == null ? void 0 : e.version) ?? te()["pl-version"];
687
693
  a.debug(` version: '${r}'`);
688
- const t = `${Ze({ version: r })}.tgz`, i = (e == null ? void 0 : e.archivePath) ?? l.binaries(t);
694
+ const t = `${Ze({ version: r })}.tgz`, i = (e == null ? void 0 : e.archivePath) ?? o.binaries(t);
689
695
  a.debug(` archive path: '${i}'`);
690
696
  const s = (e == null ? void 0 : e.extractTo) ?? Br(i);
691
- if (a.debug(` target dir: '${s}'`), o.existsSync(s))
697
+ if (a.debug(` target dir: '${s}'`), l.existsSync(s))
692
698
  return a.info(`Platforma Backend binaries unpack skipped: '${s}' exists`), s;
693
- if (!o.existsSync(i)) {
699
+ if (!l.existsSync(i)) {
694
700
  const c = `Platforma Backend binary archive not found at '${i}'`;
695
701
  throw a.error(c), new Error(c);
696
702
  }
697
- return o.existsSync(s) || (a.debug(` creating target dir '${s}'`), o.mkdirSync(s, { recursive: !0 })), a.info(`Unpacking Platforma Backend archive:
703
+ return l.existsSync(s) || (a.debug(` creating target dir '${s}'`), l.mkdirSync(s, { recursive: !0 })), a.info(`Unpacking Platforma Backend archive:
698
704
  Archive: ${i}
699
705
  Target dir: ${s}`), or.x({
700
706
  file: i,
@@ -710,7 +716,7 @@ function Ze(a) {
710
716
  return `pl-${(a == null ? void 0 : a.version) ?? te()["pl-version"]}-${Qe()}`;
711
717
  }
712
718
  function Cr(a, ...e) {
713
- return l.binaries(Ze({ version: a }), ...e);
719
+ return o.binaries(Ze({ version: a }), ...e);
714
720
  }
715
721
  function Br(a) {
716
722
  const e = a.lastIndexOf(".");
@@ -721,19 +727,19 @@ class D {
721
727
  this.logger = e;
722
728
  }
723
729
  startLast() {
724
- const e = $r(this.logger, { stdio: "inherit" });
730
+ const e = Or(this.logger, { stdio: "inherit" });
725
731
  J(e, "failed to bring back Platforma Backend in the last started configuration");
726
732
  }
727
733
  startLocal(e) {
728
- var h, u, g, v, P, d, b, w, S, L;
734
+ var h, f, g, v, P, d, b, w, S, L;
729
735
  const r = (e == null ? void 0 : e.binaryPath) ?? Cr(e == null ? void 0 : e.version, "binaries", "platforma");
730
736
  var t = e == null ? void 0 : e.configPath;
731
- const i = (e == null ? void 0 : e.workdir) ?? (t ? process.cwd() : l.path());
737
+ const i = (e == null ? void 0 : e.workdir) ?? (t ? process.cwd() : o.path());
732
738
  e != null && e.primaryURL && (e.configOptions = {
733
739
  ...e.configOptions,
734
740
  storages: {
735
741
  ...(h = e.configOptions) == null ? void 0 : h.storages,
736
- primary: N(e.primaryURL, i, (g = (u = e.configOptions) == null ? void 0 : u.storages) == null ? void 0 : g.primary)
742
+ primary: N(e.primaryURL, i, (g = (f = e.configOptions) == null ? void 0 : f.storages) == null ? void 0 : g.primary)
737
743
  }
738
744
  }), e != null && e.libraryURL && (e.configOptions = {
739
745
  ...e.configOptions,
@@ -751,10 +757,10 @@ class D {
751
757
  ];
752
758
  s.storages.primary.type === "FS" && c.push(s.storages.primary.rootPath), s.storages.library.type === "FS" && (c.push(s.storages.library.rootPath), s.hacks.libraryDownloadable = !1), s.storages.work.type === "FS" && c.push(s.storages.work.rootPath), this.logger.debug(" creating pl state directories...");
753
759
  for (const k of c)
754
- o.existsSync(k) || (this.logger.debug(` '${k}'`), o.mkdirSync(k, { recursive: !0 }));
760
+ l.existsSync(k) || (this.logger.debug(` '${k}'`), l.mkdirSync(k, { recursive: !0 }));
755
761
  for (const k of s.core.auth.drivers)
756
- k.driver === "htpasswd" && (o.existsSync(k.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${k.path}...`), o.copyFileSync($("users.htpasswd"), k.path)));
757
- t || (t = f.join(s.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${t}'...`), o.writeFileSync(t, Fr(s)));
762
+ k.driver === "htpasswd" && (l.existsSync(k.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${k.path}...`), l.copyFileSync(O("users.htpasswd"), k.path)));
763
+ t || (t = u.join(s.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${t}'...`), l.writeFileSync(t, Fr(s)));
758
764
  const n = this.renderRunInfo({
759
765
  configPath: t,
760
766
  dbPath: s.core.db.path,
@@ -765,7 +771,7 @@ class D {
765
771
  library: s.storages.library
766
772
  });
767
773
  return this.logger.info(`Starting platforma:
768
- ${n}`), _r(
774
+ ${n}`), pr(
769
775
  this.logger,
770
776
  r,
771
777
  ["-config", t],
@@ -785,7 +791,7 @@ ${n}`), _r(
785
791
  return this.startMinio({
786
792
  minioPort: r,
787
793
  minioConsolePort: e == null ? void 0 : e.minioConsolePort,
788
- storage: t ? f.join(t, "minio") : void 0
794
+ storage: t ? u.join(t, "minio") : void 0
789
795
  }), this.startLocal({
790
796
  ...e,
791
797
  primaryURL: (e == null ? void 0 : e.primaryURL) ?? `s3e://testuser:testpassword@localhost:${r}/main-bucket/?region=no-region`,
@@ -794,18 +800,18 @@ ${n}`), _r(
794
800
  }
795
801
  startMinio(e) {
796
802
  this.logger.debug(" starting minio...");
797
- var r = $("compose-backend.yaml");
803
+ var r = O("compose-backend.yaml");
798
804
  const t = e != null && e.version ? `:${e.version}` : "";
799
805
  this.logger.debug(` minio version: ${t}`);
800
806
  const i = (e == null ? void 0 : e.image) ?? `quay.io/minio/minio${t}`;
801
807
  this.logger.debug(` minio image: ${i}`);
802
- const s = (e == null ? void 0 : e.storage) ?? l.data("minio");
803
- q(s);
804
- const c = l.data("stub");
808
+ const s = (e == null ? void 0 : e.storage) ?? o.data("minio");
809
+ q(s, { mode: "0775" });
810
+ const c = o.data("stub");
805
811
  q(c);
806
- const n = (e == null ? void 0 : e.minioPort) ?? 9e3, h = (e == null ? void 0 : e.minioConsolePort) ?? 9001, u = {
812
+ const n = (e == null ? void 0 : e.minioPort) ?? 9e3, h = (e == null ? void 0 : e.minioConsolePort) ?? 9001, f = {
807
813
  MINIO_IMAGE: i,
808
- MINIO_STORAGE: f.resolve(s),
814
+ MINIO_STORAGE: u.resolve(s),
809
815
  MINIO_PORT: n.toString(),
810
816
  MINIO_CONSOLE_PORT: h.toString(),
811
817
  PL_DATA_DB_ROOT: c,
@@ -822,7 +828,7 @@ ${n}`), _r(
822
828
  {
823
829
  env: {
824
830
  ...process.env,
825
- ...u
831
+ ...f
826
832
  },
827
833
  stdio: "inherit"
828
834
  }
@@ -830,7 +836,7 @@ ${n}`), _r(
830
836
  J(g, "failed to start MinIO service in docker");
831
837
  }
832
838
  buildPlatforma(e) {
833
- const r = f.resolve(e.repoRoot, "cmd", "platforma"), t = e.binPath ?? f.join(p.tmpdir(), "platforma-local-build");
839
+ const r = u.resolve(e.repoRoot, "cmd", "platforma"), t = e.binPath ?? u.join(_.tmpdir(), "platforma-local-build");
834
840
  this.logger.info("Building Platforma Backend binary from sources"), this.logger.info(` sources path: ${e.repoRoot}`), this.logger.info(` binary path: ${t}`);
835
841
  const i = H("go", ["build", "-o", t, "."], {
836
842
  cwd: r,
@@ -839,23 +845,23 @@ ${n}`), _r(
839
845
  return J(i, "failed to build platforma binary from sources using 'go build' command"), t;
840
846
  }
841
847
  startDockerS3(e, r) {
842
- const t = $("compose-backend.yaml"), i = (r == null ? void 0 : r.image) ?? ie(r == null ? void 0 : r.version);
848
+ const t = O("compose-backend.yaml"), i = (r == null ? void 0 : r.image) ?? ie(r == null ? void 0 : r.version);
843
849
  this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
844
- const s = (S) => f.join(e, S), c = (S) => {
850
+ const s = (S) => u.join(e, S), c = (S) => {
845
851
  const L = s(S);
846
- return q(L), L;
852
+ return q(L, { mode: "0775" }), L;
847
853
  }, n = s("platforma.log");
848
- o.existsSync(n) || (o.mkdirSync(f.dirname(n), { recursive: !0 }), o.writeFileSync(n, ""));
854
+ l.existsSync(n) || (l.mkdirSync(u.dirname(n), { recursive: !0 }), l.writeFileSync(n, ""));
849
855
  const h = N("s3e://testuser:testpassword@minio:9000/main-bucket");
850
856
  if (h.type !== "S3")
851
857
  throw new Error("primary storage must have 'S3' type in 'docker s3' configuration");
852
858
  h.presignEndpoint = "http://localhost:9000";
853
- const u = N("s3e://testuser:testpassword@minio:9000/library-bucket");
854
- if (u.type !== "S3")
855
- throw new Error(`${u.type} storage type is not supported for library storage`);
856
- u.presignEndpoint = "http://localhost:9000";
859
+ const f = N("s3e://testuser:testpassword@minio:9000/library-bucket");
860
+ if (f.type !== "S3")
861
+ throw new Error(`${f.type} storage type is not supported for library storage`);
862
+ f.presignEndpoint = "http://localhost:9000";
857
863
  const g = c("db"), v = c("work"), P = s("users.htpasswd");
858
- o.existsSync(P) || o.copyFileSync($("users.htpasswd"), P);
864
+ l.existsSync(P) || l.copyFileSync(O("users.htpasswd"), P);
859
865
  const d = {
860
866
  MINIO_IMAGE: "quay.io/minio/minio",
861
867
  MINIO_STORAGE: c("minio"),
@@ -871,11 +877,11 @@ ${n}`), _r(
871
877
  PL_DATA_WORKDIR_ROOT: v,
872
878
  PL_DATA_PACKAGE_ROOT: c("packages"),
873
879
  ...this.configureDockerStorage("primary", h),
874
- ...this.configureDockerStorage("library", u)
880
+ ...this.configureDockerStorage("library", f)
875
881
  };
876
882
  if (r != null && r.grpcAddr && (d.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (d.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (d.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (d.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (d.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (d.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (d.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
877
883
  for (const S of r.auth.drivers)
878
- S.driver === "htpasswd" && (d.PL_AUTH_HTPASSWD_PATH = f.resolve(S.path), S.path = "/etc/platforma/users.htpasswd");
884
+ S.driver === "htpasswd" && (d.PL_AUTH_HTPASSWD_PATH = u.resolve(S.path), S.path = "/etc/platforma/users.htpasswd");
879
885
  d.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
880
886
  }
881
887
  const b = Be(
@@ -899,31 +905,31 @@ ${n}`), _r(
899
905
  composePath: t
900
906
  }
901
907
  );
902
- J(b, "failed to start Platforma Backend in Docker"), l.isActive = !0;
908
+ J(b, "failed to start Platforma Backend in Docker"), o.isActive = !0;
903
909
  const w = this.renderRunInfo({
904
910
  apiPort: r == null ? void 0 : r.grpcPort,
905
911
  apiAddr: r == null ? void 0 : r.grpcAddr,
906
912
  logPath: n,
907
913
  primary: h,
908
914
  work: { type: "FS", rootPath: v },
909
- library: u,
915
+ library: f,
910
916
  dbPath: g
911
917
  });
912
918
  this.logger.info(`Started platforma:
913
919
  ${w}`);
914
920
  }
915
921
  startDocker(e, r) {
916
- var t = $("compose-backend.yaml");
922
+ var t = O("compose-backend.yaml");
917
923
  const i = (r == null ? void 0 : r.image) ?? ie(r == null ? void 0 : r.version);
918
924
  this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
919
- const s = (k) => f.join(e, k), c = (k) => {
920
- const _ = s(k);
921
- return q(_), _;
925
+ const s = (k) => u.join(e, k), c = (k) => {
926
+ const p = s(k);
927
+ return q(p, { mode: "0775" }), p;
922
928
  }, n = s("platforma.log");
923
- o.existsSync(n) || (o.mkdirSync(f.dirname(n), { recursive: !0 }), o.writeFileSync(n, ""));
924
- const h = c("db"), u = c("primary"), g = c("library"), v = c("work"), P = s("users.htpasswd");
925
- o.existsSync(P) || o.copyFileSync($("users.htpasswd"), P);
926
- const d = N((r == null ? void 0 : r.primaryStorageURL) ?? `file:${u}`, "."), b = N((r == null ? void 0 : r.libraryStorageURL) ?? `file:${g}`, "."), w = {
929
+ l.existsSync(n) || (l.mkdirSync(u.dirname(n), { recursive: !0 }), l.writeFileSync(n, ""));
930
+ const h = c("db"), f = c("primary"), g = c("library"), v = c("work"), P = s("users.htpasswd");
931
+ l.existsSync(P) || l.copyFileSync(O("users.htpasswd"), P);
932
+ const d = N((r == null ? void 0 : r.primaryStorageURL) ?? `file:${f}`, "."), b = N((r == null ? void 0 : r.libraryStorageURL) ?? `file:${g}`, "."), w = {
927
933
  MINIO_IMAGE: "quay.io/minio/minio",
928
934
  MINIO_STORAGE: c("minio"),
929
935
  PL_IMAGE: i,
@@ -933,7 +939,7 @@ ${w}`);
933
939
  PL_LOG_LEVEL: "info",
934
940
  PL_LOG_FILE: n,
935
941
  PL_DATA_DB_ROOT: h,
936
- PL_DATA_PRIMARY_ROOT: u,
942
+ PL_DATA_PRIMARY_ROOT: f,
937
943
  PL_DATA_LIBRARY_ROOT: g,
938
944
  PL_DATA_WORKDIR_ROOT: v,
939
945
  PL_DATA_PACKAGE_ROOT: c("packages"),
@@ -942,7 +948,7 @@ ${w}`);
942
948
  };
943
949
  if (r != null && r.grpcAddr && (w.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (w.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (w.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (w.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (w.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (w.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (w.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
944
950
  for (const k of r.auth.drivers)
945
- k.driver === "htpasswd" && (w.PL_AUTH_HTPASSWD_PATH = f.resolve(k.path), k.path = "/etc/platforma/users.htpasswd");
951
+ k.driver === "htpasswd" && (w.PL_AUTH_HTPASSWD_PATH = u.resolve(k.path), k.path = "/etc/platforma/users.htpasswd");
946
952
  w.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
947
953
  }
948
954
  const S = Be(
@@ -955,12 +961,12 @@ ${w}`);
955
961
  {
956
962
  plImage: i,
957
963
  composePath: t,
958
- primaryPath: u,
964
+ primaryPath: f,
959
965
  workPath: v,
960
966
  libraryPath: g
961
967
  }
962
968
  );
963
- J(S, "failed to start Platforma Backend in Docker"), l.isActive = !0;
969
+ J(S, "failed to start Platforma Backend in Docker"), o.isActive = !0;
964
970
  const L = this.renderRunInfo({
965
971
  apiPort: r == null ? void 0 : r.grpcPort,
966
972
  apiAddr: r == null ? void 0 : r.grpcAddr,
@@ -974,11 +980,11 @@ ${w}`);
974
980
  ${L}`);
975
981
  }
976
982
  stop() {
977
- if (!l.isActive) {
983
+ if (!o.isActive) {
978
984
  console.log("no running service detected");
979
985
  return;
980
986
  }
981
- const e = l.lastRun;
987
+ const e = o.lastRun;
982
988
  switch (e.mode) {
983
989
  case "docker":
984
990
  const r = H("docker", ["compose", "--file", e.docker.composePath, "down"], {
@@ -988,31 +994,31 @@ ${L}`);
988
994
  },
989
995
  stdio: "inherit"
990
996
  });
991
- l.isActive = !1, r.status !== 0 && process.exit(r.status);
997
+ o.isActive = !1, r.status !== 0 && process.exit(r.status);
992
998
  return;
993
999
  case "process":
994
- l.isValidPID && process.kill(e.process.pid), l.isActive = !1;
1000
+ o.isValidPID && process.kill(e.process.pid), o.isActive = !1;
995
1001
  return;
996
1002
  default:
997
1003
  Y(e.mode);
998
1004
  }
999
1005
  }
1000
1006
  cleanup() {
1001
- var n, h, u, g, v, P, d, b, w, S, L, k, _, W;
1007
+ var n, h, f, g, v, P, d, b, w, S, L, k, p, j;
1002
1008
  const e = [
1003
1009
  "last command run cache ('pl-service start' shorthand will stop working until next full start command call)",
1004
1010
  "'platforma' docker compose service containers and volumes"
1005
- ], r = l.data(), t = [r];
1006
- if ((h = (n = l.lastRun) == null ? void 0 : n.docker) != null && h.primaryPath) {
1007
- const A = (g = (u = l.lastRun) == null ? void 0 : u.docker) == null ? void 0 : g.primaryPath;
1011
+ ], r = o.data(), t = [r];
1012
+ if ((h = (n = o.lastRun) == null ? void 0 : n.docker) != null && h.primaryPath) {
1013
+ const A = (g = (f = o.lastRun) == null ? void 0 : f.docker) == null ? void 0 : g.primaryPath;
1008
1014
  A.startsWith(r) || t.push(A);
1009
1015
  }
1010
- if ((P = (v = l.lastRun) == null ? void 0 : v.docker) != null && P.workPath) {
1011
- const A = (b = (d = l.lastRun) == null ? void 0 : d.docker) == null ? void 0 : b.workPath;
1016
+ if ((P = (v = o.lastRun) == null ? void 0 : v.docker) != null && P.workPath) {
1017
+ const A = (b = (d = o.lastRun) == null ? void 0 : d.docker) == null ? void 0 : b.workPath;
1012
1018
  A.startsWith(r) || t.push(A);
1013
1019
  }
1014
- if ((S = (w = l.lastRun) == null ? void 0 : w.process) != null && S.storagePath) {
1015
- const A = (k = (L = l.lastRun) == null ? void 0 : L.process) == null ? void 0 : k.storagePath;
1020
+ if ((S = (w = o.lastRun) == null ? void 0 : w.process) != null && S.storagePath) {
1021
+ const A = (k = (L = o.lastRun) == null ? void 0 : L.process) == null ? void 0 : k.storagePath;
1016
1022
  A.startsWith(r) || t.push(A);
1017
1023
  }
1018
1024
  const i = t.length > 0 ? ` - storages (you'll loose all projects and calculation results stored in service instances):
@@ -1029,26 +1035,26 @@ ${i}
1029
1035
  this.logger.info("Reset action was canceled");
1030
1036
  return;
1031
1037
  }
1032
- const c = new Set(pr());
1033
- (W = (_ = l.lastRun) == null ? void 0 : _.docker) != null && W.composePath && c.add(l.lastRun.docker.composePath);
1038
+ const c = new Set(_r());
1039
+ (j = (p = o.lastRun) == null ? void 0 : p.docker) != null && j.composePath && c.add(o.lastRun.docker.composePath);
1034
1040
  for (const A of c)
1035
1041
  this.logger.info(`Destroying docker compose '${A}'`), this.destroyDocker(A, ie());
1036
1042
  for (const A of t)
1037
- this.logger.info(`Destroying '${A}'`), o.rmSync(A, { recursive: !0, force: !0 });
1038
- this.logger.info(`Destroying state dir '${l.path()}'`), o.rmSync(l.path(), { recursive: !0, force: !0 }), this.logger.info(
1043
+ this.logger.info(`Destroying '${A}'`), l.rmSync(A, { recursive: !0, force: !0 });
1044
+ this.logger.info(`Destroying state dir '${o.path()}'`), l.rmSync(o.path(), { recursive: !0, force: !0 }), this.logger.info(
1039
1045
  `
1040
- If you want to remove all downloaded platforma binaries, delete '${l.binaries()}' dir manually
1046
+ If you want to remove all downloaded platforma binaries, delete '${o.binaries()}' dir manually
1041
1047
  `
1042
1048
  );
1043
1049
  }
1044
1050
  mergeLicenseEnvs(e) {
1045
- 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 : o.existsSync(f.resolve(p.homedir(), ".pl.license")) && (e["license-file"] = f.resolve(p.homedir(), ".pl.license")));
1051
+ 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 : l.existsSync(u.resolve(_.homedir(), ".pl.license")) && (e["license-file"] = u.resolve(_.homedir(), ".pl.license")));
1046
1052
  }
1047
1053
  initAuthDriversList(e, r) {
1048
1054
  var t = [];
1049
1055
  if (e["auth-htpasswd-file"] && t.push({
1050
1056
  driver: "htpasswd",
1051
- path: f.resolve(r, e["auth-htpasswd-file"])
1057
+ path: u.resolve(r, e["auth-htpasswd-file"])
1052
1058
  }), !!e["auth-ldap-server"] != !!e["auth-ldap-default-dn"])
1053
1059
  throw new Error("LDAP auth settings require both 'server' and 'default DN' options to be set");
1054
1060
  if (e["auth-ldap-server"] && t.push({
@@ -1060,16 +1066,16 @@ If you want to remove all downloaded platforma binaries, delete '${l.binaries()}
1060
1066
  }
1061
1067
  /** Gets the last stored JWT secret key or generates it and stores in a file. */
1062
1068
  getLastJwt() {
1063
- const e = l.path("auth.jwt"), r = "utf-8";
1069
+ const e = o.path("auth.jwt"), r = "utf-8";
1064
1070
  let t = "";
1065
1071
  try {
1066
- t = o.readFileSync(e, { encoding: r });
1072
+ t = l.readFileSync(e, { encoding: r });
1067
1073
  } catch {
1068
1074
  }
1069
- return t == "" && (t = yr(64), o.writeFileSync(e, t, { encoding: r })), t;
1075
+ return t == "" && (t = yr(64), l.writeFileSync(e, t, { encoding: r })), t;
1070
1076
  }
1071
1077
  destroyDocker(e, r) {
1072
- const t = l.data("stub"), i = H("docker", ["compose", "--file", e, "down", "--volumes", "--remove-orphans"], {
1078
+ const t = o.data("stub"), i = H("docker", ["compose", "--file", e, "down", "--volumes", "--remove-orphans"], {
1073
1079
  env: {
1074
1080
  ...process.env,
1075
1081
  PL_IMAGE: "scratch",
@@ -1113,7 +1119,7 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
1113
1119
  }
1114
1120
  renderRunInfo(e, r = 10) {
1115
1121
  var n, h;
1116
- const t = [], i = (u) => u.padStart(r, " ");
1122
+ const t = [], i = (f) => f.padStart(r, " ");
1117
1123
  switch (e.configPath && t.push(`${i("config")}: ${e.configPath}`), e.apiAddr ? t.push(`${i("API")}: ${e.apiAddr}`) : e.apiPort ? t.push(`${i("API")}: 127.0.0.1:${e.apiPort.toString()}`) : t.push(`${i("API")}: 127.0.0.1:6345`), e.logPath && t.push(`${i("log")}: ${e.logPath}`), (n = e.primary) == null ? void 0 : n.type) {
1118
1124
  case void 0:
1119
1125
  break;
@@ -1146,11 +1152,11 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
1146
1152
  `);
1147
1153
  }
1148
1154
  readComposeFile(e) {
1149
- const r = o.readFileSync(e);
1155
+ const r = l.readFileSync(e);
1150
1156
  return Ce.parse(r.toString());
1151
1157
  }
1152
1158
  writeComposeFile(e, r) {
1153
- o.writeFileSync(e, Ce.stringify(r));
1159
+ l.writeFileSync(e, Ce.stringify(r));
1154
1160
  }
1155
1161
  }
1156
1162
  function J(a, e) {
@@ -1160,7 +1166,7 @@ function J(a, e) {
1160
1166
  if (a.status !== 0)
1161
1167
  throw new Error(`${r}, process exited with code '${a.status}'`);
1162
1168
  }
1163
- const x = class x extends O {
1169
+ const x = class x extends $ {
1164
1170
  async run() {
1165
1171
  const { flags: e } = await this.parse(x), r = E(e["log-level"]);
1166
1172
  new D(r).cleanup();
@@ -1170,7 +1176,7 @@ m(x, "description", "Clear service state (forget last run command, destroy docke
1170
1176
  ...T
1171
1177
  });
1172
1178
  let ne = x;
1173
- const M = class M extends O {
1179
+ const M = class M extends $ {
1174
1180
  async run() {
1175
1181
  const { flags: e } = await this.parse(M), r = E(e["log-level"]);
1176
1182
  new D(r).startLast();
@@ -1180,7 +1186,7 @@ m(M, "description", "Start last run service configuraiton"), m(M, "examples", ["
1180
1186
  ...T
1181
1187
  });
1182
1188
  let le = M;
1183
- const C = class C extends O {
1189
+ const C = class C extends $ {
1184
1190
  async run() {
1185
1191
  const { flags: e } = await this.parse(C), r = E(e["log-level"]);
1186
1192
  new D(r).stop();
@@ -1190,14 +1196,14 @@ m(C, "description", "Stop platforma service"), m(C, "examples", ["<%= config.bin
1190
1196
  ...T
1191
1197
  });
1192
1198
  let oe = C;
1193
- const B = class B extends O {
1199
+ const B = class B extends $ {
1194
1200
  async run() {
1195
1201
  const { flags: e } = await this.parse(B), r = E(e["log-level"]), t = new D(r);
1196
1202
  t.mergeLicenseEnvs(e);
1197
1203
  const i = e["auth-enabled"], s = i ? {
1198
1204
  enabled: i,
1199
1205
  drivers: t.initAuthDriversList(e, ".")
1200
- } : void 0, c = e.storage ? f.join(".", e.storage) : l.data("docker");
1206
+ } : void 0, c = e.storage ? u.join(".", e.storage) : o.data("docker");
1201
1207
  t.startDocker(c, {
1202
1208
  primaryStorageURL: e["storage-primary"],
1203
1209
  workStoragePath: e["storage-work"],
@@ -1229,13 +1235,13 @@ m(B, "description", "Run platforma backend service with 'FS' primary storage typ
1229
1235
  ...me
1230
1236
  });
1231
1237
  let de = B;
1232
- const G = class G extends O {
1238
+ const G = class G extends $ {
1233
1239
  async run() {
1234
1240
  const { flags: e } = await this.parse(G), r = E(e["log-level"]), t = new D(r);
1235
1241
  t.mergeLicenseEnvs(e);
1236
- const i = e["pl-workdir"] ?? ".", s = e.storage ? f.join(i, e.storage) : l.data("local"), c = e["pl-log-file"] ? f.join(i, e["pl-log-file"]) : void 0, n = t.initAuthDriversList(e, i), h = e["auth-enabled"] ?? n !== void 0;
1237
- var u = e["pl-binary"];
1238
- e["pl-sources"] && (u = t.buildPlatforma({ repoRoot: e["pl-sources"] }));
1242
+ const i = e["pl-workdir"] ?? ".", s = e.storage ? u.join(i, e.storage) : o.data("local"), c = e["pl-log-file"] ? u.join(i, e["pl-log-file"]) : void 0, n = t.initAuthDriversList(e, i), h = e["auth-enabled"] ?? n !== void 0;
1243
+ var f = e["pl-binary"];
1244
+ e["pl-sources"] && (f = t.buildPlatforma({ repoRoot: e["pl-sources"] }));
1239
1245
  var g = "127.0.0.1:6345";
1240
1246
  e["grpc-listen"] ? g = e["grpc-listen"] : e["grpc-port"] && (g = `127.0.0.1:${e["grpc-port"]}`);
1241
1247
  var v = "127.0.0.1:9090";
@@ -1243,7 +1249,7 @@ const G = class G extends O {
1243
1249
  var P = "127.0.0.1:9091";
1244
1250
  e["debug-listen"] ? P = e["debug-listen"] : e["debug-port"] && (P = `127.0.0.1:${e["debug-port"]}`);
1245
1251
  const d = {
1246
- binaryPath: u,
1252
+ binaryPath: f,
1247
1253
  version: e.version,
1248
1254
  configPath: e.config,
1249
1255
  workdir: e["pl-workdir"],
@@ -1279,20 +1285,20 @@ m(G, "description", "Run Platforma Backend service as local process on current h
1279
1285
  ...he,
1280
1286
  ...fe,
1281
1287
  ...me,
1282
- ...We,
1283
1288
  ...je,
1289
+ ...We,
1284
1290
  ...re
1285
1291
  });
1286
1292
  let ge = G;
1287
1293
  var R;
1288
- let Gr = (R = class extends O {
1294
+ let Gr = (R = class extends $ {
1289
1295
  async run() {
1290
1296
  const { flags: e } = await this.parse(R), r = E(e["log-level"]), t = new D(r);
1291
1297
  t.mergeLicenseEnvs(e);
1292
1298
  const i = e["auth-enabled"], s = i ? {
1293
1299
  enabled: i,
1294
1300
  drivers: t.initAuthDriversList(e, ".")
1295
- } : void 0, c = e.storage ? f.join(".", e.storage) : l.data("docker-s3");
1301
+ } : void 0, c = e.storage ? u.join(".", e.storage) : o.data("docker-s3");
1296
1302
  t.startDockerS3(c, {
1297
1303
  image: e.image,
1298
1304
  version: e.version,
@@ -1316,13 +1322,13 @@ let Gr = (R = class extends O {
1316
1322
  ...X,
1317
1323
  ...re
1318
1324
  }), R);
1319
- const U = class U extends O {
1325
+ const U = class U extends $ {
1320
1326
  async run() {
1321
1327
  const { flags: e } = await this.parse(U), r = E(e["log-level"]), t = new D(r);
1322
1328
  t.mergeLicenseEnvs(e);
1323
- const i = e["pl-workdir"] ?? ".", s = e.storage ? f.join(i, e.storage) : l.data("local-s3"), c = e["pl-log-file"] ? f.join(i, e["pl-log-file"]) : void 0, n = t.initAuthDriversList(e, i), h = e["auth-enabled"] ?? n !== void 0;
1324
- var u = e["pl-binary"];
1325
- e["pl-sources"] && (u = t.buildPlatforma({ repoRoot: e["pl-sources"] }));
1329
+ const i = e["pl-workdir"] ?? ".", s = e.storage ? u.join(i, e.storage) : o.data("local-s3"), c = e["pl-log-file"] ? u.join(i, e["pl-log-file"]) : void 0, n = t.initAuthDriversList(e, i), h = e["auth-enabled"] ?? n !== void 0;
1330
+ var f = e["pl-binary"];
1331
+ e["pl-sources"] && (f = t.buildPlatforma({ repoRoot: e["pl-sources"] }));
1326
1332
  var g = "127.0.0.1:6345";
1327
1333
  e["grpc-listen"] ? g = e["grpc-listen"] : e["grpc-port"] && (g = `127.0.0.1:${e["grpc-port"]}`);
1328
1334
  var v = "127.0.0.1:9090";
@@ -1330,7 +1336,7 @@ const U = class U extends O {
1330
1336
  var P = "127.0.0.1:9091";
1331
1337
  e["debug-listen"] ? P = e["debug-listen"] : e["debug-port"] && (P = `127.0.0.1:${e["debug-port"]}`);
1332
1338
  const d = {
1333
- binaryPath: u,
1339
+ binaryPath: f,
1334
1340
  version: e.version,
1335
1341
  configPath: e.config,
1336
1342
  workdir: e["pl-workdir"],
@@ -1371,8 +1377,8 @@ m(U, "description", "Run Platforma Backend service as local process on current h
1371
1377
  ...he,
1372
1378
  ...fe,
1373
1379
  ...me,
1374
- ...We,
1375
1380
  ...je,
1381
+ ...We,
1376
1382
  ...re
1377
1383
  });
1378
1384
  let ue = U;