@platforma-sdk/model 1.86.0 → 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/peer_links.cjs +1 -2
- package/dist/columns/peer_links.cjs.map +1 -1
- package/dist/columns/peer_links.d.ts +0 -2
- package/dist/columns/peer_links.d.ts.map +1 -1
- package/dist/columns/peer_links.js +1 -2
- 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 +4 -4
- package/dist/columns/utils.cjs.map +1 -1
- package/dist/columns/utils.d.ts +0 -2
- package/dist/columns/utils.d.ts.map +1 -1
- package/dist/columns/utils.js +4 -4
- 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 +1 -2
- 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 +1 -2
- 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 +6 -5
- 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 +6 -5
- 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 +0 -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/internal.cjs +1 -2
- package/dist/internal.js +1 -2
- package/dist/labels/derive_distinct_labels.cjs +1 -2
- package/dist/labels/derive_distinct_labels.cjs.map +1 -1
- package/dist/labels/derive_distinct_labels.d.ts +0 -2
- package/dist/labels/derive_distinct_labels.d.ts.map +1 -1
- package/dist/labels/derive_distinct_labels.js +1 -2
- 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 +1 -2
- 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 +1 -2
- 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 +17 -17
- package/src/annotations/converter.ts +5 -10
- package/src/block_storage_facade.ts +3 -1
- package/src/columns/split_by_axes.ts +4 -3
- package/src/components/PlDataTable/state-migration.ts +4 -6
- package/src/filters/distill.ts +2 -2
- package/src/labels/derive_distinct_labels.ts +1 -1
|
@@ -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);\n currentCombo.pop();\n }\n }\n\n generate([], 0);\n return combinations;\n}\n"],"mappings":"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"}
|
|
@@ -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":"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"}
|
package/dist/columns/utils.cjs
CHANGED
|
@@ -9,7 +9,7 @@ const require_columns_collection = require("./columns_collection.cjs");
|
|
|
9
9
|
const require_peer_links = require("./peer_links.cjs");
|
|
10
10
|
let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
|
|
11
11
|
let _milaboratories_helpers = require("@milaboratories/helpers");
|
|
12
|
-
|
|
12
|
+
// src/columns/utils.ts
|
|
13
13
|
/**
|
|
14
14
|
* PObjectIds of every non-hit column referenced by `recipe.getQuery()`,
|
|
15
15
|
* deduped in traversal order. The hit column is
|
|
@@ -191,7 +191,7 @@ function deriveColumnOptions(source, labelOptions = {}) {
|
|
|
191
191
|
function deriveRecipeOptions(recipes, labelOptions = {}) {
|
|
192
192
|
const labels = require_derive_distinct_labels.deriveDistinctLabels(recipes.map((r) => r.getSpec()), labelOptions);
|
|
193
193
|
const findPeerLinks = createPeerLinkFinder();
|
|
194
|
-
|
|
194
|
+
const options = recipes.map((recipe, i) => {
|
|
195
195
|
const links = findPeerLinks(recipe);
|
|
196
196
|
return {
|
|
197
197
|
id: recipe.id,
|
|
@@ -199,9 +199,9 @@ function deriveRecipeOptions(recipes, labelOptions = {}) {
|
|
|
199
199
|
linkHint: links.length > 0 ? require_peer_links.describePeerLinks(links) : void 0,
|
|
200
200
|
recipe
|
|
201
201
|
};
|
|
202
|
-
})
|
|
202
|
+
});
|
|
203
|
+
return require_peer_links.peerLinkedLast(options, (o) => o.linkHint !== void 0);
|
|
203
204
|
}
|
|
204
|
-
//#endregion
|
|
205
205
|
exports.collectLinkerColumns = collectLinkerColumns;
|
|
206
206
|
exports.collectLinkerIds = collectLinkerIds;
|
|
207
207
|
exports.createPeerLinkFinder = createPeerLinkFinder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["DataColumnImpl","getResultPoolDatasetAxes","findPeerLinks","TreeNodeAccessor","ColumnDiscoveredRecipe","ColumnOverriddenRecipe","ColumnFilteredRecipe","DataColumnOverriddenRecipe","isColumnsCollection","ColumnsCollection","deriveDistinctLabels","peerLinkedLast","describePeerLinks"],"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":"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"}
|
|
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,MAAM,MAAmB,CAAC;CAC1B,KAAK,MAAM,OAAA,GAAMC,gCAAAA,wBAAAA,CAAwB,OAAO,SAAS,CAAC,GAAG;EAI3D,MAAM,QAAA,GAAOD,gCAAAA,iBAAAA,CAAiB,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,OACCE,oBAAAA,eAAe,OAAO,IAAI,IAAI,MAAA,GAC9BC,wBAAAA,WAAAA,CAAW,8BAA8B,GAAG,gBAAgB,CAChE;AACF;;AAGA,SAAgB,uBAA2D;CACzE,MAAM,cAAcC,mBAAAA,yBAAyB;CAC7C,QAAQ,WACNC,mBAAAA,cACE,qBAAqB,MAAM,CAAC,CAAC,KAAK,MAAM,EAAE,QAAQ,CAAC,GACnD,WACF;AACJ;;;;;;;;;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;;;;;;;;;;;;;;;AAgBA,SAAgB,cACd,QACA,OAAqC,CAAC,GAC7B;CACT,KAAK,MAAM,MAAM,OAAO,iBAAiB,GAAG;EAC1C,MAAM,OAAOH,oBAAAA,eAAe,OAAO,IAAI,IAAI;EAC3C,IAAI,SAAS,KAAA,GAAW,OAAO;EAC/B,IAAI,KAAK,cAAc,MAAM,WAAW,OAAO;EAC/C,IAAI,CAAC,kBAAkB,KAAK,QAAQ,CAAC,GAAG,OAAO;CACjD;CACA,OAAO;AACT;AAEA,SAAS,kBAAkB,MAA2B;CACpD,IAAI,SAAS,KAAA,GAAW,OAAO;CAC/B,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO;CAChC,IAAI,gBAAgBI,iBAAAA,kBAAkB,OAAO,KAAK,QAAQ;CAC1D,KAAA,GAAIC,gCAAAA,WAAAA,CAAW,IAAI,GAAG;EACpB,IAAI,KAAK;EACT,CAAA,GAAA,gCAAA,cAAA,CAAc,OAAO,SAAS;GAC5B,OAAO,KAAK,QAAQ;EACtB,CAAC;EACD,OAAO;CACT;CACA,OAAO;AACT;;;;;;;;;;AAWA,SAAS,eAAe,QAA0D;CAChF,IAAI,UAAwB;CAC5B,OAAO,MAAM;EACX,IAAI,mBAAmBC,iCAAAA,wBAAwB,OAAO;EACtD,IAAI,mBAAmBC,gCAAAA,0BAA0B,mBAAmBC,+BAAAA,sBAAsB;GACxF,UAAU,QAAQ,SAAS;GAC3B;EACF;EACA;CACF;AACF;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,oBAAoB,QAA+B;CACjE,OAAO,OAAO,iBAAiB,CAAC,CAAC,WAAW;AAC9C;;;;;;AAOA,MAAa,eAAe;;;;;;;;;;;;;;;;;AAkB5B,SAAgB,iBAAiB,QAAkD;CACjF,OAAO,kBAAkBR,oBAAAA,kBAAkB,kBAAkBS,gCAAAA;AAC/D;;;;;;;;;AAkBA,SAAgB,oBACd,QACA,eAAoC,CAAC,GACrB;CAEhB,OAAO,qBADYC,2BAAAA,oBAAoB,MAAM,IAAI,SAASC,2BAAAA,kBAAkB,MAAM,EAAA,CAC5C,WAAW,GAAG,YAAY,CAAC,CAAC,KAC/D,EAAE,IAAI,OAAO,gBAAgB;EAAE;EAAI;EAAO;CAAS,EACtD;AACF;;;;;AAMA,SAAgB,oBACd,SACA,eAAoC,CAAC,GACM;CAC3C,MAAM,SAASC,+BAAAA,qBACb,QAAQ,KAAK,MAAM,EAAE,QAAQ,CAAC,GAC9B,YACF;CACA,MAAM,gBAAgB,qBAAqB;CAC3C,MAAM,UAAU,QAAQ,KAAK,QAAQ,MAAM;EACzC,MAAM,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
|
|
@@ -126,5 +125,4 @@ export declare function deriveColumnOptions(source: ColumnsCollection | ColumnsS
|
|
|
126
125
|
export declare function deriveRecipeOptions<R extends ColumnRecipe>(recipes: R[], labelOptions?: DeriveLabelsOptions): (ColumnOption & {
|
|
127
126
|
readonly recipe: R;
|
|
128
127
|
})[];
|
|
129
|
-
//#endregion
|
|
130
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
|
@@ -9,7 +9,7 @@ import { ColumnsCollection, isColumnsCollection } from "./columns_collection.js"
|
|
|
9
9
|
import { describePeerLinks, findPeerLinks, getResultPoolDatasetAxes, peerLinkedLast } from "./peer_links.js";
|
|
10
10
|
import { collectSpecQueryColumns, extractPObjectId, isDataInfo, visitDataInfo } from "@milaboratories/pl-model-common";
|
|
11
11
|
import { throwError } from "@milaboratories/helpers";
|
|
12
|
-
|
|
12
|
+
// src/columns/utils.ts
|
|
13
13
|
/**
|
|
14
14
|
* PObjectIds of every non-hit column referenced by `recipe.getQuery()`,
|
|
15
15
|
* deduped in traversal order. The hit column is
|
|
@@ -191,7 +191,7 @@ function deriveColumnOptions(source, labelOptions = {}) {
|
|
|
191
191
|
function deriveRecipeOptions(recipes, labelOptions = {}) {
|
|
192
192
|
const labels = deriveDistinctLabels(recipes.map((r) => r.getSpec()), labelOptions);
|
|
193
193
|
const findPeerLinks = createPeerLinkFinder();
|
|
194
|
-
|
|
194
|
+
const options = recipes.map((recipe, i) => {
|
|
195
195
|
const links = findPeerLinks(recipe);
|
|
196
196
|
return {
|
|
197
197
|
id: recipe.id,
|
|
@@ -199,9 +199,9 @@ function deriveRecipeOptions(recipes, labelOptions = {}) {
|
|
|
199
199
|
linkHint: links.length > 0 ? describePeerLinks(links) : void 0,
|
|
200
200
|
recipe
|
|
201
201
|
};
|
|
202
|
-
})
|
|
202
|
+
});
|
|
203
|
+
return peerLinkedLast(options, (o) => o.linkHint !== void 0);
|
|
203
204
|
}
|
|
204
|
-
//#endregion
|
|
205
205
|
export { collectLinkerColumns, collectLinkerIds, createPeerLinkFinder, deriveColumnOptions, deriveRecipeOptions, hasColumnData, hasReachableData, hasSingleDataColumn, hitQualifications, isLeafColumn, queriesQualifications };
|
|
206
206
|
|
|
207
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\";\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":"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"}
|
|
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":"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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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","names":[],"sources":["../../../src/components/PlAnnotations/filter.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"filter.d.ts","names":[],"sources":["../../../src/components/PlAnnotations/filter.ts"],"mappings":";;;;;;YAWY;EACV;;EAEA;;;;;;;YAQU;EACV;;EAEA;;;;;YAMU,mBAAmB,yBAAyB;;;;;YAM5C;EACV;;EAEA,QAAQ;;EAER,WAAW;;;;;;;;;;;;;YAkBD;EACV;;EAEA,QAAQ;;EAER;;;;;;;;;;;;YAaU;EACV;;EAEA,QAAQ;;EAER;;;;;;;;;;;YAYU;EACV;;EAEA,QAAQ;;;;;;;;YASE,oBAAoB,YAAY,sBAAsB;;;;;;;;;;;;;;;;;;YAmBtD;EACV;;EAEA,KAAK,sBAAsB;;EAE3B,KAAK,sBAAsB;;EAE3B;;EAEA;;;;;;YAOU;EACV;;EAEA,QAAQ;;;;;;iBAWO;EACf;;EAEA,SAAS;;;;;;iBAOM;EACf;;EAEA,SAAS;;;;;;iBAOM;EACf;;EAEA,QAAQ;;;;;YAME,mBACR,OACA,gBACA,4BACA,WACA,YACA;;;;;YAUQ;;EAEV,QAAQ;;EAER;;;;;;YAOU;;;;;;;;;;;;;;;;;;;;;;;;YAyBA;;EAEV;;EAEA,MAAM;;EAEN,OAAO;;YAGG,kBAAkB,UAAU;;EAEtC,MAAM;;EAEN,OAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/PlAnnotations/filters_ui.ts
|
|
2
2
|
function unreachable(x) {
|
|
3
3
|
throw new Error("Unexpected object: " + x);
|
|
4
4
|
}
|
|
@@ -139,7 +139,6 @@ function compileAnnotationScript(uiScript) {
|
|
|
139
139
|
}))
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
//#endregion
|
|
143
142
|
exports.compileAnnotationScript = compileAnnotationScript;
|
|
144
143
|
exports.compileFilter = compileFilter;
|
|
145
144
|
exports.compileFilters = compileFilters;
|
|
@@ -4,7 +4,6 @@ import "../../filters/index.js";
|
|
|
4
4
|
import { FilterSpecUi } from "../../annotations/types.js";
|
|
5
5
|
import "../../annotations/index.js";
|
|
6
6
|
import { SUniversalPColumnId } from "@milaboratories/pl-model-common";
|
|
7
|
-
//#region src/components/PlAnnotations/filters_ui.d.ts
|
|
8
7
|
export type FilterUi = FilterSpec$1<Extract<FilterSpecLeaf$1, {
|
|
9
8
|
type: "lessThan" | "greaterThan" | "lessThanOrEqual" | "greaterThanOrEqual" | "lessThanColumn" | "lessThanColumnOrEqual" | "patternContainSubsequence" | "patternNotContainSubsequence" | "patternEquals" | "patternNotEquals" | "topN" | "bottomN" | "isNA" | "isNotNA";
|
|
10
9
|
}>, {
|
|
@@ -52,5 +51,4 @@ export type AnnotationScriptUi = {
|
|
|
52
51
|
export declare function compileFilter(ui: FilterUi): AnnotationFilter;
|
|
53
52
|
export declare function compileFilters(uiFilters: FilterUi[]): AnnotationFilter[];
|
|
54
53
|
export declare function compileAnnotationScript(uiScript: AnnotationScriptUi): AnnotationScript;
|
|
55
|
-
//#endregion
|
|
56
54
|
//# sourceMappingURL=filters_ui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters_ui.d.ts","names":[],"sources":["../../../src/components/PlAnnotations/filters_ui.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"filters_ui.d.ts","names":["FilterSpecLeaf","FilterSpec"],"sources":["../../../src/components/PlAnnotations/filters_ui.ts"],"mappings":";;;;;;YAgBY,WAAWC,aACrB,QACED;EAGE;;EAiBF;EAAY;EAAe;;YAGnB,eAAe,QAAQ;EAAY;;YAEnC,eAAe,UAAU,gBAAgB,QAAQ;EAAY,MAAM;;wBAG/D,YAAY;YAKhB,cAAc,MAAM,YAAY,kCAEvC,YAAY,gDAEV,YAAY,0CAEV,YAAY,8CAEV,YAAY,0CAEV,kCAEE,+CAEE,kCAEE,+CAEE,oCAEE,iDAEE,uCAGC,8BAEE,8BAEE,gCAEE,UAAU;YAK9B,UAAU;EACpB,WAAW,cAAc;EACzB;EACA,oBAAoB;;YAGV,gBAAgB,UAAU,eAAe,WAAW,IAAI,UAAU,EAAE;YAEpE,SAAS,QAClB,WAAW,IAAI,EAAE,WAAW;EAEvB;EACA;EACA,OAAO,EAAE,WAAW,0BAA0B,SAAS,EAAE;EACzD,oBAAoB,EAAE;IAExB,UAAU,EAAE;YAGN;EAEN;EACA,OAAO,eAAe;EACtB,oBAAoB;IAEtB,UAAU,gBACV,oBACA,oBACA,gCACA,qBACA,iCACA,UAAU;YAEF,UAAU,eAAe;YAEzB,mBAAmB,aAAa,QAAQ;EAAY;;EAC9D;;YAGU;EACV;EACA;EACA,MAAM;EACN,OAAO;;wBAGO,cAAc,IAAI,WAAW;wBAmK7B,eAAe,WAAW,aAAa;wBAIvC,wBAAwB,UAAU,qBAAqB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/PlAnnotations/filters_ui.ts
|
|
2
2
|
function unreachable(x) {
|
|
3
3
|
throw new Error("Unexpected object: " + x);
|
|
4
4
|
}
|
|
@@ -139,7 +139,6 @@ function compileAnnotationScript(uiScript) {
|
|
|
139
139
|
}))
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
//#endregion
|
|
143
142
|
export { compileAnnotationScript, compileFilter, compileFilters, unreachable };
|
|
144
143
|
|
|
145
144
|
//# sourceMappingURL=filters_ui.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
|
|
2
|
-
|
|
2
|
+
// src/components/PlDataTable/columnResolver.ts
|
|
3
3
|
function createColumnResolver(columns) {
|
|
4
4
|
const axisIds = [];
|
|
5
5
|
for (const c of columns) for (const ax of c.getSpec().axesSpec) axisIds.push((0, _milaboratories_pl_model_common.getAxisId)(ax));
|
|
@@ -20,7 +20,6 @@ function createColumnResolver(columns) {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
//#endregion
|
|
24
23
|
exports.createColumnResolver = createColumnResolver;
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=columnResolver.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnResolver.cjs","names":[],"sources":["../../../src/components/PlDataTable/columnResolver.ts"],"sourcesContent":["import type {\n AxisId,\n ColumnUniversalId,\n PObjectId,\n PTableColumnId,\n PTableColumnIdColumn,\n} from \"@milaboratories/pl-model-common\";\nimport { extractPObjectId, getAxisId, matchAxisId } from \"@milaboratories/pl-model-common\";\nimport type { ColumnRecipe } from \"../../columns\";\n\n/**\n * Resolves a user-supplied PTableColumnId against the discovered set of\n * columns and axes. For column refs, accepts either the full recipe id (rich\n * {@link ColumnUniversalId}) or the bare {@link PObjectId} and returns a ref\n * carrying the recipe's full id — the same id that appears as the leaf in the\n * emitted SpecQuery, so engine-side dedup is consistent with the resolver's\n * view. Axis refs are checked against the union of axes spanned by the\n * columns and pass through unchanged on hit.\n * Returns `undefined` when the reference cannot be matched.\n */\nexport type ColumnResolver = (ref: PTableColumnId) => PTableColumnId | undefined;\n\nexport function createColumnResolver(columns: ColumnRecipe[]): ColumnResolver {\n const axisIds: AxisId[] = [];\n for (const c of columns) {\n for (const ax of c.getSpec().axesSpec) {\n axisIds.push(getAxisId(ax));\n }\n }\n\n const byFullId = new Map<ColumnUniversalId, ColumnRecipe>();\n const byPObjectId = new Map<PObjectId, ColumnRecipe>();\n for (const c of columns) {\n byFullId.set(c.id, c);\n const pid = extractPObjectId(c.id);\n if (!byPObjectId.has(pid)) byPObjectId.set(pid, c);\n }\n\n return (ref: PTableColumnId): PTableColumnId | undefined => {\n if (ref.type === \"axis\") {\n return axisIds.some((a) => matchAxisId(ref.id, a)) ? ref : undefined;\n }\n const hit = byFullId.get(ref.id) ?? byPObjectId.get(extractPObjectId(ref.id));\n if (hit === undefined) return undefined;\n return { type: \"column\", id: hit.id } satisfies PTableColumnIdColumn;\n };\n}\n"],"mappings":";;AAsBA,SAAgB,qBAAqB,SAAyC;CAC5E,MAAM,UAAoB,CAAC;CAC3B,KAAK,MAAM,KAAK,SACd,KAAK,MAAM,MAAM,EAAE,QAAQ,CAAC,CAAC,UAC3B,QAAQ,MAAA,
|
|
1
|
+
{"version":3,"file":"columnResolver.cjs","names":["getAxisId","extractPObjectId","matchAxisId"],"sources":["../../../src/components/PlDataTable/columnResolver.ts"],"sourcesContent":["import type {\n AxisId,\n ColumnUniversalId,\n PObjectId,\n PTableColumnId,\n PTableColumnIdColumn,\n} from \"@milaboratories/pl-model-common\";\nimport { extractPObjectId, getAxisId, matchAxisId } from \"@milaboratories/pl-model-common\";\nimport type { ColumnRecipe } from \"../../columns\";\n\n/**\n * Resolves a user-supplied PTableColumnId against the discovered set of\n * columns and axes. For column refs, accepts either the full recipe id (rich\n * {@link ColumnUniversalId}) or the bare {@link PObjectId} and returns a ref\n * carrying the recipe's full id — the same id that appears as the leaf in the\n * emitted SpecQuery, so engine-side dedup is consistent with the resolver's\n * view. Axis refs are checked against the union of axes spanned by the\n * columns and pass through unchanged on hit.\n * Returns `undefined` when the reference cannot be matched.\n */\nexport type ColumnResolver = (ref: PTableColumnId) => PTableColumnId | undefined;\n\nexport function createColumnResolver(columns: ColumnRecipe[]): ColumnResolver {\n const axisIds: AxisId[] = [];\n for (const c of columns) {\n for (const ax of c.getSpec().axesSpec) {\n axisIds.push(getAxisId(ax));\n }\n }\n\n const byFullId = new Map<ColumnUniversalId, ColumnRecipe>();\n const byPObjectId = new Map<PObjectId, ColumnRecipe>();\n for (const c of columns) {\n byFullId.set(c.id, c);\n const pid = extractPObjectId(c.id);\n if (!byPObjectId.has(pid)) byPObjectId.set(pid, c);\n }\n\n return (ref: PTableColumnId): PTableColumnId | undefined => {\n if (ref.type === \"axis\") {\n return axisIds.some((a) => matchAxisId(ref.id, a)) ? ref : undefined;\n }\n const hit = byFullId.get(ref.id) ?? byPObjectId.get(extractPObjectId(ref.id));\n if (hit === undefined) return undefined;\n return { type: \"column\", id: hit.id } satisfies PTableColumnIdColumn;\n };\n}\n"],"mappings":";;AAsBA,SAAgB,qBAAqB,SAAyC;CAC5E,MAAM,UAAoB,CAAC;CAC3B,KAAK,MAAM,KAAK,SACd,KAAK,MAAM,MAAM,EAAE,QAAQ,CAAC,CAAC,UAC3B,QAAQ,MAAA,GAAKA,gCAAAA,UAAAA,CAAU,EAAE,CAAC;CAI9B,MAAM,2BAAW,IAAI,IAAqC;CAC1D,MAAM,8BAAc,IAAI,IAA6B;CACrD,KAAK,MAAM,KAAK,SAAS;EACvB,SAAS,IAAI,EAAE,IAAI,CAAC;EACpB,MAAM,OAAA,GAAMC,gCAAAA,iBAAAA,CAAiB,EAAE,EAAE;EACjC,IAAI,CAAC,YAAY,IAAI,GAAG,GAAG,YAAY,IAAI,KAAK,CAAC;CACnD;CAEA,QAAQ,QAAoD;EAC1D,IAAI,IAAI,SAAS,QACf,OAAO,QAAQ,MAAM,OAAA,GAAMC,gCAAAA,YAAAA,CAAY,IAAI,IAAI,CAAC,CAAC,IAAI,MAAM,KAAA;EAE7D,MAAM,MAAM,SAAS,IAAI,IAAI,EAAE,KAAK,YAAY,KAAA,GAAID,gCAAAA,iBAAAA,CAAiB,IAAI,EAAE,CAAC;EAC5E,IAAI,QAAQ,KAAA,GAAW,OAAO,KAAA;EAC9B,OAAO;GAAE,MAAM;GAAU,IAAI,IAAI;EAAG;CACtC;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { extractPObjectId, getAxisId, matchAxisId } from "@milaboratories/pl-model-common";
|
|
2
|
-
|
|
2
|
+
// src/components/PlDataTable/columnResolver.ts
|
|
3
3
|
function createColumnResolver(columns) {
|
|
4
4
|
const axisIds = [];
|
|
5
5
|
for (const c of columns) for (const ax of c.getSpec().axesSpec) axisIds.push(getAxisId(ax));
|
|
@@ -20,7 +20,6 @@ function createColumnResolver(columns) {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
//#endregion
|
|
24
23
|
export { createColumnResolver };
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=columnResolver.js.map
|
|
@@ -3,7 +3,7 @@ require("../../../columns/index.cjs");
|
|
|
3
3
|
const require_createPTableDefV3 = require("./createPTableDefV3.cjs");
|
|
4
4
|
let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
|
|
5
5
|
let es_toolkit = require("es-toolkit");
|
|
6
|
-
|
|
6
|
+
// src/components/PlDataTable/createPlDataTable/createPTableDefV2.ts
|
|
7
7
|
function createPTableDefV2(params) {
|
|
8
8
|
let coreColumns = params.columns;
|
|
9
9
|
const secondaryColumns = [];
|
|
@@ -21,7 +21,6 @@ function createPTableDefV2(params) {
|
|
|
21
21
|
sorting: params.sorting
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
//#endregion
|
|
25
24
|
exports.createPTableDefV2 = createPTableDefV2;
|
|
26
25
|
|
|
27
26
|
//# sourceMappingURL=createPTableDefV2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPTableDefV2.cjs","names":["createPTableDefV3","DataColumn"],"sources":["../../../../src/components/PlDataTable/createPlDataTable/createPTableDefV2.ts"],"sourcesContent":["import type {\n ColumnUniversalId,\n PColumn,\n PColumnIdAndSpec,\n PTableSorting,\n PTableDefV2,\n} from \"@milaboratories/pl-model-common\";\nimport { getColumnIdAndSpec } from \"@milaboratories/pl-model-common\";\nimport type { PColumnDataUniversal } from \"../../../render\";\nimport { isFunction } from \"es-toolkit\";\nimport type { PlDataTableFilters } from \"../typesV8\";\nimport { createPTableDefV3 } from \"./createPTableDefV3\";\nimport { DataColumn } from \"../../../columns\";\n\nexport function createPTableDefV2(params: {\n columns: PColumn<undefined | PColumnDataUniversal>[];\n labelColumns: PColumn<undefined | PColumnDataUniversal>[];\n coreJoinType: \"inner\" | \"full\";\n filters: null | PlDataTableFilters;\n sorting: PTableSorting[];\n coreColumnPredicate?: (spec: PColumnIdAndSpec) => boolean;\n}): PTableDefV2<ColumnUniversalId> {\n let coreColumns = params.columns;\n const secondaryColumns: typeof params.columns = [];\n\n if (isFunction(params.coreColumnPredicate)) {\n coreColumns = [];\n for (const c of params.columns)\n if (params.coreColumnPredicate(getColumnIdAndSpec(c))) coreColumns.push(c);\n else secondaryColumns.push(c);\n }\n\n secondaryColumns.push(...params.labelColumns);\n\n return createPTableDefV3({\n primary: coreColumns.map((column) => DataColumn.fromColumn(column)),\n secondary: secondaryColumns.map((column) => DataColumn.fromColumn(column)),\n primaryJoinType: params.coreJoinType,\n filters: params.filters,\n sorting: params.sorting,\n });\n}\n"],"mappings":";;;;;;AAcA,SAAgB,kBAAkB,QAOC;CACjC,IAAI,cAAc,OAAO;CACzB,MAAM,mBAA0C,CAAC;CAEjD,KAAA,
|
|
1
|
+
{"version":3,"file":"createPTableDefV2.cjs","names":["isFunction","getColumnIdAndSpec","createPTableDefV3","DataColumn"],"sources":["../../../../src/components/PlDataTable/createPlDataTable/createPTableDefV2.ts"],"sourcesContent":["import type {\n ColumnUniversalId,\n PColumn,\n PColumnIdAndSpec,\n PTableSorting,\n PTableDefV2,\n} from \"@milaboratories/pl-model-common\";\nimport { getColumnIdAndSpec } from \"@milaboratories/pl-model-common\";\nimport type { PColumnDataUniversal } from \"../../../render\";\nimport { isFunction } from \"es-toolkit\";\nimport type { PlDataTableFilters } from \"../typesV8\";\nimport { createPTableDefV3 } from \"./createPTableDefV3\";\nimport { DataColumn } from \"../../../columns\";\n\nexport function createPTableDefV2(params: {\n columns: PColumn<undefined | PColumnDataUniversal>[];\n labelColumns: PColumn<undefined | PColumnDataUniversal>[];\n coreJoinType: \"inner\" | \"full\";\n filters: null | PlDataTableFilters;\n sorting: PTableSorting[];\n coreColumnPredicate?: (spec: PColumnIdAndSpec) => boolean;\n}): PTableDefV2<ColumnUniversalId> {\n let coreColumns = params.columns;\n const secondaryColumns: typeof params.columns = [];\n\n if (isFunction(params.coreColumnPredicate)) {\n coreColumns = [];\n for (const c of params.columns)\n if (params.coreColumnPredicate(getColumnIdAndSpec(c))) coreColumns.push(c);\n else secondaryColumns.push(c);\n }\n\n secondaryColumns.push(...params.labelColumns);\n\n return createPTableDefV3({\n primary: coreColumns.map((column) => DataColumn.fromColumn(column)),\n secondary: secondaryColumns.map((column) => DataColumn.fromColumn(column)),\n primaryJoinType: params.coreJoinType,\n filters: params.filters,\n sorting: params.sorting,\n });\n}\n"],"mappings":";;;;;;AAcA,SAAgB,kBAAkB,QAOC;CACjC,IAAI,cAAc,OAAO;CACzB,MAAM,mBAA0C,CAAC;CAEjD,KAAA,GAAIA,WAAAA,WAAAA,CAAW,OAAO,mBAAmB,GAAG;EAC1C,cAAc,CAAC;EACf,KAAK,MAAM,KAAK,OAAO,SACrB,IAAI,OAAO,qBAAA,GAAoBC,gCAAAA,mBAAAA,CAAmB,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC;OACpE,iBAAiB,KAAK,CAAC;CAChC;CAEA,iBAAiB,KAAK,GAAG,OAAO,YAAY;CAE5C,OAAOC,0BAAAA,kBAAkB;EACvB,SAAS,YAAY,KAAK,WAAWC,oBAAAA,WAAW,WAAW,MAAM,CAAC;EAClE,WAAW,iBAAiB,KAAK,WAAWA,oBAAAA,WAAW,WAAW,MAAM,CAAC;EACzE,iBAAiB,OAAO;EACxB,SAAS,OAAO;EAChB,SAAS,OAAO;CAClB,CAAC;AACH"}
|
|
@@ -3,7 +3,7 @@ import "../../../columns/index.js";
|
|
|
3
3
|
import { createPTableDefV3 } from "./createPTableDefV3.js";
|
|
4
4
|
import { getColumnIdAndSpec } from "@milaboratories/pl-model-common";
|
|
5
5
|
import { isFunction } from "es-toolkit";
|
|
6
|
-
|
|
6
|
+
// src/components/PlDataTable/createPlDataTable/createPTableDefV2.ts
|
|
7
7
|
function createPTableDefV2(params) {
|
|
8
8
|
let coreColumns = params.columns;
|
|
9
9
|
const secondaryColumns = [];
|
|
@@ -21,7 +21,6 @@ function createPTableDefV2(params) {
|
|
|
21
21
|
sorting: params.sorting
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
//#endregion
|
|
25
24
|
export { createPTableDefV2 };
|
|
26
25
|
|
|
27
26
|
//# sourceMappingURL=createPTableDefV2.js.map
|