@milaboratories/pl-model-common 1.10.1 → 1.10.2
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/base32-encode.d.ts +8 -0
- package/dist/base32-encode.d.ts.map +1 -0
- package/dist/drivers/pframe/data.d.ts +11 -3
- package/dist/drivers/pframe/data.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +203 -143
- package/dist/index.mjs.map +1 -1
- package/dist/plid.d.ts +11 -0
- package/dist/plid.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/base32-encode.ts +74 -0
- package/src/drivers/pframe/data.ts +22 -8
- package/src/index.ts +1 -0
- package/src/plid.ts +31 -0
package/dist/index.mjs
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { z as
|
|
2
|
-
function
|
|
1
|
+
import { z as a } from "zod";
|
|
2
|
+
function Z(t) {
|
|
3
3
|
return t !== void 0 && t.startsWith("log+live://log/");
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function b(t) {
|
|
6
6
|
throw new Error("Unexpected object: " + t);
|
|
7
7
|
}
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
return t.startsWith(
|
|
8
|
+
const w = "upload://upload/", h = "index://index/";
|
|
9
|
+
function E(t) {
|
|
10
|
+
return t.startsWith(w);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return t.startsWith(
|
|
12
|
+
function I(t) {
|
|
13
|
+
return t.startsWith(h);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
if (
|
|
17
|
-
const n = t.slice(
|
|
15
|
+
function C(t) {
|
|
16
|
+
if (I(t)) {
|
|
17
|
+
const n = t.slice(h.length);
|
|
18
18
|
return JSON.parse(decodeURIComponent(n)).path;
|
|
19
|
-
} else if (
|
|
20
|
-
const n = t.slice(
|
|
19
|
+
} else if (E(t)) {
|
|
20
|
+
const n = t.slice(w.length);
|
|
21
21
|
return JSON.parse(decodeURIComponent(n)).localPath;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
b(t);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function V(t) {
|
|
26
26
|
return t.replace(/^.*[\\/]/, "");
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function z(t) {
|
|
29
|
+
return V(C(t));
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
function
|
|
31
|
+
const F = -2147483648, g = -9007199254740991n, x = NaN, R = NaN, U = null, k = null;
|
|
32
|
+
function d(t, n) {
|
|
33
33
|
switch (n) {
|
|
34
34
|
case "Int":
|
|
35
|
-
return t ===
|
|
35
|
+
return t === F;
|
|
36
36
|
case "Long":
|
|
37
|
-
return t === Number(
|
|
37
|
+
return t === Number(g) || t === g;
|
|
38
38
|
case "Float":
|
|
39
|
-
return t ===
|
|
39
|
+
return t === x;
|
|
40
40
|
case "Double":
|
|
41
|
-
return t ===
|
|
41
|
+
return t === R;
|
|
42
42
|
case "String":
|
|
43
|
-
return t ===
|
|
43
|
+
return t === U;
|
|
44
44
|
case "Bytes":
|
|
45
|
-
return t ===
|
|
45
|
+
return t === k;
|
|
46
46
|
default:
|
|
47
47
|
throw Error(`unsupported data type: ${n}`);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
if (!
|
|
50
|
+
function q(t) {
|
|
51
|
+
if (!B(t)) throw new Error(`Expected not-NA PValue, got ${t}`);
|
|
52
52
|
return t;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function B(t, n) {
|
|
55
55
|
if (!n)
|
|
56
56
|
return typeof t == "string" || typeof t == "number" && isFinite(t) || typeof t == "bigint";
|
|
57
|
-
if (
|
|
57
|
+
if (d(t, n)) return !1;
|
|
58
58
|
switch (n) {
|
|
59
59
|
case "Int":
|
|
60
60
|
return typeof t == "number";
|
|
@@ -72,10 +72,10 @@ function V(t, n) {
|
|
|
72
72
|
throw Error(`unsupported data type: ${n}`);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function S(t, n) {
|
|
76
76
|
if (!n)
|
|
77
77
|
return t === null || typeof t == "string" || typeof t == "number" || typeof t == "bigint";
|
|
78
|
-
if (
|
|
78
|
+
if (d(t, n)) return !0;
|
|
79
79
|
switch (n) {
|
|
80
80
|
case "Int":
|
|
81
81
|
return typeof t == "number";
|
|
@@ -93,14 +93,14 @@ function I(t, n) {
|
|
|
93
93
|
throw Error(`unsupported data type: ${n}`);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function v(t) {
|
|
97
97
|
if (t === null || typeof t == "string" || typeof t == "number") return t;
|
|
98
98
|
if (typeof t == "bigint") return { bigint: t.toString() };
|
|
99
99
|
throw new Error(`Type ${typeof t} (value ${t}) not yet supported.`);
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function D(t, n) {
|
|
102
102
|
if (t === null || typeof t == "string" || typeof t == "number" || typeof t == "bigint") {
|
|
103
|
-
if (n && !
|
|
103
|
+
if (n && !d(t, n) && !S(t, n))
|
|
104
104
|
throw new Error(`Unexpected value type, got ${typeof t}, expected ${n}`);
|
|
105
105
|
return t;
|
|
106
106
|
}
|
|
@@ -111,12 +111,12 @@ function A(t, n) {
|
|
|
111
111
|
}
|
|
112
112
|
throw new Error(`Unsupported type ${typeof t} (value ${t}).`);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function tt(t) {
|
|
115
115
|
if (t = $(t), t === null) throw new Error("Value is null");
|
|
116
116
|
return t;
|
|
117
117
|
}
|
|
118
118
|
function $(t) {
|
|
119
|
-
if (t =
|
|
119
|
+
if (t = D(t), t === null) return null;
|
|
120
120
|
if (typeof t == "string") return t;
|
|
121
121
|
if (typeof t == "number") {
|
|
122
122
|
if (!isFinite(t)) throw new Error(`Value is not finite (${t})`);
|
|
@@ -126,16 +126,20 @@ function $(t) {
|
|
|
126
126
|
return Number(t);
|
|
127
127
|
throw new Error(`Unexpected value type: ${typeof t}`);
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
const
|
|
131
|
-
return (t[
|
|
129
|
+
function L(t, n) {
|
|
130
|
+
const e = Math.floor(n / 8), r = 1 << 7 - n % 8;
|
|
131
|
+
return (t[e] & r) > 0;
|
|
132
|
+
}
|
|
133
|
+
const O = { type: "absent" }, H = null;
|
|
134
|
+
function nt(t) {
|
|
135
|
+
return typeof t == "object" && t !== null && t.type === "absent";
|
|
132
136
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const r = t.data[n],
|
|
137
|
-
if (
|
|
138
|
-
switch (
|
|
137
|
+
function et(t, n, e = {}) {
|
|
138
|
+
if (L(t.absent, n))
|
|
139
|
+
return e.absent === void 0 ? O : e.absent;
|
|
140
|
+
const r = t.data[n], o = t.type;
|
|
141
|
+
if (d(r, o)) return e.na === void 0 ? H : e.na;
|
|
142
|
+
switch (o) {
|
|
139
143
|
case "Int":
|
|
140
144
|
return r;
|
|
141
145
|
case "Long":
|
|
@@ -149,30 +153,30 @@ function J(t, n) {
|
|
|
149
153
|
case "Bytes":
|
|
150
154
|
throw Error("Bytes not yet supported");
|
|
151
155
|
default:
|
|
152
|
-
throw Error(`unsupported data type: ${
|
|
156
|
+
throw Error(`unsupported data type: ${o}`);
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
|
-
function
|
|
156
|
-
const { type: n, name:
|
|
157
|
-
return { type: n, name:
|
|
159
|
+
function J(t) {
|
|
160
|
+
const { type: n, name: e, domain: r } = t;
|
|
161
|
+
return { type: n, name: e, ...r && { domain: r } };
|
|
158
162
|
}
|
|
159
|
-
function
|
|
160
|
-
return t.map(
|
|
163
|
+
function rt(t) {
|
|
164
|
+
return t.map(J);
|
|
161
165
|
}
|
|
162
|
-
function
|
|
166
|
+
function _(t, n) {
|
|
163
167
|
if (t === void 0) return n === void 0;
|
|
164
168
|
if (n === void 0) return !0;
|
|
165
|
-
for (const
|
|
166
|
-
if (t[
|
|
169
|
+
for (const e in n)
|
|
170
|
+
if (t[e] !== n[e]) return !1;
|
|
167
171
|
return !0;
|
|
168
172
|
}
|
|
169
|
-
function
|
|
170
|
-
return t.name === n.name &&
|
|
173
|
+
function ot(t, n) {
|
|
174
|
+
return t.name === n.name && _(t.domain, n.domain);
|
|
171
175
|
}
|
|
172
|
-
function
|
|
173
|
-
return { ...t, src:
|
|
176
|
+
function it(t, n) {
|
|
177
|
+
return { ...t, src: f(t.src, n) };
|
|
174
178
|
}
|
|
175
|
-
function
|
|
179
|
+
function f(t, n) {
|
|
176
180
|
switch (t.type) {
|
|
177
181
|
case "column":
|
|
178
182
|
return {
|
|
@@ -183,148 +187,204 @@ function u(t, n) {
|
|
|
183
187
|
case "full":
|
|
184
188
|
return {
|
|
185
189
|
type: t.type,
|
|
186
|
-
entries: t.entries.map((
|
|
190
|
+
entries: t.entries.map((e) => f(e, n))
|
|
187
191
|
};
|
|
188
192
|
case "outer":
|
|
189
193
|
return {
|
|
190
194
|
type: "outer",
|
|
191
|
-
primary:
|
|
192
|
-
secondary: t.secondary.map((
|
|
195
|
+
primary: f(t.primary, n),
|
|
196
|
+
secondary: t.secondary.map((e) => f(e, n))
|
|
193
197
|
};
|
|
194
198
|
default:
|
|
195
|
-
|
|
199
|
+
b(t);
|
|
196
200
|
}
|
|
197
201
|
}
|
|
198
|
-
const
|
|
199
|
-
__isRef:
|
|
200
|
-
blockId:
|
|
201
|
-
name:
|
|
202
|
+
const st = { href: "/" }, ut = a.object({
|
|
203
|
+
__isRef: a.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
|
|
204
|
+
blockId: a.string().describe("Upstream block id"),
|
|
205
|
+
name: a.string().describe("Name of the output provided to the upstream block's output context")
|
|
202
206
|
}).describe(
|
|
203
207
|
"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."
|
|
204
208
|
).strict().readonly();
|
|
205
|
-
function
|
|
209
|
+
function at(t, n) {
|
|
206
210
|
return t.blockId === n.blockId && t.name === n.name;
|
|
207
211
|
}
|
|
208
|
-
function
|
|
212
|
+
function i(t) {
|
|
209
213
|
return t.kind === "PColumn";
|
|
210
214
|
}
|
|
211
|
-
function
|
|
212
|
-
return
|
|
215
|
+
function W(t) {
|
|
216
|
+
return i(t.spec);
|
|
213
217
|
}
|
|
214
|
-
function
|
|
215
|
-
return
|
|
218
|
+
function ct(t) {
|
|
219
|
+
return i(t.obj);
|
|
216
220
|
}
|
|
217
|
-
function
|
|
218
|
-
return
|
|
221
|
+
function ft(t) {
|
|
222
|
+
return i(t.obj.spec);
|
|
219
223
|
}
|
|
220
|
-
function
|
|
221
|
-
if (!
|
|
224
|
+
function dt(t) {
|
|
225
|
+
if (!W(t)) throw new Error(`not a PColumn (kind = ${t.spec.kind})`);
|
|
222
226
|
return t;
|
|
223
227
|
}
|
|
224
|
-
function
|
|
228
|
+
function lt(t, n) {
|
|
225
229
|
return t === void 0 ? void 0 : {
|
|
226
230
|
...t,
|
|
227
231
|
data: n(t.data)
|
|
228
232
|
};
|
|
229
233
|
}
|
|
230
|
-
function
|
|
231
|
-
const n = /* @__PURE__ */ new Map(),
|
|
232
|
-
switch (
|
|
234
|
+
function pt(t) {
|
|
235
|
+
const n = /* @__PURE__ */ new Map(), e = (r) => {
|
|
236
|
+
switch (r.type) {
|
|
233
237
|
case "column":
|
|
234
|
-
n.set(
|
|
238
|
+
n.set(r.column.id, r.column);
|
|
235
239
|
return;
|
|
236
240
|
case "full":
|
|
237
241
|
case "inner":
|
|
238
|
-
for (const
|
|
242
|
+
for (const o of r.entries) e(o);
|
|
239
243
|
return;
|
|
240
244
|
case "outer":
|
|
241
|
-
r
|
|
242
|
-
for (const
|
|
245
|
+
e(r.primary);
|
|
246
|
+
for (const o of r.secondary) e(o);
|
|
243
247
|
return;
|
|
244
248
|
default:
|
|
245
|
-
|
|
249
|
+
b(r);
|
|
246
250
|
}
|
|
247
251
|
};
|
|
248
|
-
return
|
|
252
|
+
return e(t), [...n.values()];
|
|
249
253
|
}
|
|
250
|
-
function
|
|
254
|
+
function j(t) {
|
|
251
255
|
throw new Error("Unexpected object: " + t);
|
|
252
256
|
}
|
|
253
|
-
function
|
|
257
|
+
function m(t, n) {
|
|
254
258
|
switch (t.type) {
|
|
255
259
|
case "and":
|
|
256
|
-
for (const
|
|
257
|
-
if (!
|
|
260
|
+
for (const e of t.operands)
|
|
261
|
+
if (!m(e, n)) return !1;
|
|
258
262
|
return !0;
|
|
259
263
|
case "or":
|
|
260
|
-
for (const
|
|
261
|
-
if (
|
|
264
|
+
for (const e of t.operands)
|
|
265
|
+
if (m(e, n)) return !0;
|
|
262
266
|
return !1;
|
|
263
267
|
case "not":
|
|
264
|
-
return !
|
|
268
|
+
return !m(t.operand, n);
|
|
265
269
|
case "name":
|
|
266
|
-
return
|
|
270
|
+
return i(n) && n.name === t.name;
|
|
267
271
|
case "name_pattern":
|
|
268
|
-
return
|
|
272
|
+
return i(n) && !!n.name.match(t.pattern);
|
|
269
273
|
case "annotation":
|
|
270
|
-
return
|
|
274
|
+
return i(n) && n.annotations !== void 0 && n.annotations[t.annotation] === t.value;
|
|
271
275
|
case "annotation_pattern":
|
|
272
|
-
return
|
|
276
|
+
return i(n) && n.annotations !== void 0 && n.annotations[t.annotation] !== void 0 && !!n.annotations[t.annotation].match(t.pattern);
|
|
273
277
|
case "has_axes":
|
|
274
|
-
return
|
|
275
|
-
(
|
|
276
|
-
(
|
|
277
|
-
([
|
|
278
|
+
return i(n) && t.axes.every(
|
|
279
|
+
(e) => n.axesSpec.some(
|
|
280
|
+
(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, l]) => r.domain[o] === l
|
|
278
282
|
))
|
|
279
283
|
)
|
|
280
284
|
);
|
|
281
285
|
default:
|
|
282
|
-
|
|
286
|
+
j(t);
|
|
283
287
|
}
|
|
284
288
|
}
|
|
285
|
-
function
|
|
289
|
+
function mt(t, n) {
|
|
286
290
|
return t.ok ? { ok: !0, value: n(t.value) } : t;
|
|
287
291
|
}
|
|
292
|
+
function M(t) {
|
|
293
|
+
if (t instanceof Int8Array || t instanceof Uint8Array || t instanceof Uint8ClampedArray)
|
|
294
|
+
return new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
295
|
+
if (t instanceof ArrayBuffer) return new DataView(t);
|
|
296
|
+
throw new TypeError(
|
|
297
|
+
"Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray"
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
const K = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", X = "0123456789ABCDEFGHIJKLMNOPQRSTUV", G = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
301
|
+
function P(t, n, e) {
|
|
302
|
+
e = e || {};
|
|
303
|
+
let r, o;
|
|
304
|
+
switch (n) {
|
|
305
|
+
case "RFC3548":
|
|
306
|
+
case "RFC4648":
|
|
307
|
+
r = K, o = !0;
|
|
308
|
+
break;
|
|
309
|
+
case "RFC4648-HEX":
|
|
310
|
+
r = X, o = !0;
|
|
311
|
+
break;
|
|
312
|
+
case "Crockford":
|
|
313
|
+
r = G, o = !1;
|
|
314
|
+
break;
|
|
315
|
+
default:
|
|
316
|
+
throw new Error("Unknown base32 variant: " + n);
|
|
317
|
+
}
|
|
318
|
+
const l = e.padding !== void 0 ? e.padding : o, y = M(t);
|
|
319
|
+
let s = 0, c = 0, u = "";
|
|
320
|
+
for (let p = 0; p < y.byteLength; p++)
|
|
321
|
+
for (c = c << 8 | y.getUint8(p), s += 8; s >= 5; )
|
|
322
|
+
u += r[c >>> s - 5 & 31], s -= 5;
|
|
323
|
+
if (s > 0 && (u += r[c << 5 - s & 31]), l)
|
|
324
|
+
for (; u.length % 8 !== 0; )
|
|
325
|
+
u += "=";
|
|
326
|
+
return u;
|
|
327
|
+
}
|
|
328
|
+
const N = 15, Q = 24, A = a.string().length(Q).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
|
|
329
|
+
function bt() {
|
|
330
|
+
const t = new Uint8Array(N);
|
|
331
|
+
return crypto.getRandomValues(t), A.parse(P(t, "RFC4648"));
|
|
332
|
+
}
|
|
333
|
+
function T(t) {
|
|
334
|
+
if (t.length !== N) throw new Error(`Wrong number of bytes: ${t.length}`);
|
|
335
|
+
return A.parse(P(t, "RFC4648"));
|
|
336
|
+
}
|
|
337
|
+
async function yt(t) {
|
|
338
|
+
const n = new TextEncoder(), e = await crypto.subtle.digest("SHA-256", n.encode(t));
|
|
339
|
+
return T(new Uint8Array(e.slice(0, 15)));
|
|
340
|
+
}
|
|
288
341
|
export {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
342
|
+
st as DefaultNavigationState,
|
|
343
|
+
O as PTableAbsent,
|
|
344
|
+
H as PTableNA,
|
|
345
|
+
k as PValueBytesNA,
|
|
346
|
+
R as PValueDoubleNA,
|
|
347
|
+
x as PValueFloatNA,
|
|
348
|
+
F as PValueIntNA,
|
|
349
|
+
g as PValueLongNA,
|
|
350
|
+
U as PValueStringNA,
|
|
351
|
+
A as PlId,
|
|
352
|
+
N as PlIdBytes,
|
|
353
|
+
Q as PlIdLength,
|
|
354
|
+
ut as PlRef,
|
|
355
|
+
yt as digestPlId,
|
|
356
|
+
q as ensureNotNAPValue,
|
|
357
|
+
dt as ensurePColumn,
|
|
358
|
+
m as executePSpecPredicate,
|
|
359
|
+
pt as extractAllColumns,
|
|
360
|
+
rt as getAxesId,
|
|
361
|
+
J as getAxisId,
|
|
362
|
+
z as getFileNameFromHandle,
|
|
363
|
+
C as getFilePathFromHandle,
|
|
364
|
+
I as isImportFileHandleIndex,
|
|
365
|
+
E as isImportFileHandleUpload,
|
|
366
|
+
Z as isLiveLog,
|
|
367
|
+
B as isNotNAPValue,
|
|
368
|
+
W as isPColumn,
|
|
369
|
+
ft as isPColumnResult,
|
|
370
|
+
i as isPColumnSpec,
|
|
371
|
+
ct as isPColumnSpecResult,
|
|
372
|
+
nt as isPTableAbsent,
|
|
373
|
+
S as isPValue,
|
|
374
|
+
L as isValueAbsent,
|
|
375
|
+
d as isValueNA,
|
|
376
|
+
f as mapJoinEntry,
|
|
377
|
+
lt as mapPObjectData,
|
|
378
|
+
it as mapPTableDef,
|
|
379
|
+
mt as mapValueInVOE,
|
|
380
|
+
ot as matchAxisId,
|
|
381
|
+
et as pTableValue,
|
|
382
|
+
tt as pValueToStringOrNumber,
|
|
325
383
|
$ as pValueToStringOrNumberOrNull,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
384
|
+
T as plId,
|
|
385
|
+
at as plRefsEqual,
|
|
386
|
+
D as safeConvertToPValue,
|
|
387
|
+
v as toJsonSafePValue,
|
|
388
|
+
bt as uniquePlId
|
|
329
389
|
};
|
|
330
390
|
//# sourceMappingURL=index.mjs.map
|