@perses-dev/core 0.53.1 → 0.54.0-beta.1

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 (104) hide show
  1. package/dist/cjs/constants/dashboard-defaults.js +3 -3
  2. package/dist/cjs/model/calculations.js +6 -6
  3. package/dist/cjs/model/definitions.js +1 -3
  4. package/dist/cjs/model/folder.js +16 -0
  5. package/dist/cjs/model/index.js +1 -0
  6. package/dist/cjs/model/legend.js +11 -11
  7. package/dist/cjs/model/otlp/index.js +4 -4
  8. package/dist/cjs/model/otlp/trace/v1/trace.js +4 -4
  9. package/dist/cjs/model/resource.js +3 -3
  10. package/dist/cjs/model/roles.js +4 -4
  11. package/dist/cjs/model/time.js +21 -309
  12. package/dist/cjs/model/units/bits.js +4 -4
  13. package/dist/cjs/model/units/bytes.js +4 -4
  14. package/dist/cjs/model/units/currency.js +4 -4
  15. package/dist/cjs/model/units/date.js +4 -4
  16. package/dist/cjs/model/units/decimal.js +4 -4
  17. package/dist/cjs/model/units/formatterCache.js +3 -3
  18. package/dist/cjs/model/units/percent.js +4 -4
  19. package/dist/cjs/model/units/temperature.js +4 -4
  20. package/dist/cjs/model/units/throughput.js +4 -4
  21. package/dist/cjs/model/units/time.js +5 -5
  22. package/dist/cjs/model/units/units.js +18 -18
  23. package/dist/cjs/model/units/utils.js +4 -4
  24. package/dist/cjs/model/variables.js +3 -3
  25. package/dist/cjs/schema/datasource.js +13 -29
  26. package/dist/cjs/schema/display.js +2 -6
  27. package/dist/cjs/schema/duration.js +2 -4
  28. package/dist/cjs/schema/metadata.js +4 -4
  29. package/dist/cjs/schema/panel.js +20 -73
  30. package/dist/cjs/schema/plugin.js +2 -6
  31. package/dist/cjs/schema/role.js +6 -6
  32. package/dist/cjs/schema/rolebinding.js +6 -6
  33. package/dist/cjs/schema/secret.js +5 -5
  34. package/dist/cjs/schema/user.js +5 -5
  35. package/dist/cjs/schema/variable.js +24 -137
  36. package/dist/cjs/utils/fetch.js +5 -5
  37. package/dist/cjs/utils/panel-refs.js +4 -4
  38. package/dist/cjs/utils/regexp.js +3 -3
  39. package/dist/cjs/utils/text.js +7 -7
  40. package/dist/cjs/utils/time-series-data.js +4 -4
  41. package/dist/cjs/utils/transform-data.js +6 -6
  42. package/dist/model/dashboard.d.ts +2 -21
  43. package/dist/model/dashboard.d.ts.map +1 -1
  44. package/dist/model/dashboard.js.map +1 -1
  45. package/dist/model/datasource.d.ts +3 -22
  46. package/dist/model/datasource.d.ts.map +1 -1
  47. package/dist/model/datasource.js +1 -3
  48. package/dist/model/datasource.js.map +1 -1
  49. package/dist/model/definitions.d.ts +1 -12
  50. package/dist/model/definitions.d.ts.map +1 -1
  51. package/dist/model/definitions.js +1 -6
  52. package/dist/model/definitions.js.map +1 -1
  53. package/dist/model/display.d.ts +1 -4
  54. package/dist/model/display.d.ts.map +1 -1
  55. package/dist/model/display.js.map +1 -1
  56. package/dist/model/folder.d.ts +19 -0
  57. package/dist/model/folder.d.ts.map +1 -0
  58. package/dist/model/folder.js +15 -0
  59. package/dist/model/folder.js.map +1 -0
  60. package/dist/model/index.d.ts +1 -0
  61. package/dist/model/index.d.ts.map +1 -1
  62. package/dist/model/index.js +1 -0
  63. package/dist/model/index.js.map +1 -1
  64. package/dist/model/project.d.ts +1 -1
  65. package/dist/model/project.d.ts.map +1 -1
  66. package/dist/model/project.js.map +1 -1
  67. package/dist/model/resource.d.ts +1 -1
  68. package/dist/model/resource.d.ts.map +1 -1
  69. package/dist/model/resource.js.map +1 -1
  70. package/dist/model/time.d.ts +3 -54
  71. package/dist/model/time.d.ts.map +1 -1
  72. package/dist/model/time.js +2 -299
  73. package/dist/model/time.js.map +1 -1
  74. package/dist/schema/datasource.d.ts +10 -9
  75. package/dist/schema/datasource.d.ts.map +1 -1
  76. package/dist/schema/datasource.js +2 -14
  77. package/dist/schema/datasource.js.map +1 -1
  78. package/dist/schema/display.d.ts +1 -11
  79. package/dist/schema/display.d.ts.map +1 -1
  80. package/dist/schema/display.js +1 -5
  81. package/dist/schema/display.js.map +1 -1
  82. package/dist/schema/duration.d.ts +1 -2
  83. package/dist/schema/duration.d.ts.map +1 -1
  84. package/dist/schema/duration.js +1 -3
  85. package/dist/schema/duration.js.map +1 -1
  86. package/dist/schema/panel.d.ts +1 -12
  87. package/dist/schema/panel.d.ts.map +1 -1
  88. package/dist/schema/panel.js +1 -54
  89. package/dist/schema/panel.js.map +1 -1
  90. package/dist/schema/plugin.d.ts +2 -13
  91. package/dist/schema/plugin.d.ts.map +1 -1
  92. package/dist/schema/plugin.js +1 -5
  93. package/dist/schema/plugin.js.map +1 -1
  94. package/dist/schema/role.d.ts +4 -4
  95. package/dist/schema/rolebinding.d.ts +4 -4
  96. package/dist/schema/secret.d.ts +70 -70
  97. package/dist/schema/variable.d.ts +1 -91
  98. package/dist/schema/variable.d.ts.map +1 -1
  99. package/dist/schema/variable.js +1 -105
  100. package/dist/schema/variable.js.map +1 -1
  101. package/dist/utils/fetch.js.map +1 -1
  102. package/dist/utils/text.js +4 -4
  103. package/dist/utils/text.js.map +1 -1
  104. package/package.json +3 -2
@@ -17,14 +17,14 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- DEFAULT_DASHBOARD_DURATION: function() {
24
+ get DEFAULT_DASHBOARD_DURATION () {
25
25
  return DEFAULT_DASHBOARD_DURATION;
26
26
  },
27
- DEFAULT_REFRESH_INTERVAL: function() {
27
+ get DEFAULT_REFRESH_INTERVAL () {
28
28
  return DEFAULT_REFRESH_INTERVAL;
29
29
  }
30
30
  });
@@ -17,23 +17,23 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- CALCULATIONS_CONFIG: function() {
24
+ get CALCULATIONS_CONFIG () {
25
25
  return CALCULATIONS_CONFIG;
26
26
  },
27
- CalculationsMap: function() {
27
+ get CalculationsMap () {
28
28
  return CalculationsMap;
29
29
  },
30
- DEFAULT_CALCULATION: function() {
30
+ get DEFAULT_CALCULATION () {
31
31
  return DEFAULT_CALCULATION;
32
32
  },
33
- getCalculation: function() {
33
+ get getCalculation () {
34
34
  return getCalculation;
35
35
  },
36
- getCalculations: function() {
36
+ get getCalculations () {
37
37
  return getCalculations;
38
38
  }
39
39
  });
@@ -10,9 +10,7 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- /**
14
- * Base type for definitions in JSON config resources.
15
- */ "use strict";
13
+ "use strict";
16
14
  Object.defineProperty(exports, "__esModule", {
17
15
  value: true
18
16
  });
@@ -0,0 +1,16 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -22,6 +22,7 @@ _export_star(require("./definitions"), exports);
22
22
  _export_star(require("./display"), exports);
23
23
  _export_star(require("./ephemeraldashboard"), exports);
24
24
  _export_star(require("./external-variable"), exports);
25
+ _export_star(require("./folder"), exports);
25
26
  _export_star(require("./http"), exports);
26
27
  _export_star(require("./http-proxy"), exports);
27
28
  _export_star(require("./kind"), exports);
@@ -21,38 +21,38 @@ Object.defineProperty(exports, "__esModule", {
21
21
  function _export(target, all) {
22
22
  for(var name in all)Object.defineProperty(target, name, {
23
23
  enumerable: true,
24
- get: all[name]
24
+ get: Object.getOwnPropertyDescriptor(all, name).get
25
25
  });
26
26
  }
27
27
  _export(exports, {
28
- DEFAULT_LEGEND: function() {
28
+ get DEFAULT_LEGEND () {
29
29
  return DEFAULT_LEGEND;
30
30
  },
31
- getLegendMode: function() {
31
+ get getLegendMode () {
32
32
  return getLegendMode;
33
33
  },
34
- getLegendPosition: function() {
34
+ get getLegendPosition () {
35
35
  return getLegendPosition;
36
36
  },
37
- getLegendSize: function() {
37
+ get getLegendSize () {
38
38
  return getLegendSize;
39
39
  },
40
- isValidLegendMode: function() {
40
+ get isValidLegendMode () {
41
41
  return isValidLegendMode;
42
42
  },
43
- isValidLegendPosition: function() {
43
+ get isValidLegendPosition () {
44
44
  return isValidLegendPosition;
45
45
  },
46
- isValidLegendSize: function() {
46
+ get isValidLegendSize () {
47
47
  return isValidLegendSize;
48
48
  },
49
- legendModes: function() {
49
+ get legendModes () {
50
50
  return legendModes;
51
51
  },
52
- legendPositions: function() {
52
+ get legendPositions () {
53
53
  return legendPositions;
54
54
  },
55
- legendSizes: function() {
55
+ get legendSizes () {
56
56
  return legendSizes;
57
57
  }
58
58
  });
@@ -17,17 +17,17 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- otlpcommonv1: function() {
24
+ get otlpcommonv1 () {
25
25
  return _common;
26
26
  },
27
- otlpresourcev1: function() {
27
+ get otlpresourcev1 () {
28
28
  return _resource;
29
29
  },
30
- otlptracev1: function() {
30
+ get otlptracev1 () {
31
31
  return _trace;
32
32
  }
33
33
  });
@@ -17,17 +17,17 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- StatusCodeError: function() {
24
+ get StatusCodeError () {
25
25
  return StatusCodeError;
26
26
  },
27
- StatusCodeOk: function() {
27
+ get StatusCodeOk () {
28
28
  return StatusCodeOk;
29
29
  },
30
- StatusCodeUnset: function() {
30
+ get StatusCodeUnset () {
31
31
  return StatusCodeUnset;
32
32
  }
33
33
  });
@@ -17,14 +17,14 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- getMetadataProject: function() {
24
+ get getMetadataProject () {
25
25
  return getMetadataProject;
26
26
  },
27
- isProjectMetadata: function() {
27
+ get isProjectMetadata () {
28
28
  return isProjectMetadata;
29
29
  }
30
30
  });
@@ -17,17 +17,17 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- ACTIONS: function() {
24
+ get ACTIONS () {
25
25
  return ACTIONS;
26
26
  },
27
- GLOBAL_SCOPES: function() {
27
+ get GLOBAL_SCOPES () {
28
28
  return GLOBAL_SCOPES;
29
29
  },
30
- PROJECT_SCOPES: function() {
30
+ get PROJECT_SCOPES () {
31
31
  return PROJECT_SCOPES;
32
32
  }
33
33
  });
@@ -10,6 +10,7 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
+ // 1. Runtime code like functions and consts
13
14
  "use strict";
14
15
  Object.defineProperty(exports, "__esModule", {
15
16
  value: true
@@ -17,325 +18,36 @@ Object.defineProperty(exports, "__esModule", {
17
18
  function _export(target, all) {
18
19
  for(var name in all)Object.defineProperty(target, name, {
19
20
  enumerable: true,
20
- get: all[name]
21
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
22
  });
22
23
  }
23
24
  _export(exports, {
24
- DURATION_REGEX: function() {
25
- return DURATION_REGEX;
25
+ get DURATION_REGEX () {
26
+ return _spec.DURATION_REGEX;
26
27
  },
27
- formatDuration: function() {
28
- return formatDuration;
28
+ get formatDuration () {
29
+ return _spec.formatDuration;
29
30
  },
30
- getSuggestedStepMs: function() {
31
- return getSuggestedStepMs;
31
+ get getSuggestedStepMs () {
32
+ return _spec.getSuggestedStepMs;
32
33
  },
33
- intervalToPrometheusDuration: function() {
34
- return intervalToPrometheusDuration;
34
+ get intervalToPrometheusDuration () {
35
+ return _spec.intervalToDuration;
35
36
  },
36
- isAbsoluteTimeRange: function() {
37
- return isAbsoluteTimeRange;
37
+ get isAbsoluteTimeRange () {
38
+ return _spec.isAbsoluteTimeRange;
38
39
  },
39
- isDurationString: function() {
40
- return isDurationString;
40
+ get isRelativeTimeRange () {
41
+ return _spec.isRelativeTimeRange;
41
42
  },
42
- isRelativeTimeRange: function() {
43
- return isRelativeTimeRange;
43
+ get parseDurationString () {
44
+ return _spec.parseDurationString;
44
45
  },
45
- msToPrometheusDuration: function() {
46
- return msToPrometheusDuration;
46
+ get roundStepInterval () {
47
+ return _spec.roundStepInterval;
47
48
  },
48
- parseDurationString: function() {
49
- return parseDurationString;
50
- },
51
- roundStepInterval: function() {
52
- return roundStepInterval;
53
- },
54
- toAbsoluteTimeRange: function() {
55
- return toAbsoluteTimeRange;
49
+ get toAbsoluteTimeRange () {
50
+ return _spec.toAbsoluteTimeRange;
56
51
  }
57
52
  });
58
- const _datefns = require("date-fns");
59
- const ONE_SECOND_IN_MS = 1000;
60
- const ONE_MINUTE_IN_MS = 60000;
61
- const ONE_HOUR_IN_MS = 3600000;
62
- const ONE_DAY_IN_MS = 86400000; // assuming a day has always 24h
63
- const ONE_WEEK_IN_MS = 604800000; // assuming a week has always 7d
64
- const ONE_YEAR_IN_MS = 31536000000; // assuming a year has always 365d
65
- function isRelativeTimeRange(timeRange) {
66
- return timeRange.pastDuration !== undefined;
67
- }
68
- function isAbsoluteTimeRange(timeRange) {
69
- return timeRange.start !== undefined && timeRange.end !== undefined;
70
- }
71
- function toAbsoluteTimeRange(timeRange) {
72
- const end = timeRange.end ?? new Date();
73
- return {
74
- start: (0, _datefns.sub)(end, parseDurationString(timeRange.pastDuration)),
75
- end
76
- };
77
- }
78
- const DURATION_REGEX = /^(?:(\d+)y)?(?:(\d+)w)?(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?(?:(\d+)ms)?$/;
79
- function parseDurationString(durationString) {
80
- const matches = DURATION_REGEX.exec(durationString);
81
- if (matches === null) {
82
- throw new Error(`Invalid duration string '${durationString}'`);
83
- }
84
- return {
85
- years: parseInt(matches[1] ?? '0'),
86
- months: 0,
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
92
- };
93
- }
94
- function isDurationString(maybeDuration) {
95
- if (maybeDuration === '') return false;
96
- return DURATION_REGEX.test(maybeDuration);
97
- }
98
- function intervalToPrometheusDuration(timeRange) {
99
- const durationInMs = timeRange.end.valueOf() - timeRange.start.valueOf();
100
- return msToPrometheusDuration(durationInMs);
101
- }
102
- function msToPrometheusDuration(durationInMs) {
103
- const years = Math.trunc(durationInMs / ONE_YEAR_IN_MS);
104
- if (years > 0) durationInMs -= years * ONE_YEAR_IN_MS;
105
- const weeks = Math.trunc(durationInMs / ONE_WEEK_IN_MS);
106
- if (weeks > 0) durationInMs -= weeks * ONE_WEEK_IN_MS;
107
- const days = Math.trunc(durationInMs / ONE_DAY_IN_MS);
108
- if (days > 0) durationInMs -= days * ONE_DAY_IN_MS;
109
- const hours = Math.trunc(durationInMs / ONE_HOUR_IN_MS);
110
- if (hours > 0) durationInMs -= hours * ONE_HOUR_IN_MS;
111
- const minutes = Math.trunc(durationInMs / ONE_MINUTE_IN_MS);
112
- if (minutes > 0) durationInMs -= minutes * ONE_MINUTE_IN_MS;
113
- return {
114
- years: years,
115
- months: 0,
116
- weeks: weeks,
117
- days: days,
118
- hours: hours,
119
- minutes: minutes,
120
- seconds: durationInMs / 1000
121
- };
122
- }
123
- function formatDuration(duration) {
124
- const result = [];
125
- if (duration.years) {
126
- result.push(`${duration.years}y`);
127
- }
128
- if (duration.weeks) {
129
- result.push(`${duration.weeks}w`);
130
- }
131
- if (duration.days) {
132
- result.push(`${duration.days}d`);
133
- }
134
- if (duration.hours) {
135
- result.push(`${duration.hours}h`);
136
- }
137
- if (duration.minutes) {
138
- result.push(`${duration.minutes}m`);
139
- }
140
- if (duration.seconds) {
141
- const seconds = Math.trunc(duration.seconds);
142
- if (seconds) {
143
- result.push(`${seconds}s`);
144
- }
145
- const ms = Math.round((duration.seconds - seconds) * 1000);
146
- if (ms) {
147
- result.push(`${ms}ms`);
148
- }
149
- }
150
- return result.join('');
151
- }
152
- const DEFAULT_STEP_MS = 15000;
153
- const ROUNDED_STEP_INTERVALS = [
154
- // max: 0.015s
155
- {
156
- maxMs: 15,
157
- roundedStepMs: 10,
158
- display: '0.01s'
159
- },
160
- // max: 0.035s
161
- {
162
- maxMs: 35,
163
- roundedStepMs: 20,
164
- display: '0.02s'
165
- },
166
- // max: 0.075s
167
- {
168
- maxMs: 75,
169
- roundedStepMs: 50,
170
- display: '0.05s'
171
- },
172
- // max: 0.15s
173
- {
174
- maxMs: 150,
175
- roundedStepMs: 100,
176
- display: '0.1s'
177
- },
178
- // max: 0.35s
179
- {
180
- maxMs: 350,
181
- roundedStepMs: 200,
182
- display: '0.2s'
183
- },
184
- // max: 0.75s
185
- {
186
- maxMs: 750,
187
- roundedStepMs: 500,
188
- display: '0.5s'
189
- },
190
- // max: 1.5s
191
- {
192
- maxMs: ONE_SECOND_IN_MS * 1.5,
193
- roundedStepMs: ONE_SECOND_IN_MS,
194
- display: '1s'
195
- },
196
- // max: 3.5s
197
- {
198
- maxMs: ONE_SECOND_IN_MS * 3.5,
199
- roundedStepMs: ONE_SECOND_IN_MS * 2,
200
- display: '2s'
201
- },
202
- // max: 7.5s
203
- {
204
- maxMs: ONE_SECOND_IN_MS * 7.5,
205
- roundedStepMs: ONE_SECOND_IN_MS * 5,
206
- display: '5s'
207
- },
208
- // max: 12.5s
209
- {
210
- maxMs: ONE_SECOND_IN_MS * 12.5,
211
- roundedStepMs: ONE_SECOND_IN_MS * 10,
212
- display: '10s'
213
- },
214
- // max: 17.5s
215
- {
216
- maxMs: ONE_SECOND_IN_MS * 17.5,
217
- roundedStepMs: ONE_SECOND_IN_MS * 15,
218
- display: '15s'
219
- },
220
- // max: 25s
221
- {
222
- maxMs: ONE_SECOND_IN_MS * 25,
223
- roundedStepMs: ONE_SECOND_IN_MS * 20,
224
- display: '20s'
225
- },
226
- // max: 45s
227
- {
228
- maxMs: ONE_SECOND_IN_MS * 45,
229
- roundedStepMs: ONE_SECOND_IN_MS * 30,
230
- display: '30s'
231
- },
232
- // max: 1.5m
233
- {
234
- maxMs: ONE_MINUTE_IN_MS * 1.5,
235
- roundedStepMs: ONE_MINUTE_IN_MS,
236
- display: '1m'
237
- },
238
- // max: 3.5m
239
- {
240
- maxMs: ONE_MINUTE_IN_MS * 3.5,
241
- roundedStepMs: ONE_MINUTE_IN_MS * 2,
242
- display: '2m'
243
- },
244
- // max: 7.5m
245
- {
246
- maxMs: ONE_MINUTE_IN_MS * 7.5,
247
- roundedStepMs: ONE_MINUTE_IN_MS * 5,
248
- display: '5m'
249
- },
250
- // max: 12.5m
251
- {
252
- maxMs: ONE_MINUTE_IN_MS * 12.5,
253
- roundedStepMs: ONE_MINUTE_IN_MS * 10,
254
- display: '10m'
255
- },
256
- // max: 12.5m
257
- {
258
- maxMs: ONE_MINUTE_IN_MS * 12.5,
259
- roundedStepMs: ONE_MINUTE_IN_MS * 15,
260
- display: '15m'
261
- },
262
- // max: 25m
263
- {
264
- maxMs: ONE_MINUTE_IN_MS * 25,
265
- roundedStepMs: ONE_MINUTE_IN_MS * 20,
266
- display: '20m'
267
- },
268
- // max: 45m
269
- {
270
- maxMs: ONE_MINUTE_IN_MS * 45,
271
- roundedStepMs: ONE_MINUTE_IN_MS * 30,
272
- display: '30m'
273
- },
274
- // max: 1.5h
275
- {
276
- maxMs: ONE_HOUR_IN_MS * 1.5,
277
- roundedStepMs: ONE_HOUR_IN_MS,
278
- display: '1h'
279
- },
280
- // max: 2.5h
281
- {
282
- maxMs: ONE_HOUR_IN_MS * 2.5,
283
- roundedStepMs: ONE_HOUR_IN_MS * 2,
284
- display: '2h'
285
- },
286
- // max: 4.5h
287
- {
288
- maxMs: ONE_HOUR_IN_MS * 4.5,
289
- roundedStepMs: ONE_HOUR_IN_MS * 3,
290
- display: '3h'
291
- },
292
- // max: 9h
293
- {
294
- maxMs: ONE_HOUR_IN_MS * 9,
295
- roundedStepMs: ONE_HOUR_IN_MS * 6,
296
- display: '6h'
297
- },
298
- // max: 1d
299
- {
300
- maxMs: ONE_DAY_IN_MS,
301
- roundedStepMs: ONE_HOUR_IN_MS * 12,
302
- display: '12h'
303
- },
304
- // max: 1w
305
- {
306
- maxMs: ONE_WEEK_IN_MS,
307
- roundedStepMs: ONE_DAY_IN_MS,
308
- display: '1d'
309
- },
310
- // max: 3w
311
- {
312
- maxMs: ONE_WEEK_IN_MS * 3,
313
- roundedStepMs: ONE_WEEK_IN_MS,
314
- display: '1w'
315
- },
316
- // max: 6w
317
- {
318
- maxMs: ONE_WEEK_IN_MS * 6,
319
- roundedStepMs: ONE_DAY_IN_MS * 30,
320
- display: '30d'
321
- },
322
- // max: 2y
323
- {
324
- maxMs: ONE_YEAR_IN_MS * 2,
325
- roundedStepMs: ONE_YEAR_IN_MS,
326
- display: '1y'
327
- }
328
- ];
329
- function roundStepInterval(stepMs) {
330
- for (const { maxMs, roundedStepMs } of ROUNDED_STEP_INTERVALS){
331
- if (stepMs < maxMs) {
332
- return roundedStepMs;
333
- }
334
- }
335
- return DEFAULT_STEP_MS;
336
- }
337
- function getSuggestedStepMs(timeRange, width) {
338
- const queryRangeMs = timeRange.end.valueOf() - timeRange.start.valueOf();
339
- const stepMs = Math.floor(queryRangeMs / width);
340
- return roundStepInterval(stepMs);
341
- }
53
+ const _spec = require("@perses-dev/spec");
@@ -17,17 +17,17 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- BITS_GROUP_CONFIG: function() {
24
+ get BITS_GROUP_CONFIG () {
25
25
  return BITS_GROUP_CONFIG;
26
26
  },
27
- BITS_UNIT_CONFIG: function() {
27
+ get BITS_UNIT_CONFIG () {
28
28
  return BITS_UNIT_CONFIG;
29
29
  },
30
- formatBits: function() {
30
+ get formatBits () {
31
31
  return formatBits;
32
32
  }
33
33
  });
@@ -17,17 +17,17 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- BYTES_GROUP_CONFIG: function() {
24
+ get BYTES_GROUP_CONFIG () {
25
25
  return BYTES_GROUP_CONFIG;
26
26
  },
27
- BYTES_UNIT_CONFIG: function() {
27
+ get BYTES_UNIT_CONFIG () {
28
28
  return BYTES_UNIT_CONFIG;
29
29
  },
30
- formatBytes: function() {
30
+ get formatBytes () {
31
31
  return formatBytes;
32
32
  }
33
33
  });
@@ -17,17 +17,17 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- CURRENCY_GROUP_CONFIG: function() {
24
+ get CURRENCY_GROUP_CONFIG () {
25
25
  return CURRENCY_GROUP_CONFIG;
26
26
  },
27
- CURRENCY_UNIT_CONFIG: function() {
27
+ get CURRENCY_UNIT_CONFIG () {
28
28
  return CURRENCY_UNIT_CONFIG;
29
29
  },
30
- formatCurrency: function() {
30
+ get formatCurrency () {
31
31
  return formatCurrency;
32
32
  }
33
33
  });
@@ -17,17 +17,17 @@ Object.defineProperty(exports, "__esModule", {
17
17
  function _export(target, all) {
18
18
  for(var name in all)Object.defineProperty(target, name, {
19
19
  enumerable: true,
20
- get: all[name]
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
- DATE_GROUP_CONFIG: function() {
24
+ get DATE_GROUP_CONFIG () {
25
25
  return DATE_GROUP_CONFIG;
26
26
  },
27
- DATE_UNIT_CONFIG: function() {
27
+ get DATE_UNIT_CONFIG () {
28
28
  return DATE_UNIT_CONFIG;
29
29
  },
30
- formatDate: function() {
30
+ get formatDate () {
31
31
  return formatDate;
32
32
  }
33
33
  });