@platforma-open/milaboratories.sequence-embeddings 1.2.0 → 1.3.0

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/AGENTS.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/author_marker.d.ts
1
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/author_marker.d.ts
2
2
  //#region src/author_marker.d.ts
3
3
  /** Structure to help resolve conflicts if multiple participants writes to
4
4
  * the same state */
@@ -1100,7 +1100,7 @@ declare const ErrorLike: ZodUnion<[ZodType<StandardErrorLike, ZodTypeDef, Standa
1100
1100
  type ErrorLike = TypeOf<typeof ErrorLike>;
1101
1101
  /** Converts everything into ErrorLike. */
1102
1102
  //#endregion
1103
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/common_types.d.ts
1103
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/common_types.d.ts
1104
1104
  type OutputWithStatus<T> = {
1105
1105
  ok: true;
1106
1106
  value: T;
@@ -1113,7 +1113,7 @@ type OutputWithStatus<T> = {
1113
1113
  /** Base type for block outputs */
1114
1114
  type BlockOutputsBase = Record<string, OutputWithStatus<unknown>>;
1115
1115
  //#endregion
1116
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/navigation.d.ts
1116
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/navigation.d.ts
1117
1117
  /**
1118
1118
  * Part of the block state, representing current navigation information
1119
1119
  * (i.e. currently selected section)
@@ -1122,7 +1122,7 @@ type NavigationState<Href extends `/${string}` = `/${string}`> = {
1122
1122
  readonly href: Href;
1123
1123
  };
1124
1124
  //#endregion
1125
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/json.d.ts
1125
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/json.d.ts
1126
1126
  //#region src/json.d.ts
1127
1127
  type JsonPrimitive = string | number | boolean | null;
1128
1128
  type JsonValue = JsonPrimitive | JsonValue[] | {
@@ -1133,8 +1133,11 @@ type JsonCompatible<T> = unknown extends T ? unknown : [T] extends [JsonValue] ?
1133
1133
  type StringifiedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {
1134
1134
  __json_stringified: T;
1135
1135
  };
1136
+ type CanonicalizedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {
1137
+ __json_canonicalized: T;
1138
+ };
1136
1139
  //#endregion
1137
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/block_state.d.ts
1140
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/block_state.d.ts
1138
1141
  //#region src/block_state.d.ts
1139
1142
  /**
1140
1143
  * @template Args sets type of block arguments passed to the workflow
@@ -1160,12 +1163,12 @@ type BlockStateV3<_Data = unknown, Outputs extends BlockOutputsBase = BlockOutpu
1160
1163
  readonly author: AuthorMarker | undefined;
1161
1164
  }; //#endregion
1162
1165
  //#endregion
1163
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/branding.d.ts
1166
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/branding.d.ts
1164
1167
  //#region src/branding.d.ts
1165
1168
  type Brand<B, K extends string = "__pl_model_brand__"> = { [key in K]: B };
1166
1169
  type Branded$1<T, B, K extends string = "__pl_model_brand__"> = T & Brand<B, K>; //#endregion
1167
1170
  //#endregion
1168
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/dialog/index.d.ts
1171
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/dialog/index.d.ts
1169
1172
  //#region src/dialog/index.d.ts
1170
1173
  /**
1171
1174
  * File filter passed to the native save dialog. Matches Electron's
@@ -1198,7 +1201,7 @@ interface DialogService {
1198
1201
  showSaveDialog(options: ShowSaveDialogOptions): Promise<ShowSaveDialogResult>;
1199
1202
  } //#endregion
1200
1203
  //#endregion
1201
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/pool_entry.d.ts
1204
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/pool_entry.d.ts
1202
1205
  //#region src/pool_entry.d.ts
1203
1206
  interface PoolEntry<K extends string = string, R extends {} = {}> extends Disposable {
1204
1207
  /** Resource key, calculated using provided `calculateParamsKey` function */
@@ -1217,7 +1220,7 @@ interface PoolEntry<K extends string = string, R extends {} = {}> extends Dispos
1217
1220
  * unless `keep()` is called to transfer ownership to the caller.
1218
1221
  */
1219
1222
  //#endregion
1220
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/table_common.d.ts
1223
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/table_common.d.ts
1221
1224
  //#region src/drivers/pframe/table_common.d.ts
1222
1225
  type PTableColumnSpecAxis = {
1223
1226
  type: "axis";
@@ -1226,7 +1229,13 @@ type PTableColumnSpecAxis = {
1226
1229
  };
1227
1230
  type PTableColumnSpecColumn = {
1228
1231
  type: "column";
1229
- id: PObjectId;
1232
+ /**
1233
+ * Leaf column id as it appears in the SpecQuery — may be a rich
1234
+ * {@link ColumnUniversalId} (Discovered / Overridden / Filtered) or a bare
1235
+ * {@link PObjectId}. The host resolver strips to bare via `extractPObjectId`
1236
+ * before physical lookup.
1237
+ */
1238
+ id: ColumnUniversalId;
1230
1239
  spec: PColumnSpec;
1231
1240
  };
1232
1241
  /** Unified spec object for axes and columns */
@@ -1236,13 +1245,13 @@ type PTableColumnIdAxis = {
1236
1245
  id: AxisId;
1237
1246
  };
1238
1247
  type PTableColumnIdColumn = {
1239
- type: "column";
1240
- id: PObjectId;
1248
+ type: "column"; /** @see PTableColumnSpecColumn.id */
1249
+ id: ColumnUniversalId;
1241
1250
  };
1242
1251
  /** Unified PTable column identifier */
1243
1252
  type PTableColumnId = PTableColumnIdAxis | PTableColumnIdColumn;
1244
1253
  //#endregion
1245
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_types.d.ts
1254
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_types.d.ts
1246
1255
  //#region src/drivers/pframe/data_types.d.ts
1247
1256
  type PVectorDataInt = Int32Array;
1248
1257
  type PVectorDataLong = BigInt64Array;
@@ -1313,7 +1322,7 @@ interface ExportPTableOptions {
1313
1322
  columnIndices: number[];
1314
1323
  } //#endregion
1315
1324
  //#endregion
1316
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_info.d.ts
1325
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_info.d.ts
1317
1326
  //#region src/drivers/pframe/data_info.d.ts
1318
1327
  /**
1319
1328
  * Represents a JavaScript representation of a value in a PColumn. Can be null, a number, or a string.
@@ -1406,7 +1415,46 @@ type PColumnValues = PColumnValuesEntry[];
1406
1415
  * Entry-based representation of JsonDataInfo
1407
1416
  */
1408
1417
  //#endregion
1409
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/query/query_common.d.ts
1418
+ //#region ../node_modules/.pnpm/@milaboratories+helpers@1.14.4/node_modules/@milaboratories/helpers/dist/types/brand.d.ts
1419
+ //#region src/types/brand.d.ts
1420
+ /**
1421
+ * Phantom-property brand. The key is a plain string literal rather than a
1422
+ * `unique symbol` so the resulting type stays fully nameable across packages.
1423
+ *
1424
+ * A `unique symbol` key forces TS, when forced to expand `Branded<T, B>` into
1425
+ * its structural form (e.g. inside `Record<BrandedUnion, V>` index signatures
1426
+ * during dts emit), to write out `typeof __brand` — a value-level reference
1427
+ * to the symbol. If the symbol's declaring module isn't reachable from the
1428
+ * compilation root, dts emit fails with TS4023 ("cannot be named"). Using a
1429
+ * string key sidesteps this entirely: `{ __brand: B }` is a plain structural
1430
+ * type, nameable from anywhere.
1431
+ *
1432
+ * Phantom keys provide compile-time discrimination only — two different brand
1433
+ * tags `B1 ≠ B2` make `Branded<T, B1>` and `Branded<T, B2>` mutually
1434
+ * incompatible regardless of whether the key is a symbol or a string.
1435
+ */
1436
+ type Branded<T, B> = T & {
1437
+ readonly __brand: B;
1438
+ };
1439
+ //#endregion
1440
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/overridden.d.ts
1441
+ //#region src/drivers/pframe/spec/overridden.d.ts
1442
+ type SpecOverrides = Pick<PColumnSpec, "domain" | "contextDomain" | "annotations"> & {
1443
+ axesSpec?: AxisPatches;
1444
+ };
1445
+ /**
1446
+ * `source` can reference a leaf or a Filtered/Discovered id, but never another
1447
+ * Overridden id — there is no `Overridden<Overridden<...>>`. Repeated overrides
1448
+ * merge at the outer wrapper via {@link mergeSpecOverrides}.
1449
+ */
1450
+ interface ColumnOverriddenKey {
1451
+ __isOverridden: true;
1452
+ source: Exclude<ColumnUniversalId, ColumnOverriddenId>;
1453
+ specOverrides: SpecOverrides;
1454
+ }
1455
+ type ColumnOverriddenId = Branded<CanonicalizedJson<ColumnOverriddenKey>, "ColumnOverriddenId">;
1456
+ //#endregion
1457
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/query/query_common.d.ts
1410
1458
  //#region src/drivers/pframe/query/query_common.d.ts
1411
1459
  /**
1412
1460
  * Structural type information for a single column: the axis value types (in
@@ -2428,895 +2476,970 @@ interface QueryTransformColumns<Q, E, SO> {
2428
2476
  mode: TransformColumnsMode;
2429
2477
  /** Derived columns to compute (at least one). */
2430
2478
  columns: [TransformColumnEntry<E, SO>, ...TransformColumnEntry<E, SO>[]];
2479
+ }
2480
+ /**
2481
+ * Spec-override query operation — client-side-only structural node.
2482
+ *
2483
+ * Overlays a {@link SpecOverrides} patch on top of the inner query's spec.
2484
+ * Carries no topological change — it is collapsed at the host boundary
2485
+ * (`resolvePColumn`) before the query reaches pframe-engine. The engine
2486
+ * never sees this node.
2487
+ *
2488
+ * Emitted by `ColumnOverriddenRecipe.getQuery()`; the only currently
2489
+ * supported shape is `specOverride{ input: <plain column ref>, override }`
2490
+ * (i.e. `Overridden<Lazy>`). More complex projections under Overridden are
2491
+ * a future engine work item.
2492
+ *
2493
+ * @template Q - Input query type
2494
+ * @template SO - Spec override type
2495
+ */
2496
+ interface QuerySpecOverride<Q, SO> {
2497
+ type: "specOverride";
2498
+ /** Input query whose spec is to be overridden. */
2499
+ input: Q;
2500
+ /** Spec override patch to overlay on the inner spec. */
2501
+ override: SO;
2431
2502
  } //#endregion
2432
2503
  //#endregion
2433
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/query/query_spec.d.ts
2434
- //#region src/drivers/pframe/query/query_spec.d.ts
2504
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/query/query_data.d.ts
2505
+ //#region src/drivers/pframe/query/query_data.d.ts
2435
2506
  /**
2436
- * Join entry for spec-layer queries — the base join entry extended with
2437
- * per-axis domain constraints. Absent `qualifications` is equivalent to `[]`.
2507
+ * Column identifier with type specification.
2438
2508
  *
2439
- * @example
2440
- * {
2441
- * entry: querySpec,
2442
- * qualifications: [{ axis: { name: 'sample' }, contextDomain: { ... } }]
2443
- * }
2509
+ * Pairs a column ID with its full type specification (axes and column types).
2510
+ * Used in data layer to carry type information alongside column references.
2444
2511
  */
2445
- type SpecQueryJoinEntry<C = PObjectId> = QueryJoinEntry<SpecQuery<C>> & {
2446
- qualifications?: {
2447
- /** Axis to qualify. */axis: SingleAxisSelector; /** Additional domain constraints for this axis. */
2448
- contextDomain: Domain;
2449
- }[];
2512
+ type ColumnIdAndTypeSpec = {
2513
+ /** Unique identifier of the column */id: PObjectId; /** Type specification defining the axes and the single column value type */
2514
+ spec: ColumnTypeSpec;
2450
2515
  };
2516
+ /**
2517
+ * Join entry for data layer queries.
2518
+ *
2519
+ * Extends the base join entry with axes mapping information.
2520
+ * The mapping specifies how axes from this entry align with the joined result.
2521
+ *
2522
+ * @example
2523
+ * // Join entry with axes mapping [0, 2] means:
2524
+ * // - This entry's axis 0 maps to result axis 0
2525
+ * // - This entry's axis 1 maps to result axis 2
2526
+ * { entry: queryData, axesMapping: [0, 2] }
2527
+ */
2528
+ interface DataQueryJoinEntry extends QueryJoinEntry<DataQuery> {
2529
+ /** Maps this entry's axes to the result axes by index */
2530
+ axesMapping: number[];
2531
+ }
2451
2532
  /** @see QueryColumn */
2452
- type SpecQueryColumn<C = PObjectId> = QueryColumn<C>;
2533
+ type DataQueryColumn = QueryColumn;
2453
2534
  /** @see QueryInlineColumn */
2454
- type SpecQueryInlineColumn = QueryInlineColumn<PColumnIdAndSpec>;
2535
+ type DataQueryInlineColumn = QueryInlineColumn<ColumnIdAndTypeSpec>;
2455
2536
  /** @see QuerySparseToDenseColumn */
2456
- type SpecQuerySparseToDenseColumn<C = PObjectId> = QuerySparseToDenseColumn<C, SingleAxisSelector, PColumnIdAndSpec>;
2537
+ type DataQuerySparseToDenseColumn = QuerySparseToDenseColumn<PObjectId, number, ColumnIdAndTypeSpec>;
2457
2538
  /** @see QuerySymmetricJoin */
2458
- type SpecQuerySymmetricJoin<C = PObjectId> = QuerySymmetricJoin<SpecQueryJoinEntry<C>>;
2539
+ type DataQuerySymmetricJoin = QuerySymmetricJoin<DataQueryJoinEntry>;
2459
2540
  /** @see QueryOuterJoin */
2460
- type SpecQueryOuterJoin<C = PObjectId> = QueryOuterJoin<SpecQueryJoinEntry<C>>;
2541
+ type DataQueryOuterJoin = QueryOuterJoin<DataQueryJoinEntry>;
2461
2542
  /**
2462
- * Linker side of a spec-layer linker-join.
2543
+ * Linker side of a data-layer linker-join.
2463
2544
  *
2464
- * At the spec layer the linker is just a column reference — integration artifacts
2465
- * (axes mapping, one-side indices) are derived during spec→data conversion.
2545
+ * Carries the linker column id along with integration-derived artifacts needed
2546
+ * for execution:
2547
+ * - `axesMapping` — how the linker's axes map into the joined result
2548
+ * - `oneSideAxesIndices` — which axis indices in the joined result to project out
2466
2549
  */
2467
- type SpecQueryLinkerJoinLinker<C = PObjectId> = {
2468
- /** Linker column reference. */column: C;
2550
+ type DataQueryLinkerJoinLinker = {
2551
+ /** Linker column reference. */column: PObjectId; /** Linker's axes mapped into the joined result. */
2552
+ axesMapping: number[]; /** Axis indices (in the joined result) to project out — the linker's one-side axes. */
2553
+ oneSideAxesIndices: number[];
2469
2554
  };
2470
2555
  /** @see QueryLinkerJoin */
2471
- type SpecQueryLinkerJoin<C = PObjectId> = QueryLinkerJoin<SpecQueryLinkerJoinLinker<C>, SpecQueryJoinEntry<C>>;
2556
+ type DataQueryLinkerJoin = QueryLinkerJoin<DataQueryLinkerJoinLinker, DataQueryJoinEntry>;
2472
2557
  /** @see QuerySliceAxes */
2473
- type SpecQuerySliceAxes<C = PObjectId> = QuerySliceAxes<SpecQuery<C>, SingleAxisSelector>;
2558
+ type DataQuerySliceAxes = QuerySliceAxes<DataQuery, number>;
2474
2559
  /** @see QuerySort */
2475
- type SpecQuerySort<C = PObjectId> = QuerySort<SpecQuery<C>, SpecQueryExpression>;
2560
+ type DataQuerySort = QuerySort<DataQuery, DataQueryExpression>;
2476
2561
  /** @see QueryFilter */
2477
- type SpecQueryFilter<C = PObjectId> = QueryFilter<SpecQuery<C>, SpecQueryBooleanExpression>;
2562
+ type DataQueryFilter = QueryFilter<DataQuery, DataQueryBooleanExpression>;
2478
2563
  /** @see QueryTransformColumns */
2479
- type SpecQueryTransformColumns<C = PObjectId> = QueryTransformColumns<SpecQuery<C>, SpecQueryExpression, PColumnIdAndSpec>;
2564
+ type DataQueryTransformColumns = QueryTransformColumns<DataQuery, DataQueryExpression, ColumnIdAndTypeSpec>;
2480
2565
  /**
2481
- * Union of all spec layer query types.
2482
- *
2483
- * The spec layer operates with named selectors and column IDs,
2484
- * making it suitable for user-facing query construction and validation.
2566
+ * Union of all data layer query types.
2485
2567
  *
2486
- * @template C - Column reference type. Defaults to PObjectId (ID-only).
2487
- * Can be parameterized with richer types (e.g., PColumn<Data>) to carry
2488
- * full column data directly in the query tree.
2568
+ * The data layer operates with numeric indices for axes and columns,
2569
+ * making it suitable for runtime query execution and optimization.
2489
2570
  *
2490
2571
  * Includes:
2491
2572
  * - Leaf nodes: column, inlineColumn, sparseToDenseColumn
2492
2573
  * - Join operations: innerJoin, fullJoin, outerJoin, linkerJoin
2493
2574
  * - Transformations: sliceAxes, sort, filter, transformColumns
2494
2575
  */
2495
- type SpecQuery<C = PObjectId> = SpecQueryColumn<C> | SpecQueryInlineColumn | SpecQuerySparseToDenseColumn<C> | SpecQuerySymmetricJoin<C> | SpecQueryOuterJoin<C> | SpecQueryLinkerJoin<C> | SpecQuerySliceAxes<C> | SpecQuerySort<C> | SpecQueryFilter<C> | SpecQueryTransformColumns<C>;
2576
+ type DataQuery = DataQueryColumn | DataQueryInlineColumn | DataQuerySparseToDenseColumn | DataQuerySymmetricJoin | DataQueryOuterJoin | DataQueryLinkerJoin | DataQuerySliceAxes | DataQuerySort | DataQueryFilter | DataQueryTransformColumns;
2496
2577
  /** @see ExprAxisRef */
2497
- type SpecExprAxisRef = ExprAxisRef<SingleAxisSelector>;
2578
+ type DataExprAxisRef = ExprAxisRef<number>;
2498
2579
  /** @see ExprColumnRef */
2499
- type SpecExprColumnRef = ExprColumnRef<PObjectId>;
2500
- type SpecQueryExpression = SpecExprColumnRef | SpecExprAxisRef | ExprConstant | ExprNumericBinary<SpecQueryExpression> | ExprNumericComparison<SpecQueryExpression> | ExprNumericUnary<SpecQueryExpression> | ExprStringEquals<SpecQueryExpression> | ExprStringContains<SpecQueryExpression> | ExprStringRegex<SpecQueryExpression> | ExprStringContainsFuzzy<SpecQueryExpression> | ExprIsNull<SpecQueryExpression> | ExprFillNull<SpecQueryExpression> | ExprLogicalUnary<SpecQueryExpression> | ExprLogicalVariadic<SpecQueryExpression> | ExprIsIn<SpecQueryExpression, string> | ExprIsIn<SpecQueryExpression, number> | ExprCast<SpecQueryExpression> | ExprConditional<SpecQueryExpression> | ExprRanking<SpecQueryExpression, SingleAxisSelector, PObjectId>;
2501
- type SpecQueryBooleanExpression = InferBooleanExpressionUnion<SpecQueryExpression>; //#endregion
2580
+ type DataExprColumnRef = ExprColumnRef<number>;
2581
+ type DataQueryExpression = DataExprColumnRef | DataExprAxisRef | ExprConstant | ExprNumericBinary<DataQueryExpression> | ExprNumericComparison<DataQueryExpression> | ExprNumericUnary<DataQueryExpression> | ExprStringEquals<DataQueryExpression> | ExprStringContains<DataQueryExpression> | ExprStringRegex<DataQueryExpression> | ExprStringContainsFuzzy<DataQueryExpression> | ExprIsNull<DataQueryExpression> | ExprFillNull<DataQueryExpression> | ExprLogicalUnary<DataQueryExpression> | ExprLogicalVariadic<DataQueryExpression> | ExprIsIn<DataQueryExpression, string> | ExprIsIn<DataQueryExpression, number> | ExprCast<DataQueryExpression> | ExprConditional<DataQueryExpression> | ExprRanking<DataQueryExpression, number, number>;
2582
+ type DataQueryBooleanExpression = InferBooleanExpressionUnion<DataQueryExpression>; //#endregion
2502
2583
  //#endregion
2503
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/table_calculate.d.ts
2504
- //#region src/drivers/pframe/table_calculate.d.ts
2505
- /** Defines a terminal column node in the join request tree */
2506
- interface ColumnJoinEntry<Col> {
2507
- /** Node type discriminator */
2508
- readonly type: "column";
2509
- /** Local column */
2510
- readonly column: Col;
2584
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec_driver.d.ts
2585
+ //#region src/drivers/pframe/spec_driver.d.ts
2586
+ /** Matches a string value either exactly or by regex pattern */
2587
+ type StringMatcher = {
2588
+ type: "exact";
2589
+ value: string;
2590
+ } | {
2591
+ type: "regex";
2592
+ value: string;
2593
+ };
2594
+ /** Map of key to array of string matchers (OR-ed per key, AND-ed across keys) */
2595
+ type MatcherMap = Record<string, StringMatcher[]>;
2596
+ /** Selector for matching axes by various criteria */
2597
+ interface MultiAxisSelector {
2598
+ /** Match any of the axis types listed here */
2599
+ readonly type?: AxisValueType[];
2600
+ /** Match any of the axis names listed here */
2601
+ readonly name?: StringMatcher[];
2602
+ /** Match requires all the domains listed here */
2603
+ readonly domain?: MatcherMap;
2604
+ /** Match requires all the context domains listed here */
2605
+ readonly contextDomain?: MatcherMap;
2606
+ /** Match requires all the annotations listed here */
2607
+ readonly annotations?: MatcherMap;
2511
2608
  }
2512
- /**
2513
- * Axis filter slicing target axis from column axes.
2514
- * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).
2515
- * */
2516
- interface ConstantAxisFilter {
2517
- /** Filter type discriminator */
2518
- readonly type: "constant";
2519
- /** Index of axis to slice (zero-based) */
2520
- readonly axisIndex: number;
2521
- /** Equality filter reference value, see {@link SingleValueEqualPredicate} */
2522
- readonly constant: string | number;
2609
+ /** Column selector for discover columns request, matching columns by various criteria.
2610
+ * Multiple selectors are OR-ed: a column matches if it satisfies any selector. */
2611
+ interface MultiColumnSelector {
2612
+ /** Match any of the value types listed here */
2613
+ readonly type?: ColumnValueType[];
2614
+ /** Match any of the names listed here */
2615
+ readonly name?: StringMatcher[];
2616
+ /** Match requires all the domains listed here */
2617
+ readonly domain?: MatcherMap;
2618
+ /** Match requires all the context domains listed here */
2619
+ readonly contextDomain?: MatcherMap;
2620
+ /** Match requires all the annotations listed here */
2621
+ readonly annotations?: MatcherMap;
2622
+ /** Match any of the axis selectors listed here */
2623
+ readonly axes?: MultiAxisSelector[];
2624
+ /** When true (default), allows matching if only a subset of axes match */
2625
+ readonly partialAxesMatch?: boolean;
2523
2626
  }
2524
- /** Defines a terminal column node in the join request tree */
2525
- interface SlicedColumnJoinEntry<Col> {
2526
- /** Node type discriminator */
2527
- readonly type: "slicedColumn";
2528
- /** Local column */
2529
- readonly column: Col;
2530
- /** New column id */
2531
- readonly newId: PObjectId;
2532
- /** Non-empty list of axis filters */
2533
- readonly axisFilters: ConstantAxisFilter[];
2627
+ /** Qualifications needed for both query (already-integrated) columns and the hit column. */
2628
+ interface ColumnAxesWithQualifications {
2629
+ /** Already integrated (query) columns with their qualifications. */
2630
+ axesSpec: AxisSpec[];
2631
+ /** Qualifications for each already integrated (query) column. */
2632
+ qualifications: AxisQualification[];
2534
2633
  }
2535
- interface ArtificialColumnJoinEntry<Col> {
2536
- /** Node type discriminator */
2537
- readonly type: "artificialColumn";
2538
- /** Column definition */
2539
- readonly column: Col;
2540
- /** New column id */
2541
- readonly newId: PObjectId;
2542
- /** Indices of axes to pick from the column (zero-based) */
2543
- readonly axesIndices: number[];
2634
+ /** Fine-grained constraints controlling axes matching and qualification behavior */
2635
+ interface DiscoverColumnsConstraints {
2636
+ /** Allow source (query) axes that have no match in the hit column */
2637
+ allowFloatingSourceAxes: boolean;
2638
+ /** Allow hit column axes that have no match in the source (query) */
2639
+ allowFloatingHitAxes: boolean;
2640
+ /** Allow source (query) axes to be qualified (contextDomain extended) */
2641
+ allowSourceQualifications: boolean;
2642
+ /** Allow hit column axes to be qualified (contextDomain extended) */
2643
+ allowHitQualifications: boolean;
2544
2644
  }
2545
- /** Defines a terminal column node in the join request tree */
2546
- interface InlineColumnJoinEntry {
2547
- /** Node type discriminator */
2548
- readonly type: "inlineColumn";
2549
- /** Column definition */
2550
- readonly column: PColumn<PColumnValues>;
2645
+ /** Request for discovering columns compatible with a given axes integration */
2646
+ interface DiscoverColumnsRequest {
2647
+ /** Include columns matching these selectors (OR-ed); empty or omitted matches all columns */
2648
+ includeColumns?: MultiColumnSelector[];
2649
+ /** Exclude columns matching these selectors (OR-ed); applied after include filter */
2650
+ excludeColumns?: MultiColumnSelector[];
2651
+ /** Already integrated axes with qualifications */
2652
+ axes: ColumnAxesWithQualifications[];
2653
+ /** Maximum number of hops allowed between provided axes integration and returned hits (0 = direct only) */
2654
+ maxHops?: number;
2655
+ /** Constraints controlling axes matching and qualification behavior */
2656
+ constraints: DiscoverColumnsConstraints;
2551
2657
  }
2552
- /**
2553
- * Defines a join request tree node that will output only records present in
2554
- * all child nodes ({@link entries}).
2555
- * */
2556
- interface InnerJoin<Col> {
2557
- /** Node type discriminator */
2558
- readonly type: "inner";
2559
- /** Child nodes to be inner joined */
2560
- readonly entries: JoinEntry<Col>[];
2658
+ /** Linker step: traversal through a linker column */
2659
+ interface DiscoverColumnsLinkerStep {
2660
+ type: "linker";
2661
+ /** The linker column traversed in this step */
2662
+ linker: PColumnIdAndSpec;
2561
2663
  }
2562
2664
  /**
2563
- * Defines a join request tree node that will output all records present at
2564
- * least in one of the child nodes ({@link entries}), values for those PColumns
2565
- * that lack corresponding combinations of axis values will be null.
2566
- * */
2567
- interface FullJoin<Col> {
2568
- /** Node type discriminator */
2569
- readonly type: "full";
2570
- /** Child nodes to be fully outer joined */
2571
- readonly entries: JoinEntry<Col>[];
2665
+ * Filter step: intersects the current subquery with a filter column on shared
2666
+ * axes. Filter columns carry `pl7.app/isSubset: "true"` with axes dataset
2667
+ * axes, so the inner-join narrows the key space to rows where the filter is
2668
+ * present.
2669
+ */
2670
+ interface DiscoverColumnsFilterStep {
2671
+ type: "filter";
2672
+ /** The filter column applied in this step */
2673
+ filter: PColumnIdAndSpec;
2572
2674
  }
2675
+ /** A step traversed during path-based column discovery. Discriminated by `type`. */
2676
+ type DiscoverColumnsStepInfo = DiscoverColumnsLinkerStep | DiscoverColumnsFilterStep;
2573
2677
  /**
2574
- * Defines a join request tree node that will output all records present in
2575
- * {@link primary} child node, and records from the {@link secondary} nodes will
2576
- * be added to the output only if present, values for those PColumns from the
2577
- * {@link secondary} list, that lack corresponding combinations of axis values
2578
- * will be null.
2678
+ * Input to `buildQuery`: a terminal column plus an ordered
2679
+ * path of wrapping steps (linker hops, filter joins). Produces a
2680
+ * {@link SpecQueryJoinEntry} ready to be plugged into an
2681
+ * `innerJoin`/`fullJoin`/`outerJoin` entry list.
2579
2682
  *
2580
- * This node can be thought as a chain of SQL LEFT JOIN operations starting from
2581
- * the {@link primary} node and adding {@link secondary} nodes one by one.
2582
- * */
2583
- interface OuterJoin<Col> {
2584
- /** Node type discriminator */
2585
- readonly type: "outer";
2586
- /** Primes the join operation. Left part of LEFT JOIN. */
2587
- readonly primary: JoinEntry<Col>;
2588
- /** Driven nodes, giving their values only if primary node have corresponding
2589
- * nodes. Right parts of LEFT JOIN chain. */
2590
- readonly secondary: JoinEntry<Col>[];
2591
- }
2592
- /**
2593
- * Base type of all join request tree nodes. Join request tree allows to combine
2594
- * information from multiple PColumns into a PTable. Correlation between records
2595
- * is performed by looking for records with the same values in common axis between
2596
- * the PColumns. Common axis are those axis which have equal {@link AxisId} derived
2597
- * from the columns axes spec.
2598
- * */
2599
- type JoinEntry<Col> = ColumnJoinEntry<Col> | SlicedColumnJoinEntry<Col> | ArtificialColumnJoinEntry<Col> | InlineColumnJoinEntry | InnerJoin<Col> | FullJoin<Col> | OuterJoin<Col>;
2600
- /** Container representing whole data stored in specific PTable column. */
2601
- interface FullPTableColumnData {
2602
- /** Unified spec */
2603
- readonly spec: PTableColumnSpec;
2604
- /** Data */
2605
- readonly data: PTableVector;
2606
- }
2607
- interface SingleValueIsNAPredicate {
2608
- /** Comparison operator */
2609
- readonly operator: "IsNA";
2610
- }
2611
- interface SingleValueEqualPredicate {
2612
- /** Comparison operator */
2613
- readonly operator: "Equal";
2614
- /** Reference value, NA values will not match */
2615
- readonly reference: string | number;
2616
- }
2617
- interface SingleValueInSetPredicate {
2618
- /** Comparison operator */
2619
- readonly operator: "InSet";
2620
- /** Reference values, NA values will not match */
2621
- readonly references: (string | number)[];
2622
- }
2623
- interface SingleValueIEqualPredicate {
2624
- /** Comparison operator (case insensitive) */
2625
- readonly operator: "IEqual";
2626
- /** Reference value, NA values will not match */
2627
- readonly reference: string;
2628
- }
2629
- interface SingleValueLessPredicate {
2630
- /** Comparison operator */
2631
- readonly operator: "Less";
2632
- /** Reference value, NA values will not match */
2633
- readonly reference: string | number;
2634
- }
2635
- interface SingleValueLessOrEqualPredicate {
2636
- /** Comparison operator */
2637
- readonly operator: "LessOrEqual";
2638
- /** Reference value, NA values will not match */
2639
- readonly reference: string | number;
2683
+ * Path ordering: `path[0]` is outermost (first applied), `path[N-1]` is
2684
+ * closest to `column`. Omit or pass `[]` for a direct column with no
2685
+ * wrapping.
2686
+ *
2687
+ * Columns are referenced by id — specs are resolved later at
2688
+ * `evaluateQuery` against the registered specs of the PFrame, so the
2689
+ * caller cannot disagree with the frame about spec content.
2690
+ *
2691
+ * Qualifications annotate the resulting outermost entry; they do not
2692
+ * propagate into the inner query.
2693
+ */
2694
+ type BuildQueryInput = {
2695
+ /** Shape version marker — bumped only on breaking structural changes. */readonly version: "v1"; /** Terminal column id — the column actually returning data. */
2696
+ readonly column: PObjectId; /** Ordered path from source integration to `column`. Outermost first. */
2697
+ readonly path?: DiscoverColumnsStepInfo[]; /** Axis qualifications attached to the resulting join entry. */
2698
+ readonly qualifications?: AxisQualification[];
2699
+ };
2700
+ /** Qualifications info for a discover columns response mapping variant */
2701
+ interface DiscoverColumnsResponseQualifications {
2702
+ /** Qualifications for each query (already-integrated) column set */
2703
+ forQueries: AxisQualification[][];
2704
+ /** Qualifications for the hit column */
2705
+ forHit: AxisQualification[];
2640
2706
  }
2641
- interface SingleValueGreaterPredicate {
2642
- /** Comparison operator */
2643
- readonly operator: "Greater";
2644
- /** Reference value, NA values will not match */
2645
- readonly reference: string | number;
2707
+ /** A single mapping variant describing how a hit column can be integrated */
2708
+ interface DiscoverColumnsMappingVariant {
2709
+ /** Full qualifications needed for integration */
2710
+ qualifications: DiscoverColumnsResponseQualifications;
2711
+ /** Distinctive (minimal) qualifications needed for integration */
2712
+ distinctiveQualifications: DiscoverColumnsResponseQualifications;
2646
2713
  }
2647
- interface SingleValueGreaterOrEqualPredicate {
2648
- /** Comparison operator */
2649
- readonly operator: "GreaterOrEqual";
2650
- /** Reference value, NA values will not match */
2651
- readonly reference: string | number;
2714
+ /** A single hit in the discover columns response */
2715
+ interface DiscoverColumnsResponseHit {
2716
+ /** The column that was found compatible */
2717
+ hit: PColumnIdAndSpec;
2718
+ /** Linker steps traversed to reach this hit; empty for direct matches */
2719
+ path: DiscoverColumnsStepInfo[];
2720
+ /** Possible ways to integrate this column with the existing set */
2721
+ mappingVariants: DiscoverColumnsMappingVariant[];
2652
2722
  }
2653
- interface SingleValueStringContainsPredicate {
2654
- /** Comparison operator */
2655
- readonly operator: "StringContains";
2656
- /** Reference substring, NA values are skipped */
2657
- readonly substring: string;
2723
+ /** Response from discover columns */
2724
+ interface DiscoverColumnsResponse {
2725
+ /** Columns that could be integrated and possible ways to integrate them */
2726
+ hits: DiscoverColumnsResponseHit[];
2658
2727
  }
2659
- interface SingleValueStringIContainsPredicate {
2660
- /** Comparison operator (case insensitive) */
2661
- readonly operator: "StringIContains";
2662
- /** Reference substring, NA values are skipped */
2663
- readonly substring: string;
2728
+ /** Request for deleting an entry from a given axes integration */
2729
+ interface DeleteColumnRequest {
2730
+ /** Already integrated axes with qualifications */
2731
+ axes: ColumnAxesWithQualifications[];
2732
+ /** Zero based index of the entry to be deleted */
2733
+ delete: number;
2664
2734
  }
2665
- interface SingleValueMatchesPredicate {
2666
- /** Comparison operator */
2667
- readonly operator: "Matches";
2668
- /** Regular expression, NA values are skipped */
2669
- readonly regex: string;
2735
+ /** Response from delete column */
2736
+ interface DeleteColumnResponse {
2737
+ axes: ColumnAxesWithQualifications[];
2670
2738
  }
2671
- interface SingleValueStringContainsFuzzyPredicate {
2672
- /** Comparison operator */
2673
- readonly operator: "StringContainsFuzzy";
2674
- /** Reference value, NA values are skipped */
2675
- readonly reference: string;
2739
+ /** Response from evaluating a query against a PFrame. */
2740
+ type EvaluateQueryResponse = {
2676
2741
  /**
2677
- * Integer specifying the upper bound of edit distance between
2678
- * reference and actual value.
2679
- * When {@link substitutionsOnly} is not defined or set to false
2680
- * Levenshtein distance is used (substitutions and indels)
2681
- * @see https://en.wikipedia.org/wiki/Levenshtein_distance
2682
- * When {@link substitutionsOnly} is set to true
2683
- * Hamming distance is used (substitutions only)
2684
- * @see https://en.wikipedia.org/wiki/Hamming_distance
2742
+ * The table specification describing the structure of the query result,
2743
+ * including all axes and columns that will be present in the output.
2685
2744
  */
2686
- readonly maxEdits: number;
2687
- /** Changes the type of edit distance in {@link maxEdits} */
2688
- readonly substitutionsOnly?: boolean;
2745
+ tableSpec: PTableColumnSpec[];
2689
2746
  /**
2690
- * Some character in {@link reference} that will match any
2691
- * single character in searched text.
2747
+ * The data layer query representation with numeric indices,
2748
+ * suitable for execution by the data processing engine.
2692
2749
  */
2693
- readonly wildcard?: string;
2694
- }
2695
- interface SingleValueStringIContainsFuzzyPredicate {
2696
- /** Comparison operator (case insensitive) */
2697
- readonly operator: "StringIContainsFuzzy";
2698
- /** Reference value, NA values are skipped */
2699
- readonly reference: string;
2750
+ dataQuery: DataQuery;
2751
+ };
2752
+ /** Handle to a spec-only PFrame (no data, synchronous operations). */
2753
+ type SpecFrameHandle = Branded<string, "SpecFrameHandle">;
2754
+ /**
2755
+ * Synchronous driver for spec-level PFrame operations.
2756
+ *
2757
+ * Unlike the async PFrameDriver (which works with data), this driver
2758
+ * operates on column specifications only. All methods are synchronous
2759
+ * because the underlying WASM PFrame computes results immediately.
2760
+ */
2761
+ interface PFrameSpecDriver {
2762
+ /** Create a spec-only PFrame from column specs. Returns a pool entry with handle and unref. */
2763
+ createSpecFrame(specs: Record<string, PColumnSpec>): PoolEntry<SpecFrameHandle>;
2764
+ /** List all columns currently registered in the frame. */
2765
+ listColumns(handle: SpecFrameHandle): PColumnIdAndSpec[];
2766
+ /** Discover columns compatible with given axes integration. */
2767
+ discoverColumns(handle: SpecFrameHandle, request: DiscoverColumnsRequest): DiscoverColumnsResponse;
2768
+ /** Delete an entry from a given axes integration */
2769
+ deleteColumn(handle: SpecFrameHandle, request: DeleteColumnRequest): DeleteColumnResponse;
2770
+ /** Evaluates a query specification against this PFrame */
2771
+ evaluateQuery(handle: SpecFrameHandle, request: SpecQuery): EvaluateQueryResponse;
2700
2772
  /**
2701
- * Integer specifying the upper bound of edit distance between
2702
- * reference and actual value.
2703
- * When {@link substitutionsOnly} is not defined or set to false
2704
- * Levenshtein distance is used (substitutions and indels)
2705
- * @see https://en.wikipedia.org/wiki/Levenshtein_distance
2706
- * When {@link substitutionsOnly} is set to true
2707
- * Hamming distance is used (substitutions only)
2708
- * @see https://en.wikipedia.org/wiki/Hamming_distance
2773
+ * Assembles a {@link SpecQueryJoinEntry} from a terminal column plus an
2774
+ * ordered path of wrapping steps (linker hops, filter joins).
2775
+ *
2776
+ * Pure over its input — no frame handle is needed. Column ids are resolved
2777
+ * later at {@link evaluateQuery} against the registered specs.
2709
2778
  */
2710
- readonly maxEdits: number;
2711
- /** Changes the type of edit distance in {@link maxEdits} */
2712
- readonly substitutionsOnly?: boolean;
2779
+ buildQuery(input: BuildQueryInput): SpecQueryJoinEntry;
2780
+ /** Expand index-based parentAxes in AxesSpec to resolved AxisId parents in AxesId. */
2781
+ expandAxes(spec: AxesSpec): AxesId;
2782
+ /** Collapse resolved AxisId parents back to index-based parentAxes in AxesSpec. */
2783
+ collapseAxes(ids: AxesId): AxesSpec;
2784
+ /** Find the index of an axis matching the given selector. Returns -1 if not found. */
2785
+ findAxis(spec: AxesSpec, selector: SingleAxisSelector): number;
2786
+ /** Find the flat index of a table column matching the given selector. Returns -1 if not found. */
2787
+ findTableColumn(tableSpec: PTableColumnSpec[], selector: PTableColumnId): number;
2713
2788
  /**
2714
- * Some character in {@link reference} that will match any
2715
- * single character in searched text.
2789
+ * Upgrades selector-based legacy record filters into index-based data-layer
2790
+ * boolean expressions, resolved against the provided unified table spec
2791
+ * (axes first, then columns).
2716
2792
  */
2717
- readonly wildcard?: string;
2718
- }
2719
- interface SingleValueNotPredicateV2 {
2720
- /** Comparison operator */
2721
- readonly operator: "Not";
2722
- /** Operand to negate */
2723
- readonly operand: SingleValuePredicateV2;
2724
- }
2725
- interface SingleValueAndPredicateV2 {
2726
- /** Comparison operator */
2727
- readonly operator: "And";
2728
- /** Operands to combine */
2729
- readonly operands: SingleValuePredicateV2[];
2793
+ rewriteLegacyFilters(request: {
2794
+ tableSpec: PTableColumnSpec[];
2795
+ filters: PTableRecordFilter[];
2796
+ }): DataQueryBooleanExpression[];
2797
+ } //#endregion
2798
+ //#endregion
2799
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/selectors.d.ts
2800
+ /** Single axis selector */
2801
+ interface SingleAxisSelector {
2802
+ /** Axis name (required) */
2803
+ name: string;
2804
+ /** Axis type (optional) */
2805
+ type?: AxisValueType;
2806
+ /** Domain requirements (optional) */
2807
+ domain?: Domain;
2808
+ /** Context-domain requirements (optional) */
2809
+ contextDomain?: Domain;
2810
+ /** Parent axes requirements (optional) */
2811
+ parentAxes?: SingleAxisSelector[];
2730
2812
  }
2731
- interface SingleValueOrPredicateV2 {
2732
- /** Comparison operator */
2733
- readonly operator: "Or";
2734
- /** Operands to combine */
2735
- readonly operands: SingleValuePredicateV2[];
2813
+ /** Qualification applied to a single axis to make it compatible during integration. */
2814
+ interface AxisQualification {
2815
+ /** Axis selector identifying which axis is qualified. */
2816
+ readonly axis: SingleAxisSelector;
2817
+ /** Additional context domain entries applied to the axis. */
2818
+ readonly contextDomain: Record<string, string>;
2736
2819
  }
2737
- /** Filtering predicate for a single axis or column value */
2738
- type SingleValuePredicateV2 = SingleValueIsNAPredicate | SingleValueEqualPredicate | SingleValueInSetPredicate | SingleValueLessPredicate | SingleValueLessOrEqualPredicate | SingleValueGreaterPredicate | SingleValueGreaterOrEqualPredicate | SingleValueStringContainsPredicate | SingleValueMatchesPredicate | SingleValueStringContainsFuzzyPredicate | SingleValueNotPredicateV2 | SingleValueAndPredicateV2 | SingleValueOrPredicateV2 | SingleValueIEqualPredicate | SingleValueStringIContainsPredicate | SingleValueStringIContainsFuzzyPredicate;
2739
2820
  /**
2740
- * Filter PTable records based on specific axis or column value. If this is an
2741
- * axis value filter and the axis is part of a partitioning key in some of the
2742
- * source PColumns, the filter will be pushed down to those columns, so only
2743
- * specific partitions will be retrieved from the remote storage.
2744
- * */
2745
- interface PTableRecordSingleValueFilterV2 {
2746
- /** Filter type discriminator */
2747
- readonly type: "bySingleColumnV2";
2748
- /** Target axis selector to examine values from */
2749
- readonly column: PTableColumnId;
2750
- /** Value predicate */
2751
- readonly predicate: SingleValuePredicateV2;
2752
- }
2753
- /** Generic PTable records filter */
2754
- type PTableRecordFilter = PTableRecordSingleValueFilterV2;
2755
- /** Sorting parameters for a PTable. */
2756
- type PTableSorting = {
2757
- /** Unified column identifier */readonly column: PTableColumnId; /** Sorting order */
2758
- readonly ascending: boolean; /** Sorting in respect to NA and absent values */
2759
- readonly naAndAbsentAreLeastValues: boolean;
2760
- };
2761
- /** Information required to instantiate a PTable. */
2762
- interface PTableDef<Col> {
2763
- /** Join tree to populate the PTable */
2764
- readonly src: JoinEntry<Col>;
2765
- /** Partition filters */
2766
- readonly partitionFilters: PTableRecordFilter[];
2767
- /** Record filters */
2768
- readonly filters: PTableRecordFilter[];
2769
- /** Table sorting */
2770
- readonly sorting: PTableSorting[];
2771
- }
2772
- /** Information required to instantiate a PTable (V2, query-based). */
2773
- interface PTableDefV2<Col> {
2774
- /** Pre-built query spec describing joins, filters and sorting */
2775
- readonly query: SpecQuery<Col>;
2776
- }
2777
- /** Request to create and retrieve entirety of data of PTable. */
2778
- type CalculateTableDataRequest<Col> = {
2779
- /** Join tree to populate the PTable */readonly src: JoinEntry<Col>; /** Record filters */
2780
- readonly filters: PTableRecordFilter[]; /** Table sorting */
2781
- readonly sorting: PTableSorting[];
2782
- };
2783
- /** Response for {@link CalculateTableDataRequest} */
2784
- type CalculateTableDataResponse = FullPTableColumnData[];
2785
- //#endregion
2786
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/ref.d.ts
2787
- //#region src/ref.d.ts
2788
- declare const PlRef: ZodReadonly<ZodObject<{
2789
- __isRef: ZodLiteral<true>;
2790
- blockId: ZodString;
2791
- name: ZodString;
2792
- requireEnrichments: ZodOptional<ZodLiteral<true>>;
2793
- }, "strip", ZodTypeAny, {
2794
- __isRef: true;
2795
- blockId: string;
2796
- name: string;
2797
- requireEnrichments?: true | undefined;
2798
- }, {
2799
- __isRef: true;
2800
- blockId: string;
2801
- name: string;
2802
- requireEnrichments?: true | undefined;
2803
- }>>;
2804
- type PlRef = TypeOf<typeof PlRef>;
2805
- /** @deprecated use {@link PlRef} */
2821
+ * Reference to an axis by its numerical index within the anchor column's axes array
2822
+ * Format: [anchorId, axisIndex]
2823
+ */
2806
2824
  //#endregion
2807
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/pool/spec.d.ts
2808
- //#region src/pool/spec.d.ts
2809
- /** Any object exported into the result pool by the block always have spec attached to it */
2810
- type PObjectSpec = {
2811
- /** PObject kind discriminator */readonly kind: string; /** Name is common part of PObject identity */
2812
- readonly name: string; /** Domain is a set of key-value pairs that can be used to identify the object */
2813
- readonly domain?: Record<string, string>;
2814
- /** Context domain provides additional axis/column identity that is matched
2815
- * by kinship rules (subset/superset/overlap) rather than exact equality */
2816
- readonly contextDomain?: Record<string, string>; /** Additional information attached to the object */
2817
- readonly annotations?: Record<string, string>;
2818
- };
2819
- /** Stable PObject id */
2820
- type PObjectId = Branded$1<string, "PColumnId">;
2825
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/query/query_spec.d.ts
2826
+ //#region src/drivers/pframe/query/query_spec.d.ts
2821
2827
  /**
2822
- * Full PObject representation.
2828
+ * Join entry for spec-layer queries — the base join entry extended with
2829
+ * per-axis domain constraints. Absent `qualifications` is equivalent to `[]`.
2823
2830
  *
2824
- * @template Data type of the object referencing or describing the "data" part of the PObject
2825
- * */
2826
- interface PObject<Data> {
2827
- /** Fully rendered PObjects are assigned a stable identifier. */
2828
- readonly id: PObjectId;
2829
- /** PObject spec, allowing it to be found among other PObjects */
2830
- readonly spec: PObjectSpec;
2831
- /** A handle to data object */
2832
- readonly data: Data;
2833
- }
2834
- //#endregion
2835
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.d.ts
2836
- //#region src/drivers/pframe/spec/spec.d.ts
2837
- declare const ValueType: {
2838
- readonly Int: "Int";
2839
- readonly Long: "Long";
2840
- readonly Float: "Float";
2841
- readonly Double: "Double";
2842
- readonly String: "String";
2843
- readonly Bytes: "Bytes";
2844
- };
2845
- type AxisValueType = Extract<ValueType, "Int" | "Long" | "String">;
2846
- type ColumnValueType = ValueType;
2847
- /** PFrame columns and axes within them may store one of these types. */
2848
- type ValueType = (typeof ValueType)[keyof typeof ValueType];
2849
- type Metadata = Record<string, string>;
2850
- declare const Domain: {
2851
- readonly Alphabet: "pl7.app/alphabet";
2852
- readonly BlockId: "pl7.app/blockId";
2853
- readonly VDJ: {
2854
- readonly Clustering: {
2855
- readonly BlockId: "pl7.app/vdj/clustering/blockId";
2856
- };
2857
- readonly ScClonotypeChain: {
2858
- readonly Index: "pl7.app/vdj/scClonotypeChain/index";
2859
- };
2860
- };
2831
+ * @example
2832
+ * {
2833
+ * entry: querySpec,
2834
+ * qualifications: [{ axis: { name: 'sample' }, contextDomain: { ... } }]
2835
+ * }
2836
+ */
2837
+ type SpecQueryJoinEntry<C = ColumnUniversalId> = QueryJoinEntry<SpecQuery<C>> & {
2838
+ qualifications?: readonly {
2839
+ /** Axis to qualify. */axis: SingleAxisSelector; /** Additional domain constraints for this axis. */
2840
+ contextDomain: Domain;
2841
+ }[];
2861
2842
  };
2862
- type Domain = Metadata & Partial<{
2863
- [Domain.Alphabet]: "nucleotide" | "aminoacid" | (string & {});
2864
- [Domain.BlockId]: string;
2865
- [Domain.VDJ.ScClonotypeChain.Index]: "primary" | "secondary" | (string & {});
2866
- }>;
2843
+ /** @see QueryColumn */
2844
+ type SpecQueryColumn<C = ColumnUniversalId> = QueryColumn<C>;
2845
+ /** @see QueryInlineColumn */
2846
+ type SpecQueryInlineColumn = QueryInlineColumn<PColumnIdAndSpec>;
2847
+ /** @see QuerySparseToDenseColumn */
2848
+ type SpecQuerySparseToDenseColumn<C = ColumnUniversalId> = QuerySparseToDenseColumn<C, SingleAxisSelector, PColumnIdAndSpec>;
2849
+ /** @see QuerySymmetricJoin */
2850
+ type SpecQuerySymmetricJoin<C = ColumnUniversalId> = QuerySymmetricJoin<SpecQueryJoinEntry<C>>;
2851
+ /** @see QueryOuterJoin */
2852
+ type SpecQueryOuterJoin<C = ColumnUniversalId> = QueryOuterJoin<SpecQueryJoinEntry<C>>;
2853
+ /** @see QueryLinkerJoin */
2854
+ type SpecQueryLinkerJoin<C = ColumnUniversalId> = QueryLinkerJoin<SpecQuery<C>, SpecQueryJoinEntry<C>>;
2855
+ /** @see QuerySliceAxes */
2856
+ type SpecQuerySliceAxes<C = ColumnUniversalId> = QuerySliceAxes<SpecQuery<C>, SingleAxisSelector>;
2857
+ /** @see QuerySort */
2858
+ type SpecQuerySort<C = ColumnUniversalId> = QuerySort<SpecQuery<C>, SpecQueryExpression>;
2859
+ /** @see QueryFilter */
2860
+ type SpecQueryFilter<C = ColumnUniversalId> = QueryFilter<SpecQuery<C>, SpecQueryBooleanExpression>;
2861
+ /** @see QueryTransformColumns */
2862
+ type SpecQueryTransformColumns<C = ColumnUniversalId> = QueryTransformColumns<SpecQuery<C>, SpecQueryExpression, PColumnIdAndSpec>;
2867
2863
  /**
2868
- * Specification of an individual axis.
2869
- *
2870
- * Each axis is a part of a composite key that addresses data inside the PColumn.
2864
+ * Client-side spec-override node collapsed at the host boundary, never
2865
+ * sent to pframe-engine.
2871
2866
  *
2872
- * Each record inside a PColumn is addressed by a unique tuple of values set for
2873
- * all the axes specified in the column spec.
2867
+ * @see QuerySpecOverride
2874
2868
  */
2875
- type AxisSpec = {
2876
- /** Type of the axis value. Should not use non-key types like float or double. */readonly type: AxisValueType; /** Name of the axis */
2877
- readonly name: string;
2878
- /** Adds auxiliary information to the axis name, type and parents to form a
2879
- * unique identifier */
2880
- readonly domain?: Record<string, string>;
2881
- /** Context domain provides additional axis identity that is matched
2882
- * by kinship rules (subset/superset/overlap) rather than exact equality */
2883
- readonly contextDomain?: Record<string, string>;
2884
- /** Any additional information attached to the axis that does not affect its
2885
- * identifier */
2886
- readonly annotations?: Record<string, string>;
2887
- /**
2888
- * Parent axes provide contextual grouping for the axis in question, establishing
2889
- * a hierarchy where the current axis is dependent on one or more axes for its
2890
- * full definition and meaning. For instance, in a data structure where each
2891
- * "container" axis may contain multiple "item" axes, the `item` axis would
2892
- * list the index of the `container` axis in this field to denote its dependency.
2893
- *
2894
- * This means that the identity or significance of the `item` axis is only
2895
- * interpretable when combined with its parent `container` axis. An `item` axis
2896
- * index by itself may be non-unique and only gains uniqueness within the context
2897
- * of its parent `container`. Therefore, the `parentAxes` field is essential for
2898
- * mapping these relationships and ensuring data coherence across nested or
2899
- * multi-level data models.
2900
- *
2901
- * A list of zero-based indices of parent axes in the overall axes specification
2902
- * from the column spec. Each index corresponds to the position of a parent axis
2903
- * in the list that defines the structure of the data model.
2904
- */
2905
- readonly parentAxes?: number[];
2906
- };
2907
- /** Parents are specs, not indexes; normalized axis can be used considering its parents independently from column */
2908
- /** Common type representing spec for all the axes in a column */
2909
- type AxesSpec = AxisSpec[];
2869
+ type SpecQuerySpecOverride<C = ColumnUniversalId> = QuerySpecOverride<SpecQuery<C>, SpecOverrides>;
2910
2870
  /**
2911
- * Full column specification including all axes specs and specs of the column
2912
- * itself.
2913
- *
2914
- * A PColumn in its essence represents a mapping from a fixed size, explicitly
2915
- * typed tuple to an explicitly typed value.
2871
+ * Union of all spec layer query types.
2916
2872
  *
2917
- * (axis1Value1, axis2Value1, ...) -> columnValue
2873
+ * The spec layer operates with named selectors and column IDs,
2874
+ * making it suitable for user-facing query construction and validation.
2918
2875
  *
2919
- * Each element in tuple correspond to the axis having the same index in axesSpec.
2920
- */
2921
- type PUniversalColumnSpec = PObjectSpec & {
2922
- /** Defines specific type of BObject, the most generic type of unit of
2923
- * information in Platforma Project. */
2924
- readonly kind: "PColumn"; /** Type of column values */
2925
- readonly valueType: string; /** Column name */
2926
- readonly name: string;
2927
- /** Adds auxiliary information to the axis name, type and parents to form a
2928
- * unique identifier */
2929
- readonly domain?: Record<string, string>;
2930
- /** Context domain provides additional column identity that is matched
2931
- * by kinship rules (subset/superset/overlap) rather than exact equality */
2932
- readonly contextDomain?: Record<string, string>;
2933
- /** Any additional information attached to the column that does not affect its
2934
- * identifier */
2935
- readonly annotations?: Record<string, string>; /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */
2936
- readonly parentAxes?: number[]; /** Axes specifications */
2937
- readonly axesSpec: AxesSpec;
2938
- };
2939
- /**
2940
- * Specification of a data column.
2876
+ * @template C - Column reference type. Defaults to PObjectId (ID-only).
2877
+ * Can be parameterized with richer types (e.g., PColumn<Data>) to carry
2878
+ * full column data directly in the query tree.
2941
2879
  *
2942
- * Data column is a specialized type of PColumn that stores only simple values (strings and numbers)
2943
- * addressed by multiple keys. This is in contrast to other PColumn variants that can store more complex
2944
- * values like files or other abstract data types. Data columns are optimized for storing and processing
2945
- * basic tabular data.
2880
+ * Includes:
2881
+ * - Leaf nodes: column, inlineColumn, sparseToDenseColumn
2882
+ * - Join operations: innerJoin, fullJoin, outerJoin, linkerJoin
2883
+ * - Transformations: sliceAxes, sort, filter, transformColumns
2884
+ * - Client-side overlays: specOverride (collapsed before reaching the engine)
2946
2885
  */
2947
- type PDataColumnSpec = PUniversalColumnSpec & {
2948
- /** Type of column values */readonly valueType: ValueType;
2949
- };
2950
- type PColumnSpec = PDataColumnSpec;
2951
- /** Unique PColumnSpec identifier */
2952
- interface PColumn<Data> extends PObject<Data> {
2953
- /** PColumn spec, allowing it to be found among other PObjects */
2954
- readonly spec: PColumnSpec;
2955
- }
2956
- /** Columns in a PFrame also have internal identifier, this object represents
2957
- * combination of specs and such id */
2958
- interface PColumnIdAndSpec {
2959
- /** Internal column id within the PFrame */
2960
- readonly columnId: PObjectId;
2961
- /** Column spec */
2962
- readonly spec: PColumnSpec;
2886
+ type SpecQuery<C = ColumnUniversalId> = SpecQueryColumn<C> | SpecQueryInlineColumn | SpecQuerySparseToDenseColumn<C> | SpecQuerySymmetricJoin<C> | SpecQueryOuterJoin<C> | SpecQueryLinkerJoin<C> | SpecQuerySliceAxes<C> | SpecQuerySort<C> | SpecQueryFilter<C> | SpecQueryTransformColumns<C> | SpecQuerySpecOverride<C>;
2887
+ /** @see ExprAxisRef */
2888
+ type SpecExprAxisRef = ExprAxisRef<SingleAxisSelector>;
2889
+ /** @see ExprColumnRef */
2890
+ type SpecExprColumnRef = ExprColumnRef<ColumnUniversalId>;
2891
+ type SpecQueryExpression = SpecExprColumnRef | SpecExprAxisRef | ExprConstant | ExprNumericBinary<SpecQueryExpression> | ExprNumericComparison<SpecQueryExpression> | ExprNumericUnary<SpecQueryExpression> | ExprStringEquals<SpecQueryExpression> | ExprStringContains<SpecQueryExpression> | ExprStringRegex<SpecQueryExpression> | ExprStringContainsFuzzy<SpecQueryExpression> | ExprIsNull<SpecQueryExpression> | ExprFillNull<SpecQueryExpression> | ExprLogicalUnary<SpecQueryExpression> | ExprLogicalVariadic<SpecQueryExpression> | ExprIsIn<SpecQueryExpression, string> | ExprIsIn<SpecQueryExpression, number> | ExprCast<SpecQueryExpression> | ExprConditional<SpecQueryExpression> | ExprRanking<SpecQueryExpression, SingleAxisSelector, PObjectId>;
2892
+ type SpecQueryBooleanExpression = InferBooleanExpressionUnion<SpecQueryExpression>; //#endregion
2893
+ //#endregion
2894
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/table_calculate.d.ts
2895
+ //#region src/drivers/pframe/table_calculate.d.ts
2896
+ /** Defines a terminal column node in the join request tree */
2897
+ interface ColumnJoinEntry<Col> {
2898
+ /** Node type discriminator */
2899
+ readonly type: "column";
2900
+ /** Local column */
2901
+ readonly column: Col;
2963
2902
  }
2964
- /** Get column id and spec from a column */
2965
- interface AxisId {
2966
- /** Type of the axis or column value. For an axis should not use non-key
2967
- * types like float or double. */
2968
- readonly type: AxisValueType;
2969
- /** Name of the axis or column */
2970
- readonly name: string;
2971
- /** Adds auxiliary information to the axis or column name and type to form a
2972
- * unique identifier */
2973
- readonly domain?: Record<string, string>;
2974
- /** Context domain provides additional axis identity that is matched
2975
- * by kinship rules (subset/superset/overlap) rather than exact equality */
2976
- readonly contextDomain?: Record<string, string>;
2903
+ /**
2904
+ * Axis filter slicing target axis from column axes.
2905
+ * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).
2906
+ * */
2907
+ interface ConstantAxisFilter {
2908
+ /** Filter type discriminator */
2909
+ readonly type: "constant";
2910
+ /** Index of axis to slice (zero-based) */
2911
+ readonly axisIndex: number;
2912
+ /** Equality filter reference value, see {@link SingleValueEqualPredicate} */
2913
+ readonly constant: string | number;
2914
+ }
2915
+ /** Defines a terminal column node in the join request tree */
2916
+ interface SlicedColumnJoinEntry<Col> {
2917
+ /** Node type discriminator */
2918
+ readonly type: "slicedColumn";
2919
+ /** Local column */
2920
+ readonly column: Col;
2921
+ /** New column id */
2922
+ readonly newId: PObjectId;
2923
+ /** Non-empty list of axis filters */
2924
+ readonly axisFilters: ConstantAxisFilter[];
2925
+ }
2926
+ interface ArtificialColumnJoinEntry<Col> {
2927
+ /** Node type discriminator */
2928
+ readonly type: "artificialColumn";
2929
+ /** Column definition */
2930
+ readonly column: Col;
2931
+ /** New column id */
2932
+ readonly newId: PObjectId;
2933
+ /** Indices of axes to pick from the column (zero-based) */
2934
+ readonly axesIndices: number[];
2935
+ }
2936
+ /** Defines a terminal column node in the join request tree */
2937
+ interface InlineColumnJoinEntry {
2938
+ /** Node type discriminator */
2939
+ readonly type: "inlineColumn";
2940
+ /** Column definition */
2941
+ readonly column: PColumn<PColumnValues>;
2977
2942
  }
2978
- /** Array of axis ids */
2979
- type AxesId = AxisId[];
2980
- /** Extracts axis ids from axis spec */
2981
- //#endregion
2982
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/query/query_data.d.ts
2983
- //#region src/drivers/pframe/query/query_data.d.ts
2984
2943
  /**
2985
- * Column identifier with type specification.
2986
- *
2987
- * Pairs a column ID with its full type specification (axes and column types).
2988
- * Used in data layer to carry type information alongside column references.
2989
- */
2990
- type ColumnIdAndTypeSpec = {
2991
- /** Unique identifier of the column */id: PObjectId; /** Type specification defining the axes and the single column value type */
2992
- spec: ColumnTypeSpec;
2993
- };
2944
+ * Defines a join request tree node that will output only records present in
2945
+ * all child nodes ({@link entries}).
2946
+ * */
2947
+ interface InnerJoin<Col> {
2948
+ /** Node type discriminator */
2949
+ readonly type: "inner";
2950
+ /** Child nodes to be inner joined */
2951
+ readonly entries: JoinEntry<Col>[];
2952
+ }
2994
2953
  /**
2995
- * Join entry for data layer queries.
2996
- *
2997
- * Extends the base join entry with axes mapping information.
2998
- * The mapping specifies how axes from this entry align with the joined result.
2999
- *
3000
- * @example
3001
- * // Join entry with axes mapping [0, 2] means:
3002
- * // - This entry's axis 0 maps to result axis 0
3003
- * // - This entry's axis 1 maps to result axis 2
3004
- * { entry: queryData, axesMapping: [0, 2] }
3005
- */
3006
- interface DataQueryJoinEntry extends QueryJoinEntry<DataQuery> {
3007
- /** Maps this entry's axes to the result axes by index */
3008
- axesMapping: number[];
2954
+ * Defines a join request tree node that will output all records present at
2955
+ * least in one of the child nodes ({@link entries}), values for those PColumns
2956
+ * that lack corresponding combinations of axis values will be null.
2957
+ * */
2958
+ interface FullJoin<Col> {
2959
+ /** Node type discriminator */
2960
+ readonly type: "full";
2961
+ /** Child nodes to be fully outer joined */
2962
+ readonly entries: JoinEntry<Col>[];
3009
2963
  }
3010
- /** @see QueryColumn */
3011
- type DataQueryColumn = QueryColumn;
3012
- /** @see QueryInlineColumn */
3013
- type DataQueryInlineColumn = QueryInlineColumn<ColumnIdAndTypeSpec>;
3014
- /** @see QuerySparseToDenseColumn */
3015
- type DataQuerySparseToDenseColumn = QuerySparseToDenseColumn<PObjectId, number, ColumnIdAndTypeSpec>;
3016
- /** @see QuerySymmetricJoin */
3017
- type DataQuerySymmetricJoin = QuerySymmetricJoin<DataQueryJoinEntry>;
3018
- /** @see QueryOuterJoin */
3019
- type DataQueryOuterJoin = QueryOuterJoin<DataQueryJoinEntry>;
3020
2964
  /**
3021
- * Linker side of a data-layer linker-join.
2965
+ * Defines a join request tree node that will output all records present in
2966
+ * {@link primary} child node, and records from the {@link secondary} nodes will
2967
+ * be added to the output only if present, values for those PColumns from the
2968
+ * {@link secondary} list, that lack corresponding combinations of axis values
2969
+ * will be null.
3022
2970
  *
3023
- * Carries the linker column id along with integration-derived artifacts needed
3024
- * for execution:
3025
- * - `axesMapping` — how the linker's axes map into the joined result
3026
- * - `oneSideAxesIndices` — which axis indices in the joined result to project out
3027
- */
3028
- type DataQueryLinkerJoinLinker = {
3029
- /** Linker column reference. */column: PObjectId; /** Linker's axes mapped into the joined result. */
3030
- axesMapping: number[]; /** Axis indices (in the joined result) to project out — the linker's one-side axes. */
3031
- oneSideAxesIndices: number[];
3032
- };
3033
- /** @see QueryLinkerJoin */
3034
- type DataQueryLinkerJoin = QueryLinkerJoin<DataQueryLinkerJoinLinker, DataQueryJoinEntry>;
3035
- /** @see QuerySliceAxes */
3036
- type DataQuerySliceAxes = QuerySliceAxes<DataQuery, number>;
3037
- /** @see QuerySort */
3038
- type DataQuerySort = QuerySort<DataQuery, DataQueryExpression>;
3039
- /** @see QueryFilter */
3040
- type DataQueryFilter = QueryFilter<DataQuery, DataQueryBooleanExpression>;
3041
- /** @see QueryTransformColumns */
3042
- type DataQueryTransformColumns = QueryTransformColumns<DataQuery, DataQueryExpression, ColumnIdAndTypeSpec>;
2971
+ * This node can be thought as a chain of SQL LEFT JOIN operations starting from
2972
+ * the {@link primary} node and adding {@link secondary} nodes one by one.
2973
+ * */
2974
+ interface OuterJoin<Col> {
2975
+ /** Node type discriminator */
2976
+ readonly type: "outer";
2977
+ /** Primes the join operation. Left part of LEFT JOIN. */
2978
+ readonly primary: JoinEntry<Col>;
2979
+ /** Driven nodes, giving their values only if primary node have corresponding
2980
+ * nodes. Right parts of LEFT JOIN chain. */
2981
+ readonly secondary: JoinEntry<Col>[];
2982
+ }
3043
2983
  /**
3044
- * Union of all data layer query types.
3045
- *
3046
- * The data layer operates with numeric indices for axes and columns,
3047
- * making it suitable for runtime query execution and optimization.
3048
- *
3049
- * Includes:
3050
- * - Leaf nodes: column, inlineColumn, sparseToDenseColumn
3051
- * - Join operations: innerJoin, fullJoin, outerJoin, linkerJoin
3052
- * - Transformations: sliceAxes, sort, filter, transformColumns
3053
- */
3054
- type DataQuery = DataQueryColumn | DataQueryInlineColumn | DataQuerySparseToDenseColumn | DataQuerySymmetricJoin | DataQueryOuterJoin | DataQueryLinkerJoin | DataQuerySliceAxes | DataQuerySort | DataQueryFilter | DataQueryTransformColumns;
3055
- /** @see ExprAxisRef */
3056
- type DataExprAxisRef = ExprAxisRef<number>;
3057
- /** @see ExprColumnRef */
3058
- type DataExprColumnRef = ExprColumnRef<number>;
3059
- type DataQueryExpression = DataExprColumnRef | DataExprAxisRef | ExprConstant | ExprNumericBinary<DataQueryExpression> | ExprNumericComparison<DataQueryExpression> | ExprNumericUnary<DataQueryExpression> | ExprStringEquals<DataQueryExpression> | ExprStringContains<DataQueryExpression> | ExprStringRegex<DataQueryExpression> | ExprStringContainsFuzzy<DataQueryExpression> | ExprIsNull<DataQueryExpression> | ExprFillNull<DataQueryExpression> | ExprLogicalUnary<DataQueryExpression> | ExprLogicalVariadic<DataQueryExpression> | ExprIsIn<DataQueryExpression, string> | ExprIsIn<DataQueryExpression, number> | ExprCast<DataQueryExpression> | ExprConditional<DataQueryExpression> | ExprRanking<DataQueryExpression, number, number>;
3060
- type DataQueryBooleanExpression = InferBooleanExpressionUnion<DataQueryExpression>; //#endregion
3061
- //#endregion
3062
- //#region ../node_modules/.pnpm/@milaboratories+helpers@1.14.2/node_modules/@milaboratories/helpers/dist/types/brand.d.ts
3063
- //#region src/types/brand.d.ts
3064
- declare const __brand: unique symbol;
3065
- type Branded<T, B> = T & {
3066
- readonly [__brand]: B;
3067
- };
3068
- //#endregion
3069
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec_driver.d.ts
3070
- //#region src/drivers/pframe/spec_driver.d.ts
3071
- /** Matches a string value either exactly or by regex pattern */
3072
- type StringMatcher = {
3073
- type: "exact";
3074
- value: string;
3075
- } | {
3076
- type: "regex";
3077
- value: string;
3078
- };
3079
- /** Map of key to array of string matchers (OR-ed per key, AND-ed across keys) */
3080
- type MatcherMap = Record<string, StringMatcher[]>;
3081
- /** Selector for matching axes by various criteria */
3082
- interface MultiAxisSelector {
3083
- /** Match any of the axis types listed here */
3084
- readonly type?: AxisValueType[];
3085
- /** Match any of the axis names listed here */
3086
- readonly name?: StringMatcher[];
3087
- /** Match requires all the domains listed here */
3088
- readonly domain?: MatcherMap;
3089
- /** Match requires all the context domains listed here */
3090
- readonly contextDomain?: MatcherMap;
3091
- /** Match requires all the annotations listed here */
3092
- readonly annotations?: MatcherMap;
2984
+ * Base type of all join request tree nodes. Join request tree allows to combine
2985
+ * information from multiple PColumns into a PTable. Correlation between records
2986
+ * is performed by looking for records with the same values in common axis between
2987
+ * the PColumns. Common axis are those axis which have equal {@link AxisId} derived
2988
+ * from the columns axes spec.
2989
+ * */
2990
+ type JoinEntry<Col> = ColumnJoinEntry<Col> | SlicedColumnJoinEntry<Col> | ArtificialColumnJoinEntry<Col> | InlineColumnJoinEntry | InnerJoin<Col> | FullJoin<Col> | OuterJoin<Col>;
2991
+ /** Container representing whole data stored in specific PTable column. */
2992
+ interface FullPTableColumnData {
2993
+ /** Unified spec */
2994
+ readonly spec: PTableColumnSpec;
2995
+ /** Data */
2996
+ readonly data: PTableVector;
3093
2997
  }
3094
- /** Column selector for discover columns request, matching columns by various criteria.
3095
- * Multiple selectors are OR-ed: a column matches if it satisfies any selector. */
3096
- interface MultiColumnSelector {
3097
- /** Match any of the value types listed here */
3098
- readonly type?: ColumnValueType[];
3099
- /** Match any of the names listed here */
3100
- readonly name?: StringMatcher[];
3101
- /** Match requires all the domains listed here */
3102
- readonly domain?: MatcherMap;
3103
- /** Match requires all the context domains listed here */
3104
- readonly contextDomain?: MatcherMap;
3105
- /** Match requires all the annotations listed here */
3106
- readonly annotations?: MatcherMap;
3107
- /** Match any of the axis selectors listed here */
3108
- readonly axes?: MultiAxisSelector[];
3109
- /** When true (default), allows matching if only a subset of axes match */
3110
- readonly partialAxesMatch?: boolean;
2998
+ interface SingleValueIsNAPredicate {
2999
+ /** Comparison operator */
3000
+ readonly operator: "IsNA";
3111
3001
  }
3112
- /** Qualifications needed for both query (already-integrated) columns and the hit column. */
3113
- interface ColumnAxesWithQualifications {
3114
- /** Already integrated (query) columns with their qualifications. */
3115
- axesSpec: AxisSpec[];
3116
- /** Qualifications for each already integrated (query) column. */
3117
- qualifications: AxisQualification[];
3002
+ interface SingleValueEqualPredicate {
3003
+ /** Comparison operator */
3004
+ readonly operator: "Equal";
3005
+ /** Reference value, NA values will not match */
3006
+ readonly reference: string | number;
3118
3007
  }
3119
- /** Fine-grained constraints controlling axes matching and qualification behavior */
3120
- interface DiscoverColumnsConstraints {
3121
- /** Allow source (query) axes that have no match in the hit column */
3122
- allowFloatingSourceAxes: boolean;
3123
- /** Allow hit column axes that have no match in the source (query) */
3124
- allowFloatingHitAxes: boolean;
3125
- /** Allow source (query) axes to be qualified (contextDomain extended) */
3126
- allowSourceQualifications: boolean;
3127
- /** Allow hit column axes to be qualified (contextDomain extended) */
3128
- allowHitQualifications: boolean;
3008
+ interface SingleValueInSetPredicate {
3009
+ /** Comparison operator */
3010
+ readonly operator: "InSet";
3011
+ /** Reference values, NA values will not match */
3012
+ readonly references: (string | number)[];
3129
3013
  }
3130
- /** Request for discovering columns compatible with a given axes integration */
3131
- interface DiscoverColumnsRequest {
3132
- /** Include columns matching these selectors (OR-ed); empty or omitted matches all columns */
3133
- includeColumns?: MultiColumnSelector[];
3134
- /** Exclude columns matching these selectors (OR-ed); applied after include filter */
3135
- excludeColumns?: MultiColumnSelector[];
3136
- /** Already integrated axes with qualifications */
3137
- axes: ColumnAxesWithQualifications[];
3138
- /** Maximum number of hops allowed between provided axes integration and returned hits (0 = direct only) */
3139
- maxHops?: number;
3140
- /** Constraints controlling axes matching and qualification behavior */
3141
- constraints: DiscoverColumnsConstraints;
3014
+ interface SingleValueIEqualPredicate {
3015
+ /** Comparison operator (case insensitive) */
3016
+ readonly operator: "IEqual";
3017
+ /** Reference value, NA values will not match */
3018
+ readonly reference: string;
3142
3019
  }
3143
- /** Linker step: traversal through a linker column */
3144
- interface DiscoverColumnsLinkerStep {
3145
- type: "linker";
3146
- /** The linker column traversed in this step */
3147
- linker: PColumnIdAndSpec;
3020
+ interface SingleValueLessPredicate {
3021
+ /** Comparison operator */
3022
+ readonly operator: "Less";
3023
+ /** Reference value, NA values will not match */
3024
+ readonly reference: string | number;
3025
+ }
3026
+ interface SingleValueLessOrEqualPredicate {
3027
+ /** Comparison operator */
3028
+ readonly operator: "LessOrEqual";
3029
+ /** Reference value, NA values will not match */
3030
+ readonly reference: string | number;
3031
+ }
3032
+ interface SingleValueGreaterPredicate {
3033
+ /** Comparison operator */
3034
+ readonly operator: "Greater";
3035
+ /** Reference value, NA values will not match */
3036
+ readonly reference: string | number;
3148
3037
  }
3038
+ interface SingleValueGreaterOrEqualPredicate {
3039
+ /** Comparison operator */
3040
+ readonly operator: "GreaterOrEqual";
3041
+ /** Reference value, NA values will not match */
3042
+ readonly reference: string | number;
3043
+ }
3044
+ interface SingleValueStringContainsPredicate {
3045
+ /** Comparison operator */
3046
+ readonly operator: "StringContains";
3047
+ /** Reference substring, NA values are skipped */
3048
+ readonly substring: string;
3049
+ }
3050
+ interface SingleValueStringIContainsPredicate {
3051
+ /** Comparison operator (case insensitive) */
3052
+ readonly operator: "StringIContains";
3053
+ /** Reference substring, NA values are skipped */
3054
+ readonly substring: string;
3055
+ }
3056
+ interface SingleValueMatchesPredicate {
3057
+ /** Comparison operator */
3058
+ readonly operator: "Matches";
3059
+ /** Regular expression, NA values are skipped */
3060
+ readonly regex: string;
3061
+ }
3062
+ interface SingleValueStringContainsFuzzyPredicate {
3063
+ /** Comparison operator */
3064
+ readonly operator: "StringContainsFuzzy";
3065
+ /** Reference value, NA values are skipped */
3066
+ readonly reference: string;
3067
+ /**
3068
+ * Integer specifying the upper bound of edit distance between
3069
+ * reference and actual value.
3070
+ * When {@link substitutionsOnly} is not defined or set to false
3071
+ * Levenshtein distance is used (substitutions and indels)
3072
+ * @see https://en.wikipedia.org/wiki/Levenshtein_distance
3073
+ * When {@link substitutionsOnly} is set to true
3074
+ * Hamming distance is used (substitutions only)
3075
+ * @see https://en.wikipedia.org/wiki/Hamming_distance
3076
+ */
3077
+ readonly maxEdits: number;
3078
+ /** Changes the type of edit distance in {@link maxEdits} */
3079
+ readonly substitutionsOnly?: boolean;
3080
+ /**
3081
+ * Some character in {@link reference} that will match any
3082
+ * single character in searched text.
3083
+ */
3084
+ readonly wildcard?: string;
3085
+ }
3086
+ interface SingleValueStringIContainsFuzzyPredicate {
3087
+ /** Comparison operator (case insensitive) */
3088
+ readonly operator: "StringIContainsFuzzy";
3089
+ /** Reference value, NA values are skipped */
3090
+ readonly reference: string;
3091
+ /**
3092
+ * Integer specifying the upper bound of edit distance between
3093
+ * reference and actual value.
3094
+ * When {@link substitutionsOnly} is not defined or set to false
3095
+ * Levenshtein distance is used (substitutions and indels)
3096
+ * @see https://en.wikipedia.org/wiki/Levenshtein_distance
3097
+ * When {@link substitutionsOnly} is set to true
3098
+ * Hamming distance is used (substitutions only)
3099
+ * @see https://en.wikipedia.org/wiki/Hamming_distance
3100
+ */
3101
+ readonly maxEdits: number;
3102
+ /** Changes the type of edit distance in {@link maxEdits} */
3103
+ readonly substitutionsOnly?: boolean;
3104
+ /**
3105
+ * Some character in {@link reference} that will match any
3106
+ * single character in searched text.
3107
+ */
3108
+ readonly wildcard?: string;
3109
+ }
3110
+ interface SingleValueNotPredicateV2 {
3111
+ /** Comparison operator */
3112
+ readonly operator: "Not";
3113
+ /** Operand to negate */
3114
+ readonly operand: SingleValuePredicateV2;
3115
+ }
3116
+ interface SingleValueAndPredicateV2 {
3117
+ /** Comparison operator */
3118
+ readonly operator: "And";
3119
+ /** Operands to combine */
3120
+ readonly operands: SingleValuePredicateV2[];
3121
+ }
3122
+ interface SingleValueOrPredicateV2 {
3123
+ /** Comparison operator */
3124
+ readonly operator: "Or";
3125
+ /** Operands to combine */
3126
+ readonly operands: SingleValuePredicateV2[];
3127
+ }
3128
+ /** Filtering predicate for a single axis or column value */
3129
+ type SingleValuePredicateV2 = SingleValueIsNAPredicate | SingleValueEqualPredicate | SingleValueInSetPredicate | SingleValueLessPredicate | SingleValueLessOrEqualPredicate | SingleValueGreaterPredicate | SingleValueGreaterOrEqualPredicate | SingleValueStringContainsPredicate | SingleValueMatchesPredicate | SingleValueStringContainsFuzzyPredicate | SingleValueNotPredicateV2 | SingleValueAndPredicateV2 | SingleValueOrPredicateV2 | SingleValueIEqualPredicate | SingleValueStringIContainsPredicate | SingleValueStringIContainsFuzzyPredicate;
3130
+ /**
3131
+ * Filter PTable records based on specific axis or column value. If this is an
3132
+ * axis value filter and the axis is part of a partitioning key in some of the
3133
+ * source PColumns, the filter will be pushed down to those columns, so only
3134
+ * specific partitions will be retrieved from the remote storage.
3135
+ * */
3136
+ interface PTableRecordSingleValueFilterV2 {
3137
+ /** Filter type discriminator */
3138
+ readonly type: "bySingleColumnV2";
3139
+ /** Target axis selector to examine values from */
3140
+ readonly column: PTableColumnId;
3141
+ /** Value predicate */
3142
+ readonly predicate: SingleValuePredicateV2;
3143
+ }
3144
+ /** Generic PTable records filter */
3145
+ type PTableRecordFilter = PTableRecordSingleValueFilterV2;
3146
+ /** Sorting parameters for a PTable. */
3147
+ type PTableSorting = {
3148
+ /** Unified column identifier */readonly column: PTableColumnId; /** Sorting order */
3149
+ readonly ascending: boolean; /** Sorting in respect to NA and absent values */
3150
+ readonly naAndAbsentAreLeastValues: boolean;
3151
+ };
3152
+ /** Information required to instantiate a PTable. */
3153
+ interface PTableDef<Col> {
3154
+ /** Join tree to populate the PTable */
3155
+ readonly src: JoinEntry<Col>;
3156
+ /** Partition filters */
3157
+ readonly partitionFilters: PTableRecordFilter[];
3158
+ /** Record filters */
3159
+ readonly filters: PTableRecordFilter[];
3160
+ /** Table sorting */
3161
+ readonly sorting: PTableSorting[];
3162
+ }
3163
+ /** Information required to instantiate a PTable (V2, query-based). */
3164
+ interface PTableDefV2<Col> {
3165
+ /** Pre-built query spec describing joins, filters and sorting */
3166
+ readonly query: SpecQuery<Col>;
3167
+ }
3168
+ /** Request to create and retrieve entirety of data of PTable. */
3169
+ type CalculateTableDataRequest<Col> = {
3170
+ /** Join tree to populate the PTable */readonly src: JoinEntry<Col>; /** Record filters */
3171
+ readonly filters: PTableRecordFilter[]; /** Table sorting */
3172
+ readonly sorting: PTableSorting[];
3173
+ };
3174
+ /** Response for {@link CalculateTableDataRequest} */
3175
+ type CalculateTableDataResponse = FullPTableColumnData[];
3176
+ //#endregion
3177
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/ref.d.ts
3178
+ //#region src/ref.d.ts
3179
+ declare const PlRef: ZodReadonly<ZodObject<{
3180
+ __isRef: ZodLiteral<true>;
3181
+ blockId: ZodString;
3182
+ name: ZodString;
3183
+ requireEnrichments: ZodOptional<ZodLiteral<true>>;
3184
+ }, "strip", ZodTypeAny, {
3185
+ __isRef: true;
3186
+ blockId: string;
3187
+ name: string;
3188
+ requireEnrichments?: true | undefined;
3189
+ }, {
3190
+ __isRef: true;
3191
+ blockId: string;
3192
+ name: string;
3193
+ requireEnrichments?: true | undefined;
3194
+ }>>;
3195
+ type PlRef = TypeOf<typeof PlRef>;
3196
+ /** @deprecated use {@link PlRef} */
3197
+ //#endregion
3198
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/pool/spec.d.ts
3199
+ //#region src/pool/spec.d.ts
3200
+ /** Any object exported into the result pool by the block always have spec attached to it */
3201
+ type PObjectSpec = {
3202
+ /** PObject kind discriminator */readonly kind: string; /** Name is common part of PObject identity */
3203
+ readonly name: string; /** Domain is a set of key-value pairs that can be used to identify the object */
3204
+ readonly domain?: Record<string, string>;
3205
+ /** Context domain provides additional axis/column identity that is matched
3206
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3207
+ readonly contextDomain?: Record<string, string>; /** Additional information attached to the object */
3208
+ readonly annotations?: Record<string, string>;
3209
+ };
3210
+ type LocalPObjectKey = {
3211
+ resolvePath: string[];
3212
+ name: string;
3213
+ };
3214
+ type LocalPObjectId = Branded<CanonicalizedJson<LocalPObjectKey>, "LocalPObjectId">;
3215
+ type GlobalPObjectKey = PlRef;
3216
+ type GlobalPObjectId = Branded<CanonicalizedJson<GlobalPObjectKey>, "GlobalPObjectId">;
3217
+ /** Stable PObject id */
3218
+ type PObjectId = LocalPObjectId | GlobalPObjectId;
3149
3219
  /**
3150
- * Filter step: intersects the current subquery with a filter column on shared
3151
- * axes. Filter columns carry `pl7.app/isSubset: "true"` with axes ⊆ dataset
3152
- * axes, so the inner-join narrows the key space to rows where the filter is
3153
- * present.
3154
- */
3155
- interface DiscoverColumnsFilterStep {
3156
- type: "filter";
3157
- /** The filter column applied in this step */
3158
- filter: PColumnIdAndSpec;
3220
+ * Full PObject representation.
3221
+ *
3222
+ * @template Data type of the object referencing or describing the "data" part of the PObject
3223
+ * */
3224
+ interface PObject<Data> {
3225
+ /** Fully rendered PObjects are assigned a stable identifier. */
3226
+ readonly id: PObjectId;
3227
+ /** PObject spec, allowing it to be found among other PObjects */
3228
+ readonly spec: PObjectSpec;
3229
+ /** A handle to data object */
3230
+ readonly data: Data;
3159
3231
  }
3160
- /** A step traversed during path-based column discovery. Discriminated by `type`. */
3161
- type DiscoverColumnsStepInfo = DiscoverColumnsLinkerStep | DiscoverColumnsFilterStep;
3232
+ //#endregion
3233
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.d.ts
3234
+ //#region src/drivers/pframe/spec/spec.d.ts
3235
+ declare const ValueType: {
3236
+ readonly Int: "Int";
3237
+ readonly Long: "Long";
3238
+ readonly Float: "Float";
3239
+ readonly Double: "Double";
3240
+ readonly String: "String";
3241
+ readonly Bytes: "Bytes";
3242
+ };
3243
+ type AxisValueType = Extract<ValueType, "Int" | "Long" | "String">;
3244
+ type ColumnValueType = ValueType;
3245
+ /** PFrame columns and axes within them may store one of these types. */
3246
+ type ValueType = (typeof ValueType)[keyof typeof ValueType];
3247
+ type Metadata = Record<string, string>;
3248
+ declare const Domain: {
3249
+ readonly Alphabet: "pl7.app/alphabet";
3250
+ readonly BlockId: "pl7.app/blockId";
3251
+ readonly VDJ: {
3252
+ readonly Clustering: {
3253
+ readonly BlockId: "pl7.app/vdj/clustering/blockId";
3254
+ };
3255
+ readonly ScClonotypeChain: {
3256
+ readonly Index: "pl7.app/vdj/scClonotypeChain/index";
3257
+ };
3258
+ };
3259
+ };
3260
+ type Domain = Metadata & Partial<{
3261
+ [Domain.Alphabet]: "nucleotide" | "aminoacid" | (string & {});
3262
+ [Domain.BlockId]: string;
3263
+ [Domain.VDJ.ScClonotypeChain.Index]: "primary" | "secondary" | (string & {});
3264
+ }>;
3162
3265
  /**
3163
- * Input to `buildQuery`: a terminal column plus an ordered
3164
- * path of wrapping steps (linker hops, filter joins). Produces a
3165
- * {@link SpecQueryJoinEntry} ready to be plugged into an
3166
- * `innerJoin`/`fullJoin`/`outerJoin` entry list.
3167
- *
3168
- * Path ordering: `path[0]` is outermost (first applied), `path[N-1]` is
3169
- * closest to `column`. Omit or pass `[]` for a direct column with no
3170
- * wrapping.
3266
+ * Specification of an individual axis.
3171
3267
  *
3172
- * Columns are referenced by id specs are resolved later at
3173
- * `evaluateQuery` against the registered specs of the PFrame, so the
3174
- * caller cannot disagree with the frame about spec content.
3268
+ * Each axis is a part of a composite key that addresses data inside the PColumn.
3175
3269
  *
3176
- * Qualifications annotate the resulting outermost entry; they do not
3177
- * propagate into the inner query.
3270
+ * Each record inside a PColumn is addressed by a unique tuple of values set for
3271
+ * all the axes specified in the column spec.
3178
3272
  */
3179
- type BuildQueryInput = {
3180
- /** Shape version marker bumped only on breaking structural changes. */readonly version: "v1"; /** Terminal column id — the column actually returning data. */
3181
- readonly column: PObjectId; /** Ordered path from source integration to `column`. Outermost first. */
3182
- readonly path?: DiscoverColumnsStepInfo[]; /** Axis qualifications attached to the resulting join entry. */
3183
- readonly qualifications?: AxisQualification[];
3184
- };
3185
- /** Qualifications info for a discover columns response mapping variant */
3186
- interface DiscoverColumnsResponseQualifications {
3187
- /** Qualifications for each query (already-integrated) column set */
3188
- forQueries: AxisQualification[][];
3189
- /** Qualifications for the hit column */
3190
- forHit: AxisQualification[];
3191
- }
3192
- /** A single mapping variant describing how a hit column can be integrated */
3193
- interface DiscoverColumnsMappingVariant {
3194
- /** Full qualifications needed for integration */
3195
- qualifications: DiscoverColumnsResponseQualifications;
3196
- /** Distinctive (minimal) qualifications needed for integration */
3197
- distinctiveQualifications: DiscoverColumnsResponseQualifications;
3198
- }
3199
- /** A single hit in the discover columns response */
3200
- interface DiscoverColumnsResponseHit {
3201
- /** The column that was found compatible */
3202
- hit: PColumnIdAndSpec;
3203
- /** Possible ways to integrate this column with the existing set */
3204
- mappingVariants: DiscoverColumnsMappingVariant[];
3205
- /** Linker steps traversed to reach this hit; empty for direct matches */
3206
- path: DiscoverColumnsStepInfo[];
3207
- }
3208
- /** Response from discover columns */
3209
- interface DiscoverColumnsResponse {
3210
- /** Columns that could be integrated and possible ways to integrate them */
3211
- hits: DiscoverColumnsResponseHit[];
3212
- }
3213
- /** Request for deleting an entry from a given axes integration */
3214
- interface DeleteColumnRequest {
3215
- /** Already integrated axes with qualifications */
3216
- axes: ColumnAxesWithQualifications[];
3217
- /** Zero based index of the entry to be deleted */
3218
- delete: number;
3219
- }
3220
- /** Response from delete column */
3221
- interface DeleteColumnResponse {
3222
- axes: ColumnAxesWithQualifications[];
3223
- }
3224
- /** Response from evaluating a query against a PFrame. */
3225
- type EvaluateQueryResponse = {
3226
- /**
3227
- * The table specification describing the structure of the query result,
3228
- * including all axes and columns that will be present in the output.
3229
- */
3230
- tableSpec: PTableColumnSpec[];
3273
+ type AxisSpec = {
3274
+ /** Type of the axis value. Should not use non-key types like float or double. */readonly type: AxisValueType; /** Name of the axis */
3275
+ readonly name: string;
3276
+ /** Adds auxiliary information to the axis name, type and parents to form a
3277
+ * unique identifier */
3278
+ readonly domain?: Record<string, string>;
3279
+ /** Context domain provides additional axis identity that is matched
3280
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3281
+ readonly contextDomain?: Record<string, string>;
3282
+ /** Any additional information attached to the axis that does not affect its
3283
+ * identifier */
3284
+ readonly annotations?: Record<string, string>;
3231
3285
  /**
3232
- * The data layer query representation with numeric indices,
3233
- * suitable for execution by the data processing engine.
3286
+ * Parent axes provide contextual grouping for the axis in question, establishing
3287
+ * a hierarchy where the current axis is dependent on one or more axes for its
3288
+ * full definition and meaning. For instance, in a data structure where each
3289
+ * "container" axis may contain multiple "item" axes, the `item` axis would
3290
+ * list the index of the `container` axis in this field to denote its dependency.
3291
+ *
3292
+ * This means that the identity or significance of the `item` axis is only
3293
+ * interpretable when combined with its parent `container` axis. An `item` axis
3294
+ * index by itself may be non-unique and only gains uniqueness within the context
3295
+ * of its parent `container`. Therefore, the `parentAxes` field is essential for
3296
+ * mapping these relationships and ensuring data coherence across nested or
3297
+ * multi-level data models.
3298
+ *
3299
+ * A list of zero-based indices of parent axes in the overall axes specification
3300
+ * from the column spec. Each index corresponds to the position of a parent axis
3301
+ * in the list that defines the structure of the data model.
3234
3302
  */
3235
- dataQuery: DataQuery;
3303
+ readonly parentAxes?: number[];
3236
3304
  };
3237
- /** Handle to a spec-only PFrame (no data, synchronous operations). */
3238
- type SpecFrameHandle = Branded<string, "SpecFrameHandle">;
3305
+ /** Parents are specs, not indexes; normalized axis can be used considering its parents independently from column */
3306
+ /** Common type representing spec for all the axes in a column */
3307
+ type AxesSpec = AxisSpec[];
3239
3308
  /**
3240
- * Synchronous driver for spec-level PFrame operations.
3309
+ * Full column specification including all axes specs and specs of the column
3310
+ * itself.
3241
3311
  *
3242
- * Unlike the async PFrameDriver (which works with data), this driver
3243
- * operates on column specifications only. All methods are synchronous
3244
- * because the underlying WASM PFrame computes results immediately.
3312
+ * A PColumn in its essence represents a mapping from a fixed size, explicitly
3313
+ * typed tuple to an explicitly typed value.
3314
+ *
3315
+ * (axis1Value1, axis2Value1, ...) -> columnValue
3316
+ *
3317
+ * Each element in tuple correspond to the axis having the same index in axesSpec.
3245
3318
  */
3246
- interface PFrameSpecDriver {
3247
- /** Create a spec-only PFrame from column specs. Returns a pool entry with handle and unref. */
3248
- createSpecFrame(specs: Record<string, PColumnSpec>): PoolEntry<SpecFrameHandle>;
3249
- /** List all columns currently registered in the frame. */
3250
- listColumns(handle: SpecFrameHandle): PColumnIdAndSpec[];
3251
- /** Discover columns compatible with given axes integration. */
3252
- discoverColumns(handle: SpecFrameHandle, request: DiscoverColumnsRequest): DiscoverColumnsResponse;
3253
- /** Delete an entry from a given axes integration */
3254
- deleteColumn(handle: SpecFrameHandle, request: DeleteColumnRequest): DeleteColumnResponse;
3255
- /** Evaluates a query specification against this PFrame */
3256
- evaluateQuery(handle: SpecFrameHandle, request: SpecQuery): EvaluateQueryResponse;
3257
- /**
3258
- * Assembles a {@link SpecQueryJoinEntry} from a terminal column plus an
3259
- * ordered path of wrapping steps (linker hops, filter joins).
3260
- *
3261
- * Pure over its input no frame handle is needed. Column ids are resolved
3262
- * later at {@link evaluateQuery} against the registered specs.
3263
- */
3264
- buildQuery(input: BuildQueryInput): SpecQueryJoinEntry;
3265
- /** Expand index-based parentAxes in AxesSpec to resolved AxisId parents in AxesId. */
3266
- expandAxes(spec: AxesSpec): AxesId;
3267
- /** Collapse resolved AxisId parents back to index-based parentAxes in AxesSpec. */
3268
- collapseAxes(ids: AxesId): AxesSpec;
3269
- /** Find the index of an axis matching the given selector. Returns -1 if not found. */
3270
- findAxis(spec: AxesSpec, selector: SingleAxisSelector): number;
3271
- /** Find the flat index of a table column matching the given selector. Returns -1 if not found. */
3272
- findTableColumn(tableSpec: PTableColumnSpec[], selector: PTableColumnId): number;
3273
- /**
3274
- * Upgrades selector-based legacy record filters into index-based data-layer
3275
- * boolean expressions, resolved against the provided unified table spec
3276
- * (axes first, then columns).
3277
- */
3278
- rewriteLegacyFilters(request: {
3279
- tableSpec: PTableColumnSpec[];
3280
- filters: PTableRecordFilter[];
3281
- }): DataQueryBooleanExpression[];
3282
- } //#endregion
3283
- //#endregion
3284
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/selectors.d.ts
3285
- /** Single axis selector */
3286
- interface SingleAxisSelector {
3287
- /** Axis name (required) */
3288
- name: string;
3289
- /** Axis type (optional) */
3290
- type?: AxisValueType;
3291
- /** Domain requirements (optional) */
3292
- domain?: Domain;
3293
- /** Parent axes requirements (optional) */
3294
- parentAxes?: SingleAxisSelector[];
3319
+ type PUniversalColumnSpec = PObjectSpec & {
3320
+ /** Defines specific type of BObject, the most generic type of unit of
3321
+ * information in Platforma Project. */
3322
+ readonly kind: "PColumn"; /** Type of column values */
3323
+ readonly valueType: string; /** Column name */
3324
+ readonly name: string;
3325
+ /** Adds auxiliary information to the axis name, type and parents to form a
3326
+ * unique identifier */
3327
+ readonly domain?: Record<string, string>;
3328
+ /** Context domain provides additional column identity that is matched
3329
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3330
+ readonly contextDomain?: Record<string, string>;
3331
+ /** Any additional information attached to the column that does not affect its
3332
+ * identifier */
3333
+ readonly annotations?: Record<string, string>; /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */
3334
+ readonly parentAxes?: number[]; /** Axes specifications */
3335
+ readonly axesSpec: AxesSpec;
3336
+ };
3337
+ /**
3338
+ * Specification of a data column.
3339
+ *
3340
+ * Data column is a specialized type of PColumn that stores only simple values (strings and numbers)
3341
+ * addressed by multiple keys. This is in contrast to other PColumn variants that can store more complex
3342
+ * values like files or other abstract data types. Data columns are optimized for storing and processing
3343
+ * basic tabular data.
3344
+ */
3345
+ type PDataColumnSpec = PUniversalColumnSpec & {
3346
+ /** Type of column values */readonly valueType: ValueType;
3347
+ };
3348
+ type PColumnSpec = PDataColumnSpec;
3349
+ /** Unique PColumnSpec identifier */
3350
+ interface PColumn<Data> extends PObject<Data> {
3351
+ /** PColumn spec, allowing it to be found among other PObjects */
3352
+ readonly spec: PColumnSpec;
3295
3353
  }
3296
- /** Qualification applied to a single axis to make it compatible during integration. */
3297
- interface AxisQualification {
3298
- /** Axis selector identifying which axis is qualified. */
3299
- readonly axis: SingleAxisSelector;
3300
- /** Additional context domain entries applied to the axis. */
3301
- readonly contextDomain: Record<string, string>;
3354
+ /** Columns in a PFrame also have internal identifier, this object represents
3355
+ * combination of specs and such id */
3356
+ interface PColumnIdAndSpec {
3357
+ /** Internal column id within the PFrame */
3358
+ readonly columnId: PObjectId;
3359
+ /** Column spec */
3360
+ readonly spec: PColumnSpec;
3361
+ }
3362
+ /** Get column id and spec from a column */
3363
+ interface AxisId {
3364
+ /** Type of the axis or column value. For an axis should not use non-key
3365
+ * types like float or double. */
3366
+ readonly type: AxisValueType;
3367
+ /** Name of the axis or column */
3368
+ readonly name: string;
3369
+ /** Adds auxiliary information to the axis or column name and type to form a
3370
+ * unique identifier */
3371
+ readonly domain?: Record<string, string>;
3372
+ /** Context domain provides additional axis identity that is matched
3373
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3374
+ readonly contextDomain?: Record<string, string>;
3302
3375
  }
3376
+ /** Array of axis ids */
3377
+ type AxesId = AxisId[];
3378
+ /** Extracts axis ids from axis spec */
3379
+ //#endregion
3380
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/filtered_column.d.ts
3381
+ //#region src/drivers/pframe/spec/filtered_column.d.ts
3382
+ /** Value of an axis filter */
3383
+ type AxisFilterValue = number | string;
3384
+ /** Axis filter by index */
3385
+ type AxisFilterByIdx = [number, AxisFilterValue];
3386
+ /** Axis filter by name */
3303
3387
  /**
3304
- * Reference to an axis by its numerical index within the anchor column's axes array
3305
- * Format: [anchorId, axisIndex]
3388
+ * `source` is either a leaf {@link PObjectId} or a {@link ColumnDiscoveredId}.
3389
+ * Filtered never nests inside Filtered (flat-merge invariant), and Filtered is
3390
+ * never the outer wrapper around Overridden — Overridden is always outermost.
3306
3391
  */
3392
+ interface ColumnFilteredKey {
3393
+ __isFiltered: true;
3394
+ source: ColumnUniversalId;
3395
+ axisFilters: AxisFilterByIdx[];
3396
+ }
3397
+ type ColumnFilteredId = Branded<CanonicalizedJson<ColumnFilteredKey>, "ColumnFilteredId">;
3307
3398
  //#endregion
3308
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/ids.d.ts
3399
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/ids.d.ts
3400
+ //#region src/drivers/pframe/spec/ids.d.ts
3401
+ /**
3402
+ * Per-axis patches keyed by positional index in the base spec's `axesSpec`.
3403
+ *
3404
+ * Using position rather than `name` lets us disambiguate linker-style specs
3405
+ * that carry multiple axes with the same `name` differentiated by `domain` /
3406
+ * `contextDomain` (e.g. a `group`, `group/primary`, `group/secondary` triple).
3407
+ *
3408
+ * A patch at index `>= base.axesSpec.length` appends a new axis at that slot.
3409
+ */
3410
+ type AxisPatches = Record<number, Partial<AxisSpec>>;
3411
+ /**
3412
+ * Universal column identifier optionally anchored and optionally filtered.
3413
+ * @deprecated use {@link ColumnUniversalKey}
3414
+ */
3309
3415
  /**
3310
3416
  * Canonically serialized {@link UniversalPColumnId}.
3417
+ * @deprecated use {@link ColumnUniversalId}
3311
3418
  */
3312
- type SUniversalPColumnId = Branded$1<PObjectId, "SUniversalPColumnId", "__pl_model_brand_2__">;
3419
+ type SUniversalPColumnId = ColumnUniversalId;
3420
+ type ColumnUniversalId = LocalPObjectId | GlobalPObjectId | ColumnFilteredId | ColumnDiscoveredId | ColumnOverriddenId;
3313
3421
  /**
3314
- * Canonically serializes a {@link UniversalPColumnId} to a string.
3315
- * @param id - The column identifier to serialize
3316
- * @returns The canonically serialized string
3422
+ * Canonically serializes a column key to a branded string id. Accepts both
3423
+ * the new {@link ColumnUniversalKey} and the deprecated {@link UniversalPColumnId}
3424
+ * (anchored / old filtered object form).
3317
3425
  */
3318
3426
  //#endregion
3319
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/interfaces.d.ts
3427
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/discovered_column.d.ts
3428
+ //#region src/drivers/pframe/spec/discovered_column.d.ts
3429
+ interface ColumnDiscoveredKey {
3430
+ __isDiscovered: true;
3431
+ column: ColumnUniversalId;
3432
+ path?: PathItem[];
3433
+ columnQualifications?: AxisQualification[];
3434
+ queriesQualifications?: Record<PObjectId, AxisQualification[]>;
3435
+ }
3436
+ type ColumnDiscoveredId = Branded<CanonicalizedJson<ColumnDiscoveredKey>, "ColumnDiscoveredId">;
3437
+ type PathItem = {
3438
+ type: "linker";
3439
+ column: ColumnUniversalId;
3440
+ };
3441
+ //#endregion
3442
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/interfaces.d.ts
3320
3443
  //#region src/drivers/interfaces.d.ts
3321
3444
  /**
3322
3445
  * Intended to match web.Blob, node.Blob, node-fetch.Blob, etc.
@@ -3341,7 +3464,7 @@ interface FileLike extends BlobLike {
3341
3464
  readonly name: string;
3342
3465
  } //#endregion
3343
3466
  //#endregion
3344
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.d.ts
3467
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.d.ts
3345
3468
  //#region src/drivers/blob.d.ts
3346
3469
  /** Handle of locally downloaded blob. This handle is issued only after the
3347
3470
  * blob's content is downloaded locally, and ready for quick access. */
@@ -3376,7 +3499,7 @@ interface BlobDriver {
3376
3499
  * Operational metrics of the blob download driver.
3377
3500
  */
3378
3501
  //#endregion
3379
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/log.d.ts
3502
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/log.d.ts
3380
3503
  //#region src/drivers/log.d.ts
3381
3504
  /** Prefix constants — single source of truth for handle format. */
3382
3505
  declare const LIVE_LOG_PREFIX = "log+live://log/";
@@ -3443,7 +3566,7 @@ type StreamingApiResponseHandleOutdated = {
3443
3566
  shouldUpdateHandle: true;
3444
3567
  };
3445
3568
  //#endregion
3446
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/column_filter.d.ts
3569
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/column_filter.d.ts
3447
3570
  //#region src/drivers/pframe/column_filter.d.ts
3448
3571
  /** Allows to search multiple columns in different contexts. */
3449
3572
  interface ColumnFilter {
@@ -3462,7 +3585,7 @@ interface ColumnFilter {
3462
3585
  readonly annotationPattern?: Record<string, string>;
3463
3586
  } //#endregion
3464
3587
  //#endregion
3465
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/find_columns.d.ts
3588
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/find_columns.d.ts
3466
3589
  //#region src/drivers/pframe/find_columns.d.ts
3467
3590
  /**
3468
3591
  * Request to search among existing columns in the PFrame. Two filtering
@@ -3489,7 +3612,7 @@ interface FindColumnsResponse {
3489
3612
  readonly hits: PColumnIdAndSpec[];
3490
3613
  } //#endregion
3491
3614
  //#endregion
3492
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/unique_values.d.ts
3615
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/unique_values.d.ts
3493
3616
  //#region src/drivers/pframe/unique_values.d.ts
3494
3617
  /** Calculate set of unique values for a specific axis for the filtered set of records */
3495
3618
  interface UniqueValuesRequest {
@@ -3509,7 +3632,79 @@ interface UniqueValuesResponse {
3509
3632
  readonly overflow: boolean;
3510
3633
  } //#endregion
3511
3634
  //#endregion
3512
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/ls.d.ts
3635
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/pframe.d.ts
3636
+ /** Information required to instantiate a PFrame. */
3637
+ type PFrameDef<Col> = Col[]; //#endregion
3638
+ //#endregion
3639
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/driver.d.ts
3640
+ //#region src/drivers/pframe/driver.d.ts
3641
+ /** PFrame handle */
3642
+ type PFrameHandle = Branded$1<string, "PFrame">;
3643
+ /** PFrame handle */
3644
+ type PTableHandle = Branded$1<string, "PTable">;
3645
+ /** Model-side PFrame service — creates frames/tables from column definitions. */
3646
+ interface PFrameModelDriver<Col = PColumn<string | PColumnValues | DataInfo<string>>> {
3647
+ createPFrame(def: PFrameDef<Col>): PFrameHandle;
3648
+ createPTable(def: PTableDef<Col>): PTableHandle;
3649
+ createPTableV2(def: PTableDefV2<Col>): PTableHandle;
3650
+ }
3651
+ /** Allows to access main data layer features of platforma */
3652
+ interface PFrameDriver {
3653
+ /**
3654
+ * Finds columns given filtering criteria on column name, annotations etc.
3655
+ * and a set of axes ids to find only columns with compatible specs.
3656
+ * */
3657
+ findColumns(handle: PFrameHandle, request: FindColumnsRequest): Promise<FindColumnsResponse>;
3658
+ /** Retrieve single column spec */
3659
+ getColumnSpec(handle: PFrameHandle, columnId: PObjectId): Promise<PColumnSpec | null>;
3660
+ /** Retrieve information about all columns currently added to the PFrame */
3661
+ listColumns(handle: PFrameHandle): Promise<PColumnIdAndSpec[]>;
3662
+ /** Calculates data for the table and returns complete data representation of it */
3663
+ calculateTableData(handle: PFrameHandle, request: CalculateTableDataRequest<PObjectId>, range?: TableRange): Promise<CalculateTableDataResponse>;
3664
+ /** Calculate set of unique values for a specific axis for the filtered set of records */
3665
+ getUniqueValues(handle: PFrameHandle, request: UniqueValuesRequest): Promise<UniqueValuesResponse>;
3666
+ /** Unified table shape */
3667
+ getShape(handle: PTableHandle): Promise<PTableShape>;
3668
+ /**
3669
+ * Returns ordered array of table axes specs (primary key "columns" in SQL
3670
+ * terms) and data column specs (regular "columns" in SQL terms).
3671
+ *
3672
+ * Data for a specific table column can be retrieved using unified indexing
3673
+ * corresponding to elements in this array.
3674
+ *
3675
+ * Axes are always listed first.
3676
+ * */
3677
+ getSpec(handle: PTableHandle): Promise<PTableColumnSpec[]>;
3678
+ /**
3679
+ * Retrieve the data from the table. To retrieve only data required, it can be
3680
+ * sliced both horizontally ({@link columnIndices}) and vertically
3681
+ * ({@link range}).
3682
+ *
3683
+ * @param columnIndices unified indices of columns to be retrieved
3684
+ * @param range optionally limit the range of records to retrieve
3685
+ * */
3686
+ getData(handle: PTableHandle, columnIndices: number[], range?: TableRange): Promise<PTableVector[]>;
3687
+ /**
3688
+ * Stream the table to a file at the given path. Caller is responsible
3689
+ * for producing the destination path (e.g. via the `Dialog` service).
3690
+ */
3691
+ writePTableToFs(handle: PTableHandle, options: WritePTableToFsOptions): Promise<WritePTableToFsResult>;
3692
+ /**
3693
+ * Export the table to a file. The output format is selected from the file
3694
+ * extension of `options.path` (`csv`, `tsv`, `parquet`, or `xlsx`).
3695
+ *
3696
+ * `options.columnIndices` selects the columns to export (output order). Column
3697
+ * headers are derived on the driver side from each field's label annotation
3698
+ * (falling back to its spec name), so the caller supplies only the path and
3699
+ * the columns.
3700
+ *
3701
+ * For `xlsx` the driver rejects tables whose row count would exceed the
3702
+ * 1,000,000-row per-sheet limit (below Excel's hard cap of 1,048,576).
3703
+ */
3704
+ exportPTable(handle: PTableHandle, options: ExportPTableOptions): Promise<void>;
3705
+ } //#endregion
3706
+ //#endregion
3707
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/ls.d.ts
3513
3708
  //#region src/drivers/ls.d.ts
3514
3709
  type ImportFileHandleUpload = `upload://upload/${string}`;
3515
3710
  type ImportFileHandleIndex = `index://index/${string}`;
@@ -3584,88 +3779,297 @@ interface LsDriver {
3584
3779
  }
3585
3780
  /** Gets a file path from an import handle. */
3586
3781
  //#endregion
3587
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/pframe.d.ts
3588
- /** Information required to instantiate a PFrame. */
3589
- type PFrameDef<Col> = Col[]; //#endregion
3782
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/columns/column_selector.d.ts
3783
+ //#region src/columns/column_selector.d.ts
3784
+ /** Relaxed string matcher input: plain string, single matcher, or array of mixed. */
3785
+ type RelaxedStringMatchers = string | StringMatcher | (string | StringMatcher)[];
3786
+ /** Relaxed record matcher: values can be plain strings or relaxed matchers. */
3787
+ type RelaxedRecord = Record<string, RelaxedStringMatchers>;
3788
+ /** Relaxed axis selector — accepts plain strings where strict requires StringMatcher[]. */
3789
+ interface RelaxedAxisSelector {
3790
+ name?: RelaxedStringMatchers;
3791
+ type?: AxisValueType | AxisValueType[];
3792
+ domain?: RelaxedRecord;
3793
+ contextDomain?: RelaxedRecord;
3794
+ annotations?: RelaxedRecord;
3795
+ }
3796
+ /** Relaxed column selector — convenient hand-written form. */
3797
+ interface RelaxedColumnSelector {
3798
+ name?: RelaxedStringMatchers;
3799
+ type?: ColumnValueType | ColumnValueType[];
3800
+ domain?: RelaxedRecord;
3801
+ contextDomain?: RelaxedRecord;
3802
+ annotations?: RelaxedRecord;
3803
+ axes?: RelaxedAxisSelector[];
3804
+ partialAxesMatch?: boolean;
3805
+ }
3806
+ /** One or many relaxed column selectors; normalizes to MultiColumnSelector[]. */
3807
+ type ColumnSelector = RelaxedColumnSelector | RelaxedColumnSelector[];
3590
3808
  //#endregion
3591
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/driver.d.ts
3592
- //#region src/drivers/pframe/driver.d.ts
3593
- /** PFrame handle */
3594
- type PFrameHandle = Branded$1<string, "PFrame">;
3595
- /** PFrame handle */
3596
- type PTableHandle = Branded$1<string, "PTable">;
3597
- /** Model-side PFrame service creates frames/tables from column definitions. */
3598
- interface PFrameModelDriver<Col = PColumn<string | PColumnValues | DataInfo<string>>> {
3599
- createPFrame(def: PFrameDef<Col>): PFrameHandle;
3600
- createPTable(def: PTableDef<Col>): PTableHandle;
3601
- createPTableV2(def: PTableDefV2<Col>): PTableHandle;
3809
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/columns/discover_columns_options.d.ts
3810
+ //#region src/drivers/columns/discover_columns_options.d.ts
3811
+ /**
3812
+ * Axis matching behaviour applied to `discover` requests.
3813
+ *
3814
+ * - `enrichment` (default) — anchor axes may float over un-mapped hit axes;
3815
+ * used by tooling that "extends" a query.
3816
+ * - `related` both source and hit axes may float; widest match.
3817
+ * - `exact` — no floating, no qualifications; strict equality.
3818
+ */
3819
+ type MatchingMode = "enrichment" | "related" | "exact";
3820
+ /**
3821
+ * Single entry accepted by `DiscoverColumnsOptions.anchors`. All variants are
3822
+ * trivially JSON-serialisable so the option carrier crosses the
3823
+ * sandbox/host VM bridge unchanged.
3824
+ */
3825
+ type AnchorEntry = PlRef | PObjectId | PColumnSpec | RelaxedColumnSelector;
3826
+ /** Qualifications needed for both already-integrated anchor columns and the hit column. */
3827
+ /**
3828
+ * Options object accepted by sandbox `discoverColumns()` and by the host
3829
+ * `ColumnsCollectionDriver.discover` / `.filter` methods. Pure JSON shape —
3830
+ * no class instances, no closures.
3831
+ */
3832
+ interface DiscoverColumnsOptions {
3833
+ /** Include columns matching these selectors. If omitted, includes all. */
3834
+ include?: ColumnSelector;
3835
+ /** Exclude columns matching these selectors. */
3836
+ exclude?: ColumnSelector;
3837
+ /** Axis matching behavior. Default: 'enrichment'. Ignored if no anchors. */
3838
+ mode?: MatchingMode;
3839
+ /** Anchors enable axis-aware discovery + linker traversal. */
3840
+ anchors?: Record<string, AnchorEntry>;
3841
+ /** Maximum linker hops. Default: 4 when anchors present, 0 otherwise. */
3842
+ maxHops?: number;
3602
3843
  }
3603
- /** Allows to access main data layer features of platforma */
3604
- interface PFrameDriver {
3605
- /**
3606
- * Finds columns given filtering criteria on column name, annotations etc.
3607
- * and a set of axes ids to find only columns with compatible specs.
3608
- * */
3609
- findColumns(handle: PFrameHandle, request: FindColumnsRequest): Promise<FindColumnsResponse>;
3610
- /** Retrieve single column spec */
3611
- getColumnSpec(handle: PFrameHandle, columnId: PObjectId): Promise<PColumnSpec | null>;
3612
- /** Retrieve information about all columns currently added to the PFrame */
3613
- listColumns(handle: PFrameHandle): Promise<PColumnIdAndSpec[]>;
3614
- /** Calculates data for the table and returns complete data representation of it */
3615
- calculateTableData(handle: PFrameHandle, request: CalculateTableDataRequest<PObjectId>, range?: TableRange): Promise<CalculateTableDataResponse>;
3616
- /** Calculate set of unique values for a specific axis for the filtered set of records */
3617
- getUniqueValues(handle: PFrameHandle, request: UniqueValuesRequest): Promise<UniqueValuesResponse>;
3618
- /** Unified table shape */
3619
- getShape(handle: PTableHandle): Promise<PTableShape>;
3620
- /**
3621
- * Returns ordered array of table axes specs (primary key "columns" in SQL
3622
- * terms) and data column specs (regular "columns" in SQL terms).
3623
- *
3624
- * Data for a specific table column can be retrieved using unified indexing
3625
- * corresponding to elements in this array.
3626
- *
3627
- * Axes are always listed first.
3628
- * */
3629
- getSpec(handle: PTableHandle): Promise<PTableColumnSpec[]>;
3844
+ /**
3845
+ * Options accepted by `ColumnsCollection.discover` / driver `.discover`.
3846
+ * Traversal scope (`mode`, `maxHops`) must be specified explicitly — the
3847
+ * defaults from {@link DiscoverColumnsOptions} are intentionally surfaced as
3848
+ * required choices at the discovery entrypoint.
3849
+ */
3850
+ type ColumnsDiscoverOptions = DiscoverColumnsOptions;
3851
+ /**
3852
+ * Options accepted by `ColumnsCollection.filter` / driver `.filter`. Traversal
3853
+ * scope is fixed by the source collection, so `mode` / `maxHops` are not part
3854
+ * of the filter surface — only `include` / `exclude` / `anchors`.
3855
+ */
3856
+ type ColumnsFilterOptions = Omit<DiscoverColumnsOptions, "mode" | "maxHops">;
3857
+ /** Translate a {@link MatchingMode} into the boolean-flag form the spec driver consumes. */
3858
+ //#endregion
3859
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/columns/types.d.ts
3860
+ //#region src/columns/types.d.ts
3861
+ /**
3862
+ * Opaque sandbox/host accessor handle.
3863
+ *
3864
+ * Both the sandbox `TreeNodeAccessor.handle` and the host-issued accessor
3865
+ * keys alias this brand `sdk/model` re-exports the same type so the two
3866
+ * sides stay structurally identical.
3867
+ */
3868
+ type AccessorHandle = Branded$1<string, "AccessorHandle">;
3869
+ /**
3870
+ * Structural subset of {@link FieldTraversalStep} (from `@platforma-sdk/model`)
3871
+ * needed by the host/sandbox column-providers traversal.
3872
+ *
3873
+ * Defined locally so this module does not depend on the sandbox `render`
3874
+ * subtree. Both `TreeNodeAccessor.traverse` (sandbox) and
3875
+ * `PlTreeNodeAccessor.traverse` (host) accept a superset of these fields, so
3876
+ * structural compatibility is preserved.
3877
+ */
3878
+ interface FieldTraversalStepLike {
3879
+ /** Field name */
3880
+ readonly field: string;
3881
+ /** Asserted field type — used by `accessor.traverse` to validate. */
3882
+ readonly assertFieldType?: "Input" | "Output" | "Service" | "OTW" | "Dynamic" | "MTW";
3883
+ /** Don't terminate chain if current resource or field has an error associated. */
3884
+ readonly ignoreError?: true;
3885
+ }
3886
+ /**
3887
+ * Raw entry returned by {@link GlobalCfgRenderCtxMethods.getUpstreamBlockCtx}
3888
+ * on the sandbox side, or by `collectUpstreamBlockCtx` on the host side.
3889
+ * Carries handle ids only — providers wrap them into accessor instances as
3890
+ * needed.
3891
+ *
3892
+ * Generic over the handle type so the same shape backs both:
3893
+ * - sandbox (`AHandle = AccessorHandle`, a `Branded<string, "AccessorHandle">`)
3894
+ * - host (`AHandle = PlTreeNodeAccessor`, the resolved accessor instance)
3895
+ *
3896
+ * Default `AHandle = string` since `AccessorHandle` is a brand on `string` —
3897
+ * the default is safe for the sandbox case.
3898
+ */
3899
+ interface UpstreamBlockCtx<AHandle = string> {
3900
+ blockId: string;
3901
+ prodCtx?: AHandle;
3902
+ stagingCtx?: AHandle;
3903
+ /** True when the `prodCtx` ctx-holder exists but `prodUiCtx` is still rendering. */
3904
+ prodIncomplete?: boolean;
3905
+ /** True when the `stagingCtx` ctx-holder exists but `stagingUiCtx` is still rendering. */
3906
+ stagingIncomplete?: boolean;
3907
+ }
3908
+ /**
3909
+ * Minimal accessor surface used by column-providers / column-registry
3910
+ * traversal.
3911
+ *
3912
+ * Both sandbox `TreeNodeAccessor` and host `PlTreeNodeAccessor` satisfy this
3913
+ * contract directly — `traverse(step)` is defined on both, and the other
3914
+ * members already match by shape. No `resolvePath` member: when canonical
3915
+ * `PObjectId`s are required (local-id construction inside the
3916
+ * outputs/prerun branch), the traversal helpers thread the path explicitly.
3917
+ */
3918
+ interface AccessorLike<Self extends AccessorLike<Self>> {
3919
+ /** Resource type carried by the underlying node (only `.name` is used). */
3920
+ readonly resourceType: {
3921
+ readonly name: string;
3922
+ };
3630
3923
  /**
3631
- * Retrieve the data from the table. To retrieve only data required, it can be
3632
- * sliced both horizontally ({@link columnIndices}) and vertically
3633
- * ({@link range}).
3634
- *
3635
- * @param columnIndices unified indices of columns to be retrieved
3636
- * @param range optionally limit the range of records to retrieve
3637
- * */
3638
- getData(handle: PTableHandle, columnIndices: number[], range?: TableRange): Promise<PTableVector[]>;
3924
+ * Single-step field traversal. Returns `undefined` when the field is
3925
+ * absent / unresolved (with `ignoreError`). Same shape on sandbox and host —
3926
+ * sandbox `TreeNodeAccessor.traverse` is an alias for `resolveAny` and host
3927
+ * `PlTreeNodeAccessor.traverse` is the canonical method.
3928
+ */
3929
+ traverse(step: FieldTraversalStepLike): Self | undefined;
3930
+ /** List input-field names on this node. */
3931
+ listInputFields(): string[];
3932
+ /** Whether the input-field collection on this node is finalized. */
3933
+ getInputsLocked(): boolean;
3934
+ /** Whether this node has a data payload attached. */
3935
+ hasData(): boolean;
3936
+ /** Decode the data payload as JSON. Returns `undefined` if no data. */
3937
+ getDataAsJson<T = unknown>(): T | undefined;
3938
+ }
3939
+ /**
3940
+ * One indexed column — the canonical record produced by every traversal.
3941
+ * Carries everything needed to read spec/data/status under a stable id.
3942
+ *
3943
+ * Generic over the accessor flavour so the same record shape works for both
3944
+ * the sandbox `TreeNodeAccessor` and the host `PlTreeNodeAccessor`.
3945
+ */
3946
+ //#endregion
3947
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/drivers/columns/columns_collection_driver.d.ts
3948
+ //#region src/drivers/columns/columns_collection_driver.d.ts
3949
+ /**
3950
+ * Opaque host-owned handle for a `ColumnsCollection` instance. Issued by
3951
+ * {@link ColumnsCollectionDriver.create}, refcounted by the driver, and
3952
+ * pinned to the active render ctx via the VM injector — sandbox never
3953
+ * sees raw refcounting.
3954
+ */
3955
+ type CollectionHandle = Branded$1<string, "CollectionHandle">;
3956
+ /**
3957
+ * JSON descriptor crossing the VM bridge in place of a sandbox
3958
+ * `ColumnsSource`. Always plain data — no closures, no class instances.
3959
+ *
3960
+ * - `"collection"` – reference another driver-managed collection by handle
3961
+ * (chaining, splicing).
3962
+ * - `"result_pool"` – fan-out into the host's current render ctx upstream
3963
+ * block ctxes. Carries no payload — the host always uses its own pool.
3964
+ * - `"accessor"` – walk the host tree starting at the given accessor
3965
+ * handle from a `path` prefix.
3966
+ * - `"ids"` – pre-resolved id list (sandbox-materialised provider).
3967
+ */
3968
+ type SerializedColumnsSource = {
3969
+ readonly kind: "collection";
3970
+ readonly handle: CollectionHandle;
3971
+ } | {
3972
+ readonly kind: "result_pool";
3973
+ } | {
3974
+ readonly kind: "accessor";
3975
+ readonly accessor: AccessorHandle;
3976
+ readonly path: string[];
3977
+ } | {
3978
+ readonly kind: "ids";
3979
+ readonly ids: ColumnUniversalId[];
3980
+ readonly isFinal: boolean;
3981
+ };
3982
+ /**
3983
+ * Per-call host bindings the driver needs to resolve sources whose
3984
+ * shape references render-ctx state (`"accessor"`, `"result_pool"`).
3985
+ *
3986
+ * The VM injector inside `pl-middle-layer` supplies these on every call;
3987
+ * UI-side direct callers that only build collections out of `"ids"` /
3988
+ * `"collection"` sources may omit the bindings entirely.
3989
+ *
3990
+ * Parameterised on the concrete accessor flavour so host implementations
3991
+ * keep their static types (e.g. `PlTreeNodeAccessor`) without leaking that
3992
+ * dependency into `@milaboratories/pl-model-common`.
3993
+ */
3994
+ interface ColumnsCollectionDriverHost<A extends AccessorLike<A> = AccessorLike<any>> {
3995
+ /** Resolve an {@link AccessorHandle} to the host's concrete accessor. */
3996
+ resolveAccessor(handle: AccessorHandle): A;
3997
+ /** Snapshot of upstream-block ctx pairs from the current render ctx. */
3998
+ getUpstreamBlockCtxes(): ReadonlyArray<UpstreamBlockCtx<A>>;
3639
3999
  /**
3640
- * Stream the table to a file at the given path. Caller is responsible
3641
- * for producing the destination path (e.g. via the `Dialog` service).
4000
+ * Per-call spec driver. The injector supplies the active render ctx's
4001
+ * `PFrameSpec` service; `discover` / `filter` use it to build a spec
4002
+ * frame and run a single discovery query.
3642
4003
  */
3643
- writePTableToFs(handle: PTableHandle, options: WritePTableToFsOptions): Promise<WritePTableToFsResult>;
4004
+ getSpecDriver(): PFrameSpecDriver;
3644
4005
  /**
3645
- * Export the table to a file. The output format is selected from the file
3646
- * extension of `options.path` (`csv`, `tsv`, `parquet`, or `xlsx`).
3647
- *
3648
- * `options.columnIndices` selects the columns to export (output order). Column
3649
- * headers are derived on the driver side from each field's label annotation
3650
- * (falling back to its spec name), so the caller supplies only the path and
3651
- * the columns.
3652
- *
3653
- * For `xlsx` the driver rejects tables whose row count would exceed the
3654
- * 1,000,000-row per-sheet limit (below Excel's hard cap of 1,048,576).
4006
+ * Resolve the canonical {@link PColumnSpec} for a leaf {@link PObjectId}.
4007
+ * Returns `undefined` when the id is not present in the active registry
4008
+ * (e.g. handed to the driver via a `{kind:"ids"}` source whose underlying
4009
+ * column has since left the visible scope). Override-wrapped ids are
4010
+ * unwrapped by the caller this method only resolves the underlying leaf.
3655
4011
  */
3656
- exportPTable(handle: PTableHandle, options: ExportPTableOptions): Promise<void>;
4012
+ resolveSpec(id: PObjectId): PColumnSpec | undefined;
4013
+ }
4014
+ /**
4015
+ * Sandbox / UI view of the `ColumnsCollection` driver. Same methods as
4016
+ * {@link ColumnsCollectionDriver}, but the `host` parameters are dropped —
4017
+ * the VM bridge / UI wrapper supplies them on every call so callers only
4018
+ * pass plain data (handles + source descriptors + option objects).
4019
+ *
4020
+ * `getService("columnsCollection")` returns a value of this shape on both
4021
+ * sandbox and UI sides.
4022
+ */
4023
+ interface ColumnsCollectionDriverModel {
4024
+ /** Build a fresh collection from the supplied source descriptors. */
4025
+ create(sources: ReadonlyArray<SerializedColumnsSource>): CollectionHandle;
4026
+ /** Whether the collection currently exposes zero columns. */
4027
+ isEmpty(handle: CollectionHandle): boolean;
4028
+ /** Whether enumeration is finalised across every contributing source. */
4029
+ isFinal(handle: CollectionHandle): boolean;
4030
+ /** Canonical id list for the columns visible through this collection. */
4031
+ getColumns(handle: CollectionHandle): ColumnUniversalId[];
4032
+ /** Append one or more sources and return a fresh collection handle. */
4033
+ addSource(handle: CollectionHandle, sources: ReadonlyArray<SerializedColumnsSource>): CollectionHandle;
4034
+ /** Anchored/selector-driven discovery. Returns a fresh handle. */
4035
+ discover(handle: CollectionHandle, options: ColumnsDiscoverOptions): CollectionHandle;
4036
+ /** Selector-only filter (no anchor traversal). Returns a fresh handle. */
4037
+ filter(handle: CollectionHandle, options: ColumnsFilterOptions): CollectionHandle;
4038
+ }
4039
+ /**
4040
+ * Synchronous host-side driver for `ColumnsCollection` operations. All
4041
+ * collection state lives on the host side, addressable through opaque
4042
+ * {@link CollectionHandle}s. Every handle-minting method returns a
4043
+ * {@link PoolEntry} so callers can wire the refcount into their own
4044
+ * lifecycle; the VM bridge pins each entry to the active render ctx and
4045
+ * forwards only the handle string to sandbox.
4046
+ *
4047
+ * Sandbox / UI callers consume {@link ColumnsCollectionDriverModel}
4048
+ * instead; the bridge maps that surface onto this one by injecting
4049
+ * {@link ColumnsCollectionDriverHost} bindings.
4050
+ */
4051
+ interface ColumnsCollectionDriver {
4052
+ create(sources: ReadonlyArray<SerializedColumnsSource>, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
4053
+ isEmpty(handle: CollectionHandle): boolean;
4054
+ isFinal(handle: CollectionHandle): boolean;
4055
+ getColumns(handle: CollectionHandle, host: ColumnsCollectionDriverHost): ColumnUniversalId[];
4056
+ addSource(handle: CollectionHandle, sources: ReadonlyArray<SerializedColumnsSource>, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
4057
+ discover(handle: CollectionHandle, options: ColumnsDiscoverOptions, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
4058
+ filter(handle: CollectionHandle, options: ColumnsFilterOptions, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
3657
4059
  } //#endregion
3658
4060
  //#endregion
3659
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/services/service_types.d.ts
4061
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/services/service_types.d.ts
3660
4062
  //#region src/services/service_types.d.ts
3661
- type ServiceTypesLike<Model = unknown, Ui = unknown, Kind extends ServiceType = ServiceType> = {
4063
+ type ServiceTypesLike<Model = unknown, Ui = unknown, Kind extends ServiceType = ServiceType, ModelHost = Model, UiHost = Ui> = {
3662
4064
  readonly __types?: {
3663
4065
  model: Model;
3664
4066
  ui: Ui;
3665
4067
  kind: Kind;
4068
+ modelHost: ModelHost;
4069
+ uiHost: UiHost;
3666
4070
  };
3667
4071
  };
3668
- type InferServiceUi<S extends ServiceTypesLike> = S extends ServiceTypesLike<unknown, infer U, ServiceType> ? U : unknown;
4072
+ type InferServiceUi<S extends ServiceTypesLike> = S extends ServiceTypesLike<unknown, infer U, ServiceType, unknown, unknown> ? U : unknown;
3669
4073
  type ServiceName<S extends ServiceTypesLike = ServiceTypesLike> = Branded$1<string, S>;
3670
4074
  type ServiceType = "node" | "wasm" | "main";
3671
4075
  type ServiceBrand<T> = T extends Branded$1<string, infer S extends ServiceTypesLike> ? S : never;
@@ -3685,15 +4089,16 @@ type ServiceNameLiterals = { [K in keyof TServices]: ExtractServiceName<TService
3685
4089
  /** Auto-derived requires* feature flags from Services keys. */
3686
4090
  type ServiceRequireFlags = { [K in keyof TServices as `requires${K & string}`]?: boolean };
3687
4091
  //#endregion
3688
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/services/service_declarations.d.ts
4092
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/services/service_declarations.d.ts
3689
4093
  //#region src/services/service_declarations.d.ts
3690
4094
  declare const Services: {
3691
- PFrameSpec: Branded$1<"pframeSpec", ServiceTypesLike<PFrameSpecDriver, PFrameSpecDriver, "wasm">>;
3692
- PFrame: Branded$1<"pframe", ServiceTypesLike<PFrameModelDriver<PColumn<string | PColumnValues | DataInfo<string>>>, PFrameDriver, "node">>;
3693
- Dialog: Branded$1<"dialog", ServiceTypesLike<Record<string, never>, DialogService, "main">>;
4095
+ PFrameSpec: Branded$1<"pframeSpec", ServiceTypesLike<PFrameSpecDriver, PFrameSpecDriver, "wasm", PFrameSpecDriver, PFrameSpecDriver>>;
4096
+ PFrame: Branded$1<"pframe", ServiceTypesLike<PFrameModelDriver<PColumn<string | PColumnValues | DataInfo<string>>>, PFrameDriver, "node", PFrameModelDriver<PColumn<string | PColumnValues | DataInfo<string>>>, PFrameDriver>>;
4097
+ Dialog: Branded$1<"dialog", ServiceTypesLike<Record<string, never>, DialogService, "main", Record<string, never>, DialogService>>;
4098
+ ColumnsCollection: Branded$1<"columnsCollection", ServiceTypesLike<ColumnsCollectionDriverModel, ColumnsCollectionDriverModel, "wasm", ColumnsCollectionDriver, ColumnsCollectionDriver>>;
3694
4099
  }; //#endregion
3695
4100
  //#endregion
3696
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/flags/block_flags.d.ts
4101
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/flags/block_flags.d.ts
3697
4102
  /**
3698
4103
  * Known block flags. Flags are set during model compilation, see `BlockModel.create` for more details and for initial values.
3699
4104
  */
@@ -3711,7 +4116,7 @@ type BlockCodeKnownFeatureFlags = {
3711
4116
  * older desktop apps.
3712
4117
  */
3713
4118
  //#endregion
3714
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/driver_kit.d.ts
4119
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/driver_kit.d.ts
3715
4120
  //#region src/driver_kit.d.ts
3716
4121
  /** Set of all drivers exposed in UI SDK via the platforma object. */
3717
4122
  interface DriverKit {
@@ -3732,7 +4137,7 @@ interface DriverKit {
3732
4137
  readonly pFrameDriver: PFrameDriver;
3733
4138
  } //#endregion
3734
4139
  //#endregion
3735
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/errors.d.ts
4140
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/errors.d.ts
3736
4141
  type ResultOrError<S, F = Error> = {
3737
4142
  value: S;
3738
4143
  error?: undefined;
@@ -3740,7 +4145,7 @@ type ResultOrError<S, F = Error> = {
3740
4145
  error: F;
3741
4146
  };
3742
4147
  //#endregion
3743
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.46.3/node_modules/@milaboratories/pl-model-common/dist/utag.d.ts
4148
+ //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.47.1/node_modules/@milaboratories/pl-model-common/dist/utag.d.ts
3744
4149
  //#region src/utag.d.ts
3745
4150
  /** Value returned for changing states supporting reactive listening for changes */
3746
4151
  interface ValueWithUTag<V> {
@@ -3759,7 +4164,7 @@ interface ValueWithUTagAndAuthor<V> extends ValueWithUTag<V> {
3759
4164
  readonly author?: AuthorMarker;
3760
4165
  } //#endregion
3761
4166
  //#endregion
3762
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/block_state_patch.d.ts
4167
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/block_state_patch.d.ts
3763
4168
  //#region src/block_state_patch.d.ts
3764
4169
  /** Patch for the structural object */
3765
4170
  type Patch<K, V> = {
@@ -3771,7 +4176,7 @@ type Unionize<T extends Record<string, unknown>> = { [K in keyof T]: Patch<K, T[
3771
4176
  /** Patch for the BlockState, pushed by onStateUpdates method in SDK. */
3772
4177
  type BlockStatePatch<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> = Unionize<BlockState<Args, Outputs, UiState, Href>>; //#endregion
3773
4178
  //#endregion
3774
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/plugin_handle.d.ts
4179
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/plugin_handle.d.ts
3775
4180
  //#region src/plugin_handle.d.ts
3776
4181
  /**
3777
4182
  * Phantom-only base type for constraining PluginHandle's type parameter.
@@ -3800,7 +4205,7 @@ interface PluginFactoryLike<Data extends Record<string, unknown> = Record<string
3800
4205
  type PluginHandle<F extends PluginFactoryLike = PluginFactoryLike> = Branded<string, F>;
3801
4206
  /** Construct the output key for a plugin output in the block outputs map. */
3802
4207
  //#endregion
3803
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/block_storage.d.ts
4208
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/block_storage.d.ts
3804
4209
  /** Payload for storage mutation operations. SDK defines specific operations. */
3805
4210
  type MutateStoragePayload<T = unknown> = {
3806
4211
  operation: "update-block-data";
@@ -3818,7 +4223,7 @@ type MutateStoragePayload<T = unknown> = {
3818
4223
  * @returns A new BlockStorage with updated data
3819
4224
  */
3820
4225
  //#endregion
3821
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/bconfig/lambdas.d.ts
4226
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/bconfig/lambdas.d.ts
3822
4227
  /** Additional information that may alter lambda rendering procedure. */
3823
4228
  type ConfigRenderLambdaFlags = {
3824
4229
  /**
@@ -3855,7 +4260,7 @@ type InferOutputsFromLambdas<OutputsCfg extends Record<string, ConfigRenderLambd
3855
4260
  } ? false : true;
3856
4261
  } }; //#endregion
3857
4262
  //#endregion
3858
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/block_api_v1.d.ts
4263
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/block_api_v1.d.ts
3859
4264
  //#region src/block_api_v1.d.ts
3860
4265
  /** Returned by state subscription methods to be able to cancel the subscription. */
3861
4266
  type CancelSubscription = () => void;
@@ -3950,7 +4355,7 @@ interface GetOperation<T> extends BaseOperation {
3950
4355
  value: T;
3951
4356
  }
3952
4357
  //#endregion
3953
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/block_api_v2.d.ts
4358
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/block_api_v2.d.ts
3954
4359
  //#region src/block_api_v2.d.ts
3955
4360
  /** Defines methods to read and write current block data. */
3956
4361
  interface BlockApiV2<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> {
@@ -4000,12 +4405,12 @@ interface BlockApiV2<Args = unknown, Outputs extends BlockOutputsBase = BlockOut
4000
4405
  dispose(): Promise<ResultOrError<void>>;
4001
4406
  } //#endregion
4002
4407
  //#endregion
4003
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/version.d.ts
4408
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/version.d.ts
4004
4409
  type SdkInfo = {
4005
4410
  readonly sdkVersion: string;
4006
4411
  };
4007
4412
  //#endregion
4008
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/services/block_services.d.ts
4413
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/services/block_services.d.ts
4009
4414
  //#region src/services/block_services.d.ts
4010
4415
  /**
4011
4416
  * Services required by all V3 blocks by default.
@@ -4018,17 +4423,18 @@ declare const BLOCK_SERVICE_FLAGS: {
4018
4423
  readonly requiresPFrameSpec: true;
4019
4424
  readonly requiresPFrame: true;
4020
4425
  readonly requiresDialog: true;
4426
+ readonly requiresColumnsCollection: true;
4021
4427
  };
4022
4428
  type BlockServiceFlags = typeof BLOCK_SERVICE_FLAGS;
4023
4429
  //#endregion
4024
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/services/service_resolve.d.ts
4430
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/services/service_resolve.d.ts
4025
4431
  //#region src/services/service_resolve.d.ts
4026
4432
  type FlagToName<Flag extends string> = Flag extends `requires${infer K}` ? K extends keyof ServiceNameLiterals ? ServiceNameLiterals[K] : never : never;
4027
4433
  type RequiredServiceNames<Flags> = { [K in keyof Flags & `requires${string}`]: Flags[K] extends true ? FlagToName<K & string> : never }[keyof Flags & `requires${string}`];
4028
4434
  type ResolveUiServices<Flags> = Pick<UiServices$1, RequiredServiceNames<Flags> & keyof UiServices$1>;
4029
4435
  type BlockDefaultUiServices = ResolveUiServices<BlockServiceFlags>; //#endregion
4030
4436
  //#endregion
4031
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/plugin_model.d.ts
4437
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/plugin_model.d.ts
4032
4438
  /**
4033
4439
  * Runtime definition for a single public output field.
4034
4440
  * Stored in PluginModel and passed through BlockModelInfo to the UI layer.
@@ -4037,7 +4443,7 @@ type PublicOutputFieldDef = {
4037
4443
  readonly getter: (data: unknown) => unknown;
4038
4444
  };
4039
4445
  //#endregion
4040
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/block_api_v3.d.ts
4446
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/block_api_v3.d.ts
4041
4447
  //#region src/block_api_v3.d.ts
4042
4448
  /** Defines methods to read and write current block data. */
4043
4449
  interface BlockApiV3<_Data = unknown, _Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, Href extends `/${string}` = `/${string}`> {
@@ -4068,7 +4474,7 @@ interface BlockApiV3<_Data = unknown, _Args = unknown, Outputs extends BlockOutp
4068
4474
  dispose(): Promise<ResultOrError<void>>;
4069
4475
  } //#endregion
4070
4476
  //#endregion
4071
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.79.24/node_modules/@platforma-sdk/model/dist/platforma.d.ts
4477
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.80.2/node_modules/@platforma-sdk/model/dist/platforma.d.ts
4072
4478
  //#region src/platforma.d.ts
4073
4479
  /** Defines all methods to interact with the platform environment from within a block UI. @deprecated */
4074
4480
  interface PlatformaV1<Args = unknown, Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>, UiState = unknown, Href extends `/${string}` = `/${string}`> extends BlockApiV1<Args, Outputs, UiState, Href>, DriverKit {
@@ -4159,36 +4565,38 @@ type SelectedScope = {
4159
4565
  };
4160
4566
  /** A selectable scope. Alias of `SelectedScope` — the label lives on the base type. */
4161
4567
  /**
4162
- * One embedding card in the settings list: a (sequence scope, model) task the
4163
- * user assembles. `scope` and `model` are each undefined until picked — the UI
4164
- * fills one and bidirectionally filters the other. `fidelity` applies only when
4165
- * `model` is ESM-2.
4568
+ * The single (sequence scope, model) selection the user assembles. `scope` and
4569
+ * `model` are each undefined until picked — the UI fills one and bidirectionally
4570
+ * filters the other. `fidelity` applies only when `model` is ESM-2. Always present
4571
+ * in `BlockData` (initialised to `{}`); the args lambda wraps it into the workflow's
4572
+ * 1-element task list, so the workflow's list contract is unchanged.
4166
4573
  */
4167
- type EmbeddingCard = {
4168
- /** Stable card key for the `PlElementList` (`get-item-key`). */id: string;
4574
+ type EmbeddingSelection = {
4169
4575
  scope?: SelectedScope;
4170
4576
  model?: EmbeddingModelId; /** ESM-2 fidelity; ignored for other models. */
4171
- fidelity?: Fidelity; /** UI: card expanded in the list. */
4172
- isExpanded?: boolean;
4577
+ fidelity?: Fidelity;
4173
4578
  };
4174
4579
  /**
4175
- * Per-scope record in the Python step's `stats.json` output one entry per
4176
- * selected scope. `n_entities = 0` marks an empty scope.
4580
+ * Frozen V2 card shape (per-card model selection, before the single-selection
4581
+ * redesign). Kept only as the migration source type so `BlockDataV2` stays
4582
+ * historically accurate; new code uses `EmbeddingSelection`. `id` was the stable
4583
+ * key for V2's `PlElementList`; dropped in V3.
4177
4584
  */
4178
4585
  /**
4179
- * V2 BlockData. Model selection moves per-scope: the global `fidelity` + flat
4180
- * `selectedScopes` become a list of embedding cards, each a (scope, model,
4181
- * fidelity?) task. Enables specialist models and same-scope model comparison.
4586
+ * V3 BlockData. The card list collapses to a single (scope, model) selection: the
4587
+ * block embeds ONE combination per run. `embedding` is always present (init `{}`);
4588
+ * the args lambda wraps it into the workflow's 1-element task list, so the workflow
4589
+ * contract is unchanged.
4182
4590
  */
4183
- type BlockDataV2 = {
4184
- inputAnchor?: PlRef; /** The embedding cards (scope × model tasks) the user has assembled. */
4185
- embeddings: EmbeddingCard[];
4591
+ type BlockDataV3 = {
4592
+ inputAnchor?: PlRef; /** The single (scope, model, fidelity?) selection the user assembles. */
4593
+ embedding: EmbeddingSelection;
4186
4594
  /**
4187
- * Init-guard: canonical id of the anchor whose default cards were last seeded.
4188
- * Prevents re-seeding on panel reopen / server patch; triggers re-seed +
4189
- * reconciliation on input change.
4595
+ * Init-guard: canonical id of the anchor whose default selection was last seeded.
4596
+ * Prevents re-seeding on panel reopen / server patch; triggers a re-seed on
4597
+ * input change.
4190
4598
  */
4191
- embeddingsInitializedForAnchor?: string; /** Advanced resource overrides (GiB / cores); undefined → workflow defaults. */
4599
+ embeddingInitializedForAnchor?: string; /** Advanced resource overrides (GiB / cores); undefined → workflow sizes automatically from device + input. */
4192
4600
  mem?: number;
4193
4601
  cpu?: number;
4194
4602
  defaultBlockLabel?: string;
@@ -4196,7 +4604,7 @@ type BlockDataV2 = {
4196
4604
  /** Current BlockData shape. */
4197
4605
  /**
4198
4606
  * One embedding task in the workflow input: a scope plus the model to embed it
4199
- * with (and ESM-2 fidelity, when applicable). Projected from `BlockData.embeddings`.
4607
+ * with (and ESM-2 fidelity, when applicable). Projected from `BlockData.embedding`.
4200
4608
  */
4201
4609
  type EmbeddingTask = {
4202
4610
  scope: SelectedScope;
@@ -4205,20 +4613,20 @@ type EmbeddingTask = {
4205
4613
  };
4206
4614
  /**
4207
4615
  * Workflow input shape. Args projection in `index.ts` builds this from
4208
- * `BlockData`, validating that `inputAnchor` is set and every card is a complete,
4616
+ * `BlockData`, validating that `inputAnchor` is set and the selection is a complete,
4209
4617
  * compatible (scope, model) pair (throws otherwise — the V3 idiom replaces V1's
4210
4618
  * `.argsValid()`).
4211
4619
  */
4212
4620
  type BlockArgs = {
4213
- inputAnchor: PlRef; /** Tasks to emit, projected from `data.embeddings` (validated complete + compatible). */
4214
- embeddings: EmbeddingTask[]; /** Advanced resource overrides for the embedding step (GiB / cores); undefined → workflow defaults. */
4621
+ inputAnchor: PlRef; /** Tasks to emit — a 1-element list projected from `data.embedding` (validated complete + compatible). */
4622
+ embeddings: EmbeddingTask[]; /** Advanced resource overrides for the embedding step (GiB / cores); undefined → workflow sizes automatically. */
4215
4623
  mem?: number;
4216
4624
  cpu?: number;
4217
4625
  }; //#endregion
4218
4626
  //#endregion
4219
4627
  //#region ../model/dist/index.d.ts
4220
4628
  //#region src/index.d.ts
4221
- declare const platforma: PlatformaExtended<PlatformaV3<BlockDataV2, BlockArgs, InferOutputsFromLambdas<{
4629
+ declare const platforma: PlatformaExtended<PlatformaV3<BlockDataV3, BlockArgs, InferOutputsFromLambdas<{
4222
4630
  inputOptions: ConfigRenderLambda<{
4223
4631
  readonly ref: {
4224
4632
  readonly __isRef: true;
@@ -4228,36 +4636,6 @@ declare const platforma: PlatformaExtended<PlatformaV3<BlockDataV2, BlockArgs, I
4228
4636
  };
4229
4637
  readonly label: string;
4230
4638
  }[]>;
4231
- } & {
4232
- inputSpec: ConfigRenderLambda<{
4233
- readonly kind: "PColumn";
4234
- readonly name: string;
4235
- readonly domain?: {
4236
- [x: string]: string;
4237
- } | undefined;
4238
- readonly contextDomain?: {
4239
- [x: string]: string;
4240
- } | undefined;
4241
- readonly annotations?: {
4242
- [x: string]: string;
4243
- } | undefined;
4244
- readonly valueType: "Int" | "Long" | "Float" | "Double" | "String" | "Bytes";
4245
- readonly parentAxes?: number[] | undefined;
4246
- readonly axesSpec: {
4247
- readonly type: AxisValueType;
4248
- readonly name: string;
4249
- readonly domain?: {
4250
- [x: string]: string;
4251
- } | undefined;
4252
- readonly contextDomain?: {
4253
- [x: string]: string;
4254
- } | undefined;
4255
- readonly annotations?: {
4256
- [x: string]: string;
4257
- } | undefined;
4258
- readonly parentAxes?: number[] | undefined;
4259
- }[];
4260
- } | undefined>;
4261
4639
  } & {
4262
4640
  availableScopes: ConfigRenderLambda<{
4263
4641
  options: {
@@ -4284,7 +4662,8 @@ declare const platforma: PlatformaExtended<PlatformaV3<BlockDataV2, BlockArgs, I
4284
4662
  } | undefined>;
4285
4663
  } & {
4286
4664
  stats: ConfigRenderLambda<{
4287
- device_used: "cpu" | "gpu";
4665
+ device_used: "cpu" | "cuda" | "mps";
4666
+ device_requested?: "cpu" | "gpu" | undefined;
4288
4667
  model: ModelTag;
4289
4668
  max_length?: number | undefined;
4290
4669
  scopes: {
@@ -4296,7 +4675,7 @@ declare const platforma: PlatformaExtended<PlatformaV3<BlockDataV2, BlockArgs, I
4296
4675
  max_length?: number | undefined;
4297
4676
  n_entities?: number | undefined;
4298
4677
  n_dropped_empty?: number | undefined;
4299
- n_truncated?: number | undefined;
4678
+ n_truncated?: number | null | undefined;
4300
4679
  }[];
4301
4680
  } | undefined>;
4302
4681
  } & {