@perses-dev/plugin-system 0.8.0 → 0.9.0

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 (149) hide show
  1. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +43 -29
  2. package/dist/cjs/components/PluginRegistry/PluginRegistry.test.js +114 -38
  3. package/dist/cjs/components/PluginRegistry/index.js +17 -18
  4. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +23 -20
  5. package/dist/cjs/components/PluginRegistry/plugin-registry-model.js +17 -7
  6. package/dist/cjs/components/PluginRegistry/test-plugins/bert/index.js +22 -12
  7. package/dist/cjs/components/PluginRegistry/test-plugins/ernie/index.js +20 -8
  8. package/dist/cjs/components/PluginRegistry/test-plugins/index.js +59 -39
  9. package/dist/cjs/components/index.js +17 -20
  10. package/dist/cjs/index.js +19 -20
  11. package/dist/cjs/model/datasource.js +16 -0
  12. package/dist/cjs/model/index.js +21 -21
  13. package/dist/cjs/model/panels.js +4 -21
  14. package/dist/cjs/model/plugins.js +4 -7
  15. package/dist/cjs/model/time-series-queries.js +16 -0
  16. package/dist/cjs/model/variables.js +5 -17
  17. package/dist/cjs/model/visual-editing.js +10 -2
  18. package/dist/cjs/runtime/datasources.js +20 -13
  19. package/dist/cjs/runtime/index.js +22 -21
  20. package/dist/cjs/runtime/plugins.js +25 -22
  21. package/dist/cjs/runtime/query-string.js +17 -10
  22. package/dist/cjs/runtime/template-variables.js +34 -16
  23. package/dist/cjs/runtime/time-range.js +17 -10
  24. package/dist/cjs/runtime/time-series-queries.js +58 -0
  25. package/dist/cjs/test/render.js +32 -13
  26. package/dist/cjs/test/setup-tests.js +4 -10
  27. package/dist/cjs/utils/cache-keys.js +8 -7
  28. package/dist/components/PluginRegistry/PluginRegistry.js +81 -1
  29. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -0
  30. package/dist/components/PluginRegistry/PluginRegistry.test.js +142 -1
  31. package/dist/components/PluginRegistry/PluginRegistry.test.js.map +1 -0
  32. package/dist/components/PluginRegistry/index.js +16 -1
  33. package/dist/components/PluginRegistry/index.js.map +1 -0
  34. package/dist/components/PluginRegistry/plugin-indexes.js +66 -1
  35. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -0
  36. package/dist/components/PluginRegistry/plugin-registry-model.d.ts +1 -2
  37. package/dist/components/PluginRegistry/plugin-registry-model.d.ts.map +1 -1
  38. package/dist/components/PluginRegistry/plugin-registry-model.js +23 -1
  39. package/dist/components/PluginRegistry/plugin-registry-model.js.map +1 -0
  40. package/dist/components/PluginRegistry/test-plugins/bert/index.js +25 -1
  41. package/dist/components/PluginRegistry/test-plugins/bert/index.js.map +1 -0
  42. package/dist/components/PluginRegistry/test-plugins/ernie/index.d.ts.map +1 -1
  43. package/dist/components/PluginRegistry/test-plugins/ernie/index.js +30 -1
  44. package/dist/components/PluginRegistry/test-plugins/ernie/index.js.map +1 -0
  45. package/dist/components/PluginRegistry/test-plugins/index.js +35 -1
  46. package/dist/components/PluginRegistry/test-plugins/index.js.map +1 -0
  47. package/dist/components/index.d.ts +1 -3
  48. package/dist/components/index.d.ts.map +1 -1
  49. package/dist/components/index.js +15 -1
  50. package/dist/components/index.js.map +1 -0
  51. package/dist/index.js +17 -1
  52. package/dist/index.js.map +1 -0
  53. package/dist/model/datasource.d.ts +9 -0
  54. package/dist/model/datasource.d.ts.map +1 -0
  55. package/dist/model/datasource.js +15 -0
  56. package/dist/model/datasource.js.map +1 -0
  57. package/dist/model/index.d.ts +2 -1
  58. package/dist/model/index.d.ts.map +1 -1
  59. package/dist/model/index.js +20 -1
  60. package/dist/model/index.js.map +1 -0
  61. package/dist/model/panels.d.ts +7 -11
  62. package/dist/model/panels.d.ts.map +1 -1
  63. package/dist/model/panels.js +15 -1
  64. package/dist/model/panels.js.map +1 -0
  65. package/dist/model/plugins.d.ts +16 -25
  66. package/dist/model/plugins.d.ts.map +1 -1
  67. package/dist/model/plugins.js +15 -1
  68. package/dist/model/plugins.js.map +1 -0
  69. package/dist/model/time-series-queries.d.ts +28 -0
  70. package/dist/model/time-series-queries.d.ts.map +1 -0
  71. package/dist/model/time-series-queries.js +15 -0
  72. package/dist/model/time-series-queries.js.map +1 -0
  73. package/dist/model/variables.d.ts +16 -11
  74. package/dist/model/variables.d.ts.map +1 -1
  75. package/dist/model/variables.js +15 -1
  76. package/dist/model/variables.js.map +1 -0
  77. package/dist/model/visual-editing.d.ts +5 -6
  78. package/dist/model/visual-editing.d.ts.map +1 -1
  79. package/dist/model/visual-editing.js +15 -1
  80. package/dist/model/visual-editing.js.map +1 -0
  81. package/dist/runtime/datasources.d.ts +5 -9
  82. package/dist/runtime/datasources.d.ts.map +1 -1
  83. package/dist/runtime/datasources.js +23 -1
  84. package/dist/runtime/datasources.js.map +1 -0
  85. package/dist/runtime/index.d.ts +3 -1
  86. package/dist/runtime/index.d.ts.map +1 -1
  87. package/dist/runtime/index.js +20 -1
  88. package/dist/runtime/index.js.map +1 -0
  89. package/dist/runtime/plugins.d.ts +5 -14
  90. package/dist/runtime/plugins.d.ts.map +1 -1
  91. package/dist/runtime/plugins.js +33 -1
  92. package/dist/runtime/plugins.js.map +1 -0
  93. package/dist/runtime/query-string.js +25 -1
  94. package/dist/runtime/query-string.js.map +1 -0
  95. package/dist/runtime/template-variables.d.ts +10 -1
  96. package/dist/runtime/template-variables.d.ts.map +1 -1
  97. package/dist/runtime/template-variables.js +44 -1
  98. package/dist/runtime/template-variables.js.map +1 -0
  99. package/dist/runtime/time-range.js +25 -1
  100. package/dist/runtime/time-range.js.map +1 -0
  101. package/dist/runtime/time-series-queries.d.ts +14 -0
  102. package/dist/runtime/time-series-queries.d.ts.map +1 -0
  103. package/dist/runtime/time-series-queries.js +54 -0
  104. package/dist/runtime/time-series-queries.js.map +1 -0
  105. package/dist/test/render.d.ts.map +1 -1
  106. package/dist/test/render.js +42 -1
  107. package/dist/test/render.js.map +1 -0
  108. package/dist/test/setup-tests.d.ts.map +1 -1
  109. package/dist/test/setup-tests.js +16 -1
  110. package/dist/test/setup-tests.js.map +1 -0
  111. package/dist/utils/cache-keys.js +19 -1
  112. package/dist/utils/cache-keys.js.map +1 -0
  113. package/package.json +11 -8
  114. package/dist/cjs/components/PluginBoundary.js +0 -14
  115. package/dist/cjs/components/PluginLoadingBoundary/PluginLoader.js +0 -39
  116. package/dist/cjs/components/PluginLoadingBoundary/PluginLoadingBoundary.js +0 -85
  117. package/dist/cjs/components/PluginLoadingBoundary/index.js +0 -29
  118. package/dist/cjs/components/PluginRegistry/legacy/PluginRegistry.js +0 -57
  119. package/dist/cjs/components/PluginRegistry/legacy/index.js +0 -29
  120. package/dist/cjs/components/PluginRegistry/legacy/registry-state.js +0 -97
  121. package/dist/cjs/components/PluginRegistry/test-plugins/bert/plugin.json +0 -32
  122. package/dist/cjs/components/PluginRegistry/test-plugins/ernie/plugin.json +0 -24
  123. package/dist/cjs/model/graph-queries.js +0 -28
  124. package/dist/components/PluginBoundary.d.ts +0 -13
  125. package/dist/components/PluginBoundary.d.ts.map +0 -1
  126. package/dist/components/PluginBoundary.js +0 -1
  127. package/dist/components/PluginLoadingBoundary/PluginLoader.d.ts +0 -11
  128. package/dist/components/PluginLoadingBoundary/PluginLoader.d.ts.map +0 -1
  129. package/dist/components/PluginLoadingBoundary/PluginLoader.js +0 -1
  130. package/dist/components/PluginLoadingBoundary/PluginLoadingBoundary.d.ts +0 -27
  131. package/dist/components/PluginLoadingBoundary/PluginLoadingBoundary.d.ts.map +0 -1
  132. package/dist/components/PluginLoadingBoundary/PluginLoadingBoundary.js +0 -1
  133. package/dist/components/PluginLoadingBoundary/index.d.ts +0 -2
  134. package/dist/components/PluginLoadingBoundary/index.d.ts.map +0 -1
  135. package/dist/components/PluginLoadingBoundary/index.js +0 -1
  136. package/dist/components/PluginRegistry/legacy/PluginRegistry.d.ts +0 -29
  137. package/dist/components/PluginRegistry/legacy/PluginRegistry.d.ts.map +0 -1
  138. package/dist/components/PluginRegistry/legacy/PluginRegistry.js +0 -1
  139. package/dist/components/PluginRegistry/legacy/index.d.ts +0 -2
  140. package/dist/components/PluginRegistry/legacy/index.d.ts.map +0 -1
  141. package/dist/components/PluginRegistry/legacy/index.js +0 -1
  142. package/dist/components/PluginRegistry/legacy/registry-state.d.ts +0 -18
  143. package/dist/components/PluginRegistry/legacy/registry-state.d.ts.map +0 -1
  144. package/dist/components/PluginRegistry/legacy/registry-state.js +0 -1
  145. package/dist/components/PluginRegistry/test-plugins/bert/plugin.json +0 -32
  146. package/dist/components/PluginRegistry/test-plugins/ernie/plugin.json +0 -24
  147. package/dist/model/graph-queries.d.ts +0 -36
  148. package/dist/model/graph-queries.d.ts.map +0 -1
  149. package/dist/model/graph-queries.js +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/PluginRegistry/plugin-indexes.ts"],"sourcesContent":["// Copyright 2022 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 { useEvent } from '@perses-dev/core';\nimport { useCallback, useRef } from 'react';\nimport { PluginMetadata, PluginModuleResource } from '../../model';\nimport { getTypeAndKindKey } from '../../utils/cache-keys';\n\nexport type GetInstalledPlugins = () => Promise<PluginModuleResource[]>;\n\nexport interface PluginIndexes {\n // Plugin resources by plugin type and kind (i.e. look up what module a plugin type and kind is in)\n pluginResourcesByTypeAndKind: Map<string, PluginModuleResource>;\n // Plugin metadata by plugin type\n pluginMetadataByType: Map<string, PluginMetadata[]>;\n}\n\n/**\n * Returns an async callback for getting indexes of the installed plugin data.\n */\nexport function usePluginIndexes(getInstalledPlugins: GetInstalledPlugins) {\n // Creates indexes from the installed plugins data (does useEvent because this accesses the getInstalledPlugins prop\n // and we want a stable reference for the callback below)\n const createPluginIndexes = useEvent(async (): Promise<PluginIndexes> => {\n const installedPlugins = await getInstalledPlugins();\n\n // Create the two indexes from the installed plugins\n const pluginResourcesByTypeAndKind = new Map<string, PluginModuleResource>();\n const pluginMetadataByType = new Map<string, PluginMetadata[]>();\n\n for (const resource of installedPlugins) {\n for (const pluginMetadata of resource.spec.plugins) {\n const { pluginType, kind } = pluginMetadata;\n\n // Index the plugin by type and kind to point at the module that contains it\n const key = getTypeAndKindKey(pluginType, kind);\n if (pluginResourcesByTypeAndKind.has(key)) {\n console.warn(`Got more than one ${pluginType} plugin for kind ${kind}`);\n }\n pluginResourcesByTypeAndKind.set(key, resource);\n\n // Index the metadata by plugin type\n let list = pluginMetadataByType.get(pluginType);\n if (list === undefined) {\n list = [];\n pluginMetadataByType.set(pluginType, list);\n }\n list.push(pluginMetadata);\n }\n }\n\n return {\n pluginResourcesByTypeAndKind,\n pluginMetadataByType,\n };\n });\n\n // De-dupe creating plugin indexes (i.e. requests to get installed plugins)\n const pluginIndexesCache = useRef<Promise<PluginIndexes> | undefined>(undefined);\n const getPluginIndexes = useCallback(() => {\n let request = pluginIndexesCache.current;\n if (request === undefined) {\n request = createPluginIndexes();\n pluginIndexesCache.current = request;\n\n // Remove failed requests from the cache so they can potentially be retried\n request.catch(() => pluginIndexesCache.current === undefined);\n }\n return request;\n }, [createPluginIndexes]);\n\n return getPluginIndexes;\n}\n"],"names":["useEvent","useCallback","useRef","getTypeAndKindKey","usePluginIndexes","getInstalledPlugins","createPluginIndexes","installedPlugins","pluginResourcesByTypeAndKind","Map","pluginMetadataByType","resource","pluginMetadata","spec","plugins","pluginType","kind","key","has","console","warn","set","list","get","undefined","push","pluginIndexesCache","getPluginIndexes","request","current","catch"],"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,QAAQ,QAAQ,kBAAkB,CAAC;AAC5C,SAASC,WAAW,EAAEC,MAAM,QAAQ,OAAO,CAAC;AAE5C,SAASC,iBAAiB,QAAQ,wBAAwB,CAAC;AAW3D;;CAEC,GACD,OAAO,SAASC,gBAAgB,CAACC,mBAAwC,EAAE;IACzE,oHAAoH;IACpH,yDAAyD;IACzD,MAAMC,mBAAmB,GAAGN,QAAQ,CAAC,UAAoC;QACvE,MAAMO,gBAAgB,GAAG,MAAMF,mBAAmB,EAAE,AAAC;QAErD,oDAAoD;QACpD,MAAMG,4BAA4B,GAAG,IAAIC,GAAG,EAAgC,AAAC;QAC7E,MAAMC,oBAAoB,GAAG,IAAID,GAAG,EAA4B,AAAC;QAEjE,KAAK,MAAME,QAAQ,IAAIJ,gBAAgB,CAAE;YACvC,KAAK,MAAMK,cAAc,IAAID,QAAQ,CAACE,IAAI,CAACC,OAAO,CAAE;gBAClD,MAAM,EAAEC,UAAU,CAAA,EAAEC,IAAI,CAAA,EAAE,GAAGJ,cAAc,AAAC;gBAE5C,4EAA4E;gBAC5E,MAAMK,GAAG,GAAGd,iBAAiB,CAACY,UAAU,EAAEC,IAAI,CAAC,AAAC;gBAChD,IAAIR,4BAA4B,CAACU,GAAG,CAACD,GAAG,CAAC,EAAE;oBACzCE,OAAO,CAACC,IAAI,CAAC,CAAC,kBAAkB,EAAEL,UAAU,CAAC,iBAAiB,EAAEC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC1E,CAAC;gBACDR,4BAA4B,CAACa,GAAG,CAACJ,GAAG,EAAEN,QAAQ,CAAC,CAAC;gBAEhD,oCAAoC;gBACpC,IAAIW,IAAI,GAAGZ,oBAAoB,CAACa,GAAG,CAACR,UAAU,CAAC,AAAC;gBAChD,IAAIO,IAAI,KAAKE,SAAS,EAAE;oBACtBF,IAAI,GAAG,EAAE,CAAC;oBACVZ,oBAAoB,CAACW,GAAG,CAACN,UAAU,EAAEO,IAAI,CAAC,CAAC;gBAC7C,CAAC;gBACDA,IAAI,CAACG,IAAI,CAACb,cAAc,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QAED,OAAO;YACLJ,4BAA4B;YAC5BE,oBAAoB;SACrB,CAAC;IACJ,CAAC,CAAC,AAAC;IAEH,2EAA2E;IAC3E,MAAMgB,kBAAkB,GAAGxB,MAAM,CAAqCsB,SAAS,CAAC,AAAC;IACjF,MAAMG,gBAAgB,GAAG1B,WAAW,CAAC,IAAM;QACzC,IAAI2B,OAAO,GAAGF,kBAAkB,CAACG,OAAO,AAAC;QACzC,IAAID,OAAO,KAAKJ,SAAS,EAAE;YACzBI,OAAO,GAAGtB,mBAAmB,EAAE,CAAC;YAChCoB,kBAAkB,CAACG,OAAO,GAAGD,OAAO,CAAC;YAErC,2EAA2E;YAC3EA,OAAO,CAACE,KAAK,CAAC,IAAMJ,kBAAkB,CAACG,OAAO,KAAKL,SAAS,CAAC,CAAC;QAChE,CAAC;QACD,OAAOI,OAAO,CAAC;IACjB,CAAC,EAAE;QAACtB,mBAAmB;KAAC,CAAC,AAAC;IAE1B,OAAOqB,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -1,8 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { JsonObject } from '@perses-dev/core';
3
2
  import { PluginImplementation, PluginMetadata, PluginType } from '../../model';
4
3
  export interface PluginRegistryContextType {
5
- getPlugin<T extends PluginType>(pluginType: T, kind: string): Promise<PluginImplementation<T, JsonObject>>;
4
+ getPlugin<T extends PluginType>(pluginType: T, kind: string): Promise<PluginImplementation<T>>;
6
5
  listPluginMetadata(pluginType: PluginType): Promise<PluginMetadata[]>;
7
6
  }
8
7
  export declare const PluginRegistryContext: import("react").Context<PluginRegistryContextType | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-registry-model.d.ts","sourceRoot":"","sources":["../../../src/components/PluginRegistry/plugin-registry-model.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/E,MAAM,WAAW,yBAAyB;IACxC,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;IAC3G,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,qBAAqB,gEAAkE,CAAC;AAErG,wBAAgB,iBAAiB,8BAMhC"}
1
+ {"version":3,"file":"plugin-registry-model.d.ts","sourceRoot":"","sources":["../../../src/components/PluginRegistry/plugin-registry-model.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/E,MAAM,WAAW,yBAAyB;IACxC,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/F,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,qBAAqB,gEAAkE,CAAC;AAErG,wBAAgB,iBAAiB,8BAMhC"}
@@ -1 +1,23 @@
1
- import{createContext,useContext}from"react";export const PluginRegistryContext=createContext(void 0);export function usePluginRegistry(){const t=useContext(PluginRegistryContext);if(void 0===t)throw new Error("PluginRegistryContext not found. Did you forget a provider?");return t}
1
+ // Copyright 2022 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 { createContext, useContext } from 'react';
14
+ export const PluginRegistryContext = createContext(undefined);
15
+ export function usePluginRegistry() {
16
+ const ctx = useContext(PluginRegistryContext);
17
+ if (ctx === undefined) {
18
+ throw new Error('PluginRegistryContext not found. Did you forget a provider?');
19
+ }
20
+ return ctx;
21
+ }
22
+
23
+ //# sourceMappingURL=plugin-registry-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/PluginRegistry/plugin-registry-model.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createContext, useContext } from 'react';\nimport { PluginImplementation, PluginMetadata, PluginType } from '../../model';\n\nexport interface PluginRegistryContextType {\n getPlugin<T extends PluginType>(pluginType: T, kind: string): Promise<PluginImplementation<T>>;\n listPluginMetadata(pluginType: PluginType): Promise<PluginMetadata[]>;\n}\n\nexport const PluginRegistryContext = createContext<PluginRegistryContextType | undefined>(undefined);\n\nexport function usePluginRegistry() {\n const ctx = useContext(PluginRegistryContext);\n if (ctx === undefined) {\n throw new Error('PluginRegistryContext not found. Did you forget a provider?');\n }\n return ctx;\n}\n"],"names":["createContext","useContext","PluginRegistryContext","undefined","usePluginRegistry","ctx","Error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO,CAAC;AAQlD,OAAO,MAAMC,qBAAqB,GAAGF,aAAa,CAAwCG,SAAS,CAAC,CAAC;AAErG,OAAO,SAASC,iBAAiB,GAAG;IAClC,MAAMC,GAAG,GAAGJ,UAAU,CAACC,qBAAqB,CAAC,AAAC;IAC9C,IAAIG,GAAG,KAAKF,SAAS,EAAE;QACrB,MAAM,IAAIG,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;IACD,OAAOD,GAAG,CAAC;AACb,CAAC"}
@@ -1 +1,25 @@
1
- export const BertPanel1={PanelComponent:()=>null,OptionsEditorComponent:()=>null,createInitialOptions:()=>({})};export const BertPanel2={PanelComponent:()=>null,OptionsEditorComponent:()=>null,createInitialOptions:()=>({})};
1
+ // Copyright 2022 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
+ // Dummy plugins to test loading
14
+ export const BertPanel1 = {
15
+ PanelComponent: ()=>null,
16
+ OptionsEditorComponent: ()=>null,
17
+ createInitialOptions: ()=>({})
18
+ };
19
+ export const BertPanel2 = {
20
+ PanelComponent: ()=>null,
21
+ OptionsEditorComponent: ()=>null,
22
+ createInitialOptions: ()=>({})
23
+ };
24
+
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/PluginRegistry/test-plugins/bert/index.ts"],"sourcesContent":["// Copyright 2022 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 { PanelPlugin } from '../../../../model';\n\n// Dummy plugins to test loading\nexport const BertPanel1: PanelPlugin = {\n PanelComponent: () => null,\n OptionsEditorComponent: () => null,\n createInitialOptions: () => ({}),\n};\n\nexport const BertPanel2: PanelPlugin = {\n PanelComponent: () => null,\n OptionsEditorComponent: () => null,\n createInitialOptions: () => ({}),\n};\n"],"names":["BertPanel1","PanelComponent","OptionsEditorComponent","createInitialOptions","BertPanel2"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,gCAAgC;AAChC,OAAO,MAAMA,UAAU,GAAgB;IACrCC,cAAc,EAAE,IAAM,IAAI;IAC1BC,sBAAsB,EAAE,IAAM,IAAI;IAClCC,oBAAoB,EAAE,IAAO,CAAA,EAAE,CAAA,AAAC;CACjC,CAAC;AAEF,OAAO,MAAMC,UAAU,GAAgB;IACrCH,cAAc,EAAE,IAAM,IAAI;IAC1BC,sBAAsB,EAAE,IAAM,IAAI;IAClCC,oBAAoB,EAAE,IAAO,CAAA,EAAE,CAAA,AAAC;CACjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/PluginRegistry/test-plugins/ernie/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQnD,eAAO,MAAM,aAAa,EAAE,cAE3B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/PluginRegistry/test-plugins/ernie/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAkB,MAAM,mBAAmB,CAAC;AAQnE,eAAO,MAAM,aAAa,EAAE,cAE3B,CAAC"}
@@ -1 +1,30 @@
1
- const data=[{label:"Grover",value:"Grover"},{label:"Snuffleupagus",value:"Snuffleupagus"}];export const ErnieVariable={useVariableOptions:()=>({loading:!1,error:void 0,data})};
1
+ // Copyright 2022 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
+ const data = [
14
+ {
15
+ label: 'Grover',
16
+ value: 'Grover'
17
+ },
18
+ {
19
+ label: 'Snuffleupagus',
20
+ value: 'Snuffleupagus'
21
+ }
22
+ ];
23
+ // Dummy plugin to test loading
24
+ export const ErnieVariable = {
25
+ getVariableOptions: async ()=>({
26
+ data
27
+ })
28
+ };
29
+
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/PluginRegistry/test-plugins/ernie/index.ts"],"sourcesContent":["// Copyright 2022 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 { VariablePlugin, VariableOption } from '../../../../model';\n\nconst data: VariableOption[] = [\n { label: 'Grover', value: 'Grover' },\n { label: 'Snuffleupagus', value: 'Snuffleupagus' },\n];\n\n// Dummy plugin to test loading\nexport const ErnieVariable: VariablePlugin = {\n getVariableOptions: async () => ({ data }),\n};\n"],"names":["data","label","value","ErnieVariable","getVariableOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,MAAMA,IAAI,GAAqB;IAC7B;QAAEC,KAAK,EAAE,QAAQ;QAAEC,KAAK,EAAE,QAAQ;KAAE;IACpC;QAAED,KAAK,EAAE,eAAe;QAAEC,KAAK,EAAE,eAAe;KAAE;CACnD,AAAC;AAEF,+BAA+B;AAC/B,OAAO,MAAMC,aAAa,GAAmB;IAC3CC,kBAAkB,EAAE,UAAa,CAAA;YAAEJ,IAAI;SAAE,CAAA,AAAC;CAC3C,CAAC"}
@@ -1 +1,35 @@
1
- import bertResource from"./bert/plugin.json";import ernieResource from"./ernie/plugin.json";const testPlugins=new Map;testPlugins.set(bertResource,(()=>import("./bert"))),testPlugins.set(ernieResource,(()=>import("./ernie")));export const testRegistryProps={getInstalledPlugins:()=>{const e=Array.from(testPlugins.keys());return Promise.resolve(e)},importPluginModule:e=>{const t=testPlugins.get(e);if(void 0===t)throw new Error("Plugin not found");return t()}};
1
+ // Copyright 2022 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 bertResource from './bert/plugin.json';
14
+ import ernieResource from './ernie/plugin.json';
15
+ // Put all the test plugins into a Map
16
+ const testPlugins = new Map();
17
+ testPlugins.set(bertResource, ()=>import('./bert'));
18
+ testPlugins.set(ernieResource, ()=>import('./ernie'));
19
+ /**
20
+ * Some props for testing the PluginRegistry that use the test plugins/metadata in this folder.
21
+ */ export const testRegistryProps = {
22
+ getInstalledPlugins: ()=>{
23
+ const resources = Array.from(testPlugins.keys());
24
+ return Promise.resolve(resources);
25
+ },
26
+ importPluginModule: (resource)=>{
27
+ const importFn = testPlugins.get(resource);
28
+ if (importFn === undefined) {
29
+ throw new Error('Plugin not found');
30
+ }
31
+ return importFn();
32
+ }
33
+ };
34
+
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/PluginRegistry/test-plugins/index.ts"],"sourcesContent":["// Copyright 2022 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 { PluginModuleResource } from '../../../model';\nimport { PluginRegistryProps } from '../PluginRegistry';\nimport bertResource from './bert/plugin.json';\nimport ernieResource from './ernie/plugin.json';\n\n// Put all the test plugins into a Map\nconst testPlugins = new Map<PluginModuleResource, () => Promise<unknown>>();\ntestPlugins.set(bertResource as PluginModuleResource, () => import('./bert'));\ntestPlugins.set(ernieResource as PluginModuleResource, () => import('./ernie'));\n\n/**\n * Some props for testing the PluginRegistry that use the test plugins/metadata in this folder.\n */\nexport const testRegistryProps: Omit<PluginRegistryProps, 'children'> = {\n getInstalledPlugins: () => {\n const resources = Array.from(testPlugins.keys());\n return Promise.resolve(resources);\n },\n importPluginModule: (resource) => {\n const importFn = testPlugins.get(resource);\n if (importFn === undefined) {\n throw new Error('Plugin not found');\n }\n return importFn();\n },\n};\n"],"names":["bertResource","ernieResource","testPlugins","Map","set","testRegistryProps","getInstalledPlugins","resources","Array","from","keys","Promise","resolve","importPluginModule","resource","importFn","get","undefined","Error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAOA,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAOC,aAAa,MAAM,qBAAqB,CAAC;AAEhD,sCAAsC;AACtC,MAAMC,WAAW,GAAG,IAAIC,GAAG,EAAgD,AAAC;AAC5ED,WAAW,CAACE,GAAG,CAACJ,YAAY,EAA0B,IAAM,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC9EE,WAAW,CAACE,GAAG,CAACH,aAAa,EAA0B,IAAM,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;AAEhF;;CAEC,GACD,OAAO,MAAMI,iBAAiB,GAA0C;IACtEC,mBAAmB,EAAE,IAAM;QACzB,MAAMC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAACP,WAAW,CAACQ,IAAI,EAAE,CAAC,AAAC;QACjD,OAAOC,OAAO,CAACC,OAAO,CAACL,SAAS,CAAC,CAAC;IACpC,CAAC;IACDM,kBAAkB,EAAE,CAACC,QAAQ,GAAK;QAChC,MAAMC,QAAQ,GAAGb,WAAW,CAACc,GAAG,CAACF,QAAQ,CAAC,AAAC;QAC3C,IAAIC,QAAQ,KAAKE,SAAS,EAAE;YAC1B,MAAM,IAAIC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,OAAOH,QAAQ,EAAE,CAAC;IACpB,CAAC;CACF,CAAC"}
@@ -1,4 +1,2 @@
1
- export * from './PluginBoundary';
2
- export * from './PluginLoadingBoundary';
3
- export * from './PluginRegistry/legacy';
1
+ export * from './PluginRegistry';
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
@@ -1 +1,15 @@
1
- export*from"./PluginBoundary";export*from"./PluginLoadingBoundary";export*from"./PluginRegistry/legacy";
1
+ // Copyright 2022 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './PluginRegistry';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2022 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 './PluginRegistry';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1,17 @@
1
- export*from"./components";export*from"./model";export*from"./runtime";
1
+ // Copyright 2022 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './components';
14
+ export * from './model';
15
+ export * from './runtime';
16
+
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2022 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 './components';\nexport * from './model';\nexport * from './runtime';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { InitialOptionsCallback, OptionsEditor } from './visual-editing';
2
+ /**
3
+ * Plugin that defines options for an external system that Perses talks to for data.
4
+ */
5
+ export interface DatasourcePlugin<Spec = unknown> {
6
+ OptionsEditorComponent: OptionsEditor<Spec>;
7
+ createInitialOptions: InitialOptionsCallback<Spec>;
8
+ }
9
+ //# sourceMappingURL=datasource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/model/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,OAAO;IAC9C,sBAAsB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5C,oBAAoB,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC;CACpD"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2022 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export { };
14
+
15
+ //# sourceMappingURL=datasource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/datasource.ts"],"sourcesContent":["// Copyright 2022 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 { InitialOptionsCallback, OptionsEditor } from './visual-editing';\n\n/**\n * Plugin that defines options for an external system that Perses talks to for data.\n */\nexport interface DatasourcePlugin<Spec = unknown> {\n OptionsEditorComponent: OptionsEditor<Spec>;\n createInitialOptions: InitialOptionsCallback<Spec>;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WAQC"}
@@ -1,6 +1,7 @@
1
- export * from './graph-queries';
1
+ export * from './datasource';
2
2
  export * from './panels';
3
3
  export * from './plugins';
4
+ export * from './time-series-queries';
4
5
  export * from './variables';
5
6
  export * from './visual-editing';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
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,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
@@ -1 +1,20 @@
1
- export*from"./graph-queries";export*from"./panels";export*from"./plugins";export*from"./variables";export*from"./visual-editing";
1
+ // Copyright 2022 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './datasource';
14
+ export * from './panels';
15
+ export * from './plugins';
16
+ export * from './time-series-queries';
17
+ export * from './variables';
18
+ export * from './visual-editing';
19
+
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 2022 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 './panels';\nexport * from './plugins';\nexport * from './time-series-queries';\nexport * from './variables';\nexport * from './visual-editing';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
@@ -1,26 +1,22 @@
1
1
  /// <reference types="react" />
2
- import { JsonObject, PanelDefinition } from '@perses-dev/core';
2
+ import { PanelDefinition } from '@perses-dev/core';
3
3
  import { InitialOptionsCallback, OptionsEditor } from './visual-editing';
4
4
  /**
5
5
  * Plugin the provides custom visualizations inside of a Panel.
6
6
  */
7
- export interface PanelPlugin<Options extends JsonObject = JsonObject> {
8
- PanelComponent: React.ComponentType<PanelProps<Options>>;
9
- OptionsEditorComponent: OptionsEditor<Options>;
10
- createInitialOptions: InitialOptionsCallback<Options>;
7
+ export interface PanelPlugin<Spec = unknown> {
8
+ PanelComponent: React.ComponentType<PanelProps<Spec>>;
9
+ OptionsEditorComponent: OptionsEditor<Spec>;
10
+ createInitialOptions: InitialOptionsCallback<Spec>;
11
11
  }
12
12
  /**
13
13
  * The props provided by Perses to a panel plugin's PanelComponent.
14
14
  */
15
- export interface PanelProps<Options extends JsonObject> {
16
- definition: PanelDefinition<Options>;
15
+ export interface PanelProps<Spec> {
16
+ definition: PanelDefinition<Spec>;
17
17
  contentDimensions?: {
18
18
  width: number;
19
19
  height: number;
20
20
  };
21
21
  }
22
- /**
23
- * Hook for using a panel plugin at runtime.
24
- */
25
- export declare function usePanelPlugin(kind: string): PanelPlugin<JsonObject>;
26
22
  //# sourceMappingURL=panels.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"panels.d.ts","sourceRoot":"","sources":["../../src/model/panels.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,OAAO,SAAS,UAAU,GAAG,UAAU;IAClE,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,sBAAsB,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/C,oBAAoB,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,OAAO,SAAS,UAAU;IACpD,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACrC,iBAAiB,CAAC,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,UAAU,CAAC,CAQpE"}
1
+ {"version":3,"file":"panels.d.ts","sourceRoot":"","sources":["../../src/model/panels.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,IAAI,GAAG,OAAO;IACzC,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,sBAAsB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5C,oBAAoB,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,IAAI;IAC9B,UAAU,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAClC,iBAAiB,CAAC,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH"}
@@ -1 +1,15 @@
1
- import{usePlugin}from"../components/PluginLoadingBoundary";export function usePanelPlugin(n){const l=usePlugin("Panel",n);return void 0!==l?l:defaultPanelPlugin}const defaultPanelPlugin={PanelComponent:()=>null,OptionsEditorComponent:()=>null,createInitialOptions:()=>({})};
1
+ // Copyright 2022 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export { };
14
+
15
+ //# sourceMappingURL=panels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/panels.tsx"],"sourcesContent":["// Copyright 2022 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 { PanelDefinition } from '@perses-dev/core';\nimport { InitialOptionsCallback, OptionsEditor } from './visual-editing';\n\n/**\n * Plugin the provides custom visualizations inside of a Panel.\n */\nexport interface PanelPlugin<Spec = unknown> {\n PanelComponent: React.ComponentType<PanelProps<Spec>>;\n OptionsEditorComponent: OptionsEditor<Spec>;\n createInitialOptions: InitialOptionsCallback<Spec>;\n}\n\n/**\n * The props provided by Perses to a panel plugin's PanelComponent.\n */\nexport interface PanelProps<Spec> {\n definition: PanelDefinition<Spec>;\n contentDimensions?: {\n width: number;\n height: number;\n };\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WAqBC"}
@@ -1,13 +1,14 @@
1
- import { JsonObject, ResourceMetadata, ListVariableDefinition, PanelDefinition } from '@perses-dev/core';
2
- import { GraphQueryDefinition, GraphQueryPlugin } from './graph-queries';
1
+ import { Metadata } from '@perses-dev/core';
2
+ import { TimeSeriesQueryPlugin } from './time-series-queries';
3
3
  import { PanelPlugin } from './panels';
4
4
  import { VariablePlugin } from './variables';
5
+ import { DatasourcePlugin } from './datasource';
5
6
  /**
6
7
  * Information about a module/package that contains plugins.
7
8
  */
8
9
  export interface PluginModuleResource {
9
10
  kind: 'PluginModule';
10
- metadata: ResourceMetadata;
11
+ metadata: Metadata;
11
12
  spec: PluginSpec;
12
13
  }
13
14
  export interface PluginSpec {
@@ -25,36 +26,26 @@ export interface PluginMetadata {
25
26
  };
26
27
  }
27
28
  /**
28
- * All supported plugin type values as an array for use at runtime.
29
+ * All supported plugin types.
29
30
  */
30
- export declare const ALL_PLUGIN_TYPES: readonly ["Variable", "Panel", "GraphQuery"];
31
+ export declare type PluginType = keyof SupportedPlugins;
31
32
  /**
32
- * All supported plugin types.
33
+ * Map of plugin type key/string -> implementation type
33
34
  */
34
- export declare type PluginType = typeof ALL_PLUGIN_TYPES[number];
35
- declare type SupportedPlugins<Options extends JsonObject> = {
36
- Variable: {
37
- Def: ListVariableDefinition<Options>;
38
- Impl: VariablePlugin<Options>;
39
- };
40
- Panel: {
41
- Def: PanelDefinition<Options>;
42
- Impl: PanelPlugin<Options>;
43
- };
44
- GraphQuery: {
45
- Def: GraphQueryDefinition<Options>;
46
- Impl: GraphQueryPlugin<Options>;
47
- };
48
- };
35
+ export interface SupportedPlugins {
36
+ Variable: VariablePlugin;
37
+ Panel: PanelPlugin;
38
+ TimeSeriesQuery: TimeSeriesQueryPlugin;
39
+ Datasource: DatasourcePlugin;
40
+ }
49
41
  /**
50
42
  * Union type of all available plugin implementations.
51
43
  */
52
- export declare type Plugin<Options extends JsonObject> = {
53
- [Type in PluginType]: PluginImplementation<Type, Options>;
44
+ export declare type Plugin = {
45
+ [Type in PluginType]: PluginImplementation<Type>;
54
46
  }[PluginType];
55
47
  /**
56
48
  * The implementation for a given plugin type.
57
49
  */
58
- export declare type PluginImplementation<Type extends PluginType, Options extends JsonObject> = SupportedPlugins<Options>[Type]['Impl'];
59
- export {};
50
+ export declare type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];
60
51
  //# sourceMappingURL=plugins.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/model/plugins.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,8CAA+C,CAAC;AAE7E;;GAEG;AACH,oBAAY,UAAU,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAGzD,aAAK,gBAAgB,CAAC,OAAO,SAAS,UAAU,IAAI;IAClD,QAAQ,EAAE;QACR,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;KAC/B,CAAC;IACF,KAAK,EAAE;QACL,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;QAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;KAC5B,CAAC;IACF,UAAU,EAAE;QACV,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;KACjC,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,oBAAY,MAAM,CAAC,OAAO,SAAS,UAAU,IAAI;KAC9C,IAAI,IAAI,UAAU,GAAG,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC;CAC1D,CAAC,UAAU,CAAC,CAAC;AAEd;;GAEG;AACH,oBAAY,oBAAoB,CAC9B,IAAI,SAAS,UAAU,EACvB,OAAO,SAAS,UAAU,IACxB,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/model/plugins.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED;;GAEG;AACH,oBAAY,UAAU,GAAG,MAAM,gBAAgB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,eAAe,EAAE,qBAAqB,CAAC;IACvC,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAED;;GAEG;AACH,oBAAY,MAAM,GAAG;KAClB,IAAI,IAAI,UAAU,GAAG,oBAAoB,CAAC,IAAI,CAAC;CACjD,CAAC,UAAU,CAAC,CAAC;AAEd;;GAEG;AACH,oBAAY,oBAAoB,CAAC,IAAI,SAAS,UAAU,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC"}
@@ -1 +1,15 @@
1
- export const ALL_PLUGIN_TYPES=["Variable","Panel","GraphQuery"];
1
+ // Copyright 2022 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export { };
14
+
15
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/plugins.ts"],"sourcesContent":["// Copyright 2022 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 { Metadata } from '@perses-dev/core';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { PanelPlugin } from './panels';\nimport { VariablePlugin } from './variables';\nimport { DatasourcePlugin } from './datasource';\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: Metadata;\n spec: PluginSpec;\n}\n\nexport interface PluginSpec {\n plugins: PluginMetadata[];\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n pluginType: PluginType;\n kind: string;\n display: {\n name: string;\n description?: string;\n };\n}\n\n/**\n * All supported plugin types.\n */\nexport type PluginType = keyof SupportedPlugins;\n\n/**\n * Map of plugin type key/string -> implementation type\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n Datasource: DatasourcePlugin;\n}\n\n/**\n * Union type of all available plugin implementations.\n */\nexport type Plugin = {\n [Type in PluginType]: PluginImplementation<Type>;\n}[PluginType];\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WAwDmF"}
@@ -0,0 +1,28 @@
1
+ import { AbsoluteTimeRange, UnixTimeMs } from '@perses-dev/core';
2
+ import { DatasourceStore, VariableStateMap } from '../runtime';
3
+ /**
4
+ * A plugin for running graph queries.
5
+ */
6
+ export interface TimeSeriesQueryPlugin<Spec = unknown> {
7
+ getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext) => Promise<TimeSeriesData>;
8
+ }
9
+ /**
10
+ * Context available to TimeSeriesQuery plugins at runtime.
11
+ */
12
+ export interface TimeSeriesQueryContext {
13
+ suggestedStepMs?: number;
14
+ timeRange: AbsoluteTimeRange;
15
+ variableState: VariableStateMap;
16
+ datasourceStore: DatasourceStore;
17
+ }
18
+ export interface TimeSeriesData {
19
+ timeRange: AbsoluteTimeRange;
20
+ stepMs: number;
21
+ series: Iterable<TimeSeries>;
22
+ }
23
+ export interface TimeSeries {
24
+ name: string;
25
+ values: Iterable<TimeSeriesValueTuple>;
26
+ }
27
+ export declare type TimeSeriesValueTuple = [timestamp: UnixTimeMs, value: number];
28
+ //# sourceMappingURL=time-series-queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-series-queries.d.ts","sourceRoot":"","sources":["../../src/model/time-series-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,IAAI,GAAG,OAAO;IACnD,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACzF;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;CACxC;AAED,oBAAY,oBAAoB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2022 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export { };
14
+
15
+ //# sourceMappingURL=time-series-queries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/time-series-queries.ts"],"sourcesContent":["// Copyright 2022 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, UnixTimeMs } from '@perses-dev/core';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\n\n/**\n * A plugin for running graph queries.\n */\nexport interface TimeSeriesQueryPlugin<Spec = unknown> {\n getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext) => Promise<TimeSeriesData>;\n}\n\n/**\n * Context available to TimeSeriesQuery plugins at runtime.\n */\nexport interface TimeSeriesQueryContext {\n suggestedStepMs?: number;\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n}\n\nexport interface TimeSeriesData {\n timeRange: AbsoluteTimeRange;\n stepMs: number;\n series: Iterable<TimeSeries>;\n}\n\nexport interface TimeSeries {\n name: string;\n values: Iterable<TimeSeriesValueTuple>;\n}\n\nexport type TimeSeriesValueTuple = [timestamp: UnixTimeMs, value: number];\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WA+B0E"}
@@ -1,21 +1,26 @@
1
- import { JsonObject, ListVariableDefinition, VariableOption } from '@perses-dev/core';
1
+ import { VariableStateMap } from '../runtime';
2
+ import { DatasourceStore } from '../runtime';
3
+ export declare type VariableOption = {
4
+ label: string;
5
+ value: string;
6
+ };
7
+ export interface GetVariableOptionsContext {
8
+ variables: VariableStateMap;
9
+ datasourceStore: DatasourceStore;
10
+ }
2
11
  /**
3
12
  * Plugin for handling custom VariableDefinitions.
4
13
  */
5
- export interface VariablePlugin<Options extends JsonObject = JsonObject> {
6
- useVariableOptions: UseVariableOptionsHook<Options>;
14
+ export interface VariablePlugin<Spec = unknown> {
15
+ getVariableOptions: GetVariableOptions<Spec>;
16
+ /** Returns a list of variables name this variable depends on. Used to optimize fetching */
17
+ dependsOn?: (definition: Spec) => string[];
7
18
  }
8
19
  /**
9
20
  * Plugin hook responsible for getting the options of a custom variable
10
21
  * definition.
11
22
  */
12
- export declare type UseVariableOptionsHook<Options extends JsonObject = JsonObject> = (definition: ListVariableDefinition<Options>) => {
23
+ export declare type GetVariableOptions<Spec> = (definition: Spec, ctx: GetVariableOptionsContext) => Promise<{
13
24
  data: VariableOption[];
14
- loading: boolean;
15
- error?: Error;
16
- };
17
- /**
18
- * Use the variable options from a variable plugin at runtime.
19
- */
20
- export declare const useVariableOptions: VariablePlugin['useVariableOptions'];
25
+ }>;
21
26
  //# sourceMappingURL=variables.d.ts.map