@milaboratories/pl-model-common 1.15.0 → 1.15.1

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,27 +1,35 @@
1
- var $ = Object.defineProperty;
2
- var D = (n, e, t) => e in n ? $(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
1
+ var I = Object.defineProperty;
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
4
  import y from "canonicalize";
5
5
  import { z as m } from "zod";
6
- function dn(n) {
6
+ function dn(n, e) {
7
+ if (!(n == null || e == null))
8
+ return { from: n, to: e };
9
+ }
10
+ function mn(n, e) {
11
+ if (n.from < 0 || n.to < 0 || n.from >= n.to)
12
+ throw new Error(`${e}: invalid bytes range: ${n}`);
13
+ }
14
+ function pn(n) {
7
15
  return n !== void 0 && n.startsWith("log+live://log/");
8
16
  }
9
17
  function w(n) {
10
18
  throw new Error("Unexpected object: " + n);
11
19
  }
12
- const S = "upload://upload/", E = "index://index/";
20
+ const E = "upload://upload/", S = "index://index/";
13
21
  function L(n) {
14
- return n.startsWith(S);
22
+ return n.startsWith(E);
15
23
  }
16
24
  function V(n) {
17
- return n.startsWith(E);
25
+ return n.startsWith(S);
18
26
  }
19
27
  function B(n) {
20
28
  if (V(n)) {
21
- const e = n.slice(E.length);
29
+ const e = n.slice(S.length);
22
30
  return JSON.parse(decodeURIComponent(e)).path;
23
31
  } else if (L(n)) {
24
- const e = n.slice(S.length);
32
+ const e = n.slice(E.length);
25
33
  return JSON.parse(decodeURIComponent(e)).localPath;
26
34
  }
27
35
  w(n);
@@ -29,10 +37,10 @@ function B(n) {
29
37
  function j(n) {
30
38
  return n.replace(/^.*[\\/]/, "");
31
39
  }
32
- function mn(n) {
40
+ function ln(n) {
33
41
  return j(B(n));
34
42
  }
35
- function pn(n) {
43
+ function yn(n) {
36
44
  if (!n || typeof n != "object")
37
45
  return !1;
38
46
  const e = n;
@@ -49,7 +57,7 @@ function pn(n) {
49
57
  return !1;
50
58
  }
51
59
  }
52
- function ln(n, e) {
60
+ function hn(n, e) {
53
61
  if (n !== void 0)
54
62
  switch (n.type) {
55
63
  case "Json":
@@ -94,10 +102,10 @@ function F(n) {
94
102
  return !1;
95
103
  }
96
104
  }
97
- function yn(n) {
105
+ function gn(n) {
98
106
  return F(n) ? n.type === "JsonPartitioned" || n.type === "BinaryPartitioned" : !1;
99
107
  }
100
- function hn(n) {
108
+ function bn(n) {
101
109
  switch (n.type) {
102
110
  case "Json": {
103
111
  const e = Object.entries(n.data).map(([t, r]) => ({ key: JSON.parse(t), value: r }));
@@ -125,7 +133,7 @@ function hn(n) {
125
133
  }
126
134
  }
127
135
  }
128
- function gn(n) {
136
+ function wn(n) {
129
137
  switch (n.type) {
130
138
  case "Json": {
131
139
  const e = {};
@@ -159,7 +167,7 @@ function gn(n) {
159
167
  }
160
168
  }
161
169
  }
162
- function bn(n, e) {
170
+ function Pn(n, e) {
163
171
  if (n !== void 0)
164
172
  switch (n.type) {
165
173
  case "Json":
@@ -189,7 +197,7 @@ function bn(n, e) {
189
197
  }
190
198
  }
191
199
  }
192
- const U = -2147483648, P = -9007199254740991n, wn = NaN, Pn = NaN, K = null, R = null;
200
+ const U = -2147483648, P = -9007199254740991n, xn = NaN, An = NaN, K = null, R = null;
193
201
  function g(n, e) {
194
202
  switch (e) {
195
203
  case "Int":
@@ -208,11 +216,11 @@ function g(n, e) {
208
216
  throw Error(`unsupported data type: ${e}`);
209
217
  }
210
218
  }
211
- function xn(n) {
212
- if (!_(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
219
+ function kn(n) {
220
+ if (!v(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
213
221
  return n;
214
222
  }
215
- function _(n, e) {
223
+ function v(n, e) {
216
224
  if (!e)
217
225
  return typeof n == "string" || typeof n == "number" && isFinite(n) || typeof n == "bigint";
218
226
  if (g(n, e)) return !1;
@@ -233,7 +241,7 @@ function _(n, e) {
233
241
  throw Error(`unsupported data type: ${e}`);
234
242
  }
235
243
  }
236
- function v(n, e) {
244
+ function _(n, e) {
237
245
  if (!e)
238
246
  return n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint";
239
247
  if (g(n, e)) return !0;
@@ -254,14 +262,14 @@ function v(n, e) {
254
262
  throw Error(`unsupported data type: ${e}`);
255
263
  }
256
264
  }
257
- function An(n) {
265
+ function Nn(n) {
258
266
  if (n === null || typeof n == "string" || typeof n == "number") return n;
259
267
  if (typeof n == "bigint") return { bigint: n.toString() };
260
268
  throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`);
261
269
  }
262
270
  function M(n, e) {
263
271
  if (n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint") {
264
- if (e && !g(n, e) && !v(n, e))
272
+ if (e && !g(n, e) && !_(n, e))
265
273
  throw new Error(`Unexpected value type, got ${typeof n}, expected ${e}`);
266
274
  return n;
267
275
  }
@@ -272,7 +280,7 @@ function M(n, e) {
272
280
  }
273
281
  throw new Error(`Unsupported type ${typeof n} (value ${n}).`);
274
282
  }
275
- function kn(n) {
283
+ function En(n) {
276
284
  if (n = T(n), n === null) throw new Error("Value is null");
277
285
  return n;
278
286
  }
@@ -292,10 +300,10 @@ function H(n, e) {
292
300
  return (n[t] & r) > 0;
293
301
  }
294
302
  const q = { type: "absent" }, W = null;
295
- function Nn(n) {
303
+ function Sn(n) {
296
304
  return typeof n == "object" && n !== null && n.type === "absent";
297
305
  }
298
- function Sn(n, e, t = {}) {
306
+ function Cn(n, e, t = {}) {
299
307
  if (H(n.absent, e))
300
308
  return t.absent === void 0 ? q : t.absent;
301
309
  const r = n.data[e], o = n.type;
@@ -317,7 +325,7 @@ function Sn(n, e, t = {}) {
317
325
  throw Error(`unsupported data type: ${o}`);
318
326
  }
319
327
  }
320
- function En(n) {
328
+ function Jn(n) {
321
329
  return {
322
330
  kind: n.kind,
323
331
  valueType: n.valueType,
@@ -327,7 +335,7 @@ function En(n) {
327
335
  axesId: C(n.axesSpec)
328
336
  };
329
337
  }
330
- function Cn(n) {
338
+ function On(n) {
331
339
  return {
332
340
  columnId: n.id,
333
341
  spec: n.spec
@@ -340,7 +348,7 @@ function p(n) {
340
348
  function C(n) {
341
349
  return n.map(p);
342
350
  }
343
- function Jn(n) {
351
+ function $n(n) {
344
352
  return y(p(n));
345
353
  }
346
354
  function z(n, e) {
@@ -353,7 +361,7 @@ function z(n, e) {
353
361
  function X(n, e) {
354
362
  return n.name === e.name && z(n.domain, e.domain);
355
363
  }
356
- function On(n, e) {
364
+ function In(n, e) {
357
365
  return { ...n, src: h(n.src, e) };
358
366
  }
359
367
  function h(n, e) {
@@ -391,7 +399,7 @@ function h(n, e) {
391
399
  function G(n) {
392
400
  return y(n);
393
401
  }
394
- function In(n) {
402
+ function Dn(n) {
395
403
  return JSON.parse(n);
396
404
  }
397
405
  function x(n) {
@@ -400,7 +408,7 @@ function x(n) {
400
408
  function A(n, e) {
401
409
  return JSON.stringify([n, e]);
402
410
  }
403
- class $n {
411
+ class Ln {
404
412
  /**
405
413
  * Creates a new anchor context from a set of anchor column specifications
406
414
  * @param anchors Record of anchor column specifications indexed by anchor ID
@@ -501,7 +509,7 @@ class $n {
501
509
  return G(this.derive(e, t));
502
510
  }
503
511
  }
504
- function Dn(n, e, t) {
512
+ function Vn(n, e, t) {
505
513
  const r = { ...e }, o = (t == null ? void 0 : t.ignoreMissingDomains) ?? !1;
506
514
  if (r.domainAnchor !== void 0) {
507
515
  const s = n[r.domainAnchor];
@@ -560,7 +568,7 @@ function Q(n, e) {
560
568
  function Y(n) {
561
569
  return typeof n == "object" && "anchor" in n;
562
570
  }
563
- function Ln(n) {
571
+ function Bn(n) {
564
572
  return typeof n == "object" && n !== null && "source" in n && "axisFilters" in n;
565
573
  }
566
574
  function f(n) {
@@ -569,23 +577,23 @@ function f(n) {
569
577
  function Z(n) {
570
578
  return f(n.spec);
571
579
  }
572
- function Vn(n) {
580
+ function jn(n) {
573
581
  return f(n.obj);
574
582
  }
575
- function Bn(n) {
583
+ function Fn(n) {
576
584
  return f(n.obj.spec);
577
585
  }
578
- function jn(n) {
586
+ function Un(n) {
579
587
  if (!Z(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
580
588
  return n;
581
589
  }
582
- function Fn(n, e) {
590
+ function Kn(n, e) {
583
591
  return n === void 0 ? void 0 : {
584
592
  ...n,
585
593
  data: e(n.data)
586
594
  };
587
595
  }
588
- function Un(n) {
596
+ function Rn(n) {
589
597
  const e = /* @__PURE__ */ new Map(), t = (r) => {
590
598
  switch (r.type) {
591
599
  case "column":
@@ -709,17 +717,17 @@ function N(n, e) {
709
717
  }
710
718
  return !0;
711
719
  }
712
- function Kn(n) {
720
+ function vn(n) {
713
721
  return Array.isArray(n) ? (e) => n.some((t) => f(e) && N(e, t)) : (e) => f(e) && N(e, n);
714
722
  }
715
- function Rn(n) {
723
+ function _n(n) {
716
724
  const e = {
717
725
  kind: n.kind,
718
726
  name: n.name
719
727
  };
720
728
  return n.domain !== void 0 && (e.domain = n.domain), f(n) && (e.axesSpec = C(n.axesSpec)), y(e);
721
729
  }
722
- const _n = { href: "/" }, vn = m.object({
730
+ const Mn = { href: "/" }, Tn = m.object({
723
731
  __isRef: m.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
724
732
  blockId: m.string().describe("Upstream block id"),
725
733
  name: m.string().describe("Name of the output provided to the upstream block's output context"),
@@ -727,10 +735,10 @@ const _n = { href: "/" }, vn = m.object({
727
735
  }).describe(
728
736
  "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."
729
737
  ).readonly();
730
- function Mn(n) {
738
+ function Hn(n) {
731
739
  return typeof n == "object" && n !== null && "__isRef" in n && n.__isRef === !0 && "blockId" in n && "name" in n;
732
740
  }
733
- function Tn(n, e, t = !1) {
741
+ function qn(n, e, t = !1) {
734
742
  return t ? {
735
743
  __isRef: !0,
736
744
  blockId: n,
@@ -742,7 +750,7 @@ function Tn(n, e, t = !1) {
742
750
  name: e
743
751
  };
744
752
  }
745
- function Hn(n, e = !0) {
753
+ function Wn(n, e = !0) {
746
754
  if (e)
747
755
  return {
748
756
  ...n,
@@ -753,10 +761,10 @@ function Hn(n, e = !0) {
753
761
  return r;
754
762
  }
755
763
  }
756
- function qn(n, e, t = !1) {
764
+ function zn(n, e, t = !1) {
757
765
  return n.blockId === e.blockId && n.name === e.name && (t || n.requireEnrichments === e.requireEnrichments);
758
766
  }
759
- function Wn(n, e) {
767
+ function Xn(n, e) {
760
768
  return n.ok ? { ok: !0, value: e(n.value) } : n;
761
769
  }
762
770
  function en(n) {
@@ -795,100 +803,102 @@ function J(n, e, t) {
795
803
  c += "=";
796
804
  return c;
797
805
  }
798
- const O = 15, sn = 24, I = m.string().length(sn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
799
- function zn() {
806
+ const O = 15, sn = 24, $ = m.string().length(sn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
807
+ function Gn() {
800
808
  const n = new Uint8Array(O);
801
- return crypto.getRandomValues(n), I.parse(J(n, "RFC4648"));
809
+ return crypto.getRandomValues(n), $.parse(J(n, "RFC4648"));
802
810
  }
803
811
  function an(n) {
804
812
  if (n.length !== O) throw new Error(`Wrong number of bytes: ${n.length}`);
805
- return I.parse(J(n, "RFC4648"));
813
+ return $.parse(J(n, "RFC4648"));
806
814
  }
807
- async function Xn(n) {
815
+ async function Qn(n) {
808
816
  const e = new TextEncoder(), t = await crypto.subtle.digest("SHA-256", e.encode(n));
809
817
  return an(new Uint8Array(t.slice(0, 15)));
810
818
  }
811
- function Gn(n) {
819
+ function Yn(n) {
812
820
  return JSON.stringify(n);
813
821
  }
814
- function Qn(n) {
822
+ function Zn(n) {
815
823
  return y(n);
816
824
  }
817
- function Yn(n) {
825
+ function ne(n) {
818
826
  return JSON.parse(n);
819
827
  }
820
828
  export {
821
- $n as AnchoredIdDeriver,
822
- _n as DefaultNavigationState,
829
+ Ln as AnchoredIdDeriver,
830
+ Mn as DefaultNavigationState,
823
831
  q as PTableAbsent,
824
832
  W as PTableNA,
825
833
  R as PValueBytesNA,
826
- Pn as PValueDoubleNA,
827
- wn as PValueFloatNA,
834
+ An as PValueDoubleNA,
835
+ xn as PValueFloatNA,
828
836
  U as PValueIntNA,
829
837
  P as PValueLongNA,
830
838
  K as PValueStringNA,
831
- I as PlId,
839
+ $ as PlId,
832
840
  O as PlIdBytes,
833
841
  sn as PlIdLength,
834
- vn as PlRef,
835
- Jn as canonicalizeAxisId,
836
- Qn as canonicalizeJson,
837
- Tn as createPlRef,
838
- hn as dataInfoToEntries,
839
- Rn as deriveNativeId,
840
- Xn as digestPlId,
841
- xn as ensureNotNAPValue,
842
- jn as ensurePColumn,
843
- gn as entriesToDataInfo,
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,
850
+ Un as ensurePColumn,
851
+ wn as entriesToDataInfo,
844
852
  b as executePSpecPredicate,
845
- Un as extractAllColumns,
853
+ Rn as extractAllColumns,
846
854
  C as getAxesId,
847
855
  p as getAxisId,
848
- Cn as getColumnIdAndSpec,
849
- mn as getFileNameFromHandle,
856
+ On as getColumnIdAndSpec,
857
+ ln as getFileNameFromHandle,
850
858
  B as getFilePathFromHandle,
851
- En as getPColumnSpecId,
852
- pn as isDataInfo,
859
+ Jn as getPColumnSpecId,
860
+ yn as isDataInfo,
853
861
  F as isDataInfoEntries,
854
- Ln as isFilteredPColumn,
862
+ Bn as isFilteredPColumn,
855
863
  V as isImportFileHandleIndex,
856
864
  L as isImportFileHandleUpload,
857
- dn as isLiveLog,
858
- _ as isNotNAPValue,
865
+ pn as isLiveLog,
866
+ v as isNotNAPValue,
859
867
  Z as isPColumn,
860
- Bn as isPColumnResult,
868
+ Fn as isPColumnResult,
861
869
  f as isPColumnSpec,
862
- Vn as isPColumnSpecResult,
863
- Nn as isPTableAbsent,
864
- v as isPValue,
865
- yn as isPartitionedDataInfoEntries,
866
- Mn as isPlRef,
870
+ jn as isPColumnSpecResult,
871
+ Sn as isPTableAbsent,
872
+ _ as isPValue,
873
+ gn as isPartitionedDataInfoEntries,
874
+ Hn as isPlRef,
867
875
  H as isValueAbsent,
868
876
  g as isValueNA,
869
- ln as mapDataInfo,
870
- bn as mapDataInfoEntries,
877
+ hn as mapDataInfo,
878
+ Pn as mapDataInfoEntries,
871
879
  h as mapJoinEntry,
872
- Fn as mapPObjectData,
873
- On as mapPTableDef,
874
- Wn as mapValueInVOE,
880
+ Kn as mapPObjectData,
881
+ In as mapPTableDef,
882
+ Xn as mapValueInVOE,
875
883
  k as matchAxis,
876
884
  X as matchAxisId,
877
885
  N as matchPColumn,
878
- Sn as pTableValue,
879
- kn as pValueToStringOrNumber,
886
+ dn as newRangeBytesOpt,
887
+ Cn as pTableValue,
888
+ En as pValueToStringOrNumber,
880
889
  T as pValueToStringOrNumberOrNull,
881
- In as parseColumnId,
882
- Yn as parseJson,
890
+ Dn as parseColumnId,
891
+ ne as parseJson,
883
892
  an as plId,
884
- qn as plRefsEqual,
885
- Dn as resolveAnchors,
893
+ zn as plRefsEqual,
894
+ Vn as resolveAnchors,
886
895
  M as safeConvertToPValue,
887
- Kn as selectorsToPredicate,
896
+ vn as selectorsToPredicate,
888
897
  G as stringifyColumnId,
889
- Gn as stringifyJson,
890
- An as toJsonSafePValue,
891
- zn as uniquePlId,
892
- Hn as withEnrichments
898
+ Yn as stringifyJson,
899
+ Nn as toJsonSafePValue,
900
+ Gn as uniquePlId,
901
+ mn as validateRangeBytes,
902
+ Wn as withEnrichments
893
903
  };
894
904
  //# sourceMappingURL=index.mjs.map