@milaboratories/pl-model-common 1.10.6 → 1.11.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/drivers/pframe/column_filter.d.ts +1 -1
- package/dist/drivers/pframe/column_filter.d.ts.map +1 -1
- package/dist/drivers/pframe/data.d.ts +1 -1
- package/dist/drivers/pframe/data.d.ts.map +1 -1
- package/dist/drivers/pframe/driver.d.ts +1 -1
- package/dist/drivers/pframe/driver.d.ts.map +1 -1
- package/dist/drivers/pframe/find_columns.d.ts +1 -1
- package/dist/drivers/pframe/find_columns.d.ts.map +1 -1
- package/dist/drivers/pframe/index.d.ts +2 -1
- package/dist/drivers/pframe/index.d.ts.map +1 -1
- package/dist/drivers/pframe/pframe.d.ts +1 -1
- package/dist/drivers/pframe/pframe.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/anchored_id.d.ts +47 -0
- package/dist/drivers/pframe/spec/anchored_id.d.ts.map +1 -0
- package/dist/drivers/pframe/spec/index.d.ts +4 -0
- package/dist/drivers/pframe/spec/index.d.ts.map +1 -0
- package/dist/drivers/pframe/spec/selectors.d.ts +165 -0
- package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -0
- package/dist/drivers/pframe/{spec.d.ts → spec/spec.d.ts} +1 -1
- package/dist/drivers/pframe/spec/spec.d.ts.map +1 -0
- package/dist/drivers/pframe/table_common.d.ts +1 -1
- package/dist/drivers/pframe/table_common.d.ts.map +1 -1
- package/dist/drivers/pframe/unique_values.d.ts +1 -1
- package/dist/drivers/pframe/unique_values.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +472 -245
- package/dist/index.mjs.map +1 -1
- package/dist/ref.d.ts +7 -0
- package/dist/ref.d.ts.map +1 -1
- package/package.json +8 -2
- package/src/drivers/pframe/column_filter.ts +1 -1
- package/src/drivers/pframe/data.ts +1 -1
- package/src/drivers/pframe/driver.ts +1 -1
- package/src/drivers/pframe/find_columns.ts +1 -1
- package/src/drivers/pframe/index.ts +3 -1
- package/src/drivers/pframe/pframe.ts +1 -1
- package/src/drivers/pframe/spec/anchored_id.ts +215 -0
- package/src/drivers/pframe/spec/index.ts +3 -0
- package/src/drivers/pframe/spec/selectors.test.ts +209 -0
- package/src/drivers/pframe/spec/selectors.ts +267 -0
- package/src/drivers/pframe/{spec.ts → spec/spec.ts} +3 -3
- package/src/drivers/pframe/table_common.ts +1 -1
- package/src/drivers/pframe/unique_values.ts +1 -1
- package/src/ref.ts +17 -0
- package/dist/drivers/pframe/spec.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,144 +1,148 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
var $ = Object.defineProperty;
|
|
2
|
+
var F = (n, t, e) => t in n ? $(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var d = (n, t, e) => F(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import k from "canonicalize";
|
|
5
|
+
import { z as m } from "zod";
|
|
6
|
+
function un(n) {
|
|
7
|
+
return n !== void 0 && n.startsWith("log+live://log/");
|
|
8
|
+
}
|
|
9
|
+
function g(n) {
|
|
10
|
+
throw new Error("Unexpected object: " + n);
|
|
11
|
+
}
|
|
12
|
+
const I = "upload://upload/", N = "index://index/";
|
|
13
|
+
function D(n) {
|
|
14
|
+
return n.startsWith(I);
|
|
15
|
+
}
|
|
16
|
+
function U(n) {
|
|
17
|
+
return n.startsWith(N);
|
|
18
|
+
}
|
|
19
|
+
function O(n) {
|
|
20
|
+
if (U(n)) {
|
|
21
|
+
const t = n.slice(N.length);
|
|
22
|
+
return JSON.parse(decodeURIComponent(t)).path;
|
|
23
|
+
} else if (D(n)) {
|
|
24
|
+
const t = n.slice(I.length);
|
|
25
|
+
return JSON.parse(decodeURIComponent(t)).localPath;
|
|
22
26
|
}
|
|
23
|
-
|
|
27
|
+
g(n);
|
|
24
28
|
}
|
|
25
|
-
function
|
|
26
|
-
return
|
|
29
|
+
function B(n) {
|
|
30
|
+
return n.replace(/^.*[\\/]/, "");
|
|
27
31
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
32
|
+
function dn(n) {
|
|
33
|
+
return B(O(n));
|
|
30
34
|
}
|
|
31
|
-
const
|
|
32
|
-
function
|
|
33
|
-
switch (
|
|
35
|
+
const R = -2147483648, w = -9007199254740991n, j = NaN, L = NaN, M = null, _ = null;
|
|
36
|
+
function p(n, t) {
|
|
37
|
+
switch (t) {
|
|
34
38
|
case "Int":
|
|
35
|
-
return
|
|
39
|
+
return n === R;
|
|
36
40
|
case "Long":
|
|
37
|
-
return
|
|
41
|
+
return n === Number(w) || n === w;
|
|
38
42
|
case "Float":
|
|
39
|
-
return
|
|
43
|
+
return n === j;
|
|
40
44
|
case "Double":
|
|
41
|
-
return
|
|
45
|
+
return n === L;
|
|
42
46
|
case "String":
|
|
43
|
-
return
|
|
47
|
+
return n === M;
|
|
44
48
|
case "Bytes":
|
|
45
|
-
return
|
|
49
|
+
return n === _;
|
|
46
50
|
default:
|
|
47
|
-
throw Error(`unsupported data type: ${
|
|
51
|
+
throw Error(`unsupported data type: ${t}`);
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
|
-
function
|
|
51
|
-
if (!
|
|
52
|
-
return
|
|
54
|
+
function mn(n) {
|
|
55
|
+
if (!H(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
|
|
56
|
+
return n;
|
|
53
57
|
}
|
|
54
|
-
function
|
|
55
|
-
if (!
|
|
56
|
-
return typeof
|
|
57
|
-
if (
|
|
58
|
-
switch (
|
|
58
|
+
function H(n, t) {
|
|
59
|
+
if (!t)
|
|
60
|
+
return typeof n == "string" || typeof n == "number" && isFinite(n) || typeof n == "bigint";
|
|
61
|
+
if (p(n, t)) return !1;
|
|
62
|
+
switch (t) {
|
|
59
63
|
case "Int":
|
|
60
|
-
return typeof
|
|
64
|
+
return typeof n == "number";
|
|
61
65
|
case "Long":
|
|
62
|
-
return typeof
|
|
66
|
+
return typeof n == "number" || typeof n == "bigint";
|
|
63
67
|
case "Float":
|
|
64
|
-
return typeof
|
|
68
|
+
return typeof n == "number";
|
|
65
69
|
case "Double":
|
|
66
|
-
return typeof
|
|
70
|
+
return typeof n == "number";
|
|
67
71
|
case "String":
|
|
68
|
-
return typeof
|
|
72
|
+
return typeof n == "string";
|
|
69
73
|
case "Bytes":
|
|
70
74
|
throw Error("Bytes not yet supported");
|
|
71
75
|
default:
|
|
72
|
-
throw Error(`unsupported data type: ${
|
|
76
|
+
throw Error(`unsupported data type: ${t}`);
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
|
-
function
|
|
76
|
-
if (!
|
|
77
|
-
return
|
|
78
|
-
if (
|
|
79
|
-
switch (
|
|
79
|
+
function J(n, t) {
|
|
80
|
+
if (!t)
|
|
81
|
+
return n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint";
|
|
82
|
+
if (p(n, t)) return !0;
|
|
83
|
+
switch (t) {
|
|
80
84
|
case "Int":
|
|
81
|
-
return typeof
|
|
85
|
+
return typeof n == "number";
|
|
82
86
|
case "Long":
|
|
83
|
-
return typeof
|
|
87
|
+
return typeof n == "number" || typeof n == "bigint";
|
|
84
88
|
case "Float":
|
|
85
|
-
return typeof
|
|
89
|
+
return typeof n == "number";
|
|
86
90
|
case "Double":
|
|
87
|
-
return typeof
|
|
91
|
+
return typeof n == "number";
|
|
88
92
|
case "String":
|
|
89
|
-
return typeof
|
|
93
|
+
return typeof n == "string";
|
|
90
94
|
case "Bytes":
|
|
91
95
|
throw Error("Bytes not yet supported");
|
|
92
96
|
default:
|
|
93
|
-
throw Error(`unsupported data type: ${
|
|
97
|
+
throw Error(`unsupported data type: ${t}`);
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
|
-
function
|
|
97
|
-
if (
|
|
98
|
-
if (typeof
|
|
99
|
-
throw new Error(`Type ${typeof
|
|
100
|
+
function ln(n) {
|
|
101
|
+
if (n === null || typeof n == "string" || typeof n == "number") return n;
|
|
102
|
+
if (typeof n == "bigint") return { bigint: n.toString() };
|
|
103
|
+
throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`);
|
|
100
104
|
}
|
|
101
|
-
function
|
|
102
|
-
if (
|
|
103
|
-
if (
|
|
104
|
-
throw new Error(`Unexpected value type, got ${typeof
|
|
105
|
-
return
|
|
105
|
+
function K(n, t) {
|
|
106
|
+
if (n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint") {
|
|
107
|
+
if (t && !p(n, t) && !J(n, t))
|
|
108
|
+
throw new Error(`Unexpected value type, got ${typeof n}, expected ${t}`);
|
|
109
|
+
return n;
|
|
106
110
|
}
|
|
107
|
-
if (typeof
|
|
108
|
-
if (
|
|
109
|
-
throw new Error(`Unexpected value type, got serialized bigint, expected ${
|
|
110
|
-
return BigInt(
|
|
111
|
+
if (typeof n == "object" && n !== null && "bigint" in n && typeof n.bigint == "string") {
|
|
112
|
+
if (t && t !== "Long")
|
|
113
|
+
throw new Error(`Unexpected value type, got serialized bigint, expected ${t}`);
|
|
114
|
+
return BigInt(n.bigint);
|
|
111
115
|
}
|
|
112
|
-
throw new Error(`Unsupported type ${typeof
|
|
113
|
-
}
|
|
114
|
-
function
|
|
115
|
-
if (
|
|
116
|
-
return
|
|
117
|
-
}
|
|
118
|
-
function
|
|
119
|
-
if (
|
|
120
|
-
if (typeof
|
|
121
|
-
if (typeof
|
|
122
|
-
if (!isFinite(
|
|
123
|
-
return
|
|
116
|
+
throw new Error(`Unsupported type ${typeof n} (value ${n}).`);
|
|
117
|
+
}
|
|
118
|
+
function pn(n) {
|
|
119
|
+
if (n = T(n), n === null) throw new Error("Value is null");
|
|
120
|
+
return n;
|
|
121
|
+
}
|
|
122
|
+
function T(n) {
|
|
123
|
+
if (n = K(n), n === null) return null;
|
|
124
|
+
if (typeof n == "string") return n;
|
|
125
|
+
if (typeof n == "number") {
|
|
126
|
+
if (!isFinite(n)) throw new Error(`Value is not finite (${n})`);
|
|
127
|
+
return n;
|
|
124
128
|
}
|
|
125
|
-
if (typeof
|
|
126
|
-
return Number(
|
|
127
|
-
throw new Error(`Unexpected value type: ${typeof
|
|
128
|
-
}
|
|
129
|
-
function
|
|
130
|
-
const e = Math.floor(
|
|
131
|
-
return (
|
|
132
|
-
}
|
|
133
|
-
const
|
|
134
|
-
function
|
|
135
|
-
return typeof
|
|
136
|
-
}
|
|
137
|
-
function
|
|
138
|
-
if (
|
|
139
|
-
return e.absent === void 0 ?
|
|
140
|
-
const r =
|
|
141
|
-
if (
|
|
129
|
+
if (typeof n == "bigint")
|
|
130
|
+
return Number(n);
|
|
131
|
+
throw new Error(`Unexpected value type: ${typeof n}`);
|
|
132
|
+
}
|
|
133
|
+
function W(n, t) {
|
|
134
|
+
const e = Math.floor(t / 8), r = 1 << 7 - t % 8;
|
|
135
|
+
return (n[e] & r) > 0;
|
|
136
|
+
}
|
|
137
|
+
const X = { type: "absent" }, G = null;
|
|
138
|
+
function hn(n) {
|
|
139
|
+
return typeof n == "object" && n !== null && n.type === "absent";
|
|
140
|
+
}
|
|
141
|
+
function yn(n, t, e = {}) {
|
|
142
|
+
if (W(n.absent, t))
|
|
143
|
+
return e.absent === void 0 ? X : e.absent;
|
|
144
|
+
const r = n.data[t], o = n.type;
|
|
145
|
+
if (p(r, o)) return e.na === void 0 ? G : e.na;
|
|
142
146
|
switch (o) {
|
|
143
147
|
case "Int":
|
|
144
148
|
return r;
|
|
@@ -156,86 +160,223 @@ function et(t, n, e = {}) {
|
|
|
156
160
|
throw Error(`unsupported data type: ${o}`);
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
|
-
function
|
|
160
|
-
const { type:
|
|
161
|
-
return { type:
|
|
163
|
+
function h(n) {
|
|
164
|
+
const { type: t, name: e, domain: r } = n;
|
|
165
|
+
return { type: t, name: e, ...r && { domain: r } };
|
|
162
166
|
}
|
|
163
|
-
function
|
|
164
|
-
return
|
|
167
|
+
function bn(n) {
|
|
168
|
+
return n.map(h);
|
|
165
169
|
}
|
|
166
|
-
function
|
|
167
|
-
if (
|
|
168
|
-
if (
|
|
169
|
-
for (const e in
|
|
170
|
-
if (
|
|
170
|
+
function Q(n, t) {
|
|
171
|
+
if (n === void 0) return t === void 0;
|
|
172
|
+
if (t === void 0) return !0;
|
|
173
|
+
for (const e in t)
|
|
174
|
+
if (n[e] !== t[e]) return !1;
|
|
171
175
|
return !0;
|
|
172
176
|
}
|
|
173
|
-
function
|
|
174
|
-
return
|
|
177
|
+
function z(n, t) {
|
|
178
|
+
return n.name === t.name && Q(n.domain, t.domain);
|
|
175
179
|
}
|
|
176
|
-
function
|
|
177
|
-
return { ...
|
|
180
|
+
function gn(n, t) {
|
|
181
|
+
return { ...n, src: l(n.src, t) };
|
|
178
182
|
}
|
|
179
|
-
function
|
|
180
|
-
switch (
|
|
183
|
+
function l(n, t) {
|
|
184
|
+
switch (n.type) {
|
|
181
185
|
case "column":
|
|
182
186
|
return {
|
|
183
187
|
type: "column",
|
|
184
|
-
column: n
|
|
188
|
+
column: t(n.column)
|
|
185
189
|
};
|
|
186
190
|
case "inner":
|
|
187
191
|
case "full":
|
|
188
192
|
return {
|
|
189
|
-
type:
|
|
190
|
-
entries:
|
|
193
|
+
type: n.type,
|
|
194
|
+
entries: n.entries.map((e) => l(e, t))
|
|
191
195
|
};
|
|
192
196
|
case "outer":
|
|
193
197
|
return {
|
|
194
198
|
type: "outer",
|
|
195
|
-
primary:
|
|
196
|
-
secondary:
|
|
199
|
+
primary: l(n.primary, t),
|
|
200
|
+
secondary: n.secondary.map((e) => l(e, t))
|
|
197
201
|
};
|
|
198
202
|
default:
|
|
199
|
-
|
|
203
|
+
g(n);
|
|
200
204
|
}
|
|
201
205
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
206
|
+
function A(n) {
|
|
207
|
+
return k(h(n));
|
|
208
|
+
}
|
|
209
|
+
function x(n, t) {
|
|
210
|
+
return JSON.stringify([n, t]);
|
|
211
|
+
}
|
|
212
|
+
class wn {
|
|
213
|
+
/**
|
|
214
|
+
* Creates a new anchor context from a set of anchor column specifications
|
|
215
|
+
* @param anchors Record of anchor column specifications indexed by anchor ID
|
|
216
|
+
*/
|
|
217
|
+
constructor(t) {
|
|
218
|
+
d(this, "domains", /* @__PURE__ */ new Map());
|
|
219
|
+
d(this, "axes", /* @__PURE__ */ new Map());
|
|
220
|
+
/**
|
|
221
|
+
* Domain packs are used to group domain keys that can be anchored to the same anchor
|
|
222
|
+
* This is used to optimize the lookup of domain anchors
|
|
223
|
+
*/
|
|
224
|
+
d(this, "domainPacks", []);
|
|
225
|
+
/**
|
|
226
|
+
* Maps domain packs to anchors
|
|
227
|
+
*/
|
|
228
|
+
d(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
|
|
229
|
+
this.anchors = t;
|
|
230
|
+
const e = Object.entries(t);
|
|
231
|
+
e.sort((r, o) => r[0].localeCompare(o[0]));
|
|
232
|
+
for (const [r, o] of e) {
|
|
233
|
+
for (let i = 0; i < o.axesSpec.length; i++) {
|
|
234
|
+
const a = o.axesSpec[i], s = A(a);
|
|
235
|
+
this.axes.set(s, { anchor: r, idx: i });
|
|
236
|
+
}
|
|
237
|
+
if (o.domain !== void 0) {
|
|
238
|
+
const i = Object.entries(o.domain);
|
|
239
|
+
i.sort((a, s) => a[0].localeCompare(s[0])), this.domainPackToAnchor.set(JSON.stringify(i), r), this.domainPacks.push(i.map(([a]) => a));
|
|
240
|
+
for (const [a, s] of i) {
|
|
241
|
+
const c = x(a, s);
|
|
242
|
+
this.domains.set(c, r);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Derives an anchored column identifier from a column specification
|
|
249
|
+
* Replaces domain values and axes with anchored references when possible
|
|
250
|
+
* @param spec Column specification to anchor
|
|
251
|
+
* @returns An anchored column identifier that can be used to identify columns similar to the input specification
|
|
252
|
+
*/
|
|
253
|
+
derive(t) {
|
|
254
|
+
const e = {
|
|
255
|
+
name: t.name,
|
|
256
|
+
axes: []
|
|
257
|
+
};
|
|
258
|
+
let r;
|
|
259
|
+
if (t.domain !== void 0)
|
|
260
|
+
n:
|
|
261
|
+
for (const o of this.domainPacks) {
|
|
262
|
+
const i = [];
|
|
263
|
+
for (const s of o) {
|
|
264
|
+
const c = t.domain[s];
|
|
265
|
+
if (c !== void 0)
|
|
266
|
+
i.push([s, c]);
|
|
267
|
+
else
|
|
268
|
+
break n;
|
|
269
|
+
}
|
|
270
|
+
const a = this.domainPackToAnchor.get(JSON.stringify(i));
|
|
271
|
+
if (a !== void 0) {
|
|
272
|
+
e.domainAnchor = a, r = new Set(o);
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
for (const [o, i] of Object.entries(t.domain ?? {})) {
|
|
277
|
+
if (r !== void 0 && r.has(o))
|
|
278
|
+
continue;
|
|
279
|
+
const a = x(o, i), s = this.domains.get(a);
|
|
280
|
+
e.domain ?? (e.domain = {}), e.domain[o] = s ? { anchor: s } : i;
|
|
281
|
+
}
|
|
282
|
+
return e.axes = t.axesSpec.map((o) => {
|
|
283
|
+
const i = A(o);
|
|
284
|
+
return this.axes.get(i) ?? o;
|
|
285
|
+
}), e;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column
|
|
289
|
+
* @param spec Column specification to anchor
|
|
290
|
+
* @returns A canonicalized string representation of the anchored column identifier
|
|
291
|
+
*/
|
|
292
|
+
deriveString(t) {
|
|
293
|
+
const e = this.derive(t);
|
|
294
|
+
return k(e);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
function An(n, t) {
|
|
298
|
+
const e = { ...t };
|
|
299
|
+
if (e.domainAnchor !== void 0) {
|
|
300
|
+
const r = n[e.domainAnchor];
|
|
301
|
+
if (!r)
|
|
302
|
+
throw new Error(`Anchor "${e.domainAnchor}" not found`);
|
|
303
|
+
const o = r.domain || {};
|
|
304
|
+
e.domain = { ...o, ...e.domain }, delete e.domainAnchor;
|
|
305
|
+
}
|
|
306
|
+
if (e.domain) {
|
|
307
|
+
const r = {};
|
|
308
|
+
for (const [o, i] of Object.entries(e.domain))
|
|
309
|
+
if (typeof i == "string")
|
|
310
|
+
r[o] = i;
|
|
311
|
+
else {
|
|
312
|
+
const a = n[i.anchor];
|
|
313
|
+
if (!a)
|
|
314
|
+
throw new Error(`Anchor "${i.anchor}" not found for domain key "${o}"`);
|
|
315
|
+
if (!a.domain || a.domain[o] === void 0)
|
|
316
|
+
throw new Error(`Domain key "${o}" not found in anchor "${i.anchor}"`);
|
|
317
|
+
r[o] = a.domain[o];
|
|
318
|
+
}
|
|
319
|
+
e.domain = r;
|
|
320
|
+
}
|
|
321
|
+
return e.axes && (e.axes = e.axes.map((r) => Y(n, r))), e;
|
|
211
322
|
}
|
|
212
|
-
function
|
|
213
|
-
|
|
323
|
+
function Y(n, t) {
|
|
324
|
+
if (!Z(t))
|
|
325
|
+
return t;
|
|
326
|
+
const e = t.anchor, r = n[e];
|
|
327
|
+
if (!r)
|
|
328
|
+
throw new Error(`Anchor "${e}" not found for axis reference`);
|
|
329
|
+
if ("idx" in t) {
|
|
330
|
+
if (t.idx < 0 || t.idx >= r.axesSpec.length)
|
|
331
|
+
throw new Error(`Axis index ${t.idx} out of bounds for anchor "${e}"`);
|
|
332
|
+
return r.axesSpec[t.idx];
|
|
333
|
+
} else if ("name" in t) {
|
|
334
|
+
const o = r.axesSpec.filter((i) => i.name === t.name);
|
|
335
|
+
if (o.length > 1)
|
|
336
|
+
throw new Error(`Multiple axes with name "${t.name}" found in anchor "${e}"`);
|
|
337
|
+
if (o.length === 0)
|
|
338
|
+
throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
|
|
339
|
+
return o[0];
|
|
340
|
+
} else if ("id" in t) {
|
|
341
|
+
const o = r.axesSpec.filter((i) => z(t.id, h(i)));
|
|
342
|
+
if (o.length > 1)
|
|
343
|
+
throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
|
|
344
|
+
if (o.length === 0)
|
|
345
|
+
throw new Error(`No matching axis found for matcher in anchor "${e}"`);
|
|
346
|
+
return o[0];
|
|
347
|
+
}
|
|
348
|
+
throw new Error("Unsupported axis reference type");
|
|
349
|
+
}
|
|
350
|
+
function Z(n) {
|
|
351
|
+
return typeof n == "object" && "anchor" in n;
|
|
214
352
|
}
|
|
215
|
-
function
|
|
216
|
-
return
|
|
353
|
+
function f(n) {
|
|
354
|
+
return n.kind === "PColumn";
|
|
217
355
|
}
|
|
218
|
-
function
|
|
219
|
-
return
|
|
356
|
+
function q(n) {
|
|
357
|
+
return f(n.spec);
|
|
220
358
|
}
|
|
221
|
-
function
|
|
222
|
-
return
|
|
359
|
+
function xn(n) {
|
|
360
|
+
return f(n.obj);
|
|
223
361
|
}
|
|
224
|
-
function
|
|
225
|
-
|
|
226
|
-
return t;
|
|
362
|
+
function Pn(n) {
|
|
363
|
+
return f(n.obj.spec);
|
|
227
364
|
}
|
|
228
|
-
function
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
365
|
+
function En(n) {
|
|
366
|
+
if (!q(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
|
|
367
|
+
return n;
|
|
368
|
+
}
|
|
369
|
+
function kn(n, t) {
|
|
370
|
+
return n === void 0 ? void 0 : {
|
|
371
|
+
...n,
|
|
372
|
+
data: t(n.data)
|
|
232
373
|
};
|
|
233
374
|
}
|
|
234
|
-
function
|
|
235
|
-
const
|
|
375
|
+
function In(n) {
|
|
376
|
+
const t = /* @__PURE__ */ new Map(), e = (r) => {
|
|
236
377
|
switch (r.type) {
|
|
237
378
|
case "column":
|
|
238
|
-
|
|
379
|
+
t.set(r.column.id, r.column);
|
|
239
380
|
return;
|
|
240
381
|
case "full":
|
|
241
382
|
case "inner":
|
|
@@ -246,145 +387,231 @@ function pt(t) {
|
|
|
246
387
|
for (const o of r.secondary) e(o);
|
|
247
388
|
return;
|
|
248
389
|
default:
|
|
249
|
-
|
|
390
|
+
g(r);
|
|
250
391
|
}
|
|
251
392
|
};
|
|
252
|
-
return e(
|
|
393
|
+
return e(n), [...t.values()];
|
|
253
394
|
}
|
|
254
|
-
function
|
|
255
|
-
throw new Error("Unexpected object: " +
|
|
395
|
+
function v(n) {
|
|
396
|
+
throw new Error("Unexpected object: " + n);
|
|
256
397
|
}
|
|
257
|
-
function
|
|
258
|
-
switch (
|
|
398
|
+
function b(n, t) {
|
|
399
|
+
switch (n.type) {
|
|
259
400
|
case "and":
|
|
260
|
-
for (const e of
|
|
261
|
-
if (!
|
|
401
|
+
for (const e of n.operands)
|
|
402
|
+
if (!b(e, t)) return !1;
|
|
262
403
|
return !0;
|
|
263
404
|
case "or":
|
|
264
|
-
for (const e of
|
|
265
|
-
if (
|
|
405
|
+
for (const e of n.operands)
|
|
406
|
+
if (b(e, t)) return !0;
|
|
266
407
|
return !1;
|
|
267
408
|
case "not":
|
|
268
|
-
return !
|
|
409
|
+
return !b(n.operand, t);
|
|
269
410
|
case "name":
|
|
270
|
-
return
|
|
411
|
+
return f(t) && t.name === n.name;
|
|
271
412
|
case "name_pattern":
|
|
272
|
-
return
|
|
413
|
+
return f(t) && !!t.name.match(n.pattern);
|
|
273
414
|
case "annotation":
|
|
274
|
-
return
|
|
415
|
+
return f(t) && t.annotations !== void 0 && t.annotations[n.annotation] === n.value;
|
|
275
416
|
case "annotation_pattern":
|
|
276
|
-
return
|
|
417
|
+
return f(t) && t.annotations !== void 0 && t.annotations[n.annotation] !== void 0 && !!t.annotations[n.annotation].match(n.pattern);
|
|
277
418
|
case "has_axes":
|
|
278
|
-
return
|
|
279
|
-
(e) =>
|
|
419
|
+
return f(t) && n.axes.every(
|
|
420
|
+
(e) => t.axesSpec.some(
|
|
280
421
|
(r) => (e.type === void 0 || e.type === r.type) && (e.name === void 0 || e.name === r.name) && (e.domain === void 0 || Object.keys(e.domain).length === 0 || r.domain !== void 0 && Object.entries(e.domain).every(
|
|
281
|
-
([o,
|
|
422
|
+
([o, i]) => r.domain[o] === i
|
|
282
423
|
))
|
|
283
424
|
)
|
|
284
425
|
);
|
|
285
426
|
default:
|
|
286
|
-
|
|
427
|
+
v(n);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function P(n, t) {
|
|
431
|
+
if (n.name !== void 0 && n.name !== t.name)
|
|
432
|
+
return !1;
|
|
433
|
+
if (n.type !== void 0) {
|
|
434
|
+
if (Array.isArray(n.type)) {
|
|
435
|
+
if (!n.type.includes(t.type))
|
|
436
|
+
return !1;
|
|
437
|
+
} else if (n.type !== t.type)
|
|
438
|
+
return !1;
|
|
439
|
+
}
|
|
440
|
+
if (n.domain !== void 0) {
|
|
441
|
+
const e = t.domain || {};
|
|
442
|
+
for (const [r, o] of Object.entries(n.domain))
|
|
443
|
+
if (e[r] !== o)
|
|
444
|
+
return !1;
|
|
445
|
+
}
|
|
446
|
+
return !0;
|
|
447
|
+
}
|
|
448
|
+
function E(n, t) {
|
|
449
|
+
if (t.name !== void 0 && n.name !== t.name || t.namePattern !== void 0 && !new RegExp(t.namePattern).test(n.name))
|
|
450
|
+
return !1;
|
|
451
|
+
if (t.type !== void 0) {
|
|
452
|
+
if (Array.isArray(t.type)) {
|
|
453
|
+
if (!t.type.includes(n.valueType))
|
|
454
|
+
return !1;
|
|
455
|
+
} else if (t.type !== n.valueType)
|
|
456
|
+
return !1;
|
|
457
|
+
}
|
|
458
|
+
if (t.domain !== void 0) {
|
|
459
|
+
const e = n.domain || {};
|
|
460
|
+
for (const [r, o] of Object.entries(t.domain))
|
|
461
|
+
if (e[r] !== o)
|
|
462
|
+
return !1;
|
|
463
|
+
}
|
|
464
|
+
if (t.axes !== void 0) {
|
|
465
|
+
const e = n.axesSpec.map(h);
|
|
466
|
+
if (t.partialAxesMatch) {
|
|
467
|
+
for (const r of t.axes)
|
|
468
|
+
if (!e.some((o) => P(r, o)))
|
|
469
|
+
return !1;
|
|
470
|
+
} else {
|
|
471
|
+
if (e.length !== t.axes.length)
|
|
472
|
+
return !1;
|
|
473
|
+
for (let r = 0; r < t.axes.length; r++)
|
|
474
|
+
if (!P(t.axes[r], e[r]))
|
|
475
|
+
return !1;
|
|
476
|
+
}
|
|
287
477
|
}
|
|
478
|
+
if (t.annotations !== void 0) {
|
|
479
|
+
const e = n.annotations || {};
|
|
480
|
+
for (const [r, o] of Object.entries(t.annotations))
|
|
481
|
+
if (e[r] !== o)
|
|
482
|
+
return !1;
|
|
483
|
+
}
|
|
484
|
+
if (t.annotationPatterns !== void 0) {
|
|
485
|
+
const e = n.annotations || {};
|
|
486
|
+
for (const [r, o] of Object.entries(t.annotationPatterns)) {
|
|
487
|
+
const i = e[r];
|
|
488
|
+
if (i === void 0 || !new RegExp(o).test(i))
|
|
489
|
+
return !1;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
return !0;
|
|
493
|
+
}
|
|
494
|
+
function Nn(n) {
|
|
495
|
+
return Array.isArray(n) ? (t) => n.some((e) => f(t) && E(t, e)) : (t) => f(t) && E(t, n);
|
|
496
|
+
}
|
|
497
|
+
const Cn = { href: "/" }, Sn = m.object({
|
|
498
|
+
__isRef: m.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
|
|
499
|
+
blockId: m.string().describe("Upstream block id"),
|
|
500
|
+
name: m.string().describe("Name of the output provided to the upstream block's output context")
|
|
501
|
+
}).describe(
|
|
502
|
+
"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."
|
|
503
|
+
).strict().readonly();
|
|
504
|
+
function Vn(n) {
|
|
505
|
+
return typeof n == "object" && n !== null && "__isRef" in n && n.__isRef === !0 && "blockId" in n && "name" in n;
|
|
506
|
+
}
|
|
507
|
+
function $n(n, t) {
|
|
508
|
+
return n.blockId === t.blockId && n.name === t.name;
|
|
288
509
|
}
|
|
289
|
-
function
|
|
290
|
-
return
|
|
510
|
+
function Fn(n, t) {
|
|
511
|
+
return n.ok ? { ok: !0, value: t(n.value) } : n;
|
|
291
512
|
}
|
|
292
|
-
function
|
|
293
|
-
if (
|
|
294
|
-
return new DataView(
|
|
295
|
-
if (
|
|
513
|
+
function nn(n) {
|
|
514
|
+
if (n instanceof Int8Array || n instanceof Uint8Array || n instanceof Uint8ClampedArray)
|
|
515
|
+
return new DataView(n.buffer, n.byteOffset, n.byteLength);
|
|
516
|
+
if (n instanceof ArrayBuffer) return new DataView(n);
|
|
296
517
|
throw new TypeError(
|
|
297
518
|
"Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray"
|
|
298
519
|
);
|
|
299
520
|
}
|
|
300
|
-
const
|
|
301
|
-
function
|
|
521
|
+
const tn = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", en = "0123456789ABCDEFGHIJKLMNOPQRSTUV", rn = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
522
|
+
function C(n, t, e) {
|
|
302
523
|
e = e || {};
|
|
303
524
|
let r, o;
|
|
304
|
-
switch (
|
|
525
|
+
switch (t) {
|
|
305
526
|
case "RFC3548":
|
|
306
527
|
case "RFC4648":
|
|
307
|
-
r =
|
|
528
|
+
r = tn, o = !0;
|
|
308
529
|
break;
|
|
309
530
|
case "RFC4648-HEX":
|
|
310
|
-
r =
|
|
531
|
+
r = en, o = !0;
|
|
311
532
|
break;
|
|
312
533
|
case "Crockford":
|
|
313
|
-
r =
|
|
534
|
+
r = rn, o = !1;
|
|
314
535
|
break;
|
|
315
536
|
default:
|
|
316
|
-
throw new Error("Unknown base32 variant: " +
|
|
537
|
+
throw new Error("Unknown base32 variant: " + t);
|
|
317
538
|
}
|
|
318
|
-
const
|
|
539
|
+
const i = e.padding !== void 0 ? e.padding : o, a = nn(n);
|
|
319
540
|
let s = 0, c = 0, u = "";
|
|
320
|
-
for (let
|
|
321
|
-
for (c = c << 8 |
|
|
541
|
+
for (let y = 0; y < a.byteLength; y++)
|
|
542
|
+
for (c = c << 8 | a.getUint8(y), s += 8; s >= 5; )
|
|
322
543
|
u += r[c >>> s - 5 & 31], s -= 5;
|
|
323
|
-
if (s > 0 && (u += r[c << 5 - s & 31]),
|
|
544
|
+
if (s > 0 && (u += r[c << 5 - s & 31]), i)
|
|
324
545
|
for (; u.length % 8 !== 0; )
|
|
325
546
|
u += "=";
|
|
326
547
|
return u;
|
|
327
548
|
}
|
|
328
|
-
const
|
|
329
|
-
function
|
|
330
|
-
const
|
|
331
|
-
return crypto.getRandomValues(
|
|
549
|
+
const S = 15, on = 24, V = m.string().length(on).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
|
|
550
|
+
function Dn() {
|
|
551
|
+
const n = new Uint8Array(S);
|
|
552
|
+
return crypto.getRandomValues(n), V.parse(C(n, "RFC4648"));
|
|
332
553
|
}
|
|
333
|
-
function
|
|
334
|
-
if (
|
|
335
|
-
return
|
|
554
|
+
function an(n) {
|
|
555
|
+
if (n.length !== S) throw new Error(`Wrong number of bytes: ${n.length}`);
|
|
556
|
+
return V.parse(C(n, "RFC4648"));
|
|
336
557
|
}
|
|
337
|
-
async function
|
|
338
|
-
const
|
|
339
|
-
return
|
|
558
|
+
async function Un(n) {
|
|
559
|
+
const t = new TextEncoder(), e = await crypto.subtle.digest("SHA-256", t.encode(n));
|
|
560
|
+
return an(new Uint8Array(e.slice(0, 15)));
|
|
340
561
|
}
|
|
341
562
|
export {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
563
|
+
wn as AnchorIdDeriver,
|
|
564
|
+
Cn as DefaultNavigationState,
|
|
565
|
+
X as PTableAbsent,
|
|
566
|
+
G as PTableNA,
|
|
567
|
+
_ as PValueBytesNA,
|
|
568
|
+
L as PValueDoubleNA,
|
|
569
|
+
j as PValueFloatNA,
|
|
570
|
+
R as PValueIntNA,
|
|
571
|
+
w as PValueLongNA,
|
|
572
|
+
M as PValueStringNA,
|
|
573
|
+
V as PlId,
|
|
574
|
+
S as PlIdBytes,
|
|
575
|
+
on as PlIdLength,
|
|
576
|
+
Sn as PlRef,
|
|
577
|
+
Un as digestPlId,
|
|
578
|
+
mn as ensureNotNAPValue,
|
|
579
|
+
En as ensurePColumn,
|
|
580
|
+
b as executePSpecPredicate,
|
|
581
|
+
In as extractAllColumns,
|
|
582
|
+
bn as getAxesId,
|
|
583
|
+
h as getAxisId,
|
|
584
|
+
dn as getFileNameFromHandle,
|
|
585
|
+
O as getFilePathFromHandle,
|
|
586
|
+
U as isImportFileHandleIndex,
|
|
587
|
+
D as isImportFileHandleUpload,
|
|
588
|
+
un as isLiveLog,
|
|
589
|
+
H as isNotNAPValue,
|
|
590
|
+
q as isPColumn,
|
|
591
|
+
Pn as isPColumnResult,
|
|
592
|
+
f as isPColumnSpec,
|
|
593
|
+
xn as isPColumnSpecResult,
|
|
594
|
+
hn as isPTableAbsent,
|
|
595
|
+
J as isPValue,
|
|
596
|
+
Vn as isPlRef,
|
|
597
|
+
W as isValueAbsent,
|
|
598
|
+
p as isValueNA,
|
|
599
|
+
l as mapJoinEntry,
|
|
600
|
+
kn as mapPObjectData,
|
|
601
|
+
gn as mapPTableDef,
|
|
602
|
+
Fn as mapValueInVOE,
|
|
603
|
+
P as matchAxis,
|
|
604
|
+
z as matchAxisId,
|
|
605
|
+
E as matchPColumn,
|
|
606
|
+
yn as pTableValue,
|
|
607
|
+
pn as pValueToStringOrNumber,
|
|
608
|
+
T as pValueToStringOrNumberOrNull,
|
|
609
|
+
an as plId,
|
|
610
|
+
$n as plRefsEqual,
|
|
611
|
+
An as resolveAnchors,
|
|
612
|
+
K as safeConvertToPValue,
|
|
613
|
+
Nn as selectorsToPredicate,
|
|
614
|
+
ln as toJsonSafePValue,
|
|
615
|
+
Dn as uniquePlId
|
|
389
616
|
};
|
|
390
617
|
//# sourceMappingURL=index.mjs.map
|