@milaboratories/pl-model-common 1.16.4 → 1.17.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
@@ -3,7 +3,7 @@ var L = (e, n, t) => n in e ? R(e, n, { enumerable: !0, configurable: !0, writab
3
3
  var d = (e, n, t) => L(e, typeof n != "symbol" ? n + "" : n, t);
4
4
  import { z as m } from "zod";
5
5
  import h from "canonicalize";
6
- function ke(e) {
6
+ function Ee(e) {
7
7
  if (e.code !== void 0)
8
8
  return {
9
9
  code: e.code,
@@ -15,7 +15,7 @@ function p(e) {
15
15
  if (e !== void 0)
16
16
  return typeof e == "string" ? { __renderLambda: !0, handle: e, retentive: !1 } : e;
17
17
  }
18
- function Ee(e) {
18
+ function ke(e) {
19
19
  if (e.v3 !== void 0) {
20
20
  const {
21
21
  initialArgs: n,
@@ -105,19 +105,19 @@ function Ne(e) {
105
105
  function A(e) {
106
106
  throw new Error("Unexpected object: " + e);
107
107
  }
108
- const N = "upload://upload/", O = "index://index/";
108
+ const O = "upload://upload/", C = "index://index/";
109
109
  function B(e) {
110
- return e.startsWith(N);
110
+ return e.startsWith(O);
111
111
  }
112
112
  function U(e) {
113
- return e.startsWith(O);
113
+ return e.startsWith(C);
114
114
  }
115
115
  function K(e) {
116
116
  if (U(e)) {
117
- const n = e.slice(O.length);
117
+ const n = e.slice(C.length);
118
118
  return JSON.parse(decodeURIComponent(n)).path;
119
119
  } else if (B(e)) {
120
- const n = e.slice(N.length);
120
+ const n = e.slice(O.length);
121
121
  return JSON.parse(decodeURIComponent(n)).localPath;
122
122
  }
123
123
  A(e);
@@ -436,7 +436,7 @@ function _e(e) {
436
436
  name: e.name,
437
437
  domain: e.domain,
438
438
  parentAxes: e.parentAxes,
439
- axesId: C(e.axesSpec)
439
+ axesId: F(e.axesSpec)
440
440
  };
441
441
  }
442
442
  function qe(e) {
@@ -449,7 +449,7 @@ function y(e) {
449
449
  const { type: n, name: t, domain: r } = e, o = { type: n, name: t };
450
450
  return r && Object.entries(r).length > 0 && Object.assign(o, { domain: r }), o;
451
451
  }
452
- function C(e) {
452
+ function F(e) {
453
453
  return e.map(y);
454
454
  }
455
455
  function Te(e) {
@@ -520,10 +520,10 @@ function te(e) {
520
520
  function We(e) {
521
521
  return JSON.parse(e);
522
522
  }
523
- function E(e) {
523
+ function x(e) {
524
524
  return h(y(e));
525
525
  }
526
- function x(e, n) {
526
+ function S(e, n) {
527
527
  return JSON.stringify([e, n]);
528
528
  }
529
529
  class Ge {
@@ -548,14 +548,14 @@ class Ge {
548
548
  t.sort((r, o) => r[0].localeCompare(o[0]));
549
549
  for (const [r, o] of t) {
550
550
  for (let i = 0; i < o.axesSpec.length; i++) {
551
- const a = o.axesSpec[i], s = E(a);
551
+ const a = o.axesSpec[i], s = x(a);
552
552
  this.axes.set(s, { anchor: r, idx: i });
553
553
  }
554
554
  if (o.domain !== void 0) {
555
555
  const i = Object.entries(o.domain);
556
556
  i.sort((a, s) => a[0].localeCompare(s[0])), this.domainPackToAnchor.set(JSON.stringify(i), r), this.domainPacks.push(i.map(([a]) => a));
557
557
  for (const [a, s] of i) {
558
- const u = x(a, s);
558
+ const u = S(a, s);
559
559
  this.domains.set(u, r);
560
560
  }
561
561
  }
@@ -590,11 +590,11 @@ class Ge {
590
590
  for (const [a, s] of Object.entries(n.domain ?? {})) {
591
591
  if (o !== void 0 && o.has(a))
592
592
  continue;
593
- const u = x(a, s), c = this.domains.get(u);
593
+ const u = S(a, s), c = this.domains.get(u);
594
594
  r.domain ?? (r.domain = {}), r.domain[a] = c ? { anchor: c } : s;
595
595
  }
596
596
  if (r.axes = n.axesSpec.map((a) => {
597
- const s = E(a), u = this.axes.get(s);
597
+ const s = x(a), u = this.axes.get(s);
598
598
  return u === void 0 ? y(a) : u;
599
599
  }), !t || t.length === 0)
600
600
  return r;
@@ -771,7 +771,7 @@ function w(e, n) {
771
771
  se(e);
772
772
  }
773
773
  }
774
- function S(e, n) {
774
+ function v(e, n) {
775
775
  if (e.name !== void 0 && e.name !== n.name)
776
776
  return !1;
777
777
  if (e.type !== void 0) {
@@ -789,7 +789,7 @@ function S(e, n) {
789
789
  }
790
790
  return !0;
791
791
  }
792
- function v(e, n) {
792
+ function N(e, n) {
793
793
  if (n.name !== void 0 && e.name !== n.name || n.namePattern !== void 0 && !new RegExp(n.namePattern).test(e.name))
794
794
  return !1;
795
795
  if (n.type !== void 0) {
@@ -809,13 +809,13 @@ function v(e, n) {
809
809
  const t = e.axesSpec.map(y);
810
810
  if (n.partialAxesMatch) {
811
811
  for (const r of n.axes)
812
- if (!t.some((o) => S(r, o)))
812
+ if (!t.some((o) => v(r, o)))
813
813
  return !1;
814
814
  } else {
815
815
  if (t.length !== n.axes.length)
816
816
  return !1;
817
817
  for (let r = 0; r < n.axes.length; r++)
818
- if (!S(n.axes[r], t[r]))
818
+ if (!v(n.axes[r], t[r]))
819
819
  return !1;
820
820
  }
821
821
  }
@@ -836,14 +836,14 @@ function v(e, n) {
836
836
  return !0;
837
837
  }
838
838
  function rn(e) {
839
- return Array.isArray(e) ? (n) => e.some((t) => l(n) && v(n, t)) : (n) => l(n) && v(n, e);
839
+ return Array.isArray(e) ? (n) => e.some((t) => l(n) && N(n, t)) : (n) => l(n) && N(n, e);
840
840
  }
841
841
  function on(e) {
842
842
  const n = {
843
843
  kind: e.kind,
844
844
  name: e.name
845
845
  };
846
- return e.domain !== void 0 && (n.domain = e.domain), l(e) && (n.axesSpec = C(e.axesSpec)), h(n);
846
+ return e.domain !== void 0 && (n.domain = e.domain), l(e) && (n.axesSpec = F(e.axesSpec)), h(n);
847
847
  }
848
848
  const sn = { href: "/" }, an = m.object({
849
849
  __isRef: m.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
@@ -894,7 +894,7 @@ function ae(e) {
894
894
  );
895
895
  }
896
896
  const ue = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", ce = "0123456789ABCDEFGHIJKLMNOPQRSTUV", fe = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
897
- function F(e, n, t) {
897
+ function $(e, n, t) {
898
898
  t = t || {};
899
899
  let r, o;
900
900
  switch (n) {
@@ -921,14 +921,14 @@ function F(e, n, t) {
921
921
  c += "=";
922
922
  return c;
923
923
  }
924
- const $ = 15, de = 24, V = m.string().length(de).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
924
+ const V = 15, de = 24, j = m.string().length(de).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
925
925
  function mn() {
926
- const e = new Uint8Array($);
927
- return crypto.getRandomValues(e), V.parse(F(e, "RFC4648"));
926
+ const e = new Uint8Array(V);
927
+ return crypto.getRandomValues(e), j.parse($(e, "RFC4648"));
928
928
  }
929
929
  function le(e) {
930
- if (e.length !== $) throw new Error(`Wrong number of bytes: ${e.length}`);
931
- return V.parse(F(e, "RFC4648"));
930
+ if (e.length !== V) throw new Error(`Wrong number of bytes: ${e.length}`);
931
+ return j.parse($(e, "RFC4648"));
932
932
  }
933
933
  async function pn(e) {
934
934
  const n = new TextEncoder(), t = await crypto.subtle.digest("SHA-256", n.encode(e));
@@ -970,10 +970,10 @@ class pe extends Error {
970
970
  d(this, "name", "PFrameError");
971
971
  }
972
972
  }
973
- function kn(e) {
973
+ function En(e) {
974
974
  return e instanceof Error && e.name === "PFrameError";
975
975
  }
976
- class En extends pe {
976
+ class kn extends pe {
977
977
  constructor() {
978
978
  super(...arguments);
979
979
  d(this, "name", "PFrameError.Driver");
@@ -996,8 +996,8 @@ function ye(e) {
996
996
  function P(e) {
997
997
  return e instanceof Error ? e : new Error(ye(e));
998
998
  }
999
- function j(e) {
1000
- const n = e.cause ? j(e.cause) : void 0, t = new Error(e.message, n !== void 0 ? { cause: n } : void 0);
999
+ function E(e) {
1000
+ const n = e.cause ? E(e.cause) : void 0, t = new Error(e.message, n !== void 0 ? { cause: n } : void 0);
1001
1001
  return t.name = e.name || "Error", t.stack = e.stack, t;
1002
1002
  }
1003
1003
  function I(e) {
@@ -1011,14 +1011,14 @@ function I(e) {
1011
1011
  }
1012
1012
  function Sn(e) {
1013
1013
  if (e.error)
1014
- throw e.error;
1014
+ throw e.error instanceof Error ? e.error : E(e.error);
1015
1015
  return e.value;
1016
1016
  }
1017
1017
  function J(e) {
1018
1018
  return e.error ? { error: I(e.error) } : { value: e.value };
1019
1019
  }
1020
1020
  function vn(e) {
1021
- return e.error ? { error: j(e.error) } : { value: e.value };
1021
+ return e.error ? { error: E(e.error) } : { value: e.value };
1022
1022
  }
1023
1023
  function he(e) {
1024
1024
  try {
@@ -1113,7 +1113,7 @@ export {
1113
1113
  Ge as AnchoredIdDeriver,
1114
1114
  sn as DefaultNavigationState,
1115
1115
  be as IncompatibleFlagsError,
1116
- En as PFrameDriverError,
1116
+ kn as PFrameDriverError,
1117
1117
  pe as PFrameError,
1118
1118
  Y as PTableAbsent,
1119
1119
  Z as PTableNA,
@@ -1123,8 +1123,8 @@ export {
1123
1123
  q as PValueIntNA,
1124
1124
  k as PValueLongNA,
1125
1125
  T as PValueStringNA,
1126
- V as PlId,
1127
- $ as PlIdBytes,
1126
+ j as PlId,
1127
+ V as PlIdBytes,
1128
1128
  de as PlIdLength,
1129
1129
  an as PlRef,
1130
1130
  xe as RangeBytes,
@@ -1136,7 +1136,7 @@ export {
1136
1136
  cn as createPlRef,
1137
1137
  je as dataInfoToEntries,
1138
1138
  on as deriveNativeId,
1139
- j as deserializeError,
1139
+ E as deserializeError,
1140
1140
  vn as deserializeResult,
1141
1141
  pn as digestPlId,
1142
1142
  P as ensureError,
@@ -1147,9 +1147,9 @@ export {
1147
1147
  tn as extractAllColumns,
1148
1148
  Vn as extractAllRequirements,
1149
1149
  jn as extractAllSupports,
1150
- ke as extractCodeWithInfo,
1151
- Ee as extractConfigGeneric,
1152
- C as getAxesId,
1150
+ Ee as extractCodeWithInfo,
1151
+ ke as extractConfigGeneric,
1152
+ F as getAxesId,
1153
1153
  y as getAxisId,
1154
1154
  qe as getColumnIdAndSpec,
1155
1155
  Oe as getFileNameFromHandle,
@@ -1171,7 +1171,7 @@ export {
1171
1171
  l as isPColumnSpec,
1172
1172
  Ye as isPColumnSpecResult,
1173
1173
  xn as isPFrameDriverError,
1174
- kn as isPFrameError,
1174
+ En as isPFrameError,
1175
1175
  Ke as isPTableAbsent,
1176
1176
  W as isPValue,
1177
1177
  Ve as isPartitionedDataInfoEntries,
@@ -1184,9 +1184,9 @@ export {
1184
1184
  nn as mapPObjectData,
1185
1185
  ze as mapPTableDef,
1186
1186
  ln as mapValueInVOE,
1187
- S as matchAxis,
1187
+ v as matchAxis,
1188
1188
  ne as matchAxisId,
1189
- v as matchPColumn,
1189
+ N as matchPColumn,
1190
1190
  Se as newRangeBytesOpt,
1191
1191
  Me as pTableValue,
1192
1192
  Ue as pValueToStringOrNumber,