@platforma-open/milaboratories.sequence-properties.model 1.2.2 → 1.2.4

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/bundle.js CHANGED
@@ -25,14 +25,14 @@
25
25
  enumerable: true
26
26
  }) : target, mod));
27
27
  //#endregion
28
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/plugin_handle.js
28
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/plugin_handle.js
29
29
  const PLUGIN_OUTPUT_PREFIX = "plugin-output#";
30
30
  /** Construct the output key for a plugin output in the block outputs map. */
31
31
  function pluginOutputKey(handle, outputKey) {
32
32
  return `${PLUGIN_OUTPUT_PREFIX}${handle}#${outputKey}`;
33
33
  }
34
34
  //#endregion
35
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/block_storage.js
35
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/block_storage.js
36
36
  /**
37
37
  * Discriminator key for BlockStorage format detection.
38
38
  * This unique hash-based key identifies data as BlockStorage vs legacy formats.
@@ -274,7 +274,7 @@
274
274
  return pluginEntry.__data;
275
275
  }
276
276
  //#endregion
277
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/block_migrations.js
277
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/block_migrations.js
278
278
  /** Create a DataVersioned wrapper with correct shape */
279
279
  function makeVersionedData(version, data) {
280
280
  return {
@@ -769,7 +769,7 @@
769
769
  }
770
770
  };
771
771
  //#endregion
772
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/internal.js
772
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/internal.js
773
773
  /** Utility code helping to identify whether the code is running in actual UI environment */
774
774
  function isInUI() {
775
775
  return typeof globalThis.getPlatforma !== "undefined" || typeof globalThis.platforma !== "undefined";
@@ -839,7 +839,7 @@
839
839
  futureResolves.get(handle).push(onResolve);
840
840
  }
841
841
  //#endregion
842
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/block_storage_facade.js
842
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/block_storage_facade.js
843
843
  /**
844
844
  * All facade callback names as constants.
845
845
  * These are the source of truth - the interface is derived from these.
@@ -874,7 +874,7 @@
874
874
  for (const key of Object.values(BlockStorageFacadeCallbacks)) tryRegisterCallback(key, callbacks[key]);
875
875
  }
876
876
  //#endregion
877
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/config/actions.js
877
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/config/actions.js
878
878
  function getFromCfg(variable) {
879
879
  return {
880
880
  type: "GetFromCtx",
@@ -887,7 +887,7 @@
887
887
  getFromCfg("$staging");
888
888
  getFromCfg("$ui");
889
889
  //#endregion
890
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/render/future.js
890
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/render/future.js
891
891
  var FutureRef = class FutureRef {
892
892
  isResolved = false;
893
893
  resolvedValue;
@@ -4462,7 +4462,7 @@
4462
4462
  to: numberType().min(1)
4463
4463
  });
4464
4464
  //#endregion
4465
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/util.js
4465
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/util.js
4466
4466
  function assertNever(x) {
4467
4467
  throw new Error("Unexpected object: " + x);
4468
4468
  }
@@ -4474,7 +4474,7 @@
4474
4474
  return [...new Map(array.map((e) => [makeId(e), e])).values()];
4475
4475
  }
4476
4476
  //#endregion
4477
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_info.js
4477
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_info.js
4478
4478
  /**
4479
4479
  * Type guard function that checks if the given value is a valid DataInfo.
4480
4480
  *
@@ -4665,7 +4665,7 @@
4665
4665
  }
4666
4666
  }
4667
4667
  //#endregion
4668
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/errors.js
4668
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/errors.js
4669
4669
  var ServiceError = class extends Error {
4670
4670
  name = "ServiceError";
4671
4671
  };
@@ -4689,7 +4689,7 @@
4689
4689
  return new Error(stringifyValue(value));
4690
4690
  }
4691
4691
  //#endregion
4692
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/json.js
4692
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/json.js
4693
4693
  var import_canonicalize = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
4694
4694
  module.exports = function serialize(object) {
4695
4695
  if (typeof object === "number" && isNaN(object)) throw new Error("NaN is not allowed");
@@ -4722,7 +4722,7 @@
4722
4722
  }
4723
4723
  }
4724
4724
  //#endregion
4725
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js
4725
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js
4726
4726
  function readMetadata(metadata, key) {
4727
4727
  return metadata?.[key];
4728
4728
  }
@@ -5014,8 +5014,8 @@
5014
5014
  return query.name === target.name && matchDomain$1(query.domain, target.domain) && matchDomain$1(query.contextDomain, target.contextDomain);
5015
5015
  }
5016
5016
  //#endregion
5017
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/query/utils.js
5018
- const booleanTypesSet = new Set([
5017
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/query/utils.js
5018
+ const BOOLEAN_TYPES = new Set([
5019
5019
  "numericComparison",
5020
5020
  "stringEquals",
5021
5021
  "stringContains",
@@ -5028,7 +5028,7 @@
5028
5028
  "isIn"
5029
5029
  ]);
5030
5030
  function isBooleanExpression(expr) {
5031
- return booleanTypesSet.has(expr.type);
5031
+ return BOOLEAN_TYPES.has(expr.type);
5032
5032
  }
5033
5033
  /**
5034
5034
  * Recursively traverses a SpecQuery tree bottom-up, applying visitor callbacks.
@@ -5092,6 +5092,7 @@
5092
5092
  case "filter":
5093
5093
  case "sort":
5094
5094
  case "sliceAxes":
5095
+ case "transformColumns":
5095
5096
  result = {
5096
5097
  ...query,
5097
5098
  input: traverseQuerySpec(query.input, visitor)
@@ -5106,7 +5107,7 @@
5106
5107
  return traverseQuerySpec(query, { column: cb });
5107
5108
  }
5108
5109
  //#endregion
5109
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/table_calculate.js
5110
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/table_calculate.js
5110
5111
  function mapPTableDef(def, cb) {
5111
5112
  return {
5112
5113
  ...def,
@@ -5149,7 +5150,21 @@
5149
5150
  }
5150
5151
  }
5151
5152
  //#endregion
5152
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/ids.js
5153
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/table_common.js
5154
+ function getPTableColumnId(spec) {
5155
+ switch (spec.type) {
5156
+ case "axis": return {
5157
+ type: "axis",
5158
+ id: spec.id
5159
+ };
5160
+ case "column": return {
5161
+ type: "column",
5162
+ id: spec.id
5163
+ };
5164
+ }
5165
+ }
5166
+ //#endregion
5167
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/ids.js
5153
5168
  /**
5154
5169
  * Canonically serializes a {@link UniversalPColumnId} to a string.
5155
5170
  * @param id - The column identifier to serialize
@@ -5159,7 +5174,7 @@
5159
5174
  return (0, import_canonicalize.default)(id);
5160
5175
  }
5161
5176
  //#endregion
5162
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/anchored.js
5177
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/anchored.js
5163
5178
  function axisKey(axis) {
5164
5179
  return (0, import_canonicalize.default)(getAxisId(axis));
5165
5180
  }
@@ -5404,7 +5419,7 @@
5404
5419
  return typeof value === "object" && "anchor" in value;
5405
5420
  }
5406
5421
  //#endregion
5407
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/pool/spec.js
5422
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/pool/spec.js
5408
5423
  function isPColumnSpec(spec) {
5409
5424
  return spec.kind === "PColumn";
5410
5425
  }
@@ -5450,7 +5465,7 @@
5450
5465
  return [...columns.values()];
5451
5466
  }
5452
5467
  //#endregion
5453
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/selectors.js
5468
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/selectors.js
5454
5469
  /**
5455
5470
  * Determines if an axis ID matches an axis selector.
5456
5471
  *
@@ -5531,7 +5546,7 @@
5531
5546
  else return (spec) => isPColumnSpec(spec) && matchPColumn(spec, predicateOrSelectors);
5532
5547
  }
5533
5548
  //#endregion
5534
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/native_id.js
5549
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/native_id.js
5535
5550
  function deriveNativeId(spec) {
5536
5551
  const result = {
5537
5552
  kind: spec.kind,
@@ -5548,47 +5563,6 @@
5548
5563
  return v === null || v === void 0;
5549
5564
  }
5550
5565
  Array.isArray;
5551
- function isObject(value) {
5552
- return typeof value === "object" && value !== null;
5553
- }
5554
- /**
5555
- * Checks if the given value is a plain object.
5556
- *
5557
- * A plain object is defined as an object created by the `{}` literal,
5558
- * an object created with `Object.create(null)`, or an object with a
5559
- * prototype that resolves to `Object.prototype`.
5560
- *
5561
- * @param value - The value to check.
5562
- * @returns `true` if the value is a plain object, otherwise `false`.
5563
- *
5564
- * @example
5565
- * ```typescript
5566
- * isPlainObject({}); // true
5567
- * isPlainObject(Object.create(null)); // true
5568
- * isPlainObject(new Date()); // false
5569
- * isPlainObject(null); // false
5570
- * isPlainObject([]); // false
5571
- * ```
5572
- */
5573
- function isPlainObject(value) {
5574
- if (!isObject(value)) return false;
5575
- const prototype = Object.getPrototypeOf(value);
5576
- return prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null;
5577
- }
5578
- /**
5579
- * Reads a property from a union-typed object where the key may exist only on some members of the union.
5580
- *
5581
- * `K` is constrained to keys of the union's intersection, so any key present on at least one union
5582
- * member is accepted. The return type resolves to `T[K]` when `K` is a key of `T`, otherwise `undefined`
5583
- * — matching the runtime behavior of reading a missing property.
5584
- *
5585
- * @param obj - source object (may be a union of shapes)
5586
- * @param prop - property name, must be a key of at least one union member
5587
- * @returns the property value if present, otherwise `undefined`
5588
- */
5589
- function getField(obj, prop) {
5590
- return obj[prop];
5591
- }
5592
5566
  //#endregion
5593
5567
  //#region ../node_modules/.pnpm/@milaboratories+helpers@1.14.2/node_modules/@milaboratories/helpers/dist/error.js
5594
5568
  function throwError(v) {
@@ -5603,23 +5577,7 @@
5603
5577
  }
5604
5578
  createGetIncrementalId();
5605
5579
  //#endregion
5606
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/discovered_column.js
5607
- function distillDiscoveredPColumn(props) {
5608
- return {
5609
- column: props.column,
5610
- path: Array.isArray(props.path) && props.path.length > 0 ? props.path : void 0,
5611
- columnQualifications: Array.isArray(props.columnQualifications) && props.columnQualifications.length > 0 ? props.columnQualifications : void 0,
5612
- queriesQualifications: props.queriesQualifications && Object.keys(props.queriesQualifications).length > 0 ? props.queriesQualifications : void 0
5613
- };
5614
- }
5615
- function createDiscoveredPColumnId(props) {
5616
- return stringifyDiscoveredPColumnId(props);
5617
- }
5618
- function stringifyDiscoveredPColumnId(id) {
5619
- return canonicalizeJson(distillDiscoveredPColumn(id));
5620
- }
5621
- //#endregion
5622
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js
5580
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js
5623
5581
  var LinkerMap = class LinkerMap {
5624
5582
  /** Graph of linkers connected by axes (single or grouped by parents) */
5625
5583
  data;
@@ -5797,11 +5755,11 @@
5797
5755
  }
5798
5756
  };
5799
5757
  //#endregion
5800
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/driver.js
5758
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/driver.js
5801
5759
  function assert() {}
5802
5760
  assert();
5803
5761
  //#endregion
5804
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/flags/block_flags.js
5762
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/flags/block_flags.js
5805
5763
  /**
5806
5764
  * Required PFrames version. Bump this in lockstep with the `@milaboratories/pframes-rs-*`
5807
5765
  * version in `pnpm-workspace.yaml` so blocks built against the new SDK refuse to load on
@@ -5844,7 +5802,7 @@
5844
5802
  }
5845
5803
  }
5846
5804
  //#endregion
5847
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/value_or_error.js
5805
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/value_or_error.js
5848
5806
  function mapValueInVOE(voe, cb) {
5849
5807
  return voe.ok ? {
5850
5808
  ok: true,
@@ -5852,48 +5810,7 @@
5852
5810
  } : voe;
5853
5811
  }
5854
5812
  //#endregion
5855
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/resource_types.js
5856
- /** Well-known resource type names used across the platform. */
5857
- const ResourceTypeName = {
5858
- StreamManager: "StreamManager",
5859
- StdMap: "StdMap",
5860
- StdMapSlash: "std/map",
5861
- EphStdMap: "EphStdMap",
5862
- PFrame: "PFrame",
5863
- ParquetChunk: "ParquetChunk",
5864
- BContext: "BContext",
5865
- BlockPackCustom: "BlockPackCustom",
5866
- BinaryMap: "BinaryMap",
5867
- BinaryValue: "BinaryValue",
5868
- BlobMap: "BlobMap",
5869
- BResolveSingle: "BResolveSingle",
5870
- BResolveSingleNoResult: "BResolveSingleNoResult",
5871
- BQueryResult: "BQueryResult",
5872
- TengoTemplate: "TengoTemplate",
5873
- TengoLib: "TengoLib",
5874
- SoftwareInfo: "SoftwareInfo",
5875
- Dummy: "Dummy",
5876
- JsonResourceError: "json/resourceError",
5877
- JsonObject: "json/object",
5878
- JsonGzObject: "json-gz/object",
5879
- JsonString: "json/string",
5880
- JsonArray: "json/array",
5881
- JsonNumber: "json/number",
5882
- BContextEnd: "BContextEnd",
5883
- FrontendFromUrl: "Frontend/FromUrl",
5884
- FrontendFromFolder: "Frontend/FromFolder",
5885
- BObjectSpec: "BObjectSpec",
5886
- Blob: "Blob",
5887
- Null: "Null",
5888
- Binary: "binary",
5889
- LSProvider: "LSProvider",
5890
- WorkingDirectory: "WorkingDirectory",
5891
- UserProject: "UserProject",
5892
- Projects: "Projects",
5893
- ClientRoot: "ClientRoot"
5894
- };
5895
- //#endregion
5896
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/services/service_types.js
5813
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/services/service_types.js
5897
5814
  const SERVICE_ID_PATTERN = /^[a-zA-Z][a-zA-Z0-9]*$/;
5898
5815
  const { service, isNodeService, isWasmService, isMainService, getServiceKind, getServiceModelMethods, getServiceUiMethods } = (() => {
5899
5816
  const typeMap = /* @__PURE__ */ new Map();
@@ -5932,7 +5849,7 @@
5932
5849
  };
5933
5850
  })();
5934
5851
  //#endregion
5935
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/services/service_declarations.js
5852
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/services/service_declarations.js
5936
5853
  const Services = {
5937
5854
  PFrameSpec: service()({
5938
5855
  type: "wasm",
@@ -6001,7 +5918,7 @@
6001
5918
  }
6002
5919
  Object.fromEntries(Object.keys(Services).map((key) => [`requires${key}`, true]));
6003
5920
  //#endregion
6004
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/services/service_injectors.js
5921
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.42.0/node_modules/@milaboratories/pl-model-common/dist/services/service_injectors.js
6005
5922
  function buildMethodMap(pick) {
6006
5923
  const result = {};
6007
5924
  for (const id of Object.values(Services)) result[id] = [...pick(id)];
@@ -6010,7 +5927,7 @@
6010
5927
  buildMethodMap(getServiceUiMethods);
6011
5928
  buildMethodMap(getServiceModelMethods);
6012
5929
  //#endregion
6013
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/render/accessor.js
5930
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/render/accessor.js
6014
5931
  function ifDef(value, cb) {
6015
5932
  return value === void 0 ? void 0 : cb(value);
6016
5933
  }
@@ -6221,11 +6138,11 @@
6221
6138
  }
6222
6139
  };
6223
6140
  //#endregion
6224
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/render/internal.js
6141
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/render/internal.js
6225
6142
  const StagingAccessorName = "staging";
6226
6143
  const MainAccessorName = "main";
6227
6144
  //#endregion
6228
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/render/util/axis_filtering.js
6145
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/render/util/axis_filtering.js
6229
6146
  function filterDataInfoEntries(dataInfoEntries, axisFilters) {
6230
6147
  const sortedFilters = [...axisFilters].sort((a, b) => b[0] - a[0]);
6231
6148
  const { type } = dataInfoEntries;
@@ -6289,13 +6206,9 @@
6289
6206
  }
6290
6207
  }
6291
6208
  //#endregion
6292
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/function/flow.mjs
6293
- function flow(...funcs) {
6294
- return function(...args) {
6295
- let result = funcs.length ? funcs[0].apply(this, args) : args[0];
6296
- for (let i = 1; i < funcs.length; i++) result = funcs[i].call(this, result);
6297
- return result;
6298
- };
6209
+ //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/function/identity.mjs
6210
+ function identity(x) {
6211
+ return x;
6299
6212
  }
6300
6213
  //#endregion
6301
6214
  //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
@@ -6324,7 +6237,7 @@
6324
6237
  return x == null;
6325
6238
  }
6326
6239
  //#endregion
6327
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/labels/derive_distinct_labels.js
6240
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/labels/derive_distinct_labels.js
6328
6241
  const DISTANCE_PENALTY = .001;
6329
6242
  const LABEL_TYPE = "__LABEL__";
6330
6243
  const LABEL_TYPE_FULL = "__LABEL__@1";
@@ -6362,18 +6275,22 @@
6362
6275
  for (let i = 0; i < includedCount; ++i) currentSet.add(mainTypes[i]);
6363
6276
  if (additionalType >= 0) currentSet.add(mainTypes[additionalType]);
6364
6277
  const candidateResult = build(currentSet, false);
6365
- if (candidateResult !== void 0 && countUniqueLabels(candidateResult) === values.length) return build(minimizeTypeSet(currentSet, records, stats, forceTraceElements, forcedSet, separator), false) ?? throwError("Failed to derive unique labels");
6278
+ if (candidateResult !== void 0 && countUniqueLabels(candidateResult) === values.length) {
6279
+ const minimized = minimizeTypeSet(currentSet, records, stats, forceTraceElements, forcedSet, separator);
6280
+ return dropRedundantLinkerSuffix(records, minimized, forceTraceElements, forcedSet, separator, build(minimized, false) ?? throwError("Failed to derive unique labels"));
6281
+ }
6366
6282
  additionalType++;
6367
6283
  if (additionalType >= mainTypes.length) {
6368
6284
  includedCount++;
6369
6285
  additionalType = includedCount;
6370
6286
  }
6371
6287
  }
6372
- return build(minimizeTypeSet(new Set([
6288
+ const minimized = minimizeTypeSet(new Set([
6373
6289
  ...forcedSet,
6374
6290
  ...mainTypes,
6375
6291
  ...secondaryTypes
6376
- ]), records, stats, forceTraceElements, forcedSet, separator), true) ?? throwError("Failed to derive unique labels");
6292
+ ]), records, stats, forceTraceElements, forcedSet, separator);
6293
+ return dropRedundantLinkerSuffix(records, minimized, forceTraceElements, forcedSet, separator, build(minimized, true) ?? throwError("Failed to derive unique labels"));
6377
6294
  }
6378
6295
  function extractEntryParts(entry) {
6379
6296
  if (!("spec" in entry && typeof entry.spec === "object")) return {
@@ -6389,7 +6306,7 @@
6389
6306
  qualifications: entry.qualifications
6390
6307
  };
6391
6308
  }
6392
- function formatQualification$1(q) {
6309
+ function formatQualification(q) {
6393
6310
  const ctx = q.contextDomain ?? {};
6394
6311
  const keys = Object.keys(ctx);
6395
6312
  if (keys.length === 0) return q.axis.name;
@@ -6397,7 +6314,7 @@
6397
6314
  return Object.prototype.hasOwnProperty.call(ctx, q.axis.name) ? pairs : `${q.axis.name} ${pairs}`;
6398
6315
  }
6399
6316
  function formatQualifications(qs) {
6400
- return qs.map(formatQualification$1).join("; ");
6317
+ return qs.map(formatQualification).join("; ");
6401
6318
  }
6402
6319
  function computeStepLabel(step, stepIndex, formatters) {
6403
6320
  const base = (readAnnotation(step.spec, Annotation.LinkLabel) ?? readAnnotation(step.spec, Annotation.Label))?.trim();
@@ -6506,36 +6423,67 @@
6506
6423
  secondaryTypes
6507
6424
  };
6508
6425
  }
6426
+ function renderRecordLabel(record, includedTypes, forceTraceElements, separator) {
6427
+ const traceParts = [];
6428
+ const anchorParts = [];
6429
+ let linkerLabel;
6430
+ let hitLabel;
6431
+ for (const ft of record.fullTrace) {
6432
+ if (!(includedTypes.has(ft.fullType) || forceTraceElements?.has(ft.type))) continue;
6433
+ if (ft.type === LINKER_TYPE) linkerLabel = ft.label;
6434
+ else if (ft.type === HIT_QUAL_TYPE) hitLabel = ft.label;
6435
+ else if (isAnchorQualType(ft.type)) anchorParts.push(ft.label);
6436
+ else traceParts.push(ft.label);
6437
+ }
6438
+ if (traceParts.length === 0 && anchorParts.length === 0 && linkerLabel === void 0 && hitLabel === void 0) return void 0;
6439
+ let label = traceParts.join(separator);
6440
+ const append = (part) => {
6441
+ label = label.length === 0 ? part : `${label} ${part}`;
6442
+ };
6443
+ if (linkerLabel !== void 0) append(linkerLabel);
6444
+ for (const a of anchorParts) append(a);
6445
+ if (hitLabel !== void 0) append(hitLabel);
6446
+ return label;
6447
+ }
6509
6448
  function buildLabels(records, includedTypes, forceTraceElements, separator, force) {
6510
6449
  const result = [];
6511
6450
  for (const r of records) {
6512
- const traceParts = [];
6513
- const anchorParts = [];
6514
- let linkerLabel;
6515
- let hitLabel;
6516
- for (const ft of r.fullTrace) {
6517
- if (!(includedTypes.has(ft.fullType) || forceTraceElements?.has(ft.type))) continue;
6518
- if (ft.type === LINKER_TYPE) linkerLabel = ft.label;
6519
- else if (ft.type === HIT_QUAL_TYPE) hitLabel = ft.label;
6520
- else if (isAnchorQualType(ft.type)) anchorParts.push(ft.label);
6521
- else traceParts.push(ft.label);
6522
- }
6523
- if (traceParts.length === 0 && anchorParts.length === 0 && linkerLabel === void 0 && hitLabel === void 0) {
6451
+ const rendered = renderRecordLabel(r, includedTypes, forceTraceElements, separator);
6452
+ if (rendered === void 0) {
6524
6453
  if (!force) return void 0;
6525
6454
  result.push("Unlabeled");
6526
6455
  continue;
6527
6456
  }
6528
- let label = traceParts.join(separator);
6529
- const append = (part) => {
6530
- label = label.length === 0 ? part : `${label} ${part}`;
6531
- };
6532
- if (linkerLabel !== void 0) append(linkerLabel);
6533
- for (const a of anchorParts) append(a);
6534
- if (hitLabel !== void 0) append(hitLabel);
6535
- result.push(label);
6457
+ result.push(rendered);
6536
6458
  }
6537
6459
  return result;
6538
6460
  }
6461
+ /**
6462
+ * Drop the "via …" linker suffix from records whose label is already unique without it.
6463
+ *
6464
+ * Global minimization may include `LINKER_TYPE_FULL` solely to resolve a collision between a
6465
+ * subset of records — but `buildLabels` then renders the suffix on every record that carries a
6466
+ * linker trace entry, including ones whose stem is already unique. We strip the suffix where it
6467
+ * isn't load-bearing while keeping the symmetric rendering required by `linkerForced` /
6468
+ * `forceTraceElements`.
6469
+ *
6470
+ * Rule: a record's linker suffix is redundant iff its stem (label rendered without LINKER) does
6471
+ * not appear anywhere else in the set.
6472
+ */
6473
+ function dropRedundantLinkerSuffix(records, globalTypeSet, forceTraceElements, forcedSet, separator, labels) {
6474
+ if (!globalTypeSet.has(LINKER_TYPE_FULL)) return labels;
6475
+ if (forcedSet.has(LINKER_TYPE_FULL) || forceTraceElements?.has(LINKER_TYPE)) return labels;
6476
+ const setWithoutLinker = new Set(globalTypeSet);
6477
+ setWithoutLinker.delete(LINKER_TYPE_FULL);
6478
+ const stems = records.map((r) => renderRecordLabel(r, setWithoutLinker, forceTraceElements, separator));
6479
+ const stemOccurrences = /* @__PURE__ */ new Map();
6480
+ for (const s of stems) if (s !== void 0) stemOccurrences.set(s, (stemOccurrences.get(s) ?? 0) + 1);
6481
+ return labels.map((label, i) => {
6482
+ const stem = stems[i];
6483
+ if (stem === void 0) return label;
6484
+ return stemOccurrences.get(stem) === 1 ? stem : label;
6485
+ });
6486
+ }
6539
6487
  function countUniqueLabels(result) {
6540
6488
  if (result === void 0) return 0;
6541
6489
  return new Set(result).size;
@@ -6555,7 +6503,7 @@
6555
6503
  return result;
6556
6504
  }
6557
6505
  //#endregion
6558
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/render/util/label.js
6506
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/render/util/label.js
6559
6507
  /** @deprecated Use deriveDistinctLabels */
6560
6508
  function deriveLabels(values, getSpec, options = {}) {
6561
6509
  return deriveDistinctLabels(values.map(getSpec), options).map((label, i) => ({
@@ -6564,7 +6512,7 @@
6564
6512
  }));
6565
6513
  }
6566
6514
  //#endregion
6567
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/render/util/pcolumn_data.js
6515
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/render/util/pcolumn_data.js
6568
6516
  const PCD_PREFIX = "PColumnData/";
6569
6517
  const RT_RESOURCE_MAP = PCD_PREFIX + "ResourceMap";
6570
6518
  const RT_RESOURCE_MAP_PARTITIONED = PCD_PREFIX + "Partitioned/ResourceMap";
@@ -6864,7 +6812,7 @@
6864
6812
  return columns.every(isPColumnReady);
6865
6813
  }
6866
6814
  //#endregion
6867
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/render/util/column_collection.js
6815
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/render/util/column_collection.js
6868
6816
  function isPColumnValues(value) {
6869
6817
  if (!Array.isArray(value)) return false;
6870
6818
  if (value.length === 0) return true;
@@ -6874,7 +6822,7 @@
6874
6822
  /**
6875
6823
  * A simple implementation of {@link ColumnProvider} backed by a pre-defined array of columns.
6876
6824
  */
6877
- var ArrayColumnProvider$1 = class {
6825
+ var ArrayColumnProvider = class {
6878
6826
  constructor(columns) {
6879
6827
  this.columns = columns;
6880
6828
  }
@@ -6925,7 +6873,7 @@
6925
6873
  }
6926
6874
  var PColumnCollection = class {
6927
6875
  defaultProviderStore = [];
6928
- providers = [new ArrayColumnProvider$1(this.defaultProviderStore)];
6876
+ providers = [new ArrayColumnProvider(this.defaultProviderStore)];
6929
6877
  axisLabelProviders = [];
6930
6878
  constructor() {}
6931
6879
  addColumnProvider(provider) {
@@ -7139,7 +7087,7 @@
7139
7087
  }
7140
7088
  };
7141
7089
  //#endregion
7142
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/services/block_services.js
7090
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/services/block_services.js
7143
7091
  /**
7144
7092
  * Services required by all V3 blocks by default.
7145
7093
  * Edit this when a new service should be available to all blocks.
@@ -7154,7 +7102,7 @@
7154
7102
  };
7155
7103
  resolveRequiredServices(BLOCK_SERVICE_FLAGS);
7156
7104
  //#endregion
7157
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/services/service_bridge.js
7105
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/services/service_bridge.js
7158
7106
  /**
7159
7107
  * Builds a ServiceProxy from a ServiceDispatch.
7160
7108
  * Each service method call is forwarded to dispatch.callServiceMethod.
@@ -7163,7 +7111,7 @@
7163
7111
  return ((serviceId) => Object.freeze(Object.fromEntries(dispatch.getServiceMethods(serviceId).map((method) => [method, (...args) => dispatch.callServiceMethod(serviceId, method, ...args)]))));
7164
7112
  }
7165
7113
  //#endregion
7166
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/services/get_services.js
7114
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/services/get_services.js
7167
7115
  const cachedServices = /* @__PURE__ */ new WeakMap();
7168
7116
  function getService(name) {
7169
7117
  const ctx = getCfgRenderCtx();
@@ -7177,7 +7125,7 @@
7177
7125
  })();
7178
7126
  }
7179
7127
  //#endregion
7180
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/render/util/pframe_upgraders.js
7128
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/render/util/pframe_upgraders.js
7181
7129
  function patchInSetFilters(filters) {
7182
7130
  const inSetToOrEqual = (predicate) => {
7183
7131
  if (predicate.operator !== "InSet") return predicate;
@@ -7215,7 +7163,7 @@
7215
7163
  return filters.map((filter) => mapFilter(filter, inSetToOrEqual));
7216
7164
  }
7217
7165
  //#endregion
7218
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/render/api.js
7166
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/render/api.js
7219
7167
  /**
7220
7168
  * Helper function to match domain objects
7221
7169
  * @param query Optional domain to match against
@@ -7666,26 +7614,26 @@
7666
7614
  }
7667
7615
  };
7668
7616
  //#endregion
7669
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/version.js
7670
- const PlatformaSDKVersion = "1.75.5";
7617
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/version.js
7618
+ const PlatformaSDKVersion = "1.77.0";
7671
7619
  //#endregion
7672
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/bconfig/types.js
7620
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/bconfig/types.js
7673
7621
  function isConfigLambda(cfgOrFh) {
7674
7622
  return cfgOrFh.__renderLambda === true;
7675
7623
  }
7676
7624
  //#endregion
7677
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/bconfig/normalization.js
7625
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/bconfig/normalization.js
7678
7626
  function downgradeCfgOrLambda(data) {
7679
7627
  if (data === void 0) return void 0;
7680
7628
  if (isConfigLambda(data)) return data.handle;
7681
7629
  return data;
7682
7630
  }
7683
7631
  //#endregion
7684
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/plugin_model.js
7632
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/plugin_model.js
7685
7633
  /** Symbol for internal plugin model creation — not accessible to external consumers */
7686
7634
  const CREATE_PLUGIN_MODEL = Symbol("createPluginModel");
7687
7635
  //#endregion
7688
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/block_storage_callbacks.js
7636
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/block_storage_callbacks.js
7689
7637
  /**
7690
7638
  * BlockStorage Callback Implementations - wired to facade callbacks in BlockModelV3.done().
7691
7639
  *
@@ -7862,7 +7810,7 @@
7862
7810
  }
7863
7811
  }
7864
7812
  //#endregion
7865
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/block_model.js
7813
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/block_model.js
7866
7814
  /**
7867
7815
  * Merges two feature flag objects with type-aware logic:
7868
7816
  * - `supports*` (boolean): OR — `true` if either side is `true`
@@ -8124,13 +8072,12 @@
8124
8072
  const wrappedInputs = {};
8125
8073
  for (const [paramKey, paramFn] of Object.entries(inputs)) wrappedInputs[paramKey] = () => paramFn(new BlockRenderCtx());
8126
8074
  const outputs = model.outputs;
8127
- const { outputFlags } = model;
8128
8075
  for (const [outputKey, outputFn] of Object.entries(outputs)) {
8129
8076
  const key = pluginOutputKey(handle, outputKey);
8130
8077
  pluginOutputs[key] = createAndRegisterRenderLambda({
8131
8078
  handle: key,
8132
8079
  lambda: () => outputFn(new PluginRenderCtx(handle, wrappedInputs)),
8133
- withStatus: outputFlags[outputKey]?.withStatus
8080
+ withStatus: true
8134
8081
  });
8135
8082
  }
8136
8083
  }
@@ -8167,13 +8114,14 @@
8167
8114
  blockModelInfo: {
8168
8115
  outputs: Object.fromEntries(Object.entries(allOutputs).map(([key, value]) => [key, { withStatus: Boolean(isConfigLambda(value) && value.withStatus) }])),
8169
8116
  pluginIds: pluginHandles,
8170
- featureFlags: this.config.featureFlags
8117
+ featureFlags: this.config.featureFlags,
8118
+ pluginPublicOutputs: Object.fromEntries(pluginHandles.map((handle) => [handle, plugins[handle].model.publicOutputDef]))
8171
8119
  }
8172
8120
  };
8173
8121
  }
8174
8122
  };
8175
8123
  //#endregion
8176
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/pframe_utils/axes.js
8124
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/pframe_utils/axes.js
8177
8125
  /** Create id for column copy with added keys in axes domains */
8178
8126
  const colId = (id, domains, contextDomains) => {
8179
8127
  let wid = id.toString();
@@ -8279,7 +8227,7 @@
8279
8227
  })];
8280
8228
  }
8281
8229
  //#endregion
8282
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/pframe_utils/columns.js
8230
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/pframe_utils/columns.js
8283
8231
  function getAllRelatedColumns(ctx, predicate) {
8284
8232
  const columns = new PColumnCollection();
8285
8233
  columns.addColumnProvider(ctx.resultPool);
@@ -8337,7 +8285,7 @@
8337
8285
  return enrichCompatible(blockAxes, [...compatibleWithoutLabels, ...compatibleLabels]);
8338
8286
  }
8339
8287
  //#endregion
8340
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/components/PFrameForGraphs.js
8288
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/components/PFrameForGraphs.js
8341
8289
  function isHiddenFromGraphColumn(column) {
8342
8290
  return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);
8343
8291
  }
@@ -8365,474 +8313,7 @@
8365
8313
  }));
8366
8314
  }
8367
8315
  //#endregion
8368
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/columns/column_selector.js
8369
- function normalizeStringMatchers(input) {
8370
- if (typeof input === "string") return [{
8371
- type: "regex",
8372
- value: input
8373
- }];
8374
- if (!Array.isArray(input)) return [input];
8375
- return input.map((v) => typeof v === "string" ? {
8376
- type: "regex",
8377
- value: v
8378
- } : v);
8379
- }
8380
- function normalizeRecord(input) {
8381
- const result = {};
8382
- for (const [key, value] of Object.entries(input)) result[key] = normalizeStringMatchers(value);
8383
- return result;
8384
- }
8385
- function normalizeTypes(input) {
8386
- return Array.isArray(input) ? input : [input];
8387
- }
8388
- function convertRelaxedAxisSelectorToMultiAxisSelector(input) {
8389
- const result = {};
8390
- if (input.name !== void 0) result.name = normalizeStringMatchers(input.name);
8391
- if (input.type !== void 0) result.type = normalizeTypes(input.type);
8392
- if (input.domain !== void 0) result.domain = normalizeRecord(input.domain);
8393
- if (input.contextDomain !== void 0) result.contextDomain = normalizeRecord(input.contextDomain);
8394
- if (input.annotations !== void 0) result.annotations = normalizeRecord(input.annotations);
8395
- return result;
8396
- }
8397
- function convertRelaxedColumnSelectorToMultiColumnSelector(input) {
8398
- const result = {};
8399
- if (input.name !== void 0) result.name = normalizeStringMatchers(input.name);
8400
- if (input.type !== void 0) result.type = normalizeTypes(input.type);
8401
- if (input.domain !== void 0) result.domain = normalizeRecord(input.domain);
8402
- if (input.contextDomain !== void 0) result.contextDomain = normalizeRecord(input.contextDomain);
8403
- if (input.annotations !== void 0) result.annotations = normalizeRecord(input.annotations);
8404
- if (input.axes !== void 0) result.axes = input.axes.map(convertRelaxedAxisSelectorToMultiAxisSelector);
8405
- if (input.partialAxesMatch !== void 0) result.partialAxesMatch = input.partialAxesMatch;
8406
- return result;
8407
- }
8408
- function convertColumnSelectorToMultiColumnSelector(input) {
8409
- return (Array.isArray(input) ? input : [input]).map(convertRelaxedColumnSelectorToMultiColumnSelector);
8410
- }
8411
- //#endregion
8412
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/columns/column_snapshot_provider.js
8413
- /**
8414
- * Simple provider wrapping an array of PColumns.
8415
- * Always complete, data status always 'ready'.
8416
- */
8417
- var ArrayColumnProvider = class {
8418
- columns;
8419
- constructor(columns) {
8420
- this.columns = columns.map((col) => ({
8421
- id: col.id,
8422
- spec: col.spec,
8423
- data: { get: () => col.data },
8424
- dataStatus: this.getStatus(col.data)
8425
- }));
8426
- }
8427
- getAllColumns() {
8428
- return this.columns;
8429
- }
8430
- isColumnListComplete() {
8431
- return true;
8432
- }
8433
- getStatus(d) {
8434
- if (d == null) return "absent";
8435
- if (typeof d === "function") return this.getStatus(d());
8436
- if (d instanceof TreeNodeAccessor) {
8437
- if (d.getIsReadyOrError()) return "ready";
8438
- if (d.getIsFinal()) return "absent";
8439
- return "computing";
8440
- }
8441
- if (isDataInfo(d)) {
8442
- let ready = true;
8443
- let final = true;
8444
- visitDataInfo(d, (v) => {
8445
- ready &&= v.getIsReadyOrError();
8446
- final &&= v.getIsFinal();
8447
- });
8448
- if (ready) return "ready";
8449
- if (final) return "absent";
8450
- return "computing";
8451
- }
8452
- return "ready";
8453
- }
8454
- };
8455
- /**
8456
- * Provider wrapping an array of ColumnSnapshots.
8457
- * Always complete. Data status taken from each snapshot.
8458
- */
8459
- var SnapshotColumnProvider = class {
8460
- constructor(snapshots) {
8461
- this.snapshots = snapshots;
8462
- }
8463
- getAllColumns() {
8464
- return this.snapshots;
8465
- }
8466
- isColumnListComplete() {
8467
- return true;
8468
- }
8469
- };
8470
- /**
8471
- * Provider wrapping a TreeNodeAccessor (output/prerun resolve result).
8472
- * Detects data status from accessor readiness state.
8473
- */
8474
- var OutputColumnProvider = class {
8475
- constructor(accessor, opts) {
8476
- this.accessor = accessor;
8477
- this.opts = opts;
8478
- }
8479
- getAllColumns() {
8480
- return this.getColumns();
8481
- }
8482
- isColumnListComplete() {
8483
- return this.accessor.getInputsLocked();
8484
- }
8485
- getColumns() {
8486
- const pColumns = this.accessor.getPColumns();
8487
- if (pColumns === void 0) return [];
8488
- const isFinal = this.accessor.getIsFinal();
8489
- const allowAbsence = this.opts?.allowPermanentAbsence === true;
8490
- return pColumns.map((col) => {
8491
- const dataAccessor = col.data;
8492
- const isReady = dataAccessor.getIsReadyOrError();
8493
- let dataStatus;
8494
- if (isReady) dataStatus = "ready";
8495
- else if (allowAbsence && isFinal) dataStatus = "absent";
8496
- else dataStatus = "computing";
8497
- return {
8498
- id: col.id,
8499
- spec: col.spec,
8500
- dataStatus,
8501
- data: { get: () => isReady ? dataAccessor : void 0 }
8502
- };
8503
- });
8504
- }
8505
- };
8506
- /** Checks if a value is a ColumnSnapshotProvider (duck-typing). */
8507
- function isColumnSnapshotProvider(source) {
8508
- return typeof source === "object" && source !== null && "getAllColumns" in source && "isColumnListComplete" in source && typeof source.getAllColumns === "function" && typeof source.isColumnListComplete === "function";
8509
- }
8510
- /** Checks if a value looks like a PColumn (has id, spec, data). */
8511
- function isPColumnArray(source) {
8512
- if (!Array.isArray(source)) return false;
8513
- if (source.length === 0) return true;
8514
- const first = source[0];
8515
- return "id" in first && "spec" in first && "data" in first && !("dataStatus" in first);
8516
- }
8517
- /** Checks if a value looks like a ColumnSnapshot array. */
8518
- function isColumnSnapshotArray(source) {
8519
- if (!Array.isArray(source)) return false;
8520
- if (source.length === 0) return true;
8521
- const first = source[0];
8522
- return "id" in first && "spec" in first && "dataStatus" in first;
8523
- }
8524
- /**
8525
- * Normalize any ColumnSource into a ColumnSnapshotProvider.
8526
- * - ColumnSnapshotProvider → returned as-is
8527
- * - ColumnSnapshot<PObjectId>[] → wrapped in SnapshotColumnProvider
8528
- * - PColumn[] → wrapped in ArrayColumnProvider
8529
- */
8530
- function toColumnSnapshotProvider(source) {
8531
- if (isColumnSnapshotProvider(source)) return source;
8532
- if (isColumnSnapshotArray(source)) return new SnapshotColumnProvider(source);
8533
- if (isPColumnArray(source)) return new ArrayColumnProvider(source);
8534
- throw new Error("Unknown ColumnSource type");
8535
- }
8536
- //#endregion
8537
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/columns/column_collection_builder.js
8538
- /**
8539
- * Mutable builder that accumulates column sources, then produces
8540
- * a ColumnCollection (plain) or AnchoredColumnCollection (with anchors).
8541
- *
8542
- * Each output lambda creates its own builder — a constraint of the
8543
- * computable framework where each output tracks its own dependencies.
8544
- */
8545
- var ColumnCollectionBuilder = class {
8546
- providers = [];
8547
- constructor(specDriver = getService("pframeSpec")) {
8548
- this.specDriver = specDriver;
8549
- }
8550
- /**
8551
- * Register a column source. Sources added first take precedence for dedup.
8552
- * Does NOT accept undefined — if a source isn't available yet,
8553
- * the caller should return undefined from the output lambda.
8554
- */
8555
- addSource(source) {
8556
- if (source instanceof TreeNodeAccessor) {
8557
- const columns = source.getPColumns();
8558
- if (columns) this.providers.push(new ArrayColumnProvider(columns));
8559
- } else this.providers.push(toColumnSnapshotProvider(source));
8560
- return this;
8561
- }
8562
- addSources(sources) {
8563
- for (const source of sources) this.addSource(source);
8564
- return this;
8565
- }
8566
- build(options) {
8567
- const allowPartial = options?.allowPartialColumnList === true;
8568
- if (!this.providers.every((p) => p.isColumnListComplete()) && !allowPartial) return void 0;
8569
- const columns = collectColumns(this.providers);
8570
- if (options !== void 0 && "anchors" in options) return new AnchoredColumnCollectionImpl(this.specDriver, {
8571
- anchors: options.anchors,
8572
- columns
8573
- });
8574
- else return new ColumnCollectionImpl(this.specDriver, { columns });
8575
- }
8576
- };
8577
- var ColumnCollectionImpl = class {
8578
- columns;
8579
- specFrameEntry;
8580
- constructor(specDriver, options) {
8581
- this.specDriver = specDriver;
8582
- this.columns = new Map(options.columns.map((col) => [col.id, col]));
8583
- this.specFrameEntry = this.specDriver.createSpecFrame(Object.fromEntries(options.columns.map((col) => [col.id, col.spec])));
8584
- }
8585
- dispose() {
8586
- this.specFrameEntry.unref();
8587
- }
8588
- [Symbol.dispose]() {
8589
- this.dispose();
8590
- }
8591
- findColumns(options) {
8592
- const includeColumns = options?.include ? toMultiColumnSelectors(options.include) : void 0;
8593
- const excludeColumns = options?.exclude ? toMultiColumnSelectors(options.exclude) : void 0;
8594
- return this.specDriver.discoverColumns(this.specFrameEntry.key, {
8595
- includeColumns,
8596
- excludeColumns,
8597
- axes: [],
8598
- maxHops: 0,
8599
- constraints: matchingModeToConstraints("enrichment")
8600
- }).hits.map((hit) => this.columns.get(hit.hit.columnId)).filter((col) => col !== void 0);
8601
- }
8602
- };
8603
- var AnchoredColumnCollectionImpl = class {
8604
- anchorsMap;
8605
- columnsMap;
8606
- specFrameEntry;
8607
- constructor(specDriver, options) {
8608
- this.specDriver = specDriver;
8609
- this.specFrameEntry = this.specDriver.createSpecFrame(Object.fromEntries(options.columns.map((col) => [col.id, col.spec])));
8610
- this.columnsMap = new Map(options.columns.map((col) => [col.id, col]));
8611
- this.anchorsMap = resolveAnchorMap(options.anchors, options.columns, this.specDriver.discoverColumns.bind(this.specDriver, this.specFrameEntry.key));
8612
- }
8613
- dispose() {
8614
- this.specFrameEntry.unref();
8615
- }
8616
- [Symbol.dispose]() {
8617
- this.dispose();
8618
- }
8619
- getAnchors() {
8620
- return this.anchorsMap;
8621
- }
8622
- findColumns(options) {
8623
- const constraints = matchingModeToConstraints(options?.mode ?? "enrichment");
8624
- const includeColumns = options?.include ? toMultiColumnSelectors(options.include) : void 0;
8625
- const excludeColumns = options?.exclude ? toMultiColumnSelectors(options.exclude) : void 0;
8626
- const anchors = Array.from(this.anchorsMap.values());
8627
- const byColumn = this.specDriver.discoverColumns(this.specFrameEntry.key, {
8628
- includeColumns,
8629
- excludeColumns,
8630
- constraints,
8631
- maxHops: options?.maxHops ?? 4,
8632
- axes: anchors.map((anchor) => ({
8633
- axesSpec: anchor.spec.axesSpec,
8634
- qualifications: []
8635
- }))
8636
- }).hits.reduce((acc, hit) => {
8637
- const origId = hit.hit.columnId;
8638
- const col = this.columnsMap.get(origId) ?? throwError(`Column with id ${origId} not found in collection`);
8639
- const path = hit.path.map((step) => {
8640
- if (step.type !== "linker") throw new Error(`Unexpected discover-columns step type: ${step.type}`);
8641
- return { linker: this.columnsMap.get(step.linker.columnId) ?? throwError(`Linker column with id ${step.linker.columnId} not found in collection`) };
8642
- });
8643
- const variants = hit.mappingVariants.map((v) => ({
8644
- path,
8645
- qualifications: remapFromIdxToId(v.qualifications, anchors)
8646
- }));
8647
- const existing = acc.get(origId);
8648
- return acc.set(origId, existing === void 0 ? {
8649
- column: col,
8650
- variants
8651
- } : {
8652
- ...existing,
8653
- variants: [...existing.variants, ...variants]
8654
- });
8655
- }, /* @__PURE__ */ new Map());
8656
- return Array.from(byColumn.values());
8657
- }
8658
- findColumnVariants(options) {
8659
- return this.findColumns(options).flatMap((match) => match.variants.map((variant) => ({
8660
- column: match.column,
8661
- path: variant.path,
8662
- qualifications: variant.qualifications
8663
- })));
8664
- }
8665
- };
8666
- /**
8667
- * Collect all columns from all providers, dedup by NativePObjectId.
8668
- * First source wins.
8669
- */
8670
- function collectColumns(providers) {
8671
- const seen = /* @__PURE__ */ new Set();
8672
- const result = [];
8673
- for (const provider of providers) {
8674
- const columns = provider.getAllColumns();
8675
- for (const col of columns) {
8676
- const nativeId = deriveNativeId(col.spec);
8677
- if (seen.has(nativeId)) continue;
8678
- seen.add(nativeId);
8679
- result.push(col);
8680
- }
8681
- }
8682
- return result;
8683
- }
8684
- /** Normalize ColumnSelector (relaxed, single or array) to MultiColumnSelector[]. */
8685
- function toMultiColumnSelectors(input) {
8686
- return convertColumnSelectorToMultiColumnSelector(input);
8687
- }
8688
- /**
8689
- * Resolve each anchor entry to a ColumnSnapshot from the collected columns.
8690
- * - PObjectId (string): looked up by id in the collected columns
8691
- * - PColumnSpec: matched by deriveNativeId against collected columns
8692
- * - RelaxedColumnSelector: resolved via discoverColumns in "exact" mode;
8693
- * must match exactly one column
8694
- * Throws on unresolved, ambiguous, or duplicated matches. Requires at least one
8695
- * anchor to resolve.
8696
- */
8697
- function resolveAnchorMap(anchors, columns, discoverColumns) {
8698
- const result = /* @__PURE__ */ new Map();
8699
- const resovedIds = /* @__PURE__ */ new Set();
8700
- const getDuplicateError = (key) => `Anchor "${key}": selector matched a column that was already matched by another anchor; please refine the selector to match a different column`;
8701
- for (const [name, anchor] of Object.entries(anchors)) if (typeof anchor === "string") {
8702
- const found = columns.find((col) => col.id === anchor) ?? throwError(`Anchor "${name}": column with id "${anchor}" not found in sources`);
8703
- if (resovedIds.has(found.id)) throwError(getDuplicateError(name));
8704
- result.set(name, found);
8705
- resovedIds.add(found.id);
8706
- } else if ("kind" in anchor) {
8707
- if (!isPColumnSpec(anchor)) throwError(`Anchor "${name}": invalid PColumnSpec`);
8708
- const nativeId = deriveNativeId(anchor);
8709
- const found = columns.find((col) => deriveNativeId(col.spec) === nativeId) ?? throwError(`Anchor "${name}": no column matching spec found in sources`);
8710
- if (resovedIds.has(found.id)) throwError(getDuplicateError(name));
8711
- result.set(name, found);
8712
- resovedIds.add(found.id);
8713
- } else {
8714
- const matched = discoverColumns({
8715
- includeColumns: toMultiColumnSelectors(anchor),
8716
- excludeColumns: void 0,
8717
- axes: [],
8718
- maxHops: 0,
8719
- constraints: matchingModeToConstraints("related")
8720
- });
8721
- if (matched.hits.length === 0) throwError(`Anchor "${name}": no columns matched selector`);
8722
- if (matched.hits.length > 1) throwError(`Anchor "${name}": selector is ambiguous and matched multiple columns; please refine the selector to match exactly one column`);
8723
- if (resovedIds.has(matched.hits[0].hit.columnId)) throwError(getDuplicateError(name));
8724
- const id = matched.hits[0].hit.columnId;
8725
- const snap = columns.find((col) => col.id === id) ?? throwError(`Anchor "${name}": matched column with id "${id}" not found in sources`);
8726
- result.set(name, snap);
8727
- resovedIds.add(snap.id);
8728
- }
8729
- if (resovedIds.size === 0) throwError("At least one anchor must be resolved to a valid column");
8730
- return result;
8731
- }
8732
- function remapFromIdxToId(qualifications, anchors) {
8733
- const forQueries = qualifications.forQueries.reduce((acc, qs, i) => anchors[i] && qs.length > 0 ? acc.set(anchors[i].id, qs) : acc, /* @__PURE__ */ new Map());
8734
- return {
8735
- forQueries: forQueries.size > 0 ? Object.fromEntries(forQueries) : void 0,
8736
- forHit: qualifications.forHit.length > 0 ? qualifications.forHit : void 0
8737
- };
8738
- }
8739
- function matchingModeToConstraints(mode) {
8740
- switch (mode) {
8741
- case "enrichment": return {
8742
- allowFloatingSourceAxes: true,
8743
- allowFloatingHitAxes: false,
8744
- allowSourceQualifications: true,
8745
- allowHitQualifications: true
8746
- };
8747
- case "related": return {
8748
- allowFloatingSourceAxes: true,
8749
- allowFloatingHitAxes: true,
8750
- allowSourceQualifications: true,
8751
- allowHitQualifications: true
8752
- };
8753
- case "exact": return {
8754
- allowFloatingSourceAxes: false,
8755
- allowFloatingHitAxes: false,
8756
- allowSourceQualifications: false,
8757
- allowHitQualifications: false
8758
- };
8759
- }
8760
- }
8761
- //#endregion
8762
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/columns/ctx_column_sources.js
8763
- /**
8764
- * Collect ColumnSnapshotProviders from `outputs`, `prerun`, and
8765
- * `resultPool` in that order. Dedup keeps the first occurrence per
8766
- * `NativePObjectId`, so a block re-publishing its own columns keeps
8767
- * the `outputs`-rooted canonical id instead of the result-pool variant.
8768
- */
8769
- function collectCtxColumnSnapshotProviders(ctx) {
8770
- const providers = [];
8771
- const outputs = ctx.outputs;
8772
- if (outputs) providers.push(...collectPFrameProviders(outputs));
8773
- const prerun = ctx.prerun;
8774
- if (prerun) providers.push(...collectPFrameProviders(prerun));
8775
- providers.push(new ResultPoolColumnSnapshotProvider(ctx.resultPool));
8776
- return providers;
8777
- }
8778
- /**
8779
- * Adapter wrapping ResultPool into the new ColumnSnapshotProvider interface.
8780
- *
8781
- * - `isColumnListComplete()` always returns true — the result pool
8782
- * is a stable snapshot within a single render cycle.
8783
- * - Data status is derived from the underlying TreeNodeAccessor:
8784
- * ready (getIsReadyOrError), computing, or absent (no data resource).
8785
- */
8786
- var ResultPoolColumnSnapshotProvider = class {
8787
- constructor(pool) {
8788
- this.pool = pool;
8789
- }
8790
- getAllColumns() {
8791
- return this.pool.selectColumns(() => true).map((col) => toSnapshot(col.id, col.spec, col.data));
8792
- }
8793
- isColumnListComplete() {
8794
- return true;
8795
- }
8796
- };
8797
- function toSnapshot(id, spec, accessor) {
8798
- if (accessor === void 0) return {
8799
- id,
8800
- spec,
8801
- dataStatus: "absent",
8802
- data: void 0
8803
- };
8804
- const isReady = accessor.getIsReadyOrError();
8805
- return {
8806
- id,
8807
- spec,
8808
- dataStatus: isReady ? "ready" : "computing",
8809
- data: { get: () => isReady ? accessor : void 0 }
8810
- };
8811
- }
8812
- /**
8813
- * Recursively walk the output tree starting from `accessor`.
8814
- * - If a node's resourceType is PFrame → wrap it as OutputColumnProvider.
8815
- * - If a node's resourceType is StdMap/std/map → recurse into its output fields.
8816
- * - Otherwise → skip (leaf of unknown type).
8817
- */
8818
- function collectPFrameProviders(accessor) {
8819
- const out = [];
8820
- walkTree(accessor, out);
8821
- return out;
8822
- }
8823
- function walkTree(node, out) {
8824
- const typeName = node.resourceType.name;
8825
- if (typeName === ResourceTypeName.PFrame) {
8826
- out.push(new OutputColumnProvider(node));
8827
- return;
8828
- }
8829
- if (typeName === ResourceTypeName.StdMap || typeName === ResourceTypeName.StdMapSlash) for (const field of node.listInputFields()) {
8830
- const child = node.resolve(field);
8831
- if (child) walkTree(child, out);
8832
- }
8833
- }
8834
- //#endregion
8835
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/filters/traverse.js
8316
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/filters/traverse.js
8836
8317
  /**
8837
8318
  * Recursively traverses a FilterSpec tree bottom-up, applying visitor callbacks.
8838
8319
  *
@@ -8871,7 +8352,7 @@
8871
8352
  });
8872
8353
  }
8873
8354
  //#endregion
8874
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/filters/converters/filterToQuery.js
8355
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/filters/converters/filterToQuery.js
8875
8356
  /** Parses a CanonicalizedJson<PTableColumnId> string into a SpecQueryExpression reference. */
8876
8357
  function resolveColumnRef(columnStr) {
8877
8358
  const parsed = JSON.parse(columnStr);
@@ -9112,15 +8593,14 @@
9112
8593
  case "inSet": return {
9113
8594
  type: "isIn",
9114
8595
  input: resolveColumnRef(filter.column),
9115
- set: filter.value
8596
+ set: filter.value,
8597
+ negate: false
9116
8598
  };
9117
8599
  case "notInSet": return {
9118
- type: "not",
9119
- input: {
9120
- type: "isIn",
9121
- input: resolveColumnRef(filter.column),
9122
- set: filter.value
9123
- }
8600
+ type: "isIn",
8601
+ input: resolveColumnRef(filter.column),
8602
+ set: filter.value,
8603
+ negate: true
9124
8604
  };
9125
8605
  case "isNA": return {
9126
8606
  type: "isNull",
@@ -9134,7 +8614,7 @@
9134
8614
  }
9135
8615
  };
9136
8616
  case "ifNa": return {
9137
- type: "ifNull",
8617
+ type: "fillNull",
9138
8618
  input: resolveColumnRef(filter.column),
9139
8619
  replacement: {
9140
8620
  type: "constant",
@@ -9185,7 +8665,7 @@
9185
8665
  return true;
9186
8666
  }
9187
8667
  //#endregion
9188
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/filters/distill.js
8668
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/filters/distill.js
9189
8669
  /**
9190
8670
  * Strips non-FilterSpec metadata (whitelist approach) and removes
9191
8671
  * unfilled leaves (type is undefined or any required field is undefined).
@@ -9290,7 +8770,7 @@
9290
8770
  greaterThanColumnOrEqual: ["column", "rhs"]
9291
8771
  };
9292
8772
  //#endregion
9293
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/components/PlDataTable/state-migration.js
8773
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/components/PlDataTable/state-migration.js
9294
8774
  /** Upgrade PlDataTableStateV2 to the latest version */
9295
8775
  function upgradePlDataTableStateV2(state) {
9296
8776
  if (!state) return createPlDataTableStateV2();
@@ -9306,6 +8786,7 @@
9306
8786
  if (state.version === 3) state = createPlDataTableStateV2();
9307
8787
  if (state.version === 4) state = migrateV4toV6(state);
9308
8788
  if (state.version === 5) state = migrateV5toV6(state);
8789
+ if (state.version === 6) state = migrateV6toV7(state);
9309
8790
  return state;
9310
8791
  }
9311
8792
  /** Migrate v5 to v6: unwrap `{source, labeled}` colIds in gridState. */
@@ -9337,6 +8818,36 @@
9337
8818
  columnVisibility: gridState.columnVisibility ? { hiddenColIds: gridState.columnVisibility.hiddenColIds.map(unwrapAs) } : void 0
9338
8819
  };
9339
8820
  }
8821
+ /** Migrate v6 to v7: rewrite each colId from a full PTableColumnSpec to its
8822
+ * compact PTableColumnId (drops annotations/spec body, ~16× smaller per column). */
8823
+ function migrateV6toV7(state) {
8824
+ return {
8825
+ version: 7,
8826
+ stateCache: state.stateCache.map((entry) => ({
8827
+ ...entry,
8828
+ gridState: shrinkV6GridState(entry.gridState)
8829
+ })),
8830
+ pTableParams: state.pTableParams
8831
+ };
8832
+ }
8833
+ /** Convert a v6 fat colId (canonicalized PTableColumnSpec) to a v7 compact colId
8834
+ * (canonicalized PTableColumnId). The row-number sentinel is a string literal,
8835
+ * not a spec — pass it through unchanged. */
8836
+ function shrinkV6ColId(json) {
8837
+ const parsed = parseJsonSafely(json);
8838
+ if (!isNil(parsed) && typeof parsed === "object" && "type" in parsed && "id" in parsed) return canonicalizeJson(getPTableColumnId(parsed));
8839
+ return json;
8840
+ }
8841
+ function shrinkV6GridState(gridState) {
8842
+ return {
8843
+ columnOrder: gridState.columnOrder ? { orderedColIds: gridState.columnOrder.orderedColIds.map(shrinkV6ColId) } : void 0,
8844
+ sort: gridState.sort ? { sortModel: gridState.sort.sortModel.map((s) => ({
8845
+ colId: shrinkV6ColId(s.colId),
8846
+ sort: s.sort
8847
+ })) } : void 0,
8848
+ columnVisibility: gridState.columnVisibility ? { hiddenColIds: gridState.columnVisibility.hiddenColIds.map(shrinkV6ColId) } : void 0
8849
+ };
8850
+ }
9340
8851
  /** Migrate v4 state to v6: convert per-column filters to tree-based format (skips v5). */
9341
8852
  function migrateV4toV6(state) {
9342
8853
  let idCounter = 0;
@@ -9514,292 +9025,73 @@
9514
9025
  }
9515
9026
  function createPlDataTableStateV2() {
9516
9027
  return {
9517
- version: 6,
9028
+ version: 7,
9518
9029
  stateCache: [],
9519
9030
  pTableParams: createDefaultPTableParams()
9520
9031
  };
9521
9032
  }
9522
9033
  //#endregion
9523
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/labels/derive_distinct_tooltips.js
9524
- /** Format tooltip strings for each entry. Returns `undefined` when nothing useful. */
9525
- function deriveDistinctTooltips(entries) {
9526
- return entries.map(formatTooltip);
9527
- }
9528
- function formatTooltip(entry) {
9529
- const sections = [];
9530
- const header = formatHeader(entry);
9531
- if (header !== void 0) sections.push(header);
9532
- const origin = formatOriginPath(entry);
9533
- if (origin !== void 0) sections.push(origin);
9534
- const anchors = formatAnchors(entry.qualifications);
9535
- if (anchors !== void 0) sections.push(anchors);
9536
- const hit = formatHit(entry.qualifications);
9537
- if (hit !== void 0) sections.push(hit);
9538
- if (sections.length <= 1) return void 0;
9539
- return sections.join("\n\n");
9540
- }
9541
- const BULLET_1 = " • ";
9542
- function formatHeader(entry) {
9543
- const lines = [];
9544
- if (entry.variantCount !== void 0 && entry.variantCount > 1) lines.push(`Variant: ${entry.variantIndex ?? "?"} of ${entry.variantCount}`);
9545
- return lines.join("\n");
9546
- }
9547
- function formatOriginPath(entry) {
9548
- const path = entry.linkerPath ?? [];
9549
- if (path.length === 0) return void 0;
9550
- const lines = ["Origin path"];
9551
- path.forEach((step, i) => {
9552
- const label = readAnnotation(step.linker.spec, Annotation.LinkLabel) ?? readAnnotation(step.linker.spec, Annotation.Label) ?? step.linker.spec.name;
9553
- lines.push(`${BULLET_1}linker ${i + 1}: ${label}`);
9554
- });
9555
- const hitName = readAnnotation(entry.spec, Annotation.Label) ?? entry.spec.name;
9556
- lines.push(`${BULLET_1}hit column: ${hitName}`);
9557
- return lines.join("\n");
9558
- }
9559
- function formatAnchors(q) {
9560
- if (isNil(q)) return void 0;
9561
- if (isNil(q.forQueries)) return void 0;
9562
- const ids = Object.keys(q.forQueries);
9563
- if (ids.length === 0) return void 0;
9564
- const lines = [];
9565
- for (const id of ids) {
9566
- const item = q.forQueries[id];
9567
- if (item.length === 0) continue;
9568
- const rendered = formatAxisQualifications(item);
9569
- lines.push(`${BULLET_1}${id}${rendered !== void 0 ? ` ${rendered}` : ""}`);
9570
- }
9571
- return lines.length > 0 ? ["Anchors (bound via this variant)"].concat(lines).join("\n") : void 0;
9572
- }
9573
- function formatHit(q) {
9574
- if (isNil(q) || isNil(q.forHit) || q.forHit.length === 0) return void 0;
9575
- const rendered = formatAxisQualifications(q.forHit);
9576
- if (rendered === void 0) return void 0;
9577
- return ["Hit column qualifications", `${BULLET_1}${rendered}`].join("\n");
9578
- }
9579
- function formatAxisQualifications(qs) {
9580
- if (qs.length === 0) return void 0;
9581
- return qs.map(formatQualification).join("; ");
9582
- }
9583
- function formatQualification(q) {
9584
- const axisName = typeof q.axis === "string" ? q.axis : q.axis.name ?? JSON.stringify(q.axis);
9585
- const entries = Object.entries(q.contextDomain);
9586
- if (entries.length === 0) return axisName;
9587
- return `${axisName} context: ${entries.map(([k, v]) => `${k}=${v}`).join(", ")}`;
9588
- }
9589
- //#endregion
9590
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/utils.js
9591
- /** Check if column should be omitted from the table */
9592
- function isColumnHidden(spec) {
9593
- return readAnnotation(spec, Annotation.Table.Visibility) === "hidden";
9594
- }
9034
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/utils.js
9595
9035
  /** Check if column is hidden by default */
9596
9036
  function isColumnOptional(spec) {
9597
9037
  return readAnnotation(spec, Annotation.Table.Visibility) === "optional";
9598
9038
  }
9599
- /** Get effective visibility for a column. Rule map lookup first, then annotation fallback. */
9600
- function getEffectiveVisibility(col, visibilityByColId) {
9601
- const rule = visibilityByColId?.get(col.id);
9602
- if (rule !== void 0) return rule.visibility;
9603
- if (isColumnHidden(col.spec)) return "hidden";
9604
- if (isColumnOptional(col.spec)) return "optional";
9605
- }
9606
- /** Get ordering priority for a column. Rule map lookup first, then annotation fallback. */
9607
- function getOrderPriority(col, orderByColId) {
9608
- const rule = orderByColId?.get(col.id);
9609
- if (rule !== void 0) return rule.priority;
9610
- const annotation = Number(readAnnotation(col.spec, Annotation.Table.OrderPriority));
9611
- return isNaN(annotation) ? void 0 : annotation;
9612
- }
9613
- /**
9614
- * Evaluate display rules against a set of columns and return a map of `colId → winning rule`
9615
- * (first-match-wins, preserving original rule order).
9616
- *
9617
- * Predicate-based rules (`ColumnMatcher`) are evaluated directly on the spec.
9618
- * Selector-based rules (`ColumnSelector`) are matched via `PFrameSpecDriver.discoverColumns`
9619
- * using the same engine as `ColumnCollection.findColumns` — no client-side matcher.
9620
- */
9621
- function evaluateRules(rules, columns, pframeSpec) {
9622
- const result = /* @__PURE__ */ new Map();
9623
- if (rules.length === 0 || columns.length === 0) return result;
9624
- const hasSelectorRules = rules.some((rule) => typeof rule.match !== "function");
9625
- const selectorHitsByRule = /* @__PURE__ */ new Map();
9626
- if (hasSelectorRules) {
9627
- const pColumns = dedupeById(columns).map((c) => ({
9628
- id: c.id,
9629
- spec: c.spec,
9630
- data: void 0
9631
- }));
9632
- const collection = new ColumnCollectionBuilder(pframeSpec).addSource(new ArrayColumnProvider(pColumns)).build();
9633
- if (collection === void 0) return result;
9634
- try {
9635
- for (const rule of rules) {
9636
- if (typeof rule.match === "function") continue;
9637
- const hits = collection.findColumns({ include: rule.match });
9638
- selectorHitsByRule.set(rule, new Set(hits.map((h) => h.id)));
9639
- }
9640
- } finally {
9641
- collection.dispose();
9039
+ //#endregion
9040
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/components/PlDataTable/labels.js
9041
+ /** Get label columns matching the provided columns from the result pool */
9042
+ function getMatchingLabelColumns(columns, allLabelColumns) {
9043
+ const inputLabelColumns = [];
9044
+ const inputValueColumns = [];
9045
+ for (const column of columns) if (isLabelColumn(column.spec)) inputLabelColumns.push(column);
9046
+ else inputValueColumns.push(column);
9047
+ const unlabeledAxes = [];
9048
+ for (const column of inputValueColumns) for (const axis of column.spec.axesSpec) {
9049
+ const axisId = getAxisId(axis);
9050
+ if (!unlabeledAxes.some((id) => matchAxisId(id, axisId))) unlabeledAxes.push(axisId);
9051
+ }
9052
+ for (const labelColumn of inputLabelColumns) {
9053
+ const labelAxisId = getAxisId(labelColumn.spec.axesSpec[0]);
9054
+ const labelMatch = unlabeledAxes.findIndex((axisId) => matchAxisId(axisId, labelAxisId));
9055
+ if (labelMatch !== -1) unlabeledAxes.splice(labelMatch, 1);
9056
+ }
9057
+ const colId = (id, domain, contextDomain) => {
9058
+ let wid = id.toString();
9059
+ if (domain) for (const k in domain) {
9060
+ wid += k;
9061
+ wid += domain[k];
9642
9062
  }
9643
- }
9644
- for (const col of columns) for (const rule of rules) if (typeof rule.match === "function" ? rule.match(col.spec) : selectorHitsByRule.get(rule)?.has(col.id) ?? false) {
9645
- result.set(col.id, rule);
9646
- break;
9647
- }
9648
- return result;
9649
- }
9650
- function dedupeById(columns) {
9651
- const seen = /* @__PURE__ */ new Set();
9652
- const result = [];
9653
- for (const col of columns) {
9654
- if (seen.has(col.id)) continue;
9655
- seen.add(col.id);
9656
- result.push(col);
9657
- }
9658
- return result;
9659
- }
9660
- /**
9661
- * Writes derived labels into column and axis annotations.
9662
- * Returns new column objects with modified specs — original columns are not mutated.
9663
- *
9664
- * For each column: writes derived label into Annotation.Label (if present in derivedLabels).
9665
- * For each axis in column specs: writes derived axis label into AxisSpec annotations.
9666
- */
9667
- function withLabelAnnotations(derivedLabels, columns) {
9668
- if (derivedLabels === void 0) return columns;
9669
- return columns.map((col) => {
9670
- const colLabel = derivedLabels[col.id];
9671
- return {
9672
- ...col,
9673
- spec: {
9674
- ...col.spec,
9675
- ...isNil(colLabel) ? {} : { annotations: {
9676
- ...col.spec.annotations,
9677
- [Annotation.Label]: colLabel
9678
- } },
9679
- axesSpec: col.spec.axesSpec.map((axis) => {
9680
- const label = derivedLabels[canonicalizeAxisId(axis)];
9681
- return isNil(label) ? axis : {
9682
- ...axis,
9683
- annotations: {
9684
- ...axis.annotations,
9685
- [Annotation.Label]: label
9686
- }
9687
- };
9688
- })
9689
- }
9690
- };
9691
- });
9692
- }
9693
- function withDataStatusAnnotations(columns) {
9694
- return columns.map((col) => {
9695
- return {
9696
- ...col,
9697
- spec: {
9698
- ...col.spec,
9699
- annotations: {
9700
- ...col.spec.annotations,
9701
- [Annotation.DataStatus]: col.dataStatus
9702
- }
9703
- }
9704
- };
9705
- });
9706
- }
9707
- /**
9708
- * Writes effective display properties (OrderPriority, Visibility) from precomputed rule maps
9709
- * into column annotations. Returns new column objects — originals are not mutated.
9710
- */
9711
- function withTableVisualAnnotations(visibilityByColId, orderByColId, columns) {
9712
- if (visibilityByColId === void 0 && orderByColId === void 0) return columns;
9713
- return columns.map((col) => {
9714
- const annotations = { ...col.spec.annotations };
9715
- const visibility = getEffectiveVisibility(col, visibilityByColId);
9716
- if (!isNil(visibility)) annotations[Annotation.Table.Visibility] = visibility;
9717
- const orderPriority = getOrderPriority(col, orderByColId);
9718
- if (!isNil(orderPriority)) annotations[Annotation.Table.OrderPriority] = String(orderPriority);
9719
- return {
9720
- ...col,
9721
- spec: {
9722
- ...col.spec,
9723
- annotations
9724
- }
9725
- };
9726
- });
9727
- }
9728
- /**
9729
- * Writes derived info annotations into column annotations.
9730
- * Columns without an info entry are passed through unchanged.
9731
- */
9732
- function withInfoAnnotations(infoById, columns) {
9733
- if (isNil(infoById)) return columns;
9734
- return columns.map((col) => {
9735
- const info = infoById[col.id];
9736
- if (isNil(info)) return col;
9737
- return {
9738
- ...col,
9739
- spec: {
9740
- ...col.spec,
9741
- annotations: {
9742
- ...col.spec.annotations,
9743
- [Annotation.Table.Info]: info
9744
- }
9745
- }
9746
- };
9747
- });
9748
- }
9749
- function withHidenAxesAnnotations(columns) {
9750
- return columns.map((col) => ({
9751
- ...col,
9752
- spec: {
9753
- ...col.spec,
9754
- axesSpec: col.spec.axesSpec.map((axis) => ({
9755
- ...axis,
9756
- annotations: {
9757
- ...axis.annotations,
9758
- [Annotation.Table.Visibility]: "hidden"
9759
- }
9760
- }))
9063
+ if (contextDomain) for (const k in contextDomain) {
9064
+ wid += k;
9065
+ wid += contextDomain[k];
9761
9066
  }
9762
- }));
9763
- }
9764
- /** Derive labels for all table elements: columns via deriveDistinctLabels, axes from label columns. */
9765
- function deriveAllLabels(options) {
9766
- const { columns, deriveLabelsOptions } = options;
9767
- return deriveDistinctLabels(columns.map((c) => ({
9768
- spec: c.spec,
9769
- linkerPath: c.linkerPath?.map((step) => ({ spec: step.linker.spec })),
9770
- qualifications: c.qualifications
9771
- })), deriveLabelsOptions).reduce((acc, label, index) => (acc[columns[index].id] = label, acc), {});
9772
- }
9773
- /** Derive origin tooltips for columns whose qualifications or linker path carry info. */
9774
- function deriveAllTooltips(options) {
9775
- const { columns } = options;
9776
- const variantCountByOriginal = columns.reduce((acc, c) => {
9777
- return acc.set(getField(c, "originalId") ?? c.id, (acc.get(c.originalId ?? c.id) ?? 0) + 1);
9778
- }, /* @__PURE__ */ new Map());
9779
- const { entries } = columns.reduce(({ entries, variantSeen }, c) => {
9780
- const id = getField(c, "originalId") ?? c.id;
9781
- const variantCount = variantCountByOriginal.get(id);
9782
- const variantIndex = (variantSeen.set(id, (variantSeen.get(id) ?? 0) + 1), variantSeen.get(id));
9783
- entries.push({
9784
- spec: c.spec,
9785
- linkerPath: c.linkerPath,
9786
- qualifications: c.qualifications,
9787
- variantIndex,
9788
- variantCount
9789
- });
9790
- return {
9791
- entries,
9792
- variantSeen
9793
- };
9794
- }, {
9795
- entries: [],
9796
- variantSeen: /* @__PURE__ */ new Map()
9797
- });
9798
- const tooltips = deriveDistinctTooltips(entries);
9799
- return Object.fromEntries(tooltips.flatMap((t, i) => isNil(t) ? [] : [[columns[i].id, t]]));
9067
+ return wid;
9068
+ };
9069
+ const labelColumns = [];
9070
+ for (const labelColumn of allLabelColumns) {
9071
+ const labelAxis = labelColumn.spec.axesSpec[0];
9072
+ const labelAxisId = getAxisId(labelAxis);
9073
+ const labelMatch = unlabeledAxes.findIndex((axisId) => matchAxisId(axisId, labelAxisId));
9074
+ if (labelMatch !== -1) {
9075
+ const axisId = unlabeledAxes[labelMatch];
9076
+ if (Object.keys(axisId.domain ?? {}).length + Object.keys(axisId.contextDomain ?? {}).length > Object.keys(labelAxis.domain ?? {}).length + Object.keys(labelAxis.contextDomain ?? {}).length) labelColumns.push({
9077
+ id: colId(labelColumn.id, axisId.domain, axisId.contextDomain),
9078
+ spec: {
9079
+ ...labelColumn.spec,
9080
+ axesSpec: [{
9081
+ ...axisId,
9082
+ annotations: labelAxis.annotations
9083
+ }]
9084
+ },
9085
+ data: labelColumn.data
9086
+ });
9087
+ else labelColumns.push(labelColumn);
9088
+ unlabeledAxes.splice(labelMatch, 1);
9089
+ }
9090
+ }
9091
+ return labelColumns;
9800
9092
  }
9801
9093
  //#endregion
9802
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js
9094
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js
9803
9095
  function createPTableDefV3(params) {
9804
9096
  let query = {
9805
9097
  type: params.primaryJoinType === "inner" ? "innerJoin" : "fullJoin",
@@ -9870,387 +9162,126 @@
9870
9162
  };
9871
9163
  }
9872
9164
  //#endregion
9873
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/discoverColumns.js
9874
- /** Discover columns from sources/anchors and normalize into a flat TableColumnVariant list. */
9875
- function discoverTableColumnSnaphots(ctx, options) {
9876
- const resolvedOptions = {
9877
- ...options,
9878
- anchors: resolveAnchors$1(ctx, options.anchors)
9879
- };
9880
- const providers = resolveProviders(ctx, resolvedOptions.sources);
9881
- if (providers.length === 0) return void 0;
9882
- const collection = new ColumnCollectionBuilder(ctx.getService("pframeSpec")).addSources(providers).build(resolvedOptions);
9883
- if (collection === void 0) return void 0;
9884
- try {
9885
- return mapToTableColumnVariants(collection.findColumnVariants(resolvedOptions.selector), collection.getAnchors());
9886
- } finally {
9887
- collection.dispose();
9888
- }
9165
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.js
9166
+ function createPTableDefV2(params) {
9167
+ let coreColumns = params.columns;
9168
+ const secondaryColumns = [];
9169
+ if (isFunction(params.coreColumnPredicate)) {
9170
+ coreColumns = [];
9171
+ for (const c of params.columns) if (params.coreColumnPredicate(getColumnIdAndSpec(c))) coreColumns.push(c);
9172
+ else secondaryColumns.push(c);
9173
+ }
9174
+ secondaryColumns.push(...params.labelColumns);
9175
+ return createPTableDefV3({
9176
+ primary: coreColumns.map((column) => ({ column })),
9177
+ secondary: secondaryColumns.map((column) => ({ entries: [{ column }] })),
9178
+ primaryJoinType: params.coreJoinType,
9179
+ filters: params.filters,
9180
+ sorting: params.sorting
9181
+ });
9889
9182
  }
9183
+ //#endregion
9184
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.77.0/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.js
9890
9185
  /**
9891
- * Discover label columns matching the axes of the given value columns from
9892
- * ctx providers. Returns label snapshots wrapped as direct TableColumnVariants
9893
- * (path: [], empty qualifications, isPrimary: false).
9186
+ * Create p-table spec and handle given ui table state
9187
+ *
9188
+ * @deprecated This version of createPlDataTable is deprecated and will be removed in future. Please migrate to v3 by switching to the new options format and providing necessary information for column discovery and display configuration. See createPlDataTableOptionsV3 for details.
9189
+ * @param ctx context
9190
+ * @param columns column list
9191
+ * @param tableState table ui state
9192
+ * @returns PlAgDataTableV2 table source
9894
9193
  */
9895
- function discoverLabelColumnVariants(ctx, columns) {
9896
- if (columns.length === 0) return [];
9897
- const collection = new ColumnCollectionBuilder(ctx.getService("pframeSpec")).addSources(collectCtxColumnSnapshotProviders(ctx)).addSource(columns.map((c) => c.column)).build({
9898
- allowPartialColumnList: true,
9899
- anchors: Object.fromEntries(columns.filter((col) => (col.path?.length ?? 0) === 0 && col.isPrimary).map((col, i) => [`anchor_${i}`, col.column.spec]))
9900
- });
9901
- try {
9902
- const axes = columns.flatMap((col) => col.column.spec.axesSpec);
9903
- return collection.findColumnVariants({
9904
- include: axes.map((a) => ({
9905
- name: {
9906
- type: "exact",
9907
- value: PColumnName.Label
9908
- },
9909
- axes: [{ name: {
9910
- type: "exact",
9911
- value: a.name
9912
- } }]
9913
- })),
9914
- maxHops: columns.reduce((acc, c) => Math.max(acc, c.path?.length ?? 0), 0)
9915
- }).map((variant) => ({
9916
- ...variant,
9917
- column: {
9918
- ...variant.column,
9919
- id: createDiscoveredPColumnId({
9920
- column: variant.column.id,
9921
- path: variant.path?.map((p) => ({
9922
- type: "linker",
9923
- column: p.linker.id
9924
- })),
9925
- columnQualifications: variant.qualifications?.forHit,
9926
- queriesQualifications: variant.qualifications?.forQueries
9927
- }),
9928
- originalId: variant.column.id
9929
- }
9930
- }));
9931
- } finally {
9932
- collection.dispose();
9933
- }
9934
- }
9935
- /** Resolve PlRef values in anchors to PColumnSpec via the result pool. */
9936
- function resolveAnchors$1(ctx, anchors) {
9937
- const result = {};
9938
- for (const [key, value] of Object.entries(anchors)) if (isPlRef(value)) result[key] = ctx.resultPool.getPColumnSpecByRef(value) ?? throwError(`Anchor ${key} with ref ${JSON.stringify(value)} could not be resolved to a PColumnSpec`);
9939
- else result[key] = value;
9940
- return result;
9941
- }
9942
- /** Resolve column snapshot providers from explicit sources or context. */
9943
- function resolveProviders(ctx, sources) {
9944
- return sources !== void 0 ? sources.map(toColumnSnapshotProvider) : collectCtxColumnSnapshotProviders(ctx);
9945
- }
9946
- /** Map column variants into TableColumnVariant list with anchor-derived isPrimary flag. */
9947
- function mapToTableColumnVariants(variants, anchors) {
9948
- const columnIdToAnchorName = new Map(Array.from(anchors.entries(), ([key, { id }]) => [id, key]));
9949
- return variants.map((variant) => {
9950
- const snap = variant.column;
9951
- const isPrimary = columnIdToAnchorName.get(snap.id) !== void 0;
9194
+ function createPlDataTableV2(ctx, columns, tableState, options) {
9195
+ if (columns.length === 0) return void 0;
9196
+ const tableStateNormalized = upgradePlDataTableStateV2(tableState);
9197
+ const allLabelColumns = getAllLabelColumns(ctx.resultPool) ?? [];
9198
+ let fullLabelColumns = getMatchingLabelColumns(columns, allLabelColumns);
9199
+ fullLabelColumns = deriveLabels(fullLabelColumns, identity, { includeNativeLabel: true }).map((v) => {
9952
9200
  return {
9953
- column: {
9954
- id: createDiscoveredPColumnId({
9955
- column: snap.id,
9956
- path: variant.path?.map((p) => ({
9957
- type: "linker",
9958
- column: p.linker.id
9959
- })),
9960
- columnQualifications: variant.qualifications?.forHit,
9961
- queriesQualifications: variant.qualifications?.forQueries
9962
- }),
9963
- spec: snap.spec,
9964
- data: snap.data,
9965
- dataStatus: snap.dataStatus
9966
- },
9967
- path: variant.path,
9968
- qualifications: variant.qualifications,
9969
- originalId: snap.id,
9970
- isPrimary
9201
+ ...v.value,
9202
+ spec: {
9203
+ ...v.value.spec,
9204
+ annotations: {
9205
+ ...v.value.spec.annotations,
9206
+ [Annotation.Label]: v.label
9207
+ }
9208
+ }
9971
9209
  };
9972
9210
  });
9973
- }
9974
- //#endregion
9975
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js
9976
- function createPlDataTableV3(ctx, options) {
9977
- const pframeSpec = ctx.getService("pframeSpec");
9978
- const state = upgradePlDataTableStateV2(options.tableState);
9979
- const primaryJoinType = options.primaryJoinType ?? "full";
9980
- const discovered = isPlainObject(options.columns) ? discoverTableColumnSnaphots(ctx, options.columns) : isNil$1(options.columns) ? options.columns : uniqueBy([...options.columns, ...discoverLabelColumnVariants(ctx, options.columns)], (c) => c.column.id);
9981
- if (isNil$1(discovered) || discovered.length === 0) return void 0;
9982
- const splited = splitDiscoveredColumns(discovered);
9983
- const derivedLabels = deriveAllLabels({
9984
- columns: discovered.map((dc) => ({
9985
- id: dc.column.id,
9986
- spec: dc.column.spec,
9987
- linkerPath: dc.path,
9988
- qualifications: dc.qualifications
9989
- })).filter((v) => !isColumnHidden(v.spec)),
9990
- deriveLabelsOptions: {
9991
- includeNativeLabel: true,
9992
- ...options.labelsOptions
9993
- }
9994
- });
9995
- const derivedTooltips = deriveAllTooltips({ columns: discovered.map((dc) => ({
9996
- id: dc.column.id,
9997
- originalId: getField(dc, "originalId"),
9998
- spec: dc.column.spec,
9999
- linkerPath: dc.path,
10000
- qualifications: dc.qualifications
10001
- })) });
10002
- const annotated = annotateColumnGroups({
10003
- pframeSpec,
10004
- ...splited,
10005
- derivedLabels,
10006
- derivedTooltips,
10007
- displayOptions: options.displayOptions
10008
- });
10009
- const primarySnapshots = annotated.direct.filter((c) => c.isPrimary);
10010
- const secondarySnapshots = annotated.direct.filter((c) => !c.isPrimary);
10011
- if (primarySnapshots.length === 0) return void 0;
10012
- const columnIsAvailable = createColumnValidationById([...annotated.direct.map((v) => v.column), ...annotated.linked.flatMap((lc) => [...(lc.path ?? []).map((s) => s.linker), lc.column])]);
10013
- const remapedDefaultFilters = remapFilterColumnIds(options.filters, discovered);
10014
- const filters = filterFilters(concatFilters(state.pTableParams.filters, state.pTableParams.defaultFilters ?? remapedDefaultFilters), columnIsAvailable);
10015
- const sorting = filterSorting(resolveSorting(state.pTableParams.sorting, remapSortingColumnIds(options.sorting, discovered)), columnIsAvailable);
10016
- const primaryEntries = primarySnapshots.map((v) => ({ column: resolveSnapshot(v.column) }));
10017
- const fullDef = createPTableDefV3({
10018
- primaryJoinType,
10019
- primary: primaryEntries,
10020
- secondary: buildSecondaryGroups(secondarySnapshots, annotated.linked),
9211
+ const fullColumns = [...columns, ...fullLabelColumns];
9212
+ const fullColumnsIds = [...uniqueBy(fullColumns.flatMap((c) => c.spec.axesSpec.map((a) => getAxisId(a))), (a) => canonicalizeJson(a)).map((a) => ({
9213
+ type: "axis",
9214
+ id: a
9215
+ })), ...fullColumns.map((c) => ({
9216
+ type: "column",
9217
+ id: c.id
9218
+ }))];
9219
+ const fullColumnsIdsSet = new Set(fullColumnsIds.map((c) => canonicalizeJson(c)));
9220
+ const isValidColumnId = (id) => fullColumnsIdsSet.has(id);
9221
+ const filters = tableStateNormalized.pTableParams.filters;
9222
+ const defaultFilters = options?.filters ?? void 0;
9223
+ const firstInvalidFilterColumn = (filters !== null ? collectFilterSpecColumns(filters) : []).find((col) => !isValidColumnId(col));
9224
+ if (firstInvalidFilterColumn) throw new Error(`Invalid filter column ${firstInvalidFilterColumn}: column reference does not match the table columns`);
9225
+ const firstInvalidDefaultFilterColumn = (defaultFilters !== void 0 ? collectFilterSpecColumns(defaultFilters) : []).find((col) => !isValidColumnId(col));
9226
+ if (firstInvalidDefaultFilterColumn) throw new Error(`Invalid default filter column ${firstInvalidDefaultFilterColumn}: column reference does not match the table columns`);
9227
+ const userSorting = tableStateNormalized.pTableParams.sorting;
9228
+ const sorting = (isEmpty(userSorting) ? options?.sorting : userSorting) ?? [];
9229
+ const firstInvalidSortingColumn = sorting.find((s) => !isValidColumnId(canonicalizeJson(s.column)));
9230
+ if (firstInvalidSortingColumn) throw new Error(`Invalid sorting column ${JSON.stringify(firstInvalidSortingColumn.column)}: column reference does not match the table columns`);
9231
+ const coreJoinType = options?.coreJoinType ?? "full";
9232
+ const fullDef = createPTableDefV2({
9233
+ columns,
9234
+ labelColumns: fullLabelColumns,
9235
+ coreJoinType,
10021
9236
  filters,
10022
- sorting
9237
+ sorting,
9238
+ coreColumnPredicate: options?.coreColumnPredicate
10023
9239
  });
10024
9240
  const fullHandle = ctx.createPTableV2(fullDef);
10025
- const pframeHandle = ctx.createPFrame([
10026
- ...annotated.direct.map((v) => resolveSnapshot(v.column)),
10027
- ...annotated.linked.map((v) => resolveSnapshot(v.column)),
10028
- ...collectLinkerSnapshots(annotated.linked).map(resolveSnapshot)
10029
- ]);
10030
- const hiddenSpecs = state.pTableParams.hiddenColIds;
10031
- const visible = buildVisibleColumns(annotated, computeHiddenColumns([...annotated.direct, ...annotated.linked].map((v) => v.column), sorting, filters, hiddenSpecs));
10032
- const visibleDef = createPTableDefV3({
10033
- primaryJoinType,
10034
- primary: primaryEntries,
10035
- secondary: buildSecondaryGroups(visible.direct.filter((c) => !c.isPrimary), visible.linked),
9241
+ const pframeHandle = ctx.createPFrame(fullColumns);
9242
+ if (!fullHandle || !pframeHandle) return void 0;
9243
+ const hiddenColumns = new Set((() => {
9244
+ if (coreJoinType === "inner") return [];
9245
+ const hiddenColIds = tableStateNormalized.pTableParams.hiddenColIds;
9246
+ if (hiddenColIds !== null) return hiddenColIds.filter((s) => s.type === "column").map((s) => s.id);
9247
+ return columns.filter((c) => isColumnOptional(c.spec)).map((c) => c.id);
9248
+ })());
9249
+ columns.filter((c) => isLinkerColumn(c.spec)).forEach((c) => hiddenColumns.delete(c.id));
9250
+ const coreColumnPredicate = options?.coreColumnPredicate;
9251
+ if (coreColumnPredicate) columns.flatMap((c) => coreColumnPredicate(getColumnIdAndSpec(c)) ? [c.id] : []).forEach((c) => hiddenColumns.delete(c));
9252
+ sorting.map((s) => s.column).filter((c) => c.type === "column").forEach((c) => hiddenColumns.delete(c.id));
9253
+ if (filters) collectFilterSpecColumns(filters).flatMap((c) => {
9254
+ const obj = parseJson(c);
9255
+ return obj.type === "column" ? [obj.id] : [];
9256
+ }).forEach((c) => hiddenColumns.delete(c));
9257
+ const visibleColumns = columns.filter((c) => !hiddenColumns.has(c.id));
9258
+ const visibleLabelColumns = getMatchingLabelColumns(visibleColumns.map(getColumnIdAndSpec), allLabelColumns);
9259
+ if (!allPColumnsReady([...visibleColumns, ...visibleLabelColumns])) return void 0;
9260
+ const visibleDef = createPTableDefV2({
9261
+ columns: visibleColumns,
9262
+ labelColumns: visibleLabelColumns,
9263
+ coreJoinType,
10036
9264
  filters,
10037
- sorting
9265
+ sorting,
9266
+ coreColumnPredicate
10038
9267
  });
10039
9268
  const visibleHandle = ctx.createPTableV2(visibleDef);
9269
+ if (!visibleHandle) return void 0;
10040
9270
  return {
10041
- sourceId: state.pTableParams.sourceId,
9271
+ sourceId: tableStateNormalized.pTableParams.sourceId,
10042
9272
  fullTableHandle: fullHandle,
10043
9273
  fullPframeHandle: pframeHandle,
10044
9274
  visibleTableHandle: visibleHandle,
10045
- defaultFilters: remapedDefaultFilters
10046
- };
10047
- }
10048
- /** Split discovered columns into direct (no linker path) and linked (with linker path). */
10049
- function splitDiscoveredColumns(columns) {
10050
- return {
10051
- direct: columns.filter((dc) => (dc.path?.length ?? 0) === 0),
10052
- linked: columns.filter((dc) => (dc.path?.length ?? 0) > 0)
10053
- };
10054
- }
10055
- /** All linker snapshots across the given linked columns, deduped by id. */
10056
- function collectLinkerSnapshots(linked) {
10057
- return uniqueBy(linked.flatMap((lc) => (lc.path ?? []).map((s) => s.linker)), (c) => c.id);
10058
- }
10059
- /**
10060
- * Annotate all column groups with derived labels and display-rule annotations.
10061
- * Evaluates `displayOptions` rules against all discovered columns (direct,
10062
- * linked, labels, linkers) and writes the winning visibility/priority into
10063
- * column annotations via `withTableVisualAnnotations`.
10064
- */
10065
- function annotateColumnGroups(params) {
10066
- const { direct, linked, derivedLabels, derivedTooltips, displayOptions, pframeSpec } = params;
10067
- const allColumnsForRules = [
10068
- ...direct.map((v) => v.column),
10069
- ...linked.map((v) => v.column),
10070
- ...collectLinkerSnapshots(linked)
10071
- ];
10072
- const visibilityByColId = evaluateRules(displayOptions?.visibility ?? [], allColumnsForRules, pframeSpec);
10073
- const orderByColId = evaluateRules(displayOptions?.ordering ?? [], allColumnsForRules, pframeSpec);
10074
- return {
10075
- direct: liftToVariantColumns(direct, flow((cols) => withDataStatusAnnotations(cols), (cols) => withLabelAnnotations(derivedLabels, cols), (cols) => withInfoAnnotations(derivedTooltips, cols), (cols) => withTableVisualAnnotations(visibilityByColId, orderByColId, cols))),
10076
- linked: liftToVariantColumns(linked, flow((cols) => withDataStatusAnnotations(cols), (cols) => withHidenAxesAnnotations(cols), (cols) => withLabelAnnotations(derivedLabels, cols), (cols) => withInfoAnnotations(derivedTooltips, cols), (cols) => withTableVisualAnnotations(visibilityByColId, orderByColId, cols))).map((lc) => ({
10077
- ...lc,
10078
- path: annotateLinkerPath(derivedLabels, lc.path)
10079
- }))
10080
- };
10081
- }
10082
- /** Lift a snapshot-array transform so it runs on the inner `column` of each variant. */
10083
- function liftToVariantColumns(variants, fn) {
10084
- const cols = fn(variants.map((v) => v.column));
10085
- if (cols.length !== variants.length) throw new Error(`liftToVariantColumns: fn must preserve array length (got ${cols.length}, expected ${variants.length})`);
10086
- return variants.map((v, i) => ({
10087
- ...v,
10088
- column: cols[i]
10089
- }));
10090
- }
10091
- function annotateLinkerPath(derivedLabels, path) {
10092
- if (isNil$1(path) || path.length === 0) return path;
10093
- const annotatedLinkers = withHidenAxesAnnotations(withLabelAnnotations(derivedLabels, path.map((s) => s.linker)));
10094
- return path.map((s, i) => ({
10095
- ...s,
10096
- linker: annotatedLinkers[i]
10097
- }));
10098
- }
10099
- /** Build an index of all valid column IDs (axes + columns) for filter/sorting validation. */
10100
- function createColumnValidationById(fullColumns) {
10101
- const allIds = [...uniqueBy(fullColumns.flatMap((c) => c.spec.axesSpec.map(getAxisId)), (a) => canonicalizeJson(a)).map((a) => ({
10102
- type: "axis",
10103
- id: a
10104
- })), ...fullColumns.map((c) => ({
10105
- type: "column",
10106
- id: c.id
10107
- }))];
10108
- const validIdSet = new Set(allIds.map((c) => canonicalizeJson(c)));
10109
- return (id) => {
10110
- return validIdSet.has(id);
9275
+ defaultFilters
10111
9276
  };
10112
9277
  }
10113
- /** Drop filter leaves whose column references are not available in the table. */
10114
- function filterFilters(filters, isValidColumnId) {
10115
- if (isNil$1(filters)) return filters;
10116
- const isLeafValid = (leaf) => {
10117
- if (leaf.type === void 0) return true;
10118
- if ("column" in leaf && !isValidColumnId(leaf.column)) return false;
10119
- if ("rhs" in leaf && !isValidColumnId(leaf.rhs)) return false;
10120
- return true;
10121
- };
10122
- const prune = (node) => {
10123
- if (node.type === "and" || node.type === "or") {
10124
- const kept = node.filters.map((f) => prune(f)).filter((f) => !isNil$1(f));
10125
- return {
10126
- type: node.type,
10127
- filters: kept
10128
- };
10129
- }
10130
- if (node.type === "not") {
10131
- const inner = prune(node.filter);
10132
- return isNil$1(inner) ? void 0 : {
10133
- type: "not",
10134
- filter: inner
10135
- };
10136
- }
10137
- return isLeafValid(node) ? node : void 0;
10138
- };
10139
- return prune(filters);
10140
- }
10141
- /** Merge two filter trees into one AND-combined tree. Returns the non-nil one if the other is nil. */
10142
- function concatFilters(a, b) {
10143
- if (isNil$1(a)) return b;
10144
- if (isNil$1(b)) return a;
10145
- return {
10146
- ...a,
10147
- filters: [...a.filters, ...b.filters]
10148
- };
10149
- }
10150
- /** Pick user sorting from state if non-empty, otherwise fall back to options default. */
10151
- function resolveSorting(userSorting, defaultSorting) {
10152
- return (isEmpty(userSorting) ? defaultSorting : userSorting) ?? [];
10153
- }
10154
- /** Drop sorting entries whose column is not available in the table. */
10155
- function filterSorting(sorting, isValidColumnId) {
10156
- return sorting.filter((s) => isValidColumnId(canonicalizeJson(s.column)));
10157
- }
10158
- function buildSecondaryGroups(direct, linked) {
10159
- return [...direct.map((c) => ({
10160
- entries: [{
10161
- column: resolveSnapshot(c.column),
10162
- qualifications: c.qualifications?.forHit
10163
- }],
10164
- primaryQualifications: c.qualifications?.forQueries
10165
- })), ...linked.map((lc) => ({
10166
- entries: [{
10167
- column: resolveSnapshot(lc.column),
10168
- linkers: lc.path?.map((s) => resolveSnapshot(s.linker)),
10169
- qualifications: lc.qualifications?.forHit
10170
- }],
10171
- primaryQualifications: lc.qualifications?.forQueries
10172
- }))];
10173
- }
10174
- /** Determine which columns should be hidden based on state or optional-column defaults. */
10175
- function computeHiddenColumns(columns, sorting, filters, hiddenSpecs) {
10176
- const alwaysHidden = columns.filter((c) => isColumnHidden(c.spec)).map((c) => c.id);
10177
- const optionalHidden = !isNil$1(hiddenSpecs) ? hiddenSpecs.filter((s) => s.type === "column").map((s) => s.id) : columns.filter((c) => isColumnOptional(c.spec)).map((c) => c.id);
10178
- const initial = [...alwaysHidden, ...optionalHidden];
10179
- const preserved = collectPreservedColumnIds(sorting, filters);
10180
- return new Set(initial.filter((id) => !preserved.has(id)));
10181
- }
10182
- /** Collect IDs of columns that must remain visible (sorted, filtered). */
10183
- function collectPreservedColumnIds(sorting, filters) {
10184
- const sortedIds = (sorting ?? []).map((s) => s.column).filter((c) => c.type === "column").map((c) => c.id);
10185
- const filterIds = !isNil$1(filters) ? collectFilterSpecColumns(filters).flatMap((c) => {
10186
- const obj = parseJson(c);
10187
- return obj.type === "column" ? [obj.id] : [];
10188
- }) : [];
10189
- return new Set([...sortedIds, ...filterIds]);
10190
- }
10191
- /** Filter annotated columns to only visible ones, re-matching label columns for the visible subset. */
10192
- function buildVisibleColumns(annotated, hiddenColumns) {
10193
- return {
10194
- direct: annotated.direct.filter((c) => !hiddenColumns.has(c.column.id)),
10195
- linked: annotated.linked.filter((c) => !hiddenColumns.has(c.column.id))
10196
- };
10197
- }
10198
- /** Resolve a ColumnSnapshot to a PColumn with lazily-evaluated data. */
10199
- function resolveSnapshot(snap) {
10200
- return {
10201
- id: snap.id,
10202
- spec: snap.spec,
10203
- data: snap.data?.get()
10204
- };
10205
- }
10206
- /** Remap column references in sorting entries. */
10207
- function remapSortingColumnIds(sorting, columns) {
10208
- return sorting?.flatMap((s) => {
10209
- if (s.column.type === "axis") return [s];
10210
- const id = s.column.id;
10211
- const column = columns.find((c) => (getField(c, "originalId") ?? c.column.id) === id);
10212
- if (column === void 0) return [];
10213
- return [{
10214
- ...s,
10215
- column: {
10216
- type: "column",
10217
- id: column.column.id
10218
- }
10219
- }];
10220
- });
10221
- }
10222
- /** Remap column references in a filter tree. */
10223
- function remapFilterColumnIds(filters, columns) {
10224
- if (isNil$1(filters)) return filters;
10225
- const map = (tableColumnId) => {
10226
- const parsed = parseJson(tableColumnId);
10227
- if (parsed.type === "axis") return tableColumnId;
10228
- const originalId = parsed.id;
10229
- return canonicalizeJson({
10230
- type: "column",
10231
- id: (columns.find((c) => (getField(c, "originalId") ?? c.column.id) === originalId) ?? throwError(`Column ID "${parsed.id}" in filters does not match any discovered column`)).column.id
10232
- });
10233
- };
10234
- return traverseFilterSpec(filters, {
10235
- leaf: (leaf) => {
10236
- if (leaf.type === void 0) return leaf;
10237
- const result = { ...leaf };
10238
- if ("column" in result) result.column = map(result.column);
10239
- if ("rhs" in result) result.rhs = map(result.rhs);
10240
- return result;
10241
- },
10242
- and: (results) => ({
10243
- type: "and",
10244
- filters: results
10245
- }),
10246
- or: (results) => ({
10247
- type: "or",
10248
- filters: results
10249
- }),
10250
- not: (result) => ({
10251
- type: "not",
10252
- filter: result
10253
- })
9278
+ function getAllLabelColumns(resultPool) {
9279
+ return new PColumnCollection().addAxisLabelProvider(resultPool).addColumnProvider(resultPool).getColumns({
9280
+ name: PColumnName.Label,
9281
+ axes: [{}]
9282
+ }, {
9283
+ dontWaitAllData: true,
9284
+ overrideLabelAnnotation: false
10254
9285
  });
10255
9286
  }
10256
9287
  (/* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -10353,38 +9384,7 @@
10353
9384
  if (ctx.data.inputAnchor === void 0) return void 0;
10354
9385
  const ownCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
10355
9386
  if (ownCols === void 0) return void 0;
10356
- const info = ctx.outputs?.resolve("info")?.getDataAsJson();
10357
- if (info === void 0) return void 0;
10358
- const tier = info.coverageTier;
10359
- const sources = [new ArrayColumnProvider(ctx.resultPool.selectColumns((spec) => !spec.annotations?.[Annotation.Trace]?.includes("milaboratories.sequence-properties"))), new ArrayColumnProvider(ownCols)];
10360
- return createPlDataTableV3(ctx, {
10361
- tableState: ctx.data.tableState,
10362
- columns: {
10363
- sources,
10364
- anchors: { main: ctx.data.inputAnchor },
10365
- selector: { mode: "enrichment" }
10366
- },
10367
- displayOptions: { visibility: [{
10368
- match: (spec) => {
10369
- if (spec.domain?.["pl7.app/vdj/scClonotypeChain/index"] === "secondary") return false;
10370
- if (spec.domain?.["pl7.app/alphabet"] !== "aminoacid") return false;
10371
- const isVdj = spec.name === "pl7.app/vdj/sequence";
10372
- const isUniversal = spec.name === "pl7.app/sequence";
10373
- if (!isVdj && !isUniversal) return false;
10374
- const feature = isVdj ? spec.domain?.["pl7.app/vdj/feature"] : spec.domain?.["pl7.app/feature"];
10375
- if (tier === "peptide") return isUniversal && feature === "peptide";
10376
- const chain = spec.domain?.["pl7.app/vdj/scClonotypeChain"];
10377
- if (chain !== void 0 && chain !== "A") return false;
10378
- if (tier === "full_chain") return feature === "VDJRegion" || feature === "VDJRegionInFrame";
10379
- if (tier === "cdr3_only" || tier === "partial") return feature === "CDR3";
10380
- return false;
10381
- },
10382
- visibility: "default"
10383
- }, {
10384
- match: (spec) => !spec.annotations?.[Annotation.Trace]?.includes("milaboratories.sequence-properties") && spec.annotations?.["pl7.app/isLinkerColumn"] !== "true" && spec.annotations?.["pl7.app/isOutput"] !== "true",
10385
- visibility: "optional"
10386
- }] }
10387
- });
9387
+ return createPlDataTableV2(ctx, ownCols.filter((c) => c.spec.axesSpec.length === 1), ctx.data.tableState);
10388
9388
  }).outputWithStatus("propertiesPfHandle", (ctx) => {
10389
9389
  const allPCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
10390
9390
  if (allPCols === void 0) return void 0;