@milaboratories/pl-middle-layer 1.27.8 → 1.27.9

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
@@ -33,7 +33,7 @@ export * from "@milaboratories/pl-model-middle-layer";
33
33
  export * from "@milaboratories/pl-deployments";
34
34
  import { request as ce, RetryAgent as Is } from "undici";
35
35
  import { RegistryV1 as de, tryLoadPackDescription as yt, BlockPackMetaEmbedAbsoluteBytes as As, RegistryV2Reader as Ts, folderReaderByUrl as Ls, loadPackDescription as zt } from "@platforma-sdk/block-tools";
36
- import X from "node:fs";
36
+ import Y from "node:fs";
37
37
  import G from "node:path";
38
38
  import Ns from "yaml";
39
39
  import { assertNever as M, notEmpty as B, ConsoleLoggerAdapter as Ds, ConcurrencyLimitingExecutor as Bs, HmacSha256Signer as Vr } from "@milaboratories/ts-helpers";
@@ -47,7 +47,7 @@ import { randomUUID as Ae, createHash as De } from "node:crypto";
47
47
  import { parseTemplate as Xs, PlTemplateV1 as ie, PlTemplateOverrideV1 as ke, PlTemplateLibV1 as Ve, PlTemplateSoftwareV1 as be } from "@milaboratories/pl-model-backend";
48
48
  import Mr from "denque";
49
49
  import { Templates as Ys } from "@platforma-sdk/workflow-tengo";
50
- import Q from "canonicalize";
50
+ import Z from "canonicalize";
51
51
  import Qs from "node:assert";
52
52
  import { Scope as St, getQuickJS as Zs } from "quickjs-emscripten";
53
53
  import { setTimeout as _r } from "node:timers/promises";
@@ -94,7 +94,7 @@ async function tr(s, e) {
94
94
  }
95
95
  async function So(s) {
96
96
  try {
97
- return await X.promises.readFile(s, "utf8");
97
+ return await Y.promises.readFile(s, "utf8");
98
98
  } catch (e) {
99
99
  if (e.code === "ENOENT")
100
100
  return;
@@ -103,7 +103,7 @@ async function So(s) {
103
103
  }
104
104
  async function bo(s) {
105
105
  try {
106
- return await X.promises.stat(s, { bigint: !0 });
106
+ return await Y.promises.stat(s, { bigint: !0 });
107
107
  } catch (e) {
108
108
  if (e.code === "ENOENT")
109
109
  return;
@@ -119,9 +119,9 @@ async function Hr(s) {
119
119
  return e.toString();
120
120
  }
121
121
  async function Tt(s) {
122
- const e = await X.promises.stat(s.components.workflow.main.file, {
122
+ const e = await Y.promises.stat(s.components.workflow.main.file, {
123
123
  bigint: !0
124
- }), t = await X.promises.stat(s.components.model.file, { bigint: !0 });
124
+ }), t = await Y.promises.stat(s.components.model.file, { bigint: !0 });
125
125
  return (e.mtimeNs > t.mtimeNs ? e.mtimeNs : t.mtimeNs).toString();
126
126
  }
127
127
  class zl {
@@ -183,7 +183,7 @@ class zl {
183
183
  }
184
184
  );
185
185
  case "local-dev":
186
- for (const a of await X.promises.readdir(r.path, { withFileTypes: !0 })) {
186
+ for (const a of await Y.promises.readdir(r.path, { withFileTypes: !0 })) {
187
187
  if (!a.isDirectory()) continue;
188
188
  const c = G.join(r.path, a.name), l = await So(
189
189
  G.join(c, de.PlPackageYamlConfigFile)
@@ -482,7 +482,7 @@ async function Zo(s) {
482
482
  case "from-file":
483
483
  return {
484
484
  type: "explicit",
485
- content: await X.promises.readFile(s.path)
485
+ content: await Y.promises.readFile(s.path)
486
486
  };
487
487
  case "from-registry":
488
488
  case "explicit":
@@ -541,11 +541,11 @@ class sn {
541
541
  case "explicit":
542
542
  return e.config;
543
543
  case "dev-v1": {
544
- const t = await tr(e.folder), r = await X.promises.readFile(t.config, { encoding: "utf-8" });
544
+ const t = await tr(e.folder), r = await Y.promises.readFile(t.config, { encoding: "utf-8" });
545
545
  return JSON.parse(r);
546
546
  }
547
547
  case "dev-v2": {
548
- const t = await zt(e.folder), r = await X.promises.readFile(t.components.model.file, {
548
+ const t = await zt(e.folder), r = await Y.promises.readFile(t.components.model.file, {
549
549
  encoding: "utf-8"
550
550
  });
551
551
  return JSON.parse(r);
@@ -567,8 +567,8 @@ class sn {
567
567
  case "explicit":
568
568
  return e;
569
569
  case "dev-v1": {
570
- const t = await tr(e.folder), r = await X.promises.readFile(t.workflow), o = JSON.parse(
571
- await X.promises.readFile(t.config, "utf-8")
570
+ const t = await tr(e.folder), r = await Y.promises.readFile(t.workflow), o = JSON.parse(
571
+ await Y.promises.readFile(t.config, "utf-8")
572
572
  ), n = t.ui;
573
573
  return {
574
574
  type: "explicit",
@@ -587,10 +587,10 @@ class sn {
587
587
  }
588
588
  case "dev-v2": {
589
589
  const t = await zt(e.folder), r = JSON.parse(
590
- await X.promises.readFile(t.components.model.file, {
590
+ await Y.promises.readFile(t.components.model.file, {
591
591
  encoding: "utf-8"
592
592
  })
593
- ), o = await X.promises.readFile(
593
+ ), o = await Y.promises.readFile(
594
594
  t.components.workflow.main.file
595
595
  ), n = t.components.ui.folder, i = { ...e };
596
596
  return e.mtime === void 0 && (i.mtime = await Tt(t)), {
@@ -1379,9 +1379,9 @@ async function dn(s, e = Eo) {
1379
1379
  ), t;
1380
1380
  }
1381
1381
  async function Me(s, e, t) {
1382
- return Y(s, e, void 0, t);
1382
+ return Q(s, e, void 0, t);
1383
1383
  }
1384
- async function Y(s, e, t, r) {
1384
+ async function Q(s, e, t, r) {
1385
1385
  if (s instanceof xs)
1386
1386
  return await s.withWriteTx("ProjectAction", async (o) => {
1387
1387
  const n = await Qe.load(o, e, t), i = await r(n);
@@ -1548,13 +1548,13 @@ function Sn(s, e) {
1548
1548
  }
1549
1549
  function bn(s, e) {
1550
1550
  const t = De("sha256");
1551
- return t.update(Q(s)), t.update(String(Xe(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1551
+ return t.update(Z(s)), t.update(String(Xe(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1552
1552
  }
1553
1553
  function lr(s, e) {
1554
- return Q({ __isRef: !0, blockId: s, name: e });
1554
+ return Z({ __isRef: !0, blockId: s, name: e });
1555
1555
  }
1556
1556
  function Rn(s, e) {
1557
- return Q({ resolvePath: s, name: e });
1557
+ return Z({ resolvePath: s, name: e });
1558
1558
  }
1559
1559
  function os(s, e = !0, t = !1, r = "") {
1560
1560
  var a, c, l;
@@ -2388,7 +2388,7 @@ function si(s, e, t, r = {}) {
2388
2388
  return us(s, Zn(e), t, r);
2389
2389
  }
2390
2390
  function us(s, e, t, r = {}) {
2391
- const o = `${e.blockId}#` + Q({
2391
+ const o = `${e.blockId}#` + Z({
2392
2392
  ctx: Object.fromEntries(
2393
2393
  Object.entries(e).filter(([n]) => Qn.indexOf(n) === -1)
2394
2394
  ),
@@ -3288,7 +3288,7 @@ class jt {
3288
3288
  * */
3289
3289
  async addBlock(e, t, r, o = void 0, n = Ae()) {
3290
3290
  const i = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfigContainer(t), c = jr(a);
3291
- return await Y(
3291
+ return await Q(
3292
3292
  this.env.pl,
3293
3293
  this.rid,
3294
3294
  o,
@@ -3313,7 +3313,7 @@ class jt {
3313
3313
  * */
3314
3314
  async updateBlockPack(e, t, r = !1, o) {
3315
3315
  const n = await this.env.bpPreparer.prepare(t), i = await this.env.bpPreparer.getBlockConfigContainer(t);
3316
- await Y(
3316
+ await Q(
3317
3317
  this.env.pl,
3318
3318
  this.rid,
3319
3319
  o,
@@ -3326,7 +3326,7 @@ class jt {
3326
3326
  }
3327
3327
  /** Deletes a block with all associated data. */
3328
3328
  async deleteBlock(e, t) {
3329
- await Y(this.env.pl, this.rid, t, (r) => r.deleteBlock(e)), this.navigationStates.deleteBlock(e), await this.projectTree.refreshState();
3329
+ await Q(this.env.pl, this.rid, t, (r) => r.deleteBlock(e)), this.navigationStates.deleteBlock(e), await this.projectTree.refreshState();
3330
3330
  }
3331
3331
  /**
3332
3332
  * Updates block order according to the given array of block ids.
@@ -3335,7 +3335,7 @@ class jt {
3335
3335
  * an error will be thrown instead.
3336
3336
  */
3337
3337
  async reorderBlocks(e, t) {
3338
- await Y(this.env.pl, this.rid, t, (r) => {
3338
+ await Q(this.env.pl, this.rid, t, (r) => {
3339
3339
  const o = r.structure;
3340
3340
  if (o.groups.length !== 1)
3341
3341
  throw new Error("Unexpected project structure, non-sinular block group");
@@ -3389,7 +3389,7 @@ class jt {
3389
3389
  * in collaborative editing scenario.
3390
3390
  * */
3391
3391
  async setBlockArgs(e, t, r) {
3392
- await Y(
3392
+ await Q(
3393
3393
  this.env.pl,
3394
3394
  this.rid,
3395
3395
  r,
@@ -3403,7 +3403,7 @@ class jt {
3403
3403
  * in collaborative editing scenario.
3404
3404
  * */
3405
3405
  async setUiState(e, t, r) {
3406
- await Y(
3406
+ await Q(
3407
3407
  this.env.pl,
3408
3408
  this.rid,
3409
3409
  r,
@@ -3423,13 +3423,13 @@ class jt {
3423
3423
  * in collaborative editing scenario.
3424
3424
  * */
3425
3425
  async setBlockArgsAndUiState(e, t, r, o) {
3426
- await Y(this.env.pl, this.rid, o, (n) => {
3426
+ await Q(this.env.pl, this.rid, o, (n) => {
3427
3427
  n.setArgs([{ blockId: e, args: JSON.stringify(t) }]), n.setUiState(e, JSON.stringify(r));
3428
3428
  }), await this.projectTree.refreshState();
3429
3429
  }
3430
3430
  /** Update block settings */
3431
3431
  async setBlockSettings(e, t) {
3432
- await Y(this.env.pl, this.rid, void 0, (r) => {
3432
+ await Q(this.env.pl, this.rid, void 0, (r) => {
3433
3433
  r.setBlockSettings(e, t);
3434
3434
  }), await this.projectTree.refreshState();
3435
3435
  }
@@ -3443,7 +3443,7 @@ class jt {
3443
3443
  ), i = await r.getResourceData(n, !1), a = JSON.parse(
3444
3444
  Buffer.from(B(i.data)).toString("utf-8")
3445
3445
  );
3446
- await Y(r, this.rid, t, (c) => {
3446
+ await Q(r, this.rid, t, (c) => {
3447
3447
  c.setArgs([{ blockId: e, args: JSON.stringify(a.config.initialArgs) }]), c.setUiState(e, void 0);
3448
3448
  }), await r.commit();
3449
3449
  }), await this.projectTree.refreshState();
@@ -3639,9 +3639,9 @@ var ms = {
3639
3639
  rcompareIdentifiers: Oi
3640
3640
  };
3641
3641
  const Ke = st, { MAX_LENGTH: fr, MAX_SAFE_INTEGER: He } = rt, { safeRe: gr, t: mr } = Be, $i = xt, { compareIdentifiers: me } = ms;
3642
- let Fi = class te {
3642
+ let Fi = class re {
3643
3643
  constructor(e, t) {
3644
- if (t = $i(t), e instanceof te) {
3644
+ if (t = $i(t), e instanceof re) {
3645
3645
  if (e.loose === !!t.loose && e.includePrerelease === !!t.includePrerelease)
3646
3646
  return e;
3647
3647
  e = e.version;
@@ -3677,18 +3677,18 @@ let Fi = class te {
3677
3677
  return this.version;
3678
3678
  }
3679
3679
  compare(e) {
3680
- if (Ke("SemVer.compare", this.version, this.options, e), !(e instanceof te)) {
3680
+ if (Ke("SemVer.compare", this.version, this.options, e), !(e instanceof re)) {
3681
3681
  if (typeof e == "string" && e === this.version)
3682
3682
  return 0;
3683
- e = new te(e, this.options);
3683
+ e = new re(e, this.options);
3684
3684
  }
3685
3685
  return e.version === this.version ? 0 : this.compareMain(e) || this.comparePre(e);
3686
3686
  }
3687
3687
  compareMain(e) {
3688
- return e instanceof te || (e = new te(e, this.options)), me(this.major, e.major) || me(this.minor, e.minor) || me(this.patch, e.patch);
3688
+ return e instanceof re || (e = new re(e, this.options)), me(this.major, e.major) || me(this.minor, e.minor) || me(this.patch, e.patch);
3689
3689
  }
3690
3690
  comparePre(e) {
3691
- if (e instanceof te || (e = new te(e, this.options)), this.prerelease.length && !e.prerelease.length)
3691
+ if (e instanceof re || (e = new re(e, this.options)), this.prerelease.length && !e.prerelease.length)
3692
3692
  return -1;
3693
3693
  if (!this.prerelease.length && e.prerelease.length)
3694
3694
  return 1;
@@ -3709,7 +3709,7 @@ let Fi = class te {
3709
3709
  } while (++t);
3710
3710
  }
3711
3711
  compareBuild(e) {
3712
- e instanceof te || (e = new te(e, this.options));
3712
+ e instanceof re || (e = new re(e, this.options));
3713
3713
  let t = 0;
3714
3714
  do {
3715
3715
  const r = this.build[t], o = e.build[t];
@@ -3835,10 +3835,10 @@ const Xi = Se, Yi = (s, e) => {
3835
3835
  };
3836
3836
  var Qi = Yi;
3837
3837
  const Sr = _, Zi = (s, e, t) => new Sr(s, t).compare(new Sr(e, t));
3838
- var Z = Zi;
3839
- const ea = Z, ta = (s, e, t) => ea(e, s, t);
3838
+ var ee = Zi;
3839
+ const ea = ee, ta = (s, e, t) => ea(e, s, t);
3840
3840
  var ra = ta;
3841
- const sa = Z, oa = (s, e) => sa(s, e, !0);
3841
+ const sa = ee, oa = (s, e) => sa(s, e, !0);
3842
3842
  var na = oa;
3843
3843
  const br = _, ia = (s, e, t) => {
3844
3844
  const r = new br(s, t), o = new br(e, t);
@@ -3849,17 +3849,17 @@ const aa = Vt, ca = (s, e) => s.sort((t, r) => aa(t, r, e));
3849
3849
  var la = ca;
3850
3850
  const ua = Vt, da = (s, e) => s.sort((t, r) => ua(r, t, e));
3851
3851
  var pa = da;
3852
- const ha = Z, fa = (s, e, t) => ha(s, e, t) > 0;
3852
+ const ha = ee, fa = (s, e, t) => ha(s, e, t) > 0;
3853
3853
  var ot = fa;
3854
- const ga = Z, ma = (s, e, t) => ga(s, e, t) < 0;
3854
+ const ga = ee, ma = (s, e, t) => ga(s, e, t) < 0;
3855
3855
  var Ut = ma;
3856
- const va = Z, ya = (s, e, t) => va(s, e, t) === 0;
3856
+ const va = ee, ya = (s, e, t) => va(s, e, t) === 0;
3857
3857
  var vs = ya;
3858
- const wa = Z, Sa = (s, e, t) => wa(s, e, t) !== 0;
3858
+ const wa = ee, Sa = (s, e, t) => wa(s, e, t) !== 0;
3859
3859
  var ys = Sa;
3860
- const ba = Z, Ra = (s, e, t) => ba(s, e, t) >= 0;
3860
+ const ba = ee, Ra = (s, e, t) => ba(s, e, t) >= 0;
3861
3861
  var Jt = Ra;
3862
- const Ca = Z, Pa = (s, e, t) => Ca(s, e, t) <= 0;
3862
+ const Ca = ee, Pa = (s, e, t) => Ca(s, e, t) <= 0;
3863
3863
  var Gt = Pa;
3864
3864
  const Ea = vs, ka = ys, Oa = ot, $a = Jt, Fa = Ut, Ia = Gt, Aa = (s, e, t, r) => {
3865
3865
  switch (e) {
@@ -3932,7 +3932,7 @@ class Ba {
3932
3932
  }
3933
3933
  }
3934
3934
  var ja = Ba, dt, Rr;
3935
- function ee() {
3935
+ function te() {
3936
3936
  if (Rr) return dt;
3937
3937
  Rr = 1;
3938
3938
  const s = /\s+/g;
@@ -4113,10 +4113,10 @@ function nt() {
4113
4113
  }
4114
4114
  }
4115
4115
  pt = e;
4116
- const t = xt, { safeRe: r, t: o } = Be, n = ws, i = st, a = _, c = ee();
4116
+ const t = xt, { safeRe: r, t: o } = Be, n = ws, i = st, a = _, c = te();
4117
4117
  return pt;
4118
4118
  }
4119
- const xa = ee(), Va = (s, e, t) => {
4119
+ const xa = te(), Va = (s, e, t) => {
4120
4120
  try {
4121
4121
  e = new xa(e, t);
4122
4122
  } catch {
@@ -4125,9 +4125,9 @@ const xa = ee(), Va = (s, e, t) => {
4125
4125
  return e.test(s);
4126
4126
  };
4127
4127
  var it = Va;
4128
- const Ua = ee(), Ja = (s, e) => new Ua(s, e).set.map((t) => t.map((r) => r.value).join(" ").trim().split(" "));
4128
+ const Ua = te(), Ja = (s, e) => new Ua(s, e).set.map((t) => t.map((r) => r.value).join(" ").trim().split(" "));
4129
4129
  var Ga = Ja;
4130
- const Ma = _, _a = ee(), Ka = (s, e, t) => {
4130
+ const Ma = _, _a = te(), Ka = (s, e, t) => {
4131
4131
  let r = null, o = null, n = null;
4132
4132
  try {
4133
4133
  n = new _a(e, t);
@@ -4139,7 +4139,7 @@ const Ma = _, _a = ee(), Ka = (s, e, t) => {
4139
4139
  }), r;
4140
4140
  };
4141
4141
  var Ha = Ka;
4142
- const Wa = _, qa = ee(), za = (s, e, t) => {
4142
+ const Wa = _, qa = te(), za = (s, e, t) => {
4143
4143
  let r = null, o = null, n = null;
4144
4144
  try {
4145
4145
  n = new qa(e, t);
@@ -4151,7 +4151,7 @@ const Wa = _, qa = ee(), za = (s, e, t) => {
4151
4151
  }), r;
4152
4152
  };
4153
4153
  var Xa = za;
4154
- const ht = _, Ya = ee(), Pr = ot, Qa = (s, e) => {
4154
+ const ht = _, Ya = te(), Pr = ot, Qa = (s, e) => {
4155
4155
  s = new Ya(s, e);
4156
4156
  let t = new ht("0.0.0");
4157
4157
  if (s.test(t) || (t = new ht("0.0.0-0"), s.test(t)))
@@ -4180,7 +4180,7 @@ const ht = _, Ya = ee(), Pr = ot, Qa = (s, e) => {
4180
4180
  return t && s.test(t) ? t : null;
4181
4181
  };
4182
4182
  var Za = Qa;
4183
- const ec = ee(), tc = (s, e) => {
4183
+ const ec = te(), tc = (s, e) => {
4184
4184
  try {
4185
4185
  return new ec(s, e).range || "*";
4186
4186
  } catch {
@@ -4188,7 +4188,7 @@ const ec = ee(), tc = (s, e) => {
4188
4188
  }
4189
4189
  };
4190
4190
  var rc = tc;
4191
- const sc = _, Ss = nt(), { ANY: oc } = Ss, nc = ee(), ic = it, Er = ot, kr = Ut, ac = Gt, cc = Jt, lc = (s, e, t, r) => {
4191
+ const sc = _, Ss = nt(), { ANY: oc } = Ss, nc = te(), ic = it, Er = ot, kr = Ut, ac = Gt, cc = Jt, lc = (s, e, t, r) => {
4192
4192
  s = new sc(s, r), e = new nc(e, r);
4193
4193
  let o, n, i, a, c;
4194
4194
  switch (t) {
@@ -4220,9 +4220,9 @@ const uc = Mt, dc = (s, e, t) => uc(s, e, ">", t);
4220
4220
  var pc = dc;
4221
4221
  const hc = Mt, fc = (s, e, t) => hc(s, e, "<", t);
4222
4222
  var gc = fc;
4223
- const Or = ee(), mc = (s, e, t) => (s = new Or(s, t), e = new Or(e, t), s.intersects(e, t));
4223
+ const Or = te(), mc = (s, e, t) => (s = new Or(s, t), e = new Or(e, t), s.intersects(e, t));
4224
4224
  var vc = mc;
4225
- const yc = it, wc = Z;
4225
+ const yc = it, wc = ee;
4226
4226
  var Sc = (s, e, t) => {
4227
4227
  const r = [];
4228
4228
  let o = null, n = null;
@@ -4236,7 +4236,7 @@ var Sc = (s, e, t) => {
4236
4236
  const c = a.join(" || "), l = typeof e.raw == "string" ? e.raw : String(e);
4237
4237
  return c.length < l.length ? c : e;
4238
4238
  };
4239
- const $r = ee(), _t = nt(), { ANY: ft } = _t, Re = it, Kt = Z, bc = (s, e, t = {}) => {
4239
+ const $r = te(), _t = nt(), { ANY: ft } = _t, Re = it, Kt = ee, bc = (s, e, t = {}) => {
4240
4240
  if (s === e)
4241
4241
  return !0;
4242
4242
  s = new $r(s, t), e = new $r(e, t);
@@ -4318,7 +4318,7 @@ const $r = ee(), _t = nt(), { ANY: ft } = _t, Re = it, Kt = Z, bc = (s, e, t = {
4318
4318
  return r < 0 ? s : r > 0 || e.operator === "<" && s.operator === "<=" ? e : s;
4319
4319
  };
4320
4320
  var Pc = bc;
4321
- const gt = Be, Tr = rt, Ec = _, Lr = ms, kc = Se, Oc = Li, $c = Bi, Fc = xi, Ic = Ui, Ac = Mi, Tc = Hi, Lc = zi, Nc = Qi, Dc = Z, Bc = ra, jc = na, xc = Vt, Vc = la, Uc = pa, Jc = ot, Gc = Ut, Mc = vs, _c = ys, Kc = Jt, Hc = Gt, Wc = ws, qc = Da, zc = nt(), Xc = ee(), Yc = it, Qc = Ga, Zc = Ha, el = Xa, tl = Za, rl = rc, sl = Mt, ol = pc, nl = gc, il = vc, al = Sc, cl = Pc;
4321
+ const gt = Be, Tr = rt, Ec = _, Lr = ms, kc = Se, Oc = Li, $c = Bi, Fc = xi, Ic = Ui, Ac = Mi, Tc = Hi, Lc = zi, Nc = Qi, Dc = ee, Bc = ra, jc = na, xc = Vt, Vc = la, Uc = pa, Jc = ot, Gc = Ut, Mc = vs, _c = ys, Kc = Jt, Hc = Gt, Wc = ws, qc = Da, zc = nt(), Xc = te(), Yc = it, Qc = Ga, Zc = Ha, el = Xa, tl = Za, rl = rc, sl = Mt, ol = pc, nl = gc, il = vc, al = Sc, cl = Pc;
4322
4322
  var ll = {
4323
4323
  parse: kc,
4324
4324
  valid: Oc,
@@ -4383,7 +4383,7 @@ class hl extends qs {
4383
4383
  case "dev-v2":
4384
4384
  return `dev_2_${t.currentSpec.folder}_${t.currentSpec.mtime}`;
4385
4385
  case "from-registry-v2":
4386
- return `from_registry_v2_${Q(t)}`;
4386
+ return `from_registry_v2_${Z(t)}`;
4387
4387
  default:
4388
4388
  return pl;
4389
4389
  }
@@ -4470,7 +4470,7 @@ class hl extends qs {
4470
4470
  }
4471
4471
  }
4472
4472
  resultsEqual(t, r) {
4473
- return Q(t) === Q(r);
4473
+ return Z(t) === Z(r);
4474
4474
  }
4475
4475
  }
4476
4476
  class Nr {
@@ -4509,7 +4509,7 @@ class Nr {
4509
4509
  }
4510
4510
  }
4511
4511
  let Ce;
4512
- function re() {
4512
+ function X() {
4513
4513
  return Ce || (Ce = {
4514
4514
  logPFrameRequests: process.env.MI_LOG_PFRAMES !== void 0,
4515
4515
  usePFrameRs: process.env.MI_USE_PFRAMES_RS !== void 0
@@ -4537,6 +4537,7 @@ function mt(s) {
4537
4537
  const Pe = (s, e) => typeof e == "bigint" ? e.toString() : e;
4538
4538
  class gl {
4539
4539
  constructor(e, t, r, o) {
4540
+ S(this, "rustPFrame");
4540
4541
  S(this, "specPFrame");
4541
4542
  S(this, "blobIdToResource", /* @__PURE__ */ new Map());
4542
4543
  S(this, "blobHandleComputables", /* @__PURE__ */ new Map());
@@ -4559,71 +4560,76 @@ class gl {
4559
4560
  }
4560
4561
  });
4561
4562
  this.blobDriver = e, this.logger = t, this.blobContentCache = r;
4562
- const n = (l, u) => {
4563
- switch (l) {
4563
+ const n = (a, c) => {
4564
+ switch (a) {
4564
4565
  default:
4565
4566
  case "info":
4566
- return this.logger.info(u);
4567
+ return this.logger.info(c);
4567
4568
  case "warn":
4568
- return this.logger.warn(u);
4569
+ return this.logger.warn(c);
4569
4570
  case "error":
4570
- return this.logger.error(u);
4571
+ return this.logger.error(c);
4571
4572
  }
4572
4573
  };
4573
- for (const l of o)
4574
- for (const u of pn(l.data))
4575
- this.blobIdToResource.set(Fe(u), u);
4574
+ for (const a of o)
4575
+ for (const c of pn(a.data))
4576
+ this.blobIdToResource.set(Fe(c), c);
4576
4577
  const i = [
4577
- ...new Map(o.map((l) => ({
4578
- ...l,
4579
- data: hn(l.data, Fe)
4578
+ ...new Map(o.map((a) => ({
4579
+ ...a,
4580
+ data: hn(a.data, Fe)
4580
4581
  })).map(
4581
- (l) => [Q(l), l]
4582
+ (a) => [Z(a), a]
4582
4583
  )).values()
4583
- ], a = () => {
4584
+ ];
4585
+ this.rustPFrame = (() => {
4584
4586
  try {
4585
- if (re().usePFrameRs) {
4586
- const l = new po(re().logPFrameRequests ? n : void 0);
4587
- for (const u of i)
4588
- l.addColumnSpec(u.id, u.spec);
4589
- return l;
4590
- } else {
4591
- const l = re().logPFrameRequests ? new Ue(n) : new Ue();
4592
- for (const u of i)
4593
- try {
4594
- l.addColumnSpec(u.id, u.spec);
4595
- } catch (d) {
4596
- throw new Error(
4597
- `Adding column ${u.id} to PFrame failed: ${d}; Spec: ${JSON.stringify(u.spec)}.`
4598
- );
4599
- }
4600
- return l;
4601
- }
4602
- } catch (l) {
4587
+ const a = new po(X().logPFrameRequests ? n : void 0);
4588
+ a.setDataSource(this);
4589
+ for (const c of i)
4590
+ a.addColumnSpec(c.id, c.spec), a.setColumnData(c.id, c.data);
4591
+ return a;
4592
+ } catch (a) {
4603
4593
  throw new Error(
4604
- `Spec PFrame creation failed, columns: ${JSON.stringify(i)}, error: ${l}`
4594
+ `Rust PFrame creation failed, columns: ${JSON.stringify(i)}, error: ${a}`
4605
4595
  );
4606
4596
  }
4607
- }, c = () => {
4597
+ })(), this.specPFrame = (() => {
4608
4598
  try {
4609
- const l = re().logPFrameRequests ? new Ue(n) : new Ue();
4610
- l.setDataSource(this);
4611
- for (const u of i)
4599
+ const a = X().logPFrameRequests ? new Ue(n) : new Ue();
4600
+ for (const c of i)
4612
4601
  try {
4613
- l.addColumnSpec(u.id, u.spec), l.setColumnData(u.id, u.data);
4614
- } catch (d) {
4602
+ a.addColumnSpec(c.id, c.spec);
4603
+ } catch (l) {
4615
4604
  throw new Error(
4616
- `Adding column ${u.id} to PFrame failed: ${d}; Spec: ${JSON.stringify(u.spec)}, DataInfo: ${JSON.stringify(u.data)}.`
4605
+ `Adding column ${c.id} to PFrame failed: ${l}; Spec: ${JSON.stringify(c.spec)}.`
4617
4606
  );
4618
4607
  }
4619
- return l;
4620
- } catch (l) {
4608
+ return a;
4609
+ } catch (a) {
4621
4610
  throw new Error(
4622
- `Data PFrame creation failed, columns: ${JSON.stringify(i)}, error: ${l}`
4611
+ `Spec PFrame creation failed, columns: ${JSON.stringify(i)}, error: ${a}`
4612
+ );
4613
+ }
4614
+ })(), this.createDataPFrame = () => {
4615
+ try {
4616
+ const a = X().logPFrameRequests ? new Ue(n) : new Ue();
4617
+ a.setDataSource(this);
4618
+ for (const c of i)
4619
+ try {
4620
+ a.addColumnSpec(c.id, c.spec), a.setColumnData(c.id, c.data);
4621
+ } catch (l) {
4622
+ throw new Error(
4623
+ `Adding column ${c.id} to PFrame failed: ${l}; Spec: ${JSON.stringify(c.spec)}, DataInfo: ${JSON.stringify(c.data)}.`
4624
+ );
4625
+ }
4626
+ return a;
4627
+ } catch (a) {
4628
+ throw new Error(
4629
+ `Data PFrame creation failed, columns: ${JSON.stringify(i)}, error: ${a}`
4623
4630
  );
4624
4631
  }
4625
4632
  };
4626
- this.specPFrame = a(), this.createDataPFrame = c;
4627
4633
  }
4628
4634
  get disposableDataPFrame() {
4629
4635
  const e = this.createDataPFrame();
@@ -4643,7 +4649,7 @@ class gl {
4643
4649
  }
4644
4650
  [Symbol.dispose]() {
4645
4651
  for (const e of this.blobHandleComputables.values()) e.resetState();
4646
- this.specPFrame.dispose();
4652
+ this.rustPFrame.dispose(), this.specPFrame.dispose();
4647
4653
  }
4648
4654
  }
4649
4655
  class ml {
@@ -4659,13 +4665,15 @@ class ml {
4659
4665
  // 1Gb
4660
4666
  fetchMethod: async (n) => await Ur.readFile(n),
4661
4667
  sizeCalculation: (n) => n.length
4662
- }), o = new Bs(1);
4663
- this.blobContentCache = r, this.concurrencyLimiter = o, this.pFrames = new class extends Nr {
4668
+ });
4669
+ this.blobContentCache = r;
4670
+ const o = new Bs(1);
4671
+ this.concurrencyLimiter = o, this.pFrames = new class extends Nr {
4664
4672
  constructor(n, i) {
4665
4673
  super(), this.blobDriver = n, this.logger = i;
4666
4674
  }
4667
4675
  createNewResource(n) {
4668
- return re().logPFrameRequests && t.info(
4676
+ return X().logPFrameRequests && t.info(
4669
4677
  `PFrame creation (pFrameHandle = ${this.calculateParamsKey(n)}): ${JSON.stringify(n, Pe)}`
4670
4678
  ), new gl(this.blobDriver, this.logger, r, n);
4671
4679
  }
@@ -4680,7 +4688,7 @@ class ml {
4680
4688
  const i = n.pFrameHandle, a = await o.run(async () => {
4681
4689
  var l = [];
4682
4690
  try {
4683
- re().logPFrameRequests && t.info(
4691
+ X().logPFrameRequests && t.info(
4684
4692
  `PTable creation (pTableHandle = ${this.calculateParamsKey(n)}): ${JSON.stringify(n, Pe)}`
4685
4693
  );
4686
4694
  const c = je(l, this.pFrames.getByKey(i).disposableDataPFrame);
@@ -4715,7 +4723,7 @@ class ml {
4715
4723
  }
4716
4724
  createPTable(e, t) {
4717
4725
  const r = this.createPFrame($s(e.src), t), o = vt(e, (i) => i.id), n = this.pTables.acquire({ def: o, pFrameHandle: r });
4718
- return re().logPFrameRequests && this.logger.info(
4726
+ return X().logPFrameRequests && this.logger.info(
4719
4727
  `Create PTable call (pFrameHandle = ${r}; pTableHandle = ${JSON.stringify(n)}): ${JSON.stringify(
4720
4728
  vt(e, (i) => i.spec),
4721
4729
  Pe
@@ -4731,14 +4739,14 @@ class ml {
4731
4739
  compatibleWith: t.compatibleWith.length !== 0 ? [{
4732
4740
  axesSpec: [
4733
4741
  ...new Map(t.compatibleWith.map(
4734
- (n) => [Q(n), n]
4742
+ (n) => [Z(n), n]
4735
4743
  )).values()
4736
4744
  ],
4737
4745
  qualifications: []
4738
4746
  }] : []
4739
4747
  };
4740
4748
  return {
4741
- hits: (await this.concurrencyLimiter.run(
4749
+ hits: (X().usePFrameRs ? await this.pFrames.getByKey(e).rustPFrame.findColumns(r) : await this.concurrencyLimiter.run(
4742
4750
  async () => await this.pFrames.getByKey(e).specPFrame.findColumns(r)
4743
4751
  )).hits.filter((n) => (
4744
4752
  // only exactly matching columns
@@ -4747,12 +4755,12 @@ class ml {
4747
4755
  };
4748
4756
  }
4749
4757
  async getColumnSpec(e, t) {
4750
- return await this.concurrencyLimiter.run(
4758
+ return X().usePFrameRs ? await this.pFrames.getByKey(e).rustPFrame.getColumnSpec(t) : await this.concurrencyLimiter.run(
4751
4759
  async () => await this.pFrames.getByKey(e).specPFrame.getColumnSpec(t)
4752
4760
  );
4753
4761
  }
4754
4762
  async listColumns(e) {
4755
- return await this.concurrencyLimiter.run(
4763
+ return X().usePFrameRs ? await this.pFrames.getByKey(e).rustPFrame.listColumns() : await this.concurrencyLimiter.run(
4756
4764
  async () => await this.pFrames.getByKey(e).specPFrame.listColumns()
4757
4765
  );
4758
4766
  }
@@ -4760,7 +4768,7 @@ class ml {
4760
4768
  let r = await this.concurrencyLimiter.run(async () => {
4761
4769
  var a = [];
4762
4770
  try {
4763
- re().logPFrameRequests && this.logger.info(
4771
+ X().logPFrameRequests && this.logger.info(
4764
4772
  `Call calculateTableData, handle = ${e}, request = ${JSON.stringify(t, Pe)}`
4765
4773
  );
4766
4774
  const i = je(a, this.pFrames.getByKey(e).disposableDataPFrame);
@@ -4792,7 +4800,7 @@ class ml {
4792
4800
  return await this.concurrencyLimiter.run(async () => {
4793
4801
  var o = [];
4794
4802
  try {
4795
- re().logPFrameRequests && this.logger.info(
4803
+ X().logPFrameRequests && this.logger.info(
4796
4804
  `Call getUniqueValues, handle = ${e}, request = ${JSON.stringify(t, Pe)}`
4797
4805
  );
4798
4806
  const r = je(o, this.pFrames.getByKey(e).disposableDataPFrame);
@@ -4849,7 +4857,7 @@ function Ie(s) {
4849
4857
  }
4850
4858
  function vl(s) {
4851
4859
  const e = De("sha256");
4852
- return e.update(Q(s)), e.digest().toString("hex");
4860
+ return e.update(Z(s)), e.digest().toString("hex");
4853
4861
  }
4854
4862
  function yl(s) {
4855
4863
  const e = [...s].map(
@@ -4895,7 +4903,7 @@ function yl(s) {
4895
4903
  );
4896
4904
  e.sort((r, o) => r.id.localeCompare(o.id));
4897
4905
  const t = De("sha256");
4898
- return t.update(Q(e)), t.digest().toString("hex");
4906
+ return t.update(Z(e)), t.digest().toString("hex");
4899
4907
  }
4900
4908
  async function wl(s, e, t) {
4901
4909
  const r = {
@@ -4967,7 +4975,7 @@ class bs {
4967
4975
  }
4968
4976
  /** Updates project metadata */
4969
4977
  async setProjectMeta(e, t, r) {
4970
- await Y(this.pl, e, r, async (o) => {
4978
+ await Q(this.pl, e, r, async (o) => {
4971
4979
  o.setMeta(t);
4972
4980
  }), await this.projectListTree.refreshState();
4973
4981
  }
@@ -5029,7 +5037,7 @@ class bs {
5029
5037
  ...mi(t),
5030
5038
  ...r
5031
5039
  };
5032
- o.defaultTreeOptions.logStat = re().logTreeStats;
5040
+ o.defaultTreeOptions.logStat = X().logTreeStats;
5033
5041
  const n = await e.withWriteTx("MLInitialization", async (C) => {
5034
5042
  const I = j(C.clientRoot, No);
5035
5043
  C.createField(I, "Dynamic");