@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
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,53 +10,74 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
- Object.defineProperty(o, "default", { enumerable: true, value: v });
27
- }) : function(o, v) {
28
- o["default"] = v;
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
29
16
  });
30
- var __importStar = (this && this.__importStar) || function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- var __importDefault = (this && this.__importDefault) || function (mod) {
38
- return (mod && mod.__esModule) ? mod : { "default": mod };
39
- };
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.testRegistryProps = void 0;
42
- const plugin_json_1 = __importDefault(require("./bert/plugin.json"));
43
- const plugin_json_2 = __importDefault(require("./ernie/plugin.json"));
17
+ Object.defineProperty(exports, "testRegistryProps", {
18
+ enumerable: true,
19
+ get: ()=>testRegistryProps
20
+ });
21
+ const _pluginJson = /*#__PURE__*/ _interopRequireDefault(require("./bert/plugin.json"));
22
+ const _pluginJson1 = /*#__PURE__*/ _interopRequireDefault(require("./ernie/plugin.json"));
23
+ function _interopRequireDefault(obj) {
24
+ return obj && obj.__esModule ? obj : {
25
+ default: obj
26
+ };
27
+ }
28
+ function _getRequireWildcardCache(nodeInterop) {
29
+ if (typeof WeakMap !== "function") return null;
30
+ var cacheBabelInterop = new WeakMap();
31
+ var cacheNodeInterop = new WeakMap();
32
+ return (_getRequireWildcardCache = function(nodeInterop) {
33
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
34
+ })(nodeInterop);
35
+ }
36
+ function _interopRequireWildcard(obj, nodeInterop) {
37
+ if (!nodeInterop && obj && obj.__esModule) {
38
+ return obj;
39
+ }
40
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
41
+ return {
42
+ default: obj
43
+ };
44
+ }
45
+ var cache = _getRequireWildcardCache(nodeInterop);
46
+ if (cache && cache.has(obj)) {
47
+ return cache.get(obj);
48
+ }
49
+ var newObj = {};
50
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
51
+ for(var key in obj){
52
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
53
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
54
+ if (desc && (desc.get || desc.set)) {
55
+ Object.defineProperty(newObj, key, desc);
56
+ } else {
57
+ newObj[key] = obj[key];
58
+ }
59
+ }
60
+ }
61
+ newObj.default = obj;
62
+ if (cache) {
63
+ cache.set(obj, newObj);
64
+ }
65
+ return newObj;
66
+ }
44
67
  // Put all the test plugins into a Map
45
68
  const testPlugins = new Map();
46
- testPlugins.set(plugin_json_1.default, () => Promise.resolve().then(() => __importStar(require('./bert'))));
47
- testPlugins.set(plugin_json_2.default, () => Promise.resolve().then(() => __importStar(require('./ernie'))));
48
- /**
49
- * Some props for testing the PluginRegistry that use the test plugins/metadata in this folder.
50
- */
51
- exports.testRegistryProps = {
52
- getInstalledPlugins: () => {
69
+ testPlugins.set(_pluginJson.default, ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interopRequireWildcard(require("./bert"))));
70
+ testPlugins.set(_pluginJson1.default, ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interopRequireWildcard(require("./ernie"))));
71
+ const testRegistryProps = {
72
+ getInstalledPlugins: ()=>{
53
73
  const resources = Array.from(testPlugins.keys());
54
74
  return Promise.resolve(resources);
55
75
  },
56
- importPluginModule: (resource) => {
76
+ importPluginModule: (resource)=>{
57
77
  const importFn = testPlugins.get(resource);
58
78
  if (importFn === undefined) {
59
79
  throw new Error('Plugin not found');
60
80
  }
61
81
  return importFn();
62
- },
82
+ }
63
83
  };
@@ -1,5 +1,4 @@
1
- "use strict";
2
- // Copyright 2021 The Perses Authors
1
+ // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
5
4
  // You may obtain a copy of the License at
@@ -11,21 +10,19 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- __exportStar(require("./PluginBoundary"), exports);
30
- __exportStar(require("./PluginLoadingBoundary"), exports);
31
- __exportStar(require("./PluginRegistry/legacy"), exports);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _exportStar(require("./PluginRegistry"), exports);
18
+ function _exportStar(from, to) {
19
+ Object.keys(from).forEach(function(k) {
20
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
21
+ enumerable: true,
22
+ get: function() {
23
+ return from[k];
24
+ }
25
+ });
26
+ });
27
+ return from;
28
+ }
package/dist/cjs/index.js CHANGED
@@ -1,5 +1,4 @@
1
- "use strict";
2
- // Copyright 2021 The Perses Authors
1
+ // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
5
4
  // You may obtain a copy of the License at
@@ -11,21 +10,21 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- __exportStar(require("./components"), exports);
30
- __exportStar(require("./model"), exports);
31
- __exportStar(require("./runtime"), exports);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _exportStar(require("./components"), exports);
18
+ _exportStar(require("./model"), exports);
19
+ _exportStar(require("./runtime"), exports);
20
+ function _exportStar(from, to) {
21
+ Object.keys(from).forEach(function(k) {
22
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
23
+ enumerable: true,
24
+ get: function() {
25
+ return from[k];
26
+ }
27
+ });
28
+ });
29
+ return from;
30
+ }
@@ -0,0 +1,16 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,23 +10,24 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- __exportStar(require("./graph-queries"), exports);
30
- __exportStar(require("./panels"), exports);
31
- __exportStar(require("./plugins"), exports);
32
- __exportStar(require("./variables"), exports);
33
- __exportStar(require("./visual-editing"), exports);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _exportStar(require("./datasource"), exports);
18
+ _exportStar(require("./panels"), exports);
19
+ _exportStar(require("./plugins"), exports);
20
+ _exportStar(require("./time-series-queries"), exports);
21
+ _exportStar(require("./variables"), exports);
22
+ _exportStar(require("./visual-editing"), exports);
23
+ function _exportStar(from, to) {
24
+ Object.keys(from).forEach(function(k) {
25
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
26
+ enumerable: true,
27
+ get: function() {
28
+ return from[k];
29
+ }
30
+ });
31
+ });
32
+ return from;
33
+ }
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,23 +10,7 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.usePanelPlugin = void 0;
16
- const PluginLoadingBoundary_1 = require("../components/PluginLoadingBoundary");
17
- /**
18
- * Hook for using a panel plugin at runtime.
19
- */
20
- function usePanelPlugin(kind) {
21
- const plugin = (0, PluginLoadingBoundary_1.usePlugin)('Panel', kind);
22
- if (plugin !== undefined) {
23
- return plugin;
24
- }
25
- // Return a default/placeholder plugin while loading happens
26
- return defaultPanelPlugin;
27
- }
28
- exports.usePanelPlugin = usePanelPlugin;
29
- const defaultPanelPlugin = {
30
- PanelComponent: () => null,
31
- OptionsEditorComponent: () => null,
32
- createInitialOptions: () => ({}),
33
- };
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,9 +10,7 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.ALL_PLUGIN_TYPES = void 0;
16
- /**
17
- * All supported plugin type values as an array for use at runtime.
18
- */
19
- exports.ALL_PLUGIN_TYPES = ['Variable', 'Panel', 'GraphQuery'];
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -0,0 +1,16 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -1,5 +1,4 @@
1
- "use strict";
2
- // Copyright 2021 The Perses Authors
1
+ // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
5
4
  // You may obtain a copy of the License at
@@ -11,18 +10,7 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.useVariableOptions = void 0;
16
- const PluginLoadingBoundary_1 = require("../components/PluginLoadingBoundary");
17
- /**
18
- * Use the variable options from a variable plugin at runtime.
19
- */
20
- const useVariableOptions = (definition) => {
21
- const plugin = (0, PluginLoadingBoundary_1.usePlugin)('Variable', definition.kind);
22
- if (plugin === undefined) {
23
- // Provide default values while the plugin is being loaded
24
- return { data: [], loading: true };
25
- }
26
- return plugin.useVariableOptions(definition);
27
- };
28
- exports.useVariableOptions = useVariableOptions;
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,4 +10,13 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ const _react = /*#__PURE__*/ _interopRequireDefault(require("react"));
18
+ function _interopRequireDefault(obj) {
19
+ return obj && obj.__esModule ? obj : {
20
+ default: obj
21
+ };
22
+ }
@@ -1,5 +1,4 @@
1
- "use strict";
2
- // Copyright 2021 The Perses Authors
1
+ // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
5
4
  // You may obtain a copy of the License at
@@ -11,18 +10,26 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.useDatasources = exports.DatasourcesContext = void 0;
16
- const react_1 = require("react");
17
- exports.DatasourcesContext = (0, react_1.createContext)(undefined);
18
- /**
19
- * Gets the Datasources at runtime.
20
- */
21
- function useDatasources() {
22
- const ctx = (0, react_1.useContext)(exports.DatasourcesContext);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ DatasourceStoreContext: ()=>DatasourceStoreContext,
25
+ useDatasourceStore: ()=>useDatasourceStore
26
+ });
27
+ const _react = require("react");
28
+ const DatasourceStoreContext = (0, _react.createContext)(undefined);
29
+ function useDatasourceStore() {
30
+ const ctx = (0, _react.useContext)(DatasourceStoreContext);
23
31
  if (ctx === undefined) {
24
- throw new Error('No DatasourcesContext found. Did you forget a Provider?');
32
+ throw new Error('No DatasourceStoreContext found. Did you forget a Provider?');
25
33
  }
26
34
  return ctx;
27
35
  }
28
- exports.useDatasources = useDatasources;
@@ -1,5 +1,4 @@
1
- "use strict";
2
- // Copyright 2021 The Perses Authors
1
+ // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
5
4
  // You may obtain a copy of the License at
@@ -11,22 +10,24 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- __exportStar(require("./datasources"), exports);
30
- __exportStar(require("./template-variables"), exports);
31
- __exportStar(require("./time-range"), exports);
32
- __exportStar(require("./query-string"), exports);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _exportStar(require("./datasources"), exports);
18
+ _exportStar(require("./time-series-queries"), exports);
19
+ _exportStar(require("./plugins"), exports);
20
+ _exportStar(require("./query-string"), exports);
21
+ _exportStar(require("./template-variables"), exports);
22
+ _exportStar(require("./time-range"), exports);
23
+ function _exportStar(from, to) {
24
+ Object.keys(from).forEach(function(k) {
25
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
26
+ enumerable: true,
27
+ get: function() {
28
+ return from[k];
29
+ }
30
+ });
31
+ });
32
+ return from;
33
+ }
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,28 +10,32 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.useListPluginMetadata = exports.usePlugin = void 0;
16
- const react_query_1 = require("react-query");
17
- const PluginRegistry_1 = require("../components/PluginRegistry");
18
- const cache_keys_1 = require("../utils/cache-keys");
19
- /**
20
- * Loads a plugin and returns the plugin implementation, along with loading/error state.
21
- */
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ usePlugin: ()=>usePlugin,
25
+ useListPluginMetadata: ()=>useListPluginMetadata
26
+ });
27
+ const _reactQuery = require("@tanstack/react-query");
28
+ const _pluginRegistry = require("../components/PluginRegistry");
22
29
  function usePlugin(pluginType, kind, options) {
23
- const { getPlugin } = (0, PluginRegistry_1.usePluginRegistry)();
24
- const queryKey = (0, cache_keys_1.getTypeAndKindKey)(pluginType, kind);
25
- const { data, isLoading, error } = (0, react_query_1.useQuery)(queryKey, () => getPlugin(pluginType, kind), options);
26
- return { plugin: data, isLoading, error };
30
+ const { getPlugin } = (0, _pluginRegistry.usePluginRegistry)();
31
+ return (0, _reactQuery.useQuery)([
32
+ pluginType,
33
+ kind
34
+ ], ()=>getPlugin(pluginType, kind), options);
27
35
  }
28
- exports.usePlugin = usePlugin;
29
- /**
30
- * Gets a list of plugin metadata for the specified plugin type and returns it, along with loading/error state.
31
- */
32
36
  function useListPluginMetadata(pluginType, options) {
33
- const { listPluginMetadata } = (0, PluginRegistry_1.usePluginRegistry)();
34
- const queryKey = pluginType;
35
- const { data, isLoading, error } = (0, react_query_1.useQuery)(queryKey, () => listPluginMetadata(pluginType), options);
36
- return { pluginMetadata: data, isLoading, error };
37
+ const { listPluginMetadata } = (0, _pluginRegistry.usePluginRegistry)();
38
+ return (0, _reactQuery.useQuery)([
39
+ pluginType
40
+ ], ()=>listPluginMetadata(pluginType), options);
37
41
  }
38
- exports.useListPluginMetadata = useListPluginMetadata;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,18 +10,26 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.useQueryString = exports.QueryStringContext = void 0;
16
- const react_1 = require("react");
17
- exports.QueryStringContext = (0, react_1.createContext)(undefined);
18
- /**
19
- * Gets the current query params at runtime.
20
- */
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ QueryStringContext: ()=>QueryStringContext,
25
+ useQueryString: ()=>useQueryString
26
+ });
27
+ const _react = require("react");
28
+ const QueryStringContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
21
29
  function useQueryString() {
22
- const ctx = (0, react_1.useContext)(exports.QueryStringContext);
30
+ const ctx = (0, _react.useContext)(QueryStringContext);
23
31
  if (ctx === undefined) {
24
32
  throw new Error('No QueryStringContext found. Did you forget a Provider?');
25
33
  }
26
34
  return ctx;
27
35
  }
28
- exports.useQueryString = useQueryString;