@perses-dev/plugin-system 0.0.0-snapshot-histogram-types-78c5104 → 0.0.0-snapshot-react-18-v-0-51-rc-0-8090608

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 (52) hide show
  1. package/dist/cjs/components/DatasourceSelect.js +163 -81
  2. package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +5 -2
  3. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +91 -1
  4. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +11 -7
  5. package/dist/cjs/constants/user-interface-text.js +3 -1
  6. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +13 -0
  7. package/dist/cjs/runtime/time-series-queries.js +4 -13
  8. package/dist/cjs/runtime/trace-queries.js +45 -11
  9. package/dist/cjs/runtime/utils.js +39 -0
  10. package/dist/components/DatasourceSelect.d.ts +20 -3
  11. package/dist/components/DatasourceSelect.d.ts.map +1 -1
  12. package/dist/components/DatasourceSelect.js +150 -74
  13. package/dist/components/DatasourceSelect.js.map +1 -1
  14. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
  15. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +5 -2
  16. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  17. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  18. package/dist/components/PluginRegistry/plugin-indexes.d.ts +1 -1
  19. package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
  20. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  21. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +2 -1
  22. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  23. package/dist/components/TimeRangeControls/TimeRangeControls.js +94 -2
  24. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  25. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  26. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +11 -7
  27. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  28. package/dist/constants/user-interface-text.d.ts +2 -0
  29. package/dist/constants/user-interface-text.d.ts.map +1 -1
  30. package/dist/constants/user-interface-text.js +3 -1
  31. package/dist/constants/user-interface-text.js.map +1 -1
  32. package/dist/model/trace-queries.d.ts +13 -1
  33. package/dist/model/trace-queries.d.ts.map +1 -1
  34. package/dist/model/trace-queries.js.map +1 -1
  35. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +7 -0
  36. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -1
  37. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +13 -0
  38. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  39. package/dist/runtime/plugin-registry.d.ts +2 -2
  40. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  41. package/dist/runtime/plugin-registry.js.map +1 -1
  42. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  43. package/dist/runtime/time-series-queries.js +2 -11
  44. package/dist/runtime/time-series-queries.js.map +1 -1
  45. package/dist/runtime/trace-queries.d.ts.map +1 -1
  46. package/dist/runtime/trace-queries.js +46 -12
  47. package/dist/runtime/trace-queries.js.map +1 -1
  48. package/dist/runtime/utils.d.ts +7 -0
  49. package/dist/runtime/utils.d.ts.map +1 -0
  50. package/dist/runtime/utils.js +25 -0
  51. package/dist/runtime/utils.js.map +1 -0
  52. package/package.json +3 -3
@@ -13,8 +13,10 @@
13
13
  import { getUnixTime } from 'date-fns';
14
14
  import { useQueries } from '@tanstack/react-query';
15
15
  import { useDatasourceStore } from './datasources';
16
- import { usePluginRegistry } from './plugin-registry';
16
+ import { usePluginRegistry, usePlugins } from './plugin-registry';
17
17
  import { useTimeRange } from './TimeRangeProvider';
18
+ import { useAllVariableValues } from './variables';
19
+ import { filterVariableStateMap, getVariableValuesKey } from './utils';
18
20
  export const TRACE_QUERY_KEY = 'TraceQuery';
19
21
  export function getUnixTimeRange(timeRange) {
20
22
  const { start, end } = timeRange;
@@ -29,23 +31,23 @@ export function getUnixTimeRange(timeRange) {
29
31
  * Documentation for TraceQL: https://grafana.com/docs/tempo/latest/traceql/
30
32
  */ export function useTraceQueries(definitions) {
31
33
  const { getPlugin } = usePluginRegistry();
32
- const datasourceStore = useDatasourceStore();
33
- const { absoluteTimeRange } = useTimeRange();
34
- const context = {
35
- datasourceStore,
36
- absoluteTimeRange
37
- };
34
+ const context = useTraceQueryContext();
35
+ const pluginLoaderResponse = usePlugins('TraceQuery', definitions.map((d)=>({
36
+ kind: d.spec.plugin.kind
37
+ })));
38
38
  // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)
39
39
  // https://tanstack.com/query/v4/docs/react/reference/useQuery
40
40
  return useQueries({
41
- queries: definitions.map((definition)=>{
42
- const queryKey = [
41
+ queries: definitions.map((definition, idx)=>{
42
+ const plugin = pluginLoaderResponse[idx]?.data;
43
+ const { queryEnabled, queryKey } = getQueryOptions({
44
+ context,
43
45
  definition,
44
- datasourceStore,
45
- absoluteTimeRange
46
- ]; // `queryKey` watches and reruns `queryFn` if keys in the array change
46
+ plugin
47
+ });
47
48
  const traceQueryKind = definition?.spec?.plugin?.kind;
48
49
  return {
50
+ enabled: queryEnabled,
49
51
  queryKey: queryKey,
50
52
  queryFn: async ()=>{
51
53
  const plugin = await getPlugin(TRACE_QUERY_KEY, traceQueryKind);
@@ -56,5 +58,37 @@ export function getUnixTimeRange(timeRange) {
56
58
  })
57
59
  });
58
60
  }
61
+ function getQueryOptions({ plugin, definition, context }) {
62
+ const { datasourceStore, variableState, absoluteTimeRange } = context;
63
+ const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};
64
+ const variableDependencies = dependencies?.variables;
65
+ const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);
66
+ const variablesValueKey = getVariableValuesKey(filteredVariabledState);
67
+ const queryKey = [
68
+ definition,
69
+ datasourceStore,
70
+ absoluteTimeRange,
71
+ variablesValueKey
72
+ ];
73
+ let waitToLoad = false;
74
+ if (variableDependencies) {
75
+ waitToLoad = variableDependencies.some((v)=>variableState[v]?.loading);
76
+ }
77
+ const queryEnabled = plugin !== undefined && !waitToLoad;
78
+ return {
79
+ queryKey,
80
+ queryEnabled
81
+ };
82
+ }
83
+ function useTraceQueryContext() {
84
+ const { absoluteTimeRange } = useTimeRange();
85
+ const variableState = useAllVariableValues();
86
+ const datasourceStore = useDatasourceStore();
87
+ return {
88
+ variableState,
89
+ datasourceStore,
90
+ absoluteTimeRange
91
+ };
92
+ }
59
93
 
60
94
  //# sourceMappingURL=trace-queries.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/trace-queries.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 { getUnixTime } from 'date-fns';\nimport { QueryDefinition, UnknownSpec, AbsoluteTimeRange, TraceData } from '@perses-dev/core';\nimport { useQueries, UseQueryResult } from '@tanstack/react-query';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nexport type TraceQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'TraceQuery', PluginSpec>;\nexport const TRACE_QUERY_KEY = 'TraceQuery';\n\nexport function getUnixTimeRange(timeRange: AbsoluteTimeRange): { start: number; end: number } {\n const { start, end } = timeRange;\n return {\n start: Math.ceil(getUnixTime(start)),\n end: Math.ceil(getUnixTime(end)),\n };\n}\n\n/**\n * Run a trace query using a TraceQuery plugin and return the results\n * @param definitions: dashboard defintion for a trace query, written in Trace Query Language (TraceQL)\n * Documentation for TraceQL: https://grafana.com/docs/tempo/latest/traceql/\n */\nexport function useTraceQueries(definitions: TraceQueryDefinition[]): Array<UseQueryResult<TraceData>> {\n const { getPlugin } = usePluginRegistry();\n const datasourceStore = useDatasourceStore();\n const { absoluteTimeRange } = useTimeRange();\n\n const context = {\n datasourceStore,\n absoluteTimeRange,\n };\n\n // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)\n // https://tanstack.com/query/v4/docs/react/reference/useQuery\n return useQueries({\n queries: definitions.map((definition) => {\n const queryKey = [definition, datasourceStore, absoluteTimeRange] as const; // `queryKey` watches and reruns `queryFn` if keys in the array change\n const traceQueryKind = definition?.spec?.plugin?.kind;\n return {\n queryKey: queryKey,\n queryFn: async (): Promise<TraceData> => {\n const plugin = await getPlugin(TRACE_QUERY_KEY, traceQueryKind);\n const data = await plugin.getTraceData(definition.spec.plugin.spec, context);\n return data;\n },\n };\n }),\n });\n}\n"],"names":["getUnixTime","useQueries","useDatasourceStore","usePluginRegistry","useTimeRange","TRACE_QUERY_KEY","getUnixTimeRange","timeRange","start","end","Math","ceil","useTraceQueries","definitions","getPlugin","datasourceStore","absoluteTimeRange","context","queries","map","definition","queryKey","traceQueryKind","spec","plugin","kind","queryFn","data","getTraceData"],"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,WAAW,QAAQ,WAAW;AAEvC,SAASC,UAAU,QAAwB,wBAAwB;AACnE,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,YAAY,QAAQ,sBAAsB;AAEnD,OAAO,MAAMC,kBAAkB,aAAa;AAE5C,OAAO,SAASC,iBAAiBC,SAA4B;IAC3D,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAE,GAAGF;IACvB,OAAO;QACLC,OAAOE,KAAKC,IAAI,CAACX,YAAYQ;QAC7BC,KAAKC,KAAKC,IAAI,CAACX,YAAYS;IAC7B;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASG,gBAAgBC,WAAmC;IACjE,MAAM,EAAEC,SAAS,EAAE,GAAGX;IACtB,MAAMY,kBAAkBb;IACxB,MAAM,EAAEc,iBAAiB,EAAE,GAAGZ;IAE9B,MAAMa,UAAU;QACdF;QACAC;IACF;IAEA,+FAA+F;IAC/F,8DAA8D;IAC9D,OAAOf,WAAW;QAChBiB,SAASL,YAAYM,GAAG,CAAC,CAACC;YACxB,MAAMC,WAAW;gBAACD;gBAAYL;gBAAiBC;aAAkB,EAAW,sEAAsE;YAClJ,MAAMM,iBAAiBF,YAAYG,MAAMC,QAAQC;YACjD,OAAO;gBACLJ,UAAUA;gBACVK,SAAS;oBACP,MAAMF,SAAS,MAAMV,UAAUT,iBAAiBiB;oBAChD,MAAMK,OAAO,MAAMH,OAAOI,YAAY,CAACR,WAAWG,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN;oBACpE,OAAOU;gBACT;YACF;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/runtime/trace-queries.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 { getUnixTime } from 'date-fns';\nimport { QueryDefinition, UnknownSpec, AbsoluteTimeRange, TraceData } from '@perses-dev/core';\nimport { QueryKey, useQueries, UseQueryResult } from '@tanstack/react-query';\nimport { TraceQueryContext, TraceQueryPlugin } from '../model';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry, usePlugins } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useAllVariableValues } from './variables';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\nexport type TraceQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'TraceQuery', PluginSpec>;\nexport const TRACE_QUERY_KEY = 'TraceQuery';\n\nexport function getUnixTimeRange(timeRange: AbsoluteTimeRange): { start: number; end: number } {\n const { start, end } = timeRange;\n return {\n start: Math.ceil(getUnixTime(start)),\n end: Math.ceil(getUnixTime(end)),\n };\n}\n\n/**\n * Run a trace query using a TraceQuery plugin and return the results\n * @param definitions: dashboard defintion for a trace query, written in Trace Query Language (TraceQL)\n * Documentation for TraceQL: https://grafana.com/docs/tempo/latest/traceql/\n */\nexport function useTraceQueries(definitions: TraceQueryDefinition[]): Array<UseQueryResult<TraceData>> {\n const { getPlugin } = usePluginRegistry();\n const context = useTraceQueryContext();\n\n const pluginLoaderResponse = usePlugins(\n 'TraceQuery',\n definitions.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n\n // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)\n // https://tanstack.com/query/v4/docs/react/reference/useQuery\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ context, definition, plugin });\n const traceQueryKind = definition?.spec?.plugin?.kind;\n return {\n enabled: queryEnabled,\n queryKey: queryKey,\n queryFn: async (): Promise<TraceData> => {\n const plugin = await getPlugin(TRACE_QUERY_KEY, traceQueryKind);\n const data = await plugin.getTraceData(definition.spec.plugin.spec, context);\n return data;\n },\n };\n }),\n });\n}\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: TraceQueryPlugin;\n definition: TraceQueryDefinition;\n context: TraceQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { datasourceStore, variableState, absoluteTimeRange } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n const queryKey = [definition, datasourceStore, absoluteTimeRange, variablesValueKey] as const;\n\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n return {\n queryKey,\n queryEnabled,\n };\n}\n\nfunction useTraceQueryContext(): TraceQueryContext {\n const { absoluteTimeRange } = useTimeRange();\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n variableState,\n datasourceStore,\n absoluteTimeRange,\n };\n}\n"],"names":["getUnixTime","useQueries","useDatasourceStore","usePluginRegistry","usePlugins","useTimeRange","useAllVariableValues","filterVariableStateMap","getVariableValuesKey","TRACE_QUERY_KEY","getUnixTimeRange","timeRange","start","end","Math","ceil","useTraceQueries","definitions","getPlugin","context","useTraceQueryContext","pluginLoaderResponse","map","d","kind","spec","plugin","queries","definition","idx","data","queryEnabled","queryKey","getQueryOptions","traceQueryKind","enabled","queryFn","getTraceData","datasourceStore","variableState","absoluteTimeRange","dependencies","dependsOn","variableDependencies","variables","filteredVariabledState","variablesValueKey","waitToLoad","some","v","loading","undefined"],"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,WAAW,QAAQ,WAAW;AAEvC,SAAmBC,UAAU,QAAwB,wBAAwB;AAE7E,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,oBAAoB;AAClE,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,oBAAoB,QAAQ,cAAc;AACnD,SAASC,sBAAsB,EAAEC,oBAAoB,QAAQ,UAAU;AAEvE,OAAO,MAAMC,kBAAkB,aAAa;AAE5C,OAAO,SAASC,iBAAiBC,SAA4B;IAC3D,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAE,GAAGF;IACvB,OAAO;QACLC,OAAOE,KAAKC,IAAI,CAACf,YAAYY;QAC7BC,KAAKC,KAAKC,IAAI,CAACf,YAAYa;IAC7B;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASG,gBAAgBC,WAAmC;IACjE,MAAM,EAAEC,SAAS,EAAE,GAAGf;IACtB,MAAMgB,UAAUC;IAEhB,MAAMC,uBAAuBjB,WAC3B,cACAa,YAAYK,GAAG,CAAC,CAACC,IAAO,CAAA;YAAEC,MAAMD,EAAEE,IAAI,CAACC,MAAM,CAACF,IAAI;QAAC,CAAA;IAGrD,+FAA+F;IAC/F,8DAA8D;IAC9D,OAAOvB,WAAW;QAChB0B,SAASV,YAAYK,GAAG,CAAC,CAACM,YAAYC;YACpC,MAAMH,SAASL,oBAAoB,CAACQ,IAAI,EAAEC;YAC1C,MAAM,EAAEC,YAAY,EAAEC,QAAQ,EAAE,GAAGC,gBAAgB;gBAAEd;gBAASS;gBAAYF;YAAO;YACjF,MAAMQ,iBAAiBN,YAAYH,MAAMC,QAAQF;YACjD,OAAO;gBACLW,SAASJ;gBACTC,UAAUA;gBACVI,SAAS;oBACP,MAAMV,SAAS,MAAMR,UAAUT,iBAAiByB;oBAChD,MAAMJ,OAAO,MAAMJ,OAAOW,YAAY,CAACT,WAAWH,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN;oBACpE,OAAOW;gBACT;YACF;QACF;IACF;AACF;AAEA,SAASG,gBAAgB,EACvBP,MAAM,EACNE,UAAU,EACVT,OAAO,EAKR;IAIC,MAAM,EAAEmB,eAAe,EAAEC,aAAa,EAAEC,iBAAiB,EAAE,GAAGrB;IAE9D,MAAMsB,eAAef,QAAQgB,YAAYhB,OAAOgB,SAAS,CAACd,WAAWH,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN,WAAW,CAAC;IACnG,MAAMwB,uBAAuBF,cAAcG;IAE3C,MAAMC,yBAAyBtC,uBAAuBgC,eAAeI;IACrE,MAAMG,oBAAoBtC,qBAAqBqC;IAC/C,MAAMb,WAAW;QAACJ;QAAYU;QAAiBE;QAAmBM;KAAkB;IAEpF,IAAIC,aAAa;IACjB,IAAIJ,sBAAsB;QACxBI,aAAaJ,qBAAqBK,IAAI,CAAC,CAACC,IAAMV,aAAa,CAACU,EAAE,EAAEC;IAClE;IAEA,MAAMnB,eAAeL,WAAWyB,aAAa,CAACJ;IAC9C,OAAO;QACLf;QACAD;IACF;AACF;AAEA,SAASX;IACP,MAAM,EAAEoB,iBAAiB,EAAE,GAAGnC;IAC9B,MAAMkC,gBAAgBjC;IACtB,MAAMgC,kBAAkBpC;IAExB,OAAO;QACLqC;QACAD;QACAE;IACF;AACF"}
@@ -0,0 +1,7 @@
1
+ import { VariableStateMap } from './variables';
2
+ export declare function filterVariableStateMap(v: VariableStateMap, names?: string[]): VariableStateMap;
3
+ /**
4
+ * Returns a serialized string of the current state of variable values.
5
+ */
6
+ export declare function getVariableValuesKey(v: VariableStateMap): string;
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/runtime/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAK9F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAIhE"}
@@ -0,0 +1,25 @@
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
+ export function filterVariableStateMap(v, names) {
14
+ if (!names) {
15
+ return v;
16
+ }
17
+ return Object.fromEntries(Object.entries(v).filter(([name])=>names.includes(name)));
18
+ }
19
+ /**
20
+ * Returns a serialized string of the current state of variable values.
21
+ */ export function getVariableValuesKey(v) {
22
+ return Object.values(v).map((v)=>JSON.stringify(v.value)).join(',');
23
+ }
24
+
25
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/runtime/utils.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 { VariableStateMap } from './variables';\n\nexport function filterVariableStateMap(v: VariableStateMap, names?: string[]): VariableStateMap {\n if (!names) {\n return v;\n }\n return Object.fromEntries(Object.entries(v).filter(([name]) => names.includes(name)));\n}\n\n/**\n * Returns a serialized string of the current state of variable values.\n */\nexport function getVariableValuesKey(v: VariableStateMap): string {\n return Object.values(v)\n .map((v) => JSON.stringify(v.value))\n .join(',');\n}\n"],"names":["filterVariableStateMap","v","names","Object","fromEntries","entries","filter","name","includes","getVariableValuesKey","values","map","JSON","stringify","value","join"],"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,OAAO,SAASA,uBAAuBC,CAAmB,EAAEC,KAAgB;IAC1E,IAAI,CAACA,OAAO;QACV,OAAOD;IACT;IACA,OAAOE,OAAOC,WAAW,CAACD,OAAOE,OAAO,CAACJ,GAAGK,MAAM,CAAC,CAAC,CAACC,KAAK,GAAKL,MAAMM,QAAQ,CAACD;AAChF;AAEA;;CAEC,GACD,OAAO,SAASE,qBAAqBR,CAAmB;IACtD,OAAOE,OAAOO,MAAM,CAACT,GAClBU,GAAG,CAAC,CAACV,IAAMW,KAAKC,SAAS,CAACZ,EAAEa,KAAK,GACjCC,IAAI,CAAC;AACV"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/plugin-system",
3
- "version": "0.0.0-snapshot-histogram-types-78c5104",
3
+ "version": "0.0.0-snapshot-react-18-v-0-51-rc-0-8090608",
4
4
  "description": "The plugin feature in Pereses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@module-federation/enhanced": "^0.8.9",
32
- "@perses-dev/components": "0.0.0-snapshot-histogram-types-78c5104",
33
- "@perses-dev/core": "0.0.0-snapshot-histogram-types-78c5104",
32
+ "@perses-dev/components": "0.0.0-snapshot-react-18-v-0-51-rc-0-8090608",
33
+ "@perses-dev/core": "0.0.0-snapshot-react-18-v-0-51-rc-0-8090608",
34
34
  "date-fns": "^4.1.0",
35
35
  "date-fns-tz": "^3.2.0",
36
36
  "immer": "^10.1.1",