@platforma-sdk/model 1.85.2 → 1.86.3
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/_virtual/_rolldown/runtime.cjs +2 -3
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/annotations/converter.cjs +1 -2
- package/dist/annotations/converter.cjs.map +1 -1
- package/dist/annotations/converter.d.ts +0 -2
- package/dist/annotations/converter.d.ts.map +1 -1
- package/dist/annotations/converter.js +1 -2
- package/dist/annotations/converter.js.map +1 -1
- package/dist/annotations/index.js +1 -2
- package/dist/annotations/types.d.ts +0 -2
- package/dist/annotations/types.d.ts.map +1 -1
- package/dist/bconfig/lambdas.d.ts +0 -2
- package/dist/bconfig/lambdas.d.ts.map +1 -1
- package/dist/bconfig/normalization.cjs +1 -2
- package/dist/bconfig/normalization.cjs.map +1 -1
- package/dist/bconfig/normalization.d.ts +0 -2
- package/dist/bconfig/normalization.d.ts.map +1 -1
- package/dist/bconfig/normalization.js +1 -2
- package/dist/bconfig/types.cjs +1 -2
- package/dist/bconfig/types.d.ts +0 -2
- package/dist/bconfig/types.d.ts.map +1 -1
- package/dist/bconfig/types.js +1 -2
- package/dist/bconfig/util.d.ts +1 -2
- package/dist/bconfig/util.d.ts.map +1 -1
- package/dist/bconfig/v3.d.ts +0 -2
- package/dist/bconfig/v3.d.ts.map +1 -1
- package/dist/block_api_v1.d.ts +0 -2
- package/dist/block_api_v1.d.ts.map +1 -1
- package/dist/block_api_v2.d.ts +0 -2
- package/dist/block_api_v2.d.ts.map +1 -1
- package/dist/block_api_v3.d.ts +0 -2
- package/dist/block_api_v3.d.ts.map +1 -1
- package/dist/block_migrations.cjs +3 -3
- package/dist/block_migrations.cjs.map +1 -1
- package/dist/block_migrations.d.ts +1 -2
- package/dist/block_migrations.d.ts.map +1 -1
- package/dist/block_migrations.js +3 -3
- package/dist/block_migrations.js.map +1 -1
- package/dist/block_model.cjs +1 -2
- package/dist/block_model.cjs.map +1 -1
- package/dist/block_model.d.ts +1 -2
- package/dist/block_model.d.ts.map +1 -1
- package/dist/block_model.js +1 -2
- package/dist/block_state_patch.d.ts +0 -2
- package/dist/block_state_patch.d.ts.map +1 -1
- package/dist/block_state_util.cjs +1 -2
- package/dist/block_state_util.d.ts +1 -2
- package/dist/block_state_util.d.ts.map +1 -1
- package/dist/block_state_util.js +1 -2
- package/dist/block_storage.cjs +1 -2
- package/dist/block_storage.d.ts +0 -2
- package/dist/block_storage.d.ts.map +1 -1
- package/dist/block_storage.js +1 -2
- package/dist/block_storage_callbacks.cjs +9 -7
- package/dist/block_storage_callbacks.cjs.map +1 -1
- package/dist/block_storage_callbacks.js +9 -7
- package/dist/block_storage_callbacks.js.map +1 -1
- package/dist/block_storage_facade.cjs +1 -2
- package/dist/block_storage_facade.cjs.map +1 -1
- package/dist/block_storage_facade.d.ts +0 -2
- package/dist/block_storage_facade.d.ts.map +1 -1
- package/dist/block_storage_facade.js +1 -2
- package/dist/block_storage_facade.js.map +1 -1
- package/dist/columns/column.cjs +1 -2
- package/dist/columns/column.d.ts +0 -2
- package/dist/columns/column.d.ts.map +1 -1
- package/dist/columns/column.js +1 -2
- package/dist/columns/column_providers/index.cjs +1 -2
- package/dist/columns/column_providers/index.d.ts +0 -2
- package/dist/columns/column_providers/index.d.ts.map +1 -1
- package/dist/columns/column_providers/index.js +1 -2
- package/dist/columns/column_providers/providers.cjs +1 -2
- package/dist/columns/column_providers/providers.cjs.map +1 -1
- package/dist/columns/column_providers/providers.d.ts +0 -2
- package/dist/columns/column_providers/providers.d.ts.map +1 -1
- package/dist/columns/column_providers/providers.js +1 -2
- package/dist/columns/column_providers/types.d.ts +0 -2
- package/dist/columns/column_providers/types.d.ts.map +1 -1
- package/dist/columns/column_recipes/column_discovered_recipe.cjs +1 -2
- package/dist/columns/column_recipes/column_discovered_recipe.cjs.map +1 -1
- package/dist/columns/column_recipes/column_discovered_recipe.d.ts +0 -2
- package/dist/columns/column_recipes/column_discovered_recipe.d.ts.map +1 -1
- package/dist/columns/column_recipes/column_discovered_recipe.js +1 -2
- package/dist/columns/column_recipes/column_filtered_recipe.cjs +1 -2
- package/dist/columns/column_recipes/column_filtered_recipe.cjs.map +1 -1
- package/dist/columns/column_recipes/column_filtered_recipe.d.ts +0 -2
- package/dist/columns/column_recipes/column_filtered_recipe.d.ts.map +1 -1
- package/dist/columns/column_recipes/column_filtered_recipe.js +1 -2
- package/dist/columns/column_recipes/column_overrided_recipe.cjs +1 -2
- package/dist/columns/column_recipes/column_overrided_recipe.cjs.map +1 -1
- package/dist/columns/column_recipes/column_overrided_recipe.d.ts +1 -2
- package/dist/columns/column_recipes/column_overrided_recipe.d.ts.map +1 -1
- package/dist/columns/column_recipes/column_overrided_recipe.js +1 -2
- package/dist/columns/column_recipes/index.cjs +1 -2
- package/dist/columns/column_recipes/index.cjs.map +1 -1
- package/dist/columns/column_recipes/index.d.ts +0 -2
- package/dist/columns/column_recipes/index.d.ts.map +1 -1
- package/dist/columns/column_recipes/index.js +1 -2
- package/dist/columns/column_recipes/leaf_rebrand.cjs +1 -2
- package/dist/columns/column_recipes/leaf_rebrand.cjs.map +1 -1
- package/dist/columns/column_recipes/leaf_rebrand.js +1 -2
- package/dist/columns/column_recipes/types.d.ts +0 -2
- package/dist/columns/column_recipes/types.d.ts.map +1 -1
- package/dist/columns/columns_collection.cjs +1 -2
- package/dist/columns/columns_collection.cjs.map +1 -1
- package/dist/columns/columns_collection.d.ts +0 -2
- package/dist/columns/columns_collection.d.ts.map +1 -1
- package/dist/columns/columns_collection.js +1 -2
- package/dist/columns/data_column.cjs +1 -2
- package/dist/columns/data_column.cjs.map +1 -1
- package/dist/columns/data_column.d.ts +0 -2
- package/dist/columns/data_column.d.ts.map +1 -1
- package/dist/columns/data_column.js +1 -2
- package/dist/columns/derive_axis_values_labels.cjs +1 -2
- package/dist/columns/derive_axis_values_labels.cjs.map +1 -1
- package/dist/columns/derive_axis_values_labels.d.ts +0 -2
- package/dist/columns/derive_axis_values_labels.d.ts.map +1 -1
- package/dist/columns/derive_axis_values_labels.js +1 -2
- package/dist/columns/index.cjs +8 -0
- package/dist/columns/index.d.ts +3 -2
- package/dist/columns/index.js +3 -2
- package/dist/columns/peer_links.cjs +42 -0
- package/dist/columns/peer_links.cjs.map +1 -0
- package/dist/columns/peer_links.d.ts +16 -0
- package/dist/columns/peer_links.d.ts.map +1 -0
- package/dist/columns/peer_links.js +38 -0
- package/dist/columns/peer_links.js.map +1 -0
- package/dist/columns/split_by_axes.cjs +1 -2
- package/dist/columns/split_by_axes.cjs.map +1 -1
- package/dist/columns/split_by_axes.d.ts +0 -2
- package/dist/columns/split_by_axes.d.ts.map +1 -1
- package/dist/columns/split_by_axes.js +1 -2
- package/dist/columns/split_by_axes.js.map +1 -1
- package/dist/columns/utils.cjs +31 -7
- package/dist/columns/utils.cjs.map +1 -1
- package/dist/columns/utils.d.ts +11 -2
- package/dist/columns/utils.d.ts.map +1 -1
- package/dist/columns/utils.js +30 -8
- package/dist/columns/utils.js.map +1 -1
- package/dist/components/PFrameForGraphs.cjs +1 -2
- package/dist/components/PFrameForGraphs.cjs.map +1 -1
- package/dist/components/PFrameForGraphs.d.ts +0 -2
- package/dist/components/PFrameForGraphs.d.ts.map +1 -1
- package/dist/components/PFrameForGraphs.js +1 -2
- package/dist/components/PlAnnotations/filter.d.ts +0 -2
- package/dist/components/PlAnnotations/filter.d.ts.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.cjs +1 -2
- package/dist/components/PlAnnotations/filters_ui.d.ts +0 -2
- package/dist/components/PlAnnotations/filters_ui.d.ts.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.js +1 -2
- package/dist/components/PlDataTable/columnResolver.cjs +1 -2
- package/dist/components/PlDataTable/columnResolver.cjs.map +1 -1
- package/dist/components/PlDataTable/columnResolver.js +1 -2
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.cjs +1 -2
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.js +1 -2
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.cjs +1 -2
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js +1 -2
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.cjs +1 -2
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.d.ts +0 -2
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.js +1 -2
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs +21 -5
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts +0 -2
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js +21 -5
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.cjs +1 -2
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.d.ts +0 -2
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.js +1 -2
- package/dist/components/PlDataTable/createPlDataTable/index.cjs +1 -2
- package/dist/components/PlDataTable/createPlDataTable/index.d.ts +0 -2
- package/dist/components/PlDataTable/createPlDataTable/index.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/index.js +1 -2
- package/dist/components/PlDataTable/createPlDataTable/utils.cjs +8 -6
- package/dist/components/PlDataTable/createPlDataTable/utils.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/utils.d.ts +0 -2
- package/dist/components/PlDataTable/createPlDataTable/utils.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/utils.js +8 -6
- package/dist/components/PlDataTable/createPlDataTable/utils.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.cjs +1 -2
- package/dist/components/PlDataTable/createPlDataTableSheet.d.ts +0 -2
- package/dist/components/PlDataTable/createPlDataTableSheet.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.js +1 -2
- package/dist/components/PlDataTable/labels.cjs +1 -2
- package/dist/components/PlDataTable/labels.cjs.map +1 -1
- package/dist/components/PlDataTable/labels.js +1 -2
- package/dist/components/PlDataTable/state-migration.cjs +1 -2
- package/dist/components/PlDataTable/state-migration.cjs.map +1 -1
- package/dist/components/PlDataTable/state-migration.d.ts +0 -2
- package/dist/components/PlDataTable/state-migration.d.ts.map +1 -1
- package/dist/components/PlDataTable/state-migration.js +1 -2
- package/dist/components/PlDataTable/state-migration.js.map +1 -1
- package/dist/components/PlDataTable/typesV4.d.ts +0 -2
- package/dist/components/PlDataTable/typesV4.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV5.d.ts +0 -2
- package/dist/components/PlDataTable/typesV5.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV6.d.ts +0 -2
- package/dist/components/PlDataTable/typesV6.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV7.d.ts +0 -2
- package/dist/components/PlDataTable/typesV7.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV8.d.ts +2 -2
- package/dist/components/PlDataTable/typesV8.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.cjs +1 -2
- package/dist/components/PlDatasetSelector/build_dataset_options.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.d.ts +1 -2
- package/dist/components/PlDatasetSelector/build_dataset_options.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.js +1 -2
- package/dist/components/PlDatasetSelector/dataset_selection.cjs +1 -2
- package/dist/components/PlDatasetSelector/dataset_selection.d.ts +0 -2
- package/dist/components/PlDatasetSelector/dataset_selection.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/dataset_selection.js +1 -2
- package/dist/components/PlDatasetSelector/enrichment_discovery.cjs +4 -4
- package/dist/components/PlDatasetSelector/enrichment_discovery.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/enrichment_discovery.js +4 -4
- package/dist/components/PlDatasetSelector/enrichment_discovery.js.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.cjs +1 -2
- package/dist/components/PlDatasetSelector/filter_discovery.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.d.ts +0 -2
- package/dist/components/PlDatasetSelector/filter_discovery.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.js +1 -2
- package/dist/components/PlMultiSequenceAlignment.cjs +1 -2
- package/dist/components/PlMultiSequenceAlignment.cjs.map +1 -1
- package/dist/components/PlMultiSequenceAlignment.d.ts +0 -2
- package/dist/components/PlMultiSequenceAlignment.d.ts.map +1 -1
- package/dist/components/PlMultiSequenceAlignment.js +1 -2
- package/dist/components/PlSelectionModel.cjs +1 -2
- package/dist/components/PlSelectionModel.d.ts +0 -2
- package/dist/components/PlSelectionModel.d.ts.map +1 -1
- package/dist/components/PlSelectionModel.js +1 -2
- package/dist/config/model.d.ts +0 -2
- package/dist/config/model.d.ts.map +1 -1
- package/dist/config/type_engine.d.ts +1 -2
- package/dist/config/type_engine.d.ts.map +1 -1
- package/dist/env_value.cjs +1 -2
- package/dist/env_value.d.ts +0 -2
- package/dist/env_value.d.ts.map +1 -1
- package/dist/env_value.js +1 -2
- package/dist/filters/converters/filterToQuery.cjs +1 -2
- package/dist/filters/converters/filterToQuery.d.ts +0 -2
- package/dist/filters/converters/filterToQuery.d.ts.map +1 -1
- package/dist/filters/converters/filterToQuery.js +1 -2
- package/dist/filters/converters/filterUiToExpressionImpl.cjs +1 -2
- package/dist/filters/converters/filterUiToExpressionImpl.cjs.map +1 -1
- package/dist/filters/converters/filterUiToExpressionImpl.d.ts +0 -2
- package/dist/filters/converters/filterUiToExpressionImpl.d.ts.map +1 -1
- package/dist/filters/converters/filterUiToExpressionImpl.js +1 -2
- package/dist/filters/distill.cjs +1 -2
- package/dist/filters/distill.cjs.map +1 -1
- package/dist/filters/distill.d.ts +1 -3
- package/dist/filters/distill.d.ts.map +1 -1
- package/dist/filters/distill.js +1 -2
- package/dist/filters/distill.js.map +1 -1
- package/dist/filters/traverse.cjs +1 -2
- package/dist/filters/traverse.js +1 -2
- package/dist/filters/types.d.ts +0 -2
- package/dist/filters/types.d.ts.map +1 -1
- package/dist/index.cjs +8 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/internal.cjs +1 -2
- package/dist/internal.js +1 -2
- package/dist/labels/derive_distinct_labels.cjs +7 -5
- package/dist/labels/derive_distinct_labels.cjs.map +1 -1
- package/dist/labels/derive_distinct_labels.d.ts +3 -2
- package/dist/labels/derive_distinct_labels.d.ts.map +1 -1
- package/dist/labels/derive_distinct_labels.js +7 -5
- package/dist/labels/derive_distinct_labels.js.map +1 -1
- package/dist/labels/derive_distinct_tooltips.cjs +1 -2
- package/dist/labels/derive_distinct_tooltips.cjs.map +1 -1
- package/dist/labels/derive_distinct_tooltips.d.ts +0 -2
- package/dist/labels/derive_distinct_tooltips.d.ts.map +1 -1
- package/dist/labels/derive_distinct_tooltips.js +1 -2
- package/dist/labels/linked_column_postfix.cjs +5 -3
- package/dist/labels/linked_column_postfix.cjs.map +1 -1
- package/dist/labels/linked_column_postfix.d.ts +0 -2
- package/dist/labels/linked_column_postfix.d.ts.map +1 -1
- package/dist/labels/linked_column_postfix.js +5 -3
- package/dist/labels/linked_column_postfix.js.map +1 -1
- package/dist/package.cjs +2 -3
- package/dist/package.js +2 -3
- package/dist/pframe.cjs +1 -2
- package/dist/pframe.d.ts +0 -2
- package/dist/pframe.d.ts.map +1 -1
- package/dist/pframe.js +1 -2
- package/dist/pframe_utils/axes.cjs +3 -3
- package/dist/pframe_utils/axes.cjs.map +1 -1
- package/dist/pframe_utils/axes.d.ts +0 -2
- package/dist/pframe_utils/axes.d.ts.map +1 -1
- package/dist/pframe_utils/axes.js +3 -3
- package/dist/pframe_utils/axes.js.map +1 -1
- package/dist/pframe_utils/columns.cjs +10 -7
- package/dist/pframe_utils/columns.cjs.map +1 -1
- package/dist/pframe_utils/columns.d.ts +0 -2
- package/dist/pframe_utils/columns.d.ts.map +1 -1
- package/dist/pframe_utils/columns.js +10 -7
- package/dist/pframe_utils/columns.js.map +1 -1
- package/dist/pframe_utils/index.cjs +1 -2
- package/dist/pframe_utils/index.cjs.map +1 -1
- package/dist/pframe_utils/index.d.ts +0 -2
- package/dist/pframe_utils/index.d.ts.map +1 -1
- package/dist/pframe_utils/index.js +1 -2
- package/dist/platforma.d.ts +0 -2
- package/dist/platforma.d.ts.map +1 -1
- package/dist/plugin_handle.cjs +1 -2
- package/dist/plugin_handle.d.ts +0 -2
- package/dist/plugin_handle.d.ts.map +1 -1
- package/dist/plugin_handle.js +1 -2
- package/dist/plugin_model.cjs +1 -2
- package/dist/plugin_model.d.ts +1 -2
- package/dist/plugin_model.d.ts.map +1 -1
- package/dist/plugin_model.js +1 -2
- package/dist/raw_globals.cjs +1 -2
- package/dist/raw_globals.d.ts +0 -2
- package/dist/raw_globals.d.ts.map +1 -1
- package/dist/raw_globals.js +1 -2
- package/dist/render/accessor.cjs +1 -2
- package/dist/render/accessor.cjs.map +1 -1
- package/dist/render/accessor.d.ts +1 -2
- package/dist/render/accessor.d.ts.map +1 -1
- package/dist/render/accessor.js +1 -2
- package/dist/render/api.cjs +10 -8
- package/dist/render/api.cjs.map +1 -1
- package/dist/render/api.d.ts +1 -2
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/api.js +10 -8
- package/dist/render/api.js.map +1 -1
- package/dist/render/future.cjs +1 -2
- package/dist/render/future.d.ts +0 -2
- package/dist/render/future.d.ts.map +1 -1
- package/dist/render/future.js +1 -2
- package/dist/render/internal.cjs +1 -2
- package/dist/render/internal.cjs.map +1 -1
- package/dist/render/internal.d.ts +0 -1
- package/dist/render/internal.js +1 -2
- package/dist/render/internal.js.map +1 -1
- package/dist/render/traversal_ops.d.ts +0 -2
- package/dist/render/traversal_ops.d.ts.map +1 -1
- package/dist/render/util/axis_filtering.cjs +1 -2
- package/dist/render/util/axis_filtering.d.ts +0 -2
- package/dist/render/util/axis_filtering.d.ts.map +1 -1
- package/dist/render/util/axis_filtering.js +1 -2
- package/dist/render/util/column_collection.cjs +3 -3
- package/dist/render/util/column_collection.cjs.map +1 -1
- package/dist/render/util/column_collection.d.ts +1 -2
- package/dist/render/util/column_collection.d.ts.map +1 -1
- package/dist/render/util/column_collection.js +3 -3
- package/dist/render/util/column_collection.js.map +1 -1
- package/dist/render/util/label.cjs +3 -3
- package/dist/render/util/label.cjs.map +1 -1
- package/dist/render/util/label.d.ts +0 -2
- package/dist/render/util/label.d.ts.map +1 -1
- package/dist/render/util/label.js +3 -3
- package/dist/render/util/label.js.map +1 -1
- package/dist/render/util/pcolumn_data.cjs +23 -26
- package/dist/render/util/pcolumn_data.cjs.map +1 -1
- package/dist/render/util/pcolumn_data.d.ts +1 -2
- package/dist/render/util/pcolumn_data.d.ts.map +1 -1
- package/dist/render/util/pcolumn_data.js +23 -26
- package/dist/render/util/pcolumn_data.js.map +1 -1
- package/dist/render/util/pframe_upgraders.cjs +1 -2
- package/dist/render/util/pframe_upgraders.js +1 -2
- package/dist/render/util/split_selectors.d.ts +0 -2
- package/dist/render/util/split_selectors.d.ts.map +1 -1
- package/dist/services/block_services.cjs +1 -2
- package/dist/services/block_services.cjs.map +1 -1
- package/dist/services/block_services.d.ts +0 -2
- package/dist/services/block_services.d.ts.map +1 -1
- package/dist/services/block_services.js +1 -2
- package/dist/services/get_services.cjs +1 -2
- package/dist/services/get_services.d.ts +0 -2
- package/dist/services/get_services.d.ts.map +1 -1
- package/dist/services/get_services.js +1 -2
- package/dist/services/service_bridge.cjs +1 -2
- package/dist/services/service_bridge.d.ts +0 -2
- package/dist/services/service_bridge.d.ts.map +1 -1
- package/dist/services/service_bridge.js +1 -2
- package/dist/services/service_resolve.d.ts +0 -2
- package/dist/services/service_resolve.d.ts.map +1 -1
- package/dist/version.cjs +1 -2
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -2
- package/package.json +22 -17
- package/src/annotations/converter.ts +5 -10
- package/src/block_storage_facade.ts +3 -1
- package/src/columns/index.ts +1 -0
- package/src/columns/peer_links.test.ts +58 -0
- package/src/columns/peer_links.ts +57 -0
- package/src/columns/split_by_axes.ts +4 -3
- package/src/columns/utils.ts +42 -2
- package/src/components/PlDataTable/createPlDataTable/createPlDataTableV3.ts +28 -3
- package/src/components/PlDataTable/createPlDataTable/utils.ts +3 -0
- package/src/components/PlDataTable/state-migration.ts +4 -6
- package/src/components/PlDataTable/typesV8.ts +2 -0
- package/src/filters/distill.ts +2 -2
- package/src/labels/derive_distinct_labels.ts +9 -2
- package/src/labels/linked_column_postfix.test.ts +8 -0
- package/src/labels/linked_column_postfix.ts +13 -7
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AxisId, CanonicalizedJson, PColumnSpec } from "@milaboratories/pl-model-common";
|
|
2
|
+
export type DatasetAxes = Set<CanonicalizedJson<AxisId>>;
|
|
3
|
+
/** Main axes of the datasets: the second axis of every column marked `pl7.app/isAnchor`. */
|
|
4
|
+
export declare function collectDatasetAxes(specs: PColumnSpec[]): DatasetAxes;
|
|
5
|
+
/** {@link collectDatasetAxes} over the result pool. */
|
|
6
|
+
export declare function getResultPoolDatasetAxes(): DatasetAxes;
|
|
7
|
+
/**
|
|
8
|
+
* Labels of the peer links on a linker path. A peer link joins two datasets' main axes, e.g. one
|
|
9
|
+
* clonotype to another, so the columns behind it describe a different clonotype than the row.
|
|
10
|
+
*/
|
|
11
|
+
export declare function findPeerLinks(linkers: PColumnSpec[], datasetAxes: DatasetAxes): string[];
|
|
12
|
+
/** Hover text for the link icon. */
|
|
13
|
+
export declare function describePeerLinks(links: string[]): string;
|
|
14
|
+
/** Moves peer-linked items after the others, keeping the order within each group. */
|
|
15
|
+
export declare function peerLinkedLast<T>(items: T[], isPeerLinked: (item: T) => boolean): T[];
|
|
16
|
+
//# sourceMappingURL=peer_links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer_links.d.ts","names":[],"sources":["../../src/columns/peer_links.ts"],"mappings":";YAWY,cAAc,IAAI,kBAAkB;;wBAGhC,mBAAmB,OAAO,gBAAgB;;wBAY1C,4BAA4B;;;;;wBAY5B,cAAc,SAAS,eAAe,aAAa;;wBAWnD,kBAAkB;;wBAKlB,eAAe,GAAG,OAAO,KAAK,eAAe,MAAM,gBAAgB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ResultPoolColumnsProvider } from "./column_providers/providers.js";
|
|
2
|
+
import "./column_providers/index.js";
|
|
3
|
+
import { Annotation, canonicalizeAxisId, readAnnotation } from "@milaboratories/pl-model-common";
|
|
4
|
+
import { uniq } from "es-toolkit";
|
|
5
|
+
// src/columns/peer_links.ts
|
|
6
|
+
/** Main axes of the datasets: the second axis of every column marked `pl7.app/isAnchor`. */
|
|
7
|
+
function collectDatasetAxes(specs) {
|
|
8
|
+
return new Set(specs.flatMap((spec) => {
|
|
9
|
+
const main = spec.axesSpec[1];
|
|
10
|
+
return readAnnotation(spec, Annotation.IsAnchor) === "true" && main !== void 0 ? [canonicalizeAxisId(main)] : [];
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
/** {@link collectDatasetAxes} over the result pool. */
|
|
14
|
+
function getResultPoolDatasetAxes() {
|
|
15
|
+
return collectDatasetAxes(ResultPoolColumnsProvider().getColumns().map((c) => c.getSpec()));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Labels of the peer links on a linker path. A peer link joins two datasets' main axes, e.g. one
|
|
19
|
+
* clonotype to another, so the columns behind it describe a different clonotype than the row.
|
|
20
|
+
*/
|
|
21
|
+
function findPeerLinks(linkers, datasetAxes) {
|
|
22
|
+
return uniq(linkers.flatMap((l) => {
|
|
23
|
+
const peer = l.axesSpec.every((a) => datasetAxes.has(canonicalizeAxisId(a)));
|
|
24
|
+
const label = readAnnotation(l, Annotation.LinkLabel) ?? readAnnotation(l, Annotation.Label);
|
|
25
|
+
return peer && label ? [label] : [];
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
/** Hover text for the link icon. */
|
|
29
|
+
function describePeerLinks(links) {
|
|
30
|
+
return `Reached via ${links.join(", then ")}`;
|
|
31
|
+
}
|
|
32
|
+
/** Moves peer-linked items after the others, keeping the order within each group. */
|
|
33
|
+
function peerLinkedLast(items, isPeerLinked) {
|
|
34
|
+
return [...items.filter((i) => !isPeerLinked(i)), ...items.filter(isPeerLinked)];
|
|
35
|
+
}
|
|
36
|
+
export { collectDatasetAxes, describePeerLinks, findPeerLinks, getResultPoolDatasetAxes, peerLinkedLast };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=peer_links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer_links.js","names":[],"sources":["../../src/columns/peer_links.ts"],"sourcesContent":["import {\n Annotation,\n canonicalizeAxisId,\n readAnnotation,\n type AxisId,\n type CanonicalizedJson,\n type PColumnSpec,\n} from \"@milaboratories/pl-model-common\";\nimport { uniq } from \"es-toolkit\";\nimport { ResultPoolColumnsProvider } from \"./column_providers\";\n\nexport type DatasetAxes = Set<CanonicalizedJson<AxisId>>;\n\n/** Main axes of the datasets: the second axis of every column marked `pl7.app/isAnchor`. */\nexport function collectDatasetAxes(specs: PColumnSpec[]): DatasetAxes {\n return new Set(\n specs.flatMap((spec) => {\n const main = spec.axesSpec[1];\n return readAnnotation(spec, Annotation.IsAnchor) === \"true\" && main !== undefined\n ? [canonicalizeAxisId(main)]\n : [];\n }),\n );\n}\n\n/** {@link collectDatasetAxes} over the result pool. */\nexport function getResultPoolDatasetAxes(): DatasetAxes {\n return collectDatasetAxes(\n ResultPoolColumnsProvider()\n .getColumns()\n .map((c) => c.getSpec()),\n );\n}\n\n/**\n * Labels of the peer links on a linker path. A peer link joins two datasets' main axes, e.g. one\n * clonotype to another, so the columns behind it describe a different clonotype than the row.\n */\nexport function findPeerLinks(linkers: PColumnSpec[], datasetAxes: DatasetAxes): string[] {\n return uniq(\n linkers.flatMap((l) => {\n const peer = l.axesSpec.every((a) => datasetAxes.has(canonicalizeAxisId(a)));\n const label = readAnnotation(l, Annotation.LinkLabel) ?? readAnnotation(l, Annotation.Label);\n return peer && label ? [label] : [];\n }),\n );\n}\n\n/** Hover text for the link icon. */\nexport function describePeerLinks(links: string[]): string {\n return `Reached via ${links.join(\", then \")}`;\n}\n\n/** Moves peer-linked items after the others, keeping the order within each group. */\nexport function peerLinkedLast<T>(items: T[], isPeerLinked: (item: T) => boolean): T[] {\n return [...items.filter((i) => !isPeerLinked(i)), ...items.filter(isPeerLinked)];\n}\n"],"mappings":";;;;;;AAcA,SAAgB,mBAAmB,OAAmC;CACpE,OAAO,IAAI,IACT,MAAM,SAAS,SAAS;EACtB,MAAM,OAAO,KAAK,SAAS;EAC3B,OAAO,eAAe,MAAM,WAAW,QAAQ,MAAM,UAAU,SAAS,KAAA,IACpE,CAAC,mBAAmB,IAAI,CAAC,IACzB,CAAC;CACP,CAAC,CACH;AACF;;AAGA,SAAgB,2BAAwC;CACtD,OAAO,mBACL,0BAA0B,CAAC,CACxB,WAAW,CAAC,CACZ,KAAK,MAAM,EAAE,QAAQ,CAAC,CAC3B;AACF;;;;;AAMA,SAAgB,cAAc,SAAwB,aAAoC;CACxF,OAAO,KACL,QAAQ,SAAS,MAAM;EACrB,MAAM,OAAO,EAAE,SAAS,OAAO,MAAM,YAAY,IAAI,mBAAmB,CAAC,CAAC,CAAC;EAC3E,MAAM,QAAQ,eAAe,GAAG,WAAW,SAAS,KAAK,eAAe,GAAG,WAAW,KAAK;EAC3F,OAAO,QAAQ,QAAQ,CAAC,KAAK,IAAI,CAAC;CACpC,CAAC,CACH;AACF;;AAGA,SAAgB,kBAAkB,OAAyB;CACzD,OAAO,eAAe,MAAM,KAAK,SAAS;AAC5C;;AAGA,SAAgB,eAAkB,OAAY,cAAyC;CACrF,OAAO,CAAC,GAAG,MAAM,QAAQ,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,GAAG,MAAM,OAAO,YAAY,CAAC;AACjF"}
|
|
@@ -5,7 +5,7 @@ const require_column_overrided_recipe = require("./column_recipes/column_overrid
|
|
|
5
5
|
const require_utils = require("./utils.cjs");
|
|
6
6
|
const require_derive_axis_values_labels = require("./derive_axis_values_labels.cjs");
|
|
7
7
|
let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
|
|
8
|
-
|
|
8
|
+
// src/columns/split_by_axes.ts
|
|
9
9
|
const MAX_KEY_COMBINATIONS = 1e4;
|
|
10
10
|
/**
|
|
11
11
|
* Split each input column along the requested axes into one
|
|
@@ -101,7 +101,6 @@ function generateKeyCombinations(uniqueKeys, splitAxisIdxs) {
|
|
|
101
101
|
generate([], 0);
|
|
102
102
|
return combinations;
|
|
103
103
|
}
|
|
104
|
-
//#endregion
|
|
105
104
|
exports.splitByAxes = splitByAxes;
|
|
106
105
|
|
|
107
106
|
//# sourceMappingURL=split_by_axes.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split_by_axes.cjs","names":["deriveAxisValuesLabels","hasReachableData","TreeNodeAccessor","getUniquePartitionKeys","Annotation","ColumnFilteredRecipe","ColumnOverriddenRecipe"],"sources":["../../src/columns/split_by_axes.ts"],"sourcesContent":["import type {\n AxisFilterByIdx,\n AxisFilterValue,\n AxisId,\n TraceEntry,\n} from \"@milaboratories/pl-model-common\";\nimport {\n Annotation,\n canonicalizeAxisId,\n getAxisId,\n isDataInfoEntries,\n readAnnotation,\n} from \"@milaboratories/pl-model-common\";\nimport { TreeNodeAccessor } from \"../render/accessor\";\nimport { getUniquePartitionKeys } from \"../render/util/pcolumn_data\";\nimport { deriveAxisValuesLabels } from \"./derive_axis_values_labels\";\nimport type { ColumnRecipe } from \"./column_recipes\";\nimport { ColumnFilteredRecipe } from \"./column_recipes/column_filtered_recipe\";\nimport { ColumnOverriddenRecipe } from \"./column_recipes/column_overrided_recipe\";\nimport { Column } from \"./column\";\nimport { hasReachableData } from \"./utils\";\n\n// --- Types ---\n\nexport interface SplitAxis {\n /** Index of the axis in the column's axesSpec to split by. */\n readonly idx: number;\n}\n\nexport interface SplitByAxesOpts {\n /**\n * Resolve axis values to human-readable labels.\n *\n * Defaults to {@link deriveAxisValuesLabels} over the ambient render ctx\n * (current block outputs + result pool), resolved lazily on the first\n * lookup. Pass an explicit callback to narrow the label source, or\n * `() => undefined` to keep raw axis values.\n */\n axisValuesLabels?: (axisId: AxisId) => undefined | Record<string | number, string>;\n}\n\n// --- Implementation ---\n\nconst MAX_KEY_COMBINATIONS = 10_000;\n\n/**\n * Split each input column along the requested axes into one\n * {@link ColumnRecipe} per Cartesian combination of the axes' distinct values.\n *\n * The split axes must be partition-key axes of the input's data — the distinct\n * values are read off the partition keys.\n *\n * Each split is produced as `ColumnOverriddenRecipe.wrap(ColumnFilteredRecipe.wrap(inner, axisFilters), { domain, annotations })`:\n * - `ColumnFilteredRecipe` pins all split axes at once (one wrap call with\n * every `[idx, value]` pair) and removes them from `axesSpec`. The\n * engine performs the data slicing via the `sliceAxes` query node.\n * - `ColumnOverriddenRecipe` overlays a `domain[axisName] = String(value)`\n * entry per split axis and appends a `split:<canonicalAxisId>` trace\n * entry per split axis to the existing `pl7.app/trace` annotation.\n *\n * The recipe id is a canonical\n * `ColumnOverriddenId(source: ColumnFilteredId(source: inner.id, axisFilters), specOverrides)`\n * — distinct per split combination, parseable by `extractPObjectId`, and\n * traversable by recipe walkers.\n *\n * Returns `undefined` when any input's `getData()` is not a\n * {@link TreeNodeAccessor} — partition inspection is not yet possible.\n */\nexport function splitByAxes(\n inputs: Column[],\n splitAxes: SplitAxis[],\n opts?: SplitByAxesOpts,\n): ColumnRecipe[] | undefined {\n if (splitAxes.length === 0) {\n return [...inputs];\n }\n\n const axisValuesLabels = opts?.axisValuesLabels ?? deriveAxisValuesLabels();\n\n const splitAxisIdxs = splitAxes.map((a) => a.idx).sort((a, b) => a - b);\n const maxSplitIdx = splitAxisIdxs[splitAxisIdxs.length - 1];\n\n const result: ColumnRecipe[] = [];\n\n for (const inner of inputs) {\n const data = hasReachableData(inner) ? inner.getData() : undefined;\n // Partition inspection requires either a live tree-accessor or already\n // parsed DataInfoEntries. Anything else means the input is not yet ready.\n if (!(data instanceof TreeNodeAccessor) && !isDataInfoEntries(data)) {\n return undefined;\n }\n\n const uniqueKeys = getUniquePartitionKeys(data);\n if (uniqueKeys === undefined) return undefined;\n\n if (maxSplitIdx >= uniqueKeys.length) {\n throw new Error(\n `Not enough partition keys (${uniqueKeys.length}) for requested split axes (max index ${maxSplitIdx}) in column ${inner.getSpec().name}`,\n );\n }\n\n const spec = inner.getSpec();\n const axesSpec = spec.axesSpec;\n const splitAxisSpecs = splitAxisIdxs.map((idx) => axesSpec[idx]);\n const splitAxisIds = splitAxisSpecs.map((axisSpec) => getAxisId(axisSpec));\n const axesLabels = splitAxisIds.map((axisId) => axisValuesLabels(axisId));\n\n const existingTraceRaw = readAnnotation(spec, Annotation.Trace);\n const baseTrace: TraceEntry[] = existingTraceRaw\n ? ((JSON.parse(existingTraceRaw) as TraceEntry[]) ?? [])\n : [];\n\n const keyCombinations = generateKeyCombinations(uniqueKeys, splitAxisIdxs);\n if (keyCombinations.length === 0) continue;\n\n for (const keyCombo of keyCombinations) {\n const axisFilters: AxisFilterByIdx[] = keyCombo.map(
|
|
1
|
+
{"version":3,"file":"split_by_axes.cjs","names":["deriveAxisValuesLabels","hasReachableData","TreeNodeAccessor","isDataInfoEntries","getUniquePartitionKeys","getAxisId","readAnnotation","Annotation","canonicalizeAxisId","ColumnFilteredRecipe","ColumnOverriddenRecipe"],"sources":["../../src/columns/split_by_axes.ts"],"sourcesContent":["import type {\n AxisFilterByIdx,\n AxisFilterValue,\n AxisId,\n TraceEntry,\n} from \"@milaboratories/pl-model-common\";\nimport {\n Annotation,\n canonicalizeAxisId,\n getAxisId,\n isDataInfoEntries,\n readAnnotation,\n} from \"@milaboratories/pl-model-common\";\nimport { TreeNodeAccessor } from \"../render/accessor\";\nimport { getUniquePartitionKeys } from \"../render/util/pcolumn_data\";\nimport { deriveAxisValuesLabels } from \"./derive_axis_values_labels\";\nimport type { ColumnRecipe } from \"./column_recipes\";\nimport { ColumnFilteredRecipe } from \"./column_recipes/column_filtered_recipe\";\nimport { ColumnOverriddenRecipe } from \"./column_recipes/column_overrided_recipe\";\nimport { Column } from \"./column\";\nimport { hasReachableData } from \"./utils\";\n\n// --- Types ---\n\nexport interface SplitAxis {\n /** Index of the axis in the column's axesSpec to split by. */\n readonly idx: number;\n}\n\nexport interface SplitByAxesOpts {\n /**\n * Resolve axis values to human-readable labels.\n *\n * Defaults to {@link deriveAxisValuesLabels} over the ambient render ctx\n * (current block outputs + result pool), resolved lazily on the first\n * lookup. Pass an explicit callback to narrow the label source, or\n * `() => undefined` to keep raw axis values.\n */\n axisValuesLabels?: (axisId: AxisId) => undefined | Record<string | number, string>;\n}\n\n// --- Implementation ---\n\nconst MAX_KEY_COMBINATIONS = 10_000;\n\n/**\n * Split each input column along the requested axes into one\n * {@link ColumnRecipe} per Cartesian combination of the axes' distinct values.\n *\n * The split axes must be partition-key axes of the input's data — the distinct\n * values are read off the partition keys.\n *\n * Each split is produced as `ColumnOverriddenRecipe.wrap(ColumnFilteredRecipe.wrap(inner, axisFilters), { domain, annotations })`:\n * - `ColumnFilteredRecipe` pins all split axes at once (one wrap call with\n * every `[idx, value]` pair) and removes them from `axesSpec`. The\n * engine performs the data slicing via the `sliceAxes` query node.\n * - `ColumnOverriddenRecipe` overlays a `domain[axisName] = String(value)`\n * entry per split axis and appends a `split:<canonicalAxisId>` trace\n * entry per split axis to the existing `pl7.app/trace` annotation.\n *\n * The recipe id is a canonical\n * `ColumnOverriddenId(source: ColumnFilteredId(source: inner.id, axisFilters), specOverrides)`\n * — distinct per split combination, parseable by `extractPObjectId`, and\n * traversable by recipe walkers.\n *\n * Returns `undefined` when any input's `getData()` is not a\n * {@link TreeNodeAccessor} — partition inspection is not yet possible.\n */\nexport function splitByAxes(\n inputs: Column[],\n splitAxes: SplitAxis[],\n opts?: SplitByAxesOpts,\n): ColumnRecipe[] | undefined {\n if (splitAxes.length === 0) {\n return [...inputs];\n }\n\n const axisValuesLabels = opts?.axisValuesLabels ?? deriveAxisValuesLabels();\n\n const splitAxisIdxs = splitAxes.map((a) => a.idx).sort((a, b) => a - b);\n const maxSplitIdx = splitAxisIdxs[splitAxisIdxs.length - 1];\n\n const result: ColumnRecipe[] = [];\n\n for (const inner of inputs) {\n const data = hasReachableData(inner) ? inner.getData() : undefined;\n // Partition inspection requires either a live tree-accessor or already\n // parsed DataInfoEntries. Anything else means the input is not yet ready.\n if (!(data instanceof TreeNodeAccessor) && !isDataInfoEntries(data)) {\n return undefined;\n }\n\n const uniqueKeys = getUniquePartitionKeys(data);\n if (uniqueKeys === undefined) return undefined;\n\n if (maxSplitIdx >= uniqueKeys.length) {\n throw new Error(\n `Not enough partition keys (${uniqueKeys.length}) for requested split axes (max index ${maxSplitIdx}) in column ${inner.getSpec().name}`,\n );\n }\n\n const spec = inner.getSpec();\n const axesSpec = spec.axesSpec;\n const splitAxisSpecs = splitAxisIdxs.map((idx) => axesSpec[idx]);\n const splitAxisIds = splitAxisSpecs.map((axisSpec) => getAxisId(axisSpec));\n const axesLabels = splitAxisIds.map((axisId) => axisValuesLabels(axisId));\n\n const existingTraceRaw = readAnnotation(spec, Annotation.Trace);\n const baseTrace: TraceEntry[] = existingTraceRaw\n ? ((JSON.parse(existingTraceRaw) as TraceEntry[]) ?? [])\n : [];\n\n const keyCombinations = generateKeyCombinations(uniqueKeys, splitAxisIdxs);\n if (keyCombinations.length === 0) continue;\n\n for (const keyCombo of keyCombinations) {\n const axisFilters: AxisFilterByIdx[] = keyCombo.map((value, sAxisIdx): AxisFilterByIdx => [\n splitAxisIdxs[sAxisIdx],\n value as AxisFilterValue,\n ]);\n\n const domain: Record<string, string> = {};\n const traceEntries: TraceEntry[] = [];\n for (let sAxisIdx = 0; sAxisIdx < keyCombo.length; sAxisIdx++) {\n const value = keyCombo[sAxisIdx];\n const axisSpec = splitAxisSpecs[sAxisIdx];\n const axisId = splitAxisIds[sAxisIdx];\n const labelMap = axesLabels[sAxisIdx];\n const label = labelMap?.[value] ?? String(value);\n domain[axisSpec.name] = String(value);\n traceEntries.push({\n type: `split:${canonicalizeAxisId(axisId)}`,\n label,\n importance: 1_000_000,\n });\n }\n\n const filtered = ColumnFilteredRecipe.wrap(inner, axisFilters);\n const overrided = ColumnOverriddenRecipe.wrap(filtered, {\n domain,\n annotations: {\n [Annotation.Trace]: JSON.stringify([...baseTrace, ...traceEntries]),\n },\n });\n\n result.push(overrided);\n }\n }\n\n return result;\n}\n\nfunction generateKeyCombinations(\n uniqueKeys: (string | number)[][],\n splitAxisIdxs: number[],\n): (string | number)[][] {\n const combinations: (string | number)[][] = [];\n\n function generate(currentCombo: (string | number)[], sAxisIdx: number): void {\n if (sAxisIdx >= splitAxisIdxs.length) {\n combinations.push([...currentCombo]);\n if (combinations.length > MAX_KEY_COMBINATIONS) {\n throw new Error(\"Too many key combinations, aborting.\");\n }\n return;\n }\n\n const axisIdx = splitAxisIdxs[sAxisIdx];\n if (axisIdx >= uniqueKeys.length) {\n throw new Error(\n `Axis index ${axisIdx} out of bounds for unique keys array (length ${uniqueKeys.length})`,\n );\n }\n\n const axisValues = uniqueKeys[axisIdx];\n if (!axisValues || axisValues.length === 0) {\n combinations.length = 0;\n return;\n }\n\n for (const val of axisValues) {\n currentCombo.push(val);\n generate(currentCombo, sAxisIdx + 1);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S;GACtB;EACF;EAEA,KAAK,MAAM,OAAO,YAAY;GAC5B,aAAa,KAAK,GAAG;GACrB,SAAS,cAAc,WAAW,CAAC;GACnC,aAAa,IAAI;EACnB;CACF;CAEA,SAAS,CAAC,GAAG,CAAC;CACd,OAAO;AACT"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Column } from "./column.js";
|
|
2
2
|
import { ColumnRecipe } from "./column_recipes/index.js";
|
|
3
3
|
import { AxisId } from "@milaboratories/pl-model-common";
|
|
4
|
-
//#region src/columns/split_by_axes.d.ts
|
|
5
4
|
export interface SplitAxis {
|
|
6
5
|
/** Index of the axis in the column's axesSpec to split by. */
|
|
7
6
|
readonly idx: number;
|
|
@@ -41,5 +40,4 @@ export interface SplitByAxesOpts {
|
|
|
41
40
|
* {@link TreeNodeAccessor} — partition inspection is not yet possible.
|
|
42
41
|
*/
|
|
43
42
|
export declare function splitByAxes(inputs: Column[], splitAxes: SplitAxis[], opts?: SplitByAxesOpts): ColumnRecipe[] | undefined;
|
|
44
|
-
//#endregion
|
|
45
43
|
//# sourceMappingURL=split_by_axes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split_by_axes.d.ts","names":[],"sources":["../../src/columns/split_by_axes.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"split_by_axes.d.ts","names":[],"sources":["../../src/columns/split_by_axes.ts"],"mappings":";;;iBAwBiB;;WAEN;;iBAGM;;;;;;;;;EASf,oBAAoB,QAAQ,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;wBA8BrC,YACd,QAAQ,UACR,WAAW,aACX,OAAO,kBACN"}
|
|
@@ -5,7 +5,7 @@ import { ColumnOverriddenRecipe } from "./column_recipes/column_overrided_recipe
|
|
|
5
5
|
import { hasReachableData } from "./utils.js";
|
|
6
6
|
import { deriveAxisValuesLabels } from "./derive_axis_values_labels.js";
|
|
7
7
|
import { Annotation, canonicalizeAxisId, getAxisId, isDataInfoEntries, readAnnotation } from "@milaboratories/pl-model-common";
|
|
8
|
-
|
|
8
|
+
// src/columns/split_by_axes.ts
|
|
9
9
|
const MAX_KEY_COMBINATIONS = 1e4;
|
|
10
10
|
/**
|
|
11
11
|
* Split each input column along the requested axes into one
|
|
@@ -101,7 +101,6 @@ function generateKeyCombinations(uniqueKeys, splitAxisIdxs) {
|
|
|
101
101
|
generate([], 0);
|
|
102
102
|
return combinations;
|
|
103
103
|
}
|
|
104
|
-
//#endregion
|
|
105
104
|
export { splitByAxes };
|
|
106
105
|
|
|
107
106
|
//# sourceMappingURL=split_by_axes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split_by_axes.js","names":[],"sources":["../../src/columns/split_by_axes.ts"],"sourcesContent":["import type {\n AxisFilterByIdx,\n AxisFilterValue,\n AxisId,\n TraceEntry,\n} from \"@milaboratories/pl-model-common\";\nimport {\n Annotation,\n canonicalizeAxisId,\n getAxisId,\n isDataInfoEntries,\n readAnnotation,\n} from \"@milaboratories/pl-model-common\";\nimport { TreeNodeAccessor } from \"../render/accessor\";\nimport { getUniquePartitionKeys } from \"../render/util/pcolumn_data\";\nimport { deriveAxisValuesLabels } from \"./derive_axis_values_labels\";\nimport type { ColumnRecipe } from \"./column_recipes\";\nimport { ColumnFilteredRecipe } from \"./column_recipes/column_filtered_recipe\";\nimport { ColumnOverriddenRecipe } from \"./column_recipes/column_overrided_recipe\";\nimport { Column } from \"./column\";\nimport { hasReachableData } from \"./utils\";\n\n// --- Types ---\n\nexport interface SplitAxis {\n /** Index of the axis in the column's axesSpec to split by. */\n readonly idx: number;\n}\n\nexport interface SplitByAxesOpts {\n /**\n * Resolve axis values to human-readable labels.\n *\n * Defaults to {@link deriveAxisValuesLabels} over the ambient render ctx\n * (current block outputs + result pool), resolved lazily on the first\n * lookup. Pass an explicit callback to narrow the label source, or\n * `() => undefined` to keep raw axis values.\n */\n axisValuesLabels?: (axisId: AxisId) => undefined | Record<string | number, string>;\n}\n\n// --- Implementation ---\n\nconst MAX_KEY_COMBINATIONS = 10_000;\n\n/**\n * Split each input column along the requested axes into one\n * {@link ColumnRecipe} per Cartesian combination of the axes' distinct values.\n *\n * The split axes must be partition-key axes of the input's data — the distinct\n * values are read off the partition keys.\n *\n * Each split is produced as `ColumnOverriddenRecipe.wrap(ColumnFilteredRecipe.wrap(inner, axisFilters), { domain, annotations })`:\n * - `ColumnFilteredRecipe` pins all split axes at once (one wrap call with\n * every `[idx, value]` pair) and removes them from `axesSpec`. The\n * engine performs the data slicing via the `sliceAxes` query node.\n * - `ColumnOverriddenRecipe` overlays a `domain[axisName] = String(value)`\n * entry per split axis and appends a `split:<canonicalAxisId>` trace\n * entry per split axis to the existing `pl7.app/trace` annotation.\n *\n * The recipe id is a canonical\n * `ColumnOverriddenId(source: ColumnFilteredId(source: inner.id, axisFilters), specOverrides)`\n * — distinct per split combination, parseable by `extractPObjectId`, and\n * traversable by recipe walkers.\n *\n * Returns `undefined` when any input's `getData()` is not a\n * {@link TreeNodeAccessor} — partition inspection is not yet possible.\n */\nexport function splitByAxes(\n inputs: Column[],\n splitAxes: SplitAxis[],\n opts?: SplitByAxesOpts,\n): ColumnRecipe[] | undefined {\n if (splitAxes.length === 0) {\n return [...inputs];\n }\n\n const axisValuesLabels = opts?.axisValuesLabels ?? deriveAxisValuesLabels();\n\n const splitAxisIdxs = splitAxes.map((a) => a.idx).sort((a, b) => a - b);\n const maxSplitIdx = splitAxisIdxs[splitAxisIdxs.length - 1];\n\n const result: ColumnRecipe[] = [];\n\n for (const inner of inputs) {\n const data = hasReachableData(inner) ? inner.getData() : undefined;\n // Partition inspection requires either a live tree-accessor or already\n // parsed DataInfoEntries. Anything else means the input is not yet ready.\n if (!(data instanceof TreeNodeAccessor) && !isDataInfoEntries(data)) {\n return undefined;\n }\n\n const uniqueKeys = getUniquePartitionKeys(data);\n if (uniqueKeys === undefined) return undefined;\n\n if (maxSplitIdx >= uniqueKeys.length) {\n throw new Error(\n `Not enough partition keys (${uniqueKeys.length}) for requested split axes (max index ${maxSplitIdx}) in column ${inner.getSpec().name}`,\n );\n }\n\n const spec = inner.getSpec();\n const axesSpec = spec.axesSpec;\n const splitAxisSpecs = splitAxisIdxs.map((idx) => axesSpec[idx]);\n const splitAxisIds = splitAxisSpecs.map((axisSpec) => getAxisId(axisSpec));\n const axesLabels = splitAxisIds.map((axisId) => axisValuesLabels(axisId));\n\n const existingTraceRaw = readAnnotation(spec, Annotation.Trace);\n const baseTrace: TraceEntry[] = existingTraceRaw\n ? ((JSON.parse(existingTraceRaw) as TraceEntry[]) ?? [])\n : [];\n\n const keyCombinations = generateKeyCombinations(uniqueKeys, splitAxisIdxs);\n if (keyCombinations.length === 0) continue;\n\n for (const keyCombo of keyCombinations) {\n const axisFilters: AxisFilterByIdx[] = keyCombo.map(
|
|
1
|
+
{"version":3,"file":"split_by_axes.js","names":[],"sources":["../../src/columns/split_by_axes.ts"],"sourcesContent":["import type {\n AxisFilterByIdx,\n AxisFilterValue,\n AxisId,\n TraceEntry,\n} from \"@milaboratories/pl-model-common\";\nimport {\n Annotation,\n canonicalizeAxisId,\n getAxisId,\n isDataInfoEntries,\n readAnnotation,\n} from \"@milaboratories/pl-model-common\";\nimport { TreeNodeAccessor } from \"../render/accessor\";\nimport { getUniquePartitionKeys } from \"../render/util/pcolumn_data\";\nimport { deriveAxisValuesLabels } from \"./derive_axis_values_labels\";\nimport type { ColumnRecipe } from \"./column_recipes\";\nimport { ColumnFilteredRecipe } from \"./column_recipes/column_filtered_recipe\";\nimport { ColumnOverriddenRecipe } from \"./column_recipes/column_overrided_recipe\";\nimport { Column } from \"./column\";\nimport { hasReachableData } from \"./utils\";\n\n// --- Types ---\n\nexport interface SplitAxis {\n /** Index of the axis in the column's axesSpec to split by. */\n readonly idx: number;\n}\n\nexport interface SplitByAxesOpts {\n /**\n * Resolve axis values to human-readable labels.\n *\n * Defaults to {@link deriveAxisValuesLabels} over the ambient render ctx\n * (current block outputs + result pool), resolved lazily on the first\n * lookup. Pass an explicit callback to narrow the label source, or\n * `() => undefined` to keep raw axis values.\n */\n axisValuesLabels?: (axisId: AxisId) => undefined | Record<string | number, string>;\n}\n\n// --- Implementation ---\n\nconst MAX_KEY_COMBINATIONS = 10_000;\n\n/**\n * Split each input column along the requested axes into one\n * {@link ColumnRecipe} per Cartesian combination of the axes' distinct values.\n *\n * The split axes must be partition-key axes of the input's data — the distinct\n * values are read off the partition keys.\n *\n * Each split is produced as `ColumnOverriddenRecipe.wrap(ColumnFilteredRecipe.wrap(inner, axisFilters), { domain, annotations })`:\n * - `ColumnFilteredRecipe` pins all split axes at once (one wrap call with\n * every `[idx, value]` pair) and removes them from `axesSpec`. The\n * engine performs the data slicing via the `sliceAxes` query node.\n * - `ColumnOverriddenRecipe` overlays a `domain[axisName] = String(value)`\n * entry per split axis and appends a `split:<canonicalAxisId>` trace\n * entry per split axis to the existing `pl7.app/trace` annotation.\n *\n * The recipe id is a canonical\n * `ColumnOverriddenId(source: ColumnFilteredId(source: inner.id, axisFilters), specOverrides)`\n * — distinct per split combination, parseable by `extractPObjectId`, and\n * traversable by recipe walkers.\n *\n * Returns `undefined` when any input's `getData()` is not a\n * {@link TreeNodeAccessor} — partition inspection is not yet possible.\n */\nexport function splitByAxes(\n inputs: Column[],\n splitAxes: SplitAxis[],\n opts?: SplitByAxesOpts,\n): ColumnRecipe[] | undefined {\n if (splitAxes.length === 0) {\n return [...inputs];\n }\n\n const axisValuesLabels = opts?.axisValuesLabels ?? deriveAxisValuesLabels();\n\n const splitAxisIdxs = splitAxes.map((a) => a.idx).sort((a, b) => a - b);\n const maxSplitIdx = splitAxisIdxs[splitAxisIdxs.length - 1];\n\n const result: ColumnRecipe[] = [];\n\n for (const inner of inputs) {\n const data = hasReachableData(inner) ? inner.getData() : undefined;\n // Partition inspection requires either a live tree-accessor or already\n // parsed DataInfoEntries. Anything else means the input is not yet ready.\n if (!(data instanceof TreeNodeAccessor) && !isDataInfoEntries(data)) {\n return undefined;\n }\n\n const uniqueKeys = getUniquePartitionKeys(data);\n if (uniqueKeys === undefined) return undefined;\n\n if (maxSplitIdx >= uniqueKeys.length) {\n throw new Error(\n `Not enough partition keys (${uniqueKeys.length}) for requested split axes (max index ${maxSplitIdx}) in column ${inner.getSpec().name}`,\n );\n }\n\n const spec = inner.getSpec();\n const axesSpec = spec.axesSpec;\n const splitAxisSpecs = splitAxisIdxs.map((idx) => axesSpec[idx]);\n const splitAxisIds = splitAxisSpecs.map((axisSpec) => getAxisId(axisSpec));\n const axesLabels = splitAxisIds.map((axisId) => axisValuesLabels(axisId));\n\n const existingTraceRaw = readAnnotation(spec, Annotation.Trace);\n const baseTrace: TraceEntry[] = existingTraceRaw\n ? ((JSON.parse(existingTraceRaw) as TraceEntry[]) ?? [])\n : [];\n\n const keyCombinations = generateKeyCombinations(uniqueKeys, splitAxisIdxs);\n if (keyCombinations.length === 0) continue;\n\n for (const keyCombo of keyCombinations) {\n const axisFilters: AxisFilterByIdx[] = keyCombo.map((value, sAxisIdx): AxisFilterByIdx => [\n splitAxisIdxs[sAxisIdx],\n value as AxisFilterValue,\n ]);\n\n const domain: Record<string, string> = {};\n const traceEntries: TraceEntry[] = [];\n for (let sAxisIdx = 0; sAxisIdx < keyCombo.length; sAxisIdx++) {\n const value = keyCombo[sAxisIdx];\n const axisSpec = splitAxisSpecs[sAxisIdx];\n const axisId = splitAxisIds[sAxisIdx];\n const labelMap = axesLabels[sAxisIdx];\n const label = labelMap?.[value] ?? String(value);\n domain[axisSpec.name] = String(value);\n traceEntries.push({\n type: `split:${canonicalizeAxisId(axisId)}`,\n label,\n importance: 1_000_000,\n });\n }\n\n const filtered = ColumnFilteredRecipe.wrap(inner, axisFilters);\n const overrided = ColumnOverriddenRecipe.wrap(filtered, {\n domain,\n annotations: {\n [Annotation.Trace]: JSON.stringify([...baseTrace, ...traceEntries]),\n },\n });\n\n result.push(overrided);\n }\n }\n\n return result;\n}\n\nfunction generateKeyCombinations(\n uniqueKeys: (string | number)[][],\n splitAxisIdxs: number[],\n): (string | number)[][] {\n const combinations: (string | number)[][] = [];\n\n function generate(currentCombo: (string | number)[], sAxisIdx: number): void {\n if (sAxisIdx >= splitAxisIdxs.length) {\n combinations.push([...currentCombo]);\n if (combinations.length > MAX_KEY_COMBINATIONS) {\n throw new Error(\"Too many key combinations, aborting.\");\n }\n return;\n }\n\n const axisIdx = splitAxisIdxs[sAxisIdx];\n if (axisIdx >= uniqueKeys.length) {\n throw new Error(\n `Axis index ${axisIdx} out of bounds for unique keys array (length ${uniqueKeys.length})`,\n );\n }\n\n const axisValues = uniqueKeys[axisIdx];\n if (!axisValues || axisValues.length === 0) {\n combinations.length = 0;\n return;\n }\n\n for (const val of axisValues) {\n currentCombo.push(val);\n generate(currentCombo, sAxisIdx + 1);\n currentCombo.pop();\n }\n }\n\n generate([], 0);\n return combinations;\n}\n"],"mappings":";;;;;;;;AA2CA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;AAyB7B,SAAgB,YACd,QACA,WACA,MAC4B;CAC5B,IAAI,UAAU,WAAW,GACvB,OAAO,CAAC,GAAG,MAAM;CAGnB,MAAM,mBAAmB,MAAM,oBAAoB,uBAAuB;CAE1E,MAAM,gBAAgB,UAAU,KAAK,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;CACtE,MAAM,cAAc,cAAc,cAAc,SAAS;CAEzD,MAAM,SAAyB,CAAC;CAEhC,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,OAAO,iBAAiB,KAAK,IAAI,MAAM,QAAQ,IAAI,KAAA;EAGzD,IAAI,EAAE,gBAAgB,qBAAqB,CAAC,kBAAkB,IAAI,GAChE;EAGF,MAAM,aAAa,uBAAuB,IAAI;EAC9C,IAAI,eAAe,KAAA,GAAW,OAAO,KAAA;EAErC,IAAI,eAAe,WAAW,QAC5B,MAAM,IAAI,MACR,8BAA8B,WAAW,OAAO,wCAAwC,YAAY,cAAc,MAAM,QAAQ,CAAC,CAAC,MACpI;EAG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Aa,KAAK,CAAC,GAAG,YAAY,CAAC;GACnC,IAAI,aAAa,SAAS,sBACxB,MAAM,IAAI,MAAM,sCAAsC;GAExD;EACF;EAEA,MAAM,UAAU,cAAc;EAC9B,IAAI,WAAW,WAAW,QACxB,MAAM,IAAI,MACR,cAAc,QAAQ,+CAA+C,WAAW,OAAO,EACzF;EAGF,MAAM,aAAa,WAAW;EAC9B,IAAI,CAAC,cAAc,WAAW,WAAW,GAAG;GAC1C,aAAa,SAAS;GACtB;EACF;EAEA,KAAK,MAAM,OAAO,YAAY;GAC5B,aAAa,KAAK,GAAG;GACrB,SAAS,cAAc,WAAW,CAAC;GACnC,aAAa,IAAI;EACnB;CACF;CAEA,SAAS,CAAC,GAAG,CAAC;CACd,OAAO;AACT"}
|
package/dist/columns/utils.cjs
CHANGED
|
@@ -6,9 +6,10 @@ const require_column_filtered_recipe = require("./column_recipes/column_filtered
|
|
|
6
6
|
const require_column_overrided_recipe = require("./column_recipes/column_overrided_recipe.cjs");
|
|
7
7
|
const require_data_column = require("./data_column.cjs");
|
|
8
8
|
const require_columns_collection = require("./columns_collection.cjs");
|
|
9
|
+
const require_peer_links = require("./peer_links.cjs");
|
|
9
10
|
let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
|
|
10
11
|
let _milaboratories_helpers = require("@milaboratories/helpers");
|
|
11
|
-
|
|
12
|
+
// src/columns/utils.ts
|
|
12
13
|
/**
|
|
13
14
|
* PObjectIds of every non-hit column referenced by `recipe.getQuery()`,
|
|
14
15
|
* deduped in traversal order. The hit column is
|
|
@@ -39,6 +40,11 @@ function collectLinkerIds(recipe) {
|
|
|
39
40
|
function collectLinkerColumns(recipe, opts = {}) {
|
|
40
41
|
return collectLinkerIds(recipe).map((id) => require_data_column.DataColumnImpl.fromId(id, opts) ?? (0, _milaboratories_helpers.throwError)(`materializeLinkers: linker ${id} not resolvable`));
|
|
41
42
|
}
|
|
43
|
+
/** Peer link labels for a column, checked against the result pool's datasets. */
|
|
44
|
+
function createPeerLinkFinder() {
|
|
45
|
+
const datasetAxes = require_peer_links.getResultPoolDatasetAxes();
|
|
46
|
+
return (recipe) => require_peer_links.findPeerLinks(collectLinkerColumns(recipe).map((l) => l.getSpec()), datasetAxes);
|
|
47
|
+
}
|
|
42
48
|
/**
|
|
43
49
|
* Hit-side axis qualifications for the recipe — the ones that should land on
|
|
44
50
|
* the outer-join entry wrapping this column at the consumer boundary.
|
|
@@ -172,17 +178,35 @@ function hasReachableData(recipe) {
|
|
|
172
178
|
* to be wrapped on the fly.
|
|
173
179
|
*/
|
|
174
180
|
function deriveColumnOptions(source, labelOptions = {}) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
label: labels[i]
|
|
181
|
+
return deriveRecipeOptions((require_columns_collection.isColumnsCollection(source) ? source : require_columns_collection.ColumnsCollection(source)).getColumns(), labelOptions).map(({ id, label, linkHint }) => ({
|
|
182
|
+
id,
|
|
183
|
+
label,
|
|
184
|
+
linkHint
|
|
180
185
|
}));
|
|
181
186
|
}
|
|
182
|
-
|
|
187
|
+
/**
|
|
188
|
+
* {@link ColumnOption}s for `recipes`, each with its recipe. Peer-linked columns go last, the rest
|
|
189
|
+
* keep their order.
|
|
190
|
+
*/
|
|
191
|
+
function deriveRecipeOptions(recipes, labelOptions = {}) {
|
|
192
|
+
const labels = require_derive_distinct_labels.deriveDistinctLabels(recipes.map((r) => r.getSpec()), labelOptions);
|
|
193
|
+
const findPeerLinks = createPeerLinkFinder();
|
|
194
|
+
const options = recipes.map((recipe, i) => {
|
|
195
|
+
const links = findPeerLinks(recipe);
|
|
196
|
+
return {
|
|
197
|
+
id: recipe.id,
|
|
198
|
+
label: labels[i],
|
|
199
|
+
linkHint: links.length > 0 ? require_peer_links.describePeerLinks(links) : void 0,
|
|
200
|
+
recipe
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
return require_peer_links.peerLinkedLast(options, (o) => o.linkHint !== void 0);
|
|
204
|
+
}
|
|
183
205
|
exports.collectLinkerColumns = collectLinkerColumns;
|
|
184
206
|
exports.collectLinkerIds = collectLinkerIds;
|
|
207
|
+
exports.createPeerLinkFinder = createPeerLinkFinder;
|
|
185
208
|
exports.deriveColumnOptions = deriveColumnOptions;
|
|
209
|
+
exports.deriveRecipeOptions = deriveRecipeOptions;
|
|
186
210
|
exports.hasColumnData = hasColumnData;
|
|
187
211
|
exports.hasReachableData = hasReachableData;
|
|
188
212
|
exports.hasSingleDataColumn = hasSingleDataColumn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["DataColumnImpl","TreeNodeAccessor","ColumnDiscoveredRecipe","ColumnOverriddenRecipe","ColumnFilteredRecipe","DataColumnOverriddenRecipe","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 { DataColumnRecipe, DataColumnImpl, type ColumnData } from \"./data_column\";\nimport { ColumnDiscoveredRecipe } from \"./column_recipes/column_discovered_recipe\";\nimport { ColumnFilteredRecipe } from \"./column_recipes/column_filtered_recipe\";\nimport {\n ColumnOverriddenRecipe,\n DataColumnOverriddenRecipe,\n} 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 DataColumnRecipe} 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 DataColumnRecipe} leaves. 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): DataColumnRecipe<PObjectId>[] {\n return collectLinkerIds(recipe).map(\n (id) =>\n DataColumnImpl.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 DataColumnRecipe} 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 leaf = DataColumnImpl.fromId(id, opts);\n if (leaf === undefined) return false;\n if (leaf.getDataStatus() !== \"present\") return false;\n if (!isLeafDataPresent(leaf.getData())) return false;\n }\n return true;\n}\n\nfunction isLeafDataPresent(data: ColumnData): 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 * Whether the recipe reads exactly one data column — its own — rather than\n * reaching through others.\n *\n * True for a bare leaf and for projections over one (spec overrides, axis\n * slicing): those add layers but no new columns. False when the recipe gets at\n * its data through further columns, which happens when discovery reached it via\n * a linker chain.\n *\n * **Why callers care.** A recipe over a single data column is co-indexed by its\n * own axes, so its spec is the whole truth about them. One that needs other\n * columns only lines up after they are joined in, and therefore drags axes into\n * the join that its own spec never mentions — which is why it cannot serve as a\n * primary column, and why `createPlDataTableV3` splits on this.\n *\n * The count comes from {@link ColumnRecipe.getReferencedIds}, which resolves\n * through the whole wrapper chain, so no class walk is involved and foreign\n * `ColumnRecipe` implementations are handled too.\n */\nexport function hasSingleDataColumn(recipe: ColumnRecipe): boolean {\n return recipe.getReferencedIds().length === 1;\n}\n\n/**\n * @deprecated Renamed to {@link hasSingleDataColumn} — \"leaf\" read as \"you can\n * get data out of it\", which is a different question (see\n * {@link hasReachableData}). Same semantics.\n */\nexport const isLeafColumn = hasSingleDataColumn;\n\n/**\n * Whether the column's data can be read here and now, consistent with its\n * spec — narrows to {@link DataColumnRecipe}, which exposes `getData()`.\n *\n * True for a bare leaf and for a spec-override over a bare leaf. False for an\n * axis-filtered recipe (its spec has dropped axes the underlying data still\n * carries, so the two no longer line up) and for anything reached through\n * other columns (nothing to read until the engine joins them). In both of\n * those cases the data exists only engine-side: pass `recipe.id` to\n * `createPFrame` / `createPTable` instead of trying to read it.\n *\n * The distinction is settled when the recipe is built, not here — recipes that\n * carry data are instances of a class that declares `getData`. So a `true`\n * result narrows to a value that really has the method, and there is no\n * throwing path behind the guard.\n */\nexport function hasReachableData(recipe: ColumnRecipe): recipe is DataColumnRecipe {\n return recipe instanceof DataColumnImpl || recipe instanceof DataColumnOverriddenRecipe;\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":";;;;;;;;;;;;;;;;;;;;AAiCA,SAAgB,iBAAiB,QAAmC;CAClE,MAAM,OAAA,GAAA,gCAAA,iBAAA,CAAuB,OAAO,EAAE;CACtC,MAAM,uBAAO,IAAI,IAAe;CAChC,MAAM,MAAmB,CAAC;CAC1B,KAAK,MAAM,OAAA,GAAA,gCAAA,wBAAA,CAA8B,OAAO,SAAS,CAAC,GAAG;EAI3D,MAAM,QAAA,GAAA,gCAAA,iBAAA,CAAwB,EAAE;EAChC,IAAI,SAAS,KAAK;EAClB,IAAI,KAAK,IAAI,IAAI,GAAG;EACpB,KAAK,IAAI,IAAI;EACb,IAAI,KAAK,IAAI;CACf;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,qBACd,QACA,OAAqC,CAAC,GACP;CAC/B,OAAO,iBAAiB,MAAM,CAAC,CAAC,KAC7B,OACCA,oBAAAA,eAAe,OAAO,IAAI,IAAI,MAAA,GAAA,wBAAA,WAAA,CACnB,8BAA8B,GAAG,gBAAgB,CAChE;AACF;;;;;;;;;AAUA,SAAgB,kBAAkB,QAAoD;CAEpF,OADmB,eAAe,MAClB,CAAC,EAAE,wBAAwB,KAAK,CAAC;AACnD;;;;;;;;AASA,SAAgB,sBACd,QACkD;CAElD,OADmB,eAAe,MAClB,CAAC,EAAE,yBAAyB,KAAK,CAAC;AACpD;;;;;;;;;;;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M,IAAI,SAASC,2BAAAA,kBAAkB,MAAM,EAAA,CACvD,WAAW;CACtC,MAAM,SAASC,+BAAAA,qBACb,QAAQ,KAAK,MAAM,EAAE,QAAQ,CAAC,GAC9B,YACF;CACA,OAAO,QAAQ,KAAK,GAAG,OAAO;EAAE,IAAI,EAAE;EAAI,OAAO,OAAO;CAAG,EAAE;AAC/D"}
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["extractPObjectId","collectSpecQueryColumns","DataColumnImpl","throwError","getResultPoolDatasetAxes","findPeerLinks","TreeNodeAccessor","isDataInfo","ColumnDiscoveredRecipe","ColumnOverriddenRecipe","ColumnFilteredRecipe","DataColumnOverriddenRecipe","isColumnsCollection","ColumnsCollection","deriveDistinctLabels","describePeerLinks","peerLinkedLast"],"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 { DataColumnRecipe, DataColumnImpl, type ColumnData } from \"./data_column\";\nimport { ColumnDiscoveredRecipe } from \"./column_recipes/column_discovered_recipe\";\nimport { ColumnFilteredRecipe } from \"./column_recipes/column_filtered_recipe\";\nimport {\n ColumnOverriddenRecipe,\n DataColumnOverriddenRecipe,\n} 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\";\nimport {\n describePeerLinks,\n findPeerLinks,\n getResultPoolDatasetAxes,\n peerLinkedLast,\n} from \"./peer_links\";\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 DataColumnRecipe} 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 DataColumnRecipe} leaves. 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): DataColumnRecipe<PObjectId>[] {\n return collectLinkerIds(recipe).map(\n (id) =>\n DataColumnImpl.fromId(id, opts) ??\n throwError(`materializeLinkers: linker ${id} not resolvable`),\n );\n}\n\n/** Peer link labels for a column, checked against the result pool's datasets. */\nexport function createPeerLinkFinder(): (recipe: ColumnRecipe) => string[] {\n const datasetAxes = getResultPoolDatasetAxes();\n return (recipe) =>\n findPeerLinks(\n collectLinkerColumns(recipe).map((l) => l.getSpec()),\n datasetAxes,\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 DataColumnRecipe} 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 leaf = DataColumnImpl.fromId(id, opts);\n if (leaf === undefined) return false;\n if (leaf.getDataStatus() !== \"present\") return false;\n if (!isLeafDataPresent(leaf.getData())) return false;\n }\n return true;\n}\n\nfunction isLeafDataPresent(data: ColumnData): 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 * Whether the recipe reads exactly one data column — its own — rather than\n * reaching through others.\n *\n * True for a bare leaf and for projections over one (spec overrides, axis\n * slicing): those add layers but no new columns. False when the recipe gets at\n * its data through further columns, which happens when discovery reached it via\n * a linker chain.\n *\n * **Why callers care.** A recipe over a single data column is co-indexed by its\n * own axes, so its spec is the whole truth about them. One that needs other\n * columns only lines up after they are joined in, and therefore drags axes into\n * the join that its own spec never mentions — which is why it cannot serve as a\n * primary column, and why `createPlDataTableV3` splits on this.\n *\n * The count comes from {@link ColumnRecipe.getReferencedIds}, which resolves\n * through the whole wrapper chain, so no class walk is involved and foreign\n * `ColumnRecipe` implementations are handled too.\n */\nexport function hasSingleDataColumn(recipe: ColumnRecipe): boolean {\n return recipe.getReferencedIds().length === 1;\n}\n\n/**\n * @deprecated Renamed to {@link hasSingleDataColumn} — \"leaf\" read as \"you can\n * get data out of it\", which is a different question (see\n * {@link hasReachableData}). Same semantics.\n */\nexport const isLeafColumn = hasSingleDataColumn;\n\n/**\n * Whether the column's data can be read here and now, consistent with its\n * spec — narrows to {@link DataColumnRecipe}, which exposes `getData()`.\n *\n * True for a bare leaf and for a spec-override over a bare leaf. False for an\n * axis-filtered recipe (its spec has dropped axes the underlying data still\n * carries, so the two no longer line up) and for anything reached through\n * other columns (nothing to read until the engine joins them). In both of\n * those cases the data exists only engine-side: pass `recipe.id` to\n * `createPFrame` / `createPTable` instead of trying to read it.\n *\n * The distinction is settled when the recipe is built, not here — recipes that\n * carry data are instances of a class that declares `getData`. So a `true`\n * result narrows to a value that really has the method, and there is no\n * throwing path behind the guard.\n */\nexport function hasReachableData(recipe: ColumnRecipe): recipe is DataColumnRecipe {\n return recipe instanceof DataColumnImpl || recipe instanceof DataColumnOverriddenRecipe;\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 /** Set for columns reached through a peer link; the dropdown shows it beside a link icon. */\n readonly linkHint?: 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 return deriveRecipeOptions(collection.getColumns(), labelOptions).map(\n ({ id, label, linkHint }) => ({ id, label, linkHint }),\n );\n}\n\n/**\n * {@link ColumnOption}s for `recipes`, each with its recipe. Peer-linked columns go last, the rest\n * keep their order.\n */\nexport function deriveRecipeOptions<R extends ColumnRecipe>(\n recipes: R[],\n labelOptions: DeriveLabelsOptions = {},\n): (ColumnOption & { readonly recipe: R })[] {\n const labels = deriveDistinctLabels(\n recipes.map((r) => r.getSpec()),\n labelOptions,\n );\n const findPeerLinks = createPeerLinkFinder();\n const options = recipes.map((recipe, i) => {\n const links = findPeerLinks(recipe);\n return {\n id: recipe.id,\n label: labels[i],\n linkHint: links.length > 0 ? describePeerLinks(links) : undefined,\n recipe,\n };\n });\n return peerLinkedLast(options, (o) => o.linkHint !== undefined);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,iBAAiB,QAAmC;CAClE,MAAM,OAAA,GAAMA,gCAAAA,iBAAAA,CAAiB,OAAO,EAAE;CACtC,MAAM,uBAAO,IAAI,IAAe;CAChC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M,QAAQ,cAAc,MAAM;EAClC,OAAO;GACL,IAAI,OAAO;GACX,OAAO,OAAO;GACd,UAAU,MAAM,SAAS,IAAIC,mBAAAA,kBAAkB,KAAK,IAAI,KAAA;GACxD;EACF;CACF,CAAC;CACD,OAAOC,mBAAAA,eAAe,UAAU,MAAM,EAAE,aAAa,KAAA,CAAS;AAChE"}
|
package/dist/columns/utils.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { DataColumnRecipe } from "./data_column.js";
|
|
|
5
5
|
import { ColumnsSource } from "./column_providers/types.js";
|
|
6
6
|
import { ColumnsCollection } from "./columns_collection.js";
|
|
7
7
|
import { AxisQualification, ColumnUniversalId, PObjectId } from "@milaboratories/pl-model-common";
|
|
8
|
-
//#region src/columns/utils.d.ts
|
|
9
8
|
/**
|
|
10
9
|
* PObjectIds of every non-hit column referenced by `recipe.getQuery()`,
|
|
11
10
|
* deduped in traversal order. The hit column is
|
|
@@ -24,6 +23,8 @@ export declare function collectLinkerIds(recipe: ColumnRecipe): PObjectId[];
|
|
|
24
23
|
export declare function collectLinkerColumns(recipe: ColumnRecipe, opts?: {
|
|
25
24
|
ctx?: GlobalCfgRenderCtx;
|
|
26
25
|
}): DataColumnRecipe<PObjectId>[];
|
|
26
|
+
/** Peer link labels for a column, checked against the result pool's datasets. */
|
|
27
|
+
export declare function createPeerLinkFinder(): (recipe: ColumnRecipe) => string[];
|
|
27
28
|
/**
|
|
28
29
|
* Hit-side axis qualifications for the recipe — the ones that should land on
|
|
29
30
|
* the outer-join entry wrapping this column at the consumer boundary.
|
|
@@ -105,6 +106,8 @@ export declare function hasReachableData(recipe: ColumnRecipe): recipe is DataCo
|
|
|
105
106
|
export type ColumnOption = {
|
|
106
107
|
readonly id: ColumnUniversalId;
|
|
107
108
|
readonly label: string;
|
|
109
|
+
/** Set for columns reached through a peer link; the dropdown shows it beside a link icon. */
|
|
110
|
+
readonly linkHint?: string;
|
|
108
111
|
};
|
|
109
112
|
/**
|
|
110
113
|
* Enumerates every column already in `source` and renders distinct labels
|
|
@@ -115,5 +118,11 @@ export type ColumnOption = {
|
|
|
115
118
|
* to be wrapped on the fly.
|
|
116
119
|
*/
|
|
117
120
|
export declare function deriveColumnOptions(source: ColumnsCollection | ColumnsSource[], labelOptions?: DeriveLabelsOptions): ColumnOption[];
|
|
118
|
-
|
|
121
|
+
/**
|
|
122
|
+
* {@link ColumnOption}s for `recipes`, each with its recipe. Peer-linked columns go last, the rest
|
|
123
|
+
* keep their order.
|
|
124
|
+
*/
|
|
125
|
+
export declare function deriveRecipeOptions<R extends ColumnRecipe>(recipes: R[], labelOptions?: DeriveLabelsOptions): (ColumnOption & {
|
|
126
|
+
readonly recipe: R;
|
|
127
|
+
})[];
|
|
119
128
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/columns/utils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/columns/utils.ts"],"mappings":";;;;;;;;;;;;;;;;wBAuCgB,iBAAiB,QAAQ,eAAe;;;;;;wBAsBxC,qBACd,QAAQ,cACR;EAAQ,MAAM;IACb,iBAAiB;;wBASJ,yBAAyB,QAAQ;;;;;;;;;wBAiBjC,kBAAkB,QAAQ,wBAAwB;;;;;;;;wBAYlD,sBACd,QAAQ,eACP,SAAS,OAAO,WAAW;;;;;;;;;;;;;;;wBAmBd,cACd,QAAQ,cACR;EAAQ,MAAM;;;;;;;;;;;;;;;;;;;;;wBAiEA,oBAAoB,QAAQ;;;;;;qBAS/B,qBAAY;;;;;;;;;;;;;;;;;wBAkBT,iBAAiB,QAAQ,eAAe,UAAU;;YAKtD;WACD,IAAI;WACJ;;WAEA;;;;;;;;;;wBAWK,oBACd,QAAQ,oBAAoB,iBAC5B,eAAc,sBACb;;;;;wBAWa,oBAAoB,UAAU,cAC5C,SAAS,KACT,eAAc,uBACZ;WAA0B,QAAQ"}
|
package/dist/columns/utils.js
CHANGED
|
@@ -6,9 +6,10 @@ import { ColumnFilteredRecipe } from "./column_recipes/column_filtered_recipe.js
|
|
|
6
6
|
import { ColumnOverriddenRecipe, DataColumnOverriddenRecipe } from "./column_recipes/column_overrided_recipe.js";
|
|
7
7
|
import { DataColumnImpl } from "./data_column.js";
|
|
8
8
|
import { ColumnsCollection, isColumnsCollection } from "./columns_collection.js";
|
|
9
|
+
import { describePeerLinks, findPeerLinks, getResultPoolDatasetAxes, peerLinkedLast } from "./peer_links.js";
|
|
9
10
|
import { collectSpecQueryColumns, extractPObjectId, isDataInfo, visitDataInfo } from "@milaboratories/pl-model-common";
|
|
10
11
|
import { throwError } from "@milaboratories/helpers";
|
|
11
|
-
|
|
12
|
+
// src/columns/utils.ts
|
|
12
13
|
/**
|
|
13
14
|
* PObjectIds of every non-hit column referenced by `recipe.getQuery()`,
|
|
14
15
|
* deduped in traversal order. The hit column is
|
|
@@ -39,6 +40,11 @@ function collectLinkerIds(recipe) {
|
|
|
39
40
|
function collectLinkerColumns(recipe, opts = {}) {
|
|
40
41
|
return collectLinkerIds(recipe).map((id) => DataColumnImpl.fromId(id, opts) ?? throwError(`materializeLinkers: linker ${id} not resolvable`));
|
|
41
42
|
}
|
|
43
|
+
/** Peer link labels for a column, checked against the result pool's datasets. */
|
|
44
|
+
function createPeerLinkFinder() {
|
|
45
|
+
const datasetAxes = getResultPoolDatasetAxes();
|
|
46
|
+
return (recipe) => findPeerLinks(collectLinkerColumns(recipe).map((l) => l.getSpec()), datasetAxes);
|
|
47
|
+
}
|
|
42
48
|
/**
|
|
43
49
|
* Hit-side axis qualifications for the recipe — the ones that should land on
|
|
44
50
|
* the outer-join entry wrapping this column at the consumer boundary.
|
|
@@ -172,14 +178,30 @@ function hasReachableData(recipe) {
|
|
|
172
178
|
* to be wrapped on the fly.
|
|
173
179
|
*/
|
|
174
180
|
function deriveColumnOptions(source, labelOptions = {}) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
label: labels[i]
|
|
181
|
+
return deriveRecipeOptions((isColumnsCollection(source) ? source : ColumnsCollection(source)).getColumns(), labelOptions).map(({ id, label, linkHint }) => ({
|
|
182
|
+
id,
|
|
183
|
+
label,
|
|
184
|
+
linkHint
|
|
180
185
|
}));
|
|
181
186
|
}
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
/**
|
|
188
|
+
* {@link ColumnOption}s for `recipes`, each with its recipe. Peer-linked columns go last, the rest
|
|
189
|
+
* keep their order.
|
|
190
|
+
*/
|
|
191
|
+
function deriveRecipeOptions(recipes, labelOptions = {}) {
|
|
192
|
+
const labels = deriveDistinctLabels(recipes.map((r) => r.getSpec()), labelOptions);
|
|
193
|
+
const findPeerLinks = createPeerLinkFinder();
|
|
194
|
+
const options = recipes.map((recipe, i) => {
|
|
195
|
+
const links = findPeerLinks(recipe);
|
|
196
|
+
return {
|
|
197
|
+
id: recipe.id,
|
|
198
|
+
label: labels[i],
|
|
199
|
+
linkHint: links.length > 0 ? describePeerLinks(links) : void 0,
|
|
200
|
+
recipe
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
return peerLinkedLast(options, (o) => o.linkHint !== void 0);
|
|
204
|
+
}
|
|
205
|
+
export { collectLinkerColumns, collectLinkerIds, createPeerLinkFinder, deriveColumnOptions, deriveRecipeOptions, hasColumnData, hasReachableData, hasSingleDataColumn, hitQualifications, isLeafColumn, queriesQualifications };
|
|
184
206
|
|
|
185
207
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +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 { DataColumnRecipe, DataColumnImpl, type ColumnData } from \"./data_column\";\nimport { ColumnDiscoveredRecipe } from \"./column_recipes/column_discovered_recipe\";\nimport { ColumnFilteredRecipe } from \"./column_recipes/column_filtered_recipe\";\nimport {\n ColumnOverriddenRecipe,\n DataColumnOverriddenRecipe,\n} 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 DataColumnRecipe} 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 DataColumnRecipe} leaves. 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): DataColumnRecipe<PObjectId>[] {\n return collectLinkerIds(recipe).map(\n (id) =>\n DataColumnImpl.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 DataColumnRecipe} 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 leaf = DataColumnImpl.fromId(id, opts);\n if (leaf === undefined) return false;\n if (leaf.getDataStatus() !== \"present\") return false;\n if (!isLeafDataPresent(leaf.getData())) return false;\n }\n return true;\n}\n\nfunction isLeafDataPresent(data: ColumnData): 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 * Whether the recipe reads exactly one data column — its own — rather than\n * reaching through others.\n *\n * True for a bare leaf and for projections over one (spec overrides, axis\n * slicing): those add layers but no new columns. False when the recipe gets at\n * its data through further columns, which happens when discovery reached it via\n * a linker chain.\n *\n * **Why callers care.** A recipe over a single data column is co-indexed by its\n * own axes, so its spec is the whole truth about them. One that needs other\n * columns only lines up after they are joined in, and therefore drags axes into\n * the join that its own spec never mentions — which is why it cannot serve as a\n * primary column, and why `createPlDataTableV3` splits on this.\n *\n * The count comes from {@link ColumnRecipe.getReferencedIds}, which resolves\n * through the whole wrapper chain, so no class walk is involved and foreign\n * `ColumnRecipe` implementations are handled too.\n */\nexport function hasSingleDataColumn(recipe: ColumnRecipe): boolean {\n return recipe.getReferencedIds().length === 1;\n}\n\n/**\n * @deprecated Renamed to {@link hasSingleDataColumn} — \"leaf\" read as \"you can\n * get data out of it\", which is a different question (see\n * {@link hasReachableData}). Same semantics.\n */\nexport const isLeafColumn = hasSingleDataColumn;\n\n/**\n * Whether the column's data can be read here and now, consistent with its\n * spec — narrows to {@link DataColumnRecipe}, which exposes `getData()`.\n *\n * True for a bare leaf and for a spec-override over a bare leaf. False for an\n * axis-filtered recipe (its spec has dropped axes the underlying data still\n * carries, so the two no longer line up) and for anything reached through\n * other columns (nothing to read until the engine joins them). In both of\n * those cases the data exists only engine-side: pass `recipe.id` to\n * `createPFrame` / `createPTable` instead of trying to read it.\n *\n * The distinction is settled when the recipe is built, not here — recipes that\n * carry data are instances of a class that declares `getData`. So a `true`\n * result narrows to a value that really has the method, and there is no\n * throwing path behind the guard.\n */\nexport function hasReachableData(recipe: ColumnRecipe): recipe is DataColumnRecipe {\n return recipe instanceof DataColumnImpl || recipe instanceof DataColumnOverriddenRecipe;\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":";;;;;;;;;;;;;;;;;;;;AAiCA,SAAgB,iBAAiB,QAAmC;CAClE,MAAM,MAAM,iBAAiB,OAAO,EAAE;CACtC,MAAM,uBAAO,IAAI,IAAe;CAChC,MAAM,MAAmB,CAAC;CAC1B,KAAK,MAAM,MAAM,wBAAwB,OAAO,SAAS,CAAC,GAAG;EAI3D,MAAM,OAAO,iBAAiB,EAAE;EAChC,IAAI,SAAS,KAAK;EAClB,IAAI,KAAK,IAAI,IAAI,GAAG;EACpB,KAAK,IAAI,IAAI;EACb,IAAI,KA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;;AAqBA,SAAgB,oBAAoB,QAA+B;CACjE,OAAO,OAAO,iBAAiB,CAAC,CAAC,WAAW;AAC9C;;;;;;AAOA,MAAa,eAAe;;;;;;;;;;;;;;;;;AAkB5B,SAAgB,iBAAiB,QAAkD;CACjF,OAAO,kBAAkB,kBAAkB,kBAAkB;AAC/D;;;;;;;;;AAgBA,SAAgB,oBACd,QACA,eAAoC,CAAC,GACrB;CAEhB,MAAM,WADa,oBAAoB,MAAM,IAAI,SAAS,kBAAkB,MAAM,EAAA,CACvD,WAAW;CACtC,MAAM,SAAS,qBACb,QAAQ,KAAK,MAAM,EAAE,QAAQ,CAAC,GAC9B,YACF;CACA,OAAO,QAAQ,KAAK,GAAG,OAAO;EAAE,IAAI,EAAE;EAAI,OAAO,OAAO;CAAG,EAAE;AAC/D"}
|
|
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 { DataColumnRecipe, DataColumnImpl, type ColumnData } from \"./data_column\";\nimport { ColumnDiscoveredRecipe } from \"./column_recipes/column_discovered_recipe\";\nimport { ColumnFilteredRecipe } from \"./column_recipes/column_filtered_recipe\";\nimport {\n ColumnOverriddenRecipe,\n DataColumnOverriddenRecipe,\n} 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\";\nimport {\n describePeerLinks,\n findPeerLinks,\n getResultPoolDatasetAxes,\n peerLinkedLast,\n} from \"./peer_links\";\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 DataColumnRecipe} 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 DataColumnRecipe} leaves. 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): DataColumnRecipe<PObjectId>[] {\n return collectLinkerIds(recipe).map(\n (id) =>\n DataColumnImpl.fromId(id, opts) ??\n throwError(`materializeLinkers: linker ${id} not resolvable`),\n );\n}\n\n/** Peer link labels for a column, checked against the result pool's datasets. */\nexport function createPeerLinkFinder(): (recipe: ColumnRecipe) => string[] {\n const datasetAxes = getResultPoolDatasetAxes();\n return (recipe) =>\n findPeerLinks(\n collectLinkerColumns(recipe).map((l) => l.getSpec()),\n datasetAxes,\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 DataColumnRecipe} 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 leaf = DataColumnImpl.fromId(id, opts);\n if (leaf === undefined) return false;\n if (leaf.getDataStatus() !== \"present\") return false;\n if (!isLeafDataPresent(leaf.getData())) return false;\n }\n return true;\n}\n\nfunction isLeafDataPresent(data: ColumnData): 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 * Whether the recipe reads exactly one data column — its own — rather than\n * reaching through others.\n *\n * True for a bare leaf and for projections over one (spec overrides, axis\n * slicing): those add layers but no new columns. False when the recipe gets at\n * its data through further columns, which happens when discovery reached it via\n * a linker chain.\n *\n * **Why callers care.** A recipe over a single data column is co-indexed by its\n * own axes, so its spec is the whole truth about them. One that needs other\n * columns only lines up after they are joined in, and therefore drags axes into\n * the join that its own spec never mentions — which is why it cannot serve as a\n * primary column, and why `createPlDataTableV3` splits on this.\n *\n * The count comes from {@link ColumnRecipe.getReferencedIds}, which resolves\n * through the whole wrapper chain, so no class walk is involved and foreign\n * `ColumnRecipe` implementations are handled too.\n */\nexport function hasSingleDataColumn(recipe: ColumnRecipe): boolean {\n return recipe.getReferencedIds().length === 1;\n}\n\n/**\n * @deprecated Renamed to {@link hasSingleDataColumn} — \"leaf\" read as \"you can\n * get data out of it\", which is a different question (see\n * {@link hasReachableData}). Same semantics.\n */\nexport const isLeafColumn = hasSingleDataColumn;\n\n/**\n * Whether the column's data can be read here and now, consistent with its\n * spec — narrows to {@link DataColumnRecipe}, which exposes `getData()`.\n *\n * True for a bare leaf and for a spec-override over a bare leaf. False for an\n * axis-filtered recipe (its spec has dropped axes the underlying data still\n * carries, so the two no longer line up) and for anything reached through\n * other columns (nothing to read until the engine joins them). In both of\n * those cases the data exists only engine-side: pass `recipe.id` to\n * `createPFrame` / `createPTable` instead of trying to read it.\n *\n * The distinction is settled when the recipe is built, not here — recipes that\n * carry data are instances of a class that declares `getData`. So a `true`\n * result narrows to a value that really has the method, and there is no\n * throwing path behind the guard.\n */\nexport function hasReachableData(recipe: ColumnRecipe): recipe is DataColumnRecipe {\n return recipe instanceof DataColumnImpl || recipe instanceof DataColumnOverriddenRecipe;\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 /** Set for columns reached through a peer link; the dropdown shows it beside a link icon. */\n readonly linkHint?: 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 return deriveRecipeOptions(collection.getColumns(), labelOptions).map(\n ({ id, label, linkHint }) => ({ id, label, linkHint }),\n );\n}\n\n/**\n * {@link ColumnOption}s for `recipes`, each with its recipe. Peer-linked columns go last, the rest\n * keep their order.\n */\nexport function deriveRecipeOptions<R extends ColumnRecipe>(\n recipes: R[],\n labelOptions: DeriveLabelsOptions = {},\n): (ColumnOption & { readonly recipe: R })[] {\n const labels = deriveDistinctLabels(\n recipes.map((r) => r.getSpec()),\n labelOptions,\n );\n const findPeerLinks = createPeerLinkFinder();\n const options = recipes.map((recipe, i) => {\n const links = findPeerLinks(recipe);\n return {\n id: recipe.id,\n label: labels[i],\n linkHint: links.length > 0 ? describePeerLinks(links) : undefined,\n recipe,\n };\n });\n return peerLinkedLast(options, (o) => o.linkHint !== undefined);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,iBAAiB,QAAmC;CAClE,MAAM,MAAM,iBAAiB,OAAO,EAAE;CAC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|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_axes = require("../pframe_utils/axes.cjs");
|
|
2
2
|
const require_columns = require("../pframe_utils/columns.cjs");
|
|
3
3
|
let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
|
|
4
|
-
|
|
4
|
+
// src/components/PFrameForGraphs.ts
|
|
5
5
|
function isHiddenFromGraphColumn(column) {
|
|
6
6
|
return !!(0, _milaboratories_pl_model_common.readAnnotationJson)(column, _milaboratories_pl_model_common.Annotation.HideDataFromGraphs);
|
|
7
7
|
}
|
|
@@ -29,7 +29,6 @@ function createPFrameForGraphs(ctx, blockColumns) {
|
|
|
29
29
|
predicate: suitableSpec
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
|
-
//#endregion
|
|
33
32
|
exports.createPFrameForGraphs = createPFrameForGraphs;
|
|
34
33
|
exports.enrichCompatible = require_axes.enrichCompatible;
|
|
35
34
|
exports.getAvailableWithLinkersAxes = require_axes.getAvailableWithLinkersAxes;
|
|
@@ -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<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,
|
|
1
|
+
{"version":3,"file":"PFrameForGraphs.cjs","names":["readAnnotationJson","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,GAACA,gCAAAA,mBAAAA,CAAmB,QAAQC,gCAAAA,WAAW,kBAAkB;AACnE;AAEA,SAAgB,qBAAqB,QAA8B;CACjE,OAAO,CAAC,EAAA,GAACD,gCAAAA,mBAAAA,CAAmB,QAAQC,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"}
|
|
@@ -3,7 +3,6 @@ import { RenderCtxBase } from "../render/api.js";
|
|
|
3
3
|
import "../render/index.js";
|
|
4
4
|
import { AxesVault, enrichCompatible, getAvailableWithLinkersAxes } from "../pframe_utils/axes.js";
|
|
5
5
|
import { PColumn, PColumnSpec, PFrameHandle } from "@milaboratories/pl-model-common";
|
|
6
|
-
//#region src/components/PFrameForGraphs.d.ts
|
|
7
6
|
export declare function isHiddenFromGraphColumn(column: PColumnSpec): boolean;
|
|
8
7
|
export declare function isHiddenFromUIColumn(column: PColumnSpec): boolean;
|
|
9
8
|
/**
|
|
@@ -19,6 +18,5 @@ export declare function isHiddenFromUIColumn(column: PColumnSpec): boolean;
|
|
|
19
18
|
and modified label (with added domain values in case if more than one copy with different domains exist).
|
|
20
19
|
*/
|
|
21
20
|
export declare function createPFrameForGraphs<A, U>(ctx: RenderCtxBase<A, U>, blockColumns?: PColumn<undefined | PColumnDataUniversal>[]): PFrameHandle | undefined;
|
|
22
|
-
//#endregion
|
|
23
21
|
export { type AxesVault, enrichCompatible, getAvailableWithLinkersAxes };
|
|
24
22
|
//# sourceMappingURL=PFrameForGraphs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PFrameForGraphs.d.ts","names":[],"sources":["../../src/components/PFrameForGraphs.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PFrameForGraphs.d.ts","names":[],"sources":["../../src/components/PFrameForGraphs.ts"],"mappings":";;;;;wBAOgB,wBAAwB,QAAQ;wBAIhC,qBAAqB,QAAQ;;;;;;;;;;;;;wBAgB7B,sBAAsB,GAAG,GACvC,KAAK,cAAc,GAAG,IACtB,eAAe,oBAAoB,0BAClC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { enrichCompatible, getAvailableWithLinkersAxes } from "../pframe_utils/axes.js";
|
|
2
2
|
import { getAllRelatedColumns, getRelatedColumns } from "../pframe_utils/columns.js";
|
|
3
3
|
import { Annotation, readAnnotationJson } from "@milaboratories/pl-model-common";
|
|
4
|
-
|
|
4
|
+
// src/components/PFrameForGraphs.ts
|
|
5
5
|
function isHiddenFromGraphColumn(column) {
|
|
6
6
|
return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);
|
|
7
7
|
}
|
|
@@ -29,7 +29,6 @@ function createPFrameForGraphs(ctx, blockColumns) {
|
|
|
29
29
|
predicate: suitableSpec
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
|
-
//#endregion
|
|
33
32
|
export { createPFrameForGraphs, enrichCompatible, getAvailableWithLinkersAxes, isHiddenFromGraphColumn, isHiddenFromUIColumn };
|
|
34
33
|
|
|
35
34
|
//# sourceMappingURL=PFrameForGraphs.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SUniversalPColumnId } from "@milaboratories/pl-model-common";
|
|
2
|
-
//#region src/components/PlAnnotations/filter.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Represents an equals predicate for pattern filtering.
|
|
5
4
|
* Checks if the pattern exactly matches the provided value.
|
|
@@ -211,5 +210,4 @@ export type AnnotationScript2<S extends AnnotationStep> = {
|
|
|
211
210
|
/** Ordered list of annotation steps to apply */
|
|
212
211
|
steps: S[];
|
|
213
212
|
};
|
|
214
|
-
//#endregion
|
|
215
213
|
//# sourceMappingURL=filter.d.ts.map
|