@perses-dev/core 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 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 (210) hide show
  1. package/dist/cjs/index.js +1 -0
  2. package/dist/cjs/model/calculations.js +1 -1
  3. package/dist/cjs/model/index.js +3 -0
  4. package/dist/cjs/model/query.js +12 -0
  5. package/dist/cjs/model/resource.js +14 -3
  6. package/dist/cjs/model/time.js +9 -11
  7. package/dist/cjs/model/trace-data.js +29 -1
  8. package/dist/cjs/model/transforms.js +28 -0
  9. package/dist/cjs/model/units/bytes.js +0 -3
  10. package/dist/cjs/model/units/decimal.js +0 -3
  11. package/dist/cjs/model/units/percent.js +0 -5
  12. package/dist/cjs/model/units/throughput.js +18 -12
  13. package/dist/cjs/model/units/time.js +0 -10
  14. package/dist/cjs/model/units/types.js +0 -13
  15. package/dist/cjs/model/units/units.js +1 -1
  16. package/dist/cjs/model/user.js +16 -0
  17. package/dist/cjs/model/value-mapping.js +16 -0
  18. package/dist/cjs/schema/datasource.js +85 -0
  19. package/dist/cjs/schema/display.js +27 -0
  20. package/dist/cjs/schema/duration.js +25 -0
  21. package/dist/cjs/schema/index.js +40 -0
  22. package/dist/cjs/schema/metadata.js +41 -0
  23. package/dist/cjs/schema/panel.js +106 -0
  24. package/dist/cjs/schema/plugin.js +27 -0
  25. package/dist/cjs/schema/role.js +86 -0
  26. package/dist/cjs/schema/rolebinding.js +65 -0
  27. package/dist/cjs/schema/secret.js +174 -0
  28. package/dist/cjs/schema/user.js +57 -0
  29. package/dist/cjs/schema/variable.js +171 -0
  30. package/dist/cjs/utils/fetch.js +14 -20
  31. package/dist/cjs/utils/index.js +3 -0
  32. package/dist/cjs/utils/memo.js +1 -2
  33. package/dist/cjs/utils/regexp.js +54 -0
  34. package/dist/cjs/utils/text.js +21 -46
  35. package/dist/cjs/utils/transform-data.js +167 -0
  36. package/dist/cjs/utils/value-mapping.js +105 -0
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/model/calculations.d.ts +1 -1
  42. package/dist/model/calculations.d.ts.map +1 -1
  43. package/dist/model/calculations.js +1 -1
  44. package/dist/model/calculations.js.map +1 -1
  45. package/dist/model/datasource.d.ts +8 -8
  46. package/dist/model/datasource.d.ts.map +1 -1
  47. package/dist/model/datasource.js.map +1 -1
  48. package/dist/model/http.d.ts +5 -0
  49. package/dist/model/http.d.ts.map +1 -1
  50. package/dist/model/http.js.map +1 -1
  51. package/dist/model/index.d.ts +3 -0
  52. package/dist/model/index.d.ts.map +1 -1
  53. package/dist/model/index.js +3 -0
  54. package/dist/model/index.js.map +1 -1
  55. package/dist/model/legend.d.ts +3 -3
  56. package/dist/model/legend.d.ts.map +1 -1
  57. package/dist/model/legend.js.map +1 -1
  58. package/dist/model/panels.d.ts +17 -1
  59. package/dist/model/panels.d.ts.map +1 -1
  60. package/dist/model/panels.js +1 -1
  61. package/dist/model/panels.js.map +1 -1
  62. package/dist/model/project.d.ts +5 -0
  63. package/dist/model/project.d.ts.map +1 -1
  64. package/dist/model/project.js.map +1 -1
  65. package/dist/model/query.d.ts +10 -0
  66. package/dist/model/query.d.ts.map +1 -1
  67. package/dist/model/query.js +8 -3
  68. package/dist/model/query.js.map +1 -1
  69. package/dist/model/resource.d.ts +7 -0
  70. package/dist/model/resource.d.ts.map +1 -1
  71. package/dist/model/resource.js +3 -0
  72. package/dist/model/resource.js.map +1 -1
  73. package/dist/model/time-series-data.d.ts +1 -0
  74. package/dist/model/time-series-data.d.ts.map +1 -1
  75. package/dist/model/time-series-data.js.map +1 -1
  76. package/dist/model/time.d.ts.map +1 -1
  77. package/dist/model/time.js +9 -11
  78. package/dist/model/time.js.map +1 -1
  79. package/dist/model/trace-data.d.ts +80 -7
  80. package/dist/model/trace-data.d.ts.map +1 -1
  81. package/dist/model/trace-data.js +7 -3
  82. package/dist/model/trace-data.js.map +1 -1
  83. package/dist/model/transforms.d.ts +34 -0
  84. package/dist/model/transforms.d.ts.map +1 -0
  85. package/dist/model/transforms.js +21 -0
  86. package/dist/model/transforms.js.map +1 -0
  87. package/dist/model/units/bytes.d.ts +1 -2
  88. package/dist/model/units/bytes.d.ts.map +1 -1
  89. package/dist/model/units/bytes.js +0 -3
  90. package/dist/model/units/bytes.js.map +1 -1
  91. package/dist/model/units/decimal.d.ts +1 -2
  92. package/dist/model/units/decimal.d.ts.map +1 -1
  93. package/dist/model/units/decimal.js +0 -3
  94. package/dist/model/units/decimal.js.map +1 -1
  95. package/dist/model/units/percent.d.ts +1 -2
  96. package/dist/model/units/percent.d.ts.map +1 -1
  97. package/dist/model/units/percent.js +0 -5
  98. package/dist/model/units/percent.js.map +1 -1
  99. package/dist/model/units/throughput.d.ts +1 -2
  100. package/dist/model/units/throughput.d.ts.map +1 -1
  101. package/dist/model/units/throughput.js +18 -12
  102. package/dist/model/units/throughput.js.map +1 -1
  103. package/dist/model/units/time.d.ts +1 -2
  104. package/dist/model/units/time.d.ts.map +1 -1
  105. package/dist/model/units/time.js +0 -10
  106. package/dist/model/units/time.js.map +1 -1
  107. package/dist/model/units/types.d.ts +1 -2
  108. package/dist/model/units/types.d.ts.map +1 -1
  109. package/dist/model/units/types.js +1 -7
  110. package/dist/model/units/types.js.map +1 -1
  111. package/dist/model/units/units.d.ts +2 -0
  112. package/dist/model/units/units.d.ts.map +1 -1
  113. package/dist/model/units/units.js +1 -1
  114. package/dist/model/units/units.js.map +1 -1
  115. package/dist/model/units/utils.d.ts.map +1 -1
  116. package/dist/model/units/utils.js.map +1 -1
  117. package/dist/model/user.d.ts +21 -0
  118. package/dist/model/user.d.ts.map +1 -0
  119. package/dist/model/user.js +15 -0
  120. package/dist/model/user.js.map +1 -0
  121. package/dist/model/value-mapping.d.ts +35 -0
  122. package/dist/model/value-mapping.d.ts.map +1 -0
  123. package/dist/model/value-mapping.js +15 -0
  124. package/dist/model/value-mapping.js.map +1 -0
  125. package/dist/model/variables.d.ts +9 -8
  126. package/dist/model/variables.d.ts.map +1 -1
  127. package/dist/model/variables.js.map +1 -1
  128. package/dist/schema/datasource.d.ts +61 -0
  129. package/dist/schema/datasource.d.ts.map +1 -0
  130. package/dist/schema/datasource.js +54 -0
  131. package/dist/schema/datasource.js.map +1 -0
  132. package/dist/schema/display.d.ts +12 -0
  133. package/dist/schema/display.d.ts.map +1 -0
  134. package/dist/schema/display.js +19 -0
  135. package/dist/schema/display.js.map +1 -0
  136. package/dist/schema/duration.d.ts +3 -0
  137. package/dist/schema/duration.d.ts.map +1 -0
  138. package/dist/schema/duration.js +17 -0
  139. package/dist/schema/duration.js.map +1 -0
  140. package/dist/schema/index.d.ts +12 -0
  141. package/dist/schema/index.d.ts.map +1 -0
  142. package/dist/schema/index.js +25 -0
  143. package/dist/schema/index.js.map +1 -0
  144. package/dist/schema/metadata.d.ts +21 -0
  145. package/dist/schema/metadata.d.ts.map +1 -0
  146. package/dist/schema/metadata.js +22 -0
  147. package/dist/schema/metadata.js.map +1 -0
  148. package/dist/schema/panel.d.ts +13 -0
  149. package/dist/schema/panel.d.ts.map +1 -0
  150. package/dist/schema/panel.js +69 -0
  151. package/dist/schema/panel.js.map +1 -0
  152. package/dist/schema/plugin.d.ts +14 -0
  153. package/dist/schema/plugin.d.ts.map +1 -0
  154. package/dist/schema/plugin.js +19 -0
  155. package/dist/schema/plugin.js.map +1 -0
  156. package/dist/schema/role.d.ts +58 -0
  157. package/dist/schema/role.d.ts.map +1 -0
  158. package/dist/schema/role.js +61 -0
  159. package/dist/schema/role.js.map +1 -0
  160. package/dist/schema/rolebinding.d.ts +58 -0
  161. package/dist/schema/rolebinding.d.ts.map +1 -0
  162. package/dist/schema/rolebinding.js +40 -0
  163. package/dist/schema/rolebinding.js.map +1 -0
  164. package/dist/schema/secret.d.ts +1140 -0
  165. package/dist/schema/secret.d.ts.map +1 -0
  166. package/dist/schema/secret.js +152 -0
  167. package/dist/schema/secret.js.map +1 -0
  168. package/dist/schema/user.d.ts +8 -0
  169. package/dist/schema/user.d.ts.map +1 -0
  170. package/dist/schema/user.js +36 -0
  171. package/dist/schema/user.js.map +1 -0
  172. package/dist/schema/variable.d.ts +92 -0
  173. package/dist/schema/variable.d.ts.map +1 -0
  174. package/dist/schema/variable.js +119 -0
  175. package/dist/schema/variable.js.map +1 -0
  176. package/dist/utils/fetch.d.ts +5 -2
  177. package/dist/utils/fetch.d.ts.map +1 -1
  178. package/dist/utils/fetch.js +15 -21
  179. package/dist/utils/fetch.js.map +1 -1
  180. package/dist/utils/index.d.ts +3 -0
  181. package/dist/utils/index.d.ts.map +1 -1
  182. package/dist/utils/index.js +3 -0
  183. package/dist/utils/index.js.map +1 -1
  184. package/dist/utils/is-empty-object.d.ts.map +1 -1
  185. package/dist/utils/is-empty-object.js.map +1 -1
  186. package/dist/utils/memo.d.ts.map +1 -1
  187. package/dist/utils/memo.js +1 -2
  188. package/dist/utils/memo.js.map +1 -1
  189. package/dist/utils/panel-refs.d.ts +2 -2
  190. package/dist/utils/panel-refs.d.ts.map +1 -1
  191. package/dist/utils/panel-refs.js.map +1 -1
  192. package/dist/utils/regexp.d.ts +11 -0
  193. package/dist/utils/regexp.d.ts.map +1 -0
  194. package/dist/utils/regexp.js +42 -0
  195. package/dist/utils/regexp.js.map +1 -0
  196. package/dist/utils/text.d.ts +7 -33
  197. package/dist/utils/text.d.ts.map +1 -1
  198. package/dist/utils/text.js +21 -52
  199. package/dist/utils/text.js.map +1 -1
  200. package/dist/utils/time-series-data.d.ts.map +1 -1
  201. package/dist/utils/time-series-data.js.map +1 -1
  202. package/dist/utils/transform-data.d.ts +8 -0
  203. package/dist/utils/transform-data.d.ts.map +1 -0
  204. package/dist/utils/transform-data.js +221 -0
  205. package/dist/utils/transform-data.js.map +1 -0
  206. package/dist/utils/value-mapping.d.ts +3 -0
  207. package/dist/utils/value-mapping.d.ts.map +1 -0
  208. package/dist/utils/value-mapping.js +97 -0
  209. package/dist/utils/value-mapping.js.map +1 -0
  210. 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) {
@@ -37,7 +37,7 @@ _export(exports, {
37
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,
@@ -38,8 +38,11 @@ _export_star(require("./time"), exports);
38
38
  _export_star(require("./time-series-data"), exports);
39
39
  _export_star(require("./time-series-queries"), exports);
40
40
  _export_star(require("./trace-data"), exports);
41
+ _export_star(require("./transforms"), exports);
41
42
  _export_star(require("./units"), exports);
43
+ _export_star(require("./user"), exports);
42
44
  _export_star(require("./variables"), exports);
45
+ _export_star(require("./value-mapping"), exports);
43
46
  function _export_star(from, to) {
44
47
  Object.keys(from).forEach(function(k) {
45
48
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -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
  }
@@ -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
@@ -69,8 +69,7 @@ function isAbsoluteTimeRange(timeRange) {
69
69
  return timeRange.start !== undefined && timeRange.end !== undefined;
70
70
  }
71
71
  function toAbsoluteTimeRange(timeRange) {
72
- var _timeRange_end;
73
- const end = (_timeRange_end = timeRange.end) !== null && _timeRange_end !== void 0 ? _timeRange_end : new Date();
72
+ const end = timeRange.end ?? new Date();
74
73
  return {
75
74
  start: (0, _datefns.sub)(end, parseDurationString(timeRange.pastDuration)),
76
75
  end
@@ -82,15 +81,14 @@ function parseDurationString(durationString) {
82
81
  if (matches === null) {
83
82
  throw new Error(`Invalid duration string '${durationString}'`);
84
83
  }
85
- var _matches_, _matches_1, _matches_2, _matches_3, _matches_4, _matches_5, _matches_6;
86
84
  return {
87
- years: parseInt((_matches_ = matches[1]) !== null && _matches_ !== void 0 ? _matches_ : '0'),
85
+ years: parseInt(matches[1] ?? '0'),
88
86
  months: 0,
89
- weeks: parseInt((_matches_1 = matches[2]) !== null && _matches_1 !== void 0 ? _matches_1 : '0'),
90
- days: parseInt((_matches_2 = matches[3]) !== null && _matches_2 !== void 0 ? _matches_2 : '0'),
91
- hours: parseInt((_matches_3 = matches[4]) !== null && _matches_3 !== void 0 ? _matches_3 : '0'),
92
- minutes: parseInt((_matches_4 = matches[5]) !== null && _matches_4 !== void 0 ? _matches_4 : '0'),
93
- 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
94
92
  };
95
93
  }
96
94
  function isDurationString(maybeDuration) {
@@ -144,7 +142,7 @@ function formatDuration(duration) {
144
142
  if (seconds) {
145
143
  result.push(`${seconds}s`);
146
144
  }
147
- const ms = (duration.seconds - seconds) * 1000;
145
+ const ms = Math.round((duration.seconds - seconds) * 1000);
148
146
  if (ms) {
149
147
  result.push(`${ms}ms`);
150
148
  }
@@ -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,
@@ -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,
@@ -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
@@ -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'
@@ -93,6 +90,15 @@ const THROUGHPUT_UNIT_CONFIG = {
93
90
  }
94
91
  };
95
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',
@@ -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
- ];
@@ -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
  }
@@ -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
+ });
@@ -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
+ });
@@ -0,0 +1,85 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ 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
+ buildDatasourceDefinitionSchema: function() {
25
+ return buildDatasourceDefinitionSchema;
26
+ },
27
+ buildDatasourceSpecSchema: function() {
28
+ return buildDatasourceSpecSchema;
29
+ },
30
+ datasourceDefinitionSchema: function() {
31
+ return datasourceDefinitionSchema;
32
+ },
33
+ datasourceSchema: function() {
34
+ return datasourceSchema;
35
+ },
36
+ datasourceSpecSchema: function() {
37
+ return datasourceSpecSchema;
38
+ },
39
+ datasourcesSchema: function() {
40
+ return datasourcesSchema;
41
+ },
42
+ globalDatasourceSchema: function() {
43
+ return globalDatasourceSchema;
44
+ }
45
+ });
46
+ const _zod = require("zod");
47
+ const _metadata = require("./metadata");
48
+ const _plugin = require("./plugin");
49
+ const _display = require("./display");
50
+ const datasourceSpecSchema = _zod.z.object({
51
+ display: _display.displaySchema.optional(),
52
+ default: _zod.z.boolean(),
53
+ plugin: _plugin.pluginSchema
54
+ });
55
+ function buildDatasourceSpecSchema(pluginSchema) {
56
+ return _zod.z.object({
57
+ display: _display.displaySchema.optional(),
58
+ default: _zod.z.boolean(),
59
+ plugin: pluginSchema
60
+ });
61
+ }
62
+ const datasourceSchema = _zod.z.object({
63
+ kind: _zod.z.literal('Datasource'),
64
+ metadata: _metadata.projectMetadataSchema,
65
+ spec: datasourceSpecSchema
66
+ });
67
+ const globalDatasourceSchema = _zod.z.object({
68
+ kind: _zod.z.literal('GlobalDatasource'),
69
+ metadata: _metadata.metadataSchema,
70
+ spec: datasourceSpecSchema
71
+ });
72
+ const datasourcesSchema = _zod.z.discriminatedUnion('kind', [
73
+ datasourceSchema,
74
+ globalDatasourceSchema
75
+ ]);
76
+ const datasourceDefinitionSchema = _zod.z.object({
77
+ name: _zod.z.string().min(1),
78
+ spec: datasourceSpecSchema
79
+ });
80
+ function buildDatasourceDefinitionSchema(pluginSchema) {
81
+ return _zod.z.object({
82
+ name: _zod.z.string().min(1),
83
+ spec: buildDatasourceSpecSchema(pluginSchema)
84
+ });
85
+ }
@@ -0,0 +1,27 @@
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, "displaySchema", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return displaySchema;
21
+ }
22
+ });
23
+ const _zod = require("zod");
24
+ const displaySchema = _zod.z.object({
25
+ name: _zod.z.string().optional(),
26
+ description: _zod.z.string().optional()
27
+ });
@@ -0,0 +1,25 @@
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, "durationValidationSchema", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return durationValidationSchema;
21
+ }
22
+ });
23
+ const _zod = require("zod");
24
+ const _model = require("../model");
25
+ const durationValidationSchema = _zod.z.string().min(1, 'Required').regex(_model.DURATION_REGEX, 'Must be a valid duration string');
@@ -0,0 +1,40 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _export_star(require("./datasource"), exports);
18
+ _export_star(require("./display"), exports);
19
+ _export_star(require("./duration"), exports);
20
+ _export_star(require("./metadata"), exports);
21
+ _export_star(require("./panel"), exports);
22
+ _export_star(require("./plugin"), exports);
23
+ _export_star(require("./role"), exports);
24
+ _export_star(require("./rolebinding"), exports);
25
+ _export_star(require("./secret"), exports);
26
+ _export_star(require("./user"), exports);
27
+ _export_star(require("./variable"), exports);
28
+ function _export_star(from, to) {
29
+ Object.keys(from).forEach(function(k) {
30
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
31
+ Object.defineProperty(to, k, {
32
+ enumerable: true,
33
+ get: function() {
34
+ return from[k];
35
+ }
36
+ });
37
+ }
38
+ });
39
+ return from;
40
+ }
@@ -0,0 +1,41 @@
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
+ 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
+ metadataSchema: function() {
25
+ return metadataSchema;
26
+ },
27
+ nameSchema: function() {
28
+ return nameSchema;
29
+ },
30
+ projectMetadataSchema: function() {
31
+ return projectMetadataSchema;
32
+ }
33
+ });
34
+ const _zod = require("zod");
35
+ const nameSchema = _zod.z.string().min(1, 'Required').max(75, 'Must be 75 or fewer characters long').regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');
36
+ const metadataSchema = _zod.z.object({
37
+ name: nameSchema
38
+ });
39
+ const projectMetadataSchema = metadataSchema.extend({
40
+ project: nameSchema
41
+ });