@platforma-sdk/model 1.91.0 → 1.92.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/components/PlDatasetSelector/build_dataset_options.cjs +43 -33
- package/dist/components/PlDatasetSelector/build_dataset_options.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.d.ts +6 -2
- package/dist/components/PlDatasetSelector/build_dataset_options.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.js +46 -36
- package/dist/components/PlDatasetSelector/build_dataset_options.js.map +1 -1
- package/dist/components/PlDatasetSelector/dataset_selection.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/dataset_selection.d.ts +13 -4
- package/dist/components/PlDatasetSelector/dataset_selection.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/dataset_selection.js.map +1 -1
- package/dist/components/PlDatasetSelector/enrichment_discovery.cjs +20 -26
- package/dist/components/PlDatasetSelector/enrichment_discovery.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/enrichment_discovery.js +22 -28
- package/dist/components/PlDatasetSelector/enrichment_discovery.js.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.cjs +6 -14
- package/dist/components/PlDatasetSelector/filter_discovery.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.d.ts +5 -10
- package/dist/components/PlDatasetSelector/filter_discovery.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.js +8 -13
- package/dist/components/PlDatasetSelector/filter_discovery.js.map +1 -1
- package/dist/components/PlDatasetSelector/index.cjs +0 -1
- package/dist/components/PlDatasetSelector/index.d.ts +3 -3
- package/dist/components/PlDatasetSelector/index.js +2 -2
- package/dist/components/index.cjs +0 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +2 -2
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/package.json +7 -7
- package/src/columns/__test_helpers__/collection_driver.ts +45 -5
- package/src/components/PlDatasetSelector/build_dataset_options.test.ts +195 -0
- package/src/components/PlDatasetSelector/build_dataset_options.ts +86 -63
- package/src/components/PlDatasetSelector/dataset_selection.ts +14 -4
- package/src/components/PlDatasetSelector/enrichment_discovery.ts +26 -35
- package/src/components/PlDatasetSelector/filter_discovery.test.ts +16 -53
- package/src/components/PlDatasetSelector/filter_discovery.ts +10 -20
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { Annotation,
|
|
1
|
+
import { Annotation, columnProducer, createPlRef } from "@milaboratories/pl-model-common";
|
|
2
2
|
import type {
|
|
3
3
|
ColumnsCollectionDriverModel,
|
|
4
4
|
Option,
|
|
5
5
|
PColumnSpec,
|
|
6
6
|
PlRef,
|
|
7
|
-
PObjectId,
|
|
8
7
|
PObjectSpec,
|
|
9
8
|
} from "@milaboratories/pl-model-common";
|
|
10
|
-
import
|
|
11
|
-
import type { ColumnRecipe, ColumnsSource } from "../../columns";
|
|
9
|
+
import type { ColumnRecipe, ColumnsSource, ColumnsSourceShorthand } from "../../columns";
|
|
12
10
|
import { ColumnsCollection, collectLinkerColumns } from "../../columns";
|
|
13
11
|
import {
|
|
14
12
|
deriveDistinctLabels,
|
|
@@ -17,7 +15,7 @@ import {
|
|
|
17
15
|
} from "../../labels/derive_distinct_labels";
|
|
18
16
|
|
|
19
17
|
export interface FindFilterColumnsOptions {
|
|
20
|
-
sources: ReadonlyArray<ColumnsSource>;
|
|
18
|
+
sources: ReadonlyArray<ColumnsCollection | ColumnsSource | ColumnsSourceShorthand>;
|
|
21
19
|
anchorSpec: PColumnSpec;
|
|
22
20
|
/** Override the resolved `columnsCollection` service (primarily for tests). */
|
|
23
21
|
driver?: ColumnsCollectionDriverModel;
|
|
@@ -43,8 +41,6 @@ export function findFilterColumns(options: FindFilterColumnsOptions): ColumnReci
|
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
export type FilterMatchOptions = {
|
|
46
|
-
/** Maps result-pool column id back to its source PlRef (see {@link buildRefMap}). */
|
|
47
|
-
refsByObjectId: ReadonlyMap<PObjectId, PlRef>;
|
|
48
44
|
/** Spec of the dataset the filters are subsets of. */
|
|
49
45
|
datasetSpec: PObjectSpec;
|
|
50
46
|
/**
|
|
@@ -59,8 +55,8 @@ export type FilterMatchOptions = {
|
|
|
59
55
|
/**
|
|
60
56
|
* Derive labeled options from filter column variants, for use in DatasetOption.filters.
|
|
61
57
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
58
|
+
* A filter is stored as a reference to a block output, so a column that is
|
|
59
|
+
* not one — a column of the current block — is silently skipped.
|
|
64
60
|
*/
|
|
65
61
|
export function filterMatchesToOptions(
|
|
66
62
|
variants: ColumnRecipe[],
|
|
@@ -68,17 +64,16 @@ export function filterMatchesToOptions(
|
|
|
68
64
|
): Option[] {
|
|
69
65
|
if (variants.length === 0) return [];
|
|
70
66
|
|
|
71
|
-
const {
|
|
67
|
+
const { datasetSpec, labelOptions } = options;
|
|
72
68
|
|
|
73
69
|
// One Option per variant — `deriveDistinctLabels` disambiguates labels by
|
|
74
|
-
// path.
|
|
75
|
-
// ref lookup happens once per variant.
|
|
70
|
+
// path.
|
|
76
71
|
const entries: (Entry & { ref: PlRef })[] = variants.flatMap((variant) => {
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
72
|
+
const producer = columnProducer(variant.id);
|
|
73
|
+
if (producer === undefined) return [];
|
|
79
74
|
return [
|
|
80
75
|
{
|
|
81
|
-
ref,
|
|
76
|
+
ref: createPlRef(producer.blockId, producer.name),
|
|
82
77
|
spec: variant.getSpec(),
|
|
83
78
|
linkerPath: collectLinkerColumns(variant).map((linker) => ({ spec: linker.getSpec() })),
|
|
84
79
|
},
|
|
@@ -98,8 +93,3 @@ export function filterMatchesToOptions(
|
|
|
98
93
|
|
|
99
94
|
return entries.map(({ ref }, i) => ({ ref, label: labels[i] }));
|
|
100
95
|
}
|
|
101
|
-
|
|
102
|
-
/** Build the `refsByObjectId` map from `ctx.resultPool.getSpecs().entries`. */
|
|
103
|
-
export function buildRefMap(entries: readonly { readonly ref: PlRef }[]): Map<PObjectId, PlRef> {
|
|
104
|
-
return new Map(entries.map((e) => [canonicalize(e.ref)! as PObjectId, e.ref]));
|
|
105
|
-
}
|