@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.
Files changed (39) hide show
  1. package/dist/components/PlDatasetSelector/build_dataset_options.cjs +43 -33
  2. package/dist/components/PlDatasetSelector/build_dataset_options.cjs.map +1 -1
  3. package/dist/components/PlDatasetSelector/build_dataset_options.d.ts +6 -2
  4. package/dist/components/PlDatasetSelector/build_dataset_options.d.ts.map +1 -1
  5. package/dist/components/PlDatasetSelector/build_dataset_options.js +46 -36
  6. package/dist/components/PlDatasetSelector/build_dataset_options.js.map +1 -1
  7. package/dist/components/PlDatasetSelector/dataset_selection.cjs.map +1 -1
  8. package/dist/components/PlDatasetSelector/dataset_selection.d.ts +13 -4
  9. package/dist/components/PlDatasetSelector/dataset_selection.d.ts.map +1 -1
  10. package/dist/components/PlDatasetSelector/dataset_selection.js.map +1 -1
  11. package/dist/components/PlDatasetSelector/enrichment_discovery.cjs +20 -26
  12. package/dist/components/PlDatasetSelector/enrichment_discovery.cjs.map +1 -1
  13. package/dist/components/PlDatasetSelector/enrichment_discovery.js +22 -28
  14. package/dist/components/PlDatasetSelector/enrichment_discovery.js.map +1 -1
  15. package/dist/components/PlDatasetSelector/filter_discovery.cjs +6 -14
  16. package/dist/components/PlDatasetSelector/filter_discovery.cjs.map +1 -1
  17. package/dist/components/PlDatasetSelector/filter_discovery.d.ts +5 -10
  18. package/dist/components/PlDatasetSelector/filter_discovery.d.ts.map +1 -1
  19. package/dist/components/PlDatasetSelector/filter_discovery.js +8 -13
  20. package/dist/components/PlDatasetSelector/filter_discovery.js.map +1 -1
  21. package/dist/components/PlDatasetSelector/index.cjs +0 -1
  22. package/dist/components/PlDatasetSelector/index.d.ts +3 -3
  23. package/dist/components/PlDatasetSelector/index.js +2 -2
  24. package/dist/components/index.cjs +0 -1
  25. package/dist/components/index.d.ts +3 -3
  26. package/dist/components/index.js +2 -2
  27. package/dist/index.cjs +0 -1
  28. package/dist/index.d.ts +3 -3
  29. package/dist/index.js +2 -2
  30. package/dist/package.cjs +1 -1
  31. package/dist/package.js +1 -1
  32. package/package.json +7 -7
  33. package/src/columns/__test_helpers__/collection_driver.ts +45 -5
  34. package/src/components/PlDatasetSelector/build_dataset_options.test.ts +195 -0
  35. package/src/components/PlDatasetSelector/build_dataset_options.ts +86 -63
  36. package/src/components/PlDatasetSelector/dataset_selection.ts +14 -4
  37. package/src/components/PlDatasetSelector/enrichment_discovery.ts +26 -35
  38. package/src/components/PlDatasetSelector/filter_discovery.test.ts +16 -53
  39. package/src/components/PlDatasetSelector/filter_discovery.ts +10 -20
@@ -1,14 +1,12 @@
1
- import { Annotation, extractPObjectId } from "@milaboratories/pl-model-common";
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 canonicalize from "canonicalize";
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
- * Entries whose column id has no PlRef in `refsByObjectId` are silently
63
- * skipped — they cannot be exposed as user-selectable options.
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 { refsByObjectId, datasetSpec, labelOptions } = options;
67
+ const { datasetSpec, labelOptions } = options;
72
68
 
73
69
  // One Option per variant — `deriveDistinctLabels` disambiguates labels by
74
- // path. All variants of the same column share a terminal PObjectId, so the
75
- // ref lookup happens once per variant.
70
+ // path.
76
71
  const entries: (Entry & { ref: PlRef })[] = variants.flatMap((variant) => {
77
- const ref = refsByObjectId.get(extractPObjectId(variant.id));
78
- if (ref === undefined) return [];
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
- }