@milaboratories/pl-model-common 1.14.0 → 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 {
@@ -370,35 +370,37 @@ function y(n, e) {
370
370
  newId: n.newId,
371
371
  axisFilters: n.axisFilters
372
372
  };
373
+ case "inlineColumn":
374
+ return n;
373
375
  case "inner":
374
376
  case "full":
375
377
  return {
376
378
  type: n.type,
377
- entries: n.entries.map((t) => y(t, e))
379
+ entries: n.entries.map((t) => h(t, e))
378
380
  };
379
381
  case "outer":
380
382
  return {
381
383
  type: "outer",
382
- primary: y(n.primary, e),
383
- secondary: n.secondary.map((t) => y(t, e))
384
+ primary: h(n.primary, e),
385
+ secondary: n.secondary.map((t) => h(t, e))
384
386
  };
385
387
  default:
386
388
  w(n);
387
389
  }
388
390
  }
389
391
  function G(n) {
390
- return h(n);
392
+ return y(n);
391
393
  }
392
- function $n(n) {
394
+ function In(n) {
393
395
  return JSON.parse(n);
394
396
  }
395
397
  function x(n) {
396
- return h(m(n));
398
+ return y(p(n));
397
399
  }
398
400
  function A(n, e) {
399
401
  return JSON.stringify([n, e]);
400
402
  }
401
- class In {
403
+ class $n {
402
404
  /**
403
405
  * Creates a new anchor context from a set of anchor column specifications
404
406
  * @param anchors Record of anchor column specifications indexed by anchor ID
@@ -467,7 +469,7 @@ class In {
467
469
  }
468
470
  if (r.axes = e.axesSpec.map((a) => {
469
471
  const i = x(a), u = this.axes.get(i);
470
- return u === void 0 ? m(a) : u;
472
+ return u === void 0 ? p(a) : u;
471
473
  }), !t || t.length === 0)
472
474
  return r;
473
475
  const s = [];
@@ -546,7 +548,7 @@ function Q(n, e) {
546
548
  throw new Error(`Axis with name "${e.name}" not found in anchor "${t}"`);
547
549
  return o[0];
548
550
  } else if ("id" in e) {
549
- const o = r.axesSpec.filter((s) => X(e.id, m(s)));
551
+ const o = r.axesSpec.filter((s) => X(e.id, p(s)));
550
552
  if (o.length > 1)
551
553
  throw new Error(`Multiple matching axes found for matcher in anchor "${t}"`);
552
554
  if (o.length === 0)
@@ -592,6 +594,8 @@ function Un(n) {
592
594
  case "slicedColumn":
593
595
  e.set(r.column.id, r.column);
594
596
  return;
597
+ case "inlineColumn":
598
+ return;
595
599
  case "full":
596
600
  case "inner":
597
601
  for (const o of r.entries) t(o);
@@ -676,7 +680,7 @@ function N(n, e) {
676
680
  return !1;
677
681
  }
678
682
  if (e.axes !== void 0) {
679
- const t = n.axesSpec.map(m);
683
+ const t = n.axesSpec.map(p);
680
684
  if (e.partialAxesMatch) {
681
685
  for (const r of e.axes)
682
686
  if (!t.some((o) => k(r, o)))
@@ -708,11 +712,18 @@ function N(n, e) {
708
712
  function Kn(n) {
709
713
  return Array.isArray(n) ? (e) => n.some((t) => f(e) && N(e, t)) : (e) => f(e) && N(e, n);
710
714
  }
711
- const Rn = { href: "/" }, _n = p.object({
712
- __isRef: p.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
713
- blockId: p.string().describe("Upstream block id"),
714
- name: p.string().describe("Name of the output provided to the upstream block's output context"),
715
- 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")
716
727
  }).describe(
717
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."
718
729
  ).readonly();
@@ -731,7 +742,7 @@ function Tn(n, e, t = !1) {
731
742
  name: e
732
743
  };
733
744
  }
734
- function vn(n, e = !0) {
745
+ function Hn(n, e = !0) {
735
746
  if (e)
736
747
  return {
737
748
  ...n,
@@ -742,10 +753,10 @@ function vn(n, e = !0) {
742
753
  return r;
743
754
  }
744
755
  }
745
- function Hn(n, e, t = !1) {
756
+ function qn(n, e, t = !1) {
746
757
  return n.blockId === e.blockId && n.name === e.name && (t || n.requireEnrichments === e.requireEnrichments);
747
758
  }
748
- function qn(n, e) {
759
+ function Wn(n, e) {
749
760
  return n.ok ? { ok: !0, value: e(n.value) } : n;
750
761
  }
751
762
  function en(n) {
@@ -757,7 +768,7 @@ function en(n) {
757
768
  );
758
769
  }
759
770
  const tn = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", rn = "0123456789ABCDEFGHIJKLMNOPQRSTUV", on = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
760
- function C(n, e, t) {
771
+ function J(n, e, t) {
761
772
  t = t || {};
762
773
  let r, o;
763
774
  switch (e) {
@@ -784,99 +795,100 @@ function C(n, e, t) {
784
795
  c += "=";
785
796
  return c;
786
797
  }
787
- const J = 15, sn = 24, O = p.string().length(sn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
788
- function Wn() {
789
- const n = new Uint8Array(J);
790
- 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"));
791
802
  }
792
803
  function an(n) {
793
- if (n.length !== J) throw new Error(`Wrong number of bytes: ${n.length}`);
794
- 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"));
795
806
  }
796
- async function zn(n) {
807
+ async function Xn(n) {
797
808
  const e = new TextEncoder(), t = await crypto.subtle.digest("SHA-256", e.encode(n));
798
809
  return an(new Uint8Array(t.slice(0, 15)));
799
810
  }
800
- function Xn(n) {
801
- return JSON.stringify(n);
802
- }
803
811
  function Gn(n) {
804
- return h(n);
812
+ return JSON.stringify(n);
805
813
  }
806
814
  function Qn(n) {
815
+ return y(n);
816
+ }
817
+ function Yn(n) {
807
818
  return JSON.parse(n);
808
819
  }
809
820
  export {
810
- In as AnchoredIdDeriver,
811
- Rn as DefaultNavigationState,
812
- H as PTableAbsent,
813
- q as PTableNA,
814
- K as PValueBytesNA,
821
+ $n as AnchoredIdDeriver,
822
+ _n as DefaultNavigationState,
823
+ q as PTableAbsent,
824
+ W as PTableNA,
825
+ R as PValueBytesNA,
815
826
  Pn as PValueDoubleNA,
816
827
  wn as PValueFloatNA,
817
- F as PValueIntNA,
828
+ U as PValueIntNA,
818
829
  P as PValueLongNA,
819
- U as PValueStringNA,
820
- O as PlId,
821
- J as PlIdBytes,
830
+ K as PValueStringNA,
831
+ I as PlId,
832
+ O as PlIdBytes,
822
833
  sn as PlIdLength,
823
- _n as PlRef,
834
+ vn as PlRef,
824
835
  Jn as canonicalizeAxisId,
825
- Gn as canonicalizeJson,
836
+ Qn as canonicalizeJson,
826
837
  Tn as createPlRef,
827
838
  hn as dataInfoToEntries,
828
- zn as digestPlId,
839
+ Rn as deriveNativeId,
840
+ Xn as digestPlId,
829
841
  xn as ensureNotNAPValue,
830
842
  jn as ensurePColumn,
831
843
  gn as entriesToDataInfo,
832
844
  b as executePSpecPredicate,
833
845
  Un as extractAllColumns,
834
- W as getAxesId,
835
- m as getAxisId,
846
+ C as getAxesId,
847
+ p as getAxisId,
836
848
  Cn as getColumnIdAndSpec,
837
- pn as getFileNameFromHandle,
838
- V as getFilePathFromHandle,
839
- Sn as getPColumnSpecId,
840
- mn as isDataInfo,
841
- j as isDataInfoEntries,
849
+ mn as getFileNameFromHandle,
850
+ B as getFilePathFromHandle,
851
+ En as getPColumnSpecId,
852
+ pn as isDataInfo,
853
+ F as isDataInfoEntries,
842
854
  Ln as isFilteredPColumn,
843
- L as isImportFileHandleIndex,
844
- D as isImportFileHandleUpload,
855
+ V as isImportFileHandleIndex,
856
+ L as isImportFileHandleUpload,
845
857
  dn as isLiveLog,
846
- R as isNotNAPValue,
858
+ _ as isNotNAPValue,
847
859
  Z as isPColumn,
848
860
  Bn as isPColumnResult,
849
861
  f as isPColumnSpec,
850
862
  Vn as isPColumnSpecResult,
851
863
  Nn as isPTableAbsent,
852
- _ as isPValue,
864
+ v as isPValue,
853
865
  yn as isPartitionedDataInfoEntries,
854
866
  Mn as isPlRef,
855
- v as isValueAbsent,
867
+ H as isValueAbsent,
856
868
  g as isValueNA,
857
869
  ln as mapDataInfo,
858
870
  bn as mapDataInfoEntries,
859
- y as mapJoinEntry,
871
+ h as mapJoinEntry,
860
872
  Fn as mapPObjectData,
861
873
  On as mapPTableDef,
862
- qn as mapValueInVOE,
874
+ Wn as mapValueInVOE,
863
875
  k as matchAxis,
864
876
  X as matchAxisId,
865
877
  N as matchPColumn,
866
- En as pTableValue,
878
+ Sn as pTableValue,
867
879
  kn as pValueToStringOrNumber,
868
880
  T as pValueToStringOrNumberOrNull,
869
- $n as parseColumnId,
870
- Qn as parseJson,
881
+ In as parseColumnId,
882
+ Yn as parseJson,
871
883
  an as plId,
872
- Hn as plRefsEqual,
884
+ qn as plRefsEqual,
873
885
  Dn as resolveAnchors,
874
886
  M as safeConvertToPValue,
875
887
  Kn as selectorsToPredicate,
876
888
  G as stringifyColumnId,
877
- Xn as stringifyJson,
889
+ Gn as stringifyJson,
878
890
  An as toJsonSafePValue,
879
- Wn as uniquePlId,
880
- vn as withEnrichments
891
+ zn as uniquePlId,
892
+ Hn as withEnrichments
881
893
  };
882
894
  //# sourceMappingURL=index.mjs.map