@perses-dev/plugin-system 0.46.0-rc1 → 0.47.0-rc0

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 (185) hide show
  1. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +70 -99
  2. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +2 -1
  3. package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +1 -1
  4. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +49 -19
  5. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +1 -0
  6. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +10 -71
  7. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +408 -376
  8. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +2 -2
  9. package/dist/cjs/components/Variables/variable-model.js +24 -22
  10. package/dist/cjs/context/ProjectStoreProvider.js +7 -4
  11. package/dist/cjs/context/ValidationProvider.js +69 -0
  12. package/dist/cjs/context/index.js +1 -0
  13. package/dist/cjs/index.js +0 -1
  14. package/dist/cjs/runtime/QueryCountProvider.js +83 -0
  15. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +100 -0
  16. package/dist/cjs/runtime/TimeRangeProvider/index.js +2 -1
  17. package/dist/cjs/runtime/builtin-variables.js +1 -1
  18. package/dist/cjs/runtime/datasources.js +22 -13
  19. package/dist/cjs/runtime/index.js +3 -2
  20. package/dist/cjs/runtime/plugin-registry.js +33 -22
  21. package/dist/cjs/runtime/time-series-queries.js +3 -3
  22. package/dist/cjs/runtime/trace-queries.js +5 -1
  23. package/dist/cjs/runtime/{template-variables.js → variables.js} +19 -19
  24. package/dist/cjs/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +8 -8
  25. package/dist/cjs/stories/shared-utils/decorators/index.js +2 -2
  26. package/dist/cjs/test/mock-data.js +25 -4
  27. package/dist/cjs/test/render.js +1 -9
  28. package/dist/cjs/test/test-plugins/bert/index.js +20 -19
  29. package/dist/cjs/utils/variables.js +23 -23
  30. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +2 -2
  31. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  32. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +71 -100
  33. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  34. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +4 -3
  35. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  36. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +1 -1
  37. package/dist/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
  38. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  39. package/dist/components/MultiQueryEditor/QueryEditorContainer.js +1 -1
  40. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  41. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +3 -1
  42. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  43. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +50 -20
  44. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  45. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  46. package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -0
  47. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  48. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +2 -2
  49. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  50. package/dist/components/TimeRangeControls/TimeRangeControls.js +12 -70
  51. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  52. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  53. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +411 -379
  54. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  55. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +2 -2
  56. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  57. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  58. package/dist/components/Variables/variable-model.js +25 -23
  59. package/dist/components/Variables/variable-model.js.map +1 -1
  60. package/dist/context/ProjectStoreProvider.d.ts.map +1 -1
  61. package/dist/context/ProjectStoreProvider.js +7 -4
  62. package/dist/context/ProjectStoreProvider.js.map +1 -1
  63. package/dist/context/ValidationProvider.d.ts +19 -0
  64. package/dist/context/ValidationProvider.d.ts.map +1 -0
  65. package/dist/context/ValidationProvider.js +52 -0
  66. package/dist/context/ValidationProvider.js.map +1 -0
  67. package/dist/context/index.d.ts +1 -0
  68. package/dist/context/index.d.ts.map +1 -1
  69. package/dist/context/index.js +1 -0
  70. package/dist/context/index.js.map +1 -1
  71. package/dist/index.d.ts +0 -1
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +0 -1
  74. package/dist/index.js.map +1 -1
  75. package/dist/runtime/DataQueriesProvider/model.d.ts +1 -1
  76. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  77. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  78. package/dist/runtime/QueryCountProvider.d.ts +9 -0
  79. package/dist/runtime/QueryCountProvider.d.ts.map +1 -0
  80. package/dist/{validation/duration.js → runtime/QueryCountProvider.js} +13 -4
  81. package/dist/runtime/QueryCountProvider.js.map +1 -0
  82. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +32 -0
  83. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -0
  84. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +82 -0
  85. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -0
  86. package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
  87. package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
  88. package/dist/runtime/TimeRangeProvider/index.js +2 -1
  89. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  90. package/dist/runtime/builtin-variables.d.ts +1 -1
  91. package/dist/runtime/builtin-variables.d.ts.map +1 -1
  92. package/dist/runtime/builtin-variables.js +1 -1
  93. package/dist/runtime/builtin-variables.js.map +1 -1
  94. package/dist/runtime/datasources.d.ts.map +1 -1
  95. package/dist/runtime/datasources.js +22 -13
  96. package/dist/runtime/datasources.js.map +1 -1
  97. package/dist/runtime/index.d.ts +2 -1
  98. package/dist/runtime/index.d.ts.map +1 -1
  99. package/dist/runtime/index.js +3 -2
  100. package/dist/runtime/index.js.map +1 -1
  101. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  102. package/dist/runtime/plugin-registry.js +33 -22
  103. package/dist/runtime/plugin-registry.js.map +1 -1
  104. package/dist/runtime/time-series-queries.d.ts +2 -2
  105. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  106. package/dist/runtime/time-series-queries.js +3 -3
  107. package/dist/runtime/time-series-queries.js.map +1 -1
  108. package/dist/runtime/trace-queries.d.ts.map +1 -1
  109. package/dist/runtime/trace-queries.js +5 -1
  110. package/dist/runtime/trace-queries.js.map +1 -1
  111. package/dist/runtime/{template-variables.d.ts → variables.d.ts} +4 -4
  112. package/dist/runtime/variables.d.ts.map +1 -0
  113. package/dist/runtime/{template-variables.js → variables.js} +18 -17
  114. package/dist/runtime/variables.js.map +1 -0
  115. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts +12 -0
  116. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts.map +1 -0
  117. package/dist/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +9 -9
  118. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.js.map +1 -0
  119. package/dist/stories/shared-utils/decorators/index.d.ts +1 -1
  120. package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
  121. package/dist/stories/shared-utils/decorators/index.js +2 -2
  122. package/dist/stories/shared-utils/decorators/index.js.map +1 -1
  123. package/dist/test/mock-data.d.ts.map +1 -1
  124. package/dist/test/mock-data.js +25 -4
  125. package/dist/test/mock-data.js.map +1 -1
  126. package/dist/test/render.d.ts.map +1 -1
  127. package/dist/test/render.js +1 -9
  128. package/dist/test/render.js.map +1 -1
  129. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  130. package/dist/test/test-plugins/bert/index.js +20 -19
  131. package/dist/test/test-plugins/bert/index.js.map +1 -1
  132. package/dist/utils/variables.d.ts +4 -4
  133. package/dist/utils/variables.d.ts.map +1 -1
  134. package/dist/utils/variables.js +18 -18
  135. package/dist/utils/variables.js.map +1 -1
  136. package/package.json +5 -5
  137. package/dist/cjs/validation/datasource.js +0 -30
  138. package/dist/cjs/validation/duration.js +0 -25
  139. package/dist/cjs/validation/index.js +0 -34
  140. package/dist/cjs/validation/resource.js +0 -24
  141. package/dist/cjs/validation/role.js +0 -86
  142. package/dist/cjs/validation/rolebinding.js +0 -55
  143. package/dist/cjs/validation/secret.js +0 -176
  144. package/dist/cjs/validation/user.js +0 -46
  145. package/dist/cjs/validation/variable.js +0 -48
  146. package/dist/runtime/template-variables.d.ts.map +0 -1
  147. package/dist/runtime/template-variables.js.map +0 -1
  148. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +0 -12
  149. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +0 -1
  150. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +0 -1
  151. package/dist/validation/datasource.d.ts +0 -19
  152. package/dist/validation/datasource.d.ts.map +0 -1
  153. package/dist/validation/datasource.js +0 -22
  154. package/dist/validation/datasource.js.map +0 -1
  155. package/dist/validation/duration.d.ts +0 -3
  156. package/dist/validation/duration.d.ts.map +0 -1
  157. package/dist/validation/duration.js.map +0 -1
  158. package/dist/validation/index.d.ts +0 -6
  159. package/dist/validation/index.d.ts.map +0 -1
  160. package/dist/validation/index.js +0 -19
  161. package/dist/validation/index.js.map +0 -1
  162. package/dist/validation/resource.d.ts +0 -3
  163. package/dist/validation/resource.d.ts.map +0 -1
  164. package/dist/validation/resource.js +0 -16
  165. package/dist/validation/resource.js.map +0 -1
  166. package/dist/validation/role.d.ts +0 -228
  167. package/dist/validation/role.d.ts.map +0 -1
  168. package/dist/validation/role.js +0 -67
  169. package/dist/validation/role.js.map +0 -1
  170. package/dist/validation/rolebinding.d.ts +0 -137
  171. package/dist/validation/rolebinding.d.ts.map +0 -1
  172. package/dist/validation/rolebinding.js +0 -47
  173. package/dist/validation/rolebinding.js.map +0 -1
  174. package/dist/validation/secret.d.ts +0 -964
  175. package/dist/validation/secret.d.ts.map +0 -1
  176. package/dist/validation/secret.js +0 -157
  177. package/dist/validation/secret.js.map +0 -1
  178. package/dist/validation/user.d.ts +0 -93
  179. package/dist/validation/user.d.ts.map +0 -1
  180. package/dist/validation/user.js +0 -38
  181. package/dist/validation/user.js.map +0 -1
  182. package/dist/validation/variable.d.ts +0 -96
  183. package/dist/validation/variable.d.ts.map +0 -1
  184. package/dist/validation/variable.js +0 -40
  185. package/dist/validation/variable.js.map +0 -1
@@ -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 { ReactNode, useCallback, useMemo } from 'react';\nimport { useListPluginMetadata } from '../plugin-registry';\n\nexport type QueryOptions = Record<string, unknown>;\nexport interface DataQueriesProviderProps<QueryPluginSpec = UnknownSpec> {\n definitions: Array<Definition<QueryPluginSpec>>;\n children?: 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,SAAoBA,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AACxD,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"}
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 { ReactNode, useCallback, useMemo } from 'react';\nimport { useListPluginMetadata } from '../plugin-registry';\n\nexport type QueryOptions = Record<string, unknown>;\nexport interface DataQueriesProviderProps<QueryPluginSpec = UnknownSpec> {\n definitions: Array<Definition<QueryPluginSpec>>;\n children?: ReactNode;\n options?: QueryOptions;\n queryOptions?: Omit<QueryObserverOptions, 'queryKey'>;\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,SAAoBA,WAAW,EAAEC,OAAO,QAAQ,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AInB,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"}
@@ -0,0 +1,9 @@
1
+ import React, { ReactNode } from 'react';
2
+ interface QueryCountProviderProps {
3
+ queryCount: number;
4
+ children: ReactNode;
5
+ }
6
+ export declare const QueryCountProvider: React.FC<QueryCountProviderProps>;
7
+ export declare const useQueryCountContext: () => number;
8
+ export {};
9
+ //# sourceMappingURL=QueryCountProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryCountProvider.d.ts","sourceRoot":"","sources":["../../src/runtime/QueryCountProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpE,UAAU,uBAAuB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAID,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAEhE,CAAC;AAEF,eAAO,MAAM,oBAAoB,cAEhC,CAAC"}
@@ -10,8 +10,17 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { DURATION_REGEX } from '@perses-dev/core';
14
- import { z } from 'zod';
15
- export const durationValidationSchema = z.string().nonempty('Required').regex(DURATION_REGEX, 'Must be a valid duration string');
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import React, { createContext, useContext } from 'react';
15
+ const QueryCountContext = /*#__PURE__*/ createContext(0);
16
+ export const QueryCountProvider = ({ queryCount, children })=>{
17
+ return /*#__PURE__*/ _jsx(QueryCountContext.Provider, {
18
+ value: queryCount,
19
+ children: children
20
+ });
21
+ };
22
+ export const useQueryCountContext = ()=>{
23
+ return useContext(QueryCountContext);
24
+ };
16
25
 
17
- //# sourceMappingURL=duration.js.map
26
+ //# sourceMappingURL=QueryCountProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/runtime/QueryCountProvider.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 React, { createContext, useContext, ReactNode } from 'react';\n\ninterface QueryCountProviderProps {\n queryCount: number;\n children: ReactNode;\n}\n\nconst QueryCountContext = createContext<number>(0);\n\nexport const QueryCountProvider: React.FC<QueryCountProviderProps> = ({ queryCount, children }) => {\n return <QueryCountContext.Provider value={queryCount}>{children}</QueryCountContext.Provider>;\n};\n\nexport const useQueryCountContext = () => {\n return useContext(QueryCountContext);\n};\n"],"names":["React","createContext","useContext","QueryCountContext","QueryCountProvider","queryCount","children","Provider","value","useQueryCountContext"],"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,UAAU,QAAmB,QAAQ;AAOpE,MAAMC,kCAAoBF,cAAsB;AAEhD,OAAO,MAAMG,qBAAwD,CAAC,EAAEC,UAAU,EAAEC,QAAQ,EAAE;IAC5F,qBAAO,KAACH,kBAAkBI,QAAQ;QAACC,OAAOH;kBAAaC;;AACzD,EAAE;AAEF,OAAO,MAAMG,uBAAuB;IAClC,OAAOP,WAAWC;AACpB,EAAE"}
@@ -0,0 +1,32 @@
1
+ import { ReactNode } from 'react';
2
+ import { TimeOption } from '@perses-dev/components';
3
+ export interface TimeRangeSettingsProviderProps {
4
+ showCustom?: boolean;
5
+ options?: TimeOption[];
6
+ children: ReactNode;
7
+ }
8
+ export interface TimeRangeSettings {
9
+ showCustom: boolean;
10
+ options: TimeOption[];
11
+ }
12
+ export declare const TimeRangeSettingsContext: import("react").Context<TimeRangeSettings>;
13
+ export declare function useTimeRangeSettingsContext(): TimeRangeSettings;
14
+ /**
15
+ * Get and set the current resolved time range at runtime.
16
+ */
17
+ export declare function useTimeRangeSettings(): TimeRangeSettings;
18
+ /**
19
+ * Get the current value of the showCustom setting.
20
+ * @param override If set, the value of the provider will be overridden by this value.
21
+ */
22
+ export declare function useShowCustomTimeRangeSetting(override?: boolean): boolean;
23
+ /**
24
+ * Get the current value of the options setting.
25
+ * @param override If set, the value of the provider will be overridden by this value.
26
+ */
27
+ export declare function useTimeRangeOptionsSetting(override?: TimeOption[]): TimeOption[];
28
+ /**
29
+ * Provider implementation that supplies the time range state at runtime.
30
+ */
31
+ export declare function TimeRangeSettingsProvider(props: TimeRangeSettingsProviderProps): import("react/jsx-runtime").JSX.Element;
32
+ //# sourceMappingURL=TimeRangeSettingsProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeRangeSettingsProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/TimeRangeProvider/TimeRangeSettingsProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,SAAS,EAAuB,MAAM,OAAO,CAAC;AACtE,OAAO,EAA2B,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAS7E,MAAM,WAAW,8BAA8B;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB;AAED,eAAO,MAAM,wBAAwB,4CAA6D,CAAC;AAEnG,wBAAgB,2BAA2B,sBAM1C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CAExD;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAMzE;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAMhF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,8BAA8B,2CAS9E"}
@@ -0,0 +1,82 @@
1
+ // Copyright 2024 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 { jsx as _jsx } from "react/jsx-runtime";
14
+ import { createContext, useContext, useMemo } from 'react';
15
+ import { buildRelativeTimeOption } from '@perses-dev/components';
16
+ const DEFAULT_OPTIONS = [
17
+ '5m',
18
+ '15m',
19
+ '30m',
20
+ '1h',
21
+ '6h',
22
+ '12h',
23
+ '24h',
24
+ '7d',
25
+ '14d'
26
+ ];
27
+ const defaultTimeRangeSettings = {
28
+ showCustom: true,
29
+ options: DEFAULT_OPTIONS.map((duration)=>buildRelativeTimeOption(duration))
30
+ };
31
+ export const TimeRangeSettingsContext = /*#__PURE__*/ createContext(defaultTimeRangeSettings);
32
+ export function useTimeRangeSettingsContext() {
33
+ const ctx = useContext(TimeRangeSettingsContext);
34
+ if (ctx === undefined) {
35
+ throw new Error('No TimeRangeContext found. Did you forget a Provider?');
36
+ }
37
+ return ctx;
38
+ }
39
+ /**
40
+ * Get and set the current resolved time range at runtime.
41
+ */ export function useTimeRangeSettings() {
42
+ return useTimeRangeSettingsContext();
43
+ }
44
+ /**
45
+ * Get the current value of the showCustom setting.
46
+ * @param override If set, the value of the provider will be overridden by this value.
47
+ */ export function useShowCustomTimeRangeSetting(override) {
48
+ const showCustomTimeRange = useTimeRangeSettings().showCustom;
49
+ if (override !== undefined) {
50
+ return override;
51
+ }
52
+ return showCustomTimeRange;
53
+ }
54
+ /**
55
+ * Get the current value of the options setting.
56
+ * @param override If set, the value of the provider will be overridden by this value.
57
+ */ export function useTimeRangeOptionsSetting(override) {
58
+ const showCustomTimeRange = useTimeRangeSettings().options;
59
+ if (override !== undefined) {
60
+ return override;
61
+ }
62
+ return showCustomTimeRange;
63
+ }
64
+ /**
65
+ * Provider implementation that supplies the time range state at runtime.
66
+ */ export function TimeRangeSettingsProvider(props) {
67
+ const ctx = useMemo(()=>{
68
+ return {
69
+ showCustom: props.showCustom === undefined ? defaultTimeRangeSettings.showCustom : props.showCustom,
70
+ options: props.options === undefined ? defaultTimeRangeSettings.options : props.options
71
+ };
72
+ }, [
73
+ props.showCustom,
74
+ props.options
75
+ ]);
76
+ return /*#__PURE__*/ _jsx(TimeRangeSettingsContext.Provider, {
77
+ value: ctx,
78
+ children: props.children
79
+ });
80
+ }
81
+
82
+ //# sourceMappingURL=TimeRangeSettingsProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/runtime/TimeRangeProvider/TimeRangeSettingsProvider.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 { createContext, ReactNode, useContext, useMemo } from 'react';\nimport { buildRelativeTimeOption, TimeOption } from '@perses-dev/components';\nimport { DurationString } from '@perses-dev/core';\n\nconst DEFAULT_OPTIONS: DurationString[] = ['5m', '15m', '30m', '1h', '6h', '12h', '24h', '7d', '14d'];\nconst defaultTimeRangeSettings: TimeRangeSettings = {\n showCustom: true,\n options: DEFAULT_OPTIONS.map((duration) => buildRelativeTimeOption(duration)),\n};\n\nexport interface TimeRangeSettingsProviderProps {\n showCustom?: boolean;\n options?: TimeOption[];\n children: ReactNode;\n}\n\nexport interface TimeRangeSettings {\n showCustom: boolean;\n options: TimeOption[];\n}\n\nexport const TimeRangeSettingsContext = createContext<TimeRangeSettings>(defaultTimeRangeSettings);\n\nexport function useTimeRangeSettingsContext() {\n const ctx = useContext(TimeRangeSettingsContext);\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 useTimeRangeSettings(): TimeRangeSettings {\n return useTimeRangeSettingsContext();\n}\n\n/**\n * Get the current value of the showCustom setting.\n * @param override If set, the value of the provider will be overridden by this value.\n */\nexport function useShowCustomTimeRangeSetting(override?: boolean): boolean {\n const showCustomTimeRange = useTimeRangeSettings().showCustom;\n if (override !== undefined) {\n return override;\n }\n return showCustomTimeRange;\n}\n\n/**\n * Get the current value of the options setting.\n * @param override If set, the value of the provider will be overridden by this value.\n */\nexport function useTimeRangeOptionsSetting(override?: TimeOption[]): TimeOption[] {\n const showCustomTimeRange = useTimeRangeSettings().options;\n if (override !== undefined) {\n return override;\n }\n return showCustomTimeRange;\n}\n\n/**\n * Provider implementation that supplies the time range state at runtime.\n */\nexport function TimeRangeSettingsProvider(props: TimeRangeSettingsProviderProps) {\n const ctx = useMemo(() => {\n return {\n showCustom: props.showCustom === undefined ? defaultTimeRangeSettings.showCustom : props.showCustom,\n options: props.options === undefined ? defaultTimeRangeSettings.options : props.options,\n };\n }, [props.showCustom, props.options]);\n\n return <TimeRangeSettingsContext.Provider value={ctx}>{props.children}</TimeRangeSettingsContext.Provider>;\n}\n"],"names":["createContext","useContext","useMemo","buildRelativeTimeOption","DEFAULT_OPTIONS","defaultTimeRangeSettings","showCustom","options","map","duration","TimeRangeSettingsContext","useTimeRangeSettingsContext","ctx","undefined","Error","useTimeRangeSettings","useShowCustomTimeRangeSetting","override","showCustomTimeRange","useTimeRangeOptionsSetting","TimeRangeSettingsProvider","props","Provider","value","children"],"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,EAAaC,UAAU,EAAEC,OAAO,QAAQ,QAAQ;AACtE,SAASC,uBAAuB,QAAoB,yBAAyB;AAG7E,MAAMC,kBAAoC;IAAC;IAAM;IAAO;IAAO;IAAM;IAAM;IAAO;IAAO;IAAM;CAAM;AACrG,MAAMC,2BAA8C;IAClDC,YAAY;IACZC,SAASH,gBAAgBI,GAAG,CAAC,CAACC,WAAaN,wBAAwBM;AACrE;AAaA,OAAO,MAAMC,yCAA2BV,cAAiCK,0BAA0B;AAEnG,OAAO,SAASM;IACd,MAAMC,MAAMX,WAAWS;IACvB,IAAIE,QAAQC,WAAW;QACrB,MAAM,IAAIC,MAAM;IAClB;IACA,OAAOF;AACT;AAEA;;CAEC,GACD,OAAO,SAASG;IACd,OAAOJ;AACT;AAEA;;;CAGC,GACD,OAAO,SAASK,8BAA8BC,QAAkB;IAC9D,MAAMC,sBAAsBH,uBAAuBT,UAAU;IAC7D,IAAIW,aAAaJ,WAAW;QAC1B,OAAOI;IACT;IACA,OAAOC;AACT;AAEA;;;CAGC,GACD,OAAO,SAASC,2BAA2BF,QAAuB;IAChE,MAAMC,sBAAsBH,uBAAuBR,OAAO;IAC1D,IAAIU,aAAaJ,WAAW;QAC1B,OAAOI;IACT;IACA,OAAOC;AACT;AAEA;;CAEC,GACD,OAAO,SAASE,0BAA0BC,KAAqC;IAC7E,MAAMT,MAAMV,QAAQ;QAClB,OAAO;YACLI,YAAYe,MAAMf,UAAU,KAAKO,YAAYR,yBAAyBC,UAAU,GAAGe,MAAMf,UAAU;YACnGC,SAASc,MAAMd,OAAO,KAAKM,YAAYR,yBAAyBE,OAAO,GAAGc,MAAMd,OAAO;QACzF;IACF,GAAG;QAACc,MAAMf,UAAU;QAAEe,MAAMd,OAAO;KAAC;IAEpC,qBAAO,KAACG,yBAAyBY,QAAQ;QAACC,OAAOX;kBAAMS,MAAMG,QAAQ;;AACvE"}
@@ -1,4 +1,5 @@
1
1
  export * from './TimeRangeProvider';
2
2
  export * from './TimeRangeProviderWithQueryParams';
3
+ export * from './TimeRangeSettingsProvider';
3
4
  export * from './query-params';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/TimeRangeProvider/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/TimeRangeProvider/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -12,6 +12,7 @@
12
12
  // limitations under the License.
13
13
  export * from './TimeRangeProvider';
14
14
  export * from './TimeRangeProviderWithQueryParams';
15
+ export * from './TimeRangeSettingsProvider';
15
16
  export * from './query-params';
16
17
 
17
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtime/TimeRangeProvider/index.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\nexport * from './TimeRangeProvider';\nexport * from './TimeRangeProviderWithQueryParams';\nexport * from './query-params';\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;AAEjC,cAAc,sBAAsB;AACpC,cAAc,qCAAqC;AACnD,cAAc,iBAAiB"}
1
+ {"version":3,"sources":["../../../src/runtime/TimeRangeProvider/index.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\nexport * from './TimeRangeProvider';\nexport * from './TimeRangeProviderWithQueryParams';\nexport * from './TimeRangeSettingsProvider';\nexport * from './query-params';\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;AAEjC,cAAc,sBAAsB;AACpC,cAAc,qCAAqC;AACnD,cAAc,8BAA8B;AAC5C,cAAc,iBAAiB"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { BuiltinVariableDefinition } from '@perses-dev/core';
3
- import { VariableStateMap } from './template-variables';
3
+ import { VariableStateMap } from './variables';
4
4
  export type BuiltinVariableSrv = {
5
5
  variables: BuiltinVariableDefinition[];
6
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-variables.d.ts","sourceRoot":"","sources":["../../src/runtime/builtin-variables.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,yBAAyB,EAAE,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,sBAAsB,yDAA2D,CAAC;AAE/F,wBAAgB,yBAAyB,uBAMxC;AAED,wBAAgB,wBAAwB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,gBAAgB,CA0B3E;AAED,wBAAgB,6BAA6B,IAAI,yBAAyB,EAAE,CAG3E"}
1
+ {"version":3,"file":"builtin-variables.d.ts","sourceRoot":"","sources":["../../src/runtime/builtin-variables.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,yBAAyB,EAAE,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,sBAAsB,yDAA2D,CAAC;AAE/F,wBAAgB,yBAAyB,uBAMxC;AAED,wBAAgB,wBAAwB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,gBAAgB,CA0B3E;AAED,wBAAgB,6BAA6B,IAAI,yBAAyB,EAAE,CAG3E"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/builtin-variables.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, useMemo } from 'react';\nimport { BuiltinVariableDefinition } from '@perses-dev/core';\nimport { VariableStateMap } from './template-variables';\n\nexport type BuiltinVariableSrv = {\n variables: BuiltinVariableDefinition[];\n};\n\nexport const BuiltinVariableContext = createContext<BuiltinVariableSrv | undefined>(undefined);\n\nexport function useBuiltinVariableContext() {\n const ctx = useContext(BuiltinVariableContext);\n if (ctx === undefined) {\n throw new Error('No BuiltinVariableContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useBuiltinVariableValues(names?: string[]): VariableStateMap {\n const { variables } = useBuiltinVariableContext();\n const states = useMemo(() => {\n const values: VariableStateMap = {};\n for (const variable of variables) {\n values[variable.spec.name] = { loading: false, value: variable.spec.value() };\n }\n return values;\n }, [variables]);\n\n const values = useMemo(() => {\n const values: VariableStateMap = {};\n names?.forEach((name) => {\n const s = states[name];\n if (s) {\n values[name] = s;\n }\n });\n return values;\n }, [names, states]);\n\n if (names === undefined) {\n return states;\n }\n\n return values;\n}\n\nexport function useBuiltinVariableDefinitions(): BuiltinVariableDefinition[] {\n const { variables } = useBuiltinVariableContext();\n return variables;\n}\n"],"names":["createContext","useContext","useMemo","BuiltinVariableContext","undefined","useBuiltinVariableContext","ctx","Error","useBuiltinVariableValues","names","variables","states","values","variable","spec","name","loading","value","forEach","s","useBuiltinVariableDefinitions"],"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,EAAEC,OAAO,QAAQ,QAAQ;AAQ3D,OAAO,MAAMC,yBAAyBH,cAA8CI,WAAW;AAE/F,OAAO,SAASC;IACd,MAAMC,MAAML,WAAWE;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAEA,OAAO,SAASE,yBAAyBC,KAAgB;IACvD,MAAM,EAAEC,SAAS,EAAE,GAAGL;IACtB,MAAMM,SAAST,QAAQ;QACrB,MAAMU,SAA2B,CAAC;QAClC,KAAK,MAAMC,YAAYH,UAAW;YAChCE,MAAM,CAACC,SAASC,IAAI,CAACC,IAAI,CAAC,GAAG;gBAAEC,SAAS;gBAAOC,OAAOJ,SAASC,IAAI,CAACG,KAAK;YAAG;QAC9E;QACA,OAAOL;IACT,GAAG;QAACF;KAAU;IAEd,MAAME,SAASV,QAAQ;QACrB,MAAMU,SAA2B,CAAC;QAClCH,kBAAAA,4BAAAA,MAAOS,OAAO,CAAC,CAACH;YACd,MAAMI,IAAIR,MAAM,CAACI,KAAK;YACtB,IAAII,GAAG;gBACLP,MAAM,CAACG,KAAK,GAAGI;YACjB;QACF;QACA,OAAOP;IACT,GAAG;QAACH;QAAOE;KAAO;IAElB,IAAIF,UAAUL,WAAW;QACvB,OAAOO;IACT;IAEA,OAAOC;AACT;AAEA,OAAO,SAASQ;IACd,MAAM,EAAEV,SAAS,EAAE,GAAGL;IACtB,OAAOK;AACT"}
1
+ {"version":3,"sources":["../../src/runtime/builtin-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 { createContext, useContext, useMemo } from 'react';\nimport { BuiltinVariableDefinition } from '@perses-dev/core';\nimport { VariableStateMap } from './variables';\n\nexport type BuiltinVariableSrv = {\n variables: BuiltinVariableDefinition[];\n};\n\nexport const BuiltinVariableContext = createContext<BuiltinVariableSrv | undefined>(undefined);\n\nexport function useBuiltinVariableContext() {\n const ctx = useContext(BuiltinVariableContext);\n if (ctx === undefined) {\n throw new Error('No BuiltinVariableContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useBuiltinVariableValues(names?: string[]): VariableStateMap {\n const { variables } = useBuiltinVariableContext();\n const states = useMemo(() => {\n const values: VariableStateMap = {};\n for (const variable of variables) {\n values[variable.spec.name] = { loading: false, value: variable.spec.value() };\n }\n return values;\n }, [variables]);\n\n const values = useMemo(() => {\n const values: VariableStateMap = {};\n names?.forEach((name) => {\n const s = states[name];\n if (s) {\n values[name] = s;\n }\n });\n return values;\n }, [names, states]);\n\n if (names === undefined) {\n return states;\n }\n\n return values;\n}\n\nexport function useBuiltinVariableDefinitions(): BuiltinVariableDefinition[] {\n const { variables } = useBuiltinVariableContext();\n return variables;\n}\n"],"names":["createContext","useContext","useMemo","BuiltinVariableContext","undefined","useBuiltinVariableContext","ctx","Error","useBuiltinVariableValues","names","variables","states","values","variable","spec","name","loading","value","forEach","s","useBuiltinVariableDefinitions"],"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,EAAEC,OAAO,QAAQ,QAAQ;AAQ3D,OAAO,MAAMC,yBAAyBH,cAA8CI,WAAW;AAE/F,OAAO,SAASC;IACd,MAAMC,MAAML,WAAWE;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAEA,OAAO,SAASE,yBAAyBC,KAAgB;IACvD,MAAM,EAAEC,SAAS,EAAE,GAAGL;IACtB,MAAMM,SAAST,QAAQ;QACrB,MAAMU,SAA2B,CAAC;QAClC,KAAK,MAAMC,YAAYH,UAAW;YAChCE,MAAM,CAACC,SAASC,IAAI,CAACC,IAAI,CAAC,GAAG;gBAAEC,SAAS;gBAAOC,OAAOJ,SAASC,IAAI,CAACG,KAAK;YAAG;QAC9E;QACA,OAAOL;IACT,GAAG;QAACF;KAAU;IAEd,MAAME,SAASV,QAAQ;QACrB,MAAMU,SAA2B,CAAC;QAClCH,kBAAAA,4BAAAA,MAAOS,OAAO,CAAC,CAACH;YACd,MAAMI,IAAIR,MAAM,CAACI,KAAK;YACtB,IAAII,GAAG;gBACLP,MAAM,CAACG,KAAK,GAAGI;YACjB;QACF;QACA,OAAOP;IACT,GAAG;QAACH;QAAOE;KAAO;IAElB,IAAIF,UAAUL,WAAW;QACvB,OAAOO;IACT;IAEA,OAAOC;AACT;AAEA,OAAO,SAASQ;IACd,MAAM,EAAE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EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,4BAA4B,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,kBAAkB;IACtE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,sBAAsB,sDAAwD,CAAC;AAE5F,wBAAgB,kBAAkB,oBAMjC;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,oBAAoB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,wFAM1F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,mEAMvE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,kBAAkB,mHAGzD"}
@@ -25,27 +25,36 @@ export function useDatasourceStore() {
25
25
  * Returns a list, with all information that can be used in a datasource selection context (group, name, selector, kind, ...)
26
26
  */ export function useListDatasourceSelectItems(datasourcePluginKind, project) {
27
27
  const { listDatasourceSelectItems } = useDatasourceStore();
28
- return useQuery([
29
- 'listDatasourceSelectItems',
30
- datasourcePluginKind,
31
- project
32
- ], ()=>listDatasourceSelectItems(datasourcePluginKind));
28
+ return useQuery({
29
+ queryKey: [
30
+ 'listDatasourceSelectItems',
31
+ datasourcePluginKind,
32
+ project
33
+ ],
34
+ queryFn: ()=>listDatasourceSelectItems(datasourcePluginKind)
35
+ });
33
36
  }
34
37
  /**
35
38
  * Provides a convenience hook for getting a DatasourceClient for a given DatasourceSelector.
36
39
  */ export function useDatasourceClient(selector) {
37
40
  const store = useDatasourceStore();
38
- return useQuery([
39
- 'getDatasourceClient',
40
- selector
41
- ], ()=>store.getDatasourceClient(selector));
41
+ return useQuery({
42
+ queryKey: [
43
+ 'getDatasourceClient',
44
+ selector
45
+ ],
46
+ queryFn: ()=>store.getDatasourceClient(selector)
47
+ });
42
48
  }
43
49
  export function useDatasource(selector) {
44
50
  const store = useDatasourceStore();
45
- return useQuery([
46
- 'getDatasource',
47
- selector
48
- ], ()=>store.getDatasource(selector));
51
+ return useQuery({
52
+ queryKey: [
53
+ 'getDatasource',
54
+ selector
55
+ ],
56
+ queryFn: ()=>store.getDatasource(selector)
57
+ });
49
58
  }
50
59
 
51
60
  //# sourceMappingURL=datasources.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/datasources.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 { DatasourceSelector, DatasourceSpec } from '@perses-dev/core';\nimport { useQuery } from '@tanstack/react-query';\nimport { createContext, useContext } from 'react';\n\nexport interface DatasourceStore {\n // TODO: Do we even need this method?\n getDatasource(selector: DatasourceSelector): Promise<DatasourceSpec>;\n\n /**\n * Given a DatasourceSelector, gets a `Client` object from the corresponding Datasource plugin.\n */\n getDatasourceClient<Client>(selector: DatasourceSelector): Promise<Client>;\n\n /**\n * Gets a list of datasource selection items for a plugin kind.\n */\n listDatasourceSelectItems(datasourcePluginKind: string): Promise<DatasourceSelectItemGroup[]>;\n\n /**\n * Gets the list of datasources defined in the dashboard\n */\n getLocalDatasources(): Record<string, DatasourceSpec>;\n\n /**\n * Sets the list of datasources defined in the dashboard\n */\n setLocalDatasources(datasources: Record<string, DatasourceSpec>): void;\n\n /**\n * Gets the list of datasources that are available in the dashboard (i.e. dashboards that have been created on the server side that we can use).\n */\n getSavedDatasources(): Record<string, DatasourceSpec>;\n\n /**\n * Sets the list of datasources that are saved in the dashboard\n */\n setSavedDatasources(datasources: Record<string, DatasourceSpec>): void;\n}\n\nexport interface DatasourceSelectItemGroup {\n group?: string;\n editLink?: string;\n items: DatasourceSelectItem[];\n}\n\nexport interface DatasourceSelectItem {\n name: string;\n overridden?: boolean;\n overriding?: boolean;\n saved?: boolean;\n selector: DatasourceSelectItemSelector;\n}\n\n/**\n * Datasource Selector used by the frontend only to differentiate datasources coming from different group.\n */\nexport interface DatasourceSelectItemSelector extends DatasourceSelector {\n /**\n * Group of the datasource.\n * Omit it if you don't store datasource by group.\n */\n group?: string;\n}\n\nexport const DatasourceStoreContext = createContext<DatasourceStore | undefined>(undefined);\n\nexport function useDatasourceStore() {\n const ctx = useContext(DatasourceStoreContext);\n if (ctx === undefined) {\n throw new Error('No DatasourceStoreContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\n/**\n * Lists all available Datasource selection items for a given datasource plugin kind.\n * Returns a list, with all information that can be used in a datasource selection context (group, name, selector, kind, ...)\n */\nexport function useListDatasourceSelectItems(datasourcePluginKind: string, project?: string) {\n const { listDatasourceSelectItems } = useDatasourceStore();\n return useQuery(['listDatasourceSelectItems', datasourcePluginKind, project], () =>\n listDatasourceSelectItems(datasourcePluginKind)\n );\n}\n\n/**\n * Provides a convenience hook for getting a DatasourceClient for a given DatasourceSelector.\n */\nexport function useDatasourceClient<Client>(selector: DatasourceSelector) {\n const store = useDatasourceStore();\n return useQuery<Client>(['getDatasourceClient', selector], () => store.getDatasourceClient<Client>(selector));\n}\n\nexport function useDatasource(selector: DatasourceSelector) {\n const store = useDatasourceStore();\n return useQuery(['getDatasource', selector], () => store.getDatasource(selector));\n}\n"],"names":["useQuery","createContext","useContext","DatasourceStoreContext","undefined","useDatasourceStore","ctx","Error","useListDatasourceSelectItems","datasourcePluginKind","project","listDatasourceSelectItems","useDatasourceClient","selector","store","getDatasourceClient","useDatasource","getDatasource"],"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,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AA8DlD,OAAO,MAAMC,yBAAyBF,cAA2CG,WAAW;AAE5F,OAAO,SAASC;IACd,MAAMC,MAAMJ,WAAWC;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAEA;;;CAGC,GACD,OAAO,SAASE,6BAA6BC,oBAA4B,EAAEC,OAAgB;IACzF,MAAM,EAAEC,yBAAyB,EAAE,GAAGN;IACtC,OAAOL,SAAS;QAAC;QAA6BS;QAAsBC;KAAQ,EAAE,IAC5EC,0BAA0BF;AAE9B;AAEA;;CAEC,GACD,OAAO,SAASG,oBAA4BC,QAA4B;IACtE,MAAMC,QAAQT;IACd,OAAOL,SAAiB;QAAC;QAAuBa;KAAS,EAAE,IAAMC,MAAMC,mBAAmB,CAASF;AACrG;AAEA,OAAO,SAASG,cAAcH,QAA4B;IACxD,MAAMC,QAAQT;IACd,OAAOL,SAAS;QAAC;QAAiBa;KAAS,EAAE,IAAMC,MAAMG,aAAa,CAACJ;AACzE"}
1
+ {"version":3,"sources":["../../src/runtime/datasources.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 { DatasourceSelector, DatasourceSpec } from '@perses-dev/core';\nimport { useQuery } from '@tanstack/react-query';\nimport { createContext, useContext } from 'react';\n\nexport interface DatasourceStore {\n // TODO: Do we even need this method?\n getDatasource(selector: DatasourceSelector): Promise<DatasourceSpec>;\n\n /**\n * Given a DatasourceSelector, gets a `Client` object from the corresponding Datasource plugin.\n */\n getDatasourceClient<Client>(selector: DatasourceSelector): Promise<Client>;\n\n /**\n * Gets a list of datasource selection items for a plugin kind.\n */\n listDatasourceSelectItems(datasourcePluginKind: string): Promise<DatasourceSelectItemGroup[]>;\n\n /**\n * Gets the list of datasources defined in the dashboard\n */\n getLocalDatasources(): Record<string, DatasourceSpec>;\n\n /**\n * Sets the list of datasources defined in the dashboard\n */\n setLocalDatasources(datasources: Record<string, DatasourceSpec>): void;\n\n /**\n * Gets the list of datasources that are available in the dashboard (i.e. dashboards that have been created on the server side that we can use).\n */\n getSavedDatasources(): Record<string, DatasourceSpec>;\n\n /**\n * Sets the list of datasources that are saved in the dashboard\n */\n setSavedDatasources(datasources: Record<string, DatasourceSpec>): void;\n}\n\nexport interface DatasourceSelectItemGroup {\n group?: string;\n editLink?: string;\n items: DatasourceSelectItem[];\n}\n\nexport interface DatasourceSelectItem {\n name: string;\n overridden?: boolean;\n overriding?: boolean;\n saved?: boolean;\n selector: DatasourceSelectItemSelector;\n}\n\n/**\n * Datasource Selector used by the frontend only to differentiate datasources coming from different group.\n */\nexport interface DatasourceSelectItemSelector extends DatasourceSelector {\n /**\n * Group of the datasource.\n * Omit it if you don't store datasource by group.\n */\n group?: string;\n}\n\nexport const DatasourceStoreContext = createContext<DatasourceStore | undefined>(undefined);\n\nexport function useDatasourceStore() {\n const ctx = useContext(DatasourceStoreContext);\n if (ctx === undefined) {\n throw new Error('No DatasourceStoreContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\n/**\n * Lists all available Datasource selection items for a given datasource plugin kind.\n * Returns a list, with all information that can be used in a datasource selection context (group, name, selector, kind, ...)\n */\nexport function useListDatasourceSelectItems(datasourcePluginKind: string, project?: string) {\n const { listDatasourceSelectItems } = useDatasourceStore();\n return useQuery({\n queryKey: ['listDatasourceSelectItems', datasourcePluginKind, project],\n queryFn: () => listDatasourceSelectItems(datasourcePluginKind),\n });\n}\n\n/**\n * Provides a convenience hook for getting a DatasourceClient for a given DatasourceSelector.\n */\nexport function useDatasourceClient<Client>(selector: DatasourceSelector) {\n const store = useDatasourceStore();\n return useQuery<Client>({\n queryKey: ['getDatasourceClient', selector],\n queryFn: () => store.getDatasourceClient<Client>(selector),\n });\n}\n\nexport function useDatasource(selector: DatasourceSelector) {\n const store = useDatasourceStore();\n return useQuery({ queryKey: ['getDatasource', selector], queryFn: () => store.getDatasource(selector) });\n}\n"],"names":["useQuery","createContext","useContext","DatasourceStoreContext","undefined","useDatasourceStore","ctx","Error","useListDatasourceSelectItems","datasourcePluginKind","project","listDatasourceSelectItems","queryKey","queryFn","useDatasourceClient","selector","store","getDatasourceClient","useDatasource","getDatasource"],"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,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AA8DlD,OAAO,MAAMC,yBAAyBF,cAA2CG,WAAW;AAE5F,OAAO,SAASC;IACd,MAAMC,MAAMJ,WAAWC;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAEA;;;CAGC,GACD,OAAO,SAASE,6BAA6BC,oBAA4B,EAAEC,OAAgB;IACzF,MAAM,EAAEC,yBAAyB,EAAE,GAAGN;IACtC,OAAOL,SAAS;QACdY,UAAU;YAAC;YAA6BH;YAAsBC;SAAQ;QACtEG,SAAS,IAAMF,0BAA0BF;IAC3C;AACF;AAEA;;CAEC,GACD,OAAO,SAASK,oBAA4BC,QAA4B;IACtE,MAAMC,QAAQX;IACd,OAAOL,SAAiB;QACtBY,UAAU;YAAC;YAAuBG;SAAS;QAC3CF,SAAS,IAAMG,MAAMC,mBAAmB,CAASF;IACnD;AACF;AAEA,OAAO,SAASG,cAAcH,QAA4B;IACxD,MAAMC,QAAQX;IACd,OAAOL,SAAS;QAAEY,UAAU;YAAC;YAAiBG;SAAS;QAAEF,SAAS,IAAMG,MAAMG,aAAa,CAACJ;IAAU;AACxG"}
@@ -1,9 +1,10 @@
1
1
  export * from './builtin-variables';
2
2
  export * from './datasources';
3
3
  export * from './plugin-registry';
4
- export * from './template-variables';
4
+ export * from './variables';
5
5
  export * from './TimeRangeProvider';
6
6
  export * from './time-series-queries';
7
7
  export * from './trace-queries';
8
8
  export * from './DataQueriesProvider';
9
+ export * from './QueryCountProvider';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -13,10 +13,11 @@
13
13
  export * from './builtin-variables';
14
14
  export * from './datasources';
15
15
  export * from './plugin-registry';
16
- export * from './template-variables';
16
+ export * from './variables';
17
17
  export * from './TimeRangeProvider';
18
18
  export * from './time-series-queries';
19
19
  export * from './trace-queries';
20
20
  export * from './DataQueriesProvider';
21
+ export * from './QueryCountProvider';
21
22
 
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/index.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\nexport * from './builtin-variables';\nexport * from './datasources';\nexport * from './plugin-registry';\nexport * from './template-variables';\nexport * from './TimeRangeProvider';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './DataQueriesProvider';\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;AAEjC,cAAc,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,uBAAuB;AACrC,cAAc,sBAAsB;AACpC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,wBAAwB"}
1
+ {"version":3,"sources":["../../src/runtime/index.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\nexport * from './builtin-variables';\nexport * from './datasources';\nexport * from './plugin-registry';\nexport * from './variables';\nexport * from './TimeRangeProvider';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './DataQueriesProvider';\nexport * from './QueryCountProvider';\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;AAEjC,cAAc,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,sBAAsB;AACpC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,wBAAwB;AACtC,cAAc,uBAAuB"}
@@ -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,UA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AAC,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,2EAOtG;AAED,wBAAgB,mCAAmC,yFAkBlD"}
@@ -33,11 +33,15 @@ export const PluginRegistryContext = createContext(undefined);
33
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
- return useQuery([
37
- 'getPlugin',
38
- pluginType,
39
- kind
40
- ], ()=>getPlugin(pluginType, kind), options);
36
+ return useQuery({
37
+ queryKey: [
38
+ 'getPlugin',
39
+ pluginType,
40
+ kind
41
+ ],
42
+ queryFn: ()=>getPlugin(pluginType, kind),
43
+ ...options
44
+ });
41
45
  }
42
46
  /**
43
47
  * Loads a list of plugins and returns the plugin implementation, along with loading/error state.
@@ -60,28 +64,35 @@ export const PluginRegistryContext = createContext(undefined);
60
64
  * Gets a list of plugin metadata for the specified plugin type and returns it, along with loading/error state.
61
65
  */ export function useListPluginMetadata(pluginTypes, options) {
62
66
  const { listPluginMetadata } = usePluginRegistry();
63
- return useQuery([
64
- 'listPluginMetadata',
65
- pluginTypes
66
- ], ()=>listPluginMetadata(pluginTypes), options);
67
+ return useQuery({
68
+ queryKey: [
69
+ 'listPluginMetadata',
70
+ pluginTypes
71
+ ],
72
+ queryFn: ()=>listPluginMetadata(pluginTypes),
73
+ ...options
74
+ });
67
75
  }
68
76
  export function usePluginBuiltinVariableDefinitions() {
69
77
  const { getPlugin, listPluginMetadata } = usePluginRegistry();
70
- return useQuery([
71
- 'usePluginBuiltinVariableDefinitions'
72
- ], async ()=>{
73
- const datasources = await listPluginMetadata([
74
- 'Datasource'
75
- ]);
76
- const datasourceKinds = new Set(datasources.map((datasource)=>datasource.kind));
77
- const result = [];
78
- for (const kind of datasourceKinds){
79
- const plugin = await getPlugin('Datasource', kind);
80
- if (plugin.getBuiltinVariableDefinitions) {
81
- plugin.getBuiltinVariableDefinitions().forEach((definition)=>result.push(definition));
78
+ return useQuery({
79
+ queryKey: [
80
+ 'usePluginBuiltinVariableDefinitions'
81
+ ],
82
+ queryFn: async ()=>{
83
+ const datasources = await listPluginMetadata([
84
+ 'Datasource'
85
+ ]);
86
+ const datasourceKinds = new Set(datasources.map((datasource)=>datasource.kind));
87
+ const result = [];
88
+ for (const kind of datasourceKinds){
89
+ const plugin = await getPlugin('Datasource', kind);
90
+ if (plugin.getBuiltinVariableDefinitions) {
91
+ plugin.getBuiltinVariableDefinitions().forEach((definition)=>result.push(definition));
92
+ }
82
93
  }
94
+ return result;
83
95
  }
84
- return result;
85
96
  });
86
97
  }
87
98
 
@@ -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(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;I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AAI,CAACD;YAC7E;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({\n queryKey: ['getPlugin', pluginType, kind],\n queryFn: () => getPlugin(pluginType!, kind),\n ...options,\n });\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({\n queryKey: ['listPluginMetadata', pluginTypes],\n queryFn: () => listPluginMetadata(pluginTypes),\n ...options,\n });\n}\n\nexport function usePluginBuiltinVariableDefinitions() {\n const { getPlugin, listPluginMetadata } = usePluginRegistry();\n\n return useQuery({\n queryKey: ['usePluginBuiltinVariableDefinitions'],\n queryFn: 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}\n"],"names":["createContext","useContext","useQuery","useQueries","PluginRegistryContext","undefined","usePluginRegistry","ctx","Error","usePlugin","pluginType","kind","options","enabled","getPlugin","queryKey","queryFn","usePlugins","plugins","queries","map","p","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;QACda,UAAU;YAAC;YAAaL;YAAYC;SAAK;QACzCK,SAAS,IAAMF,UAAUJ,YAAaC;QACtC,GAAGC,OAAO;IACZ;AACF;AAEA;;CAEC,GACD,OAAO,SAASK,WAAiCP,UAAa,EAAEQ,OAAgC;IAC9F,MAAM,EAAEJ,SAAS,EAAE,GAAGR;IACtB,OAAOH,WAAW;QAChBgB,SAASD,QAAQE,GAAG,CAAC,CAACC;YACpB,OAAO;gBACLN,UAAU;oBAAC;oBAAaL;oBAAYW,EAAEV,IAAI;iBAAC;gBAC3CK,SAAS,IAAMF,UAAUJ,YAAYW,EAAEV,IAAI;YAC7C;QACF;IACF;AACF;AAQA;;CAEC,GACD,OAAO,SAASW,sBAAsBC,WAAyB,EAAEX,OAAsC;IACrG,MAAM,EAAEY,kBAAkB,EAAE,GAAGlB;IAC/B,OAAOJ,SAAS;QACda,UAAU;YAAC;YAAsBQ;SAAY;QAC7CP,SAAS,IAAMQ,mBAAmBD;QAClC,GAAGX,OAAO;IACZ;AACF;AAEA,OAAO,SAASa;IACd,MAAM,EAAEX,SAAS,EAAEU,kBAAkB,EAAE,GAAGlB;IAE1C,OAAOJ,SAAS;QACda,UAAU;YAAC;SAAsC;QACjDC,SAAS;YACP,MAAMU,cAAc,MAAMF,mBAAmB;gBAAC;aAAa;YAC3D,MAAMG,kBAAkB,IAAIC,IAAIF,YAAYN,GAAG,CAAC,CAACS,aAAeA,WAAWlB,IAAI;YAC/E,MAAMmB,SAAsC,EAAE;YAC9C,KAAK,MAAMnB,QAAQgB,gBAAiB;gBAClC,MAAMI,SAAS,MAAMjB,UAAU,cAAcH;gBAC7C,IAAIoB,OAAOC,6BAA6B,EAAE;oBACxCD,OAAOC,6BAA6B,GAAGC,OAAO,CAAC,CAACC,aAAeJ,OAAOK,IAAI,CAACD;gBAC7E;YACF;YACA,OAAOJ;QACT;IACF;AACF"}
@@ -9,11 +9,11 @@ export declare const TIME_SERIES_QUERY_KEY = "TimeSeriesQuery";
9
9
  /**
10
10
  * Runs a time series query using a plugin and returns the results.
11
11
  */
12
- export declare const useTimeSeriesQuery: (definition: TimeSeriesQueryDefinition, options?: UseTimeSeriesQueryOptions, queryOptions?: QueryObserverOptions) => import("@tanstack/react-query").UseQueryResult<TimeSeriesData, unknown>;
12
+ export declare const useTimeSeriesQuery: (definition: TimeSeriesQueryDefinition, options?: UseTimeSeriesQueryOptions, queryOptions?: QueryObserverOptions<TimeSeriesData>) => import("@tanstack/react-query").UseQueryResult<TimeSeriesData, unknown>;
13
13
  /**
14
14
  * Runs multiple time series queries using plugins and returns the results.
15
15
  */
16
- export declare function useTimeSeriesQueries(definitions: TimeSeriesQueryDefinition[], options?: UseTimeSeriesQueryOptions, queryOptions?: QueryObserverOptions): import("@tanstack/react-query").UseQueryResult<TimeSeriesData, unknown>[];
16
+ export declare function useTimeSeriesQueries(definitions: TimeSeriesQueryDefinition[], options?: UseTimeSeriesQueryOptions, queryOptions?: Omit<QueryObserverOptions, 'queryKey'>): import("@tanstack/react-query").UseQueryResult<TimeSeriesData, unknown>[];
17
17
  /**
18
18
  * Get active time series queries for query results summary
19
19
  */
@@ -1 +1 @@
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,EAA0B,mBAAmB,EAAyB,MAAM,UAAU,CAAC;AAMnH,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAED,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AA2DvD;;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,6EAkCpC;AAkBD;;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,EAA0B,mBAAmB,EAAyB,MAAM,UAAU,CAAC;AAMnH,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAED,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AA2DvD;;GAEG;AACH,eAAO,MAAM,kBAAkB,eACjB,yBAAyB,YAC3B,yBAAyB,iBACpB,qBAAqB,cAAc,CAAC,4EAmBpD,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,yBAAyB,EAAE,EACxC,OAAO,CAAC,EAAE,yBAAyB,EACnC,YAAY,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,6EAkCtD;AAkBD;;GAEG;AACH,wBAAgB,0BAA0B,0BAIzC;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,UAAU,yBAW3D"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -11,7 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { useQuery, useQueries, useQueryClient } from '@tanstack/react-query';
14
- import { useVariableValues } from './template-variables';
14
+ import { useAllVariableValues } from './variables';
15
15
  import { useTimeRange } from './TimeRangeProvider';
16
16
  import { useDatasourceStore } from './datasources';
17
17
  import { usePlugin, usePluginRegistry, usePlugins } from './plugin-registry';
@@ -128,7 +128,7 @@ function getQueryOptions({ plugin, definition, context }) {
128
128
  * Build the time series query context object from data available at runtime
129
129
  */ function useTimeSeriesQueryContext() {
130
130
  const { absoluteTimeRange, refreshKey } = useTimeRange();
131
- const variableState = useVariableValues();
131
+ const variableState = useAllVariableValues();
132
132
  const datasourceStore = useDatasourceStore();
133
133
  return {
134
134
  timeRange: absoluteTimeRange,