@milaboratories/pl-middle-layer 1.10.44 → 1.10.47

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
@@ -36,14 +36,14 @@ async function Ye(o) {
36
36
  throw e;
37
37
  }
38
38
  }
39
- const Rr = [H.PlPackageYamlConfigFile], Br = [H.PlPackageJsonConfigFile], Ee = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Ae = ["config", "dist", "config.json"], vt = ["frontend", "dist"], qe = "block-model/dist/config.json", Or = "block-ui/package.json", xr = [
39
+ const Rr = [H.PlPackageYamlConfigFile], Br = [H.PlPackageJsonConfigFile], Ee = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Ae = ["config", "dist", "config.json"], vt = ["frontend", "dist"], qe = "block-model/dist/config.json", Or = "block-ui/package.json", Dr = [
40
40
  Ee,
41
41
  Ae,
42
42
  Rr,
43
43
  Br,
44
44
  vt
45
45
  ];
46
- async function Dr(o) {
46
+ async function xr(o) {
47
47
  return await Ye(I.join(o, ...Ae)) !== void 0 || await Ye(I.join(o, ...Ee)) !== void 0;
48
48
  }
49
49
  function ve(o, e) {
@@ -52,7 +52,7 @@ function ve(o, e) {
52
52
  return t;
53
53
  }
54
54
  async function Qe(o, e) {
55
- if (I.isAbsolute(o) || (o = I.resolve(o)), await Dr(o))
55
+ if (I.isAbsolute(o) || (o = I.resolve(o)), await xr(o))
56
56
  return {
57
57
  workflow: I.join(o, ...Ee),
58
58
  config: I.join(o, ...Ae),
@@ -83,7 +83,7 @@ async function jr(o) {
83
83
  }
84
84
  async function yt(o) {
85
85
  let e = 0n;
86
- for (const t of xr) {
86
+ for (const t of Dr) {
87
87
  const r = I.join(o, ...t), s = await jr(r);
88
88
  s !== void 0 && e < s.mtimeNs && (e = s.mtimeNs);
89
89
  }
@@ -612,8 +612,8 @@ function So(o, e) {
612
612
  for (const t of o) if (!e.has(t)) return !1;
613
613
  return !0;
614
614
  }
615
- function xe(o, e) {
616
- if (o.size > e.size) return xe(e, o);
615
+ function De(o, e) {
616
+ if (o.size > e.size) return De(e, o);
617
617
  for (const t of o) if (e.has(t)) return !0;
618
618
  return !1;
619
619
  }
@@ -621,9 +621,9 @@ function tt(o, e) {
621
621
  const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
622
622
  return o.nodes.forEach((i) => {
623
623
  const n = e.nodes.get(i.id);
624
- n === void 0 ? t.add(i.id) : (!So(i.upstream, n.upstream) || xe(i.upstream, s)) && s.add(i.id);
624
+ n === void 0 ? t.add(i.id) : (!So(i.upstream, n.upstream) || De(i.upstream, s)) && s.add(i.id);
625
625
  }), e.nodes.forEach((i) => {
626
- o.nodes.has(i.id) ? xe(i.upstream, s) && s.add(i.id) : r.add(i.id);
626
+ o.nodes.has(i.id) ? De(i.upstream, s) && s.add(i.id) : r.add(i.id);
627
627
  }), { onlyInA: t, onlyInB: r, different: s };
628
628
  }
629
629
  let ye;
@@ -1104,7 +1104,7 @@ class le {
1104
1104
  g,
1105
1105
  f,
1106
1106
  v,
1107
- x,
1107
+ D,
1108
1108
  { stagingRefreshTimestamp: V, blocksInLimbo: K },
1109
1109
  re
1110
1110
  ] = await Promise.all([
@@ -1139,10 +1139,10 @@ class le {
1139
1139
  "Dynamic",
1140
1140
  J
1141
1141
  ));
1142
- const z = { stagingRefreshTimestamp: V }, j = new Set(K), D = /* @__PURE__ */ new Map();
1142
+ const z = { stagingRefreshTimestamp: V }, j = new Set(K), x = /* @__PURE__ */ new Map();
1143
1143
  for (const y of re) {
1144
1144
  const B = Mr(y.key);
1145
- B !== void 0 && D.set(B, y.value);
1145
+ B !== void 0 && x.set(B, y.value);
1146
1146
  }
1147
1147
  const R = [];
1148
1148
  $.forEach(({ id: y, fields: B }) => {
@@ -1160,7 +1160,7 @@ class le {
1160
1160
  const M = /* @__PURE__ */ new Map();
1161
1161
  $.forEach(({ id: y, fields: B }) => M.set(y, new rt(y, B)));
1162
1162
  const L = /* @__PURE__ */ new Set();
1163
- for (const y of N(x)) {
1163
+ for (const y of N(D)) {
1164
1164
  if (!M.has(y.id))
1165
1165
  throw new Error(`Inconsistent project structure: no inputs for ${y.id}`);
1166
1166
  L.add(y.id);
@@ -1177,11 +1177,11 @@ class le {
1177
1177
  g,
1178
1178
  f,
1179
1179
  v,
1180
- x,
1180
+ D,
1181
1181
  z,
1182
1182
  j,
1183
1183
  M,
1184
- D,
1184
+ x,
1185
1185
  J
1186
1186
  );
1187
1187
  return se.fixProblems(), se;
@@ -1254,7 +1254,7 @@ function Ro(o, e) {
1254
1254
  const Bo = te("PColumnData/JsonPartitioned", "1"), Oo = te(
1255
1255
  "PColumnData/Partitioned/JsonPartitioned",
1256
1256
  "1"
1257
- ), xo = te("PColumnData/BinaryPartitioned", "1"), Do = te(
1257
+ ), Do = te("PColumnData/BinaryPartitioned", "1"), xo = te(
1258
1258
  "PColumnData/Partitioned/BinaryPartitioned",
1259
1259
  "1"
1260
1260
  ), To = te("PColumnData/Json", "1");
@@ -1294,7 +1294,7 @@ function jo(o) {
1294
1294
  partitionKeyLength: t.superPartitionKeyLength + t.partitionKeyLength,
1295
1295
  parts: r
1296
1296
  };
1297
- } else if (U(o.resourceType, xo)) {
1297
+ } else if (U(o.resourceType, Do)) {
1298
1298
  const t = e, r = {};
1299
1299
  for (const s of o.listInputFields())
1300
1300
  if (s.endsWith(".index")) {
@@ -1315,7 +1315,7 @@ function jo(o) {
1315
1315
  partitionKeyLength: t.partitionKeyLength,
1316
1316
  parts: r
1317
1317
  };
1318
- } else if (U(o.resourceType, Do)) {
1318
+ } else if (U(o.resourceType, xo)) {
1319
1319
  const t = e, r = {};
1320
1320
  for (const s of o.listInputFields()) {
1321
1321
  const i = o.traverse({ field: s, errorIfFieldNotSet: !0 }), n = i.listInputFields();
@@ -1345,11 +1345,11 @@ function jo(o) {
1345
1345
  }
1346
1346
  throw new Error(`unsupported resource type: ${or(o.resourceType)}`);
1347
1347
  }
1348
- function xt(o, e) {
1348
+ function Dt(o, e) {
1349
1349
  const t = ge("sha256");
1350
1350
  return t.update(je(o)), t.update(String(ce(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1351
1351
  }
1352
- function Dt(o, e = !0, t = !1, r = "") {
1352
+ function xt(o, e = !0, t = !1, r = "") {
1353
1353
  var a, c, u;
1354
1354
  const s = /^(?<name>.*)\.(?<type>spec|data)$/, i = /* @__PURE__ */ new Map();
1355
1355
  for (const l of o.listInputFields()) {
@@ -1390,7 +1390,7 @@ function Dt(o, e = !0, t = !1, r = "") {
1390
1390
  }
1391
1391
  function Eo(o, e = !0, t = "") {
1392
1392
  if (!o.getIsReadyOrError()) throw new Error("resource is not ready");
1393
- const r = Dt(o, e, !1, t);
1393
+ const r = xt(o, e, !1, t);
1394
1394
  dr(r.locked);
1395
1395
  const s = {};
1396
1396
  for (const [i, n] of r.results) {
@@ -1401,7 +1401,7 @@ function Eo(o, e = !0, t = "") {
1401
1401
  if (a === void 0) throw new Error(`no data for key ${i}`);
1402
1402
  if (!a.ok) throw new ar(a.error);
1403
1403
  s[i] = {
1404
- id: xt(n.spec, a.value),
1404
+ id: Dt(n.spec, a.value),
1405
1405
  spec: n.spec,
1406
1406
  data: a.value
1407
1407
  };
@@ -1460,7 +1460,7 @@ class Le {
1460
1460
  u !== void 0 ? e.push({
1461
1461
  ref: ie(n, a),
1462
1462
  obj: {
1463
- id: u.ok ? xt(c.spec, u.value) : void 0,
1463
+ id: u.ok ? Dt(c.spec, u.value) : void 0,
1464
1464
  spec: c.spec,
1465
1465
  data: u
1466
1466
  }
@@ -1557,7 +1557,7 @@ class Le {
1557
1557
  function st(o, e) {
1558
1558
  if (e === void 0)
1559
1559
  return o ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
1560
- if (e.ok) return Dt(e.value, !1, !0);
1560
+ if (e.ok) return xt(e.value, !1, !0);
1561
1561
  }
1562
1562
  function Je(o, e) {
1563
1563
  const t = o.persist(), r = w(
@@ -2142,16 +2142,16 @@ function Vt(o, e, t, r = {}) {
2142
2142
  ),
2143
2143
  async postprocessValue(u, l) {
2144
2144
  const p = [];
2145
- for (const x of u)
2146
- p.push({ destination: x.destination, operation: h(x.computable) });
2145
+ for (const D of u)
2146
+ p.push({ destination: D.destination, operation: h(D.computable) });
2147
2147
  const g = {
2148
2148
  drivers: o,
2149
2149
  get cCtx() {
2150
2150
  throw new Error("asynchronous operations are forbidden in this context");
2151
2151
  }
2152
2152
  }, f = /* @__PURE__ */ new Map();
2153
- for (const [x, V] of a.pendingSubroutines)
2154
- f.set(x, { ...V, args: { ...V.args } });
2153
+ for (const [D, V] of a.pendingSubroutines)
2154
+ f.set(D, { ...V, args: { ...V.args } });
2155
2155
  const v = {
2156
2156
  result: a.result,
2157
2157
  pendingSubroutines: f
@@ -2620,7 +2620,7 @@ function ps(o, e, t, r, s = {}) {
2620
2620
  };
2621
2621
  }, s);
2622
2622
  }
2623
- function De(o, e, t, r, s = {}) {
2623
+ function xe(o, e, t, r, s = {}) {
2624
2624
  if (lt(t)) {
2625
2625
  if (r === void 0) throw new Error("No code bundle.");
2626
2626
  return ps(o, e, t, r, s);
@@ -2629,7 +2629,7 @@ function De(o, e, t, r, s = {}) {
2629
2629
  function gs(o, e, t) {
2630
2630
  return P.make(
2631
2631
  (r) => {
2632
- var v, x, V, K, re, $, W, oe;
2632
+ var v, D, V, K, re, $, W, oe;
2633
2633
  const s = r.accessor(o).node(), i = w(s.getKeyValueAsJson(Ne)), n = w(s.getKeyValueAsJson(X)), a = w(s.getKeyValueAsJson(ee)), c = w(s.getKeyValueAsJson(_)), u = w(
2634
2634
  s.getKeyValueAsJson(ue)
2635
2635
  ), l = /* @__PURE__ */ new Map();
@@ -2646,7 +2646,7 @@ function gs(o, e, t) {
2646
2646
  stableIfNotFound: !0
2647
2647
  });
2648
2648
  if (j !== void 0) {
2649
- const D = s.getField({
2649
+ const x = s.getField({
2650
2650
  field: C(k, "prodOutput"),
2651
2651
  assertFieldType: "Dynamic",
2652
2652
  errorIfFieldNotFound: !0
@@ -2658,17 +2658,17 @@ function gs(o, e, t) {
2658
2658
  z = {
2659
2659
  arguments: j.getDataAsJson(),
2660
2660
  stale: J.id !== j.id,
2661
- outputError: D.error !== void 0 || R.error !== void 0 || ((v = D.value) == null ? void 0 : v.getError()) !== void 0 || ((x = R.value) == null ? void 0 : x.getError()) !== void 0,
2662
- outputsError: ((V = D.error) == null ? void 0 : V.getDataAsString()) ?? ((re = (K = D.value) == null ? void 0 : K.getError()) == null ? void 0 : re.getDataAsString()),
2661
+ outputError: x.error !== void 0 || R.error !== void 0 || ((v = x.value) == null ? void 0 : v.getError()) !== void 0 || ((D = R.value) == null ? void 0 : D.getError()) !== void 0,
2662
+ outputsError: ((V = x.error) == null ? void 0 : V.getDataAsString()) ?? ((re = (K = x.value) == null ? void 0 : K.getError()) == null ? void 0 : re.getDataAsString()),
2663
2663
  exportsError: (($ = R.error) == null ? void 0 : $.getDataAsString()) ?? ((oe = (W = R.value) == null ? void 0 : W.getError()) == null ? void 0 : oe.getDataAsString()),
2664
- finished: (D.value !== void 0 && D.value.getIsReadyOrError() || D.error !== void 0 && D.error.getIsReadyOrError()) && (R.value !== void 0 && R.value.getIsReadyOrError() || R.error !== void 0 && R.error.getIsReadyOrError())
2664
+ finished: (x.value !== void 0 && x.value.getIsReadyOrError() || x.error !== void 0 && x.error.getIsReadyOrError()) && (R.value !== void 0 && R.value.getIsReadyOrError() || R.error !== void 0 && R.error.getIsReadyOrError())
2665
2665
  };
2666
2666
  }
2667
2667
  l.set(k, { currentArguments: J.getDataAsJson(), prod: z });
2668
2668
  }
2669
2669
  const p = ne(c, (k) => l.get(k).currentArguments), g = new Set(u.blocksInLimbo), f = [...N(c)].map(({ id: k, label: J, renderingMode: z }) => {
2670
2670
  var Me, Ue, $e, Ge;
2671
- const j = w(l.get(k)), D = w(p.nodes.get(k));
2671
+ const j = w(l.get(k)), x = w(p.nodes.get(k));
2672
2672
  let R = "NotCalculated";
2673
2673
  j.prod !== void 0 && (g.has(k) ? R = "Limbo" : R = j.prod.finished ? "Done" : "Running");
2674
2674
  const M = s.traverse(
@@ -2681,13 +2681,13 @@ function gs(o, e, t) {
2681
2681
  ), L = M == null ? void 0 : M.getDataAsJson(), { sections: se, inputsValid: y, sdkVersion: B } = de(L == null ? void 0 : L.config, (fe) => {
2682
2682
  const Y = Te(fe), He = Je(s, k);
2683
2683
  return {
2684
- sections: De(
2684
+ sections: xe(
2685
2685
  t,
2686
2686
  He,
2687
2687
  Y.sections,
2688
2688
  Y.code
2689
2689
  ),
2690
- inputsValid: De(
2690
+ inputsValid: xe(
2691
2691
  t,
2692
2692
  He,
2693
2693
  Y.inputsValid,
@@ -2704,7 +2704,7 @@ function gs(o, e, t) {
2704
2704
  label: J,
2705
2705
  renderingMode: z,
2706
2706
  stale: ((Me = j.prod) == null ? void 0 : Me.stale) !== !1 || R === "Limbo",
2707
- missingReference: D.missingReferences,
2707
+ missingReference: x.missingReferences,
2708
2708
  upstreams: [...p.traverseIdsExcludingRoots("upstream", k)],
2709
2709
  downstreams: [...p.traverseIdsExcludingRoots("downstream", k)],
2710
2710
  calculationStatus: R,
@@ -2826,7 +2826,7 @@ function ys(o, e, t) {
2826
2826
  const c = {};
2827
2827
  for (const [u, l] of Object.entries(a.outputs))
2828
2828
  c[u] = P.wrapError(
2829
- De(t, i, l, a.code)
2829
+ xe(t, i, l, a.code)
2830
2830
  );
2831
2831
  return c;
2832
2832
  });
@@ -3369,7 +3369,7 @@ class Rs {
3369
3369
  return t.addOnDestroy(s.unref), s.key;
3370
3370
  }
3371
3371
  createPTable(e, t) {
3372
- const r = this.createPFrame(xs(e.src), t), s = ut(e, (n) => n.id), i = this.pTables.acquire({ def: s, pFrameHandle: r });
3372
+ const r = this.createPFrame(Ds(e.src), t), s = ut(e, (n) => n.id), i = this.pTables.acquire({ def: s, pFrameHandle: r });
3373
3373
  return t.addOnDestroy(i.unref), i.key;
3374
3374
  }
3375
3375
  //
@@ -3458,7 +3458,7 @@ function Os(o) {
3458
3458
  r !== s && (t.update(s), r = s);
3459
3459
  return t.digest().toString("hex");
3460
3460
  }
3461
- function xs(o) {
3461
+ function Ds(o) {
3462
3462
  const e = /* @__PURE__ */ new Map();
3463
3463
  return ae(o, e), [...e.values()];
3464
3464
  }
@@ -3479,7 +3479,7 @@ function ae(o, e) {
3479
3479
  O(o);
3480
3480
  }
3481
3481
  }
3482
- async function Ds(o, e) {
3482
+ async function xs(o, e) {
3483
3483
  const t = { ...Jt, ...e };
3484
3484
  Ts(t.logger, t);
3485
3485
  const r = new pt(t.localSecret), s = hr(t.logger, o, t.platformLocalStorageNameToPath), i = fr(o, t.logger), n = mr(o, t.logger), a = vr(o, t.logger), c = yr(o, t.logger), u = new br(
@@ -3506,7 +3506,7 @@ async function Ds(o, e) {
3506
3506
  };
3507
3507
  }
3508
3508
  function Ts(o, e) {
3509
- e.localStorageNameToPath.local != mt.homedir() && o.warn(`'local' storage with homedir was overwrote: ${e.localStorageNameToPath.local}`);
3509
+ e.localStorageNameToPath.local != mt.homedir() && o.info(`'local' storage with homedir was overwrote: ${e.localStorageNameToPath.local}`);
3510
3510
  const t = Object.keys(e.platformLocalStorageNameToPath), r = Object.keys(e.localStorageNameToPath).find(
3511
3511
  (s) => t.includes(s)
3512
3512
  );
@@ -3587,7 +3587,7 @@ class Kt {
3587
3587
  * actual termination of event loops and other processes associated with
3588
3588
  * them. */
3589
3589
  async close() {
3590
- await Promise.all([...this.openedProjectsByRid.values()].map((e) => e.destroy())), this.env.quickJs, await this.projectListTree.terminate();
3590
+ await Promise.all([...this.openedProjectsByRid.values()].map((e) => e.destroy())), await this.projectListTree.terminate(), await this.env.retryHttpDispatcher.destroy(), await this.pl.close();
3591
3591
  }
3592
3592
  /** @deprecated */
3593
3593
  async closeAndAwaitTermination() {
@@ -3603,15 +3603,15 @@ class Kt {
3603
3603
  const r = { ...Ss, ...t };
3604
3604
  process.env.MI_LOG_TREE_STAT && (r.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
3605
3605
  const s = await e.withWriteTx("MLInitialization", async (v) => {
3606
- const x = S(v.clientRoot, Hr);
3607
- v.createField(x, "Dynamic");
3608
- const V = await v.getField(x);
3606
+ const D = S(v.clientRoot, Hr);
3607
+ v.createField(D, "Dynamic");
3608
+ const V = await v.getField(D);
3609
3609
  if (ce(V.value)) {
3610
3610
  const K = v.createEphemeral(St);
3611
- return v.lock(K), v.setField(x, K), await v.commit(), await K.globalId;
3611
+ return v.lock(K), v.setField(D, K), await v.commit(), await K.globalId;
3612
3612
  } else
3613
3613
  return V.value;
3614
- }), i = r.logger, n = await Ds(e, r), a = new _t(e.httpDispatcher, {
3614
+ }), i = r.logger, n = await xs(e, r), a = new _t(e.httpDispatcher, {
3615
3615
  minTimeout: 250,
3616
3616
  maxRetries: 4
3617
3617
  }), c = new Er(a), u = new vo(
@@ -3626,6 +3626,8 @@ class Kt {
3626
3626
  pl: e,
3627
3627
  signer: n.signer,
3628
3628
  logger: i,
3629
+ httpDispatcher: e.httpDispatcher,
3630
+ retryHttpDispatcher: a,
3629
3631
  ops: r,
3630
3632
  bpPreparer: u,
3631
3633
  frontendDownloadDriver: l,
@@ -3671,7 +3673,7 @@ export {
3671
3673
  kt as createRenderTemplate,
3672
3674
  yt as getDevV1PacketMtime,
3673
3675
  Ie as getDevV2PacketMtime,
3674
- Ds as initDriverKit,
3676
+ xs as initDriverKit,
3675
3677
  Ve as loadTemplate,
3676
3678
  po as prepareTemplateSpec
3677
3679
  };