@platforma-sdk/model 1.33.17 → 1.34.8

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/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const PlatformaSDKVersion = "1.33.17";
1
+ export declare const PlatformaSDKVersion = "1.34.8";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,YAAY,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/model",
3
- "version": "1.33.17",
3
+ "version": "1.34.8",
4
4
  "description": "Platforma.bio SDK / Block Model",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -21,8 +21,8 @@
21
21
  "utility-types": "^3.11.0",
22
22
  "canonicalize": "~2.1.0",
23
23
  "zod": "~3.23.8",
24
- "@milaboratories/pl-error-like": "^1.12.1",
25
- "@milaboratories/pl-model-common": "^1.15.5"
24
+ "@milaboratories/pl-model-common": "^1.15.5",
25
+ "@milaboratories/pl-error-like": "^1.12.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "typescript": "~5.5.4",
@@ -203,6 +203,18 @@ function getAdditionalColumnsForColumn(
203
203
  return [column, ...additionalColumns];
204
204
  }
205
205
 
206
+ /**
207
+ The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool
208
+ (including linker columns and all label columns).
209
+ Block’s columns are added to pframe as is.
210
+ Other columns are added basing on set of axes of block’s columns, considering available with linker columns.
211
+ Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from
212
+ result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values
213
+ among existing ones).
214
+ In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case
215
+ of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)
216
+ and modified label (with added domain values in case if more than one copy with different domains exist).
217
+ */
206
218
  export function createPFrameForGraphs<A, U>(
207
219
  ctx: RenderCtx<A, U>,
208
220
  blockColumns: PColumn<PColumnDataUniversal>[] | undefined,
@@ -1,71 +1,56 @@
1
- import type {
2
- CanonicalizedJson,
3
- PColumn,
4
- PColumnIdAndSpec,
5
- PColumnKey,
6
- PColumnValues,
7
- PColumnValuesEntry,
8
- PObjectId,
9
- PTableColumnId,
10
- } from '@milaboratories/pl-model-common';
11
1
  import {
12
- canonicalizeJson,
13
2
  isPTableAbsent,
3
+ type PColumn,
4
+ type PColumnIdAndSpec,
5
+ type PColumnKey,
6
+ type PColumnValues,
7
+ type PObjectId,
8
+ type PTableColumnId,
9
+ uniquePlId,
14
10
  } from '@milaboratories/pl-model-common';
15
- import type { PlSelectionModel } from './PlSelectionModel';
16
-
17
- /** Canonicalized PTableColumnId JSON string */
18
- export type PTableColumnIdJson = CanonicalizedJson<PTableColumnId>;
19
-
20
- /** Encode `PTableColumnId` as canonicalized JSON string */
21
- export function stringifyPTableColumnId(
22
- id: PTableColumnId,
23
- ): PTableColumnIdJson {
24
- const type = id.type;
25
- switch (type) {
26
- case 'axis':
27
- return canonicalizeJson(id);
28
- case 'column':
29
- return canonicalizeJson(id);
30
- default:
31
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
32
- throw Error(`unsupported column type: ${type satisfies never}`);
33
- }
34
- }
11
+ import { type PlSelectionModel } from './PlSelectionModel';
35
12
 
36
13
  export type PColumnPredicate = (column: PColumnIdAndSpec) => boolean;
37
14
 
38
15
  export type PlMultiSequenceAlignmentModel = {
16
+ version?: number;
39
17
  sequenceColumnIds?: PObjectId[];
40
- labelColumnIds?: PTableColumnIdJson[];
18
+ labelColumnIds?: PTableColumnId[];
41
19
  };
42
20
 
43
- export function createRowSelectionColumn(
44
- columnId: PObjectId,
45
- rowSelectionModel: PlSelectionModel | undefined,
46
- label?: string,
47
- domain?: Record<string, string>,
48
- ): PColumn<PColumnValues> | undefined {
49
- if (!rowSelectionModel || rowSelectionModel.axesSpec.length === 0) {
50
- return undefined;
21
+ export function createRowSelectionColumn({
22
+ selection,
23
+ columnId = uniquePlId() as string as PObjectId,
24
+ label = 'Selection marker',
25
+ domain,
26
+ }: {
27
+ selection: PlSelectionModel | undefined;
28
+ columnId?: PObjectId;
29
+ label?: string;
30
+ domain?: Record<string, string>;
31
+ }): PColumn<PColumnValues> | undefined {
32
+ if (!selection?.axesSpec.length) {
33
+ return;
34
+ }
35
+ const data: PColumnValues = selection.selectedKeys
36
+ .filter((r): r is PColumnKey => r.every((v) => !isPTableAbsent(v)))
37
+ .map((r) => ({ key: r, val: 1 }));
38
+ if (!data.length) {
39
+ return;
51
40
  }
52
-
53
41
  return {
54
42
  id: columnId,
55
43
  spec: {
56
44
  kind: 'PColumn',
57
45
  valueType: 'Int',
58
46
  name: 'pl7.app/table/row-selection',
59
- axesSpec: rowSelectionModel.axesSpec,
60
- ...(domain && { domain }),
47
+ axesSpec: selection.axesSpec,
48
+ ...(domain && Object.keys(domain).length && { domain }),
61
49
  annotations: {
62
- 'pl7.app/label': label ?? 'Selected rows',
50
+ 'pl7.app/label': label,
63
51
  'pl7.app/discreteValues': '[1]',
64
52
  },
65
53
  },
66
- data: rowSelectionModel
67
- .selectedKeys
68
- .filter((r): r is PColumnKey => !r.some((v) => isPTableAbsent(v)))
69
- .map((r) => ({ key: r, val: 1 } satisfies PColumnValuesEntry)),
70
- } satisfies PColumn<PColumnValues>;
54
+ data,
55
+ };
71
56
  }