@platforma-sdk/model 1.28.1 → 1.29.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.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -37
- package/dist/index.mjs.map +1 -1
- package/dist/render/api.d.ts +2 -2
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/util/column_collection.d.ts.map +1 -1
- package/dist/render/util/label.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -3
- package/src/render/api.ts +13 -8
- package/src/render/util/column_collection.ts +2 -0
- package/src/render/util/label.ts +2 -3
package/dist/index.mjs
CHANGED
|
@@ -3,8 +3,8 @@ var Ke = (t, e, n) => e in t ? je(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var L = (t, e, n) => Ke(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
import { isPColumn as ie, mapPObjectData as ge, isDataInfoEntries as xe, isDataInfo as me, dataInfoToEntries as Ve, resolveAnchors as $e, isPColumnSpec as Q, isPartitionedDataInfoEntries as Je, getAxisId as E, entriesToDataInfo as Ne, selectorsToPredicate as ce, canonicalizeAxisId as Ue, AnchoredIdDeriver as ye, isPlRef as Be, mapValueInVOE as Me, ensurePColumn as Ge, extractAllColumns as We, mapPTableDef as He, mapDataInfo as qe, matchAxisId as G } from "@milaboratories/pl-model-common";
|
|
5
5
|
export * from "@milaboratories/pl-model-common";
|
|
6
|
-
import { z as K } from "zod";
|
|
7
6
|
import Pe from "canonicalize";
|
|
7
|
+
import { z as K } from "zod";
|
|
8
8
|
export * from "@milaboratories/pl-error-like";
|
|
9
9
|
class ze extends Error {
|
|
10
10
|
constructor(e, n) {
|
|
@@ -514,11 +514,11 @@ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
514
514
|
}), st = K.array(it), ot = 1e-3, at = "__LABEL__", ve = "__LABEL__@1";
|
|
515
515
|
function Ee(t, e, n = {}) {
|
|
516
516
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = t.map((p) => {
|
|
517
|
-
var q,
|
|
517
|
+
var q, F;
|
|
518
518
|
const c = e(p);
|
|
519
519
|
let h, A, y;
|
|
520
520
|
"spec" in c && typeof c.spec == "object" ? (h = c.spec, A = c.prefixTrace, y = c.suffixTrace) : h = c;
|
|
521
|
-
const v = (q = h.annotations) == null ? void 0 : q[nt], g = (
|
|
521
|
+
const v = (q = h.annotations) == null ? void 0 : q[nt], g = (F = h.annotations) == null ? void 0 : F[rt], P = (g ? st.safeParse(JSON.parse(g)).data : void 0) ?? [], b = [
|
|
522
522
|
...A ?? [],
|
|
523
523
|
...P,
|
|
524
524
|
...y ?? []
|
|
@@ -527,7 +527,7 @@ function Ee(t, e, n = {}) {
|
|
|
527
527
|
const I = { label: v, type: at, importance: -2 };
|
|
528
528
|
n.addLabelAsSuffix ? b.push(I) : b.splice(0, 0, I);
|
|
529
529
|
}
|
|
530
|
-
const
|
|
530
|
+
const k = [], $ = /* @__PURE__ */ new Map();
|
|
531
531
|
for (let I = b.length - 1; I >= 0; --I) {
|
|
532
532
|
const { type: R } = b[I], se = b[I].importance ?? 0, J = ($.get(R) ?? 0) + 1;
|
|
533
533
|
$.set(R, J);
|
|
@@ -538,13 +538,13 @@ function Ee(t, e, n = {}) {
|
|
|
538
538
|
r.get(w) ?? Number.NEGATIVE_INFINITY,
|
|
539
539
|
se - (b.length - I) * ot
|
|
540
540
|
)
|
|
541
|
-
),
|
|
541
|
+
), k.push({ ...b[I], fullType: w, occurenceIndex: J });
|
|
542
542
|
}
|
|
543
|
-
return
|
|
543
|
+
return k.reverse(), {
|
|
544
544
|
value: p,
|
|
545
545
|
spec: h,
|
|
546
546
|
label: v,
|
|
547
|
-
fullTrace:
|
|
547
|
+
fullTrace: k
|
|
548
548
|
};
|
|
549
549
|
}), o = [], a = [], l = [...r];
|
|
550
550
|
l.sort(([, p], [, c]) => c - p);
|
|
@@ -577,17 +577,15 @@ function Ee(t, e, n = {}) {
|
|
|
577
577
|
for (let h = 0; h < S; ++h) p.add(o[h]);
|
|
578
578
|
p.add(o[d]);
|
|
579
579
|
const c = u(p);
|
|
580
|
-
if (c !== void 0)
|
|
581
|
-
|
|
582
|
-
d++, d == o.length && (S++, d = S);
|
|
583
|
-
}
|
|
580
|
+
if (c !== void 0 && new Set(c.map((h) => h.label)).size === t.length) return c;
|
|
581
|
+
d++, d >= o.length && (S++, d = S);
|
|
584
582
|
}
|
|
585
583
|
const f = u(/* @__PURE__ */ new Set([...o, ...a]));
|
|
586
584
|
if (f === void 0) throw new Error("Assertion error.");
|
|
587
585
|
return f;
|
|
588
586
|
}
|
|
589
587
|
const H = "PColumnData/", te = H + "ResourceMap", ne = H + "Partitioned/ResourceMap", U = H + "JsonPartitioned", V = H + "BinaryPartitioned", Fe = H + "Partitioned/", re = Fe + "JsonPartitioned", B = Fe + "BinaryPartitioned";
|
|
590
|
-
function
|
|
588
|
+
function ke(t, e, n, r = [], i) {
|
|
591
589
|
if (t === void 0) return !1;
|
|
592
590
|
switch (t.resourceType.name) {
|
|
593
591
|
case te: {
|
|
@@ -604,7 +602,7 @@ function De(t, e, n, r = [], i) {
|
|
|
604
602
|
const a = t.resolve({ field: o, assertFieldType: "Input" });
|
|
605
603
|
if (a === void 0) s = !1;
|
|
606
604
|
else {
|
|
607
|
-
const l = [...r, ...JSON.parse(o)], u =
|
|
605
|
+
const l = [...r, ...JSON.parse(o)], u = ke(
|
|
608
606
|
a,
|
|
609
607
|
e,
|
|
610
608
|
n,
|
|
@@ -622,7 +620,7 @@ function De(t, e, n, r = [], i) {
|
|
|
622
620
|
}
|
|
623
621
|
function pn(t, e, n = !1) {
|
|
624
622
|
const r = [];
|
|
625
|
-
return { isComplete:
|
|
623
|
+
return { isComplete: ke(t, e, r, [], n), data: r };
|
|
626
624
|
}
|
|
627
625
|
const fe = (t) => {
|
|
628
626
|
if (t.endsWith(".index"))
|
|
@@ -979,35 +977,36 @@ class be {
|
|
|
979
977
|
}
|
|
980
978
|
if (!Je(b))
|
|
981
979
|
throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${b.type} for column ${g.id}`);
|
|
982
|
-
const
|
|
980
|
+
const k = ct(b), $ = y[y.length - 1];
|
|
983
981
|
if ($ >= b.partitionKeyLength)
|
|
984
982
|
throw new Error(`Not enough partition keys (${b.partitionKeyLength}) for requested split axes (max index ${$}) in column ${P.name}`);
|
|
985
|
-
const q = y.map((w) => this.findLabels(E(P.axesSpec[w]))),
|
|
983
|
+
const q = y.map((w) => this.findLabels(E(P.axesSpec[w]))), F = [], I = (w, N) => {
|
|
986
984
|
if (N >= y.length) {
|
|
987
|
-
|
|
985
|
+
if (F.push([...w]), F.length > 1e4)
|
|
986
|
+
throw new Error("Too many key combinations, aborting.");
|
|
988
987
|
return;
|
|
989
988
|
}
|
|
990
|
-
const
|
|
991
|
-
if (
|
|
992
|
-
throw new Error(`Axis index ${
|
|
993
|
-
const O =
|
|
989
|
+
const D = y[N];
|
|
990
|
+
if (D >= k.length)
|
|
991
|
+
throw new Error(`Axis index ${D} out of bounds for unique keys array (length ${k.length}) during split key generation for column ${g.id}`);
|
|
992
|
+
const O = k[D];
|
|
994
993
|
if (!O || O.length === 0) {
|
|
995
|
-
|
|
994
|
+
F.length = 0;
|
|
996
995
|
return;
|
|
997
996
|
}
|
|
998
997
|
for (const z of O)
|
|
999
998
|
w.push(z), I(w, N + 1), w.pop();
|
|
1000
999
|
};
|
|
1001
|
-
if (I([], 0),
|
|
1000
|
+
if (I([], 0), F.length === 0)
|
|
1002
1001
|
continue;
|
|
1003
1002
|
const R = [...P.axesSpec], se = y.map((w) => w);
|
|
1004
1003
|
for (let w = y.length - 1; w >= 0; w--)
|
|
1005
1004
|
R.splice(y[w], 1);
|
|
1006
1005
|
const J = { ...P, axesSpec: R };
|
|
1007
|
-
for (const w of
|
|
1008
|
-
const N = w.map((
|
|
1009
|
-
const z = se[O], Re = E(P.axesSpec[z]), oe = q[O], Oe = (oe == null ? void 0 : oe[
|
|
1010
|
-
return { axisIdx: z, axisId: Re, value:
|
|
1006
|
+
for (const w of F) {
|
|
1007
|
+
const N = w.map((D, O) => {
|
|
1008
|
+
const z = se[O], Re = E(P.axesSpec[z]), oe = q[O], Oe = (oe == null ? void 0 : oe[D]) ?? String(D);
|
|
1009
|
+
return { axisIdx: z, axisId: Re, value: D, label: Oe };
|
|
1011
1010
|
});
|
|
1012
1011
|
u.push({
|
|
1013
1012
|
type: "split",
|
|
@@ -1346,12 +1345,15 @@ class bt {
|
|
|
1346
1345
|
* @returns a map of axis value => label
|
|
1347
1346
|
*/
|
|
1348
1347
|
findLabelsForColumnAxis(e, n) {
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1348
|
+
var s;
|
|
1349
|
+
const r = this.findLabels(e.axesSpec[n]);
|
|
1350
|
+
if (!r) return;
|
|
1351
|
+
const i = (s = e.annotations) == null ? void 0 : s["pl7.app/axisKeys/" + n];
|
|
1352
|
+
if (i !== void 0) {
|
|
1353
|
+
const o = JSON.parse(i);
|
|
1354
|
+
return Object.fromEntries(o.map((a) => [a, r[a] ?? "Unlabelled"]));
|
|
1355
|
+
} else
|
|
1356
|
+
return r;
|
|
1355
1357
|
}
|
|
1356
1358
|
}
|
|
1357
1359
|
class X {
|
|
@@ -1430,7 +1432,7 @@ class X {
|
|
|
1430
1432
|
return this.ctx.getCurrentUnstableMarker();
|
|
1431
1433
|
}
|
|
1432
1434
|
}
|
|
1433
|
-
const M = "1.
|
|
1435
|
+
const M = "1.29.0";
|
|
1434
1436
|
function wt(t) {
|
|
1435
1437
|
return t.__renderLambda === !0;
|
|
1436
1438
|
}
|
|
@@ -1771,7 +1773,7 @@ function xt(t, e) {
|
|
|
1771
1773
|
const n = t.spec.axesSpec.map(E);
|
|
1772
1774
|
return e.spec.axesSpec.map(E).every((i) => n.some((s) => G(s, i) && G(i, s)));
|
|
1773
1775
|
}
|
|
1774
|
-
function
|
|
1776
|
+
function De(t, e) {
|
|
1775
1777
|
const n = t.spec.axesSpec.map(E);
|
|
1776
1778
|
return e.spec.axesSpec.map(E).every((i) => n.some((s) => G(s, i)));
|
|
1777
1779
|
}
|
|
@@ -1780,7 +1782,7 @@ function Se(t, e) {
|
|
|
1780
1782
|
const n = t.spec.axesSpec.map(E), r = e.spec.axesSpec.map(E);
|
|
1781
1783
|
if (xt(t, e))
|
|
1782
1784
|
return [];
|
|
1783
|
-
if (!
|
|
1785
|
+
if (!De(t, e))
|
|
1784
1786
|
return [];
|
|
1785
1787
|
const o = r.map((d) => n.filter((f) => G(f, d))), a = St(o), l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), S = a.map((d) => {
|
|
1786
1788
|
const f = /* @__PURE__ */ new Set();
|
|
@@ -1840,7 +1842,7 @@ function _t(t, e) {
|
|
|
1840
1842
|
for (const i of t) {
|
|
1841
1843
|
if (i.id === r.id)
|
|
1842
1844
|
break;
|
|
1843
|
-
if (
|
|
1845
|
+
if (De(i, r)) {
|
|
1844
1846
|
n.push(r);
|
|
1845
1847
|
break;
|
|
1846
1848
|
}
|