@perses-dev/plugin-system 0.54.0-beta.5 → 0.54.0-beta.7

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 (66) hide show
  1. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +283 -0
  2. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +211 -0
  3. package/dist/cjs/components/Annotations/AnnotationEditorForm/index.js +30 -0
  4. package/dist/cjs/components/Annotations/index.js +30 -0
  5. package/dist/cjs/components/index.js +1 -0
  6. package/dist/cjs/context/ValidationProvider.js +7 -1
  7. package/dist/cjs/model/annotations.js +16 -0
  8. package/dist/cjs/model/index.js +1 -0
  9. package/dist/cjs/runtime/annotations.js +148 -0
  10. package/dist/cjs/runtime/index.js +1 -0
  11. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts +16 -0
  12. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts.map +1 -0
  13. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +270 -0
  14. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js.map +1 -0
  15. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts +8 -0
  16. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts.map +1 -0
  17. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +198 -0
  18. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js.map +1 -0
  19. package/dist/components/Annotations/AnnotationEditorForm/index.d.ts +2 -0
  20. package/dist/components/Annotations/AnnotationEditorForm/index.d.ts.map +1 -0
  21. package/dist/components/Annotations/AnnotationEditorForm/index.js +15 -0
  22. package/dist/components/Annotations/AnnotationEditorForm/index.js.map +1 -0
  23. package/dist/components/Annotations/index.d.ts +2 -0
  24. package/dist/components/Annotations/index.d.ts.map +1 -0
  25. package/dist/components/Annotations/index.js +15 -0
  26. package/dist/components/Annotations/index.js.map +1 -0
  27. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +1 -2
  28. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  29. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  30. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +1 -1
  31. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  32. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  33. package/dist/components/index.d.ts +1 -0
  34. package/dist/components/index.d.ts.map +1 -1
  35. package/dist/components/index.js +1 -0
  36. package/dist/components/index.js.map +1 -1
  37. package/dist/context/ValidationProvider.d.ts +3 -1
  38. package/dist/context/ValidationProvider.d.ts.map +1 -1
  39. package/dist/context/ValidationProvider.js +8 -2
  40. package/dist/context/ValidationProvider.js.map +1 -1
  41. package/dist/model/annotations.d.ts +28 -0
  42. package/dist/model/annotations.d.ts.map +1 -0
  43. package/dist/model/annotations.js +17 -0
  44. package/dist/model/annotations.js.map +1 -0
  45. package/dist/model/index.d.ts +1 -0
  46. package/dist/model/index.d.ts.map +1 -1
  47. package/dist/model/index.js +1 -0
  48. package/dist/model/index.js.map +1 -1
  49. package/dist/model/plugins.d.ts +2 -0
  50. package/dist/model/plugins.d.ts.map +1 -1
  51. package/dist/model/plugins.js.map +1 -1
  52. package/dist/model/trace-queries.d.ts +2 -3
  53. package/dist/model/trace-queries.d.ts.map +1 -1
  54. package/dist/model/trace-queries.js.map +1 -1
  55. package/dist/runtime/annotations.d.ts +6 -0
  56. package/dist/runtime/annotations.d.ts.map +1 -0
  57. package/dist/runtime/annotations.js +129 -0
  58. package/dist/runtime/annotations.js.map +1 -0
  59. package/dist/runtime/datasources.d.ts +6 -0
  60. package/dist/runtime/datasources.d.ts.map +1 -1
  61. package/dist/runtime/datasources.js.map +1 -1
  62. package/dist/runtime/index.d.ts +1 -0
  63. package/dist/runtime/index.d.ts.map +1 -1
  64. package/dist/runtime/index.js +1 -0
  65. package/dist/runtime/index.js.map +1 -1
  66. package/package.json +4 -4
@@ -1,14 +1,16 @@
1
1
  import { ReactElement, ReactNode } from 'react';
2
- import { PanelEditorValues, VariableDefinition, PluginSchema } from '@perses-dev/spec';
2
+ import { PanelEditorValues, VariableDefinition, PluginSchema, AnnotationSpec } from '@perses-dev/spec';
3
3
  import { z } from 'zod';
4
4
  import { DatasourceDefinition } from '@perses-dev/client';
5
5
  export interface ValidationSchemas {
6
6
  datasourceEditorSchema: z.Schema<DatasourceDefinition>;
7
7
  panelEditorSchema: z.Schema<PanelEditorValues>;
8
8
  variableEditorSchema: z.Schema<VariableDefinition>;
9
+ annotationEditorSchema: z.Schema<AnnotationSpec>;
9
10
  setDatasourceEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;
10
11
  setPanelEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;
11
12
  setVariableEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;
13
+ setAnnotationEditorSchemaPlugin?: (pluginSchema: PluginSchema) => void;
12
14
  }
13
15
  export declare const ValidationSchemasContext: import("react").Context<ValidationSchemas | undefined>;
14
16
  export declare function useValidationSchemas(): ValidationSchemas;
@@ -1 +1 @@
1
- {"version":3,"file":"ValidationProvider.d.ts","sourceRoot":"","sources":["../../src/context/ValidationProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAC;AACrF,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EAKb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAmC,oBAAoB,EAA8B,MAAM,oBAAoB,CAAC;AAEvH,MAAM,WAAW,iBAAiB;IAChC,sBAAsB,EAAE,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACvD,iBAAiB,EAAE,CAAC,C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EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACjE,6BAA6B,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACpE,+BAA+B,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;CACxE;AAED,eAAO,MAAM,wBAAwB,wDAA0D,CAAC;AAEhG,wBAAgB,oBAAoB,IAAI,iBAAiB,CAMxD;AAED,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAKD,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE,uBAAuB,GAAG,YAAY,CAwCtF"}
@@ -12,7 +12,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
  import { createContext, useContext, useState } from 'react';
15
- import { panelEditorSchema as defaultPanelEditorSchema, variableDefinitionSchema, buildPanelEditorSchema, buildVariableDefinitionSchema } from '@perses-dev/spec';
15
+ import { panelEditorSchema as defaultPanelEditorSchema, variableDefinitionSchema, buildPanelEditorSchema, buildVariableDefinitionSchema, annotationSpecSchema, buildAnnotationSpecSchema } from '@perses-dev/spec';
16
16
  import { buildDatasourceDefinitionSchema, datasourceDefinitionSchema } from '@perses-dev/client';
17
17
  export const ValidationSchemasContext = /*#__PURE__*/ createContext(undefined);
18
18
  export function useValidationSchemas() {
@@ -28,6 +28,7 @@ export function useValidationSchemas() {
28
28
  const [datasourceEditorSchema, setDatasourceEditorSchema] = useState(datasourceDefinitionSchema);
29
29
  const [panelEditorSchema, setPanelEditorSchema] = useState(defaultPanelEditorSchema); // TODO I don't get why this does not compile
30
30
  const [variableEditorSchema, setVariableEditorSchema] = useState(variableDefinitionSchema);
31
+ const [annotationEditorSchema, setAnnotationEditorSchema] = useState(annotationSpecSchema);
31
32
  function setDatasourceEditorSchemaPlugin(pluginSchema) {
32
33
  setDatasourceEditorSchema(buildDatasourceDefinitionSchema(pluginSchema));
33
34
  }
@@ -37,14 +38,19 @@ export function useValidationSchemas() {
37
38
  function setVariableEditorSchemaPlugin(pluginSchema) {
38
39
  setVariableEditorSchema(buildVariableDefinitionSchema(pluginSchema));
39
40
  }
41
+ function setAnnotationEditorSchemaPlugin(pluginSchema) {
42
+ setAnnotationEditorSchema(buildAnnotationSpecSchema(pluginSchema));
43
+ }
40
44
  return /*#__PURE__*/ _jsx(ValidationSchemasContext.Provider, {
41
45
  value: {
42
46
  datasourceEditorSchema,
43
47
  panelEditorSchema,
44
48
  variableEditorSchema,
49
+ annotationEditorSchema,
45
50
  setDatasourceEditorSchemaPlugin,
46
51
  setPanelEditorSchemaPlugin,
47
- setVariableEditorSchemaPlugin
52
+ setVariableEditorSchemaPlugin,
53
+ setAnnotationEditorSchemaPlugin
48
54
  },
49
55
  children: children
50
56
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/context/ValidationProvider.tsx"],"sourcesContent":["// Copyright 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, ReactElement, ReactNode, useContext, useState } from 'react';\nimport {\n PanelEditorValues,\n VariableDefinition,\n PluginSchema,\n panelEditorSchema as defaultPanelEditorSchema,\n variableDefinitionSchema,\n buildPanelEditorSchema,\n buildVariableDefinitionSchema,\n} from '@perses-dev/spec';\n\nimport { z } from 'zod';\nimport { buildDatasourceDefinitionSchema, DatasourceDefinition, datasourceDefinitionSchema } from '@perses-dev/client';\n\nexport interface ValidationSchemas {\n datasourceEditorSchema: z.Schema<DatasourceDefinition>;\n panelEditorSchema: z.Schema<PanelEditorValues>;\n variableEditorSchema: z.Schema<VariableDefinition>;\n setDatasourceEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setPanelEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setVariableEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n}\n\nexport const ValidationSchemasContext = createContext<ValidationSchemas | undefined>(undefined);\n\nexport function useValidationSchemas(): ValidationSchemas {\n const ctx = useContext(ValidationSchemasContext);\n if (ctx === undefined) {\n throw new Error('No ValidationSchemasContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\ninterface ValidationProviderProps {\n children: ReactNode;\n}\n\n/*\n * Provide validation schemas for forms handling plugins (datasources, variables, panels).\n */\nexport function ValidationProvider({ children }: ValidationProviderProps): ReactElement {\n const [datasourceEditorSchema, setDatasourceEditorSchema] =\n useState<z.Schema<DatasourceDefinition>>(datasourceDefinitionSchema);\n const [panelEditorSchema, setPanelEditorSchema] = useState<z.Schema<PanelEditorValues>>(defaultPanelEditorSchema); // TODO I don't get why this does not compile\n const [variableEditorSchema, setVariableEditorSchema] =\n useState<z.Schema<VariableDefinition>>(variableDefinitionSchema);\n\n function setDatasourceEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setDatasourceEditorSchema(buildDatasourceDefinitionSchema(pluginSchema));\n }\n\n function setPanelEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setPanelEditorSchema(buildPanelEditorSchema(pluginSchema));\n }\n\n function setVariableEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setVariableEditorSchema(buildVariableDefinitionSchema(pluginSchema));\n }\n\n return (\n <ValidationSchemasContext.Provider\n value={{\n datasourceEditorSchema,\n panelEditorSchema,\n variableEditorSchema,\n setDatasourceEditorSchemaPlugin,\n setPanelEditorSchemaPlugin,\n setVariableEditorSchemaPlugin,\n }}\n >\n {children}\n </ValidationSchemasContext.Provider>\n );\n}\n"],"names":["createContext","useContext","useState","panelEditorSchema","defaultPanelEditorSchema","variableDefinitionSchema","buildPanelEditorSchema","buildVariableDefinitionSchema","buildDatasourceDefinitionSchema","datasourceDefinitionSchema","ValidationSchemasContext","undefined","useValidationSchemas","ctx","Error","ValidationProvider","children","datasourceEditorSchema","setDatasourceEditorSchema","setPanelEditorSchema","variableEditorSchema","setVariableEditorSchema","setDatasourceEditorSchemaPlugin","pluginSchema","setPanelEditorSchemaPlugin","setVariableEditorSchemaPlugin","Provider","value"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,aAAa,EAA2BC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AACrF,SAIEC,qBAAqBC,wBAAwB,EAC7CC,wBAAwB,EACxBC,sBAAsB,EACtBC,6BAA6B,QACxB,mBAAmB;AAG1B,SAASC,+BAA+B,EAAwBC,0BAA0B,QAAQ,qBAAqB;AAWvH,OAAO,MAAMC,yCAA2BV,cAA6CW,WAAW;AAEhG,OAAO,SAASC;IACd,MAAMC,MAAMZ,WAAWS;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAMA;;CAEC,GACD,OAAO,SAASE,mBAAmB,EAAEC,QAAQ,EAA2B;IACtE,MAAM,CAACC,wBAAwBC,0BAA0B,GACvDhB,SAAyCO;IAC3C,MAAM,CAACN,mBAAmBgB,qBAAqB,GAAGjB,SAAsCE,2BAA2B,6CAA6C;IAChK,MAAM,CAACgB,sBAAsBC,wBAAwB,GACnDnB,SAAuCG;IAEzC,SAASiB,gCAAgCC,YAA0B;QACjEL,0BAA0BV,gCAAgCe;IAC5D;IAEA,SAASC,2BAA2BD,YAA0B;QAC5DJ,qBAAqBb,uBAAuBiB;IAC9C;IAEA,SAASE,8BAA8BF,YAA0B;QAC/DF,wBAAwBd,8BAA8BgB;IACxD;IAEA,qBACE,KAACb,yBAAyBgB,QAAQ;QAChCC,OAAO;YACLV;YACAd;YACAiB;YACAE;YACAE;YACAC;QACF;kBAECT;;AAGP"}
1
+ {"version":3,"sources":["../../src/context/ValidationProvider.tsx"],"sourcesContent":["// Copyright 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, ReactElement, ReactNode, useContext, useState } from 'react';\nimport {\n PanelEditorValues,\n VariableDefinition,\n PluginSchema,\n panelEditorSchema as defaultPanelEditorSchema,\n variableDefinitionSchema,\n buildPanelEditorSchema,\n buildVariableDefinitionSchema,\n AnnotationSpec,\n annotationSpecSchema,\n buildAnnotationSpecSchema,\n} from '@perses-dev/spec';\n\nimport { z } from 'zod';\nimport { buildDatasourceDefinitionSchema, DatasourceDefinition, datasourceDefinitionSchema } from '@perses-dev/client';\n\nexport interface ValidationSchemas {\n datasourceEditorSchema: z.Schema<DatasourceDefinition>;\n panelEditorSchema: z.Schema<PanelEditorValues>;\n variableEditorSchema: z.Schema<VariableDefinition>;\n annotationEditorSchema: z.Schema<AnnotationSpec>;\n setDatasourceEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setPanelEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setVariableEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setAnnotationEditorSchemaPlugin?: (pluginSchema: PluginSchema) => void;\n}\n\nexport const ValidationSchemasContext = createContext<ValidationSchemas | undefined>(undefined);\n\nexport function useValidationSchemas(): ValidationSchemas {\n const ctx = useContext(ValidationSchemasContext);\n if (ctx === undefined) {\n throw new Error('No ValidationSchemasContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\ninterface ValidationProviderProps {\n children: ReactNode;\n}\n\n/*\n * Provide validation schemas for forms handling plugins (datasources, variables, panels).\n */\nexport function ValidationProvider({ children }: ValidationProviderProps): ReactElement {\n const [datasourceEditorSchema, setDatasourceEditorSchema] =\n useState<z.Schema<DatasourceDefinition>>(datasourceDefinitionSchema);\n const [panelEditorSchema, setPanelEditorSchema] = useState<z.Schema<PanelEditorValues>>(defaultPanelEditorSchema); // TODO I don't get why this does not compile\n const [variableEditorSchema, setVariableEditorSchema] =\n useState<z.Schema<VariableDefinition>>(variableDefinitionSchema);\n const [annotationEditorSchema, setAnnotationEditorSchema] = useState<z.Schema<AnnotationSpec>>(annotationSpecSchema);\n\n function setDatasourceEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setDatasourceEditorSchema(buildDatasourceDefinitionSchema(pluginSchema));\n }\n\n function setPanelEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setPanelEditorSchema(buildPanelEditorSchema(pluginSchema));\n }\n\n function setVariableEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setVariableEditorSchema(buildVariableDefinitionSchema(pluginSchema));\n }\n\n function setAnnotationEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setAnnotationEditorSchema(buildAnnotationSpecSchema(pluginSchema));\n }\n\n return (\n <ValidationSchemasContext.Provider\n value={{\n datasourceEditorSchema,\n panelEditorSchema,\n variableEditorSchema,\n annotationEditorSchema,\n setDatasourceEditorSchemaPlugin,\n setPanelEditorSchemaPlugin,\n setVariableEditorSchemaPlugin,\n setAnnotationEditorSchemaPlugin,\n }}\n >\n {children}\n </ValidationSchemasContext.Provider>\n );\n}\n"],"names":["createContext","useContext","useState","panelEditorSchema","defaultPanelEditorSchema","variableDefinitionSchema","buildPanelEditorSchema","buildVariableDefinitionSchema","annotationSpecSchema","buildAnnotationSpecSchema","buildDatasourceDefinitionSchema","datasourceDefinitionSchema","ValidationSchemasContext","undefined","useValidationSchemas","ctx","Error","ValidationProvider","children","datasourceEditorSchema","setDatasourceEditorSchema","setPanelEditorSchema","variableEditorSchema","setVariableEditorSchema","annotationEditorSchema","setAnnotationEditorSchema","setDatasourceEditorSchemaPlugin","pluginSchema","setPanelEditorSchemaPlugin","setVariableEditorSchemaPlugin","setAnnotationEditorSchemaPlugin","Provider","value"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,aAAa,EAA2BC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AACrF,SAIEC,qBAAqBC,wBAAwB,EAC7CC,wBAAwB,EACxBC,sBAAsB,EACtBC,6BAA6B,EAE7BC,oBAAoB,EACpBC,yBAAyB,QACpB,mBAAmB;AAG1B,SAASC,+BAA+B,EAAwBC,0BAA0B,QAAQ,qBAAqB;AAavH,OAAO,MAAMC,yCAA2BZ,cAA6Ca,WAAW;AAEhG,OAAO,SAASC;IACd,MAAMC,MAAMd,WAAWW;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAMA;;CAEC,GACD,OAAO,SAASE,mBAAmB,EAAEC,QAAQ,EAA2B;IACtE,MAAM,CAACC,wBAAwBC,0BAA0B,GACvDlB,SAAyCS;IAC3C,MAAM,CAACR,mBAAmBkB,qBAAqB,GAAGnB,SAAsCE,2BAA2B,6CAA6C;IAChK,MAAM,CAACkB,sBAAsBC,wBAAwB,GACnDrB,SAAuCG;IACzC,MAAM,CAACmB,wBAAwBC,0BAA0B,GAAGvB,SAAmCM;IAE/F,SAASkB,gCAAgCC,YAA0B;QACjEP,0BAA0BV,gCAAgCiB;IAC5D;IAEA,SAASC,2BAA2BD,YAA0B;QAC5DN,qBAAqBf,uBAAuBqB;IAC9C;IAEA,SAASE,8BAA8BF,YAA0B;QAC/DJ,wBAAwBhB,8BAA8BoB;IACxD;IAEA,SAASG,gCAAgCH,YAA0B;QACjEF,0BAA0BhB,0BAA0BkB;IACtD;IAEA,qBACE,KAACf,yBAAyBmB,QAAQ;QAChCC,OAAO;YACLb;YACAhB;YACAmB;YACAE;YACAE;YACAE;YACAC;YACAC;QACF;kBAECZ;;AAGP"}
@@ -0,0 +1,28 @@
1
+ import { AbsoluteTimeRange, AnnotationData, UnknownSpec } from '@perses-dev/spec';
2
+ import { DatasourceStore, VariableStateMap } from '@perses-dev/plugin-system';
3
+ import { Plugin } from './plugin-base';
4
+ /**
5
+ * An object containing all the dependencies of a AnnotationQuery.
6
+ */
7
+ export type AnnotationQueryPluginDependencies = {
8
+ /**
9
+ * Returns a list of variables name this annotation query depends on.
10
+ */
11
+ variables?: string[];
12
+ };
13
+ /**
14
+ * A plugin for running annotation queries.
15
+ */
16
+ export interface AnnotationPlugin<Spec = UnknownSpec> extends Plugin<Spec> {
17
+ getAnnotationData: (spec: Spec, ctx: AnnotationContext, abortSignal?: AbortSignal) => Promise<AnnotationData[]>;
18
+ dependsOn?: (spec: Spec, ctx: AnnotationContext) => AnnotationQueryPluginDependencies;
19
+ }
20
+ /**
21
+ * Context available to AnnotationQuery plugins at runtime.
22
+ */
23
+ export interface AnnotationContext {
24
+ datasourceStore: DatasourceStore;
25
+ absoluteTimeRange: AbsoluteTimeRange;
26
+ variableState: VariableStateMap;
27
+ }
28
+ //# sourceMappingURL=annotations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/model/annotations.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACxE,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,EAAE,WAAW,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAChH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,KAAK,iCAAiC,CAAC;CACvF;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,aAAa,EAAE,gBAAgB,CAAC;CACjC"}
@@ -0,0 +1,17 @@
1
+ // Copyright 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
+ /**
14
+ * Context available to AnnotationQuery plugins at runtime.
15
+ */ export { };
16
+
17
+ //# sourceMappingURL=annotations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/annotations.ts"],"sourcesContent":["// Copyright 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 { AbsoluteTimeRange, AnnotationData, UnknownSpec } from '@perses-dev/spec';\nimport { DatasourceStore, VariableStateMap } from '@perses-dev/plugin-system';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a AnnotationQuery.\n */\nexport type AnnotationQueryPluginDependencies = {\n /**\n * Returns a list of variables name this annotation query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running annotation queries.\n */\nexport interface AnnotationPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getAnnotationData: (spec: Spec, ctx: AnnotationContext, abortSignal?: AbortSignal) => Promise<AnnotationData[]>;\n dependsOn?: (spec: Spec, ctx: AnnotationContext) => AnnotationQueryPluginDependencies;\n}\n\n/**\n * Context available to AnnotationQuery plugins at runtime.\n */\nexport interface AnnotationContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAwBjC;;CAEC,GACD,WAIC"}
@@ -1,3 +1,4 @@
1
+ export * from './annotations';
1
2
  export * from './datasource';
2
3
  export * from './legend';
3
4
  export * from './log-queries';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
@@ -10,6 +10,7 @@
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
+ export * from './annotations';
13
14
  export * from './datasource';
14
15
  export * from './legend';
15
16
  export * from './log-queries';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 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 './datasource';\nexport * from './legend';\nexport * from './log-queries';\nexport * from './log-volume-utils';\nexport * from './panels';\nexport * from './plugins';\nexport * from './plugin-base';\nexport * from './plugin-loading';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './profile-queries';\nexport * from './variables';\nexport * from './calculations';\nexport * from './alerts-queries';\nexport * from './silences-queries';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,iBAAiB;AAC/B,cAAc,mBAAmB;AACjC,cAAc,qBAAqB"}
1
+ {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 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 './annotations';\nexport * from './datasource';\nexport * from './legend';\nexport * from './log-queries';\nexport * from './log-volume-utils';\nexport * from './panels';\nexport * from './plugins';\nexport * from './plugin-base';\nexport * from './plugin-loading';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './profile-queries';\nexport * from './variables';\nexport * from './calculations';\nexport * from './alerts-queries';\nexport * from './silences-queries';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,iBAAiB;AAC/B,cAAc,mBAAmB;AACjC,cAAc,qBAAqB"}
@@ -8,6 +8,7 @@ import { ProfileQueryPlugin } from './profile-queries';
8
8
  import { VariablePlugin } from './variables';
9
9
  import { ExplorePlugin } from './explore';
10
10
  import { LogQueryPlugin } from './log-queries';
11
+ import { AnnotationPlugin } from './annotations';
11
12
  import { AlertsQueryPlugin } from './alerts-queries';
12
13
  import { SilencesQueryPlugin } from './silences-queries';
13
14
  export interface PluginModuleSpec {
@@ -62,6 +63,7 @@ export type PluginType = {
62
63
  */
63
64
  export interface SupportedPlugins {
64
65
  Variable: VariablePlugin;
66
+ Annotation: AnnotationPlugin;
65
67
  Panel: PanelPlugin;
66
68
  TimeSeriesQuery: TimeSeriesQueryPlugin;
67
69
  TraceQuery: TraceQueryPlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/model/plugins.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,qBAA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AiB,CAAC,CAAC,SAAS,UAAU,IAAI;IACpD,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,WAAW,EAAE;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAGT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/plugins.ts"],"sourcesContent":["// Copyright 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/spec';\nimport { DatasourcePlugin } from './datasource';\nimport { PanelPlugin } from './panels';\nimport { Plugin } from './plugin-base';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { TraceQueryPlugin } from './trace-queries';\nimport { ProfileQueryPlugin } from './profile-queries';\nimport { VariablePlugin } from './variables';\nimport { ExplorePlugin } from './explore';\nimport { LogQueryPlugin } from './log-queries';\nimport { AlertsQueryPlugin } from './alerts-queries';\nimport { SilencesQueryPlugin } from './silences-queries';\n\nexport interface PluginModuleSpec {\n plugins: PluginMetadata[];\n}\n\nexport interface PluginMetadataWithModule extends PluginMetadata {\n module: PluginModuleMetadata;\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n kind: PluginType;\n metadata?: {\n version?: string;\n registry?: string;\n };\n spec: {\n name: string;\n display: {\n name: string;\n description?: string;\n };\n };\n}\n\n/**\n * Metadata about a module/package that contains plugins.\n */\nexport interface PluginModuleMetadata {\n name: string;\n version: string;\n registry?: string;\n}\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: PluginModuleMetadata;\n spec: PluginModuleSpec;\n}\n\n/**\n * All supported plugin types. A plugin's implementation must extend from `Plugin<UnknownSpec>` to be considered a valid\n * `PluginType`.\n */\nexport type PluginType = {\n // Filter out implementations on SupportedPlugins that don't extend `Plugin<UnknownSpec>`\n [K in keyof SupportedPlugins]: SupportedPlugins[K] extends Plugin<UnknownSpec> ? K : never;\n}[keyof SupportedPlugins];\n\n/**\n * Map of plugin type key/string -> implementation type. Use Typescript module augmentation to extend the plugin system\n * with new plugin types.\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n TraceQuery: TraceQueryPlugin;\n ProfileQuery: ProfileQueryPlugin;\n LogQuery: LogQueryPlugin;\n AlertsQuery: AlertsQueryPlugin;\n SilencesQuery: SilencesQueryPlugin;\n Datasource: DatasourcePlugin;\n Explore: ExplorePlugin;\n}\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n\n/**\n * Default plugin kinds by plugin type.\n */\ntype PluginKinds = Partial<Record<PluginType, string>>;\nexport type DefaultPluginKinds = Required<Pick<PluginKinds, 'TimeSeriesQuery'>> & Omit<PluginKinds, 'TimeSeriesQuery'>;\n\nexport type PluginCompoundKey<T extends PluginType> = {\n kind: T;\n name: string;\n registry?: string;\n version?: string;\n};\n\nexport function getPluginModuleCompoundKey(compoundKey: {\n kind: string;\n name: string;\n registry?: string;\n version?: string;\n}): string {\n const { kind, name, registry, version } = compoundKey;\n return `${kind}:${name}:${registry ?? ''}:${version ?? ''}`;\n}\n"],"names":["getPluginModuleCompoundKey","compoundKey","kind","name","registry","version"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAuGjC,OAAO,SAASA,2BAA2BC,WAK1C;IACC,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGJ;IAC1C,OAAO,GAAGC,KAAK,CAAC,EAAEC,KAAK,CAAC,EAAEC,YAAY,GAAG,CAAC,EAAEC,WAAW,IAAI;AAC7D"}
1
+ {"version":3,"sources":["../../src/model/plugins.ts"],"sourcesContent":["// Copyright 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/spec';\nimport { DatasourcePlugin } from './datasource';\nimport { PanelPlugin } from './panels';\nimport { Plugin } from './plugin-base';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { TraceQueryPlugin } from './trace-queries';\nimport { ProfileQueryPlugin } from './profile-queries';\nimport { VariablePlugin } from './variables';\nimport { ExplorePlugin } from './explore';\nimport { LogQueryPlugin } from './log-queries';\nimport { AnnotationPlugin } from './annotations';\nimport { AlertsQueryPlugin } from './alerts-queries';\nimport { SilencesQueryPlugin } from './silences-queries';\n\nexport interface PluginModuleSpec {\n plugins: PluginMetadata[];\n}\n\nexport interface PluginMetadataWithModule extends PluginMetadata {\n module: PluginModuleMetadata;\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n kind: PluginType;\n metadata?: {\n version?: string;\n registry?: string;\n };\n spec: {\n name: string;\n display: {\n name: string;\n description?: string;\n };\n };\n}\n\n/**\n * Metadata about a module/package that contains plugins.\n */\nexport interface PluginModuleMetadata {\n name: string;\n version: string;\n registry?: string;\n}\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: PluginModuleMetadata;\n spec: PluginModuleSpec;\n}\n\n/**\n * All supported plugin types. A plugin's implementation must extend from `Plugin<UnknownSpec>` to be considered a valid\n * `PluginType`.\n */\nexport type PluginType = {\n // Filter out implementations on SupportedPlugins that don't extend `Plugin<UnknownSpec>`\n [K in keyof SupportedPlugins]: SupportedPlugins[K] extends Plugin<UnknownSpec> ? K : never;\n}[keyof SupportedPlugins];\n\n/**\n * Map of plugin type key/string -> implementation type. Use Typescript module augmentation to extend the plugin system\n * with new plugin types.\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Annotation: AnnotationPlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n TraceQuery: TraceQueryPlugin;\n ProfileQuery: ProfileQueryPlugin;\n LogQuery: LogQueryPlugin;\n AlertsQuery: AlertsQueryPlugin;\n SilencesQuery: SilencesQueryPlugin;\n Datasource: DatasourcePlugin;\n Explore: ExplorePlugin;\n}\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n\n/**\n * Default plugin kinds by plugin type.\n */\ntype PluginKinds = Partial<Record<PluginType, string>>;\nexport type DefaultPluginKinds = Required<Pick<PluginKinds, 'TimeSeriesQuery'>> & Omit<PluginKinds, 'TimeSeriesQuery'>;\n\nexport type PluginCompoundKey<T extends PluginType> = {\n kind: T;\n name: string;\n registry?: string;\n version?: string;\n};\n\nexport function getPluginModuleCompoundKey(compoundKey: {\n kind: string;\n name: string;\n registry?: string;\n version?: string;\n}): string {\n const { kind, name, registry, version } = compoundKey;\n return `${kind}:${name}:${registry ?? ''}:${version ?? ''}`;\n}\n"],"names":["getPluginModuleCompoundKey","compoundKey","kind","name","registry","version"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAyGjC,OAAO,SAASA,2BAA2BC,WAK1C;IACC,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGJ;IAC1C,OAAO,GAAGC,KAAK,CAAC,EAAEC,KAAK,CAAC,EAAEC,YAAY,GAAG,CAAC,EAAEC,WAAW,IAAI;AAC7D"}
@@ -5,7 +5,7 @@ import { Plugin } from './plugin-base';
5
5
  /**
6
6
  * An object containing all the dependencies of a TraceQuery.
7
7
  */
8
- type TraceQueryQueryPluginDependencies = {
8
+ export type TraceQueryPluginDependencies = {
9
9
  /**
10
10
  * Returns a list of variables name this trace query depends on.
11
11
  */
@@ -16,7 +16,7 @@ type TraceQueryQueryPluginDependencies = {
16
16
  */
17
17
  export interface TraceQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {
18
18
  getTraceData: (spec: Spec, ctx: TraceQueryContext, abortSignal?: AbortSignal) => Promise<TraceData>;
19
- dependsOn?: (spec: Spec, ctx: TraceQueryContext) => TraceQueryQueryPluginDependencies;
19
+ dependsOn?: (spec: Spec, ctx: TraceQueryContext) => TraceQueryPluginDependencies;
20
20
  }
21
21
  /**
22
22
  * Context available to TraceQuery plugins at runtime.
@@ -27,5 +27,4 @@ export interface TraceQueryContext {
27
27
  variableState: VariableStateMap;
28
28
  }
29
29
  export type TraceDataQuery = Query<TraceData, unknown, TraceData, QueryKey>;
30
- export {};
31
30
  //# sourceMappingURL=trace-queries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trace-queries.d.ts","sourceRoot":"","sources":["../../src/model/trace-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,KAAK,iCAAiC,GAAG;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACxE,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,EAAE,WAAW,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IACpG,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,KAAK,iCAAiC,CAAC;CACvF;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,aAAa,EAAE,gBAAgB,CAAC;CACjC;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"trace-queries.d.ts","sourceRoot":"","sources":["../../src/model/trace-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACxE,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,EAAE,WAAW,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IACpG,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,KAAK,4BAA4B,CAAC;CAClF;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,aAAa,EAAE,gBAAgB,CAAC;CACjC;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/trace-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Query, QueryKey } from '@tanstack/react-query';\nimport { UnknownSpec, TraceData, AbsoluteTimeRange } from '@perses-dev/spec';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TraceQuery.\n */\ntype TraceQueryQueryPluginDependencies = {\n /**\n * Returns a list of variables name this trace query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running trace queries.\n */\nexport interface TraceQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTraceData: (spec: Spec, ctx: TraceQueryContext, abortSignal?: AbortSignal) => Promise<TraceData>;\n dependsOn?: (spec: Spec, ctx: TraceQueryContext) => TraceQueryQueryPluginDependencies;\n}\n\n/**\n * Context available to TraceQuery plugins at runtime.\n */\nexport interface TraceQueryContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange?: AbsoluteTimeRange;\n variableState: VariableStateMap;\n}\n\nexport type TraceDataQuery = Query<TraceData, unknown, TraceData, QueryKey>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAkCjC,WAA4E"}
1
+ {"version":3,"sources":["../../src/model/trace-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Query, QueryKey } from '@tanstack/react-query';\nimport { UnknownSpec, TraceData, AbsoluteTimeRange } from '@perses-dev/spec';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TraceQuery.\n */\nexport type TraceQueryPluginDependencies = {\n /**\n * Returns a list of variables name this trace query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running trace queries.\n */\nexport interface TraceQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTraceData: (spec: Spec, ctx: TraceQueryContext, abortSignal?: AbortSignal) => Promise<TraceData>;\n dependsOn?: (spec: Spec, ctx: TraceQueryContext) => TraceQueryPluginDependencies;\n}\n\n/**\n * Context available to TraceQuery plugins at runtime.\n */\nexport interface TraceQueryContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange?: AbsoluteTimeRange;\n variableState: VariableStateMap;\n}\n\nexport type TraceDataQuery = Query<TraceData, unknown, TraceData, QueryKey>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAkCjC,WAA4E"}
@@ -0,0 +1,6 @@
1
+ import { AnnotationData, AnnotationSpec } from '@perses-dev/spec';
2
+ import { UseQueryResult } from '@tanstack/react-query';
3
+ export declare const ANNOTATION_KEY = "Annotation";
4
+ export declare function useAnnotations(definitions: AnnotationSpec[]): Array<UseQueryResult<AnnotationData[]>>;
5
+ export declare function useAnnotationData(spec: AnnotationSpec): UseQueryResult<AnnotationData[]>;
6
+ //# sourceMappingURL=annotations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/runtime/annotations.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAkC,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAQvF,eAAO,MAAM,cAAc,eAAe,CAAC;AA+C3C,wBAAgB,cAAc,CAAC,WAAW,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC,CAAC,CA8BrG;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc,CAAC,cAAc,EAAE,CAAC,CAsCxF"}
@@ -0,0 +1,129 @@
1
+ // Copyright 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 { useQueries, useQuery } from '@tanstack/react-query';
14
+ import { usePlugin, usePluginRegistry, usePlugins } from './plugin-registry';
15
+ import { useTimeRange } from './TimeRangeProvider';
16
+ import { useAllVariableValues } from './variables';
17
+ import { useDatasourceStore } from './datasources';
18
+ import { filterVariableStateMap, getVariableValuesKey } from './utils';
19
+ export const ANNOTATION_KEY = 'Annotation';
20
+ function useAnnotationContext() {
21
+ const { absoluteTimeRange } = useTimeRange();
22
+ const variableState = useAllVariableValues();
23
+ const datasourceStore = useDatasourceStore();
24
+ return {
25
+ variableState,
26
+ datasourceStore,
27
+ absoluteTimeRange
28
+ };
29
+ }
30
+ function getQueryOptions({ plugin, definition, context }) {
31
+ const { variableState, absoluteTimeRange } = context;
32
+ const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.plugin.spec, context) : {};
33
+ const variableDependencies = dependencies?.variables;
34
+ const filteredVariableState = filterVariableStateMap(variableState, variableDependencies);
35
+ const variablesValueKey = getVariableValuesKey(filteredVariableState);
36
+ const queryKey = [
37
+ ANNOTATION_KEY,
38
+ definition,
39
+ absoluteTimeRange,
40
+ variablesValueKey
41
+ ];
42
+ let waitToLoad = false;
43
+ if (variableDependencies) {
44
+ waitToLoad = variableDependencies.some((v)=>variableState[v]?.loading);
45
+ }
46
+ const queryEnabled = plugin !== undefined && !waitToLoad;
47
+ return {
48
+ queryKey,
49
+ queryEnabled
50
+ };
51
+ }
52
+ export function useAnnotations(definitions) {
53
+ const { getPlugin } = usePluginRegistry();
54
+ const context = useAnnotationContext();
55
+ const pluginLoaderResponse = usePlugins('Annotation', definitions.map((d)=>({
56
+ kind: d.plugin.kind
57
+ })));
58
+ // useQueries() handles data fetching from query plugins
59
+ return useQueries({
60
+ queries: definitions.map((definition, idx)=>{
61
+ const plugin = pluginLoaderResponse[idx]?.data;
62
+ const { queryEnabled, queryKey } = getQueryOptions({
63
+ context,
64
+ definition,
65
+ plugin
66
+ });
67
+ const annotationKind = definition?.plugin?.kind;
68
+ return {
69
+ enabled: queryEnabled,
70
+ queryKey: queryKey,
71
+ refetchOnMount: false,
72
+ refetchOnWindowFocus: false,
73
+ refetchOnReconnect: false,
74
+ staleTime: Infinity,
75
+ queryFn: async ({ signal })=>{
76
+ const plugin = await getPlugin({
77
+ kind: ANNOTATION_KEY,
78
+ name: annotationKind
79
+ });
80
+ const data = await plugin.getAnnotationData(definition.plugin.spec, context, signal);
81
+ return data;
82
+ }
83
+ };
84
+ })
85
+ });
86
+ }
87
+ export function useAnnotationData(spec) {
88
+ const { data: annotationPlugin } = usePlugin('Annotation', spec.plugin.kind);
89
+ const datasourceStore = useDatasourceStore();
90
+ const allVariables = useAllVariableValues();
91
+ const { absoluteTimeRange: timeRange } = useTimeRange();
92
+ const variablePluginCtx = {
93
+ absoluteTimeRange: timeRange,
94
+ datasourceStore,
95
+ variableState: allVariables
96
+ };
97
+ let dependsOnVariables = Object.keys(allVariables); // Default to all variables
98
+ if (annotationPlugin?.dependsOn) {
99
+ const dependencies = annotationPlugin.dependsOn(spec.plugin.spec, variablePluginCtx);
100
+ dependsOnVariables = dependencies.variables ? dependencies.variables : dependsOnVariables;
101
+ }
102
+ const variables = useAllVariableValues(dependsOnVariables);
103
+ let waitToLoad = false;
104
+ if (dependsOnVariables) {
105
+ waitToLoad = dependsOnVariables.some((v)=>variables[v]?.loading);
106
+ }
107
+ const variablesValueKey = getVariableValuesKey(variables);
108
+ return useQuery({
109
+ queryKey: [
110
+ 'annotation',
111
+ spec,
112
+ timeRange,
113
+ variablesValueKey
114
+ ],
115
+ queryFn: async ({ signal })=>{
116
+ const resp = await annotationPlugin?.getAnnotationData(spec.plugin.spec, {
117
+ ...variablePluginCtx,
118
+ variableState: variables
119
+ }, signal);
120
+ if (!resp?.length) {
121
+ return [];
122
+ }
123
+ return resp;
124
+ },
125
+ enabled: !!annotationPlugin || waitToLoad
126
+ });
127
+ }
128
+
129
+ //# sourceMappingURL=annotations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/runtime/annotations.ts"],"sourcesContent":["// Copyright 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 { AnnotationData, AnnotationSpec } from '@perses-dev/spec';\nimport { QueryKey, useQueries, useQuery, UseQueryResult } from '@tanstack/react-query';\nimport { AnnotationContext, AnnotationPlugin } from '../model';\nimport { usePlugin, usePluginRegistry, usePlugins } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useAllVariableValues } from './variables';\nimport { useDatasourceStore } from './datasources';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\n\nexport const ANNOTATION_KEY = 'Annotation';\n\nfunction useAnnotationContext(): AnnotationContext {\n const { absoluteTimeRange } = useTimeRange();\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n variableState,\n datasourceStore,\n absoluteTimeRange,\n };\n}\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: AnnotationPlugin;\n definition: AnnotationSpec;\n context: AnnotationContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { variableState, absoluteTimeRange } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n const filteredVariableState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariableState);\n const queryKey = [ANNOTATION_KEY, definition, 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\nexport function useAnnotations(definitions: AnnotationSpec[]): Array<UseQueryResult<AnnotationData[]>> {\n const { getPlugin } = usePluginRegistry();\n const context = useAnnotationContext();\n\n const pluginLoaderResponse = usePlugins(\n 'Annotation',\n definitions.map((d) => ({ kind: d.plugin.kind }))\n );\n\n // useQueries() handles data fetching from query plugins\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 annotationKind = definition?.plugin?.kind;\n return {\n enabled: queryEnabled,\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<AnnotationData[]> => {\n const plugin = await getPlugin({ kind: ANNOTATION_KEY, name: annotationKind });\n const data = await plugin.getAnnotationData(definition.plugin.spec, context, signal);\n return data;\n },\n };\n }),\n });\n}\n\nexport function useAnnotationData(spec: AnnotationSpec): UseQueryResult<AnnotationData[]> {\n const { data: annotationPlugin } = usePlugin('Annotation', spec.plugin.kind);\n\n const datasourceStore = useDatasourceStore();\n const allVariables = useAllVariableValues();\n const { absoluteTimeRange: timeRange } = useTimeRange();\n const variablePluginCtx = { absoluteTimeRange: timeRange, datasourceStore, variableState: allVariables };\n\n let dependsOnVariables: string[] = Object.keys(allVariables); // Default to all variables\n if (annotationPlugin?.dependsOn) {\n const dependencies = annotationPlugin.dependsOn(spec.plugin.spec, variablePluginCtx);\n dependsOnVariables = dependencies.variables ? dependencies.variables : dependsOnVariables;\n }\n\n const variables = useAllVariableValues(dependsOnVariables);\n\n let waitToLoad = false;\n if (dependsOnVariables) {\n waitToLoad = dependsOnVariables.some((v) => variables[v]?.loading);\n }\n\n const variablesValueKey = getVariableValuesKey(variables);\n\n return useQuery({\n queryKey: ['annotation', spec, timeRange, variablesValueKey],\n queryFn: async ({ signal }) => {\n const resp = await annotationPlugin?.getAnnotationData(\n spec.plugin.spec,\n { ...variablePluginCtx, variableState: variables },\n signal\n );\n if (!resp?.length) {\n return [];\n }\n return resp;\n },\n enabled: !!annotationPlugin || waitToLoad,\n });\n}\n"],"names":["useQueries","useQuery","usePlugin","usePluginRegistry","usePlugins","useTimeRange","useAllVariableValues","useDatasourceStore","filterVariableStateMap","getVariableValuesKey","ANNOTATION_KEY","useAnnotationContext","absoluteTimeRange","variableState","datasourceStore","getQueryOptions","plugin","definition","context","dependencies","dependsOn","spec","variableDependencies","variables","filteredVariableState","variablesValueKey","queryKey","waitToLoad","some","v","loading","queryEnabled","undefined","useAnnotations","definitions","getPlugin","pluginLoaderResponse","map","d","kind","queries","idx","data","annotationKind","enabled","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","queryFn","signal","name","getAnnotationData","useAnnotationData","annotationPlugin","allVariables","timeRange","variablePluginCtx","dependsOnVariables","Object","keys","resp","length"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAAmBA,UAAU,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BAAoB;QACtBhC,aAAagC,mBAAmB/B,IAAI,CAAC,CAACC,IAAMN,SAAS,CAACM,EAAE,EAAEC;IAC5D;IAEA,MAAML,oBAAoBhB,qBAAqBc;IAE/C,OAAOtB,SAAS;QACdyB,UAAU;YAAC;YAAcL;YAAMoC;YAAWhC;SAAkB;QAC5DyB,SAAS,OAAO,EAAEC,MAAM,EAAE;YACxB,MAAMW,OAAO,MAAMP,kBAAkBF,kBACnChC,KAAKL,MAAM,CAACK,IAAI,EAChB;gBAAE,GAAGqC,iBAAiB;gBAAE7C,eAAeU;YAAU,GACjD4B;YAEF,IAAI,CAACW,MAAMC,QAAQ;gBACjB,OAAO,EAAE;YACX;YACA,OAAOD;QACT;QACAlB,SAAS,CAAC,CAACW,oBAAoB5B;IACjC;AACF"}
@@ -3,6 +3,12 @@ import { DatasourceSelector, DatasourceSpec } from '@perses-dev/spec';
3
3
  import { UseQueryResult } from '@tanstack/react-query';
4
4
  export interface DatasourceStore {
5
5
  getDatasource(selector: DatasourceSelector): Promise<DatasourceSpec>;
6
+ /**
7
+ * Gets a cached datasource spec synchronously if available.
8
+ * Used by variable dependency resolution to avoid async calls in dependsOn().
9
+ * Returns undefined if the spec is not cached.
10
+ */
11
+ getDatasourceSpecSync?(selector: DatasourceSelector): DatasourceSpec | undefined;
6
12
  /**
7
13
  * Given a DatasourceSelector, gets a `Client` object from the corresponding Datasource plugin.
8
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"datasources.d.ts","sourceRoot":"","sources":["../../src/runtime/datasources.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGjE,MAAM,WAAW,eAAe;IAE9B,aAAa,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAErE;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE,QAAQ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AC/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,IAAI,eAAe,CAMpD;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,oBAAoB,EAAE,MAAM,EAC5B,OAAO,CAAC,EAAE,MAAM,GACf,cAAc,CAAC,yBAAyB,EAAE,CAAC,CAM7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,cAAc,CAAC,MAAM,CAAC,CAMhG;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,kBAAkB,GAAG,cAAc,CAAC,cAAc,CAAC,CAM1F"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/datasources.ts"],"sourcesContent":["// Copyright 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/spec';\nimport { useQuery, UseQueryResult } 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(datasourcePluginName: 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(): DatasourceStore {\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(\n datasourcePluginName: string,\n project?: string\n): UseQueryResult<DatasourceSelectItemGroup[]> {\n const { listDatasourceSelectItems } = useDatasourceStore();\n return useQuery<DatasourceSelectItemGroup[]>({\n queryKey: ['listDatasourceSelectItems', datasourcePluginName, project],\n queryFn: () => listDatasourceSelectItems(datasourcePluginName),\n });\n}\n\n/**\n * Provides a convenience hook for getting a DatasourceClient for a given DatasourceSelector.\n */\nexport function useDatasourceClient<Client>(selector: DatasourceSelector): UseQueryResult<Client> {\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): UseQueryResult<DatasourceSpec> {\n const store = useDatasourceStore();\n return useQuery<DatasourceSpec>({\n queryKey: ['getDatasource', selector],\n queryFn: () => store.getDatasource(selector),\n });\n}\n"],"names":["useQuery","createContext","useContext","DatasourceStoreContext","undefined","useDatasourceStore","ctx","Error","useListDatasourceSelectItems","datasourcePluginName","project","listDatasourceSelectItems","queryKey","queryFn","useDatasourceClient","selector","store","getDatasourceClient","useDatasource","getDatasource"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,QAAQ,QAAwB,wBAAwB;AACjE,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,6BACdC,oBAA4B,EAC5BC,OAAgB;IAEhB,MAAM,EAAEC,yBAAyB,EAAE,GAAGN;IACtC,OAAOL,SAAsC;QAC3CY,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,SAAyB;QAC9BY,UAAU;YAAC;YAAiBG;SAAS;QACrCF,SAAS,IAAMG,MAAMG,aAAa,CAACJ;IACrC;AACF"}
1
+ {"version":3,"sources":["../../src/runtime/datasources.ts"],"sourcesContent":["// Copyright 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/spec';\nimport { useQuery, UseQueryResult } 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 * Gets a cached datasource spec synchronously if available.\n * Used by variable dependency resolution to avoid async calls in dependsOn().\n * Returns undefined if the spec is not cached.\n */\n getDatasourceSpecSync?(selector: DatasourceSelector): DatasourceSpec | undefined;\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(datasourcePluginName: 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(): DatasourceStore {\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(\n datasourcePluginName: string,\n project?: string\n): UseQueryResult<DatasourceSelectItemGroup[]> {\n const { listDatasourceSelectItems } = useDatasourceStore();\n return useQuery<DatasourceSelectItemGroup[]>({\n queryKey: ['listDatasourceSelectItems', datasourcePluginName, project],\n queryFn: () => listDatasourceSelectItems(datasourcePluginName),\n });\n}\n\n/**\n * Provides a convenience hook for getting a DatasourceClient for a given DatasourceSelector.\n */\nexport function useDatasourceClient<Client>(selector: DatasourceSelector): UseQueryResult<Client> {\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): UseQueryResult<DatasourceSpec> {\n const store = useDatasourceStore();\n return useQuery<DatasourceSpec>({\n queryKey: ['getDatasource', selector],\n queryFn: () => store.getDatasource(selector),\n });\n}\n"],"names":["useQuery","createContext","useContext","DatasourceStoreContext","undefined","useDatasourceStore","ctx","Error","useListDatasourceSelectItems","datasourcePluginName","project","listDatasourceSelectItems","queryKey","queryFn","useDatasourceClient","selector","store","getDatasourceClient","useDatasource","getDatasource"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,QAAQ,QAAwB,wBAAwB;AACjE,SAASC,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAqElD,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,6BACdC,oBAA4B,EAC5BC,OAAgB;IAEhB,MAAM,EAAEC,yBAAyB,EAAE,GAAGN;IACtC,OAAOL,SAAsC;QAC3CY,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,SAAyB;QAC9BY,UAAU;YAAC;YAAiBG;SAAS;QACrCF,SAAS,IAAMG,MAAMG,aAAa,CAACJ;IACrC;AACF"}
@@ -1,3 +1,4 @@
1
+ export * from './annotations';
1
2
  export * from './builtin-variables';
2
3
  export * from './datasources';
3
4
  export * from './plugin-registry';
@@ -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,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,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,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC"}
@@ -10,6 +10,7 @@
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
+ export * from './annotations';
13
14
  export * from './builtin-variables';
14
15
  export * from './datasources';
15
16
  export * from './plugin-registry';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/index.ts"],"sourcesContent":["// Copyright 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 './profile-queries';\nexport * from './alerts-queries';\nexport * from './silences-queries';\nexport * from './item-actions';\nexport * from './DataQueriesProvider';\nexport * from './QueryCountProvider';\nexport * from './RouterProvider';\nexport * from './UsageMetricsProvider';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,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,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB;AACtC,cAAc,uBAAuB;AACrC,cAAc,mBAAmB;AACjC,cAAc,yBAAyB"}
1
+ {"version":3,"sources":["../../src/runtime/index.ts"],"sourcesContent":["// Copyright 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 './annotations';\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 './profile-queries';\nexport * from './alerts-queries';\nexport * from './silences-queries';\nexport * from './item-actions';\nexport * from './DataQueriesProvider';\nexport * from './QueryCountProvider';\nexport * from './RouterProvider';\nexport * from './UsageMetricsProvider';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,sBAAsB;AACpC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB;AACtC,cAAc,uBAAuB;AACrC,cAAc,mBAAmB;AACjC,cAAc,yBAAyB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/plugin-system",
3
- "version": "0.54.0-beta.5",
3
+ "version": "0.54.0-beta.7",
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,10 +29,10 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@module-federation/enhanced": "^2.3.3",
32
- "@perses-dev/components": "0.54.0-beta.5",
32
+ "@perses-dev/components": "0.54.0-beta.7",
33
33
  "@perses-dev/core": "0.53.0",
34
- "@perses-dev/spec": "0.2.0-beta.2",
35
- "@perses-dev/client": "0.54.0-beta.5",
34
+ "@perses-dev/spec": "0.2.0-beta.3",
35
+ "@perses-dev/client": "0.54.0-beta.7",
36
36
  "date-fns": "^4.1.0",
37
37
  "date-fns-tz": "^3.2.0",
38
38
  "immer": "^10.1.1",