@perses-dev/plugin-system 0.44.0 → 0.45.0-rc1

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 (129) hide show
  1. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +12 -3
  2. package/dist/cjs/components/{TimeSeriesQueryEditor/TimeSeriesQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +35 -37
  3. package/dist/cjs/components/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +22 -10
  4. package/dist/cjs/components/{TimeSeriesQueryEditor → MultiQueryEditor}/index.js +2 -2
  5. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +12 -46
  6. package/dist/cjs/components/PluginEditor/PluginEditor.js +6 -7
  7. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +43 -31
  8. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +25 -5
  9. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +5 -3
  10. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
  11. package/dist/cjs/components/ProjectSelect.js +3 -2
  12. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +192 -0
  13. package/dist/cjs/components/{TraceQueryEditor → TimeRangeControls}/index.js +1 -1
  14. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +16 -4
  15. package/dist/cjs/components/index.js +2 -1
  16. package/dist/cjs/constants/user-interface-text.js +4 -1
  17. package/dist/cjs/runtime/DataQueriesProvider/model.js +6 -2
  18. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +23 -2
  19. package/dist/cjs/runtime/plugin-registry.js +7 -5
  20. package/dist/cjs/runtime/time-series-queries.js +2 -5
  21. package/dist/cjs/validation/resource.js +1 -1
  22. package/dist/cjs/validation/user.js +46 -0
  23. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  24. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +12 -3
  25. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  26. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +16 -0
  27. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -0
  28. package/dist/components/{TimeSeriesQueryEditor/TimeSeriesQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +42 -37
  29. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -0
  30. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +28 -0
  31. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -0
  32. package/dist/components/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +32 -9
  33. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -0
  34. package/dist/components/MultiQueryEditor/index.d.ts +2 -0
  35. package/dist/components/MultiQueryEditor/index.d.ts.map +1 -0
  36. package/dist/components/{TimeSeriesQueryEditor → MultiQueryEditor}/index.js +2 -2
  37. package/dist/components/{TraceQueryEditor → MultiQueryEditor}/index.js.map +1 -1
  38. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  39. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +13 -47
  40. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  41. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  42. package/dist/components/PluginEditor/PluginEditor.js +6 -7
  43. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  44. package/dist/components/PluginEditor/plugin-editor-api.d.ts +15 -9
  45. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  46. package/dist/components/PluginEditor/plugin-editor-api.js +43 -31
  47. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  48. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +10 -4
  49. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  50. package/dist/components/PluginKindSelect/PluginKindSelect.js +31 -8
  51. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  52. package/dist/components/PluginRegistry/PluginRegistry.js +5 -3
  53. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  54. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +3 -3
  55. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  56. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
  57. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  58. package/dist/components/ProjectSelect.js +3 -2
  59. package/dist/components/ProjectSelect.js.map +1 -1
  60. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +13 -0
  61. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -0
  62. package/dist/components/TimeRangeControls/TimeRangeControls.js +168 -0
  63. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
  64. package/dist/components/TimeRangeControls/index.d.ts +2 -0
  65. package/dist/components/TimeRangeControls/index.d.ts.map +1 -0
  66. package/dist/components/{TraceQueryEditor → TimeRangeControls}/index.js +1 -1
  67. package/dist/components/TimeRangeControls/index.js.map +1 -0
  68. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  69. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +16 -4
  70. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  71. package/dist/components/index.d.ts +2 -1
  72. package/dist/components/index.d.ts.map +1 -1
  73. package/dist/components/index.js +2 -1
  74. package/dist/components/index.js.map +1 -1
  75. package/dist/constants/user-interface-text.d.ts +2 -0
  76. package/dist/constants/user-interface-text.d.ts.map +1 -1
  77. package/dist/constants/user-interface-text.js +4 -1
  78. package/dist/constants/user-interface-text.js.map +1 -1
  79. package/dist/model/panels.d.ts +7 -2
  80. package/dist/model/panels.d.ts.map +1 -1
  81. package/dist/model/panels.js.map +1 -1
  82. package/dist/model/plugin-base.d.ts +0 -1
  83. package/dist/model/plugin-base.d.ts.map +1 -1
  84. package/dist/model/plugin-base.js.map +1 -1
  85. package/dist/model/time-series-queries.d.ts +0 -1
  86. package/dist/model/time-series-queries.d.ts.map +1 -1
  87. package/dist/model/time-series-queries.js.map +1 -1
  88. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  89. package/dist/runtime/DataQueriesProvider/model.js +6 -2
  90. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  91. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +4 -0
  92. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  93. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +23 -3
  94. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  95. package/dist/runtime/plugin-registry.d.ts +5 -5
  96. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  97. package/dist/runtime/plugin-registry.js +7 -5
  98. package/dist/runtime/plugin-registry.js.map +1 -1
  99. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  100. package/dist/runtime/time-series-queries.js +2 -5
  101. package/dist/runtime/time-series-queries.js.map +1 -1
  102. package/dist/validation/resource.js +1 -1
  103. package/dist/validation/resource.js.map +1 -1
  104. package/dist/validation/user.d.ts +93 -0
  105. package/dist/validation/user.d.ts.map +1 -0
  106. package/dist/validation/user.js +38 -0
  107. package/dist/validation/user.js.map +1 -0
  108. package/package.json +4 -4
  109. package/dist/cjs/components/TraceQueryEditor/TraceQueryEditor.js +0 -143
  110. package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +0 -96
  111. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +0 -7
  112. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +0 -1
  113. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +0 -1
  114. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +0 -12
  115. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +0 -1
  116. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +0 -1
  117. package/dist/components/TimeSeriesQueryEditor/index.d.ts +0 -2
  118. package/dist/components/TimeSeriesQueryEditor/index.d.ts.map +0 -1
  119. package/dist/components/TimeSeriesQueryEditor/index.js.map +0 -1
  120. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +0 -8
  121. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +0 -1
  122. package/dist/components/TraceQueryEditor/TraceQueryEditor.js +0 -130
  123. package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +0 -1
  124. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +0 -12
  125. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +0 -1
  126. package/dist/components/TraceQueryEditor/TraceQueryInput.js +0 -83
  127. package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +0 -1
  128. package/dist/components/TraceQueryEditor/index.d.ts +0 -2
  129. package/dist/components/TraceQueryEditor/index.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"time-series-queries.d.ts","sourceRoot":"","sources":["../../src/model/time-series-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,KAAK,iCAAiC,GAAG;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW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,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAExF,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,KAAK,iCAAiC,CAAC;CAC5F;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/time-series-queries.ts"],"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 { Query, QueryKey } from '@tanstack/react-query';\nimport { AbsoluteTimeRange, UnknownSpec, TimeSeriesData } from '@perses-dev/core';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TimeSeriesQuery.\n */\ntype TimeSeriesQueryPluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running time series queries.\n */\nexport interface TimeSeriesQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext) => Promise<TimeSeriesData>;\n\n dependsOn?: (spec: Spec, ctx: TimeSeriesQueryContext) => TimeSeriesQueryPluginDependencies;\n}\n\n/**\n * Context available to TimeSeriesQuery plugins at runtime.\n */\nexport interface TimeSeriesQueryContext {\n suggestedStepMs?: number;\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n refreshIntervalInMs: number;\n}\n\nexport type TimeSeriesDataQuery = Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>;\n"],"names":[],"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;AAsCjC,WAA2F"}
1
+ {"version":3,"sources":["../../src/model/time-series-queries.ts"],"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 { Query, QueryKey } from '@tanstack/react-query';\nimport { AbsoluteTimeRange, UnknownSpec, TimeSeriesData } from '@perses-dev/core';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TimeSeriesQuery.\n */\ntype TimeSeriesQueryPluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running time series queries.\n */\nexport interface TimeSeriesQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext) => Promise<TimeSeriesData>;\n\n dependsOn?: (spec: Spec, ctx: TimeSeriesQueryContext) => TimeSeriesQueryPluginDependencies;\n}\n\n/**\n * Context available to TimeSeriesQuery plugins at runtime.\n */\nexport interface TimeSeriesQueryContext {\n suggestedStepMs?: number;\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n}\n\nexport type TimeSeriesDataQuery = Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>;\n"],"names":[],"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;AAqCjC,WAA2F"}
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/runtime/DataQueriesProvider/model.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI7E,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,MAAM,WAAW,wBAAwB,CAAC,eAAe,GAAG,WAAW;IACrE,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAED,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,SAAS,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB;AAED,MAAM,WA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,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,sBAAsB,EAAE,cAAc,CAAC;IAC1F,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CACnC;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,GAAG,aAAa,IAAI;IACzC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,8BAW9F;AAED,wBAAgB,YAAY,IAAI,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAuDzE"}
@@ -25,8 +25,12 @@ export function transformQueryResults(results, definitions) {
25
25
  });
26
26
  }
27
27
  export function useQueryType() {
28
- const { data: timeSeriesQueryPlugins, isLoading: isTimeSeriesQueryLoading } = useListPluginMetadata('TimeSeriesQuery');
29
- const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = useListPluginMetadata('TraceQuery');
28
+ const { data: timeSeriesQueryPlugins, isLoading: isTimeSeriesQueryLoading } = useListPluginMetadata([
29
+ 'TimeSeriesQuery'
30
+ ]);
31
+ const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = useListPluginMetadata([
32
+ 'TraceQuery'
33
+ ]);
30
34
  // For example, `map: {"TimeSeriesQuery":["PrometheusTimeSeriesQuery"],"TraceQuery":["TempoTraceQuery"]}`
31
35
  const queryTypeMap = useMemo(()=>{
32
36
  const map = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtime/DataQueriesProvider/model.ts"],"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 { Definition, QueryDefinition, UnknownSpec, QueryDataType } from '@perses-dev/core';\nimport { QueryObserverOptions, UseQueryResult } from '@tanstack/react-query';\nimport { useCallback, useMemo } from 'react';\nimport { useListPluginMetadata } from '../plugin-registry';\n\ntype QueryOptions = Record<string, unknown>;\nexport interface DataQueriesProviderProps<QueryPluginSpec = UnknownSpec> {\n definitions: Array<Definition<QueryPluginSpec>>;\n children?: React.ReactNode;\n options?: QueryOptions;\n queryOptions?: QueryObserverOptions;\n}\n\nexport interface DataQueriesContextType {\n queryResults: QueryData[];\n refetchAll: () => void;\n isFetching: boolean;\n isLoading: boolean;\n errors: unknown[];\n}\n\nexport interface UseDataQueryResults<T> extends Omit<DataQueriesContextType, 'queryResults'> {\n queryResults: Array<QueryData<T>>;\n}\n\nexport type QueryData<T = QueryDataType> = {\n data?: T;\n definition: QueryDefinition;\n error: unknown;\n isFetching: boolean;\n isLoading: boolean;\n refetch?: () => void;\n};\n\nexport function transformQueryResults(results: UseQueryResult[], definitions: QueryDefinition[]) {\n return results.map(({ data, isFetching, isLoading, refetch, error }, i) => {\n return {\n definition: definitions[i],\n data,\n isFetching,\n isLoading,\n refetch,\n error,\n } as QueryData;\n });\n}\n\nexport function useQueryType(): (pluginKind: string) => string | undefined {\n const { data: timeSeriesQueryPlugins, isLoading: isTimeSeriesQueryLoading } =\n useListPluginMetadata('TimeSeriesQuery');\n const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = useListPluginMetadata('TraceQuery');\n\n // For example, `map: {\"TimeSeriesQuery\":[\"PrometheusTimeSeriesQuery\"],\"TraceQuery\":[\"TempoTraceQuery\"]}`\n const queryTypeMap = useMemo(() => {\n const map: Record<string, string[]> = {\n TimeSeriesQuery: [],\n TraceQuery: [],\n };\n\n if (timeSeriesQueryPlugins) {\n timeSeriesQueryPlugins.forEach((plugin) => {\n map[plugin.pluginType]?.push(plugin.kind);\n });\n }\n\n if (traceQueryPlugins) {\n traceQueryPlugins.forEach((plugin) => {\n map[plugin.pluginType]?.push(plugin.kind);\n });\n }\n return map;\n }, [timeSeriesQueryPlugins, traceQueryPlugins]);\n\n const getQueryType = useCallback(\n (pluginKind: string) => {\n const isLoading = (pluginKind: string) => {\n switch (pluginKind) {\n case 'PrometheusTimeSeriesQuery':\n return isTimeSeriesQueryLoading;\n case 'TempoTraceQuery':\n return isTraceQueryPluginLoading;\n }\n throw new Error(`Unable to determine the query type: ${pluginKind}`);\n };\n\n if (isLoading(pluginKind)) {\n return undefined;\n }\n\n for (const queryType in queryTypeMap) {\n if (queryTypeMap[queryType]?.includes(pluginKind)) {\n return queryType;\n }\n }\n\n throw new Error(`Unable to determine the query type: ${pluginKind}`);\n },\n [queryTypeMap, isTimeSeriesQueryLoading, isTraceQueryPluginLoading]\n );\n\n return getQueryType;\n}\n"],"names":["useCallback","useMemo","useListPluginMetadata","transformQueryResults","results","definitions","map","data","isFetching","isLoading","refetch","error","i","definition","useQueryType","timeSeriesQueryPlugins","isTimeSeriesQueryLoading","traceQueryPlugins","isTraceQueryPluginLoading","queryTypeMap","TimeSeriesQuery","TraceQuery","forEach","plugin","pluginType","push","kind","getQueryType","pluginKind","Error","undefined","queryType","includes"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAs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oC,EAAED,WAAW,CAAC;QACrE;QAEA,IAAInB,UAAUmB,aAAa;YACzB,OAAOE;QACT;QAEA,IAAK,MAAMC,aAAaZ,aAAc;gBAChCA;YAAJ,KAAIA,0BAAAA,YAAY,CAACY,UAAU,cAAvBZ,8CAAAA,wBAAyBa,QAAQ,CAACJ,aAAa;gBACjD,OAAOG;YACT;QACF;QAEA,MAAM,IAAIF,MAAM,CAAC,oCAAoC,EAAED,WAAW,CAAC;IACrE,GACA;QAACT;QAAcH;QAA0BE;KAA0B;IAGrE,OAAOS;AACT"}
1
+ {"version":3,"sources":["../../../src/runtime/DataQueriesProvider/model.ts"],"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 { Definition, QueryDefinition, UnknownSpec, QueryDataType } from '@perses-dev/core';\nimport { QueryObserverOptions, UseQueryResult } from '@tanstack/react-query';\nimport { useCallback, useMemo } from 'react';\nimport { useListPluginMetadata } from '../plugin-registry';\n\ntype QueryOptions = Record<string, unknown>;\nexport interface DataQueriesProviderProps<QueryPluginSpec = UnknownSpec> {\n definitions: Array<Definition<QueryPluginSpec>>;\n children?: React.ReactNode;\n options?: QueryOptions;\n queryOptions?: QueryObserverOptions;\n}\n\nexport interface DataQueriesContextType {\n queryResults: QueryData[];\n refetchAll: () => void;\n isFetching: boolean;\n isLoading: boolean;\n errors: unknown[];\n}\n\nexport interface UseDataQueryResults<T> extends Omit<DataQueriesContextType, 'queryResults'> {\n queryResults: Array<QueryData<T>>;\n}\n\nexport type QueryData<T = QueryDataType> = {\n data?: T;\n definition: QueryDefinition;\n error: unknown;\n isFetching: boolean;\n isLoading: boolean;\n refetch?: () => void;\n};\n\nexport function transformQueryResults(results: UseQueryResult[], definitions: QueryDefinition[]) {\n return results.map(({ data, isFetching, isLoading, refetch, error }, i) => {\n return {\n definition: definitions[i],\n data,\n isFetching,\n isLoading,\n refetch,\n error,\n } as QueryData;\n });\n}\n\nexport function useQueryType(): (pluginKind: string) => string | undefined {\n const { data: timeSeriesQueryPlugins, isLoading: isTimeSeriesQueryLoading } = useListPluginMetadata([\n 'TimeSeriesQuery',\n ]);\n const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = useListPluginMetadata(['TraceQuery']);\n\n // For example, `map: {\"TimeSeriesQuery\":[\"PrometheusTimeSeriesQuery\"],\"TraceQuery\":[\"TempoTraceQuery\"]}`\n const queryTypeMap = useMemo(() => {\n const map: Record<string, string[]> = {\n TimeSeriesQuery: [],\n TraceQuery: [],\n };\n\n if (timeSeriesQueryPlugins) {\n timeSeriesQueryPlugins.forEach((plugin) => {\n map[plugin.pluginType]?.push(plugin.kind);\n });\n }\n\n if (traceQueryPlugins) {\n traceQueryPlugins.forEach((plugin) => {\n map[plugin.pluginType]?.push(plugin.kind);\n });\n }\n return map;\n }, [timeSeriesQueryPlugins, traceQueryPlugins]);\n\n const getQueryType = useCallback(\n (pluginKind: string) => {\n const isLoading = (pluginKind: string) => {\n switch (pluginKind) {\n case 'PrometheusTimeSeriesQuery':\n return isTimeSeriesQueryLoading;\n case 'TempoTraceQuery':\n return isTraceQueryPluginLoading;\n }\n throw new Error(`Unable to determine the query type: ${pluginKind}`);\n };\n\n if (isLoading(pluginKind)) {\n return undefined;\n }\n\n for (const queryType in queryTypeMap) {\n if (queryTypeMap[queryType]?.includes(pluginKind)) {\n return queryType;\n }\n }\n\n throw new Error(`Unable to determine the query type: ${pluginKind}`);\n },\n [queryTypeMap, isTimeSeriesQueryLoading, isTraceQueryPluginLoading]\n );\n\n return getQueryType;\n}\n"],"names":["useCallback","useMemo","useListPluginMetadata","transformQueryResults","results","definitions","map","data","isFetching","isLoading","refetch","error","i","definition","useQueryType","timeSeriesQueryPlugins","isTimeSeriesQueryLoading","traceQueryPlugins","isTraceQueryPluginLoading","queryTypeMap","TimeSeriesQuery","TraceQuery","forEach","plugin","pluginType","push","kind","getQueryType","pluginKind","Error","undefined","queryType","includes"],"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,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AAC7C,SAASC,qBAAqB,QAAQ,qBAAqB;AA+B3D,OAAO,SAASC,sBAAsBC,OAAyB,EAAEC,WAA8B;IAC7F,OAAOD,QAAQE,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAEC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,KAAK,EAAE,EAAEC;QACnE,OAAO;YACLC,YAAYR,WAAW,CAACO,EAAE;YAC1BL;YACAC;YACAC;YACAC;YACAC;QACF;IACF;AACF;AAEA,OAAO,SAASG;IACd,MAAM,EAAEP,MAAMQ,sBAAsB,EAAEN,WAAWO,wBAAwB,EAAE,GAAGd,sBAAsB;QAClG;KACD;IACD,MAAM,EAAEK,MAAMU,iBAAiB,EAAER,WAAWS,yBAAyB,EAAE,GAAGhB,sBAAsB;QAAC;KAAa;IAE9G,yGAAyG;IACzG,MAAMiB,eAAelB,QAAQ;QAC3B,MAAMK,MAAgC;YACpCc,iBAAiB,EAAE;YACnBC,YAAY,EAAE;QAChB;QAEA,IAAIN,wBAAwB;YAC1BA,uBAAuBO,OAAO,CAAC,CAACC;oBAC9BjB;iBAAAA,yBAAAA,GAAG,CAACiB,OAAOC,UAAU,CAAC,cAAtBlB,6CAAAA,uBAAwBmB,IAAI,CAACF,OAAOG,IAAI;YAC1C;QACF;QAEA,IAAIT,mBAAmB;YACrBA,kBAAkBK,OAAO,CAAC,CAACC;oBACzBjB;iBAAAA,yBAAAA,GAAG,CAACiB,OAAOC,UAAU,CAAC,cAAtBlB,6CAAAA,uBAAwBmB,IAAI,CAACF,OAAOG,IAAI;YAC1C;QACF;QACA,OAAOpB;IACT,GAAG;QAACS;QAAwBE;KAAkB;IAE9C,MAAMU,eAAe3B,YACnB,CAAC4B;QACC,MAAMnB,YAAY,CAACmB;YACjB,OAAQA;gBACN,KAAK;oBACH,OAAOZ;gBACT,KAAK;oBACH,OAAOE;YACX;YACA,MAAM,IAAIW,MAAM,CAAC,oCAAoC,EAAED,WAAW,CAAC;QACrE;QAEA,IAAInB,UAAUmB,aAAa;YACzB,OAAOE;QACT;QAEA,IAAK,MAAMC,aAAaZ,aAAc;gBAChCA;YAAJ,KAAIA,0BAAAA,YAAY,CAACY,UAAU,cAAvBZ,8CAAAA,wBAAyBa,QAAQ,CAACJ,aAAa;gBACjD,OAAOG;YACT;QACF;QAEA,MAAM,IAAIF,MAAM,CAAC,oCAAoC,EAAED,WAAW,CAAC;IACrE,GACA;QAACT;QAAcH;QAA0BE;KAA0B;IAGrE,OAAOS;AACT"}
@@ -23,6 +23,10 @@ export declare function useTimeRangeContext(): TimeRange;
23
23
  * Get and set the current resolved time range at runtime.
24
24
  */
25
25
  export declare function useTimeRange(): TimeRange;
26
+ /**
27
+ * Gets the suggested step for a graph query in ms for the currently selected time range.
28
+ */
29
+ export declare function useSuggestedStepMs(width?: number): number;
26
30
  /**
27
31
  * Provider implementation that supplies the time range state at runtime.
28
32
  */
@@ -1 +1 @@
1
- {"version":3,"file":"TimeRangeProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/TimeRangeProvider/TimeRangeProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA+E,MAAM,OAAO,CAAC;AACpG,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,cAAc,EAGf,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,sBAAsB;IACrC,SAAS,E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AI,CAAC;IACrD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,cAAc,CAAC;IAC1B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,YAAY,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,cAAc,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CACrD;AAED,eAAO,MAAM,gBAAgB,sCAAkD,CAAC;AAEhF,wBAAgB,mBAAmB,cAMlC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,UAIhD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAwD9D"}
@@ -12,7 +12,7 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
15
- import { isRelativeTimeRange, toAbsoluteTimeRange } from '@perses-dev/core';
15
+ import { isRelativeTimeRange, toAbsoluteTimeRange, getSuggestedStepMs } from '@perses-dev/core';
16
16
  import { getRefreshIntervalInMs } from './refresh-interval';
17
17
  export const TimeRangeContext = /*#__PURE__*/ createContext(undefined);
18
18
  export function useTimeRangeContext() {
@@ -27,6 +27,13 @@ export function useTimeRangeContext() {
27
27
  */ export function useTimeRange() {
28
28
  return useTimeRangeContext();
29
29
  }
30
+ /**
31
+ * Gets the suggested step for a graph query in ms for the currently selected time range.
32
+ */ export function useSuggestedStepMs(width) {
33
+ const { absoluteTimeRange } = useTimeRange();
34
+ if (width === undefined) return 0;
35
+ return getSuggestedStepMs(absoluteTimeRange, width);
36
+ }
30
37
  /**
31
38
  * Provider implementation that supplies the time range state at runtime.
32
39
  */ export function TimeRangeProvider(props) {
@@ -50,6 +57,18 @@ export function useTimeRangeContext() {
50
57
  }, [
51
58
  setRefreshCounter
52
59
  ]);
60
+ const refreshIntervalInMs = getRefreshIntervalInMs(localRefreshInterval);
61
+ useEffect(()=>{
62
+ if (refreshIntervalInMs > 0) {
63
+ const interval = setInterval(()=>{
64
+ refresh();
65
+ }, refreshIntervalInMs);
66
+ return ()=>clearInterval(interval);
67
+ }
68
+ }, [
69
+ refresh,
70
+ refreshIntervalInMs
71
+ ]);
53
72
  const ctx = useMemo(()=>{
54
73
  const absoluteTimeRange = isRelativeTimeRange(localTimeRange) ? toAbsoluteTimeRange(localTimeRange) : localTimeRange;
55
74
  return {
@@ -59,15 +78,16 @@ export function useTimeRangeContext() {
59
78
  refresh,
60
79
  refreshKey: `${absoluteTimeRange.start}:${absoluteTimeRange.end}:${localRefreshInterval}:${refreshCounter}`,
61
80
  refreshInterval: localRefreshInterval,
62
- refreshIntervalInMs: getRefreshIntervalInMs(localRefreshInterval),
81
+ refreshIntervalInMs: refreshIntervalInMs,
63
82
  setRefreshInterval: setRefreshInterval !== null && setRefreshInterval !== void 0 ? setRefreshInterval : setLocalRefreshInterval
64
83
  };
65
84
  }, [
66
85
  localTimeRange,
67
86
  setTimeRange,
68
87
  refresh,
69
- refreshCounter,
70
88
  localRefreshInterval,
89
+ refreshCounter,
90
+ refreshIntervalInMs,
71
91
  setRefreshInterval
72
92
  ]);
73
93
  return /*#__PURE__*/ _jsx(TimeRangeContext.Provider, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtime/TimeRangeProvider/TimeRangeProvider.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 React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport {\n AbsoluteTimeRange,\n DurationString,\n TimeRangeValue,\n isRelativeTimeRange,\n toAbsoluteTimeRange,\n} from '@perses-dev/core';\nimport { getRefreshIntervalInMs } from './refresh-interval';\n\nexport interface TimeRangeProviderProps {\n timeRange: TimeRangeValue;\n refreshInterval?: DurationString;\n setTimeRange?: (value: TimeRangeValue) => void;\n setRefreshInterval?: (value: DurationString) => void;\n children?: React.ReactNode;\n}\n\nexport interface TimeRange {\n timeRange: TimeRangeValue;\n absoluteTimeRange: AbsoluteTimeRange; // resolved absolute time for plugins to use\n setTimeRange: (value: TimeRangeValue) => void;\n refresh: () => void;\n refreshKey: string;\n refreshInterval?: DurationString;\n refreshIntervalInMs: number;\n setRefreshInterval: (value: DurationString) => void;\n}\n\nexport const TimeRangeContext = createContext<TimeRange | undefined>(undefined);\n\nexport function useTimeRangeContext() {\n const ctx = useContext(TimeRangeContext);\n if (ctx === undefined) {\n throw new Error('No TimeRangeContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\n/**\n * Get and set the current resolved time range at runtime.\n */\nexport function useTimeRange(): TimeRange {\n return useTimeRangeContext();\n}\n\n/**\n * Provider implementation that supplies the time range state at runtime.\n */\nexport function TimeRangeProvider(props: TimeRangeProviderProps) {\n const { timeRange, refreshInterval, children, setTimeRange, setRefreshInterval } = props;\n\n const [localTimeRange, setLocalTimeRange] = useState<TimeRangeValue>(timeRange);\n const [localRefreshInterval, setLocalRefreshInterval] = useState<DurationString | undefined>(refreshInterval);\n\n const [refreshCounter, setRefreshCounter] = useState(0);\n\n useEffect(() => {\n setLocalTimeRange(timeRange);\n }, [timeRange, refreshCounter]);\n\n useEffect(() => {\n setLocalRefreshInterval(refreshInterval);\n }, [refreshInterval]);\n\n const refresh = useCallback(() => {\n setRefreshCounter((counter) => counter + 1);\n }, [setRefreshCounter]);\n\n const ctx = useMemo(() => {\n const absoluteTimeRange = isRelativeTimeRange(localTimeRange)\n ? toAbsoluteTimeRange(localTimeRange)\n : localTimeRange;\n return {\n timeRange: localTimeRange,\n setTimeRange: setTimeRange ?? setLocalTimeRange,\n absoluteTimeRange,\n refresh,\n refreshKey: `${absoluteTimeRange.start}:${absoluteTimeRange.end}:${localRefreshInterval}:${refreshCounter}`,\n refreshInterval: localRefreshInterval,\n refreshIntervalInMs: getRefreshIntervalInMs(localRefreshInterval),\n setRefreshInterval: setRefreshInterval ?? setLocalRefreshInterval,\n };\n }, [localTimeRange, setTimeRange, refresh, refreshCounter, localRefreshInterval, setRefreshInterval]);\n\n return <TimeRangeContext.Provider value={ctx}>{children}</TimeRangeContext.Provider>;\n}\n"],"names":["React","createContext","useCallback","useContext","useEffect","useMemo","useState","isRelativeTimeRange","toAbsoluteTimeRange","getRefreshIntervalInMs","TimeRangeContext","undefined","useTimeRangeContext","ctx","Error","useTimeRange","TimeRangeProvider","props","timeRange","refreshInterval","children","setTimeRange","setRefreshInterval","localTimeRange","setLocalTimeRange","localRefreshInterval","setLocalRefreshInterval","refreshCounter","setRefreshCounter","refresh","counter","absoluteTimeRange","refreshKey","start","end","refreshIntervalInMs","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;;AAEjC,OAAOA,SAASC,aAAa,EAAEC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACpG,SAIEC,mBAAmB,EACnBC,mBAAmB,QACd,mBAAmB;AAC1B,SAASC,sBAAsB,QAAQ,qBAAqB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AACC,OAAOxB;kBAAMO;;AACjD"}
1
+ {"version":3,"sources":["../../../src/runtime/TimeRangeProvider/TimeRangeProvider.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 React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport {\n AbsoluteTimeRange,\n DurationString,\n TimeRangeValue,\n isRelativeTimeRange,\n toAbsoluteTimeRange,\n getSuggestedStepMs,\n} from '@perses-dev/core';\nimport { getRefreshIntervalInMs } from './refresh-interval';\n\nexport interface TimeRangeProviderProps {\n timeRange: TimeRangeValue;\n refreshInterval?: DurationString;\n setTimeRange?: (value: TimeRangeValue) => void;\n setRefreshInterval?: (value: DurationString) => void;\n children?: React.ReactNode;\n}\n\nexport interface TimeRange {\n timeRange: TimeRangeValue;\n absoluteTimeRange: AbsoluteTimeRange; // resolved absolute time for plugins to use\n setTimeRange: (value: TimeRangeValue) => void;\n refresh: () => void;\n refreshKey: string;\n refreshInterval?: DurationString;\n refreshIntervalInMs: number;\n setRefreshInterval: (value: DurationString) => void;\n}\n\nexport const TimeRangeContext = createContext<TimeRange | undefined>(undefined);\n\nexport function useTimeRangeContext() {\n const ctx = useContext(TimeRangeContext);\n if (ctx === undefined) {\n throw new Error('No TimeRangeContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\n/**\n * Get and set the current resolved time range at runtime.\n */\nexport function useTimeRange(): TimeRange {\n return useTimeRangeContext();\n}\n\n/**\n * Gets the suggested step for a graph query in ms for the currently selected time range.\n */\nexport function useSuggestedStepMs(width?: number) {\n const { absoluteTimeRange } = useTimeRange();\n if (width === undefined) return 0;\n return getSuggestedStepMs(absoluteTimeRange, width);\n}\n\n/**\n * Provider implementation that supplies the time range state at runtime.\n */\nexport function TimeRangeProvider(props: TimeRangeProviderProps) {\n const { timeRange, refreshInterval, children, setTimeRange, setRefreshInterval } = props;\n\n const [localTimeRange, setLocalTimeRange] = useState<TimeRangeValue>(timeRange);\n const [localRefreshInterval, setLocalRefreshInterval] = useState<DurationString | undefined>(refreshInterval);\n\n const [refreshCounter, setRefreshCounter] = useState(0);\n\n useEffect(() => {\n setLocalTimeRange(timeRange);\n }, [timeRange, refreshCounter]);\n\n useEffect(() => {\n setLocalRefreshInterval(refreshInterval);\n }, [refreshInterval]);\n\n const refresh = useCallback(() => {\n setRefreshCounter((counter) => counter + 1);\n }, [setRefreshCounter]);\n\n const refreshIntervalInMs = getRefreshIntervalInMs(localRefreshInterval);\n useEffect(() => {\n if (refreshIntervalInMs > 0) {\n const interval = setInterval(() => {\n refresh();\n }, refreshIntervalInMs);\n\n return () => clearInterval(interval);\n }\n }, [refresh, refreshIntervalInMs]);\n\n const ctx = useMemo(() => {\n const absoluteTimeRange = isRelativeTimeRange(localTimeRange)\n ? toAbsoluteTimeRange(localTimeRange)\n : localTimeRange;\n return {\n timeRange: localTimeRange,\n setTimeRange: setTimeRange ?? setLocalTimeRange,\n absoluteTimeRange,\n refresh,\n refreshKey: `${absoluteTimeRange.start}:${absoluteTimeRange.end}:${localRefreshInterval}:${refreshCounter}`,\n refreshInterval: localRefreshInterval,\n refreshIntervalInMs: refreshIntervalInMs,\n setRefreshInterval: setRefreshInterval ?? setLocalRefreshInterval,\n };\n }, [\n localTimeRange,\n setTimeRange,\n refresh,\n localRefreshInterval,\n refreshCounter,\n refreshIntervalInMs,\n setRefreshInterval,\n ]);\n\n return <TimeRangeContext.Provider value={ctx}>{children}</TimeRangeContext.Provider>;\n}\n"],"names":["React","createContext","useCallback","useContext","useEffect","useMemo","useState","isRelativeTimeRange","toAbsoluteTimeRange","getSuggestedStepMs","getRefreshIntervalInMs","TimeRangeContext","undefined","useTimeRangeContext","ctx","Error","useTimeRange","useSuggestedStepMs","width","absoluteTimeRange","TimeRangeProvider","props","timeRange","refreshInterval","children","setTimeRange","setRefreshInterval","localTimeRange","setLocalTimeRange","localRefreshInterval","setLocalRefreshInterval","refreshCounter","setRefreshCounter","refresh","counter","refreshIntervalInMs","interval","setInterval","clearInterval","refreshKey","start","end","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;;AAEjC,OAAOA,SAASC,aAAa,EAAEC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACpG,SAIEC,mBAAmB,EACnBC,mBAAmB,EACnBC,kBAAkB,QACb,mBAAmB;AAC1B,SAASC,sBAAsB,QAAQ,qBAAqB;AAqB5D,OAAO,MAAMC,iCAAmBV,cAAqCW,WAAW;AAEhF,OAAO,SAASC;IACd,MAAMC,MAAMX,WAAWQ;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAEA;;CAEC,GACD,OAAO,SAASE;IACd,OAAOH;AACT;AAEA;;CAEC,GACD,OAAO,SAASI,mBAAmBC,KAAc;IAC/C,MAAM,EAAEC,iBAAiB,EAAE,GAAGH;IAC9B,IAAIE,UAAUN,WAAW,OAAO;IAChC,OAAOH,mBAAmBU,mBAAmBD;AAC/C;AAEA;;CAEC,GACD,OAAO,SAASE,kBAAkBC,KAA6B;IAC7D,MAAM,EAAEC,SAAS,EAAEC,eAAe,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,kBAAkB,EAAE,GAAGL;IAEnF,MAAM,CAACM,gBAAgBC,kBAAkB,GAAGtB,SAAyBgB;IACrE,MAAM,CAACO,sBAAsBC,wBAAwB,GAAGxB,SAAqCiB;IAE7F,MAAM,CAACQ,gBAAgBC,kBAAkB,GAAG1B,SAAS;IAErDF,UAAU;QACRwB,kBAAkBN;IACpB,GAAG;QAACA;QAAWS;KAAe;IAE9B3B,UAAU;QACR0B,wBAAwBP;IAC1B,GAAG;QAACA;KAAgB;IAEpB,MAAMU,UAAU/B,YAAY;QAC1B8B,kBAAkB,CAACE,UAAYA,UAAU;IAC3C,GAAG;QAACF;KAAkB;IAEtB,MAAMG,sBAAsBzB,uBAAuBmB;IACnDzB,UAAU;QACR,IAAI+B,sBAAsB,GAAG;YAC3B,MAAMC,WAAWC,YAAY;gBAC3BJ;YACF,GAAGE;YAEH,OAAO,IAAMG,cAAcF;QAC7B;IACF,GAAG;QAACH;QAASE;KAAoB;IAEjC,MAAMrB,MAAMT,QAAQ;QAClB,MAAMc,oBAAoBZ,oBAAoBoB,kBAC1CnB,oBAAoBmB,kBACpBA;QACJ,OAAO;YACLL,WAAWK;YACXF,cAAcA,yBAAAA,0BAAAA,eAAgBG;YAC9BT;YACAc;YACAM,YAAY,CAAC,EAAEpB,kBAAkBqB,KAAK,CAAC,CAAC,EAAErB,kBAAkBsB,GAAG,CAAC,CAAC,EAAEZ,qBAAqB,CAAC,EAAEE,eAAe,CAAC;YAC3GR,iBAAiBM;YACjBM,qBAAqBA;YACrBT,oBAAoBA,+BAAAA,gCAAAA,qBAAsBI;QAC5C;IACF,GAAG;QACDH;QACAF;QACAQ;QACAJ;QACAE;QACAI;QACAT;KACD;IAED,qBAAO,KAACf,iBAAiB+B,QAAQ;QAACC,OAAO7B;kBAAMU;;AACjD"}
@@ -4,7 +4,7 @@ import { BuiltinVariableDefinition } from '@perses-dev/core';
4
4
  import { DefaultPluginKinds, PluginImplementation, PluginMetadata, PluginType } from '../model';
5
5
  export interface PluginRegistryContextType {
6
6
  getPlugin<T extends PluginType>(pluginType: T, kind: string): Promise<PluginImplementation<T>>;
7
- listPluginMetadata(pluginType: PluginType): Promise<PluginMetadata[]>;
7
+ listPluginMetadata(pluginTypes: PluginType[]): Promise<PluginMetadata[]>;
8
8
  defaultPluginKinds?: DefaultPluginKinds;
9
9
  }
10
10
  export declare const PluginRegistryContext: import("react").Context<PluginRegistryContextType | undefined>;
@@ -13,22 +13,22 @@ export declare const PluginRegistryContext: import("react").Context<PluginRegist
13
13
  * be using `usePlugin` or `useListPluginMetadata` instead.
14
14
  */
15
15
  export declare function usePluginRegistry(): PluginRegistryContextType;
16
- type UsePluginOptions<T extends PluginType> = Omit<UseQueryOptions<PluginImplementation<T>, Error, PluginImplementation<T>, [string, PluginType, string]>, 'queryKey' | 'queryFn'>;
16
+ type UsePluginOptions<T extends PluginType> = Omit<UseQueryOptions<PluginImplementation<T>, Error, PluginImplementation<T>, [string, PluginType | undefined, string]>, 'queryKey' | 'queryFn'>;
17
17
  /**
18
18
  * Loads a plugin and returns the plugin implementation, along with loading/error state.
19
19
  */
20
- export declare function usePlugin<T extends PluginType>(pluginType: T, kind: string, options?: UsePluginOptions<T>): import("@tanstack/react-query").UseQueryResult<PluginImplementation<T>, Error>;
20
+ export declare function usePlugin<T extends PluginType>(pluginType: T | undefined, kind: string, options?: UsePluginOptions<T>): import("@tanstack/react-query").UseQueryResult<PluginImplementation<T>, Error>;
21
21
  /**
22
22
  * Loads a list of plugins and returns the plugin implementation, along with loading/error state.
23
23
  */
24
24
  export declare function usePlugins<T extends PluginType>(pluginType: T, plugins: Array<{
25
25
  kind: string;
26
26
  }>): import("@tanstack/react-query").UseQueryResult<PluginImplementation<T>, unknown>[];
27
- type UseListPluginMetadataOptions = Omit<UseQueryOptions<PluginMetadata[], Error, PluginMetadata[], [string, PluginType]>, 'queryKey' | 'queryFn'>;
27
+ type UseListPluginMetadataOptions = Omit<UseQueryOptions<PluginMetadata[], Error, PluginMetadata[], [string, PluginType[]]>, 'queryKey' | 'queryFn'>;
28
28
  /**
29
29
  * Gets a list of plugin metadata for the specified plugin type and returns it, along with loading/error state.
30
30
  */
31
- export declare function useListPluginMetadata(pluginType: PluginType, options?: UseListPluginMetadataOptions): import("@tanstack/react-query").UseQueryResult<PluginMetadata[], Error>;
31
+ export declare function useListPluginMetadata(pluginTypes: PluginType[], options?: UseListPluginMetadataOptions): import("@tanstack/react-query").UseQueryResult<PluginMetadata[], Error>;
32
32
  export declare function usePluginBuiltinVariableDefinitions(): import("@tanstack/react-query").UseQueryResult<BuiltinVariableDefinition[], unknown>;
33
33
  export {};
34
34
  //# sourceMappingURL=plugin-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../src/runtime/plugin-registry.ts"],"names":[],"mappings":";AAcA,OAAO,EAAwB,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEhG,MAAM,WAAW,yBAAyB;IACxC,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/F,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IACtE,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,eAAO,MAAM,qBAAqB,gEAAkE,CAAC;AAErG;;;GAGG;AACH,wBAAgB,iBAAiB,8BAMhC;AAGD,KAAK,gBAAgB,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAChD,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,EACtG,UAAU,GAAG,SAAS,CACvB,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BAAqB,gEAAkE,CAAC;AAErG;;;GAGG;AACH,wBAAgB,iBAAiB,8BAMhC;AAGD,KAAK,gBAAgB,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAChD,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,EAAE,MAAM,CAAC,CAAC,EAClH,UAAU,GAAG,SAAS,CACvB,CAAC;AAEF;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,UAAU,EAC5C,UAAU,EAAE,CAAC,GAAG,SAAS,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,kFAS9B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,sFAU/F;AAGD,KAAK,4BAA4B,GAAG,IAAI,CACtC,eAAe,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,EAClF,UAAU,GAAG,SAAS,CACvB,CAAC;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,4BAA4B,2EAGtG;AAED,wBAAgB,mCAAmC,yFAelD"}
@@ -30,7 +30,7 @@ export const PluginRegistryContext = createContext(undefined);
30
30
  // We never want to ask for a plugin when the kind isn't set yet, so disable those queries automatically
31
31
  options = {
32
32
  ...options,
33
- enabled: ((_options_enabled = options === null || options === void 0 ? void 0 : options.enabled) !== null && _options_enabled !== void 0 ? _options_enabled : true) && kind !== ''
33
+ enabled: ((_options_enabled = options === null || options === void 0 ? void 0 : options.enabled) !== null && _options_enabled !== void 0 ? _options_enabled : true) && pluginType !== undefined && kind !== ''
34
34
  };
35
35
  const { getPlugin } = usePluginRegistry();
36
36
  return useQuery([
@@ -58,19 +58,21 @@ export const PluginRegistryContext = createContext(undefined);
58
58
  }
59
59
  /**
60
60
  * Gets a list of plugin metadata for the specified plugin type and returns it, along with loading/error state.
61
- */ export function useListPluginMetadata(pluginType, options) {
61
+ */ export function useListPluginMetadata(pluginTypes, options) {
62
62
  const { listPluginMetadata } = usePluginRegistry();
63
63
  return useQuery([
64
64
  'listPluginMetadata',
65
- pluginType
66
- ], ()=>listPluginMetadata(pluginType), options);
65
+ pluginTypes
66
+ ], ()=>listPluginMetadata(pluginTypes), options);
67
67
  }
68
68
  export function usePluginBuiltinVariableDefinitions() {
69
69
  const { getPlugin, listPluginMetadata } = usePluginRegistry();
70
70
  return useQuery([
71
71
  'usePluginBuiltinVariableDefinitions'
72
72
  ], async ()=>{
73
- const datasources = await listPluginMetadata('Datasource');
73
+ const datasources = await listPluginMetadata([
74
+ 'Datasource'
75
+ ]);
74
76
  const datasourceKinds = new Set(datasources.map((datasource)=>datasource.kind));
75
77
  const result = [];
76
78
  for (const kind of datasourceKinds){
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/plugin-registry.ts"],"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 { createContext, useContext } from 'react';\nimport { useQuery, useQueries, UseQueryOptions } from '@tanstack/react-query';\nimport { BuiltinVariableDefinition } from '@perses-dev/core';\nimport { DefaultPluginKinds, PluginImplementation, PluginMetadata, PluginType } from '../model';\n\nexport interface PluginRegistryContextType {\n getPlugin<T extends PluginType>(pluginType: T, kind: string): Promise<PluginImplementation<T>>;\n listPluginMetadata(pluginType: PluginType): Promise<PluginMetadata[]>;\n defaultPluginKinds?: DefaultPluginKinds;\n}\n\nexport const PluginRegistryContext = createContext<PluginRegistryContextType | undefined>(undefined);\n\n/**\n * Use the PluginRegistry context directly. This is meant as an escape hatch for custom async flows. You should probably\n * be using `usePlugin` or `useListPluginMetadata` instead.\n */\nexport function usePluginRegistry() {\n const ctx = useContext(PluginRegistryContext);\n if (ctx === undefined) {\n throw new Error('PluginRegistryContext not found. Did you forget a provider?');\n }\n return ctx;\n}\n\n// Allows consumers to pass useQuery options from react-query when loading a plugin\ntype UsePluginOptions<T extends PluginType> = Omit<\n UseQueryOptions<PluginImplementation<T>, Error, PluginImplementation<T>, [string, PluginType, string]>,\n 'queryKey' | 'queryFn'\n>;\n\n/**\n * Loads a plugin and returns the plugin implementation, along with loading/error state.\n */\nexport function usePlugin<T extends PluginType>(pluginType: T, kind: string, options?: UsePluginOptions<T>) {\n // We never want to ask for a plugin when the kind isn't set yet, so disable those queries automatically\n options = {\n ...options,\n enabled: (options?.enabled ?? true) && kind !== '',\n };\n const { getPlugin } = usePluginRegistry();\n return useQuery(['getPlugin', pluginType, kind], () => getPlugin(pluginType, kind), options);\n}\n\n/**\n * Loads a list of plugins and returns the plugin implementation, along with loading/error state.\n */\nexport function usePlugins<T extends PluginType>(pluginType: T, plugins: Array<{ kind: string }>) {\n const { getPlugin } = usePluginRegistry();\n return useQueries({\n queries: plugins.map((p) => {\n return {\n queryKey: ['getPlugin', pluginType, p.kind],\n queryFn: () => getPlugin(pluginType, p.kind),\n };\n }),\n });\n}\n\n// Allow consumers to pass useQuery options from react-query when listing metadata\ntype UseListPluginMetadataOptions = Omit<\n UseQueryOptions<PluginMetadata[], Error, PluginMetadata[], [string, PluginType]>,\n 'queryKey' | 'queryFn'\n>;\n\n/**\n * Gets a list of plugin metadata for the specified plugin type and returns it, along with loading/error state.\n */\nexport function useListPluginMetadata(pluginType: PluginType, options?: UseListPluginMetadataOptions) {\n const { listPluginMetadata } = usePluginRegistry();\n return useQuery(['listPluginMetadata', pluginType], () => listPluginMetadata(pluginType), options);\n}\n\nexport function usePluginBuiltinVariableDefinitions() {\n const { getPlugin, listPluginMetadata } = usePluginRegistry();\n\n return useQuery(['usePluginBuiltinVariableDefinitions'], async () => {\n const datasources = await listPluginMetadata('Datasource');\n const datasourceKinds = new Set(datasources.map((datasource) => datasource.kind));\n const result: BuiltinVariableDefinition[] = [];\n for (const kind of datasourceKinds) {\n const plugin = await getPlugin('Datasource', kind);\n if (plugin.getBuiltinVariableDefinitions) {\n plugin.getBuiltinVariableDefinitions().forEach((definition) => result.push(definition));\n }\n }\n return result;\n });\n}\n"],"names":["createContext","useContext","useQuery","useQueries","PluginRegistryContext","undefined","usePluginRegistry","ctx","Error","usePlugin","pluginType","kind","options","enabled","getPlugin","usePlugins","plugins","queries","map","p","queryKey","queryFn","useListPluginMetadata","listPluginMetadata","usePluginBuiltinVariableDefinitions","datasources","datasourceKinds","Set","datasource","result","plugin","getBuiltinVariableDefinitions","forEach","definition","push"],"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,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAClD,SAASC,QAAQ,EAAEC,UAAU,QAAyB,wBAAwB;AAU9E,OAAO,MAAMC,wBAAwBJ,cAAqDK,WAAW;AAErG;;;CAGC,GACD,OAAO,SAASC;IACd,MAAMC,MAAMN,WAAWG;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAQA;;CAEC,GACD,OAAO,SAASE,UAAgCC,UAAa,EAAEC,IAAY,EAAEC,OAA6B;QAI5FA;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C7E;QACF;QACA,OAAOJ;IACT;AACF"}
1
+ {"version":3,"sources":["../../src/runtime/plugin-registry.ts"],"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 { createContext, useContext } from 'react';\nimport { useQuery, useQueries, UseQueryOptions } from '@tanstack/react-query';\nimport { BuiltinVariableDefinition } from '@perses-dev/core';\nimport { DefaultPluginKinds, PluginImplementation, PluginMetadata, PluginType } from '../model';\n\nexport interface PluginRegistryContextType {\n getPlugin<T extends PluginType>(pluginType: T, kind: string): Promise<PluginImplementation<T>>;\n listPluginMetadata(pluginTypes: PluginType[]): Promise<PluginMetadata[]>;\n defaultPluginKinds?: DefaultPluginKinds;\n}\n\nexport const PluginRegistryContext = createContext<PluginRegistryContextType | undefined>(undefined);\n\n/**\n * Use the PluginRegistry context directly. This is meant as an escape hatch for custom async flows. You should probably\n * be using `usePlugin` or `useListPluginMetadata` instead.\n */\nexport function usePluginRegistry() {\n const ctx = useContext(PluginRegistryContext);\n if (ctx === undefined) {\n throw new Error('PluginRegistryContext not found. Did you forget a provider?');\n }\n return ctx;\n}\n\n// Allows consumers to pass useQuery options from react-query when loading a plugin\ntype UsePluginOptions<T extends PluginType> = Omit<\n UseQueryOptions<PluginImplementation<T>, Error, PluginImplementation<T>, [string, PluginType | undefined, string]>,\n 'queryKey' | 'queryFn'\n>;\n\n/**\n * Loads a plugin and returns the plugin implementation, along with loading/error state.\n */\nexport function usePlugin<T extends PluginType>(\n pluginType: T | undefined,\n kind: string,\n options?: UsePluginOptions<T>\n) {\n // We never want to ask for a plugin when the kind isn't set yet, so disable those queries automatically\n options = {\n ...options,\n enabled: (options?.enabled ?? true) && pluginType !== undefined && kind !== '',\n };\n const { getPlugin } = usePluginRegistry();\n return useQuery(['getPlugin', pluginType, kind], () => getPlugin(pluginType!, kind), options);\n}\n\n/**\n * Loads a list of plugins and returns the plugin implementation, along with loading/error state.\n */\nexport function usePlugins<T extends PluginType>(pluginType: T, plugins: Array<{ kind: string }>) {\n const { getPlugin } = usePluginRegistry();\n return useQueries({\n queries: plugins.map((p) => {\n return {\n queryKey: ['getPlugin', pluginType, p.kind],\n queryFn: () => getPlugin(pluginType, p.kind),\n };\n }),\n });\n}\n\n// Allow consumers to pass useQuery options from react-query when listing metadata\ntype UseListPluginMetadataOptions = Omit<\n UseQueryOptions<PluginMetadata[], Error, PluginMetadata[], [string, PluginType[]]>,\n 'queryKey' | 'queryFn'\n>;\n\n/**\n * Gets a list of plugin metadata for the specified plugin type and returns it, along with loading/error state.\n */\nexport function useListPluginMetadata(pluginTypes: PluginType[], options?: UseListPluginMetadataOptions) {\n const { listPluginMetadata } = usePluginRegistry();\n return useQuery(['listPluginMetadata', pluginTypes], () => listPluginMetadata(pluginTypes), options);\n}\n\nexport function usePluginBuiltinVariableDefinitions() {\n const { getPlugin, listPluginMetadata } = usePluginRegistry();\n\n return useQuery(['usePluginBuiltinVariableDefinitions'], async () => {\n const datasources = await listPluginMetadata(['Datasource']);\n const datasourceKinds = new Set(datasources.map((datasource) => datasource.kind));\n const result: BuiltinVariableDefinition[] = [];\n for (const kind of datasourceKinds) {\n const plugin = await getPlugin('Datasource', kind);\n if (plugin.getBuiltinVariableDefinitions) {\n plugin.getBuiltinVariableDefinitions().forEach((definition) => result.push(definition));\n }\n }\n return result;\n });\n}\n"],"names":["createContext","useContext","useQuery","useQueries","PluginRegistryContext","undefined","usePluginRegistry","ctx","Error","usePlugin","pluginType","kind","options","enabled","getPlugin","usePlugins","plugins","queries","map","p","queryKey","queryFn","useListPluginMetadata","pluginTypes","listPluginMetadata","usePluginBuiltinVariableDefinitions","datasources","datasourceKinds","Set","datasource","result","plugin","getBuiltinVariableDefinitions","forEach","definition","push"],"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,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAClD,SAASC,QAAQ,EAAEC,UAAU,QAAyB,wBAAwB;AAU9E,OAAO,MAAMC,wBAAwBJ,cAAqDK,WAAW;AAErG;;;CAGC,GACD,OAAO,SAASC;IACd,MAAMC,MAAMN,WAAWG;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAQA;;CAEC,GACD,OAAO,SAASE,UACdC,UAAyB,EACzBC,IAAY,EACZC,OAA6B;QAKjBA;IAHZ,wGAAwG;IACxGA,UAAU;QACR,GAAGA,OAAO;QACVC,SAAS,AAACD,CAAAA,CAAAA,mBAAAA,oBAAAA,8BAAAA,QAASC,OAAO,cAAhBD,8BAAAA,mBAAoB,IAAG,KAAMF,eAAeL,aAAaM,SAAS;IAC9E;IACA,MAAM,EAAEG,SAAS,EAAE,GAAGR;IACtB,OAAOJ,SAAS;QAAC;QAAaQ;QAAYC;KAAK,EAAE,IAAMG,UAAUJ,YAAaC,OAAOC;AACvF;AAEA;;CAEC,GACD,OAAO,SAASG,WAAiCL,UAAa,EAAEM,OAAgC;IAC9F,MAAM,EAAEF,SAAS,EAAE,GAAGR;IACtB,OAAOH,WAAW;QAChBc,SAASD,QAAQE,GAAG,CAAC,CAACC;YACpB,OAAO;gBACLC,UAAU;oBAAC;oBAAaV;oBAAYS,EAAER,IAAI;iBAAC;gBAC3CU,SAAS,IAAMP,UAAUJ,YAAYS,EAAER,IAAI;YAC7C;QACF;IACF;AACF;AAQA;;CAEC,GACD,OAAO,SAASW,sBAAsB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AAE,yBAAyB,EACnC,YAAY,CAAC,EAAE,oBAAoB,6EA4BpC;AAmBD;;GAEG;AACH,wBAAgB,0BAA0B,0BAIzC;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,UAAU,yBAW3D"}
1
+ {"version":3,"file":"time-series-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/time-series-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAKL,UAAU,EAEV,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAe,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAiD,MAAM,UAAU,CAAC;AAM9F,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAmDvD;;GAEG;AACH,eAAO,MAAM,kBAAkB,eACjB,yBAAyB,YAC3B,yBAAyB,iBACpB,oBAAoB,4EAmBpC,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,yBAAyB,EAAE,EACxC,OAAO,CAAC,EAAE,yBAAyB,EACnC,YAAY,CAAC,EAAE,oBAAoB,6EA2BpC;AAkBD;;GAEG;AACH,wBAAgB,0BAA0B,0BAIzC;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,UAAU,yBAW3D"}
@@ -70,7 +70,6 @@ function getQueryOptions({ plugin, definition, context }) {
70
70
  return useQuery({
71
71
  enabled: ((_queryOptions_enabled = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.enabled) !== null && _queryOptions_enabled !== void 0 ? _queryOptions_enabled : true) || queryEnabled,
72
72
  queryKey: queryKey,
73
- refetchInterval: context.refreshIntervalInMs > 0 ? context.refreshIntervalInMs : false,
74
73
  queryFn: ()=>{
75
74
  // The 'enabled' option should prevent this from happening, but make TypeScript happy by checking
76
75
  if (plugin === undefined) {
@@ -106,7 +105,6 @@ function getQueryOptions({ plugin, definition, context }) {
106
105
  return {
107
106
  enabled: ((_queryOptions_enabled = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.enabled) !== null && _queryOptions_enabled !== void 0 ? _queryOptions_enabled : true) && queryEnabled,
108
107
  queryKey: queryKey,
109
- refetchInterval: context.refreshIntervalInMs > 0 ? context.refreshIntervalInMs : undefined,
110
108
  queryFn: async ()=>{
111
109
  // Keep options out of query key so we don't re-run queries because suggested step changes
112
110
  const ctx = {
@@ -124,15 +122,14 @@ function getQueryOptions({ plugin, definition, context }) {
124
122
  /**
125
123
  * Build the time series query context object from data available at runtime
126
124
  */ function useTimeSeriesQueryContext() {
127
- const { absoluteTimeRange, refreshKey, refreshIntervalInMs } = useTimeRange();
125
+ const { absoluteTimeRange, refreshKey } = useTimeRange();
128
126
  const variableState = useVariableValues();
129
127
  const datasourceStore = useDatasourceStore();
130
128
  return {
131
129
  timeRange: absoluteTimeRange,
132
130
  variableState,
133
131
  datasourceStore,
134
- refreshKey,
135
- refreshIntervalInMs: refreshIntervalInMs
132
+ refreshKey
136
133
  };
137
134
  }
138
135
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/time-series-queries.ts"],"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 {\n useQuery,\n useQueries,\n useQueryClient,\n Query,\n QueryCache,\n QueryKey,\n QueryObserverOptions,\n} from '@tanstack/react-query';\nimport { TimeSeriesQueryDefinition, UnknownSpec, TimeSeriesData } from '@perses-dev/core';\nimport { TimeSeriesDataQuery, TimeSeriesQueryContext, TimeSeriesQueryPlugin } from '../model';\nimport { VariableStateMap, useVariableValues } from './template-variables';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useDatasourceStore } from './datasources';\nimport { usePlugin, usePluginRegistry, usePlugins } from './plugin-registry';\n\nexport interface UseTimeSeriesQueryOptions {\n suggestedStepMs?: number;\n}\n\nexport const TIME_SERIES_QUERY_KEY = 'TimeSeriesQuery';\n\n/**\n * Returns a serialized string of the current state of variable values.\n */\nfunction getVariableValuesKey(v: VariableStateMap) {\n return Object.values(v)\n .map((v) => JSON.stringify(v.value))\n .join(',');\n}\n\nfunction filterVariableStateMap(v: VariableStateMap, names?: string[]) {\n if (!names) {\n return v;\n }\n return Object.fromEntries(Object.entries(v).filter(([name]) => names.includes(name)));\n}\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: TimeSeriesQueryPlugin;\n definition: TimeSeriesQueryDefinition;\n context: TimeSeriesQueryContext;\n}) {\n const { timeRange, datasourceStore, suggestedStepMs, variableState, refreshKey } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n // Determine queryKey\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n const queryKey = [definition, timeRange, datasourceStore, suggestedStepMs, variablesValueKey, refreshKey] as const;\n\n // Determine queryEnabled\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n\n return {\n queryKey,\n queryEnabled,\n };\n}\n\n/**\n * Runs a time series query using a plugin and returns the results.\n */\nexport const useTimeSeriesQuery = (\n definition: TimeSeriesQueryDefinition,\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: QueryObserverOptions\n) => {\n const { data: plugin } = usePlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);\n const context = useTimeSeriesQueryContext();\n\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return useQuery({\n enabled: (queryOptions?.enabled ?? true) || queryEnabled,\n queryKey: queryKey,\n refetchInterval: context.refreshIntervalInMs > 0 ? context.refreshIntervalInMs : false,\n queryFn: () => {\n // The 'enabled' option should prevent this from happening, but make TypeScript happy by checking\n if (plugin === undefined) {\n throw new Error('Expected plugin to be loaded');\n }\n // Keep options out of query key so we don't re-run queries because suggested step changes\n const ctx: TimeSeriesQueryContext = { ...context, suggestedStepMs: options?.suggestedStepMs };\n return plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx);\n },\n });\n};\n\n/**\n * Runs multiple time series queries using plugins and returns the results.\n */\nexport function useTimeSeriesQueries(\n definitions: TimeSeriesQueryDefinition[],\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: QueryObserverOptions\n) {\n const { getPlugin } = usePluginRegistry();\n const context = useTimeSeriesQueryContext();\n\n const pluginLoaderResponse = usePlugins(\n TIME_SERIES_QUERY_KEY,\n definitions.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return {\n enabled: (queryOptions?.enabled ?? true) && queryEnabled,\n queryKey: queryKey,\n refetchInterval: context.refreshIntervalInMs > 0 ? context.refreshIntervalInMs : undefined,\n queryFn: async () => {\n // Keep options out of query key so we don't re-run queries because suggested step changes\n const ctx: TimeSeriesQueryContext = { ...context, suggestedStepMs: options?.suggestedStepMs };\n const plugin = await getPlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);\n const data = await plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx);\n return data;\n },\n };\n }),\n });\n}\n\n/**\n * Build the time series query context object from data available at runtime\n */\nfunction useTimeSeriesQueryContext(): TimeSeriesQueryContext {\n const { absoluteTimeRange, refreshKey, refreshIntervalInMs } = useTimeRange();\n const variableState = useVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n timeRange: absoluteTimeRange,\n variableState,\n datasourceStore,\n refreshKey,\n refreshIntervalInMs: refreshIntervalInMs,\n };\n}\n\n/**\n * Get active time series queries for query results summary\n */\nexport function useActiveTimeSeriesQueries() {\n const queryClient = useQueryClient();\n const queryCache = queryClient.getQueryCache();\n return getActiveTimeSeriesQueries(queryCache);\n}\n\n/**\n * Filter all cached queries down to only active time series queries\n */\nexport function getActiveTimeSeriesQueries(cache: QueryCache) {\n const queries: TimeSeriesDataQuery[] = [];\n\n for (const query of cache.findAll({ type: 'active' })) {\n const firstPart = query.queryKey?.[0] as UnknownSpec;\n if (firstPart?.kind && (firstPart.kind as string).startsWith(TIME_SERIES_QUERY_KEY)) {\n queries.push(query as Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>);\n }\n }\n\n return queries;\n}\n"],"names":["useQuery","useQueries","useQueryClient","useVariableValues","useTimeRange","useDatasourceStore","usePlugin","usePluginRegistry","usePlugins","TIME_SERIES_QUERY_KEY","getVariableValuesKey","v","Object","values","map","JSON","stringify","value","join","filterVariableStateMap","names","fromEntries","entries","filter","name","includes","getQueryOptions","plugin","definition","context","timeRange","datasourceStore","suggestedStepMs","variableState","refreshKey","dependencies","dependsOn","spec","variableDependencies","variables","filteredVariabledState","variablesValueKey","queryKey","waitToLoad","some","loading","queryEnabled","undefined","useTimeSeriesQuery","options","queryOptions","data","kind","useTimeSeriesQueryContext","enabled","refetchInterval","refreshIntervalInMs","queryFn","Error","ctx","getTimeSeriesData","useTimeSeriesQueries","definitions","getPlugin","pluginLoaderResponse","d","queries","idx","absoluteTimeRange","useActiveTimeSeriesQueries","queryClient","queryCache","getQueryCache","getActiveTimeSeriesQueries","cache","query","findAll","type","firstPart","startsWith","push"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;A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d,MAAMC,cAAcpE;IACpB,MAAMqE,aAAaD,YAAYE,aAAa;IAC5C,OAAOC,2BAA2BF;AACpC;AAEA;;CAEC,GACD,OAAO,SAASE,2BAA2BC,KAAiB;IAC1D,MAAMR,UAAiC,EAAE;IAEzC,KAAK,MAAMS,SAASD,MAAME,OAAO,CAAC;QAAEC,MAAM;IAAS,GAAI;YACnCF;QAAlB,MAAMG,aAAYH,kBAAAA,MAAMjC,QAAQ,cAAdiC,sCAAAA,eAAgB,CAAC,EAAE;QACrC,IAAIG,CAAAA,sBAAAA,gCAAAA,UAAW1B,IAAI,KAAI,AAAC0B,UAAU1B,IAAI,CAAY2B,UAAU,CAACtE,wBAAwB;YACnFyD,QAAQc,IAAI,CAACL;QACf;IACF;IAEA,OAAOT;AACT"}
1
+ {"version":3,"sources":["../../src/runtime/time-series-queries.ts"],"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 {\n useQuery,\n useQueries,\n useQueryClient,\n Query,\n QueryCache,\n QueryKey,\n QueryObserverOptions,\n} from '@tanstack/react-query';\nimport { TimeSeriesQueryDefinition, UnknownSpec, TimeSeriesData } from '@perses-dev/core';\nimport { TimeSeriesDataQuery, TimeSeriesQueryContext, TimeSeriesQueryPlugin } from '../model';\nimport { VariableStateMap, useVariableValues } from './template-variables';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useDatasourceStore } from './datasources';\nimport { usePlugin, usePluginRegistry, usePlugins } from './plugin-registry';\n\nexport interface UseTimeSeriesQueryOptions {\n suggestedStepMs?: number;\n}\n\nexport const TIME_SERIES_QUERY_KEY = 'TimeSeriesQuery';\n\n/**\n * Returns a serialized string of the current state of variable values.\n */\nfunction getVariableValuesKey(v: VariableStateMap) {\n return Object.values(v)\n .map((v) => JSON.stringify(v.value))\n .join(',');\n}\n\nfunction filterVariableStateMap(v: VariableStateMap, names?: string[]) {\n if (!names) {\n return v;\n }\n return Object.fromEntries(Object.entries(v).filter(([name]) => names.includes(name)));\n}\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: TimeSeriesQueryPlugin;\n definition: TimeSeriesQueryDefinition;\n context: TimeSeriesQueryContext;\n}) {\n const { timeRange, datasourceStore, suggestedStepMs, variableState, refreshKey } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n // Determine queryKey\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n const queryKey = [definition, timeRange, datasourceStore, suggestedStepMs, variablesValueKey, refreshKey] as const;\n\n // Determine queryEnabled\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n\n return {\n queryKey,\n queryEnabled,\n };\n}\n\n/**\n * Runs a time series query using a plugin and returns the results.\n */\nexport const useTimeSeriesQuery = (\n definition: TimeSeriesQueryDefinition,\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: QueryObserverOptions\n) => {\n const { data: plugin } = usePlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);\n const context = useTimeSeriesQueryContext();\n\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return useQuery({\n enabled: (queryOptions?.enabled ?? true) || queryEnabled,\n queryKey: queryKey,\n queryFn: () => {\n // The 'enabled' option should prevent this from happening, but make TypeScript happy by checking\n if (plugin === undefined) {\n throw new Error('Expected plugin to be loaded');\n }\n // Keep options out of query key so we don't re-run queries because suggested step changes\n const ctx: TimeSeriesQueryContext = { ...context, suggestedStepMs: options?.suggestedStepMs };\n return plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx);\n },\n });\n};\n\n/**\n * Runs multiple time series queries using plugins and returns the results.\n */\nexport function useTimeSeriesQueries(\n definitions: TimeSeriesQueryDefinition[],\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: QueryObserverOptions\n) {\n const { getPlugin } = usePluginRegistry();\n const context = useTimeSeriesQueryContext();\n\n const pluginLoaderResponse = usePlugins(\n TIME_SERIES_QUERY_KEY,\n definitions.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return {\n enabled: (queryOptions?.enabled ?? true) && queryEnabled,\n queryKey: queryKey,\n queryFn: async () => {\n // Keep options out of query key so we don't re-run queries because suggested step changes\n const ctx: TimeSeriesQueryContext = { ...context, suggestedStepMs: options?.suggestedStepMs };\n const plugin = await getPlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);\n const data = await plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx);\n return data;\n },\n };\n }),\n });\n}\n\n/**\n * Build the time series query context object from data available at runtime\n */\nfunction useTimeSeriesQueryContext(): TimeSeriesQueryContext {\n const { absoluteTimeRange, refreshKey } = useTimeRange();\n const variableState = useVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n timeRange: absoluteTimeRange,\n variableState,\n datasourceStore,\n refreshKey,\n };\n}\n\n/**\n * Get active time series queries for query results summary\n */\nexport function useActiveTimeSeriesQueries() {\n const queryClient = useQueryClient();\n const queryCache = queryClient.getQueryCache();\n return getActiveTimeSeriesQueries(queryCache);\n}\n\n/**\n * Filter all cached queries down to only active time series queries\n */\nexport function getActiveTimeSeriesQueries(cache: QueryCache) {\n const queries: TimeSeriesDataQuery[] = [];\n\n for (const query of cache.findAll({ type: 'active' })) {\n const firstPart = query.queryKey?.[0] as UnknownSpec;\n if (firstPart?.kind && (firstPart.kind as string).startsWith(TIME_SERIES_QUERY_KEY)) {\n queries.push(query as Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>);\n }\n }\n\n return queries;\n}\n"],"names":["useQuery","useQueries","useQueryClient","useVariableValues","useTimeRange","useDatasourceStore","usePlugin","usePluginRegistry","usePlugins","TIME_SERIES_QUERY_KEY","getVariableValuesKey","v","Object","values","map","JSON","stringify","value","join","filterVariableStateMap","names","fromEntries","entries","filter","name","includes","getQueryOptions","plugin","definition","context","timeRange","datasourceStore","suggestedStepMs","variableState","refreshKey","dependencies","dependsOn","spec","variableDependencies","variables","filteredVariabledState","variablesValueKey","queryKey","waitToLoad","some","loading","queryEnabled","undefined","useTimeSeriesQuery","options","queryOptions","data","kind","useTimeSeriesQueryContext","enabled","queryFn","Error","ctx","getTimeSeriesData","useTimeSeriesQueries","definitions","getPlugin","pluginLoaderResponse","d","queries","idx","absoluteTimeRange","useActiveTimeSeriesQueries","queryClient","queryCache","getQueryCache","getActiveTimeSeriesQueries","cache","query","findAll","type","firstPart","startsWith","push"],"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,SACEA,QAAQ,EACRC,UAAU,EACVC,cAAc,QAKT,wBAAwB;AAG/B,SAA2BC,iBAAiB,QAAQ,uBAAuB;AAC3E,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,SAAS,EAAEC,iBAAiB,EAAEC,UAAU,QAAQ,oBAAoB;AAM7E,OAAO,MAAMC,wBAAwB,kBAAkB;AAEvD;;CAEC,GACD,SAASC,qBAAqBC,CAAmB;IAC/C,OAAOC,OAAOC,MAAM,CAACF,G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J,mCAAAA,wBAAyB,IAAG,KAAMJ;gBAC5CJ,UAAUA;gBACVa,SAAS;oBACP,0FAA0F;oBAC1F,MAAME,MAA8B;wBAAE,GAAG5B,OAAO;wBAAEG,eAAe,EAAEiB,oBAAAA,8BAAAA,QAASjB,eAAe;oBAAC;oBAC5F,MAAML,SAAS,MAAMkC,UAAUpD,uBAAuBmB,WAAWS,IAAI,CAACV,MAAM,CAACyB,IAAI;oBACjF,MAAMD,OAAO,MAAMxB,OAAO+B,iBAAiB,CAAC9B,WAAWS,IAAI,CAACV,MAAM,CAACU,IAAI,EAAEoB;oBACzE,OAAON;gBACT;YACF;QACF;IACF;AACF;AAEA;;CAEC,GACD,SAASE;IACP,MAAM,EAAEa,iBAAiB,EAAEhC,UAAU,EAAE,GAAG9B;IAC1C,MAAM6B,gBAAgB9B;IACtB,MAAM4B,kBAAkB1B;IAExB,OAAO;QACLyB,WAAWoC;QACXjC;QACAF;QACAG;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASiC;IACd,MAAMC,cAAclE;IACpB,MAAMmE,aAAaD,YAAYE,aAAa;IAC5C,OAAOC,2BAA2BF;AACpC;AAEA;;CAEC,GACD,OAAO,SAASE,2BAA2BC,KAAiB;IAC1D,MAAMR,UAAiC,EAAE;IAEzC,KAAK,MAAMS,SAASD,MAAME,OAAO,CAAC;QAAEC,MAAM;IAAS,GAAI;YACnCF;QAAlB,MAAMG,aAAYH,kBAAAA,MAAM/B,QAAQ,cAAd+B,sCAAAA,eAAgB,CAAC,EAAE;QACrC,IAAIG,CAAAA,sBAAAA,gCAAAA,UAAWxB,IAAI,KAAI,AAACwB,UAAUxB,IAAI,CAAYyB,UAAU,CAACpE,wBAAwB;YACnFuD,QAAQc,IAAI,CAACL;QACf;IACF;IAEA,OAAOT;AACT"}
@@ -11,6 +11,6 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { z } from 'zod';
14
- export const resourceIdValidationSchema = z.string().nonempty('Required').max(75, 'Must be 75 or fewer characters long').regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');
14
+ export const resourceIdValidationSchema = z.string().min(1, 'Required').max(75, 'Must be 75 or fewer characters long').regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');
15
15
 
16
16
  //# sourceMappingURL=resource.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/validation/resource.ts"],"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 { z } from 'zod';\n\nexport const resourceIdValidationSchema = z\n .string()\n .nonempty('Required')\n .max(75, 'Must be 75 or fewer characters long')\n .regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');\n"],"names":["z","resourceIdValidationSchema","string","nonempty","max","regex"],"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,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,6BAA6BD,EACvCE,MAAM,GACNC,QAAQ,CAAC,YACTC,GAAG,CAAC,IAAI,uCACRC,KAAK,CAAC,qBAAqB,6EAA6E"}
1
+ {"version":3,"sources":["../../src/validation/resource.ts"],"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 { z } from 'zod';\n\nexport const resourceIdValidationSchema = z\n .string()\n .min(1, 'Required')\n .max(75, 'Must be 75 or fewer characters long')\n .regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');\n"],"names":["z","resourceIdValidationSchema","string","min","max","regex"],"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,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,6BAA6BD,EACvCE,MAAM,GACNC,GAAG,CAAC,GAAG,YACPC,GAAG,CAAC,IAAI,uCACRC,KAAK,CAAC,qBAAqB,6EAA6E"}
@@ -0,0 +1,93 @@
1
+ import { z } from 'zod';
2
+ export declare const userEditorValidationSchema: z.ZodObject<{
3
+ kind: z.ZodLiteral<"User">;
4
+ metadata: z.ZodObject<{
5
+ name: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ name: string;
8
+ }, {
9
+ name: string;
10
+ }>;
11
+ spec: z.ZodObject<{
12
+ firstName: z.ZodOptional<z.ZodString>;
13
+ lastName: z.ZodOptional<z.ZodString>;
14
+ nativeProvider: z.ZodOptional<z.ZodObject<{
15
+ password: z.ZodOptional<z.ZodString>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ password?: string | undefined;
18
+ }, {
19
+ password?: string | undefined;
20
+ }>>;
21
+ oauthProviders: z.ZodOptional<z.ZodArray<z.ZodObject<{
22
+ issuer: z.ZodOptional<z.ZodString>;
23
+ email: z.ZodOptional<z.ZodString>;
24
+ subject: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ issuer?: string | undefined;
27
+ email?: string | undefined;
28
+ subject?: string | undefined;
29
+ }, {
30
+ issuer?: string | undefined;
31
+ email?: string | undefined;
32
+ subject?: string | undefined;
33
+ }>, "many">>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ firstName?: string | undefined;
36
+ lastName?: string | undefined;
37
+ nativeProvider?: {
38
+ password?: string | undefined;
39
+ } | undefined;
40
+ oauthProviders?: {
41
+ issuer?: string | undefined;
42
+ email?: string | undefined;
43
+ subject?: string | undefined;
44
+ }[] | undefined;
45
+ }, {
46
+ firstName?: string | undefined;
47
+ lastName?: string | undefined;
48
+ nativeProvider?: {
49
+ password?: string | undefined;
50
+ } | undefined;
51
+ oauthProviders?: {
52
+ issuer?: string | undefined;
53
+ email?: string | undefined;
54
+ subject?: string | undefined;
55
+ }[] | undefined;
56
+ }>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ kind: "User";
59
+ spec: {
60
+ firstName?: string | undefined;
61
+ lastName?: string | undefined;
62
+ nativeProvider?: {
63
+ password?: string | undefined;
64
+ } | undefined;
65
+ oauthProviders?: {
66
+ issuer?: string | undefined;
67
+ email?: string | undefined;
68
+ subject?: string | undefined;
69
+ }[] | undefined;
70
+ };
71
+ metadata: {
72
+ name: string;
73
+ };
74
+ }, {
75
+ kind: "User";
76
+ spec: {
77
+ firstName?: string | undefined;
78
+ lastName?: string | undefined;
79
+ nativeProvider?: {
80
+ password?: string | undefined;
81
+ } | undefined;
82
+ oauthProviders?: {
83
+ issuer?: string | undefined;
84
+ email?: string | undefined;
85
+ subject?: string | undefined;
86
+ }[] | undefined;
87
+ };
88
+ metadata: {
89
+ name: string;
90
+ };
91
+ }>;
92
+ export type UserEditorValidationType = z.infer<typeof userEditorValidationSchema>;
93
+ //# sourceMappingURL=user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/validation/user.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMrC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ // Copyright 2023 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 { z } from 'zod';
14
+ import { resourceIdValidationSchema } from './resource';
15
+ const nativeProviderSchema = z.object({
16
+ password: z.string().optional()
17
+ });
18
+ const oauthProvidersSchema = z.object({
19
+ issuer: z.string().optional(),
20
+ email: z.string().optional(),
21
+ subject: z.string().optional()
22
+ });
23
+ // TODO: handle exclusion native / oauth?
24
+ const userSpecSchema = z.object({
25
+ firstName: z.string().optional(),
26
+ lastName: z.string().optional(),
27
+ nativeProvider: nativeProviderSchema.optional(),
28
+ oauthProviders: z.array(oauthProvidersSchema).optional()
29
+ });
30
+ export const userEditorValidationSchema = z.object({
31
+ kind: z.literal('User'),
32
+ metadata: z.object({
33
+ name: resourceIdValidationSchema
34
+ }),
35
+ spec: userSpecSchema
36
+ });
37
+
38
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/validation/user.ts"],"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 { z } from 'zod';\nimport { resourceIdValidationSchema } from './resource';\n\nconst nativeProviderSchema = z.object({\n password: z.string().optional(),\n});\n\nconst oauthProvidersSchema = z.object({\n issuer: z.string().optional(),\n email: z.string().optional(),\n subject: z.string().optional(),\n});\n\n// TODO: handle exclusion native / oauth?\nconst userSpecSchema = z.object({\n firstName: z.string().optional(),\n lastName: z.string().optional(),\n nativeProvider: nativeProviderSchema.optional(),\n oauthProviders: z.array(oauthProvidersSchema).optional(),\n});\n\nexport const userEditorValidationSchema = z.object({\n kind: z.literal('User'),\n metadata: z.object({\n name: resourceIdValidationSchema,\n }),\n spec: userSpecSchema,\n});\n\nexport type UserEditorValidationType = z.infer<typeof userEditorValidationSchema>;\n"],"names":["z","resourceIdValidationSchema","nativeProviderSchema","object","password","string","optional","oauthProvidersSchema","issuer","email","subject","userSpecSchema","firstName","lastName","nativeProvider","oauthProviders","array","userEditorValidationSchema","kind","literal","metadata","name","spec"],"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,CAAC,QAAQ,MAAM;AACxB,SAASC,0BAA0B,QAAQ,aAAa;AAExD,MAAMC,uBAAuBF,EAAEG,MAAM,CAAC;IACpCC,UAAUJ,EAAEK,MAAM,GAAGC,QAAQ;AAC/B;AAEA,MAAMC,uBAAuBP,EAAEG,MAAM,CAAC;IACpCK,QAAQR,EAAEK,MAAM,GAAGC,QAAQ;IAC3BG,OAAOT,EAAEK,MAAM,GAAGC,QAAQ;IAC1BI,SAASV,EAAEK,MAAM,GAAGC,QAAQ;AAC9B;AAEA,yCAAyC;AACzC,MAAMK,iBAAiBX,EAAEG,MAAM,CAAC;IAC9BS,WAAWZ,EAAEK,MAAM,GAAGC,QAAQ;IAC9BO,UAAUb,EAAEK,MAAM,GAAGC,QAAQ;IAC7BQ,gBAAgBZ,qBAAqBI,QAAQ;IAC7CS,gBAAgBf,EAAEgB,KAAK,CAACT,sBAAsBD,QAAQ;AACxD;AAEA,OAAO,MAAMW,6BAA6BjB,EAAEG,MAAM,CAAC;IACjDe,MAAMlB,EAAEmB,OAAO,CAAC;IAChBC,UAAUpB,EAAEG,MAAM,CAAC;QACjBkB,MAAMpB;IACR;IACAqB,MAAMX;AACR,GAAG"}