@milaboratories/uikit 2.3.15 → 2.3.16

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,13 +1,13 @@
1
1
  import { isDataInfo as ae, extractAllColumns as Ee, mapPTableDef as Te, selectorsToPredicate as W, withEnrichments as ce, AnchoredIdDeriver as he, isPlRef as Fe, mapValueInVOE as ke, mapPObjectData as le, ensurePColumn as Oe, isPColumnSpec as z, isPColumn as be, resolveAnchors as pe, deriveNativeId as De, isPartitionedDataInfoEntries as Re, getAxisId as de, entriesToDataInfo as $e, isDataInfoEntries as _e, dataInfoToEntries as Ke, canonicalizeAxisId as je, mapDataInfo as Ne } from "../../../lib/model/common/dist/index.js";
2
- import { PlIdLength as bt, getAxesId as _t, getFileNameFromHandle as wt, getFilePathFromHandle as Pt, isImportFileHandleIndex as xt, isImportFileHandleUpload as At, mapJoinEntry as It, matchAxis as St, matchAxisId as Ct, matchPColumn as Lt, stringifyColumnId as Et } from "../../../lib/model/common/dist/index.js";
2
+ import { PlIdLength as bt, getAxesId as _t, getFileNameFromHandle as wt, getFilePathFromHandle as Pt, isImportFileHandleIndex as At, isImportFileHandleUpload as xt, mapJoinEntry as It, matchAxis as St, matchAxisId as Ct, matchPColumn as Lt, stringifyColumnId as Et } from "../../../lib/model/common/dist/index.js";
3
3
  import we from "../../../_virtual/canonicalize.js";
4
4
  import K from "../../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.js";
5
5
  import { BasePlErrorLike as Ft, ErrorLike as kt, PlErrorLike as Ot, StandardErrorLike as Dt } from "../../../lib/model/pl-error-like/dist/index.js";
6
- var Be = Object.defineProperty, Je = (n, e, t) => e in n ? Be(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, I = (n, e, t) => Je(n, typeof e != "symbol" ? e + "" : e, t);
6
+ var Be = Object.defineProperty, Ve = (n, e, t) => e in n ? Be(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, I = (n, e, t) => Ve(n, typeof e != "symbol" ? e + "" : e, t);
7
7
  function Q(n) {
8
8
  return { type: "Immediate", value: n };
9
9
  }
10
- function Ve() {
10
+ function Je() {
11
11
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
12
12
  }
13
13
  function Pe(n) {
@@ -23,7 +23,7 @@ function c() {
23
23
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
24
24
  throw new Error("Not in config rendering context");
25
25
  }
26
- function V(n, e) {
26
+ function J(n, e) {
27
27
  const t = Ue();
28
28
  if (t === void 0) return !1;
29
29
  if (n in t.callbackRegistry) throw new Error(`Callback with key ${n} already registered.`);
@@ -284,33 +284,33 @@ const We = "staging", He = "main", qe = "pl7.app/label", Ge = "pl7.app/trace", z
284
284
  id: K.string().optional(),
285
285
  label: K.string()
286
286
  }), Xe = K.array(ze), Ye = 1e-3, Qe = "__LABEL__", fe = "__LABEL__@1";
287
- function xe(n, e, t = {}) {
287
+ function Ae(n, e, t = {}) {
288
288
  const r = /* @__PURE__ */ new Map(), i = t.forceTraceElements !== void 0 && t.forceTraceElements.length > 0 ? new Set(t.forceTraceElements) : void 0, s = /* @__PURE__ */ new Map(), o = n.map((f) => {
289
289
  var P, u;
290
290
  const h = e(f);
291
291
  let v, C, L;
292
292
  "spec" in h && typeof h.spec == "object" ? (v = h.spec, C = h.prefixTrace, L = h.suffixTrace) : v = h;
293
- const p = (P = v.annotations) == null ? void 0 : P[qe], x = (u = v.annotations) == null ? void 0 : u[Ge], d = (x ? Xe.safeParse(JSON.parse(x)).data : void 0) ?? [], g = [
293
+ const p = (P = v.annotations) == null ? void 0 : P[qe], A = (u = v.annotations) == null ? void 0 : u[Ge], d = (A ? Xe.safeParse(JSON.parse(A)).data : void 0) ?? [], g = [
294
294
  ...C ?? [],
295
295
  ...d,
296
296
  ...L ?? []
297
297
  ];
298
298
  if (p !== void 0) {
299
- const A = { label: p, type: Qe, importance: -2 };
300
- t.addLabelAsSuffix ? g.push(A) : g.splice(0, 0, A);
299
+ const x = { label: p, type: Qe, importance: -2 };
300
+ t.addLabelAsSuffix ? g.push(x) : g.splice(0, 0, x);
301
301
  }
302
302
  const m = [], T = /* @__PURE__ */ new Map();
303
- for (let A = g.length - 1; A >= 0; --A) {
304
- const { type: B } = g[A], O = g[A].importance ?? 0, R = (T.get(B) ?? 0) + 1;
303
+ for (let x = g.length - 1; x >= 0; --x) {
304
+ const { type: B } = g[x], O = g[x].importance ?? 0, R = (T.get(B) ?? 0) + 1;
305
305
  T.set(B, R);
306
306
  const k = `${B}@${R}`;
307
307
  s.set(k, (s.get(k) ?? 0) + 1), r.set(
308
308
  k,
309
309
  Math.max(
310
310
  r.get(k) ?? Number.NEGATIVE_INFINITY,
311
- O - (g.length - A) * Ye
311
+ O - (g.length - x) * Ye
312
312
  )
313
- ), m.push({ ...g[A], fullType: k, occurrenceIndex: R });
313
+ ), m.push({ ...g[x], fullType: k, occurrenceIndex: R });
314
314
  }
315
315
  return m.reverse(), {
316
316
  value: f,
@@ -325,7 +325,7 @@ function xe(n, e, t = {}) {
325
325
  const N = (f, P = !1) => {
326
326
  const u = [];
327
327
  for (let h = 0; h < o.length; h++) {
328
- const v = o[h], C = v.fullTrace.filter((x) => f.has(x.fullType) || i && i.has(x.type));
328
+ const v = o[h], C = v.fullTrace.filter((A) => f.has(A.fullType) || i && i.has(A.type));
329
329
  if (C.length === 0)
330
330
  if (P)
331
331
  u.push({
@@ -333,7 +333,7 @@ function xe(n, e, t = {}) {
333
333
  value: v.value
334
334
  });
335
335
  else return;
336
- const L = C.map((x) => x.label), p = t.separator ?? " / ";
336
+ const L = C.map((A) => A.label), p = t.separator ?? " / ";
337
337
  u.push({
338
338
  label: L.join(p),
339
339
  value: v.value
@@ -357,7 +357,7 @@ function xe(n, e, t = {}) {
357
357
  }
358
358
  return N(/* @__PURE__ */ new Set([...a, ...l]), !0);
359
359
  }
360
- const H = "PColumnData/", ne = H + "ResourceMap", ie = H + "Partitioned/ResourceMap", U = H + "JsonPartitioned", j = H + "BinaryPartitioned", Ae = H + "Partitioned/", Y = Ae + "JsonPartitioned", M = Ae + "BinaryPartitioned", se = (n) => {
360
+ const H = "PColumnData/", ne = H + "ResourceMap", ie = H + "Partitioned/ResourceMap", U = H + "JsonPartitioned", j = H + "BinaryPartitioned", xe = H + "Partitioned/", Y = xe + "JsonPartitioned", M = xe + "BinaryPartitioned", se = (n) => {
361
361
  if (n.endsWith(".index"))
362
362
  return { baseKey: n.substring(0, n.length - 6), type: "index" };
363
363
  if (n.endsWith(".values"))
@@ -720,11 +720,11 @@ class me {
720
720
  }
721
721
  }
722
722
  if (L.length === 0) continue;
723
- const p = ut(u), x = p.length > 0;
723
+ const p = ut(u), A = p.length > 0;
724
724
  for (const d of L) {
725
725
  if (!z(d.spec)) continue;
726
726
  const g = d.spec;
727
- if (x) {
727
+ if (A) {
728
728
  if (it(d.data))
729
729
  throw new Error(`Splitting is not supported for PColumns with PColumnValues data format. Column id: ${d.id}`);
730
730
  const m = rt(d.data);
@@ -734,16 +734,16 @@ class me {
734
734
  }
735
735
  if (!Re(m))
736
736
  throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${m.type} for column ${d.id}`);
737
- const T = tt(m), A = p[p.length - 1];
738
- if (A >= m.partitionKeyLength)
739
- throw new Error(`Not enough partition keys (${m.partitionKeyLength}) for requested split axes (max index ${A}) in column ${g.name}`);
740
- const B = p.map((b) => this.findLabels(de(g.axesSpec[b]))), O = [], R = (b, J) => {
741
- if (J >= p.length) {
742
- if (O.push([...b]), O.length > 1e4)
737
+ const T = tt(m), x = p[p.length - 1];
738
+ if (x >= m.partitionKeyLength)
739
+ throw new Error(`Not enough partition keys (${m.partitionKeyLength}) for requested split axes (max index ${x}) in column ${g.name}`);
740
+ const B = p.map((_) => this.findLabels(de(g.axesSpec[_]))), O = [], R = (_, V) => {
741
+ if (V >= p.length) {
742
+ if (O.push([..._]), O.length > 1e4)
743
743
  throw new Error("Too many key combinations, aborting.");
744
744
  return;
745
745
  }
746
- const D = p[J];
746
+ const D = p[V];
747
747
  if (D >= T.length)
748
748
  throw new Error(`Axis index ${D} out of bounds for unique keys array (length ${T.length}) during split key generation for column ${d.id}`);
749
749
  const $ = T[D];
@@ -752,16 +752,16 @@ class me {
752
752
  return;
753
753
  }
754
754
  for (const q of $)
755
- b.push(q), R(b, J + 1), b.pop();
755
+ _.push(q), R(_, V + 1), _.pop();
756
756
  };
757
757
  if (R([], 0), O.length === 0)
758
758
  continue;
759
- const k = [...g.axesSpec], Ie = p.map((b) => b);
760
- for (let b = p.length - 1; b >= 0; b--)
761
- k.splice(p[b], 1);
759
+ const k = [...g.axesSpec], Ie = p.map((_) => _);
760
+ for (let _ = p.length - 1; _ >= 0; _--)
761
+ k.splice(p[_], 1);
762
762
  const Se = { ...g, axesSpec: k };
763
- for (const b of O) {
764
- const J = b.map((D, $) => {
763
+ for (const _ of O) {
764
+ const V = _.map((D, $) => {
765
765
  const q = Ie[$], Ce = de(g.axesSpec[q]), ue = B[$], Le = (ue == null ? void 0 : ue[D]) ?? String(D);
766
766
  return { axisIdx: q, axisId: Ce, value: D, label: Le };
767
767
  });
@@ -771,7 +771,7 @@ class me {
771
771
  spec: g,
772
772
  adjustedSpec: Se,
773
773
  dataEntries: m,
774
- axisFilters: J
774
+ axisFilters: V
775
775
  });
776
776
  }
777
777
  } else
@@ -784,7 +784,7 @@ class me {
784
784
  }
785
785
  }
786
786
  if (E.length === 0) return [];
787
- const f = xe(
787
+ const f = Ae(
788
788
  E,
789
789
  (u) => ({
790
790
  spec: u.spec,
@@ -794,8 +794,8 @@ class me {
794
794
  ), P = [];
795
795
  for (const { value: u, label: h } of f) {
796
796
  const { originalColumn: v, spec: C } = u, L = u.type === "split" ? u.axisFilters : void 0, p = at(L);
797
- let x;
798
- r ? x = r.deriveS(C, p) : x = lt(v.id, p);
797
+ let A;
798
+ r ? A = r.deriveS(C, p) : A = lt(v.id, p);
799
799
  let d = { ...u.adjustedSpec };
800
800
  o && (d = {
801
801
  ...d,
@@ -804,7 +804,7 @@ class me {
804
804
  "pl7.app/label": h
805
805
  }
806
806
  }), P.push({
807
- id: x,
807
+ id: A,
808
808
  spec: d,
809
809
  data: () => u.type === "split" ? $e(nt(u.dataEntries, p)) : u.originalColumn.data,
810
810
  label: h
@@ -891,7 +891,7 @@ class ct {
891
891
  getOptions(e, t) {
892
892
  const r = typeof e == "function" ? e : W(e), i = this.getSpecs().entries.filter((a) => r(a.obj));
893
893
  let s = {}, o = !1;
894
- return typeof t < "u" && (typeof t == "function" ? s = t : typeof t == "object" && ("includeNativeLabel" in t || "separator" in t || "addLabelAsSuffix" in t ? s = t : (t = t, s = t.label ?? {}, o = t.refsWithEnrichments ?? !1))), typeof s == "object" ? xe(i, (a) => a.obj, s ?? {}).map(({ value: { ref: a }, label: l }) => ({
894
+ return typeof t < "u" && (typeof t == "function" ? s = t : typeof t == "object" && ("includeNativeLabel" in t || "separator" in t || "addLabelAsSuffix" in t ? s = t : (t = t, s = t.label ?? {}, o = t.refsWithEnrichments ?? !1))), typeof s == "object" ? Ae(i, (a) => a.obj, s ?? {}).map(({ value: { ref: a }, label: l }) => ({
895
895
  ref: ce(a, o),
896
896
  label: l
897
897
  })) : i.map(({ ref: a, obj: l }) => ({
@@ -1256,7 +1256,7 @@ class G {
1256
1256
  this.ctx.logError(e);
1257
1257
  }
1258
1258
  }
1259
- const X = "1.40.6";
1259
+ const X = "1.41.0";
1260
1260
  function ht(n) {
1261
1261
  return n.__renderLambda === !0;
1262
1262
  }
@@ -1264,12 +1264,12 @@ function te(n) {
1264
1264
  if (n !== void 0)
1265
1265
  return ht(n) ? n.handle : n;
1266
1266
  }
1267
- const pt = class _ {
1267
+ const pt = class b {
1268
1268
  constructor(e, t, r, i, s, o, a, l, y) {
1269
1269
  this._renderingMode = e, this._initialArgs = t, this._initialUiState = r, this._outputs = i, this._inputsValid = s, this._sections = o, this._title = a, this._enrichmentTargets = l, this._featureFlags = y;
1270
1270
  }
1271
1271
  static create(e = "Heavy") {
1272
- return new _(
1272
+ return new b(
1273
1273
  e,
1274
1274
  void 0,
1275
1275
  {},
@@ -1278,13 +1278,13 @@ const pt = class _ {
1278
1278
  Q([]),
1279
1279
  void 0,
1280
1280
  void 0,
1281
- { ..._.INITIAL_BLOCK_FEATURE_FLAGS }
1281
+ { ...b.INITIAL_BLOCK_FEATURE_FLAGS }
1282
1282
  );
1283
1283
  }
1284
1284
  output(e, t, r = {}) {
1285
1285
  if (typeof t == "function") {
1286
1286
  const i = `output#${e}`;
1287
- return V(i, () => t(new G())), new _(
1287
+ return J(i, () => t(new G())), new b(
1288
1288
  this._renderingMode,
1289
1289
  this._initialArgs,
1290
1290
  this._initialUiState,
@@ -1303,7 +1303,7 @@ const pt = class _ {
1303
1303
  this._featureFlags
1304
1304
  );
1305
1305
  } else
1306
- return new _(
1306
+ return new b(
1307
1307
  this._renderingMode,
1308
1308
  this._initialArgs,
1309
1309
  this._initialUiState,
@@ -1323,7 +1323,7 @@ const pt = class _ {
1323
1323
  return this.output(e, t, { retentive: !0 });
1324
1324
  }
1325
1325
  argsValid(e) {
1326
- return typeof e == "function" ? (V("inputsValid", () => e(new G())), new _(
1326
+ return typeof e == "function" ? (J("inputsValid", () => e(new G())), new b(
1327
1327
  this._renderingMode,
1328
1328
  this._initialArgs,
1329
1329
  this._initialUiState,
@@ -1336,7 +1336,7 @@ const pt = class _ {
1336
1336
  this._title,
1337
1337
  this._enrichmentTargets,
1338
1338
  this._featureFlags
1339
- )) : new _(
1339
+ )) : new b(
1340
1340
  this._renderingMode,
1341
1341
  this._initialArgs,
1342
1342
  this._initialUiState,
@@ -1349,7 +1349,7 @@ const pt = class _ {
1349
1349
  );
1350
1350
  }
1351
1351
  sections(e) {
1352
- return Array.isArray(e) ? this.sections(Q(e)) : typeof e == "function" ? (V("sections", () => e(new G())), new _(
1352
+ return Array.isArray(e) ? this.sections(Q(e)) : typeof e == "function" ? (J("sections", () => e(new G())), new b(
1353
1353
  this._renderingMode,
1354
1354
  this._initialArgs,
1355
1355
  this._initialUiState,
@@ -1359,7 +1359,7 @@ const pt = class _ {
1359
1359
  this._title,
1360
1360
  this._enrichmentTargets,
1361
1361
  this._featureFlags
1362
- )) : new _(
1362
+ )) : new b(
1363
1363
  this._renderingMode,
1364
1364
  this._initialArgs,
1365
1365
  this._initialUiState,
@@ -1373,7 +1373,7 @@ const pt = class _ {
1373
1373
  }
1374
1374
  /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
1375
1375
  title(e) {
1376
- return V("title", () => e(new G())), new _(
1376
+ return J("title", () => e(new G())), new b(
1377
1377
  this._renderingMode,
1378
1378
  this._initialArgs,
1379
1379
  this._initialUiState,
@@ -1390,7 +1390,7 @@ const pt = class _ {
1390
1390
  * @deprecated use {@link withArgs}
1391
1391
  * */
1392
1392
  initialArgs(e) {
1393
- return new _(
1393
+ return new b(
1394
1394
  this._renderingMode,
1395
1395
  e,
1396
1396
  this._initialUiState,
@@ -1404,7 +1404,7 @@ const pt = class _ {
1404
1404
  }
1405
1405
  /** Sets initial args for the block, this value must be specified. */
1406
1406
  withArgs(e) {
1407
- return new _(
1407
+ return new b(
1408
1408
  this._renderingMode,
1409
1409
  e,
1410
1410
  this._initialUiState,
@@ -1418,7 +1418,7 @@ const pt = class _ {
1418
1418
  }
1419
1419
  /** Defines type and sets initial value for block UiState. */
1420
1420
  withUiState(e) {
1421
- return new _(
1421
+ return new b(
1422
1422
  this._renderingMode,
1423
1423
  this._initialArgs,
1424
1424
  e,
@@ -1430,12 +1430,26 @@ const pt = class _ {
1430
1430
  this._featureFlags
1431
1431
  );
1432
1432
  }
1433
+ /** Sets or overrides feature flags for the block. */
1434
+ withFeatureFlags(e) {
1435
+ return new b(
1436
+ this._renderingMode,
1437
+ this._initialArgs,
1438
+ this._initialUiState,
1439
+ this._outputs,
1440
+ this._inputsValid,
1441
+ this._sections,
1442
+ this._title,
1443
+ this._enrichmentTargets,
1444
+ { ...this._featureFlags, ...e }
1445
+ );
1446
+ }
1433
1447
  /**
1434
1448
  * Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.
1435
1449
  * Influences dependency graph construction.
1436
1450
  */
1437
1451
  enriches(e) {
1438
- return V("enrichmentTargets", e), new _(
1452
+ return J("enrichmentTargets", e), new b(
1439
1453
  this._renderingMode,
1440
1454
  this._initialArgs,
1441
1455
  this._initialUiState,
@@ -1450,9 +1464,16 @@ const pt = class _ {
1450
1464
  /** Renders all provided block settings into a pre-configured platforma API
1451
1465
  * instance, that can be used in frontend to interact with block state, and
1452
1466
  * other features provided by the platforma to the block. */
1453
- done() {
1467
+ done(e) {
1468
+ const t = e ?? 1;
1469
+ return this.withFeatureFlags({
1470
+ ...this._featureFlags,
1471
+ requiresUIAPIVersion: t
1472
+ })._done(t);
1473
+ }
1474
+ _done(e) {
1454
1475
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
1455
- const e = {
1476
+ const t = {
1456
1477
  v3: {
1457
1478
  sdkVersion: X,
1458
1479
  renderingMode: this._renderingMode,
@@ -1472,10 +1493,10 @@ const pt = class _ {
1472
1493
  inputsValid: te(this._inputsValid),
1473
1494
  sections: te(this._sections),
1474
1495
  outputs: Object.fromEntries(
1475
- Object.entries(this._outputs).map(([t, r]) => [t, te(r)])
1496
+ Object.entries(this._outputs).map(([r, i]) => [r, te(i)])
1476
1497
  )
1477
1498
  };
1478
- return Ve() ? Pe({ sdkVersion: X }) : { config: e };
1499
+ return globalThis.platformaApiVersion = e, Je() ? Pe({ sdkVersion: X, apiVersion: platformaApiVersion }) : { config: t };
1479
1500
  }
1480
1501
  };
1481
1502
  I(pt, "INITIAL_BLOCK_FEATURE_FLAGS", {
@@ -1484,7 +1505,7 @@ I(pt, "INITIAL_BLOCK_FEATURE_FLAGS", {
1484
1505
  requiresModelAPIVersion: 1
1485
1506
  });
1486
1507
  function mt() {
1487
- return Pe({ sdkVersion: X });
1508
+ return Pe({ sdkVersion: X, apiVersion: platformaApiVersion });
1488
1509
  }
1489
1510
  export {
1490
1511
  he as AnchoredIdDeriver,
@@ -1511,7 +1532,7 @@ export {
1511
1532
  je as canonicalizeAxisId,
1512
1533
  rt as convertOrParsePColumnData,
1513
1534
  Ke as dataInfoToEntries,
1514
- xe as deriveLabels,
1535
+ Ae as deriveLabels,
1515
1536
  De as deriveNativeId,
1516
1537
  te as downgradeCfgOrLambda,
1517
1538
  Oe as ensurePColumn,
@@ -1530,8 +1551,8 @@ export {
1530
1551
  ht as isConfigLambda,
1531
1552
  ae as isDataInfo,
1532
1553
  _e as isDataInfoEntries,
1533
- xt as isImportFileHandleIndex,
1534
- At as isImportFileHandleUpload,
1554
+ At as isImportFileHandleIndex,
1555
+ xt as isImportFileHandleUpload,
1535
1556
  be as isPColumn,
1536
1557
  z as isPColumnSpec,
1537
1558
  Re as isPartitionedDataInfoEntries,