@perses-dev/plugin-system 0.55.0-beta.1 → 0.55.0-beta.11
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/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts +3 -3
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts.map +1 -1
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +11 -11
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js.map +1 -1
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts +3 -3
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts.map +1 -1
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +6 -6
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js.map +1 -1
- package/dist/components/Annotations/AnnotationEditorForm/index.js +1 -1
- package/dist/components/Annotations/AnnotationEditorForm/index.js.map +1 -1
- package/dist/components/Annotations/index.js +2 -2
- package/dist/components/Annotations/index.js.map +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.d.ts +2 -2
- package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js +2 -2
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
- package/dist/components/CalculationSelector/index.js +1 -1
- package/dist/components/CalculationSelector/index.js.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +3 -2
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +10 -9
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/DatasourceEditorForm/index.js +1 -1
- package/dist/components/DatasourceEditorForm/index.js.map +1 -1
- package/dist/components/DatasourceSelect/DatasourceSelect.d.ts +4 -4
- package/dist/components/DatasourceSelect/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect/DatasourceSelect.js +7 -7
- package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -1
- package/dist/components/DatasourceSelect/index.js +1 -1
- package/dist/components/DatasourceSelect/index.js.map +1 -1
- package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.d.ts +8 -0
- package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.d.ts.map +1 -0
- package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.js +45 -0
- package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.js.map +1 -0
- package/dist/components/DatasourceTestConnectionButton/index.d.ts +2 -0
- package/dist/components/DatasourceTestConnectionButton/index.d.ts.map +1 -0
- package/dist/{cjs/model/alerts-queries.js → components/DatasourceTestConnectionButton/index.js} +3 -4
- package/dist/components/DatasourceTestConnectionButton/index.js.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.d.ts +10 -0
- package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.d.ts.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.js +99 -0
- package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.js.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +4 -2
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +91 -41
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
- package/dist/components/HTTPSettingsEditor/index.js +1 -1
- package/dist/components/HTTPSettingsEditor/index.js.map +1 -1
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts +1 -1
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts.map +1 -1
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +28 -28
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -1
- package/dist/components/ItemSelectionActionsOptionsEditor/index.js +1 -1
- package/dist/components/ItemSelectionActionsOptionsEditor/index.js.map +1 -1
- package/dist/components/LayoutEditor/LayoutEditor.d.ts +16 -0
- package/dist/components/LayoutEditor/LayoutEditor.d.ts.map +1 -0
- package/dist/components/LayoutEditor/LayoutEditor.js +115 -0
- package/dist/components/LayoutEditor/LayoutEditor.js.map +1 -0
- package/dist/components/LayoutEditor/RepeatLayoutPreview.d.ts +7 -0
- package/dist/components/LayoutEditor/RepeatLayoutPreview.d.ts.map +1 -0
- package/dist/components/LayoutEditor/RepeatLayoutPreview.js +92 -0
- package/dist/components/LayoutEditor/RepeatLayoutPreview.js.map +1 -0
- package/dist/components/LayoutEditor/RepeatVariableEditor.d.ts +18 -0
- package/dist/components/LayoutEditor/RepeatVariableEditor.d.ts.map +1 -0
- package/dist/components/LayoutEditor/RepeatVariableEditor.js +168 -0
- package/dist/components/LayoutEditor/RepeatVariableEditor.js.map +1 -0
- package/dist/components/LayoutEditor/index.d.ts +4 -0
- package/dist/components/LayoutEditor/index.d.ts.map +1 -0
- package/dist/{cjs/model/explore.js → components/LayoutEditor/index.js} +5 -4
- package/dist/components/LayoutEditor/index.js.map +1 -0
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +2 -2
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +5 -5
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/LegendOptionsEditor/index.js +1 -1
- package/dist/components/LegendOptionsEditor/index.js.map +1 -1
- package/dist/components/LinksEditor/LinksEditor.d.ts +3 -3
- package/dist/components/LinksEditor/LinksEditor.d.ts.map +1 -1
- package/dist/components/LinksEditor/LinksEditor.js +6 -6
- package/dist/components/LinksEditor/LinksEditor.js.map +1 -1
- package/dist/components/LinksEditor/index.js +1 -1
- package/dist/components/LinksEditor/index.js.map +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.d.ts +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.d.ts.map +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.js +2 -2
- package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
- package/dist/components/MetricLabelInput/index.js +1 -1
- package/dist/components/MetricLabelInput/index.js.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +3 -4
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js +27 -9
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +3 -4
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js +14 -14
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
- package/dist/components/MultiQueryEditor/index.js +2 -2
- package/dist/components/MultiQueryEditor/index.js.map +1 -1
- package/dist/components/MultiQueryEditor/utils.d.ts +1 -1
- package/dist/components/MultiQueryEditor/utils.d.ts.map +1 -1
- package/dist/components/MultiQueryEditor/utils.js.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +4 -4
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
- package/dist/components/OptionsEditorRadios/index.js +1 -1
- package/dist/components/OptionsEditorRadios/index.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/index.js +1 -1
- package/dist/components/OptionsEditorTabPanel/index.js.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +4 -4
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/OptionsEditorTabs/index.js +1 -1
- package/dist/components/OptionsEditorTabs/index.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.d.ts +2 -2
- package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.js +9 -9
- package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +8 -5
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +27 -12
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PanelSpecEditor/index.js +1 -1
- package/dist/components/PanelSpecEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts +2 -2
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +10 -9
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/index.js +2 -2
- package/dist/components/PluginEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +10 -3
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +10 -5
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +17 -4
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +191 -27
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginKindSelect/index.js +1 -1
- package/dist/components/PluginKindSelect/index.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.d.ts +2 -2
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +71 -8
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts +2 -2
- package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts.map +1 -1
- package/dist/components/PluginRegistry/getPluginSearchHelper.js +2 -2
- package/dist/components/PluginRegistry/getPluginSearchHelper.js.map +1 -1
- package/dist/components/PluginRegistry/index.js +1 -1
- package/dist/components/PluginRegistry/index.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.d.ts +3 -1
- package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +9 -4
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/DatasourceSpecEditor.d.ts +10 -0
- package/dist/components/PluginSpecEditor/DatasourceSpecEditor.d.ts.map +1 -0
- package/dist/components/PluginSpecEditor/DatasourceSpecEditor.js +62 -0
- package/dist/components/PluginSpecEditor/DatasourceSpecEditor.js.map +1 -0
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +5 -4
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js +24 -6
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/PluginSpecEditor/index.js +1 -1
- package/dist/components/PluginSpecEditor/index.js.map +1 -1
- package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts +1 -1
- package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts.map +1 -1
- package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js +3 -3
- package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js.map +1 -1
- package/dist/components/SelectionOptionsEditor/index.js +1 -1
- package/dist/components/SelectionOptionsEditor/index.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +4 -4
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +18 -55
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/TimeRangeControls/index.js +1 -1
- package/dist/components/TimeRangeControls/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +3 -3
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +11 -11
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -2
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +8 -7
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js +3 -3
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +2 -2
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -6
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/index.js +2 -2
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/components/Variables/variable-model.d.ts +8 -8
- package/dist/components/Variables/variable-model.d.ts.map +1 -1
- package/dist/components/Variables/variable-model.js +10 -5
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +21 -19
- package/dist/components/index.js.map +1 -1
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +2 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/repeat.d.ts +3 -0
- package/dist/constants/repeat.d.ts.map +1 -0
- package/dist/{cjs/model/datasource.js → constants/repeat.js} +4 -4
- package/dist/constants/repeat.js.map +1 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/context/ValidationProvider.d.ts +9 -9
- package/dist/context/ValidationProvider.d.ts.map +1 -1
- package/dist/context/ValidationProvider.js +6 -6
- package/dist/context/ValidationProvider.js.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/model/alerts-queries.d.ts +4 -4
- package/dist/model/alerts-queries.d.ts.map +1 -1
- package/dist/model/alerts-queries.js.map +1 -1
- package/dist/model/annotations.d.ts +3 -3
- package/dist/model/annotations.d.ts.map +1 -1
- package/dist/model/annotations.js.map +1 -1
- package/dist/model/calculations.d.ts +1 -1
- package/dist/model/calculations.d.ts.map +1 -1
- package/dist/model/calculations.js.map +1 -1
- package/dist/model/datasource.d.ts +10 -3
- package/dist/model/datasource.d.ts.map +1 -1
- package/dist/model/datasource.js +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/explore.d.ts +2 -3
- package/dist/model/explore.d.ts.map +1 -1
- package/dist/model/explore.js.map +1 -1
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +17 -16
- package/dist/model/index.js.map +1 -1
- package/dist/model/json-queries.d.ts +29 -0
- package/dist/model/json-queries.d.ts.map +1 -0
- package/dist/{cjs/model/annotations.js → model/json-queries.js} +5 -4
- package/dist/model/json-queries.js.map +1 -0
- package/dist/model/legend.d.ts +3 -3
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js +2 -2
- package/dist/model/legend.js.map +1 -1
- package/dist/model/log-queries.d.ts +3 -3
- package/dist/model/log-queries.d.ts.map +1 -1
- package/dist/model/log-queries.js.map +1 -1
- package/dist/model/panels.d.ts +13 -4
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-base.d.ts +3 -3
- package/dist/model/plugin-base.d.ts.map +1 -1
- package/dist/model/plugin-base.js.map +1 -1
- package/dist/model/plugin-loading.d.ts +1 -1
- package/dist/model/plugin-loading.d.ts.map +1 -1
- package/dist/model/plugin-loading.js +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/model/plugins.d.ts +26 -13
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/profile-queries.d.ts +4 -4
- package/dist/model/profile-queries.d.ts.map +1 -1
- package/dist/model/profile-queries.js.map +1 -1
- package/dist/model/silences-queries.d.ts +4 -4
- package/dist/model/silences-queries.d.ts.map +1 -1
- package/dist/model/silences-queries.js.map +1 -1
- package/dist/model/time-series-queries.d.ts +4 -4
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/model/trace-queries.d.ts +4 -4
- package/dist/model/trace-queries.d.ts.map +1 -1
- package/dist/model/trace-queries.js.map +1 -1
- package/dist/model/variables.d.ts +7 -3
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js +1 -3
- package/dist/model/variables.js.map +1 -1
- package/dist/remote/PluginLoaderComponent.d.ts +1 -2
- package/dist/remote/PluginLoaderComponent.d.ts.map +1 -1
- package/dist/remote/PluginLoaderComponent.js +2 -2
- package/dist/remote/PluginLoaderComponent.js.map +1 -1
- package/dist/remote/PluginRuntime.d.ts +11 -2
- package/dist/remote/PluginRuntime.d.ts.map +1 -1
- package/dist/remote/PluginRuntime.js +84 -79
- package/dist/remote/PluginRuntime.js.map +1 -1
- package/dist/remote/index.d.ts +1 -0
- package/dist/remote/index.d.ts.map +1 -1
- package/dist/remote/index.js +3 -2
- package/dist/remote/index.js.map +1 -1
- package/dist/remote/remotePluginLoader.d.ts +2 -2
- package/dist/remote/remotePluginLoader.d.ts.map +1 -1
- package/dist/remote/remotePluginLoader.js +3 -3
- package/dist/remote/remotePluginLoader.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +3 -3
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +20 -12
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/index.js +2 -2
- package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +3 -3
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/RouterProvider.d.ts +2 -1
- package/dist/runtime/RouterProvider.d.ts.map +1 -1
- package/dist/runtime/RouterProvider.js +3 -3
- package/dist/runtime/RouterProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +3 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +22 -8
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts +3 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js +5 -5
- package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +13 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +65 -4
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/index.js +4 -4
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts +3 -3
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +4 -4
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.js +2 -2
- package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
- package/dist/runtime/UsageMetricsProvider.d.ts +3 -3
- package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
- package/dist/runtime/UsageMetricsProvider.js +3 -3
- package/dist/runtime/UsageMetricsProvider.js.map +1 -1
- package/dist/runtime/alerts-queries.d.ts +2 -2
- package/dist/runtime/alerts-queries.d.ts.map +1 -1
- package/dist/runtime/alerts-queries.js +11 -7
- package/dist/runtime/alerts-queries.js.map +1 -1
- package/dist/runtime/annotations.d.ts +2 -2
- package/dist/runtime/annotations.d.ts.map +1 -1
- package/dist/runtime/annotations.js +16 -9
- package/dist/runtime/annotations.js.map +1 -1
- package/dist/runtime/builtin-variables.d.ts +2 -3
- package/dist/runtime/builtin-variables.d.ts.map +1 -1
- package/dist/runtime/builtin-variables.js +1 -1
- package/dist/runtime/builtin-variables.js.map +1 -1
- package/dist/runtime/datasources.d.ts +2 -3
- package/dist/runtime/datasources.d.ts.map +1 -1
- package/dist/runtime/datasources.js +2 -2
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +16 -15
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/item-actions.d.ts +3 -3
- package/dist/runtime/item-actions.d.ts.map +1 -1
- package/dist/runtime/item-actions.js +2 -2
- package/dist/runtime/item-actions.js.map +1 -1
- package/dist/runtime/json-queries.d.ts +11 -0
- package/dist/runtime/json-queries.d.ts.map +1 -0
- package/dist/runtime/json-queries.js +58 -0
- package/dist/runtime/json-queries.js.map +1 -0
- package/dist/runtime/log-queries.d.ts +3 -3
- package/dist/runtime/log-queries.d.ts.map +1 -1
- package/dist/runtime/log-queries.js +8 -6
- package/dist/runtime/log-queries.js.map +1 -1
- package/dist/runtime/plugin-registry.d.ts +24 -11
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +54 -18
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/profile-queries.d.ts +2 -2
- package/dist/runtime/profile-queries.d.ts.map +1 -1
- package/dist/runtime/profile-queries.js +7 -5
- package/dist/runtime/profile-queries.js.map +1 -1
- package/dist/runtime/silences-queries.d.ts +2 -2
- package/dist/runtime/silences-queries.d.ts.map +1 -1
- package/dist/runtime/silences-queries.js +11 -7
- package/dist/runtime/silences-queries.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts +3 -3
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +16 -9
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.d.ts +2 -2
- package/dist/runtime/trace-queries.d.ts.map +1 -1
- package/dist/runtime/trace-queries.js +12 -8
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/runtime/utils.d.ts +1 -1
- package/dist/runtime/utils.d.ts.map +1 -1
- package/dist/runtime/utils.js.map +1 -1
- package/dist/runtime/variables.d.ts +7 -2
- package/dist/runtime/variables.d.ts.map +1 -1
- package/dist/runtime/variables.js +20 -4
- package/dist/runtime/variables.js.map +1 -1
- package/dist/schema/index.js +1 -1
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/panel.d.ts +4 -4
- package/dist/schema/panel.d.ts.map +1 -1
- package/dist/schema/panel.js +18 -4
- package/dist/schema/panel.js.map +1 -1
- package/dist/test/index.js +2 -2
- package/dist/test/index.js.map +1 -1
- package/dist/test/mock-data.d.ts +14 -13
- package/dist/test/mock-data.d.ts.map +1 -1
- package/dist/test/mock-data.js +6 -0
- package/dist/test/mock-data.js.map +1 -1
- package/dist/test/render-hook.d.ts +2 -2
- package/dist/test/render-hook.d.ts.map +1 -1
- package/dist/test/render-hook.js +2 -2
- package/dist/test/render-hook.js.map +1 -1
- package/dist/test/render.d.ts +3 -3
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +3 -3
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.d.ts +1 -1
- package/dist/test/setup-tests.d.ts.map +1 -1
- package/dist/test/setup-tests.js +3 -2
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/test-plugins/bert/index.d.ts +3 -3
- package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test/test-plugins/ernie/index.d.ts +7 -1
- package/dist/test/test-plugins/ernie/index.d.ts.map +1 -1
- package/dist/test/test-plugins/ernie/index.js +58 -1
- package/dist/test/test-plugins/ernie/index.js.map +1 -1
- package/dist/test/test-plugins/index.d.ts +1 -1
- package/dist/test/test-plugins/index.d.ts.map +1 -1
- package/dist/test/test-plugins/index.js +5 -5
- package/dist/test/test-plugins/index.js.map +1 -1
- package/dist/test/utils.d.ts +2 -2
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +5 -5
- package/dist/test/utils.js.map +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.d.ts +2 -2
- package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +1 -1
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/dist/utils/csv-export.d.ts.map +1 -1
- package/dist/utils/csv-export.js +2 -2
- package/dist/utils/csv-export.js.map +1 -1
- package/dist/utils/event.js +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/plugin-versions.d.ts +18 -0
- package/dist/utils/plugin-versions.d.ts.map +1 -0
- package/dist/utils/plugin-versions.js +52 -0
- package/dist/utils/plugin-versions.js.map +1 -0
- package/dist/utils/variables.js +1 -1
- package/package.json +18 -17
- package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +0 -283
- package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +0 -197
- package/dist/cjs/components/Annotations/AnnotationEditorForm/index.js +0 -30
- package/dist/cjs/components/Annotations/constants.js +0 -23
- package/dist/cjs/components/Annotations/index.js +0 -31
- package/dist/cjs/components/CalculationSelector/CalculationSelector.js +0 -49
- package/dist/cjs/components/CalculationSelector/index.js +0 -30
- package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +0 -270
- package/dist/cjs/components/DatasourceEditorForm/index.js +0 -30
- package/dist/cjs/components/DatasourceSelect/DatasourceSelect.js +0 -266
- package/dist/cjs/components/DatasourceSelect/index.js +0 -30
- package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +0 -568
- package/dist/cjs/components/HTTPSettingsEditor/index.js +0 -30
- package/dist/cjs/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +0 -1175
- package/dist/cjs/components/ItemSelectionActionsOptionsEditor/index.js +0 -30
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +0 -211
- package/dist/cjs/components/LegendOptionsEditor/index.js +0 -30
- package/dist/cjs/components/LinksEditor/LinksEditor.js +0 -162
- package/dist/cjs/components/LinksEditor/index.js +0 -30
- package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +0 -41
- package/dist/cjs/components/MetricLabelInput/index.js +0 -30
- package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +0 -159
- package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +0 -250
- package/dist/cjs/components/MultiQueryEditor/index.js +0 -31
- package/dist/cjs/components/MultiQueryEditor/utils.js +0 -36
- package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +0 -69
- package/dist/cjs/components/OptionsEditorRadios/index.js +0 -30
- package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +0 -39
- package/dist/cjs/components/OptionsEditorTabPanel/index.js +0 -30
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +0 -61
- package/dist/cjs/components/OptionsEditorTabs/index.js +0 -30
- package/dist/cjs/components/PanelSpecEditor/PanelAnnotationsEditor.js +0 -246
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +0 -132
- package/dist/cjs/components/PanelSpecEditor/index.js +0 -30
- package/dist/cjs/components/PluginEditor/PluginEditor.js +0 -98
- package/dist/cjs/components/PluginEditor/index.js +0 -31
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +0 -136
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +0 -109
- package/dist/cjs/components/PluginKindSelect/index.js +0 -30
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +0 -86
- package/dist/cjs/components/PluginRegistry/getPluginSearchHelper.js +0 -92
- package/dist/cjs/components/PluginRegistry/index.js +0 -30
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +0 -88
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +0 -55
- package/dist/cjs/components/PluginSpecEditor/index.js +0 -30
- package/dist/cjs/components/SelectionOptionsEditor/SelectionOptionsEditor.js +0 -43
- package/dist/cjs/components/SelectionOptionsEditor/index.js +0 -30
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +0 -236
- package/dist/cjs/components/TimeRangeControls/index.js +0 -30
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +0 -613
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +0 -193
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +0 -32
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +0 -143
- package/dist/cjs/components/Variables/index.js +0 -31
- package/dist/cjs/components/Variables/variable-model.js +0 -211
- package/dist/cjs/components/index.js +0 -48
- package/dist/cjs/constants/index.js +0 -30
- package/dist/cjs/constants/user-interface-text.js +0 -32
- package/dist/cjs/context/ValidationProvider.js +0 -77
- package/dist/cjs/context/index.js +0 -30
- package/dist/cjs/index.js +0 -38
- package/dist/cjs/model/calculations.js +0 -178
- package/dist/cjs/model/index.js +0 -45
- package/dist/cjs/model/legend.js +0 -111
- package/dist/cjs/model/log-queries.js +0 -16
- package/dist/cjs/model/log-volume-utils.js +0 -124
- package/dist/cjs/model/panels.js +0 -16
- package/dist/cjs/model/plugin-base.js +0 -16
- package/dist/cjs/model/plugin-loading.js +0 -56
- package/dist/cjs/model/plugins.js +0 -26
- package/dist/cjs/model/profile-queries.js +0 -16
- package/dist/cjs/model/silences-queries.js +0 -16
- package/dist/cjs/model/time-series-queries.js +0 -26
- package/dist/cjs/model/trace-queries.js +0 -16
- package/dist/cjs/model/variables.js +0 -16
- package/dist/cjs/remote/PersesPlugin.types.js +0 -16
- package/dist/cjs/remote/PluginLoaderComponent.js +0 -87
- package/dist/cjs/remote/PluginRuntime.js +0 -331
- package/dist/cjs/remote/index.js +0 -31
- package/dist/cjs/remote/remotePluginLoader.js +0 -101
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +0 -154
- package/dist/cjs/runtime/DataQueriesProvider/index.js +0 -31
- package/dist/cjs/runtime/DataQueriesProvider/model.js +0 -34
- package/dist/cjs/runtime/RouterProvider.js +0 -114
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +0 -201
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviders.js +0 -66
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +0 -113
- package/dist/cjs/runtime/TimeRangeProvider/index.js +0 -33
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +0 -250
- package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +0 -30
- package/dist/cjs/runtime/UsageMetricsProvider.js +0 -102
- package/dist/cjs/runtime/alerts-queries.js +0 -101
- package/dist/cjs/runtime/annotations.js +0 -148
- package/dist/cjs/runtime/builtin-variables.js +0 -81
- package/dist/cjs/runtime/datasources.js +0 -80
- package/dist/cjs/runtime/index.js +0 -44
- package/dist/cjs/runtime/item-actions.js +0 -302
- package/dist/cjs/runtime/log-queries.js +0 -76
- package/dist/cjs/runtime/plugin-registry.js +0 -135
- package/dist/cjs/runtime/profile-queries.js +0 -73
- package/dist/cjs/runtime/silences-queries.js +0 -101
- package/dist/cjs/runtime/time-series-queries.js +0 -165
- package/dist/cjs/runtime/trace-queries.js +0 -106
- package/dist/cjs/runtime/utils.js +0 -39
- package/dist/cjs/runtime/variables.js +0 -160
- package/dist/cjs/schema/index.js +0 -30
- package/dist/cjs/schema/panel.js +0 -42
- package/dist/cjs/test/index.js +0 -31
- package/dist/cjs/test/mock-data.js +0 -357
- package/dist/cjs/test/render-hook.js +0 -31
- package/dist/cjs/test/render.js +0 -31
- package/dist/cjs/test/setup-tests.js +0 -20
- package/dist/cjs/test/test-plugins/bert/index.js +0 -99
- package/dist/cjs/test/test-plugins/ernie/index.js +0 -92
- package/dist/cjs/test/test-plugins/index.js +0 -81
- package/dist/cjs/test/utils.js +0 -58
- package/dist/cjs/test-utils/index.js +0 -30
- package/dist/cjs/test-utils/mock-plugin-registry.js +0 -81
- package/dist/cjs/utils/csv-export.js +0 -248
- package/dist/cjs/utils/event.js +0 -30
- package/dist/cjs/utils/index.js +0 -32
- package/dist/cjs/utils/variables.js +0 -44
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/test/test-plugins/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/test/test-plugins/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { PluginLoader, PluginModuleResource } from '../../model';\nimport { dynamicImportPluginLoader } from '../../model';\nimport bertResource from './bert/plugin.json';\nimport ernieResource from './ernie/plugin.json';\n\n/**\n * A PluginLoader for tests that will dynamically load the plugins in this folder.\n */\nexport const testPluginLoader: PluginLoader = dynamicImportPluginLoader([\n { resource: bertResource as PluginModuleResource, importPlugin: () => import('./bert').then((m) => m.plugins) },\n { resource: ernieResource as PluginModuleResource, importPlugin: () => import('./ernie').then((m) => m.plugins) },\n]);\n"],"names":["dynamicImportPluginLoader","bertResource","ernieResource","testPluginLoader","resource","importPlugin","then","m","plugins"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,yBAAyB,QAAQ,uBAAc;AACxD,OAAOC,kBAAkB,qBAAqB;AAC9C,OAAOC,mBAAmB,sBAAsB;AAEhD;;CAEC,GACD,OAAO,MAAMC,mBAAiCH,0BAA0B;IACtE;QAAEI,UAAUH;QAAsCI,cAAc,IAAM,MAAM,CAAC,mBAAUC,IAAI,CAAC,CAACC,IAAMA,EAAEC,OAAO;IAAE;IAC9G;QAAEJ,UAAUF;QAAuCG,cAAc,IAAM,MAAM,CAAC,oBAAWC,IAAI,CAAC,CAACC,IAAMA,EAAEC,OAAO;IAAE;CACjH,EAAE"}
|
package/dist/test/utils.d.ts
CHANGED
package/dist/test/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test/utils.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test/utils.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,MAAM,MAAM,cAAc,GAAG;IAC3B,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,cAAc,CAAC,EAAE,cAAc,kBAQ7B;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,KAAG,SAAS,CAkB1E"}
|
package/dist/test/utils.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
// Copyright The Perses Authors
|
|
3
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
3
|
// you may not use this file except in compliance with the License.
|
|
@@ -11,10 +10,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
11
|
// See the License for the specific language governing permissions and
|
|
13
12
|
// limitations under the License.
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
15
|
+
import { PluginRegistry } from "../components/index.js";
|
|
16
|
+
import { TimeRangeProviderBasic } from "../runtime/index.js";
|
|
17
|
+
import { testPluginLoader } from "./test-plugins/index.js";
|
|
18
18
|
export function getTestContextWrapper(contextOptions) {
|
|
19
19
|
// Create a new QueryClient for each test to avoid caching issues
|
|
20
20
|
const queryClient = new QueryClient({
|
package/dist/test/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/utils.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/test/utils.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { DurationString } from '@perses-dev/spec';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport type { ReactNode } from 'react';\n\nimport { PluginRegistry } from '../components';\nimport type { DefaultPluginKinds } from '../model';\nimport { TimeRangeProviderBasic } from '../runtime';\nimport { testPluginLoader } from './test-plugins';\n\nexport type ContextOptions = {\n defaultPluginKinds?: DefaultPluginKinds;\n};\n\nexport function getTestContextWrapper(contextOptions?: ContextOptions) {\n // Create a new QueryClient for each test to avoid caching issues\n const queryClient = new QueryClient({\n defaultOptions: { queries: { refetchOnWindowFocus: false, retry: false } },\n });\n const DEFAULT_DASHBOARD_DURATION: DurationString = '1h';\n const timeRange = { start: new Date(Date.now() - Number(DEFAULT_DASHBOARD_DURATION)), end: new Date() };\n\n return function Wrapper({ children }: { children: ReactNode }): ReactNode {\n return (\n <QueryClientProvider client={queryClient}>\n <TimeRangeProviderBasic initialTimeRange={timeRange}>\n <PluginRegistry\n pluginLoader={testPluginLoader}\n defaultPluginKinds={\n contextOptions?.defaultPluginKinds ?? {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n }\n }\n >\n {children}\n </PluginRegistry>\n </TimeRangeProviderBasic>\n </QueryClientProvider>\n );\n };\n}\n"],"names":["QueryClient","QueryClientProvider","PluginRegistry","TimeRangeProviderBasic","testPluginLoader","getTestContextWrapper","contextOptions","queryClient","defaultOptions","queries","refetchOnWindowFocus","retry","DEFAULT_DASHBOARD_DURATION","timeRange","start","Date","now","Number","end","Wrapper","children","client","initialTimeRange","pluginLoader","defaultPluginKinds","TimeSeriesQuery"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AAGzE,SAASC,cAAc,QAAQ,yBAAgB;AAE/C,SAASC,sBAAsB,QAAQ,sBAAa;AACpD,SAASC,gBAAgB,QAAQ,0BAAiB;AAMlD,OAAO,SAASC,sBAAsBC,cAA+B;IACnE,iEAAiE;IACjE,MAAMC,cAAc,IAAIP,YAAY;QAClCQ,gBAAgB;YAAEC,SAAS;gBAAEC,sBAAsB;gBAAOC,OAAO;YAAM;QAAE;IAC3E;IACA,MAAMC,6BAA6C;IACnD,MAAMC,YAAY;QAAEC,OAAO,IAAIC,KAAKA,KAAKC,GAAG,KAAKC,OAAOL;QAA8BM,KAAK,IAAIH;IAAO;IAEtG,OAAO,SAASI,QAAQ,EAAEC,QAAQ,EAA2B;QAC3D,qBACE,KAACnB;YAAoBoB,QAAQd;sBAC3B,cAAA,KAACJ;gBAAuBmB,kBAAkBT;0BACxC,cAAA,KAACX;oBACCqB,cAAcnB;oBACdoB,oBACElB,gBAAgBkB,sBAAsB;wBACpCC,iBAAiB;oBACnB;8BAGDL;;;;IAKX;AACF"}
|
package/dist/test-utils/index.js
CHANGED
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
export * from
|
|
13
|
+
export * from "./mock-plugin-registry.js";
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test-utils/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './mock-plugin-registry';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../src/test-utils/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './mock-plugin-registry';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,4BAAyB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PluginRegistryProps } from '../components';
|
|
2
|
-
import { PluginImplementation, PluginType } from '../model';
|
|
1
|
+
import type { PluginRegistryProps } from '../components';
|
|
2
|
+
import type { PluginImplementation, PluginType } from '../model';
|
|
3
3
|
export type MockPlugin = {
|
|
4
4
|
[T in PluginType]: {
|
|
5
5
|
kind: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-plugin-registry.d.ts","sourceRoot":"","sources":["../../src/test-utils/mock-plugin-registry.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mock-plugin-registry.d.ts","sourceRoot":"","sources":["../../src/test-utils/mock-plugin-registry.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAA8C,oBAAoB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG7G,MAAM,MAAM,UAAU,GAAG;KACtB,CAAC,IAAI,UAAU,GAAG;QACjB,IAAI,EAAE,CAAC,CAAC;QACR,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QACvB,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;KACjC;CACF,CAAC,UAAU,CAAC,CAAC;AAEd;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAiDtG;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAExE"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { getPluginModuleCompoundKey } from
|
|
13
|
+
import { getPluginModuleCompoundKey } from "../model/index.js";
|
|
14
14
|
/**
|
|
15
15
|
* Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`
|
|
16
16
|
* component so that it will load the mock plugins you provide.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test-utils/mock-plugin-registry.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/spec';\nimport { PluginRegistryProps } from '../components';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/test-utils/mock-plugin-registry.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { UnknownSpec } from '@perses-dev/spec';\n\nimport type { PluginRegistryProps } from '../components';\nimport type { PluginModuleResource, Plugin, PluginLoader, PluginImplementation, PluginType } from '../model';\nimport { getPluginModuleCompoundKey } from '../model';\n\nexport type MockPlugin = {\n [T in PluginType]: {\n kind: T;\n spec: { name: string };\n plugin: PluginImplementation<T>;\n };\n}[PluginType];\n\n/**\n * Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`\n * component so that it will load the mock plugins you provide.\n */\nexport function mockPluginRegistry(...mockPlugins: MockPlugin[]): Omit<PluginRegistryProps, 'children'> {\n const mockPluginResource: PluginModuleResource = {\n kind: 'PluginModule',\n metadata: {\n name: 'Fake Plugin Module for Tests',\n version: '1.0.0',\n },\n spec: {\n // Add metadata for all mock plugins\n plugins: mockPlugins.map(({ kind, spec: { name } }) => ({\n kind,\n spec: {\n name,\n display: {\n name: getMockPluginName(kind, name),\n },\n },\n })),\n },\n };\n\n const mockPluginModule: Record<string, Plugin<UnknownSpec>> = {};\n for (const mockPlugin of mockPlugins) {\n // \"Export\" on the module under the same name as the kind the plugin handles\n mockPluginModule[\n getPluginModuleCompoundKey({\n kind: mockPlugin.kind,\n name: mockPlugin.spec.name,\n registry: mockPluginResource.metadata.registry,\n version: mockPluginResource.metadata.version,\n })\n ] = mockPlugin.plugin;\n }\n\n const pluginLoader: PluginLoader = {\n getInstalledPlugins() {\n return Promise.resolve([mockPluginResource]);\n },\n importPluginModule(/* resource */) {\n return Promise.resolve(mockPluginModule);\n },\n };\n\n return {\n pluginLoader,\n defaultPluginKinds: {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n },\n };\n}\n\n/**\n * The function that's used to generate the display name of mocked plugins in mockPluginRegistry. Can be useful if you\n * need to interact with some UI component that's displaying it.\n */\nexport function getMockPluginName(kind: PluginType, name: string): string {\n return `${kind} Plugin for ${name}`;\n}\n"],"names":["getPluginModuleCompoundKey","mockPluginRegistry","mockPlugins","mockPluginResource","kind","metadata","name","version","spec","plugins","map","display","getMockPluginName","mockPluginModule","mockPlugin","registry","plugin","pluginLoader","getInstalledPlugins","Promise","resolve","importPluginModule","defaultPluginKinds","TimeSeriesQuery"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAMjC,SAASA,0BAA0B,QAAQ,oBAAW;AAUtD;;;CAGC,GACD,OAAO,SAASC,mBAAmB,GAAGC,WAAyB;IAC7D,MAAMC,qBAA2C;QAC/CC,MAAM;QACNC,UAAU;YACRC,MAAM;YACNC,SAAS;QACX;QACAC,MAAM;YACJ,oCAAoC;YACpCC,SAASP,YAAYQ,GAAG,CAAC,CAAC,EAAEN,IAAI,EAAEI,MAAM,EAAEF,IAAI,EAAE,EAAE,GAAM,CAAA;oBACtDF;oBACAI,MAAM;wBACJF;wBACAK,SAAS;4BACPL,MAAMM,kBAAkBR,MAAME;wBAChC;oBACF;gBACF,CAAA;QACF;IACF;IAEA,MAAMO,mBAAwD,CAAC;IAC/D,KAAK,MAAMC,cAAcZ,YAAa;QACpC,4EAA4E;QAC5EW,gBAAgB,CACdb,2BAA2B;YAC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OAAO,CAAC;CACtB;AAED,eAAO,MAAM,qBAAqB,iBAAkB,cAAc,EAAE,KAAG,cAAc,GAAG,SAoCvF,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,UAAU,eAAe,MAAM,KAAG,MA0C1E,CAAC;AAEF,eAAO,MAAM,kBAAkB,SAAU,MAAM,KAAG,MAOjD,CAAC;AAEF,eAAO,MAAM,gBAAgB,aAAc,MAAM,KAAG,MAanD,CAAC;AAEF,eAAO,MAAM,kBAAkB,cAAe,MAAM,GAAG,MAAM,KAAG,MAmB/D,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,OAAO,KAAG,MAiB/C,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,aAAc,iBAAiB,KAAG,IAsG7D,CAAC"}
|
package/dist/utils/csv-export.js
CHANGED
|
@@ -164,7 +164,7 @@ export const exportDataAsCSV = ({ data })=>{
|
|
|
164
164
|
if (!result[dateTime]) {
|
|
165
165
|
result[dateTime] = {};
|
|
166
166
|
}
|
|
167
|
-
/* linter complains, so assert result[dateTime]
|
|
167
|
+
/* linter complains, so assert result[dateTime]
|
|
168
168
|
It has already been checked by the if statement
|
|
169
169
|
*/ result[dateTime][currentSeriesInfo.columnName] = value;
|
|
170
170
|
}
|
|
@@ -188,7 +188,7 @@ export const exportDataAsCSV = ({ data })=>{
|
|
|
188
188
|
}
|
|
189
189
|
const columnNames = seriesInfo.map((info)=>info.columnName);
|
|
190
190
|
csvString += `DateTime,${columnNames.join(',')}\n`;
|
|
191
|
-
const sortedDateTimes = Object.keys(result).
|
|
191
|
+
const sortedDateTimes = Object.keys(result).toSorted((a, b)=>{
|
|
192
192
|
const dateA = new Date(a).getTime();
|
|
193
193
|
const dateB = new Date(b).getTime();
|
|
194
194
|
return dateA - dateB;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/csv-export.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport interface SeriesDataPoint {\n timestamp: number | string;\n value: unknown;\n}\n\nexport interface DataSeries {\n name?: string;\n formattedName?: string;\n legendName?: string;\n displayName?: string;\n legend?: string;\n labels?: Record<string, string>;\n values: Array<[number | string, unknown]> | SeriesDataPoint[];\n}\n\nexport interface ExportableData {\n series: DataSeries[];\n timeRange?: {\n start: string | number;\n end: string | number;\n };\n stepMs?: number;\n metadata?: Record<string, unknown>;\n}\n\nexport const isExportableData = (data: unknown): data is ExportableData => {\n return !!(\n data &&\n typeof data === 'object' &&\n 'series' in data &&\n Array.isArray((data as ExportableData).series) &&\n (data as ExportableData).series.length > 0\n );\n};\n\nexport interface QueryDataInput {\n data?: unknown;\n error?: unknown;\n isFetching?: boolean;\n}\n\nexport const extractExportableData = (queryResults: QueryDataInput[]): ExportableData | undefined => {\n if (!queryResults || queryResults.length === 0) return undefined;\n\n const allSeries: DataSeries[] = [];\n let timeRange: ExportableData['timeRange'] = undefined;\n let stepMs: number | undefined = undefined;\n let metadata: ExportableData['metadata'] = undefined;\n\n queryResults.forEach((query) => {\n if (query?.data && typeof query.data === 'object' && 'series' in query.data) {\n const data = query.data as ExportableData;\n if (data.series && Array.isArray(data.series) && data.series.length > 0) {\n allSeries.push(...data.series);\n if (!timeRange && data.timeRange) {\n timeRange = data.timeRange;\n }\n if (!stepMs && data.stepMs) {\n stepMs = data.stepMs;\n }\n if (!metadata && data.metadata) {\n metadata = data.metadata;\n }\n }\n }\n });\n\n if (allSeries.length > 0) {\n return {\n series: allSeries,\n timeRange,\n stepMs,\n metadata,\n };\n }\n\n return undefined;\n};\n\nexport const formatLegendName = (series: DataSeries, seriesIndex: number): string => {\n const seriesAny = series as DataSeries & {\n formattedName?: string;\n legendName?: string;\n displayName?: string;\n legend?: string;\n labels?: Record<string, string>;\n };\n\n let legendName = series.formattedName || series.name;\n\n if (!legendName || legendName === `Series ${seriesIndex + 1}`) {\n legendName = seriesAny.legendName || seriesAny.displayName || seriesAny.legend || series.name || '';\n }\n\n if ((!legendName || legendName === series.name) && series.labels) {\n const labels = series.labels;\n const displayLabels = { ...labels };\n const metricName = displayLabels.__name__;\n delete displayLabels.__name__;\n\n const labelPairs = Object.entries(displayLabels)\n .filter(([value]) => value !== undefined && value !== null && value !== '')\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join(', ');\n\n if (metricName && labelPairs) {\n legendName = `${metricName}{${labelPairs}}`;\n } else if (metricName) {\n legendName = metricName;\n } else if (labelPairs) {\n legendName = `{${labelPairs}}`;\n } else {\n legendName = labels.job || labels.instance || labels.metric || `Series ${seriesIndex + 1}`;\n }\n }\n\n if (!legendName || legendName.trim() === '') {\n legendName = `Series ${seriesIndex + 1}`;\n }\n\n return legendName;\n};\n\nexport const sanitizeColumnName = (name: string): string => {\n return name\n .replace(/[,\"\\n\\r]/g, '_')\n .replace(/\\s+/g, '_')\n .replace(/_+/g, '_')\n .replace(/^_|_$/g, '')\n .substring(0, 255);\n};\n\nexport const sanitizeFilename = (filename: string): string => {\n return filename\n .replace(/[<>:\"/\\\\|?*]/g, ' ')\n .trim()\n .split(/\\s+/)\n .filter((word) => word.length > 0)\n .map((word, index) => {\n if (index === 0) {\n return word.toLowerCase();\n }\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n })\n .join('');\n};\n\nexport const formatTimestampISO = (timestamp: number | string): string => {\n let timestampMs: number;\n\n if (typeof timestamp === 'string') {\n const date = new Date(timestamp);\n if (isNaN(date.getTime())) {\n return timestamp;\n }\n timestampMs = date.getTime();\n } else {\n timestampMs = timestamp > 1e10 ? timestamp : timestamp * 1000;\n }\n\n const date = new Date(timestampMs);\n if (isNaN(date.getTime())) {\n return new Date(timestampMs).toISOString();\n }\n\n return date.toISOString();\n};\n\nexport const escapeCsvValue = (value: unknown): string => {\n if (value === null || value === undefined) {\n return '';\n }\n\n const stringValue = String(value);\n\n if (\n stringValue.includes(',') ||\n stringValue.includes('\"') ||\n stringValue.includes('\\n') ||\n stringValue.includes('\\r')\n ) {\n return `\"${stringValue.replace(/\"/g, '\"\"')}\"`;\n }\n\n return stringValue;\n};\n\nexport interface ExportDataOptions {\n data: ExportableData;\n}\n\nexport const exportDataAsCSV = ({ data }: ExportDataOptions): Blob => {\n if (!isExportableData(data)) {\n console.warn('No valid data found to export to CSV.');\n return new Blob([''], { type: 'text/csv;charset=utf-8' });\n }\n\n let csvString = '';\n const result: Record<string, Record<string, unknown>> = {};\n const seriesInfo: Array<{ legendName: string; columnName: string; originalName: string }> = [];\n let validSeriesCount = 0;\n\n for (let i = 0; i < data.series.length; i++) {\n const series = data.series[i];\n\n if (!series) {\n continue;\n }\n\n if (!Array.isArray(series.values) || series.values.length === 0) {\n continue;\n }\n\n const legendName = formatLegendName(series, i);\n const columnName = sanitizeColumnName(legendName);\n\n const currentSeriesInfo = {\n legendName,\n columnName: columnName || `Series_${i + 1}`,\n originalName: series.name || '',\n };\n\n seriesInfo.push(currentSeriesInfo);\n validSeriesCount++;\n\n for (let j = 0; j < series.values.length; j++) {\n const entry = series.values[j];\n\n let timestamp: number | string;\n let value: unknown;\n\n if (Array.isArray(entry) && entry.length >= 2) {\n timestamp = entry[0];\n value = entry[1];\n } else if (typeof entry === 'object' && entry !== null && 'timestamp' in entry && 'value' in entry) {\n const dataPoint = entry as SeriesDataPoint;\n timestamp = dataPoint.timestamp;\n value = dataPoint.value;\n } else {\n continue;\n }\n\n if (value === null || value === undefined) {\n continue;\n }\n\n const dateTime = formatTimestampISO(timestamp);\n\n if (!result[dateTime]) {\n result[dateTime] = {};\n }\n /* linter complains, so assert result[dateTime] \n It has already been checked by the if statement\n */\n result[dateTime]![currentSeriesInfo.columnName] = value;\n }\n }\n\n if (validSeriesCount === 0 || seriesInfo.length === 0) {\n console.warn('No valid data found to export to CSV.');\n return new Blob([''], { type: 'text/csv;charset=utf-8' });\n }\n\n const timestampCount = Object.keys(result).length;\n if (timestampCount === 0) {\n console.warn('No valid timestamp data found to export to CSV.');\n return new Blob([''], { type: 'text/csv;charset=utf-8' });\n }\n\n const columnNames = seriesInfo.map((info) => info.columnName);\n csvString += `DateTime,${columnNames.join(',')}\\n`;\n\n const sortedDateTimes = Object.keys(result).sort((a, b) => {\n const dateA = new Date(a).getTime();\n const dateB = new Date(b).getTime();\n return dateA - dateB;\n });\n\n for (const dateTime of sortedDateTimes) {\n const rowData = result[dateTime];\n const values: string[] = [];\n\n if (rowData) {\n for (const columnName of columnNames) {\n const value = rowData[columnName];\n values.push(escapeCsvValue(value));\n }\n\n csvString += `${escapeCsvValue(dateTime)},${values.join(',')}\\n`;\n }\n }\n\n return new Blob([csvString], { type: 'text/csv;charset=utf-8' });\n};\n"],"names":["isExportableData","data","Array","isArray","series","length","extractExportableData","queryResults","undefined","allSeries","timeRange","stepMs","metadata","forEach","query","push","formatLegendName","seriesIndex","seriesAny","legendName","formattedName","name","displayName","legend","labels","displayLabels","metricName","__name__","labelPairs","Object","entries","filter","value","map","key","join","job","instance","metric","trim","sanitizeColumnName","replace","substring","sanitizeFilename","filename","split","word","index","toLowerCase","charAt","toUpperCase","slice","formatTimestampISO","timestamp","timestampMs","date","Date","isNaN","getTime","toISOString","escapeCsvValue","stringValue","String","includes","exportDataAsCSV","console","warn","Blob","type","csvString","result","seriesInfo","validSeriesCount","i","values","columnName","currentSeriesInfo","originalName","j","entry","dataPoint","dateTime","timestampCount","keys","columnNames","info","sortedDateTimes","sort","a","b","dateA","dateB","rowData"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAA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,WAAW;gBACjCD,OAAO3D,IAAI,CAAC6C,eAAe5B;YAC7B;YAEAqC,aAAa,GAAGT,eAAeqB,UAAU,CAAC,EAAEP,OAAOvC,IAAI,CAAC,KAAK,EAAE,CAAC;QAClE;IACF;IAEA,OAAO,IAAIgC,KAAK;QAACE;KAAU,EAAE;QAAED,MAAM;IAAyB;AAChE,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/csv-export.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport interface SeriesDataPoint {\n timestamp: number | string;\n value: unknown;\n}\n\nexport interface DataSeries {\n name?: string;\n formattedName?: string;\n legendName?: string;\n displayName?: string;\n legend?: string;\n labels?: Record<string, string>;\n values: Array<[number | string, unknown]> | SeriesDataPoint[];\n}\n\nexport interface ExportableData {\n series: DataSeries[];\n timeRange?: {\n start: string | number;\n end: string | number;\n };\n stepMs?: number;\n metadata?: Record<string, unknown>;\n}\n\nexport const isExportableData = (data: unknown): data is ExportableData => {\n return !!(\n data &&\n typeof data === 'object' &&\n 'series' in data &&\n Array.isArray((data as ExportableData).series) &&\n (data as ExportableData).series.length > 0\n );\n};\n\nexport interface QueryDataInput {\n data?: unknown;\n error?: unknown;\n isFetching?: boolean;\n}\n\nexport const extractExportableData = (queryResults: QueryDataInput[]): ExportableData | undefined => {\n if (!queryResults || queryResults.length === 0) return undefined;\n\n const allSeries: DataSeries[] = [];\n let timeRange: ExportableData['timeRange'] = undefined;\n let stepMs: number | undefined = undefined;\n let metadata: ExportableData['metadata'] = undefined;\n\n queryResults.forEach((query) => {\n if (query?.data && typeof query.data === 'object' && 'series' in query.data) {\n const data = query.data as ExportableData;\n if (data.series && Array.isArray(data.series) && data.series.length > 0) {\n allSeries.push(...data.series);\n if (!timeRange && data.timeRange) {\n timeRange = data.timeRange;\n }\n if (!stepMs && data.stepMs) {\n stepMs = data.stepMs;\n }\n if (!metadata && data.metadata) {\n metadata = data.metadata;\n }\n }\n }\n });\n\n if (allSeries.length > 0) {\n return {\n series: allSeries,\n timeRange,\n stepMs,\n metadata,\n };\n }\n\n return undefined;\n};\n\nexport const formatLegendName = (series: DataSeries, seriesIndex: number): string => {\n const seriesAny = series as DataSeries & {\n formattedName?: string;\n legendName?: string;\n displayName?: string;\n legend?: string;\n labels?: Record<string, string>;\n };\n\n let legendName = series.formattedName || series.name;\n\n if (!legendName || legendName === `Series ${seriesIndex + 1}`) {\n legendName = seriesAny.legendName || seriesAny.displayName || seriesAny.legend || series.name || '';\n }\n\n if ((!legendName || legendName === series.name) && series.labels) {\n const labels = series.labels;\n const displayLabels = { ...labels };\n const metricName = displayLabels.__name__;\n delete displayLabels.__name__;\n\n const labelPairs = Object.entries(displayLabels)\n .filter(([value]) => value !== undefined && value !== null && value !== '')\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join(', ');\n\n if (metricName && labelPairs) {\n legendName = `${metricName}{${labelPairs}}`;\n } else if (metricName) {\n legendName = metricName;\n } else if (labelPairs) {\n legendName = `{${labelPairs}}`;\n } else {\n legendName = labels.job || labels.instance || labels.metric || `Series ${seriesIndex + 1}`;\n }\n }\n\n if (!legendName || legendName.trim() === '') {\n legendName = `Series ${seriesIndex + 1}`;\n }\n\n return legendName;\n};\n\nexport const sanitizeColumnName = (name: string): string => {\n return name\n .replace(/[,\"\\n\\r]/g, '_')\n .replace(/\\s+/g, '_')\n .replace(/_+/g, '_')\n .replace(/^_|_$/g, '')\n .substring(0, 255);\n};\n\nexport const sanitizeFilename = (filename: string): string => {\n return filename\n .replace(/[<>:\"/\\\\|?*]/g, ' ')\n .trim()\n .split(/\\s+/)\n .filter((word) => word.length > 0)\n .map((word, index) => {\n if (index === 0) {\n return word.toLowerCase();\n }\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n })\n .join('');\n};\n\nexport const formatTimestampISO = (timestamp: number | string): string => {\n let timestampMs: number;\n\n if (typeof timestamp === 'string') {\n const date = new Date(timestamp);\n if (isNaN(date.getTime())) {\n return timestamp;\n }\n timestampMs = date.getTime();\n } else {\n timestampMs = timestamp > 1e10 ? timestamp : timestamp * 1000;\n }\n\n const date = new Date(timestampMs);\n if (isNaN(date.getTime())) {\n return new Date(timestampMs).toISOString();\n }\n\n return date.toISOString();\n};\n\nexport const escapeCsvValue = (value: unknown): string => {\n if (value === null || value === undefined) {\n return '';\n }\n\n const stringValue = String(value);\n\n if (\n stringValue.includes(',') ||\n stringValue.includes('\"') ||\n stringValue.includes('\\n') ||\n stringValue.includes('\\r')\n ) {\n return `\"${stringValue.replace(/\"/g, '\"\"')}\"`;\n }\n\n return stringValue;\n};\n\nexport interface ExportDataOptions {\n data: ExportableData;\n}\n\nexport const exportDataAsCSV = ({ data }: ExportDataOptions): Blob => {\n if (!isExportableData(data)) {\n console.warn('No valid data found to export to CSV.');\n return new Blob([''], { type: 'text/csv;charset=utf-8' });\n }\n\n let csvString = '';\n const result: Record<string, Record<string, unknown>> = {};\n const seriesInfo: Array<{ legendName: string; columnName: string; originalName: string }> = [];\n let validSeriesCount = 0;\n\n for (let i = 0; i < data.series.length; i++) {\n const series = data.series[i];\n\n if (!series) {\n continue;\n }\n\n if (!Array.isArray(series.values) || series.values.length === 0) {\n continue;\n }\n\n const legendName = formatLegendName(series, i);\n const columnName = sanitizeColumnName(legendName);\n\n const currentSeriesInfo = {\n legendName,\n columnName: columnName || `Series_${i + 1}`,\n originalName: series.name || '',\n };\n\n seriesInfo.push(currentSeriesInfo);\n validSeriesCount++;\n\n for (let j = 0; j < series.values.length; j++) {\n const entry = series.values[j];\n\n let timestamp: number | string;\n let value: unknown;\n\n if (Array.isArray(entry) && entry.length >= 2) {\n timestamp = entry[0];\n value = entry[1];\n } else if (typeof entry === 'object' && entry !== null && 'timestamp' in entry && 'value' in entry) {\n const dataPoint = entry as SeriesDataPoint;\n timestamp = dataPoint.timestamp;\n value = dataPoint.value;\n } else {\n continue;\n }\n\n if (value === null || value === undefined) {\n continue;\n }\n\n const dateTime = formatTimestampISO(timestamp);\n\n if (!result[dateTime]) {\n result[dateTime] = {};\n }\n /* linter complains, so assert result[dateTime]\n It has already been checked by the if statement\n */\n result[dateTime]![currentSeriesInfo.columnName] = value;\n }\n }\n\n if (validSeriesCount === 0 || seriesInfo.length === 0) {\n console.warn('No valid data found to export to CSV.');\n return new Blob([''], { type: 'text/csv;charset=utf-8' });\n }\n\n const timestampCount = Object.keys(result).length;\n if (timestampCount === 0) {\n console.warn('No valid timestamp data found to export to CSV.');\n return new Blob([''], { type: 'text/csv;charset=utf-8' });\n }\n\n const columnNames = seriesInfo.map((info) => info.columnName);\n csvString += `DateTime,${columnNames.join(',')}\\n`;\n\n const sortedDateTimes = Object.keys(result).toSorted((a, b) => {\n const dateA = new Date(a).getTime();\n const dateB = new Date(b).getTime();\n return dateA - dateB;\n });\n\n for (const dateTime of sortedDateTimes) {\n const rowData = result[dateTime];\n const values: string[] = [];\n\n if (rowData) {\n for (const columnName of columnNames) {\n const value = rowData[columnName];\n values.push(escapeCsvValue(value));\n }\n\n csvString += `${escapeCsvValue(dateTime)},${values.join(',')}\\n`;\n }\n }\n\n return new Blob([csvString], { type: 'text/csv;charset=utf-8' });\n};\n"],"names":["isExportableData","data","Array","isArray","series","length","extractExportableData","queryResults","undefined","allSeries","timeRange","stepMs","metadata","forEach","query","push","formatLegendName","seriesIndex","seriesAny","legendName","formattedName","name","displayName","legend","labels","displayLabels","metricName","__name__","labelPairs","Object","entries","filter","value","map","key","join","job","instance","metric","trim","sanitizeColumnName","replace","substring","sanitizeFilename","filename","split","word","index","toLowerCase","charAt","toUpperCase","slice","formatTimestampISO","timestamp","timestampMs","date","Date","isNaN","getTime","toISOString","escapeCsvValue","stringValue","String","includes","exportDataAsCSV","console","warn","Blob","type","csvString","result","seriesInfo","validSeriesCount","i","values","columnName","currentSeriesInfo","originalName","j","entry","dataPoint","dateTime","timestampCount","keys","columnNames","info","sortedDateTimes","toSorted","a","b","dateA","dateB","rowData"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA2BjC,OAAO,MAAMA,mBAAmB,CAACC;IAC/B,OAAO,CAAC,CACNA,CAAAA,QACA,OAAOA,SAAS,YAChB,YAAYA,QACZC,MAAMC,OAAO,CAAC,AAACF,KAAwBG,MAAM,KAC7C,AAACH,KAAwBG,MAAM,CAACC,MAAM,GAAG,CAAA;AAE7C,EAAE;AAQF,OAAO,MAAMC,wBAAwB,CAACC;IACpC,IAAI,CAACA,gBAAgBA,aAAaF,MAAM,KAAK,GAAG,OAAOG;IAEvD,MAAMC,YAA0B,EAAE;IAClC,IAAIC,YAAyCF;IAC7C,IAAIG,SAA6BH;IACjC,IAAII,WAAuCJ;IAE3CD,aAAaM,OAAO,CAAC,CAACC;QACpB,IAAIA,OAAOb,QAAQ,OAAOa,MAAMb,IAAI,KAAK,YAAY,YAAYa,MAAMb,IAAI,EAAE;YAC3E,MAAMA,OAAOa,MAAMb,IAAI;YACvB,IAAIA,KAAKG,MAAM,IAAIF,MAAMC,OAAO,CAACF,KAAKG,MAAM,KAAKH,KAAKG,MAAM,CAACC,MAAM,GAAG,GAAG;gBACvEI,UAAUM,IAAI,IAAId,KAAKG,MAAM;gBAC7B,IAAI,CAACM,aAAaT,KAAKS,SAAS,EAAE;oBAChCA,YAAYT,KAAKS,SAAS;gBAC5B;gBACA,IAAI,CAACC,UAAUV,KAAKU,MAAM,EAAE;oBAC1BA,SAASV,KAAKU,MAAM;gB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AAKgC,GAAG9B,OAAO;QACjC,MAAMiC,QAAQ,IAAInC,KAAKiC,GAAG/B,OAAO;QACjC,OAAOgC,QAAQC;IACjB;IAEA,KAAK,MAAMV,YAAYK,gBAAiB;QACtC,MAAMM,UAAUtB,MAAM,CAACW,SAAS;QAChC,MAAMP,SAAmB,EAAE;QAE3B,IAAIkB,SAAS;YACX,KAAK,MAAMjB,cAAcS,YAAa;gBACpC,MAAMpD,QAAQ4D,OAAO,CAACjB,WAAW;gBACjCD,OAAO3D,IAAI,CAAC6C,eAAe5B;YAC7B;YAEAqC,aAAa,GAAGT,eAAeqB,UAAU,CAAC,EAAEP,OAAOvC,IAAI,CAAC,KAAK,EAAE,CAAC;QAClE;IACF;IAEA,OAAO,IAAIgC,KAAK;QAACE;KAAU,EAAE;QAAED,MAAM;IAAyB;AAChE,EAAE"}
|
package/dist/utils/event.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { useRef, useLayoutEffect, useCallback } from
|
|
13
|
+
import { useRef, useLayoutEffect, useCallback } from "react";
|
|
14
14
|
/**
|
|
15
15
|
* A (temporary) userland implementation of `useEvent` from this React RFC: https://github.com/reactjs/rfcs/pull/220.
|
|
16
16
|
*
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
13
|
+
export * from "./event.js";
|
|
14
|
+
export * from "./plugin-versions.js";
|
|
15
|
+
export * from "./variables.js";
|
|
16
|
+
export * from "./csv-export.js";
|
|
16
17
|
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './event';\nexport * from './variables';\nexport * from './csv-export';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './event';\nexport * from './plugin-versions';\nexport * from './variables';\nexport * from './csv-export';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,aAAU;AACxB,cAAc,uBAAoB;AAClC,cAAc,iBAAc;AAC5B,cAAc,kBAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentinel version meaning "the latest version available in the Perses instance". It mirrors the backend
|
|
3
|
+
* `plugin.LatestVersion` constant. A plugin definition using it is not pinned to an exact version: the plugin registry
|
|
4
|
+
* resolves it dynamically at load time.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LATEST_PLUGIN_VERSION = "latest";
|
|
7
|
+
/**
|
|
8
|
+
* Compare two plugin version strings with semver semantics, the same way the Perses backend orders plugin versions.
|
|
9
|
+
* Returns a positive number when `a` is greater than `b`, a negative number when it is lower, and 0 when they are equal.
|
|
10
|
+
*
|
|
11
|
+
* Pre-releases order below their stable release (`1.0.0-beta` < `1.0.0`), as semver mandates. Versions that cannot be
|
|
12
|
+
* parsed at all always order below parseable ones, and are compared lexicographically between themselves, so an
|
|
13
|
+
* unexpected value can never be picked as "the latest version".
|
|
14
|
+
*/
|
|
15
|
+
export declare function comparePluginVersions(a: string, b: string): number;
|
|
16
|
+
/** Return a new array of versions sorted from newest to oldest, using {@link comparePluginVersions}. */
|
|
17
|
+
export declare function sortPluginVersionsDesc(versions: string[]): string[];
|
|
18
|
+
//# sourceMappingURL=plugin-versions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-versions.d.ts","sourceRoot":"","sources":["../../src/utils/plugin-versions.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAU9C;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAalE;AAED,wGAAwG;AACxG,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAEnE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { coerce, compare, parse } from "semver";
|
|
14
|
+
/**
|
|
15
|
+
* Sentinel version meaning "the latest version available in the Perses instance". It mirrors the backend
|
|
16
|
+
* `plugin.LatestVersion` constant. A plugin definition using it is not pinned to an exact version: the plugin registry
|
|
17
|
+
* resolves it dynamically at load time.
|
|
18
|
+
*/ export const LATEST_PLUGIN_VERSION = 'latest';
|
|
19
|
+
/**
|
|
20
|
+
* Parse a plugin version with semver, tolerating the loose forms the backend also accepts (a leading `v`, a missing
|
|
21
|
+
* patch segment, ...). Returns `null` when the value cannot be understood as a version at all.
|
|
22
|
+
*/ function parsePluginVersion(version) {
|
|
23
|
+
return parse(version, {
|
|
24
|
+
loose: true
|
|
25
|
+
}) ?? coerce(version);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Compare two plugin version strings with semver semantics, the same way the Perses backend orders plugin versions.
|
|
29
|
+
* Returns a positive number when `a` is greater than `b`, a negative number when it is lower, and 0 when they are equal.
|
|
30
|
+
*
|
|
31
|
+
* Pre-releases order below their stable release (`1.0.0-beta` < `1.0.0`), as semver mandates. Versions that cannot be
|
|
32
|
+
* parsed at all always order below parseable ones, and are compared lexicographically between themselves, so an
|
|
33
|
+
* unexpected value can never be picked as "the latest version".
|
|
34
|
+
*/ export function comparePluginVersions(a, b) {
|
|
35
|
+
const parsedA = parsePluginVersion(a);
|
|
36
|
+
const parsedB = parsePluginVersion(b);
|
|
37
|
+
if (parsedA && parsedB) {
|
|
38
|
+
return compare(parsedA, parsedB);
|
|
39
|
+
}
|
|
40
|
+
if (parsedA) {
|
|
41
|
+
return 1;
|
|
42
|
+
}
|
|
43
|
+
if (parsedB) {
|
|
44
|
+
return -1;
|
|
45
|
+
}
|
|
46
|
+
return a.localeCompare(b);
|
|
47
|
+
}
|
|
48
|
+
/** Return a new array of versions sorted from newest to oldest, using {@link comparePluginVersions}. */ export function sortPluginVersionsDesc(versions) {
|
|
49
|
+
return versions.toSorted((a, b)=>comparePluginVersions(b, a));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=plugin-versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/plugin-versions.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { SemVer } from 'semver';\nimport { coerce, compare, parse } from 'semver';\n\n/**\n * Sentinel version meaning \"the latest version available in the Perses instance\". It mirrors the backend\n * `plugin.LatestVersion` constant. A plugin definition using it is not pinned to an exact version: the plugin registry\n * resolves it dynamically at load time.\n */\nexport const LATEST_PLUGIN_VERSION = 'latest';\n\n/**\n * Parse a plugin version with semver, tolerating the loose forms the backend also accepts (a leading `v`, a missing\n * patch segment, ...). Returns `null` when the value cannot be understood as a version at all.\n */\nfunction parsePluginVersion(version: string): SemVer | null {\n return parse(version, { loose: true }) ?? coerce(version);\n}\n\n/**\n * Compare two plugin version strings with semver semantics, the same way the Perses backend orders plugin versions.\n * Returns a positive number when `a` is greater than `b`, a negative number when it is lower, and 0 when they are equal.\n *\n * Pre-releases order below their stable release (`1.0.0-beta` < `1.0.0`), as semver mandates. Versions that cannot be\n * parsed at all always order below parseable ones, and are compared lexicographically between themselves, so an\n * unexpected value can never be picked as \"the latest version\".\n */\nexport function comparePluginVersions(a: string, b: string): number {\n const parsedA = parsePluginVersion(a);\n const parsedB = parsePluginVersion(b);\n if (parsedA && parsedB) {\n return compare(parsedA, parsedB);\n }\n if (parsedA) {\n return 1;\n }\n if (parsedB) {\n return -1;\n }\n return a.localeCompare(b);\n}\n\n/** Return a new array of versions sorted from newest to oldest, using {@link comparePluginVersions}. */\nexport function sortPluginVersionsDesc(versions: string[]): string[] {\n return versions.toSorted((a, b) => comparePluginVersions(b, a));\n}\n"],"names":["coerce","compare","parse","LATEST_PLUGIN_VERSION","parsePluginVersion","version","loose","comparePluginVersions","a","b","parsedA","parsedB","localeCompare","sortPluginVersionsDesc","versions","toSorted"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,MAAM,EAAEC,OAAO,EAAEC,KAAK,QAAQ,SAAS;AAEhD;;;;CAIC,GACD,OAAO,MAAMC,wBAAwB,SAAS;AAE9C;;;CAGC,GACD,SAASC,mBAAmBC,OAAe;IACzC,OAAOH,MAAMG,SAAS;QAAEC,OAAO;IAAK,MAAMN,OAAOK;AACnD;AAEA;;;;;;;CAOC,GACD,OAAO,SAASE,sBAAsBC,CAAS,EAAEC,CAAS;IACxD,MAAMC,UAAUN,mBAAmBI;IACnC,MAAMG,UAAUP,mBAAmBK;IACnC,IAAIC,WAAWC,SAAS;QACtB,OAAOV,QAAQS,SAASC;IAC1B;IACA,IAAID,SAAS;QACX,OAAO;IACT;IACA,IAAIC,SAAS;QACX,OAAO,CAAC;IACV;IACA,OAAOH,EAAEI,aAAa,CAACH;AACzB;AAEA,sGAAsG,GACtG,OAAO,SAASI,uBAAuBC,QAAkB;IACvD,OAAOA,SAASC,QAAQ,CAAC,CAACP,GAAGC,IAAMF,sBAAsBE,GAAGD;AAC9D"}
|
package/dist/utils/variables.js
CHANGED
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
// Re-export all variable interpolation utilities from @perses-dev/components for backwards compatibility
|
|
14
|
-
export { InterpolationFormat, interpolate, parseVariables, parseVariablesAndFormat, replaceVariable, replaceVariables } from
|
|
14
|
+
export { InterpolationFormat, interpolate, parseVariables, parseVariablesAndFormat, replaceVariable, replaceVariables } from "@perses-dev/components";
|
|
15
15
|
|
|
16
16
|
//# sourceMappingURL=variables.js.map
|
package/package.json
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/plugin-system",
|
|
3
|
-
"version": "0.55.0-beta.
|
|
3
|
+
"version": "0.55.0-beta.11",
|
|
4
4
|
"description": "The plugin feature in Pereses",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/perses/
|
|
9
|
+
"url": "git+https://github.com/perses/shared.git"
|
|
10
10
|
},
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/perses/perses/issues"
|
|
13
13
|
},
|
|
14
|
+
"type": "module",
|
|
14
15
|
"module": "dist/index.js",
|
|
15
|
-
"main": "dist
|
|
16
|
+
"main": "dist/index.js",
|
|
16
17
|
"types": "dist/index.d.ts",
|
|
17
18
|
"sideEffects": false,
|
|
18
19
|
"scripts": {
|
|
19
20
|
"clean": "rimraf dist/",
|
|
20
21
|
"build": "concurrently \"npm:build:*\"",
|
|
21
|
-
"build:cjs": "swc ./src -d dist/cjs --strip-leading-paths --config-file ../.cjs.swcrc",
|
|
22
22
|
"build:esm": "swc ./src -d dist --strip-leading-paths --config-file ../.swcrc",
|
|
23
23
|
"build:types": "tsc --project tsconfig.build.json",
|
|
24
24
|
"type-check": "tsc --noEmit",
|
|
25
25
|
"start": "concurrently -P \"npm:build:* -- {*}\" -- --watch",
|
|
26
|
-
"test": "cross-env TZ=UTC
|
|
27
|
-
"
|
|
28
|
-
"lint
|
|
26
|
+
"test": "cross-env TZ=UTC vitest run",
|
|
27
|
+
"test:watch": "cross-env TZ=UTC vitest",
|
|
28
|
+
"lint": "oxlint src",
|
|
29
|
+
"lint:fix": "oxlint --fix src"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@module-federation/enhanced": "^2.
|
|
32
|
-
"@perses-dev/client": "0.55.0-beta.
|
|
33
|
-
"@perses-dev/components": "0.55.0-beta.
|
|
34
|
-
"@perses-dev/
|
|
35
|
-
"@perses-dev/spec": "0.3.0-beta.1",
|
|
32
|
+
"@module-federation/enhanced": "^2.9.0",
|
|
33
|
+
"@perses-dev/client": "0.55.0-beta.11",
|
|
34
|
+
"@perses-dev/components": "0.55.0-beta.11",
|
|
35
|
+
"@perses-dev/spec": "0.3.0-beta.8",
|
|
36
36
|
"date-fns": "^4.1.0",
|
|
37
37
|
"date-fns-tz": "^3.2.0",
|
|
38
|
+
"fast-uri": "3.1.6",
|
|
38
39
|
"immer": "^10.1.1",
|
|
39
|
-
"react-hook-form": "^7.
|
|
40
|
+
"react-hook-form": "^7.87.0",
|
|
40
41
|
"semver": "^7.8.0",
|
|
41
42
|
"use-query-params": "^2.2.1",
|
|
42
|
-
"zod": "^
|
|
43
|
+
"zod": "^4.5.4"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"@emotion/react": "^11.14.0",
|
|
46
47
|
"@emotion/styled": "^11.14.1",
|
|
47
|
-
"@hookform/resolvers": "^
|
|
48
|
+
"@hookform/resolvers": "^5.9.1",
|
|
48
49
|
"@mui/material": "^6.1.10",
|
|
49
50
|
"@tanstack/react-query": "^4.39.1",
|
|
50
|
-
"react": "^
|
|
51
|
-
"react-dom": "^
|
|
51
|
+
"react": "^18.3.0",
|
|
52
|
+
"react-dom": "^18.3.0"
|
|
52
53
|
},
|
|
53
54
|
"files": [
|
|
54
55
|
"dist"
|