@platforma-sdk/bootstrap 3.3.0 → 3.3.1

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,7 +1,7 @@
1
1
  var kr = Object.defineProperty;
2
2
  var Sr = (a, e, t) => e in a ? kr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
3
  var l = (a, e, t) => Sr(a, typeof e != "symbol" ? e + "" : e, t);
4
- import { Flags as w, Command as $, Args as K } from "@oclif/core";
4
+ import { Flags as w, Command as L, Args as K } from "@oclif/core";
5
5
  import D from "node:os";
6
6
  import f, { createWriteStream as $r } from "node:fs";
7
7
  import m, { resolve as Lr } from "node:path";
@@ -342,7 +342,7 @@ async function br(a, e, t) {
342
342
  async function ee(a, e) {
343
343
  return await br(a, e, "");
344
344
  }
345
- const re = class re extends $ {
345
+ const re = class re extends L {
346
346
  async run() {
347
347
  const { flags: e } = await this.parse(re), t = I(e["log-level"]);
348
348
  await Hr(t);
@@ -616,14 +616,14 @@ function X(a, e, t) {
616
616
  }
617
617
  }
618
618
  function et(a, e) {
619
- var p, y, P, L, S, v, k, le, Ge, Je, He, We, qe, ze, Ye, Ve, Ke, Qe, Xe, Ze, er, rr, tr, ar, nr, sr, ir, cr, or, lr;
619
+ var p, y, P, $, S, v, k, le, Ge, Je, He, We, qe, ze, Ye, Ve, Ke, Qe, Xe, Ze, er, rr, tr, ar, nr, sr, ir, cr, or, lr;
620
620
  const t = (e == null ? void 0 : e.localRoot) ?? u.instanceDir("default"), r = {
621
621
  level: ((p = e == null ? void 0 : e.log) == null ? void 0 : p.level) ?? "info",
622
622
  path: ((y = e == null ? void 0 : e.log) == null ? void 0 : y.path) ?? `${t}/logs/platforma.log`
623
623
  }, n = {
624
624
  listen: ((P = e == null ? void 0 : e.grpc) == null ? void 0 : P.listen) ?? "localhost:6345",
625
625
  tls: {
626
- enable: de((S = (L = e == null ? void 0 : e.grpc) == null ? void 0 : L.tls) == null ? void 0 : S.enable, !1),
626
+ enable: de((S = ($ = e == null ? void 0 : e.grpc) == null ? void 0 : $.tls) == null ? void 0 : S.enable, !1),
627
627
  clientAuthMode: ((k = (v = e == null ? void 0 : e.grpc) == null ? void 0 : v.tls) == null ? void 0 : k.clientAuthMode) ?? "NoAuth",
628
628
  certFile: ((Ge = (le = e == null ? void 0 : e.grpc) == null ? void 0 : le.tls) == null ? void 0 : Ge.certFile) ?? `${t}/certs/tls.cert`,
629
629
  keyFile: ((He = (Je = e == null ? void 0 : e.grpc) == null ? void 0 : Je.tls) == null ? void 0 : He.keyFile) ?? `${t}/certs/tls.key`,
@@ -925,7 +925,7 @@ ${r}`);
925
925
  return this.startInstance(e);
926
926
  }
927
927
  createLocal(e, t) {
928
- var g, d, h, b, p, y, P, L, S, v;
928
+ var g, d, h, b, p, y, P, $, S, v;
929
929
  let r = ct(t == null ? void 0 : t.version, "binaries", "platforma");
930
930
  t != null && t.sourcesPath && (r = m.join(D.tmpdir(), "platforma-custom-build")), t != null && t.binaryPath && (r = t.binaryPath);
931
931
  let n = t == null ? void 0 : t.configPath;
@@ -944,7 +944,7 @@ ${r}`);
944
944
  }
945
945
  });
946
946
  const i = et(this.getLastJwt(), t == null ? void 0 : t.configOptions);
947
- this.logger.debug(" checking license..."), this.checkLicense((L = (P = t == null ? void 0 : t.configOptions) == null ? void 0 : P.license) == null ? void 0 : L.value, (v = (S = t == null ? void 0 : t.configOptions) == null ? void 0 : S.license) == null ? void 0 : v.file);
947
+ this.logger.debug(" checking license..."), this.checkLicense(($ = (P = t == null ? void 0 : t.configOptions) == null ? void 0 : P.license) == null ? void 0 : $.value, (v = (S = t == null ? void 0 : t.configOptions) == null ? void 0 : S.license) == null ? void 0 : v.file);
948
948
  const c = [
949
949
  `${i.localRoot}/packages`,
950
950
  `${i.localRoot}/packages-local`,
@@ -967,7 +967,7 @@ ${r}`);
967
967
  }), o.push({
968
968
  async: !0,
969
969
  cmd: r,
970
- args: ["--config", n],
970
+ args: ["--quiet", "--config", n],
971
971
  workdir: s,
972
972
  runOpts: { stdio: "inherit" }
973
973
  }), u.setInstanceInfo(e, {
@@ -1078,9 +1078,9 @@ ${r}`);
1078
1078
  f.existsSync(y) || f.copyFileSync(Q("users.htpasswd"), y);
1079
1079
  const P = i("compose.yaml");
1080
1080
  f.existsSync(P) && this.logger.info(`replacing docker compose file ${P}`);
1081
- const L = [];
1081
+ const $ = [];
1082
1082
  for (const v of (r == null ? void 0 : r.customMounts) ?? [])
1083
- L.push({
1083
+ $.push({
1084
1084
  hostPath: v.hostPath,
1085
1085
  containerPath: v.containerPath ?? v.hostPath
1086
1086
  });
@@ -1088,7 +1088,7 @@ ${r}`);
1088
1088
  ["minio", {}],
1089
1089
  ["backend", {
1090
1090
  platform: r == null ? void 0 : r.platformOverride,
1091
- mounts: L
1091
+ mounts: $
1092
1092
  }]
1093
1093
  ]));
1094
1094
  const S = {
@@ -1172,7 +1172,7 @@ ${r}`);
1172
1172
  mounts: P
1173
1173
  }]
1174
1174
  ]));
1175
- const L = X((r == null ? void 0 : r.primaryStorageURL) ?? `file:${d}`, "."), S = X((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."), v = {
1175
+ const $ = X((r == null ? void 0 : r.primaryStorageURL) ?? `file:${d}`, "."), S = X((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."), v = {
1176
1176
  PL_IMAGE: s,
1177
1177
  PL_AUTH_HTPASSWD_PATH: p,
1178
1178
  PL_LICENSE: r == null ? void 0 : r.license,
@@ -1186,7 +1186,7 @@ ${r}`);
1186
1186
  PL_DATA_LIBRARY_ROOT: h,
1187
1187
  PL_DATA_WORKDIR_ROOT: b,
1188
1188
  PL_DATA_PACKAGE_ROOT: c("packages"),
1189
- ...this.configureDockerStorage("primary", L),
1189
+ ...this.configureDockerStorage("primary", $),
1190
1190
  ...this.configureDockerStorage("library", S)
1191
1191
  };
1192
1192
  if (r != null && r.grpcAddr && (v.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (v.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (v.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (v.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (v.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (v.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (v.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
@@ -1218,7 +1218,7 @@ ${r}`);
1218
1218
  apiPort: r == null ? void 0 : r.grpcPort,
1219
1219
  apiAddr: r == null ? void 0 : r.grpcAddr,
1220
1220
  logPath: o,
1221
- primary: L,
1221
+ primary: $,
1222
1222
  work: { type: "FS", rootPath: b },
1223
1223
  library: S,
1224
1224
  dbPath: g
@@ -1372,7 +1372,7 @@ function Ae(a, e) {
1372
1372
  throw new Error(`${r}, process exited with code '${t.status}'`);
1373
1373
  }
1374
1374
  }
1375
- const te = class te extends $ {
1375
+ const te = class te extends L {
1376
1376
  async run() {
1377
1377
  const { flags: e } = await this.parse(te), t = I(e["log-level"]);
1378
1378
  new O(t).cleanupInstance();
@@ -1382,7 +1382,7 @@ l(te, "description", "Clear service state (forget last run command, destroy dock
1382
1382
  ...A
1383
1383
  });
1384
1384
  let Te = te;
1385
- const ae = class ae extends $ {
1385
+ const ae = class ae extends L {
1386
1386
  async run() {
1387
1387
  const { flags: e } = await this.parse(ae), t = I(e["log-level"]);
1388
1388
  new O(t).startLast();
@@ -1392,7 +1392,7 @@ l(ae, "description", "Start last run service configuraiton"), l(ae, "examples",
1392
1392
  ...A
1393
1393
  });
1394
1394
  let xe = ae;
1395
- const ne = class ne extends $ {
1395
+ const ne = class ne extends L {
1396
1396
  async run() {
1397
1397
  const { flags: e } = await this.parse(ne), t = I(e["log-level"]), r = new O(t);
1398
1398
  u.currentInstance ? r.stopInstance(u.currentInstance) : t.warn("up/start command was not called for any instance, nothing to stop");
@@ -1403,7 +1403,7 @@ l(ne, "description", "Stop platforma service"), l(ne, "examples", ["<%= config.b
1403
1403
  });
1404
1404
  let Fe = ne;
1405
1405
  var R;
1406
- let lt = (R = class extends $ {
1406
+ let lt = (R = class extends L {
1407
1407
  async run() {
1408
1408
  const { flags: e } = await this.parse(R), t = I(e["log-level"]), r = new O(t);
1409
1409
  r.mergeLicenseEnvs(e);
@@ -1448,7 +1448,7 @@ let lt = (R = class extends $ {
1448
1448
  ...oe
1449
1449
  }), R);
1450
1450
  var T;
1451
- let dt = (T = class extends $ {
1451
+ let dt = (T = class extends L {
1452
1452
  async run() {
1453
1453
  const { flags: e } = await this.parse(T), t = I(e["log-level"]), r = new O(t);
1454
1454
  r.mergeLicenseEnvs(e);
@@ -1483,8 +1483,8 @@ let dt = (T = class extends $ {
1483
1483
  p.binaryPath || p.sourcesPath ? r.switchInstance(y) : Pe(t, { version: e.version }).then(() => {
1484
1484
  const P = r.switchInstance(y);
1485
1485
  setTimeout(() => {
1486
- for (const L of P)
1487
- L.unref();
1486
+ for (const $ of P)
1487
+ $.unref();
1488
1488
  }, 1e3);
1489
1489
  }).catch(function(P) {
1490
1490
  t.error(P.message);
@@ -1506,7 +1506,7 @@ let dt = (T = class extends $ {
1506
1506
  ...be,
1507
1507
  ...U
1508
1508
  }), T);
1509
- const H = class H extends $ {
1509
+ const H = class H extends L {
1510
1510
  async run() {
1511
1511
  const { flags: e, args: t } = await this.parse(H), r = I(e["log-level"]), n = new O(r), s = t.name;
1512
1512
  e.all && (n.cleanupInstance(), process.exit(0)), s || (r.error("Please, specify name of instance to be removed or set '--all' flag instead"), process.exit(1)), n.cleanupInstance(s);
@@ -1522,7 +1522,7 @@ l(H, "description", "List available instances"), l(H, "examples", ["<%= config.b
1522
1522
  name: K.string({ required: !1 })
1523
1523
  });
1524
1524
  let De = H;
1525
- const W = class W extends $ {
1525
+ const W = class W extends L {
1526
1526
  async run() {
1527
1527
  const { flags: e, args: t } = await this.parse(W), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
1528
1528
  s || (r.info("no pl service instance selected. No service was stopped"), process.exit(0)), n.stopInstance(u.getInstanceInfo(s));
@@ -1534,7 +1534,7 @@ l(W, "description", "List available instances"), l(W, "examples", ["<%= config.b
1534
1534
  name: K.string({ required: !1 })
1535
1535
  });
1536
1536
  let Ne = W;
1537
- const se = class se extends $ {
1537
+ const se = class se extends L {
1538
1538
  async run() {
1539
1539
  await this.parse(se);
1540
1540
  const e = u.instanceList, t = u.currentInstanceName;
@@ -1546,7 +1546,7 @@ const se = class se extends $ {
1546
1546
  };
1547
1547
  l(se, "description", "List available instances"), l(se, "examples", ["<%= config.bin %> <%= command.id %>"]), l(se, "flags", {});
1548
1548
  let _e = se;
1549
- const q = class q extends $ {
1549
+ const q = class q extends L {
1550
1550
  async run() {
1551
1551
  const { flags: e, args: t } = await this.parse(q), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
1552
1552
  s || (r.error("no pl service instance is selected. Select instance with 'select' command or provide name to 'up'"), process.exit(1));
@@ -1565,7 +1565,7 @@ l(q, "description", "List available instances"), l(q, "examples", ["<%= config.b
1565
1565
  });
1566
1566
  let Ce = q;
1567
1567
  var x;
1568
- let gt = (x = class extends $ {
1568
+ let gt = (x = class extends L {
1569
1569
  async run() {
1570
1570
  const { flags: e } = await this.parse(x), t = I(e["log-level"]), r = new O(t);
1571
1571
  r.mergeLicenseEnvs(e);
@@ -1606,7 +1606,7 @@ let gt = (x = class extends $ {
1606
1606
  ...hr
1607
1607
  }), x);
1608
1608
  var F;
1609
- let ut = (F = class extends $ {
1609
+ let ut = (F = class extends L {
1610
1610
  async run() {
1611
1611
  const { flags: e } = await this.parse(F), t = I(e["log-level"]), r = new O(t);
1612
1612
  r.mergeLicenseEnvs(e);
@@ -1642,12 +1642,13 @@ let ut = (F = class extends $ {
1642
1642
  }
1643
1643
  }
1644
1644
  }, y = r.createLocalS3(n, p);
1645
- p.binaryPath || p.sourcesPath ? r.switchInstance(y) : Pe(t, { version: e.version }).then(() => {
1646
- const P = r.switchInstance(y);
1647
- setTimeout(() => {
1648
- for (const L of P)
1649
- L.unref();
1650
- }, 1e3);
1645
+ p.binaryPath || p.sourcesPath ? r.switchInstance(y) : await Pe(t, { version: e.version }).then(() => {
1646
+ const P = r.switchInstance(y), $ = [];
1647
+ for (const S of P)
1648
+ $.push(new Promise((v, k) => {
1649
+ S.on("close", v), S.on("error", k);
1650
+ }));
1651
+ return Promise.all($);
1651
1652
  }).catch(function(P) {
1652
1653
  t.error(P.message);
1653
1654
  });
@@ -1669,7 +1670,7 @@ let ut = (F = class extends $ {
1669
1670
  ...be,
1670
1671
  ...U
1671
1672
  }), F);
1672
- const z = class z extends $ {
1673
+ const z = class z extends L {
1673
1674
  async run() {
1674
1675
  const { flags: e, args: t } = await this.parse(z), r = I(e["log-level"]), n = new O(r);
1675
1676
  n.mergeLicenseEnvs(e);
@@ -1718,7 +1719,7 @@ l(z, "description", "Run Platforma Backend service as docker container on curren
1718
1719
  });
1719
1720
  let Me = z;
1720
1721
  var E;
1721
- let ft = (E = class extends $ {
1722
+ let ft = (E = class extends L {
1722
1723
  async run() {
1723
1724
  const { flags: e, args: t } = await this.parse(E), r = I(e["log-level"]), n = new O(r);
1724
1725
  n.mergeLicenseEnvs(e);
@@ -1776,7 +1777,7 @@ let ft = (E = class extends $ {
1776
1777
  }), l(E, "args", {
1777
1778
  name: K.string({ required: !0 })
1778
1779
  }), E);
1779
- const Y = class Y extends $ {
1780
+ const Y = class Y extends L {
1780
1781
  async run() {
1781
1782
  const { flags: e, args: t } = await this.parse(Y), r = I(e["log-level"]), n = new O(r);
1782
1783
  n.mergeLicenseEnvs(e);
@@ -1820,7 +1821,7 @@ l(Y, "description", "Run Platforma Backend service as docker container on curren
1820
1821
  name: K.string({ required: !0 })
1821
1822
  });
1822
1823
  let je = Y;
1823
- const V = class V extends $ {
1824
+ const V = class V extends L {
1824
1825
  async run() {
1825
1826
  const { flags: e, args: t } = await this.parse(V), r = I(e["log-level"]), n = new O(r);
1826
1827
  n.mergeLicenseEnvs(e);