@platforma-sdk/model 1.27.8 → 1.27.17

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,19 +1,20 @@
1
1
  var _e = Object.defineProperty;
2
2
  var Ie = (t, e, n) => e in t ? _e(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var T = (t, e, n) => Ie(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { isPColumn as M, mapPObjectData as ue, selectorsToPredicate as ce, AnchoredIdDeriver as te, isPlRef as Ce, resolveAnchors as Le, isPColumnSpec as J, getAxisId as L, entriesToDataInfo as Te, mapValueInVOE as Fe, ensurePColumn as Re, isDataInfo as me, extractAllColumns as ke, mapPTableDef as De, mapDataInfo as Ee, canonicalizeAxisId as Oe, matchAxisId as G } from "@milaboratories/pl-model-common";
3
+ var F = (t, e, n) => Ie(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { isPColumn as M, mapPObjectData as ue, selectorsToPredicate as ce, AnchoredIdDeriver as te, isPlRef as Ce, resolveAnchors as Le, isPColumnSpec as N, getAxisId as L, entriesToDataInfo as Fe, mapValueInVOE as Te, ensurePColumn as Re, isDataInfo as me, extractAllColumns as ke, mapPTableDef as De, mapDataInfo as Oe, canonicalizeAxisId as Ee, matchAxisId as G } from "@milaboratories/pl-model-common";
5
5
  export * from "@milaboratories/pl-model-common";
6
- import { z as E } from "zod";
6
+ import { z as O } from "zod";
7
+ export * from "@milaboratories/pl-error-like";
7
8
  class je extends Error {
8
9
  constructor(e, n) {
9
- super(`${e.length}${n ? "+" : ""} errors, first error: ` + e[0]), this.errors = e, this.moreErrors = n;
10
+ super(`${e.length}${n ? "+" : ""} errors, first error: ` + e[0].message), this.errors = e, this.moreErrors = n;
10
11
  }
11
12
  }
12
13
  function Ve(t) {
13
14
  if (!t.ok) throw new je(t.errors, t.moreErrors);
14
15
  return t.value;
15
16
  }
16
- function ft(t) {
17
+ function ht(t) {
17
18
  return new Proxy(t, {
18
19
  get(e, n) {
19
20
  return Ve(e[n]);
@@ -26,13 +27,13 @@ function b(t) {
26
27
  function W(t) {
27
28
  return { type: "GetFromCtx", variable: t };
28
29
  }
29
- function ht(t) {
30
+ function gt(t) {
30
31
  return {
31
32
  type: "Isolate",
32
33
  cfg: t
33
34
  };
34
35
  }
35
- const gt = W("$args"), mt = W("$it"), yt = W("$prod"), bt = W("$staging"), vt = W("$ui");
36
+ const mt = W("$args"), yt = W("$it"), bt = W("$prod"), vt = W("$staging"), wt = W("$ui");
36
37
  function Y(t) {
37
38
  return { type: "Immediate", value: t };
38
39
  }
@@ -44,7 +45,7 @@ function ye(t) {
44
45
  template: e
45
46
  };
46
47
  }
47
- function wt(...t) {
48
+ function xt(...t) {
48
49
  const e = [];
49
50
  for (const n of t) e.push(b(n));
50
51
  return {
@@ -59,7 +60,7 @@ function X(t, e) {
59
60
  field: b(e)
60
61
  };
61
62
  }
62
- function xt(t, e, n = "$it") {
63
+ function At(t, e, n = "$it") {
63
64
  return {
64
65
  type: "MapRecordValues",
65
66
  source: t,
@@ -67,7 +68,7 @@ function xt(t, e, n = "$it") {
67
68
  itVar: n
68
69
  };
69
70
  }
70
- function At(t, e, n = "$it") {
71
+ function St(t, e, n = "$it") {
71
72
  return {
72
73
  type: "MapArrayValues",
73
74
  source: t,
@@ -75,39 +76,39 @@ function At(t, e, n = "$it") {
75
76
  itVar: n
76
77
  };
77
78
  }
78
- function St(t) {
79
+ function Pt(t) {
79
80
  return {
80
81
  type: "Flatten",
81
82
  source: t
82
83
  };
83
84
  }
84
- function Pt(t) {
85
+ function _t(t) {
85
86
  return {
86
87
  type: "IsEmpty",
87
88
  arg: t
88
89
  };
89
90
  }
90
- function _t(t) {
91
+ function It(t) {
91
92
  return {
92
93
  type: "Not",
93
94
  operand: t
94
95
  };
95
96
  }
96
- function It(t, e) {
97
+ function Ct(t, e) {
97
98
  return {
98
99
  type: "And",
99
100
  operand1: t,
100
101
  operand2: e
101
102
  };
102
103
  }
103
- function Ct(t, e) {
104
+ function Lt(t, e) {
104
105
  return {
105
106
  type: "Or",
106
107
  operand1: t,
107
108
  operand2: e
108
109
  };
109
110
  }
110
- function Lt(t, e) {
111
+ function Ft(t, e) {
111
112
  return {
112
113
  type: "GetResourceField",
113
114
  source: b(t),
@@ -122,7 +123,7 @@ function Tt() {
122
123
  };
123
124
  };
124
125
  }
125
- function Ft(t, e, n = "$it") {
126
+ function Rt(t, e, n = "$it") {
126
127
  return {
127
128
  type: "MapResourceFields",
128
129
  source: t,
@@ -130,19 +131,19 @@ function Ft(t, e, n = "$it") {
130
131
  itVar: n
131
132
  };
132
133
  }
133
- function Rt(t) {
134
+ function kt(t) {
134
135
  return {
135
136
  type: "GetBlobContent",
136
137
  source: b(t)
137
138
  };
138
139
  }
139
- function kt(t) {
140
+ function Dt(t) {
140
141
  return {
141
142
  type: "GetBlobContentAsString",
142
143
  source: b(t)
143
144
  };
144
145
  }
145
- function Dt() {
146
+ function Ot() {
146
147
  return function(t) {
147
148
  return {
148
149
  type: "GetBlobContentAsJson",
@@ -156,47 +157,47 @@ function Et(t) {
156
157
  source: b(t)
157
158
  };
158
159
  }
159
- function Ot(t) {
160
+ function jt(t) {
160
161
  return {
161
162
  type: "GetOnDemandBlobContent",
162
163
  source: b(t)
163
164
  };
164
165
  }
165
- function jt(t, e) {
166
+ function Vt(t, e) {
166
167
  return {
167
168
  type: "ExtractArchiveAndGetURL",
168
169
  format: e,
169
170
  source: b(t)
170
171
  };
171
172
  }
172
- function Vt(t) {
173
+ function Kt(t) {
173
174
  return {
174
175
  type: "GetImportProgress",
175
176
  source: b(t)
176
177
  };
177
178
  }
178
- function Kt(t, e) {
179
+ function Jt(t, e) {
179
180
  return {
180
181
  type: "GetLastLogs",
181
182
  source: b(t),
182
183
  lines: e
183
184
  };
184
185
  }
185
- function $t(t, e) {
186
+ function Nt(t, e) {
186
187
  return {
187
188
  type: "GetProgressLog",
188
189
  source: b(t),
189
190
  patternToSearch: e
190
191
  };
191
192
  }
192
- function Jt(t, e) {
193
+ function $t(t, e) {
193
194
  return {
194
195
  type: "GetProgressLogWithInfo",
195
196
  source: b(t),
196
197
  patternToSearch: e
197
198
  };
198
199
  }
199
- function Nt(t) {
200
+ function Bt(t) {
200
201
  return {
201
202
  type: "GetLogHandle",
202
203
  source: b(t)
@@ -211,7 +212,7 @@ function be(t) {
211
212
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
212
213
  throw new Error("Can't get platforma instance.");
213
214
  }
214
- function $e() {
215
+ function Je() {
215
216
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
216
217
  }
217
218
  function h() {
@@ -219,13 +220,13 @@ function h() {
219
220
  throw new Error("Not in config rendering context");
220
221
  }
221
222
  function q(t, e) {
222
- const n = $e();
223
+ const n = Je();
223
224
  if (n === void 0) return !1;
224
225
  if (t in n.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
225
226
  return n.callbackRegistry[t] = e, !0;
226
227
  }
227
228
  const ne = /* @__PURE__ */ new Map();
228
- function Je(t, e) {
229
+ function Ne(t, e) {
229
230
  t in h().callbackRegistry || (h().callbackRegistry[t] = (n) => {
230
231
  for (const r of ne.get(t))
231
232
  r(n);
@@ -233,9 +234,9 @@ function Je(t, e) {
233
234
  }
234
235
  class S {
235
236
  constructor(e, n = (r) => r) {
236
- T(this, "isResolved", !1);
237
- T(this, "resolvedValue");
238
- this.handle = e, this.postProcess = n, Je(e, (r) => {
237
+ F(this, "isResolved", !1);
238
+ F(this, "resolvedValue");
239
+ this.handle = e, this.postProcess = n, Ne(e, (r) => {
239
240
  this.resolvedValue = n(r), this.isResolved = !0;
240
241
  });
241
242
  }
@@ -475,7 +476,7 @@ class I {
475
476
  return s && (c = c.filter((l) => l[1] !== void 0)), c.map(([l, m]) => o(l, m));
476
477
  }
477
478
  }
478
- const ve = "staging", we = "main", Ne = {
479
+ const ve = "staging", we = "main", $e = {
479
480
  explicitColumnsSupport: !0,
480
481
  inlineColumnsSupport: !0,
481
482
  activeArgs: !0
@@ -497,46 +498,107 @@ function Be(t) {
497
498
  const e = /* @__PURE__ */ new Set();
498
499
  return oe(e, /* @__PURE__ */ new Set(), t), e;
499
500
  }
500
- const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
501
+ const Ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
501
502
  __proto__: null,
502
- GlobalCfgRenderCtxFeatureFlags: Ne,
503
+ GlobalCfgRenderCtxFeatureFlags: $e,
503
504
  MainAccessorName: we,
504
505
  StagingAccessorName: ve,
505
506
  getAllFutureAwaits: Be,
506
507
  isFutureAwait: xe
507
- }, Symbol.toStringTag, { value: "Module" })), Ue = "pl7.app/label", Me = "pl7.app/trace", Ge = E.object({
508
- type: E.string(),
509
- importance: E.number().optional(),
510
- id: E.string().optional(),
511
- label: E.string()
512
- }), We = E.array(Ge), He = 1e-3, qe = "__LABEL__", pe = "__LABEL__@1";
508
+ }, Symbol.toStringTag, { value: "Module" }));
509
+ function Ue(t, e) {
510
+ const n = [...e].sort((s, o) => o[0] - s[0]);
511
+ if (t.type === "JsonPartitioned" || t.type === "BinaryPartitioned") {
512
+ const { partitionKeyLength: s } = t;
513
+ for (const [o] of e)
514
+ if (o >= s)
515
+ throw new Error(`Can't filter on non-partitioned axis ${o}. Must be >= ${s}`);
516
+ } else if (t.type === "Json") {
517
+ const { keyLength: s } = t;
518
+ for (const [o] of e)
519
+ if (o >= s)
520
+ throw new Error(`Can't filter on non-data axis ${o}. Must be >= ${s}`);
521
+ }
522
+ const r = (s) => {
523
+ for (const [o, a] of n)
524
+ if (s[o] !== a)
525
+ return !1;
526
+ return !0;
527
+ }, i = (s) => {
528
+ const o = [...s];
529
+ for (const [a] of n)
530
+ o.splice(a, 1);
531
+ return o;
532
+ };
533
+ switch (t.type) {
534
+ case "Json": {
535
+ const s = t.data.filter((o) => r(o.key)).map((o) => ({
536
+ key: i(o.key),
537
+ value: o.value
538
+ }));
539
+ return {
540
+ type: "Json",
541
+ keyLength: t.keyLength - e.length,
542
+ data: s
543
+ };
544
+ }
545
+ case "JsonPartitioned": {
546
+ const s = t.parts.filter((o) => r(o.key)).map((o) => ({
547
+ key: i(o.key),
548
+ value: o.value
549
+ }));
550
+ return {
551
+ type: "JsonPartitioned",
552
+ partitionKeyLength: t.partitionKeyLength - e.length,
553
+ parts: s
554
+ };
555
+ }
556
+ case "BinaryPartitioned": {
557
+ const s = t.parts.filter((o) => r(o.key)).map((o) => ({
558
+ key: i(o.key),
559
+ value: o.value
560
+ }));
561
+ return {
562
+ type: "BinaryPartitioned",
563
+ partitionKeyLength: t.partitionKeyLength - e.length,
564
+ parts: s
565
+ };
566
+ }
567
+ }
568
+ }
569
+ const Me = "pl7.app/label", Ge = "pl7.app/trace", We = O.object({
570
+ type: O.string(),
571
+ importance: O.number().optional(),
572
+ id: O.string().optional(),
573
+ label: O.string()
574
+ }), He = O.array(We), qe = 1e-3, ze = "__LABEL__", pe = "__LABEL__@1";
513
575
  function de(t, e, n = {}) {
514
576
  const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = t.map((f) => {
515
577
  var R, k;
516
578
  const p = e(f);
517
579
  let d, y, g;
518
580
  "spec" in p && typeof p.spec == "object" ? (d = p.spec, y = p.prefixTrace, g = p.suffixTrace) : d = p;
519
- const v = (R = d.annotations) == null ? void 0 : R[Ue], w = (k = d.annotations) == null ? void 0 : k[Me], x = (w ? We.safeParse(JSON.parse(w)).data : void 0) ?? [], C = [
581
+ const v = (R = d.annotations) == null ? void 0 : R[Me], w = (k = d.annotations) == null ? void 0 : k[Ge], x = (w ? He.safeParse(JSON.parse(w)).data : void 0) ?? [], C = [
520
582
  ...y ?? [],
521
583
  ...x,
522
584
  ...g ?? []
523
585
  ];
524
586
  if (v) {
525
- const A = { label: v, type: qe, importance: -2 };
587
+ const A = { label: v, type: ze, importance: -2 };
526
588
  n.addLabelAsSuffix ? C.push(A) : C.splice(0, 0, A);
527
589
  }
528
- const P = [], F = /* @__PURE__ */ new Map();
590
+ const P = [], T = /* @__PURE__ */ new Map();
529
591
  for (let A = C.length - 1; A >= 0; --A) {
530
- const { type: j } = C[A], V = C[A].importance ?? 0, K = (F.get(j) ?? 0) + 1;
531
- F.set(j, K);
532
- const $ = `${j}@${K}`;
533
- i.set($, (i.get($) ?? 0) + 1), r.set(
534
- $,
592
+ const { type: j } = C[A], V = C[A].importance ?? 0, K = (T.get(j) ?? 0) + 1;
593
+ T.set(j, K);
594
+ const J = `${j}@${K}`;
595
+ i.set(J, (i.get(J) ?? 0) + 1), r.set(
596
+ J,
535
597
  Math.max(
536
- r.get($) ?? Number.NEGATIVE_INFINITY,
537
- V - (C.length - A) * He
598
+ r.get(J) ?? Number.NEGATIVE_INFINITY,
599
+ V - (C.length - A) * qe
538
600
  )
539
- ), P.push({ ...C[A], fullType: $, occurenceIndex: K });
601
+ ), P.push({ ...C[A], fullType: J, occurenceIndex: K });
540
602
  }
541
603
  return P.reverse(), {
542
604
  value: f,
@@ -571,7 +633,7 @@ function de(t, e, n = {}) {
571
633
  }
572
634
  return l(/* @__PURE__ */ new Set([...o, ...a]));
573
635
  }
574
- const H = "PColumnData/", Q = H + "ResourceMap", Z = H + "Partitioned/ResourceMap", N = H + "JsonPartitioned", O = H + "BinaryPartitioned", Ae = H + "Partitioned/", ee = Ae + "JsonPartitioned", B = Ae + "BinaryPartitioned";
636
+ const H = "PColumnData/", Q = H + "ResourceMap", Z = H + "Partitioned/ResourceMap", $ = H + "JsonPartitioned", E = H + "BinaryPartitioned", Ae = H + "Partitioned/", ee = Ae + "JsonPartitioned", B = Ae + "BinaryPartitioned";
575
637
  function Se(t, e, n, r = [], i) {
576
638
  if (t === void 0) return !1;
577
639
  switch (t.resourceType.name) {
@@ -605,7 +667,7 @@ function Se(t, e, n, r = [], i) {
605
667
  throw new Error(`Unknown resource type: ${t.resourceType.name}`);
606
668
  }
607
669
  }
608
- function Ut(t, e, n = !1) {
670
+ function Mt(t, e, n = !1) {
609
671
  const r = [];
610
672
  return { isComplete: Se(t, e, r, [], n), data: r };
611
673
  }
@@ -616,7 +678,7 @@ const ae = (t) => {
616
678
  return { baseKey: t.substring(0, t.length - 7), type: "values" };
617
679
  throw new Error(`key must ends on .index/.values for binary p-column, got: ${t}`);
618
680
  };
619
- function ze(t) {
681
+ function Ye(t) {
620
682
  if (!t) return;
621
683
  const e = t.resourceType.name, n = t.getDataAsJson(), r = [];
622
684
  let i = 0;
@@ -627,8 +689,8 @@ function ze(t) {
627
689
  case Z:
628
690
  i = n.partitionKeyLength + n.keyLength;
629
691
  break;
630
- case N:
631
- case O:
692
+ case $:
693
+ case E:
632
694
  i = n.partitionKeyLength;
633
695
  break;
634
696
  case B:
@@ -638,10 +700,10 @@ function ze(t) {
638
700
  }
639
701
  switch (e) {
640
702
  case Q:
641
- case N:
642
- case O:
703
+ case $:
704
+ case E:
643
705
  for (let s of t.listInputFields()) {
644
- e === O && (s = ae(s).baseKey);
706
+ e === E && (s = ae(s).baseKey);
645
707
  const o = [...JSON.parse(s)];
646
708
  r.push(o);
647
709
  }
@@ -662,8 +724,8 @@ function ze(t) {
662
724
  }
663
725
  return { data: r, keyLength: i };
664
726
  }
665
- function Ye(t) {
666
- const e = ze(t);
727
+ function Xe(t) {
728
+ const e = Ye(t);
667
729
  if (!e) return;
668
730
  const { data: n, keyLength: r } = e, i = [];
669
731
  for (let s = 0; s < r; ++s)
@@ -685,7 +747,7 @@ function le(t, e = []) {
685
747
  case Q:
686
748
  case Z:
687
749
  throw new Error(`Only data columns are supported, got: ${n}`);
688
- case N: {
750
+ case $: {
689
751
  if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
690
752
  throw new Error(`Missing partitionKeyLength in metadata for ${n}`);
691
753
  const i = [];
@@ -701,7 +763,7 @@ function le(t, e = []) {
701
763
  parts: i
702
764
  };
703
765
  }
704
- case O: {
766
+ case E: {
705
767
  if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
706
768
  throw new Error(`Missing partitionKeyLength in metadata for ${n}`);
707
769
  const i = [], s = /* @__PURE__ */ new Map();
@@ -735,8 +797,8 @@ function le(t, e = []) {
735
797
  for (const o of t.listInputFields()) {
736
798
  const a = t.resolve({ field: o, assertFieldType: "Input" });
737
799
  if (a === void 0) return;
738
- if (a.resourceType.name !== N)
739
- throw new Error(`Expected ${N} inside ${n}, but got ${a.resourceType.name}`);
800
+ if (a.resourceType.name !== $)
801
+ throw new Error(`Expected ${$} inside ${n}, but got ${a.resourceType.name}`);
740
802
  const c = le(a, JSON.parse(o));
741
803
  if (c === void 0) return;
742
804
  if (c.type !== "JsonPartitioned")
@@ -756,8 +818,8 @@ function le(t, e = []) {
756
818
  for (const o of t.listInputFields()) {
757
819
  const a = t.resolve({ field: o, assertFieldType: "Input" });
758
820
  if (a === void 0) return;
759
- if (a.resourceType.name !== O)
760
- throw new Error(`Expected ${O} inside ${n}, but got ${a.resourceType.name}`);
821
+ if (a.resourceType.name !== E)
822
+ throw new Error(`Expected ${E} inside ${n}, but got ${a.resourceType.name}`);
761
823
  const c = le(a, JSON.parse(o));
762
824
  if (c === void 0) return;
763
825
  if (c.type !== "BinaryPartitioned")
@@ -774,66 +836,6 @@ function le(t, e = []) {
774
836
  throw new Error(`Unknown resource type: ${n}`);
775
837
  }
776
838
  }
777
- function Xe(t, e) {
778
- const n = [...e].sort((s, o) => o[0] - s[0]);
779
- if (t.type === "JsonPartitioned" || t.type === "BinaryPartitioned") {
780
- const { partitionKeyLength: s } = t;
781
- for (const [o] of e)
782
- if (o >= s)
783
- throw new Error(`Can't filter on non-partitioned axis ${o}. Must be >= ${s}`);
784
- } else if (t.type === "Json") {
785
- const { keyLength: s } = t;
786
- for (const [o] of e)
787
- if (o >= s)
788
- throw new Error(`Can't filter on non-data axis ${o}. Must be >= ${s}`);
789
- }
790
- const r = (s) => {
791
- for (const [o, a] of n)
792
- if (s[o] !== a)
793
- return !1;
794
- return !0;
795
- }, i = (s) => {
796
- const o = [...s];
797
- for (const [a] of n)
798
- o.splice(a, 1);
799
- return o;
800
- };
801
- switch (t.type) {
802
- case "Json": {
803
- const s = t.data.filter((o) => r(o.key)).map((o) => ({
804
- key: i(o.key),
805
- value: o.value
806
- }));
807
- return {
808
- type: "Json",
809
- keyLength: t.keyLength - e.length,
810
- data: s
811
- };
812
- }
813
- case "JsonPartitioned": {
814
- const s = t.parts.filter((o) => r(o.key)).map((o) => ({
815
- key: i(o.key),
816
- value: o.value
817
- }));
818
- return {
819
- type: "JsonPartitioned",
820
- partitionKeyLength: t.partitionKeyLength - e.length,
821
- parts: s
822
- };
823
- }
824
- case "BinaryPartitioned": {
825
- const s = t.parts.filter((o) => r(o.key)).map((o) => ({
826
- key: i(o.key),
827
- value: o.value
828
- }));
829
- return {
830
- type: "BinaryPartitioned",
831
- partitionKeyLength: t.partitionKeyLength - e.length,
832
- parts: s
833
- };
834
- }
835
- }
836
- }
837
839
  function re(t, e) {
838
840
  if (t === void 0) return e === void 0;
839
841
  if (e === void 0) return !0;
@@ -842,12 +844,12 @@ function re(t, e) {
842
844
  return !0;
843
845
  }
844
846
  function fe(t) {
845
- return ue(t, (e) => e instanceof I ? e.handle : me(e) ? Ee(e, (n) => n.handle) : e);
847
+ return ue(t, (e) => e instanceof I ? e.handle : me(e) ? Oe(e, (n) => n.handle) : e);
846
848
  }
847
849
  function Qe(t) {
848
850
  if (t)
849
851
  return t.map((e) => ({
850
- type: `split:${Oe(e.axisId)}`,
852
+ type: `split:${Ee(e.axisId)}`,
851
853
  label: e.label,
852
854
  importance: 1e6
853
855
  // High importance for split filters in labels
@@ -859,7 +861,7 @@ function Ze(t) {
859
861
  }
860
862
  class et {
861
863
  constructor() {
862
- T(this, "ctx", h());
864
+ F(this, "ctx", h());
863
865
  }
864
866
  /**
865
867
  * @deprecated use getOptions()
@@ -894,52 +896,52 @@ class et {
894
896
  i[l] = m;
895
897
  const s = typeof n == "function" ? [n] : Array.isArray(n) ? n : [n], o = e instanceof te ? e : new te(i), a = [];
896
898
  for (const l of s) {
897
- const m = typeof l == "function" ? l : ce(Le(i, l)), u = this.getSpecs().entries.filter(({ obj: p }) => J(p) ? m(p) : !1);
899
+ const m = typeof l == "function" ? l : ce(Le(i, l)), u = this.getSpecs().entries.filter(({ obj: p }) => N(p) ? m(p) : !1);
898
900
  if (u.length === 0)
899
901
  continue;
900
902
  const f = typeof l == "object" && "axes" in l && l.axes !== void 0 && l.partialAxesMatch === void 0 ? l.axes.map((p, d) => "split" in p && p.split === !0 ? d : -1).filter((p) => p !== -1) : [];
901
903
  if (f.sort((p, d) => p - d), f.length > 0) {
902
904
  const p = f[f.length - 1];
903
905
  for (const { ref: d, obj: y } of u) {
904
- if (!J(y)) throw new Error(`Assertion failed: expected PColumnSpec, got ${y.kind}`);
906
+ if (!N(y)) throw new Error(`Assertion failed: expected PColumnSpec, got ${y.kind}`);
905
907
  const g = this.getDataByRef(d);
906
908
  if (!g) {
907
909
  if (r != null && r.dontWaitAllData) continue;
908
910
  return;
909
911
  }
910
912
  if (!M(g)) throw new Error(`Assertion failed: expected PColumn, got ${g.spec.kind}`);
911
- const v = Ye(g.data);
913
+ const v = Xe(g.data);
912
914
  if (!v) {
913
915
  if (r != null && r.dontWaitAllData) continue;
914
916
  return;
915
917
  }
916
918
  if (p >= v.length)
917
919
  throw new Error(`Not enough partition keys for the requested split axes in column ${y.name}`);
918
- const w = f.map((P) => this.findLabels(L(y.axesSpec[P]))), x = [], C = (P, F) => {
919
- if (F >= f.length) {
920
+ const w = f.map((P) => this.findLabels(L(y.axesSpec[P]))), x = [], C = (P, T) => {
921
+ if (T >= f.length) {
920
922
  x.push([...P]);
921
923
  return;
922
924
  }
923
- const R = f[F], k = v[R];
925
+ const R = f[T], k = v[R];
924
926
  for (const A of k)
925
- P.push(A), C(P, F + 1), P.pop();
927
+ P.push(A), C(P, T + 1), P.pop();
926
928
  };
927
929
  C([], 0);
928
930
  for (const P of x) {
929
- const F = P.map((R, k) => {
931
+ const T = P.map((R, k) => {
930
932
  const A = f[k], j = L(y.axesSpec[A]), V = w[k], K = (V == null ? void 0 : V[R]) ?? String(R);
931
933
  return { axisIdx: A, axisId: j, value: R, label: K };
932
934
  });
933
935
  a.push({
934
936
  obj: y,
935
937
  ref: d,
936
- axisFilters: F
938
+ axisFilters: T
937
939
  });
938
940
  }
939
941
  }
940
942
  } else
941
943
  for (const { ref: p, obj: d } of u)
942
- J(d) && a.push({
944
+ N(d) && a.push({
943
945
  obj: d,
944
946
  ref: p
945
947
  // No splitFilters needed here
@@ -998,13 +1000,13 @@ class et {
998
1000
  g.axisIdx,
999
1001
  g.value
1000
1002
  ]);
1001
- m = Xe(l, p);
1003
+ m = Ue(l, p);
1002
1004
  const d = [...a.axisFilters].map((g) => g.axisIdx).sort((g, v) => v - g), y = [...u.axesSpec];
1003
1005
  for (const g of d)
1004
1006
  y.splice(g, 1);
1005
1007
  u = { ...u, axesSpec: y };
1006
1008
  }
1007
- const f = Te(m);
1009
+ const f = Fe(m);
1008
1010
  u.annotations ? u = {
1009
1011
  ...u,
1010
1012
  annotations: {
@@ -1094,7 +1096,7 @@ class et {
1094
1096
  ref: n.ref,
1095
1097
  obj: {
1096
1098
  ...n.obj,
1097
- data: Fe(
1099
+ data: Te(
1098
1100
  n.obj.data,
1099
1101
  (r) => new I(r, [n.ref.blockId, n.ref.name])
1100
1102
  )
@@ -1146,7 +1148,7 @@ class et {
1146
1148
  getPColumnSpecByRef(e) {
1147
1149
  const n = this.getSpecByRef(e);
1148
1150
  if (n) {
1149
- if (!J(n)) throw new Error(`not a PColumn spec (kind = ${n.kind})`);
1151
+ if (!N(n)) throw new Error(`not a PColumn spec (kind = ${n.kind})`);
1150
1152
  return n;
1151
1153
  }
1152
1154
  }
@@ -1165,7 +1167,7 @@ class et {
1165
1167
  findDataWithCompatibleSpec(e) {
1166
1168
  const n = [];
1167
1169
  e: for (const r of this.getData().entries) {
1168
- if (!J(r.obj.spec))
1170
+ if (!N(r.obj.spec))
1169
1171
  continue;
1170
1172
  const i = r.obj.spec;
1171
1173
  if (e.name === i.name && e.valueType === i.valueType && e.axesSpec.length === i.axesSpec.length && re(e.domain, i.domain)) {
@@ -1199,15 +1201,27 @@ class et {
1199
1201
  }
1200
1202
  }
1201
1203
  }
1204
+ /**
1205
+ * Find labels data for a given axis id of a p-column.
1206
+ * @returns a map of axis value => label
1207
+ */
1208
+ findLabelsForColumnAxis(e, n) {
1209
+ const r = this.findLabels(e.spec.axesSpec[n]);
1210
+ if (r)
1211
+ return Object.fromEntries(e.data.listInputFields().map((i) => {
1212
+ const s = JSON.parse(i);
1213
+ return [s[n], r[s[n]] ?? "Unlabelled"];
1214
+ }));
1215
+ }
1202
1216
  }
1203
1217
  class z {
1204
1218
  constructor() {
1205
- T(this, "ctx");
1206
- T(this, "args");
1207
- T(this, "uiState");
1219
+ F(this, "ctx");
1220
+ F(this, "args");
1221
+ F(this, "uiState");
1208
1222
  // lazy rendering because this feature is rarely used
1209
- T(this, "_activeArgsCache");
1210
- T(this, "resultPool", new et());
1223
+ F(this, "_activeArgsCache");
1224
+ F(this, "resultPool", new et());
1211
1225
  this.ctx = h(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
1212
1226
  }
1213
1227
  /**
@@ -1275,7 +1289,7 @@ class z {
1275
1289
  return this.ctx.getCurrentUnstableMarker();
1276
1290
  }
1277
1291
  }
1278
- const U = "1.27.8";
1292
+ const U = "1.27.17";
1279
1293
  function tt(t) {
1280
1294
  return t.__renderLambda === !0;
1281
1295
  }
@@ -1287,7 +1301,7 @@ function D(t) {
1287
1301
  if (t !== void 0)
1288
1302
  return typeof t == "string" ? { __renderLambda: !0, handle: t, retentive: !1 } : t;
1289
1303
  }
1290
- function Mt(t) {
1304
+ function Gt(t) {
1291
1305
  if (t.v3 !== void 0) {
1292
1306
  const {
1293
1307
  initialArgs: e,
@@ -1526,7 +1540,7 @@ class _ {
1526
1540
  return Ke() ? be({ sdkVersion: U }) : { config: e };
1527
1541
  }
1528
1542
  }
1529
- function Gt(t, e, n, r) {
1543
+ function Wt(t, e, n, r) {
1530
1544
  var l, m;
1531
1545
  Array.isArray(r) && (r = { filters: r });
1532
1546
  const i = t.resultPool.getData().entries.map((u) => u.obj).filter(M).filter((u) => u.spec.name === "pl7.app/label" && u.spec.axesSpec.length === 1), s = (u, f) => {
@@ -1582,7 +1596,7 @@ function Gt(t, e, n, r) {
1582
1596
  sorting: ((m = n == null ? void 0 : n.pTableParams) == null ? void 0 : m.sorting) ?? []
1583
1597
  });
1584
1598
  }
1585
- function Wt(t, e, n) {
1599
+ function Ht(t, e, n) {
1586
1600
  const r = t.resultPool.findLabels(e);
1587
1601
  return {
1588
1602
  axis: e,
@@ -1700,7 +1714,7 @@ const lt = [
1700
1714
  "String",
1701
1715
  "Bytes"
1702
1716
  ];
1703
- function Ht(t, e) {
1717
+ function qt(t, e) {
1704
1718
  if (e === void 0) return;
1705
1719
  const n = t.resultPool.getData().entries.map((s) => s.obj).filter(M).filter((s) => lt.includes(s.spec.valueType)), r = at(e, n), i = [...r, ...ot(r)];
1706
1720
  if (!i.some(
@@ -1708,7 +1722,7 @@ function Ht(t, e) {
1708
1722
  ))
1709
1723
  return t.createPFrame(i);
1710
1724
  }
1711
- class qt {
1725
+ class zt {
1712
1726
  constructor(e) {
1713
1727
  this.handle = e;
1714
1728
  }
@@ -1735,96 +1749,104 @@ function ut(t) {
1735
1749
  name: X(t, "name")
1736
1750
  });
1737
1751
  }
1738
- function zt(t) {
1752
+ function Yt(t) {
1739
1753
  return ye({
1740
1754
  ref: ut(X(t, "ref")),
1741
1755
  label: X(t, "label")
1742
1756
  });
1743
1757
  }
1744
- const Yt = {
1758
+ const Xt = {
1745
1759
  sdkVersion: U
1746
1760
  };
1747
- function Xt() {
1761
+ function ct() {
1748
1762
  return be({ sdkVersion: U });
1749
1763
  }
1750
1764
  function Qt(t) {
1765
+ try {
1766
+ return ct();
1767
+ } catch {
1768
+ return t;
1769
+ }
1770
+ }
1771
+ function Zt(t) {
1751
1772
  if (typeof globalThis.getEnvironmentValue == "function")
1752
1773
  return globalThis.getEnvironmentValue(t);
1753
1774
  }
1754
1775
  export {
1755
- gt as Args,
1776
+ mt as Args,
1756
1777
  _ as BlockModel,
1757
- Yt as CurrentSdkInfo,
1778
+ Xt as CurrentSdkInfo,
1758
1779
  S as FutureRef,
1759
1780
  it as IS_VIRTUAL_COLUMN,
1760
- mt as It,
1761
- Bt as JsRenderInternal,
1781
+ yt as It,
1782
+ Ut as JsRenderInternal,
1762
1783
  he as LABEL_ANNOTATION,
1763
- yt as MainOutputs,
1784
+ bt as MainOutputs,
1764
1785
  je as OutputError,
1765
- Ue as PAnnotationLabel,
1766
- Me as PAnnotationTrace,
1767
- qt as PFrameImpl,
1768
- O as RT_BINARY_PARTITIONED,
1786
+ Me as PAnnotationLabel,
1787
+ Ge as PAnnotationTrace,
1788
+ zt as PFrameImpl,
1789
+ E as RT_BINARY_PARTITIONED,
1769
1790
  B as RT_BINARY_SUPER_PARTITIONED,
1770
- N as RT_JSON_PARTITIONED,
1791
+ $ as RT_JSON_PARTITIONED,
1771
1792
  ee as RT_JSON_SUPER_PARTITIONED,
1772
1793
  Q as RT_RESOURCE_MAP,
1773
1794
  Z as RT_RESOURCE_MAP_PARTITIONED,
1774
1795
  z as RenderCtx,
1775
1796
  et as ResultPool,
1776
- bt as StagingOutputs,
1777
- We as Trace,
1778
- Ge as TraceEntry,
1797
+ vt as StagingOutputs,
1798
+ He as Trace,
1799
+ We as TraceEntry,
1779
1800
  I as TreeNodeAccessor,
1780
- vt as UiState,
1781
- It as and,
1782
- Ht as createPFrameForGraphs,
1783
- Gt as createPlDataTable,
1784
- Wt as createPlDataTableSheet,
1801
+ wt as UiState,
1802
+ Ct as and,
1803
+ qt as createPFrameForGraphs,
1804
+ Wt as createPlDataTable,
1805
+ Ht as createPlDataTableSheet,
1785
1806
  de as deriveLabels,
1786
1807
  se as downgradeCfgOrLambda,
1787
1808
  at as enrichColumnsWithCompatible,
1788
- jt as extractArchiveAndGetURL,
1789
- Mt as extractConfig,
1790
- Xe as filterDataInfoEntries,
1791
- St as flatten,
1792
- zt as fromPlOption,
1809
+ Vt as extractArchiveAndGetURL,
1810
+ Gt as extractConfig,
1811
+ Ue as filterDataInfoEntries,
1812
+ Pt as flatten,
1813
+ Yt as fromPlOption,
1793
1814
  ut as fromPlRef,
1794
1815
  ot as getAdditionalColumns,
1795
- Rt as getBlobContent,
1796
- Dt as getBlobContentAsJson,
1797
- kt as getBlobContentAsString,
1816
+ kt as getBlobContent,
1817
+ Ot as getBlobContentAsJson,
1818
+ Dt as getBlobContentAsString,
1798
1819
  Et as getDownloadedBlobContent,
1799
- Qt as getEnvironmentValue,
1820
+ Zt as getEnvironmentValue,
1800
1821
  W as getFromCfg,
1801
1822
  Y as getImmediate,
1802
- Vt as getImportProgress,
1823
+ Kt as getImportProgress,
1803
1824
  X as getJsonField,
1804
- Kt as getLastLogs,
1805
- Nt as getLogHandle,
1806
- Ot as getOnDemandBlobContent,
1807
- ze as getPartitionKeysList,
1808
- $t as getProgressLog,
1809
- Jt as getProgressLogWithInfo,
1810
- Xt as getRawPlatformaInstance,
1811
- Lt as getResourceField,
1825
+ Jt as getLastLogs,
1826
+ Bt as getLogHandle,
1827
+ jt as getOnDemandBlobContent,
1828
+ Ye as getPartitionKeysList,
1829
+ Qt as getPlatformaOrDefault,
1830
+ Nt as getProgressLog,
1831
+ $t as getProgressLogWithInfo,
1832
+ ct as getRawPlatformaInstance,
1833
+ Ft as getResourceField,
1812
1834
  Tt as getResourceValueAsJson,
1813
- Ye as getUniquePartitionKeys,
1835
+ Xe as getUniquePartitionKeys,
1814
1836
  ie as ifDef,
1815
1837
  tt as isConfigLambda,
1816
- Pt as isEmpty,
1817
- ht as isolate,
1818
- wt as makeArray,
1838
+ _t as isEmpty,
1839
+ gt as isolate,
1840
+ xt as makeArray,
1819
1841
  ye as makeObject,
1820
- At as mapArrayValues,
1821
- xt as mapRecordValues,
1822
- Ft as mapResourceFields,
1823
- _t as not,
1824
- Ct as or,
1842
+ St as mapArrayValues,
1843
+ At as mapRecordValues,
1844
+ Rt as mapResourceFields,
1845
+ It as not,
1846
+ Lt as or,
1825
1847
  le as parsePColumnData,
1826
- Ut as parseResourceMap,
1848
+ Mt as parseResourceMap,
1827
1849
  Ve as readOutput,
1828
- ft as wrapOutputs
1850
+ ht as wrapOutputs
1829
1851
  };
1830
1852
  //# sourceMappingURL=index.mjs.map