@platforma-sdk/model 1.14.1 → 1.17.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 ce = Object.defineProperty;
2
2
  var de = (t, e, n) => e in t ? ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
3
  var v = (t, e, n) => de(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { isPColumn as W, mapPObjectData as L, mapValueInVOE as pe, ensurePColumn as fe, isPColumnSpec as he, mapPTableDef as ge, getAxisId as J, matchAxisId as me } from "@milaboratories/pl-model-common";
4
+ import { isPColumn as H, mapPObjectData as L, mapValueInVOE as pe, ensurePColumn as fe, isPColumnSpec as he, mapPTableDef as ge, getAxisId as Y, matchAxisId as me } from "@milaboratories/pl-model-common";
5
5
  export * from "@milaboratories/pl-model-common";
6
6
  import { z as P } from "zod";
7
7
  class ye extends Error {
@@ -333,7 +333,7 @@ class S {
333
333
  getPColumns(e = !1, n = "") {
334
334
  const r = this.parsePObjectCollection(e, n);
335
335
  return r === void 0 ? void 0 : Object.entries(r).map(([, i]) => {
336
- if (!W(i)) throw new Error(`not a PColumn (kind = ${i.spec.kind})`);
336
+ if (!H(i)) throw new Error(`not a PColumn (kind = ${i.spec.kind})`);
337
337
  return i;
338
338
  });
339
339
  }
@@ -442,19 +442,19 @@ const se = "staging", ie = "main";
442
442
  function oe(t) {
443
443
  return typeof t == "object" && t !== null && "__awaited_futures__" in t;
444
444
  }
445
- function $(t, e, n) {
445
+ function J(t, e, n) {
446
446
  if (e.has(n)) return;
447
447
  if (e.add(n), typeof n === "object")
448
448
  if (oe(n)) n.__awaited_futures__.forEach((s) => t.add(s));
449
449
  else if (Array.isArray(n))
450
- for (const s of n) $(t, e, s);
450
+ for (const s of n) J(t, e, s);
451
451
  else
452
452
  for (const [, s] of Object.entries(n))
453
- s !== n && $(t, e, s);
453
+ s !== n && J(t, e, s);
454
454
  }
455
455
  function Se(t) {
456
456
  const e = /* @__PURE__ */ new Set();
457
- return $(e, /* @__PURE__ */ new Set(), t), e;
457
+ return J(e, /* @__PURE__ */ new Set(), t), e;
458
458
  }
459
459
  const ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
460
460
  __proto__: null,
@@ -470,16 +470,16 @@ const ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
470
470
  }), Ce = P.array(Ie), Re = 1e-3, Te = "__LABEL__", Q = "__LABEL__@1";
471
471
  function Fe(t, e, n = {}) {
472
472
  const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = t.map((d) => {
473
- var z, Y;
474
- const m = e(d), y = (z = m.annotations) == null ? void 0 : z[Ae], F = (Y = m.annotations) == null ? void 0 : Y[Pe], b = (F ? Ce.safeParse(JSON.parse(F)).data : void 0) ?? [];
473
+ var q, z;
474
+ const m = e(d), y = (q = m.annotations) == null ? void 0 : q[Ae], F = (z = m.annotations) == null ? void 0 : z[Pe], b = (F ? Ce.safeParse(JSON.parse(F)).data : void 0) ?? [];
475
475
  if (y) {
476
476
  const _ = { label: y, type: Te, importance: -2 };
477
477
  n.addLabelAsSuffix ? b.push(_) : b.splice(0, 0, _);
478
478
  }
479
- const E = [], q = /* @__PURE__ */ new Map();
479
+ const E = [], W = /* @__PURE__ */ new Map();
480
480
  for (let _ = b.length - 1; _ >= 0; --_) {
481
- const { type: V } = b[_], ue = b[_].importance ?? 0, j = (q.get(V) ?? 0) + 1;
482
- q.set(V, j);
481
+ const { type: V } = b[_], ue = b[_].importance ?? 0, j = (W.get(V) ?? 0) + 1;
482
+ W.set(V, j);
483
483
  const I = `${V}@${j}`;
484
484
  s.set(I, (s.get(I) ?? 0) + 1), r.set(
485
485
  I,
@@ -538,12 +538,10 @@ class Oe {
538
538
  }
539
539
  getOptions(e, n) {
540
540
  const r = this.getSpecs().entries.filter((s) => e(s.obj));
541
- return typeof n == "object" || typeof n > "u" ? Fe(r, (s) => s.obj, n ?? {}).map(
542
- ({ value: { ref: s }, label: i }) => ({
543
- ref: s,
544
- label: i
545
- })
546
- ) : r.map((s) => ({
541
+ return typeof n == "object" || typeof n > "u" ? Fe(r, (s) => s.obj, n ?? {}).map(({ value: { ref: s }, label: i }) => ({
542
+ ref: s,
543
+ label: i
544
+ })) : r.map((s) => ({
547
545
  ref: s.ref,
548
546
  label: n(s.obj, s.ref)
549
547
  }));
@@ -639,10 +637,10 @@ class Oe {
639
637
  if (!he(r.obj.spec))
640
638
  continue;
641
639
  const s = r.obj.spec;
642
- if (e.name === s.name && e.valueType === s.valueType && e.axesSpec.length === s.axesSpec.length && K(e.domain, s.domain)) {
640
+ if (e.name === s.name && e.valueType === s.valueType && e.axesSpec.length === s.axesSpec.length && $(e.domain, s.domain)) {
643
641
  for (let i = 0; i < e.axesSpec.length; ++i) {
644
642
  const o = e.axesSpec[i], a = s.axesSpec[i];
645
- if (o.name !== a.name || o.type !== a.type || !K(o.domain, a.domain))
643
+ if (o.name !== a.name || o.type !== a.type || !$(o.domain, a.domain))
646
644
  continue e;
647
645
  }
648
646
  n.push(r.obj);
@@ -651,7 +649,7 @@ class Oe {
651
649
  return n;
652
650
  }
653
651
  }
654
- function K(t, e) {
652
+ function $(t, e) {
655
653
  if (t === void 0) return e === void 0;
656
654
  if (e === void 0) return !0;
657
655
  for (const n in e)
@@ -701,9 +699,9 @@ class D {
701
699
  findLabels(e) {
702
700
  const n = this.resultPool.getData();
703
701
  for (const r of n.entries) {
704
- if (!W(r.obj)) continue;
702
+ if (!H(r.obj)) continue;
705
703
  const s = r.obj.spec;
706
- if (s.name === "pl7.app/label" && s.axesSpec.length === 1 && s.axesSpec[0].name === e.name && s.axesSpec[0].type === e.type && K(e.domain, s.axesSpec[0].domain)) {
704
+ if (s.name === "pl7.app/label" && s.axesSpec.length === 1 && s.axesSpec[0].name === e.name && s.axesSpec[0].type === e.type && $(e.domain, s.axesSpec[0].domain)) {
707
705
  if (r.obj.data.resourceType.name !== "PColumnData/Json")
708
706
  throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
709
707
  return new Map(
@@ -737,11 +735,11 @@ class D {
737
735
  return this.ctx.getCurrentUnstableMarker();
738
736
  }
739
737
  }
740
- const T = "PColumnData/", G = T + "ResourceMap", H = T + "Partitioned/ResourceMap", Z = T + "JsonPartitioned", M = T + "BinaryPartitioned", ae = T + "Partitioned/", ee = ae + "JsonPartitioned", B = ae + "BinaryPartitioned";
738
+ const T = "PColumnData/", K = T + "ResourceMap", G = T + "Partitioned/ResourceMap", Z = T + "JsonPartitioned", M = T + "BinaryPartitioned", ae = T + "Partitioned/", ee = ae + "JsonPartitioned", B = ae + "BinaryPartitioned";
741
739
  function le(t, e, n, r = [], s) {
742
740
  if (t === void 0) return !1;
743
741
  switch (t.resourceType.name) {
744
- case G: {
742
+ case K: {
745
743
  let i = t.getInputsLocked();
746
744
  for (const o of t.listInputFields()) {
747
745
  const a = t.resolve({ field: o, assertFieldType: "Input" }), l = [...r, ...JSON.parse(o)], c = a === void 0 ? void 0 : e(a);
@@ -749,7 +747,7 @@ function le(t, e, n, r = [], s) {
749
747
  }
750
748
  return i;
751
749
  }
752
- case H: {
750
+ case G: {
753
751
  let i = t.getInputsLocked();
754
752
  for (const o of t.listInputFields()) {
755
753
  const a = t.resolve({ field: o, assertFieldType: "Input" });
@@ -787,10 +785,10 @@ function De(t) {
787
785
  const e = t.resourceType.name, n = t.getDataAsJson(), r = [];
788
786
  let s = 0;
789
787
  switch (e) {
790
- case G:
788
+ case K:
791
789
  s = n.keyLength;
792
790
  break;
793
- case H:
791
+ case G:
794
792
  s = n.partitionKeyLength + n.keyLength;
795
793
  break;
796
794
  case Z:
@@ -803,7 +801,7 @@ function De(t) {
803
801
  break;
804
802
  }
805
803
  switch (e) {
806
- case G:
804
+ case K:
807
805
  case Z:
808
806
  case M:
809
807
  for (let i of t.listInputFields()) {
@@ -816,7 +814,7 @@ function De(t) {
816
814
  r.push(o);
817
815
  }
818
816
  break;
819
- case H:
817
+ case G:
820
818
  case B:
821
819
  case ee:
822
820
  for (const i of t.listInputFields()) {
@@ -850,7 +848,7 @@ function pt(t) {
850
848
  }
851
849
  return s.map((i) => Array.from(i.values()));
852
850
  }
853
- const C = "1.14.1";
851
+ const C = "1.17.0";
854
852
  function ke(t) {
855
853
  return t.__renderLambda === !0;
856
854
  }
@@ -1109,12 +1107,12 @@ class h {
1109
1107
  }
1110
1108
  function ht(t, e, n, r) {
1111
1109
  var o, a;
1112
- const s = t.resultPool.getData().entries.map((l) => l.obj).filter(W).filter((l) => l.spec.name === "pl7.app/label" && l.spec.axesSpec.length === 1), i = /* @__PURE__ */ new Map();
1110
+ const s = t.resultPool.getData().entries.map((l) => l.obj).filter(H).filter((l) => l.spec.name === "pl7.app/label" && l.spec.axesSpec.length === 1), i = /* @__PURE__ */ new Map();
1113
1111
  for (const l of e)
1114
1112
  for (const c of l.spec.axesSpec) {
1115
- const f = J(c);
1113
+ const f = Y(c);
1116
1114
  for (const w of s)
1117
- me(f, J(w.spec.axesSpec[0])) && i.set(w.id, w);
1115
+ me(f, Y(w.spec.axesSpec[0])) && i.set(w.id, w);
1118
1116
  }
1119
1117
  if (![...e, ...i.values()].find((l) => !l.data.getIsReadyOrError()))
1120
1118
  return t.createPTable({
@@ -1133,7 +1131,7 @@ function ht(t, e, n, r) {
1133
1131
  function gt(t, e, n) {
1134
1132
  const r = t.findLabels(e);
1135
1133
  return {
1136
- axis: J(e),
1134
+ axis: e,
1137
1135
  options: n.map((s) => ({
1138
1136
  value: s,
1139
1137
  label: (r == null ? void 0 : r.get(s)) ?? s.toString()
@@ -1200,8 +1198,8 @@ export {
1200
1198
  B as RT_BINARY_SUPER_PARTITIONED,
1201
1199
  Z as RT_JSON_PARTITIONED,
1202
1200
  ee as RT_JSON_SUPER_PARTITIONED,
1203
- G as RT_RESOURCE_MAP,
1204
- H as RT_RESOURCE_MAP_PARTITIONED,
1201
+ K as RT_RESOURCE_MAP,
1202
+ G as RT_RESOURCE_MAP_PARTITIONED,
1205
1203
  D as RenderCtx,
1206
1204
  Oe as ResultPool,
1207
1205
  Je as StagingOutputs,