@milaboratories/pl-model-common 1.14.1 → 1.15.0

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,38 +1,38 @@
1
1
  var $ = Object.defineProperty;
2
- var I = (n, e, t) => e in n ? $(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var l = (n, e, t) => I(n, typeof e != "symbol" ? e + "" : e, t);
4
- import h from "canonicalize";
5
- import { z as p } from "zod";
2
+ var D = (n, e, t) => e in n ? $(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var l = (n, e, t) => D(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import y from "canonicalize";
5
+ import { z as m } from "zod";
6
6
  function dn(n) {
7
7
  return n !== void 0 && n.startsWith("log+live://log/");
8
8
  }
9
9
  function w(n) {
10
10
  throw new Error("Unexpected object: " + n);
11
11
  }
12
- const E = "upload://upload/", S = "index://index/";
13
- function D(n) {
14
- return n.startsWith(E);
15
- }
12
+ const S = "upload://upload/", E = "index://index/";
16
13
  function L(n) {
17
14
  return n.startsWith(S);
18
15
  }
19
16
  function V(n) {
20
- if (L(n)) {
21
- const e = n.slice(S.length);
22
- return JSON.parse(decodeURIComponent(e)).path;
23
- } else if (D(n)) {
17
+ return n.startsWith(E);
18
+ }
19
+ function B(n) {
20
+ if (V(n)) {
24
21
  const e = n.slice(E.length);
22
+ return JSON.parse(decodeURIComponent(e)).path;
23
+ } else if (L(n)) {
24
+ const e = n.slice(S.length);
25
25
  return JSON.parse(decodeURIComponent(e)).localPath;
26
26
  }
27
27
  w(n);
28
28
  }
29
- function B(n) {
29
+ function j(n) {
30
30
  return n.replace(/^.*[\\/]/, "");
31
31
  }
32
- function pn(n) {
33
- return B(V(n));
34
- }
35
32
  function mn(n) {
33
+ return j(B(n));
34
+ }
35
+ function pn(n) {
36
36
  if (!n || typeof n != "object")
37
37
  return !1;
38
38
  const e = n;
@@ -77,7 +77,7 @@ function ln(n, e) {
77
77
  }
78
78
  }
79
79
  }
80
- function j(n) {
80
+ function F(n) {
81
81
  if (!n || typeof n != "object")
82
82
  return !1;
83
83
  const e = n;
@@ -95,7 +95,7 @@ function j(n) {
95
95
  }
96
96
  }
97
97
  function yn(n) {
98
- return j(n) ? n.type === "JsonPartitioned" || n.type === "BinaryPartitioned" : !1;
98
+ return F(n) ? n.type === "JsonPartitioned" || n.type === "BinaryPartitioned" : !1;
99
99
  }
100
100
  function hn(n) {
101
101
  switch (n.type) {
@@ -189,11 +189,11 @@ function bn(n, e) {
189
189
  }
190
190
  }
191
191
  }
192
- const F = -2147483648, P = -9007199254740991n, wn = NaN, Pn = NaN, U = null, K = null;
192
+ const U = -2147483648, P = -9007199254740991n, wn = NaN, Pn = NaN, K = null, R = null;
193
193
  function g(n, e) {
194
194
  switch (e) {
195
195
  case "Int":
196
- return n === F;
196
+ return n === U;
197
197
  case "Long":
198
198
  return n === Number(P) || n === P;
199
199
  case "Float":
@@ -201,18 +201,18 @@ function g(n, e) {
201
201
  case "Double":
202
202
  return Number.isNaN(n);
203
203
  case "String":
204
- return n === U;
205
- case "Bytes":
206
204
  return n === K;
205
+ case "Bytes":
206
+ return n === R;
207
207
  default:
208
208
  throw Error(`unsupported data type: ${e}`);
209
209
  }
210
210
  }
211
211
  function xn(n) {
212
- if (!R(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
212
+ if (!_(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
213
213
  return n;
214
214
  }
215
- function R(n, e) {
215
+ function _(n, e) {
216
216
  if (!e)
217
217
  return typeof n == "string" || typeof n == "number" && isFinite(n) || typeof n == "bigint";
218
218
  if (g(n, e)) return !1;
@@ -233,7 +233,7 @@ function R(n, e) {
233
233
  throw Error(`unsupported data type: ${e}`);
234
234
  }
235
235
  }
236
- function _(n, e) {
236
+ function v(n, e) {
237
237
  if (!e)
238
238
  return n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint";
239
239
  if (g(n, e)) return !0;
@@ -261,7 +261,7 @@ function An(n) {
261
261
  }
262
262
  function M(n, e) {
263
263
  if (n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint") {
264
- if (e && !g(n, e) && !_(n, e))
264
+ if (e && !g(n, e) && !v(n, e))
265
265
  throw new Error(`Unexpected value type, got ${typeof n}, expected ${e}`);
266
266
  return n;
267
267
  }
@@ -287,19 +287,19 @@ function T(n) {
287
287
  return Number(n);
288
288
  throw new Error(`Unexpected value type: ${typeof n}`);
289
289
  }
290
- function v(n, e) {
290
+ function H(n, e) {
291
291
  const t = Math.floor(e / 8), r = 1 << 7 - e % 8;
292
292
  return (n[t] & r) > 0;
293
293
  }
294
- const H = { type: "absent" }, q = null;
294
+ const q = { type: "absent" }, W = null;
295
295
  function Nn(n) {
296
296
  return typeof n == "object" && n !== null && n.type === "absent";
297
297
  }
298
- function En(n, e, t = {}) {
299
- if (v(n.absent, e))
300
- return t.absent === void 0 ? H : t.absent;
298
+ function Sn(n, e, t = {}) {
299
+ if (H(n.absent, e))
300
+ return t.absent === void 0 ? q : t.absent;
301
301
  const r = n.data[e], o = n.type;
302
- if (g(r, o)) return t.na === void 0 ? q : t.na;
302
+ if (g(r, o)) return t.na === void 0 ? W : t.na;
303
303
  switch (o) {
304
304
  case "Int":
305
305
  return r;
@@ -317,14 +317,14 @@ function En(n, e, t = {}) {
317
317
  throw Error(`unsupported data type: ${o}`);
318
318
  }
319
319
  }
320
- function Sn(n) {
320
+ function En(n) {
321
321
  return {
322
322
  kind: n.kind,
323
323
  valueType: n.valueType,
324
324
  name: n.name,
325
325
  domain: n.domain,
326
326
  parentAxes: n.parentAxes,
327
- axesId: W(n.axesSpec)
327
+ axesId: C(n.axesSpec)
328
328
  };
329
329
  }
330
330
  function Cn(n) {
@@ -333,15 +333,15 @@ function Cn(n) {
333
333
  spec: n.spec
334
334
  };
335
335
  }
336
- function m(n) {
336
+ function p(n) {
337
337
  const { type: e, name: t, domain: r } = n;
338
338
  return { type: e, name: t, ...r && { domain: r } };
339
339
  }
340
- function W(n) {
341
- return n.map(m);
340
+ function C(n) {
341
+ return n.map(p);
342
342
  }
343
343
  function Jn(n) {
344
- return h(m(n));
344
+ return y(p(n));
345
345
  }
346
346
  function z(n, e) {
347
347
  if (n === void 0) return e === void 0;
@@ -354,9 +354,9 @@ function X(n, e) {
354
354
  return n.name === e.name && z(n.domain, e.domain);
355
355
  }
356
356
  function On(n, e) {
357
- return { ...n, src: y(n.src, e) };
357
+ return { ...n, src: h(n.src, e) };
358
358
  }
359
- function y(n, e) {
359
+ function h(n, e) {
360
360
  switch (n.type) {
361
361
  case "column":
362
362
  return {
@@ -376,31 +376,31 @@ function y(n, e) {
376
376
  case "full":
377
377
  return {
378
378
  type: n.type,
379
- entries: n.entries.map((t) => y(t, e))
379
+ entries: n.entries.map((t) => h(t, e))
380
380
  };
381
381
  case "outer":
382
382
  return {
383
383
  type: "outer",
384
- primary: y(n.primary, e),
385
- secondary: n.secondary.map((t) => y(t, e))
384
+ primary: h(n.primary, e),
385
+ secondary: n.secondary.map((t) => h(t, e))
386
386
  };
387
387
  default:
388
388
  w(n);
389
389
  }
390
390
  }
391
391
  function G(n) {
392
- return h(n);
392
+ return y(n);
393
393
  }
394
- function $n(n) {
394
+ function In(n) {
395
395
  return JSON.parse(n);
396
396
  }
397
397
  function x(n) {
398
- return h(m(n));
398
+ return y(p(n));
399
399
  }
400
400
  function A(n, e) {
401
401
  return JSON.stringify([n, e]);
402
402
  }
403
- class In {
403
+ class $n {
404
404
  /**
405
405
  * Creates a new anchor context from a set of anchor column specifications
406
406
  * @param anchors Record of anchor column specifications indexed by anchor ID
@@ -469,7 +469,7 @@ class In {
469
469
  }
470
470
  if (r.axes = e.axesSpec.map((a) => {
471
471
  const i = x(a), u = this.axes.get(i);
472
- return u === void 0 ? m(a) : u;
472
+ return u === void 0 ? p(a) : u;
473
473
  }), !t || t.length === 0)
474
474
  return r;
475
475
  const s = [];
@@ -548,7 +548,7 @@ function Q(n, e) {
548
548
  throw new Error(`Axis with name "${e.name}" not found in anchor "${t}"`);
549
549
  return o[0];
550
550
  } else if ("id" in e) {
551
- const o = r.axesSpec.filter((s) => X(e.id, m(s)));
551
+ const o = r.axesSpec.filter((s) => X(e.id, p(s)));
552
552
  if (o.length > 1)
553
553
  throw new Error(`Multiple matching axes found for matcher in anchor "${t}"`);
554
554
  if (o.length === 0)
@@ -680,7 +680,7 @@ function N(n, e) {
680
680
  return !1;
681
681
  }
682
682
  if (e.axes !== void 0) {
683
- const t = n.axesSpec.map(m);
683
+ const t = n.axesSpec.map(p);
684
684
  if (e.partialAxesMatch) {
685
685
  for (const r of e.axes)
686
686
  if (!t.some((o) => k(r, o)))
@@ -712,11 +712,18 @@ function N(n, e) {
712
712
  function Kn(n) {
713
713
  return Array.isArray(n) ? (e) => n.some((t) => f(e) && N(e, t)) : (e) => f(e) && N(e, n);
714
714
  }
715
- const Rn = { href: "/" }, _n = p.object({
716
- __isRef: p.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
717
- blockId: p.string().describe("Upstream block id"),
718
- name: p.string().describe("Name of the output provided to the upstream block's output context"),
719
- requireEnrichments: p.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")
715
+ function Rn(n) {
716
+ const e = {
717
+ kind: n.kind,
718
+ name: n.name
719
+ };
720
+ return n.domain !== void 0 && (e.domain = n.domain), f(n) && (e.axesSpec = C(n.axesSpec)), y(e);
721
+ }
722
+ const _n = { href: "/" }, vn = m.object({
723
+ __isRef: m.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
724
+ blockId: m.string().describe("Upstream block id"),
725
+ name: m.string().describe("Name of the output provided to the upstream block's output context"),
726
+ 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")
720
727
  }).describe(
721
728
  "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."
722
729
  ).readonly();
@@ -735,7 +742,7 @@ function Tn(n, e, t = !1) {
735
742
  name: e
736
743
  };
737
744
  }
738
- function vn(n, e = !0) {
745
+ function Hn(n, e = !0) {
739
746
  if (e)
740
747
  return {
741
748
  ...n,
@@ -746,10 +753,10 @@ function vn(n, e = !0) {
746
753
  return r;
747
754
  }
748
755
  }
749
- function Hn(n, e, t = !1) {
756
+ function qn(n, e, t = !1) {
750
757
  return n.blockId === e.blockId && n.name === e.name && (t || n.requireEnrichments === e.requireEnrichments);
751
758
  }
752
- function qn(n, e) {
759
+ function Wn(n, e) {
753
760
  return n.ok ? { ok: !0, value: e(n.value) } : n;
754
761
  }
755
762
  function en(n) {
@@ -761,7 +768,7 @@ function en(n) {
761
768
  );
762
769
  }
763
770
  const tn = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", rn = "0123456789ABCDEFGHIJKLMNOPQRSTUV", on = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
764
- function C(n, e, t) {
771
+ function J(n, e, t) {
765
772
  t = t || {};
766
773
  let r, o;
767
774
  switch (e) {
@@ -788,99 +795,100 @@ function C(n, e, t) {
788
795
  c += "=";
789
796
  return c;
790
797
  }
791
- const J = 15, sn = 24, O = p.string().length(sn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
792
- function Wn() {
793
- const n = new Uint8Array(J);
794
- return crypto.getRandomValues(n), O.parse(C(n, "RFC4648"));
798
+ const O = 15, sn = 24, I = m.string().length(sn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
799
+ function zn() {
800
+ const n = new Uint8Array(O);
801
+ return crypto.getRandomValues(n), I.parse(J(n, "RFC4648"));
795
802
  }
796
803
  function an(n) {
797
- if (n.length !== J) throw new Error(`Wrong number of bytes: ${n.length}`);
798
- return O.parse(C(n, "RFC4648"));
804
+ if (n.length !== O) throw new Error(`Wrong number of bytes: ${n.length}`);
805
+ return I.parse(J(n, "RFC4648"));
799
806
  }
800
- async function zn(n) {
807
+ async function Xn(n) {
801
808
  const e = new TextEncoder(), t = await crypto.subtle.digest("SHA-256", e.encode(n));
802
809
  return an(new Uint8Array(t.slice(0, 15)));
803
810
  }
804
- function Xn(n) {
805
- return JSON.stringify(n);
806
- }
807
811
  function Gn(n) {
808
- return h(n);
812
+ return JSON.stringify(n);
809
813
  }
810
814
  function Qn(n) {
815
+ return y(n);
816
+ }
817
+ function Yn(n) {
811
818
  return JSON.parse(n);
812
819
  }
813
820
  export {
814
- In as AnchoredIdDeriver,
815
- Rn as DefaultNavigationState,
816
- H as PTableAbsent,
817
- q as PTableNA,
818
- K as PValueBytesNA,
821
+ $n as AnchoredIdDeriver,
822
+ _n as DefaultNavigationState,
823
+ q as PTableAbsent,
824
+ W as PTableNA,
825
+ R as PValueBytesNA,
819
826
  Pn as PValueDoubleNA,
820
827
  wn as PValueFloatNA,
821
- F as PValueIntNA,
828
+ U as PValueIntNA,
822
829
  P as PValueLongNA,
823
- U as PValueStringNA,
824
- O as PlId,
825
- J as PlIdBytes,
830
+ K as PValueStringNA,
831
+ I as PlId,
832
+ O as PlIdBytes,
826
833
  sn as PlIdLength,
827
- _n as PlRef,
834
+ vn as PlRef,
828
835
  Jn as canonicalizeAxisId,
829
- Gn as canonicalizeJson,
836
+ Qn as canonicalizeJson,
830
837
  Tn as createPlRef,
831
838
  hn as dataInfoToEntries,
832
- zn as digestPlId,
839
+ Rn as deriveNativeId,
840
+ Xn as digestPlId,
833
841
  xn as ensureNotNAPValue,
834
842
  jn as ensurePColumn,
835
843
  gn as entriesToDataInfo,
836
844
  b as executePSpecPredicate,
837
845
  Un as extractAllColumns,
838
- W as getAxesId,
839
- m as getAxisId,
846
+ C as getAxesId,
847
+ p as getAxisId,
840
848
  Cn as getColumnIdAndSpec,
841
- pn as getFileNameFromHandle,
842
- V as getFilePathFromHandle,
843
- Sn as getPColumnSpecId,
844
- mn as isDataInfo,
845
- j as isDataInfoEntries,
849
+ mn as getFileNameFromHandle,
850
+ B as getFilePathFromHandle,
851
+ En as getPColumnSpecId,
852
+ pn as isDataInfo,
853
+ F as isDataInfoEntries,
846
854
  Ln as isFilteredPColumn,
847
- L as isImportFileHandleIndex,
848
- D as isImportFileHandleUpload,
855
+ V as isImportFileHandleIndex,
856
+ L as isImportFileHandleUpload,
849
857
  dn as isLiveLog,
850
- R as isNotNAPValue,
858
+ _ as isNotNAPValue,
851
859
  Z as isPColumn,
852
860
  Bn as isPColumnResult,
853
861
  f as isPColumnSpec,
854
862
  Vn as isPColumnSpecResult,
855
863
  Nn as isPTableAbsent,
856
- _ as isPValue,
864
+ v as isPValue,
857
865
  yn as isPartitionedDataInfoEntries,
858
866
  Mn as isPlRef,
859
- v as isValueAbsent,
867
+ H as isValueAbsent,
860
868
  g as isValueNA,
861
869
  ln as mapDataInfo,
862
870
  bn as mapDataInfoEntries,
863
- y as mapJoinEntry,
871
+ h as mapJoinEntry,
864
872
  Fn as mapPObjectData,
865
873
  On as mapPTableDef,
866
- qn as mapValueInVOE,
874
+ Wn as mapValueInVOE,
867
875
  k as matchAxis,
868
876
  X as matchAxisId,
869
877
  N as matchPColumn,
870
- En as pTableValue,
878
+ Sn as pTableValue,
871
879
  kn as pValueToStringOrNumber,
872
880
  T as pValueToStringOrNumberOrNull,
873
- $n as parseColumnId,
874
- Qn as parseJson,
881
+ In as parseColumnId,
882
+ Yn as parseJson,
875
883
  an as plId,
876
- Hn as plRefsEqual,
884
+ qn as plRefsEqual,
877
885
  Dn as resolveAnchors,
878
886
  M as safeConvertToPValue,
879
887
  Kn as selectorsToPredicate,
880
888
  G as stringifyColumnId,
881
- Xn as stringifyJson,
889
+ Gn as stringifyJson,
882
890
  An as toJsonSafePValue,
883
- Wn as uniquePlId,
884
- vn as withEnrichments
891
+ zn as uniquePlId,
892
+ Hn as withEnrichments
885
893
  };
886
894
  //# sourceMappingURL=index.mjs.map