@platforma-sdk/bootstrap 3.4.11 → 3.5.0

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 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
- import { Flags as w, Command as L, Args as Q } from "@oclif/core";
4
+ import { Flags as p, Command as L, Args as Q } from "@oclif/core";
5
5
  import * as me from "node:os";
6
6
  import N from "node:os";
7
7
  import f, { createWriteStream as Lr } from "node:fs";
@@ -15,124 +15,124 @@ import { Writable as Rr } from "node:stream";
15
15
  import { z as C } from "zod";
16
16
  import xr from "decompress";
17
17
  import { getDefaultPlVersion as he } from "@milaboratories/pl-deployments";
18
- import gr from "yaml";
18
+ import ur from "yaml";
19
19
  import Tr from "node:https";
20
20
  import * as Fr from "tar";
21
21
  const A = {
22
- "log-level": w.string({
22
+ "log-level": p.string({
23
23
  description: "logging level",
24
24
  default: "info",
25
25
  options: ["error", "warn", "info", "debug"],
26
26
  required: !1
27
27
  })
28
28
  };
29
- w.string({
29
+ p.string({
30
30
  description: "name of instance",
31
31
  required: !1
32
32
  });
33
33
  const ye = {
34
- image: w.string({
34
+ image: p.string({
35
35
  description: "use custom docker image to run platforma"
36
36
  })
37
37
  }, j = {
38
- version: w.string({
38
+ version: p.string({
39
39
  description: "use custom platforma release (official docker image or binary package)"
40
40
  })
41
- }, pe = {
42
- arch: w.string({
41
+ }, be = {
42
+ arch: p.string({
43
43
  description: "override architecture. You can start amd64 linux image on arm-based host (say, Apple M family processor). I.e. arm64, amd64, amd64/v2"
44
44
  })
45
45
  }, B = {
46
- license: w.string({
46
+ license: p.string({
47
47
  description: 'pass a license code. The license can be got from "https://licensing.milaboratories.com".'
48
48
  }),
49
- "license-file": w.file({
49
+ "license-file": p.file({
50
50
  exists: !0,
51
51
  description: "specify a path to the file with a license. The license can be got from 'https://licensing.milaboratories.com'."
52
52
  })
53
53
  }, U = {
54
- "grpc-port": w.integer({
54
+ "grpc-port": p.integer({
55
55
  description: "port for Platforma Backend gRPC API. Default is 6345",
56
56
  env: "PLATFORMA_GRPC_PORT"
57
57
  }),
58
- "grpc-listen": w.string({
58
+ "grpc-listen": p.string({
59
59
  description: "full listen addr for Platforma Backend gRPC API. Default is 127.0.0.1:6345",
60
60
  env: "PLATFORMA_GRPC_LISTEN"
61
61
  }),
62
- "monitoring-port": w.integer({
62
+ "monitoring-port": p.integer({
63
63
  description: "port for Platforma Backend monitoring API. Default is 9090",
64
64
  env: "PLATFORMA_MONITORING_PORT"
65
65
  }),
66
- "monitoring-listen": w.string({
66
+ "monitoring-listen": p.string({
67
67
  description: "full listen addr for Platforma Backend monitoring API. Default is 127.0.0.1:9090",
68
68
  env: "PLATFORMA_MONITORING_LISTEN"
69
69
  }),
70
- "debug-port": w.integer({
70
+ "debug-port": p.integer({
71
71
  description: "port for Platforma Backend debug API. Default is 9091",
72
72
  env: "PLATFORMA_DEBUG_PORT"
73
73
  }),
74
- "debug-listen": w.string({
74
+ "debug-listen": p.string({
75
75
  description: "full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091",
76
76
  env: "PLATFORMA_DEBUG_LISTEN"
77
77
  })
78
- }, hr = {
79
- "s3-port": w.integer({
78
+ }, He = {
79
+ "s3-port": p.integer({
80
80
  description: "port that S3 will listen, default is 9000",
81
81
  default: 9e3,
82
82
  env: "PLATFORMA_S3_PORT"
83
83
  }),
84
- "s3-console-port": w.integer({
84
+ "s3-console-port": p.integer({
85
85
  description: "port that a console of S3 will listen, default is 9001",
86
86
  default: 9001,
87
87
  env: "PLATFORMA_S3_CONSOLE_PORT"
88
88
  })
89
89
  }, G = {
90
- storage: w.string({
90
+ storage: p.string({
91
91
  description: "specify path on host to be used as storage for all Platforma Backend data"
92
92
  })
93
93
  }, yr = {
94
- "minio-presign-host": w.boolean({
94
+ "minio-presign-host": p.boolean({
95
95
  description: "use 'minio' host instead of 'localhost' in presign URLs"
96
96
  })
97
- }, be = {
98
- mount: w.string({
97
+ }, we = {
98
+ mount: p.string({
99
99
  multiple: !0,
100
100
  description: "things to be mounted into platforma docker container. Targets will appear inside the container under the same absolute paths"
101
101
  })
102
- }, we = {
103
- "pl-log-file": w.file({
102
+ }, pe = {
103
+ "pl-log-file": p.file({
104
104
  description: "specify path for Platforma Backend log file"
105
105
  })
106
106
  }, ve = {
107
- "pl-workdir": w.file({
107
+ "pl-workdir": p.file({
108
108
  description: "specify working directory for Platforma Backend process"
109
109
  })
110
110
  }, Pe = {
111
- "pl-binary": w.file({
111
+ "pl-binary": p.file({
112
112
  description: "start given Platforma Backend binary instead of automatically downloaded version"
113
113
  })
114
114
  }, ke = {
115
- "pl-sources": w.file({
115
+ "pl-sources": p.file({
116
116
  description: "path to pl repository root: build Platforma Backend from sources and start the resulting binary"
117
117
  })
118
118
  }, Se = {
119
- config: w.string({
119
+ config: p.string({
120
120
  description: "use custom Platforma Backend config"
121
121
  })
122
122
  };
123
- w.file({
123
+ p.file({
124
124
  description: "specify path on host to be used as 'primary' storage"
125
125
  });
126
126
  const oe = {
127
- "storage-work": w.file({
127
+ "storage-work": p.file({
128
128
  description: "specify path on host to be used as 'work' storage"
129
129
  })
130
130
  };
131
- w.file({
131
+ p.file({
132
132
  description: "specify path on host to be used as 'library' storage"
133
133
  });
134
134
  const le = {
135
- "storage-primary": w.string({
135
+ "storage-primary": p.string({
136
136
  description: `specify 'primary' storage destination URL.
137
137
  file:/path/to/dir for directory on local FS
138
138
  s3://<bucket>/?region=<name> for real AWS bucket
@@ -140,7 +140,7 @@ const le = {
140
140
  s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
141
141
  })
142
142
  }, de = {
143
- "storage-library": w.string({
143
+ "storage-library": p.string({
144
144
  description: `specify 'library' storage destination URL.
145
145
  file:/path/to/dir for directory on local FS
146
146
  s3://<bucket>/?region=<name> for real AWS bucket
@@ -148,19 +148,19 @@ const le = {
148
148
  s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
149
149
  })
150
150
  }, Dr = {
151
- "auth-enabled": w.boolean({
151
+ "auth-enabled": p.boolean({
152
152
  description: "enable authorization"
153
153
  })
154
154
  }, Nr = {
155
- "auth-htpasswd-file": w.file({
155
+ "auth-htpasswd-file": p.file({
156
156
  description: "path to .htpasswd file with Platforma users (static user DB auth source)"
157
157
  })
158
158
  }, _r = {
159
- "auth-ldap-server": w.string({
159
+ "auth-ldap-server": p.string({
160
160
  description: "address of LDAP server to use for auth in Platforma (auth source)"
161
161
  })
162
162
  }, Cr = {
163
- "auth-ldap-default-dn": w.string({
163
+ "auth-ldap-default-dn": p.string({
164
164
  description: "DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com"
165
165
  })
166
166
  }, J = {
@@ -223,7 +223,7 @@ function Gr(a) {
223
223
  if (r.Name === a)
224
224
  return r;
225
225
  }
226
- const xe = ["Python"], pr = ["Tengo", "Python"], Jr = C.union([C.literal("Tengo"), C.literal("Python")]), Hr = C.object({
226
+ const xe = ["Python"], br = ["Tengo", "Python"], Jr = C.union([C.literal("Tengo"), C.literal("Python")]), Hr = C.object({
227
227
  npmOrgName: C.string().min(1),
228
228
  orgName: C.string().min(1, { message: "Organization name must be provided" }),
229
229
  blockName: C.string().min(1, { message: "Block name must be provided" }),
@@ -240,7 +240,7 @@ async function Wr(a) {
240
240
  "platforma-block-boilerplate-main",
241
241
  s
242
242
  );
243
- const i = pr.filter((o) => n.indexOf(o) < 0), c = xe.length == i.length;
243
+ const i = br.filter((o) => n.indexOf(o) < 0), c = xe.length == i.length;
244
244
  a.info(`Keep platforms '${n}', remove: '${i}'. Will remove all platforms? ${c}`);
245
245
  for (const o of i)
246
246
  await Yr(s, o);
@@ -267,7 +267,7 @@ function qr() {
267
267
  const r = re.keyInYN("Create package for block's software?");
268
268
  let n = ["Tengo"];
269
269
  if (r)
270
- for (; n.length < pr.length; ) {
270
+ for (; n.length < br.length; ) {
271
271
  const i = re.keyInSelect(xe, "Choose software platform:");
272
272
  if (i < 0) break;
273
273
  n.push(xe[i]);
@@ -301,7 +301,7 @@ async function Yr(a, e) {
301
301
  ), await te(
302
302
  m.join(a, "workflow", "src", "wf.test.ts"),
303
303
  new RegExp(`.*${t}Message.*\\n.*expect.*\\n\\n`, "g")
304
- ), await M.rm(m.join(a, "software", `src_${t}`), { recursive: !0 }), await He(
304
+ ), await M.rm(m.join(a, "software", `src_${t}`), { recursive: !0 }), await We(
305
305
  m.join(a, "software", "package.json"),
306
306
  (r) => {
307
307
  const n = JSON.parse(r);
@@ -310,7 +310,7 @@ async function Yr(a, e) {
310
310
  );
311
311
  }
312
312
  async function Vr(a) {
313
- await M.rm(m.join(a, "software"), { recursive: !0 }), await He(
313
+ await M.rm(m.join(a, "software"), { recursive: !0 }), await We(
314
314
  m.join(a, "workflow", "package.json"),
315
315
  (e) => {
316
316
  const t = JSON.parse(e);
@@ -325,7 +325,7 @@ async function Kr(a, e) {
325
325
  const t = await Xr(a);
326
326
  for (const { from: r, to: n } of e)
327
327
  for (const s of t)
328
- await br(s, r, n);
328
+ await wr(s, r, n);
329
329
  }
330
330
  async function Xr(a) {
331
331
  return (await M.readdir(a, {
@@ -333,15 +333,15 @@ async function Xr(a) {
333
333
  recursive: !0
334
334
  })).filter((t) => t.isFile()).map((t) => m.join(t.parentPath, t.name));
335
335
  }
336
- async function He(a, e) {
336
+ async function We(a, e) {
337
337
  const t = await M.readFile(a), r = e(t.toString());
338
338
  await M.writeFile(a, r);
339
339
  }
340
- async function br(a, e, t) {
341
- return await He(a, (r) => r.replaceAll(e, t));
340
+ async function wr(a, e, t) {
341
+ return await We(a, (r) => r.replaceAll(e, t));
342
342
  }
343
343
  async function te(a, e) {
344
- return await br(a, e, "");
344
+ return await wr(a, e, "");
345
345
  }
346
346
  const ae = class ae extends L {
347
347
  async run() {
@@ -353,16 +353,16 @@ l(ae, "description", "Helps to create a new block by downloading a block's templ
353
353
  ...A
354
354
  });
355
355
  let Te = ae;
356
- function wr(...a) {
356
+ function pr(...a) {
357
357
  return Ar(__dirname, "..", ...a);
358
358
  }
359
359
  function Z(...a) {
360
- return wr("assets", ...a);
360
+ return pr("assets", ...a);
361
361
  }
362
362
  function Ae(...a) {
363
- return f.readFileSync(wr(...a));
363
+ return f.readFileSync(pr(...a));
364
364
  }
365
- function ur(a) {
365
+ function fr(a) {
366
366
  return a || (a = he()), `quay.io/milaboratories/platforma:${a}`;
367
367
  }
368
368
  const W = class W {
@@ -420,7 +420,7 @@ const W = class W {
420
420
  return r ? r.Status.trim().startsWith("running") : !1;
421
421
  }
422
422
  case "process":
423
- return e.pid ? fr(e.pid) : !1;
423
+ return e.pid ? mr(e.pid) : !1;
424
424
  default:
425
425
  throw H(), new Error("cli logic error: unknown service type, cannot check its state");
426
426
  }
@@ -434,7 +434,7 @@ const W = class W {
434
434
  return !1;
435
435
  }
436
436
  isValidPID(e) {
437
- return fr(e);
437
+ return mr(e);
438
438
  }
439
439
  get currentInstance() {
440
440
  const e = this.state.currentInstance;
@@ -455,7 +455,7 @@ const W = class W {
455
455
  };
456
456
  l(W, "instance");
457
457
  let Fe = W;
458
- function fr(a) {
458
+ function mr(a) {
459
459
  const e = Ur(a);
460
460
  return e === "platforma" || e.endsWith("/platforma") || e.endsWith("\\platforma");
461
461
  }
@@ -510,7 +510,7 @@ function Zr(a, e, t, r) {
510
510
  ), r.env = { ...process.env, ...r.env }, Or(e, t, r);
511
511
  }
512
512
  function Oe(a, e, t, r, n) {
513
- const s = f.readFileSync(a, { encoding: "utf-8" }), i = gr.parse(s.toString());
513
+ const s = f.readFileSync(a, { encoding: "utf-8" }), i = ur.parse(s.toString());
514
514
  if (!i.services)
515
515
  throw new Error(`file '${a}' seems to be not a docker-compose file or has unsupported version`);
516
516
  if (r)
@@ -524,10 +524,10 @@ function Oe(a, e, t, r, n) {
524
524
  if (o.platform && (g.platform = o.platform), o.envs) {
525
525
  g.environment || (g.environment = []);
526
526
  for (let d = 0; d < ((g == null ? void 0 : g.environment.length) ?? 0); ) {
527
- const p = g.environment[d].split("=")[0];
528
- if (o.envs[p]) {
529
- const b = g.environment.pop();
530
- b && g.environment.length !== d && (g.environment[d] = b);
527
+ const b = g.environment[d].split("=")[0];
528
+ if (o.envs[b]) {
529
+ const w = g.environment.pop();
530
+ w && g.environment.length !== d && (g.environment[d] = w);
531
531
  } else
532
532
  d++;
533
533
  }
@@ -540,7 +540,7 @@ function Oe(a, e, t, r, n) {
540
540
  g.volumes.push(`${d.hostPath}:${d.containerPath}`);
541
541
  }
542
542
  }
543
- n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e, gr.stringify(i));
543
+ n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e, ur.stringify(i));
544
544
  }
545
545
  function et(a) {
546
546
  return {
@@ -617,9 +617,9 @@ function ee(a, e, t) {
617
617
  }
618
618
  }
619
619
  function rt(a, e) {
620
- var b, y, P, $, k, v, S, _, ge, E, We, qe, ze, Ye, Ve, Ke, Xe, Qe, Ze, er, rr, tr, ar, nr, sr, ir, cr, or, lr, dr;
620
+ var w, y, P, $, k, v, S, _, ge, E, qe, ze, Ye, Ve, Ke, Xe, Qe, Ze, er, rr, tr, ar, nr, sr, ir, cr, or, lr, dr, gr;
621
621
  const t = (e == null ? void 0 : e.localRoot) ?? u.instanceDir("default"), r = {
622
- level: ((b = e == null ? void 0 : e.log) == null ? void 0 : b.level) ?? "info",
622
+ level: ((w = e == null ? void 0 : e.log) == null ? void 0 : w.level) ?? "info",
623
623
  path: ((y = e == null ? void 0 : e.log) == null ? void 0 : y.path) ?? `${t}/logs/platforma.log`
624
624
  }, n = {
625
625
  listen: ((P = e == null ? void 0 : e.grpc) == null ? void 0 : P.listen) ?? "localhost:6345",
@@ -627,13 +627,13 @@ function rt(a, e) {
627
627
  enable: ue((k = ($ = e == null ? void 0 : e.grpc) == null ? void 0 : $.tls) == null ? void 0 : k.enable, !1),
628
628
  clientAuthMode: ((S = (v = e == null ? void 0 : e.grpc) == null ? void 0 : v.tls) == null ? void 0 : S.clientAuthMode) ?? "NoAuth",
629
629
  certFile: ((ge = (_ = e == null ? void 0 : e.grpc) == null ? void 0 : _.tls) == null ? void 0 : ge.certFile) ?? `${t}/certs/tls.cert`,
630
- keyFile: ((We = (E = e == null ? void 0 : e.grpc) == null ? void 0 : E.tls) == null ? void 0 : We.keyFile) ?? `${t}/certs/tls.key`,
631
- ...(qe = e == null ? void 0 : e.grpc) == null ? void 0 : qe.tls
630
+ keyFile: ((qe = (E = e == null ? void 0 : e.grpc) == null ? void 0 : E.tls) == null ? void 0 : qe.keyFile) ?? `${t}/certs/tls.key`,
631
+ ...(ze = e == null ? void 0 : e.grpc) == null ? void 0 : ze.tls
632
632
  }
633
633
  }, s = {
634
634
  auth: {
635
- enabled: ((Ye = (ze = e == null ? void 0 : e.core) == null ? void 0 : ze.auth) == null ? void 0 : Ye.enabled) ?? !1,
636
- drivers: ((Ke = (Ve = e == null ? void 0 : e.core) == null ? void 0 : Ve.auth) == null ? void 0 : Ke.drivers) ?? [
635
+ enabled: ((Ve = (Ye = e == null ? void 0 : e.core) == null ? void 0 : Ye.auth) == null ? void 0 : Ve.enabled) ?? !1,
636
+ drivers: ((Xe = (Ke = e == null ? void 0 : e.core) == null ? void 0 : Ke.auth) == null ? void 0 : Xe.drivers) ?? [
637
637
  { driver: "jwt", key: a },
638
638
  { driver: "htpasswd", path: `${t}/users.htpasswd` }
639
639
  ]
@@ -641,39 +641,39 @@ function rt(a, e) {
641
641
  db: {
642
642
  path: `${t}/db`
643
643
  }
644
- }, i = mr(
644
+ }, i = hr(
645
645
  "main",
646
646
  `${t}/storages/main`,
647
647
  "main-bucket",
648
- (Xe = e == null ? void 0 : e.storages) == null ? void 0 : Xe.primary
648
+ (Qe = e == null ? void 0 : e.storages) == null ? void 0 : Qe.primary
649
649
  );
650
650
  let c;
651
- switch ((Ze = (Qe = e == null ? void 0 : e.storages) == null ? void 0 : Qe.work) == null ? void 0 : Ze.type) {
651
+ switch ((er = (Ze = e == null ? void 0 : e.storages) == null ? void 0 : Ze.work) == null ? void 0 : er.type) {
652
652
  case void 0:
653
653
  case "FS":
654
- 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";
654
+ c = vr("work"), c.rootPath = ((tr = (rr = e == null ? void 0 : e.storages) == null ? void 0 : rr.work) == null ? void 0 : tr.rootPath) ?? `${t}/storages/work`, c.indexCachePeriod = ((nr = (ar = e == null ? void 0 : e.storages) == null ? void 0 : ar.work) == null ? void 0 : nr.indexCachePeriod) ?? "1m";
655
655
  break;
656
656
  default:
657
657
  throw new Error("work storage MUST have 'FS' type as it is used for working directories management");
658
658
  }
659
- const g = mr(
659
+ const g = hr(
660
660
  "library",
661
661
  `${t}/storages/library`,
662
662
  "library-bucket",
663
- (nr = e == null ? void 0 : e.storages) == null ? void 0 : nr.library
663
+ (sr = e == null ? void 0 : e.storages) == null ? void 0 : sr.library
664
664
  ), d = {
665
- enabled: ue((sr = e == null ? void 0 : e.monitoring) == null ? void 0 : sr.enabled, !0),
666
- listen: ((ir = e == null ? void 0 : e.monitoring) == null ? void 0 : ir.listen) ?? "127.0.0.1:9090"
665
+ enabled: ue((ir = e == null ? void 0 : e.monitoring) == null ? void 0 : ir.enabled, !0),
666
+ listen: ((cr = e == null ? void 0 : e.monitoring) == null ? void 0 : cr.listen) ?? "127.0.0.1:9090"
667
667
  }, h = {
668
- enabled: ue((cr = e == null ? void 0 : e.debug) == null ? void 0 : cr.enabled, !0),
669
- listen: ((or = e == null ? void 0 : e.debug) == null ? void 0 : or.listen) ?? "127.0.0.1:9091"
670
- }, p = {
671
- value: ((lr = e == null ? void 0 : e.license) == null ? void 0 : lr.value) ?? "",
672
- file: ((dr = e == null ? void 0 : e.license) == null ? void 0 : dr.file) ?? ""
668
+ enabled: ue((or = e == null ? void 0 : e.debug) == null ? void 0 : or.enabled, !0),
669
+ listen: ((lr = e == null ? void 0 : e.debug) == null ? void 0 : lr.listen) ?? "127.0.0.1:9091"
670
+ }, b = {
671
+ value: ((dr = e == null ? void 0 : e.license) == null ? void 0 : dr.value) ?? "",
672
+ file: ((gr = e == null ? void 0 : e.license) == null ? void 0 : gr.file) ?? ""
673
673
  };
674
674
  return {
675
675
  localRoot: t,
676
- license: p,
676
+ license: b,
677
677
  log: r,
678
678
  grpc: n,
679
679
  core: s,
@@ -684,7 +684,7 @@ function rt(a, e) {
684
684
  hacks: { libraryDownloadable: !0 }
685
685
  };
686
686
  }
687
- function mr(a, e, t, r) {
687
+ function hr(a, e, t, r) {
688
688
  let n;
689
689
  switch (r == null ? void 0 : r.type) {
690
690
  case void 0:
@@ -844,16 +844,16 @@ function it(a, e) {
844
844
  return;
845
845
  }
846
846
  const h = parseInt(d.headers["content-length"] || "0", 10);
847
- let p = 0;
848
- const b = f.createWriteStream(i);
849
- d.pipe(b), d.on("data", (y) => {
850
- p += y.length;
851
- const P = p / h * 100;
847
+ let b = 0;
848
+ const w = f.createWriteStream(i);
849
+ d.pipe(w), d.on("data", (y) => {
850
+ b += y.length;
851
+ const P = b / h * 100;
852
852
  r && process.stdout.write(` downloading: ${P.toFixed(2)}%\r`);
853
853
  }), d.on("error", (y) => {
854
854
  f.unlinkSync(i), a.error(`Failed to download Platforma Binary: ${y.message}`), c.destroy(), g(y);
855
- }), b.on("finish", () => {
856
- b.close(), a.info(" ... download done."), c.destroy(), o(i);
855
+ }), w.on("finish", () => {
856
+ w.close(), a.info(" ... download done."), c.destroy(), o(i);
857
857
  });
858
858
  });
859
859
  });
@@ -938,7 +938,7 @@ ${r}`);
938
938
  return this.startInstance(e);
939
939
  }
940
940
  createLocal(e, t) {
941
- var d, h, p, b, y, P, $, k, v, S, _, ge;
941
+ var d, h, b, w, y, P, $, k, v, S, _, ge;
942
942
  let r = ot(t == null ? void 0 : t.version, "binaries", "platforma");
943
943
  t != null && t.sourcesPath && (r = m.join(N.tmpdir(), "platforma-custom-build")), t != null && t.binaryPath && (r = t.binaryPath);
944
944
  let n = t == null ? void 0 : t.configPath;
@@ -947,12 +947,12 @@ ${r}`);
947
947
  ...t.configOptions,
948
948
  storages: {
949
949
  ...(d = t.configOptions) == null ? void 0 : d.storages,
950
- primary: ee(t.primaryURL, s, (p = (h = t.configOptions) == null ? void 0 : h.storages) == null ? void 0 : p.primary)
950
+ primary: ee(t.primaryURL, s, (b = (h = t.configOptions) == null ? void 0 : h.storages) == null ? void 0 : b.primary)
951
951
  }
952
952
  }), t != null && t.libraryURL && (t.configOptions = {
953
953
  ...t.configOptions,
954
954
  storages: {
955
- ...(b = t.configOptions) == null ? void 0 : b.storages,
955
+ ...(w = t.configOptions) == null ? void 0 : w.storages,
956
956
  library: ee(t.libraryURL, s, (P = (y = t.configOptions) == null ? void 0 : y.storages) == null ? void 0 : P.library)
957
957
  }
958
958
  });
@@ -1078,7 +1078,7 @@ ${r}`);
1078
1078
  }
1079
1079
  createDockerS3(e, t, r) {
1080
1080
  this.logger.debug("creating platforma instance in 'docker s3' mode...");
1081
- const n = Z("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? ur(r == null ? void 0 : r.version);
1081
+ const n = Z("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? fr(r == null ? void 0 : r.version);
1082
1082
  this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
1083
1083
  const i = (...v) => m.join(t, ...v), c = (v) => {
1084
1084
  const S = i(v);
@@ -1093,7 +1093,7 @@ ${r}`);
1093
1093
  if (h.type !== "S3")
1094
1094
  throw new Error(`${h.type} storage type is not supported for library storage`);
1095
1095
  h.presignEndpoint = `http://${g}:9000`;
1096
- const p = c("db"), b = c("work"), y = i("users.htpasswd");
1096
+ const b = c("db"), w = c("work"), y = i("users.htpasswd");
1097
1097
  f.existsSync(y) || f.copyFileSync(Z("users.htpasswd"), y);
1098
1098
  const P = i("compose.yaml");
1099
1099
  f.existsSync(P) && this.logger.info(`replacing docker compose file ${P}`);
@@ -1121,16 +1121,16 @@ ${r}`);
1121
1121
  PL_LOG_DIR: m.dirname(o),
1122
1122
  PL_LOG_ROTATION_ENABLED: "true",
1123
1123
  PL_RUNNER_WD_CACHE_ON_FAILURE: "1h",
1124
- PL_DATA_DB_ROOT: p,
1124
+ PL_DATA_DB_ROOT: b,
1125
1125
  PL_DATA_PRIMARY_ROOT: c("primary"),
1126
1126
  PL_DATA_LIBRARY_ROOT: c("library"),
1127
- PL_DATA_WORKDIR_ROOT: b,
1127
+ PL_DATA_WORKDIR_ROOT: w,
1128
1128
  // Mount packages storage as volume, because APFS is case-insensitive on Mac OS X and this breaks some pl software installation.
1129
1129
  // PL_DATA_PACKAGE_ROOT: storageDir('packages'),
1130
1130
  ...this.configureDockerStorage("primary", d),
1131
1131
  ...this.configureDockerStorage("library", h)
1132
1132
  };
1133
- 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)) {
1133
+ 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.s3Port && (k.MINIO_PORT = r.s3Port.toString()), r != null && r.s3ConsolePort && (k.MINIO_CONSOLE_PORT = r.s3ConsolePort.toString()), r != null && r.auth && (r.auth.enabled && (k.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
1134
1134
  for (const v of r.auth.drivers)
1135
1135
  v.driver === "htpasswd" && (k.PL_AUTH_HTPASSWD_PATH = m.resolve(v.path), v.path = "/etc/platforma/users.htpasswd");
1136
1136
  k.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
@@ -1160,23 +1160,23 @@ ${r}`);
1160
1160
  apiAddr: r == null ? void 0 : r.grpcAddr,
1161
1161
  logPath: o,
1162
1162
  primary: d,
1163
- work: { type: "FS", rootPath: b },
1163
+ work: { type: "FS", rootPath: w },
1164
1164
  library: h,
1165
- dbPath: p
1165
+ dbPath: b
1166
1166
  }
1167
1167
  }), u.getInstanceInfo(e);
1168
1168
  }
1169
1169
  createDocker(e, t, r) {
1170
1170
  this.logger.debug("creating platforma instance in 'docker' mode...");
1171
- const n = Z("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? ur(r == null ? void 0 : r.version);
1171
+ const n = Z("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? fr(r == null ? void 0 : r.version);
1172
1172
  this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
1173
1173
  const i = (...S) => m.join(t, ...S), c = (S) => {
1174
1174
  const _ = i(S);
1175
1175
  return Le(_, { mode: "0775" }), _;
1176
1176
  }, o = i("logs", "platforma.log");
1177
1177
  f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
1178
- const g = c("db"), d = c("primary"), h = c("library"), p = c("work"), b = i("users.htpasswd");
1179
- f.existsSync(b) || f.copyFileSync(Z("users.htpasswd"), b);
1178
+ const g = c("db"), d = c("primary"), h = c("library"), b = c("work"), w = i("users.htpasswd");
1179
+ f.existsSync(w) || f.copyFileSync(Z("users.htpasswd"), w);
1180
1180
  const y = i("compose.yaml");
1181
1181
  f.existsSync(y) && this.logger.info(`replacing docker compose file ${y}`);
1182
1182
  const P = [];
@@ -1193,7 +1193,7 @@ ${r}`);
1193
1193
  ]));
1194
1194
  const $ = ee((r == null ? void 0 : r.primaryStorageURL) ?? `file:${d}`, "."), k = ee((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."), v = {
1195
1195
  PL_IMAGE: s,
1196
- PL_AUTH_HTPASSWD_PATH: b,
1196
+ PL_AUTH_HTPASSWD_PATH: w,
1197
1197
  PL_LICENSE: r == null ? void 0 : r.license,
1198
1198
  PL_LICENSE_FILE: r == null ? void 0 : r.licenseFile,
1199
1199
  PL_LOG_LEVEL: "info",
@@ -1203,7 +1203,7 @@ ${r}`);
1203
1203
  PL_DATA_DB_ROOT: g,
1204
1204
  PL_DATA_PRIMARY_ROOT: d,
1205
1205
  PL_DATA_LIBRARY_ROOT: h,
1206
- PL_DATA_WORKDIR_ROOT: p,
1206
+ PL_DATA_WORKDIR_ROOT: b,
1207
1207
  PL_DATA_PACKAGE_ROOT: c("packages"),
1208
1208
  ...this.configureDockerStorage("primary", $),
1209
1209
  ...this.configureDockerStorage("library", k)
@@ -1238,7 +1238,7 @@ ${r}`);
1238
1238
  apiAddr: r == null ? void 0 : r.grpcAddr,
1239
1239
  logPath: o,
1240
1240
  primary: $,
1241
- work: { type: "FS", rootPath: p },
1241
+ work: { type: "FS", rootPath: b },
1242
1242
  library: k,
1243
1243
  dbPath: g
1244
1244
  }
@@ -1457,10 +1457,10 @@ let dt = (x = class extends L {
1457
1457
  ...U,
1458
1458
  ...ye,
1459
1459
  ...j,
1460
- ...pe,
1460
+ ...be,
1461
1461
  ...J,
1462
1462
  ...B,
1463
- ...be,
1463
+ ...we,
1464
1464
  ...G,
1465
1465
  ...le,
1466
1466
  ...oe,
@@ -1476,9 +1476,9 @@ let gt = (T = class extends L {
1476
1476
  e["grpc-listen"] ? d = e["grpc-listen"] : e["grpc-port"] && (d = `127.0.0.1:${e["grpc-port"]}`);
1477
1477
  let h = "127.0.0.1:9090";
1478
1478
  e["monitoring-listen"] ? h = e["monitoring-listen"] : e["monitoring-port"] && (h = `127.0.0.1:${e["monitoring-port"]}`);
1479
- let p = "127.0.0.1:9091";
1480
- e["debug-listen"] ? p = e["debug-listen"] : e["debug-port"] && (p = `127.0.0.1:${e["debug-port"]}`);
1481
- const b = {
1479
+ let b = "127.0.0.1:9091";
1480
+ e["debug-listen"] ? b = e["debug-listen"] : e["debug-port"] && (b = `127.0.0.1:${e["debug-port"]}`);
1481
+ const w = {
1482
1482
  sourcesPath: e["pl-sources"],
1483
1483
  binaryPath: e["pl-binary"],
1484
1484
  version: e.version,
@@ -1489,7 +1489,7 @@ let gt = (T = class extends L {
1489
1489
  configOptions: {
1490
1490
  grpc: { listen: d },
1491
1491
  monitoring: { listen: h },
1492
- debug: { listen: p },
1492
+ debug: { listen: b },
1493
1493
  license: { value: e.license, file: e["license-file"] },
1494
1494
  log: { path: c },
1495
1495
  localRoot: i,
@@ -1501,8 +1501,8 @@ let gt = (T = class extends L {
1501
1501
  // we want to keep at least a couple for UI and other apps to work.
1502
1502
  numCpu: Math.max(me.cpus().length - 2, 1)
1503
1503
  }
1504
- }, y = r.createLocal(n, b);
1505
- b.binaryPath || b.sourcesPath ? r.switchInstance(y) : $e(t, { version: e.version }).then(() => {
1504
+ }, y = r.createLocal(n, w);
1505
+ w.binaryPath || w.sourcesPath ? r.switchInstance(y) : $e(t, { version: e.version }).then(() => {
1506
1506
  const P = r.switchInstance(y);
1507
1507
  setTimeout(() => {
1508
1508
  for (const $ of P)
@@ -1524,7 +1524,7 @@ let gt = (T = class extends L {
1524
1524
  ...le,
1525
1525
  ...oe,
1526
1526
  ...de,
1527
- ...we,
1527
+ ...pe,
1528
1528
  ...ve,
1529
1529
  ...J
1530
1530
  }), T);
@@ -1536,7 +1536,7 @@ const q = class q extends L {
1536
1536
  };
1537
1537
  l(q, "description", "List available instances"), l(q, "examples", ["<%= config.bin %> <%= command.id %>"]), l(q, "flags", {
1538
1538
  ...A,
1539
- all: w.boolean({
1539
+ all: p.boolean({
1540
1540
  description: "remove all known instances",
1541
1541
  required: !1
1542
1542
  })
@@ -1595,8 +1595,8 @@ let ut = (F = class extends L {
1595
1595
  enabled: s,
1596
1596
  drivers: r.initAuthDriversList(e, ".")
1597
1597
  } : void 0, c = e.storage ? m.join(".", e.storage) : u.instanceDir(n), o = [];
1598
- for (const p of e.mount ?? [])
1599
- o.push({ hostPath: p });
1598
+ for (const b of e.mount ?? [])
1599
+ o.push({ hostPath: b });
1600
1600
  const g = e.arch ? `linux/${e.arch}` : void 0, d = e["minio-presign-host"] ? "minio" : "localhost", h = r.createDockerS3(n, c, {
1601
1601
  image: e.image,
1602
1602
  version: e.version,
@@ -1611,6 +1611,8 @@ let ut = (F = class extends L {
1611
1611
  monitoringPort: e["monitoring-port"],
1612
1612
  debugAddr: e["debug-listen"],
1613
1613
  debugPort: e["debug-port"],
1614
+ s3Port: e["s3-port"],
1615
+ s3ConsolePort: e["s3-console-port"],
1614
1616
  presignHost: d
1615
1617
  });
1616
1618
  r.switchInstance(h);
@@ -1618,12 +1620,13 @@ let ut = (F = class extends L {
1618
1620
  }, l(F, "description", "Run platforma backend service with 'S3' primary storage type"), l(F, "examples", ["<%= config.bin %> <%= command.id %>"]), l(F, "flags", {
1619
1621
  ...A,
1620
1622
  ...U,
1623
+ ...He,
1621
1624
  ...ye,
1622
1625
  ...j,
1623
- ...pe,
1626
+ ...be,
1624
1627
  ...J,
1625
1628
  ...B,
1626
- ...be,
1629
+ ...we,
1627
1630
  ...G,
1628
1631
  ...yr
1629
1632
  }), F);
@@ -1637,9 +1640,9 @@ let ft = (D = class extends L {
1637
1640
  e["grpc-listen"] ? d = e["grpc-listen"] : e["grpc-port"] && (d = `127.0.0.1:${e["grpc-port"]}`);
1638
1641
  let h = "127.0.0.1:9090";
1639
1642
  e["monitoring-listen"] ? h = e["monitoring-listen"] : e["monitoring-port"] && (h = `127.0.0.1:${e["monitoring-port"]}`);
1640
- let p = "127.0.0.1:9091";
1641
- e["debug-listen"] ? p = e["debug-listen"] : e["debug-port"] && (p = `127.0.0.1:${e["debug-port"]}`);
1642
- const b = {
1643
+ let b = "127.0.0.1:9091";
1644
+ e["debug-listen"] ? b = e["debug-listen"] : e["debug-port"] && (b = `127.0.0.1:${e["debug-port"]}`);
1645
+ const w = {
1643
1646
  sourcesPath: e["pl-sources"],
1644
1647
  binaryPath: e["pl-binary"],
1645
1648
  version: e.version,
@@ -1652,7 +1655,7 @@ let ft = (D = class extends L {
1652
1655
  configOptions: {
1653
1656
  grpc: { listen: d },
1654
1657
  monitoring: { listen: h },
1655
- debug: { listen: p },
1658
+ debug: { listen: b },
1656
1659
  license: { value: e.license, file: e["license-file"] },
1657
1660
  log: { path: c },
1658
1661
  localRoot: i,
@@ -1666,8 +1669,8 @@ let ft = (D = class extends L {
1666
1669
  work: { type: "FS", rootPath: e["storage-work"] }
1667
1670
  }
1668
1671
  }
1669
- }, y = r.createLocalS3(n, b);
1670
- b.binaryPath || b.sourcesPath ? r.switchInstance(y) : await $e(t, { version: e.version }).then(() => {
1672
+ }, y = r.createLocalS3(n, w);
1673
+ w.binaryPath || w.sourcesPath ? r.switchInstance(y) : await $e(t, { version: e.version }).then(() => {
1671
1674
  const P = r.switchInstance(y), $ = [];
1672
1675
  for (const k of P)
1673
1676
  $.push(new Promise((v, S) => {
@@ -1682,7 +1685,7 @@ let ft = (D = class extends L {
1682
1685
  ...A,
1683
1686
  ...j,
1684
1687
  ...U,
1685
- ...hr,
1688
+ ...He,
1686
1689
  ...Pe,
1687
1690
  ...ke,
1688
1691
  ...Se,
@@ -1691,7 +1694,7 @@ let ft = (D = class extends L {
1691
1694
  ...le,
1692
1695
  ...oe,
1693
1696
  ...de,
1694
- ...we,
1697
+ ...pe,
1695
1698
  ...ve,
1696
1699
  ...J
1697
1700
  }), D);
@@ -1731,10 +1734,10 @@ l(V, "description", "Run Platforma Backend service as docker container on curren
1731
1734
  ...U,
1732
1735
  ...ye,
1733
1736
  ...j,
1734
- ...pe,
1737
+ ...be,
1735
1738
  ...J,
1736
1739
  ...B,
1737
- ...be,
1740
+ ...we,
1738
1741
  ...G,
1739
1742
  ...le,
1740
1743
  ...oe,
@@ -1751,10 +1754,10 @@ let mt = (R = class extends L {
1751
1754
  const s = t.name, i = e["pl-workdir"] ?? ".", c = e.storage ? m.join(i, e.storage) : u.instanceDir(s), o = e["pl-log-file"] ? m.join(i, e["pl-log-file"]) : void 0, g = n.initAuthDriversList(e, i), d = e["auth-enabled"] ?? g !== void 0;
1752
1755
  let h = "127.0.0.1:6345";
1753
1756
  e["grpc-listen"] ? h = e["grpc-listen"] : e["grpc-port"] && (h = `127.0.0.1:${e["grpc-port"]}`);
1754
- let p = "127.0.0.1:9090";
1755
- e["monitoring-listen"] ? p = e["monitoring-listen"] : e["monitoring-port"] && (p = `127.0.0.1:${e["monitoring-port"]}`);
1756
- let b = "127.0.0.1:9091";
1757
- e["debug-listen"] ? b = e["debug-listen"] : e["debug-port"] && (b = `127.0.0.1:${e["debug-port"]}`);
1757
+ let b = "127.0.0.1:9090";
1758
+ e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
1759
+ let w = "127.0.0.1:9091";
1760
+ e["debug-listen"] ? w = e["debug-listen"] : e["debug-port"] && (w = `127.0.0.1:${e["debug-port"]}`);
1758
1761
  const y = {
1759
1762
  sourcesPath: e["pl-sources"],
1760
1763
  binaryPath: e["pl-binary"],
@@ -1765,8 +1768,8 @@ let mt = (R = class extends L {
1765
1768
  libraryURL: e["storage-library"],
1766
1769
  configOptions: {
1767
1770
  grpc: { listen: h },
1768
- monitoring: { listen: p },
1769
- debug: { listen: b },
1771
+ monitoring: { listen: b },
1772
+ debug: { listen: w },
1770
1773
  license: { value: e.license, file: e["license-file"] },
1771
1774
  log: { path: o },
1772
1775
  localRoot: c,
@@ -1799,7 +1802,7 @@ let mt = (R = class extends L {
1799
1802
  ...le,
1800
1803
  ...oe,
1801
1804
  ...de,
1802
- ...we,
1805
+ ...pe,
1803
1806
  ...ve,
1804
1807
  ...J
1805
1808
  }), l(R, "args", {
@@ -1813,8 +1816,8 @@ const K = class K extends L {
1813
1816
  enabled: i,
1814
1817
  drivers: n.initAuthDriversList(e, ".")
1815
1818
  } : void 0, o = e.storage ? m.join(".", e.storage) : u.instanceDir(s), g = [];
1816
- for (const p of e.mount ?? [])
1817
- g.push({ hostPath: p });
1819
+ for (const b of e.mount ?? [])
1820
+ g.push({ hostPath: b });
1818
1821
  const d = e.arch ? `linux/${e.arch}` : void 0, h = e["minio-presign-host"] ? "minio" : "localhost";
1819
1822
  n.createDockerS3(s, o, {
1820
1823
  image: e.image,
@@ -1839,10 +1842,10 @@ l(K, "description", "Run Platforma Backend service as docker container on curren
1839
1842
  ...U,
1840
1843
  ...ye,
1841
1844
  ...j,
1842
- ...pe,
1845
+ ...be,
1843
1846
  ...J,
1844
1847
  ...B,
1845
- ...be,
1848
+ ...we,
1846
1849
  ...G,
1847
1850
  ...yr
1848
1851
  }), l(K, "args", {
@@ -1856,10 +1859,10 @@ const X = class X extends L {
1856
1859
  const s = t.name, i = e["pl-workdir"] ?? ".", c = e.storage ? m.join(i, e.storage) : u.instanceDir(s), o = e["pl-log-file"] ? m.join(i, e["pl-log-file"]) : void 0, g = n.initAuthDriversList(e, i), d = e["auth-enabled"] ?? g !== void 0;
1857
1860
  let h = "127.0.0.1:6345";
1858
1861
  e["grpc-listen"] ? h = e["grpc-listen"] : e["grpc-port"] && (h = `127.0.0.1:${e["grpc-port"]}`);
1859
- let p = "127.0.0.1:9090";
1860
- e["monitoring-listen"] ? p = e["monitoring-listen"] : e["monitoring-port"] && (p = `127.0.0.1:${e["monitoring-port"]}`);
1861
- let b = "127.0.0.1:9091";
1862
- e["debug-listen"] ? b = e["debug-listen"] : e["debug-port"] && (b = `127.0.0.1:${e["debug-port"]}`);
1862
+ let b = "127.0.0.1:9090";
1863
+ e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
1864
+ let w = "127.0.0.1:9091";
1865
+ e["debug-listen"] ? w = e["debug-listen"] : e["debug-port"] && (w = `127.0.0.1:${e["debug-port"]}`);
1863
1866
  const y = {
1864
1867
  sourcesPath: e["pl-sources"],
1865
1868
  binaryPath: e["pl-binary"],
@@ -1872,8 +1875,8 @@ const X = class X extends L {
1872
1875
  minioConsolePort: e["s3-console-port"],
1873
1876
  configOptions: {
1874
1877
  grpc: { listen: h },
1875
- monitoring: { listen: p },
1876
- debug: { listen: b },
1878
+ monitoring: { listen: b },
1879
+ debug: { listen: w },
1877
1880
  license: { value: e.license, file: e["license-file"] },
1878
1881
  log: { path: o },
1879
1882
  localRoot: c,
@@ -1898,7 +1901,7 @@ const X = class X extends L {
1898
1901
  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", {
1899
1902
  ...A,
1900
1903
  ...j,
1901
- ...hr,
1904
+ ...He,
1902
1905
  ...U,
1903
1906
  ...Pe,
1904
1907
  ...ke,
@@ -1908,7 +1911,7 @@ l(X, "description", "Run Platforma Backend service as local process on current h
1908
1911
  ...le,
1909
1912
  ...oe,
1910
1913
  ...de,
1911
- ...we,
1914
+ ...pe,
1912
1915
  ...ve,
1913
1916
  ...J
1914
1917
  }), l(X, "args", {