@platforma-sdk/model 1.19.0 → 1.20.6

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,9 +1,9 @@
1
- var ct = Object.defineProperty;
2
- var pt = (e, t, n) => t in e ? ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var w = (e, t, n) => pt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { isPColumn as H, mapPObjectData as L, mapValueInVOE as dt, ensurePColumn as ft, isPColumnSpec as ht, extractAllColumns as gt, mapPTableDef as mt, getAxisId as Y, matchAxisId as yt } from "@milaboratories/pl-model-common";
1
+ var pt = Object.defineProperty;
2
+ var dt = (e, t, n) => t in e ? pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var w = (e, t, n) => dt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { isPColumn as H, mapPObjectData as L, mapValueInVOE as ft, ensurePColumn as ht, isPColumnSpec as Y, extractAllColumns as gt, mapPTableDef as mt, getAxisId as X, matchAxisId as yt } from "@milaboratories/pl-model-common";
5
5
  export * from "@milaboratories/pl-model-common";
6
- import { z as C } from "zod";
6
+ import { z as A } from "zod";
7
7
  class bt extends Error {
8
8
  constructor(t, n) {
9
9
  super(`${t.length}${n ? "+" : ""} errors, first error: ` + t[0]), this.errors = t, this.moreErrors = n;
@@ -13,7 +13,7 @@ function _t(e) {
13
13
  if (!e.ok) throw new bt(e.errors, e.moreErrors);
14
14
  return e.value;
15
15
  }
16
- function Mt(e) {
16
+ function Bt(e) {
17
17
  return new Proxy(e, {
18
18
  get(t, n) {
19
19
  return _t(t[n]);
@@ -21,24 +21,24 @@ function Mt(e) {
21
21
  });
22
22
  }
23
23
  function d(e) {
24
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null ? k(e) : e;
24
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null ? D(e) : e;
25
25
  }
26
26
  function R(e) {
27
27
  return { type: "GetFromCtx", variable: e };
28
28
  }
29
- function Bt(e) {
29
+ function Mt(e) {
30
30
  return {
31
31
  type: "Isolate",
32
32
  cfg: e
33
33
  };
34
34
  }
35
35
  const Ut = R("$args"), Jt = R("$it"), $t = R("$prod"), Kt = R("$staging"), Gt = R("$ui");
36
- function k(e) {
36
+ function D(e) {
37
37
  return { type: "Immediate", value: e };
38
38
  }
39
- function nt(e) {
39
+ function rt(e) {
40
40
  const t = {};
41
- for (const [n, s] of Object.entries(e)) t[n] = d(s);
41
+ for (const [n, r] of Object.entries(e)) t[n] = d(r);
42
42
  return {
43
43
  type: "MakeObject",
44
44
  template: t
@@ -130,13 +130,13 @@ function ne(e, t, n = "$it") {
130
130
  itVar: n
131
131
  };
132
132
  }
133
- function se(e) {
133
+ function re(e) {
134
134
  return {
135
135
  type: "GetBlobContent",
136
136
  source: d(e)
137
137
  };
138
138
  }
139
- function re(e) {
139
+ function se(e) {
140
140
  return {
141
141
  type: "GetBlobContentAsString",
142
142
  source: d(e)
@@ -213,16 +213,16 @@ function O(e, t) {
213
213
  const N = /* @__PURE__ */ new Map();
214
214
  function St(e, t) {
215
215
  e in u().callbackRegistry || (u().callbackRegistry[e] = (n) => {
216
- for (const s of N.get(e))
217
- s(n);
216
+ for (const r of N.get(e))
217
+ r(n);
218
218
  }, N.set(e, [])), N.get(e).push(t);
219
219
  }
220
220
  class g {
221
- constructor(t, n = (s) => s) {
221
+ constructor(t, n = (r) => r) {
222
222
  w(this, "isResolved", !1);
223
223
  w(this, "resolvedValue");
224
- this.handle = t, this.postProcess = n, St(t, (s) => {
225
- this.resolvedValue = n(s), this.isResolved = !0;
224
+ this.handle = t, this.postProcess = n, St(t, (r) => {
225
+ this.resolvedValue = n(r), this.isResolved = !0;
226
226
  });
227
227
  }
228
228
  map(t) {
@@ -230,15 +230,15 @@ class g {
230
230
  }
231
231
  mapDefined(t) {
232
232
  return new g(this.handle, (n) => {
233
- const s = this.postProcess(n);
234
- return s ? t(s) : void 0;
233
+ const r = this.postProcess(n);
234
+ return r ? t(r) : void 0;
235
235
  });
236
236
  }
237
237
  toJSON() {
238
238
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
239
239
  }
240
240
  }
241
- function X(e) {
241
+ function Q(e) {
242
242
  return e === void 0 ? void 0 : new _(e);
243
243
  }
244
244
  class _ {
@@ -247,27 +247,27 @@ class _ {
247
247
  }
248
248
  resolve(...t) {
249
249
  const n = t.map(
250
- (s) => ({
250
+ (r) => ({
251
251
  assertFieldType: "Input",
252
- ...typeof s == "string" ? { field: s } : s
252
+ ...typeof r == "string" ? { field: r } : r
253
253
  })
254
254
  );
255
255
  return this.resolveWithCommon({}, ...n);
256
256
  }
257
257
  resolveOutput(...t) {
258
258
  const n = t.map(
259
- (s) => ({
259
+ (r) => ({
260
260
  assertFieldType: "Output",
261
- ...typeof s == "string" ? { field: s } : s
261
+ ...typeof r == "string" ? { field: r } : r
262
262
  })
263
263
  );
264
264
  return this.resolveWithCommon({}, ...n);
265
265
  }
266
266
  resolveInput(...t) {
267
267
  const n = t.map(
268
- (s) => ({
268
+ (r) => ({
269
269
  assertFieldType: "Input",
270
- ...typeof s == "string" ? { field: s } : s
270
+ ...typeof r == "string" ? { field: r } : r
271
271
  })
272
272
  );
273
273
  return this.resolveWithCommon({}, ...n);
@@ -276,7 +276,7 @@ class _ {
276
276
  return this.resolveWithCommon({}, ...t);
277
277
  }
278
278
  resolveWithCommon(t, ...n) {
279
- return X(u().resolveWithCommon(this.handle, t, ...n));
279
+ return Q(u().resolveWithCommon(this.handle, t, ...n));
280
280
  }
281
281
  get resourceType() {
282
282
  return u().getResourceType(this.handle);
@@ -294,7 +294,7 @@ class _ {
294
294
  return u().getIsFinal(this.handle);
295
295
  }
296
296
  getError() {
297
- return X(u().getError(this.handle));
297
+ return Q(u().getError(this.handle));
298
298
  }
299
299
  listInputFields() {
300
300
  return u().listInputFields(this.handle);
@@ -331,8 +331,8 @@ class _ {
331
331
  *
332
332
  */
333
333
  getPColumns(t = !1, n = "") {
334
- const s = this.parsePObjectCollection(t, n);
335
- return s === void 0 ? void 0 : Object.entries(s).map(([, i]) => {
334
+ const r = this.parsePObjectCollection(t, n);
335
+ return r === void 0 ? void 0 : Object.entries(r).map(([, i]) => {
336
336
  if (!H(i)) throw new Error(`not a PColumn (kind = ${i.spec.kind})`);
337
337
  return i;
338
338
  });
@@ -341,16 +341,16 @@ class _ {
341
341
  *
342
342
  */
343
343
  parsePObjectCollection(t = !1, n = "") {
344
- const s = u().parsePObjectCollection(
344
+ const r = u().parsePObjectCollection(
345
345
  this.handle,
346
346
  t,
347
347
  n
348
348
  );
349
- if (s === void 0) return;
350
- const r = {};
351
- for (const [i, o] of Object.entries(s))
352
- r[i] = L(o, (l) => new _(l));
353
- return r;
349
+ if (r === void 0) return;
350
+ const s = {};
351
+ for (const [i, o] of Object.entries(r))
352
+ s[i] = L(o, (l) => new _(l));
353
+ return s;
354
354
  }
355
355
  getFileContentAsBase64() {
356
356
  return new g(u().getBlobContentAsBase64(this.handle));
@@ -424,55 +424,55 @@ class _ {
424
424
  }
425
425
  }
426
426
  mapFields(t, n) {
427
- const { fieldType: s, requireLocked: r, skipUnresolved: i } = {
427
+ const { fieldType: r, requireLocked: s, skipUnresolved: i } = {
428
428
  fieldType: "Input",
429
429
  requireLocked: !0,
430
430
  skipUnresolved: !1,
431
431
  ...n
432
432
  }, o = t;
433
- if (r && (s === "Input" && !this.getInputsLocked() || s === "Output" && !this.getOutputsLocked()))
433
+ if (s && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
434
434
  return;
435
- let a = (s === "Input" ? this.listInputFields() : s === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
436
- (c) => [c, this.resolve({ field: c, assertFieldType: s })]
435
+ let a = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
436
+ (c) => [c, this.resolve({ field: c, assertFieldType: r })]
437
437
  );
438
438
  return i && (a = a.filter((c) => c[1] !== void 0)), a.map(([c, f]) => o(c, f));
439
439
  }
440
440
  }
441
- const rt = "staging", it = "main", At = {
441
+ const it = "staging", ot = "main", Ct = {
442
442
  inlineColumnsSupport: !0
443
443
  };
444
- function ot(e) {
444
+ function at(e) {
445
445
  return typeof e == "object" && e !== null && "__awaited_futures__" in e;
446
446
  }
447
447
  function J(e, t, n) {
448
448
  if (t.has(n)) return;
449
449
  if (t.add(n), typeof n === "object")
450
- if (ot(n)) n.__awaited_futures__.forEach((r) => e.add(r));
450
+ if (at(n)) n.__awaited_futures__.forEach((s) => e.add(s));
451
451
  else if (Array.isArray(n))
452
- for (const r of n) J(e, t, r);
452
+ for (const s of n) J(e, t, s);
453
453
  else
454
- for (const [, r] of Object.entries(n))
455
- r !== n && J(e, t, r);
454
+ for (const [, s] of Object.entries(n))
455
+ s !== n && J(e, t, s);
456
456
  }
457
- function Ct(e) {
457
+ function At(e) {
458
458
  const t = /* @__PURE__ */ new Set();
459
459
  return J(t, /* @__PURE__ */ new Set(), e), t;
460
460
  }
461
461
  const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
462
462
  __proto__: null,
463
- GlobalCfgRenderCtxFeatureFlags: At,
464
- MainAccessorName: it,
465
- StagingAccessorName: rt,
466
- getAllFutureAwaits: Ct,
467
- isFutureAwait: ot
468
- }, Symbol.toStringTag, { value: "Module" })), It = "pl7.app/label", Pt = "pl7.app/trace", Rt = C.object({
469
- type: C.string(),
470
- importance: C.number().optional(),
471
- id: C.string().optional(),
472
- label: C.string()
473
- }), Ft = C.array(Rt), Tt = 1e-3, Ot = "__LABEL__", Q = "__LABEL__@1";
474
- function Dt(e, t, n = {}) {
475
- const s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = e.map((p) => {
463
+ GlobalCfgRenderCtxFeatureFlags: Ct,
464
+ MainAccessorName: ot,
465
+ StagingAccessorName: it,
466
+ getAllFutureAwaits: At,
467
+ isFutureAwait: at
468
+ }, Symbol.toStringTag, { value: "Module" })), It = "pl7.app/label", Pt = "pl7.app/trace", Rt = A.object({
469
+ type: A.string(),
470
+ importance: A.number().optional(),
471
+ id: A.string().optional(),
472
+ label: A.string()
473
+ }), Ft = A.array(Rt), Tt = 1e-3, Ot = "__LABEL__", Z = "__LABEL__@1";
474
+ function kt(e, t, n = {}) {
475
+ const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = e.map((p) => {
476
476
  var q, z;
477
477
  const m = t(p), y = (q = m.annotations) == null ? void 0 : q[It], T = (z = m.annotations) == null ? void 0 : z[Pt], b = (T ? Ft.safeParse(JSON.parse(T)).data : void 0) ?? [];
478
478
  if (y) {
@@ -481,14 +481,14 @@ function Dt(e, t, n = {}) {
481
481
  }
482
482
  const E = [], W = /* @__PURE__ */ new Map();
483
483
  for (let v = b.length - 1; v >= 0; --v) {
484
- const { type: V } = b[v], ut = b[v].importance ?? 0, j = (W.get(V) ?? 0) + 1;
484
+ const { type: V } = b[v], ct = b[v].importance ?? 0, j = (W.get(V) ?? 0) + 1;
485
485
  W.set(V, j);
486
486
  const I = `${V}@${j}`;
487
- r.set(I, (r.get(I) ?? 0) + 1), s.set(
487
+ s.set(I, (s.get(I) ?? 0) + 1), r.set(
488
488
  I,
489
489
  Math.max(
490
- s.get(I) ?? Number.NEGATIVE_INFINITY,
491
- ut - (b.length - v) * Tt
490
+ r.get(I) ?? Number.NEGATIVE_INFINITY,
491
+ ct - (b.length - v) * Tt
492
492
  )
493
493
  ), E.push({ ...b[v], fullType: I, occurenceIndex: j });
494
494
  }
@@ -498,10 +498,10 @@ function Dt(e, t, n = {}) {
498
498
  label: y,
499
499
  fullTrace: E
500
500
  };
501
- }), o = [], l = [], a = [...s];
501
+ }), o = [], l = [], a = [...r];
502
502
  a.sort(([, p], [, m]) => m - p);
503
503
  for (const [p] of a)
504
- p.endsWith("@1") || r.get(p) === e.length ? o.push(p) : l.push(p);
504
+ p.endsWith("@1") || s.get(p) === e.length ? o.push(p) : l.push(p);
505
505
  const c = (p) => i.map((m) => {
506
506
  const y = m.fullTrace.filter((b) => p.has(b.fullType)).map((b) => b.label), T = n.separator ?? " / ";
507
507
  return {
@@ -511,12 +511,12 @@ function Dt(e, t, n = {}) {
511
511
  });
512
512
  if (o.length === 0) {
513
513
  if (l.length !== 0) throw new Error("Assertion error.");
514
- return c(new Set(Q));
514
+ return c(new Set(Z));
515
515
  }
516
516
  let f = 0, S = 0;
517
517
  for (; f < o.length; ) {
518
518
  const p = /* @__PURE__ */ new Set();
519
- n.includeNativeLabel && p.add(Q);
519
+ n.includeNativeLabel && p.add(Z);
520
520
  for (let y = 0; y < f; ++y) p.add(o[y]);
521
521
  p.add(o[S]);
522
522
  const m = c(p);
@@ -525,12 +525,12 @@ function Dt(e, t, n = {}) {
525
525
  }
526
526
  return c(/* @__PURE__ */ new Set([...o, ...l]));
527
527
  }
528
- class kt {
528
+ class Dt {
529
529
  constructor() {
530
530
  w(this, "ctx", u());
531
531
  w(this, "defaultLabelFn", (t, n) => {
532
- var s;
533
- return ((s = t.annotations) == null ? void 0 : s["pl7.app/label"]) ?? "Unlabelled";
532
+ var r;
533
+ return ((r = t.annotations) == null ? void 0 : r["pl7.app/label"]) ?? "Unlabelled";
534
534
  });
535
535
  }
536
536
  /**
@@ -540,13 +540,13 @@ class kt {
540
540
  return this.ctx.calculateOptions(t);
541
541
  }
542
542
  getOptions(t, n) {
543
- const s = this.getSpecs().entries.filter((r) => t(r.obj));
544
- return typeof n == "object" || typeof n > "u" ? Dt(s, (r) => r.obj, n ?? {}).map(({ value: { ref: r }, label: i }) => ({
545
- ref: r,
543
+ const r = this.getSpecs().entries.filter((s) => t(s.obj));
544
+ return typeof n == "object" || typeof n > "u" ? kt(r, (s) => s.obj, n ?? {}).map(({ value: { ref: s }, label: i }) => ({
545
+ ref: s,
546
546
  label: i
547
- })) : s.map((r) => ({
548
- ref: r.ref,
549
- label: n(r.obj, r.ref)
547
+ })) : r.map((s) => ({
548
+ ref: s.ref,
549
+ label: n(s.obj, s.ref)
550
550
  }));
551
551
  }
552
552
  /**
@@ -582,7 +582,7 @@ class kt {
582
582
  ref: n.ref,
583
583
  obj: {
584
584
  ...n.obj,
585
- data: dt(n.obj.data, (s) => new _(s))
585
+ data: ft(n.obj.data, (r) => new _(r))
586
586
  }
587
587
  }))
588
588
  };
@@ -603,10 +603,10 @@ class kt {
603
603
  getDataByRef(t) {
604
604
  var n;
605
605
  return typeof this.ctx.getDataFromResultPoolByRef > "u" ? (n = this.getData().entries.find(
606
- (s) => s.ref.blockId === t.blockId && s.ref.name === t.name
606
+ (r) => r.ref.blockId === t.blockId && r.ref.name === t.name
607
607
  )) == null ? void 0 : n.obj : L(
608
608
  this.ctx.getDataFromResultPoolByRef(t.blockId, t.name),
609
- (s) => new _(s)
609
+ (r) => new _(r)
610
610
  );
611
611
  }
612
612
  /**
@@ -617,7 +617,19 @@ class kt {
617
617
  getPColumnByRef(t) {
618
618
  const n = this.getDataByRef(t);
619
619
  if (n)
620
- return ft(n);
620
+ return ht(n);
621
+ }
622
+ /**
623
+ * Returns spec associated with the ref ensuring that it is a p-column spec.
624
+ * @param ref a Ref
625
+ * @returns p-column spec associated with the ref
626
+ */
627
+ getPColumnSpecByRef(t) {
628
+ const n = this.getSpecByRef(t);
629
+ if (n) {
630
+ if (!Y(n)) throw new Error(`not a PColumn spec (kind = ${n.kind})`);
631
+ return n;
632
+ }
621
633
  }
622
634
  /**
623
635
  * @param ref a Ref
@@ -626,7 +638,7 @@ class kt {
626
638
  getSpecByRef(t) {
627
639
  var n;
628
640
  return typeof this.ctx.getSpecFromResultPoolByRef > "u" ? (n = this.getSpecs().entries.find(
629
- (s) => s.ref.blockId === t.blockId && s.ref.name === t.name
641
+ (r) => r.ref.blockId === t.blockId && r.ref.name === t.name
630
642
  )) == null ? void 0 : n.obj : this.ctx.getSpecFromResultPoolByRef(t.blockId, t.name);
631
643
  }
632
644
  /**
@@ -636,17 +648,17 @@ class kt {
636
648
  */
637
649
  findDataWithCompatibleSpec(t) {
638
650
  const n = [];
639
- t: for (const s of this.getData().entries) {
640
- if (!ht(s.obj.spec))
651
+ t: for (const r of this.getData().entries) {
652
+ if (!Y(r.obj.spec))
641
653
  continue;
642
- const r = s.obj.spec;
643
- if (t.name === r.name && t.valueType === r.valueType && t.axesSpec.length === r.axesSpec.length && $(t.domain, r.domain)) {
654
+ const s = r.obj.spec;
655
+ if (t.name === s.name && t.valueType === s.valueType && t.axesSpec.length === s.axesSpec.length && $(t.domain, s.domain)) {
644
656
  for (let i = 0; i < t.axesSpec.length; ++i) {
645
- const o = t.axesSpec[i], l = r.axesSpec[i];
657
+ const o = t.axesSpec[i], l = s.axesSpec[i];
646
658
  if (o.name !== l.name || o.type !== l.type || !$(o.domain, l.domain))
647
659
  continue t;
648
660
  }
649
- n.push(s.obj);
661
+ n.push(r.obj);
650
662
  }
651
663
  }
652
664
  return n;
@@ -659,12 +671,12 @@ function $(e, t) {
659
671
  if (e[n] !== t[n]) return !1;
660
672
  return !0;
661
673
  }
662
- class D {
674
+ class k {
663
675
  constructor() {
664
676
  w(this, "ctx");
665
677
  w(this, "args");
666
678
  w(this, "uiState");
667
- w(this, "resultPool", new kt());
679
+ w(this, "resultPool", new Dt());
668
680
  this.ctx = u(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : void 0;
669
681
  }
670
682
  getNamedAccessor(t) {
@@ -672,7 +684,7 @@ class D {
672
684
  return n ? new _(n) : void 0;
673
685
  }
674
686
  get prerun() {
675
- return this.getNamedAccessor(rt);
687
+ return this.getNamedAccessor(it);
676
688
  }
677
689
  /**
678
690
  * @deprecated use prerun
@@ -687,7 +699,7 @@ class D {
687
699
  return this.precalc;
688
700
  }
689
701
  get outputs() {
690
- return this.getNamedAccessor(it);
702
+ return this.getNamedAccessor(ot);
691
703
  }
692
704
  /**
693
705
  * @deprecated use outputs
@@ -701,29 +713,29 @@ class D {
701
713
  */
702
714
  findLabels(t) {
703
715
  const n = this.resultPool.getData();
704
- for (const s of n.entries) {
705
- if (!H(s.obj)) continue;
706
- const r = s.obj.spec;
707
- if (r.name === "pl7.app/label" && r.axesSpec.length === 1 && r.axesSpec[0].name === t.name && r.axesSpec[0].type === t.type && $(t.domain, r.axesSpec[0].domain)) {
708
- if (s.obj.data.resourceType.name !== "PColumnData/Json")
709
- throw Error(`Expected JSON column for labels, got: ${s.obj.data.resourceType.name}`);
710
- return new Map(
716
+ for (const r of n.entries) {
717
+ if (!H(r.obj)) continue;
718
+ const s = r.obj.spec;
719
+ if (s.name === "pl7.app/label" && s.axesSpec.length === 1 && s.axesSpec[0].name === t.name && s.axesSpec[0].type === t.type && $(t.domain, s.axesSpec[0].domain)) {
720
+ if (r.obj.data.resourceType.name !== "PColumnData/Json")
721
+ throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
722
+ return Object.fromEntries(
711
723
  Object.entries(
712
- s.obj.data.getDataAsJson().data
724
+ r.obj.data.getDataAsJson().data
713
725
  ).map((o) => [JSON.parse(o[0])[0], o[1]])
714
726
  );
715
727
  }
716
728
  }
717
729
  }
718
730
  verifyInlineColumnsSupport(t) {
719
- var r;
720
- const n = t.some((i) => !(i.data instanceof _)), s = ((r = this.ctx.featureFlags) == null ? void 0 : r.inlineColumnsSupport) === !0;
721
- if (n && !s) throw Error("inline columns not supported");
731
+ var s;
732
+ const n = t.some((i) => !(i.data instanceof _)), r = ((s = this.ctx.featureFlags) == null ? void 0 : s.inlineColumnsSupport) === !0;
733
+ if (n && !r) throw Error("inline columns not supported");
722
734
  }
723
735
  createPFrame(t) {
724
736
  return this.verifyInlineColumnsSupport(t), this.ctx.createPFrame(t.map((n) => L(
725
737
  n,
726
- (s) => s instanceof _ ? s.handle : s
738
+ (r) => r instanceof _ ? r.handle : r
727
739
  )));
728
740
  }
729
741
  createPTable(t) {
@@ -731,13 +743,13 @@ class D {
731
743
  return "columns" in t ? n = {
732
744
  src: {
733
745
  type: "full",
734
- entries: t.columns.map((s) => ({ type: "column", column: s }))
746
+ entries: t.columns.map((r) => ({ type: "column", column: r }))
735
747
  },
736
748
  filters: t.filters ?? [],
737
749
  sorting: t.sorting ?? []
738
- } : n = t, this.verifyInlineColumnsSupport(gt(n.src)), this.ctx.createPTable(mt(n, (s) => L(
739
- s,
740
- (r) => r instanceof _ ? r.handle : r
750
+ } : n = t, this.verifyInlineColumnsSupport(gt(n.src)), this.ctx.createPTable(mt(n, (r) => L(
751
+ r,
752
+ (s) => s instanceof _ ? s.handle : s
741
753
  )));
742
754
  }
743
755
  /** @deprecated scheduled for removal from SDK */
@@ -749,15 +761,15 @@ class D {
749
761
  return this.ctx.getCurrentUnstableMarker();
750
762
  }
751
763
  }
752
- const F = "PColumnData/", K = F + "ResourceMap", G = F + "Partitioned/ResourceMap", Z = F + "JsonPartitioned", M = F + "BinaryPartitioned", at = F + "Partitioned/", tt = at + "JsonPartitioned", B = at + "BinaryPartitioned";
753
- function lt(e, t, n, s = [], r) {
764
+ const F = "PColumnData/", K = F + "ResourceMap", G = F + "Partitioned/ResourceMap", tt = F + "JsonPartitioned", B = F + "BinaryPartitioned", lt = F + "Partitioned/", et = lt + "JsonPartitioned", M = lt + "BinaryPartitioned";
765
+ function ut(e, t, n, r = [], s) {
754
766
  if (e === void 0) return !1;
755
767
  switch (e.resourceType.name) {
756
768
  case K: {
757
769
  let i = e.getInputsLocked();
758
770
  for (const o of e.listInputFields()) {
759
- const l = e.resolve({ field: o, assertFieldType: "Input" }), a = [...s, ...JSON.parse(o)], c = l === void 0 ? void 0 : t(l);
760
- c === void 0 && (i = !1), (c !== void 0 || r) && n.push({ key: a, value: c });
771
+ const l = e.resolve({ field: o, assertFieldType: "Input" }), a = [...r, ...JSON.parse(o)], c = l === void 0 ? void 0 : t(l);
772
+ c === void 0 && (i = !1), (c !== void 0 || s) && n.push({ key: a, value: c });
761
773
  }
762
774
  return i;
763
775
  }
@@ -767,12 +779,12 @@ function lt(e, t, n, s = [], r) {
767
779
  const l = e.resolve({ field: o, assertFieldType: "Input" });
768
780
  if (l === void 0) i = !1;
769
781
  else {
770
- const a = [...s, ...JSON.parse(o)], c = lt(
782
+ const a = [...r, ...JSON.parse(o)], c = ut(
771
783
  l,
772
784
  t,
773
785
  n,
774
786
  a,
775
- r
787
+ s
776
788
  );
777
789
  i = i && c;
778
790
  }
@@ -784,10 +796,10 @@ function lt(e, t, n, s = [], r) {
784
796
  }
785
797
  }
786
798
  function fe(e, t, n = !1) {
787
- const s = [];
788
- return { isComplete: lt(e, t, s, [], n), data: s };
799
+ const r = [];
800
+ return { isComplete: ut(e, t, r, [], n), data: r };
789
801
  }
790
- const et = (e) => {
802
+ const nt = (e) => {
791
803
  if (!e.endsWith(".index")) {
792
804
  if (e.endsWith(".values"))
793
805
  return e.substring(0, e.length - 7);
@@ -796,73 +808,73 @@ const et = (e) => {
796
808
  };
797
809
  function Lt(e) {
798
810
  if (!e) return;
799
- const t = e.resourceType.name, n = e.getDataAsJson(), s = [];
800
- let r = 0;
811
+ const t = e.resourceType.name, n = e.getDataAsJson(), r = [];
812
+ let s = 0;
801
813
  switch (t) {
802
814
  case K:
803
- r = n.keyLength;
815
+ s = n.keyLength;
804
816
  break;
805
817
  case G:
806
- r = n.partitionKeyLength + n.keyLength;
807
- break;
808
- case Z:
809
- case M:
810
- r = n.partitionKeyLength;
818
+ s = n.partitionKeyLength + n.keyLength;
811
819
  break;
812
- case B:
813
820
  case tt:
814
- r = n.superPartitionKeyLength + n.partitionKeyLength;
821
+ case B:
822
+ s = n.partitionKeyLength;
823
+ break;
824
+ case M:
825
+ case et:
826
+ s = n.superPartitionKeyLength + n.partitionKeyLength;
815
827
  break;
816
828
  }
817
829
  switch (t) {
818
830
  case K:
819
- case Z:
820
- case M:
831
+ case tt:
832
+ case B:
821
833
  for (let i of e.listInputFields()) {
822
- if (t === M) {
823
- const l = et(i);
834
+ if (t === B) {
835
+ const l = nt(i);
824
836
  if (l) i = l;
825
837
  else continue;
826
838
  }
827
839
  const o = [...JSON.parse(i)];
828
- s.push(o);
840
+ r.push(o);
829
841
  }
830
842
  break;
831
843
  case G:
832
- case B:
833
- case tt:
844
+ case M:
845
+ case et:
834
846
  for (const i of e.listInputFields()) {
835
847
  const o = [...JSON.parse(i)], l = e.resolve({ field: i, assertFieldType: "Input" });
836
848
  if (l !== void 0)
837
849
  for (let a of l.listInputFields()) {
838
- if (t === B) {
839
- const f = et(a);
850
+ if (t === M) {
851
+ const f = nt(a);
840
852
  if (f) a = f;
841
853
  else continue;
842
854
  }
843
855
  const c = [...o, ...JSON.parse(a)];
844
- s.push(c);
856
+ r.push(c);
845
857
  }
846
858
  }
847
859
  break;
848
860
  }
849
- return { data: s, keyLength: r };
861
+ return { data: r, keyLength: s };
850
862
  }
851
863
  function he(e) {
852
864
  const t = Lt(e);
853
865
  if (!t) return;
854
- const { data: n, keyLength: s } = t, r = [];
855
- for (let i = 0; i < s; ++i)
856
- r.push(/* @__PURE__ */ new Set());
866
+ const { data: n, keyLength: r } = t, s = [];
867
+ for (let i = 0; i < r; ++i)
868
+ s.push(/* @__PURE__ */ new Set());
857
869
  for (const i of n) {
858
- if (i.length !== s)
870
+ if (i.length !== r)
859
871
  throw new Error("key length does not match partition length");
860
- for (let o = 0; o < s; ++o)
861
- r[o].add(i[o]);
872
+ for (let o = 0; o < r; ++o)
873
+ s[o].add(i[o]);
862
874
  }
863
- return r.map((i) => Array.from(i.values()));
875
+ return s.map((i) => Array.from(i.values()));
864
876
  }
865
- const P = "1.19.0";
877
+ const P = "1.20.6";
866
878
  function xt(e) {
867
879
  return e.__renderLambda === !0;
868
880
  }
@@ -870,7 +882,7 @@ function U(e) {
870
882
  if (e !== void 0)
871
883
  return xt(e) ? e.handle : e;
872
884
  }
873
- function A(e) {
885
+ function C(e) {
874
886
  if (e !== void 0)
875
887
  return typeof e == "string" ? { __renderLambda: !0, handle: e, retentive: !1 } : e;
876
888
  }
@@ -879,8 +891,8 @@ function ge(e) {
879
891
  const {
880
892
  initialArgs: t,
881
893
  initialUiState: n,
882
- inputsValid: s,
883
- outputs: r,
894
+ inputsValid: r,
895
+ outputs: s,
884
896
  renderingMode: i,
885
897
  sdkVersion: o,
886
898
  sections: l,
@@ -889,8 +901,8 @@ function ge(e) {
889
901
  return {
890
902
  initialArgs: t,
891
903
  initialUiState: n,
892
- inputsValid: s,
893
- outputs: r,
904
+ inputsValid: r,
905
+ outputs: s,
894
906
  renderingMode: i,
895
907
  sdkVersion: o,
896
908
  sections: l,
@@ -898,8 +910,8 @@ function ge(e) {
898
910
  code: c
899
911
  };
900
912
  } else if (e.inputsValid !== void 0) {
901
- const { sdkVersion: t, renderingMode: n, outputs: s, inputsValid: r, sections: i, initialArgs: o, code: l } = e, a = Object.keys(e);
902
- if (t === void 0 || n === void 0 || s === void 0 || r === void 0 || i === void 0 || o === void 0)
913
+ const { sdkVersion: t, renderingMode: n, outputs: r, inputsValid: s, sections: i, initialArgs: o, code: l } = e, a = Object.keys(e);
914
+ if (t === void 0 || n === void 0 || r === void 0 || s === void 0 || i === void 0 || o === void 0)
903
915
  throw new Error(
904
916
  `Malformed config v2. SDK version ${t}; Fields = ${a.join(", ")}`
905
917
  );
@@ -908,28 +920,28 @@ function ge(e) {
908
920
  renderingMode: n,
909
921
  initialArgs: o,
910
922
  outputs: Object.fromEntries(
911
- Object.entries(s).map(([c, f]) => [c, A(f)])
923
+ Object.entries(r).map(([c, f]) => [c, C(f)])
912
924
  ),
913
- inputsValid: A(r),
914
- sections: A(i),
925
+ inputsValid: C(s),
926
+ sections: C(i),
915
927
  initialUiState: void 0,
916
928
  code: l
917
929
  };
918
930
  } else if (e.renderingMode !== void 0) {
919
- const { sdkVersion: t, canRun: n, renderingMode: s, outputs: r, sections: i, initialArgs: o, code: l } = e, a = Object.keys(e);
920
- if (s === void 0 || r === void 0 || n === void 0 || i === void 0 || o === void 0)
931
+ const { sdkVersion: t, canRun: n, renderingMode: r, outputs: s, sections: i, initialArgs: o, code: l } = e, a = Object.keys(e);
932
+ if (r === void 0 || s === void 0 || n === void 0 || i === void 0 || o === void 0)
921
933
  throw new Error(
922
934
  `Malformed config v1. SDK version ${t}; Fields = ${a.join(", ")}`
923
935
  );
924
936
  return {
925
937
  sdkVersion: t ?? "unknown",
926
- renderingMode: s,
938
+ renderingMode: r,
927
939
  initialArgs: o,
928
940
  outputs: Object.fromEntries(
929
- Object.entries(r).map(([c, f]) => [c, A(f)])
941
+ Object.entries(s).map(([c, f]) => [c, C(f)])
930
942
  ),
931
- inputsValid: A(n),
932
- sections: A(i),
943
+ inputsValid: C(n),
944
+ sections: C(i),
933
945
  initialUiState: void 0,
934
946
  code: l
935
947
  };
@@ -941,8 +953,8 @@ function ge(e) {
941
953
  }
942
954
  }
943
955
  class h {
944
- constructor(t, n, s, r, i, o, l) {
945
- this._renderingMode = t, this._initialArgs = n, this._initialUiState = s, this._outputs = r, this._inputsValid = i, this._sections = o, this._title = l;
956
+ constructor(t, n, r, s, i, o, l) {
957
+ this._renderingMode = t, this._initialArgs = n, this._initialUiState = r, this._outputs = s, this._inputsValid = i, this._sections = o, this._title = l;
946
958
  }
947
959
  static create(t = "Heavy") {
948
960
  return new h(
@@ -950,15 +962,15 @@ class h {
950
962
  void 0,
951
963
  {},
952
964
  {},
953
- k(!0),
954
- k([]),
965
+ D(!0),
966
+ D([]),
955
967
  void 0
956
968
  );
957
969
  }
958
- output(t, n, s = {}) {
970
+ output(t, n, r = {}) {
959
971
  if (typeof n == "function") {
960
- const r = `output#${t}`;
961
- return O(r, () => n(new D())), new h(
972
+ const s = `output#${t}`;
973
+ return O(s, () => n(new k())), new h(
962
974
  this._renderingMode,
963
975
  this._initialArgs,
964
976
  this._initialUiState,
@@ -966,8 +978,8 @@ class h {
966
978
  ...this._outputs,
967
979
  [t]: {
968
980
  __renderLambda: !0,
969
- handle: r,
970
- ...s
981
+ handle: s,
982
+ ...r
971
983
  }
972
984
  },
973
985
  this._inputsValid,
@@ -997,7 +1009,7 @@ class h {
997
1009
  return this.inputsValid(t);
998
1010
  }
999
1011
  argsValid(t) {
1000
- return typeof t == "function" ? (O("inputsValid", () => t(new D())), new h(
1012
+ return typeof t == "function" ? (O("inputsValid", () => t(new k())), new h(
1001
1013
  this._renderingMode,
1002
1014
  this._initialArgs,
1003
1015
  this._initialUiState,
@@ -1022,7 +1034,7 @@ class h {
1022
1034
  return this.argsValid(t);
1023
1035
  }
1024
1036
  sections(t) {
1025
- return Array.isArray(t) ? this.sections(k(t)) : typeof t == "function" ? (O("sections", () => t(new D())), new h(
1037
+ return Array.isArray(t) ? this.sections(D(t)) : typeof t == "function" ? (O("sections", () => t(new k())), new h(
1026
1038
  this._renderingMode,
1027
1039
  this._initialArgs,
1028
1040
  this._initialUiState,
@@ -1041,7 +1053,7 @@ class h {
1041
1053
  );
1042
1054
  }
1043
1055
  title(t) {
1044
- return O("title", () => t(new D())), new h(
1056
+ return O("title", () => t(new k())), new h(
1045
1057
  this._renderingMode,
1046
1058
  this._initialArgs,
1047
1059
  this._initialUiState,
@@ -1113,20 +1125,20 @@ class h {
1113
1125
  inputsValid: U(this._inputsValid),
1114
1126
  sections: U(this._sections),
1115
1127
  outputs: Object.fromEntries(
1116
- Object.entries(this._outputs).map(([n, s]) => [n, U(s)])
1128
+ Object.entries(this._outputs).map(([n, r]) => [n, U(r)])
1117
1129
  )
1118
1130
  };
1119
1131
  return vt() ? st({ sdkVersion: P }) : { config: t };
1120
1132
  }
1121
1133
  }
1122
- function me(e, t, n, s) {
1134
+ function me(e, t, n, r) {
1123
1135
  var o, l;
1124
- const r = e.resultPool.getData().entries.map((a) => a.obj).filter(H).filter((a) => a.spec.name === "pl7.app/label" && a.spec.axesSpec.length === 1), i = /* @__PURE__ */ new Map();
1136
+ const s = e.resultPool.getData().entries.map((a) => a.obj).filter(H).filter((a) => a.spec.name === "pl7.app/label" && a.spec.axesSpec.length === 1), i = /* @__PURE__ */ new Map();
1125
1137
  for (const a of t)
1126
1138
  for (const c of a.spec.axesSpec) {
1127
- const f = Y(c);
1128
- for (const S of r)
1129
- yt(f, Y(S.spec.axesSpec[0])) && i.set(S.id, S);
1139
+ const f = X(c);
1140
+ for (const S of s)
1141
+ yt(f, X(S.spec.axesSpec[0])) && i.set(S.id, S);
1130
1142
  }
1131
1143
  if (![...t, ...i.values()].some(
1132
1144
  (a) => a.data instanceof _ && !a.data.getIsReadyOrError()
@@ -1140,17 +1152,17 @@ function me(e, t, n, s) {
1140
1152
  },
1141
1153
  secondary: [...i.values()].map((a) => ({ type: "column", column: a }))
1142
1154
  },
1143
- filters: [...((o = n == null ? void 0 : n.pTableParams) == null ? void 0 : o.filters) ?? [], ...s ?? []],
1155
+ filters: [...((o = n == null ? void 0 : n.pTableParams) == null ? void 0 : o.filters) ?? [], ...r ?? []],
1144
1156
  sorting: ((l = n == null ? void 0 : n.pTableParams) == null ? void 0 : l.sorting) ?? []
1145
1157
  });
1146
1158
  }
1147
1159
  function ye(e, t, n) {
1148
- const s = e.findLabels(t);
1160
+ const r = e.findLabels(t);
1149
1161
  return {
1150
1162
  axis: t,
1151
- options: n.map((r) => ({
1152
- value: r,
1153
- label: (s == null ? void 0 : s.get(r)) ?? r.toString()
1163
+ options: n.map((s) => ({
1164
+ value: s,
1165
+ label: (r == null ? void 0 : r[s]) ?? s.toString()
1154
1166
  })),
1155
1167
  defaultValue: n[0]
1156
1168
  };
@@ -1176,14 +1188,14 @@ class be {
1176
1188
  }
1177
1189
  }
1178
1190
  function Et(e) {
1179
- return nt({
1191
+ return rt({
1180
1192
  __isRef: !0,
1181
1193
  blockId: x(e, "blockId"),
1182
1194
  name: x(e, "name")
1183
1195
  });
1184
1196
  }
1185
1197
  function _e(e) {
1186
- return nt({
1198
+ return rt({
1187
1199
  ref: Et(x(e, "ref")),
1188
1200
  label: x(e, "label")
1189
1201
  });
@@ -1210,14 +1222,14 @@ export {
1210
1222
  It as PAnnotationLabel,
1211
1223
  Pt as PAnnotationTrace,
1212
1224
  be as PFrameImpl,
1213
- M as RT_BINARY_PARTITIONED,
1214
- B as RT_BINARY_SUPER_PARTITIONED,
1215
- Z as RT_JSON_PARTITIONED,
1216
- tt as RT_JSON_SUPER_PARTITIONED,
1225
+ B as RT_BINARY_PARTITIONED,
1226
+ M as RT_BINARY_SUPER_PARTITIONED,
1227
+ tt as RT_JSON_PARTITIONED,
1228
+ et as RT_JSON_SUPER_PARTITIONED,
1217
1229
  K as RT_RESOURCE_MAP,
1218
1230
  G as RT_RESOURCE_MAP_PARTITIONED,
1219
- D as RenderCtx,
1220
- kt as ResultPool,
1231
+ k as RenderCtx,
1232
+ Dt as ResultPool,
1221
1233
  Kt as StagingOutputs,
1222
1234
  Ft as Trace,
1223
1235
  Rt as TraceEntry,
@@ -1226,19 +1238,19 @@ export {
1226
1238
  Qt as and,
1227
1239
  me as createPlDataTable,
1228
1240
  ye as createPlDataTableSheet,
1229
- Dt as deriveLabels,
1241
+ kt as deriveLabels,
1230
1242
  U as downgradeCfgOrLambda,
1231
1243
  ge as extractConfig,
1232
1244
  zt as flatten,
1233
1245
  _e as fromPlOption,
1234
1246
  Et as fromPlRef,
1235
- se as getBlobContent,
1247
+ re as getBlobContent,
1236
1248
  ie as getBlobContentAsJson,
1237
- re as getBlobContentAsString,
1249
+ se as getBlobContentAsString,
1238
1250
  oe as getDownloadedBlobContent,
1239
1251
  Se as getEnvironmentValue,
1240
1252
  R as getFromCfg,
1241
- k as getImmediate,
1253
+ D as getImmediate,
1242
1254
  le as getImportProgress,
1243
1255
  x as getJsonField,
1244
1256
  ue as getLastLogs,
@@ -1252,9 +1264,9 @@ export {
1252
1264
  he as getUniquePartitionKeys,
1253
1265
  xt as isConfigLambda,
1254
1266
  Yt as isEmpty,
1255
- Bt as isolate,
1267
+ Mt as isolate,
1256
1268
  Ht as makeArray,
1257
- nt as makeObject,
1269
+ rt as makeObject,
1258
1270
  qt as mapArrayValues,
1259
1271
  Wt as mapRecordValues,
1260
1272
  ne as mapResourceFields,
@@ -1262,6 +1274,6 @@ export {
1262
1274
  Zt as or,
1263
1275
  fe as parseResourceMap,
1264
1276
  _t as readOutput,
1265
- Mt as wrapOutputs
1277
+ Bt as wrapOutputs
1266
1278
  };
1267
1279
  //# sourceMappingURL=index.mjs.map