@milaboratories/pl-model-common 1.13.8 → 1.14.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
@@ -1,28 +1,28 @@
1
- var I = Object.defineProperty;
2
- var $ = (n, t, e) => t in n ? I(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var m = (n, t, e) => $(n, typeof t != "symbol" ? t + "" : t, e);
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
4
  import h from "canonicalize";
5
- import { z as y } from "zod";
5
+ import { z as p } 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 S = "upload://upload/", E = "index://index/";
12
+ const E = "upload://upload/", S = "index://index/";
13
13
  function D(n) {
14
- return n.startsWith(S);
14
+ return n.startsWith(E);
15
15
  }
16
16
  function L(n) {
17
- return n.startsWith(E);
17
+ return n.startsWith(S);
18
18
  }
19
19
  function V(n) {
20
20
  if (L(n)) {
21
- const t = n.slice(E.length);
22
- return JSON.parse(decodeURIComponent(t)).path;
21
+ const e = n.slice(S.length);
22
+ return JSON.parse(decodeURIComponent(e)).path;
23
23
  } else if (D(n)) {
24
- const t = n.slice(S.length);
25
- return JSON.parse(decodeURIComponent(t)).localPath;
24
+ const e = n.slice(E.length);
25
+ return JSON.parse(decodeURIComponent(e)).localPath;
26
26
  }
27
27
  w(n);
28
28
  }
@@ -35,44 +35,44 @@ function pn(n) {
35
35
  function mn(n) {
36
36
  if (!n || typeof n != "object")
37
37
  return !1;
38
- const t = n;
39
- if (!("type" in t))
38
+ const e = n;
39
+ if (!("type" in e))
40
40
  return !1;
41
- switch (t.type) {
41
+ switch (e.type) {
42
42
  case "Json":
43
- return typeof t.keyLength == "number" && t.data !== void 0 && typeof t.data == "object";
43
+ return typeof e.keyLength == "number" && e.data !== void 0 && typeof e.data == "object";
44
44
  case "JsonPartitioned":
45
- return typeof t.partitionKeyLength == "number" && t.parts !== void 0 && typeof t.parts == "object";
45
+ return typeof e.partitionKeyLength == "number" && e.parts !== void 0 && typeof e.parts == "object";
46
46
  case "BinaryPartitioned":
47
- return typeof t.partitionKeyLength == "number" && t.parts !== void 0 && typeof t.parts == "object";
47
+ return typeof e.partitionKeyLength == "number" && e.parts !== void 0 && typeof e.parts == "object";
48
48
  default:
49
49
  return !1;
50
50
  }
51
51
  }
52
- function yn(n, t) {
52
+ function ln(n, e) {
53
53
  if (n !== void 0)
54
54
  switch (n.type) {
55
55
  case "Json":
56
56
  return n;
57
57
  case "JsonPartitioned": {
58
- const e = {};
58
+ const t = {};
59
59
  for (const [r, o] of Object.entries(n.parts))
60
- e[r] = t(o);
60
+ t[r] = e(o);
61
61
  return {
62
62
  ...n,
63
- parts: e
63
+ parts: t
64
64
  };
65
65
  }
66
66
  case "BinaryPartitioned": {
67
- const e = {};
67
+ const t = {};
68
68
  for (const [r, o] of Object.entries(n.parts))
69
- e[r] = {
70
- index: t(o.index),
71
- values: t(o.values)
69
+ t[r] = {
70
+ index: e(o.index),
71
+ values: e(o.values)
72
72
  };
73
73
  return {
74
74
  ...n,
75
- parts: e
75
+ parts: t
76
76
  };
77
77
  }
78
78
  }
@@ -80,47 +80,47 @@ function yn(n, t) {
80
80
  function j(n) {
81
81
  if (!n || typeof n != "object")
82
82
  return !1;
83
- const t = n;
84
- if (!("type" in t))
83
+ const e = n;
84
+ if (!("type" in e))
85
85
  return !1;
86
- switch (t.type) {
86
+ switch (e.type) {
87
87
  case "Json":
88
- return typeof t.keyLength == "number" && Array.isArray(t.data);
88
+ return typeof e.keyLength == "number" && Array.isArray(e.data);
89
89
  case "JsonPartitioned":
90
- return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
90
+ return typeof e.partitionKeyLength == "number" && Array.isArray(e.parts);
91
91
  case "BinaryPartitioned":
92
- return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
92
+ return typeof e.partitionKeyLength == "number" && Array.isArray(e.parts);
93
93
  default:
94
94
  return !1;
95
95
  }
96
96
  }
97
- function ln(n) {
97
+ function yn(n) {
98
98
  return j(n) ? n.type === "JsonPartitioned" || n.type === "BinaryPartitioned" : !1;
99
99
  }
100
100
  function hn(n) {
101
101
  switch (n.type) {
102
102
  case "Json": {
103
- const t = Object.entries(n.data).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
103
+ const e = Object.entries(n.data).map(([t, r]) => ({ key: JSON.parse(t), value: r }));
104
104
  return {
105
105
  type: "Json",
106
106
  keyLength: n.keyLength,
107
- data: t
107
+ data: e
108
108
  };
109
109
  }
110
110
  case "JsonPartitioned": {
111
- const t = Object.entries(n.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
111
+ const e = Object.entries(n.parts).map(([t, r]) => ({ key: JSON.parse(t), value: r }));
112
112
  return {
113
113
  type: "JsonPartitioned",
114
114
  partitionKeyLength: n.partitionKeyLength,
115
- parts: t
115
+ parts: e
116
116
  };
117
117
  }
118
118
  case "BinaryPartitioned": {
119
- const t = Object.entries(n.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
119
+ const e = Object.entries(n.parts).map(([t, r]) => ({ key: JSON.parse(t), value: r }));
120
120
  return {
121
121
  type: "BinaryPartitioned",
122
122
  partitionKeyLength: n.partitionKeyLength,
123
- parts: t
123
+ parts: e
124
124
  };
125
125
  }
126
126
  }
@@ -128,70 +128,70 @@ function hn(n) {
128
128
  function gn(n) {
129
129
  switch (n.type) {
130
130
  case "Json": {
131
- const t = {};
132
- for (const e of n.data)
133
- t[JSON.stringify(e.key)] = e.value;
131
+ const e = {};
132
+ for (const t of n.data)
133
+ e[JSON.stringify(t.key)] = t.value;
134
134
  return {
135
135
  type: "Json",
136
136
  keyLength: n.keyLength,
137
- data: t
137
+ data: e
138
138
  };
139
139
  }
140
140
  case "JsonPartitioned": {
141
- const t = {};
142
- for (const e of n.parts)
143
- t[JSON.stringify(e.key)] = e.value;
141
+ const e = {};
142
+ for (const t of n.parts)
143
+ e[JSON.stringify(t.key)] = t.value;
144
144
  return {
145
145
  type: "JsonPartitioned",
146
146
  partitionKeyLength: n.partitionKeyLength,
147
- parts: t
147
+ parts: e
148
148
  };
149
149
  }
150
150
  case "BinaryPartitioned": {
151
- const t = {};
152
- for (const e of n.parts)
153
- t[JSON.stringify(e.key)] = e.value;
151
+ const e = {};
152
+ for (const t of n.parts)
153
+ e[JSON.stringify(t.key)] = t.value;
154
154
  return {
155
155
  type: "BinaryPartitioned",
156
156
  partitionKeyLength: n.partitionKeyLength,
157
- parts: t
157
+ parts: e
158
158
  };
159
159
  }
160
160
  }
161
161
  }
162
- function bn(n, t) {
162
+ function bn(n, e) {
163
163
  if (n !== void 0)
164
164
  switch (n.type) {
165
165
  case "Json":
166
166
  return n;
167
167
  case "JsonPartitioned": {
168
- const e = n.parts.map((r) => ({
168
+ const t = n.parts.map((r) => ({
169
169
  key: r.key,
170
- value: t(r.value)
170
+ value: e(r.value)
171
171
  }));
172
172
  return {
173
173
  ...n,
174
- parts: e
174
+ parts: t
175
175
  };
176
176
  }
177
177
  case "BinaryPartitioned": {
178
- const e = n.parts.map((r) => ({
178
+ const t = n.parts.map((r) => ({
179
179
  key: r.key,
180
180
  value: {
181
- index: t(r.value.index),
182
- values: t(r.value.values)
181
+ index: e(r.value.index),
182
+ values: e(r.value.values)
183
183
  }
184
184
  }));
185
185
  return {
186
186
  ...n,
187
- parts: e
187
+ parts: t
188
188
  };
189
189
  }
190
190
  }
191
191
  }
192
192
  const F = -2147483648, P = -9007199254740991n, wn = NaN, Pn = NaN, U = null, K = null;
193
- function g(n, t) {
194
- switch (t) {
193
+ function g(n, e) {
194
+ switch (e) {
195
195
  case "Int":
196
196
  return n === F;
197
197
  case "Long":
@@ -205,18 +205,18 @@ function g(n, t) {
205
205
  case "Bytes":
206
206
  return n === K;
207
207
  default:
208
- throw Error(`unsupported data type: ${t}`);
208
+ throw Error(`unsupported data type: ${e}`);
209
209
  }
210
210
  }
211
211
  function xn(n) {
212
212
  if (!R(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
213
213
  return n;
214
214
  }
215
- function R(n, t) {
216
- if (!t)
215
+ function R(n, e) {
216
+ if (!e)
217
217
  return typeof n == "string" || typeof n == "number" && isFinite(n) || typeof n == "bigint";
218
- if (g(n, t)) return !1;
219
- switch (t) {
218
+ if (g(n, e)) return !1;
219
+ switch (e) {
220
220
  case "Int":
221
221
  return typeof n == "number";
222
222
  case "Long":
@@ -230,14 +230,14 @@ function R(n, t) {
230
230
  case "Bytes":
231
231
  throw Error("Bytes not yet supported");
232
232
  default:
233
- throw Error(`unsupported data type: ${t}`);
233
+ throw Error(`unsupported data type: ${e}`);
234
234
  }
235
235
  }
236
- function M(n, t) {
237
- if (!t)
236
+ function _(n, e) {
237
+ if (!e)
238
238
  return n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint";
239
- if (g(n, t)) return !0;
240
- switch (t) {
239
+ if (g(n, e)) return !0;
240
+ switch (e) {
241
241
  case "Int":
242
242
  return typeof n == "number";
243
243
  case "Long":
@@ -251,7 +251,7 @@ function M(n, t) {
251
251
  case "Bytes":
252
252
  throw Error("Bytes not yet supported");
253
253
  default:
254
- throw Error(`unsupported data type: ${t}`);
254
+ throw Error(`unsupported data type: ${e}`);
255
255
  }
256
256
  }
257
257
  function An(n) {
@@ -259,25 +259,25 @@ function An(n) {
259
259
  if (typeof n == "bigint") return { bigint: n.toString() };
260
260
  throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`);
261
261
  }
262
- function T(n, t) {
262
+ function M(n, e) {
263
263
  if (n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint") {
264
- if (t && !g(n, t) && !M(n, t))
265
- throw new Error(`Unexpected value type, got ${typeof n}, expected ${t}`);
264
+ if (e && !g(n, e) && !_(n, e))
265
+ throw new Error(`Unexpected value type, got ${typeof n}, expected ${e}`);
266
266
  return n;
267
267
  }
268
268
  if (typeof n == "object" && n !== null && "bigint" in n && typeof n.bigint == "string") {
269
- if (t && t !== "Long")
270
- throw new Error(`Unexpected value type, got serialized bigint, expected ${t}`);
269
+ if (e && e !== "Long")
270
+ throw new Error(`Unexpected value type, got serialized bigint, expected ${e}`);
271
271
  return BigInt(n.bigint);
272
272
  }
273
273
  throw new Error(`Unsupported type ${typeof n} (value ${n}).`);
274
274
  }
275
275
  function kn(n) {
276
- if (n = v(n), n === null) throw new Error("Value is null");
276
+ if (n = T(n), n === null) throw new Error("Value is null");
277
277
  return n;
278
278
  }
279
- function v(n) {
280
- if (n = T(n), n === null) return null;
279
+ function T(n) {
280
+ if (n = M(n), n === null) return null;
281
281
  if (typeof n == "string") return n;
282
282
  if (typeof n == "number") {
283
283
  if (!isFinite(n)) throw new Error(`Value is not finite (${n})`);
@@ -287,19 +287,19 @@ function v(n) {
287
287
  return Number(n);
288
288
  throw new Error(`Unexpected value type: ${typeof n}`);
289
289
  }
290
- function _(n, t) {
291
- const e = Math.floor(t / 8), r = 1 << 7 - t % 8;
292
- return (n[e] & r) > 0;
290
+ function v(n, e) {
291
+ const t = Math.floor(e / 8), r = 1 << 7 - e % 8;
292
+ return (n[t] & r) > 0;
293
293
  }
294
- const H = { type: "absent" }, W = null;
294
+ const H = { type: "absent" }, q = null;
295
295
  function Nn(n) {
296
296
  return typeof n == "object" && n !== null && n.type === "absent";
297
297
  }
298
- function Sn(n, t, e = {}) {
299
- if (_(n.absent, t))
300
- return e.absent === void 0 ? H : e.absent;
301
- const r = n.data[t], o = n.type;
302
- if (g(r, o)) return e.na === void 0 ? W : e.na;
298
+ function En(n, e, t = {}) {
299
+ if (v(n.absent, e))
300
+ return t.absent === void 0 ? H : t.absent;
301
+ const r = n.data[e], o = n.type;
302
+ if (g(r, o)) return t.na === void 0 ? q : t.na;
303
303
  switch (o) {
304
304
  case "Int":
305
305
  return r;
@@ -317,14 +317,14 @@ function Sn(n, t, e = {}) {
317
317
  throw Error(`unsupported data type: ${o}`);
318
318
  }
319
319
  }
320
- function En(n) {
320
+ function Sn(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: z(n.axesSpec)
327
+ axesId: W(n.axesSpec)
328
328
  };
329
329
  }
330
330
  function Cn(n) {
@@ -333,92 +333,94 @@ function Cn(n) {
333
333
  spec: n.spec
334
334
  };
335
335
  }
336
- function p(n) {
337
- const { type: t, name: e, domain: r } = n;
338
- return { type: t, name: e, ...r && { domain: r } };
336
+ function m(n) {
337
+ const { type: e, name: t, domain: r } = n;
338
+ return { type: e, name: t, ...r && { domain: r } };
339
339
  }
340
- function z(n) {
341
- return n.map(p);
340
+ function W(n) {
341
+ return n.map(m);
342
342
  }
343
343
  function Jn(n) {
344
- return h(p(n));
344
+ return h(m(n));
345
345
  }
346
- function X(n, t) {
347
- if (n === void 0) return t === void 0;
348
- if (t === void 0) return !0;
349
- for (const e in t)
350
- if (n[e] !== t[e]) return !1;
346
+ function z(n, e) {
347
+ if (n === void 0) return e === void 0;
348
+ if (e === void 0) return !0;
349
+ for (const t in e)
350
+ if (n[t] !== e[t]) return !1;
351
351
  return !0;
352
352
  }
353
- function G(n, t) {
354
- return n.name === t.name && X(n.domain, t.domain);
353
+ function X(n, e) {
354
+ return n.name === e.name && z(n.domain, e.domain);
355
355
  }
356
- function On(n, t) {
357
- return { ...n, src: l(n.src, t) };
356
+ function On(n, e) {
357
+ return { ...n, src: y(n.src, e) };
358
358
  }
359
- function l(n, t) {
359
+ function y(n, e) {
360
360
  switch (n.type) {
361
361
  case "column":
362
362
  return {
363
363
  type: "column",
364
- column: t(n.column)
364
+ column: e(n.column)
365
365
  };
366
366
  case "slicedColumn":
367
367
  return {
368
368
  type: "slicedColumn",
369
- column: t(n.column),
369
+ column: e(n.column),
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((e) => l(e, t))
379
+ entries: n.entries.map((t) => y(t, e))
378
380
  };
379
381
  case "outer":
380
382
  return {
381
383
  type: "outer",
382
- primary: l(n.primary, t),
383
- secondary: n.secondary.map((e) => l(e, t))
384
+ primary: y(n.primary, e),
385
+ secondary: n.secondary.map((t) => y(t, e))
384
386
  };
385
387
  default:
386
388
  w(n);
387
389
  }
388
390
  }
389
- function Q(n) {
391
+ function G(n) {
390
392
  return h(n);
391
393
  }
392
- function In(n) {
394
+ function $n(n) {
393
395
  return JSON.parse(n);
394
396
  }
395
397
  function x(n) {
396
- return h(p(n));
398
+ return h(m(n));
397
399
  }
398
- function A(n, t) {
399
- return JSON.stringify([n, t]);
400
+ function A(n, e) {
401
+ return JSON.stringify([n, e]);
400
402
  }
401
- class $n {
403
+ class In {
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
405
407
  */
406
- constructor(t) {
407
- m(this, "domains", /* @__PURE__ */ new Map());
408
- m(this, "axes", /* @__PURE__ */ new Map());
408
+ constructor(e) {
409
+ l(this, "domains", /* @__PURE__ */ new Map());
410
+ l(this, "axes", /* @__PURE__ */ new Map());
409
411
  /**
410
412
  * Domain packs are used to group domain keys that can be anchored to the same anchor
411
413
  * This is used to optimize the lookup of domain anchors
412
414
  */
413
- m(this, "domainPacks", []);
415
+ l(this, "domainPacks", []);
414
416
  /**
415
417
  * Maps domain packs to anchors
416
418
  */
417
- m(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
418
- this.anchors = t;
419
- const e = Object.entries(t);
420
- e.sort((r, o) => r[0].localeCompare(o[0]));
421
- for (const [r, o] of e) {
419
+ l(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
420
+ this.anchors = e;
421
+ const t = Object.entries(e);
422
+ t.sort((r, o) => r[0].localeCompare(o[0]));
423
+ for (const [r, o] of t) {
422
424
  for (let s = 0; s < o.axesSpec.length; s++) {
423
425
  const a = o.axesSpec[s], i = x(a);
424
426
  this.axes.set(i, { anchor: r, idx: s });
@@ -436,18 +438,18 @@ class $n {
436
438
  /**
437
439
  * Implementation of derive method
438
440
  */
439
- derive(t, e) {
441
+ derive(e, t) {
440
442
  const r = {
441
- name: t.name,
443
+ name: e.name,
442
444
  axes: []
443
445
  };
444
446
  let o;
445
- if (t.domain !== void 0)
447
+ if (e.domain !== void 0)
446
448
  n:
447
449
  for (const a of this.domainPacks) {
448
450
  const i = [];
449
451
  for (const c of a) {
450
- const d = t.domain[c];
452
+ const d = e.domain[c];
451
453
  if (d !== void 0)
452
454
  i.push([c, d]);
453
455
  else
@@ -459,26 +461,26 @@ class $n {
459
461
  break;
460
462
  }
461
463
  }
462
- for (const [a, i] of Object.entries(t.domain ?? {})) {
464
+ for (const [a, i] of Object.entries(e.domain ?? {})) {
463
465
  if (o !== void 0 && o.has(a))
464
466
  continue;
465
467
  const u = A(a, i), c = this.domains.get(u);
466
468
  r.domain ?? (r.domain = {}), r.domain[a] = c ? { anchor: c } : i;
467
469
  }
468
- if (r.axes = t.axesSpec.map((a) => {
470
+ if (r.axes = e.axesSpec.map((a) => {
469
471
  const i = x(a), u = this.axes.get(i);
470
- return u === void 0 ? p(a) : u;
471
- }), !e || e.length === 0)
472
+ return u === void 0 ? m(a) : u;
473
+ }), !t || t.length === 0)
472
474
  return r;
473
475
  const s = [];
474
- for (const a of e) {
476
+ for (const a of t) {
475
477
  const [i, u] = a;
476
478
  if (typeof i == "number") {
477
- if (i < 0 || i >= t.axesSpec.length)
478
- throw new Error(`Axis index ${i} is out of bounds (0-${t.axesSpec.length - 1})`);
479
+ if (i < 0 || i >= e.axesSpec.length)
480
+ throw new Error(`Axis index ${i} is out of bounds (0-${e.axesSpec.length - 1})`);
479
481
  s.push([i, u]);
480
482
  } else {
481
- const c = t.axesSpec.findIndex((d) => d.name === i);
483
+ const c = e.axesSpec.findIndex((d) => d.name === i);
482
484
  if (c === -1)
483
485
  throw new Error(`Axis with name "${i}" not found in the column specification`);
484
486
  s.push([c, u]);
@@ -495,12 +497,12 @@ class $n {
495
497
  * @param axisFilters Optional axis filters to apply to the column
496
498
  * @returns A canonicalized string representation of the anchored column identifier
497
499
  */
498
- deriveS(t, e) {
499
- return Q(this.derive(t, e));
500
+ deriveS(e, t) {
501
+ return G(this.derive(e, t));
500
502
  }
501
503
  }
502
- function Dn(n, t, e) {
503
- const r = { ...t }, o = (e == null ? void 0 : e.ignoreMissingDomains) ?? !1;
504
+ function Dn(n, e, t) {
505
+ const r = { ...e }, o = (t == null ? void 0 : t.ignoreMissingDomains) ?? !1;
504
506
  if (r.domainAnchor !== void 0) {
505
507
  const s = n[r.domainAnchor];
506
508
  if (!s)
@@ -526,36 +528,36 @@ function Dn(n, t, e) {
526
528
  }
527
529
  r.domain = s;
528
530
  }
529
- return r.axes && (r.axes = r.axes.map((s) => Y(n, s))), r;
531
+ return r.axes && (r.axes = r.axes.map((s) => Q(n, s))), r;
530
532
  }
531
- function Y(n, t) {
532
- if (!Z(t))
533
- return t;
534
- const e = t.anchor, r = n[e];
533
+ function Q(n, e) {
534
+ if (!Y(e))
535
+ return e;
536
+ const t = e.anchor, r = n[t];
535
537
  if (!r)
536
- throw new Error(`Anchor "${e}" not found for axis reference`);
537
- if ("idx" in t) {
538
- if (t.idx < 0 || t.idx >= r.axesSpec.length)
539
- throw new Error(`Axis index ${t.idx} out of bounds for anchor "${e}"`);
540
- return r.axesSpec[t.idx];
541
- } else if ("name" in t) {
542
- const o = r.axesSpec.filter((s) => s.name === t.name);
538
+ throw new Error(`Anchor "${t}" not found for axis reference`);
539
+ if ("idx" in e) {
540
+ if (e.idx < 0 || e.idx >= r.axesSpec.length)
541
+ throw new Error(`Axis index ${e.idx} out of bounds for anchor "${t}"`);
542
+ return r.axesSpec[e.idx];
543
+ } else if ("name" in e) {
544
+ const o = r.axesSpec.filter((s) => s.name === e.name);
543
545
  if (o.length > 1)
544
- throw new Error(`Multiple axes with name "${t.name}" found in anchor "${e}"`);
546
+ throw new Error(`Multiple axes with name "${e.name}" found in anchor "${t}"`);
545
547
  if (o.length === 0)
546
- throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
548
+ throw new Error(`Axis with name "${e.name}" not found in anchor "${t}"`);
547
549
  return o[0];
548
- } else if ("id" in t) {
549
- const o = r.axesSpec.filter((s) => G(t.id, p(s)));
550
+ } else if ("id" in e) {
551
+ const o = r.axesSpec.filter((s) => X(e.id, m(s)));
550
552
  if (o.length > 1)
551
- throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
553
+ throw new Error(`Multiple matching axes found for matcher in anchor "${t}"`);
552
554
  if (o.length === 0)
553
- throw new Error(`No matching axis found for matcher in anchor "${e}"`);
555
+ throw new Error(`No matching axis found for matcher in anchor "${t}"`);
554
556
  return o[0];
555
557
  }
556
558
  throw new Error("Unsupported axis reference type");
557
559
  }
558
- function Z(n) {
560
+ function Y(n) {
559
561
  return typeof n == "object" && "anchor" in n;
560
562
  }
561
563
  function Ln(n) {
@@ -564,7 +566,7 @@ function Ln(n) {
564
566
  function f(n) {
565
567
  return n.kind === "PColumn";
566
568
  }
567
- function q(n) {
569
+ function Z(n) {
568
570
  return f(n.spec);
569
571
  }
570
572
  function Vn(n) {
@@ -574,65 +576,67 @@ function Bn(n) {
574
576
  return f(n.obj.spec);
575
577
  }
576
578
  function jn(n) {
577
- if (!q(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
579
+ if (!Z(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
578
580
  return n;
579
581
  }
580
- function Fn(n, t) {
582
+ function Fn(n, e) {
581
583
  return n === void 0 ? void 0 : {
582
584
  ...n,
583
- data: t(n.data)
585
+ data: e(n.data)
584
586
  };
585
587
  }
586
588
  function Un(n) {
587
- const t = /* @__PURE__ */ new Map(), e = (r) => {
589
+ const e = /* @__PURE__ */ new Map(), t = (r) => {
588
590
  switch (r.type) {
589
591
  case "column":
590
- t.set(r.column.id, r.column);
592
+ e.set(r.column.id, r.column);
591
593
  return;
592
594
  case "slicedColumn":
593
- t.set(r.column.id, r.column);
595
+ e.set(r.column.id, r.column);
596
+ return;
597
+ case "inlineColumn":
594
598
  return;
595
599
  case "full":
596
600
  case "inner":
597
- for (const o of r.entries) e(o);
601
+ for (const o of r.entries) t(o);
598
602
  return;
599
603
  case "outer":
600
- e(r.primary);
601
- for (const o of r.secondary) e(o);
604
+ t(r.primary);
605
+ for (const o of r.secondary) t(o);
602
606
  return;
603
607
  default:
604
608
  w(r);
605
609
  }
606
610
  };
607
- return e(n), [...t.values()];
611
+ return t(n), [...e.values()];
608
612
  }
609
613
  function nn(n) {
610
614
  throw new Error("Unexpected object: " + n);
611
615
  }
612
- function b(n, t) {
616
+ function b(n, e) {
613
617
  switch (n.type) {
614
618
  case "and":
615
- for (const e of n.operands)
616
- if (!b(e, t)) return !1;
619
+ for (const t of n.operands)
620
+ if (!b(t, e)) return !1;
617
621
  return !0;
618
622
  case "or":
619
- for (const e of n.operands)
620
- if (b(e, t)) return !0;
623
+ for (const t of n.operands)
624
+ if (b(t, e)) return !0;
621
625
  return !1;
622
626
  case "not":
623
- return !b(n.operand, t);
627
+ return !b(n.operand, e);
624
628
  case "name":
625
- return f(t) && t.name === n.name;
629
+ return f(e) && e.name === n.name;
626
630
  case "name_pattern":
627
- return f(t) && !!t.name.match(n.pattern);
631
+ return f(e) && !!e.name.match(n.pattern);
628
632
  case "annotation":
629
- return f(t) && t.annotations !== void 0 && t.annotations[n.annotation] === n.value;
633
+ return f(e) && e.annotations !== void 0 && e.annotations[n.annotation] === n.value;
630
634
  case "annotation_pattern":
631
- return f(t) && t.annotations !== void 0 && t.annotations[n.annotation] !== void 0 && !!t.annotations[n.annotation].match(n.pattern);
635
+ return f(e) && e.annotations !== void 0 && e.annotations[n.annotation] !== void 0 && !!e.annotations[n.annotation].match(n.pattern);
632
636
  case "has_axes":
633
- return f(t) && n.axes.every(
634
- (e) => t.axesSpec.some(
635
- (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(
637
+ return f(e) && n.axes.every(
638
+ (t) => e.axesSpec.some(
639
+ (r) => (t.type === void 0 || t.type === r.type) && (t.name === void 0 || t.name === r.name) && (t.domain === void 0 || Object.keys(t.domain).length === 0 || r.domain !== void 0 && Object.entries(t.domain).every(
636
640
  ([o, s]) => r.domain[o] === s
637
641
  ))
638
642
  )
@@ -641,64 +645,64 @@ function b(n, t) {
641
645
  nn(n);
642
646
  }
643
647
  }
644
- function k(n, t) {
645
- if (n.name !== void 0 && n.name !== t.name)
648
+ function k(n, e) {
649
+ if (n.name !== void 0 && n.name !== e.name)
646
650
  return !1;
647
651
  if (n.type !== void 0) {
648
652
  if (Array.isArray(n.type)) {
649
- if (!n.type.includes(t.type))
653
+ if (!n.type.includes(e.type))
650
654
  return !1;
651
- } else if (n.type !== t.type)
655
+ } else if (n.type !== e.type)
652
656
  return !1;
653
657
  }
654
658
  if (n.domain !== void 0) {
655
- const e = t.domain || {};
659
+ const t = e.domain || {};
656
660
  for (const [r, o] of Object.entries(n.domain))
657
- if (e[r] !== o)
661
+ if (t[r] !== o)
658
662
  return !1;
659
663
  }
660
664
  return !0;
661
665
  }
662
- function N(n, t) {
663
- if (t.name !== void 0 && n.name !== t.name || t.namePattern !== void 0 && !new RegExp(t.namePattern).test(n.name))
666
+ function N(n, e) {
667
+ if (e.name !== void 0 && n.name !== e.name || e.namePattern !== void 0 && !new RegExp(e.namePattern).test(n.name))
664
668
  return !1;
665
- if (t.type !== void 0) {
666
- if (Array.isArray(t.type)) {
667
- if (!t.type.includes(n.valueType))
669
+ if (e.type !== void 0) {
670
+ if (Array.isArray(e.type)) {
671
+ if (!e.type.includes(n.valueType))
668
672
  return !1;
669
- } else if (t.type !== n.valueType)
673
+ } else if (e.type !== n.valueType)
670
674
  return !1;
671
675
  }
672
- if (t.domain !== void 0) {
673
- const e = n.domain || {};
674
- for (const [r, o] of Object.entries(t.domain))
675
- if (e[r] !== o)
676
+ if (e.domain !== void 0) {
677
+ const t = n.domain || {};
678
+ for (const [r, o] of Object.entries(e.domain))
679
+ if (t[r] !== o)
676
680
  return !1;
677
681
  }
678
- if (t.axes !== void 0) {
679
- const e = n.axesSpec.map(p);
680
- if (t.partialAxesMatch) {
681
- for (const r of t.axes)
682
- if (!e.some((o) => k(r, o)))
682
+ if (e.axes !== void 0) {
683
+ const t = n.axesSpec.map(m);
684
+ if (e.partialAxesMatch) {
685
+ for (const r of e.axes)
686
+ if (!t.some((o) => k(r, o)))
683
687
  return !1;
684
688
  } else {
685
- if (e.length !== t.axes.length)
689
+ if (t.length !== e.axes.length)
686
690
  return !1;
687
- for (let r = 0; r < t.axes.length; r++)
688
- if (!k(t.axes[r], e[r]))
691
+ for (let r = 0; r < e.axes.length; r++)
692
+ if (!k(e.axes[r], t[r]))
689
693
  return !1;
690
694
  }
691
695
  }
692
- if (t.annotations !== void 0) {
693
- const e = n.annotations || {};
694
- for (const [r, o] of Object.entries(t.annotations))
695
- if (e[r] !== o)
696
+ if (e.annotations !== void 0) {
697
+ const t = n.annotations || {};
698
+ for (const [r, o] of Object.entries(e.annotations))
699
+ if (t[r] !== o)
696
700
  return !1;
697
701
  }
698
- if (t.annotationPatterns !== void 0) {
699
- const e = n.annotations || {};
700
- for (const [r, o] of Object.entries(t.annotationPatterns)) {
701
- const s = e[r];
702
+ if (e.annotationPatterns !== void 0) {
703
+ const t = n.annotations || {};
704
+ for (const [r, o] of Object.entries(e.annotationPatterns)) {
705
+ const s = t[r];
702
706
  if (s === void 0 || !new RegExp(o).test(s))
703
707
  return !1;
704
708
  }
@@ -706,25 +710,49 @@ function N(n, t) {
706
710
  return !0;
707
711
  }
708
712
  function Kn(n) {
709
- return Array.isArray(n) ? (t) => n.some((e) => f(t) && N(t, e)) : (t) => f(t) && N(t, n);
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: "/" }, Mn = y.object({
712
- __isRef: y.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
713
- blockId: y.string().describe("Upstream block id"),
714
- name: y.string().describe("Name of the output provided to the upstream block's output context")
715
+ const Rn = { href: "/" }, _n = p.object({
716
+ __isRef: p.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
717
+ blockId: p.string().describe("Upstream block id"),
718
+ name: p.string().describe("Name of the output provided to the upstream block's output context"),
719
+ 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
720
  }).describe(
716
721
  "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."
717
- ).strict().readonly();
718
- function Tn(n) {
722
+ ).readonly();
723
+ function Mn(n) {
719
724
  return typeof n == "object" && n !== null && "__isRef" in n && n.__isRef === !0 && "blockId" in n && "name" in n;
720
725
  }
721
- function vn(n, t) {
722
- return n.blockId === t.blockId && n.name === t.name;
726
+ function Tn(n, e, t = !1) {
727
+ return t ? {
728
+ __isRef: !0,
729
+ blockId: n,
730
+ name: e,
731
+ requireEnrichments: !0
732
+ } : {
733
+ __isRef: !0,
734
+ blockId: n,
735
+ name: e
736
+ };
737
+ }
738
+ function vn(n, e = !0) {
739
+ if (e)
740
+ return {
741
+ ...n,
742
+ requireEnrichments: !0
743
+ };
744
+ {
745
+ const { requireEnrichments: t, ...r } = n;
746
+ return r;
747
+ }
748
+ }
749
+ function Hn(n, e, t = !1) {
750
+ return n.blockId === e.blockId && n.name === e.name && (t || n.requireEnrichments === e.requireEnrichments);
723
751
  }
724
- function _n(n, t) {
725
- return n.ok ? { ok: !0, value: t(n.value) } : n;
752
+ function qn(n, e) {
753
+ return n.ok ? { ok: !0, value: e(n.value) } : n;
726
754
  }
727
- function tn(n) {
755
+ function en(n) {
728
756
  if (n instanceof Int8Array || n instanceof Uint8Array || n instanceof Uint8ClampedArray)
729
757
  return new DataView(n.buffer, n.byteOffset, n.byteLength);
730
758
  if (n instanceof ArrayBuffer) return new DataView(n);
@@ -732,14 +760,14 @@ function tn(n) {
732
760
  "Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray"
733
761
  );
734
762
  }
735
- const en = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", rn = "0123456789ABCDEFGHIJKLMNOPQRSTUV", on = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
736
- function C(n, t, e) {
737
- e = e || {};
763
+ const tn = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", rn = "0123456789ABCDEFGHIJKLMNOPQRSTUV", on = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
764
+ function C(n, e, t) {
765
+ t = t || {};
738
766
  let r, o;
739
- switch (t) {
767
+ switch (e) {
740
768
  case "RFC3548":
741
769
  case "RFC4648":
742
- r = en, o = !0;
770
+ r = tn, o = !0;
743
771
  break;
744
772
  case "RFC4648-HEX":
745
773
  r = rn, o = !0;
@@ -748,9 +776,9 @@ function C(n, t, e) {
748
776
  r = on, o = !1;
749
777
  break;
750
778
  default:
751
- throw new Error("Unknown base32 variant: " + String(t));
779
+ throw new Error("Unknown base32 variant: " + String(e));
752
780
  }
753
- const s = e.padding !== void 0 ? e.padding : o, a = tn(n);
781
+ const s = t.padding !== void 0 ? t.padding : o, a = en(n);
754
782
  let i = 0, u = 0, c = "";
755
783
  for (let d = 0; d < a.byteLength; d++)
756
784
  for (u = u << 8 | a.getUint8(d), i += 8; i >= 5; )
@@ -760,8 +788,8 @@ function C(n, t, e) {
760
788
  c += "=";
761
789
  return c;
762
790
  }
763
- const J = 15, sn = 24, O = y.string().length(sn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
764
- function Hn() {
791
+ const J = 15, sn = 24, O = p.string().length(sn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
792
+ function Wn() {
765
793
  const n = new Uint8Array(J);
766
794
  return crypto.getRandomValues(n), O.parse(C(n, "RFC4648"));
767
795
  }
@@ -769,24 +797,24 @@ function an(n) {
769
797
  if (n.length !== J) throw new Error(`Wrong number of bytes: ${n.length}`);
770
798
  return O.parse(C(n, "RFC4648"));
771
799
  }
772
- async function Wn(n) {
773
- const t = new TextEncoder(), e = await crypto.subtle.digest("SHA-256", t.encode(n));
774
- return an(new Uint8Array(e.slice(0, 15)));
800
+ async function zn(n) {
801
+ const e = new TextEncoder(), t = await crypto.subtle.digest("SHA-256", e.encode(n));
802
+ return an(new Uint8Array(t.slice(0, 15)));
775
803
  }
776
- function zn(n) {
804
+ function Xn(n) {
777
805
  return JSON.stringify(n);
778
806
  }
779
- function Xn(n) {
807
+ function Gn(n) {
780
808
  return h(n);
781
809
  }
782
- function Gn(n) {
810
+ function Qn(n) {
783
811
  return JSON.parse(n);
784
812
  }
785
813
  export {
786
- $n as AnchoredIdDeriver,
814
+ In as AnchoredIdDeriver,
787
815
  Rn as DefaultNavigationState,
788
816
  H as PTableAbsent,
789
- W as PTableNA,
817
+ q as PTableNA,
790
818
  K as PValueBytesNA,
791
819
  Pn as PValueDoubleNA,
792
820
  wn as PValueFloatNA,
@@ -796,22 +824,23 @@ export {
796
824
  O as PlId,
797
825
  J as PlIdBytes,
798
826
  sn as PlIdLength,
799
- Mn as PlRef,
827
+ _n as PlRef,
800
828
  Jn as canonicalizeAxisId,
801
- Xn as canonicalizeJson,
829
+ Gn as canonicalizeJson,
830
+ Tn as createPlRef,
802
831
  hn as dataInfoToEntries,
803
- Wn as digestPlId,
832
+ zn as digestPlId,
804
833
  xn as ensureNotNAPValue,
805
834
  jn as ensurePColumn,
806
835
  gn as entriesToDataInfo,
807
836
  b as executePSpecPredicate,
808
837
  Un as extractAllColumns,
809
- z as getAxesId,
810
- p as getAxisId,
838
+ W as getAxesId,
839
+ m as getAxisId,
811
840
  Cn as getColumnIdAndSpec,
812
841
  pn as getFileNameFromHandle,
813
842
  V as getFilePathFromHandle,
814
- En as getPColumnSpecId,
843
+ Sn as getPColumnSpecId,
815
844
  mn as isDataInfo,
816
845
  j as isDataInfoEntries,
817
846
  Ln as isFilteredPColumn,
@@ -819,38 +848,39 @@ export {
819
848
  D as isImportFileHandleUpload,
820
849
  dn as isLiveLog,
821
850
  R as isNotNAPValue,
822
- q as isPColumn,
851
+ Z as isPColumn,
823
852
  Bn as isPColumnResult,
824
853
  f as isPColumnSpec,
825
854
  Vn as isPColumnSpecResult,
826
855
  Nn as isPTableAbsent,
827
- M as isPValue,
828
- ln as isPartitionedDataInfoEntries,
829
- Tn as isPlRef,
830
- _ as isValueAbsent,
856
+ _ as isPValue,
857
+ yn as isPartitionedDataInfoEntries,
858
+ Mn as isPlRef,
859
+ v as isValueAbsent,
831
860
  g as isValueNA,
832
- yn as mapDataInfo,
861
+ ln as mapDataInfo,
833
862
  bn as mapDataInfoEntries,
834
- l as mapJoinEntry,
863
+ y as mapJoinEntry,
835
864
  Fn as mapPObjectData,
836
865
  On as mapPTableDef,
837
- _n as mapValueInVOE,
866
+ qn as mapValueInVOE,
838
867
  k as matchAxis,
839
- G as matchAxisId,
868
+ X as matchAxisId,
840
869
  N as matchPColumn,
841
- Sn as pTableValue,
870
+ En as pTableValue,
842
871
  kn as pValueToStringOrNumber,
843
- v as pValueToStringOrNumberOrNull,
844
- In as parseColumnId,
845
- Gn as parseJson,
872
+ T as pValueToStringOrNumberOrNull,
873
+ $n as parseColumnId,
874
+ Qn as parseJson,
846
875
  an as plId,
847
- vn as plRefsEqual,
876
+ Hn as plRefsEqual,
848
877
  Dn as resolveAnchors,
849
- T as safeConvertToPValue,
878
+ M as safeConvertToPValue,
850
879
  Kn as selectorsToPredicate,
851
- Q as stringifyColumnId,
852
- zn as stringifyJson,
880
+ G as stringifyColumnId,
881
+ Xn as stringifyJson,
853
882
  An as toJsonSafePValue,
854
- Hn as uniquePlId
883
+ Wn as uniquePlId,
884
+ vn as withEnrichments
855
885
  };
856
886
  //# sourceMappingURL=index.mjs.map