@milaboratories/pl-model-common 1.13.3 → 1.13.4

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
@@ -3,7 +3,7 @@ var L = (n, t, e) => t in n ? $(n, t, { enumerable: !0, configurable: !0, writab
3
3
  var p = (n, t, e) => L(n, typeof t != "symbol" ? t + "" : t, e);
4
4
  import g from "canonicalize";
5
5
  import { z as m } from "zod";
6
- function cn(n) {
6
+ function fn(n) {
7
7
  return n !== void 0 && n.startsWith("log+live://log/");
8
8
  }
9
9
  function w(n) {
@@ -26,13 +26,13 @@ function I(n) {
26
26
  }
27
27
  w(n);
28
28
  }
29
- function j(n) {
29
+ function B(n) {
30
30
  return n.replace(/^.*[\\/]/, "");
31
31
  }
32
- function fn(n) {
33
- return j(I(n));
34
- }
35
32
  function dn(n) {
33
+ return B(I(n));
34
+ }
35
+ function pn(n) {
36
36
  if (!n || typeof n != "object")
37
37
  return !1;
38
38
  const t = n;
@@ -49,7 +49,7 @@ function dn(n) {
49
49
  return !1;
50
50
  }
51
51
  }
52
- function pn(n, t) {
52
+ function mn(n, t) {
53
53
  if (n !== void 0)
54
54
  switch (n.type) {
55
55
  case "Json":
@@ -77,7 +77,7 @@ function pn(n, t) {
77
77
  }
78
78
  }
79
79
  }
80
- function mn(n) {
80
+ function j(n) {
81
81
  if (!n || typeof n != "object")
82
82
  return !1;
83
83
  const t = n;
@@ -95,6 +95,9 @@ function mn(n) {
95
95
  }
96
96
  }
97
97
  function yn(n) {
98
+ return j(n) ? n.type === "JsonPartitioned" || n.type === "BinaryPartitioned" : !1;
99
+ }
100
+ function ln(n) {
98
101
  switch (n.type) {
99
102
  case "Json": {
100
103
  const t = Object.entries(n.data).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
@@ -122,7 +125,7 @@ function yn(n) {
122
125
  }
123
126
  }
124
127
  }
125
- function ln(n) {
128
+ function hn(n) {
126
129
  switch (n.type) {
127
130
  case "Json": {
128
131
  const t = {};
@@ -156,7 +159,7 @@ function ln(n) {
156
159
  }
157
160
  }
158
161
  }
159
- function hn(n, t) {
162
+ function bn(n, t) {
160
163
  if (n !== void 0)
161
164
  switch (n.type) {
162
165
  case "Json":
@@ -186,30 +189,30 @@ function hn(n, t) {
186
189
  }
187
190
  }
188
191
  }
189
- const B = -2147483648, A = -9007199254740991n, bn = NaN, gn = NaN, F = null, U = null;
192
+ const F = -2147483648, P = -9007199254740991n, gn = NaN, wn = NaN, U = null, K = null;
190
193
  function h(n, t) {
191
194
  switch (t) {
192
195
  case "Int":
193
- return n === B;
196
+ return n === F;
194
197
  case "Long":
195
- return n === Number(A) || n === A;
198
+ return n === Number(P) || n === P;
196
199
  case "Float":
197
200
  return Number.isNaN(n);
198
201
  case "Double":
199
202
  return Number.isNaN(n);
200
203
  case "String":
201
- return n === F;
202
- case "Bytes":
203
204
  return n === U;
205
+ case "Bytes":
206
+ return n === K;
204
207
  default:
205
208
  throw Error(`unsupported data type: ${t}`);
206
209
  }
207
210
  }
208
- function wn(n) {
209
- if (!K(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
211
+ function Pn(n) {
212
+ if (!R(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
210
213
  return n;
211
214
  }
212
- function K(n, t) {
215
+ function R(n, t) {
213
216
  if (!t)
214
217
  return typeof n == "string" || typeof n == "number" && isFinite(n) || typeof n == "bigint";
215
218
  if (h(n, t)) return !1;
@@ -230,7 +233,7 @@ function K(n, t) {
230
233
  throw Error(`unsupported data type: ${t}`);
231
234
  }
232
235
  }
233
- function R(n, t) {
236
+ function M(n, t) {
234
237
  if (!t)
235
238
  return n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint";
236
239
  if (h(n, t)) return !0;
@@ -256,9 +259,9 @@ function An(n) {
256
259
  if (typeof n == "bigint") return { bigint: n.toString() };
257
260
  throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`);
258
261
  }
259
- function M(n, t) {
262
+ function _(n, t) {
260
263
  if (n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint") {
261
- if (t && !h(n, t) && !R(n, t))
264
+ if (t && !h(n, t) && !M(n, t))
262
265
  throw new Error(`Unexpected value type, got ${typeof n}, expected ${t}`);
263
266
  return n;
264
267
  }
@@ -269,12 +272,12 @@ function M(n, t) {
269
272
  }
270
273
  throw new Error(`Unsupported type ${typeof n} (value ${n}).`);
271
274
  }
272
- function Pn(n) {
273
- if (n = _(n), n === null) throw new Error("Value is null");
275
+ function xn(n) {
276
+ if (n = H(n), n === null) throw new Error("Value is null");
274
277
  return n;
275
278
  }
276
- function _(n) {
277
- if (n = M(n), n === null) return null;
279
+ function H(n) {
280
+ if (n = _(n), n === null) return null;
278
281
  if (typeof n == "string") return n;
279
282
  if (typeof n == "number") {
280
283
  if (!isFinite(n)) throw new Error(`Value is not finite (${n})`);
@@ -284,19 +287,19 @@ function _(n) {
284
287
  return Number(n);
285
288
  throw new Error(`Unexpected value type: ${typeof n}`);
286
289
  }
287
- function v(n, t) {
290
+ function T(n, t) {
288
291
  const e = Math.floor(t / 8), r = 1 << 7 - t % 8;
289
292
  return (n[e] & r) > 0;
290
293
  }
291
- const H = { type: "absent" }, T = null;
292
- function xn(n) {
294
+ const v = { type: "absent" }, W = null;
295
+ function kn(n) {
293
296
  return typeof n == "object" && n !== null && n.type === "absent";
294
297
  }
295
- function kn(n, t, e = {}) {
296
- if (v(n.absent, t))
297
- return e.absent === void 0 ? H : e.absent;
298
+ function Nn(n, t, e = {}) {
299
+ if (T(n.absent, t))
300
+ return e.absent === void 0 ? v : e.absent;
298
301
  const r = n.data[t], o = n.type;
299
- if (h(r, o)) return e.na === void 0 ? T : e.na;
302
+ if (h(r, o)) return e.na === void 0 ? W : e.na;
300
303
  switch (o) {
301
304
  case "Int":
302
305
  return r;
@@ -318,23 +321,23 @@ function y(n) {
318
321
  const { type: t, name: e, domain: r } = n;
319
322
  return { type: t, name: e, ...r && { domain: r } };
320
323
  }
321
- function Nn(n) {
324
+ function Sn(n) {
322
325
  return n.map(y);
323
326
  }
324
- function Sn(n) {
327
+ function En(n) {
325
328
  return g(y(n));
326
329
  }
327
- function W(n, t) {
330
+ function X(n, t) {
328
331
  if (n === void 0) return t === void 0;
329
332
  if (t === void 0) return !0;
330
333
  for (const e in t)
331
334
  if (n[e] !== t[e]) return !1;
332
335
  return !0;
333
336
  }
334
- function X(n, t) {
335
- return n.name === t.name && W(n.domain, t.domain);
337
+ function z(n, t) {
338
+ return n.name === t.name && X(n.domain, t.domain);
336
339
  }
337
- function En(n, t) {
340
+ function Cn(n, t) {
338
341
  return { ...n, src: l(n.src, t) };
339
342
  }
340
343
  function l(n, t) {
@@ -367,13 +370,13 @@ function l(n, t) {
367
370
  w(n);
368
371
  }
369
372
  }
370
- function z(n) {
373
+ function G(n) {
371
374
  return g(n);
372
375
  }
373
- function Cn(n) {
376
+ function Jn(n) {
374
377
  return JSON.parse(n);
375
378
  }
376
- function P(n) {
379
+ function A(n) {
377
380
  return g(y(n));
378
381
  }
379
382
  function x(n, t) {
@@ -401,7 +404,7 @@ class On {
401
404
  e.sort((r, o) => r[0].localeCompare(o[0]));
402
405
  for (const [r, o] of e) {
403
406
  for (let i = 0; i < o.axesSpec.length; i++) {
404
- const a = o.axesSpec[i], s = P(a);
407
+ const a = o.axesSpec[i], s = A(a);
405
408
  this.axes.set(s, { anchor: r, idx: i });
406
409
  }
407
410
  if (o.domain !== void 0) {
@@ -447,7 +450,7 @@ class On {
447
450
  r.domain ?? (r.domain = {}), r.domain[a] = c ? { anchor: c } : s;
448
451
  }
449
452
  if (r.axes = t.axesSpec.map((a) => {
450
- const s = P(a);
453
+ const s = A(a);
451
454
  return this.axes.get(s) ?? a;
452
455
  }), !e || e.length === 0)
453
456
  return r;
@@ -477,10 +480,10 @@ class On {
477
480
  * @returns A canonicalized string representation of the anchored column identifier
478
481
  */
479
482
  deriveS(t, e) {
480
- return z(this.derive(t, e));
483
+ return G(this.derive(t, e));
481
484
  }
482
485
  }
483
- function Jn(n, t) {
486
+ function $n(n, t) {
484
487
  const e = { ...t };
485
488
  if (e.domainAnchor !== void 0) {
486
489
  const r = n[e.domainAnchor];
@@ -504,10 +507,10 @@ function Jn(n, t) {
504
507
  }
505
508
  e.domain = r;
506
509
  }
507
- return e.axes && (e.axes = e.axes.map((r) => G(n, r))), e;
510
+ return e.axes && (e.axes = e.axes.map((r) => Q(n, r))), e;
508
511
  }
509
- function G(n, t) {
510
- if (!Q(t))
512
+ function Q(n, t) {
513
+ if (!Y(t))
511
514
  return t;
512
515
  const e = t.anchor, r = n[e];
513
516
  if (!r)
@@ -524,7 +527,7 @@ function G(n, t) {
524
527
  throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
525
528
  return o[0];
526
529
  } else if ("id" in t) {
527
- const o = r.axesSpec.filter((i) => X(t.id, y(i)));
530
+ const o = r.axesSpec.filter((i) => z(t.id, y(i)));
528
531
  if (o.length > 1)
529
532
  throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
530
533
  if (o.length === 0)
@@ -533,29 +536,29 @@ function G(n, t) {
533
536
  }
534
537
  throw new Error("Unsupported axis reference type");
535
538
  }
536
- function Q(n) {
539
+ function Y(n) {
537
540
  return typeof n == "object" && "anchor" in n;
538
541
  }
539
- function $n(n) {
542
+ function Ln(n) {
540
543
  return typeof n == "object" && n !== null && "source" in n && "axisFilters" in n;
541
544
  }
542
545
  function f(n) {
543
546
  return n.kind === "PColumn";
544
547
  }
545
- function Y(n) {
548
+ function Z(n) {
546
549
  return f(n.spec);
547
550
  }
548
- function Ln(n) {
551
+ function Vn(n) {
549
552
  return f(n.obj);
550
553
  }
551
- function Vn(n) {
554
+ function Dn(n) {
552
555
  return f(n.obj.spec);
553
556
  }
554
- function Dn(n) {
555
- if (!Y(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
557
+ function In(n) {
558
+ if (!Z(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
556
559
  return n;
557
560
  }
558
- function In(n, t) {
561
+ function Bn(n, t) {
559
562
  return n === void 0 ? void 0 : {
560
563
  ...n,
561
564
  data: t(n.data)
@@ -584,7 +587,7 @@ function jn(n) {
584
587
  };
585
588
  return e(n), [...t.values()];
586
589
  }
587
- function Z(n) {
590
+ function q(n) {
588
591
  throw new Error("Unexpected object: " + n);
589
592
  }
590
593
  function b(n, t) {
@@ -616,7 +619,7 @@ function b(n, t) {
616
619
  )
617
620
  );
618
621
  default:
619
- Z(n);
622
+ q(n);
620
623
  }
621
624
  }
622
625
  function k(n, t) {
@@ -683,26 +686,26 @@ function N(n, t) {
683
686
  }
684
687
  return !0;
685
688
  }
686
- function Bn(n) {
689
+ function Fn(n) {
687
690
  return Array.isArray(n) ? (t) => n.some((e) => f(t) && N(t, e)) : (t) => f(t) && N(t, n);
688
691
  }
689
- const Fn = { href: "/" }, Un = m.object({
692
+ const Un = { href: "/" }, Kn = m.object({
690
693
  __isRef: m.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
691
694
  blockId: m.string().describe("Upstream block id"),
692
695
  name: m.string().describe("Name of the output provided to the upstream block's output context")
693
696
  }).describe(
694
697
  "Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees."
695
698
  ).strict().readonly();
696
- function Kn(n) {
699
+ function Rn(n) {
697
700
  return typeof n == "object" && n !== null && "__isRef" in n && n.__isRef === !0 && "blockId" in n && "name" in n;
698
701
  }
699
- function Rn(n, t) {
702
+ function Mn(n, t) {
700
703
  return n.blockId === t.blockId && n.name === t.name;
701
704
  }
702
- function Mn(n, t) {
705
+ function _n(n, t) {
703
706
  return n.ok ? { ok: !0, value: t(n.value) } : n;
704
707
  }
705
- function q(n) {
708
+ function nn(n) {
706
709
  if (n instanceof Int8Array || n instanceof Uint8Array || n instanceof Uint8ClampedArray)
707
710
  return new DataView(n.buffer, n.byteOffset, n.byteLength);
708
711
  if (n instanceof ArrayBuffer) return new DataView(n);
@@ -710,25 +713,25 @@ function q(n) {
710
713
  "Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray"
711
714
  );
712
715
  }
713
- const nn = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", tn = "0123456789ABCDEFGHIJKLMNOPQRSTUV", en = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
716
+ const tn = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", en = "0123456789ABCDEFGHIJKLMNOPQRSTUV", rn = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
714
717
  function C(n, t, e) {
715
718
  e = e || {};
716
719
  let r, o;
717
720
  switch (t) {
718
721
  case "RFC3548":
719
722
  case "RFC4648":
720
- r = nn, o = !0;
723
+ r = tn, o = !0;
721
724
  break;
722
725
  case "RFC4648-HEX":
723
- r = tn, o = !0;
726
+ r = en, o = !0;
724
727
  break;
725
728
  case "Crockford":
726
- r = en, o = !1;
729
+ r = rn, o = !1;
727
730
  break;
728
731
  default:
729
732
  throw new Error("Unknown base32 variant: " + String(t));
730
733
  }
731
- const i = e.padding !== void 0 ? e.padding : o, a = q(n);
734
+ const i = e.padding !== void 0 ? e.padding : o, a = nn(n);
732
735
  let s = 0, u = 0, c = "";
733
736
  for (let d = 0; d < a.byteLength; d++)
734
737
  for (u = u << 8 | a.getUint8(d), s += 8; s >= 5; )
@@ -738,82 +741,83 @@ function C(n, t, e) {
738
741
  c += "=";
739
742
  return c;
740
743
  }
741
- const O = 15, rn = 24, J = m.string().length(rn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
742
- function _n() {
743
- const n = new Uint8Array(O);
744
- return crypto.getRandomValues(n), J.parse(C(n, "RFC4648"));
744
+ const J = 15, on = 24, O = m.string().length(on).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
745
+ function Hn() {
746
+ const n = new Uint8Array(J);
747
+ return crypto.getRandomValues(n), O.parse(C(n, "RFC4648"));
745
748
  }
746
- function on(n) {
747
- if (n.length !== O) throw new Error(`Wrong number of bytes: ${n.length}`);
748
- return J.parse(C(n, "RFC4648"));
749
+ function sn(n) {
750
+ if (n.length !== J) throw new Error(`Wrong number of bytes: ${n.length}`);
751
+ return O.parse(C(n, "RFC4648"));
749
752
  }
750
- async function vn(n) {
753
+ async function Tn(n) {
751
754
  const t = new TextEncoder(), e = await crypto.subtle.digest("SHA-256", t.encode(n));
752
- return on(new Uint8Array(e.slice(0, 15)));
755
+ return sn(new Uint8Array(e.slice(0, 15)));
753
756
  }
754
757
  export {
755
758
  On as AnchoredIdDeriver,
756
- Fn as DefaultNavigationState,
757
- H as PTableAbsent,
758
- T as PTableNA,
759
- U as PValueBytesNA,
760
- gn as PValueDoubleNA,
761
- bn as PValueFloatNA,
762
- B as PValueIntNA,
763
- A as PValueLongNA,
764
- F as PValueStringNA,
765
- J as PlId,
766
- O as PlIdBytes,
767
- rn as PlIdLength,
768
- Un as PlRef,
769
- Sn as canonicalizeAxisId,
770
- yn as dataInfoToEntries,
771
- vn as digestPlId,
772
- wn as ensureNotNAPValue,
773
- Dn as ensurePColumn,
774
- ln as entriesToDataInfo,
759
+ Un as DefaultNavigationState,
760
+ v as PTableAbsent,
761
+ W as PTableNA,
762
+ K as PValueBytesNA,
763
+ wn as PValueDoubleNA,
764
+ gn as PValueFloatNA,
765
+ F as PValueIntNA,
766
+ P as PValueLongNA,
767
+ U as PValueStringNA,
768
+ O as PlId,
769
+ J as PlIdBytes,
770
+ on as PlIdLength,
771
+ Kn as PlRef,
772
+ En as canonicalizeAxisId,
773
+ ln as dataInfoToEntries,
774
+ Tn as digestPlId,
775
+ Pn as ensureNotNAPValue,
776
+ In as ensurePColumn,
777
+ hn as entriesToDataInfo,
775
778
  b as executePSpecPredicate,
776
779
  jn as extractAllColumns,
777
- Nn as getAxesId,
780
+ Sn as getAxesId,
778
781
  y as getAxisId,
779
- fn as getFileNameFromHandle,
782
+ dn as getFileNameFromHandle,
780
783
  I as getFilePathFromHandle,
781
- dn as isDataInfo,
782
- mn as isDataInfoEntries,
783
- $n as isFilteredPColumn,
784
+ pn as isDataInfo,
785
+ j as isDataInfoEntries,
786
+ Ln as isFilteredPColumn,
784
787
  D as isImportFileHandleIndex,
785
788
  V as isImportFileHandleUpload,
786
- cn as isLiveLog,
787
- K as isNotNAPValue,
788
- Y as isPColumn,
789
- Vn as isPColumnResult,
789
+ fn as isLiveLog,
790
+ R as isNotNAPValue,
791
+ Z as isPColumn,
792
+ Dn as isPColumnResult,
790
793
  f as isPColumnSpec,
791
- Ln as isPColumnSpecResult,
792
- xn as isPTableAbsent,
793
- R as isPValue,
794
- Kn as isPlRef,
795
- v as isValueAbsent,
794
+ Vn as isPColumnSpecResult,
795
+ kn as isPTableAbsent,
796
+ M as isPValue,
797
+ yn as isPartitionedDataInfoEntries,
798
+ Rn as isPlRef,
799
+ T as isValueAbsent,
796
800
  h as isValueNA,
797
- pn as mapDataInfo,
798
- hn as mapDataInfoEntries,
801
+ mn as mapDataInfo,
802
+ bn as mapDataInfoEntries,
799
803
  l as mapJoinEntry,
800
- In as mapPObjectData,
801
- En as mapPTableDef,
802
- Mn as mapValueInVOE,
804
+ Bn as mapPObjectData,
805
+ Cn as mapPTableDef,
806
+ _n as mapValueInVOE,
803
807
  k as matchAxis,
804
- X as matchAxisId,
808
+ z as matchAxisId,
805
809
  N as matchPColumn,
806
- kn as pTableValue,
807
- Pn as pValueToStringOrNumber,
808
- _ as pValueToStringOrNumberOrNull,
809
- Cn as parseColumnId,
810
- on as plId,
811
- Rn as plRefsEqual,
812
- Jn as resolveAnchors,
813
- M as safeConvertToPValue,
814
- Bn as selectorsToPredicate,
815
- z as stringifyColumnId,
810
+ Nn as pTableValue,
811
+ xn as pValueToStringOrNumber,
812
+ H as pValueToStringOrNumberOrNull,
813
+ Jn as parseColumnId,
814
+ sn as plId,
815
+ Mn as plRefsEqual,
816
+ $n as resolveAnchors,
817
+ _ as safeConvertToPValue,
818
+ Fn as selectorsToPredicate,
819
+ G as stringifyColumnId,
816
820
  An as toJsonSafePValue,
817
- _n as uniquePlId
821
+ Hn as uniquePlId
818
822
  };
819
823
  //# sourceMappingURL=index.mjs.map