@platforma-sdk/model 1.79.24 → 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 +9 -7
- 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
package/dist/columns/index.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { ColumnFieldStatus, ColumnRecipeId, ColumnResolutionStatus, SpecQuery } from "./column_recipes/types.js";
|
|
2
|
+
import { ColumnAbsentError, ColumnLazy, ColumnLazyData, ColumnLazyId, ColumnLazyImpl, isColumnLazy } from "./column_lazy.js";
|
|
3
|
+
import { ColumnDiscoveredRecipe } from "./column_recipes/column_discovered_recipe.js";
|
|
4
|
+
import { ColumnFilteredRecipe } from "./column_recipes/column_filtered_recipe.js";
|
|
5
|
+
import { Column, ColumnSource, isColumn } from "./column.js";
|
|
6
|
+
import { ColumnOverriddenRecipe } from "./column_recipes/column_overrided_recipe.js";
|
|
7
|
+
import { ColumnRecipe, isColumnRecipe } from "./column_recipes/index.js";
|
|
8
|
+
import { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, ColumnsProvider, ResultPoolColumnsProvider, ResultPoolColumnsProviderImpl } from "./column_providers/providers.js";
|
|
9
|
+
import { ColumnsSource } from "./column_providers/types.js";
|
|
10
|
+
import { _ctxProvidersCache, getCtxProviders, isColumnProvider, toColumnProvider } from "./column_providers/index.js";
|
|
11
|
+
import { ExpandByPartitionOpts, SplitAxis, expandByPartition } from "./expand_by_partition.js";
|
|
12
|
+
import { ColumnsCollection, ColumnsCollectionDeps, ColumnsCollectionImpl, ColumnsSourceShorthand, isColumnsCollection } from "./columns_collection.js";
|
|
13
|
+
import { deriveAxisValuesLabels } from "./derive_axis_values_labels.js";
|
|
14
|
+
import { ColumnOption, collectLinkerColumns, collectLinkerIds, deriveColumnOptions, getLeafColumnData, hasColumnData, hitQualifications, isLeafColumn, queriesQualifications } from "./utils.js";
|
|
15
|
+
export { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, Column, ColumnAbsentError, ColumnDiscoveredRecipe, type ColumnFieldStatus, ColumnFilteredRecipe, ColumnLazy, ColumnLazyData, ColumnLazyId, ColumnLazyImpl, ColumnOption, ColumnOverriddenRecipe, ColumnRecipe, type ColumnRecipeId, type ColumnResolutionStatus, ColumnSource, ColumnsCollection, ColumnsCollectionDeps, ColumnsCollectionImpl, ColumnsProvider, ColumnsSource, ColumnsSourceShorthand, ExpandByPartitionOpts, ResultPoolColumnsProvider, ResultPoolColumnsProviderImpl, type SpecQuery, SplitAxis, _ctxProvidersCache, collectLinkerColumns, collectLinkerIds, deriveAxisValuesLabels, deriveColumnOptions, expandByPartition, getCtxProviders, getLeafColumnData, hasColumnData, hitQualifications, isColumn, isColumnLazy, isColumnProvider, isColumnRecipe, isColumnsCollection, isLeafColumn, queriesQualifications, toColumnProvider };
|
package/dist/columns/index.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { Column, isColumn } from "./column.js";
|
|
2
|
+
import { ColumnDiscoveredRecipe } from "./column_recipes/column_discovered_recipe.js";
|
|
3
|
+
import { ColumnFilteredRecipe } from "./column_recipes/column_filtered_recipe.js";
|
|
4
|
+
import { ColumnRecipe, isColumnRecipe } from "./column_recipes/index.js";
|
|
5
|
+
import { ColumnOverriddenRecipe } from "./column_recipes/column_overrided_recipe.js";
|
|
6
|
+
import { ColumnAbsentError, ColumnLazy, ColumnLazyImpl, isColumnLazy } from "./column_lazy.js";
|
|
7
|
+
import { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, ColumnsProvider, ResultPoolColumnsProvider, ResultPoolColumnsProviderImpl } from "./column_providers/providers.js";
|
|
8
|
+
import { _ctxProvidersCache, getCtxProviders, isColumnProvider, toColumnProvider } from "./column_providers/index.js";
|
|
9
|
+
import { ColumnsCollection, ColumnsCollectionImpl, isColumnsCollection } from "./columns_collection.js";
|
|
10
|
+
import { collectLinkerColumns, collectLinkerIds, deriveColumnOptions, getLeafColumnData, hasColumnData, hitQualifications, isLeafColumn, queriesQualifications } from "./utils.js";
|
|
6
11
|
import { expandByPartition } from "./expand_by_partition.js";
|
|
7
|
-
|
|
12
|
+
import { deriveAxisValuesLabels } from "./derive_axis_values_labels.js";
|
|
13
|
+
export { AccessorColumnsProvider, AccessorColumnsProviderImpl, ArrayColumnsProvider, Column, ColumnAbsentError, ColumnDiscoveredRecipe, ColumnFilteredRecipe, ColumnLazy, ColumnLazyImpl, ColumnOverriddenRecipe, ColumnRecipe, ColumnsCollection, ColumnsCollectionImpl, ColumnsProvider, ResultPoolColumnsProvider, ResultPoolColumnsProviderImpl, _ctxProvidersCache, collectLinkerColumns, collectLinkerIds, deriveAxisValuesLabels, deriveColumnOptions, expandByPartition, getCtxProviders, getLeafColumnData, hasColumnData, hitQualifications, isColumn, isColumnLazy, isColumnProvider, isColumnRecipe, isColumnsCollection, isLeafColumn, queriesQualifications, toColumnProvider };
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
const require_accessor = require("../render/accessor.cjs");
|
|
2
|
+
const require_derive_distinct_labels = require("../labels/derive_distinct_labels.cjs");
|
|
3
|
+
require("../render/index.cjs");
|
|
4
|
+
const require_column_discovered_recipe = require("./column_recipes/column_discovered_recipe.cjs");
|
|
5
|
+
const require_column_filtered_recipe = require("./column_recipes/column_filtered_recipe.cjs");
|
|
6
|
+
const require_column_overrided_recipe = require("./column_recipes/column_overrided_recipe.cjs");
|
|
7
|
+
const require_column_lazy = require("./column_lazy.cjs");
|
|
8
|
+
const require_columns_collection = require("./columns_collection.cjs");
|
|
9
|
+
let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
|
|
10
|
+
let _milaboratories_helpers = require("@milaboratories/helpers");
|
|
11
|
+
//#region src/columns/utils.ts
|
|
12
|
+
/**
|
|
13
|
+
* PObjectIds of every non-hit column referenced by `recipe.getQuery()`,
|
|
14
|
+
* deduped in traversal order. The hit column is
|
|
15
|
+
* `extractPObjectId(recipe.id)`; anything else in the query is a linker or
|
|
16
|
+
* other engine-consumed column.
|
|
17
|
+
*
|
|
18
|
+
* Pure query walk — no registry access. Use {@link collectLinkerColumns} for
|
|
19
|
+
* the resolved {@link ColumnLazy} variant.
|
|
20
|
+
*/
|
|
21
|
+
function collectLinkerIds(recipe) {
|
|
22
|
+
const hit = (0, _milaboratories_pl_model_common.extractPObjectId)(recipe.id);
|
|
23
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24
|
+
const out = [];
|
|
25
|
+
for (const id of (0, _milaboratories_pl_model_common.collectSpecQueryColumns)(recipe.getQuery())) {
|
|
26
|
+
const bare = (0, _milaboratories_pl_model_common.extractPObjectId)(id);
|
|
27
|
+
if (bare === hit) continue;
|
|
28
|
+
if (seen.has(bare)) continue;
|
|
29
|
+
seen.add(bare);
|
|
30
|
+
out.push(bare);
|
|
31
|
+
}
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* {@link collectLinkerIds} resolved against the ambient context as
|
|
36
|
+
* {@link ColumnLazy} instances. Throws if any id fails to resolve —
|
|
37
|
+
* matches the contract of the legacy `resolveLinkers` it replaces.
|
|
38
|
+
*/
|
|
39
|
+
function collectLinkerColumns(recipe, opts = {}) {
|
|
40
|
+
return collectLinkerIds(recipe).map((id) => require_column_lazy.ColumnLazyImpl.fromId(id, opts) ?? (0, _milaboratories_helpers.throwError)(`materializeLinkers: linker ${id} not resolvable`));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Hit-side axis qualifications for the recipe — the ones that should land on
|
|
44
|
+
* the outer-join entry wrapping this column at the consumer boundary.
|
|
45
|
+
*
|
|
46
|
+
* Descends {@link ColumnOverriddenRecipe} / {@link ColumnFilteredRecipe} via
|
|
47
|
+
* `getInner()` until it finds a {@link ColumnDiscoveredRecipe}; otherwise
|
|
48
|
+
* returns `[]`. Pure recipe walk — no query-tree introspection.
|
|
49
|
+
*/
|
|
50
|
+
function hitQualifications(recipe) {
|
|
51
|
+
return findDiscovered(recipe)?.getColumnQualifications() ?? [];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Per-primary-column axis qualifications for the recipe — applied to the
|
|
55
|
+
* outer primary anchors on this recipe's group side. Keyed by the external
|
|
56
|
+
* primary column id (NOT by columns inside this recipe's own query).
|
|
57
|
+
*
|
|
58
|
+
* Same walk strategy as {@link hitQualifications}.
|
|
59
|
+
*/
|
|
60
|
+
function queriesQualifications(recipe) {
|
|
61
|
+
return findDiscovered(recipe)?.getQueriesQualifications() ?? {};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Whether the recipe's underlying data resources actually carry bytes —
|
|
65
|
+
* strictly stronger than `getDataStatus() === "present"`, which only tells
|
|
66
|
+
* that the `.data` field is wired onto the accessor.
|
|
67
|
+
*
|
|
68
|
+
* Walks every physical leaf the recipe depends on via
|
|
69
|
+
* {@link ColumnRecipe.getReferencedIds} (resolves each id back to a
|
|
70
|
+
* {@link ColumnLazy} through the ambient ctx) and ANDs `hasData()` across
|
|
71
|
+
* all of them. Inline {@link PColumnValues} payloads count as present.
|
|
72
|
+
*
|
|
73
|
+
* Returns `false` if any leaf cannot be re-resolved in `opts.ctx` (treat as
|
|
74
|
+
* "not yet ready") rather than throwing — this is a UI-facing predicate, not
|
|
75
|
+
* a contract assertion.
|
|
76
|
+
*/
|
|
77
|
+
function hasColumnData(recipe, opts = {}) {
|
|
78
|
+
for (const id of recipe.getReferencedIds()) {
|
|
79
|
+
const lazy = require_column_lazy.ColumnLazyImpl.fromId(id, opts);
|
|
80
|
+
if (lazy === void 0) return false;
|
|
81
|
+
if (lazy.getDataStatus() !== "present") return false;
|
|
82
|
+
if (!isLazyDataPresent(lazy.getData())) return false;
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
function isLazyDataPresent(data) {
|
|
87
|
+
if (data === void 0) return false;
|
|
88
|
+
if (Array.isArray(data)) return true;
|
|
89
|
+
if (data instanceof require_accessor.TreeNodeAccessor) return data.hasData();
|
|
90
|
+
if ((0, _milaboratories_pl_model_common.isDataInfo)(data)) {
|
|
91
|
+
let ok = true;
|
|
92
|
+
(0, _milaboratories_pl_model_common.visitDataInfo)(data, (blob) => {
|
|
93
|
+
ok &&= blob.hasData();
|
|
94
|
+
});
|
|
95
|
+
return ok;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Walk wrapper layers (Overridden, Filtered) until a {@link
|
|
101
|
+
* ColumnDiscoveredRecipe} is found. Returns `undefined` if the recipe chain
|
|
102
|
+
* has no Discovered layer (bare leaves and Overridden-over-leaf cases).
|
|
103
|
+
*
|
|
104
|
+
* Invariant from the wrapper classes themselves: there is at most one
|
|
105
|
+
* Discovered layer in any recipe chain — Discovered is constructed only via
|
|
106
|
+
* its own factory and is never re-wrapped by Discovered.
|
|
107
|
+
*/
|
|
108
|
+
function findDiscovered(recipe) {
|
|
109
|
+
let current = recipe;
|
|
110
|
+
while (true) {
|
|
111
|
+
if (current instanceof require_column_discovered_recipe.ColumnDiscoveredRecipe) return current;
|
|
112
|
+
if (current instanceof require_column_overrided_recipe.ColumnOverriddenRecipe || current instanceof require_column_filtered_recipe.ColumnFilteredRecipe) {
|
|
113
|
+
current = current.getInner();
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A recipe is a "leaf" (directly co-indexed on the anchor, reached without a
|
|
121
|
+
* linker chain) iff its wrapper chain contains no {@link ColumnDiscoveredRecipe}.
|
|
122
|
+
*
|
|
123
|
+
* `Filtered` / `Overridden` over a bare leaf stay leaves; anything wrapping a
|
|
124
|
+
* `Discovered` (e.g. `Overridden(Discovered(...))`) is linked. Use this — not an
|
|
125
|
+
* `instanceof ColumnLazyImpl` check — to split direct vs. linker-joined columns,
|
|
126
|
+
* since projections over a plain leaf are still direct.
|
|
127
|
+
*/
|
|
128
|
+
function isLeafColumn(recipe) {
|
|
129
|
+
return findDiscovered(recipe) === void 0;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Data of the bare leaf a "leaf" recipe bottoms out at — reads the leaf-only
|
|
133
|
+
* {@link ColumnLazy.getData} after walking the wrapper chain down via
|
|
134
|
+
* {@link extractLeafColumn}. Returns `undefined` when the recipe is not a leaf (its
|
|
135
|
+
* chain reaches a {@link ColumnDiscoveredRecipe}); the symmetric counterpart
|
|
136
|
+
* of {@link isLeafColumn} returning `false`.
|
|
137
|
+
*/
|
|
138
|
+
function getLeafColumnData(recipe) {
|
|
139
|
+
if (!isLeafColumn(recipe)) throw new Error(`getLeafColumnData: recipe ${recipe.id} is not a leaf column`);
|
|
140
|
+
return extractLeafColumn(recipe)?.getData();
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Walk wrapper layers (Overridden, Filtered) down to the bare {@link ColumnLazy}
|
|
144
|
+
* leaf the chain bottoms out at. Returns `undefined` if the chain reaches a
|
|
145
|
+
* {@link ColumnDiscoveredRecipe} instead — i.e. the recipe is not a leaf
|
|
146
|
+
* ({@link isLeafColumn} would return `false`). Mirror of {@link findDiscovered}.
|
|
147
|
+
*/
|
|
148
|
+
function extractLeafColumn(recipe) {
|
|
149
|
+
let current = recipe;
|
|
150
|
+
while (true) {
|
|
151
|
+
if (current instanceof require_column_lazy.ColumnLazyImpl) return current;
|
|
152
|
+
if (current instanceof require_column_overrided_recipe.ColumnOverriddenRecipe || current instanceof require_column_filtered_recipe.ColumnFilteredRecipe) {
|
|
153
|
+
current = current.getInner();
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (current instanceof require_column_discovered_recipe.ColumnDiscoveredRecipe) throw new Error(`extractLeafColumn: recipe ${recipe.id} is not a leaf column`);
|
|
157
|
+
throw new Error(`extractLeafColumn: unrecognized recipe layer for ${recipe.id}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Enumerates every column already in `source` and renders distinct labels
|
|
162
|
+
* from each recipe's spec. Filtering is the caller's job — pass a
|
|
163
|
+
* {@link ColumnsCollection} that was already narrowed via `.filter(...)` /
|
|
164
|
+
* `.discover(...)`, or hand over a raw {@link ColumnsSource} (provider,
|
|
165
|
+
* accessor, column array, or `"result_pool"` / `"current_block"` shorthand)
|
|
166
|
+
* to be wrapped on the fly.
|
|
167
|
+
*/
|
|
168
|
+
function deriveColumnOptions(source, labelOptions = {}) {
|
|
169
|
+
const recipes = (require_columns_collection.isColumnsCollection(source) ? source : require_columns_collection.ColumnsCollection(source)).getColumns();
|
|
170
|
+
const labels = require_derive_distinct_labels.deriveDistinctLabels(recipes.map((r) => r.getSpec()), labelOptions);
|
|
171
|
+
return recipes.map((r, i) => ({
|
|
172
|
+
id: r.id,
|
|
173
|
+
label: labels[i]
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
exports.collectLinkerColumns = collectLinkerColumns;
|
|
178
|
+
exports.collectLinkerIds = collectLinkerIds;
|
|
179
|
+
exports.deriveColumnOptions = deriveColumnOptions;
|
|
180
|
+
exports.getLeafColumnData = getLeafColumnData;
|
|
181
|
+
exports.hasColumnData = hasColumnData;
|
|
182
|
+
exports.hitQualifications = hitQualifications;
|
|
183
|
+
exports.isLeafColumn = isLeafColumn;
|
|
184
|
+
exports.queriesQualifications = queriesQualifications;
|
|
185
|
+
|
|
186
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["ColumnLazyImpl","TreeNodeAccessor","ColumnDiscoveredRecipe","ColumnOverriddenRecipe","ColumnFilteredRecipe","isColumnsCollection","ColumnsCollection","deriveDistinctLabels"],"sources":["../../src/columns/utils.ts"],"sourcesContent":["import {\n collectSpecQueryColumns,\n extractPObjectId,\n isDataInfo,\n visitDataInfo,\n type AxisQualification,\n type ColumnUniversalId,\n type PObjectId,\n} from \"@milaboratories/pl-model-common\";\nimport { throwError } from \"@milaboratories/helpers\";\nimport type { GlobalCfgRenderCtx } from \"../render/internal\";\nimport { TreeNodeAccessor } from \"../render\";\nimport { deriveDistinctLabels, type DeriveLabelsOptions } from \"../labels/derive_distinct_labels\";\nimport { ColumnLazy, ColumnLazyImpl, type ColumnLazyData } from \"./column_lazy\";\nimport { ColumnDiscoveredRecipe } from \"./column_recipes/column_discovered_recipe\";\nimport { ColumnFilteredRecipe } from \"./column_recipes/column_filtered_recipe\";\nimport { ColumnOverriddenRecipe } from \"./column_recipes/column_overrided_recipe\";\nimport type { ColumnRecipe } from \"./column_recipes/types\";\nimport { ColumnsCollection, isColumnsCollection } from \"./columns_collection\";\nimport type { ColumnsSource } from \"./column_providers/types\";\n\n/**\n * PObjectIds of every non-hit column referenced by `recipe.getQuery()`,\n * deduped in traversal order. The hit column is\n * `extractPObjectId(recipe.id)`; anything else in the query is a linker or\n * other engine-consumed column.\n *\n * Pure query walk — no registry access. Use {@link collectLinkerColumns} for\n * the resolved {@link ColumnLazy} variant.\n */\nexport function collectLinkerIds(recipe: ColumnRecipe): PObjectId[] {\n const hit = extractPObjectId(recipe.id);\n const seen = new Set<PObjectId>();\n const out: PObjectId[] = [];\n for (const id of collectSpecQueryColumns(recipe.getQuery())) {\n // Leaf ids in SpecQuery may be rich (e.g. ColumnDiscoveredId) — drop to\n // bare PObjectId before comparing/registering so we hand the ambient\n // ColumnRegistry physical ids it can resolve.\n const bare = extractPObjectId(id);\n if (bare === hit) continue;\n if (seen.has(bare)) continue;\n seen.add(bare);\n out.push(bare);\n }\n return out;\n}\n\n/**\n * {@link collectLinkerIds} resolved against the ambient context as\n * {@link ColumnLazy} instances. Throws if any id fails to resolve —\n * matches the contract of the legacy `resolveLinkers` it replaces.\n */\nexport function collectLinkerColumns(\n recipe: ColumnRecipe,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): ColumnLazy[] {\n return collectLinkerIds(recipe).map(\n (id) =>\n ColumnLazyImpl.fromId(id, opts) ??\n throwError(`materializeLinkers: linker ${id} not resolvable`),\n );\n}\n\n/**\n * Hit-side axis qualifications for the recipe — the ones that should land on\n * the outer-join entry wrapping this column at the consumer boundary.\n *\n * Descends {@link ColumnOverriddenRecipe} / {@link ColumnFilteredRecipe} via\n * `getInner()` until it finds a {@link ColumnDiscoveredRecipe}; otherwise\n * returns `[]`. Pure recipe walk — no query-tree introspection.\n */\nexport function hitQualifications(recipe: ColumnRecipe): readonly AxisQualification[] {\n const discovered = findDiscovered(recipe);\n return discovered?.getColumnQualifications() ?? [];\n}\n\n/**\n * Per-primary-column axis qualifications for the recipe — applied to the\n * outer primary anchors on this recipe's group side. Keyed by the external\n * primary column id (NOT by columns inside this recipe's own query).\n *\n * Same walk strategy as {@link hitQualifications}.\n */\nexport function queriesQualifications(\n recipe: ColumnRecipe,\n): Readonly<Record<PObjectId, AxisQualification[]>> {\n const discovered = findDiscovered(recipe);\n return discovered?.getQueriesQualifications() ?? {};\n}\n\n/**\n * Whether the recipe's underlying data resources actually carry bytes —\n * strictly stronger than `getDataStatus() === \"present\"`, which only tells\n * that the `.data` field is wired onto the accessor.\n *\n * Walks every physical leaf the recipe depends on via\n * {@link ColumnRecipe.getReferencedIds} (resolves each id back to a\n * {@link ColumnLazy} through the ambient ctx) and ANDs `hasData()` across\n * all of them. Inline {@link PColumnValues} payloads count as present.\n *\n * Returns `false` if any leaf cannot be re-resolved in `opts.ctx` (treat as\n * \"not yet ready\") rather than throwing — this is a UI-facing predicate, not\n * a contract assertion.\n */\nexport function hasColumnData(\n recipe: ColumnRecipe,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): boolean {\n for (const id of recipe.getReferencedIds()) {\n const lazy = ColumnLazyImpl.fromId(id, opts);\n if (lazy === undefined) return false;\n if (lazy.getDataStatus() !== \"present\") return false;\n if (!isLazyDataPresent(lazy.getData())) return false;\n }\n return true;\n}\n\nfunction isLazyDataPresent(data: ColumnLazyData): boolean {\n if (data === undefined) return false;\n if (Array.isArray(data)) return true;\n if (data instanceof TreeNodeAccessor) return data.hasData();\n if (isDataInfo(data)) {\n let ok = true;\n visitDataInfo(data, (blob) => {\n ok &&= blob.hasData();\n });\n return ok;\n }\n return false;\n}\n\n/**\n * Walk wrapper layers (Overridden, Filtered) until a {@link\n * ColumnDiscoveredRecipe} is found. Returns `undefined` if the recipe chain\n * has no Discovered layer (bare leaves and Overridden-over-leaf cases).\n *\n * Invariant from the wrapper classes themselves: there is at most one\n * Discovered layer in any recipe chain — Discovered is constructed only via\n * its own factory and is never re-wrapped by Discovered.\n */\nfunction findDiscovered(recipe: ColumnRecipe): undefined | ColumnDiscoveredRecipe {\n let current: ColumnRecipe = recipe;\n while (true) {\n if (current instanceof ColumnDiscoveredRecipe) return current;\n if (current instanceof ColumnOverriddenRecipe || current instanceof ColumnFilteredRecipe) {\n current = current.getInner();\n continue;\n }\n return undefined;\n }\n}\n\n/**\n * A recipe is a \"leaf\" (directly co-indexed on the anchor, reached without a\n * linker chain) iff its wrapper chain contains no {@link ColumnDiscoveredRecipe}.\n *\n * `Filtered` / `Overridden` over a bare leaf stay leaves; anything wrapping a\n * `Discovered` (e.g. `Overridden(Discovered(...))`) is linked. Use this — not an\n * `instanceof ColumnLazyImpl` check — to split direct vs. linker-joined columns,\n * since projections over a plain leaf are still direct.\n */\nexport function isLeafColumn(recipe: ColumnRecipe): boolean {\n return findDiscovered(recipe) === undefined;\n}\n\n/**\n * Data of the bare leaf a \"leaf\" recipe bottoms out at — reads the leaf-only\n * {@link ColumnLazy.getData} after walking the wrapper chain down via\n * {@link extractLeafColumn}. Returns `undefined` when the recipe is not a leaf (its\n * chain reaches a {@link ColumnDiscoveredRecipe}); the symmetric counterpart\n * of {@link isLeafColumn} returning `false`.\n */\nexport function getLeafColumnData(recipe: ColumnRecipe): ColumnLazyData {\n if (!isLeafColumn(recipe)) {\n throw new Error(`getLeafColumnData: recipe ${recipe.id} is not a leaf column`);\n }\n return extractLeafColumn(recipe)?.getData();\n}\n\n/**\n * Walk wrapper layers (Overridden, Filtered) down to the bare {@link ColumnLazy}\n * leaf the chain bottoms out at. Returns `undefined` if the chain reaches a\n * {@link ColumnDiscoveredRecipe} instead — i.e. the recipe is not a leaf\n * ({@link isLeafColumn} would return `false`). Mirror of {@link findDiscovered}.\n */\nfunction extractLeafColumn(recipe: ColumnRecipe): undefined | ColumnLazy {\n let current: ColumnRecipe = recipe;\n while (true) {\n if (current instanceof ColumnLazyImpl) return current;\n if (current instanceof ColumnOverriddenRecipe || current instanceof ColumnFilteredRecipe) {\n current = current.getInner();\n continue;\n }\n if (current instanceof ColumnDiscoveredRecipe) {\n throw new Error(`extractLeafColumn: recipe ${recipe.id} is not a leaf column`);\n }\n throw new Error(`extractLeafColumn: unrecognized recipe layer for ${recipe.id}`);\n }\n}\n\n/** Drop-down option built over a {@link ColumnsCollection} — universal-id valued. */\nexport type ColumnOption = {\n readonly id: ColumnUniversalId;\n readonly label: string;\n};\n\n/**\n * Enumerates every column already in `source` and renders distinct labels\n * from each recipe's spec. Filtering is the caller's job — pass a\n * {@link ColumnsCollection} that was already narrowed via `.filter(...)` /\n * `.discover(...)`, or hand over a raw {@link ColumnsSource} (provider,\n * accessor, column array, or `\"result_pool\"` / `\"current_block\"` shorthand)\n * to be wrapped on the fly.\n */\nexport function deriveColumnOptions(\n source: ColumnsCollection | ColumnsSource[],\n labelOptions: DeriveLabelsOptions = {},\n): ColumnOption[] {\n const collection = isColumnsCollection(source) ? source : ColumnsCollection(source);\n const recipes = collection.getColumns();\n const labels = deriveDistinctLabels(\n recipes.map((r) => r.getSpec()),\n labelOptions,\n );\n return recipes.map((r, i) => ({ id: r.id, label: labels[i] }));\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { GlobalCfgRenderCtx } from "../render/internal.js";
|
|
2
|
+
import { DeriveLabelsOptions } from "../labels/derive_distinct_labels.js";
|
|
3
|
+
import { ColumnRecipe } from "./column_recipes/types.js";
|
|
4
|
+
import { ColumnLazy, ColumnLazyData } from "./column_lazy.js";
|
|
5
|
+
import { ColumnsSource } from "./column_providers/types.js";
|
|
6
|
+
import { ColumnsCollection } from "./columns_collection.js";
|
|
7
|
+
import { AxisQualification, ColumnUniversalId, PObjectId } from "@milaboratories/pl-model-common";
|
|
8
|
+
|
|
9
|
+
//#region src/columns/utils.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* PObjectIds of every non-hit column referenced by `recipe.getQuery()`,
|
|
12
|
+
* deduped in traversal order. The hit column is
|
|
13
|
+
* `extractPObjectId(recipe.id)`; anything else in the query is a linker or
|
|
14
|
+
* other engine-consumed column.
|
|
15
|
+
*
|
|
16
|
+
* Pure query walk — no registry access. Use {@link collectLinkerColumns} for
|
|
17
|
+
* the resolved {@link ColumnLazy} variant.
|
|
18
|
+
*/
|
|
19
|
+
declare function collectLinkerIds(recipe: ColumnRecipe): PObjectId[];
|
|
20
|
+
/**
|
|
21
|
+
* {@link collectLinkerIds} resolved against the ambient context as
|
|
22
|
+
* {@link ColumnLazy} instances. Throws if any id fails to resolve —
|
|
23
|
+
* matches the contract of the legacy `resolveLinkers` it replaces.
|
|
24
|
+
*/
|
|
25
|
+
declare function collectLinkerColumns(recipe: ColumnRecipe, opts?: {
|
|
26
|
+
ctx?: GlobalCfgRenderCtx;
|
|
27
|
+
}): ColumnLazy[];
|
|
28
|
+
/**
|
|
29
|
+
* Hit-side axis qualifications for the recipe — the ones that should land on
|
|
30
|
+
* the outer-join entry wrapping this column at the consumer boundary.
|
|
31
|
+
*
|
|
32
|
+
* Descends {@link ColumnOverriddenRecipe} / {@link ColumnFilteredRecipe} via
|
|
33
|
+
* `getInner()` until it finds a {@link ColumnDiscoveredRecipe}; otherwise
|
|
34
|
+
* returns `[]`. Pure recipe walk — no query-tree introspection.
|
|
35
|
+
*/
|
|
36
|
+
declare function hitQualifications(recipe: ColumnRecipe): readonly AxisQualification[];
|
|
37
|
+
/**
|
|
38
|
+
* Per-primary-column axis qualifications for the recipe — applied to the
|
|
39
|
+
* outer primary anchors on this recipe's group side. Keyed by the external
|
|
40
|
+
* primary column id (NOT by columns inside this recipe's own query).
|
|
41
|
+
*
|
|
42
|
+
* Same walk strategy as {@link hitQualifications}.
|
|
43
|
+
*/
|
|
44
|
+
declare function queriesQualifications(recipe: ColumnRecipe): Readonly<Record<PObjectId, AxisQualification[]>>;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the recipe's underlying data resources actually carry bytes —
|
|
47
|
+
* strictly stronger than `getDataStatus() === "present"`, which only tells
|
|
48
|
+
* that the `.data` field is wired onto the accessor.
|
|
49
|
+
*
|
|
50
|
+
* Walks every physical leaf the recipe depends on via
|
|
51
|
+
* {@link ColumnRecipe.getReferencedIds} (resolves each id back to a
|
|
52
|
+
* {@link ColumnLazy} through the ambient ctx) and ANDs `hasData()` across
|
|
53
|
+
* all of them. Inline {@link PColumnValues} payloads count as present.
|
|
54
|
+
*
|
|
55
|
+
* Returns `false` if any leaf cannot be re-resolved in `opts.ctx` (treat as
|
|
56
|
+
* "not yet ready") rather than throwing — this is a UI-facing predicate, not
|
|
57
|
+
* a contract assertion.
|
|
58
|
+
*/
|
|
59
|
+
declare function hasColumnData(recipe: ColumnRecipe, opts?: {
|
|
60
|
+
ctx?: GlobalCfgRenderCtx;
|
|
61
|
+
}): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* A recipe is a "leaf" (directly co-indexed on the anchor, reached without a
|
|
64
|
+
* linker chain) iff its wrapper chain contains no {@link ColumnDiscoveredRecipe}.
|
|
65
|
+
*
|
|
66
|
+
* `Filtered` / `Overridden` over a bare leaf stay leaves; anything wrapping a
|
|
67
|
+
* `Discovered` (e.g. `Overridden(Discovered(...))`) is linked. Use this — not an
|
|
68
|
+
* `instanceof ColumnLazyImpl` check — to split direct vs. linker-joined columns,
|
|
69
|
+
* since projections over a plain leaf are still direct.
|
|
70
|
+
*/
|
|
71
|
+
declare function isLeafColumn(recipe: ColumnRecipe): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Data of the bare leaf a "leaf" recipe bottoms out at — reads the leaf-only
|
|
74
|
+
* {@link ColumnLazy.getData} after walking the wrapper chain down via
|
|
75
|
+
* {@link extractLeafColumn}. Returns `undefined` when the recipe is not a leaf (its
|
|
76
|
+
* chain reaches a {@link ColumnDiscoveredRecipe}); the symmetric counterpart
|
|
77
|
+
* of {@link isLeafColumn} returning `false`.
|
|
78
|
+
*/
|
|
79
|
+
declare function getLeafColumnData(recipe: ColumnRecipe): ColumnLazyData;
|
|
80
|
+
/** Drop-down option built over a {@link ColumnsCollection} — universal-id valued. */
|
|
81
|
+
type ColumnOption = {
|
|
82
|
+
readonly id: ColumnUniversalId;
|
|
83
|
+
readonly label: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Enumerates every column already in `source` and renders distinct labels
|
|
87
|
+
* from each recipe's spec. Filtering is the caller's job — pass a
|
|
88
|
+
* {@link ColumnsCollection} that was already narrowed via `.filter(...)` /
|
|
89
|
+
* `.discover(...)`, or hand over a raw {@link ColumnsSource} (provider,
|
|
90
|
+
* accessor, column array, or `"result_pool"` / `"current_block"` shorthand)
|
|
91
|
+
* to be wrapped on the fly.
|
|
92
|
+
*/
|
|
93
|
+
declare function deriveColumnOptions(source: ColumnsCollection | ColumnsSource[], labelOptions?: DeriveLabelsOptions): ColumnOption[];
|
|
94
|
+
//#endregion
|
|
95
|
+
export { ColumnOption, collectLinkerColumns, collectLinkerIds, deriveColumnOptions, getLeafColumnData, hasColumnData, hitQualifications, isLeafColumn, queriesQualifications };
|
|
96
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/columns/utils.ts"],"mappings":";;;;;;;;;;;AA8BA;;;;;;;iBAAgB,gBAAA,CAAiB,MAAA,EAAQ,YAAA,GAAe,SAAS;AAAA;AAsBjE;;;;AAtBiE,iBAsBjD,oBAAA,CACd,MAAA,EAAQ,YAAA,EACR,IAAA;EAAQ,GAAA,GAAM,kBAAA;AAAA,IACb,UAAA;;;;;;;;;iBAgBa,iBAAA,CAAkB,MAAA,EAAQ,YAAA,YAAwB,iBAAiB;AAAnF;;;;;;;AAAA,iBAYgB,qBAAA,CACd,MAAA,EAAQ,YAAA,GACP,QAAA,CAAS,MAAA,CAAO,SAAA,EAAW,iBAAA;AAdqD;AAYnF;;;;;;;;;;;;;AAZmF,iBAiCnE,aAAA,CACd,MAAA,EAAQ,YAAA,EACR,IAAA;EAAQ,GAAA,GAAM,kBAAkB;AAAA;;AArBa;AAmB/C;;;;;;;iBAyDgB,YAAA,CAAa,MAAoB,EAAZ,YAAY;;;AAvDR;AAuDzC;;;;iBAWgB,iBAAA,CAAkB,MAAA,EAAQ,YAAA,GAAe,cAAc;AAAvE;AAAA,KA6BY,YAAA;EAAA,SACD,EAAA,EAAI,iBAAiB;EAAA,SACrB,KAAA;AAAA;;;;AA/B4D;AA6BvE;;;;iBAagB,mBAAA,CACd,MAAA,EAAQ,iBAAA,GAAoB,aAAA,IAC5B,YAAA,GAAc,mBAAA,GACb,YAAA"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { TreeNodeAccessor } from "../render/accessor.js";
|
|
2
|
+
import { deriveDistinctLabels } from "../labels/derive_distinct_labels.js";
|
|
3
|
+
import "../render/index.js";
|
|
4
|
+
import { ColumnDiscoveredRecipe } from "./column_recipes/column_discovered_recipe.js";
|
|
5
|
+
import { ColumnFilteredRecipe } from "./column_recipes/column_filtered_recipe.js";
|
|
6
|
+
import { ColumnOverriddenRecipe } from "./column_recipes/column_overrided_recipe.js";
|
|
7
|
+
import { ColumnLazyImpl } from "./column_lazy.js";
|
|
8
|
+
import { ColumnsCollection, isColumnsCollection } from "./columns_collection.js";
|
|
9
|
+
import { collectSpecQueryColumns, extractPObjectId, isDataInfo, visitDataInfo } from "@milaboratories/pl-model-common";
|
|
10
|
+
import { throwError } from "@milaboratories/helpers";
|
|
11
|
+
//#region src/columns/utils.ts
|
|
12
|
+
/**
|
|
13
|
+
* PObjectIds of every non-hit column referenced by `recipe.getQuery()`,
|
|
14
|
+
* deduped in traversal order. The hit column is
|
|
15
|
+
* `extractPObjectId(recipe.id)`; anything else in the query is a linker or
|
|
16
|
+
* other engine-consumed column.
|
|
17
|
+
*
|
|
18
|
+
* Pure query walk — no registry access. Use {@link collectLinkerColumns} for
|
|
19
|
+
* the resolved {@link ColumnLazy} variant.
|
|
20
|
+
*/
|
|
21
|
+
function collectLinkerIds(recipe) {
|
|
22
|
+
const hit = extractPObjectId(recipe.id);
|
|
23
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24
|
+
const out = [];
|
|
25
|
+
for (const id of collectSpecQueryColumns(recipe.getQuery())) {
|
|
26
|
+
const bare = extractPObjectId(id);
|
|
27
|
+
if (bare === hit) continue;
|
|
28
|
+
if (seen.has(bare)) continue;
|
|
29
|
+
seen.add(bare);
|
|
30
|
+
out.push(bare);
|
|
31
|
+
}
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* {@link collectLinkerIds} resolved against the ambient context as
|
|
36
|
+
* {@link ColumnLazy} instances. Throws if any id fails to resolve —
|
|
37
|
+
* matches the contract of the legacy `resolveLinkers` it replaces.
|
|
38
|
+
*/
|
|
39
|
+
function collectLinkerColumns(recipe, opts = {}) {
|
|
40
|
+
return collectLinkerIds(recipe).map((id) => ColumnLazyImpl.fromId(id, opts) ?? throwError(`materializeLinkers: linker ${id} not resolvable`));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Hit-side axis qualifications for the recipe — the ones that should land on
|
|
44
|
+
* the outer-join entry wrapping this column at the consumer boundary.
|
|
45
|
+
*
|
|
46
|
+
* Descends {@link ColumnOverriddenRecipe} / {@link ColumnFilteredRecipe} via
|
|
47
|
+
* `getInner()` until it finds a {@link ColumnDiscoveredRecipe}; otherwise
|
|
48
|
+
* returns `[]`. Pure recipe walk — no query-tree introspection.
|
|
49
|
+
*/
|
|
50
|
+
function hitQualifications(recipe) {
|
|
51
|
+
return findDiscovered(recipe)?.getColumnQualifications() ?? [];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Per-primary-column axis qualifications for the recipe — applied to the
|
|
55
|
+
* outer primary anchors on this recipe's group side. Keyed by the external
|
|
56
|
+
* primary column id (NOT by columns inside this recipe's own query).
|
|
57
|
+
*
|
|
58
|
+
* Same walk strategy as {@link hitQualifications}.
|
|
59
|
+
*/
|
|
60
|
+
function queriesQualifications(recipe) {
|
|
61
|
+
return findDiscovered(recipe)?.getQueriesQualifications() ?? {};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Whether the recipe's underlying data resources actually carry bytes —
|
|
65
|
+
* strictly stronger than `getDataStatus() === "present"`, which only tells
|
|
66
|
+
* that the `.data` field is wired onto the accessor.
|
|
67
|
+
*
|
|
68
|
+
* Walks every physical leaf the recipe depends on via
|
|
69
|
+
* {@link ColumnRecipe.getReferencedIds} (resolves each id back to a
|
|
70
|
+
* {@link ColumnLazy} through the ambient ctx) and ANDs `hasData()` across
|
|
71
|
+
* all of them. Inline {@link PColumnValues} payloads count as present.
|
|
72
|
+
*
|
|
73
|
+
* Returns `false` if any leaf cannot be re-resolved in `opts.ctx` (treat as
|
|
74
|
+
* "not yet ready") rather than throwing — this is a UI-facing predicate, not
|
|
75
|
+
* a contract assertion.
|
|
76
|
+
*/
|
|
77
|
+
function hasColumnData(recipe, opts = {}) {
|
|
78
|
+
for (const id of recipe.getReferencedIds()) {
|
|
79
|
+
const lazy = ColumnLazyImpl.fromId(id, opts);
|
|
80
|
+
if (lazy === void 0) return false;
|
|
81
|
+
if (lazy.getDataStatus() !== "present") return false;
|
|
82
|
+
if (!isLazyDataPresent(lazy.getData())) return false;
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
function isLazyDataPresent(data) {
|
|
87
|
+
if (data === void 0) return false;
|
|
88
|
+
if (Array.isArray(data)) return true;
|
|
89
|
+
if (data instanceof TreeNodeAccessor) return data.hasData();
|
|
90
|
+
if (isDataInfo(data)) {
|
|
91
|
+
let ok = true;
|
|
92
|
+
visitDataInfo(data, (blob) => {
|
|
93
|
+
ok &&= blob.hasData();
|
|
94
|
+
});
|
|
95
|
+
return ok;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Walk wrapper layers (Overridden, Filtered) until a {@link
|
|
101
|
+
* ColumnDiscoveredRecipe} is found. Returns `undefined` if the recipe chain
|
|
102
|
+
* has no Discovered layer (bare leaves and Overridden-over-leaf cases).
|
|
103
|
+
*
|
|
104
|
+
* Invariant from the wrapper classes themselves: there is at most one
|
|
105
|
+
* Discovered layer in any recipe chain — Discovered is constructed only via
|
|
106
|
+
* its own factory and is never re-wrapped by Discovered.
|
|
107
|
+
*/
|
|
108
|
+
function findDiscovered(recipe) {
|
|
109
|
+
let current = recipe;
|
|
110
|
+
while (true) {
|
|
111
|
+
if (current instanceof ColumnDiscoveredRecipe) return current;
|
|
112
|
+
if (current instanceof ColumnOverriddenRecipe || current instanceof ColumnFilteredRecipe) {
|
|
113
|
+
current = current.getInner();
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A recipe is a "leaf" (directly co-indexed on the anchor, reached without a
|
|
121
|
+
* linker chain) iff its wrapper chain contains no {@link ColumnDiscoveredRecipe}.
|
|
122
|
+
*
|
|
123
|
+
* `Filtered` / `Overridden` over a bare leaf stay leaves; anything wrapping a
|
|
124
|
+
* `Discovered` (e.g. `Overridden(Discovered(...))`) is linked. Use this — not an
|
|
125
|
+
* `instanceof ColumnLazyImpl` check — to split direct vs. linker-joined columns,
|
|
126
|
+
* since projections over a plain leaf are still direct.
|
|
127
|
+
*/
|
|
128
|
+
function isLeafColumn(recipe) {
|
|
129
|
+
return findDiscovered(recipe) === void 0;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Data of the bare leaf a "leaf" recipe bottoms out at — reads the leaf-only
|
|
133
|
+
* {@link ColumnLazy.getData} after walking the wrapper chain down via
|
|
134
|
+
* {@link extractLeafColumn}. Returns `undefined` when the recipe is not a leaf (its
|
|
135
|
+
* chain reaches a {@link ColumnDiscoveredRecipe}); the symmetric counterpart
|
|
136
|
+
* of {@link isLeafColumn} returning `false`.
|
|
137
|
+
*/
|
|
138
|
+
function getLeafColumnData(recipe) {
|
|
139
|
+
if (!isLeafColumn(recipe)) throw new Error(`getLeafColumnData: recipe ${recipe.id} is not a leaf column`);
|
|
140
|
+
return extractLeafColumn(recipe)?.getData();
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Walk wrapper layers (Overridden, Filtered) down to the bare {@link ColumnLazy}
|
|
144
|
+
* leaf the chain bottoms out at. Returns `undefined` if the chain reaches a
|
|
145
|
+
* {@link ColumnDiscoveredRecipe} instead — i.e. the recipe is not a leaf
|
|
146
|
+
* ({@link isLeafColumn} would return `false`). Mirror of {@link findDiscovered}.
|
|
147
|
+
*/
|
|
148
|
+
function extractLeafColumn(recipe) {
|
|
149
|
+
let current = recipe;
|
|
150
|
+
while (true) {
|
|
151
|
+
if (current instanceof ColumnLazyImpl) return current;
|
|
152
|
+
if (current instanceof ColumnOverriddenRecipe || current instanceof ColumnFilteredRecipe) {
|
|
153
|
+
current = current.getInner();
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (current instanceof ColumnDiscoveredRecipe) throw new Error(`extractLeafColumn: recipe ${recipe.id} is not a leaf column`);
|
|
157
|
+
throw new Error(`extractLeafColumn: unrecognized recipe layer for ${recipe.id}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Enumerates every column already in `source` and renders distinct labels
|
|
162
|
+
* from each recipe's spec. Filtering is the caller's job — pass a
|
|
163
|
+
* {@link ColumnsCollection} that was already narrowed via `.filter(...)` /
|
|
164
|
+
* `.discover(...)`, or hand over a raw {@link ColumnsSource} (provider,
|
|
165
|
+
* accessor, column array, or `"result_pool"` / `"current_block"` shorthand)
|
|
166
|
+
* to be wrapped on the fly.
|
|
167
|
+
*/
|
|
168
|
+
function deriveColumnOptions(source, labelOptions = {}) {
|
|
169
|
+
const recipes = (isColumnsCollection(source) ? source : ColumnsCollection(source)).getColumns();
|
|
170
|
+
const labels = deriveDistinctLabels(recipes.map((r) => r.getSpec()), labelOptions);
|
|
171
|
+
return recipes.map((r, i) => ({
|
|
172
|
+
id: r.id,
|
|
173
|
+
label: labels[i]
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
export { collectLinkerColumns, collectLinkerIds, deriveColumnOptions, getLeafColumnData, hasColumnData, hitQualifications, isLeafColumn, queriesQualifications };
|
|
178
|
+
|
|
179
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/columns/utils.ts"],"sourcesContent":["import {\n collectSpecQueryColumns,\n extractPObjectId,\n isDataInfo,\n visitDataInfo,\n type AxisQualification,\n type ColumnUniversalId,\n type PObjectId,\n} from \"@milaboratories/pl-model-common\";\nimport { throwError } from \"@milaboratories/helpers\";\nimport type { GlobalCfgRenderCtx } from \"../render/internal\";\nimport { TreeNodeAccessor } from \"../render\";\nimport { deriveDistinctLabels, type DeriveLabelsOptions } from \"../labels/derive_distinct_labels\";\nimport { ColumnLazy, ColumnLazyImpl, type ColumnLazyData } from \"./column_lazy\";\nimport { ColumnDiscoveredRecipe } from \"./column_recipes/column_discovered_recipe\";\nimport { ColumnFilteredRecipe } from \"./column_recipes/column_filtered_recipe\";\nimport { ColumnOverriddenRecipe } from \"./column_recipes/column_overrided_recipe\";\nimport type { ColumnRecipe } from \"./column_recipes/types\";\nimport { ColumnsCollection, isColumnsCollection } from \"./columns_collection\";\nimport type { ColumnsSource } from \"./column_providers/types\";\n\n/**\n * PObjectIds of every non-hit column referenced by `recipe.getQuery()`,\n * deduped in traversal order. The hit column is\n * `extractPObjectId(recipe.id)`; anything else in the query is a linker or\n * other engine-consumed column.\n *\n * Pure query walk — no registry access. Use {@link collectLinkerColumns} for\n * the resolved {@link ColumnLazy} variant.\n */\nexport function collectLinkerIds(recipe: ColumnRecipe): PObjectId[] {\n const hit = extractPObjectId(recipe.id);\n const seen = new Set<PObjectId>();\n const out: PObjectId[] = [];\n for (const id of collectSpecQueryColumns(recipe.getQuery())) {\n // Leaf ids in SpecQuery may be rich (e.g. ColumnDiscoveredId) — drop to\n // bare PObjectId before comparing/registering so we hand the ambient\n // ColumnRegistry physical ids it can resolve.\n const bare = extractPObjectId(id);\n if (bare === hit) continue;\n if (seen.has(bare)) continue;\n seen.add(bare);\n out.push(bare);\n }\n return out;\n}\n\n/**\n * {@link collectLinkerIds} resolved against the ambient context as\n * {@link ColumnLazy} instances. Throws if any id fails to resolve —\n * matches the contract of the legacy `resolveLinkers` it replaces.\n */\nexport function collectLinkerColumns(\n recipe: ColumnRecipe,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): ColumnLazy[] {\n return collectLinkerIds(recipe).map(\n (id) =>\n ColumnLazyImpl.fromId(id, opts) ??\n throwError(`materializeLinkers: linker ${id} not resolvable`),\n );\n}\n\n/**\n * Hit-side axis qualifications for the recipe — the ones that should land on\n * the outer-join entry wrapping this column at the consumer boundary.\n *\n * Descends {@link ColumnOverriddenRecipe} / {@link ColumnFilteredRecipe} via\n * `getInner()` until it finds a {@link ColumnDiscoveredRecipe}; otherwise\n * returns `[]`. Pure recipe walk — no query-tree introspection.\n */\nexport function hitQualifications(recipe: ColumnRecipe): readonly AxisQualification[] {\n const discovered = findDiscovered(recipe);\n return discovered?.getColumnQualifications() ?? [];\n}\n\n/**\n * Per-primary-column axis qualifications for the recipe — applied to the\n * outer primary anchors on this recipe's group side. Keyed by the external\n * primary column id (NOT by columns inside this recipe's own query).\n *\n * Same walk strategy as {@link hitQualifications}.\n */\nexport function queriesQualifications(\n recipe: ColumnRecipe,\n): Readonly<Record<PObjectId, AxisQualification[]>> {\n const discovered = findDiscovered(recipe);\n return discovered?.getQueriesQualifications() ?? {};\n}\n\n/**\n * Whether the recipe's underlying data resources actually carry bytes —\n * strictly stronger than `getDataStatus() === \"present\"`, which only tells\n * that the `.data` field is wired onto the accessor.\n *\n * Walks every physical leaf the recipe depends on via\n * {@link ColumnRecipe.getReferencedIds} (resolves each id back to a\n * {@link ColumnLazy} through the ambient ctx) and ANDs `hasData()` across\n * all of them. Inline {@link PColumnValues} payloads count as present.\n *\n * Returns `false` if any leaf cannot be re-resolved in `opts.ctx` (treat as\n * \"not yet ready\") rather than throwing — this is a UI-facing predicate, not\n * a contract assertion.\n */\nexport function hasColumnData(\n recipe: ColumnRecipe,\n opts: { ctx?: GlobalCfgRenderCtx } = {},\n): boolean {\n for (const id of recipe.getReferencedIds()) {\n const lazy = ColumnLazyImpl.fromId(id, opts);\n if (lazy === undefined) return false;\n if (lazy.getDataStatus() !== \"present\") return false;\n if (!isLazyDataPresent(lazy.getData())) return false;\n }\n return true;\n}\n\nfunction isLazyDataPresent(data: ColumnLazyData): boolean {\n if (data === undefined) return false;\n if (Array.isArray(data)) return true;\n if (data instanceof TreeNodeAccessor) return data.hasData();\n if (isDataInfo(data)) {\n let ok = true;\n visitDataInfo(data, (blob) => {\n ok &&= blob.hasData();\n });\n return ok;\n }\n return false;\n}\n\n/**\n * Walk wrapper layers (Overridden, Filtered) until a {@link\n * ColumnDiscoveredRecipe} is found. Returns `undefined` if the recipe chain\n * has no Discovered layer (bare leaves and Overridden-over-leaf cases).\n *\n * Invariant from the wrapper classes themselves: there is at most one\n * Discovered layer in any recipe chain — Discovered is constructed only via\n * its own factory and is never re-wrapped by Discovered.\n */\nfunction findDiscovered(recipe: ColumnRecipe): undefined | ColumnDiscoveredRecipe {\n let current: ColumnRecipe = recipe;\n while (true) {\n if (current instanceof ColumnDiscoveredRecipe) return current;\n if (current instanceof ColumnOverriddenRecipe || current instanceof ColumnFilteredRecipe) {\n current = current.getInner();\n continue;\n }\n return undefined;\n }\n}\n\n/**\n * A recipe is a \"leaf\" (directly co-indexed on the anchor, reached without a\n * linker chain) iff its wrapper chain contains no {@link ColumnDiscoveredRecipe}.\n *\n * `Filtered` / `Overridden` over a bare leaf stay leaves; anything wrapping a\n * `Discovered` (e.g. `Overridden(Discovered(...))`) is linked. Use this — not an\n * `instanceof ColumnLazyImpl` check — to split direct vs. linker-joined columns,\n * since projections over a plain leaf are still direct.\n */\nexport function isLeafColumn(recipe: ColumnRecipe): boolean {\n return findDiscovered(recipe) === undefined;\n}\n\n/**\n * Data of the bare leaf a \"leaf\" recipe bottoms out at — reads the leaf-only\n * {@link ColumnLazy.getData} after walking the wrapper chain down via\n * {@link extractLeafColumn}. Returns `undefined` when the recipe is not a leaf (its\n * chain reaches a {@link ColumnDiscoveredRecipe}); the symmetric counterpart\n * of {@link isLeafColumn} returning `false`.\n */\nexport function getLeafColumnData(recipe: ColumnRecipe): ColumnLazyData {\n if (!isLeafColumn(recipe)) {\n throw new Error(`getLeafColumnData: recipe ${recipe.id} is not a leaf column`);\n }\n return extractLeafColumn(recipe)?.getData();\n}\n\n/**\n * Walk wrapper layers (Overridden, Filtered) down to the bare {@link ColumnLazy}\n * leaf the chain bottoms out at. Returns `undefined` if the chain reaches a\n * {@link ColumnDiscoveredRecipe} instead — i.e. the recipe is not a leaf\n * ({@link isLeafColumn} would return `false`). Mirror of {@link findDiscovered}.\n */\nfunction extractLeafColumn(recipe: ColumnRecipe): undefined | ColumnLazy {\n let current: ColumnRecipe = recipe;\n while (true) {\n if (current instanceof ColumnLazyImpl) return current;\n if (current instanceof ColumnOverriddenRecipe || current instanceof ColumnFilteredRecipe) {\n current = current.getInner();\n continue;\n }\n if (current instanceof ColumnDiscoveredRecipe) {\n throw new Error(`extractLeafColumn: recipe ${recipe.id} is not a leaf column`);\n }\n throw new Error(`extractLeafColumn: unrecognized recipe layer for ${recipe.id}`);\n }\n}\n\n/** Drop-down option built over a {@link ColumnsCollection} — universal-id valued. */\nexport type ColumnOption = {\n readonly id: ColumnUniversalId;\n readonly label: string;\n};\n\n/**\n * Enumerates every column already in `source` and renders distinct labels\n * from each recipe's spec. Filtering is the caller's job — pass a\n * {@link ColumnsCollection} that was already narrowed via `.filter(...)` /\n * `.discover(...)`, or hand over a raw {@link ColumnsSource} (provider,\n * accessor, column array, or `\"result_pool\"` / `\"current_block\"` shorthand)\n * to be wrapped on the fly.\n */\nexport function deriveColumnOptions(\n source: ColumnsCollection | ColumnsSource[],\n labelOptions: DeriveLabelsOptions = {},\n): ColumnOption[] {\n const collection = isColumnsCollection(source) ? source : ColumnsCollection(source);\n const recipes = collection.getColumns();\n const labels = deriveDistinctLabels(\n recipes.map((r) => r.getSpec()),\n labelOptions,\n );\n return recipes.map((r, i) => ({ id: r.id, label: labels[i] }));\n}\n"],"mappings":"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"}
|
|
@@ -21,6 +21,7 @@ of partially matched axis we add to pframe a copy of this column with modified a
|
|
|
21
21
|
and modified label (with added domain values in case if more than one copy with different domains exist).
|
|
22
22
|
*/
|
|
23
23
|
function createPFrameForGraphs(ctx, blockColumns) {
|
|
24
|
+
if (blockColumns?.some((v) => v.data === void 0)) return void 0;
|
|
24
25
|
const suitableSpec = (spec) => !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);
|
|
25
26
|
if (!blockColumns) return ctx.createPFrame(require_columns.getAllRelatedColumns(ctx, suitableSpec));
|
|
26
27
|
return ctx.createPFrame(require_columns.getRelatedColumns(ctx, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PFrameForGraphs.cjs","names":["Annotation","getAllRelatedColumns","getRelatedColumns"],"sources":["../../src/components/PFrameForGraphs.ts"],"sourcesContent":["import type { PColumn, PColumnSpec, PFrameHandle } from \"@milaboratories/pl-model-common\";\nimport { Annotation, readAnnotationJson } from \"@milaboratories/pl-model-common\";\nimport type { PColumnDataUniversal, RenderCtxBase } from \"../render\";\nimport { getAllRelatedColumns, getRelatedColumns } from \"../pframe_utils/columns\";\nexport type { AxesVault } from \"../pframe_utils/axes\";\nexport { enrichCompatible, getAvailableWithLinkersAxes } from \"../pframe_utils/axes\";\n\nexport function isHiddenFromGraphColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);\n}\n\nexport function isHiddenFromUIColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromUi);\n}\n\n/**\n The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool\n (including linker columns and all label columns).\n Block’s columns are added to pframe as is.\n Other columns are added basing on set of axes of block’s columns, considering available with linker columns.\n Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from\n result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values\n among existing ones).\n In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case\n of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)\n and modified label (with added domain values in case if more than one copy with different domains exist).\n */\nexport function createPFrameForGraphs<A, U>(\n ctx: RenderCtxBase<A, U>,\n blockColumns?: PColumn<PColumnDataUniversal>[],\n): PFrameHandle | undefined {\n const suitableSpec = (spec: PColumnSpec) =>\n !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);\n // if current block doesn't produce own columns then use all columns from result pool\n if (!blockColumns) {\n return ctx.createPFrame(getAllRelatedColumns(ctx, suitableSpec));\n }\n\n return ctx.createPFrame(\n getRelatedColumns(ctx, { columns: blockColumns, predicate: suitableSpec }),\n );\n}\n"],"mappings":";;;;AAOA,SAAgB,wBAAwB,QAA8B;CACpE,OAAO,CAAC,EAAA,GAAA,gCAAA,mBAAA,CAAoB,QAAQA,gCAAAA,WAAW,kBAAkB;AACnE;AAEA,SAAgB,qBAAqB,QAA8B;CACjE,OAAO,CAAC,EAAA,GAAA,gCAAA,mBAAA,CAAoB,QAAQA,gCAAAA,WAAW,cAAc;AAC/D;;;;;;;;;;;;;AAcA,SAAgB,sBACd,KACA,cAC0B;CAC1B,MAAM,gBAAgB,SACpB,CAAC,qBAAqB,IAAI,KAAK,CAAC,wBAAwB,IAAI;CAE9D,IAAI,CAAC,cACH,OAAO,IAAI,aAAaC,gBAAAA,qBAAqB,KAAK,YAAY,CAAC;CAGjE,OAAO,IAAI,aACTC,gBAAAA,kBAAkB,KAAK;EAAE,SAAS;EAAc,WAAW;CAAa,CAAC,CAC3E;AACF"}
|
|
1
|
+
{"version":3,"file":"PFrameForGraphs.cjs","names":["Annotation","getAllRelatedColumns","getRelatedColumns"],"sources":["../../src/components/PFrameForGraphs.ts"],"sourcesContent":["import type { PColumn, PColumnSpec, PFrameHandle } from \"@milaboratories/pl-model-common\";\nimport { Annotation, readAnnotationJson } from \"@milaboratories/pl-model-common\";\nimport type { PColumnDataUniversal, RenderCtxBase } from \"../render\";\nimport { getAllRelatedColumns, getRelatedColumns } from \"../pframe_utils/columns\";\nexport type { AxesVault } from \"../pframe_utils/axes\";\nexport { enrichCompatible, getAvailableWithLinkersAxes } from \"../pframe_utils/axes\";\n\nexport function isHiddenFromGraphColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);\n}\n\nexport function isHiddenFromUIColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromUi);\n}\n\n/**\n The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool\n (including linker columns and all label columns).\n Block’s columns are added to pframe as is.\n Other columns are added basing on set of axes of block’s columns, considering available with linker columns.\n Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from\n result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values\n among existing ones).\n In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case\n of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)\n and modified label (with added domain values in case if more than one copy with different domains exist).\n */\nexport function createPFrameForGraphs<A, U>(\n ctx: RenderCtxBase<A, U>,\n blockColumns?: PColumn<undefined | PColumnDataUniversal>[],\n): PFrameHandle | undefined {\n if (blockColumns?.some((v) => v.data === undefined)) return undefined;\n\n const suitableSpec = (spec: PColumnSpec) =>\n !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);\n // if current block doesn't produce own columns then use all columns from result pool\n if (!blockColumns) {\n return ctx.createPFrame(getAllRelatedColumns(ctx, suitableSpec));\n }\n\n return ctx.createPFrame(\n getRelatedColumns(ctx, { columns: blockColumns, predicate: suitableSpec }),\n );\n}\n"],"mappings":";;;;AAOA,SAAgB,wBAAwB,QAA8B;CACpE,OAAO,CAAC,EAAA,GAAA,gCAAA,mBAAA,CAAoB,QAAQA,gCAAAA,WAAW,kBAAkB;AACnE;AAEA,SAAgB,qBAAqB,QAA8B;CACjE,OAAO,CAAC,EAAA,GAAA,gCAAA,mBAAA,CAAoB,QAAQA,gCAAAA,WAAW,cAAc;AAC/D;;;;;;;;;;;;;AAcA,SAAgB,sBACd,KACA,cAC0B;CAC1B,IAAI,cAAc,MAAM,MAAM,EAAE,SAAS,KAAA,CAAS,GAAG,OAAO,KAAA;CAE5D,MAAM,gBAAgB,SACpB,CAAC,qBAAqB,IAAI,KAAK,CAAC,wBAAwB,IAAI;CAE9D,IAAI,CAAC,cACH,OAAO,IAAI,aAAaC,gBAAAA,qBAAqB,KAAK,YAAY,CAAC;CAGjE,OAAO,IAAI,aACTC,gBAAAA,kBAAkB,KAAK;EAAE,SAAS;EAAc,WAAW;CAAa,CAAC,CAC3E;AACF"}
|
|
@@ -18,7 +18,7 @@ declare function isHiddenFromUIColumn(column: PColumnSpec): boolean;
|
|
|
18
18
|
of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)
|
|
19
19
|
and modified label (with added domain values in case if more than one copy with different domains exist).
|
|
20
20
|
*/
|
|
21
|
-
declare function createPFrameForGraphs<A, U>(ctx: RenderCtxBase<A, U>, blockColumns?: PColumn<PColumnDataUniversal>[]): PFrameHandle | undefined;
|
|
21
|
+
declare function createPFrameForGraphs<A, U>(ctx: RenderCtxBase<A, U>, blockColumns?: PColumn<undefined | PColumnDataUniversal>[]): PFrameHandle | undefined;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { type AxesVault, createPFrameForGraphs, enrichCompatible, getAvailableWithLinkersAxes, isHiddenFromGraphColumn, isHiddenFromUIColumn };
|
|
24
24
|
//# sourceMappingURL=PFrameForGraphs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PFrameForGraphs.d.ts","names":[],"sources":["../../src/components/PFrameForGraphs.ts"],"mappings":";;;;;;iBAOgB,uBAAA,CAAwB,MAAmB,EAAX,WAAW;AAAA,iBAI3C,oBAAA,CAAqB,MAAmB,EAAX,WAAW;;AAJxD;;;;AAA2D;AAI3D;;;;AAAwD;AAgBxD;iBAAgB,qBAAA,OACd,GAAA,EAAK,aAAA,CAAc,CAAA,EAAG,CAAA,GACtB,YAAA,GAAe,OAAA,
|
|
1
|
+
{"version":3,"file":"PFrameForGraphs.d.ts","names":[],"sources":["../../src/components/PFrameForGraphs.ts"],"mappings":";;;;;;iBAOgB,uBAAA,CAAwB,MAAmB,EAAX,WAAW;AAAA,iBAI3C,oBAAA,CAAqB,MAAmB,EAAX,WAAW;;AAJxD;;;;AAA2D;AAI3D;;;;AAAwD;AAgBxD;iBAAgB,qBAAA,OACd,GAAA,EAAK,aAAA,CAAc,CAAA,EAAG,CAAA,GACtB,YAAA,GAAe,OAAA,aAAoB,oBAAA,MAClC,YAAA"}
|
|
@@ -21,6 +21,7 @@ of partially matched axis we add to pframe a copy of this column with modified a
|
|
|
21
21
|
and modified label (with added domain values in case if more than one copy with different domains exist).
|
|
22
22
|
*/
|
|
23
23
|
function createPFrameForGraphs(ctx, blockColumns) {
|
|
24
|
+
if (blockColumns?.some((v) => v.data === void 0)) return void 0;
|
|
24
25
|
const suitableSpec = (spec) => !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);
|
|
25
26
|
if (!blockColumns) return ctx.createPFrame(getAllRelatedColumns(ctx, suitableSpec));
|
|
26
27
|
return ctx.createPFrame(getRelatedColumns(ctx, {
|