@perses-dev/plugin-system 0.0.0-snapshot-explorer-plugin-c4a7621 → 0.0.0-snapshot-histogram-types-78c5104

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 (87) hide show
  1. package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +8 -2
  2. package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +13 -10
  3. package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +2 -2
  4. package/dist/cjs/remote/PluginRuntime.js +168 -162
  5. package/dist/cjs/runtime/DataQueriesProvider/model.js +1 -1
  6. package/dist/cjs/runtime/plugin-registry.js +13 -4
  7. package/dist/cjs/runtime/trace-queries.js +1 -5
  8. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  9. package/dist/components/DatasourceSelect.d.ts +2 -2
  10. package/dist/components/DatasourceSelect.d.ts.map +1 -1
  11. package/dist/components/DatasourceSelect.js.map +1 -1
  12. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
  13. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +8 -2
  14. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  15. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -1
  16. package/dist/components/MultiQueryEditor/MultiQueryEditor.js +13 -10
  17. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  18. package/dist/components/MultiQueryEditor/QueryEditorContainer.js +1 -1
  19. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  20. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  21. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  22. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  23. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  24. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  25. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  26. package/dist/components/Variables/variable-model.js.map +1 -1
  27. package/dist/model/panels.d.ts +13 -3
  28. package/dist/model/panels.d.ts.map +1 -1
  29. package/dist/model/panels.js.map +1 -1
  30. package/dist/remote/PluginLoaderComponent.js.map +1 -1
  31. package/dist/remote/PluginRuntime.d.ts +0 -1
  32. package/dist/remote/PluginRuntime.d.ts.map +1 -1
  33. package/dist/remote/PluginRuntime.js +169 -160
  34. package/dist/remote/PluginRuntime.js.map +1 -1
  35. package/dist/remote/remotePluginLoader.js.map +1 -1
  36. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  37. package/dist/runtime/DataQueriesProvider/model.js +1 -1
  38. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  39. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  40. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  41. package/dist/runtime/plugin-registry.js +13 -4
  42. package/dist/runtime/plugin-registry.js.map +1 -1
  43. package/dist/runtime/trace-queries.d.ts.map +1 -1
  44. package/dist/runtime/trace-queries.js +1 -5
  45. package/dist/runtime/trace-queries.js.map +1 -1
  46. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  47. package/package.json +7 -9
  48. package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +0 -41
  49. package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +0 -34
  50. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +0 -42
  51. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +0 -101
  52. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemVariables.js +0 -42
  53. package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +0 -41
  54. package/dist/cjs/stories/shared-utils/decorators/index.js +0 -35
  55. package/dist/cjs/stories/shared-utils/index.js +0 -30
  56. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +0 -13
  57. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +0 -1
  58. package/dist/stories/shared-utils/decorators/WithDataQueries.js +0 -33
  59. package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +0 -1
  60. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +0 -4
  61. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +0 -1
  62. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +0 -26
  63. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +0 -1
  64. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +0 -13
  65. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +0 -1
  66. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +0 -39
  67. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +0 -1
  68. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +0 -13
  69. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +0 -1
  70. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +0 -95
  71. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +0 -1
  72. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts +0 -13
  73. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts.map +0 -1
  74. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.js +0 -39
  75. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.js.map +0 -1
  76. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +0 -13
  77. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +0 -1
  78. package/dist/stories/shared-utils/decorators/WithTimeRange.js +0 -33
  79. package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +0 -1
  80. package/dist/stories/shared-utils/decorators/index.d.ts +0 -7
  81. package/dist/stories/shared-utils/decorators/index.d.ts.map +0 -1
  82. package/dist/stories/shared-utils/decorators/index.js +0 -20
  83. package/dist/stories/shared-utils/decorators/index.js.map +0 -1
  84. package/dist/stories/shared-utils/index.d.ts +0 -2
  85. package/dist/stories/shared-utils/index.d.ts.map +0 -1
  86. package/dist/stories/shared-utils/index.js +0 -15
  87. package/dist/stories/shared-utils/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"trace-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/trace-queries.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAc,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAInE,MAAM,MAAM,oBAAoB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACvG,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAM7F;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CA+BrG"}
1
+ {"version":3,"file":"trace-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/trace-queries.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAc,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAInE,MAAM,MAAM,oBAAoB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACvG,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAM7F;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CA0BrG"}
@@ -51,11 +51,7 @@ export function getUnixTimeRange(timeRange) {
51
51
  const plugin = await getPlugin(TRACE_QUERY_KEY, traceQueryKind);
52
52
  const data = await plugin.getTraceData(definition.spec.plugin.spec, context);
53
53
  return data;
54
- },
55
- // The data returned by getTraceData() contains circular dependencies (a span has a reference to the parent span, and the parent span has an array of child spans)
56
- // Therefore structuralSharing must be turned off, otherwise the query is stuck in the 'fetching' state on re-fetch.
57
- // Ref: https://github.com/TanStack/query/issues/6954#issuecomment-1962321426
58
- structuralSharing: false
54
+ }
59
55
  };
60
56
  })
61
57
  });
@@ -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 // The data returned by getTraceData() contains circular dependencies (a span has a reference to the parent span, and the parent span has an array of child spans)\n // Therefore structuralSharing must be turned off, otherwise the query is stuck in the 'fetching' state on re-fetch.\n // Ref: https://github.com/TanStack/query/issues/6954#issuecomment-1962321426\n structuralSharing: false,\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","structuralSharing"],"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;gBAEA,kKAAkK;gBAClK,oHAAoH;gBACpH,6EAA6E;gBAC7EE,mBAAmB;YACrB;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 { 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 +1 @@
1
- {"version":3,"sources":["../../src/test-utils/mock-plugin-registry.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/core';\nimport { PluginRegistryProps } from '../components';\nimport { PluginModuleResource, Plugin, PluginLoader, PluginImplementation, PluginType } from '../model';\n\nexport type MockPlugin = {\n [T in PluginType]: {\n kind: T;\n spec: { name: string };\n plugin: PluginImplementation<T>;\n };\n}[PluginType];\n\n/**\n * Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`\n * component so that it will load the mock plugins you provide.\n */\nexport function mockPluginRegistry(...mockPlugins: MockPlugin[]): Omit<PluginRegistryProps, 'children'> {\n const mockPluginResource: PluginModuleResource = {\n kind: 'PluginModule',\n metadata: {\n name: 'Fake Plugin Module for Tests',\n version: '0',\n },\n spec: {\n // Add metadata for all mock plugins\n plugins: mockPlugins.map(({ kind, spec: { name } }) => ({\n kind,\n spec: {\n name,\n display: {\n name: getMockPluginName(kind, name),\n },\n },\n })),\n },\n };\n\n const mockPluginModule: Record<string, Plugin<UnknownSpec>> = {};\n for (const mockPlugin of mockPlugins) {\n // \"Export\" on the module under the same name as the kind the plugin handles\n mockPluginModule[mockPlugin.spec.name] = mockPlugin.plugin;\n }\n\n const pluginLoader: PluginLoader = {\n getInstalledPlugins() {\n return Promise.resolve([mockPluginResource]);\n },\n importPluginModule(/* resource */) {\n return Promise.resolve(mockPluginModule);\n },\n };\n\n return {\n pluginLoader,\n defaultPluginKinds: {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n },\n };\n}\n\n/**\n * The function that's used to generate the display name of mocked plugins in mockPluginRegistry. Can be useful if you\n * need to interact with some UI component that's displaying it.\n */\nexport function getMockPluginName(kind: PluginType, name: string): string {\n return `${kind} Plugin for ${name}`;\n}\n"],"names":["mockPluginRegistry","mockPlugins","mockPluginResource","kind","metadata","name","version","spec","plugins","map","display","getMockPluginName","mockPluginModule","mockPlugin","plugin","pluginLoader","getInstalledPlugins","Promise","resolve","importPluginModule","defaultPluginKinds","TimeSeriesQuery"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAcjC;;;CAGC,GACD,OAAO,SAASA,mBAAmB,GAAGC,WAAyB;IAC7D,MAAMC,qBAA2C;QAC/CC,MAAM;QACNC,UAAU;YACRC,MAAM;YACNC,SAAS;QACX;QACAC,MAAM;YACJ,oCAAoC;YACpCC,SAASP,YAAYQ,GAAG,CAAC,CAAC,EAAEN,IAAI,EAAEI,MAAM,EAAEF,IAAI,EAAE,EAAE,GAAM,CAAA;oBACtDF;oBACAI,MAAM;wBACJF;wBACAK,SAAS;4BACPL,MAAMM,kBAAkBR,MAAME;wBAChC;oBACF;gBACF,CAAA;QACF;IACF;IAEA,MAAMO,mBAAwD,CAAC;IAC/D,KAAK,MAAMC,cAAcZ,YAAa;QACpC,4EAA4E;QAC5EW,gBAAgB,CAACC,WAAWN,IAAI,CAACF,IAAI,CAAC,GAAGQ,WAAWC,MAAM;IAC5D;IAEA,MAAMC,eAA6B;QACjCC;YACE,OAAOC,QAAQC,OAAO,CAAC;gBAAChB;aAAmB;QAC7C;QACAiB;YACE,OAAOF,QAAQC,OAAO,CAACN;QACzB;IACF;IAEA,OAAO;QACLG;QACAK,oBAAoB;YAClBC,iBAAiB;QACnB;IACF;AACF;AAEA;;;CAGC,GACD,OAAO,SAASV,kBAAkBR,IAAgB,EAAEE,IAAY;IAC9D,OAAO,CAAC,EAAEF,KAAK,YAAY,EAAEE,KAAK,CAAC;AACrC"}
1
+ {"version":3,"sources":["../../src/test-utils/mock-plugin-registry.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/core';\nimport { PluginRegistryProps } from '../components';\nimport { PluginModuleResource, Plugin, PluginLoader, PluginImplementation, PluginType } from '../model';\n\nexport type MockPlugin = {\n [T in PluginType]: {\n kind: T;\n spec: { name: string };\n plugin: PluginImplementation<T>;\n };\n}[PluginType];\n\n/**\n * Helper for mocking `PluginRegistry` data during tests. Returns props that can be spread on the `PluginRegistry`\n * component so that it will load the mock plugins you provide.\n */\nexport function mockPluginRegistry(...mockPlugins: MockPlugin[]): Omit<PluginRegistryProps, 'children'> {\n const mockPluginResource: PluginModuleResource = {\n kind: 'PluginModule',\n metadata: {\n name: 'Fake Plugin Module for Tests',\n version: '0',\n },\n spec: {\n // Add metadata for all mock plugins\n plugins: mockPlugins.map(({ kind, spec: { name } }) => ({\n kind,\n spec: {\n name,\n display: {\n name: getMockPluginName(kind, name),\n },\n },\n })),\n },\n };\n\n const mockPluginModule: Record<string, Plugin<UnknownSpec>> = {};\n for (const mockPlugin of mockPlugins) {\n // \"Export\" on the module under the same name as the kind the plugin handles\n mockPluginModule[mockPlugin.spec.name] = mockPlugin.plugin;\n }\n\n const pluginLoader: PluginLoader = {\n getInstalledPlugins() {\n return Promise.resolve([mockPluginResource]);\n },\n importPluginModule(/* resource */) {\n return Promise.resolve(mockPluginModule);\n },\n };\n\n return {\n pluginLoader,\n defaultPluginKinds: {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n },\n };\n}\n\n/**\n * The function that's used to generate the display name of mocked plugins in mockPluginRegistry. Can be useful if you\n * need to interact with some UI component that's displaying it.\n */\nexport function getMockPluginName(kind: PluginType, name: string): string {\n return `${kind} Plugin for ${name}`;\n}\n"],"names":["mockPluginRegistry","mockPlugins","mockPluginResource","kind","metadata","name","version","spec","plugins","map","display","getMockPluginName","mockPluginModule","mockPlugin","plugin","pluginLoader","getInstalledPlugins","Promise","resolve","importPluginModule","defaultPluginKinds","TimeSeriesQuery"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAcjC;;;CAGC,GACD,OAAO,SAASA,mBAAmB,GAAGC,WAAyB;IAC7D,MAAMC,qBAA2C;QAC/CC,MAAM;QACNC,UAAU;YACRC,MAAM;YACNC,SAAS;QACX;QACAC,MAAM;YACJ,oCAAoC;YACpCC,SAASP,YAAYQ,GAAG,CAAC,CAAC,EAAEN,IAAI,EAAEI,MAAM,EAAEF,IAAI,EAAE,EAAE,GAAM,CAAA;oBACtDF;oBACAI,MAAM;wBACJF;wBACAK,SAAS;4BACPL,MAAMM,kBAAkBR,MAAME;wBAChC;oBACF;gBACF,CAAA;QACF;IACF;IAEA,MAAMO,mBAAwD,CAAC;IAC/D,KAAK,MAAMC,cAAcZ,YAAa;QACpC,4EAA4E;QAC5EW,gBAAgB,CAACC,WAAWN,IAAI,CAACF,IAAI,CAAC,GAAGQ,WAAWC,MAAM;IAC5D;IAEA,MAAMC,eAA6B;QACjCC;YACE,OAAOC,QAAQC,OAAO,CAAC;gBAAChB;aAAmB;QAC7C;QACAiB;YACE,OAAOF,QAAQC,OAAO,CAACN;QACzB;IACF;IAEA,OAAO;QACLG;QACAK,oBAAoB;YAClBC,iBAAiB;QACnB;IACF;AACF;AAEA;;;CAGC,GACD,OAAO,SAASV,kBAAkBR,IAAgB,EAAEE,IAAY;IAC9D,OAAO,GAAGF,KAAK,YAAY,EAAEE,MAAM;AACrC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/plugin-system",
3
- "version": "0.0.0-snapshot-explorer-plugin-c4a7621",
3
+ "version": "0.0.0-snapshot-histogram-types-78c5104",
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,18 +29,16 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@module-federation/enhanced": "^0.8.9",
32
- "@perses-dev/components": "0.0.0-snapshot-explorer-plugin-c4a7621",
33
- "@perses-dev/core": "0.0.0-snapshot-explorer-plugin-c4a7621",
34
- "date-fns": "^2.30.0",
35
- "immer": "^9.0.15",
32
+ "@perses-dev/components": "0.0.0-snapshot-histogram-types-78c5104",
33
+ "@perses-dev/core": "0.0.0-snapshot-histogram-types-78c5104",
34
+ "date-fns": "^4.1.0",
35
+ "date-fns-tz": "^3.2.0",
36
+ "immer": "^10.1.1",
36
37
  "react-hook-form": "^7.46.1",
37
- "use-immer": "^0.7.0",
38
+ "use-immer": "^0.11.0",
38
39
  "use-query-params": "^2.1.2",
39
40
  "zod": "^3.22.2"
40
41
  },
41
- "devDependencies": {
42
- "@perses-dev/storybook": "0.0.0-snapshot-explorer-plugin-c4a7621"
43
- },
44
42
  "peerDependencies": {
45
43
  "@mui/material": "^6.1.10",
46
44
  "@tanstack/react-query": "^5.64.2",
@@ -1,41 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "WithDataQueries", {
18
- enumerable: true,
19
- get: function() {
20
- return WithDataQueries;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _pluginsystem = require("@perses-dev/plugin-system");
25
- // Type guard because storybook types parameters as `any`
26
- function isWithDataQueriesParameter(parameter) {
27
- return !!parameter && typeof parameter === 'object' && 'props' in parameter;
28
- }
29
- const WithDataQueries = (Story, context)=>{
30
- const initParameter = context.parameters.withDataQueries;
31
- const parameter = isWithDataQueriesParameter(initParameter) ? initParameter : {
32
- props: {
33
- definitions: []
34
- }
35
- };
36
- const props = parameter?.props;
37
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DataQueriesProvider, {
38
- ...props,
39
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
40
- });
41
- };
@@ -1,34 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "WithPluginRegistry", {
18
- enumerable: true,
19
- get: function() {
20
- return WithPluginRegistry;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _pluginsystem = require("@perses-dev/plugin-system");
25
- const WithPluginRegistry = (Story)=>{
26
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PluginRegistry, {
27
- pluginLoader: (0, _pluginsystem.remotePluginLoader)(),
28
- defaultPluginKinds: {
29
- TimeSeriesQuery: 'PrometheusTimeSeriesQuery',
30
- TraceQuery: 'TempoTraceQuery'
31
- },
32
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
33
- });
34
- };
@@ -1,42 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "WithPluginSystemBuiltinVariables", {
18
- enumerable: true,
19
- get: function() {
20
- return WithPluginSystemBuiltinVariables;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _runtime = require("../../../runtime");
25
- // Type guard because storybook types parameters as `any`
26
- function isWithBuiltinVariableParameter(parameter) {
27
- return !!parameter && Array.isArray(parameter);
28
- }
29
- const WithPluginSystemBuiltinVariables = (Story, context)=>{
30
- const initParameter = context.parameters.withPluginSystemBuiltinVariables;
31
- const defaultValue = {
32
- variables: []
33
- };
34
- const parameter = isWithBuiltinVariableParameter(initParameter) ? initParameter : {
35
- props: defaultValue
36
- };
37
- const props = parameter?.props;
38
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_runtime.BuiltinVariableContext.Provider, {
39
- value: props,
40
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
41
- });
42
- };
@@ -1,101 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "WithPluginSystemDatasourceStore", {
18
- enumerable: true,
19
- get: function() {
20
- return WithPluginSystemDatasourceStore;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _pluginsystem = require("@perses-dev/plugin-system");
25
- const prometheusDemoUrl = 'https://prometheus.demo.do.prometheus.io';
26
- // Type guard because storybook types parameters as `any`
27
- function isWithDatastoreStoreParameter(parameter) {
28
- return !!parameter && typeof parameter === 'object' && 'props' in parameter;
29
- }
30
- const WithPluginSystemDatasourceStore = (Story, context)=>{
31
- const { getPlugin } = (0, _pluginsystem.usePluginRegistry)();
32
- const initParameter = context.parameters.withPluginSystemDatasourceStore;
33
- // This currently provides a very simplified default to enable use in some
34
- // basic stories. It likely will need expanding in the future.
35
- // In general, `plugin-system` would probably benefit from a provider wrapper
36
- // for `DatasourceStoreContext` that is more generic than the one available
37
- // in the `dashboard` package for non-dashboard use cases.
38
- const defaultValue = {
39
- getDatasource: (selector)=>{
40
- if (selector.kind === 'PrometheusDatasource') {
41
- return Promise.resolve({
42
- default: true,
43
- plugin: {
44
- kind: 'PrometheusDatasource',
45
- spec: {}
46
- }
47
- });
48
- }
49
- throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);
50
- },
51
- getDatasourceClient: async (selector)=>{
52
- if (selector.kind === 'PrometheusDatasource') {
53
- const plugin = await getPlugin('Datasource', 'PrometheusDatasource');
54
- const client = plugin.createClient({
55
- directUrl: prometheusDemoUrl
56
- }, {
57
- proxyUrl: prometheusDemoUrl
58
- });
59
- return client;
60
- }
61
- throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);
62
- },
63
- listDatasourceSelectItems: async (datasourcePluginName)=>{
64
- if (datasourcePluginName === 'PrometheusDatasource') {
65
- return Promise.resolve([
66
- {
67
- items: [
68
- {
69
- name: 'PrometheusDatasource',
70
- selector: {
71
- kind: 'PrometheusDatasource'
72
- }
73
- }
74
- ]
75
- }
76
- ]);
77
- }
78
- throw new Error(`WithDatasourceStore is not configured to support kind: ${datasourcePluginName}`);
79
- },
80
- getSavedDatasources: ()=>{
81
- return {};
82
- },
83
- setSavedDatasources: (datasources)=>{
84
- return datasources;
85
- },
86
- getLocalDatasources: ()=>{
87
- return {};
88
- },
89
- setLocalDatasources: (datasources)=>{
90
- return datasources;
91
- }
92
- };
93
- const parameter = isWithDatastoreStoreParameter(initParameter) ? initParameter : {
94
- props: defaultValue
95
- };
96
- const props = parameter?.props;
97
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceStoreContext.Provider, {
98
- value: props,
99
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
100
- });
101
- };
@@ -1,42 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "WithPluginSystemVariables", {
18
- enumerable: true,
19
- get: function() {
20
- return WithPluginSystemVariables;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _runtime = require("../../../runtime");
25
- // Type guard because storybook types parameters as `any`
26
- function isWithVariableParameter(parameter) {
27
- return !!parameter && typeof parameter === 'object' && 'props' in parameter;
28
- }
29
- const WithPluginSystemVariables = (Story, context)=>{
30
- const initParameter = context.parameters.withPluginSystemVariables;
31
- const defaultValue = {
32
- state: {}
33
- };
34
- const parameter = isWithVariableParameter(initParameter) ? initParameter : {
35
- props: defaultValue
36
- };
37
- const props = parameter?.props;
38
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_runtime.VariableContext.Provider, {
39
- value: props,
40
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
41
- });
42
- };
@@ -1,41 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "WithTimeRange", {
18
- enumerable: true,
19
- get: function() {
20
- return WithTimeRange;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _pluginsystem = require("@perses-dev/plugin-system");
25
- // Type guard because storybook types parameters as `any`
26
- function isWithTimeRangeParameter(parameter) {
27
- return !!parameter && typeof parameter === 'object' && 'props' in parameter;
28
- }
29
- const WithTimeRange = (Story, context)=>{
30
- const initParameter = context.parameters.withTimeRange;
31
- const parameter = isWithTimeRangeParameter(initParameter) ? initParameter : undefined;
32
- const props = parameter?.props;
33
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.TimeRangeProvider, {
34
- refreshInterval: "0s",
35
- timeRange: {
36
- pastDuration: '1h'
37
- },
38
- ...props,
39
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
40
- });
41
- };
@@ -1,35 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- _export_star(require("./WithDataQueries"), exports);
18
- _export_star(require("./WithPluginRegistry"), exports);
19
- _export_star(require("./WithPluginSystemBuiltinVariables"), exports);
20
- _export_star(require("./WithPluginSystemDatasourceStore"), exports);
21
- _export_star(require("./WithPluginSystemVariables"), exports);
22
- _export_star(require("./WithTimeRange"), exports);
23
- function _export_star(from, to) {
24
- Object.keys(from).forEach(function(k) {
25
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
26
- Object.defineProperty(to, k, {
27
- enumerable: true,
28
- get: function() {
29
- return from[k];
30
- }
31
- });
32
- }
33
- });
34
- return from;
35
- }
@@ -1,30 +0,0 @@
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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- _export_star(require("./decorators"), exports);
18
- function _export_star(from, to) {
19
- Object.keys(from).forEach(function(k) {
20
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
21
- Object.defineProperty(to, k, {
22
- enumerable: true,
23
- get: function() {
24
- return from[k];
25
- }
26
- });
27
- }
28
- });
29
- return from;
30
- }
@@ -1,13 +0,0 @@
1
- import { DataQueriesProviderProps } from '@perses-dev/plugin-system';
2
- import { StoryFn, StoryContext } from '@storybook/react';
3
- import { ReactElement } from 'react';
4
- declare module '@storybook/react' {
5
- interface Parameters {
6
- withDataQueries?: WithDataQueriesProvideParameter;
7
- }
8
- }
9
- export type WithDataQueriesProvideParameter = {
10
- props: DataQueriesProviderProps;
11
- };
12
- export declare const WithDataQueries: (Story: StoryFn, context: StoryContext<unknown>) => ReactElement;
13
- //# sourceMappingURL=WithDataQueries.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WithDataQueries.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithDataQueries.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAuB,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,eAAe,CAAC,EAAE,+BAA+B,CAAC;KACnD;CACF;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,KAAK,EAAE,wBAAwB,CAAC;CACjC,CAAC;AASF,eAAO,MAAM,eAAe,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,KAAG,YAYhF,CAAC"}
@@ -1,33 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import { DataQueriesProvider } from '@perses-dev/plugin-system';
15
- // Type guard because storybook types parameters as `any`
16
- function isWithDataQueriesParameter(parameter) {
17
- return !!parameter && typeof parameter === 'object' && 'props' in parameter;
18
- }
19
- export const WithDataQueries = (Story, context)=>{
20
- const initParameter = context.parameters.withDataQueries;
21
- const parameter = isWithDataQueriesParameter(initParameter) ? initParameter : {
22
- props: {
23
- definitions: []
24
- }
25
- };
26
- const props = parameter?.props;
27
- return /*#__PURE__*/ _jsx(DataQueriesProvider, {
28
- ...props,
29
- children: /*#__PURE__*/ _jsx(Story, {})
30
- });
31
- };
32
-
33
- //# sourceMappingURL=WithDataQueries.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithDataQueries.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 { Definition, UnknownSpec } from '@perses-dev/core';\nimport { DataQueriesProvider, DataQueriesProviderProps } from '@perses-dev/plugin-system';\nimport { StoryFn, StoryContext } from '@storybook/react';\nimport { ReactElement } from 'react';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withDataQueries?: WithDataQueriesProvideParameter;\n }\n}\n\nexport type WithDataQueriesProvideParameter = {\n props: DataQueriesProviderProps;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithDataQueriesParameter(\n parameter: unknown | WithDataQueriesProvideParameter\n): parameter is WithDataQueriesProvideParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\nexport const WithDataQueries = (Story: StoryFn, context: StoryContext<unknown>): ReactElement => {\n const initParameter = context.parameters.withDataQueries;\n const parameter = isWithDataQueriesParameter(initParameter)\n ? initParameter\n : { props: { definitions: [] as Array<Definition<UnknownSpec>> } };\n const props = parameter?.props;\n\n return (\n <DataQueriesProvider {...props}>\n <Story />\n </DataQueriesProvider>\n );\n};\n"],"names":["DataQueriesProvider","isWithDataQueriesParameter","parameter","WithDataQueries","Story","context","initParameter","parameters","withDataQueries","props","definitions"],"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,mBAAmB,QAAkC,4BAA4B;AAc1F,yDAAyD;AACzD,SAASC,2BACPC,SAAoD;IAEpD,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,OAAO,MAAMC,kBAAkB,CAACC,OAAgBC;IAC9C,MAAMC,gBAAgBD,QAAQE,UAAU,CAACC,eAAe;IACxD,MAAMN,YAAYD,2BAA2BK,iBACzCA,gBACA;QAAEG,OAAO;YAAEC,aAAa,EAAE;QAAmC;IAAE;IACnE,MAAMD,QAAQP,WAAWO;IAEzB,qBACE,KAACT;QAAqB,GAAGS,KAAK;kBAC5B,cAAA,KAACL;;AAGP,EAAE"}
@@ -1,4 +0,0 @@
1
- import { StoryFn } from '@storybook/react';
2
- import { ReactElement } from 'react';
3
- export declare const WithPluginRegistry: (Story: StoryFn) => ReactElement;
4
- //# sourceMappingURL=WithPluginRegistry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WithPluginRegistry.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginRegistry.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,eAAO,MAAM,kBAAkB,UAAW,OAAO,KAAG,YAYnD,CAAC"}
@@ -1,26 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import { PluginRegistry, remotePluginLoader } from '@perses-dev/plugin-system';
15
- export const WithPluginRegistry = (Story)=>{
16
- return /*#__PURE__*/ _jsx(PluginRegistry, {
17
- pluginLoader: remotePluginLoader(),
18
- defaultPluginKinds: {
19
- TimeSeriesQuery: 'PrometheusTimeSeriesQuery',
20
- TraceQuery: 'TempoTraceQuery'
21
- },
22
- children: /*#__PURE__*/ _jsx(Story, {})
23
- });
24
- };
25
-
26
- //# sourceMappingURL=WithPluginRegistry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/stories/shared-utils/decorators/WithPluginRegistry.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 { PluginRegistry, remotePluginLoader } from '@perses-dev/plugin-system';\nimport { StoryFn } from '@storybook/react';\n\nimport { ReactElement } from 'react';\n\nexport const WithPluginRegistry = (Story: StoryFn): ReactElement => {\n return (\n <PluginRegistry\n pluginLoader={remotePluginLoader()}\n defaultPluginKinds={{\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n TraceQuery: 'TempoTraceQuery',\n }}\n >\n <Story />\n </PluginRegistry>\n );\n};\n"],"names":["PluginRegistry","remotePluginLoader","WithPluginRegistry","Story","pluginLoader","defaultPluginKinds","TimeSeriesQuery","TraceQuery"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,cAAc,EAAEC,kBAAkB,QAAQ,4BAA4B;AAK/E,OAAO,MAAMC,qBAAqB,CAACC;IACjC,qBACE,KAACH;QACCI,cAAcH;QACdI,oBAAoB;YAClBC,iBAAiB;YACjBC,YAAY;QACd;kBAEA,cAAA,KAACJ;;AAGP,EAAE"}
@@ -1,13 +0,0 @@
1
- import { StoryFn, StoryContext } from '@storybook/react';
2
- import { ReactElement } from 'react';
3
- import { BuiltinVariableSrv } from '../../../runtime';
4
- declare module '@storybook/react' {
5
- interface Parameters {
6
- withPluginSystemBuiltinVariables?: WithPluginSystemBuiltinVariableParameter;
7
- }
8
- }
9
- export type WithPluginSystemBuiltinVariableParameter = {
10
- props: BuiltinVariableSrv;
11
- };
12
- export declare const WithPluginSystemBuiltinVariables: (Story: StoryFn, context: StoryContext<unknown>) => ReactElement;
13
- //# sourceMappingURL=WithPluginSystemBuiltinVariables.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WithPluginSystemBuiltinVariables.d.ts","sourceRoot":"","sources":["../../../../src/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAA0B,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,UAAU;QAClB,gCAAgC,CAAC,EAAE,wCAAwC,CAAC;KAC7E;CACF;AAED,MAAM,MAAM,wCAAwC,GAAG;IACrD,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AAcF,eAAO,MAAM,gCAAgC,UAAW,OAAO,WAAW,aAAa,OAAO,CAAC,KAAG,YAcjG,CAAC"}