@milaboratories/pl-model-common 1.15.2 → 1.15.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
@@ -1,17 +1,23 @@
1
1
  var I = Object.defineProperty;
2
2
  var D = (n, e, t) => e in n ? I(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
3
  var l = (n, e, t) => D(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { z as d } from "zod";
4
5
  import y from "canonicalize";
5
- import { z as m } from "zod";
6
- function dn(n, e) {
6
+ const dn = d.object({
7
+ /** Included left border. */
8
+ from: d.number(),
9
+ /** Excluded right border. */
10
+ to: d.number()
11
+ });
12
+ function mn(n, e) {
7
13
  if (!(n == null || e == null))
8
14
  return { from: n, to: e };
9
15
  }
10
- function mn(n, e) {
16
+ function pn(n, e) {
11
17
  if (n.from < 0 || n.to < 0 || n.from >= n.to)
12
18
  throw new Error(`${e}: invalid bytes range: ${n}`);
13
19
  }
14
- function pn(n) {
20
+ function ln(n) {
15
21
  return n !== void 0 && n.startsWith("log+live://log/");
16
22
  }
17
23
  function w(n) {
@@ -37,10 +43,10 @@ function B(n) {
37
43
  function j(n) {
38
44
  return n.replace(/^.*[\\/]/, "");
39
45
  }
40
- function ln(n) {
46
+ function yn(n) {
41
47
  return j(B(n));
42
48
  }
43
- function yn(n) {
49
+ function hn(n) {
44
50
  if (!n || typeof n != "object")
45
51
  return !1;
46
52
  const e = n;
@@ -57,7 +63,7 @@ function yn(n) {
57
63
  return !1;
58
64
  }
59
65
  }
60
- function hn(n, e) {
66
+ function gn(n, e) {
61
67
  if (n !== void 0)
62
68
  switch (n.type) {
63
69
  case "Json":
@@ -102,10 +108,10 @@ function F(n) {
102
108
  return !1;
103
109
  }
104
110
  }
105
- function gn(n) {
111
+ function bn(n) {
106
112
  return F(n) ? n.type === "JsonPartitioned" || n.type === "BinaryPartitioned" : !1;
107
113
  }
108
- function bn(n) {
114
+ function wn(n) {
109
115
  switch (n.type) {
110
116
  case "Json": {
111
117
  const e = Object.entries(n.data).map(([t, r]) => ({ key: JSON.parse(t), value: r }));
@@ -133,7 +139,7 @@ function bn(n) {
133
139
  }
134
140
  }
135
141
  }
136
- function wn(n) {
142
+ function Pn(n) {
137
143
  switch (n.type) {
138
144
  case "Json": {
139
145
  const e = {};
@@ -167,7 +173,7 @@ function wn(n) {
167
173
  }
168
174
  }
169
175
  }
170
- function Pn(n, e) {
176
+ function xn(n, e) {
171
177
  if (n !== void 0)
172
178
  switch (n.type) {
173
179
  case "Json":
@@ -197,11 +203,11 @@ function Pn(n, e) {
197
203
  }
198
204
  }
199
205
  }
200
- const U = -2147483648, P = -9007199254740991n, xn = NaN, An = NaN, K = null, R = null;
206
+ const R = -2147483648, P = -9007199254740991n, An = NaN, kn = NaN, U = null, K = null;
201
207
  function g(n, e) {
202
208
  switch (e) {
203
209
  case "Int":
204
- return n === U;
210
+ return n === R;
205
211
  case "Long":
206
212
  return n === Number(P) || n === P;
207
213
  case "Float":
@@ -209,14 +215,14 @@ function g(n, e) {
209
215
  case "Double":
210
216
  return Number.isNaN(n);
211
217
  case "String":
212
- return n === K;
218
+ return n === U;
213
219
  case "Bytes":
214
- return n === R;
220
+ return n === K;
215
221
  default:
216
222
  throw Error(`unsupported data type: ${e}`);
217
223
  }
218
224
  }
219
- function kn(n) {
225
+ function Nn(n) {
220
226
  if (!v(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
221
227
  return n;
222
228
  }
@@ -262,7 +268,7 @@ function _(n, e) {
262
268
  throw Error(`unsupported data type: ${e}`);
263
269
  }
264
270
  }
265
- function Nn(n) {
271
+ function En(n) {
266
272
  if (n === null || typeof n == "string" || typeof n == "number") return n;
267
273
  if (typeof n == "bigint") return { bigint: n.toString() };
268
274
  throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`);
@@ -280,7 +286,7 @@ function M(n, e) {
280
286
  }
281
287
  throw new Error(`Unsupported type ${typeof n} (value ${n}).`);
282
288
  }
283
- function En(n) {
289
+ function Sn(n) {
284
290
  if (n = T(n), n === null) throw new Error("Value is null");
285
291
  return n;
286
292
  }
@@ -300,10 +306,10 @@ function H(n, e) {
300
306
  return (n[t] & r) > 0;
301
307
  }
302
308
  const q = { type: "absent" }, W = null;
303
- function Sn(n) {
309
+ function Cn(n) {
304
310
  return typeof n == "object" && n !== null && n.type === "absent";
305
311
  }
306
- function Cn(n, e, t = {}) {
312
+ function Jn(n, e, t = {}) {
307
313
  if (H(n.absent, e))
308
314
  return t.absent === void 0 ? q : t.absent;
309
315
  const r = n.data[e], o = n.type;
@@ -325,7 +331,7 @@ function Cn(n, e, t = {}) {
325
331
  throw Error(`unsupported data type: ${o}`);
326
332
  }
327
333
  }
328
- function Jn(n) {
334
+ function On(n) {
329
335
  return {
330
336
  kind: n.kind,
331
337
  valueType: n.valueType,
@@ -335,20 +341,20 @@ function Jn(n) {
335
341
  axesId: C(n.axesSpec)
336
342
  };
337
343
  }
338
- function On(n) {
344
+ function $n(n) {
339
345
  return {
340
346
  columnId: n.id,
341
347
  spec: n.spec
342
348
  };
343
349
  }
344
350
  function p(n) {
345
- const { type: e, name: t, domain: r } = n;
346
- return { type: e, name: t, ...r && { domain: r } };
351
+ const { type: e, name: t, domain: r } = n, o = { type: e, name: t };
352
+ return r && Object.entries(r).length > 0 && Object.assign(o, { domain: r }), o;
347
353
  }
348
354
  function C(n) {
349
355
  return n.map(p);
350
356
  }
351
- function $n(n) {
357
+ function In(n) {
352
358
  return y(p(n));
353
359
  }
354
360
  function z(n, e) {
@@ -361,7 +367,7 @@ function z(n, e) {
361
367
  function X(n, e) {
362
368
  return n.name === e.name && z(n.domain, e.domain);
363
369
  }
364
- function In(n, e) {
370
+ function Dn(n, e) {
365
371
  return { ...n, src: h(n.src, e) };
366
372
  }
367
373
  function h(n, e) {
@@ -399,7 +405,7 @@ function h(n, e) {
399
405
  function G(n) {
400
406
  return y(n);
401
407
  }
402
- function Dn(n) {
408
+ function Ln(n) {
403
409
  return JSON.parse(n);
404
410
  }
405
411
  function x(n) {
@@ -408,7 +414,7 @@ function x(n) {
408
414
  function A(n, e) {
409
415
  return JSON.stringify([n, e]);
410
416
  }
411
- class Ln {
417
+ class Vn {
412
418
  /**
413
419
  * Creates a new anchor context from a set of anchor column specifications
414
420
  * @param anchors Record of anchor column specifications indexed by anchor ID
@@ -457,9 +463,9 @@ class Ln {
457
463
  for (const a of this.domainPacks) {
458
464
  const i = [];
459
465
  for (const c of a) {
460
- const d = e.domain[c];
461
- if (d !== void 0)
462
- i.push([c, d]);
466
+ const m = e.domain[c];
467
+ if (m !== void 0)
468
+ i.push([c, m]);
463
469
  else
464
470
  break n;
465
471
  }
@@ -488,7 +494,7 @@ class Ln {
488
494
  throw new Error(`Axis index ${i} is out of bounds (0-${e.axesSpec.length - 1})`);
489
495
  s.push([i, u]);
490
496
  } else {
491
- const c = e.axesSpec.findIndex((d) => d.name === i);
497
+ const c = e.axesSpec.findIndex((m) => m.name === i);
492
498
  if (c === -1)
493
499
  throw new Error(`Axis with name "${i}" not found in the column specification`);
494
500
  s.push([c, u]);
@@ -509,7 +515,7 @@ class Ln {
509
515
  return G(this.derive(e, t));
510
516
  }
511
517
  }
512
- function Vn(n, e, t) {
518
+ function Bn(n, e, t) {
513
519
  const r = { ...e }, o = (t == null ? void 0 : t.ignoreMissingDomains) ?? !1;
514
520
  if (r.domainAnchor !== void 0) {
515
521
  const s = n[r.domainAnchor];
@@ -568,7 +574,7 @@ function Q(n, e) {
568
574
  function Y(n) {
569
575
  return typeof n == "object" && "anchor" in n;
570
576
  }
571
- function Bn(n) {
577
+ function jn(n) {
572
578
  return typeof n == "object" && n !== null && "source" in n && "axisFilters" in n;
573
579
  }
574
580
  function f(n) {
@@ -577,10 +583,10 @@ function f(n) {
577
583
  function Z(n) {
578
584
  return f(n.spec);
579
585
  }
580
- function jn(n) {
586
+ function Fn(n) {
581
587
  return f(n.obj);
582
588
  }
583
- function Fn(n) {
589
+ function Rn(n) {
584
590
  return f(n.obj.spec);
585
591
  }
586
592
  function Un(n) {
@@ -593,7 +599,7 @@ function Kn(n, e) {
593
599
  data: e(n.data)
594
600
  };
595
601
  }
596
- function Rn(n) {
602
+ function vn(n) {
597
603
  const e = /* @__PURE__ */ new Map(), t = (r) => {
598
604
  switch (r.type) {
599
605
  case "column":
@@ -717,28 +723,28 @@ function N(n, e) {
717
723
  }
718
724
  return !0;
719
725
  }
720
- function vn(n) {
726
+ function _n(n) {
721
727
  return Array.isArray(n) ? (e) => n.some((t) => f(e) && N(e, t)) : (e) => f(e) && N(e, n);
722
728
  }
723
- function _n(n) {
729
+ function Mn(n) {
724
730
  const e = {
725
731
  kind: n.kind,
726
732
  name: n.name
727
733
  };
728
734
  return n.domain !== void 0 && (e.domain = n.domain), f(n) && (e.axesSpec = C(n.axesSpec)), y(e);
729
735
  }
730
- const Mn = { href: "/" }, Tn = m.object({
731
- __isRef: m.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
732
- blockId: m.string().describe("Upstream block id"),
733
- name: m.string().describe("Name of the output provided to the upstream block's output context"),
734
- requireEnrichments: m.literal(!0).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")
736
+ const Tn = { href: "/" }, Hn = d.object({
737
+ __isRef: d.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
738
+ blockId: d.string().describe("Upstream block id"),
739
+ name: d.string().describe("Name of the output provided to the upstream block's output context"),
740
+ requireEnrichments: d.literal(!0).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")
735
741
  }).describe(
736
742
  "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."
737
743
  ).readonly();
738
- function Hn(n) {
744
+ function qn(n) {
739
745
  return typeof n == "object" && n !== null && "__isRef" in n && n.__isRef === !0 && "blockId" in n && "name" in n;
740
746
  }
741
- function qn(n, e, t = !1) {
747
+ function Wn(n, e, t = !1) {
742
748
  return t ? {
743
749
  __isRef: !0,
744
750
  blockId: n,
@@ -750,7 +756,7 @@ function qn(n, e, t = !1) {
750
756
  name: e
751
757
  };
752
758
  }
753
- function Wn(n, e = !0) {
759
+ function zn(n, e = !0) {
754
760
  if (e)
755
761
  return {
756
762
  ...n,
@@ -761,10 +767,10 @@ function Wn(n, e = !0) {
761
767
  return r;
762
768
  }
763
769
  }
764
- function zn(n, e, t = !1) {
770
+ function Xn(n, e, t = !1) {
765
771
  return n.blockId === e.blockId && n.name === e.name && (t || n.requireEnrichments === e.requireEnrichments);
766
772
  }
767
- function Xn(n, e) {
773
+ function Gn(n, e) {
768
774
  return n.ok ? { ok: !0, value: e(n.value) } : n;
769
775
  }
770
776
  function en(n) {
@@ -795,16 +801,16 @@ function J(n, e, t) {
795
801
  }
796
802
  const s = t.padding !== void 0 ? t.padding : o, a = en(n);
797
803
  let i = 0, u = 0, c = "";
798
- for (let d = 0; d < a.byteLength; d++)
799
- for (u = u << 8 | a.getUint8(d), i += 8; i >= 5; )
804
+ for (let m = 0; m < a.byteLength; m++)
805
+ for (u = u << 8 | a.getUint8(m), i += 8; i >= 5; )
800
806
  c += r[u >>> i - 5 & 31], i -= 5;
801
807
  if (i > 0 && (c += r[u << 5 - i & 31]), s)
802
808
  for (; c.length % 8 !== 0; )
803
809
  c += "=";
804
810
  return c;
805
811
  }
806
- const O = 15, sn = 24, $ = m.string().length(sn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
807
- function Gn() {
812
+ const O = 15, sn = 24, $ = d.string().length(sn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
813
+ function Qn() {
808
814
  const n = new Uint8Array(O);
809
815
  return crypto.getRandomValues(n), $.parse(J(n, "RFC4648"));
810
816
  }
@@ -812,93 +818,94 @@ function an(n) {
812
818
  if (n.length !== O) throw new Error(`Wrong number of bytes: ${n.length}`);
813
819
  return $.parse(J(n, "RFC4648"));
814
820
  }
815
- async function Qn(n) {
821
+ async function Yn(n) {
816
822
  const e = new TextEncoder(), t = await crypto.subtle.digest("SHA-256", e.encode(n));
817
823
  return an(new Uint8Array(t.slice(0, 15)));
818
824
  }
819
- function Yn(n) {
825
+ function Zn(n) {
820
826
  return JSON.stringify(n);
821
827
  }
822
- function Zn(n) {
828
+ function ne(n) {
823
829
  return y(n);
824
830
  }
825
- function ne(n) {
831
+ function ee(n) {
826
832
  return JSON.parse(n);
827
833
  }
828
834
  export {
829
- Ln as AnchoredIdDeriver,
830
- Mn as DefaultNavigationState,
835
+ Vn as AnchoredIdDeriver,
836
+ Tn as DefaultNavigationState,
831
837
  q as PTableAbsent,
832
838
  W as PTableNA,
833
- R as PValueBytesNA,
834
- An as PValueDoubleNA,
835
- xn as PValueFloatNA,
836
- U as PValueIntNA,
839
+ K as PValueBytesNA,
840
+ kn as PValueDoubleNA,
841
+ An as PValueFloatNA,
842
+ R as PValueIntNA,
837
843
  P as PValueLongNA,
838
- K as PValueStringNA,
844
+ U as PValueStringNA,
839
845
  $ as PlId,
840
846
  O as PlIdBytes,
841
847
  sn as PlIdLength,
842
- Tn as PlRef,
843
- $n as canonicalizeAxisId,
844
- Zn as canonicalizeJson,
845
- qn as createPlRef,
846
- bn as dataInfoToEntries,
847
- _n as deriveNativeId,
848
- Qn as digestPlId,
849
- kn as ensureNotNAPValue,
848
+ Hn as PlRef,
849
+ dn as RangeBytes,
850
+ In as canonicalizeAxisId,
851
+ ne as canonicalizeJson,
852
+ Wn as createPlRef,
853
+ wn as dataInfoToEntries,
854
+ Mn as deriveNativeId,
855
+ Yn as digestPlId,
856
+ Nn as ensureNotNAPValue,
850
857
  Un as ensurePColumn,
851
- wn as entriesToDataInfo,
858
+ Pn as entriesToDataInfo,
852
859
  b as executePSpecPredicate,
853
- Rn as extractAllColumns,
860
+ vn as extractAllColumns,
854
861
  C as getAxesId,
855
862
  p as getAxisId,
856
- On as getColumnIdAndSpec,
857
- ln as getFileNameFromHandle,
863
+ $n as getColumnIdAndSpec,
864
+ yn as getFileNameFromHandle,
858
865
  B as getFilePathFromHandle,
859
- Jn as getPColumnSpecId,
860
- yn as isDataInfo,
866
+ On as getPColumnSpecId,
867
+ hn as isDataInfo,
861
868
  F as isDataInfoEntries,
862
- Bn as isFilteredPColumn,
869
+ jn as isFilteredPColumn,
863
870
  V as isImportFileHandleIndex,
864
871
  L as isImportFileHandleUpload,
865
- pn as isLiveLog,
872
+ ln as isLiveLog,
866
873
  v as isNotNAPValue,
867
874
  Z as isPColumn,
868
- Fn as isPColumnResult,
875
+ Rn as isPColumnResult,
869
876
  f as isPColumnSpec,
870
- jn as isPColumnSpecResult,
871
- Sn as isPTableAbsent,
877
+ Fn as isPColumnSpecResult,
878
+ Cn as isPTableAbsent,
872
879
  _ as isPValue,
873
- gn as isPartitionedDataInfoEntries,
874
- Hn as isPlRef,
880
+ bn as isPartitionedDataInfoEntries,
881
+ qn as isPlRef,
875
882
  H as isValueAbsent,
876
883
  g as isValueNA,
877
- hn as mapDataInfo,
878
- Pn as mapDataInfoEntries,
884
+ gn as mapDataInfo,
885
+ xn as mapDataInfoEntries,
879
886
  h as mapJoinEntry,
880
887
  Kn as mapPObjectData,
881
- In as mapPTableDef,
882
- Xn as mapValueInVOE,
888
+ Dn as mapPTableDef,
889
+ Gn as mapValueInVOE,
883
890
  k as matchAxis,
884
891
  X as matchAxisId,
885
892
  N as matchPColumn,
886
- dn as newRangeBytesOpt,
887
- Cn as pTableValue,
888
- En as pValueToStringOrNumber,
893
+ mn as newRangeBytesOpt,
894
+ Jn as pTableValue,
895
+ Sn as pValueToStringOrNumber,
889
896
  T as pValueToStringOrNumberOrNull,
890
- Dn as parseColumnId,
891
- ne as parseJson,
897
+ Ln as parseColumnId,
898
+ ee as parseJson,
892
899
  an as plId,
893
- zn as plRefsEqual,
894
- Vn as resolveAnchors,
900
+ Xn as plRefsEqual,
901
+ Bn as resolveAnchors,
895
902
  M as safeConvertToPValue,
896
- vn as selectorsToPredicate,
903
+ _n as selectorsToPredicate,
897
904
  G as stringifyColumnId,
898
- Yn as stringifyJson,
899
- Nn as toJsonSafePValue,
900
- Gn as uniquePlId,
901
- mn as validateRangeBytes,
902
- Wn as withEnrichments
905
+ Zn as stringifyJson,
906
+ En as toJsonSafePValue,
907
+ Qn as uniquePlId,
908
+ pn as validateRangeBytes,
909
+ zn as withEnrichments
903
910
  };
904
911
  //# sourceMappingURL=index.mjs.map