@platforma-sdk/model 1.79.27 → 1.80.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/block_model.d.ts +2 -0
- package/dist/block_model.d.ts.map +1 -1
- package/dist/columns/column.cjs +28 -0
- package/dist/columns/column.cjs.map +1 -0
- package/dist/columns/column.d.ts +30 -0
- package/dist/columns/column.d.ts.map +1 -0
- package/dist/columns/column.js +27 -0
- package/dist/columns/column.js.map +1 -0
- package/dist/columns/column_lazy.cjs +248 -0
- package/dist/columns/column_lazy.cjs.map +1 -0
- package/dist/columns/column_lazy.d.ts +137 -0
- package/dist/columns/column_lazy.d.ts.map +1 -0
- package/dist/columns/column_lazy.js +245 -0
- package/dist/columns/column_lazy.js.map +1 -0
- package/dist/columns/column_providers/index.cjs +62 -0
- package/dist/columns/column_providers/index.cjs.map +1 -0
- package/dist/columns/column_providers/index.d.ts +30 -0
- package/dist/columns/column_providers/index.d.ts.map +1 -0
- package/dist/columns/column_providers/index.js +53 -0
- package/dist/columns/column_providers/index.js.map +1 -0
- package/dist/columns/column_providers/providers.cjs +123 -0
- package/dist/columns/column_providers/providers.cjs.map +1 -0
- package/dist/columns/column_providers/providers.d.ts +75 -0
- package/dist/columns/column_providers/providers.d.ts.map +1 -0
- package/dist/columns/column_providers/providers.js +118 -0
- package/dist/columns/column_providers/providers.js.map +1 -0
- package/dist/columns/column_providers/types.d.ts +23 -0
- package/dist/columns/column_providers/types.d.ts.map +1 -0
- package/dist/columns/column_recipes/column_discovered_recipe.cjs +180 -0
- package/dist/columns/column_recipes/column_discovered_recipe.cjs.map +1 -0
- package/dist/columns/column_recipes/column_discovered_recipe.d.ts +120 -0
- package/dist/columns/column_recipes/column_discovered_recipe.d.ts.map +1 -0
- package/dist/columns/column_recipes/column_discovered_recipe.js +180 -0
- package/dist/columns/column_recipes/column_discovered_recipe.js.map +1 -0
- package/dist/columns/column_recipes/column_filtered_recipe.cjs +133 -0
- package/dist/columns/column_recipes/column_filtered_recipe.cjs.map +1 -0
- package/dist/columns/column_recipes/column_filtered_recipe.d.ts +75 -0
- package/dist/columns/column_recipes/column_filtered_recipe.d.ts.map +1 -0
- package/dist/columns/column_recipes/column_filtered_recipe.js +133 -0
- package/dist/columns/column_recipes/column_filtered_recipe.js.map +1 -0
- package/dist/columns/column_recipes/column_overrided_recipe.cjs +101 -0
- package/dist/columns/column_recipes/column_overrided_recipe.cjs.map +1 -0
- package/dist/columns/column_recipes/column_overrided_recipe.d.ts +73 -0
- package/dist/columns/column_recipes/column_overrided_recipe.d.ts.map +1 -0
- package/dist/columns/column_recipes/column_overrided_recipe.js +101 -0
- package/dist/columns/column_recipes/column_overrided_recipe.js.map +1 -0
- package/dist/columns/column_recipes/index.cjs +72 -0
- package/dist/columns/column_recipes/index.cjs.map +1 -0
- package/dist/columns/column_recipes/index.d.ts +52 -0
- package/dist/columns/column_recipes/index.d.ts.map +1 -0
- package/dist/columns/column_recipes/index.js +68 -0
- package/dist/columns/column_recipes/index.js.map +1 -0
- package/dist/columns/column_recipes/leaf_rebrand.cjs +22 -0
- package/dist/columns/column_recipes/leaf_rebrand.cjs.map +1 -0
- package/dist/columns/column_recipes/leaf_rebrand.js +22 -0
- package/dist/columns/column_recipes/leaf_rebrand.js.map +1 -0
- package/dist/columns/column_recipes/types.d.ts +101 -0
- package/dist/columns/column_recipes/types.d.ts.map +1 -0
- package/dist/columns/columns_collection.cjs +124 -0
- package/dist/columns/columns_collection.cjs.map +1 -0
- package/dist/columns/columns_collection.d.ts +64 -0
- package/dist/columns/columns_collection.d.ts.map +1 -0
- package/dist/columns/columns_collection.js +122 -0
- package/dist/columns/columns_collection.js.map +1 -0
- package/dist/columns/derive_axis_values_labels.cjs +76 -0
- package/dist/columns/derive_axis_values_labels.cjs.map +1 -0
- package/dist/columns/derive_axis_values_labels.d.ts +30 -0
- package/dist/columns/derive_axis_values_labels.d.ts.map +1 -0
- package/dist/columns/derive_axis_values_labels.js +76 -0
- package/dist/columns/derive_axis_values_labels.js.map +1 -0
- package/dist/columns/expand_by_partition.cjs +53 -56
- package/dist/columns/expand_by_partition.cjs.map +1 -1
- package/dist/columns/expand_by_partition.d.ts +22 -18
- package/dist/columns/expand_by_partition.d.ts.map +1 -1
- package/dist/columns/expand_by_partition.js +55 -58
- package/dist/columns/expand_by_partition.js.map +1 -1
- package/dist/columns/index.cjs +44 -18
- package/dist/columns/index.d.ts +15 -7
- package/dist/columns/index.js +12 -6
- package/dist/columns/utils.cjs +186 -0
- package/dist/columns/utils.cjs.map +1 -0
- package/dist/columns/utils.d.ts +96 -0
- package/dist/columns/utils.d.ts.map +1 -0
- package/dist/columns/utils.js +179 -0
- package/dist/columns/utils.js.map +1 -0
- package/dist/components/PFrameForGraphs.cjs +1 -0
- package/dist/components/PFrameForGraphs.cjs.map +1 -1
- package/dist/components/PFrameForGraphs.d.ts +1 -1
- package/dist/components/PFrameForGraphs.d.ts.map +1 -1
- package/dist/components/PFrameForGraphs.js +1 -0
- package/dist/components/PFrameForGraphs.js.map +1 -1
- package/dist/components/PlDataTable/columnResolver.cjs +28 -0
- package/dist/components/PlDataTable/columnResolver.cjs.map +1 -0
- package/dist/components/PlDataTable/columnResolver.js +28 -0
- package/dist/components/PlDataTable/columnResolver.js.map +1 -0
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.cjs +4 -2
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.js +4 -2
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.cjs +20 -25
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js +20 -25
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.cjs +58 -26
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.d.ts +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.js +60 -28
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs +224 -194
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts +13 -16
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js +228 -198
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.cjs +40 -98
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.d.ts +17 -8
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.js +40 -98
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/index.cjs +1 -1
- package/dist/components/PlDataTable/createPlDataTable/index.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/index.d.ts +2 -2
- package/dist/components/PlDataTable/createPlDataTable/index.js +2 -2
- package/dist/components/PlDataTable/createPlDataTable/index.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/utils.cjs +51 -169
- package/dist/components/PlDataTable/createPlDataTable/utils.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/utils.d.ts +1 -1
- package/dist/components/PlDataTable/createPlDataTable/utils.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/utils.js +52 -166
- package/dist/components/PlDataTable/createPlDataTable/utils.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.d.ts +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.js.map +1 -1
- package/dist/components/PlDataTable/index.cjs +1 -1
- package/dist/components/PlDataTable/index.d.ts +4 -4
- package/dist/components/PlDataTable/index.js +2 -2
- package/dist/components/PlDataTable/labels.cjs +0 -1
- package/dist/components/PlDataTable/labels.cjs.map +1 -1
- package/dist/components/PlDataTable/labels.js +0 -1
- package/dist/components/PlDataTable/labels.js.map +1 -1
- package/dist/components/PlDataTable/state-migration.cjs +107 -10
- package/dist/components/PlDataTable/state-migration.cjs.map +1 -1
- package/dist/components/PlDataTable/state-migration.d.ts +5 -4
- package/dist/components/PlDataTable/state-migration.d.ts.map +1 -1
- package/dist/components/PlDataTable/state-migration.js +107 -10
- package/dist/components/PlDataTable/state-migration.js.map +1 -1
- package/dist/components/PlDataTable/typesV7.d.ts +1 -36
- package/dist/components/PlDataTable/typesV7.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV8.d.ts +123 -0
- package/dist/components/PlDataTable/typesV8.d.ts.map +1 -0
- package/dist/components/PlDatasetSelector/build_dataset_options.cjs +27 -34
- package/dist/components/PlDatasetSelector/build_dataset_options.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.js +27 -34
- package/dist/components/PlDatasetSelector/build_dataset_options.js.map +1 -1
- package/dist/components/PlDatasetSelector/enrichment_discovery.cjs +28 -33
- package/dist/components/PlDatasetSelector/enrichment_discovery.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/enrichment_discovery.js +29 -34
- package/dist/components/PlDatasetSelector/enrichment_discovery.js.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.cjs +27 -17
- package/dist/components/PlDatasetSelector/filter_discovery.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.d.ts +24 -10
- package/dist/components/PlDatasetSelector/filter_discovery.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.js +28 -18
- package/dist/components/PlDatasetSelector/filter_discovery.js.map +1 -1
- package/dist/components/PlDatasetSelector/index.d.ts +2 -2
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +5 -5
- package/dist/components/index.js +2 -2
- package/dist/filters/converters/filterToQuery.cjs +5 -6
- package/dist/filters/converters/filterToQuery.cjs.map +1 -1
- package/dist/filters/converters/filterToQuery.d.ts +12 -3
- package/dist/filters/converters/filterToQuery.d.ts.map +1 -1
- package/dist/filters/converters/filterToQuery.js +5 -6
- package/dist/filters/converters/filterToQuery.js.map +1 -1
- package/dist/filters/converters/index.d.ts +2 -2
- package/dist/filters/index.d.ts +2 -2
- package/dist/index.cjs +64 -35
- package/dist/index.d.ts +23 -15
- package/dist/index.js +15 -9
- package/dist/labels/derive_distinct_labels.cjs.map +1 -1
- package/dist/labels/derive_distinct_labels.d.ts +1 -2
- package/dist/labels/derive_distinct_labels.d.ts.map +1 -1
- package/dist/labels/derive_distinct_labels.js.map +1 -1
- package/dist/labels/derive_distinct_tooltips.cjs +1 -1
- package/dist/labels/derive_distinct_tooltips.cjs.map +1 -1
- package/dist/labels/derive_distinct_tooltips.d.ts +6 -3
- package/dist/labels/derive_distinct_tooltips.d.ts.map +1 -1
- package/dist/labels/derive_distinct_tooltips.js +1 -1
- package/dist/labels/derive_distinct_tooltips.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/pframe_utils/axes.cjs.map +1 -1
- package/dist/pframe_utils/axes.d.ts +2 -2
- package/dist/pframe_utils/axes.d.ts.map +1 -1
- package/dist/pframe_utils/axes.js.map +1 -1
- package/dist/pframe_utils/columns.cjs +6 -10
- package/dist/pframe_utils/columns.cjs.map +1 -1
- package/dist/pframe_utils/columns.d.ts +4 -4
- package/dist/pframe_utils/columns.d.ts.map +1 -1
- package/dist/pframe_utils/columns.js +7 -11
- package/dist/pframe_utils/columns.js.map +1 -1
- package/dist/pframe_utils/index.cjs.map +1 -1
- package/dist/pframe_utils/index.d.ts +1 -1
- package/dist/pframe_utils/index.d.ts.map +1 -1
- package/dist/pframe_utils/index.js.map +1 -1
- package/dist/render/accessor.cjs +15 -16
- package/dist/render/accessor.cjs.map +1 -1
- package/dist/render/accessor.d.ts +7 -10
- package/dist/render/accessor.d.ts.map +1 -1
- package/dist/render/accessor.js +15 -16
- package/dist/render/accessor.js.map +1 -1
- package/dist/render/api.cjs +34 -36
- package/dist/render/api.cjs.map +1 -1
- package/dist/render/api.d.ts +30 -20
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/api.js +35 -38
- package/dist/render/api.js.map +1 -1
- package/dist/render/index.cjs +4 -0
- package/dist/render/index.d.ts +4 -4
- package/dist/render/index.js +3 -2
- package/dist/render/internal.cjs +3 -2
- package/dist/render/internal.cjs.map +1 -1
- package/dist/render/internal.d.ts +17 -9
- package/dist/render/internal.d.ts.map +1 -1
- package/dist/render/internal.js +3 -2
- package/dist/render/internal.js.map +1 -1
- package/dist/render/util/axis_filtering.cjs.map +1 -1
- package/dist/render/util/axis_filtering.js.map +1 -1
- package/dist/render/util/column_collection.cjs +6 -4
- package/dist/render/util/column_collection.cjs.map +1 -1
- package/dist/render/util/column_collection.d.ts +9 -9
- package/dist/render/util/column_collection.d.ts.map +1 -1
- package/dist/render/util/column_collection.js +6 -4
- package/dist/render/util/column_collection.js.map +1 -1
- package/dist/render/util/index.d.ts +2 -2
- package/dist/render/util/pcolumn_data.cjs +1 -1
- package/dist/render/util/pcolumn_data.cjs.map +1 -1
- package/dist/render/util/pcolumn_data.d.ts +3 -3
- package/dist/render/util/pcolumn_data.d.ts.map +1 -1
- package/dist/render/util/pcolumn_data.js +1 -1
- package/dist/render/util/pcolumn_data.js.map +1 -1
- package/dist/services/block_services.cjs +2 -1
- package/dist/services/block_services.cjs.map +1 -1
- package/dist/services/block_services.d.ts +1 -0
- package/dist/services/block_services.d.ts.map +1 -1
- package/dist/services/block_services.js +2 -1
- package/dist/services/block_services.js.map +1 -1
- package/dist/services/get_services.cjs +2 -2
- package/dist/services/get_services.cjs.map +1 -1
- package/dist/services/get_services.d.ts +4 -1
- package/dist/services/get_services.d.ts.map +1 -1
- package/dist/services/get_services.js +2 -2
- package/dist/services/get_services.js.map +1 -1
- package/package.json +10 -8
- package/src/columns/__test_helpers__/collection_driver.ts +197 -0
- package/src/columns/__test_helpers__/stub_registry.ts +134 -0
- package/src/columns/column.ts +46 -0
- package/src/columns/column_lazy.test.ts +201 -0
- package/src/columns/column_lazy.ts +311 -0
- package/src/columns/column_providers/index.ts +78 -0
- package/src/columns/column_providers/providers.ts +193 -0
- package/src/columns/column_providers/types.ts +24 -0
- package/src/columns/column_recipes/column_discovered_recipe.ts +231 -0
- package/src/columns/column_recipes/column_filtered_recipe.ts +184 -0
- package/src/columns/column_recipes/column_overrided_recipe.ts +146 -0
- package/src/columns/column_recipes/column_recipes.test.ts +681 -0
- package/src/columns/column_recipes/index.ts +127 -0
- package/src/columns/column_recipes/leaf_rebrand.ts +28 -0
- package/src/columns/column_recipes/types.ts +113 -0
- package/src/columns/columns_collection.test.ts +164 -0
- package/src/columns/columns_collection.ts +170 -0
- package/src/columns/derive_axis_values_labels.ts +98 -0
- package/src/columns/expand_by_partition.test.ts +146 -110
- package/src/columns/expand_by_partition.ts +72 -84
- package/src/columns/index.ts +7 -5
- package/src/columns/utils.test.ts +249 -0
- package/src/columns/utils.ts +226 -0
- package/src/components/PFrameForGraphs.ts +3 -1
- package/src/components/PlAnnotations/filters_ui.test.ts +46 -47
- package/src/components/PlDataTable/columnResolver.test.ts +122 -0
- package/src/components/PlDataTable/columnResolver.ts +57 -0
- package/src/components/PlDataTable/createPlDataTable/createPTableDefV2.ts +9 -9
- package/src/components/PlDataTable/createPlDataTable/createPTableDefV3.ts +31 -63
- package/src/components/PlDataTable/createPlDataTable/createPlDataTableV2.ts +85 -58
- package/src/components/PlDataTable/createPlDataTable/createPlDataTableV3.ts +316 -354
- package/src/components/PlDataTable/createPlDataTable/discoverColumns.ts +48 -144
- package/src/components/PlDataTable/createPlDataTable/index.ts +2 -2
- package/src/components/PlDataTable/createPlDataTable/utils.test.ts +60 -69
- package/src/components/PlDataTable/createPlDataTable/utils.ts +65 -173
- package/src/components/PlDataTable/createPlDataTableSheet.ts +1 -1
- package/src/components/PlDataTable/index.ts +4 -2
- package/src/components/PlDataTable/labels.ts +4 -33
- package/src/components/PlDataTable/state-migration.ts +151 -22
- package/src/components/PlDataTable/typesV8.ts +188 -0
- package/src/components/PlDatasetSelector/build_dataset_options.ts +35 -60
- package/src/components/PlDatasetSelector/enrichment_discovery.ts +65 -61
- package/src/components/PlDatasetSelector/filter_discovery.test.ts +110 -72
- package/src/components/PlDatasetSelector/filter_discovery.ts +51 -31
- package/src/filters/converters/filterToQuery.test.ts +15 -8
- package/src/filters/converters/filterToQuery.ts +22 -9
- package/src/filters/converters/filterUiToExpressionImpl.test.ts +35 -36
- package/src/labels/derive_distinct_labels.ts +1 -1
- package/src/labels/derive_distinct_tooltips.test.ts +7 -4
- package/src/labels/derive_distinct_tooltips.ts +3 -3
- package/src/pframe_utils/axes.ts +2 -2
- package/src/pframe_utils/columns.ts +14 -23
- package/src/pframe_utils/index.ts +1 -1
- package/src/render/accessor.ts +35 -38
- package/src/render/api.ts +45 -61
- package/src/render/index.ts +2 -1
- package/src/render/internal.ts +43 -10
- package/src/render/util/axis_filtering.ts +0 -1
- package/src/render/util/column_collection.ts +17 -17
- package/src/render/util/pcolumn_data.ts +5 -9
- package/src/services/block_services.ts +1 -0
- package/src/services/get_services.ts +5 -2
- package/dist/columns/column_collection_builder.cjs +0 -241
- package/dist/columns/column_collection_builder.cjs.map +0 -1
- package/dist/columns/column_collection_builder.d.ts +0 -119
- package/dist/columns/column_collection_builder.d.ts.map +0 -1
- package/dist/columns/column_collection_builder.js +0 -241
- package/dist/columns/column_collection_builder.js.map +0 -1
- package/dist/columns/column_selector.cjs +0 -49
- package/dist/columns/column_selector.cjs.map +0 -1
- package/dist/columns/column_selector.d.ts +0 -33
- package/dist/columns/column_selector.d.ts.map +0 -1
- package/dist/columns/column_selector.js +0 -47
- package/dist/columns/column_selector.js.map +0 -1
- package/dist/columns/column_snapshot.cjs +0 -19
- package/dist/columns/column_snapshot.cjs.map +0 -1
- package/dist/columns/column_snapshot.d.ts +0 -39
- package/dist/columns/column_snapshot.d.ts.map +0 -1
- package/dist/columns/column_snapshot.js +0 -18
- package/dist/columns/column_snapshot.js.map +0 -1
- package/dist/columns/column_snapshot_provider.cjs +0 -137
- package/dist/columns/column_snapshot_provider.cjs.map +0 -1
- package/dist/columns/column_snapshot_provider.d.ts +0 -74
- package/dist/columns/column_snapshot_provider.d.ts.map +0 -1
- package/dist/columns/column_snapshot_provider.js +0 -133
- package/dist/columns/column_snapshot_provider.js.map +0 -1
- package/dist/columns/ctx_column_sources.cjs +0 -80
- package/dist/columns/ctx_column_sources.cjs.map +0 -1
- package/dist/columns/ctx_column_sources.d.ts +0 -30
- package/dist/columns/ctx_column_sources.d.ts.map +0 -1
- package/dist/columns/ctx_column_sources.js +0 -79
- package/dist/columns/ctx_column_sources.js.map +0 -1
- package/src/columns/column_collection_builder.test.ts +0 -484
- package/src/columns/column_collection_builder.ts +0 -485
- package/src/columns/column_selector.test.ts +0 -90
- package/src/columns/column_selector.ts +0 -100
- package/src/columns/column_snapshot.ts +0 -58
- package/src/columns/column_snapshot_provider.ts +0 -194
- package/src/columns/ctx_column_sources.ts +0 -99
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import {
|
|
2
|
+
collectSpecQueryColumns,
|
|
3
|
+
extractPObjectId,
|
|
4
|
+
isDataInfo,
|
|
5
|
+
visitDataInfo,
|
|
6
|
+
type AxisQualification,
|
|
7
|
+
type ColumnUniversalId,
|
|
8
|
+
type PObjectId,
|
|
9
|
+
} from "@milaboratories/pl-model-common";
|
|
10
|
+
import { throwError } from "@milaboratories/helpers";
|
|
11
|
+
import type { GlobalCfgRenderCtx } from "../render/internal";
|
|
12
|
+
import { TreeNodeAccessor } from "../render";
|
|
13
|
+
import { deriveDistinctLabels, type DeriveLabelsOptions } from "../labels/derive_distinct_labels";
|
|
14
|
+
import { ColumnLazy, ColumnLazyImpl, type ColumnLazyData } from "./column_lazy";
|
|
15
|
+
import { ColumnDiscoveredRecipe } from "./column_recipes/column_discovered_recipe";
|
|
16
|
+
import { ColumnFilteredRecipe } from "./column_recipes/column_filtered_recipe";
|
|
17
|
+
import { ColumnOverriddenRecipe } from "./column_recipes/column_overrided_recipe";
|
|
18
|
+
import type { ColumnRecipe } from "./column_recipes/types";
|
|
19
|
+
import { ColumnsCollection, isColumnsCollection } from "./columns_collection";
|
|
20
|
+
import type { ColumnsSource } from "./column_providers/types";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* PObjectIds of every non-hit column referenced by `recipe.getQuery()`,
|
|
24
|
+
* deduped in traversal order. The hit column is
|
|
25
|
+
* `extractPObjectId(recipe.id)`; anything else in the query is a linker or
|
|
26
|
+
* other engine-consumed column.
|
|
27
|
+
*
|
|
28
|
+
* Pure query walk — no registry access. Use {@link collectLinkerColumns} for
|
|
29
|
+
* the resolved {@link ColumnLazy} variant.
|
|
30
|
+
*/
|
|
31
|
+
export function collectLinkerIds(recipe: ColumnRecipe): PObjectId[] {
|
|
32
|
+
const hit = extractPObjectId(recipe.id);
|
|
33
|
+
const seen = new Set<PObjectId>();
|
|
34
|
+
const out: PObjectId[] = [];
|
|
35
|
+
for (const id of collectSpecQueryColumns(recipe.getQuery())) {
|
|
36
|
+
// Leaf ids in SpecQuery may be rich (e.g. ColumnDiscoveredId) — drop to
|
|
37
|
+
// bare PObjectId before comparing/registering so we hand the ambient
|
|
38
|
+
// ColumnRegistry physical ids it can resolve.
|
|
39
|
+
const bare = extractPObjectId(id);
|
|
40
|
+
if (bare === hit) continue;
|
|
41
|
+
if (seen.has(bare)) continue;
|
|
42
|
+
seen.add(bare);
|
|
43
|
+
out.push(bare);
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* {@link collectLinkerIds} resolved against the ambient context as
|
|
50
|
+
* {@link ColumnLazy} instances. Throws if any id fails to resolve —
|
|
51
|
+
* matches the contract of the legacy `resolveLinkers` it replaces.
|
|
52
|
+
*/
|
|
53
|
+
export function collectLinkerColumns(
|
|
54
|
+
recipe: ColumnRecipe,
|
|
55
|
+
opts: { ctx?: GlobalCfgRenderCtx } = {},
|
|
56
|
+
): ColumnLazy[] {
|
|
57
|
+
return collectLinkerIds(recipe).map(
|
|
58
|
+
(id) =>
|
|
59
|
+
ColumnLazyImpl.fromId(id, opts) ??
|
|
60
|
+
throwError(`materializeLinkers: linker ${id} not resolvable`),
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Hit-side axis qualifications for the recipe — the ones that should land on
|
|
66
|
+
* the outer-join entry wrapping this column at the consumer boundary.
|
|
67
|
+
*
|
|
68
|
+
* Descends {@link ColumnOverriddenRecipe} / {@link ColumnFilteredRecipe} via
|
|
69
|
+
* `getInner()` until it finds a {@link ColumnDiscoveredRecipe}; otherwise
|
|
70
|
+
* returns `[]`. Pure recipe walk — no query-tree introspection.
|
|
71
|
+
*/
|
|
72
|
+
export function hitQualifications(recipe: ColumnRecipe): readonly AxisQualification[] {
|
|
73
|
+
const discovered = findDiscovered(recipe);
|
|
74
|
+
return discovered?.getColumnQualifications() ?? [];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Per-primary-column axis qualifications for the recipe — applied to the
|
|
79
|
+
* outer primary anchors on this recipe's group side. Keyed by the external
|
|
80
|
+
* primary column id (NOT by columns inside this recipe's own query).
|
|
81
|
+
*
|
|
82
|
+
* Same walk strategy as {@link hitQualifications}.
|
|
83
|
+
*/
|
|
84
|
+
export function queriesQualifications(
|
|
85
|
+
recipe: ColumnRecipe,
|
|
86
|
+
): Readonly<Record<PObjectId, AxisQualification[]>> {
|
|
87
|
+
const discovered = findDiscovered(recipe);
|
|
88
|
+
return discovered?.getQueriesQualifications() ?? {};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Whether the recipe's underlying data resources actually carry bytes —
|
|
93
|
+
* strictly stronger than `getDataStatus() === "present"`, which only tells
|
|
94
|
+
* that the `.data` field is wired onto the accessor.
|
|
95
|
+
*
|
|
96
|
+
* Walks every physical leaf the recipe depends on via
|
|
97
|
+
* {@link ColumnRecipe.getReferencedIds} (resolves each id back to a
|
|
98
|
+
* {@link ColumnLazy} through the ambient ctx) and ANDs `hasData()` across
|
|
99
|
+
* all of them. Inline {@link PColumnValues} payloads count as present.
|
|
100
|
+
*
|
|
101
|
+
* Returns `false` if any leaf cannot be re-resolved in `opts.ctx` (treat as
|
|
102
|
+
* "not yet ready") rather than throwing — this is a UI-facing predicate, not
|
|
103
|
+
* a contract assertion.
|
|
104
|
+
*/
|
|
105
|
+
export function hasColumnData(
|
|
106
|
+
recipe: ColumnRecipe,
|
|
107
|
+
opts: { ctx?: GlobalCfgRenderCtx } = {},
|
|
108
|
+
): boolean {
|
|
109
|
+
for (const id of recipe.getReferencedIds()) {
|
|
110
|
+
const lazy = ColumnLazyImpl.fromId(id, opts);
|
|
111
|
+
if (lazy === undefined) return false;
|
|
112
|
+
if (lazy.getDataStatus() !== "present") return false;
|
|
113
|
+
if (!isLazyDataPresent(lazy.getData())) return false;
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function isLazyDataPresent(data: ColumnLazyData): boolean {
|
|
119
|
+
if (data === undefined) return false;
|
|
120
|
+
if (Array.isArray(data)) return true;
|
|
121
|
+
if (data instanceof TreeNodeAccessor) return data.hasData();
|
|
122
|
+
if (isDataInfo(data)) {
|
|
123
|
+
let ok = true;
|
|
124
|
+
visitDataInfo(data, (blob) => {
|
|
125
|
+
ok &&= blob.hasData();
|
|
126
|
+
});
|
|
127
|
+
return ok;
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Walk wrapper layers (Overridden, Filtered) until a {@link
|
|
134
|
+
* ColumnDiscoveredRecipe} is found. Returns `undefined` if the recipe chain
|
|
135
|
+
* has no Discovered layer (bare leaves and Overridden-over-leaf cases).
|
|
136
|
+
*
|
|
137
|
+
* Invariant from the wrapper classes themselves: there is at most one
|
|
138
|
+
* Discovered layer in any recipe chain — Discovered is constructed only via
|
|
139
|
+
* its own factory and is never re-wrapped by Discovered.
|
|
140
|
+
*/
|
|
141
|
+
function findDiscovered(recipe: ColumnRecipe): undefined | ColumnDiscoveredRecipe {
|
|
142
|
+
let current: ColumnRecipe = recipe;
|
|
143
|
+
while (true) {
|
|
144
|
+
if (current instanceof ColumnDiscoveredRecipe) return current;
|
|
145
|
+
if (current instanceof ColumnOverriddenRecipe || current instanceof ColumnFilteredRecipe) {
|
|
146
|
+
current = current.getInner();
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* A recipe is a "leaf" (directly co-indexed on the anchor, reached without a
|
|
155
|
+
* linker chain) iff its wrapper chain contains no {@link ColumnDiscoveredRecipe}.
|
|
156
|
+
*
|
|
157
|
+
* `Filtered` / `Overridden` over a bare leaf stay leaves; anything wrapping a
|
|
158
|
+
* `Discovered` (e.g. `Overridden(Discovered(...))`) is linked. Use this — not an
|
|
159
|
+
* `instanceof ColumnLazyImpl` check — to split direct vs. linker-joined columns,
|
|
160
|
+
* since projections over a plain leaf are still direct.
|
|
161
|
+
*/
|
|
162
|
+
export function isLeafColumn(recipe: ColumnRecipe): boolean {
|
|
163
|
+
return findDiscovered(recipe) === undefined;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Data of the bare leaf a "leaf" recipe bottoms out at — reads the leaf-only
|
|
168
|
+
* {@link ColumnLazy.getData} after walking the wrapper chain down via
|
|
169
|
+
* {@link extractLeafColumn}. Returns `undefined` when the recipe is not a leaf (its
|
|
170
|
+
* chain reaches a {@link ColumnDiscoveredRecipe}); the symmetric counterpart
|
|
171
|
+
* of {@link isLeafColumn} returning `false`.
|
|
172
|
+
*/
|
|
173
|
+
export function getLeafColumnData(recipe: ColumnRecipe): ColumnLazyData {
|
|
174
|
+
if (!isLeafColumn(recipe)) {
|
|
175
|
+
throw new Error(`getLeafColumnData: recipe ${recipe.id} is not a leaf column`);
|
|
176
|
+
}
|
|
177
|
+
return extractLeafColumn(recipe)?.getData();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Walk wrapper layers (Overridden, Filtered) down to the bare {@link ColumnLazy}
|
|
182
|
+
* leaf the chain bottoms out at. Returns `undefined` if the chain reaches a
|
|
183
|
+
* {@link ColumnDiscoveredRecipe} instead — i.e. the recipe is not a leaf
|
|
184
|
+
* ({@link isLeafColumn} would return `false`). Mirror of {@link findDiscovered}.
|
|
185
|
+
*/
|
|
186
|
+
function extractLeafColumn(recipe: ColumnRecipe): undefined | ColumnLazy {
|
|
187
|
+
let current: ColumnRecipe = recipe;
|
|
188
|
+
while (true) {
|
|
189
|
+
if (current instanceof ColumnLazyImpl) return current;
|
|
190
|
+
if (current instanceof ColumnOverriddenRecipe || current instanceof ColumnFilteredRecipe) {
|
|
191
|
+
current = current.getInner();
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (current instanceof ColumnDiscoveredRecipe) {
|
|
195
|
+
throw new Error(`extractLeafColumn: recipe ${recipe.id} is not a leaf column`);
|
|
196
|
+
}
|
|
197
|
+
throw new Error(`extractLeafColumn: unrecognized recipe layer for ${recipe.id}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** Drop-down option built over a {@link ColumnsCollection} — universal-id valued. */
|
|
202
|
+
export type ColumnOption = {
|
|
203
|
+
readonly id: ColumnUniversalId;
|
|
204
|
+
readonly label: string;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Enumerates every column already in `source` and renders distinct labels
|
|
209
|
+
* from each recipe's spec. Filtering is the caller's job — pass a
|
|
210
|
+
* {@link ColumnsCollection} that was already narrowed via `.filter(...)` /
|
|
211
|
+
* `.discover(...)`, or hand over a raw {@link ColumnsSource} (provider,
|
|
212
|
+
* accessor, column array, or `"result_pool"` / `"current_block"` shorthand)
|
|
213
|
+
* to be wrapped on the fly.
|
|
214
|
+
*/
|
|
215
|
+
export function deriveColumnOptions(
|
|
216
|
+
source: ColumnsCollection | ColumnsSource[],
|
|
217
|
+
labelOptions: DeriveLabelsOptions = {},
|
|
218
|
+
): ColumnOption[] {
|
|
219
|
+
const collection = isColumnsCollection(source) ? source : ColumnsCollection(source);
|
|
220
|
+
const recipes = collection.getColumns();
|
|
221
|
+
const labels = deriveDistinctLabels(
|
|
222
|
+
recipes.map((r) => r.getSpec()),
|
|
223
|
+
labelOptions,
|
|
224
|
+
);
|
|
225
|
+
return recipes.map((r, i) => ({ id: r.id, label: labels[i] }));
|
|
226
|
+
}
|
|
@@ -27,8 +27,10 @@ export function isHiddenFromUIColumn(column: PColumnSpec): boolean {
|
|
|
27
27
|
*/
|
|
28
28
|
export function createPFrameForGraphs<A, U>(
|
|
29
29
|
ctx: RenderCtxBase<A, U>,
|
|
30
|
-
blockColumns?: PColumn<PColumnDataUniversal>[],
|
|
30
|
+
blockColumns?: PColumn<undefined | PColumnDataUniversal>[],
|
|
31
31
|
): PFrameHandle | undefined {
|
|
32
|
+
if (blockColumns?.some((v) => v.data === undefined)) return undefined;
|
|
33
|
+
|
|
32
34
|
const suitableSpec = (spec: PColumnSpec) =>
|
|
33
35
|
!isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);
|
|
34
36
|
// if current block doesn't produce own columns then use all columns from result pool
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @DEPRECATED - use sdk/model/src/filters + sdk/model/src/annotations
|
|
2
|
-
import type { SUniversalPColumnId } from "@milaboratories/pl-model-common";
|
|
3
2
|
import { describe, expect, it, test } from "vitest";
|
|
4
3
|
import type {
|
|
5
4
|
AnnotationFilter,
|
|
@@ -37,10 +36,10 @@ describe("compileAnnotationScript", () => {
|
|
|
37
36
|
filter: {
|
|
38
37
|
type: "and",
|
|
39
38
|
filters: [
|
|
40
|
-
{ type: "isNA", column: "colA"
|
|
39
|
+
{ type: "isNA", column: "colA" },
|
|
41
40
|
{
|
|
42
41
|
type: "patternEquals",
|
|
43
|
-
column: "colB"
|
|
42
|
+
column: "colB",
|
|
44
43
|
value: "abc",
|
|
45
44
|
},
|
|
46
45
|
],
|
|
@@ -57,10 +56,10 @@ describe("compileAnnotationScript", () => {
|
|
|
57
56
|
filter: {
|
|
58
57
|
type: "and",
|
|
59
58
|
filters: [
|
|
60
|
-
{ type: "isNA", column: "colA"
|
|
59
|
+
{ type: "isNA", column: "colA" },
|
|
61
60
|
{
|
|
62
61
|
type: "pattern",
|
|
63
|
-
column: "colB"
|
|
62
|
+
column: "colB",
|
|
64
63
|
predicate: { type: "equals", value: "abc" },
|
|
65
64
|
},
|
|
66
65
|
],
|
|
@@ -77,11 +76,11 @@ describe("compileFilter", () => {
|
|
|
77
76
|
it('should compile "or" filter', () => {
|
|
78
77
|
const uiFilter: FilterUi = {
|
|
79
78
|
type: "or",
|
|
80
|
-
filters: [{ type: "isNA", column: "colA"
|
|
79
|
+
filters: [{ type: "isNA", column: "colA" }],
|
|
81
80
|
};
|
|
82
81
|
const expectedFilter: AnnotationFilter = {
|
|
83
82
|
type: "or",
|
|
84
|
-
filters: [{ type: "isNA", column: "colA"
|
|
83
|
+
filters: [{ type: "isNA", column: "colA" }],
|
|
85
84
|
};
|
|
86
85
|
expect(compileFilter(uiFilter)).toEqual(expectedFilter);
|
|
87
86
|
});
|
|
@@ -89,11 +88,11 @@ describe("compileFilter", () => {
|
|
|
89
88
|
it('should compile "and" filter', () => {
|
|
90
89
|
const uiFilter: FilterUi = {
|
|
91
90
|
type: "and",
|
|
92
|
-
filters: [{ type: "isNA", column: "colA"
|
|
91
|
+
filters: [{ type: "isNA", column: "colA" }],
|
|
93
92
|
};
|
|
94
93
|
const expectedFilter: AnnotationFilter = {
|
|
95
94
|
type: "and",
|
|
96
|
-
filters: [{ type: "isNA", column: "colA"
|
|
95
|
+
filters: [{ type: "isNA", column: "colA" }],
|
|
97
96
|
};
|
|
98
97
|
expect(compileFilter(uiFilter)).toEqual(expectedFilter);
|
|
99
98
|
});
|
|
@@ -102,13 +101,13 @@ describe("compileFilter", () => {
|
|
|
102
101
|
const uiFilter: FilterUi = {
|
|
103
102
|
type: "and",
|
|
104
103
|
filters: [
|
|
105
|
-
{ type: "isNA", column: "colA"
|
|
104
|
+
{ type: "isNA", column: "colA" },
|
|
106
105
|
{
|
|
107
106
|
type: "or",
|
|
108
107
|
filters: [
|
|
109
108
|
{
|
|
110
109
|
type: "patternEquals",
|
|
111
|
-
column: "colB"
|
|
110
|
+
column: "colB",
|
|
112
111
|
value: "test",
|
|
113
112
|
},
|
|
114
113
|
],
|
|
@@ -118,13 +117,13 @@ describe("compileFilter", () => {
|
|
|
118
117
|
const expectedFilter: AnnotationFilter = {
|
|
119
118
|
type: "and",
|
|
120
119
|
filters: [
|
|
121
|
-
{ type: "isNA", column: "colA"
|
|
120
|
+
{ type: "isNA", column: "colA" },
|
|
122
121
|
{
|
|
123
122
|
type: "or",
|
|
124
123
|
filters: [
|
|
125
124
|
{
|
|
126
125
|
type: "pattern",
|
|
127
|
-
column: "colB"
|
|
126
|
+
column: "colB",
|
|
128
127
|
predicate: { type: "equals", value: "test" },
|
|
129
128
|
},
|
|
130
129
|
],
|
|
@@ -137,20 +136,20 @@ describe("compileFilter", () => {
|
|
|
137
136
|
it('should compile "not" filter', () => {
|
|
138
137
|
const uiFilter: FilterUi = {
|
|
139
138
|
type: "not",
|
|
140
|
-
filter: { type: "isNA", column: "colA"
|
|
139
|
+
filter: { type: "isNA", column: "colA" },
|
|
141
140
|
};
|
|
142
141
|
const expectedFilter: AnnotationFilter = {
|
|
143
142
|
type: "not",
|
|
144
|
-
filter: { type: "isNA", column: "colA"
|
|
143
|
+
filter: { type: "isNA", column: "colA" },
|
|
145
144
|
};
|
|
146
145
|
expect(compileFilter(uiFilter)).toEqual(expectedFilter);
|
|
147
146
|
});
|
|
148
147
|
|
|
149
148
|
it('should compile "isNA" filter', () => {
|
|
150
|
-
const uiFilter: FilterUi = { type: "isNA", column: "colA"
|
|
149
|
+
const uiFilter: FilterUi = { type: "isNA", column: "colA" };
|
|
151
150
|
const expectedFilter: AnnotationFilter = {
|
|
152
151
|
type: "isNA",
|
|
153
|
-
column: "colA"
|
|
152
|
+
column: "colA",
|
|
154
153
|
};
|
|
155
154
|
expect(compileFilter(uiFilter)).toEqual(expectedFilter);
|
|
156
155
|
});
|
|
@@ -158,9 +157,9 @@ describe("compileFilter", () => {
|
|
|
158
157
|
it('should compile "isNotNA" filter', () => {
|
|
159
158
|
const uiFilter: FilterUi = {
|
|
160
159
|
type: "isNotNA",
|
|
161
|
-
column: "colA"
|
|
160
|
+
column: "colA",
|
|
162
161
|
};
|
|
163
|
-
const expectedIsNA: IsNA = { type: "isNA", column: "colA"
|
|
162
|
+
const expectedIsNA: IsNA = { type: "isNA", column: "colA" };
|
|
164
163
|
const expectedFilter: NotFilter = { type: "not", filter: expectedIsNA };
|
|
165
164
|
expect(compileFilter(uiFilter)).toEqual(expectedFilter);
|
|
166
165
|
});
|
|
@@ -168,12 +167,12 @@ describe("compileFilter", () => {
|
|
|
168
167
|
it('should compile "patternEquals" filter', () => {
|
|
169
168
|
const uiFilter: FilterUi = {
|
|
170
169
|
type: "patternEquals",
|
|
171
|
-
column: "colB"
|
|
170
|
+
column: "colB",
|
|
172
171
|
value: "abc",
|
|
173
172
|
};
|
|
174
173
|
const expectedFilter: AnnotationFilter = {
|
|
175
174
|
type: "pattern",
|
|
176
|
-
column: "colB"
|
|
175
|
+
column: "colB",
|
|
177
176
|
predicate: { type: "equals", value: "abc" },
|
|
178
177
|
};
|
|
179
178
|
expect(compileFilter(uiFilter)).toEqual(expectedFilter);
|
|
@@ -182,12 +181,12 @@ describe("compileFilter", () => {
|
|
|
182
181
|
it('should compile "patternNotEquals" filter', () => {
|
|
183
182
|
const uiFilter: FilterUi = {
|
|
184
183
|
type: "patternNotEquals",
|
|
185
|
-
column: "colB"
|
|
184
|
+
column: "colB",
|
|
186
185
|
value: "abc",
|
|
187
186
|
};
|
|
188
187
|
const expectedPatternFilter: PatternFilter = {
|
|
189
188
|
type: "pattern",
|
|
190
|
-
column: "colB"
|
|
189
|
+
column: "colB",
|
|
191
190
|
predicate: { type: "equals", value: "abc" },
|
|
192
191
|
};
|
|
193
192
|
const expectedFilter: NotFilter = { type: "not", filter: expectedPatternFilter };
|
|
@@ -197,12 +196,12 @@ describe("compileFilter", () => {
|
|
|
197
196
|
it('should compile "patternContainSubsequence" filter', () => {
|
|
198
197
|
const uiFilter: FilterUi = {
|
|
199
198
|
type: "patternContainSubsequence",
|
|
200
|
-
column: "colC"
|
|
199
|
+
column: "colC",
|
|
201
200
|
value: "sub",
|
|
202
201
|
};
|
|
203
202
|
const expectedFilter: AnnotationFilter = {
|
|
204
203
|
type: "pattern",
|
|
205
|
-
column: "colC"
|
|
204
|
+
column: "colC",
|
|
206
205
|
predicate: { type: "containSubsequence", value: "sub" },
|
|
207
206
|
};
|
|
208
207
|
expect(compileFilter(uiFilter)).toEqual(expectedFilter);
|
|
@@ -211,12 +210,12 @@ describe("compileFilter", () => {
|
|
|
211
210
|
it('should compile "patternNotContainSubsequence" filter', () => {
|
|
212
211
|
const uiFilter: FilterUi = {
|
|
213
212
|
type: "patternNotContainSubsequence",
|
|
214
|
-
column: "colC"
|
|
213
|
+
column: "colC",
|
|
215
214
|
value: "sub",
|
|
216
215
|
};
|
|
217
216
|
const expectedPatternFilter: PatternFilter = {
|
|
218
217
|
type: "pattern",
|
|
219
|
-
column: "colC"
|
|
218
|
+
column: "colC",
|
|
220
219
|
predicate: { type: "containSubsequence", value: "sub" },
|
|
221
220
|
};
|
|
222
221
|
const expectedFilter: NotFilter = { type: "not", filter: expectedPatternFilter };
|
|
@@ -226,12 +225,12 @@ describe("compileFilter", () => {
|
|
|
226
225
|
it('should compile "topN" filter (Top 5)', () => {
|
|
227
226
|
const uiFilter: FilterUi = {
|
|
228
227
|
type: "topN",
|
|
229
|
-
column: "colNum"
|
|
228
|
+
column: "colNum",
|
|
230
229
|
n: 5,
|
|
231
230
|
};
|
|
232
231
|
const expectedRank: ValueRank = {
|
|
233
232
|
transformer: "rank",
|
|
234
|
-
column: "colNum"
|
|
233
|
+
column: "colNum",
|
|
235
234
|
descending: true,
|
|
236
235
|
};
|
|
237
236
|
const expectedFilter: NumericalComparisonFilter = {
|
|
@@ -246,12 +245,12 @@ describe("compileFilter", () => {
|
|
|
246
245
|
it('should compile "topN" filter (Bottom 3)', () => {
|
|
247
246
|
const uiFilter: FilterUi = {
|
|
248
247
|
type: "bottomN",
|
|
249
|
-
column: "colNum"
|
|
248
|
+
column: "colNum",
|
|
250
249
|
n: 3,
|
|
251
250
|
};
|
|
252
251
|
const expectedRank: ValueRank = {
|
|
253
252
|
transformer: "rank",
|
|
254
|
-
column: "colNum"
|
|
253
|
+
column: "colNum",
|
|
255
254
|
};
|
|
256
255
|
const expectedFilter: NumericalComparisonFilter = {
|
|
257
256
|
type: "numericalComparison",
|
|
@@ -265,12 +264,12 @@ describe("compileFilter", () => {
|
|
|
265
264
|
it('should compile "lessThan" filter', () => {
|
|
266
265
|
const uiFilter: FilterUi = {
|
|
267
266
|
type: "lessThan",
|
|
268
|
-
column: "colNum"
|
|
267
|
+
column: "colNum",
|
|
269
268
|
x: 10,
|
|
270
269
|
};
|
|
271
270
|
const expectedFilter: AnnotationFilter = {
|
|
272
271
|
type: "numericalComparison",
|
|
273
|
-
lhs: "colNum"
|
|
272
|
+
lhs: "colNum",
|
|
274
273
|
rhs: 10,
|
|
275
274
|
};
|
|
276
275
|
expect(compileFilter(uiFilter)).toEqual(expectedFilter);
|
|
@@ -279,12 +278,12 @@ describe("compileFilter", () => {
|
|
|
279
278
|
it('should compile "greaterThan" filter', () => {
|
|
280
279
|
const uiFilter: FilterUi = {
|
|
281
280
|
type: "greaterThan",
|
|
282
|
-
column: "colNum"
|
|
281
|
+
column: "colNum",
|
|
283
282
|
x: 5,
|
|
284
283
|
};
|
|
285
284
|
const expectedFilter: AnnotationFilter = {
|
|
286
285
|
type: "numericalComparison",
|
|
287
|
-
rhs: "colNum"
|
|
286
|
+
rhs: "colNum",
|
|
288
287
|
lhs: 5,
|
|
289
288
|
};
|
|
290
289
|
expect(compileFilter(uiFilter)).toEqual(expectedFilter);
|
|
@@ -293,12 +292,12 @@ describe("compileFilter", () => {
|
|
|
293
292
|
it('should compile "lessThanOrEqual" filter', () => {
|
|
294
293
|
const uiFilter: FilterUi = {
|
|
295
294
|
type: "lessThanOrEqual",
|
|
296
|
-
column: "colNum"
|
|
295
|
+
column: "colNum",
|
|
297
296
|
x: 20,
|
|
298
297
|
};
|
|
299
298
|
const expectedFilter: AnnotationFilter = {
|
|
300
299
|
type: "numericalComparison",
|
|
301
|
-
lhs: "colNum"
|
|
300
|
+
lhs: "colNum",
|
|
302
301
|
rhs: 20,
|
|
303
302
|
allowEqual: true,
|
|
304
303
|
};
|
|
@@ -308,12 +307,12 @@ describe("compileFilter", () => {
|
|
|
308
307
|
it('should compile "greaterThanOrEqual" filter', () => {
|
|
309
308
|
const uiFilter: FilterUi = {
|
|
310
309
|
type: "greaterThanOrEqual",
|
|
311
|
-
column: "colNum"
|
|
310
|
+
column: "colNum",
|
|
312
311
|
x: 0,
|
|
313
312
|
};
|
|
314
313
|
const expectedFilter: AnnotationFilter = {
|
|
315
314
|
type: "numericalComparison",
|
|
316
|
-
rhs: "colNum"
|
|
315
|
+
rhs: "colNum",
|
|
317
316
|
lhs: 0,
|
|
318
317
|
allowEqual: true,
|
|
319
318
|
};
|
|
@@ -323,14 +322,14 @@ describe("compileFilter", () => {
|
|
|
323
322
|
it('should compile "lessThanColumn" filter', () => {
|
|
324
323
|
const uiFilter: FilterUi = {
|
|
325
324
|
type: "lessThanColumn",
|
|
326
|
-
column: "colNum1"
|
|
327
|
-
rhs: "colNum2"
|
|
325
|
+
column: "colNum1",
|
|
326
|
+
rhs: "colNum2",
|
|
328
327
|
minDiff: 5,
|
|
329
328
|
};
|
|
330
329
|
const expectedFilter: AnnotationFilter = {
|
|
331
330
|
type: "numericalComparison",
|
|
332
|
-
lhs: "colNum1"
|
|
333
|
-
rhs: "colNum2"
|
|
331
|
+
lhs: "colNum1",
|
|
332
|
+
rhs: "colNum2",
|
|
334
333
|
minDiff: 5,
|
|
335
334
|
allowEqual: undefined,
|
|
336
335
|
};
|
|
@@ -340,14 +339,14 @@ describe("compileFilter", () => {
|
|
|
340
339
|
it('should compile "lessThanColumnOrEqual" filter', () => {
|
|
341
340
|
const uiFilter: FilterUi = {
|
|
342
341
|
type: "lessThanColumnOrEqual",
|
|
343
|
-
column: "colNum1"
|
|
344
|
-
rhs: "colNum2"
|
|
342
|
+
column: "colNum1",
|
|
343
|
+
rhs: "colNum2",
|
|
345
344
|
minDiff: 6,
|
|
346
345
|
};
|
|
347
346
|
const expectedFilter: AnnotationFilter = {
|
|
348
347
|
type: "numericalComparison",
|
|
349
|
-
lhs: "colNum1"
|
|
350
|
-
rhs: "colNum2"
|
|
348
|
+
lhs: "colNum1",
|
|
349
|
+
rhs: "colNum2",
|
|
351
350
|
minDiff: 6,
|
|
352
351
|
allowEqual: true,
|
|
353
352
|
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
createLocalPObjectId,
|
|
4
|
+
createColumnOverriddenId,
|
|
5
|
+
type AxisId,
|
|
6
|
+
type AxisSpec,
|
|
7
|
+
type PColumnSpec,
|
|
8
|
+
type PObjectId,
|
|
9
|
+
type PTableColumnId,
|
|
10
|
+
type SUniversalPColumnId,
|
|
11
|
+
} from "@milaboratories/pl-model-common";
|
|
12
|
+
import { ColumnLazyImpl } from "../../columns";
|
|
13
|
+
import type { ColumnRecipe } from "../../columns";
|
|
14
|
+
import { createColumnResolver } from "./columnResolver";
|
|
15
|
+
|
|
16
|
+
function wrap(id: PObjectId | SUniversalPColumnId, tag: string): SUniversalPColumnId {
|
|
17
|
+
return createColumnOverriddenId({
|
|
18
|
+
source: id,
|
|
19
|
+
specOverrides: { annotations: { tag }, domain: {}, contextDomain: {}, axesSpec: {} },
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ColumnLazy constructor pulls `getCfgRenderCtx()` from globalThis on some
|
|
24
|
+
// paths — keep a minimal mock the same way p_column_lazy.test.ts does.
|
|
25
|
+
const mockCtx = {
|
|
26
|
+
getAccessorHandleByName: () => undefined,
|
|
27
|
+
getUpstreamBlockCtx: () => [],
|
|
28
|
+
} as unknown as never;
|
|
29
|
+
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
(globalThis as { cfgRenderCtx?: unknown }).cfgRenderCtx = mockCtx;
|
|
32
|
+
});
|
|
33
|
+
afterEach(() => {
|
|
34
|
+
delete (globalThis as { cfgRenderCtx?: unknown }).cfgRenderCtx;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
function lazyOf(id: PObjectId, axes: AxisSpec[] = []) {
|
|
38
|
+
const spec = { kind: "PColumn", name: "stub", axesSpec: axes } as unknown as PColumnSpec;
|
|
39
|
+
return ColumnLazyImpl.fromColumn({
|
|
40
|
+
id,
|
|
41
|
+
spec,
|
|
42
|
+
data: undefined,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function axisSpec(name: string): AxisSpec {
|
|
47
|
+
return { type: "String", name } as unknown as AxisSpec;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
describe("createColumnResolver", () => {
|
|
51
|
+
test("exact lazy id match returns the same id (column)", () => {
|
|
52
|
+
const id = createLocalPObjectId(["main", "out"], "col-1");
|
|
53
|
+
const r = createColumnResolver([lazyOf(id)]);
|
|
54
|
+
const ref: PTableColumnId = { type: "column", id };
|
|
55
|
+
expect(r(ref)).toEqual({ type: "column", id });
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("bare PObjectId resolves to the recipe's full id", () => {
|
|
59
|
+
const pid = createLocalPObjectId(["main", "out"], "col-1");
|
|
60
|
+
const wrapped = wrap(pid, "A");
|
|
61
|
+
const fake: ColumnRecipe = {
|
|
62
|
+
id: wrapped,
|
|
63
|
+
getReferencedIds: () => [pid],
|
|
64
|
+
getSpec: () => ({ kind: "PColumn", name: "stub", axesSpec: [] }) as unknown as PColumnSpec,
|
|
65
|
+
getQuery: () => ({ type: "column", column: pid }) as never,
|
|
66
|
+
getDataStatus: () => "present",
|
|
67
|
+
withSpecs: () => fake,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const r = createColumnResolver([fake]);
|
|
71
|
+
const out = r({ type: "column", id: pid });
|
|
72
|
+
expect(out).toEqual({ type: "column", id: wrapped });
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("axis hit passes through unchanged", () => {
|
|
76
|
+
const ax = axisSpec("sampleId");
|
|
77
|
+
const id = createLocalPObjectId(["main", "out"], "col-1");
|
|
78
|
+
const r = createColumnResolver([lazyOf(id, [ax])]);
|
|
79
|
+
const ref: PTableColumnId = {
|
|
80
|
+
type: "axis",
|
|
81
|
+
id: { type: "String", name: "sampleId" } as AxisId,
|
|
82
|
+
};
|
|
83
|
+
expect(r(ref)).toEqual(ref);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("axis miss → undefined", () => {
|
|
87
|
+
const id = createLocalPObjectId(["main", "out"], "col-1");
|
|
88
|
+
const r = createColumnResolver([lazyOf(id, [axisSpec("sampleId")])]);
|
|
89
|
+
const ref: PTableColumnId = { type: "axis", id: { type: "String", name: "missing" } as AxisId };
|
|
90
|
+
expect(r(ref)).toBeUndefined();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("column miss → undefined", () => {
|
|
94
|
+
const id = createLocalPObjectId(["main", "out"], "col-1");
|
|
95
|
+
const other = createLocalPObjectId(["main", "out"], "col-2");
|
|
96
|
+
const r = createColumnResolver([lazyOf(id)]);
|
|
97
|
+
expect(r({ type: "column", id: other })).toBeUndefined();
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("collision warns once and keeps first", () => {
|
|
101
|
+
const pid = createLocalPObjectId(["main", "out"], "col-1");
|
|
102
|
+
const wrappedA = wrap(pid, "A");
|
|
103
|
+
const wrappedB = wrap(pid, "B");
|
|
104
|
+
const makeFake = (wrapped: SUniversalPColumnId): ColumnRecipe => {
|
|
105
|
+
const r: ColumnRecipe = {
|
|
106
|
+
id: wrapped,
|
|
107
|
+
getReferencedIds: () => [pid],
|
|
108
|
+
getSpec: () => ({ kind: "PColumn", name: "stub", axesSpec: [] }) as unknown as PColumnSpec,
|
|
109
|
+
getQuery: () => ({ type: "column", column: pid }) as never,
|
|
110
|
+
getDataStatus: () => "present",
|
|
111
|
+
withSpecs: () => r,
|
|
112
|
+
};
|
|
113
|
+
return r;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const warn = vi.fn();
|
|
117
|
+
const r = createColumnResolver([makeFake(wrappedA), makeFake(wrappedB)], { warn });
|
|
118
|
+
expect(warn).toHaveBeenCalledTimes(1);
|
|
119
|
+
const out = r({ type: "column", id: pid });
|
|
120
|
+
expect(out).toEqual({ type: "column", id: wrappedA });
|
|
121
|
+
});
|
|
122
|
+
});
|