@milaboratories/pl-model-common 1.13.0 → 1.13.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
|
@@ -3,7 +3,7 @@ var L = (n, t, e) => t in n ? $(n, t, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var p = (n, t, e) => L(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import g from "canonicalize";
|
|
5
5
|
import { z as y } from "zod";
|
|
6
|
-
function
|
|
6
|
+
function un(n) {
|
|
7
7
|
return n !== void 0 && n.startsWith("log+live://log/");
|
|
8
8
|
}
|
|
9
9
|
function w(n) {
|
|
@@ -29,10 +29,10 @@ function j(n) {
|
|
|
29
29
|
function B(n) {
|
|
30
30
|
return n.replace(/^.*[\\/]/, "");
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function fn(n) {
|
|
33
33
|
return B(j(n));
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function dn(n) {
|
|
36
36
|
if (!n || typeof n != "object")
|
|
37
37
|
return !1;
|
|
38
38
|
const t = n;
|
|
@@ -49,7 +49,7 @@ function yn(n) {
|
|
|
49
49
|
return !1;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function pn(n, t) {
|
|
53
53
|
if (n !== void 0)
|
|
54
54
|
switch (n.type) {
|
|
55
55
|
case "Json":
|
|
@@ -77,7 +77,7 @@ function mn(n, t) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function yn(n) {
|
|
81
81
|
if (!n || typeof n != "object")
|
|
82
82
|
return !1;
|
|
83
83
|
const t = n;
|
|
@@ -94,7 +94,7 @@ function ln(n) {
|
|
|
94
94
|
return !1;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function mn(n) {
|
|
98
98
|
switch (n.type) {
|
|
99
99
|
case "Json": {
|
|
100
100
|
const t = Object.entries(n.data).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
|
|
@@ -122,7 +122,7 @@ function hn(n) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function ln(n) {
|
|
126
126
|
switch (n.type) {
|
|
127
127
|
case "Json": {
|
|
128
128
|
const t = {};
|
|
@@ -156,7 +156,7 @@ function bn(n) {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function hn(n, t) {
|
|
160
160
|
if (n !== void 0)
|
|
161
161
|
switch (n.type) {
|
|
162
162
|
case "Json":
|
|
@@ -186,7 +186,7 @@ function gn(n, t) {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
const I = -2147483648, A = -9007199254740991n,
|
|
189
|
+
const I = -2147483648, A = -9007199254740991n, bn = NaN, gn = NaN, F = null, U = null;
|
|
190
190
|
function h(n, t) {
|
|
191
191
|
switch (t) {
|
|
192
192
|
case "Int":
|
|
@@ -194,22 +194,22 @@ function h(n, t) {
|
|
|
194
194
|
case "Long":
|
|
195
195
|
return n === Number(A) || n === A;
|
|
196
196
|
case "Float":
|
|
197
|
-
return n
|
|
197
|
+
return Number.isNaN(n);
|
|
198
198
|
case "Double":
|
|
199
|
-
return n
|
|
199
|
+
return Number.isNaN(n);
|
|
200
200
|
case "String":
|
|
201
|
-
return n ===
|
|
201
|
+
return n === F;
|
|
202
202
|
case "Bytes":
|
|
203
|
-
return n ===
|
|
203
|
+
return n === U;
|
|
204
204
|
default:
|
|
205
205
|
throw Error(`unsupported data type: ${t}`);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
function wn(n) {
|
|
209
|
-
if (!
|
|
209
|
+
if (!K(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
|
|
210
210
|
return n;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function K(n, t) {
|
|
213
213
|
if (!t)
|
|
214
214
|
return typeof n == "string" || typeof n == "number" && isFinite(n) || typeof n == "bigint";
|
|
215
215
|
if (h(n, t)) return !1;
|
|
@@ -230,7 +230,7 @@ function M(n, t) {
|
|
|
230
230
|
throw Error(`unsupported data type: ${t}`);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function R(n, t) {
|
|
234
234
|
if (!t)
|
|
235
235
|
return n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint";
|
|
236
236
|
if (h(n, t)) return !0;
|
|
@@ -256,9 +256,9 @@ function An(n) {
|
|
|
256
256
|
if (typeof n == "bigint") return { bigint: n.toString() };
|
|
257
257
|
throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`);
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function M(n, t) {
|
|
260
260
|
if (n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint") {
|
|
261
|
-
if (t && !h(n, t) && !
|
|
261
|
+
if (t && !h(n, t) && !R(n, t))
|
|
262
262
|
throw new Error(`Unexpected value type, got ${typeof n}, expected ${t}`);
|
|
263
263
|
return n;
|
|
264
264
|
}
|
|
@@ -270,11 +270,11 @@ function v(n, t) {
|
|
|
270
270
|
throw new Error(`Unsupported type ${typeof n} (value ${n}).`);
|
|
271
271
|
}
|
|
272
272
|
function Pn(n) {
|
|
273
|
-
if (n =
|
|
273
|
+
if (n = _(n), n === null) throw new Error("Value is null");
|
|
274
274
|
return n;
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
if (n =
|
|
276
|
+
function _(n) {
|
|
277
|
+
if (n = M(n), n === null) return null;
|
|
278
278
|
if (typeof n == "string") return n;
|
|
279
279
|
if (typeof n == "number") {
|
|
280
280
|
if (!isFinite(n)) throw new Error(`Value is not finite (${n})`);
|
|
@@ -284,19 +284,19 @@ function H(n) {
|
|
|
284
284
|
return Number(n);
|
|
285
285
|
throw new Error(`Unexpected value type: ${typeof n}`);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function v(n, t) {
|
|
288
288
|
const e = Math.floor(t / 8), r = 1 << 7 - t % 8;
|
|
289
289
|
return (n[e] & r) > 0;
|
|
290
290
|
}
|
|
291
|
-
const
|
|
291
|
+
const H = { type: "absent" }, T = null;
|
|
292
292
|
function xn(n) {
|
|
293
293
|
return typeof n == "object" && n !== null && n.type === "absent";
|
|
294
294
|
}
|
|
295
295
|
function kn(n, t, e = {}) {
|
|
296
|
-
if (
|
|
297
|
-
return e.absent === void 0 ?
|
|
296
|
+
if (v(n.absent, t))
|
|
297
|
+
return e.absent === void 0 ? H : e.absent;
|
|
298
298
|
const r = n.data[t], o = n.type;
|
|
299
|
-
if (h(r, o)) return e.na === void 0 ?
|
|
299
|
+
if (h(r, o)) return e.na === void 0 ? T : e.na;
|
|
300
300
|
switch (o) {
|
|
301
301
|
case "Int":
|
|
302
302
|
return r;
|
|
@@ -324,15 +324,15 @@ function Nn(n) {
|
|
|
324
324
|
function Sn(n) {
|
|
325
325
|
return g(m(n));
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function W(n, t) {
|
|
328
328
|
if (n === void 0) return t === void 0;
|
|
329
329
|
if (t === void 0) return !0;
|
|
330
330
|
for (const e in t)
|
|
331
331
|
if (n[e] !== t[e]) return !1;
|
|
332
332
|
return !0;
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
return n.name === t.name &&
|
|
334
|
+
function X(n, t) {
|
|
335
|
+
return n.name === t.name && W(n.domain, t.domain);
|
|
336
336
|
}
|
|
337
337
|
function En(n, t) {
|
|
338
338
|
return { ...n, src: l(n.src, t) };
|
|
@@ -360,7 +360,7 @@ function l(n, t) {
|
|
|
360
360
|
w(n);
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function z(n) {
|
|
364
364
|
return g(n);
|
|
365
365
|
}
|
|
366
366
|
function Cn(n) {
|
|
@@ -470,7 +470,7 @@ class On {
|
|
|
470
470
|
* @returns A canonicalized string representation of the anchored column identifier
|
|
471
471
|
*/
|
|
472
472
|
deriveS(t, e) {
|
|
473
|
-
return
|
|
473
|
+
return z(this.derive(t, e));
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
function Jn(n, t) {
|
|
@@ -497,10 +497,10 @@ function Jn(n, t) {
|
|
|
497
497
|
}
|
|
498
498
|
e.domain = r;
|
|
499
499
|
}
|
|
500
|
-
return e.axes && (e.axes = e.axes.map((r) =>
|
|
500
|
+
return e.axes && (e.axes = e.axes.map((r) => G(n, r))), e;
|
|
501
501
|
}
|
|
502
|
-
function
|
|
503
|
-
if (!
|
|
502
|
+
function G(n, t) {
|
|
503
|
+
if (!Q(t))
|
|
504
504
|
return t;
|
|
505
505
|
const e = t.anchor, r = n[e];
|
|
506
506
|
if (!r)
|
|
@@ -517,7 +517,7 @@ function Y(n, t) {
|
|
|
517
517
|
throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
|
|
518
518
|
return o[0];
|
|
519
519
|
} else if ("id" in t) {
|
|
520
|
-
const o = r.axesSpec.filter((i) =>
|
|
520
|
+
const o = r.axesSpec.filter((i) => X(t.id, m(i)));
|
|
521
521
|
if (o.length > 1)
|
|
522
522
|
throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
|
|
523
523
|
if (o.length === 0)
|
|
@@ -526,7 +526,7 @@ function Y(n, t) {
|
|
|
526
526
|
}
|
|
527
527
|
throw new Error("Unsupported axis reference type");
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function Q(n) {
|
|
530
530
|
return typeof n == "object" && "anchor" in n;
|
|
531
531
|
}
|
|
532
532
|
function $n(n) {
|
|
@@ -535,7 +535,7 @@ function $n(n) {
|
|
|
535
535
|
function f(n) {
|
|
536
536
|
return n.kind === "PColumn";
|
|
537
537
|
}
|
|
538
|
-
function
|
|
538
|
+
function Y(n) {
|
|
539
539
|
return f(n.spec);
|
|
540
540
|
}
|
|
541
541
|
function Ln(n) {
|
|
@@ -545,7 +545,7 @@ function Vn(n) {
|
|
|
545
545
|
return f(n.obj.spec);
|
|
546
546
|
}
|
|
547
547
|
function Dn(n) {
|
|
548
|
-
if (!
|
|
548
|
+
if (!Y(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
|
|
549
549
|
return n;
|
|
550
550
|
}
|
|
551
551
|
function jn(n, t) {
|
|
@@ -574,7 +574,7 @@ function Bn(n) {
|
|
|
574
574
|
};
|
|
575
575
|
return e(n), [...t.values()];
|
|
576
576
|
}
|
|
577
|
-
function
|
|
577
|
+
function Z(n) {
|
|
578
578
|
throw new Error("Unexpected object: " + n);
|
|
579
579
|
}
|
|
580
580
|
function b(n, t) {
|
|
@@ -606,7 +606,7 @@ function b(n, t) {
|
|
|
606
606
|
)
|
|
607
607
|
);
|
|
608
608
|
default:
|
|
609
|
-
|
|
609
|
+
Z(n);
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
612
|
function k(n, t) {
|
|
@@ -692,7 +692,7 @@ function Rn(n, t) {
|
|
|
692
692
|
function Mn(n, t) {
|
|
693
693
|
return n.ok ? { ok: !0, value: t(n.value) } : n;
|
|
694
694
|
}
|
|
695
|
-
function
|
|
695
|
+
function q(n) {
|
|
696
696
|
if (n instanceof Int8Array || n instanceof Uint8Array || n instanceof Uint8ClampedArray)
|
|
697
697
|
return new DataView(n.buffer, n.byteOffset, n.byteLength);
|
|
698
698
|
if (n instanceof ArrayBuffer) return new DataView(n);
|
|
@@ -700,25 +700,25 @@ function tn(n) {
|
|
|
700
700
|
"Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray"
|
|
701
701
|
);
|
|
702
702
|
}
|
|
703
|
-
const
|
|
703
|
+
const nn = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", tn = "0123456789ABCDEFGHIJKLMNOPQRSTUV", en = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
704
704
|
function C(n, t, e) {
|
|
705
705
|
e = e || {};
|
|
706
706
|
let r, o;
|
|
707
707
|
switch (t) {
|
|
708
708
|
case "RFC3548":
|
|
709
709
|
case "RFC4648":
|
|
710
|
-
r =
|
|
710
|
+
r = nn, o = !0;
|
|
711
711
|
break;
|
|
712
712
|
case "RFC4648-HEX":
|
|
713
|
-
r =
|
|
713
|
+
r = tn, o = !0;
|
|
714
714
|
break;
|
|
715
715
|
case "Crockford":
|
|
716
|
-
r =
|
|
716
|
+
r = en, o = !1;
|
|
717
717
|
break;
|
|
718
718
|
default:
|
|
719
719
|
throw new Error("Unknown base32 variant: " + String(t));
|
|
720
720
|
}
|
|
721
|
-
const i = e.padding !== void 0 ? e.padding : o, s =
|
|
721
|
+
const i = e.padding !== void 0 ? e.padding : o, s = q(n);
|
|
722
722
|
let a = 0, c = 0, u = "";
|
|
723
723
|
for (let d = 0; d < s.byteLength; d++)
|
|
724
724
|
for (c = c << 8 | s.getUint8(d), a += 8; a >= 5; )
|
|
@@ -728,81 +728,81 @@ function C(n, t, e) {
|
|
|
728
728
|
u += "=";
|
|
729
729
|
return u;
|
|
730
730
|
}
|
|
731
|
-
const O = 15,
|
|
731
|
+
const O = 15, rn = 24, J = y.string().length(rn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
|
|
732
732
|
function _n() {
|
|
733
733
|
const n = new Uint8Array(O);
|
|
734
734
|
return crypto.getRandomValues(n), J.parse(C(n, "RFC4648"));
|
|
735
735
|
}
|
|
736
|
-
function
|
|
736
|
+
function on(n) {
|
|
737
737
|
if (n.length !== O) throw new Error(`Wrong number of bytes: ${n.length}`);
|
|
738
738
|
return J.parse(C(n, "RFC4648"));
|
|
739
739
|
}
|
|
740
740
|
async function vn(n) {
|
|
741
741
|
const t = new TextEncoder(), e = await crypto.subtle.digest("SHA-256", t.encode(n));
|
|
742
|
-
return
|
|
742
|
+
return on(new Uint8Array(e.slice(0, 15)));
|
|
743
743
|
}
|
|
744
744
|
export {
|
|
745
745
|
On as AnchoredIdDeriver,
|
|
746
746
|
Fn as DefaultNavigationState,
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
747
|
+
H as PTableAbsent,
|
|
748
|
+
T as PTableNA,
|
|
749
|
+
U as PValueBytesNA,
|
|
750
|
+
gn as PValueDoubleNA,
|
|
751
|
+
bn as PValueFloatNA,
|
|
752
752
|
I as PValueIntNA,
|
|
753
753
|
A as PValueLongNA,
|
|
754
|
-
|
|
754
|
+
F as PValueStringNA,
|
|
755
755
|
J as PlId,
|
|
756
756
|
O as PlIdBytes,
|
|
757
|
-
|
|
757
|
+
rn as PlIdLength,
|
|
758
758
|
Un as PlRef,
|
|
759
759
|
Sn as canonicalizeAxisId,
|
|
760
|
-
|
|
760
|
+
mn as dataInfoToEntries,
|
|
761
761
|
vn as digestPlId,
|
|
762
762
|
wn as ensureNotNAPValue,
|
|
763
763
|
Dn as ensurePColumn,
|
|
764
|
-
|
|
764
|
+
ln as entriesToDataInfo,
|
|
765
765
|
b as executePSpecPredicate,
|
|
766
766
|
Bn as extractAllColumns,
|
|
767
767
|
Nn as getAxesId,
|
|
768
768
|
m as getAxisId,
|
|
769
|
-
|
|
769
|
+
fn as getFileNameFromHandle,
|
|
770
770
|
j as getFilePathFromHandle,
|
|
771
|
-
|
|
772
|
-
|
|
771
|
+
dn as isDataInfo,
|
|
772
|
+
yn as isDataInfoEntries,
|
|
773
773
|
$n as isFilteredPColumn,
|
|
774
774
|
D as isImportFileHandleIndex,
|
|
775
775
|
V as isImportFileHandleUpload,
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
776
|
+
un as isLiveLog,
|
|
777
|
+
K as isNotNAPValue,
|
|
778
|
+
Y as isPColumn,
|
|
779
779
|
Vn as isPColumnResult,
|
|
780
780
|
f as isPColumnSpec,
|
|
781
781
|
Ln as isPColumnSpecResult,
|
|
782
782
|
xn as isPTableAbsent,
|
|
783
|
-
|
|
783
|
+
R as isPValue,
|
|
784
784
|
Kn as isPlRef,
|
|
785
|
-
|
|
785
|
+
v as isValueAbsent,
|
|
786
786
|
h as isValueNA,
|
|
787
|
-
|
|
788
|
-
|
|
787
|
+
pn as mapDataInfo,
|
|
788
|
+
hn as mapDataInfoEntries,
|
|
789
789
|
l as mapJoinEntry,
|
|
790
790
|
jn as mapPObjectData,
|
|
791
791
|
En as mapPTableDef,
|
|
792
792
|
Mn as mapValueInVOE,
|
|
793
793
|
k as matchAxis,
|
|
794
|
-
|
|
794
|
+
X as matchAxisId,
|
|
795
795
|
N as matchPColumn,
|
|
796
796
|
kn as pTableValue,
|
|
797
797
|
Pn as pValueToStringOrNumber,
|
|
798
|
-
|
|
798
|
+
_ as pValueToStringOrNumberOrNull,
|
|
799
799
|
Cn as parseColumnId,
|
|
800
|
-
|
|
800
|
+
on as plId,
|
|
801
801
|
Rn as plRefsEqual,
|
|
802
802
|
Jn as resolveAnchors,
|
|
803
|
-
|
|
803
|
+
M as safeConvertToPValue,
|
|
804
804
|
In as selectorsToPredicate,
|
|
805
|
-
|
|
805
|
+
z as stringifyColumnId,
|
|
806
806
|
An as toJsonSafePValue,
|
|
807
807
|
_n as uniquePlId
|
|
808
808
|
};
|