@platforma-open/milaboratories.sequence-properties.model 1.2.2 → 1.2.3
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/.turbo/turbo-build.log +10 -10
- package/.turbo/turbo-check.log +4 -4
- package/CHANGELOG.md +14 -0
- package/dist/bundle.js +161 -1241
- package/dist/bundle.js.map +1 -1
- package/dist/index.cjs +1 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -33
- package/dist/index.js.map +1 -1
- package/dist/model.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +10 -92
package/dist/bundle.js
CHANGED
|
@@ -5548,47 +5548,6 @@
|
|
|
5548
5548
|
return v === null || v === void 0;
|
|
5549
5549
|
}
|
|
5550
5550
|
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
5551
|
//#endregion
|
|
5593
5552
|
//#region ../node_modules/.pnpm/@milaboratories+helpers@1.14.2/node_modules/@milaboratories/helpers/dist/error.js
|
|
5594
5553
|
function throwError(v) {
|
|
@@ -5603,22 +5562,6 @@
|
|
|
5603
5562
|
}
|
|
5604
5563
|
createGetIncrementalId();
|
|
5605
5564
|
//#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
5565
|
//#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js
|
|
5623
5566
|
var LinkerMap = class LinkerMap {
|
|
5624
5567
|
/** Graph of linkers connected by axes (single or grouped by parents) */
|
|
@@ -5852,47 +5795,6 @@
|
|
|
5852
5795
|
} : voe;
|
|
5853
5796
|
}
|
|
5854
5797
|
//#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
5798
|
//#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.41.2/node_modules/@milaboratories/pl-model-common/dist/services/service_types.js
|
|
5897
5799
|
const SERVICE_ID_PATTERN = /^[a-zA-Z][a-zA-Z0-9]*$/;
|
|
5898
5800
|
const { service, isNodeService, isWasmService, isMainService, getServiceKind, getServiceModelMethods, getServiceUiMethods } = (() => {
|
|
@@ -6289,13 +6191,9 @@
|
|
|
6289
6191
|
}
|
|
6290
6192
|
}
|
|
6291
6193
|
//#endregion
|
|
6292
|
-
//#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/function/
|
|
6293
|
-
function
|
|
6294
|
-
return
|
|
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
|
-
};
|
|
6194
|
+
//#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/function/identity.mjs
|
|
6195
|
+
function identity(x) {
|
|
6196
|
+
return x;
|
|
6299
6197
|
}
|
|
6300
6198
|
//#endregion
|
|
6301
6199
|
//#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
|
|
@@ -6389,7 +6287,7 @@
|
|
|
6389
6287
|
qualifications: entry.qualifications
|
|
6390
6288
|
};
|
|
6391
6289
|
}
|
|
6392
|
-
function formatQualification
|
|
6290
|
+
function formatQualification(q) {
|
|
6393
6291
|
const ctx = q.contextDomain ?? {};
|
|
6394
6292
|
const keys = Object.keys(ctx);
|
|
6395
6293
|
if (keys.length === 0) return q.axis.name;
|
|
@@ -6397,7 +6295,7 @@
|
|
|
6397
6295
|
return Object.prototype.hasOwnProperty.call(ctx, q.axis.name) ? pairs : `${q.axis.name} ${pairs}`;
|
|
6398
6296
|
}
|
|
6399
6297
|
function formatQualifications(qs) {
|
|
6400
|
-
return qs.map(formatQualification
|
|
6298
|
+
return qs.map(formatQualification).join("; ");
|
|
6401
6299
|
}
|
|
6402
6300
|
function computeStepLabel(step, stepIndex, formatters) {
|
|
6403
6301
|
const base = (readAnnotation(step.spec, Annotation.LinkLabel) ?? readAnnotation(step.spec, Annotation.Label))?.trim();
|
|
@@ -6874,7 +6772,7 @@
|
|
|
6874
6772
|
/**
|
|
6875
6773
|
* A simple implementation of {@link ColumnProvider} backed by a pre-defined array of columns.
|
|
6876
6774
|
*/
|
|
6877
|
-
var ArrayColumnProvider
|
|
6775
|
+
var ArrayColumnProvider = class {
|
|
6878
6776
|
constructor(columns) {
|
|
6879
6777
|
this.columns = columns;
|
|
6880
6778
|
}
|
|
@@ -6925,7 +6823,7 @@
|
|
|
6925
6823
|
}
|
|
6926
6824
|
var PColumnCollection = class {
|
|
6927
6825
|
defaultProviderStore = [];
|
|
6928
|
-
providers = [new ArrayColumnProvider
|
|
6826
|
+
providers = [new ArrayColumnProvider(this.defaultProviderStore)];
|
|
6929
6827
|
axisLabelProviders = [];
|
|
6930
6828
|
constructor() {}
|
|
6931
6829
|
addColumnProvider(provider) {
|
|
@@ -8365,473 +8263,6 @@
|
|
|
8365
8263
|
}));
|
|
8366
8264
|
}
|
|
8367
8265
|
//#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
8266
|
//#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/filters/traverse.js
|
|
8836
8267
|
/**
|
|
8837
8268
|
* Recursively traverses a FilterSpec tree bottom-up, applying visitor callbacks.
|
|
@@ -9520,283 +8951,64 @@
|
|
|
9520
8951
|
};
|
|
9521
8952
|
}
|
|
9522
8953
|
//#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
8954
|
//#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
|
-
}
|
|
9595
8955
|
/** Check if column is hidden by default */
|
|
9596
8956
|
function isColumnOptional(spec) {
|
|
9597
8957
|
return readAnnotation(spec, Annotation.Table.Visibility) === "optional";
|
|
9598
8958
|
}
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
const
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
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();
|
|
8959
|
+
//#endregion
|
|
8960
|
+
//#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/components/PlDataTable/labels.js
|
|
8961
|
+
/** Get label columns matching the provided columns from the result pool */
|
|
8962
|
+
function getMatchingLabelColumns(columns, allLabelColumns) {
|
|
8963
|
+
const inputLabelColumns = [];
|
|
8964
|
+
const inputValueColumns = [];
|
|
8965
|
+
for (const column of columns) if (isLabelColumn(column.spec)) inputLabelColumns.push(column);
|
|
8966
|
+
else inputValueColumns.push(column);
|
|
8967
|
+
const unlabeledAxes = [];
|
|
8968
|
+
for (const column of inputValueColumns) for (const axis of column.spec.axesSpec) {
|
|
8969
|
+
const axisId = getAxisId(axis);
|
|
8970
|
+
if (!unlabeledAxes.some((id) => matchAxisId(id, axisId))) unlabeledAxes.push(axisId);
|
|
8971
|
+
}
|
|
8972
|
+
for (const labelColumn of inputLabelColumns) {
|
|
8973
|
+
const labelAxisId = getAxisId(labelColumn.spec.axesSpec[0]);
|
|
8974
|
+
const labelMatch = unlabeledAxes.findIndex((axisId) => matchAxisId(axisId, labelAxisId));
|
|
8975
|
+
if (labelMatch !== -1) unlabeledAxes.splice(labelMatch, 1);
|
|
8976
|
+
}
|
|
8977
|
+
const colId = (id, domain, contextDomain) => {
|
|
8978
|
+
let wid = id.toString();
|
|
8979
|
+
if (domain) for (const k in domain) {
|
|
8980
|
+
wid += k;
|
|
8981
|
+
wid += domain[k];
|
|
9642
8982
|
}
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
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
|
-
}))
|
|
8983
|
+
if (contextDomain) for (const k in contextDomain) {
|
|
8984
|
+
wid += k;
|
|
8985
|
+
wid += contextDomain[k];
|
|
9761
8986
|
}
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
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]]));
|
|
8987
|
+
return wid;
|
|
8988
|
+
};
|
|
8989
|
+
const labelColumns = [];
|
|
8990
|
+
for (const labelColumn of allLabelColumns) {
|
|
8991
|
+
const labelAxis = labelColumn.spec.axesSpec[0];
|
|
8992
|
+
const labelAxisId = getAxisId(labelAxis);
|
|
8993
|
+
const labelMatch = unlabeledAxes.findIndex((axisId) => matchAxisId(axisId, labelAxisId));
|
|
8994
|
+
if (labelMatch !== -1) {
|
|
8995
|
+
const axisId = unlabeledAxes[labelMatch];
|
|
8996
|
+
if (Object.keys(axisId.domain ?? {}).length + Object.keys(axisId.contextDomain ?? {}).length > Object.keys(labelAxis.domain ?? {}).length + Object.keys(labelAxis.contextDomain ?? {}).length) labelColumns.push({
|
|
8997
|
+
id: colId(labelColumn.id, axisId.domain, axisId.contextDomain),
|
|
8998
|
+
spec: {
|
|
8999
|
+
...labelColumn.spec,
|
|
9000
|
+
axesSpec: [{
|
|
9001
|
+
...axisId,
|
|
9002
|
+
annotations: labelAxis.annotations
|
|
9003
|
+
}]
|
|
9004
|
+
},
|
|
9005
|
+
data: labelColumn.data
|
|
9006
|
+
});
|
|
9007
|
+
else labelColumns.push(labelColumn);
|
|
9008
|
+
unlabeledAxes.splice(labelMatch, 1);
|
|
9009
|
+
}
|
|
9010
|
+
}
|
|
9011
|
+
return labelColumns;
|
|
9800
9012
|
}
|
|
9801
9013
|
//#endregion
|
|
9802
9014
|
//#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js
|
|
@@ -9870,387 +9082,126 @@
|
|
|
9870
9082
|
};
|
|
9871
9083
|
}
|
|
9872
9084
|
//#endregion
|
|
9873
|
-
//#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
const
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9085
|
+
//#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.js
|
|
9086
|
+
function createPTableDefV2(params) {
|
|
9087
|
+
let coreColumns = params.columns;
|
|
9088
|
+
const secondaryColumns = [];
|
|
9089
|
+
if (isFunction(params.coreColumnPredicate)) {
|
|
9090
|
+
coreColumns = [];
|
|
9091
|
+
for (const c of params.columns) if (params.coreColumnPredicate(getColumnIdAndSpec(c))) coreColumns.push(c);
|
|
9092
|
+
else secondaryColumns.push(c);
|
|
9093
|
+
}
|
|
9094
|
+
secondaryColumns.push(...params.labelColumns);
|
|
9095
|
+
return createPTableDefV3({
|
|
9096
|
+
primary: coreColumns.map((column) => ({ column })),
|
|
9097
|
+
secondary: secondaryColumns.map((column) => ({ entries: [{ column }] })),
|
|
9098
|
+
primaryJoinType: params.coreJoinType,
|
|
9099
|
+
filters: params.filters,
|
|
9100
|
+
sorting: params.sorting
|
|
9101
|
+
});
|
|
9889
9102
|
}
|
|
9103
|
+
//#endregion
|
|
9104
|
+
//#region ../node_modules/.pnpm/@platforma-sdk+model@1.75.5/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.js
|
|
9890
9105
|
/**
|
|
9891
|
-
*
|
|
9892
|
-
*
|
|
9893
|
-
*
|
|
9106
|
+
* Create p-table spec and handle given ui table state
|
|
9107
|
+
*
|
|
9108
|
+
* @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.
|
|
9109
|
+
* @param ctx context
|
|
9110
|
+
* @param columns column list
|
|
9111
|
+
* @param tableState table ui state
|
|
9112
|
+
* @returns PlAgDataTableV2 table source
|
|
9894
9113
|
*/
|
|
9895
|
-
function
|
|
9896
|
-
if (columns.length === 0) return
|
|
9897
|
-
const
|
|
9898
|
-
|
|
9899
|
-
|
|
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;
|
|
9114
|
+
function createPlDataTableV2(ctx, columns, tableState, options) {
|
|
9115
|
+
if (columns.length === 0) return void 0;
|
|
9116
|
+
const tableStateNormalized = upgradePlDataTableStateV2(tableState);
|
|
9117
|
+
const allLabelColumns = getAllLabelColumns(ctx.resultPool) ?? [];
|
|
9118
|
+
let fullLabelColumns = getMatchingLabelColumns(columns, allLabelColumns);
|
|
9119
|
+
fullLabelColumns = deriveLabels(fullLabelColumns, identity, { includeNativeLabel: true }).map((v) => {
|
|
9952
9120
|
return {
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
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
|
|
9121
|
+
...v.value,
|
|
9122
|
+
spec: {
|
|
9123
|
+
...v.value.spec,
|
|
9124
|
+
annotations: {
|
|
9125
|
+
...v.value.spec.annotations,
|
|
9126
|
+
[Annotation.Label]: v.label
|
|
9127
|
+
}
|
|
9128
|
+
}
|
|
9971
9129
|
};
|
|
9972
9130
|
});
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
const
|
|
9983
|
-
const
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
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),
|
|
9131
|
+
const fullColumns = [...columns, ...fullLabelColumns];
|
|
9132
|
+
const fullColumnsIds = [...uniqueBy(fullColumns.flatMap((c) => c.spec.axesSpec.map((a) => getAxisId(a))), (a) => canonicalizeJson(a)).map((a) => ({
|
|
9133
|
+
type: "axis",
|
|
9134
|
+
id: a
|
|
9135
|
+
})), ...fullColumns.map((c) => ({
|
|
9136
|
+
type: "column",
|
|
9137
|
+
id: c.id
|
|
9138
|
+
}))];
|
|
9139
|
+
const fullColumnsIdsSet = new Set(fullColumnsIds.map((c) => canonicalizeJson(c)));
|
|
9140
|
+
const isValidColumnId = (id) => fullColumnsIdsSet.has(id);
|
|
9141
|
+
const filters = tableStateNormalized.pTableParams.filters;
|
|
9142
|
+
const defaultFilters = options?.filters ?? void 0;
|
|
9143
|
+
const firstInvalidFilterColumn = (filters !== null ? collectFilterSpecColumns(filters) : []).find((col) => !isValidColumnId(col));
|
|
9144
|
+
if (firstInvalidFilterColumn) throw new Error(`Invalid filter column ${firstInvalidFilterColumn}: column reference does not match the table columns`);
|
|
9145
|
+
const firstInvalidDefaultFilterColumn = (defaultFilters !== void 0 ? collectFilterSpecColumns(defaultFilters) : []).find((col) => !isValidColumnId(col));
|
|
9146
|
+
if (firstInvalidDefaultFilterColumn) throw new Error(`Invalid default filter column ${firstInvalidDefaultFilterColumn}: column reference does not match the table columns`);
|
|
9147
|
+
const userSorting = tableStateNormalized.pTableParams.sorting;
|
|
9148
|
+
const sorting = (isEmpty(userSorting) ? options?.sorting : userSorting) ?? [];
|
|
9149
|
+
const firstInvalidSortingColumn = sorting.find((s) => !isValidColumnId(canonicalizeJson(s.column)));
|
|
9150
|
+
if (firstInvalidSortingColumn) throw new Error(`Invalid sorting column ${JSON.stringify(firstInvalidSortingColumn.column)}: column reference does not match the table columns`);
|
|
9151
|
+
const coreJoinType = options?.coreJoinType ?? "full";
|
|
9152
|
+
const fullDef = createPTableDefV2({
|
|
9153
|
+
columns,
|
|
9154
|
+
labelColumns: fullLabelColumns,
|
|
9155
|
+
coreJoinType,
|
|
10021
9156
|
filters,
|
|
10022
|
-
sorting
|
|
9157
|
+
sorting,
|
|
9158
|
+
coreColumnPredicate: options?.coreColumnPredicate
|
|
10023
9159
|
});
|
|
10024
9160
|
const fullHandle = ctx.createPTableV2(fullDef);
|
|
10025
|
-
const pframeHandle = ctx.createPFrame(
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
9161
|
+
const pframeHandle = ctx.createPFrame(fullColumns);
|
|
9162
|
+
if (!fullHandle || !pframeHandle) return void 0;
|
|
9163
|
+
const hiddenColumns = new Set((() => {
|
|
9164
|
+
if (coreJoinType === "inner") return [];
|
|
9165
|
+
const hiddenColIds = tableStateNormalized.pTableParams.hiddenColIds;
|
|
9166
|
+
if (hiddenColIds !== null) return hiddenColIds.filter((s) => s.type === "column").map((s) => s.id);
|
|
9167
|
+
return columns.filter((c) => isColumnOptional(c.spec)).map((c) => c.id);
|
|
9168
|
+
})());
|
|
9169
|
+
columns.filter((c) => isLinkerColumn(c.spec)).forEach((c) => hiddenColumns.delete(c.id));
|
|
9170
|
+
const coreColumnPredicate = options?.coreColumnPredicate;
|
|
9171
|
+
if (coreColumnPredicate) columns.flatMap((c) => coreColumnPredicate(getColumnIdAndSpec(c)) ? [c.id] : []).forEach((c) => hiddenColumns.delete(c));
|
|
9172
|
+
sorting.map((s) => s.column).filter((c) => c.type === "column").forEach((c) => hiddenColumns.delete(c.id));
|
|
9173
|
+
if (filters) collectFilterSpecColumns(filters).flatMap((c) => {
|
|
9174
|
+
const obj = parseJson(c);
|
|
9175
|
+
return obj.type === "column" ? [obj.id] : [];
|
|
9176
|
+
}).forEach((c) => hiddenColumns.delete(c));
|
|
9177
|
+
const visibleColumns = columns.filter((c) => !hiddenColumns.has(c.id));
|
|
9178
|
+
const visibleLabelColumns = getMatchingLabelColumns(visibleColumns.map(getColumnIdAndSpec), allLabelColumns);
|
|
9179
|
+
if (!allPColumnsReady([...visibleColumns, ...visibleLabelColumns])) return void 0;
|
|
9180
|
+
const visibleDef = createPTableDefV2({
|
|
9181
|
+
columns: visibleColumns,
|
|
9182
|
+
labelColumns: visibleLabelColumns,
|
|
9183
|
+
coreJoinType,
|
|
10036
9184
|
filters,
|
|
10037
|
-
sorting
|
|
9185
|
+
sorting,
|
|
9186
|
+
coreColumnPredicate
|
|
10038
9187
|
});
|
|
10039
9188
|
const visibleHandle = ctx.createPTableV2(visibleDef);
|
|
9189
|
+
if (!visibleHandle) return void 0;
|
|
10040
9190
|
return {
|
|
10041
|
-
sourceId:
|
|
9191
|
+
sourceId: tableStateNormalized.pTableParams.sourceId,
|
|
10042
9192
|
fullTableHandle: fullHandle,
|
|
10043
9193
|
fullPframeHandle: pframeHandle,
|
|
10044
9194
|
visibleTableHandle: visibleHandle,
|
|
10045
|
-
defaultFilters
|
|
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);
|
|
10111
|
-
};
|
|
10112
|
-
}
|
|
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))
|
|
9195
|
+
defaultFilters
|
|
10196
9196
|
};
|
|
10197
9197
|
}
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
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
|
-
})
|
|
9198
|
+
function getAllLabelColumns(resultPool) {
|
|
9199
|
+
return new PColumnCollection().addAxisLabelProvider(resultPool).addColumnProvider(resultPool).getColumns({
|
|
9200
|
+
name: PColumnName.Label,
|
|
9201
|
+
axes: [{}]
|
|
9202
|
+
}, {
|
|
9203
|
+
dontWaitAllData: true,
|
|
9204
|
+
overrideLabelAnnotation: false
|
|
10254
9205
|
});
|
|
10255
9206
|
}
|
|
10256
9207
|
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -10353,38 +9304,7 @@
|
|
|
10353
9304
|
if (ctx.data.inputAnchor === void 0) return void 0;
|
|
10354
9305
|
const ownCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
|
|
10355
9306
|
if (ownCols === void 0) return void 0;
|
|
10356
|
-
|
|
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
|
-
});
|
|
9307
|
+
return createPlDataTableV2(ctx, ownCols.filter((c) => c.spec.axesSpec.length === 1), ctx.data.tableState);
|
|
10388
9308
|
}).outputWithStatus("propertiesPfHandle", (ctx) => {
|
|
10389
9309
|
const allPCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
|
|
10390
9310
|
if (allPCols === void 0) return void 0;
|