@platforma-sdk/bootstrap 2.0.1 → 2.1.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
@@ -2,45 +2,159 @@ 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
4
  import { Flags as y, Command as O } from "@oclif/core";
5
- import { execSync as Me, spawn as tr, spawnSync as H } from "node:child_process";
6
- import Ce from "yaml";
7
- import o, { createWriteStream as ar } from "node:fs";
8
5
  import p from "node:os";
9
- import f, { resolve as ir } from "node:path";
6
+ import o, { createWriteStream as tr } from "node:fs";
7
+ import f, { resolve as ar } from "node:path";
8
+ import { execSync as Me, spawn as ir, spawnSync as H } from "node:child_process";
10
9
  import j from "winston";
11
10
  import { randomBytes as sr } from "node:crypto";
12
11
  import V from "readline-sync";
13
- import cr from "node:https";
14
- import * as nr from "tar";
15
- import { Writable as lr } from "node:stream";
12
+ import { Writable as cr } from "node:stream";
16
13
  import { z as K } from "zod";
17
- import or from "decompress";
18
- function Ue(...a) {
19
- return ir(__dirname, "..", ...a);
20
- }
21
- function $(...a) {
22
- return Ue("assets", ...a);
23
- }
24
- function dr() {
25
- return o.readdirSync($()).filter((e) => e.startsWith("compose-") && e.endsWith(".yaml")).map((e) => $(e));
26
- }
27
- function We(...a) {
28
- return o.readFileSync(Ue(...a));
29
- }
30
- var ae;
31
- function Q() {
32
- return ae || (ae = JSON.parse(We("package.json").toString())), ae;
33
- }
34
- function ie(a) {
35
- return a || (a = Q()["pl-version"]), `quay.io/milaboratories/platforma:${a}`;
36
- }
37
- function gr(a) {
14
+ import nr from "decompress";
15
+ import Ce from "yaml";
16
+ import lr from "node:https";
17
+ import * as or from "tar";
18
+ const T = {
19
+ "log-level": y.string({
20
+ description: "logging level",
21
+ default: "info",
22
+ options: ["error", "warn", "info", "debug"],
23
+ required: !1
24
+ })
25
+ }, Ue = {
26
+ image: y.string({
27
+ description: "use custom docker image to run platforma"
28
+ })
29
+ }, Q = {
30
+ version: y.string({
31
+ description: "use custom platforma release (official docker image or binary package)"
32
+ })
33
+ }, X = {
34
+ license: y.string({
35
+ description: 'pass a license code. The license can be got from "https://licensing.milaboratories.com".'
36
+ }),
37
+ "license-file": y.file({
38
+ exists: !0,
39
+ description: "specify a path to the file with a license. The license can be got from 'https://licensing.milaboratories.com'."
40
+ })
41
+ }, Z = {
42
+ "grpc-port": y.integer({
43
+ description: "port for Platforma Backend gRPC API. Default is 6345",
44
+ env: "PLATFORMA_GRPC_PORT"
45
+ }),
46
+ "grpc-listen": y.string({
47
+ description: "full listen addr for Platforma Backend gRPC API. Default is 127.0.0.1:6345",
48
+ env: "PLATFORMA_GRPC_LISTEN"
49
+ }),
50
+ "monitoring-port": y.integer({
51
+ description: "port for Platforma Backend monitoring API. Default is 9090",
52
+ env: "PLATFORMA_MONITORING_PORT"
53
+ }),
54
+ "monitoring-listen": y.string({
55
+ description: "full listen addr for Platforma Backend monitoring API. Default is 127.0.0.1:9090",
56
+ env: "PLATFORMA_MONITORING_LISTEN"
57
+ }),
58
+ "debug-port": y.integer({
59
+ description: "port for Platforma Backend debug API. Default is 9091",
60
+ env: "PLATFORMA_DEBUG_PORT"
61
+ }),
62
+ "debug-listen": y.string({
63
+ description: "full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091",
64
+ env: "PLATFORMA_DEBUG_LISTEN"
65
+ })
66
+ }, dr = {
67
+ "s3-address-port": y.integer({
68
+ description: "port that S3 will listen, default is 9000",
69
+ default: 9e3,
70
+ env: "PLATFORMA_S3_PORT"
71
+ }),
72
+ "s3-console-address-port": y.integer({
73
+ description: "port that a console of S3 will listen, default is 9001",
74
+ default: 9001,
75
+ env: "PLATFORMA_S3_CONSOLE_PORT"
76
+ })
77
+ }, ee = {
78
+ storage: y.string({
79
+ description: "specify path on host to be used as storage for all Platforma Backend data"
80
+ })
81
+ }, We = {
82
+ "pl-log-file": y.file({
83
+ description: "specify path for Platforma Backend log file"
84
+ })
85
+ }, je = {
86
+ "pl-workdir": y.file({
87
+ description: "specify working directory for Platforma Backend process"
88
+ })
89
+ }, Je = {
90
+ "pl-binary": y.file({
91
+ description: "start given Platforma Backend binary instead of automatically downloaded version"
92
+ })
93
+ }, He = {
94
+ "pl-sources": y.file({
95
+ description: "path to pl repository root: build Platforma Backend from sources and start the resulting binary"
96
+ })
97
+ }, Ye = {
98
+ config: y.string({
99
+ description: "use custom Platforma Backend config"
100
+ })
101
+ };
102
+ y.file({
103
+ description: "specify path on host to be used as 'primary' storage"
104
+ });
105
+ const fe = {
106
+ "storage-work": y.file({
107
+ description: "specify path on host to be used as 'work' storage"
108
+ })
109
+ };
110
+ y.file({
111
+ description: "specify path on host to be used as 'library' storage"
112
+ });
113
+ const he = {
114
+ "storage-primary": y.string({
115
+ description: `specify 'primary' storage destination URL.
116
+ file:/path/to/dir for directory on local FS
117
+ s3://<bucket>/?region=<name> for real AWS bucket
118
+ s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
119
+ s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
120
+ })
121
+ }, me = {
122
+ "storage-library": y.string({
123
+ description: `specify 'library' storage destination URL.
124
+ file:/path/to/dir for directory on local FS
125
+ s3://<bucket>/?region=<name> for real AWS bucket
126
+ s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
127
+ s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
128
+ })
129
+ }, gr = {
130
+ "auth-enabled": y.boolean({
131
+ description: "enable authorization"
132
+ })
133
+ }, ur = {
134
+ "auth-htpasswd-file": y.file({
135
+ description: "path to .htpasswd file with Platforma users (static user DB auth source)"
136
+ })
137
+ }, fr = {
138
+ "auth-ldap-server": y.string({
139
+ description: "address of LDAP server to use for auth in Platforma (auth source)"
140
+ })
141
+ }, hr = {
142
+ "auth-ldap-default-dn": y.string({
143
+ description: "DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com"
144
+ })
145
+ }, re = {
146
+ ...gr,
147
+ ...ur,
148
+ ...fr,
149
+ ...hr
150
+ };
151
+ function mr(a) {
38
152
  return V.question(`${a} [y/N] `).toLowerCase() === "y";
39
153
  }
40
154
  function Y(a) {
41
155
  throw new Error("this should never happen");
42
156
  }
43
- function T(a = "debug") {
157
+ function E(a = "debug") {
44
158
  return j.createLogger({
45
159
  level: a,
46
160
  format: j.format.combine(
@@ -59,16 +173,16 @@ function T(a = "debug") {
59
173
  ]
60
174
  });
61
175
  }
62
- function ur(a) {
176
+ function yr(a) {
63
177
  return sr(Math.ceil(a / 2)).toString("hex").slice(0, a);
64
178
  }
65
- function fr(a) {
179
+ function Pr(a) {
66
180
  return a.startsWith("~") ? f.join(p.homedir(), a.slice(1)) : a;
67
181
  }
68
182
  function q(a) {
69
183
  o.existsSync(a) || o.mkdirSync(a, { recursive: !0 });
70
184
  }
71
- function hr(a) {
185
+ function br(a) {
72
186
  try {
73
187
  if (p.platform() !== "win32")
74
188
  return Me(`ps -p ${a} -o comm=`, { encoding: "utf8" }).trim();
@@ -79,6 +193,77 @@ function hr(a) {
79
193
  return "";
80
194
  }
81
195
  }
196
+ const vr = K.object({
197
+ npmOrgName: K.string().min(1),
198
+ orgName: K.string().min(1),
199
+ blockName: K.string().min(1)
200
+ });
201
+ async function wr(a) {
202
+ const e = kr(), r = f.join(process.cwd(), e.blockName);
203
+ a.info("Downloading boilerplate code..."), await Sr(
204
+ "https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip",
205
+ "platforma-block-boilerplate-main",
206
+ r
207
+ ), a.info("Replace everything in the template with provided options..."), Ar(
208
+ r,
209
+ /pl-open\/my-org.block-boilerplate/g,
210
+ `${e.npmOrgName}/${e.orgName}.${e.blockName}`
211
+ );
212
+ }
213
+ function kr() {
214
+ let a = V.question('Write an organization name for npm. Default is "pl-open": ');
215
+ a === "" && (a = "pl-open");
216
+ 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
+ return vr.parse({ npmOrgName: a, orgName: e, blockName: r });
218
+ }
219
+ 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));
221
+ 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 });
224
+ }
225
+ function Ar(a, e, r) {
226
+ Lr(a).forEach((t) => Rr(t, e, r));
227
+ }
228
+ function Lr(a) {
229
+ return o.readdirSync(a, {
230
+ withFileTypes: !0,
231
+ recursive: !0
232
+ }).filter((r) => r.isFile()).map((r) => f.join(r.parentPath, r.name));
233
+ }
234
+ function Rr(a, e, r) {
235
+ const i = o.readFileSync(a).toString().replaceAll(e, r);
236
+ o.writeFileSync(a, i);
237
+ }
238
+ const I = class I extends O {
239
+ async run() {
240
+ const { flags: e } = await this.parse(I), r = E(e["log-level"]);
241
+ await wr(r);
242
+ }
243
+ };
244
+ m(I, "description", "Helps to create a new block by downloading a block's template."), m(I, "examples", ["<%= name %>"]), m(I, "flags", {
245
+ ...T
246
+ });
247
+ let se = I;
248
+ function ze(...a) {
249
+ return ar(__dirname, "..", ...a);
250
+ }
251
+ function $(...a) {
252
+ return ze("assets", ...a);
253
+ }
254
+ function pr() {
255
+ return o.readdirSync($()).filter((e) => e.startsWith("compose-") && e.endsWith(".yaml")).map((e) => $(e));
256
+ }
257
+ function Ke(...a) {
258
+ return o.readFileSync(ze(...a));
259
+ }
260
+ var ae;
261
+ function te() {
262
+ return ae || (ae = JSON.parse(Ke("package.json").toString())), ae;
263
+ }
264
+ function ie(a) {
265
+ return a || (a = te()["pl-version"]), `quay.io/milaboratories/platforma:${a}`;
266
+ }
82
267
  const F = class F {
83
268
  constructor(e) {
84
269
  m(this, "state", {
@@ -89,7 +274,7 @@ const F = class F {
89
274
  m(this, "dirPath");
90
275
  e = e ?? f.resolve(p.homedir(), ".config", "pl-bootstrap");
91
276
  const r = f.join(e, "state.json");
92
- this.dirPath = e, this.filePath = r, o.existsSync(e) || o.mkdirSync(e, { recursive: !0 }), o.existsSync(r) && (this.state = JSON.parse(We(r).toString()));
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()));
93
278
  }
94
279
  static getInstance() {
95
280
  return F.instance || (F.instance = new F()), F.instance;
@@ -114,7 +299,7 @@ const F = class F {
114
299
  var r, t;
115
300
  if (!((t = (r = this.state.lastRun) == null ? void 0 : r.process) != null && t.pid))
116
301
  return !1;
117
- const e = hr(this.state.lastRun.process.pid);
302
+ const e = br(this.state.lastRun.process.pid);
118
303
  return e === "platforma" || e.endsWith("/platforma") || e.endsWith("\\platforma");
119
304
  }
120
305
  set isActive(e) {
@@ -128,8 +313,8 @@ const F = class F {
128
313
  }
129
314
  };
130
315
  m(F, "instance");
131
- let se = F;
132
- const l = se.getInstance();
316
+ let ce = F;
317
+ const l = ce.getInstance();
133
318
  function Be(a, e, r, t) {
134
319
  var i;
135
320
  return l.lastRun = {
@@ -143,9 +328,9 @@ function Be(a, e, r, t) {
143
328
  ...(i = l.lastRun) == null ? void 0 : i.docker,
144
329
  ...t
145
330
  }
146
- }, je(a, "docker", e, r);
331
+ }, qe(a, "docker", e, r);
147
332
  }
148
- function mr(a, e, r, t, i) {
333
+ function _r(a, e, r, t, i) {
149
334
  var c;
150
335
  l.lastRun = {
151
336
  ...l.lastRun,
@@ -159,13 +344,13 @@ function mr(a, e, r, t, i) {
159
344
  ...i
160
345
  }
161
346
  };
162
- const s = Pr(a, e, r, t);
347
+ const s = Or(a, e, r, t);
163
348
  return l.lastRun.process = {
164
349
  ...l.lastRun.process,
165
350
  pid: s.pid
166
351
  }, s;
167
352
  }
168
- function yr(a, e) {
353
+ function $r(a, e) {
169
354
  if (!l.lastRun)
170
355
  throw new Error("no previous run info found: this is the first run after package installation");
171
356
  return e = {
@@ -175,16 +360,16 @@ function yr(a, e) {
175
360
  ...e.env
176
361
  },
177
362
  ...e
178
- }, je(a, l.lastRun.cmd, l.lastRun.args, e);
363
+ }, qe(a, l.lastRun.cmd, l.lastRun.args, e);
179
364
  }
180
- function Pr(a, e, r, t) {
365
+ function Or(a, e, r, t) {
181
366
  a.debug(
182
367
  `Running:
183
368
  env: ${JSON.stringify(t.env)}
184
369
  cmd: ${JSON.stringify([e, ...r])}
185
370
  wd: ${t.cwd}`
186
371
  ), t.env = { ...process.env, ...t.env }, a.debug(" spawning child process");
187
- const i = tr(e, r, t);
372
+ const i = ir(e, r, t);
188
373
  var s = !1;
189
374
  const c = () => {
190
375
  i.kill("SIGINT"), s = !0;
@@ -193,7 +378,7 @@ function Pr(a, e, r, t) {
193
378
  process.removeListener("SIGINT", c), s && process.exit(n);
194
379
  }), i;
195
380
  }
196
- function je(a, e, r, t) {
381
+ function qe(a, e, r, t) {
197
382
  return a.debug(
198
383
  `Running:
199
384
  env: ${JSON.stringify(t.env)}
@@ -201,7 +386,7 @@ function je(a, e, r, t) {
201
386
  wd: ${t.cwd}`
202
387
  ), t.env = { ...process.env, ...t.env }, H(e, r, t);
203
388
  }
204
- function br(a) {
389
+ function Tr(a) {
205
390
  return {
206
391
  id: a,
207
392
  type: "S3",
@@ -219,7 +404,7 @@ function br(a) {
219
404
  uploadKeyPrefix: ""
220
405
  };
221
406
  }
222
- function Je(a) {
407
+ function Ve(a) {
223
408
  return {
224
409
  id: a,
225
410
  type: "FS",
@@ -228,7 +413,7 @@ function Je(a) {
228
413
  };
229
414
  }
230
415
  function N(a, e, r) {
231
- a = fr(a);
416
+ a = Pr(a);
232
417
  const t = new URL(a, `file:${e}`);
233
418
  switch (t.protocol) {
234
419
  case "s3:":
@@ -272,7 +457,7 @@ function N(a, e, r) {
272
457
  throw new Error(`storage protocol '${t.protocol}' is not supported`);
273
458
  }
274
459
  }
275
- function vr(a, e) {
460
+ function Er(a, e) {
276
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;
277
462
  const r = (e == null ? void 0 : e.localRoot) ?? l.data("local-custom"), t = {
278
463
  level: ((d = e == null ? void 0 : e.log) == null ? void 0 : d.level) ?? "info",
@@ -307,7 +492,7 @@ function vr(a, e) {
307
492
  switch ((Re = (Le = e == null ? void 0 : e.storages) == null ? void 0 : Le.work) == null ? void 0 : Re.type) {
308
493
  case void 0:
309
494
  case "FS":
310
- n = Je("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";
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";
311
496
  break;
312
497
  default:
313
498
  throw new Error("work storage MUST have 'FS' type as it is used for working directories management");
@@ -344,17 +529,17 @@ function Ge(a, e, r, t) {
344
529
  switch (t == null ? void 0 : t.type) {
345
530
  case void 0:
346
531
  case "FS":
347
- i = Je(a), i.rootPath = (t == null ? void 0 : t.rootPath) ?? e;
532
+ i = Ve(a), i.rootPath = (t == null ? void 0 : t.rootPath) ?? e;
348
533
  break;
349
534
  case "S3":
350
- i = br(a), i.endpoint = (t == null ? void 0 : t.endpoint) ?? "http://localhost:9000", i.presignEndpoint = (t == null ? void 0 : t.presignEndpoint) ?? "http://localhost:9000", i.bucketName = (t == null ? void 0 : t.bucketName) ?? r, i.createBucket = z(t == null ? void 0 : t.createBucket, !0), i.forcePathStyle = z(t == null ? void 0 : t.forcePathStyle, !0), i.key = (t == null ? void 0 : t.key) ?? "", i.secret = (t == null ? void 0 : t.secret) ?? "", i.keyPrefix = (t == null ? void 0 : t.keyPrefix) ?? "", i.accessPrefixes = (t == null ? void 0 : t.accessPrefixes) ?? [""], i.uploadKeyPrefix = (t == null ? void 0 : t.uploadKeyPrefix) ?? "";
535
+ i = Tr(a), i.endpoint = (t == null ? void 0 : t.endpoint) ?? "http://localhost:9000", i.presignEndpoint = (t == null ? void 0 : t.presignEndpoint) ?? "http://localhost:9000", i.bucketName = (t == null ? void 0 : t.bucketName) ?? r, i.createBucket = z(t == null ? void 0 : t.createBucket, !0), i.forcePathStyle = z(t == null ? void 0 : t.forcePathStyle, !0), i.key = (t == null ? void 0 : t.key) ?? "", i.secret = (t == null ? void 0 : t.secret) ?? "", i.keyPrefix = (t == null ? void 0 : t.keyPrefix) ?? "", i.accessPrefixes = (t == null ? void 0 : t.accessPrefixes) ?? [""], i.uploadKeyPrefix = (t == null ? void 0 : t.uploadKeyPrefix) ?? "";
351
536
  break;
352
537
  default:
353
538
  throw Y(), new Error("unknown storage type");
354
539
  }
355
540
  return i;
356
541
  }
357
- function wr(a) {
542
+ function Fr(a) {
358
543
  const e = a.monitoring.enabled ? "" : " disabled", r = a.debug.enabled ? "" : " disabled", t = a.hacks.libraryDownloadable ? "true" : "false";
359
544
  var i = a.license.value;
360
545
  return a.license.file != "" && (i = o.readFileSync(a.license.file).toString().trimEnd()), `
@@ -431,8 +616,8 @@ controllers:
431
616
  function z(a, e) {
432
617
  return a === void 0 ? e : a;
433
618
  }
434
- const kr = ["linux", "macos", "windows"];
435
- function Sr(a) {
619
+ const Dr = ["linux", "macos", "windows"];
620
+ function Nr(a) {
436
621
  const e = p.platform();
437
622
  switch (e) {
438
623
  case "darwin":
@@ -443,12 +628,12 @@ function Sr(a) {
443
628
  return "windows";
444
629
  default:
445
630
  throw new Error(
446
- `operating system '${e}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` + JSON.stringify(kr)
631
+ `operating system '${e}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` + JSON.stringify(Dr)
447
632
  );
448
633
  }
449
634
  }
450
- const Ar = ["amd64", "arm64"];
451
- function He(a) {
635
+ const Ir = ["amd64", "arm64"];
636
+ function Qe(a) {
452
637
  const e = p.arch();
453
638
  switch (e) {
454
639
  case "arm64":
@@ -457,18 +642,18 @@ function He(a) {
457
642
  return "amd64";
458
643
  default:
459
644
  throw new Error(
460
- `processor architecture '${e}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` + JSON.stringify(Ar)
645
+ `processor architecture '${e}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` + JSON.stringify(Ir)
461
646
  );
462
647
  }
463
648
  }
464
- function Lr(a, e) {
465
- const r = (e == null ? void 0 : e.version) ?? Q()["pl-version"], t = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, i = `pl-${r}-${He()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${Sr()}/${i}`, c = (e == null ? void 0 : e.saveTo) ?? l.binaries(i);
649
+ 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);
466
651
  if (o.existsSync(c))
467
652
  return a.info(`Platforma Backend archive download skipped: '${c}' already exists`), Promise.resolve(c);
468
653
  o.mkdirSync(f.dirname(c), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
469
654
  URL: ${s}
470
655
  Save to: ${c}`);
471
- const n = cr.get(s);
656
+ const n = lr.get(s);
472
657
  return new Promise((h, u) => {
473
658
  n.on("response", (g) => {
474
659
  if (!g.statusCode) {
@@ -496,13 +681,13 @@ function Lr(a, e) {
496
681
  });
497
682
  });
498
683
  }
499
- function Rr(a, e) {
684
+ function Mr(a, e) {
500
685
  a.debug("extracting archive...");
501
- const r = (e == null ? void 0 : e.version) ?? Q()["pl-version"];
686
+ const r = (e == null ? void 0 : e.version) ?? te()["pl-version"];
502
687
  a.debug(` version: '${r}'`);
503
- const t = `${ze({ version: r })}.tgz`, i = (e == null ? void 0 : e.archivePath) ?? l.binaries(t);
688
+ const t = `${Ze({ version: r })}.tgz`, i = (e == null ? void 0 : e.archivePath) ?? l.binaries(t);
504
689
  a.debug(` archive path: '${i}'`);
505
- const s = (e == null ? void 0 : e.extractTo) ?? _r(i);
690
+ const s = (e == null ? void 0 : e.extractTo) ?? Br(i);
506
691
  if (a.debug(` target dir: '${s}'`), o.existsSync(s))
507
692
  return a.info(`Platforma Backend binaries unpack skipped: '${s}' exists`), s;
508
693
  if (!o.existsSync(i)) {
@@ -511,23 +696,23 @@ function Rr(a, e) {
511
696
  }
512
697
  return o.existsSync(s) || (a.debug(` creating target dir '${s}'`), o.mkdirSync(s, { recursive: !0 })), a.info(`Unpacking Platforma Backend archive:
513
698
  Archive: ${i}
514
- Target dir: ${s}`), nr.x({
699
+ Target dir: ${s}`), or.x({
515
700
  file: i,
516
701
  cwd: s,
517
702
  gzip: !0,
518
703
  sync: !0
519
704
  }), a.info(" ... unpack done."), s;
520
705
  }
521
- function Ye(a, e) {
522
- return Lr(a, e).then((r) => Rr(a, { archivePath: r }));
706
+ function Xe(a, e) {
707
+ return xr(a, e).then((r) => Mr(a, { archivePath: r }));
523
708
  }
524
- function ze(a) {
525
- return `pl-${(a == null ? void 0 : a.version) ?? Q()["pl-version"]}-${He()}`;
709
+ function Ze(a) {
710
+ return `pl-${(a == null ? void 0 : a.version) ?? te()["pl-version"]}-${Qe()}`;
526
711
  }
527
- function pr(a, ...e) {
528
- return l.binaries(ze({ version: a }), ...e);
712
+ function Cr(a, ...e) {
713
+ return l.binaries(Ze({ version: a }), ...e);
529
714
  }
530
- function _r(a) {
715
+ function Br(a) {
531
716
  const e = a.lastIndexOf(".");
532
717
  return e === -1 ? a : a.slice(0, e);
533
718
  }
@@ -536,12 +721,12 @@ class D {
536
721
  this.logger = e;
537
722
  }
538
723
  startLast() {
539
- const e = yr(this.logger, { stdio: "inherit" });
724
+ const e = $r(this.logger, { stdio: "inherit" });
540
725
  J(e, "failed to bring back Platforma Backend in the last started configuration");
541
726
  }
542
727
  startLocal(e) {
543
728
  var h, u, g, v, P, d, b, w, S, L;
544
- const r = (e == null ? void 0 : e.binaryPath) ?? pr(e == null ? void 0 : e.version, "binaries", "platforma");
729
+ const r = (e == null ? void 0 : e.binaryPath) ?? Cr(e == null ? void 0 : e.version, "binaries", "platforma");
545
730
  var t = e == null ? void 0 : e.configPath;
546
731
  const i = (e == null ? void 0 : e.workdir) ?? (t ? process.cwd() : l.path());
547
732
  e != null && e.primaryURL && (e.configOptions = {
@@ -557,7 +742,7 @@ class D {
557
742
  library: N(e.libraryURL, i, (d = (P = e.configOptions) == null ? void 0 : P.storages) == null ? void 0 : d.library)
558
743
  }
559
744
  });
560
- const s = vr(this.getLastJwt(), e == null ? void 0 : e.configOptions);
745
+ const s = Er(this.getLastJwt(), e == null ? void 0 : e.configOptions);
561
746
  this.logger.debug(" checking license..."), this.checkLicense((w = (b = e == null ? void 0 : e.configOptions) == null ? void 0 : b.license) == null ? void 0 : w.value, (L = (S = e == null ? void 0 : e.configOptions) == null ? void 0 : S.license) == null ? void 0 : L.file);
562
747
  const c = [
563
748
  `${s.localRoot}/packages`,
@@ -569,7 +754,7 @@ class D {
569
754
  o.existsSync(k) || (this.logger.debug(` '${k}'`), o.mkdirSync(k, { recursive: !0 }));
570
755
  for (const k of s.core.auth.drivers)
571
756
  k.driver === "htpasswd" && (o.existsSync(k.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${k.path}...`), o.copyFileSync($("users.htpasswd"), k.path)));
572
- t || (t = f.join(s.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${t}'...`), o.writeFileSync(t, wr(s)));
757
+ t || (t = f.join(s.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${t}'...`), o.writeFileSync(t, Fr(s)));
573
758
  const n = this.renderRunInfo({
574
759
  configPath: t,
575
760
  dbPath: s.core.db.path,
@@ -580,7 +765,7 @@ class D {
580
765
  library: s.storages.library
581
766
  });
582
767
  return this.logger.info(`Starting platforma:
583
- ${n}`), mr(
768
+ ${n}`), _r(
584
769
  this.logger,
585
770
  r,
586
771
  ["-config", t],
@@ -840,11 +1025,11 @@ Things to be removed:
840
1025
  - `)}
841
1026
  ${i}
842
1027
  `;
843
- if (this.logger.warn(s), !gr("Are you sure?")) {
1028
+ if (this.logger.warn(s), !mr("Are you sure?")) {
844
1029
  this.logger.info("Reset action was canceled");
845
1030
  return;
846
1031
  }
847
- const c = new Set(dr());
1032
+ const c = new Set(pr());
848
1033
  (W = (_ = l.lastRun) == null ? void 0 : _.docker) != null && W.composePath && c.add(l.lastRun.docker.composePath);
849
1034
  for (const A of c)
850
1035
  this.logger.info(`Destroying docker compose '${A}'`), this.destroyDocker(A, ie());
@@ -881,7 +1066,7 @@ If you want to remove all downloaded platforma binaries, delete '${l.binaries()}
881
1066
  t = o.readFileSync(e, { encoding: r });
882
1067
  } catch {
883
1068
  }
884
- return t == "" && (t = ur(64), o.writeFileSync(e, t, { encoding: r })), t;
1069
+ return t == "" && (t = yr(64), o.writeFileSync(e, t, { encoding: r })), t;
885
1070
  }
886
1071
  destroyDocker(e, r) {
887
1072
  const t = l.data("stub"), i = H("docker", ["compose", "--file", e, "down", "--volumes", "--remove-orphans"], {
@@ -975,171 +1160,39 @@ function J(a, e) {
975
1160
  if (a.status !== 0)
976
1161
  throw new Error(`${r}, process exited with code '${a.status}'`);
977
1162
  }
978
- const E = {
979
- "log-level": y.string({
980
- description: "logging level",
981
- default: "info",
982
- options: ["error", "warn", "info", "debug"],
983
- required: !1
984
- })
985
- }, Ke = {
986
- image: y.string({
987
- description: "use custom docker image to run platforma"
988
- })
989
- }, X = {
990
- version: y.string({
991
- description: "use custom platforma release (official docker image or binary package)"
992
- })
993
- }, Z = {
994
- license: y.string({
995
- description: 'pass a license code. The license can be got from "https://licensing.milaboratories.com".'
996
- }),
997
- "license-file": y.file({
998
- exists: !0,
999
- description: "specify a path to the file with a license. The license can be got from 'https://licensing.milaboratories.com'."
1000
- })
1001
- }, ee = {
1002
- "grpc-port": y.integer({
1003
- description: "port for Platforma Backend gRPC API. Default is 6345",
1004
- env: "PLATFORMA_GRPC_PORT"
1005
- }),
1006
- "grpc-listen": y.string({
1007
- description: "full listen addr for Platforma Backend gRPC API. Default is 127.0.0.1:6345",
1008
- env: "PLATFORMA_GRPC_LISTEN"
1009
- }),
1010
- "monitoring-port": y.integer({
1011
- description: "port for Platforma Backend monitoring API. Default is 9090",
1012
- env: "PLATFORMA_MONITORING_PORT"
1013
- }),
1014
- "monitoring-listen": y.string({
1015
- description: "full listen addr for Platforma Backend monitoring API. Default is 127.0.0.1:9090",
1016
- env: "PLATFORMA_MONITORING_LISTEN"
1017
- }),
1018
- "debug-port": y.integer({
1019
- description: "port for Platforma Backend debug API. Default is 9091",
1020
- env: "PLATFORMA_DEBUG_PORT"
1021
- }),
1022
- "debug-listen": y.string({
1023
- description: "full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091",
1024
- env: "PLATFORMA_DEBUG_LISTEN"
1025
- })
1026
- }, $r = {
1027
- "s3-address-port": y.integer({
1028
- description: "port that S3 will listen, default is 9000",
1029
- default: 9e3,
1030
- env: "PLATFORMA_S3_PORT"
1031
- }),
1032
- "s3-console-address-port": y.integer({
1033
- description: "port that a console of S3 will listen, default is 9001",
1034
- default: 9001,
1035
- env: "PLATFORMA_S3_CONSOLE_PORT"
1036
- })
1037
- }, re = {
1038
- storage: y.string({
1039
- description: "specify path on host to be used as storage for all Platforma Backend data"
1040
- })
1041
- }, qe = {
1042
- "pl-log-file": y.file({
1043
- description: "specify path for Platforma Backend log file"
1044
- })
1045
- }, Ve = {
1046
- "pl-workdir": y.file({
1047
- description: "specify working directory for Platforma Backend process"
1048
- })
1049
- }, Qe = {
1050
- "pl-binary": y.file({
1051
- description: "start given Platforma Backend binary instead of automatically downloaded version"
1052
- })
1053
- }, Xe = {
1054
- "pl-sources": y.file({
1055
- description: "path to pl repository root: build Platforma Backend from sources and start the resulting binary"
1056
- })
1057
- }, Ze = {
1058
- config: y.string({
1059
- description: "use custom Platforma Backend config"
1060
- })
1061
- };
1062
- y.file({
1063
- description: "specify path on host to be used as 'primary' storage"
1064
- });
1065
- const fe = {
1066
- "storage-work": y.file({
1067
- description: "specify path on host to be used as 'work' storage"
1068
- })
1069
- };
1070
- y.file({
1071
- description: "specify path on host to be used as 'library' storage"
1072
- });
1073
- const he = {
1074
- "storage-primary": y.string({
1075
- description: `specify 'primary' storage destination URL.
1076
- file:/path/to/dir for directory on local FS
1077
- s3://<bucket>/?region=<name> for real AWS bucket
1078
- s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
1079
- s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
1080
- })
1081
- }, me = {
1082
- "storage-library": y.string({
1083
- description: `specify 'library' storage destination URL.
1084
- file:/path/to/dir for directory on local FS
1085
- s3://<bucket>/?region=<name> for real AWS bucket
1086
- s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
1087
- s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
1088
- })
1089
- }, Or = {
1090
- "auth-enabled": y.boolean({
1091
- description: "enable authorization"
1092
- })
1093
- }, Tr = {
1094
- "auth-htpasswd-file": y.file({
1095
- description: "path to .htpasswd file with Platforma users (static user DB auth source)"
1096
- })
1097
- }, Er = {
1098
- "auth-ldap-server": y.string({
1099
- description: "address of LDAP server to use for auth in Platforma (auth source)"
1100
- })
1101
- }, Fr = {
1102
- "auth-ldap-default-dn": y.string({
1103
- description: "DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com"
1104
- })
1105
- }, te = {
1106
- ...Or,
1107
- ...Tr,
1108
- ...Er,
1109
- ...Fr
1110
- }, I = class I extends O {
1111
- async run() {
1112
- const { flags: e } = await this.parse(I), r = T(e["log-level"]);
1113
- new D(r).stop();
1114
- }
1115
- };
1116
- m(I, "description", "Stop platforma service"), m(I, "examples", ["<%= config.bin %> <%= command.id %>"]), m(I, "flags", {
1117
- ...E
1118
- });
1119
- let ce = I;
1120
1163
  const x = class x extends O {
1121
1164
  async run() {
1122
- const { flags: e } = await this.parse(x), r = T(e["log-level"]);
1165
+ const { flags: e } = await this.parse(x), r = E(e["log-level"]);
1123
1166
  new D(r).cleanup();
1124
1167
  }
1125
1168
  };
1126
1169
  m(x, "description", "Clear service state (forget last run command, destroy docker services, volumes and so on)"), m(x, "examples", ["<%= config.bin %> <%= command.id %>"]), m(x, "flags", {
1127
- ...E
1170
+ ...T
1128
1171
  });
1129
1172
  let ne = x;
1130
1173
  const M = class M extends O {
1131
1174
  async run() {
1132
- const { flags: e } = await this.parse(M), r = T(e["log-level"]);
1175
+ const { flags: e } = await this.parse(M), r = E(e["log-level"]);
1133
1176
  new D(r).startLast();
1134
1177
  }
1135
1178
  };
1136
1179
  m(M, "description", "Start last run service configuraiton"), m(M, "examples", ["<%= config.bin %> <%= command.id %>"]), m(M, "flags", {
1137
- ...E
1180
+ ...T
1138
1181
  });
1139
1182
  let le = M;
1140
1183
  const C = class C extends O {
1141
1184
  async run() {
1142
- const { flags: e } = await this.parse(C), r = T(e["log-level"]), t = new D(r);
1185
+ const { flags: e } = await this.parse(C), r = E(e["log-level"]);
1186
+ new D(r).stop();
1187
+ }
1188
+ };
1189
+ m(C, "description", "Stop platforma service"), m(C, "examples", ["<%= config.bin %> <%= command.id %>"]), m(C, "flags", {
1190
+ ...T
1191
+ });
1192
+ let oe = C;
1193
+ const B = class B extends O {
1194
+ async run() {
1195
+ const { flags: e } = await this.parse(B), r = E(e["log-level"]), t = new D(r);
1143
1196
  t.mergeLicenseEnvs(e);
1144
1197
  const i = e["auth-enabled"], s = i ? {
1145
1198
  enabled: i,
@@ -1163,54 +1216,22 @@ const C = class C extends O {
1163
1216
  });
1164
1217
  }
1165
1218
  };
1166
- m(C, "description", "Run platforma backend service with 'FS' primary storage type"), m(C, "examples", ["<%= config.bin %> <%= command.id %>"]), m(C, "flags", {
1167
- ...E,
1168
- ...ee,
1169
- ...Ke,
1170
- ...X,
1171
- ...te,
1219
+ m(B, "description", "Run platforma backend service with 'FS' primary storage type"), m(B, "examples", ["<%= config.bin %> <%= command.id %>"]), m(B, "flags", {
1220
+ ...T,
1172
1221
  ...Z,
1222
+ ...Ue,
1223
+ ...Q,
1173
1224
  ...re,
1225
+ ...X,
1226
+ ...ee,
1174
1227
  ...he,
1175
1228
  ...fe,
1176
1229
  ...me
1177
1230
  });
1178
- let oe = C;
1179
- var R;
1180
- let Dr = (R = class extends O {
1181
- async run() {
1182
- const { flags: e } = await this.parse(R), r = T(e["log-level"]), t = new D(r);
1183
- t.mergeLicenseEnvs(e);
1184
- const i = e["auth-enabled"], s = i ? {
1185
- enabled: i,
1186
- drivers: t.initAuthDriversList(e, ".")
1187
- } : void 0, c = e.storage ? f.join(".", e.storage) : l.data("docker-s3");
1188
- t.startDockerS3(c, {
1189
- image: e.image,
1190
- version: e.version,
1191
- license: e.license,
1192
- licenseFile: e["license-file"],
1193
- auth: s,
1194
- grpcAddr: e["grpc-listen"],
1195
- grpcPort: e["grpc-port"],
1196
- monitoringAddr: e["monitoring-listen"],
1197
- monitoringPort: e["monitoring-port"],
1198
- debugAddr: e["debug-listen"],
1199
- debugPort: e["debug-port"]
1200
- });
1201
- }
1202
- }, m(R, "description", "Run platforma backend service with 'S3' primary storage type"), m(R, "examples", ["<%= config.bin %> <%= command.id %>"]), m(R, "flags", {
1203
- ...E,
1204
- ...ee,
1205
- ...Ke,
1206
- ...X,
1207
- ...re,
1208
- ...Z,
1209
- ...te
1210
- }), R);
1211
- const B = class B extends O {
1231
+ let de = B;
1232
+ const G = class G extends O {
1212
1233
  async run() {
1213
- const { flags: e } = await this.parse(B), r = T(e["log-level"]), t = new D(r);
1234
+ const { flags: e } = await this.parse(G), r = E(e["log-level"]), t = new D(r);
1214
1235
  t.mergeLicenseEnvs(e);
1215
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;
1216
1237
  var u = e["pl-binary"];
@@ -1241,31 +1262,63 @@ const B = class B extends O {
1241
1262
  }
1242
1263
  }
1243
1264
  };
1244
- d.binaryPath ? t.startLocal(d) : Ye(r, { version: e.version }).then(() => t.startLocal(d)).catch(function(b) {
1265
+ d.binaryPath ? t.startLocal(d) : Xe(r, { version: e.version }).then(() => t.startLocal(d)).catch(function(b) {
1245
1266
  r.error(b.message);
1246
1267
  });
1247
1268
  }
1248
1269
  };
1249
- m(B, "description", "Run Platforma Backend service as local process on current host (no docker container)"), m(B, "examples", ["<%= config.bin %> <%= command.id %>"]), m(B, "flags", {
1250
- ...E,
1270
+ m(G, "description", "Run Platforma Backend service as local process on current host (no docker container)"), m(G, "examples", ["<%= config.bin %> <%= command.id %>"]), m(G, "flags", {
1271
+ ...T,
1272
+ ...Q,
1273
+ ...Z,
1274
+ ...Je,
1275
+ ...He,
1276
+ ...Ye,
1251
1277
  ...X,
1252
1278
  ...ee,
1253
- ...Qe,
1254
- ...Xe,
1255
- ...Ze,
1256
- ...Z,
1257
- ...re,
1258
1279
  ...he,
1259
1280
  ...fe,
1260
1281
  ...me,
1261
- ...qe,
1262
- ...Ve,
1263
- ...te
1282
+ ...We,
1283
+ ...je,
1284
+ ...re
1264
1285
  });
1265
- let de = B;
1266
- const G = class G extends O {
1286
+ let ge = G;
1287
+ var R;
1288
+ let Gr = (R = class extends O {
1289
+ async run() {
1290
+ const { flags: e } = await this.parse(R), r = E(e["log-level"]), t = new D(r);
1291
+ t.mergeLicenseEnvs(e);
1292
+ const i = e["auth-enabled"], s = i ? {
1293
+ enabled: i,
1294
+ drivers: t.initAuthDriversList(e, ".")
1295
+ } : void 0, c = e.storage ? f.join(".", e.storage) : l.data("docker-s3");
1296
+ t.startDockerS3(c, {
1297
+ image: e.image,
1298
+ version: e.version,
1299
+ license: e.license,
1300
+ licenseFile: e["license-file"],
1301
+ auth: s,
1302
+ grpcAddr: e["grpc-listen"],
1303
+ grpcPort: e["grpc-port"],
1304
+ monitoringAddr: e["monitoring-listen"],
1305
+ monitoringPort: e["monitoring-port"],
1306
+ debugAddr: e["debug-listen"],
1307
+ debugPort: e["debug-port"]
1308
+ });
1309
+ }
1310
+ }, m(R, "description", "Run platforma backend service with 'S3' primary storage type"), m(R, "examples", ["<%= config.bin %> <%= command.id %>"]), m(R, "flags", {
1311
+ ...T,
1312
+ ...Z,
1313
+ ...Ue,
1314
+ ...Q,
1315
+ ...ee,
1316
+ ...X,
1317
+ ...re
1318
+ }), R);
1319
+ const U = class U extends O {
1267
1320
  async run() {
1268
- const { flags: e } = await this.parse(G), r = T(e["log-level"]), t = new D(r);
1321
+ const { flags: e } = await this.parse(U), r = E(e["log-level"]), t = new D(r);
1269
1322
  t.mergeLicenseEnvs(e);
1270
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;
1271
1324
  var u = e["pl-binary"];
@@ -1300,90 +1353,38 @@ const G = class G extends O {
1300
1353
  }
1301
1354
  }
1302
1355
  };
1303
- d.binaryPath ? t.startLocalS3(d) : Ye(r, { version: e.version }).then(() => t.startLocalS3(d)).catch(function(b) {
1356
+ d.binaryPath ? t.startLocalS3(d) : Xe(r, { version: e.version }).then(() => t.startLocalS3(d)).catch(function(b) {
1304
1357
  r.error(b.message);
1305
1358
  });
1306
1359
  }
1307
1360
  };
1308
- m(G, "description", "Run Platforma Backend service as local process on current host (no docker container)"), m(G, "examples", ["<%= config.bin %> <%= command.id %>"]), m(G, "flags", {
1309
- ...E,
1361
+ m(U, "description", "Run Platforma Backend service as local process on current host (no docker container)"), m(U, "examples", ["<%= config.bin %> <%= command.id %>"]), m(U, "flags", {
1362
+ ...T,
1363
+ ...Q,
1364
+ ...Z,
1365
+ ...dr,
1366
+ ...Je,
1367
+ ...He,
1368
+ ...Ye,
1310
1369
  ...X,
1311
1370
  ...ee,
1312
- ...$r,
1313
- ...Qe,
1314
- ...Xe,
1315
- ...Ze,
1316
- ...Z,
1317
- ...re,
1318
1371
  ...he,
1319
1372
  ...fe,
1320
1373
  ...me,
1321
- ...qe,
1322
- ...Ve,
1323
- ...te
1324
- });
1325
- let ge = G;
1326
- const Nr = K.object({
1327
- npmOrgName: K.string().min(1),
1328
- orgName: K.string().min(1),
1329
- blockName: K.string().min(1)
1330
- });
1331
- async function Ir(a) {
1332
- const e = xr(), r = f.join(process.cwd(), e.blockName);
1333
- a.info("Downloading boilerplate code..."), await Mr(
1334
- "https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip",
1335
- "platforma-block-boilerplate-main",
1336
- r
1337
- ), a.info("Replace everything in the template with provided options..."), Cr(
1338
- r,
1339
- /pl-open\/my-org.block-boilerplate/g,
1340
- `${e.npmOrgName}/${e.orgName}.${e.blockName}`
1341
- );
1342
- }
1343
- function xr() {
1344
- let a = V.question('Write an organization name for npm. Default is "pl-open": ');
1345
- a === "" && (a = "pl-open");
1346
- 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": ');
1347
- return Nr.parse({ npmOrgName: a, orgName: e, blockName: r });
1348
- }
1349
- async function Mr(a, e, r) {
1350
- const i = await (await fetch(a)).blob(), s = o.mkdtempSync(f.join(p.tmpdir(), "create-repo")), c = f.join(s, "packed-repo.zip"), n = lr.toWeb(ar(c));
1351
- await i.stream().pipeTo(n);
1352
- const h = f.join(s, "unpacked-repo");
1353
- o.mkdirSync(h), await or(c, h), o.cpSync(f.join(h, e), r, { recursive: !0 });
1354
- }
1355
- function Cr(a, e, r) {
1356
- Br(a).forEach((t) => Gr(t, e, r));
1357
- }
1358
- function Br(a) {
1359
- return o.readdirSync(a, {
1360
- withFileTypes: !0,
1361
- recursive: !0
1362
- }).filter((r) => r.isFile()).map((r) => f.join(r.parentPath, r.name));
1363
- }
1364
- function Gr(a, e, r) {
1365
- const i = o.readFileSync(a).toString().replaceAll(e, r);
1366
- o.writeFileSync(a, i);
1367
- }
1368
- const U = class U extends O {
1369
- async run() {
1370
- const { flags: e } = await this.parse(U), r = T(e["log-level"]);
1371
- await Ir(r);
1372
- }
1373
- };
1374
- m(U, "description", "Helps to create a new block by downloading a block's template."), m(U, "examples", ["<%= name %>"]), m(U, "flags", {
1375
- ...E
1374
+ ...We,
1375
+ ...je,
1376
+ ...re
1376
1377
  });
1377
1378
  let ue = U;
1378
1379
  const rt = {
1379
- stop: ce,
1380
- start: le,
1380
+ "create-block": se,
1381
1381
  reset: ne,
1382
- "create-block": ue,
1383
- "start docker": oe,
1384
- "start local": de,
1385
- "start docker s3": Dr,
1386
- "start local s3": ge
1382
+ start: le,
1383
+ stop: oe,
1384
+ "start:docker": de,
1385
+ "start:local": ge,
1386
+ "start:docker:s3": Gr,
1387
+ "start:local:s3": ue
1387
1388
  };
1388
1389
  export {
1389
1390
  rt as COMMANDS