@perses-dev/plugin-system 0.49.0 → 0.50.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +52 -58
  2. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +2 -2
  3. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +1 -1
  4. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +10 -59
  5. package/dist/components/CalculationSelector/CalculationSelector.d.ts +2 -1
  6. package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
  7. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  8. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +4 -3
  9. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  10. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +14 -61
  11. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  12. package/dist/components/DatasourceSelect.d.ts +3 -2
  13. package/dist/components/DatasourceSelect.d.ts.map +1 -1
  14. package/dist/components/DatasourceSelect.js.map +1 -1
  15. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +3 -1
  16. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  17. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +2 -2
  18. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  19. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +2 -1
  20. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -1
  21. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  22. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +2 -1
  23. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
  24. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  25. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +2 -2
  26. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  27. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  28. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +2 -2
  29. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
  30. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  31. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +3 -3
  32. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
  33. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  34. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +2 -1
  35. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  36. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +1 -1
  37. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  38. package/dist/components/PluginEditor/PluginEditor.d.ts +2 -1
  39. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  40. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  41. package/dist/components/PluginEditor/plugin-editor-api.d.ts +1 -1
  42. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  43. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  44. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  45. package/dist/components/PluginRegistry/PluginRegistry.d.ts +2 -2
  46. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  47. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  48. package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
  49. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  50. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +2 -1
  51. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  52. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  53. package/dist/components/ProjectSelect.d.ts +2 -1
  54. package/dist/components/ProjectSelect.d.ts.map +1 -1
  55. package/dist/components/ProjectSelect.js.map +1 -1
  56. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +2 -1
  57. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  58. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  59. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +4 -3
  60. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  61. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +12 -61
  62. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  63. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +3 -2
  64. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  65. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  66. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +2 -2
  67. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  68. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  69. package/dist/components/Variables/variable-model.d.ts +2 -1
  70. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  71. package/dist/components/Variables/variable-model.js.map +1 -1
  72. package/dist/context/ProjectStoreProvider.d.ts +2 -2
  73. package/dist/context/ProjectStoreProvider.d.ts.map +1 -1
  74. package/dist/context/ProjectStoreProvider.js.map +1 -1
  75. package/dist/context/ValidationProvider.d.ts +2 -2
  76. package/dist/context/ValidationProvider.d.ts.map +1 -1
  77. package/dist/context/ValidationProvider.js.map +1 -1
  78. package/dist/context/query-params.d.ts.map +1 -1
  79. package/dist/context/query-params.js.map +1 -1
  80. package/dist/model/legend.d.ts.map +1 -1
  81. package/dist/model/legend.js.map +1 -1
  82. package/dist/model/plugin-loading.js.map +1 -1
  83. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +2 -2
  84. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  85. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  86. package/dist/runtime/DataQueriesProvider/model.d.ts +1 -1
  87. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  88. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  89. package/dist/runtime/QueryCountProvider.d.ts.map +1 -1
  90. package/dist/runtime/QueryCountProvider.js.map +1 -1
  91. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +2 -2
  92. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  93. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  94. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +2 -2
  95. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -1
  96. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -1
  97. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +2 -2
  98. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -1
  99. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  100. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -1
  101. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
  102. package/dist/runtime/UsageMetricsProvider.d.ts +2 -2
  103. package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
  104. package/dist/runtime/UsageMetricsProvider.js.map +1 -1
  105. package/dist/runtime/builtin-variables.d.ts.map +1 -1
  106. package/dist/runtime/builtin-variables.js.map +1 -1
  107. package/dist/runtime/datasources.d.ts +4 -3
  108. package/dist/runtime/datasources.d.ts.map +1 -1
  109. package/dist/runtime/datasources.js.map +1 -1
  110. package/dist/runtime/plugin-registry.d.ts +5 -5
  111. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  112. package/dist/runtime/plugin-registry.js.map +1 -1
  113. package/dist/runtime/time-series-queries.d.ts +3 -3
  114. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  115. package/dist/runtime/time-series-queries.js.map +1 -1
  116. package/dist/runtime/trace-queries.d.ts +4 -3
  117. package/dist/runtime/trace-queries.d.ts.map +1 -1
  118. package/dist/runtime/trace-queries.js +1 -1
  119. package/dist/runtime/trace-queries.js.map +1 -1
  120. package/dist/runtime/variables.js.map +1 -1
  121. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +2 -1
  122. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +1 -1
  123. package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
  124. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +2 -1
  125. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
  126. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
  127. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +2 -1
  128. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -1
  129. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -1
  130. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +2 -1
  131. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
  132. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
  133. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts +2 -1
  134. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts.map +1 -1
  135. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.js.map +1 -1
  136. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +2 -1
  137. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
  138. package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
  139. package/dist/test/render.d.ts +3 -3
  140. package/dist/test/render.d.ts.map +1 -1
  141. package/dist/test/render.js.map +1 -1
  142. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  143. package/dist/test/test-plugins/bert/index.js.map +1 -1
  144. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  145. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  146. package/dist/utils/variables.d.ts.map +1 -1
  147. package/dist/utils/variables.js.map +1 -1
  148. package/package.json +5 -5
@@ -1,5 +1,6 @@
1
1
  import { DatasourceStore } from '@perses-dev/plugin-system';
2
2
  import { StoryFn, StoryContext } from '@storybook/react';
3
+ import { ReactElement } from 'react';
3
4
  declare module '@storybook/react' {
4
5
  interface Parameters {
5
6
  withPluginSystemDatasourceStore?: WithPluginSystemDatasourceStoreParameter;
@@ -8,5 +9,5 @@ declare module '@storybook/react' {
8
9
  export type WithPluginSystemDatasourceStoreParameter = {
9
10
  props: DatasourceStore;
10
11
  };
11
- export declare const WithPluginSystemDatasourceStore: (Story: StoryFn, context: StoryContext<unknown>) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const WithPluginSystemDatasourceStore: (Story: StoryFn, context: StoryContext<unknown>) => ReactElement;
12
13
  //# sourceMappingURL=WithPluginSystemDatasourceStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WithPluginSystemDatasourceStore.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.tsx"],"names":[],"mappings":"AAcA,OAAO,EAEL,eAAe,EAGhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,+BAA+B,CAAC,EAAE,wCAAwC,CAAC;KAC5E;CACF;AAED,MAAM,MAAM,wCAAwC,GAAG;IACrD,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAaF,eAAO,MAAM,+BAA+B,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,4CAoE7F,CAAC"}
1
+ {"version":3,"file":"WithPluginSystemDatasourceStore.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.tsx"],"names":[],"mappings":"AAcA,OAAO,EAEL,eAAe,EAGhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,+BAA+B,CAAC,EAAE,wCAAwC,CAAC;KAC5E;CACF;AAED,MAAM,MAAM,wCAAwC,GAAG;IACrD,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAaF,eAAO,MAAM,+BAA+B,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,KAAG,YAoEhG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.tsx"],"sourcesContent":["// Copyright 2023 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 { DatasourceSelector, DatasourceSpec } from '@perses-dev/core';\nimport {\n DatasourceStoreContext,\n DatasourceStore,\n usePluginRegistry,\n DatasourceSelectItemGroup,\n} from '@perses-dev/plugin-system';\nimport { StoryFn, StoryContext } from '@storybook/react';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withPluginSystemDatasourceStore?: WithPluginSystemDatasourceStoreParameter;\n }\n}\n\nexport type WithPluginSystemDatasourceStoreParameter = {\n props: DatasourceStore;\n};\n\nconst prometheusDemoUrl = 'https://prometheus.demo.do.prometheus.io';\n\n// Type guard because storybook types parameters as `any`\nfunction isWithDatastoreStoreParameter(\n parameter: unknown | WithPluginSystemDatasourceStoreParameter\n): parameter is WithPluginSystemDatasourceStoreParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\n// This decorator includes \"PluginSystem\" in the name to differentiate it from\n// the datasource store decorator in the `dashboards` package.\nexport const WithPluginSystemDatasourceStore = (Story: StoryFn, context: StoryContext<unknown>) => {\n const { getPlugin } = usePluginRegistry();\n\n const initParameter = context.parameters.withPluginSystemDatasourceStore;\n\n // This currently provides a very simplified default to enable use in some\n // basic stories. It likely will need expanding in the future.\n // In general, `plugin-system` would probably benefit from a provider wrapper\n // for `DatasourceStoreContext` that is more generic than the one available\n // in the `dashboard` package for non-dashboard use cases.\n const defaultValue: DatasourceStore = {\n getDatasource: (selector) => {\n if (selector.kind === 'PrometheusDatasource') {\n return Promise.resolve({\n default: true,\n plugin: {\n kind: 'PrometheusDatasource',\n spec: {},\n },\n });\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);\n },\n getDatasourceClient: async <Client,>(selector: DatasourceSelector) => {\n if (selector.kind === 'PrometheusDatasource') {\n const plugin = await getPlugin('Datasource', 'PrometheusDatasource');\n const client = plugin.createClient({ directUrl: prometheusDemoUrl }, { proxyUrl: prometheusDemoUrl }) as Client;\n return client;\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);\n },\n listDatasourceSelectItems: async (datasourcePluginKind): Promise<DatasourceSelectItemGroup[]> => {\n if (datasourcePluginKind === 'PrometheusDatasource') {\n return Promise.resolve([\n {\n items: [\n {\n name: 'PrometheusDatasource',\n selector: { kind: 'PrometheusDatasource' },\n },\n ],\n },\n ]);\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${datasourcePluginKind}`);\n },\n getSavedDatasources: (): Record<string, DatasourceSpec> => {\n return {};\n },\n setSavedDatasources: (datasources: Record<string, DatasourceSpec>) => {\n return datasources;\n },\n getLocalDatasources: (): Record<string, DatasourceSpec> => {\n return {};\n },\n setLocalDatasources: (datasources: Record<string, DatasourceSpec>) => {\n return datasources;\n },\n };\n\n const parameter = isWithDatastoreStoreParameter(initParameter) ? initParameter : { props: defaultValue };\n const props = parameter?.props;\n\n return (\n <DatasourceStoreContext.Provider value={props}>\n <Story />\n </DatasourceStoreContext.Provider>\n );\n};\n"],"names":["DatasourceStoreContext","usePluginRegistry","prometheusDemoUrl","isWithDatastoreStoreParameter","parameter","WithPluginSystemDatasourceStore","Story","context","getPlugin","initParameter","parameters","withPluginSystemDatasourceStore","defaultValue","getDatasource","selector","kind","Promise","resolve","default","plugin","spec","Error","getDatasourceClient","client","createClient","directUrl","proxyUrl","listDatasourceSelectItems","datasourcePluginKind","items","name","getSavedDatasources","setSavedDatasources","datasources","getLocalDatasources","setLocalDatasources","props","Provider","value"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SACEA,sBAAsB,EAEtBC,iBAAiB,QAEZ,4BAA4B;AAanC,MAAMC,oBAAoB;AAE1B,yDAAyD;AACzD,SAASC,8BACPC,SAA6D;IAE7D,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,MAAMC,kCAAkC,CAACC,OAAgBC;IAC9D,MAAM,EAAEC,SAAS,EAAE,GAAGP;IAEtB,MAAMQ,gBAAgBF,QAAQG,UAAU,CAACC,+BAA+B;IAExE,0EAA0E;IAC1E,8DAA8D;IAC9D,6EAA6E;IAC7E,2EAA2E;IAC3E,0DAA0D;IAC1D,MAAMC,eAAgC;QACpCC,eAAe,CAACC;YACd,IAAIA,SAASC,IAAI,KAAK,wBAAwB;gBAC5C,OAAOC,QAAQC,OAAO,CAAC;oBACrBC,SAAS;oBACTC,QAAQ;wBACNJ,MAAM;wBACNK,MAAM,CAAC;oBACT;gBACF;YACF;YACA,MAAM,IAAIC,MAAM,CAAC,uDAAuD,EAAEP,SAASC,IAAI,CAAC,CAAC;QAC3F;QACAO,qBAAqB,OAAgBR;YACnC,IAAIA,SAASC,IAAI,KAAK,wBAAwB;gBAC5C,MAAMI,SAAS,MAAMX,UAAU,cAAc;gBAC7C,MAAMe,SAASJ,OAAOK,YAAY,CAAC;oBAAEC,WAAWvB;gBAAkB,GAAG;oBAAEwB,UAAUxB;gBAAkB;gBACnG,OAAOqB;YACT;YACA,MAAM,IAAIF,MAAM,CAAC,uDAAuD,EAAEP,SAASC,IAAI,CAAC,CAAC;QAC3F;QACAY,2BAA2B,OAAOC;YAChC,IAAIA,yBAAyB,wBAAwB;gBACnD,OAAOZ,QAAQC,OAAO,CAAC;oBACrB;wBACEY,OAAO;4BACL;gCACEC,MAAM;gCACNhB,UAAU;oCAAEC,MAAM;gCAAuB;4BAC3C;yBACD;oBACH;iBACD;YACH;YACA,MAAM,IAAIM,MAAM,CAAC,uDAAuD,EAAEO,qBAAqB,CAAC;QAClG;QACAG,qBAAqB;YACnB,OAAO,CAAC;QACV;QACAC,qBAAqB,CAACC;YACpB,OAAOA;QACT;QACAC,qBAAqB;YACnB,OAAO,CAAC;QACV;QACAC,qBAAqB,CAACF;YACpB,OAAOA;QACT;IACF;IAEA,MAAM7B,YAAYD,8BAA8BM,iBAAiBA,gBAAgB;QAAE2B,OAAOxB;IAAa;IACvG,MAAMwB,QAAQhC,sBAAAA,gCAAAA,UAAWgC,KAAK;IAE9B,qBACE,KAACpC,uBAAuBqC,QAAQ;QAACC,OAAOF;kBACtC,cAAA,KAAC9B;;AAGP,EAAE"}
1
+ {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.tsx"],"sourcesContent":["// Copyright 2023 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 { DatasourceSelector, DatasourceSpec } from '@perses-dev/core';\nimport {\n DatasourceStoreContext,\n DatasourceStore,\n usePluginRegistry,\n DatasourceSelectItemGroup,\n} from '@perses-dev/plugin-system';\nimport { StoryFn, StoryContext } from '@storybook/react';\nimport { ReactElement } from 'react';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withPluginSystemDatasourceStore?: WithPluginSystemDatasourceStoreParameter;\n }\n}\n\nexport type WithPluginSystemDatasourceStoreParameter = {\n props: DatasourceStore;\n};\n\nconst prometheusDemoUrl = 'https://prometheus.demo.do.prometheus.io';\n\n// Type guard because storybook types parameters as `any`\nfunction isWithDatastoreStoreParameter(\n parameter: unknown | WithPluginSystemDatasourceStoreParameter\n): parameter is WithPluginSystemDatasourceStoreParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\n// This decorator includes \"PluginSystem\" in the name to differentiate it from\n// the datasource store decorator in the `dashboards` package.\nexport const WithPluginSystemDatasourceStore = (Story: StoryFn, context: StoryContext<unknown>): ReactElement => {\n const { getPlugin } = usePluginRegistry();\n\n const initParameter = context.parameters.withPluginSystemDatasourceStore;\n\n // This currently provides a very simplified default to enable use in some\n // basic stories. It likely will need expanding in the future.\n // In general, `plugin-system` would probably benefit from a provider wrapper\n // for `DatasourceStoreContext` that is more generic than the one available\n // in the `dashboard` package for non-dashboard use cases.\n const defaultValue: DatasourceStore = {\n getDatasource: (selector) => {\n if (selector.kind === 'PrometheusDatasource') {\n return Promise.resolve({\n default: true,\n plugin: {\n kind: 'PrometheusDatasource',\n spec: {},\n },\n });\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);\n },\n getDatasourceClient: async <Client,>(selector: DatasourceSelector) => {\n if (selector.kind === 'PrometheusDatasource') {\n const plugin = await getPlugin('Datasource', 'PrometheusDatasource');\n const client = plugin.createClient({ directUrl: prometheusDemoUrl }, { proxyUrl: prometheusDemoUrl }) as Client;\n return client;\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);\n },\n listDatasourceSelectItems: async (datasourcePluginKind): Promise<DatasourceSelectItemGroup[]> => {\n if (datasourcePluginKind === 'PrometheusDatasource') {\n return Promise.resolve([\n {\n items: [\n {\n name: 'PrometheusDatasource',\n selector: { kind: 'PrometheusDatasource' },\n },\n ],\n },\n ]);\n }\n throw new Error(`WithDatasourceStore is not configured to support kind: ${datasourcePluginKind}`);\n },\n getSavedDatasources: (): Record<string, DatasourceSpec> => {\n return {};\n },\n setSavedDatasources: (datasources: Record<string, DatasourceSpec>) => {\n return datasources;\n },\n getLocalDatasources: (): Record<string, DatasourceSpec> => {\n return {};\n },\n setLocalDatasources: (datasources: Record<string, DatasourceSpec>) => {\n return datasources;\n },\n };\n\n const parameter = isWithDatastoreStoreParameter(initParameter) ? initParameter : { props: defaultValue };\n const props = parameter?.props;\n\n return (\n <DatasourceStoreContext.Provider value={props}>\n <Story />\n </DatasourceStoreContext.Provider>\n );\n};\n"],"names":["DatasourceStoreContext","usePluginRegistry","prometheusDemoUrl","isWithDatastoreStoreParameter","parameter","WithPluginSystemDatasourceStore","Story","context","getPlugin","initParameter","parameters","withPluginSystemDatasourceStore","defaultValue","getDatasource","selector","kind","Promise","resolve","default","plugin","spec","Error","getDatasourceClient","client","createClient","directUrl","proxyUrl","listDatasourceSelectItems","datasourcePluginKind","items","name","getSavedDatasources","setSavedDatasources","datasources","getLocalDatasources","setLocalDatasources","props","Provider","value"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SACEA,sBAAsB,EAEtBC,iBAAiB,QAEZ,4BAA4B;AAcnC,MAAMC,oBAAoB;AAE1B,yDAAyD;AACzD,SAASC,8BACPC,SAA6D;IAE7D,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,MAAMC,kCAAkC,CAACC,OAAgBC;IAC9D,MAAM,EAAEC,SAAS,EAAE,GAAGP;IAEtB,MAAMQ,gBAAgBF,QAAQG,UAAU,CAACC,+BAA+B;IAExE,0EAA0E;IAC1E,8DAA8D;IAC9D,6EAA6E;IAC7E,2EAA2E;IAC3E,0DAA0D;IAC1D,MAAMC,eAAgC;QACpCC,eAAe,CAACC;YACd,IAAIA,SAASC,IAAI,KAAK,wBAAwB;gBAC5C,OAAOC,QAAQC,OAAO,CAAC;oBACrBC,SAAS;oBACTC,QAAQ;wBACNJ,MAAM;wBACNK,MAAM,CAAC;oBACT;gBACF;YACF;YACA,MAAM,IAAIC,MAAM,CAAC,uDAAuD,EAAEP,SAASC,IAAI,CAAC,CAAC;QAC3F;QACAO,qBAAqB,OAAgBR;YACnC,IAAIA,SAASC,IAAI,KAAK,wBAAwB;gBAC5C,MAAMI,SAAS,MAAMX,UAAU,cAAc;gBAC7C,MAAMe,SAASJ,OAAOK,YAAY,CAAC;oBAAEC,WAAWvB;gBAAkB,GAAG;oBAAEwB,UAAUxB;gBAAkB;gBACnG,OAAOqB;YACT;YACA,MAAM,IAAIF,MAAM,CAAC,uDAAuD,EAAEP,SAASC,IAAI,CAAC,CAAC;QAC3F;QACAY,2BAA2B,OAAOC;YAChC,IAAIA,yBAAyB,wBAAwB;gBACnD,OAAOZ,QAAQC,OAAO,CAAC;oBACrB;wBACEY,OAAO;4BACL;gCACEC,MAAM;gCACNhB,UAAU;oCAAEC,MAAM;gCAAuB;4BAC3C;yBACD;oBACH;iBACD;YACH;YACA,MAAM,IAAIM,MAAM,CAAC,uDAAuD,EAAEO,qBAAqB,CAAC;QAClG;QACAG,qBAAqB;YACnB,OAAO,CAAC;QACV;QACAC,qBAAqB,CAACC;YACpB,OAAOA;QACT;QACAC,qBAAqB;YACnB,OAAO,CAAC;QACV;QACAC,qBAAqB,CAACF;YACpB,OAAOA;QACT;IACF;IAEA,MAAM7B,YAAYD,8BAA8BM,iBAAiBA,gBAAgB;QAAE2B,OAAOxB;IAAa;IACvG,MAAMwB,QAAQhC,sBAAAA,gCAAAA,UAAWgC,KAAK;IAE9B,qBACE,KAACpC,uBAAuBqC,QAAQ;QAACC,OAAOF;kBACtC,cAAA,KAAC9B;;AAGP,EAAE"}
@@ -1,4 +1,5 @@
1
1
  import { StoryFn, StoryContext } from '@storybook/react';
2
+ import { ReactElement } from 'react';
2
3
  import { VariableSrv } from '../../../runtime';
3
4
  declare module '@storybook/react' {
4
5
  interface Parameters {
@@ -8,5 +9,5 @@ declare module '@storybook/react' {
8
9
  export type WithPluginSystemVariableParameter = {
9
10
  props: VariableSrv;
10
11
  };
11
- export declare const WithPluginSystemVariables: (Story: StoryFn, context: StoryContext<unknown>) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const WithPluginSystemVariables: (Story: StoryFn, context: StoryContext<unknown>) => ReactElement;
12
13
  //# sourceMappingURL=WithPluginSystemVariables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WithPluginSystemVariables.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemVariables.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAmB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,yBAAyB,CAAC,EAAE,iCAAiC,CAAC;KAC/D;CACF;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAcF,eAAO,MAAM,yBAAyB,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,4CAcvF,CAAC"}
1
+ {"version":3,"file":"WithPluginSystemVariables.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemVariables.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAmB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,yBAAyB,CAAC,EAAE,iCAAiC,CAAC;KAC/D;CACF;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAcF,eAAO,MAAM,yBAAyB,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,KAAG,YAc1F,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemVariables.tsx"],"sourcesContent":["// Copyright 2024 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 { StoryFn, StoryContext } from '@storybook/react';\nimport { VariableContext, VariableSrv } from '../../../runtime';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withPluginSystemVariables?: WithPluginSystemVariableParameter;\n }\n}\n\nexport type WithPluginSystemVariableParameter = {\n props: VariableSrv;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithVariableParameter(\n parameter: unknown | WithPluginSystemVariableParameter\n): parameter is WithPluginSystemVariableParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\n// This decorator is used for non-dashboards package variable needs.\n// Use the more specific decorator in the dashboards package when working with\n// dashboards.\n// This decorator includes \"PluginSystem\" in the name to differentiate it from\n// the datasource store decorator in the `dashboards` package.\nexport const WithPluginSystemVariables = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withPluginSystemVariables;\n const defaultValue: VariableSrv = {\n state: {},\n };\n const parameter = isWithVariableParameter(initParameter) ? initParameter : { props: defaultValue };\n\n const props = parameter?.props;\n\n return (\n <VariableContext.Provider value={props}>\n <Story />\n </VariableContext.Provider>\n );\n};\n"],"names":["VariableContext","isWithVariableParameter","parameter","WithPluginSystemVariables","Story","context","initParameter","parameters","withPluginSystemVariables","defaultValue","state","props","Provider","value"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,eAAe,QAAqB,mBAAmB;AAYhE,yDAAyD;AACzD,SAASC,wBACPC,SAAsD;IAEtD,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,oEAAoE;AACpE,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,MAAMC,4BAA4B,CAACC,OAAgBC;IACxD,MAAMC,gBAAgBD,QAAQE,UAAU,CAACC,yBAAyB;IAClE,MAAMC,eAA4B;QAChCC,OAAO,CAAC;IACV;IACA,MAAMR,YAAYD,wBAAwBK,iBAAiBA,gBAAgB;QAAEK,OAAOF;IAAa;IAEjG,MAAME,QAAQT,sBAAAA,gCAAAA,UAAWS,KAAK;IAE9B,qBACE,KAACX,gBAAgBY,QAAQ;QAACC,OAAOF;kBAC/B,cAAA,KAACP;;AAGP,EAAE"}
1
+ {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemVariables.tsx"],"sourcesContent":["// Copyright 2024 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 { StoryFn, StoryContext } from '@storybook/react';\nimport { ReactElement } from 'react';\nimport { VariableContext, VariableSrv } from '../../../runtime';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withPluginSystemVariables?: WithPluginSystemVariableParameter;\n }\n}\n\nexport type WithPluginSystemVariableParameter = {\n props: VariableSrv;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithVariableParameter(\n parameter: unknown | WithPluginSystemVariableParameter\n): parameter is WithPluginSystemVariableParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\n// This decorator is used for non-dashboards package variable needs.\n// Use the more specific decorator in the dashboards package when working with\n// dashboards.\n// This decorator includes \"PluginSystem\" in the name to differentiate it from\n// the datasource store decorator in the `dashboards` package.\nexport const WithPluginSystemVariables = (Story: StoryFn, context: StoryContext<unknown>): ReactElement => {\n const initParameter = context.parameters.withPluginSystemVariables;\n const defaultValue: VariableSrv = {\n state: {},\n };\n const parameter = isWithVariableParameter(initParameter) ? initParameter : { props: defaultValue };\n\n const props = parameter?.props;\n\n return (\n <VariableContext.Provider value={props}>\n <Story />\n </VariableContext.Provider>\n );\n};\n"],"names":["VariableContext","isWithVariableParameter","parameter","WithPluginSystemVariables","Story","context","initParameter","parameters","withPluginSystemVariables","defaultValue","state","props","Provider","value"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAIjC,SAASA,eAAe,QAAqB,mBAAmB;AAYhE,yDAAyD;AACzD,SAASC,wBACPC,SAAsD;IAEtD,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,oEAAoE;AACpE,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,MAAMC,4BAA4B,CAACC,OAAgBC;IACxD,MAAMC,gBAAgBD,QAAQE,UAAU,CAACC,yBAAyB;IAClE,MAAMC,eAA4B;QAChCC,OAAO,CAAC;IACV;IACA,MAAMR,YAAYD,wBAAwBK,iBAAiBA,gBAAgB;QAAEK,OAAOF;IAAa;IAEjG,MAAME,QAAQT,sBAAAA,gCAAAA,UAAWS,KAAK;IAE9B,qBACE,KAACX,gBAAgBY,QAAQ;QAACC,OAAOF;kBAC/B,cAAA,KAACP;;AAGP,EAAE"}
@@ -1,5 +1,6 @@
1
1
  import { StoryFn, StoryContext } from '@storybook/react';
2
2
  import { TimeRangeFromQueryProps } from '@perses-dev/plugin-system';
3
+ import { ReactElement } from 'react';
3
4
  declare module '@storybook/react' {
4
5
  interface Parameters {
5
6
  withTimeRange?: WithTimeRangeParameter;
@@ -8,5 +9,5 @@ declare module '@storybook/react' {
8
9
  export type WithTimeRangeParameter = {
9
10
  props: Partial<TimeRangeFromQueryProps>;
10
11
  };
11
- export declare const WithTimeRange: (Story: StoryFn, context: StoryContext<unknown>) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const WithTimeRange: (Story: StoryFn, context: StoryContext<unknown>) => ReactElement;
12
13
  //# sourceMappingURL=WithTimeRange.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WithTimeRange.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithTimeRange.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAqB,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEvF,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,aAAa,CAAC,EAAE,sBAAsB,CAAC;KACxC;CACF;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACzC,CAAC;AAOF,eAAO,MAAM,aAAa,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,4CAU3E,CAAC"}
1
+ {"version":3,"file":"WithTimeRange.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithTimeRange.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAqB,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,aAAa,CAAC,EAAE,sBAAsB,CAAC;KACxC;CACF;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACzC,CAAC;AAOF,eAAO,MAAM,aAAa,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,KAAG,YAU9E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithTimeRange.tsx"],"sourcesContent":["// Copyright 2023 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 { StoryFn, StoryContext } from '@storybook/react';\nimport { TimeRangeProvider, TimeRangeFromQueryProps } from '@perses-dev/plugin-system';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withTimeRange?: WithTimeRangeParameter;\n }\n}\n\nexport type WithTimeRangeParameter = {\n props: Partial<TimeRangeFromQueryProps>;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithTimeRangeParameter(parameter: unknown | WithTimeRangeParameter): parameter is WithTimeRangeParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\nexport const WithTimeRange = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withTimeRange;\n const parameter = isWithTimeRangeParameter(initParameter) ? initParameter : undefined;\n const props = parameter?.props;\n\n return (\n <TimeRangeProvider refreshInterval=\"0s\" timeRange={{ pastDuration: '1h' }} {...props}>\n <Story />\n </TimeRangeProvider>\n );\n};\n"],"names":["TimeRangeProvider","isWithTimeRangeParameter","parameter","WithTimeRange","Story","context","initParameter","parameters","withTimeRange","undefined","props","refreshInterval","timeRange","pastDuration"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,iBAAiB,QAAiC,4BAA4B;AAYvF,yDAAyD;AACzD,SAASC,yBAAyBC,SAA2C;IAC3E,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,OAAO,MAAMC,gBAAgB,CAACC,OAAgBC;IAC5C,MAAMC,gBAAgBD,QAAQE,UAAU,CAACC,aAAa;IACtD,MAAMN,YAAYD,yBAAyBK,iBAAiBA,gBAAgBG;IAC5E,MAAMC,QAAQR,sBAAAA,gCAAAA,UAAWQ,KAAK;IAE9B,qBACE,KAACV;QAAkBW,iBAAgB;QAAKC,WAAW;YAAEC,cAAc;QAAK;QAAI,GAAGH,KAAK;kBAClF,cAAA,KAACN;;AAGP,EAAE"}
1
+ {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithTimeRange.tsx"],"sourcesContent":["// Copyright 2023 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 { StoryFn, StoryContext } from '@storybook/react';\nimport { TimeRangeProvider, TimeRangeFromQueryProps } from '@perses-dev/plugin-system';\nimport { ReactElement } from 'react';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withTimeRange?: WithTimeRangeParameter;\n }\n}\n\nexport type WithTimeRangeParameter = {\n props: Partial<TimeRangeFromQueryProps>;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithTimeRangeParameter(parameter: unknown | WithTimeRangeParameter): parameter is WithTimeRangeParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\nexport const WithTimeRange = (Story: StoryFn, context: StoryContext<unknown>): ReactElement => {\n const initParameter = context.parameters.withTimeRange;\n const parameter = isWithTimeRangeParameter(initParameter) ? initParameter : undefined;\n const props = parameter?.props;\n\n return (\n <TimeRangeProvider refreshInterval=\"0s\" timeRange={{ pastDuration: '1h' }} {...props}>\n <Story />\n </TimeRangeProvider>\n );\n};\n"],"names":["TimeRangeProvider","isWithTimeRangeParameter","parameter","WithTimeRange","Story","context","initParameter","parameters","withTimeRange","undefined","props","refreshInterval","timeRange","pastDuration"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,iBAAiB,QAAiC,4BAA4B;AAavF,yDAAyD;AACzD,SAASC,yBAAyBC,SAA2C;IAC3E,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,OAAO,MAAMC,gBAAgB,CAACC,OAAgBC;IAC5C,MAAMC,gBAAgBD,QAAQE,UAAU,CAACC,aAAa;IACtD,MAAMN,YAAYD,yBAAyBK,iBAAiBA,gBAAgBG;IAC5E,MAAMC,QAAQR,sBAAAA,gCAAAA,UAAWQ,KAAK;IAE9B,qBACE,KAACV;QAAkBW,iBAAgB;QAAKC,WAAW;YAAEC,cAAc;QAAK;QAAI,GAAGH,KAAK;kBAClF,cAAA,KAACN;;AAGP,EAAE"}
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import { RenderOptions } from '@testing-library/react';
1
+ import { RenderOptions, RenderResult } from '@testing-library/react';
2
+ import { ReactNode } from 'react';
3
3
  import { DefaultPluginKinds } from '../model';
4
4
  type ContextOptions = {
5
5
  defaultPluginKinds?: DefaultPluginKinds;
@@ -8,6 +8,6 @@ type ContextOptions = {
8
8
  * Test helper to render a React component with some common app-level providers, as well as the PluginRegistry
9
9
  * wrapped around it.
10
10
  */
11
- export declare function renderWithContext(ui: React.ReactNode, renderOptions?: Omit<RenderOptions, 'queries'>, contextOptions?: ContextOptions): import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
11
+ export declare function renderWithContext(ui: ReactNode, renderOptions?: Omit<RenderOptions, 'queries'>, contextOptions?: ContextOptions): RenderResult;
12
12
  export {};
13
13
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAU,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,KAAK,cAAc,GAAG;IACpB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,KAAK,CAAC,SAAS,EACnB,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,EAC9C,cAAc,CAAC,EAAE,cAAc,gIAqBhC"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAU,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE7E,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,KAAK,cAAc,GAAG;IACpB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,SAAS,EACb,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,EAC9C,cAAc,CAAC,EAAE,cAAc,GAC9B,YAAY,CAoBd"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/render.tsx"],"sourcesContent":["// Copyright 2023 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 { render, RenderOptions } from '@testing-library/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { PluginRegistry } from '../components/PluginRegistry';\nimport { DefaultPluginKinds } from '../model';\nimport { testPluginLoader } from './test-plugins';\n\ntype ContextOptions = {\n defaultPluginKinds?: DefaultPluginKinds;\n};\n\n/**\n * Test helper to render a React component with some common app-level providers, as well as the PluginRegistry\n * wrapped around it.\n */\nexport function renderWithContext(\n ui: React.ReactNode,\n renderOptions?: Omit<RenderOptions, 'queries'>,\n contextOptions?: ContextOptions\n) {\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 return render(\n <QueryClientProvider client={queryClient}>\n <PluginRegistry\n pluginLoader={testPluginLoader}\n defaultPluginKinds={\n contextOptions?.defaultPluginKinds ?? {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n }\n }\n >\n {ui}\n </PluginRegistry>\n </QueryClientProvider>,\n renderOptions\n );\n}\n"],"names":["render","QueryClient","QueryClientProvider","PluginRegistry","testPluginLoader","renderWithContext","ui","renderOptions","contextOptions","queryClient","defaultOptions","queries","refetchOnWindowFocus","retry","client","pluginLoader","defaultPluginKinds","TimeSeriesQuery"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAuB,yBAAyB;AAC/D,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AACzE,SAASC,cAAc,QAAQ,+BAA+B;AAE9D,SAASC,gBAAgB,QAAQ,iBAAiB;AAMlD;;;CAGC,GACD,OAAO,SAASC,kBACdC,EAAmB,EACnBC,aAA8C,EAC9CC,cAA+B;IAE/B,iEAAiE;IACjE,MAAMC,cAAc,IAAIR,YAAY;QAClCS,gBAAgB;YAAEC,SAAS;gBAAEC,sBAAsB;gBAAOC,OAAO;YAAM;QAAE;IAC3E;QAMQL;IALR,OAAOR,qBACL,KAACE;QAAoBY,QAAQL;kBAC3B,cAAA,KAACN;YACCY,cAAcX;YACdY,oBACER,CAAAA,qCAAAA,2BAAAA,qCAAAA,eAAgBQ,kBAAkB,cAAlCR,gDAAAA,qCAAsC;gBACpCS,iBAAiB;YACnB;sBAGDX;;QAGLC;AAEJ"}
1
+ {"version":3,"sources":["../../src/test/render.tsx"],"sourcesContent":["// Copyright 2023 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 { render, RenderOptions, RenderResult } from '@testing-library/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ReactNode } from 'react';\nimport { PluginRegistry } from '../components/PluginRegistry';\nimport { DefaultPluginKinds } from '../model';\nimport { testPluginLoader } from './test-plugins';\n\ntype ContextOptions = {\n defaultPluginKinds?: DefaultPluginKinds;\n};\n\n/**\n * Test helper to render a React component with some common app-level providers, as well as the PluginRegistry\n * wrapped around it.\n */\nexport function renderWithContext(\n ui: ReactNode,\n renderOptions?: Omit<RenderOptions, 'queries'>,\n contextOptions?: ContextOptions\n): RenderResult {\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 return render(\n <QueryClientProvider client={queryClient}>\n <PluginRegistry\n pluginLoader={testPluginLoader}\n defaultPluginKinds={\n contextOptions?.defaultPluginKinds ?? {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n }\n }\n >\n {ui}\n </PluginRegistry>\n </QueryClientProvider>,\n renderOptions\n );\n}\n"],"names":["render","QueryClient","QueryClientProvider","PluginRegistry","testPluginLoader","renderWithContext","ui","renderOptions","contextOptions","queryClient","defaultOptions","queries","refetchOnWindowFocus","retry","client","pluginLoader","defaultPluginKinds","TimeSeriesQuery"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAqC,yBAAyB;AAC7E,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AAEzE,SAASC,cAAc,QAAQ,+BAA+B;AAE9D,SAASC,gBAAgB,QAAQ,iBAAiB;AAMlD;;;CAGC,GACD,OAAO,SAASC,kBACdC,EAAa,EACbC,aAA8C,EAC9CC,cAA+B;IAE/B,iEAAiE;IACjE,MAAMC,cAAc,IAAIR,YAAY;QAClCS,gBAAgB;YAAEC,SAAS;gBAAEC,sBAAsB;gBAAOC,OAAO;YAAM;QAAE;IAC3E;QAMQL;IALR,OAAOR,qBACL,KAACE;QAAoBY,QAAQL;kBAC3B,cAAA,KAACN;YACCY,cAAcX;YACdY,oBACER,CAAAA,qCAAAA,2BAAAA,qCAAAA,eAAgBQ,kBAAkB,cAAlCR,gDAAAA,qCAAsC;gBACpCS,iBAAiB;YACnB;sBAGDX;;QAGLC;AAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/test/test-plugins/bert/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAsB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiBjE,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CASvD,CAAC;AAgBF,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAgBvD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/test/test-plugins/bert/index.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAsB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiBjE,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CASvD,CAAC;AAgBF,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAgBvD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/test/test-plugins/bert/index.tsx"],"sourcesContent":["// Copyright 2023 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 { OptionsEditorProps, PanelPlugin } from '../../../model';\n\nfunction BertPanel1Editor({ value, onChange }: OptionsEditorProps<{ option1: string }>) {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel1 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option1}\n onChange={(e) => onChange({ ...value, option1: e.target.value })}\n />\n </div>\n );\n}\n\n// Dummy plugins to test loading\nexport const BertPanel1: PanelPlugin<{ option1: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Editor',\n content: BertPanel1Editor,\n },\n ],\n createInitialOptions: () => ({ option1: '' }),\n};\n\nfunction BertPanel2Editor({ value, onChange }: OptionsEditorProps<{ option2: string }>) {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel2 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option2}\n onChange={(e) => onChange({ ...value, option2: e.target.value })}\n />\n </div>\n );\n}\n\nexport const BertPanel2: PanelPlugin<{ option2: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: BertPanel2Editor,\n },\n {\n label: 'Custom Tab',\n content: function Editor() {\n return <div>custom content</div>;\n },\n },\n ],\n createInitialOptions: () => ({ option2: '' }),\n hideQueryEditor: true,\n};\n"],"names":["BertPanel1Editor","value","onChange","div","label","htmlFor","input","type","id","option1","e","target","BertPanel1","PanelComponent","panelOptionsEditorComponents","content","createInitialOptions","BertPanel2Editor","option2","BertPanel2","Editor","hideQueryEditor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAIjC,SAASA,iBAAiB,EAAEC,KAAK,EAAEC,QAAQ,EAA2C;IACpF,qBACE,MAACC;;0BACC,KAACC;gBAAMC,SAAQ;0BAAe;;0BAC9B,KAACC;gBACCC,MAAK;gBACLC,IAAG;gBACHP,OAAOA,MAAMQ,OAAO;gBACpBP,UAAU,CAACQ,IAAMR,SAAS;wBAAE,GAAGD,KAAK;wBAAEQ,SAASC,EAAEC,MAAM,CAACV,KAAK;oBAAC;;;;AAItE;AAEA,gCAAgC;AAChC,OAAO,MAAMW,aAA+C;IAC1DC,gBAAgB,IAAM;IACtBC,8BAA8B;QAC5B;YACEV,OAAO;YACPW,SAASf;QACX;KACD;IACDgB,sBAAsB,IAAO,CAAA;YAAEP,SAAS;QAAG,CAAA;AAC7C,EAAE;AAEF,SAASQ,iBAAiB,EAAEhB,KAAK,EAAEC,QAAQ,EAA2C;IACpF,qBACE,MAACC;;0BACC,KAACC;gBAAMC,SAAQ;0BAAe;;0BAC9B,KAACC;gBACCC,MAAK;gBACLC,IAAG;gBACHP,OAAOA,MAAMiB,OAAO;gBACpBhB,UAAU,CAACQ,IAAMR,SAAS;wBAAE,GAAGD,KAAK;wBAAEiB,SAASR,EAAEC,MAAM,CAACV,KAAK;oBAAC;;;;AAItE;AAEA,OAAO,MAAMkB,aAA+C;IAC1DN,gBAAgB,IAAM;IACtBC,8BAA8B;QAC5B;YACEV,OAAO;YACPW,SAASE;QACX;QACA;YACEb,OAAO;YACPW,SAAS,SAASK;gBAChB,qBAAO,KAACjB;8BAAI;;YACd;QACF;KACD;IACDa,sBAAsB,IAAO,CAAA;YAAEE,SAAS;QAAG,CAAA;IAC3CG,iBAAiB;AACnB,EAAE"}
1
+ {"version":3,"sources":["../../../../src/test/test-plugins/bert/index.tsx"],"sourcesContent":["// Copyright 2023 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 { ReactElement } from 'react';\nimport { OptionsEditorProps, PanelPlugin } from '../../../model';\n\nfunction BertPanel1Editor({ value, onChange }: OptionsEditorProps<{ option1: string }>): ReactElement {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel1 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option1}\n onChange={(e) => onChange({ ...value, option1: e.target.value })}\n />\n </div>\n );\n}\n\n// Dummy plugins to test loading\nexport const BertPanel1: PanelPlugin<{ option1: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Editor',\n content: BertPanel1Editor,\n },\n ],\n createInitialOptions: () => ({ option1: '' }),\n};\n\nfunction BertPanel2Editor({ value, onChange }: OptionsEditorProps<{ option2: string }>): ReactElement {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel2 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option2}\n onChange={(e) => onChange({ ...value, option2: e.target.value })}\n />\n </div>\n );\n}\n\nexport const BertPanel2: PanelPlugin<{ option2: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: BertPanel2Editor,\n },\n {\n label: 'Custom Tab',\n content: function Editor(): ReactElement {\n return <div>custom content</div>;\n },\n },\n ],\n createInitialOptions: () => ({ option2: '' }),\n hideQueryEditor: true,\n};\n"],"names":["BertPanel1Editor","value","onChange","div","label","htmlFor","input","type","id","option1","e","target","BertPanel1","PanelComponent","panelOptionsEditorComponents","content","createInitialOptions","BertPanel2Editor","option2","BertPanel2","Editor","hideQueryEditor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAKjC,SAASA,iBAAiB,EAAEC,KAAK,EAAEC,QAAQ,EAA2C;IACpF,qBACE,MAACC;;0BACC,KAACC;gBAAMC,SAAQ;0BAAe;;0BAC9B,KAACC;gBACCC,MAAK;gBACLC,IAAG;gBACHP,OAAOA,MAAMQ,OAAO;gBACpBP,UAAU,CAACQ,IAAMR,SAAS;wBAAE,GAAGD,KAAK;wBAAEQ,SAASC,EAAEC,MAAM,CAACV,KAAK;oBAAC;;;;AAItE;AAEA,gCAAgC;AAChC,OAAO,MAAMW,aAA+C;IAC1DC,gBAAgB,IAAM;IACtBC,8BAA8B;QAC5B;YACEV,OAAO;YACPW,SAASf;QACX;KACD;IACDgB,sBAAsB,IAAO,CAAA;YAAEP,SAAS;QAAG,CAAA;AAC7C,EAAE;AAEF,SAASQ,iBAAiB,EAAEhB,KAAK,EAAEC,QAAQ,EAA2C;IACpF,qBACE,MAACC;;0BACC,KAACC;gBAAMC,SAAQ;0BAAe;;0BAC9B,KAACC;gBACCC,MAAK;gBACLC,IAAG;gBACHP,OAAOA,MAAMiB,OAAO;gBACpBhB,UAAU,CAACQ,IAAMR,SAAS;wBAAE,GAAGD,KAAK;wBAAEiB,SAASR,EAAEC,MAAM,CAACV,KAAK;oBAAC;;;;AAItE;AAEA,OAAO,MAAMkB,aAA+C;IAC1DN,gBAAgB,IAAM;IACtBC,8BAA8B;QAC5B;YACEV,OAAO;YACPW,SAASE;QACX;QACA;YACEb,OAAO;YACPW,SAAS,SAASK;gBAChB,qBAAO,KAACjB;8BAAI;;YACd;QACF;KACD;IACDa,sBAAsB,IAAO,CAAA;YAAEE,SAAS;QAAG,CAAA;IAC3CG,iBAAiB;AACnB,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"mock-plugin-registry.d.ts","sourceRoot":"","sources":["../../src/test-utils/mock-plugin-registry.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAA8C,oBAAoB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAExG,MAAM,MAAM,UAAU,GAAG;KACtB,CAAC,IAAI,UAAU,GAAG;QACjB,UAAU,EAAE,CAAC,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,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,CA0CtG;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAErE"}
1
+ {"version":3,"file":"mock-plugin-registry.d.ts","sourceRoot":"","sources":["../../src/test-utils/mock-plugin-registry.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAA8C,oBAAoB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAExG,MAAM,MAAM,UAAU,GAAG;KACtB,CAAC,IAAI,UAAU,GAAG;QACjB,UAAU,EAAE,CAAC,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,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,CA0CtG;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9E"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test-utils/mock-plugin-registry.tsx"],"sourcesContent":["// Copyright 2023 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/core';\nimport { PluginRegistryProps } from '../components';\nimport { PluginModuleResource, Plugin, PluginLoader, PluginImplementation, PluginType } from '../model';\n\nexport type MockPlugin = {\n [T in PluginType]: {\n pluginType: T;\n kind: 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 createdAt: '',\n updatedAt: '',\n version: 0,\n },\n spec: {\n // Add metadata for all mock plugins\n plugins: mockPlugins.map(({ pluginType, kind }) => ({\n pluginType,\n kind,\n display: {\n name: getMockPluginName(pluginType, kind),\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[mockPlugin.kind] = 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(pluginType: PluginType, kind: string) {\n return `${pluginType} Plugin for ${kind}`;\n}\n"],"names":["mockPluginRegistry","mockPlugins","mockPluginResource","kind","metadata","name","createdAt","updatedAt","version","spec","plugins","map","pluginType","display","getMockPluginName","mockPluginModule","mockPlugin","plugin","pluginLoader","getInstalledPlugins","Promise","resolve","importPluginModule","defaultPluginKinds","TimeSeriesQuery"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAcjC;;;CAGC,GACD,OAAO,SAASA,mBAAmB,GAAGC,WAAyB;IAC7D,MAAMC,qBAA2C;QAC/CC,MAAM;QACNC,UAAU;YACRC,MAAM;YACNC,WAAW;YACXC,WAAW;YACXC,SAAS;QACX;QACAC,MAAM;YACJ,oCAAoC;YACpCC,SAAST,YAAYU,GAAG,CAAC,CAAC,EAAEC,UAAU,EAAET,IAAI,EAAE,GAAM,CAAA;oBAClDS;oBACAT;oBACAU,SAAS;wBACPR,MAAMS,kBAAkBF,YAAYT;oBACtC;gBACF,CAAA;QACF;IACF;IAEA,MAAMY,mBAAwD,CAAC;IAC/D,KAAK,MAAMC,cAAcf,YAAa;QACpC,4EAA4E;QAC5Ec,gBAAgB,CAACC,WAAWb,IAAI,CAAC,GAAGa,WAAWC,MAAM;IACvD;IAEA,MAAMC,eAA6B;QACjCC;YACE,OAAOC,QAAQC,OAAO,CAAC;gBAACnB;aAAmB;QAC7C;QACAoB;YACE,OAAOF,QAAQC,OAAO,CAACN;QACzB;IACF;IAEA,OAAO;QACLG;QACAK,oBAAoB;YAClBC,iBAAiB;QACnB;IACF;AACF;AAEA;;;CAGC,GACD,OAAO,SAASV,kBAAkBF,UAAsB,EAAET,IAAY;IACpE,OAAO,CAAC,EAAES,WAAW,YAAY,EAAET,KAAK,CAAC;AAC3C"}
1
+ {"version":3,"sources":["../../src/test-utils/mock-plugin-registry.tsx"],"sourcesContent":["// Copyright 2023 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/core';\nimport { PluginRegistryProps } from '../components';\nimport { PluginModuleResource, Plugin, PluginLoader, PluginImplementation, PluginType } from '../model';\n\nexport type MockPlugin = {\n [T in PluginType]: {\n pluginType: T;\n kind: 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 createdAt: '',\n updatedAt: '',\n version: 0,\n },\n spec: {\n // Add metadata for all mock plugins\n plugins: mockPlugins.map(({ pluginType, kind }) => ({\n pluginType,\n kind,\n display: {\n name: getMockPluginName(pluginType, kind),\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[mockPlugin.kind] = 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(pluginType: PluginType, kind: string): string {\n return `${pluginType} Plugin for ${kind}`;\n}\n"],"names":["mockPluginRegistry","mockPlugins","mockPluginResource","kind","metadata","name","createdAt","updatedAt","version","spec","plugins","map","pluginType","display","getMockPluginName","mockPluginModule","mockPlugin","plugin","pluginLoader","getInstalledPlugins","Promise","resolve","importPluginModule","defaultPluginKinds","TimeSeriesQuery"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAcjC;;;CAGC,GACD,OAAO,SAASA,mBAAmB,GAAGC,WAAyB;IAC7D,MAAMC,qBAA2C;QAC/CC,MAAM;QACNC,UAAU;YACRC,MAAM;YACNC,WAAW;YACXC,WAAW;YACXC,SAAS;QACX;QACAC,MAAM;YACJ,oCAAoC;YACpCC,SAAST,YAAYU,GAAG,CAAC,CAAC,EAAEC,UAAU,EAAET,IAAI,EAAE,GAAM,CAAA;oBAClDS;oBACAT;oBACAU,SAAS;wBACPR,MAAMS,kBAAkBF,YAAYT;oBACtC;gBACF,CAAA;QACF;IACF;IAEA,MAAMY,mBAAwD,CAAC;IAC/D,KAAK,MAAMC,cAAcf,YAAa;QACpC,4EAA4E;QAC5Ec,gBAAgB,CAACC,WAAWb,IAAI,CAAC,GAAGa,WAAWC,MAAM;IACvD;IAEA,MAAMC,eAA6B;QACjCC;YACE,OAAOC,QAAQC,OAAO,CAAC;gBAACnB;aAAmB;QAC7C;QACAoB;YACE,OAAOF,QAAQC,OAAO,CAACN;QACzB;IACF;IAEA,OAAO;QACLG;QACAK,oBAAoB;YAClBC,iBAAiB;QACnB;IACF;AACF;AAEA;;;CAGC,GACD,OAAO,SAASV,kBAAkBF,UAAsB,EAAET,IAAY;IACpE,OAAO,CAAC,EAAES,WAAW,YAAY,EAAET,KAAK,CAAC;AAC3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/utils/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,GAAG,MAAM,CAgBtF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,UAc1F;AAWD;;GAEG;AACH,eAAO,MAAM,cAAc,SAAU,MAAM,aAkB1C,CAAC"}
1
+ {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/utils/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,GAAG,MAAM,CAgBtF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,MAAM,CAcnG;AAWD;;GAEG;AACH,eAAO,MAAM,cAAc,SAAU,MAAM,KAAG,MAAM,EAkBnD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/variables.ts"],"sourcesContent":["// Copyright 2024 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 { VariableValue } from '@perses-dev/core';\nimport { VariableStateMap } from '@perses-dev/plugin-system';\n\nexport function replaceVariables(text: string, variableState: VariableStateMap): string {\n const variables = parseVariables(text);\n let finalText = text;\n variables\n // Sorting variables by their length.\n // In order to not have a variable name have contained in another variable name.\n // i.e.: $__range replacing $__range_ms => '3600_ms' instead of '3600000'\n .sort((a, b) => b.length - a.length)\n .forEach((v) => {\n const variable = variableState[v];\n if (variable && variable.value !== undefined) {\n finalText = replaceVariable(finalText, v, variable?.value);\n }\n });\n\n return finalText;\n}\n\nexport function replaceVariable(text: string, varName: string, variableValue: VariableValue) {\n const variableSyntax = '$' + varName;\n const alternativeVariableSyntax = '${' + varName + '}';\n\n let replaceString = '';\n if (Array.isArray(variableValue)) {\n replaceString = `(${variableValue.join('|')})`; // regex style\n }\n if (typeof variableValue === 'string') {\n replaceString = variableValue;\n }\n\n text = text.replaceAll(variableSyntax, replaceString);\n return text.replaceAll(alternativeVariableSyntax, replaceString);\n}\n\n// This regular expression is designed to identify variable references in a string.\n// It supports two formats for referencing variables:\n// 1. $variableName - This is a simpler format, and the regular expression captures the variable name (\\w+ matches one or more word characters).\n// 2. ${variableName} - This is a more complex format and the regular expression captures the variable name (\\w+ matches one or more word characters) in the curly braces.\n// 3. [COMING SOON] ${variableName:value} - This is a more complex format that allows specifying a format function as well.\n// TODO: Fix this lint error\n// eslint-disable-next-line no-useless-escape\nconst VARIABLE_REGEX = /\\$(\\w+)|\\${(\\w+)(?:\\.([^:^\\}]+))?(?::([^\\}]+))?}/gm;\n\n/**\n * Returns a list of variables\n */\nexport const parseVariables = (text: string) => {\n const regex = VARIABLE_REGEX;\n const matches = new Set<string>();\n let match;\n\n while ((match = regex.exec(text)) !== null) {\n if (match) {\n if (match[1]) {\n // \\$(\\w+)\\\n matches.add(match[1]);\n } else if (match[2]) {\n // \\${(\\w+)}\\\n matches.add(match[2]);\n }\n }\n }\n // return unique matches\n return Array.from(matches.values());\n};\n"],"names":["replaceVariables","text","variableState","variables","parseVariables","finalText","sort","a","b","length","forEach","v","variable","value","undefined","replaceVariable","varName","variableValue","variableSyntax","alternativeVariableSyntax","replaceString","Array","isArray","join","replaceAll","VARIABLE_REGEX","regex","matches","Set","match","exec","add","from","values"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,OAAO,SAASA,iBAAiBC,IAAY,EAAEC,aAA+B;IAC5E,MAAMC,YAAYC,eAAeH;IACjC,IAAII,YAAYJ;IAChBE,SACE,qCAAqC;IACrC,gFAAgF;IAChF,yEAAyE;KACxEG,IAAI,CAAC,CAACC,GAAGC,IAAMA,EAAEC,MAAM,GAAGF,EAAEE,MAAM,EAClCC,OAAO,CAAC,CAACC;QACR,MAAMC,WAAWV,aAAa,CAACS,EAAE;QACjC,IAAIC,YAAYA,SAASC,KAAK,KAAKC,WAAW;YAC5CT,YAAYU,gBAAgBV,WAAWM,GAAGC,qBAAAA,+BAAAA,SAAUC,KAAK;QAC3D;IACF;IAEF,OAAOR;AACT;AAEA,OAAO,SAASU,gBAAgBd,IAAY,EAAEe,OAAe,EAAEC,aAA4B;IACzF,MAAMC,iBAAiB,MAAMF;IAC7B,MAAMG,4BAA4B,OAAOH,UAAU;IAEnD,IAAII,gBAAgB;IACpB,IAAIC,MAAMC,OAAO,CAACL,gBAAgB;QAChCG,gBAAgB,CAAC,CAAC,EAAEH,cAAcM,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc;IAChE;IACA,IAAI,OAAON,kBAAkB,UAAU;QACrCG,gBAAgBH;IAClB;IAEAhB,OAAOA,KAAKuB,UAAU,CAACN,gBAAgBE;IACvC,OAAOnB,KAAKuB,UAAU,CAACL,2BAA2BC;AACpD;AAEA,mFAAmF;AACnF,qDAAqD;AACrD,gJAAgJ;AAChJ,0KAA0K;AAC1K,2HAA2H;AAC3H,4BAA4B;AAC5B,6CAA6C;AAC7C,MAAMK,iBAAiB;AAEvB;;CAEC,GACD,OAAO,MAAMrB,iBAAiB,CAACH;IAC7B,MAAMyB,QAAQD;IACd,MAAME,UAAU,IAAIC;IACpB,IAAIC;IAEJ,MAAO,AAACA,CAAAA,QAAQH,MAAMI,IAAI,CAAC7B,KAAI,MAAO,KAAM;QAC1C,IAAI4B,OAAO;YACT,IAAIA,KAAK,CAAC,EAAE,EAAE;gBACZ,WAAW;gBACXF,QAAQI,GAAG,CAACF,KAAK,CAAC,EAAE;YACtB,OAAO,IAAIA,KAAK,CAAC,EAAE,EAAE;gBACnB,aAAa;gBACbF,QAAQI,GAAG,CAACF,KAAK,CAAC,EAAE;YACtB;QACF;IACF;IACA,wBAAwB;IACxB,OAAOR,MAAMW,IAAI,CAACL,QAAQM,MAAM;AAClC,EAAE"}
1
+ {"version":3,"sources":["../../src/utils/variables.ts"],"sourcesContent":["// Copyright 2024 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 { VariableValue } from '@perses-dev/core';\nimport { VariableStateMap } from '@perses-dev/plugin-system';\n\nexport function replaceVariables(text: string, variableState: VariableStateMap): string {\n const variables = parseVariables(text);\n let finalText = text;\n variables\n // Sorting variables by their length.\n // In order to not have a variable name have contained in another variable name.\n // i.e.: $__range replacing $__range_ms => '3600_ms' instead of '3600000'\n .sort((a, b) => b.length - a.length)\n .forEach((v) => {\n const variable = variableState[v];\n if (variable && variable.value !== undefined) {\n finalText = replaceVariable(finalText, v, variable?.value);\n }\n });\n\n return finalText;\n}\n\nexport function replaceVariable(text: string, varName: string, variableValue: VariableValue): string {\n const variableSyntax = '$' + varName;\n const alternativeVariableSyntax = '${' + varName + '}';\n\n let replaceString = '';\n if (Array.isArray(variableValue)) {\n replaceString = `(${variableValue.join('|')})`; // regex style\n }\n if (typeof variableValue === 'string') {\n replaceString = variableValue;\n }\n\n text = text.replaceAll(variableSyntax, replaceString);\n return text.replaceAll(alternativeVariableSyntax, replaceString);\n}\n\n// This regular expression is designed to identify variable references in a string.\n// It supports two formats for referencing variables:\n// 1. $variableName - This is a simpler format, and the regular expression captures the variable name (\\w+ matches one or more word characters).\n// 2. ${variableName} - This is a more complex format and the regular expression captures the variable name (\\w+ matches one or more word characters) in the curly braces.\n// 3. [COMING SOON] ${variableName:value} - This is a more complex format that allows specifying a format function as well.\n// TODO: Fix this lint error\n// eslint-disable-next-line no-useless-escape\nconst VARIABLE_REGEX = /\\$(\\w+)|\\${(\\w+)(?:\\.([^:^\\}]+))?(?::([^\\}]+))?}/gm;\n\n/**\n * Returns a list of variables\n */\nexport const parseVariables = (text: string): string[] => {\n const regex = VARIABLE_REGEX;\n const matches = new Set<string>();\n let match;\n\n while ((match = regex.exec(text)) !== null) {\n if (match) {\n if (match[1]) {\n // \\$(\\w+)\\\n matches.add(match[1]);\n } else if (match[2]) {\n // \\${(\\w+)}\\\n matches.add(match[2]);\n }\n }\n }\n // return unique matches\n return Array.from(matches.values());\n};\n"],"names":["replaceVariables","text","variableState","variables","parseVariables","finalText","sort","a","b","length","forEach","v","variable","value","undefined","replaceVariable","varName","variableValue","variableSyntax","alternativeVariableSyntax","replaceString","Array","isArray","join","replaceAll","VARIABLE_REGEX","regex","matches","Set","match","exec","add","from","values"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,OAAO,SAASA,iBAAiBC,IAAY,EAAEC,aAA+B;IAC5E,MAAMC,YAAYC,eAAeH;IACjC,IAAII,YAAYJ;IAChBE,SACE,qCAAqC;IACrC,gFAAgF;IAChF,yEAAyE;KACxEG,IAAI,CAAC,CAACC,GAAGC,IAAMA,EAAEC,MAAM,GAAGF,EAAEE,MAAM,EAClCC,OAAO,CAAC,CAACC;QACR,MAAMC,WAAWV,aAAa,CAACS,EAAE;QACjC,IAAIC,YAAYA,SAASC,KAAK,KAAKC,WAAW;YAC5CT,YAAYU,gBAAgBV,WAAWM,GAAGC,qBAAAA,+BAAAA,SAAUC,KAAK;QAC3D;IACF;IAEF,OAAOR;AACT;AAEA,OAAO,SAASU,gBAAgBd,IAAY,EAAEe,OAAe,EAAEC,aAA4B;IACzF,MAAMC,iBAAiB,MAAMF;IAC7B,MAAMG,4BAA4B,OAAOH,UAAU;IAEnD,IAAII,gBAAgB;IACpB,IAAIC,MAAMC,OAAO,CAACL,gBAAgB;QAChCG,gBAAgB,CAAC,CAAC,EAAEH,cAAcM,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc;IAChE;IACA,IAAI,OAAON,kBAAkB,UAAU;QACrCG,gBAAgBH;IAClB;IAEAhB,OAAOA,KAAKuB,UAAU,CAACN,gBAAgBE;IACvC,OAAOnB,KAAKuB,UAAU,CAACL,2BAA2BC;AACpD;AAEA,mFAAmF;AACnF,qDAAqD;AACrD,gJAAgJ;AAChJ,0KAA0K;AAC1K,2HAA2H;AAC3H,4BAA4B;AAC5B,6CAA6C;AAC7C,MAAMK,iBAAiB;AAEvB;;CAEC,GACD,OAAO,MAAMrB,iBAAiB,CAACH;IAC7B,MAAMyB,QAAQD;IACd,MAAME,UAAU,IAAIC;IACpB,IAAIC;IAEJ,MAAO,AAACA,CAAAA,QAAQH,MAAMI,IAAI,CAAC7B,KAAI,MAAO,KAAM;QAC1C,IAAI4B,OAAO;YACT,IAAIA,KAAK,CAAC,EAAE,EAAE;gBACZ,WAAW;gBACXF,QAAQI,GAAG,CAACF,KAAK,CAAC,EAAE;YACtB,OAAO,IAAIA,KAAK,CAAC,EAAE,EAAE;gBACnB,aAAa;gBACbF,QAAQI,GAAG,CAACF,KAAK,CAAC,EAAE;YACtB;QACF;IACF;IACA,wBAAwB;IACxB,OAAOR,MAAMW,IAAI,CAACL,QAAQM,MAAM;AAClC,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/plugin-system",
3
- "version": "0.49.0",
3
+ "version": "0.50.0-rc.0",
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",
@@ -28,8 +28,8 @@
28
28
  "lint:fix": "eslint --fix src --ext .ts,.tsx"
29
29
  },
30
30
  "dependencies": {
31
- "@perses-dev/components": "0.49.0",
32
- "@perses-dev/core": "0.49.0",
31
+ "@perses-dev/components": "0.50.0-rc.0",
32
+ "@perses-dev/core": "0.50.0-rc.0",
33
33
  "date-fns": "^2.30.0",
34
34
  "immer": "^9.0.15",
35
35
  "react-hook-form": "^7.46.1",
@@ -38,10 +38,10 @@
38
38
  "zod": "^3.22.2"
39
39
  },
40
40
  "devDependencies": {
41
- "@perses-dev/storybook": "0.49.0"
41
+ "@perses-dev/storybook": "0.50.0-rc.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@mui/material": "^5.15.20",
44
+ "@mui/material": "^6.1.10",
45
45
  "@tanstack/react-query": "^4.7.1",
46
46
  "react": "^17.0.2 || ^18.0.0",
47
47
  "react-dom": "^17.0.2 || ^18.0.0"