@milaboratories/graph-maker 1.1.143 → 1.1.145

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.
Files changed (48) hide show
  1. package/dist/GraphMaker/index.vue.d.ts.map +1 -1
  2. package/dist/GraphMaker/index.vue.js.map +1 -1
  3. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js +64 -64
  4. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js.map +1 -1
  5. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js +31 -31
  6. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
  7. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +39 -32
  8. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -1
  9. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +68 -62
  10. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -1
  11. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +5 -5
  12. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +8 -8
  13. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +3 -3
  14. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +6 -6
  15. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +12 -9
  16. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
  17. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/{index.js → error_like_shape.js} +1 -1
  18. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/error_like_shape.js.map +1 -0
  19. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js +8 -0
  20. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js.map +1 -0
  21. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_types.js +63 -0
  22. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_types.js.map +1 -0
  23. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js +152 -0
  24. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js.map +1 -0
  25. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js +189 -0
  26. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js.map +1 -0
  27. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/errors.js +18 -0
  28. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/errors.js.map +1 -0
  29. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/json.js +12 -0
  30. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/json.js.map +1 -0
  31. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/plid.js +7 -0
  32. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/plid.js.map +1 -0
  33. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/ref.js +8 -0
  34. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/ref.js.map +1 -0
  35. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/components/PlDataTable.js +13 -0
  36. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/components/PlDataTable.js.map +1 -0
  37. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js +89 -0
  38. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js.map +1 -0
  39. package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +50 -45
  40. package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -1
  41. package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +54 -50
  42. package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -1
  43. package/package.json +4 -4
  44. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +0 -1
  45. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +0 -979
  46. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +0 -1
  47. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js +0 -1599
  48. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js.map +0 -1
@@ -1,979 +0,0 @@
1
- import u from "../../../zod/lib/index.js";
2
- import L from "../../../../_virtual/canonicalize.js";
3
- var F = Object.defineProperty, D = (n, e, t) => e in n ? F(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, A = (n, e, t) => D(n, typeof e != "symbol" ? e + "" : e, t);
4
- u.object({
5
- /** Included left border. */
6
- from: u.number(),
7
- /** Excluded right border. */
8
- to: u.number()
9
- });
10
- function E(n) {
11
- throw new Error("Unexpected object: " + n);
12
- }
13
- function le(n) {
14
- if (!n || typeof n != "object")
15
- return !1;
16
- const e = n;
17
- if (!("type" in e))
18
- return !1;
19
- switch (e.type) {
20
- case "Json":
21
- return typeof e.keyLength == "number" && e.data !== void 0 && typeof e.data == "object";
22
- case "JsonPartitioned":
23
- case "BinaryPartitioned":
24
- case "ParquetPartitioned":
25
- return typeof e.partitionKeyLength == "number" && e.parts !== void 0 && typeof e.parts == "object";
26
- default:
27
- return !1;
28
- }
29
- }
30
- function de(n, e) {
31
- if (n !== void 0)
32
- switch (n.type) {
33
- case "Json":
34
- return n;
35
- case "JsonPartitioned": {
36
- const t = {};
37
- for (const [r, o] of Object.entries(n.parts))
38
- t[r] = e(o);
39
- return {
40
- ...n,
41
- parts: t
42
- };
43
- }
44
- case "BinaryPartitioned": {
45
- const t = {};
46
- for (const [r, o] of Object.entries(n.parts))
47
- t[r] = {
48
- index: e(o.index),
49
- values: e(o.values)
50
- };
51
- return {
52
- ...n,
53
- parts: t
54
- };
55
- }
56
- case "ParquetPartitioned": {
57
- const t = {};
58
- for (const [r, o] of Object.entries(n.parts))
59
- t[r] = e(o);
60
- return {
61
- ...n,
62
- parts: t
63
- };
64
- }
65
- }
66
- }
67
- function q(n) {
68
- if (!n || typeof n != "object")
69
- return !1;
70
- const e = n;
71
- if (!("type" in e))
72
- return !1;
73
- switch (e.type) {
74
- case "Json":
75
- return typeof e.keyLength == "number" && Array.isArray(e.data);
76
- case "JsonPartitioned":
77
- case "BinaryPartitioned":
78
- case "ParquetPartitioned":
79
- return typeof e.partitionKeyLength == "number" && Array.isArray(e.parts);
80
- default:
81
- return !1;
82
- }
83
- }
84
- function me(n) {
85
- if (!q(n)) return !1;
86
- switch (n.type) {
87
- case "JsonPartitioned":
88
- case "BinaryPartitioned":
89
- case "ParquetPartitioned":
90
- return !0;
91
- default:
92
- return !1;
93
- }
94
- }
95
- function he(n) {
96
- switch (n.type) {
97
- case "Json":
98
- return {
99
- type: "Json",
100
- keyLength: n.keyLength,
101
- data: Object.entries(n.data).map(([e, t]) => ({ key: JSON.parse(e), value: t }))
102
- };
103
- case "JsonPartitioned":
104
- return {
105
- type: "JsonPartitioned",
106
- partitionKeyLength: n.partitionKeyLength,
107
- parts: Object.entries(n.parts).map(([e, t]) => ({ key: JSON.parse(e), value: t }))
108
- };
109
- case "BinaryPartitioned":
110
- return {
111
- type: "BinaryPartitioned",
112
- partitionKeyLength: n.partitionKeyLength,
113
- parts: Object.entries(n.parts).map(([e, t]) => ({ key: JSON.parse(e), value: t }))
114
- };
115
- case "ParquetPartitioned":
116
- return {
117
- type: "ParquetPartitioned",
118
- partitionKeyLength: n.partitionKeyLength,
119
- parts: Object.entries(n.parts).map(([e, t]) => ({ key: JSON.parse(e), value: t }))
120
- };
121
- default:
122
- E(n);
123
- }
124
- }
125
- function ye(n) {
126
- switch (n.type) {
127
- case "Json":
128
- return {
129
- type: "Json",
130
- keyLength: n.keyLength,
131
- data: Object.fromEntries(
132
- n.data.map(({ key: e, value: t }) => [JSON.stringify(e), t])
133
- )
134
- };
135
- case "JsonPartitioned":
136
- return {
137
- type: "JsonPartitioned",
138
- partitionKeyLength: n.partitionKeyLength,
139
- parts: Object.fromEntries(
140
- n.parts.map(({ key: e, value: t }) => [JSON.stringify(e), t])
141
- )
142
- };
143
- case "BinaryPartitioned":
144
- return {
145
- type: "BinaryPartitioned",
146
- partitionKeyLength: n.partitionKeyLength,
147
- parts: Object.fromEntries(
148
- n.parts.map(({ key: e, value: t }) => [JSON.stringify(e), t])
149
- )
150
- };
151
- case "ParquetPartitioned":
152
- return {
153
- type: "ParquetPartitioned",
154
- partitionKeyLength: n.partitionKeyLength,
155
- parts: Object.fromEntries(
156
- n.parts.map(({ key: e, value: t }) => [JSON.stringify(e), t])
157
- )
158
- };
159
- default:
160
- E(n);
161
- }
162
- }
163
- function B(n) {
164
- if (typeof n == "string")
165
- return `String value was thrown: ${n}`;
166
- if (n && typeof n == "object")
167
- try {
168
- return `Plain object was thrown: ${JSON.stringify(n)}`;
169
- } catch (e) {
170
- return `Non-serializable object was thrown (JSON.stringify failed: ${e instanceof Error ? e.message : String(e)}): ${String(n)}`;
171
- }
172
- return `Non-Error value (${typeof n}) was thrown: ${n}`;
173
- }
174
- function R(n) {
175
- return n instanceof Error ? n : new Error(B(n));
176
- }
177
- function h(n) {
178
- return L(n);
179
- }
180
- function V(n) {
181
- return JSON.parse(n);
182
- }
183
- const g = {
184
- Int: "Int",
185
- Long: "Long",
186
- Float: "Float",
187
- Double: "Double",
188
- String: "String",
189
- Bytes: "Bytes"
190
- };
191
- function M(n, e) {
192
- return n == null ? void 0 : n[e];
193
- }
194
- function W(n, e, t, r = "readMetadataJsonOrThrow") {
195
- const o = M(n, t);
196
- if (o === void 0) return;
197
- const s = e[t];
198
- try {
199
- const a = JSON.parse(o);
200
- return s.parse(a);
201
- } catch (a) {
202
- throw new Error(
203
- `${r} failed, key: ${String(t)}, value: ${o}, error: ${R(a)}`
204
- );
205
- }
206
- }
207
- function U(n, e, t) {
208
- try {
209
- return W(n, e, t);
210
- } catch {
211
- return;
212
- }
213
- }
214
- const y = {
215
- DiscreteValues: "pl7.app/discreteValues",
216
- Graph: {
217
- IsVirtual: "pl7.app/graph/isVirtual"
218
- },
219
- HideDataFromUi: "pl7.app/hideDataFromUi",
220
- IsLinkerColumn: "pl7.app/isLinkerColumn",
221
- Label: "pl7.app/label",
222
- Max: "pl7.app/max",
223
- Min: "pl7.app/min",
224
- Parents: "pl7.app/parents",
225
- Sequence: {
226
- Annotation: {
227
- Mapping: "pl7.app/sequence/annotation/mapping"
228
- },
229
- IsAnnotation: "pl7.app/sequence/isAnnotation"
230
- },
231
- Table: {
232
- OrderPriority: "pl7.app/table/orderPriority"
233
- },
234
- Trace: "pl7.app/trace"
235
- }, z = u.object({
236
- type: u.nativeEnum(g),
237
- name: u.string(),
238
- domain: u.record(u.string(), u.string()).optional(),
239
- annotations: u.record(u.string(), u.string()).optional(),
240
- parentAxes: u.array(u.number()).optional()
241
- }).passthrough(), G = {
242
- [y.DiscreteValues]: u.array(u.string()).or(u.array(u.number())),
243
- [y.Graph.IsVirtual]: u.boolean(),
244
- [y.HideDataFromUi]: u.boolean(),
245
- [y.IsLinkerColumn]: u.boolean(),
246
- [y.Max]: u.number(),
247
- [y.Min]: u.number(),
248
- [y.Parents]: u.array(z),
249
- [y.Sequence.Annotation.Mapping]: u.record(u.string(), u.string()),
250
- [y.Sequence.IsAnnotation]: u.boolean(),
251
- [y.Table.OrderPriority]: u.number(),
252
- [y.Trace]: u.record(u.string(), u.unknown())
253
- };
254
- function ge(n, e) {
255
- return M(n == null ? void 0 : n.annotations, e);
256
- }
257
- function $(n, e) {
258
- return U(n == null ? void 0 : n.annotations, G, e);
259
- }
260
- function S(n) {
261
- return { axis: n, children: [] };
262
- }
263
- function w(n) {
264
- const e = S(n);
265
- let t = [e];
266
- for (; t.length; ) {
267
- const r = [];
268
- for (const o of t)
269
- o.children = o.axis.parentAxesSpec.map(S), r.push(...o.children);
270
- t = r;
271
- }
272
- return e;
273
- }
274
- function k(n) {
275
- const e = [n.axis];
276
- let t = [n];
277
- for (; t.length; ) {
278
- const r = [];
279
- for (const o of t)
280
- for (const s of o.children)
281
- e.push(s.axis), r.push(s);
282
- t = r;
283
- }
284
- return e;
285
- }
286
- function O(n) {
287
- return h(k(w(n)).map(d));
288
- }
289
- function H(n, e) {
290
- if (n.name !== e.name)
291
- return n.name < e.name ? 1 : -1;
292
- if (n.type !== e.type)
293
- return n.type < e.type ? 1 : -1;
294
- const t = h(n.domain ?? {}), r = h(e.domain ?? {});
295
- if (t !== r)
296
- return t < r ? 1 : -1;
297
- const o = O(n), s = O(e);
298
- if (o !== s)
299
- return o < s ? 1 : -1;
300
- const a = h(n.annotations ?? {}), i = h(e.annotations ?? {});
301
- return a !== i ? a < i ? 1 : -1 : 0;
302
- }
303
- function Q(n) {
304
- const e = $(n, y.Parents);
305
- return e === void 0 ? [] : e;
306
- }
307
- function T(n) {
308
- n.parentAxesSpec.forEach(T), n.parentAxesSpec.sort(H);
309
- }
310
- function X(n) {
311
- let e = [S(n)];
312
- const t = new Set(h(d(n)));
313
- for (; e.length; ) {
314
- const r = [], o = /* @__PURE__ */ new Set();
315
- for (const s of e) {
316
- s.children = s.axis.parentAxesSpec.map(S);
317
- for (const a of s.children) {
318
- const i = h(d(a.axis));
319
- if (!o.has(i)) {
320
- if (r.push(a), o.add(i), t.has(i))
321
- return !0;
322
- t.add(i);
323
- }
324
- }
325
- }
326
- e = r;
327
- }
328
- return !1;
329
- }
330
- function K(n) {
331
- if (!n.length)
332
- return [];
333
- const e = n.map((t) => {
334
- const { parentAxes: r, ...o } = t;
335
- return { ...o, annotations: { ...o.annotations }, parentAxesSpec: [] };
336
- });
337
- return n.forEach((t, r) => {
338
- var o;
339
- const s = e[r];
340
- t.parentAxes ? s.parentAxesSpec = t.parentAxes.map((a) => e[a]) : (s.parentAxesSpec = K(Q(t)), (o = s.annotations) == null || delete o[y.Parents]);
341
- }), e.some(X) ? e.forEach((t) => {
342
- t.parentAxesSpec = [];
343
- }) : e.forEach((t) => {
344
- T(t);
345
- }), e;
346
- }
347
- const xe = {
348
- Label: "pl7.app/label"
349
- };
350
- function d(n) {
351
- const { type: e, name: t, domain: r } = n, o = { type: e, name: t };
352
- return r && Object.entries(r).length > 0 && Object.assign(o, { domain: r }), o;
353
- }
354
- function Y(n) {
355
- return n.map(d);
356
- }
357
- function be(n) {
358
- return h(d(n));
359
- }
360
- function Z(n, e) {
361
- if (n === void 0) return e === void 0;
362
- if (e === void 0) return !0;
363
- for (const t in e)
364
- if (n[t] !== e[t]) return !1;
365
- return !0;
366
- }
367
- function _(n, e) {
368
- return n.name === e.name && Z(n.domain, e.domain);
369
- }
370
- function C(n, e) {
371
- const t = Math.floor(e / 8), r = 1 << 7 - e % 8;
372
- return (n[t] & r) > 0;
373
- }
374
- function ee(n, e) {
375
- return C(n.absent, e);
376
- }
377
- function ne(n, e) {
378
- if (n.isNA) return C(n.isNA, e);
379
- const t = n.type, r = n.data[e];
380
- switch (t) {
381
- case g.Int:
382
- return r === -2147483648;
383
- case g.Long:
384
- return r === -9007199254740991n;
385
- case g.Float:
386
- return Number.isNaN(r);
387
- case g.Double:
388
- return Number.isNaN(r);
389
- case g.String:
390
- return r === null;
391
- case g.Bytes:
392
- return r === null;
393
- default:
394
- throw Error(`unsupported data type: ${t}`);
395
- }
396
- }
397
- const te = { type: "absent" }, re = null;
398
- function oe(n, e, t) {
399
- const r = n.type;
400
- if (r === g.Bytes)
401
- throw Error("Bytes not yet supported");
402
- if (t && "dataType" in t && t.dataType !== void 0 && t.dataType !== r)
403
- throw Error(`expected column of type ${t.dataType}, got ${r}`);
404
- if (ee(n, e))
405
- return (t == null ? void 0 : t.absent) !== void 0 ? t.absent : te;
406
- if (ne(n, e))
407
- return (t == null ? void 0 : t.na) !== void 0 ? t.na : re;
408
- const o = n.data[e];
409
- switch (r) {
410
- case g.Int:
411
- return o;
412
- case g.Long:
413
- return Number(o);
414
- case g.Float:
415
- return o;
416
- case g.Double:
417
- return o;
418
- case g.String:
419
- return o;
420
- }
421
- }
422
- function Ae(n, e, t) {
423
- return oe(n, e, t);
424
- }
425
- function we(n, e) {
426
- return { ...n, src: v(n.src, e) };
427
- }
428
- function v(n, e) {
429
- switch (n.type) {
430
- case "column":
431
- return {
432
- type: "column",
433
- column: e(n.column)
434
- };
435
- case "slicedColumn":
436
- return {
437
- type: "slicedColumn",
438
- column: e(n.column),
439
- newId: n.newId,
440
- axisFilters: n.axisFilters
441
- };
442
- case "inlineColumn":
443
- return n;
444
- case "inner":
445
- case "full":
446
- return {
447
- type: n.type,
448
- entries: n.entries.map((t) => v(t, e))
449
- };
450
- case "outer":
451
- return {
452
- type: "outer",
453
- primary: v(n.primary, e),
454
- secondary: n.secondary.map((t) => v(t, e))
455
- };
456
- default:
457
- E(n);
458
- }
459
- }
460
- function ae(n) {
461
- return L(n);
462
- }
463
- function J(n) {
464
- return L(d(n));
465
- }
466
- function I(n, e) {
467
- return JSON.stringify([n, e]);
468
- }
469
- class ke {
470
- /**
471
- * Creates a new anchor context from a set of anchor column specifications
472
- * @param anchors Record of anchor column specifications indexed by anchor ID
473
- */
474
- constructor(e) {
475
- A(this, "domains", /* @__PURE__ */ new Map()), A(this, "axes", /* @__PURE__ */ new Map()), A(this, "domainPacks", []), A(this, "domainPackToAnchor", /* @__PURE__ */ new Map()), this.anchors = e;
476
- const t = Object.entries(e);
477
- t.sort((r, o) => r[0].localeCompare(o[0]));
478
- for (const [r, o] of t) {
479
- for (let s = 0; s < o.axesSpec.length; s++) {
480
- const a = o.axesSpec[s], i = J(a);
481
- this.axes.set(i, { anchor: r, idx: s });
482
- }
483
- if (o.domain !== void 0) {
484
- const s = Object.entries(o.domain);
485
- s.sort((a, i) => a[0].localeCompare(i[0])), this.domainPackToAnchor.set(JSON.stringify(s), r), this.domainPacks.push(s.map(([a]) => a));
486
- for (const [a, i] of s) {
487
- const c = I(a, i);
488
- this.domains.set(c, r);
489
- }
490
- }
491
- }
492
- }
493
- /**
494
- * Implementation of derive method
495
- */
496
- derive(e, t) {
497
- const r = {
498
- name: e.name,
499
- axes: []
500
- };
501
- let o;
502
- if (e.domain !== void 0)
503
- e:
504
- for (const a of this.domainPacks) {
505
- const i = [];
506
- for (const f of a) {
507
- const l = e.domain[f];
508
- if (l !== void 0)
509
- i.push([f, l]);
510
- else
511
- break e;
512
- }
513
- const c = this.domainPackToAnchor.get(JSON.stringify(i));
514
- if (c !== void 0) {
515
- r.domainAnchor = c, o = new Set(a);
516
- break;
517
- }
518
- }
519
- for (const [a, i] of Object.entries(e.domain ?? {})) {
520
- if (o !== void 0 && o.has(a))
521
- continue;
522
- const c = I(a, i), f = this.domains.get(c);
523
- r.domain ?? (r.domain = {}), r.domain[a] = f ? { anchor: f } : i;
524
- }
525
- if (r.axes = e.axesSpec.map((a) => {
526
- const i = J(a), c = this.axes.get(i);
527
- return c === void 0 ? d(a) : c;
528
- }), !t || t.length === 0)
529
- return r;
530
- const s = [];
531
- for (const a of t) {
532
- const [i, c] = a;
533
- if (typeof i == "number") {
534
- if (i < 0 || i >= e.axesSpec.length)
535
- throw new Error(`Axis index ${i} is out of bounds (0-${e.axesSpec.length - 1})`);
536
- s.push([i, c]);
537
- } else {
538
- const f = e.axesSpec.findIndex((l) => l.name === i);
539
- if (f === -1)
540
- throw new Error(`Axis with name "${i}" not found in the column specification`);
541
- s.push([f, c]);
542
- }
543
- }
544
- return s.sort((a, i) => a[0] - i[0]), {
545
- source: r,
546
- axisFilters: s
547
- };
548
- }
549
- /**
550
- * Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column
551
- * @param spec Column specification to anchor
552
- * @param axisFilters Optional axis filters to apply to the column
553
- * @returns A canonicalized string representation of the anchored column identifier
554
- */
555
- deriveS(e, t) {
556
- return ae(this.derive(e, t));
557
- }
558
- }
559
- function ve(n, e, t) {
560
- const r = { ...e }, o = (t == null ? void 0 : t.ignoreMissingDomains) ?? !1;
561
- if (r.domainAnchor !== void 0) {
562
- const s = n[r.domainAnchor];
563
- if (!s)
564
- throw new Error(`Anchor "${r.domainAnchor}" not found`);
565
- const a = s.domain || {};
566
- r.domain = { ...a, ...r.domain }, delete r.domainAnchor;
567
- }
568
- if (r.domain) {
569
- const s = {};
570
- for (const [a, i] of Object.entries(r.domain))
571
- if (typeof i == "string")
572
- s[a] = i;
573
- else {
574
- const c = n[i.anchor];
575
- if (!c)
576
- throw new Error(`Anchor "${i.anchor}" not found for domain key "${a}"`);
577
- if (!c.domain || c.domain[a] === void 0) {
578
- if (!o)
579
- throw new Error(`Domain key "${a}" not found in anchor "${i.anchor}"`);
580
- continue;
581
- }
582
- s[a] = c.domain[a];
583
- }
584
- r.domain = s;
585
- }
586
- return r.axes && (r.axes = r.axes.map((s) => se(n, s))), r;
587
- }
588
- function se(n, e) {
589
- if (!ie(e))
590
- return e;
591
- const t = e.anchor, r = n[t];
592
- if (!r)
593
- throw new Error(`Anchor "${t}" not found for axis reference`);
594
- if ("idx" in e) {
595
- if (e.idx < 0 || e.idx >= r.axesSpec.length)
596
- throw new Error(`Axis index ${e.idx} out of bounds for anchor "${t}"`);
597
- return r.axesSpec[e.idx];
598
- } else if ("name" in e) {
599
- const o = r.axesSpec.filter((s) => s.name === e.name);
600
- if (o.length > 1)
601
- throw new Error(`Multiple axes with name "${e.name}" found in anchor "${t}"`);
602
- if (o.length === 0)
603
- throw new Error(`Axis with name "${e.name}" not found in anchor "${t}"`);
604
- return o[0];
605
- } else if ("id" in e) {
606
- const o = r.axesSpec.filter((s) => _(e.id, d(s)));
607
- if (o.length > 1)
608
- throw new Error(`Multiple matching axes found for matcher in anchor "${t}"`);
609
- if (o.length === 0)
610
- throw new Error(`No matching axis found for matcher in anchor "${t}"`);
611
- return o[0];
612
- }
613
- throw new Error("Unsupported axis reference type");
614
- }
615
- function ie(n) {
616
- return typeof n == "object" && "anchor" in n;
617
- }
618
- function P(n) {
619
- return n.kind === "PColumn";
620
- }
621
- function ce(n) {
622
- return P(n.spec);
623
- }
624
- function Se(n) {
625
- if (!ce(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
626
- return n;
627
- }
628
- function Pe(n, e) {
629
- return n === void 0 ? void 0 : {
630
- ...n,
631
- data: e(n.data)
632
- };
633
- }
634
- function Le(n) {
635
- const e = /* @__PURE__ */ new Map(), t = (r) => {
636
- switch (r.type) {
637
- case "column":
638
- e.set(r.column.id, r.column);
639
- return;
640
- case "slicedColumn":
641
- e.set(r.column.id, r.column);
642
- return;
643
- case "inlineColumn":
644
- return;
645
- case "full":
646
- case "inner":
647
- for (const o of r.entries) t(o);
648
- return;
649
- case "outer":
650
- t(r.primary);
651
- for (const o of r.secondary) t(o);
652
- return;
653
- default:
654
- E(r);
655
- }
656
- };
657
- return t(n), [...e.values()];
658
- }
659
- function N(n, e) {
660
- if (n.name !== void 0 && n.name !== e.name)
661
- return !1;
662
- if (n.type !== void 0) {
663
- if (Array.isArray(n.type)) {
664
- if (!n.type.includes(e.type))
665
- return !1;
666
- } else if (n.type !== e.type)
667
- return !1;
668
- }
669
- if (n.domain !== void 0) {
670
- const t = e.domain || {};
671
- for (const [r, o] of Object.entries(n.domain))
672
- if (t[r] !== o)
673
- return !1;
674
- }
675
- return !0;
676
- }
677
- function j(n, e) {
678
- if (e.name !== void 0 && n.name !== e.name || e.namePattern !== void 0 && !new RegExp(e.namePattern).test(n.name))
679
- return !1;
680
- if (e.type !== void 0) {
681
- if (Array.isArray(e.type)) {
682
- if (!e.type.includes(n.valueType))
683
- return !1;
684
- } else if (e.type !== n.valueType)
685
- return !1;
686
- }
687
- if (e.domain !== void 0) {
688
- const t = n.domain || {};
689
- for (const [r, o] of Object.entries(e.domain))
690
- if (t[r] !== o)
691
- return !1;
692
- }
693
- if (e.axes !== void 0) {
694
- const t = n.axesSpec.map(d);
695
- if (e.partialAxesMatch) {
696
- for (const r of e.axes)
697
- if (!t.some((o) => N(r, o)))
698
- return !1;
699
- } else {
700
- if (t.length !== e.axes.length)
701
- return !1;
702
- for (let r = 0; r < e.axes.length; r++)
703
- if (!N(e.axes[r], t[r]))
704
- return !1;
705
- }
706
- }
707
- if (e.annotations !== void 0) {
708
- const t = n.annotations || {};
709
- for (const [r, o] of Object.entries(e.annotations))
710
- if (t[r] !== o)
711
- return !1;
712
- }
713
- if (e.annotationPatterns !== void 0) {
714
- const t = n.annotations || {};
715
- for (const [r, o] of Object.entries(e.annotationPatterns)) {
716
- const s = t[r];
717
- if (s === void 0 || !new RegExp(o).test(s))
718
- return !1;
719
- }
720
- }
721
- return !0;
722
- }
723
- function Ee(n) {
724
- return Array.isArray(n) ? (e) => n.some((t) => P(e) && j(e, t)) : (e) => P(e) && j(e, n);
725
- }
726
- function Oe(n) {
727
- const e = {
728
- kind: n.kind,
729
- name: n.name
730
- };
731
- return n.domain !== void 0 && (e.domain = n.domain), P(n) && (e.axesSpec = Y(n.axesSpec)), L(e);
732
- }
733
- class x {
734
- constructor(e) {
735
- A(this, "data"), this.data = e;
736
- }
737
- get keys() {
738
- return this.data.keys();
739
- }
740
- get keyAxesIds() {
741
- return [...this.data.keys()].map(V);
742
- }
743
- static fromColumns(e) {
744
- var t, r;
745
- const o = /* @__PURE__ */ new Map();
746
- for (const s of e.filter((a) => !!$(a.spec, y.IsLinkerColumn))) {
747
- const a = x.getAxesGroups(K(s.spec.axesSpec));
748
- if (a.length !== 2)
749
- continue;
750
- const [i, c] = a, f = x.getAxesRoots(i).map((p) => {
751
- const m = k(w(p));
752
- return [h(m.map(d)), m];
753
- }), l = x.getAxesRoots(c).map((p) => {
754
- const m = k(w(p));
755
- return [h(m.map(d)), m];
756
- });
757
- for (const [p, m] of f)
758
- o.has(p) || o.set(p, { keyAxesSpec: m, linkWith: /* @__PURE__ */ new Map() });
759
- for (const [p, m] of l)
760
- o.has(p) || o.set(p, { keyAxesSpec: m, linkWith: /* @__PURE__ */ new Map() });
761
- for (const [p] of f)
762
- for (const [m] of l)
763
- (t = o.get(p)) == null || t.linkWith.set(m, s), (r = o.get(m)) == null || r.linkWith.set(p, s);
764
- }
765
- return new this(o);
766
- }
767
- /** Get all available nodes of linker graphs if start from sourceAxesKeys */
768
- searchAvailableAxesKeys(e) {
769
- const t = new Set(e), r = /* @__PURE__ */ new Set();
770
- let o = e;
771
- for (; o.length; ) {
772
- const s = [];
773
- for (const a of o) {
774
- const i = this.data.get(a);
775
- if (i)
776
- for (const c of i.linkWith.keys())
777
- !r.has(c) && !t.has(c) && (s.push(c), r.add(c));
778
- }
779
- o = s;
780
- }
781
- return r;
782
- }
783
- /** Get all linker columns that are necessary to reach endKey from startKey */
784
- searchLinkerPath(e, t) {
785
- const r = {};
786
- let o = /* @__PURE__ */ new Set([e]);
787
- const s = /* @__PURE__ */ new Set([e]);
788
- for (; o.size; ) {
789
- const a = /* @__PURE__ */ new Set();
790
- for (const i of o) {
791
- const c = this.data.get(i);
792
- if (c)
793
- for (const f of c.linkWith.keys())
794
- if (r[f] = i, f === t) {
795
- const l = [];
796
- let p = t;
797
- for (; r[p] !== e; )
798
- l.push(p), p = r[p];
799
- return l.push(p), l.map((m) => this.data.get(m).linkWith.get(r[m]));
800
- } else s.has(f) || (a.add(f), s.add(f));
801
- }
802
- o = a;
803
- }
804
- return [];
805
- }
806
- getLinkerColumnsForAxes({
807
- from: e,
808
- to: t,
809
- throwWhenNoLinkExists: r = !0
810
- }) {
811
- const o = e.map(x.getLinkerKeyFromAxisSpec);
812
- return Array.from(
813
- new Map(
814
- x.getAxesRoots(t).map(x.getLinkerKeyFromAxisSpec).flatMap((s) => {
815
- const a = o.map((i) => this.searchLinkerPath(i, s)).reduce(
816
- (i, c) => i.length && i.length < c.length || !c.length ? i : c,
817
- []
818
- ).map((i) => [i.columnId, i]);
819
- if (!a.length && r)
820
- throw Error(`Unable to find linker column for ${s}`);
821
- return a;
822
- })
823
- ).values()
824
- );
825
- }
826
- /** Get list of axisSpecs from keys of linker columns map */
827
- getAxesListFromKeysList(e) {
828
- return Array.from(
829
- new Map(
830
- e.flatMap((t) => {
831
- var r;
832
- return ((r = this.data.get(t)) == null ? void 0 : r.keyAxesSpec) ?? [];
833
- }).map((t) => [h(d(t)), t])
834
- ).values()
835
- );
836
- }
837
- /** Get axes of target axes that are impossible to be linked to source axes with current linker map */
838
- getNonLinkableAxes(e, t) {
839
- const r = e.map(x.getLinkerKeyFromAxisSpec), o = t.map(x.getLinkerKeyFromAxisSpec);
840
- return Array.from(
841
- new Map(
842
- t.filter((s, a) => {
843
- const i = o[a];
844
- return !r.some((c) => this.searchLinkerPath(c, i).length);
845
- }).flatMap((s) => k(w(s)).map((a) => [h(d(a)), a]))
846
- ).values()
847
- );
848
- }
849
- /** Get all axes that can be connected to sourceAxes by linkers */
850
- getReachableByLinkersAxesFromAxes(e) {
851
- const t = e.map(x.getLinkerKeyFromAxisSpec), r = this.searchAvailableAxesKeys(t);
852
- return this.getAxesListFromKeysList([...r]);
853
- }
854
- static getLinkerKeyFromAxisSpec(e) {
855
- return h(k(w(e)).map(d));
856
- }
857
- /** Split array of axes into several arrays by parents: axes of one group are parents for each other.
858
- There are no order inside every group. */
859
- static getAxesGroups(e) {
860
- switch (e.length) {
861
- case 0:
862
- return [];
863
- case 1:
864
- return [[e[0]]];
865
- }
866
- const t = e.map((c) => h(d(c))), r = e.map(
867
- (c) => new Set(
868
- c.parentAxesSpec.map((f) => h(d(f))).map((f) => {
869
- const l = t.indexOf(f);
870
- if (l === -1)
871
- throw new Error(`malformed axesSpec: ${JSON.stringify(e)}, unable to locate parent ${f}`);
872
- return l;
873
- })
874
- )
875
- ), o = [...e.keys()], s = [], a = /* @__PURE__ */ new Set();
876
- let i = o.find((c) => !a.has(c));
877
- for (; i !== void 0; ) {
878
- const c = [i];
879
- a.add(i);
880
- let f = [i];
881
- for (; f.length; ) {
882
- const l = /* @__PURE__ */ new Set();
883
- for (const p of f) {
884
- const m = r[p];
885
- o.forEach((b) => {
886
- b === p || a.has(b) || (r[b].has(p) || m.has(b)) && (c.push(b), l.add(b), a.add(b));
887
- });
888
- }
889
- f = [...l];
890
- }
891
- s.push([...c]), i = o.find((l) => !a.has(l));
892
- }
893
- return s.map((c) => c.map((f) => e[f]));
894
- }
895
- /** Get all axes that are not parents of any other axis */
896
- static getAxesRoots(e) {
897
- const t = new Set(e.flatMap((r) => r.parentAxesSpec).map((r) => h(d(r))));
898
- return e.filter((r) => !t.has(h(d(r))));
899
- }
900
- }
901
- u.object({
902
- __isRef: u.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
903
- blockId: u.string().describe("Upstream block id"),
904
- name: u.string().describe("Name of the output provided to the upstream block's output context"),
905
- requireEnrichments: u.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")
906
- }).describe(
907
- "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."
908
- ).readonly();
909
- function Je(n) {
910
- return typeof n == "object" && n !== null && "__isRef" in n && n.__isRef === !0 && "blockId" in n && "name" in n;
911
- }
912
- function Ie(n, e = !0) {
913
- if (e)
914
- return {
915
- ...n,
916
- requireEnrichments: !0
917
- };
918
- {
919
- const { requireEnrichments: t, ...r } = n;
920
- return r;
921
- }
922
- }
923
- function Ne(n, e) {
924
- return n.ok ? { ok: !0, value: e(n.value) } : n;
925
- }
926
- const ue = 24;
927
- u.string().length(ue).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
928
- export {
929
- ke as AnchoredIdDeriver,
930
- y as Annotation,
931
- G as AnnotationJson,
932
- z as AxisSpec,
933
- x as LinkerMap,
934
- xe as PColumnName,
935
- te as PTableAbsent,
936
- re as PTableNA,
937
- ue as PlIdLength,
938
- g as ValueType,
939
- be as canonicalizeAxisId,
940
- O as canonicalizeAxisWithParents,
941
- h as canonicalizeJson,
942
- he as dataInfoToEntries,
943
- Oe as deriveNativeId,
944
- R as ensureError,
945
- Se as ensurePColumn,
946
- ye as entriesToDataInfo,
947
- Le as extractAllColumns,
948
- k as getArrayFromAxisTree,
949
- Y as getAxesId,
950
- w as getAxesTree,
951
- d as getAxisId,
952
- K as getNormalizedAxesList,
953
- le as isDataInfo,
954
- q as isDataInfoEntries,
955
- ce as isPColumn,
956
- P as isPColumnSpec,
957
- me as isPartitionedDataInfoEntries,
958
- Je as isPlRef,
959
- de as mapDataInfo,
960
- v as mapJoinEntry,
961
- Pe as mapPObjectData,
962
- we as mapPTableDef,
963
- Ne as mapValueInVOE,
964
- N as matchAxis,
965
- _ as matchAxisId,
966
- j as matchPColumn,
967
- Ae as pTableValue,
968
- V as parseJson,
969
- ge as readAnnotation,
970
- $ as readAnnotationJson,
971
- M as readMetadata,
972
- U as readMetadataJson,
973
- W as readMetadataJsonOrThrow,
974
- ve as resolveAnchors,
975
- Ee as selectorsToPredicate,
976
- ae as stringifyColumnId,
977
- Ie as withEnrichments
978
- };
979
- //# sourceMappingURL=index.js.map