@perses-dev/core 0.0.0-snapshot-scatter-chart-embed-8efdfab → 0.0.0-snapshot-explorer-plugin-c4a7621

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 (257) hide show
  1. package/dist/cjs/index.js +1 -0
  2. package/dist/cjs/model/calculations.js +8 -8
  3. package/dist/cjs/model/ephemeraldashboard.js +16 -0
  4. package/dist/cjs/model/index.js +4 -0
  5. package/dist/cjs/model/kind.js +1 -0
  6. package/dist/cjs/model/legend.js +17 -17
  7. package/dist/cjs/model/query.js +12 -0
  8. package/dist/cjs/model/resource.js +14 -3
  9. package/dist/cjs/model/roles.js +4 -3
  10. package/dist/cjs/model/time.js +27 -26
  11. package/dist/cjs/model/trace-data.js +29 -1
  12. package/dist/cjs/model/transforms.js +28 -0
  13. package/dist/cjs/model/units/bytes.js +1 -4
  14. package/dist/cjs/model/units/decimal.js +1 -4
  15. package/dist/cjs/model/units/percent.js +1 -6
  16. package/dist/cjs/model/units/throughput.js +19 -13
  17. package/dist/cjs/model/units/time.js +9 -19
  18. package/dist/cjs/model/units/types.js +0 -13
  19. package/dist/cjs/model/units/units.js +13 -13
  20. package/dist/cjs/model/units/utils.js +3 -3
  21. package/dist/cjs/model/user.js +16 -0
  22. package/dist/cjs/model/value-mapping.js +16 -0
  23. package/dist/cjs/model/variables.js +3 -3
  24. package/dist/cjs/schema/datasource.js +85 -0
  25. package/dist/cjs/schema/display.js +27 -0
  26. package/dist/cjs/schema/duration.js +25 -0
  27. package/dist/cjs/schema/index.js +40 -0
  28. package/dist/cjs/schema/metadata.js +41 -0
  29. package/dist/cjs/schema/panel.js +106 -0
  30. package/dist/cjs/schema/plugin.js +27 -0
  31. package/dist/cjs/schema/role.js +86 -0
  32. package/dist/cjs/schema/rolebinding.js +65 -0
  33. package/dist/cjs/schema/secret.js +174 -0
  34. package/dist/cjs/schema/user.js +57 -0
  35. package/dist/cjs/schema/variable.js +171 -0
  36. package/dist/cjs/utils/fetch.js +20 -26
  37. package/dist/cjs/utils/index.js +3 -0
  38. package/dist/cjs/utils/mathjs.js +1 -1
  39. package/dist/cjs/utils/memo.js +4 -5
  40. package/dist/cjs/utils/panel-refs.js +4 -4
  41. package/dist/cjs/utils/regexp.js +54 -0
  42. package/dist/cjs/utils/text.js +21 -46
  43. package/dist/cjs/utils/time-series-data.js +5 -5
  44. package/dist/cjs/utils/transform-data.js +167 -0
  45. package/dist/cjs/utils/value-mapping.js +105 -0
  46. package/dist/index.d.ts +1 -0
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +1 -0
  49. package/dist/index.js.map +1 -1
  50. package/dist/model/calculations.d.ts +4 -4
  51. package/dist/model/calculations.d.ts.map +1 -1
  52. package/dist/model/calculations.js +1 -1
  53. package/dist/model/calculations.js.map +1 -1
  54. package/dist/model/dashboard.js.map +1 -1
  55. package/dist/model/datasource.d.ts +15 -8
  56. package/dist/model/datasource.d.ts.map +1 -1
  57. package/dist/model/datasource.js +3 -1
  58. package/dist/model/datasource.js.map +1 -1
  59. package/dist/model/definitions.d.ts +1 -1
  60. package/dist/model/definitions.d.ts.map +1 -1
  61. package/dist/model/definitions.js +3 -0
  62. package/dist/model/definitions.js.map +1 -1
  63. package/dist/model/ephemeraldashboard.d.ts +15 -0
  64. package/dist/model/ephemeraldashboard.d.ts.map +1 -0
  65. package/dist/model/ephemeraldashboard.js +15 -0
  66. package/dist/model/ephemeraldashboard.js.map +1 -0
  67. package/dist/model/http-proxy.js.map +1 -1
  68. package/dist/model/http.d.ts +6 -1
  69. package/dist/model/http.d.ts.map +1 -1
  70. package/dist/model/http.js.map +1 -1
  71. package/dist/model/index.d.ts +4 -0
  72. package/dist/model/index.d.ts.map +1 -1
  73. package/dist/model/index.js +4 -0
  74. package/dist/model/index.js.map +1 -1
  75. package/dist/model/kind.d.ts +1 -1
  76. package/dist/model/kind.d.ts.map +1 -1
  77. package/dist/model/kind.js +1 -0
  78. package/dist/model/kind.js.map +1 -1
  79. package/dist/model/layout.d.ts +1 -1
  80. package/dist/model/layout.d.ts.map +1 -1
  81. package/dist/model/layout.js.map +1 -1
  82. package/dist/model/legend.d.ts +6 -6
  83. package/dist/model/legend.d.ts.map +1 -1
  84. package/dist/model/legend.js.map +1 -1
  85. package/dist/model/panels.d.ts +17 -1
  86. package/dist/model/panels.d.ts.map +1 -1
  87. package/dist/model/panels.js +3 -1
  88. package/dist/model/panels.js.map +1 -1
  89. package/dist/model/project.d.ts +5 -0
  90. package/dist/model/project.d.ts.map +1 -1
  91. package/dist/model/project.js.map +1 -1
  92. package/dist/model/query.d.ts +11 -1
  93. package/dist/model/query.d.ts.map +1 -1
  94. package/dist/model/query.js +9 -1
  95. package/dist/model/query.js.map +1 -1
  96. package/dist/model/resource.d.ts +7 -0
  97. package/dist/model/resource.d.ts.map +1 -1
  98. package/dist/model/resource.js +3 -0
  99. package/dist/model/resource.js.map +1 -1
  100. package/dist/model/rolebindings.d.ts +1 -1
  101. package/dist/model/rolebindings.d.ts.map +1 -1
  102. package/dist/model/rolebindings.js.map +1 -1
  103. package/dist/model/roles.d.ts +3 -3
  104. package/dist/model/roles.d.ts.map +1 -1
  105. package/dist/model/roles.js +1 -0
  106. package/dist/model/roles.js.map +1 -1
  107. package/dist/model/secrets.d.ts +1 -1
  108. package/dist/model/secrets.d.ts.map +1 -1
  109. package/dist/model/secrets.js.map +1 -1
  110. package/dist/model/thresholds.js.map +1 -1
  111. package/dist/model/time-series-data.d.ts +1 -0
  112. package/dist/model/time-series-data.d.ts.map +1 -1
  113. package/dist/model/time-series-data.js.map +1 -1
  114. package/dist/model/time-series-queries.d.ts +3 -3
  115. package/dist/model/time-series-queries.d.ts.map +1 -1
  116. package/dist/model/time-series-queries.js.map +1 -1
  117. package/dist/model/time.d.ts +12 -11
  118. package/dist/model/time.d.ts.map +1 -1
  119. package/dist/model/time.js +11 -13
  120. package/dist/model/time.js.map +1 -1
  121. package/dist/model/trace-data.d.ts +80 -7
  122. package/dist/model/trace-data.d.ts.map +1 -1
  123. package/dist/model/trace-data.js +8 -1
  124. package/dist/model/trace-data.js.map +1 -1
  125. package/dist/model/transforms.d.ts +34 -0
  126. package/dist/model/transforms.d.ts.map +1 -0
  127. package/dist/model/transforms.js +21 -0
  128. package/dist/model/transforms.js.map +1 -0
  129. package/dist/model/units/bytes.d.ts +2 -3
  130. package/dist/model/units/bytes.d.ts.map +1 -1
  131. package/dist/model/units/bytes.js +1 -4
  132. package/dist/model/units/bytes.js.map +1 -1
  133. package/dist/model/units/decimal.d.ts +2 -3
  134. package/dist/model/units/decimal.d.ts.map +1 -1
  135. package/dist/model/units/decimal.js +1 -4
  136. package/dist/model/units/decimal.js.map +1 -1
  137. package/dist/model/units/percent.d.ts +2 -3
  138. package/dist/model/units/percent.d.ts.map +1 -1
  139. package/dist/model/units/percent.js +1 -6
  140. package/dist/model/units/percent.js.map +1 -1
  141. package/dist/model/units/throughput.d.ts +2 -3
  142. package/dist/model/units/throughput.d.ts.map +1 -1
  143. package/dist/model/units/throughput.js +19 -13
  144. package/dist/model/units/throughput.js.map +1 -1
  145. package/dist/model/units/time.d.ts +2 -3
  146. package/dist/model/units/time.d.ts.map +1 -1
  147. package/dist/model/units/time.js +9 -19
  148. package/dist/model/units/time.js.map +1 -1
  149. package/dist/model/units/types.d.ts +3 -4
  150. package/dist/model/units/types.d.ts.map +1 -1
  151. package/dist/model/units/types.js +1 -7
  152. package/dist/model/units/types.js.map +1 -1
  153. package/dist/model/units/units.d.ts +5 -3
  154. package/dist/model/units/units.d.ts.map +1 -1
  155. package/dist/model/units/units.js +1 -1
  156. package/dist/model/units/units.js.map +1 -1
  157. package/dist/model/units/utils.d.ts.map +1 -1
  158. package/dist/model/units/utils.js.map +1 -1
  159. package/dist/model/user.d.ts +21 -0
  160. package/dist/model/user.d.ts.map +1 -0
  161. package/dist/model/user.js +15 -0
  162. package/dist/model/user.js.map +1 -0
  163. package/dist/model/value-mapping.d.ts +35 -0
  164. package/dist/model/value-mapping.d.ts.map +1 -0
  165. package/dist/model/value-mapping.js +15 -0
  166. package/dist/model/value-mapping.js.map +1 -0
  167. package/dist/model/variables.d.ts +12 -11
  168. package/dist/model/variables.d.ts.map +1 -1
  169. package/dist/model/variables.js.map +1 -1
  170. package/dist/schema/datasource.d.ts +61 -0
  171. package/dist/schema/datasource.d.ts.map +1 -0
  172. package/dist/schema/datasource.js +54 -0
  173. package/dist/schema/datasource.js.map +1 -0
  174. package/dist/schema/display.d.ts +12 -0
  175. package/dist/schema/display.d.ts.map +1 -0
  176. package/dist/schema/display.js +19 -0
  177. package/dist/schema/display.js.map +1 -0
  178. package/dist/schema/duration.d.ts +3 -0
  179. package/dist/schema/duration.d.ts.map +1 -0
  180. package/dist/schema/duration.js +17 -0
  181. package/dist/schema/duration.js.map +1 -0
  182. package/dist/schema/index.d.ts +12 -0
  183. package/dist/schema/index.d.ts.map +1 -0
  184. package/dist/schema/index.js +25 -0
  185. package/dist/schema/index.js.map +1 -0
  186. package/dist/schema/metadata.d.ts +21 -0
  187. package/dist/schema/metadata.d.ts.map +1 -0
  188. package/dist/schema/metadata.js +22 -0
  189. package/dist/schema/metadata.js.map +1 -0
  190. package/dist/schema/panel.d.ts +13 -0
  191. package/dist/schema/panel.d.ts.map +1 -0
  192. package/dist/schema/panel.js +69 -0
  193. package/dist/schema/panel.js.map +1 -0
  194. package/dist/schema/plugin.d.ts +14 -0
  195. package/dist/schema/plugin.d.ts.map +1 -0
  196. package/dist/schema/plugin.js +19 -0
  197. package/dist/schema/plugin.js.map +1 -0
  198. package/dist/schema/role.d.ts +58 -0
  199. package/dist/schema/role.d.ts.map +1 -0
  200. package/dist/schema/role.js +61 -0
  201. package/dist/schema/role.js.map +1 -0
  202. package/dist/schema/rolebinding.d.ts +58 -0
  203. package/dist/schema/rolebinding.d.ts.map +1 -0
  204. package/dist/schema/rolebinding.js +40 -0
  205. package/dist/schema/rolebinding.js.map +1 -0
  206. package/dist/schema/secret.d.ts +1140 -0
  207. package/dist/schema/secret.d.ts.map +1 -0
  208. package/dist/schema/secret.js +152 -0
  209. package/dist/schema/secret.js.map +1 -0
  210. package/dist/schema/user.d.ts +8 -0
  211. package/dist/schema/user.d.ts.map +1 -0
  212. package/dist/schema/user.js +36 -0
  213. package/dist/schema/user.js.map +1 -0
  214. package/dist/schema/variable.d.ts +92 -0
  215. package/dist/schema/variable.d.ts.map +1 -0
  216. package/dist/schema/variable.js +119 -0
  217. package/dist/schema/variable.js.map +1 -0
  218. package/dist/utils/event.js.map +1 -1
  219. package/dist/utils/fetch.d.ts +5 -2
  220. package/dist/utils/fetch.d.ts.map +1 -1
  221. package/dist/utils/fetch.js +15 -21
  222. package/dist/utils/fetch.js.map +1 -1
  223. package/dist/utils/index.d.ts +3 -0
  224. package/dist/utils/index.d.ts.map +1 -1
  225. package/dist/utils/index.js +3 -0
  226. package/dist/utils/index.js.map +1 -1
  227. package/dist/utils/is-empty-object.d.ts.map +1 -1
  228. package/dist/utils/is-empty-object.js.map +1 -1
  229. package/dist/utils/mathjs.js +1 -1
  230. package/dist/utils/mathjs.js.map +1 -1
  231. package/dist/utils/memo.d.ts.map +1 -1
  232. package/dist/utils/memo.js +1 -2
  233. package/dist/utils/memo.js.map +1 -1
  234. package/dist/utils/panel-refs.d.ts +2 -2
  235. package/dist/utils/panel-refs.d.ts.map +1 -1
  236. package/dist/utils/panel-refs.js.map +1 -1
  237. package/dist/utils/regexp.d.ts +11 -0
  238. package/dist/utils/regexp.d.ts.map +1 -0
  239. package/dist/utils/regexp.js +42 -0
  240. package/dist/utils/regexp.js.map +1 -0
  241. package/dist/utils/text.d.ts +7 -33
  242. package/dist/utils/text.d.ts.map +1 -1
  243. package/dist/utils/text.js +21 -52
  244. package/dist/utils/text.js.map +1 -1
  245. package/dist/utils/time-series-data.d.ts.map +1 -1
  246. package/dist/utils/time-series-data.js.map +1 -1
  247. package/dist/utils/transform-data.d.ts +8 -0
  248. package/dist/utils/transform-data.d.ts.map +1 -0
  249. package/dist/utils/transform-data.js +221 -0
  250. package/dist/utils/transform-data.js.map +1 -0
  251. package/dist/utils/types.d.ts +1 -1
  252. package/dist/utils/types.d.ts.map +1 -1
  253. package/dist/utils/value-mapping.d.ts +3 -0
  254. package/dist/utils/value-mapping.d.ts.map +1 -0
  255. package/dist/utils/value-mapping.js +97 -0
  256. package/dist/utils/value-mapping.js.map +1 -0
  257. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", {
16
16
  });
17
17
  _export_star(require("./constants"), exports);
18
18
  _export_star(require("./model"), exports);
19
+ _export_star(require("./schema"), exports);
19
20
  _export_star(require("./utils"), exports);
20
21
  function _export_star(from, to) {
21
22
  Object.keys(from).forEach(function(k) {
@@ -21,23 +21,23 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- DEFAULT_CALCULATION: function() {
25
- return DEFAULT_CALCULATION;
24
+ CALCULATIONS_CONFIG: function() {
25
+ return CALCULATIONS_CONFIG;
26
26
  },
27
27
  CalculationsMap: function() {
28
28
  return CalculationsMap;
29
29
  },
30
- CALCULATIONS_CONFIG: function() {
31
- return CALCULATIONS_CONFIG;
32
- },
33
- getCalculations: function() {
34
- return getCalculations;
30
+ DEFAULT_CALCULATION: function() {
31
+ return DEFAULT_CALCULATION;
35
32
  },
36
33
  getCalculation: function() {
37
34
  return getCalculation;
35
+ },
36
+ getCalculations: function() {
37
+ return getCalculations;
38
38
  }
39
39
  });
40
- const DEFAULT_CALCULATION = 'last-number';
40
+ const DEFAULT_CALCULATION = 'last'; // aligned with cue
41
41
  const CalculationsMap = {
42
42
  first: first,
43
43
  last: last,
@@ -0,0 +1,16 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -19,6 +19,7 @@ _export_star(require("./dashboard"), exports);
19
19
  _export_star(require("./datasource"), exports);
20
20
  _export_star(require("./definitions"), exports);
21
21
  _export_star(require("./display"), exports);
22
+ _export_star(require("./ephemeraldashboard"), exports);
22
23
  _export_star(require("./http"), exports);
23
24
  _export_star(require("./http-proxy"), exports);
24
25
  _export_star(require("./kind"), exports);
@@ -37,8 +38,11 @@ _export_star(require("./time"), exports);
37
38
  _export_star(require("./time-series-data"), exports);
38
39
  _export_star(require("./time-series-queries"), exports);
39
40
  _export_star(require("./trace-data"), exports);
41
+ _export_star(require("./transforms"), exports);
40
42
  _export_star(require("./units"), exports);
43
+ _export_star(require("./user"), exports);
41
44
  _export_star(require("./variables"), exports);
45
+ _export_star(require("./value-mapping"), exports);
42
46
  function _export_star(from, to) {
43
47
  Object.keys(from).forEach(function(k) {
44
48
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "KINDS", {
23
23
  const KINDS = [
24
24
  'Dashboard',
25
25
  'Datasource',
26
+ 'EphemeralDashboard',
26
27
  'Folder',
27
28
  'GlobalDatasource',
28
29
  'GlobalRole',
@@ -25,35 +25,35 @@ function _export(target, all) {
25
25
  });
26
26
  }
27
27
  _export(exports, {
28
- legendPositions: function() {
29
- return legendPositions;
28
+ DEFAULT_LEGEND: function() {
29
+ return DEFAULT_LEGEND;
30
30
  },
31
- legendModes: function() {
32
- return legendModes;
31
+ getLegendMode: function() {
32
+ return getLegendMode;
33
33
  },
34
- legendSizes: function() {
35
- return legendSizes;
34
+ getLegendPosition: function() {
35
+ return getLegendPosition;
36
36
  },
37
- isValidLegendPosition: function() {
38
- return isValidLegendPosition;
37
+ getLegendSize: function() {
38
+ return getLegendSize;
39
39
  },
40
40
  isValidLegendMode: function() {
41
41
  return isValidLegendMode;
42
42
  },
43
+ isValidLegendPosition: function() {
44
+ return isValidLegendPosition;
45
+ },
43
46
  isValidLegendSize: function() {
44
47
  return isValidLegendSize;
45
48
  },
46
- DEFAULT_LEGEND: function() {
47
- return DEFAULT_LEGEND;
48
- },
49
- getLegendPosition: function() {
50
- return getLegendPosition;
49
+ legendModes: function() {
50
+ return legendModes;
51
51
  },
52
- getLegendMode: function() {
53
- return getLegendMode;
52
+ legendPositions: function() {
53
+ return legendPositions;
54
54
  },
55
- getLegendSize: function() {
56
- return getLegendSize;
55
+ legendSizes: function() {
56
+ return legendSizes;
57
57
  }
58
58
  });
59
59
  const legendPositions = [
@@ -14,3 +14,15 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
+ Object.defineProperty(exports, "isValidQueryPluginType", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return isValidQueryPluginType;
21
+ }
22
+ });
23
+ function isValidQueryPluginType(type) {
24
+ return [
25
+ 'TimeSeriesQuery',
26
+ 'TraceQuery'
27
+ ].includes(type);
28
+ }
@@ -14,12 +14,23 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- Object.defineProperty(exports, "getMetadataProject", {
18
- enumerable: true,
19
- get: function() {
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
+ getMetadataProject: function() {
20
25
  return getMetadataProject;
26
+ },
27
+ isProjectMetadata: function() {
28
+ return isProjectMetadata;
21
29
  }
22
30
  });
31
+ function isProjectMetadata(metadata) {
32
+ return 'project' in metadata;
33
+ }
23
34
  function getMetadataProject(metadata) {
24
35
  return 'project' in metadata ? metadata.project : undefined;
25
36
  }
@@ -24,11 +24,11 @@ _export(exports, {
24
24
  ACTIONS: function() {
25
25
  return ACTIONS;
26
26
  },
27
- PROJECT_SCOPES: function() {
28
- return PROJECT_SCOPES;
29
- },
30
27
  GLOBAL_SCOPES: function() {
31
28
  return GLOBAL_SCOPES;
29
+ },
30
+ PROJECT_SCOPES: function() {
31
+ return PROJECT_SCOPES;
32
32
  }
33
33
  });
34
34
  const ACTIONS = [
@@ -42,6 +42,7 @@ const PROJECT_SCOPES = [
42
42
  '*',
43
43
  'Dashboard',
44
44
  'Datasource',
45
+ 'EphemeralDashboard',
45
46
  'Folder',
46
47
  'Project',
47
48
  'Role',
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -21,35 +21,38 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- isRelativeTimeRange: function() {
25
- return isRelativeTimeRange;
24
+ DURATION_REGEX: function() {
25
+ return DURATION_REGEX;
26
26
  },
27
- isAbsoluteTimeRange: function() {
28
- return isAbsoluteTimeRange;
27
+ formatDuration: function() {
28
+ return formatDuration;
29
29
  },
30
- toAbsoluteTimeRange: function() {
31
- return toAbsoluteTimeRange;
30
+ getSuggestedStepMs: function() {
31
+ return getSuggestedStepMs;
32
32
  },
33
- parseDurationString: function() {
34
- return parseDurationString;
33
+ intervalToPrometheusDuration: function() {
34
+ return intervalToPrometheusDuration;
35
+ },
36
+ isAbsoluteTimeRange: function() {
37
+ return isAbsoluteTimeRange;
35
38
  },
36
39
  isDurationString: function() {
37
40
  return isDurationString;
38
41
  },
39
- intervalToPrometheusDuration: function() {
40
- return intervalToPrometheusDuration;
42
+ isRelativeTimeRange: function() {
43
+ return isRelativeTimeRange;
41
44
  },
42
45
  msToPrometheusDuration: function() {
43
46
  return msToPrometheusDuration;
44
47
  },
45
- formatDuration: function() {
46
- return formatDuration;
48
+ parseDurationString: function() {
49
+ return parseDurationString;
47
50
  },
48
51
  roundStepInterval: function() {
49
52
  return roundStepInterval;
50
53
  },
51
- getSuggestedStepMs: function() {
52
- return getSuggestedStepMs;
54
+ toAbsoluteTimeRange: function() {
55
+ return toAbsoluteTimeRange;
53
56
  }
54
57
  });
55
58
  const _datefns = require("date-fns");
@@ -66,8 +69,7 @@ function isAbsoluteTimeRange(timeRange) {
66
69
  return timeRange.start !== undefined && timeRange.end !== undefined;
67
70
  }
68
71
  function toAbsoluteTimeRange(timeRange) {
69
- var _timeRange_end;
70
- const end = (_timeRange_end = timeRange.end) !== null && _timeRange_end !== void 0 ? _timeRange_end : new Date();
72
+ const end = timeRange.end ?? new Date();
71
73
  return {
72
74
  start: (0, _datefns.sub)(end, parseDurationString(timeRange.pastDuration)),
73
75
  end
@@ -79,15 +81,14 @@ function parseDurationString(durationString) {
79
81
  if (matches === null) {
80
82
  throw new Error(`Invalid duration string '${durationString}'`);
81
83
  }
82
- var _matches_, _matches_1, _matches_2, _matches_3, _matches_4, _matches_5, _matches_6;
83
84
  return {
84
- years: parseInt((_matches_ = matches[1]) !== null && _matches_ !== void 0 ? _matches_ : '0'),
85
+ years: parseInt(matches[1] ?? '0'),
85
86
  months: 0,
86
- weeks: parseInt((_matches_1 = matches[2]) !== null && _matches_1 !== void 0 ? _matches_1 : '0'),
87
- days: parseInt((_matches_2 = matches[3]) !== null && _matches_2 !== void 0 ? _matches_2 : '0'),
88
- hours: parseInt((_matches_3 = matches[4]) !== null && _matches_3 !== void 0 ? _matches_3 : '0'),
89
- minutes: parseInt((_matches_4 = matches[5]) !== null && _matches_4 !== void 0 ? _matches_4 : '0'),
90
- seconds: parseInt((_matches_5 = matches[6]) !== null && _matches_5 !== void 0 ? _matches_5 : '0') + parseInt((_matches_6 = matches[7]) !== null && _matches_6 !== void 0 ? _matches_6 : '0') / 1000
87
+ weeks: parseInt(matches[2] ?? '0'),
88
+ days: parseInt(matches[3] ?? '0'),
89
+ hours: parseInt(matches[4] ?? '0'),
90
+ minutes: parseInt(matches[5] ?? '0'),
91
+ seconds: parseInt(matches[6] ?? '0') + parseInt(matches[7] ?? '0') / 1000
91
92
  };
92
93
  }
93
94
  function isDurationString(maybeDuration) {
@@ -141,7 +142,7 @@ function formatDuration(duration) {
141
142
  if (seconds) {
142
143
  result.push(`${seconds}s`);
143
144
  }
144
- const ms = (duration.seconds - seconds) * 1000;
145
+ const ms = Math.round((duration.seconds - seconds) * 1000);
145
146
  if (ms) {
146
147
  result.push(`${ms}ms`);
147
148
  }
@@ -326,7 +327,7 @@ const ROUNDED_STEP_INTERVALS = [
326
327
  }
327
328
  ];
328
329
  function roundStepInterval(stepMs) {
329
- for (const { maxMs , roundedStepMs } of ROUNDED_STEP_INTERVALS){
330
+ for (const { maxMs, roundedStepMs } of ROUNDED_STEP_INTERVALS){
330
331
  if (stepMs < maxMs) {
331
332
  return roundedStepMs;
332
333
  }
@@ -10,7 +10,35 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- "use strict";
13
+ /**
14
+ * Common types
15
+ */ "use strict";
14
16
  Object.defineProperty(exports, "__esModule", {
15
17
  value: true
16
18
  });
19
+ function _export(target, all) {
20
+ for(var name in all)Object.defineProperty(target, name, {
21
+ enumerable: true,
22
+ get: all[name]
23
+ });
24
+ }
25
+ _export(exports, {
26
+ SpanStatusError: function() {
27
+ return SpanStatusError;
28
+ },
29
+ SpanStatusOk: function() {
30
+ return SpanStatusOk;
31
+ },
32
+ SpanStatusUnset: function() {
33
+ return SpanStatusUnset;
34
+ },
35
+ isValidTraceId: function() {
36
+ return isValidTraceId;
37
+ }
38
+ });
39
+ const SpanStatusUnset = 'STATUS_CODE_UNSET';
40
+ const SpanStatusOk = 'STATUS_CODE_OK';
41
+ const SpanStatusError = 'STATUS_CODE_ERROR';
42
+ function isValidTraceId(traceId) {
43
+ return /^[0-9a-fA-F]+$/.test(traceId);
44
+ }
@@ -0,0 +1,28 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "TRANSFORM_TEXT", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return TRANSFORM_TEXT;
21
+ }
22
+ });
23
+ const TRANSFORM_TEXT = {
24
+ JoinByColumnValue: 'Join by column value',
25
+ MergeColumns: 'Merge columns',
26
+ MergeIndexedColumns: 'Merge indexed columns',
27
+ MergeSeries: 'Merge series'
28
+ };
@@ -46,9 +46,6 @@ function _interop_require_default(obj) {
46
46
  * 1 MB = 1,000,000 bytes (1000^2 bytes)
47
47
  * etc.
48
48
  */ const DEFAULT_NUMBRO_MANTISSA = 2;
49
- const bytesUnits = [
50
- 'bytes'
51
- ];
52
49
  const BYTES_GROUP_CONFIG = {
53
50
  label: 'Bytes',
54
51
  decimalPlaces: true,
@@ -60,7 +57,7 @@ const BYTES_UNIT_CONFIG = {
60
57
  label: 'Bytes'
61
58
  }
62
59
  };
63
- function formatBytes(bytes, { shortValues , decimalPlaces }) {
60
+ function formatBytes(bytes, { shortValues, decimalPlaces }) {
64
61
  // If we're showing the entire value, we can use Intl.NumberFormat.
65
62
  if (!(0, _utils.shouldShortenValues)(shortValues) || Math.abs(bytes) < 1000) {
66
63
  const formatterOptions = {
@@ -33,9 +33,6 @@ _export(exports, {
33
33
  });
34
34
  const _constants = require("./constants");
35
35
  const _utils = require("./utils");
36
- const decimalUnits = [
37
- 'decimal'
38
- ];
39
36
  const DECIMAL_GROUP_CONFIG = {
40
37
  label: 'Decimal',
41
38
  decimalPlaces: true,
@@ -47,7 +44,7 @@ const DECIMAL_UNIT_CONFIG = {
47
44
  label: 'Decimal'
48
45
  }
49
46
  };
50
- function formatDecimal(value, { shortValues , decimalPlaces }) {
47
+ function formatDecimal(value, { shortValues, decimalPlaces }) {
51
48
  const formatterOptions = {
52
49
  style: 'decimal',
53
50
  useGrouping: true
@@ -33,11 +33,6 @@ _export(exports, {
33
33
  });
34
34
  const _constants = require("./constants");
35
35
  const _utils = require("./utils");
36
- const percentUnits = [
37
- 'percent',
38
- 'percent-decimal',
39
- '%'
40
- ];
41
36
  const PERCENT_GROUP_CONFIG = {
42
37
  label: 'percent',
43
38
  decimalPlaces: true
@@ -60,7 +55,7 @@ const PERCENT_UNIT_CONFIG = {
60
55
  label: '%'
61
56
  }
62
57
  };
63
- function formatPercent(value, { unit , decimalPlaces }) {
58
+ function formatPercent(value, { unit, decimalPlaces }) {
64
59
  const formatterOptions = {
65
60
  style: 'percent',
66
61
  useGrouping: true
@@ -31,26 +31,23 @@ _export(exports, {
31
31
  return formatThroughput;
32
32
  }
33
33
  });
34
+ const _bytes = require("./bytes");
34
35
  const _constants = require("./constants");
35
36
  const _utils = require("./utils");
36
- const throughputUnits = [
37
- 'counts/sec',
38
- 'events/sec',
39
- 'messages/sec',
40
- 'ops/sec',
41
- 'packets/sec',
42
- 'reads/sec',
43
- 'records/sec',
44
- 'requests/sec',
45
- 'rows/sec',
46
- 'writes/sec'
47
- ];
48
37
  const THROUGHPUT_GROUP_CONFIG = {
49
38
  label: 'Throughput',
50
39
  decimalPlaces: true
51
40
  };
52
41
  const THROUGHPUT_GROUP = 'Throughput';
53
42
  const THROUGHPUT_UNIT_CONFIG = {
43
+ 'bits/sec': {
44
+ group: THROUGHPUT_GROUP,
45
+ label: 'Bits/sec'
46
+ },
47
+ 'bytes/sec': {
48
+ group: THROUGHPUT_GROUP,
49
+ label: 'Bytes/sec'
50
+ },
54
51
  'counts/sec': {
55
52
  group: THROUGHPUT_GROUP,
56
53
  label: 'Counts/sec'
@@ -92,7 +89,16 @@ const THROUGHPUT_UNIT_CONFIG = {
92
89
  label: 'Writes/sec'
93
90
  }
94
91
  };
95
- function formatThroughput(value, { unit , shortValues , decimalPlaces }) {
92
+ function formatThroughput(value, { unit, shortValues, decimalPlaces }) {
93
+ // special case for data throughput
94
+ if (unit === 'bytes/sec') {
95
+ const denominator = Math.abs(value) < 1000 ? 'sec' : 's';
96
+ return (0, _bytes.formatBytes)(value, {
97
+ unit: 'bytes',
98
+ shortValues,
99
+ decimalPlaces
100
+ }) + '/' + denominator;
101
+ }
96
102
  const formatterOptions = {
97
103
  style: 'decimal',
98
104
  useGrouping: true
@@ -36,16 +36,6 @@ _export(exports, {
36
36
  });
37
37
  const _constants = require("./constants");
38
38
  const _utils = require("./utils");
39
- const timeUnits = [
40
- 'milliseconds',
41
- 'seconds',
42
- 'minutes',
43
- 'hours',
44
- 'days',
45
- 'weeks',
46
- 'months',
47
- 'years'
48
- ];
49
39
  const TIME_GROUP = 'Time';
50
40
  const TIME_GROUP_CONFIG = {
51
41
  label: 'Time',
@@ -87,14 +77,14 @@ const TIME_UNIT_CONFIG = {
87
77
  };
88
78
  var PersesTimeToIntlTime;
89
79
  (function(PersesTimeToIntlTime) {
90
- PersesTimeToIntlTime["milliseconds"] = 'millisecond';
91
- PersesTimeToIntlTime["seconds"] = 'second';
92
- PersesTimeToIntlTime["minutes"] = 'minute';
93
- PersesTimeToIntlTime["hours"] = 'hour';
94
- PersesTimeToIntlTime["days"] = 'day';
95
- PersesTimeToIntlTime["weeks"] = 'week';
96
- PersesTimeToIntlTime["months"] = 'month';
97
- PersesTimeToIntlTime["years"] = 'year';
80
+ PersesTimeToIntlTime["milliseconds"] = "millisecond";
81
+ PersesTimeToIntlTime["seconds"] = "second";
82
+ PersesTimeToIntlTime["minutes"] = "minute";
83
+ PersesTimeToIntlTime["hours"] = "hour";
84
+ PersesTimeToIntlTime["days"] = "day";
85
+ PersesTimeToIntlTime["weeks"] = "week";
86
+ PersesTimeToIntlTime["months"] = "month";
87
+ PersesTimeToIntlTime["years"] = "year";
98
88
  })(PersesTimeToIntlTime || (PersesTimeToIntlTime = {}));
99
89
  /**
100
90
  * Note: This conversion will not be exactly accurate for months and years,
@@ -147,7 +137,7 @@ const LARGEST_TO_SMALLEST_TIME_UNITS = [
147
137
  function isMonthOrYear(unit) {
148
138
  return unit === 'months' || unit === 'years';
149
139
  }
150
- function formatTime(value, { unit , decimalPlaces }) {
140
+ function formatTime(value, { unit, decimalPlaces }) {
151
141
  if (value === 0) return '0s';
152
142
  const results = getValueAndKindForNaturalNumbers(value, unit);
153
143
  const formatterOptions = {
@@ -16,16 +16,3 @@
16
16
  Object.defineProperty(exports, "__esModule", {
17
17
  value: true
18
18
  });
19
- Object.defineProperty(exports, "UNIT_GROUPS", {
20
- enumerable: true,
21
- get: function() {
22
- return UNIT_GROUPS;
23
- }
24
- });
25
- const UNIT_GROUPS = [
26
- 'Time',
27
- 'Percent',
28
- 'Decimal',
29
- 'Bytes',
30
- 'Throughput'
31
- ];
@@ -21,12 +21,12 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- UNIT_GROUP_CONFIG: function() {
25
- return UNIT_GROUP_CONFIG;
26
- },
27
24
  UNIT_CONFIG: function() {
28
25
  return UNIT_CONFIG;
29
26
  },
27
+ UNIT_GROUP_CONFIG: function() {
28
+ return UNIT_GROUP_CONFIG;
29
+ },
30
30
  formatValue: function() {
31
31
  return formatValue;
32
32
  },
@@ -39,26 +39,26 @@ _export(exports, {
39
39
  getUnitGroupConfig: function() {
40
40
  return getUnitGroupConfig;
41
41
  },
42
- isTimeUnit: function() {
43
- return isTimeUnit;
42
+ isBytesUnit: function() {
43
+ return isBytesUnit;
44
+ },
45
+ isDecimalUnit: function() {
46
+ return isDecimalUnit;
44
47
  },
45
48
  isPercentUnit: function() {
46
49
  return isPercentUnit;
47
50
  },
48
- isDecimalUnit: function() {
49
- return isDecimalUnit;
51
+ isThroughputUnit: function() {
52
+ return isThroughputUnit;
50
53
  },
51
- isBytesUnit: function() {
52
- return isBytesUnit;
54
+ isTimeUnit: function() {
55
+ return isTimeUnit;
53
56
  },
54
57
  isUnitWithDecimalPlaces: function() {
55
58
  return isUnitWithDecimalPlaces;
56
59
  },
57
60
  isUnitWithShortValues: function() {
58
61
  return isUnitWithShortValues;
59
- },
60
- isThroughputUnit: function() {
61
- return isThroughputUnit;
62
62
  }
63
63
  });
64
64
  const _bytes = require("./bytes");
@@ -133,5 +133,5 @@ function isUnitWithShortValues(formatOptions) {
133
133
  return !!groupConfig.shortValues;
134
134
  }
135
135
  function isThroughputUnit(formatOptions) {
136
- return getUnitGroup(formatOptions) == 'Throughput';
136
+ return getUnitGroup(formatOptions) === 'Throughput';
137
137
  }
@@ -21,14 +21,14 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- shouldShortenValues: function() {
25
- return shouldShortenValues;
26
- },
27
24
  hasDecimalPlaces: function() {
28
25
  return hasDecimalPlaces;
29
26
  },
30
27
  limitDecimalPlaces: function() {
31
28
  return limitDecimalPlaces;
29
+ },
30
+ shouldShortenValues: function() {
31
+ return shouldShortenValues;
32
32
  }
33
33
  });
34
34
  function shouldShortenValues(shortValues) {
@@ -0,0 +1,16 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });