@milaboratories/uikit 2.3.0 → 2.3.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.
@@ -1,51 +1,552 @@
1
- import t from "../../../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.js";
2
- t.object({
1
+ import u from "../../../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.js";
2
+ import y from "../../../../_virtual/canonicalize.js";
3
+ var A = Object.defineProperty, O = (e, t, n) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, m = (e, t, n) => O(e, typeof t != "symbol" ? t + "" : t, n);
4
+ u.object({
3
5
  /** Included left border. */
4
- from: t.number(),
6
+ from: u.number(),
5
7
  /** Excluded right border. */
6
- to: t.number()
8
+ to: u.number()
7
9
  });
8
- function i(e) {
10
+ function g(e) {
9
11
  throw new Error("Unexpected object: " + e);
10
12
  }
11
- const n = "upload://upload/", o = "index://index/";
12
- function c(e) {
13
- return e.startsWith(n);
13
+ const P = "upload://upload/", k = "index://index/";
14
+ function I(e) {
15
+ return e.startsWith(P);
14
16
  }
15
- function s(e) {
16
- return e.startsWith(o);
17
+ function S(e) {
18
+ return e.startsWith(k);
17
19
  }
18
- function l(e) {
19
- if (s(e)) {
20
- const r = e.slice(o.length);
21
- return JSON.parse(decodeURIComponent(r)).path;
22
- } else if (c(e)) {
23
- const r = e.slice(n.length);
24
- return JSON.parse(decodeURIComponent(r)).localPath;
20
+ function J(e) {
21
+ if (S(e)) {
22
+ const t = e.slice(k.length);
23
+ return JSON.parse(decodeURIComponent(t)).path;
24
+ } else if (I(e)) {
25
+ const t = e.slice(P.length);
26
+ return JSON.parse(decodeURIComponent(t)).localPath;
25
27
  }
26
- i(e);
28
+ g(e);
27
29
  }
28
- function a(e) {
30
+ function j(e) {
29
31
  return e.replace(/^.*[\\/]/, "");
30
32
  }
31
- function p(e) {
32
- return a(l(e));
33
+ function M(e) {
34
+ return j(J(e));
33
35
  }
34
- t.object({
35
- __isRef: t.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
36
- blockId: t.string().describe("Upstream block id"),
37
- name: t.string().describe("Name of the output provided to the upstream block's output context"),
38
- requireEnrichments: t.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")
36
+ function _(e) {
37
+ if (!e || typeof e != "object")
38
+ return !1;
39
+ const t = e;
40
+ if (!("type" in t))
41
+ return !1;
42
+ switch (t.type) {
43
+ case "Json":
44
+ return typeof t.keyLength == "number" && t.data !== void 0 && typeof t.data == "object";
45
+ case "JsonPartitioned":
46
+ return typeof t.partitionKeyLength == "number" && t.parts !== void 0 && typeof t.parts == "object";
47
+ case "BinaryPartitioned":
48
+ return typeof t.partitionKeyLength == "number" && t.parts !== void 0 && typeof t.parts == "object";
49
+ default:
50
+ return !1;
51
+ }
52
+ }
53
+ function U(e, t) {
54
+ if (e !== void 0)
55
+ switch (e.type) {
56
+ case "Json":
57
+ return e;
58
+ case "JsonPartitioned": {
59
+ const n = {};
60
+ for (const [r, o] of Object.entries(e.parts))
61
+ n[r] = t(o);
62
+ return {
63
+ ...e,
64
+ parts: n
65
+ };
66
+ }
67
+ case "BinaryPartitioned": {
68
+ const n = {};
69
+ for (const [r, o] of Object.entries(e.parts))
70
+ n[r] = {
71
+ index: t(o.index),
72
+ values: t(o.values)
73
+ };
74
+ return {
75
+ ...e,
76
+ parts: n
77
+ };
78
+ }
79
+ }
80
+ }
81
+ function E(e) {
82
+ if (!e || typeof e != "object")
83
+ return !1;
84
+ const t = e;
85
+ if (!("type" in t))
86
+ return !1;
87
+ switch (t.type) {
88
+ case "Json":
89
+ return typeof t.keyLength == "number" && Array.isArray(t.data);
90
+ case "JsonPartitioned":
91
+ return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
92
+ case "BinaryPartitioned":
93
+ return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
94
+ default:
95
+ return !1;
96
+ }
97
+ }
98
+ function H(e) {
99
+ return E(e) ? e.type === "JsonPartitioned" || e.type === "BinaryPartitioned" : !1;
100
+ }
101
+ function q(e) {
102
+ switch (e.type) {
103
+ case "Json": {
104
+ const t = Object.entries(e.data).map(([n, r]) => ({ key: JSON.parse(n), value: r }));
105
+ return {
106
+ type: "Json",
107
+ keyLength: e.keyLength,
108
+ data: t
109
+ };
110
+ }
111
+ case "JsonPartitioned": {
112
+ const t = Object.entries(e.parts).map(([n, r]) => ({ key: JSON.parse(n), value: r }));
113
+ return {
114
+ type: "JsonPartitioned",
115
+ partitionKeyLength: e.partitionKeyLength,
116
+ parts: t
117
+ };
118
+ }
119
+ case "BinaryPartitioned": {
120
+ const t = Object.entries(e.parts).map(([n, r]) => ({ key: JSON.parse(n), value: r }));
121
+ return {
122
+ type: "BinaryPartitioned",
123
+ partitionKeyLength: e.partitionKeyLength,
124
+ parts: t
125
+ };
126
+ }
127
+ }
128
+ }
129
+ function V(e) {
130
+ switch (e.type) {
131
+ case "Json": {
132
+ const t = {};
133
+ for (const n of e.data)
134
+ t[JSON.stringify(n.key)] = n.value;
135
+ return {
136
+ type: "Json",
137
+ keyLength: e.keyLength,
138
+ data: t
139
+ };
140
+ }
141
+ case "JsonPartitioned": {
142
+ const t = {};
143
+ for (const n of e.parts)
144
+ t[JSON.stringify(n.key)] = n.value;
145
+ return {
146
+ type: "JsonPartitioned",
147
+ partitionKeyLength: e.partitionKeyLength,
148
+ parts: t
149
+ };
150
+ }
151
+ case "BinaryPartitioned": {
152
+ const t = {};
153
+ for (const n of e.parts)
154
+ t[JSON.stringify(n.key)] = n.value;
155
+ return {
156
+ type: "BinaryPartitioned",
157
+ partitionKeyLength: e.partitionKeyLength,
158
+ parts: t
159
+ };
160
+ }
161
+ }
162
+ }
163
+ function d(e) {
164
+ const { type: t, name: n, domain: r } = e, o = { type: t, name: n };
165
+ return r && Object.entries(r).length > 0 && Object.assign(o, { domain: r }), o;
166
+ }
167
+ function C(e) {
168
+ return e.map(d);
169
+ }
170
+ function W(e) {
171
+ return y(d(e));
172
+ }
173
+ function L(e, t) {
174
+ if (e === void 0) return t === void 0;
175
+ if (t === void 0) return !0;
176
+ for (const n in t)
177
+ if (e[n] !== t[n]) return !1;
178
+ return !0;
179
+ }
180
+ function $(e, t) {
181
+ return e.name === t.name && L(e.domain, t.domain);
182
+ }
183
+ function z(e, t) {
184
+ return { ...e, src: p(e.src, t) };
185
+ }
186
+ function p(e, t) {
187
+ switch (e.type) {
188
+ case "column":
189
+ return {
190
+ type: "column",
191
+ column: t(e.column)
192
+ };
193
+ case "slicedColumn":
194
+ return {
195
+ type: "slicedColumn",
196
+ column: t(e.column),
197
+ newId: e.newId,
198
+ axisFilters: e.axisFilters
199
+ };
200
+ case "inlineColumn":
201
+ return e;
202
+ case "inner":
203
+ case "full":
204
+ return {
205
+ type: e.type,
206
+ entries: e.entries.map((n) => p(n, t))
207
+ };
208
+ case "outer":
209
+ return {
210
+ type: "outer",
211
+ primary: p(e.primary, t),
212
+ secondary: e.secondary.map((n) => p(n, t))
213
+ };
214
+ default:
215
+ g(e);
216
+ }
217
+ }
218
+ function N(e) {
219
+ return y(e);
220
+ }
221
+ function x(e) {
222
+ return y(d(e));
223
+ }
224
+ function b(e, t) {
225
+ return JSON.stringify([e, t]);
226
+ }
227
+ class Y {
228
+ /**
229
+ * Creates a new anchor context from a set of anchor column specifications
230
+ * @param anchors Record of anchor column specifications indexed by anchor ID
231
+ */
232
+ constructor(t) {
233
+ m(this, "domains", /* @__PURE__ */ new Map()), m(this, "axes", /* @__PURE__ */ new Map()), m(this, "domainPacks", []), m(this, "domainPackToAnchor", /* @__PURE__ */ new Map()), this.anchors = t;
234
+ const n = Object.entries(t);
235
+ n.sort((r, o) => r[0].localeCompare(o[0]));
236
+ for (const [r, o] of n) {
237
+ for (let i = 0; i < o.axesSpec.length; i++) {
238
+ const a = o.axesSpec[i], s = x(a);
239
+ this.axes.set(s, { anchor: r, idx: i });
240
+ }
241
+ if (o.domain !== void 0) {
242
+ const i = Object.entries(o.domain);
243
+ i.sort((a, s) => a[0].localeCompare(s[0])), this.domainPackToAnchor.set(JSON.stringify(i), r), this.domainPacks.push(i.map(([a]) => a));
244
+ for (const [a, s] of i) {
245
+ const c = b(a, s);
246
+ this.domains.set(c, r);
247
+ }
248
+ }
249
+ }
250
+ }
251
+ /**
252
+ * Implementation of derive method
253
+ */
254
+ derive(t, n) {
255
+ const r = {
256
+ name: t.name,
257
+ axes: []
258
+ };
259
+ let o;
260
+ if (t.domain !== void 0)
261
+ e:
262
+ for (const a of this.domainPacks) {
263
+ const s = [];
264
+ for (const f of a) {
265
+ const l = t.domain[f];
266
+ if (l !== void 0)
267
+ s.push([f, l]);
268
+ else
269
+ break e;
270
+ }
271
+ const c = this.domainPackToAnchor.get(JSON.stringify(s));
272
+ if (c !== void 0) {
273
+ r.domainAnchor = c, o = new Set(a);
274
+ break;
275
+ }
276
+ }
277
+ for (const [a, s] of Object.entries(t.domain ?? {})) {
278
+ if (o !== void 0 && o.has(a))
279
+ continue;
280
+ const c = b(a, s), f = this.domains.get(c);
281
+ r.domain ?? (r.domain = {}), r.domain[a] = f ? { anchor: f } : s;
282
+ }
283
+ if (r.axes = t.axesSpec.map((a) => {
284
+ const s = x(a), c = this.axes.get(s);
285
+ return c === void 0 ? d(a) : c;
286
+ }), !n || n.length === 0)
287
+ return r;
288
+ const i = [];
289
+ for (const a of n) {
290
+ const [s, c] = a;
291
+ if (typeof s == "number") {
292
+ if (s < 0 || s >= t.axesSpec.length)
293
+ throw new Error(`Axis index ${s} is out of bounds (0-${t.axesSpec.length - 1})`);
294
+ i.push([s, c]);
295
+ } else {
296
+ const f = t.axesSpec.findIndex((l) => l.name === s);
297
+ if (f === -1)
298
+ throw new Error(`Axis with name "${s}" not found in the column specification`);
299
+ i.push([f, c]);
300
+ }
301
+ }
302
+ return i.sort((a, s) => a[0] - s[0]), {
303
+ source: r,
304
+ axisFilters: i
305
+ };
306
+ }
307
+ /**
308
+ * Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column
309
+ * @param spec Column specification to anchor
310
+ * @param axisFilters Optional axis filters to apply to the column
311
+ * @returns A canonicalized string representation of the anchored column identifier
312
+ */
313
+ deriveS(t, n) {
314
+ return N(this.derive(t, n));
315
+ }
316
+ }
317
+ function Z(e, t, n) {
318
+ const r = { ...t }, o = (n == null ? void 0 : n.ignoreMissingDomains) ?? !1;
319
+ if (r.domainAnchor !== void 0) {
320
+ const i = e[r.domainAnchor];
321
+ if (!i)
322
+ throw new Error(`Anchor "${r.domainAnchor}" not found`);
323
+ const a = i.domain || {};
324
+ r.domain = { ...a, ...r.domain }, delete r.domainAnchor;
325
+ }
326
+ if (r.domain) {
327
+ const i = {};
328
+ for (const [a, s] of Object.entries(r.domain))
329
+ if (typeof s == "string")
330
+ i[a] = s;
331
+ else {
332
+ const c = e[s.anchor];
333
+ if (!c)
334
+ throw new Error(`Anchor "${s.anchor}" not found for domain key "${a}"`);
335
+ if (!c.domain || c.domain[a] === void 0) {
336
+ if (!o)
337
+ throw new Error(`Domain key "${a}" not found in anchor "${s.anchor}"`);
338
+ continue;
339
+ }
340
+ i[a] = c.domain[a];
341
+ }
342
+ r.domain = i;
343
+ }
344
+ return r.axes && (r.axes = r.axes.map((i) => K(e, i))), r;
345
+ }
346
+ function K(e, t) {
347
+ if (!D(t))
348
+ return t;
349
+ const n = t.anchor, r = e[n];
350
+ if (!r)
351
+ throw new Error(`Anchor "${n}" not found for axis reference`);
352
+ if ("idx" in t) {
353
+ if (t.idx < 0 || t.idx >= r.axesSpec.length)
354
+ throw new Error(`Axis index ${t.idx} out of bounds for anchor "${n}"`);
355
+ return r.axesSpec[t.idx];
356
+ } else if ("name" in t) {
357
+ const o = r.axesSpec.filter((i) => i.name === t.name);
358
+ if (o.length > 1)
359
+ throw new Error(`Multiple axes with name "${t.name}" found in anchor "${n}"`);
360
+ if (o.length === 0)
361
+ throw new Error(`Axis with name "${t.name}" not found in anchor "${n}"`);
362
+ return o[0];
363
+ } else if ("id" in t) {
364
+ const o = r.axesSpec.filter((i) => $(t.id, d(i)));
365
+ if (o.length > 1)
366
+ throw new Error(`Multiple matching axes found for matcher in anchor "${n}"`);
367
+ if (o.length === 0)
368
+ throw new Error(`No matching axis found for matcher in anchor "${n}"`);
369
+ return o[0];
370
+ }
371
+ throw new Error("Unsupported axis reference type");
372
+ }
373
+ function D(e) {
374
+ return typeof e == "object" && "anchor" in e;
375
+ }
376
+ function h(e) {
377
+ return e.kind === "PColumn";
378
+ }
379
+ function R(e) {
380
+ return h(e.spec);
381
+ }
382
+ function G(e) {
383
+ if (!R(e)) throw new Error(`not a PColumn (kind = ${e.spec.kind})`);
384
+ return e;
385
+ }
386
+ function Q(e, t) {
387
+ return e === void 0 ? void 0 : {
388
+ ...e,
389
+ data: t(e.data)
390
+ };
391
+ }
392
+ function X(e) {
393
+ const t = /* @__PURE__ */ new Map(), n = (r) => {
394
+ switch (r.type) {
395
+ case "column":
396
+ t.set(r.column.id, r.column);
397
+ return;
398
+ case "slicedColumn":
399
+ t.set(r.column.id, r.column);
400
+ return;
401
+ case "inlineColumn":
402
+ return;
403
+ case "full":
404
+ case "inner":
405
+ for (const o of r.entries) n(o);
406
+ return;
407
+ case "outer":
408
+ n(r.primary);
409
+ for (const o of r.secondary) n(o);
410
+ return;
411
+ default:
412
+ g(r);
413
+ }
414
+ };
415
+ return n(e), [...t.values()];
416
+ }
417
+ function v(e, t) {
418
+ if (e.name !== void 0 && e.name !== t.name)
419
+ return !1;
420
+ if (e.type !== void 0) {
421
+ if (Array.isArray(e.type)) {
422
+ if (!e.type.includes(t.type))
423
+ return !1;
424
+ } else if (e.type !== t.type)
425
+ return !1;
426
+ }
427
+ if (e.domain !== void 0) {
428
+ const n = t.domain || {};
429
+ for (const [r, o] of Object.entries(e.domain))
430
+ if (n[r] !== o)
431
+ return !1;
432
+ }
433
+ return !0;
434
+ }
435
+ function w(e, t) {
436
+ if (t.name !== void 0 && e.name !== t.name || t.namePattern !== void 0 && !new RegExp(t.namePattern).test(e.name))
437
+ return !1;
438
+ if (t.type !== void 0) {
439
+ if (Array.isArray(t.type)) {
440
+ if (!t.type.includes(e.valueType))
441
+ return !1;
442
+ } else if (t.type !== e.valueType)
443
+ return !1;
444
+ }
445
+ if (t.domain !== void 0) {
446
+ const n = e.domain || {};
447
+ for (const [r, o] of Object.entries(t.domain))
448
+ if (n[r] !== o)
449
+ return !1;
450
+ }
451
+ if (t.axes !== void 0) {
452
+ const n = e.axesSpec.map(d);
453
+ if (t.partialAxesMatch) {
454
+ for (const r of t.axes)
455
+ if (!n.some((o) => v(r, o)))
456
+ return !1;
457
+ } else {
458
+ if (n.length !== t.axes.length)
459
+ return !1;
460
+ for (let r = 0; r < t.axes.length; r++)
461
+ if (!v(t.axes[r], n[r]))
462
+ return !1;
463
+ }
464
+ }
465
+ if (t.annotations !== void 0) {
466
+ const n = e.annotations || {};
467
+ for (const [r, o] of Object.entries(t.annotations))
468
+ if (n[r] !== o)
469
+ return !1;
470
+ }
471
+ if (t.annotationPatterns !== void 0) {
472
+ const n = e.annotations || {};
473
+ for (const [r, o] of Object.entries(t.annotationPatterns)) {
474
+ const i = n[r];
475
+ if (i === void 0 || !new RegExp(o).test(i))
476
+ return !1;
477
+ }
478
+ }
479
+ return !0;
480
+ }
481
+ function ee(e) {
482
+ return Array.isArray(e) ? (t) => e.some((n) => h(t) && w(t, n)) : (t) => h(t) && w(t, e);
483
+ }
484
+ function te(e) {
485
+ const t = {
486
+ kind: e.kind,
487
+ name: e.name
488
+ };
489
+ return e.domain !== void 0 && (t.domain = e.domain), h(e) && (t.axesSpec = C(e.axesSpec)), y(t);
490
+ }
491
+ u.object({
492
+ __isRef: u.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
493
+ blockId: u.string().describe("Upstream block id"),
494
+ name: u.string().describe("Name of the output provided to the upstream block's output context"),
495
+ 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")
39
496
  }).describe(
40
497
  "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."
41
498
  ).readonly();
42
- const d = 24;
43
- t.string().length(d).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
499
+ function ne(e) {
500
+ return typeof e == "object" && e !== null && "__isRef" in e && e.__isRef === !0 && "blockId" in e && "name" in e;
501
+ }
502
+ function re(e, t = !0) {
503
+ if (t)
504
+ return {
505
+ ...e,
506
+ requireEnrichments: !0
507
+ };
508
+ {
509
+ const { requireEnrichments: n, ...r } = e;
510
+ return r;
511
+ }
512
+ }
513
+ function oe(e, t) {
514
+ return e.ok ? { ok: !0, value: t(e.value) } : e;
515
+ }
516
+ const T = 24;
517
+ u.string().length(T).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
44
518
  export {
45
- d as PlIdLength,
46
- p as getFileNameFromHandle,
47
- l as getFilePathFromHandle,
48
- s as isImportFileHandleIndex,
49
- c as isImportFileHandleUpload
519
+ Y as AnchoredIdDeriver,
520
+ T as PlIdLength,
521
+ W as canonicalizeAxisId,
522
+ q as dataInfoToEntries,
523
+ te as deriveNativeId,
524
+ G as ensurePColumn,
525
+ V as entriesToDataInfo,
526
+ X as extractAllColumns,
527
+ C as getAxesId,
528
+ d as getAxisId,
529
+ M as getFileNameFromHandle,
530
+ J as getFilePathFromHandle,
531
+ _ as isDataInfo,
532
+ E as isDataInfoEntries,
533
+ S as isImportFileHandleIndex,
534
+ I as isImportFileHandleUpload,
535
+ R as isPColumn,
536
+ h as isPColumnSpec,
537
+ H as isPartitionedDataInfoEntries,
538
+ ne as isPlRef,
539
+ U as mapDataInfo,
540
+ p as mapJoinEntry,
541
+ Q as mapPObjectData,
542
+ z as mapPTableDef,
543
+ oe as mapValueInVOE,
544
+ v as matchAxis,
545
+ $ as matchAxisId,
546
+ w as matchPColumn,
547
+ Z as resolveAnchors,
548
+ ee as selectorsToPredicate,
549
+ N as stringifyColumnId,
550
+ re as withEnrichments
50
551
  };
51
552
  //# sourceMappingURL=index.js.map