@platforma-sdk/bootstrap 3.2.13 → 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`,
@@ -765,6 +765,7 @@ controllers:
765
765
  runner:
766
766
  type: local
767
767
  storageRoot: '${a.storages.work.rootPath}'
768
+ workdirCacheOnSuccess: 20m
768
769
  workdirCacheOnFailure: 1h
769
770
  secrets:
770
771
  - map:
@@ -924,7 +925,7 @@ ${r}`);
924
925
  return this.startInstance(e);
925
926
  }
926
927
  createLocal(e, t) {
927
- var g, d, h, b, p, y, P, L, S, v;
928
+ var g, d, h, b, p, y, P, $, S, v;
928
929
  let r = ct(t == null ? void 0 : t.version, "binaries", "platforma");
929
930
  t != null && t.sourcesPath && (r = m.join(D.tmpdir(), "platforma-custom-build")), t != null && t.binaryPath && (r = t.binaryPath);
930
931
  let n = t == null ? void 0 : t.configPath;
@@ -943,7 +944,7 @@ ${r}`);
943
944
  }
944
945
  });
945
946
  const i = et(this.getLastJwt(), t == null ? void 0 : t.configOptions);
946
- 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);
947
948
  const c = [
948
949
  `${i.localRoot}/packages`,
949
950
  `${i.localRoot}/packages-local`,
@@ -966,7 +967,7 @@ ${r}`);
966
967
  }), o.push({
967
968
  async: !0,
968
969
  cmd: r,
969
- args: ["--config", n],
970
+ args: ["--quiet", "--config", n],
970
971
  workdir: s,
971
972
  runOpts: { stdio: "inherit" }
972
973
  }), u.setInstanceInfo(e, {
@@ -1077,9 +1078,9 @@ ${r}`);
1077
1078
  f.existsSync(y) || f.copyFileSync(Q("users.htpasswd"), y);
1078
1079
  const P = i("compose.yaml");
1079
1080
  f.existsSync(P) && this.logger.info(`replacing docker compose file ${P}`);
1080
- const L = [];
1081
+ const $ = [];
1081
1082
  for (const v of (r == null ? void 0 : r.customMounts) ?? [])
1082
- L.push({
1083
+ $.push({
1083
1084
  hostPath: v.hostPath,
1084
1085
  containerPath: v.containerPath ?? v.hostPath
1085
1086
  });
@@ -1087,7 +1088,7 @@ ${r}`);
1087
1088
  ["minio", {}],
1088
1089
  ["backend", {
1089
1090
  platform: r == null ? void 0 : r.platformOverride,
1090
- mounts: L
1091
+ mounts: $
1091
1092
  }]
1092
1093
  ]));
1093
1094
  const S = {
@@ -1171,7 +1172,7 @@ ${r}`);
1171
1172
  mounts: P
1172
1173
  }]
1173
1174
  ]));
1174
- 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 = {
1175
1176
  PL_IMAGE: s,
1176
1177
  PL_AUTH_HTPASSWD_PATH: p,
1177
1178
  PL_LICENSE: r == null ? void 0 : r.license,
@@ -1185,7 +1186,7 @@ ${r}`);
1185
1186
  PL_DATA_LIBRARY_ROOT: h,
1186
1187
  PL_DATA_WORKDIR_ROOT: b,
1187
1188
  PL_DATA_PACKAGE_ROOT: c("packages"),
1188
- ...this.configureDockerStorage("primary", L),
1189
+ ...this.configureDockerStorage("primary", $),
1189
1190
  ...this.configureDockerStorage("library", S)
1190
1191
  };
1191
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)) {
@@ -1217,7 +1218,7 @@ ${r}`);
1217
1218
  apiPort: r == null ? void 0 : r.grpcPort,
1218
1219
  apiAddr: r == null ? void 0 : r.grpcAddr,
1219
1220
  logPath: o,
1220
- primary: L,
1221
+ primary: $,
1221
1222
  work: { type: "FS", rootPath: b },
1222
1223
  library: S,
1223
1224
  dbPath: g
@@ -1371,7 +1372,7 @@ function Ae(a, e) {
1371
1372
  throw new Error(`${r}, process exited with code '${t.status}'`);
1372
1373
  }
1373
1374
  }
1374
- const te = class te extends $ {
1375
+ const te = class te extends L {
1375
1376
  async run() {
1376
1377
  const { flags: e } = await this.parse(te), t = I(e["log-level"]);
1377
1378
  new O(t).cleanupInstance();
@@ -1381,7 +1382,7 @@ l(te, "description", "Clear service state (forget last run command, destroy dock
1381
1382
  ...A
1382
1383
  });
1383
1384
  let Te = te;
1384
- const ae = class ae extends $ {
1385
+ const ae = class ae extends L {
1385
1386
  async run() {
1386
1387
  const { flags: e } = await this.parse(ae), t = I(e["log-level"]);
1387
1388
  new O(t).startLast();
@@ -1391,7 +1392,7 @@ l(ae, "description", "Start last run service configuraiton"), l(ae, "examples",
1391
1392
  ...A
1392
1393
  });
1393
1394
  let xe = ae;
1394
- const ne = class ne extends $ {
1395
+ const ne = class ne extends L {
1395
1396
  async run() {
1396
1397
  const { flags: e } = await this.parse(ne), t = I(e["log-level"]), r = new O(t);
1397
1398
  u.currentInstance ? r.stopInstance(u.currentInstance) : t.warn("up/start command was not called for any instance, nothing to stop");
@@ -1402,7 +1403,7 @@ l(ne, "description", "Stop platforma service"), l(ne, "examples", ["<%= config.b
1402
1403
  });
1403
1404
  let Fe = ne;
1404
1405
  var R;
1405
- let lt = (R = class extends $ {
1406
+ let lt = (R = class extends L {
1406
1407
  async run() {
1407
1408
  const { flags: e } = await this.parse(R), t = I(e["log-level"]), r = new O(t);
1408
1409
  r.mergeLicenseEnvs(e);
@@ -1447,7 +1448,7 @@ let lt = (R = class extends $ {
1447
1448
  ...oe
1448
1449
  }), R);
1449
1450
  var T;
1450
- let dt = (T = class extends $ {
1451
+ let dt = (T = class extends L {
1451
1452
  async run() {
1452
1453
  const { flags: e } = await this.parse(T), t = I(e["log-level"]), r = new O(t);
1453
1454
  r.mergeLicenseEnvs(e);
@@ -1482,8 +1483,8 @@ let dt = (T = class extends $ {
1482
1483
  p.binaryPath || p.sourcesPath ? r.switchInstance(y) : Pe(t, { version: e.version }).then(() => {
1483
1484
  const P = r.switchInstance(y);
1484
1485
  setTimeout(() => {
1485
- for (const L of P)
1486
- L.unref();
1486
+ for (const $ of P)
1487
+ $.unref();
1487
1488
  }, 1e3);
1488
1489
  }).catch(function(P) {
1489
1490
  t.error(P.message);
@@ -1505,7 +1506,7 @@ let dt = (T = class extends $ {
1505
1506
  ...be,
1506
1507
  ...U
1507
1508
  }), T);
1508
- const H = class H extends $ {
1509
+ const H = class H extends L {
1509
1510
  async run() {
1510
1511
  const { flags: e, args: t } = await this.parse(H), r = I(e["log-level"]), n = new O(r), s = t.name;
1511
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);
@@ -1521,7 +1522,7 @@ l(H, "description", "List available instances"), l(H, "examples", ["<%= config.b
1521
1522
  name: K.string({ required: !1 })
1522
1523
  });
1523
1524
  let De = H;
1524
- const W = class W extends $ {
1525
+ const W = class W extends L {
1525
1526
  async run() {
1526
1527
  const { flags: e, args: t } = await this.parse(W), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
1527
1528
  s || (r.info("no pl service instance selected. No service was stopped"), process.exit(0)), n.stopInstance(u.getInstanceInfo(s));
@@ -1533,7 +1534,7 @@ l(W, "description", "List available instances"), l(W, "examples", ["<%= config.b
1533
1534
  name: K.string({ required: !1 })
1534
1535
  });
1535
1536
  let Ne = W;
1536
- const se = class se extends $ {
1537
+ const se = class se extends L {
1537
1538
  async run() {
1538
1539
  await this.parse(se);
1539
1540
  const e = u.instanceList, t = u.currentInstanceName;
@@ -1545,7 +1546,7 @@ const se = class se extends $ {
1545
1546
  };
1546
1547
  l(se, "description", "List available instances"), l(se, "examples", ["<%= config.bin %> <%= command.id %>"]), l(se, "flags", {});
1547
1548
  let _e = se;
1548
- const q = class q extends $ {
1549
+ const q = class q extends L {
1549
1550
  async run() {
1550
1551
  const { flags: e, args: t } = await this.parse(q), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
1551
1552
  s || (r.error("no pl service instance is selected. Select instance with 'select' command or provide name to 'up'"), process.exit(1));
@@ -1564,7 +1565,7 @@ l(q, "description", "List available instances"), l(q, "examples", ["<%= config.b
1564
1565
  });
1565
1566
  let Ce = q;
1566
1567
  var x;
1567
- let gt = (x = class extends $ {
1568
+ let gt = (x = class extends L {
1568
1569
  async run() {
1569
1570
  const { flags: e } = await this.parse(x), t = I(e["log-level"]), r = new O(t);
1570
1571
  r.mergeLicenseEnvs(e);
@@ -1605,7 +1606,7 @@ let gt = (x = class extends $ {
1605
1606
  ...hr
1606
1607
  }), x);
1607
1608
  var F;
1608
- let ut = (F = class extends $ {
1609
+ let ut = (F = class extends L {
1609
1610
  async run() {
1610
1611
  const { flags: e } = await this.parse(F), t = I(e["log-level"]), r = new O(t);
1611
1612
  r.mergeLicenseEnvs(e);
@@ -1641,12 +1642,13 @@ let ut = (F = class extends $ {
1641
1642
  }
1642
1643
  }
1643
1644
  }, y = r.createLocalS3(n, p);
1644
- p.binaryPath || p.sourcesPath ? r.switchInstance(y) : Pe(t, { version: e.version }).then(() => {
1645
- const P = r.switchInstance(y);
1646
- setTimeout(() => {
1647
- for (const L of P)
1648
- L.unref();
1649
- }, 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($);
1650
1652
  }).catch(function(P) {
1651
1653
  t.error(P.message);
1652
1654
  });
@@ -1668,7 +1670,7 @@ let ut = (F = class extends $ {
1668
1670
  ...be,
1669
1671
  ...U
1670
1672
  }), F);
1671
- const z = class z extends $ {
1673
+ const z = class z extends L {
1672
1674
  async run() {
1673
1675
  const { flags: e, args: t } = await this.parse(z), r = I(e["log-level"]), n = new O(r);
1674
1676
  n.mergeLicenseEnvs(e);
@@ -1717,7 +1719,7 @@ l(z, "description", "Run Platforma Backend service as docker container on curren
1717
1719
  });
1718
1720
  let Me = z;
1719
1721
  var E;
1720
- let ft = (E = class extends $ {
1722
+ let ft = (E = class extends L {
1721
1723
  async run() {
1722
1724
  const { flags: e, args: t } = await this.parse(E), r = I(e["log-level"]), n = new O(r);
1723
1725
  n.mergeLicenseEnvs(e);
@@ -1775,7 +1777,7 @@ let ft = (E = class extends $ {
1775
1777
  }), l(E, "args", {
1776
1778
  name: K.string({ required: !0 })
1777
1779
  }), E);
1778
- const Y = class Y extends $ {
1780
+ const Y = class Y extends L {
1779
1781
  async run() {
1780
1782
  const { flags: e, args: t } = await this.parse(Y), r = I(e["log-level"]), n = new O(r);
1781
1783
  n.mergeLicenseEnvs(e);
@@ -1819,7 +1821,7 @@ l(Y, "description", "Run Platforma Backend service as docker container on curren
1819
1821
  name: K.string({ required: !0 })
1820
1822
  });
1821
1823
  let je = Y;
1822
- const V = class V extends $ {
1824
+ const V = class V extends L {
1823
1825
  async run() {
1824
1826
  const { flags: e, args: t } = await this.parse(V), r = I(e["log-level"]), n = new O(r);
1825
1827
  n.mergeLicenseEnvs(e);