@perses-dev/core 0.53.0-beta.2 → 0.53.0-beta.4
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.
- package/dist/cjs/model/base-metadata.js +16 -0
- package/dist/cjs/model/profile-data.js +1 -5
- package/dist/cjs/model/units/bits.js +105 -0
- package/dist/cjs/model/units/throughput.js +22 -1
- package/dist/cjs/model/units/units.js +12 -0
- package/dist/model/base-metadata.d.ts +17 -0
- package/dist/model/base-metadata.d.ts.map +1 -0
- package/dist/model/base-metadata.js +15 -0
- package/dist/model/base-metadata.js.map +1 -0
- package/dist/model/log-data.d.ts +2 -9
- package/dist/model/log-data.d.ts.map +1 -1
- package/dist/model/log-data.js.map +1 -1
- package/dist/model/profile-data.d.ts +2 -1
- package/dist/model/profile-data.d.ts.map +1 -1
- package/dist/model/profile-data.js +1 -5
- package/dist/model/profile-data.js.map +1 -1
- package/dist/model/time-series-data.d.ts +3 -9
- package/dist/model/time-series-data.d.ts.map +1 -1
- package/dist/model/time-series-data.js.map +1 -1
- package/dist/model/trace-data.d.ts +5 -2
- package/dist/model/trace-data.d.ts.map +1 -1
- package/dist/model/trace-data.js.map +1 -1
- package/dist/model/units/bits.d.ts +12 -0
- package/dist/model/units/bits.d.ts.map +1 -0
- package/dist/model/units/bits.js +81 -0
- package/dist/model/units/bits.js.map +1 -0
- package/dist/model/units/throughput.d.ts +1 -1
- package/dist/model/units/throughput.d.ts.map +1 -1
- package/dist/model/units/throughput.js +22 -1
- package/dist/model/units/throughput.js.map +1 -1
- package/dist/model/units/types.d.ts +1 -1
- package/dist/model/units/types.d.ts.map +1 -1
- package/dist/model/units/types.js.map +1 -1
- package/dist/model/units/units.d.ts +6 -1
- package/dist/model/units/units.d.ts.map +1 -1
- package/dist/model/units/units.js +9 -0
- package/dist/model/units/units.js.map +1 -1
- package/dist/schema/datasource.d.ts +4 -4
- package/dist/schema/metadata.d.ts +2 -2
- package/dist/schema/role.d.ts +4 -4
- package/dist/schema/rolebinding.d.ts +4 -4
- package/dist/schema/secret.d.ts +8 -8
- package/dist/schema/variable.d.ts +8 -8
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
});
|
|
@@ -10,11 +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
|
-
* A stackTrace
|
|
15
|
-
* It corresponds to a function called during a program execution.
|
|
16
|
-
* Children of a function are functions called by the parent function during its execution.
|
|
17
|
-
*/ "use strict";
|
|
13
|
+
"use strict";
|
|
18
14
|
Object.defineProperty(exports, "__esModule", {
|
|
19
15
|
value: true
|
|
20
16
|
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
BITS_GROUP_CONFIG: function() {
|
|
25
|
+
return BITS_GROUP_CONFIG;
|
|
26
|
+
},
|
|
27
|
+
BITS_UNIT_CONFIG: function() {
|
|
28
|
+
return BITS_UNIT_CONFIG;
|
|
29
|
+
},
|
|
30
|
+
formatBits: function() {
|
|
31
|
+
return formatBits;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _numbro = /*#__PURE__*/ _interop_require_default(require("numbro"));
|
|
35
|
+
const _constants = require("./constants");
|
|
36
|
+
const _utils = require("./utils");
|
|
37
|
+
function _interop_require_default(obj) {
|
|
38
|
+
return obj && obj.__esModule ? obj : {
|
|
39
|
+
default: obj
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* We support both SI (decimal) and IEC (binary) units for bits:
|
|
44
|
+
*
|
|
45
|
+
* SI/decimal (unit: 'decbits'):
|
|
46
|
+
* 1 Kb = 1000 bits (1000^1 bits)
|
|
47
|
+
* 1 Mb = 1,000,000 bits (1000^2 bits)
|
|
48
|
+
* etc.
|
|
49
|
+
*
|
|
50
|
+
* IEC/binary (unit: 'bits'):
|
|
51
|
+
* 1 Kib = 1024 bits (1024^1 bits)
|
|
52
|
+
* 1 Mib = 1,048,576 bits (1024^2 bits)
|
|
53
|
+
* etc.
|
|
54
|
+
*/ const DEFAULT_NUMBRO_MANTISSA = 2;
|
|
55
|
+
const BITS_GROUP_CONFIG = {
|
|
56
|
+
label: 'Bits',
|
|
57
|
+
decimalPlaces: true,
|
|
58
|
+
shortValues: true
|
|
59
|
+
};
|
|
60
|
+
const BITS_UNIT_CONFIG = {
|
|
61
|
+
bits: {
|
|
62
|
+
group: 'Bits',
|
|
63
|
+
label: 'Bits (IEC)'
|
|
64
|
+
},
|
|
65
|
+
decbits: {
|
|
66
|
+
group: 'Bits',
|
|
67
|
+
label: 'Bits (SI)'
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
function formatBits(bits, { unit = 'bits', shortValues, decimalPlaces }) {
|
|
71
|
+
const isDecimal = unit === 'decbits';
|
|
72
|
+
const threshold = isDecimal ? 1000 : 1024;
|
|
73
|
+
// If we're showing the entire value, we can use Intl.NumberFormat.
|
|
74
|
+
if (!(0, _utils.shouldShortenValues)(shortValues) || Math.abs(bits) < threshold) {
|
|
75
|
+
const formatterOptions = {
|
|
76
|
+
style: 'decimal',
|
|
77
|
+
useGrouping: true
|
|
78
|
+
};
|
|
79
|
+
if ((0, _utils.hasDecimalPlaces)(decimalPlaces)) {
|
|
80
|
+
formatterOptions.minimumFractionDigits = (0, _utils.limitDecimalPlaces)(decimalPlaces);
|
|
81
|
+
formatterOptions.maximumFractionDigits = (0, _utils.limitDecimalPlaces)(decimalPlaces);
|
|
82
|
+
} else {
|
|
83
|
+
// This can happen if bits is between -threshold and threshold (1000 for SI, 1024 for IEC)
|
|
84
|
+
if ((0, _utils.shouldShortenValues)(shortValues)) {
|
|
85
|
+
formatterOptions.maximumSignificantDigits = _constants.MAX_SIGNIFICANT_DIGITS;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const formatter = Intl.NumberFormat('en-US', formatterOptions);
|
|
89
|
+
return formatter.format(bits) + ' bits';
|
|
90
|
+
}
|
|
91
|
+
// If we're showing the shorten value, we use numbro.
|
|
92
|
+
// numbro is able to add units like Kb, Mb, Gb, etc. correctly.
|
|
93
|
+
const formatted = (0, _numbro.default)(bits).format({
|
|
94
|
+
output: 'byte',
|
|
95
|
+
base: isDecimal ? 'decimal' : 'binary',
|
|
96
|
+
spaceSeparated: true,
|
|
97
|
+
mantissa: (0, _utils.hasDecimalPlaces)(decimalPlaces) ? decimalPlaces : DEFAULT_NUMBRO_MANTISSA,
|
|
98
|
+
// trimMantissa trims trailing 0s
|
|
99
|
+
trimMantissa: !(0, _utils.hasDecimalPlaces)(decimalPlaces),
|
|
100
|
+
// optionalMantissa excludes all the decimal places if they're all zeros
|
|
101
|
+
optionalMantissa: !(0, _utils.hasDecimalPlaces)(decimalPlaces)
|
|
102
|
+
});
|
|
103
|
+
// Replace byte units with bit units
|
|
104
|
+
return formatted.replace(/KB/g, 'Kb').replace(/MB/g, 'Mb').replace(/GB/g, 'Gb').replace(/TB/g, 'Tb').replace(/PB/g, 'Pb').replace(/EB/g, 'Eb').replace(/KiB/g, 'Kib').replace(/MiB/g, 'Mib').replace(/GiB/g, 'Gib').replace(/TiB/g, 'Tib').replace(/PiB/g, 'Pib').replace(/EiB/g, 'Eib');
|
|
105
|
+
}
|
|
@@ -32,6 +32,7 @@ _export(exports, {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
const _bytes = require("./bytes");
|
|
35
|
+
const _bits = require("./bits");
|
|
35
36
|
const _constants = require("./constants");
|
|
36
37
|
const _utils = require("./utils");
|
|
37
38
|
const THROUGHPUT_GROUP_CONFIG = {
|
|
@@ -42,7 +43,11 @@ const THROUGHPUT_GROUP = 'Throughput';
|
|
|
42
43
|
const THROUGHPUT_UNIT_CONFIG = {
|
|
43
44
|
'bits/sec': {
|
|
44
45
|
group: THROUGHPUT_GROUP,
|
|
45
|
-
label: 'Bits/sec'
|
|
46
|
+
label: 'Bits/sec (IEC)'
|
|
47
|
+
},
|
|
48
|
+
'decbits/sec': {
|
|
49
|
+
group: THROUGHPUT_GROUP,
|
|
50
|
+
label: 'Bits/sec (SI)'
|
|
46
51
|
},
|
|
47
52
|
'bytes/sec': {
|
|
48
53
|
group: THROUGHPUT_GROUP,
|
|
@@ -95,6 +100,22 @@ const THROUGHPUT_UNIT_CONFIG = {
|
|
|
95
100
|
};
|
|
96
101
|
function formatThroughput(value, { unit, shortValues, decimalPlaces }) {
|
|
97
102
|
// special case for data throughput
|
|
103
|
+
if (unit === 'bits/sec') {
|
|
104
|
+
const denominator = Math.abs(value) < 1024 ? 'sec' : 's';
|
|
105
|
+
return (0, _bits.formatBits)(value, {
|
|
106
|
+
unit: 'bits',
|
|
107
|
+
shortValues,
|
|
108
|
+
decimalPlaces
|
|
109
|
+
}) + '/' + denominator;
|
|
110
|
+
}
|
|
111
|
+
if (unit === 'decbits/sec') {
|
|
112
|
+
const denominator = Math.abs(value) < 1000 ? 'sec' : 's';
|
|
113
|
+
return (0, _bits.formatBits)(value, {
|
|
114
|
+
unit: 'decbits',
|
|
115
|
+
shortValues,
|
|
116
|
+
decimalPlaces
|
|
117
|
+
}) + '/' + denominator;
|
|
118
|
+
}
|
|
98
119
|
if (unit === 'decbytes/sec') {
|
|
99
120
|
const denominator = Math.abs(value) < 1000 ? 'sec' : 's';
|
|
100
121
|
return (0, _bytes.formatBytes)(value, {
|
|
@@ -39,6 +39,9 @@ _export(exports, {
|
|
|
39
39
|
getUnitGroupConfig: function() {
|
|
40
40
|
return getUnitGroupConfig;
|
|
41
41
|
},
|
|
42
|
+
isBitsUnit: function() {
|
|
43
|
+
return isBitsUnit;
|
|
44
|
+
},
|
|
42
45
|
isBytesUnit: function() {
|
|
43
46
|
return isBytesUnit;
|
|
44
47
|
},
|
|
@@ -71,6 +74,7 @@ _export(exports, {
|
|
|
71
74
|
}
|
|
72
75
|
});
|
|
73
76
|
const _bytes = require("./bytes");
|
|
77
|
+
const _bits = require("./bits");
|
|
74
78
|
const _decimal = require("./decimal");
|
|
75
79
|
const _percent = require("./percent");
|
|
76
80
|
const _temperature = require("./temperature");
|
|
@@ -83,6 +87,7 @@ const UNIT_GROUP_CONFIG = {
|
|
|
83
87
|
Percent: _percent.PERCENT_GROUP_CONFIG,
|
|
84
88
|
Decimal: _decimal.DECIMAL_GROUP_CONFIG,
|
|
85
89
|
Bytes: _bytes.BYTES_GROUP_CONFIG,
|
|
90
|
+
Bits: _bits.BITS_GROUP_CONFIG,
|
|
86
91
|
Throughput: _throughput.THROUGHPUT_GROUP_CONFIG,
|
|
87
92
|
Currency: _currency.CURRENCY_GROUP_CONFIG,
|
|
88
93
|
Temperature: _temperature.TEMPERATURE_GROUP_CONFIG,
|
|
@@ -93,6 +98,7 @@ const UNIT_CONFIG = {
|
|
|
93
98
|
..._percent.PERCENT_UNIT_CONFIG,
|
|
94
99
|
..._decimal.DECIMAL_UNIT_CONFIG,
|
|
95
100
|
..._bytes.BYTES_UNIT_CONFIG,
|
|
101
|
+
..._bits.BITS_UNIT_CONFIG,
|
|
96
102
|
..._throughput.THROUGHPUT_UNIT_CONFIG,
|
|
97
103
|
..._currency.CURRENCY_UNIT_CONFIG,
|
|
98
104
|
..._temperature.TEMPERATURE_UNIT_CONFIG,
|
|
@@ -105,6 +111,9 @@ function formatValue(value, formatOptions) {
|
|
|
105
111
|
if (isBytesUnit(formatOptions)) {
|
|
106
112
|
return (0, _bytes.formatBytes)(value, formatOptions);
|
|
107
113
|
}
|
|
114
|
+
if (isBitsUnit(formatOptions)) {
|
|
115
|
+
return (0, _bits.formatBits)(value, formatOptions);
|
|
116
|
+
}
|
|
108
117
|
if (isDecimalUnit(formatOptions)) {
|
|
109
118
|
return (0, _decimal.formatDecimal)(value, formatOptions);
|
|
110
119
|
}
|
|
@@ -152,6 +161,9 @@ function isDecimalUnit(formatOptions) {
|
|
|
152
161
|
function isBytesUnit(formatOptions) {
|
|
153
162
|
return getUnitGroup(formatOptions) === 'Bytes';
|
|
154
163
|
}
|
|
164
|
+
function isBitsUnit(formatOptions) {
|
|
165
|
+
return getUnitGroup(formatOptions) === 'Bits';
|
|
166
|
+
}
|
|
155
167
|
function isUnitWithDecimalPlaces(formatOptions) {
|
|
156
168
|
const groupConfig = getUnitGroupConfig(formatOptions);
|
|
157
169
|
return !!groupConfig.decimalPlaces;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Notice } from './notice';
|
|
2
|
+
export interface BaseMetadata {
|
|
3
|
+
/**
|
|
4
|
+
* A list of notices to display in the panel.
|
|
5
|
+
* These notices are passed down to the panel header
|
|
6
|
+
* and can be used to inform the user about important
|
|
7
|
+
* states, warnings, or messages related to the panel’s data or configuration.
|
|
8
|
+
*/
|
|
9
|
+
notices?: Notice[];
|
|
10
|
+
/**
|
|
11
|
+
* The raw query that is executed to generate this data.
|
|
12
|
+
* Useful when needing to inspect the query that was executed
|
|
13
|
+
* after variables and other context modifications have been applied.
|
|
14
|
+
*/
|
|
15
|
+
executedQueryString?: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=base-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-metadata.d.ts","sourceRoot":"","sources":["../../src/model/base-metadata.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=base-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/base-metadata.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Notice } from './notice';\n\nexport interface BaseMetadata {\n /**\n * A list of notices to display in the panel.\n * These notices are passed down to the panel header\n * and can be used to inform the user about important\n * states, warnings, or messages related to the panel’s data or configuration.\n */\n notices?: Notice[];\n\n /**\n * The raw query that is executed to generate this data.\n * Useful when needing to inspect the query that was executed\n * after variables and other context modifications have been applied.\n */\n executedQueryString?: string;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,WAeC"}
|
package/dist/model/log-data.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseMetadata } from './base-metadata';
|
|
2
2
|
import { AbsoluteTimeRange } from './time';
|
|
3
3
|
import { Labels } from './time-series-queries';
|
|
4
4
|
export interface LogEntry {
|
|
@@ -14,14 +14,7 @@ export interface LogData {
|
|
|
14
14
|
hasMore?: boolean;
|
|
15
15
|
direction?: 'forward' | 'backward';
|
|
16
16
|
}
|
|
17
|
-
export interface LogMetadata {
|
|
18
|
-
notices?: Notice[];
|
|
19
|
-
/**
|
|
20
|
-
* The raw query that is executed to generate this data.
|
|
21
|
-
* Useful when needing to inspect the query that was executed
|
|
22
|
-
* after variables and other context modifications have been applied.
|
|
23
|
-
*/
|
|
24
|
-
executedQueryString?: string;
|
|
17
|
+
export interface LogMetadata extends BaseMetadata {
|
|
25
18
|
/**
|
|
26
19
|
* Statistics about the log query execution
|
|
27
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-data.d.ts","sourceRoot":"","sources":["../../src/model/log-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"log-data.d.ts","sourceRoot":"","sources":["../../src/model/log-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;CACpC;AAED,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/log-data.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/model/log-data.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { BaseMetadata } from './base-metadata';\nimport { AbsoluteTimeRange } from './time';\nimport { Labels } from './time-series-queries';\n\nexport interface LogEntry {\n timestamp: number;\n line: string;\n labels: Labels;\n}\n\nexport interface LogData {\n timeRange?: AbsoluteTimeRange;\n entries: LogEntry[];\n metadata?: LogMetadata;\n totalCount?: number;\n hasMore?: boolean;\n direction?: 'forward' | 'backward';\n}\n\nexport interface LogMetadata extends BaseMetadata {\n /**\n * Statistics about the log query execution\n */\n stats?: LogQueryStats;\n}\n\nexport interface LogQueryStats {\n /**\n * Number of bytes examined during the query\n */\n bytesExamined?: number;\n\n /**\n * Number of lines examined during the query\n */\n linesExamined?: number;\n\n /**\n * Query execution time in milliseconds\n */\n executionTimeMs?: number;\n\n /**\n * Number of streams processed\n */\n streamsProcessed?: number;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA4BjC,WAoBC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseMetadata } from './base-metadata';
|
|
1
2
|
/**
|
|
2
3
|
* A stackTrace
|
|
3
4
|
* It corresponds to a function called during a program execution.
|
|
@@ -40,7 +41,7 @@ export interface ProfileData {
|
|
|
40
41
|
maxSelf?: number;
|
|
41
42
|
metadata?: ProfileMetaData;
|
|
42
43
|
}
|
|
43
|
-
export interface ProfileMetaData {
|
|
44
|
+
export interface ProfileMetaData extends BaseMetadata {
|
|
44
45
|
spyName: string;
|
|
45
46
|
sampleRate: number;
|
|
46
47
|
units: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-data.d.ts","sourceRoot":"","sources":["../../src/model/profile-data.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,UAAU,EAAE,UAAU,CAAC;CACxB;AA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IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -10,10 +10,6 @@
|
|
|
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
|
-
* A stackTrace
|
|
15
|
-
* It corresponds to a function called during a program execution.
|
|
16
|
-
* Children of a function are functions called by the parent function during its execution.
|
|
17
|
-
*/ export { };
|
|
13
|
+
export { };
|
|
18
14
|
|
|
19
15
|
//# sourceMappingURL=profile-data.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/profile-data.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * A stackTrace\n * It corresponds to a function called during a program execution.\n * Children of a function are functions called by the parent function during its execution.\n */\nexport interface StackTrace {\n id: number; // index of function's name in names array\n name: string; // function's name\n level: number; // level of the function in the flame graph\n start: number; // time at which the function starts\n end: number; // time at which the function ends\n total: number; // total samples (including the samples in its children nodes)\n self: number; // self samples (excluding the samples in its children nodes)\n children: StackTrace[];\n}\n\n/**\n * Timeline attribute contains data to draw the chart showing the evolution of the profiled resource over time (CPU, memory, etc.).\n * It is like a metric and it helps to identify bottlenecks.\n */\nexport interface Timeline {\n startTime: number; // Time at which the timeline starts, as a Unix timestamp\n samples: number[]; // A sequence of samples starting at startTime, spaced by durationDelta seconds\n durationDelta: number; // Time delta between samples, in seconds\n}\n\n/**\n * An entire profile\n * It is the stacktrace of the root function.\n */\nexport interface Profile {\n stackTrace: StackTrace;\n}\n\n/**\n * A generalized data-model that will be used by Panel components\n * to display profiles.\n */\nexport interface ProfileData {\n profile: Profile;\n timeline?: Timeline;\n\n numTicks?: number; // Total number of samples\n maxSelf?: number; // Maximum self value in any node\n\n metadata?: ProfileMetaData;\n}\n\nexport interface ProfileMetaData {\n spyName: string; // Name of the spy / profiler used to generate the profile, if any\n sampleRate: number; // Sample rate at which the profiler was operating\n units: string; // The unit of measurement for the profiled data\n name: string; // A name that identifies the profile. [Is this really necessary?]\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;
|
|
1
|
+
{"version":3,"sources":["../../src/model/profile-data.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { BaseMetadata } from './base-metadata';\n\n/**\n * A stackTrace\n * It corresponds to a function called during a program execution.\n * Children of a function are functions called by the parent function during its execution.\n */\nexport interface StackTrace {\n id: number; // index of function's name in names array\n name: string; // function's name\n level: number; // level of the function in the flame graph\n start: number; // time at which the function starts\n end: number; // time at which the function ends\n total: number; // total samples (including the samples in its children nodes)\n self: number; // self samples (excluding the samples in its children nodes)\n children: StackTrace[];\n}\n\n/**\n * Timeline attribute contains data to draw the chart showing the evolution of the profiled resource over time (CPU, memory, etc.).\n * It is like a metric and it helps to identify bottlenecks.\n */\nexport interface Timeline {\n startTime: number; // Time at which the timeline starts, as a Unix timestamp\n samples: number[]; // A sequence of samples starting at startTime, spaced by durationDelta seconds\n durationDelta: number; // Time delta between samples, in seconds\n}\n\n/**\n * An entire profile\n * It is the stacktrace of the root function.\n */\nexport interface Profile {\n stackTrace: StackTrace;\n}\n\n/**\n * A generalized data-model that will be used by Panel components\n * to display profiles.\n */\nexport interface ProfileData {\n profile: Profile;\n timeline?: Timeline;\n\n numTicks?: number; // Total number of samples\n maxSelf?: number; // Maximum self value in any node\n\n metadata?: ProfileMetaData;\n}\n\nexport interface ProfileMetaData extends BaseMetadata {\n spyName: string; // Name of the spy / profiler used to generate the profile, if any\n sampleRate: number; // Sample rate at which the profiler was operating\n units: string; // The unit of measurement for the profiled data\n name: string; // A name that identifies the profile. [Is this really necessary?]\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAoDjC,WAKC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseMetadata } from './base-metadata';
|
|
2
2
|
import { AbsoluteTimeRange } from './time';
|
|
3
3
|
import { Labels, TimeSeriesValueTuple, TimeSeriesHistogramTuple } from './time-series-queries';
|
|
4
4
|
export interface TimeScale {
|
|
@@ -20,13 +20,7 @@ export interface TimeSeries {
|
|
|
20
20
|
formattedName?: string;
|
|
21
21
|
labels?: Labels;
|
|
22
22
|
}
|
|
23
|
-
export interface TimeSeriesMetadata {
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The raw query that is executed to generate this data.
|
|
27
|
-
* Useful when needing to inspect the query that was executed
|
|
28
|
-
* after variables and other context modifications have been applied.
|
|
29
|
-
*/
|
|
30
|
-
executedQueryString?: string;
|
|
23
|
+
export interface TimeSeriesMetadata extends BaseMetadata {
|
|
24
|
+
[key: string]: unknown;
|
|
31
25
|
}
|
|
32
26
|
//# sourceMappingURL=time-series-data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-series-data.d.ts","sourceRoot":"","sources":["../../src/model/time-series-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"time-series-data.d.ts","sourceRoot":"","sources":["../../src/model/time-series-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAE/F,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/time-series-data.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/model/time-series-data.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { BaseMetadata } from './base-metadata';\nimport { AbsoluteTimeRange } from './time';\nimport { Labels, TimeSeriesValueTuple, TimeSeriesHistogramTuple } from './time-series-queries';\n\nexport interface TimeScale {\n startMs: number;\n endMs: number;\n stepMs: number;\n rangeMs: number;\n}\n\nexport interface TimeSeriesData {\n timeRange?: AbsoluteTimeRange;\n stepMs?: number;\n series: TimeSeries[];\n metadata?: TimeSeriesMetadata;\n}\n\nexport interface TimeSeries {\n name: string;\n values: TimeSeriesValueTuple[];\n histograms?: TimeSeriesHistogramTuple[];\n formattedName?: string;\n labels?: Labels;\n}\n\nexport interface TimeSeriesMetadata extends BaseMetadata {\n [key: string]: unknown;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA4BjC,WAEC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseMetadata } from './base-metadata';
|
|
1
2
|
import { TracesData } from './otlp/trace/v1/trace';
|
|
2
3
|
/**
|
|
3
4
|
* Partial trace information returned by search endpoint
|
|
@@ -27,8 +28,10 @@ export interface TraceData {
|
|
|
27
28
|
searchResult?: TraceSearchResult[];
|
|
28
29
|
metadata?: TraceMetaData;
|
|
29
30
|
}
|
|
30
|
-
export interface TraceMetaData {
|
|
31
|
-
|
|
31
|
+
export interface TraceMetaData extends BaseMetadata {
|
|
32
|
+
/** this field indicates if there are more traces matching the search query, however not all traces were returned */
|
|
33
|
+
hasMoreResults?: boolean;
|
|
34
|
+
[key: string]: unknown;
|
|
32
35
|
}
|
|
33
36
|
export declare function isValidTraceId(traceId: string): boolean;
|
|
34
37
|
//# sourceMappingURL=trace-data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace-data.d.ts","sourceRoot":"","sources":["../../src/model/trace-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAEnC,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"trace-data.d.ts","sourceRoot":"","sources":["../../src/model/trace-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAEnC,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,oHAAoH;IACpH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/trace-data.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TracesData } from './otlp/trace/v1/trace';\n\n/**\n * Partial trace information returned by search endpoint\n */\nexport interface TraceSearchResult {\n traceId: string;\n rootServiceName: string;\n rootTraceName: string;\n startTimeUnixMs: number;\n durationMs: number;\n serviceStats: Record<string, ServiceStats>;\n}\n\nexport interface ServiceStats {\n spanCount: number;\n /** number of spans with errors, unset if zero */\n errorCount?: number;\n}\n\n/**\n * A generalized data-model that will be used by Panel components\n * to display traces.\n *\n * If the query contains a valid trace ID, the 'trace' attribute will contain the entire trace.\n * If the query contains a TraceQL query, the 'searchResult' attribute will contain the search results.\n */\nexport interface TraceData {\n trace?: TracesData;\n searchResult?: TraceSearchResult[];\n\n metadata?: TraceMetaData;\n}\n\nexport interface TraceMetaData {\n
|
|
1
|
+
{"version":3,"sources":["../../src/model/trace-data.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { BaseMetadata } from './base-metadata';\nimport { TracesData } from './otlp/trace/v1/trace';\n\n/**\n * Partial trace information returned by search endpoint\n */\nexport interface TraceSearchResult {\n traceId: string;\n rootServiceName: string;\n rootTraceName: string;\n startTimeUnixMs: number;\n durationMs: number;\n serviceStats: Record<string, ServiceStats>;\n}\n\nexport interface ServiceStats {\n spanCount: number;\n /** number of spans with errors, unset if zero */\n errorCount?: number;\n}\n\n/**\n * A generalized data-model that will be used by Panel components\n * to display traces.\n *\n * If the query contains a valid trace ID, the 'trace' attribute will contain the entire trace.\n * If the query contains a TraceQL query, the 'searchResult' attribute will contain the search results.\n */\nexport interface TraceData {\n trace?: TracesData;\n searchResult?: TraceSearchResult[];\n\n metadata?: TraceMetaData;\n}\n\nexport interface TraceMetaData extends BaseMetadata {\n /** this field indicates if there are more traces matching the search query, however not all traces were returned */\n hasMoreResults?: boolean;\n [key: string]: unknown;\n}\n\nexport function isValidTraceId(traceId: string): boolean {\n return /^[0-9a-fA-F]+$/.test(traceId);\n}\n"],"names":["isValidTraceId","traceId","test"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA2CjC,OAAO,SAASA,eAAeC,OAAe;IAC5C,OAAO,iBAAiBC,IAAI,CAACD;AAC/B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UnitGroupConfig, UnitConfig } from './types';
|
|
2
|
+
type BitsUnit = 'bits' | 'decbits';
|
|
3
|
+
export type BitsFormatOptions = {
|
|
4
|
+
unit?: BitsUnit;
|
|
5
|
+
decimalPlaces?: number;
|
|
6
|
+
shortValues?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const BITS_GROUP_CONFIG: UnitGroupConfig;
|
|
9
|
+
export declare const BITS_UNIT_CONFIG: Readonly<Record<BitsUnit, UnitConfig>>;
|
|
10
|
+
export declare function formatBits(bits: number, { unit, shortValues, decimalPlaces }: BitsFormatOptions): string;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=bits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bits.d.ts","sourceRoot":"","sources":["../../../src/model/units/bits.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAmBtD,KAAK,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAEnC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAI/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,CASnE,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAa,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,iBAAiB,GAAG,MAAM,CAmDjH"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import numbro from 'numbro';
|
|
14
|
+
import { MAX_SIGNIFICANT_DIGITS } from './constants';
|
|
15
|
+
import { hasDecimalPlaces, limitDecimalPlaces, shouldShortenValues } from './utils';
|
|
16
|
+
/**
|
|
17
|
+
* We support both SI (decimal) and IEC (binary) units for bits:
|
|
18
|
+
*
|
|
19
|
+
* SI/decimal (unit: 'decbits'):
|
|
20
|
+
* 1 Kb = 1000 bits (1000^1 bits)
|
|
21
|
+
* 1 Mb = 1,000,000 bits (1000^2 bits)
|
|
22
|
+
* etc.
|
|
23
|
+
*
|
|
24
|
+
* IEC/binary (unit: 'bits'):
|
|
25
|
+
* 1 Kib = 1024 bits (1024^1 bits)
|
|
26
|
+
* 1 Mib = 1,048,576 bits (1024^2 bits)
|
|
27
|
+
* etc.
|
|
28
|
+
*/ const DEFAULT_NUMBRO_MANTISSA = 2;
|
|
29
|
+
export const BITS_GROUP_CONFIG = {
|
|
30
|
+
label: 'Bits',
|
|
31
|
+
decimalPlaces: true,
|
|
32
|
+
shortValues: true
|
|
33
|
+
};
|
|
34
|
+
export const BITS_UNIT_CONFIG = {
|
|
35
|
+
bits: {
|
|
36
|
+
group: 'Bits',
|
|
37
|
+
label: 'Bits (IEC)'
|
|
38
|
+
},
|
|
39
|
+
decbits: {
|
|
40
|
+
group: 'Bits',
|
|
41
|
+
label: 'Bits (SI)'
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export function formatBits(bits, { unit = 'bits', shortValues, decimalPlaces }) {
|
|
45
|
+
const isDecimal = unit === 'decbits';
|
|
46
|
+
const threshold = isDecimal ? 1000 : 1024;
|
|
47
|
+
// If we're showing the entire value, we can use Intl.NumberFormat.
|
|
48
|
+
if (!shouldShortenValues(shortValues) || Math.abs(bits) < threshold) {
|
|
49
|
+
const formatterOptions = {
|
|
50
|
+
style: 'decimal',
|
|
51
|
+
useGrouping: true
|
|
52
|
+
};
|
|
53
|
+
if (hasDecimalPlaces(decimalPlaces)) {
|
|
54
|
+
formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
55
|
+
formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
56
|
+
} else {
|
|
57
|
+
// This can happen if bits is between -threshold and threshold (1000 for SI, 1024 for IEC)
|
|
58
|
+
if (shouldShortenValues(shortValues)) {
|
|
59
|
+
formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const formatter = Intl.NumberFormat('en-US', formatterOptions);
|
|
63
|
+
return formatter.format(bits) + ' bits';
|
|
64
|
+
}
|
|
65
|
+
// If we're showing the shorten value, we use numbro.
|
|
66
|
+
// numbro is able to add units like Kb, Mb, Gb, etc. correctly.
|
|
67
|
+
const formatted = numbro(bits).format({
|
|
68
|
+
output: 'byte',
|
|
69
|
+
base: isDecimal ? 'decimal' : 'binary',
|
|
70
|
+
spaceSeparated: true,
|
|
71
|
+
mantissa: hasDecimalPlaces(decimalPlaces) ? decimalPlaces : DEFAULT_NUMBRO_MANTISSA,
|
|
72
|
+
// trimMantissa trims trailing 0s
|
|
73
|
+
trimMantissa: !hasDecimalPlaces(decimalPlaces),
|
|
74
|
+
// optionalMantissa excludes all the decimal places if they're all zeros
|
|
75
|
+
optionalMantissa: !hasDecimalPlaces(decimalPlaces)
|
|
76
|
+
});
|
|
77
|
+
// Replace byte units with bit units
|
|
78
|
+
return formatted.replace(/KB/g, 'Kb').replace(/MB/g, 'Mb').replace(/GB/g, 'Gb').replace(/TB/g, 'Tb').replace(/PB/g, 'Pb').replace(/EB/g, 'Eb').replace(/KiB/g, 'Kib').replace(/MiB/g, 'Mib').replace(/GiB/g, 'Gib').replace(/TiB/g, 'Tib').replace(/PiB/g, 'Pib').replace(/EiB/g, 'Eib');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=bits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/bits.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport numbro from 'numbro';\n\nimport { MAX_SIGNIFICANT_DIGITS } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { hasDecimalPlaces, limitDecimalPlaces, shouldShortenValues } from './utils';\n\n/**\n * We support both SI (decimal) and IEC (binary) units for bits:\n *\n * SI/decimal (unit: 'decbits'):\n * 1 Kb = 1000 bits (1000^1 bits)\n * 1 Mb = 1,000,000 bits (1000^2 bits)\n * etc.\n *\n * IEC/binary (unit: 'bits'):\n * 1 Kib = 1024 bits (1024^1 bits)\n * 1 Mib = 1,048,576 bits (1024^2 bits)\n * etc.\n */\n\nconst DEFAULT_NUMBRO_MANTISSA = 2;\n\ntype BitsUnit = 'bits' | 'decbits';\n\nexport type BitsFormatOptions = {\n unit?: BitsUnit;\n decimalPlaces?: number;\n shortValues?: boolean;\n};\n\nexport const BITS_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Bits',\n decimalPlaces: true,\n shortValues: true,\n};\n\nexport const BITS_UNIT_CONFIG: Readonly<Record<BitsUnit, UnitConfig>> = {\n bits: {\n group: 'Bits',\n label: 'Bits (IEC)',\n },\n decbits: {\n group: 'Bits',\n label: 'Bits (SI)',\n },\n};\n\nexport function formatBits(bits: number, { unit = 'bits', shortValues, decimalPlaces }: BitsFormatOptions): string {\n const isDecimal = unit === 'decbits';\n const threshold = isDecimal ? 1000 : 1024;\n\n // If we're showing the entire value, we can use Intl.NumberFormat.\n if (!shouldShortenValues(shortValues) || Math.abs(bits) < threshold) {\n const formatterOptions: Intl.NumberFormatOptions = {\n style: 'decimal',\n useGrouping: true,\n };\n\n if (hasDecimalPlaces(decimalPlaces)) {\n formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);\n formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);\n } else {\n // This can happen if bits is between -threshold and threshold (1000 for SI, 1024 for IEC)\n if (shouldShortenValues(shortValues)) {\n formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;\n }\n }\n const formatter = Intl.NumberFormat('en-US', formatterOptions);\n return formatter.format(bits) + ' bits';\n }\n\n // If we're showing the shorten value, we use numbro.\n // numbro is able to add units like Kb, Mb, Gb, etc. correctly.\n const formatted = numbro(bits).format({\n output: 'byte', // numbro uses 'byte' output for bit formatting\n base: isDecimal ? 'decimal' : 'binary',\n spaceSeparated: true,\n mantissa: hasDecimalPlaces(decimalPlaces) ? decimalPlaces : DEFAULT_NUMBRO_MANTISSA,\n // trimMantissa trims trailing 0s\n trimMantissa: !hasDecimalPlaces(decimalPlaces),\n // optionalMantissa excludes all the decimal places if they're all zeros\n optionalMantissa: !hasDecimalPlaces(decimalPlaces),\n });\n\n // Replace byte units with bit units\n return formatted\n .replace(/KB/g, 'Kb')\n .replace(/MB/g, 'Mb')\n .replace(/GB/g, 'Gb')\n .replace(/TB/g, 'Tb')\n .replace(/PB/g, 'Pb')\n .replace(/EB/g, 'Eb')\n .replace(/KiB/g, 'Kib')\n .replace(/MiB/g, 'Mib')\n .replace(/GiB/g, 'Gib')\n .replace(/TiB/g, 'Tib')\n .replace(/PiB/g, 'Pib')\n .replace(/EiB/g, 'Eib');\n}\n"],"names":["numbro","MAX_SIGNIFICANT_DIGITS","hasDecimalPlaces","limitDecimalPlaces","shouldShortenValues","DEFAULT_NUMBRO_MANTISSA","BITS_GROUP_CONFIG","label","decimalPlaces","shortValues","BITS_UNIT_CONFIG","bits","group","decbits","formatBits","unit","isDecimal","threshold","Math","abs","formatterOptions","style","useGrouping","minimumFractionDigits","maximumFractionDigits","maximumSignificantDigits","formatter","Intl","NumberFormat","format","formatted","output","base","spaceSeparated","mantissa","trimMantissa","optionalMantissa","replace"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAOA,YAAY,SAAS;AAE5B,SAASC,sBAAsB,QAAQ,cAAc;AAErD,SAASC,gBAAgB,EAAEC,kBAAkB,EAAEC,mBAAmB,QAAQ,UAAU;AAEpF;;;;;;;;;;;;CAYC,GAED,MAAMC,0BAA0B;AAUhC,OAAO,MAAMC,oBAAqC;I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MACfA,OAAO,CAAC,QAAQ,OAChBA,OAAO,CAAC,QAAQ,OAChBA,OAAO,CAAC,QAAQ,OAChBA,OAAO,CAAC,QAAQ,OAChBA,OAAO,CAAC,QAAQ,OAChBA,OAAO,CAAC,QAAQ;AACrB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnitGroupConfig, UnitConfig } from './types';
|
|
2
|
-
type ThroughputUnit = 'bits/sec' | 'bytes/sec' | 'decbytes/sec' | 'counts/sec' | 'events/sec' | 'messages/sec' | 'ops/sec' | 'packets/sec' | 'reads/sec' | 'records/sec' | 'requests/sec' | 'rows/sec' | 'writes/sec';
|
|
2
|
+
type ThroughputUnit = 'bits/sec' | 'decbits/sec' | 'bytes/sec' | 'decbytes/sec' | 'counts/sec' | 'events/sec' | 'messages/sec' | 'ops/sec' | 'packets/sec' | 'reads/sec' | 'records/sec' | 'requests/sec' | 'rows/sec' | 'writes/sec';
|
|
3
3
|
export type ThroughputFormatOptions = {
|
|
4
4
|
unit?: ThroughputUnit;
|
|
5
5
|
decimalPlaces?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throughput.d.ts","sourceRoot":"","sources":["../../../src/model/units/throughput.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"throughput.d.ts","sourceRoot":"","sources":["../../../src/model/units/throughput.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGtD,KAAK,cAAc,GACf,UAAU,GACV,aAAa,GACb,WAAW,GACX,cAAc,GACd,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,SAAS,GACT,aAAa,GACb,WAAW,GACX,aAAa,GACb,cAAc,GACd,UAAU,GACV,YAAY,CAAC;AACjB,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AACF,eAAO,MAAM,uBAAuB,EAAE,eAGrC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CA0D/E,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,uBAAuB,GAAG,MAAM,CA0CrH"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { formatBytes } from './bytes';
|
|
14
|
+
import { formatBits } from './bits';
|
|
14
15
|
import { MAX_SIGNIFICANT_DIGITS } from './constants';
|
|
15
16
|
import { hasDecimalPlaces, limitDecimalPlaces, shouldShortenValues } from './utils';
|
|
16
17
|
export const THROUGHPUT_GROUP_CONFIG = {
|
|
@@ -21,7 +22,11 @@ const THROUGHPUT_GROUP = 'Throughput';
|
|
|
21
22
|
export const THROUGHPUT_UNIT_CONFIG = {
|
|
22
23
|
'bits/sec': {
|
|
23
24
|
group: THROUGHPUT_GROUP,
|
|
24
|
-
label: 'Bits/sec'
|
|
25
|
+
label: 'Bits/sec (IEC)'
|
|
26
|
+
},
|
|
27
|
+
'decbits/sec': {
|
|
28
|
+
group: THROUGHPUT_GROUP,
|
|
29
|
+
label: 'Bits/sec (SI)'
|
|
25
30
|
},
|
|
26
31
|
'bytes/sec': {
|
|
27
32
|
group: THROUGHPUT_GROUP,
|
|
@@ -74,6 +79,22 @@ export const THROUGHPUT_UNIT_CONFIG = {
|
|
|
74
79
|
};
|
|
75
80
|
export function formatThroughput(value, { unit, shortValues, decimalPlaces }) {
|
|
76
81
|
// special case for data throughput
|
|
82
|
+
if (unit === 'bits/sec') {
|
|
83
|
+
const denominator = Math.abs(value) < 1024 ? 'sec' : 's';
|
|
84
|
+
return formatBits(value, {
|
|
85
|
+
unit: 'bits',
|
|
86
|
+
shortValues,
|
|
87
|
+
decimalPlaces
|
|
88
|
+
}) + '/' + denominator;
|
|
89
|
+
}
|
|
90
|
+
if (unit === 'decbits/sec') {
|
|
91
|
+
const denominator = Math.abs(value) < 1000 ? 'sec' : 's';
|
|
92
|
+
return formatBits(value, {
|
|
93
|
+
unit: 'decbits',
|
|
94
|
+
shortValues,
|
|
95
|
+
decimalPlaces
|
|
96
|
+
}) + '/' + denominator;
|
|
97
|
+
}
|
|
77
98
|
if (unit === 'decbytes/sec') {
|
|
78
99
|
const denominator = Math.abs(value) < 1000 ? 'sec' : 's';
|
|
79
100
|
return formatBytes(value, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/units/throughput.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatBytes } from './bytes';\nimport { MAX_SIGNIFICANT_DIGITS } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { hasDecimalPlaces, limitDecimalPlaces, shouldShortenValues } from './utils';\n\ntype ThroughputUnit =\n | 'bits/sec'\n | 'bytes/sec'\n | 'decbytes/sec'\n | 'counts/sec'\n | 'events/sec'\n | 'messages/sec'\n | 'ops/sec'\n | 'packets/sec'\n | 'reads/sec'\n | 'records/sec'\n | 'requests/sec'\n | 'rows/sec'\n | 'writes/sec';\nexport type ThroughputFormatOptions = {\n unit?: ThroughputUnit;\n decimalPlaces?: number;\n shortValues?: boolean;\n};\nexport const THROUGHPUT_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Throughput',\n decimalPlaces: true,\n};\nconst THROUGHPUT_GROUP = 'Throughput';\nexport const THROUGHPUT_UNIT_CONFIG: Readonly<Record<ThroughputUnit, UnitConfig>> = {\n 'bits/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Bits/sec',\n },\n 'bytes/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Bytes/sec (IEC)',\n },\n 'decbytes/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Bytes/sec (SI)',\n },\n\n 'counts/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Counts/sec',\n },\n 'events/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Events/sec',\n },\n 'messages/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Messages/sec',\n },\n 'ops/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Ops/sec',\n },\n 'packets/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Packets/sec',\n },\n 'reads/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Reads/sec',\n },\n 'requests/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Requests/sec',\n },\n 'records/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Records/sec',\n },\n 'rows/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Rows/sec',\n },\n 'writes/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Writes/sec',\n },\n};\n\nexport function formatThroughput(value: number, { unit, shortValues, decimalPlaces }: ThroughputFormatOptions): string {\n // special case for data throughput\n if (unit === 'decbytes/sec') {\n const denominator = Math.abs(value) < 1000 ? 'sec' : 's';\n return formatBytes(value, { unit: 'decbytes', shortValues, decimalPlaces }) + '/' + denominator;\n }\n\n if (unit === 'bytes/sec') {\n const denominator = Math.abs(value) < 1024 ? 'sec' : 's';\n return formatBytes(value, { unit: 'bytes', shortValues, decimalPlaces }) + '/' + denominator;\n }\n\n const formatterOptions: Intl.NumberFormatOptions = {\n style: 'decimal',\n useGrouping: true,\n };\n\n if (shouldShortenValues(shortValues)) {\n formatterOptions.notation = 'compact';\n }\n\n if (hasDecimalPlaces(decimalPlaces)) {\n formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);\n formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);\n } else {\n if (shouldShortenValues(shortValues)) {\n formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;\n }\n }\n\n const formatter = Intl.NumberFormat('en-US', formatterOptions);\n return formatter.format(value) + ' ' + unit;\n}\n"],"names":["formatBytes","MAX_SIGNIFICANT_DIGITS","hasDecimalPlaces","limitDecimalPlaces","shouldShortenValues","THROUGHPUT_GROUP_CONFIG","label","decimalPlaces","THROUGHPUT_GROUP","THROUGHPUT_UNIT_CONFIG","group","formatThroughput","value","unit","shortValues","denominator","Math","abs","formatterOptions","style","useGrouping","notation","minimumFractionDigits","maximumFractionDigits","maximumSignificantDigits","formatter","Intl","NumberFormat","format"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAAQ,UAAU;AACtC,SAASC,sBAAsB,QAAQ,cAAc;AAErD,SAASC,gBAAgB,EAAEC,kBAAkB,EAAEC,mBAAmB,QAAQ,UAAU;
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/throughput.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatBytes } from './bytes';\nimport { formatBits } from './bits';\nimport { MAX_SIGNIFICANT_DIGITS } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { hasDecimalPlaces, limitDecimalPlaces, shouldShortenValues } from './utils';\n\ntype ThroughputUnit =\n | 'bits/sec'\n | 'decbits/sec'\n | 'bytes/sec'\n | 'decbytes/sec'\n | 'counts/sec'\n | 'events/sec'\n | 'messages/sec'\n | 'ops/sec'\n | 'packets/sec'\n | 'reads/sec'\n | 'records/sec'\n | 'requests/sec'\n | 'rows/sec'\n | 'writes/sec';\nexport type ThroughputFormatOptions = {\n unit?: ThroughputUnit;\n decimalPlaces?: number;\n shortValues?: boolean;\n};\nexport const THROUGHPUT_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Throughput',\n decimalPlaces: true,\n};\nconst THROUGHPUT_GROUP = 'Throughput';\nexport const THROUGHPUT_UNIT_CONFIG: Readonly<Record<ThroughputUnit, UnitConfig>> = {\n 'bits/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Bits/sec (IEC)',\n },\n 'decbits/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Bits/sec (SI)',\n },\n 'bytes/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Bytes/sec (IEC)',\n },\n 'decbytes/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Bytes/sec (SI)',\n },\n\n 'counts/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Counts/sec',\n },\n 'events/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Events/sec',\n },\n 'messages/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Messages/sec',\n },\n 'ops/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Ops/sec',\n },\n 'packets/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Packets/sec',\n },\n 'reads/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Reads/sec',\n },\n 'requests/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Requests/sec',\n },\n 'records/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Records/sec',\n },\n 'rows/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Rows/sec',\n },\n 'writes/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Writes/sec',\n },\n};\n\nexport function formatThroughput(value: number, { unit, shortValues, decimalPlaces }: ThroughputFormatOptions): string {\n // special case for data throughput\n if (unit === 'bits/sec') {\n const denominator = Math.abs(value) < 1024 ? 'sec' : 's';\n return formatBits(value, { unit: 'bits', shortValues, decimalPlaces }) + '/' + denominator;\n }\n\n if (unit === 'decbits/sec') {\n const denominator = Math.abs(value) < 1000 ? 'sec' : 's';\n return formatBits(value, { unit: 'decbits', shortValues, decimalPlaces }) + '/' + denominator;\n }\n\n if (unit === 'decbytes/sec') {\n const denominator = Math.abs(value) < 1000 ? 'sec' : 's';\n return formatBytes(value, { unit: 'decbytes', shortValues, decimalPlaces }) + '/' + denominator;\n }\n\n if (unit === 'bytes/sec') {\n const denominator = Math.abs(value) < 1024 ? 'sec' : 's';\n return formatBytes(value, { unit: 'bytes', shortValues, decimalPlaces }) + '/' + denominator;\n }\n\n const formatterOptions: Intl.NumberFormatOptions = {\n style: 'decimal',\n useGrouping: true,\n };\n\n if (shouldShortenValues(shortValues)) {\n formatterOptions.notation = 'compact';\n }\n\n if (hasDecimalPlaces(decimalPlaces)) {\n formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);\n formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);\n } else {\n if (shouldShortenValues(shortValues)) {\n formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;\n }\n }\n\n const formatter = Intl.NumberFormat('en-US', formatterOptions);\n return formatter.format(value) + ' ' + unit;\n}\n"],"names":["formatBytes","formatBits","MAX_SIGNIFICANT_DIGITS","hasDecimalPlaces","limitDecimalPlaces","shouldShortenValues","THROUGHPUT_GROUP_CONFIG","label","decimalPlaces","THROUGHPUT_GROUP","THROUGHPUT_UNIT_CONFIG","group","formatThroughput","value","unit","shortValues","denominator","Math","abs","formatterOptions","style","useGrouping","notation","minimumFractionDigits","maximumFractionDigits","maximumSignificantDigits","formatter","Intl","NumberFormat","format"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAAQ,UAAU;AACtC,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,sBAAsB,QAAQ,cAAc;AAErD,SAASC,gBAAgB,EAAEC,kBAAkB,EAAEC,mBAAmB,QAAQ,UAAU;AAsBpF,OAAO,MAAMC,0BAA2C;IACtDC,OAAO;IACPC,eAAe;AACjB,EAAE;AACF,MAAMC,mBAAmB;AACzB,OAAO,MAAMC,yBAAuE;IAClF,YAAY;QACVC,OAAOF;QACPF,OAAO;IACT;IACA,eAAe;QACbI,OAAOF;QACPF,OAAO;IACT;IACA,aAAa;QACXI,OAAOF;QACPF,OAAO;IACT;IACA,gBAAgB;QACdI,OAAOF;QACPF,OAAO;IACT;IAEA,cAAc;QACZI,OAAOF;QACPF,OAAO;IACT;IACA,cAAc;QACZI,OAAOF;QACPF,OAAO;IACT;IACA,gBAAgB;QACdI,OAAOF;QACPF,OAAO;IACT;IACA,WAAW;QACTI,OAAOF;QACPF,OAAO;IACT;IACA,eAAe;QACbI,OAAOF;QACPF,OAAO;IACT;IACA,aAAa;QACXI,OAAOF;QACPF,OAAO;IACT;IACA,gBAAgB;QACdI,OAAOF;QACPF,OAAO;IACT;IACA,eAAe;QACbI,OAAOF;QACPF,OAAO;IACT;IACA,YAAY;QACVI,OAAOF;QACPF,OAAO;IACT;IACA,cAAc;QACZI,OAAOF;QACPF,OAAO;IACT;AACF,EAAE;AAEF,OAAO,SAASK,iBAAiBC,KAAa,EAAE,EAAEC,IAAI,EAAEC,WAAW,EAAEP,aAAa,EAA2B;IAC3G,mCAAmC;IACnC,IAAIM,SAAS,YAAY;QACvB,MAAME,cAAcC,KAAKC,GAAG,CAACL,SAAS,OAAO,QAAQ;QACrD,OAAOZ,WAAWY,OAAO;YAAEC,MAAM;YAAQC;YAAaP;QAAc,KAAK,MAAMQ;IACjF;IAEA,IAAIF,SAAS,eAAe;QAC1B,MAAME,cAAcC,KAAKC,GAAG,CAACL,SAAS,OAAO,QAAQ;QACrD,OAAOZ,WAAWY,OAAO;YAAEC,MAAM;YAAWC;YAAaP;QAAc,KAAK,MAAMQ;IACpF;IAEA,IAAIF,SAAS,gBAAgB;QAC3B,MAAME,cAAcC,KAAKC,GAAG,CAACL,SAAS,OAAO,QAAQ;QACrD,OAAOb,YAAYa,OAAO;YAAEC,MAAM;YAAYC;YAAaP;QAAc,KAAK,MAAMQ;IACtF;IAEA,IAAIF,SAAS,aAAa;QACxB,MAAME,cAAcC,KAAKC,GAAG,CAACL,SAAS,OAAO,QAAQ;QACrD,OAAOb,YAAYa,OAAO;YAAEC,MAAM;YAASC;YAAaP;QAAc,KAAK,MAAMQ;IACnF;IAEA,MAAMG,mBAA6C;QACjDC,OAAO;QACPC,aAAa;IACf;IAEA,IAAIhB,oBAAoBU,cAAc;QACpCI,iBAAiBG,QAAQ,GAAG;IAC9B;IAEA,IAAInB,iBAAiBK,gBAAgB;QACnCW,iBAAiBI,qBAAqB,GAAGnB,mBAAmBI;QAC5DW,iBAAiBK,qBAAqB,GAAGpB,mBAAmBI;IAC9D,OAAO;QACL,IAAIH,oBAAoBU,cAAc;YACpCI,iBAAiBM,wBAAwB,GAAGvB;QAC9C;IACF;IAEA,MAAMwB,YAAYC,KAAKC,YAAY,CAAC,SAAST;IAC7C,OAAOO,UAAUG,MAAM,CAAChB,SAAS,MAAMC;AACzC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Duration } from 'date-fns';
|
|
2
2
|
import { AbsoluteTimeRange, DurationString } from '../time';
|
|
3
3
|
import { FormatOptions } from './units';
|
|
4
|
-
export type UnitGroup = 'Time' | 'Percent' | 'Decimal' | 'Bytes' | 'Throughput' | 'Currency' | 'Temperature' | 'Date';
|
|
4
|
+
export type UnitGroup = 'Time' | 'Percent' | 'Decimal' | 'Bytes' | 'Bits' | 'Throughput' | 'Currency' | 'Temperature' | 'Date';
|
|
5
5
|
/**
|
|
6
6
|
* Configuration for rendering units that are part of a group.
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/model/units/types.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/model/units/types.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,SAAS,GACT,SAAS,GACT,OAAO,GACP,MAAM,GACN,YAAY,GACZ,UAAU,GACV,aAAa,GACb,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/units/types.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Common types needed across individual unit groups and the overall combined\n// units.\n\nimport { Duration } from 'date-fns';\nimport { AbsoluteTimeRange, DurationString } from '../time';\nimport { FormatOptions } from './units';\n\nexport type UnitGroup
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/types.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Common types needed across individual unit groups and the overall combined\n// units.\n\nimport { Duration } from 'date-fns';\nimport { AbsoluteTimeRange, DurationString } from '../time';\nimport { FormatOptions } from './units';\n\nexport type UnitGroup =\n | 'Time'\n | 'Percent'\n | 'Decimal'\n | 'Bytes'\n | 'Bits'\n | 'Throughput'\n | 'Currency'\n | 'Temperature'\n | 'Date';\n\n/**\n * Configuration for rendering units that are part of a group.\n */\nexport type UnitGroupConfig = {\n /**\n * The label that is shown in the UI.\n */\n label: string;\n /**\n * When true, the unit group supports setting decimal places.\n */\n decimalPlaces?: boolean;\n /**\n * When true, the unit group supports enabling shortValues.\n */\n shortValues?: boolean;\n};\n\n/**\n * Configuration for rendering a specific unit.\n */\nexport type UnitConfig = {\n /**\n * The group the unit is part of. This will inform common rendering behavior.\n */\n group?: UnitGroup;\n\n /**\n * When true, this unit will not be displayed in the unit selector. This is\n * useful for units that are shorthand variants of other units.\n */\n disableSelectorOption?: boolean;\n\n /**\n * The label that is shown in the UI.\n */\n label: string;\n};\n\n/**\n * Used in the tests for each type of unit.\n */\nexport interface UnitTestCase {\n value: number;\n format: FormatOptions;\n expected: string;\n}\n\nexport interface IntervalTestCase {\n timeRange: AbsoluteTimeRange;\n expected: Duration;\n}\n\nexport interface FormatTestCase {\n duration: Duration;\n expected: DurationString;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,6EAA6E;AAC7E,SAAS;AAsET,WAGC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BytesFormatOptions as BytesFormatOptions } from './bytes';
|
|
2
|
+
import { BitsFormatOptions as BitsFormatOptions } from './bits';
|
|
2
3
|
import { DecimalFormatOptions as DecimalFormatOptions } from './decimal';
|
|
3
4
|
import { PercentFormatOptions as PercentFormatOptions } from './percent';
|
|
4
5
|
import { TemperatureFormatOptions } from './temperature';
|
|
@@ -46,6 +47,7 @@ export declare const UNIT_CONFIG: {
|
|
|
46
47
|
readonly sgd: UnitConfig;
|
|
47
48
|
readonly usd: UnitConfig;
|
|
48
49
|
readonly "bits/sec": UnitConfig;
|
|
50
|
+
readonly "decbits/sec": UnitConfig;
|
|
49
51
|
readonly "bytes/sec": UnitConfig;
|
|
50
52
|
readonly "decbytes/sec": UnitConfig;
|
|
51
53
|
readonly "counts/sec": UnitConfig;
|
|
@@ -58,6 +60,8 @@ export declare const UNIT_CONFIG: {
|
|
|
58
60
|
readonly "requests/sec": UnitConfig;
|
|
59
61
|
readonly "rows/sec": UnitConfig;
|
|
60
62
|
readonly "writes/sec": UnitConfig;
|
|
63
|
+
readonly bits: UnitConfig;
|
|
64
|
+
readonly decbits: UnitConfig;
|
|
61
65
|
readonly bytes: UnitConfig;
|
|
62
66
|
readonly decbytes: UnitConfig;
|
|
63
67
|
readonly decimal: UnitConfig;
|
|
@@ -75,7 +79,7 @@ export declare const UNIT_CONFIG: {
|
|
|
75
79
|
readonly months: UnitConfig;
|
|
76
80
|
readonly years: UnitConfig;
|
|
77
81
|
};
|
|
78
|
-
export type FormatOptions = TimeFormatOptions | PercentFormatOptions | DecimalFormatOptions | BytesFormatOptions | ThroughputFormatOptions | CurrencyFormatOptions | TemperatureFormatOptions | DateFormatOptions;
|
|
82
|
+
export type FormatOptions = TimeFormatOptions | PercentFormatOptions | DecimalFormatOptions | BytesFormatOptions | BitsFormatOptions | ThroughputFormatOptions | CurrencyFormatOptions | TemperatureFormatOptions | DateFormatOptions;
|
|
79
83
|
type HasDecimalPlaces<UnitOpt> = UnitOpt extends {
|
|
80
84
|
decimalPlaces?: number;
|
|
81
85
|
} ? UnitOpt : never;
|
|
@@ -90,6 +94,7 @@ export declare function isTimeUnit(formatOptions: FormatOptions): formatOptions
|
|
|
90
94
|
export declare function isPercentUnit(formatOptions: FormatOptions): formatOptions is PercentFormatOptions;
|
|
91
95
|
export declare function isDecimalUnit(formatOptions: FormatOptions): formatOptions is DecimalFormatOptions;
|
|
92
96
|
export declare function isBytesUnit(formatOptions: FormatOptions): formatOptions is BytesFormatOptions;
|
|
97
|
+
export declare function isBitsUnit(formatOptions: FormatOptions): formatOptions is BitsFormatOptions;
|
|
93
98
|
export declare function isUnitWithDecimalPlaces(formatOptions: FormatOptions): formatOptions is HasDecimalPlaces<FormatOptions>;
|
|
94
99
|
export declare function isUnitWithShortValues(formatOptions: FormatOptions): formatOptions is HasShortValues<FormatOptions>;
|
|
95
100
|
export declare function isThroughputUnit(formatOptions: FormatOptions): formatOptions is ThroughputFormatOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../../src/model/units/units.ts"],"names":[],"mappings":"AAaA,OAAO,EAAe,kBAAkB,IAAI,kBAAkB,EAAyC,MAAM,SAAS,CAAC;AACvH,OAAO,EAEL,oBAAoB,IAAI,oBAAoB,EAG7C,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,oBAAoB,IAAI,oBAAoB,EAG7C,MAAM,WAAW,CAAC;AACnB,OAAO,EAIL,wBAAwB,EACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAc,iBAAiB,IAAI,iBAAiB,EAAuC,MAAM,QAAQ,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAIL,uBAAuB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA+D,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAChH,OAAO,EAAc,iBAAiB,EAAuC,MAAM,QAAQ,CAAC;AAE5F;;;;;;GAMG;AAEH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../../src/model/units/units.ts"],"names":[],"mappings":"AAaA,OAAO,EAAe,kBAAkB,IAAI,kBAAkB,EAAy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
|
import { formatBytes, BYTES_GROUP_CONFIG, BYTES_UNIT_CONFIG } from './bytes';
|
|
14
|
+
import { formatBits, BITS_GROUP_CONFIG, BITS_UNIT_CONFIG } from './bits';
|
|
14
15
|
import { formatDecimal, DECIMAL_GROUP_CONFIG, DECIMAL_UNIT_CONFIG } from './decimal';
|
|
15
16
|
import { formatPercent, PERCENT_GROUP_CONFIG, PERCENT_UNIT_CONFIG } from './percent';
|
|
16
17
|
import { TEMPERATURE_GROUP_CONFIG, formatTemperature, TEMPERATURE_UNIT_CONFIG } from './temperature';
|
|
@@ -29,6 +30,7 @@ import { formatDate, DATE_GROUP_CONFIG, DATE_UNIT_CONFIG } from './date';
|
|
|
29
30
|
Percent: PERCENT_GROUP_CONFIG,
|
|
30
31
|
Decimal: DECIMAL_GROUP_CONFIG,
|
|
31
32
|
Bytes: BYTES_GROUP_CONFIG,
|
|
33
|
+
Bits: BITS_GROUP_CONFIG,
|
|
32
34
|
Throughput: THROUGHPUT_GROUP_CONFIG,
|
|
33
35
|
Currency: CURRENCY_GROUP_CONFIG,
|
|
34
36
|
Temperature: TEMPERATURE_GROUP_CONFIG,
|
|
@@ -39,6 +41,7 @@ export const UNIT_CONFIG = {
|
|
|
39
41
|
...PERCENT_UNIT_CONFIG,
|
|
40
42
|
...DECIMAL_UNIT_CONFIG,
|
|
41
43
|
...BYTES_UNIT_CONFIG,
|
|
44
|
+
...BITS_UNIT_CONFIG,
|
|
42
45
|
...THROUGHPUT_UNIT_CONFIG,
|
|
43
46
|
...CURRENCY_UNIT_CONFIG,
|
|
44
47
|
...TEMPERATURE_UNIT_CONFIG,
|
|
@@ -51,6 +54,9 @@ export function formatValue(value, formatOptions) {
|
|
|
51
54
|
if (isBytesUnit(formatOptions)) {
|
|
52
55
|
return formatBytes(value, formatOptions);
|
|
53
56
|
}
|
|
57
|
+
if (isBitsUnit(formatOptions)) {
|
|
58
|
+
return formatBits(value, formatOptions);
|
|
59
|
+
}
|
|
54
60
|
if (isDecimalUnit(formatOptions)) {
|
|
55
61
|
return formatDecimal(value, formatOptions);
|
|
56
62
|
}
|
|
@@ -99,6 +105,9 @@ export function isDecimalUnit(formatOptions) {
|
|
|
99
105
|
export function isBytesUnit(formatOptions) {
|
|
100
106
|
return getUnitGroup(formatOptions) === 'Bytes';
|
|
101
107
|
}
|
|
108
|
+
export function isBitsUnit(formatOptions) {
|
|
109
|
+
return getUnitGroup(formatOptions) === 'Bits';
|
|
110
|
+
}
|
|
102
111
|
export function isUnitWithDecimalPlaces(formatOptions) {
|
|
103
112
|
const groupConfig = getUnitGroupConfig(formatOptions);
|
|
104
113
|
return !!groupConfig.decimalPlaces;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/units/units.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatBytes, BytesFormatOptions as BytesFormatOptions, BYTES_GROUP_CONFIG, BYTES_UNIT_CONFIG } from './bytes';\nimport {\n formatDecimal,\n DecimalFormatOptions as DecimalFormatOptions,\n DECIMAL_GROUP_CONFIG,\n DECIMAL_UNIT_CONFIG,\n} from './decimal';\nimport {\n formatPercent,\n PercentFormatOptions as PercentFormatOptions,\n PERCENT_GROUP_CONFIG,\n PERCENT_UNIT_CONFIG,\n} from './percent';\nimport {\n TEMPERATURE_GROUP_CONFIG,\n formatTemperature,\n TEMPERATURE_UNIT_CONFIG,\n TemperatureFormatOptions,\n} from './temperature';\nimport { formatTime, TimeFormatOptions as TimeFormatOptions, TIME_GROUP_CONFIG, TIME_UNIT_CONFIG } from './time';\nimport { UnitGroup, UnitGroupConfig, UnitConfig } from './types';\nimport {\n formatThroughput,\n THROUGHPUT_GROUP_CONFIG,\n THROUGHPUT_UNIT_CONFIG,\n ThroughputFormatOptions,\n} from './throughput';\nimport { formatCurrency, CURRENCY_GROUP_CONFIG, CURRENCY_UNIT_CONFIG, CurrencyFormatOptions } from './currency';\nimport { formatDate, DateFormatOptions, DATE_GROUP_CONFIG, DATE_UNIT_CONFIG } from './date';\n\n/**\n * Most of the number formatting is based on Intl.NumberFormat, which is built into JavaScript.\n * Prefer Intl.NumbeFormat because it covers most use cases and will continue to be supported with time.\n *\n * To format bytes, we also make use of the `numbro` package,\n * because it can handle adding units like KB, MB, GB, etc. correctly.\n */\n\nexport const UNIT_GROUP_CONFIG: Readonly<Record<UnitGroup, UnitGroupConfig>> = {\n Time: TIME_GROUP_CONFIG,\n Percent: PERCENT_GROUP_CONFIG,\n Decimal: DECIMAL_GROUP_CONFIG,\n Bytes: BYTES_GROUP_CONFIG,\n Throughput: THROUGHPUT_GROUP_CONFIG,\n Currency: CURRENCY_GROUP_CONFIG,\n Temperature: TEMPERATURE_GROUP_CONFIG,\n Date: DATE_GROUP_CONFIG,\n};\nexport const UNIT_CONFIG = {\n ...TIME_UNIT_CONFIG,\n ...PERCENT_UNIT_CONFIG,\n ...DECIMAL_UNIT_CONFIG,\n ...BYTES_UNIT_CONFIG,\n ...THROUGHPUT_UNIT_CONFIG,\n ...CURRENCY_UNIT_CONFIG,\n ...TEMPERATURE_UNIT_CONFIG,\n ...DATE_UNIT_CONFIG,\n} as const;\n\nexport type FormatOptions =\n | TimeFormatOptions\n | PercentFormatOptions\n | DecimalFormatOptions\n | BytesFormatOptions\n | ThroughputFormatOptions\n | CurrencyFormatOptions\n | TemperatureFormatOptions\n | DateFormatOptions;\n\ntype HasDecimalPlaces<UnitOpt> = UnitOpt extends { decimalPlaces?: number } ? UnitOpt : never;\ntype HasShortValues<UnitOpt> = UnitOpt extends { shortValues?: boolean } ? UnitOpt : never;\n\nexport function formatValue(value: number, formatOptions?: FormatOptions): string {\n if (!formatOptions) {\n return value.toString();\n }\n\n if (isBytesUnit(formatOptions)) {\n return formatBytes(value, formatOptions);\n }\n\n if (isDecimalUnit(formatOptions)) {\n return formatDecimal(value, formatOptions);\n }\n\n if (isPercentUnit(formatOptions)) {\n return formatPercent(value, formatOptions);\n }\n\n if (isTimeUnit(formatOptions)) {\n return formatTime(value, formatOptions);\n }\n\n if (isThroughputUnit(formatOptions)) {\n return formatThroughput(value, formatOptions);\n }\n\n if (isCurrencyUnit(formatOptions)) {\n return formatCurrency(value, formatOptions);\n }\n\n if (isDateUnit(formatOptions)) {\n return formatDate(value, formatOptions);\n }\n\n if (isTemperatureUnit(formatOptions)) {\n return formatTemperature(value, formatOptions);\n }\n\n const exhaustive: never = formatOptions;\n throw new Error(`Unknown unit options ${exhaustive}`);\n}\n\nexport function getUnitConfig(formatOptions: FormatOptions): UnitConfig {\n const unit = formatOptions.unit ?? 'decimal';\n return UNIT_CONFIG[unit];\n}\n\nexport function getUnitGroup(formatOptions: FormatOptions): UnitGroup {\n return getUnitConfig(formatOptions).group ?? 'Decimal';\n}\n\nexport function getUnitGroupConfig(formatOptions: FormatOptions): UnitGroupConfig {\n const unitConfig = getUnitConfig(formatOptions);\n return UNIT_GROUP_CONFIG[unitConfig.group ?? 'Decimal'];\n}\n\n// Type guards\nexport function isTimeUnit(formatOptions: FormatOptions): formatOptions is TimeFormatOptions {\n return getUnitGroup(formatOptions) === 'Time';\n}\n\nexport function isPercentUnit(formatOptions: FormatOptions): formatOptions is PercentFormatOptions {\n return getUnitGroup(formatOptions) === 'Percent';\n}\n\nexport function isDecimalUnit(formatOptions: FormatOptions): formatOptions is DecimalFormatOptions {\n return getUnitGroup(formatOptions) === 'Decimal';\n}\n\nexport function isBytesUnit(formatOptions: FormatOptions): formatOptions is BytesFormatOptions {\n return getUnitGroup(formatOptions) === 'Bytes';\n}\n\nexport function isUnitWithDecimalPlaces(\n formatOptions: FormatOptions\n): formatOptions is HasDecimalPlaces<FormatOptions> {\n const groupConfig = getUnitGroupConfig(formatOptions);\n\n return !!groupConfig.decimalPlaces;\n}\n\nexport function isUnitWithShortValues(formatOptions: FormatOptions): formatOptions is HasShortValues<FormatOptions> {\n const groupConfig = getUnitGroupConfig(formatOptions);\n\n return !!groupConfig.shortValues;\n}\n\nexport function isThroughputUnit(formatOptions: FormatOptions): formatOptions is ThroughputFormatOptions {\n return getUnitGroup(formatOptions) === 'Throughput';\n}\n\nexport function isCurrencyUnit(formatOptions: FormatOptions): formatOptions is CurrencyFormatOptions {\n return getUnitGroup(formatOptions) === 'Currency';\n}\n\nexport function isDateUnit(formatOptions: FormatOptions): formatOptions is DateFormatOptions {\n return getUnitGroup(formatOptions) === 'Date';\n}\n\nexport function isTemperatureUnit(formatOptions: FormatOptions): formatOptions is TemperatureFormatOptions {\n return getUnitGroup(formatOptions) === 'Temperature';\n}\n"],"names":["formatBytes","BYTES_GROUP_CONFIG","BYTES_UNIT_CONFIG","formatDecimal","DECIMAL_GROUP_CONFIG","DECIMAL_UNIT_CONFIG","formatPercent","PERCENT_GROUP_CONFIG","PERCENT_UNIT_CONFIG","TEMPERATURE_GROUP_CONFIG","formatTemperature","TEMPERATURE_UNIT_CONFIG","formatTime","TIME_GROUP_CONFIG","TIME_UNIT_CONFIG","formatThroughput","THROUGHPUT_GROUP_CONFIG","THROUGHPUT_UNIT_CONFIG","formatCurrency","CURRENCY_GROUP_CONFIG","CURRENCY_UNIT_CONFIG","formatDate","DATE_GROUP_CONFIG","DATE_UNIT_CONFIG","UNIT_GROUP_CONFIG","Time","Percent","Decimal","Bytes","Throughput","Currency","Temperature","Date","UNIT_CONFIG","formatValue","value","formatOptions","toString","isBytesUnit","isDecimalUnit","isPercentUnit","isTimeUnit","isThroughputUnit","isCurrencyUnit","isDateUnit","isTemperatureUnit","exhaustive","Error","getUnitConfig","unit","getUnitGroup","group","getUnitGroupConfig","unitConfig","isUnitWithDecimalPlaces","groupConfig","decimalPlaces","isUnitWithShortValues","sh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vC,OAAO,CAAC,CAACmB,YAAYC,aAAa;AACpC;AAEA,OAAO,SAASC,sBAAsBrB,aAA4B;IAChE,MAAMmB,cAAcH,mBAAmBhB;IAEvC,OAAO,CAAC,CAACmB,YAAYG,WAAW;AAClC;AAEA,OAAO,SAAShB,iBAAiBN,aAA4B;IAC3D,OAAOc,aAAad,mBAAmB;AACzC;AAEA,OAAO,SAASO,eAAeP,aAA4B;IACzD,OAAOc,aAAad,mBAAmB;AACzC;AAEA,OAAO,SAASQ,WAAWR,aAA4B;IACrD,OAAOc,aAAad,mBAAmB;AACzC;AAEA,OAAO,SAASS,kBAAkBT,aAA4B;IAC5D,OAAOc,aAAad,mBAAmB;AACzC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/units.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatBytes, BytesFormatOptions as BytesFormatOptions, BYTES_GROUP_CONFIG, BYTES_UNIT_CONFIG } from './bytes';\nimport { formatBits, BitsFormatOptions as BitsFormatOptions, BITS_GROUP_CONFIG, BITS_UNIT_CONFIG } from './bits';\nimport {\n formatDecimal,\n DecimalFormatOptions as DecimalFormatOptions,\n DECIMAL_GROUP_CONFIG,\n DECIMAL_UNIT_CONFIG,\n} from './decimal';\nimport {\n formatPercent,\n PercentFormatOptions as PercentFormatOptions,\n PERCENT_GROUP_CONFIG,\n PERCENT_UNIT_CONFIG,\n} from './percent';\nimport {\n TEMPERATURE_GROUP_CONFIG,\n formatTemperature,\n TEMPERATURE_UNIT_CONFIG,\n TemperatureFormatOptions,\n} from './temperature';\nimport { formatTime, TimeFormatOptions as TimeFormatOptions, TIME_GROUP_CONFIG, TIME_UNIT_CONFIG } from './time';\nimport { UnitGroup, UnitGroupConfig, UnitConfig } from './types';\nimport {\n formatThroughput,\n THROUGHPUT_GROUP_CONFIG,\n THROUGHPUT_UNIT_CONFIG,\n ThroughputFormatOptions,\n} from './throughput';\nimport { formatCurrency, CURRENCY_GROUP_CONFIG, CURRENCY_UNIT_CONFIG, CurrencyFormatOptions } from './currency';\nimport { formatDate, DateFormatOptions, DATE_GROUP_CONFIG, DATE_UNIT_CONFIG } from './date';\n\n/**\n * Most of the number formatting is based on Intl.NumberFormat, which is built into JavaScript.\n * Prefer Intl.NumbeFormat because it covers most use cases and will continue to be supported with time.\n *\n * To format bytes, we also make use of the `numbro` package,\n * because it can handle adding units like KB, MB, GB, etc. correctly.\n */\n\nexport const UNIT_GROUP_CONFIG: Readonly<Record<UnitGroup, UnitGroupConfig>> = {\n Time: TIME_GROUP_CONFIG,\n Percent: PERCENT_GROUP_CONFIG,\n Decimal: DECIMAL_GROUP_CONFIG,\n Bytes: BYTES_GROUP_CONFIG,\n Bits: BITS_GROUP_CONFIG,\n Throughput: THROUGHPUT_GROUP_CONFIG,\n Currency: CURRENCY_GROUP_CONFIG,\n Temperature: TEMPERATURE_GROUP_CONFIG,\n Date: DATE_GROUP_CONFIG,\n};\nexport const UNIT_CONFIG = {\n ...TIME_UNIT_CONFIG,\n ...PERCENT_UNIT_CONFIG,\n ...DECIMAL_UNIT_CONFIG,\n ...BYTES_UNIT_CONFIG,\n ...BITS_UNIT_CONFIG,\n ...THROUGHPUT_UNIT_CONFIG,\n ...CURRENCY_UNIT_CONFIG,\n ...TEMPERATURE_UNIT_CONFIG,\n ...DATE_UNIT_CONFIG,\n} as const;\n\nexport type FormatOptions =\n | TimeFormatOptions\n | PercentFormatOptions\n | DecimalFormatOptions\n | BytesFormatOptions\n | BitsFormatOptions\n | ThroughputFormatOptions\n | CurrencyFormatOptions\n | TemperatureFormatOptions\n | DateFormatOptions;\n\ntype HasDecimalPlaces<UnitOpt> = UnitOpt extends { decimalPlaces?: number } ? UnitOpt : never;\ntype HasShortValues<UnitOpt> = UnitOpt extends { shortValues?: boolean } ? UnitOpt : never;\n\nexport function formatValue(value: number, formatOptions?: FormatOptions): string {\n if (!formatOptions) {\n return value.toString();\n }\n\n if (isBytesUnit(formatOptions)) {\n return formatBytes(value, formatOptions);\n }\n\n if (isBitsUnit(formatOptions)) {\n return formatBits(value, formatOptions);\n }\n\n if (isDecimalUnit(formatOptions)) {\n return formatDecimal(value, formatOptions);\n }\n\n if (isPercentUnit(formatOptions)) {\n return formatPercent(value, formatOptions);\n }\n\n if (isTimeUnit(formatOptions)) {\n return formatTime(value, formatOptions);\n }\n\n if (isThroughputUnit(formatOptions)) {\n return formatThroughput(value, formatOptions);\n }\n\n if (isCurrencyUnit(formatOptions)) {\n return formatCurrency(value, formatOptions);\n }\n\n if (isDateUnit(formatOptions)) {\n return formatDate(value, formatOptions);\n }\n\n if (isTemperatureUnit(formatOptions)) {\n return formatTemperature(value, formatOptions);\n }\n\n const exhaustive: never = formatOptions;\n throw new Error(`Unknown unit options ${exhaustive}`);\n}\n\nexport function getUnitConfig(formatOptions: FormatOptions): UnitConfig {\n const unit = formatOptions.unit ?? 'decimal';\n return UNIT_CONFIG[unit];\n}\n\nexport function getUnitGroup(formatOptions: FormatOptions): UnitGroup {\n return getUnitConfig(formatOptions).group ?? 'Decimal';\n}\n\nexport function getUnitGroupConfig(formatOptions: FormatOptions): UnitGroupConfig {\n const unitConfig = getUnitConfig(formatOptions);\n return UNIT_GROUP_CONFIG[unitConfig.group ?? 'Decimal'];\n}\n\n// Type guards\nexport function isTimeUnit(formatOptions: FormatOptions): formatOptions is TimeFormatOptions {\n return getUnitGroup(formatOptions) === 'Time';\n}\n\nexport function isPercentUnit(formatOptions: FormatOptions): formatOptions is PercentFormatOptions {\n return getUnitGroup(formatOptions) === 'Percent';\n}\n\nexport function isDecimalUnit(formatOptions: FormatOptions): formatOptions is DecimalFormatOptions {\n return getUnitGroup(formatOptions) === 'Decimal';\n}\n\nexport function isBytesUnit(formatOptions: FormatOptions): formatOptions is BytesFormatOptions {\n return getUnitGroup(formatOptions) === 'Bytes';\n}\n\nexport function isBitsUnit(formatOptions: FormatOptions): formatOptions is BitsFormatOptions {\n return getUnitGroup(formatOptions) === 'Bits';\n}\n\nexport function isUnitWithDecimalPlaces(\n formatOptions: FormatOptions\n): formatOptions is HasDecimalPlaces<FormatOptions> {\n const groupConfig = getUnitGroupConfig(formatOptions);\n\n return !!groupConfig.decimalPlaces;\n}\n\nexport function isUnitWithShortValues(formatOptions: FormatOptions): formatOptions is HasShortValues<FormatOptions> {\n const groupConfig = getUnitGroupConfig(formatOptions);\n\n return !!groupConfig.shortValues;\n}\n\nexport function isThroughputUnit(formatOptions: FormatOptions): formatOptions is ThroughputFormatOptions {\n return getUnitGroup(formatOptions) === 'Throughput';\n}\n\nexport function isCurrencyUnit(formatOptions: FormatOptions): formatOptions is CurrencyFormatOptions {\n return getUnitGroup(formatOptions) === 'Currency';\n}\n\nexport function isDateUnit(formatOptions: FormatOptions): formatOptions is DateFormatOptions {\n return getUnitGroup(formatOptions) === 'Date';\n}\n\nexport function isTemperatureUnit(formatOptions: FormatOptions): formatOptions is TemperatureFormatOptions {\n return getUnitGroup(formatOptions) === 'Temperature';\n}\n"],"names":["formatBytes","BYTES_GROUP_CONFIG","BYTES_UNIT_CONFIG","formatBits","BITS_GROUP_CONFIG","BITS_UNIT_CONFIG","formatDecimal","DECIMAL_GROUP_CONFIG","DECIMAL_UNIT_CONFIG","formatPercent","PERCENT_GROUP_CONFIG","PERCENT_UNIT_CONFIG","TEMPERATURE_GROUP_CONFIG","formatTemperature","TEMPERATURE_UNIT_CONFIG","formatTime","TIME_GROUP_CONFIG","TIME_UNIT_CONFIG","formatThroughput","THROUGHPUT_GROUP_CONFIG","THROUGHPUT_UNIT_CONFIG","formatCurrency","CURRENCY_GROUP_CONFIG","CURRENCY_UNIT_CONFIG","formatDate","DATE_GROUP_CONFIG","DATE_UNIT_CONFIG","UNIT_GROUP_CONFIG","Time","Percent","Decimal","Bytes","Bits","Throughput","Currency","Temperature","Date","UNIT_CONFIG","formatValue","value","formatOptions","toString","isBytesUnit","isBitsUnit","isDecimalUnit","isPercentUnit","isTimeUnit","isThroughputUnit","isCurrencyUnit","isDateUnit","isTemperatureUnit","exhaustive","Error","getUnitConfig","unit","getUnitGroup","group","getUnitGroupConfig","unitConfig","isUnitWithDecimalPlaces","groupConfig","decimalPlaces","isUnitWithShortValues","shortValues"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,EAA4CC,kBAAkB,EAAEC,iBAAiB,QAAQ,UAAU;AACvH,SAASC,UAAU,EAA0CC,iBAAiB,EAAEC,gBAAgB,QAAQ,SAAS;AACjH,SACEC,aAAa,EAEbC,oBAAoB,EACpBC,mBAAmB,QACd,YAAY;AACnB,SACEC,aAAa,EAEbC,oBAAoB,EACpBC,mBAAmB,QACd,YAAY;AACnB,SACEC,wBAAwB,EACxBC,iBAAiB,EACjBC,uBAAuB,QAElB,gBAAgB;AACvB,SAASC,UAAU,EAA0CC,iBAAiB,EAAEC,gBAAgB,QAAQ,SAAS;AAEjH,SACEC,gBAAgB,EAChBC,uBAAuB,EACvBC,sBAAsB,QAEjB,eAAe;AACtB,SAASC,cAAc,EAAEC,qBAAqB,EAAEC,oBAAoB,QAA+B,aAAa;AAChH,SAASC,UAAU,EAAqBC,iBAAiB,EAAEC,gBAAgB,QAAQ,SAAS;AAE5F;;;;;;CAMC,GAED,OAAO,MAAMC,oBAAkE;IAC7EC,MAAMZ;IACNa,SAASnB;IACToB,SAASvB;IACTwB,OAAO9B;IACP+B,MAAM5B;IACN6B,YAAYd;I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,cAAcb,eAAegB,KAAK,IAAI;AAC/C;AAEA,OAAO,SAASC,mBAAmBjB,aAA4B;IAC7D,MAAMkB,aAAaL,cAAcb;IACjC,OAAOb,iBAAiB,CAAC+B,WAAWF,KAAK,IAAI,UAAU;AACzD;AAEA,cAAc;AACd,OAAO,SAASV,WAAWN,aAA4B;IACrD,OAAOe,aAAaf,mBAAmB;AACzC;AAEA,OAAO,SAASK,cAAcL,aAA4B;IACxD,OAAOe,aAAaf,mBAAmB;AACzC;AAEA,OAAO,SAASI,cAAcJ,aAA4B;IACxD,OAAOe,aAAaf,mBAAmB;AACzC;AAEA,OAAO,SAASE,YAAYF,aAA4B;IACtD,OAAOe,aAAaf,mBAAmB;AACzC;AAEA,OAAO,SAASG,WAAWH,aAA4B;IACrD,OAAOe,aAAaf,mBAAmB;AACzC;AAEA,OAAO,SAASmB,wBACdnB,aAA4B;IAE5B,MAAMoB,cAAcH,mBAAmBjB;IAEvC,OAAO,CAAC,CAACoB,YAAYC,aAAa;AACpC;AAEA,OAAO,SAASC,sBAAsBtB,aAA4B;IAChE,MAAMoB,cAAcH,mBAAmBjB;IAEvC,OAAO,CAAC,CAACoB,YAAYG,WAAW;AAClC;AAEA,OAAO,SAAShB,iBAAiBP,aAA4B;IAC3D,OAAOe,aAAaf,mBAAmB;AACzC;AAEA,OAAO,SAASQ,eAAeR,aAA4B;IACzD,OAAOe,aAAaf,mBAAmB;AACzC;AAEA,OAAO,SAASS,WAAWT,aAA4B;IACrD,OAAOe,aAAaf,mBAAmB;AACzC;AAEA,OAAO,SAASU,kBAAkBV,aAA4B;IAC5D,OAAOe,aAAaf,mBAAmB;AACzC"}
|
|
@@ -10,26 +10,26 @@ export declare const datasourceSchema: z.ZodObject<{
|
|
|
10
10
|
} & {
|
|
11
11
|
project: z.ZodString;
|
|
12
12
|
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
project: string;
|
|
14
13
|
name: string;
|
|
15
|
-
}, {
|
|
16
14
|
project: string;
|
|
15
|
+
}, {
|
|
17
16
|
name: string;
|
|
17
|
+
project: string;
|
|
18
18
|
}>;
|
|
19
19
|
spec: z.ZodType<DatasourceSpec<import("../model").UnknownSpec>, z.ZodTypeDef, DatasourceSpec<import("../model").UnknownSpec>>;
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
21
21
|
kind: "Datasource";
|
|
22
22
|
spec: DatasourceSpec<import("../model").UnknownSpec>;
|
|
23
23
|
metadata: {
|
|
24
|
-
project: string;
|
|
25
24
|
name: string;
|
|
25
|
+
project: string;
|
|
26
26
|
};
|
|
27
27
|
}, {
|
|
28
28
|
kind: "Datasource";
|
|
29
29
|
spec: DatasourceSpec<import("../model").UnknownSpec>;
|
|
30
30
|
metadata: {
|
|
31
|
-
project: string;
|
|
32
31
|
name: string;
|
|
32
|
+
project: string;
|
|
33
33
|
};
|
|
34
34
|
}>;
|
|
35
35
|
export declare const globalDatasourceSchema: z.ZodObject<{
|
|
@@ -12,10 +12,10 @@ export declare const projectMetadataSchema: z.ZodObject<{
|
|
|
12
12
|
} & {
|
|
13
13
|
project: z.ZodString;
|
|
14
14
|
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
project: string;
|
|
16
15
|
name: string;
|
|
17
|
-
}, {
|
|
18
16
|
project: string;
|
|
17
|
+
}, {
|
|
19
18
|
name: string;
|
|
19
|
+
project: string;
|
|
20
20
|
}>;
|
|
21
21
|
//# sourceMappingURL=metadata.d.ts.map
|
package/dist/schema/role.d.ts
CHANGED
|
@@ -9,26 +9,26 @@ export declare const roleSchema: z.ZodObject<{
|
|
|
9
9
|
} & {
|
|
10
10
|
project: z.ZodString;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
project: string;
|
|
13
12
|
name: string;
|
|
14
|
-
}, {
|
|
15
13
|
project: string;
|
|
14
|
+
}, {
|
|
16
15
|
name: string;
|
|
16
|
+
project: string;
|
|
17
17
|
}>;
|
|
18
18
|
spec: z.ZodType<RoleSpec, z.ZodTypeDef, RoleSpec>;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
20
|
kind: "Role";
|
|
21
21
|
spec: RoleSpec;
|
|
22
22
|
metadata: {
|
|
23
|
-
project: string;
|
|
24
23
|
name: string;
|
|
24
|
+
project: string;
|
|
25
25
|
};
|
|
26
26
|
}, {
|
|
27
27
|
kind: "Role";
|
|
28
28
|
spec: RoleSpec;
|
|
29
29
|
metadata: {
|
|
30
|
-
project: string;
|
|
31
30
|
name: string;
|
|
31
|
+
project: string;
|
|
32
32
|
};
|
|
33
33
|
}>;
|
|
34
34
|
export declare const globalRoleSchema: z.ZodObject<{
|
|
@@ -9,26 +9,26 @@ export declare const roleBindingSchema: z.ZodObject<{
|
|
|
9
9
|
} & {
|
|
10
10
|
project: z.ZodString;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
project: string;
|
|
13
12
|
name: string;
|
|
14
|
-
}, {
|
|
15
13
|
project: string;
|
|
14
|
+
}, {
|
|
16
15
|
name: string;
|
|
16
|
+
project: string;
|
|
17
17
|
}>;
|
|
18
18
|
spec: z.ZodType<RoleBindingSpec, z.ZodTypeDef, RoleBindingSpec>;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
20
|
kind: "RoleBinding";
|
|
21
21
|
spec: RoleBindingSpec;
|
|
22
22
|
metadata: {
|
|
23
|
-
project: string;
|
|
24
23
|
name: string;
|
|
24
|
+
project: string;
|
|
25
25
|
};
|
|
26
26
|
}, {
|
|
27
27
|
kind: "RoleBinding";
|
|
28
28
|
spec: RoleBindingSpec;
|
|
29
29
|
metadata: {
|
|
30
|
-
project: string;
|
|
31
30
|
name: string;
|
|
31
|
+
project: string;
|
|
32
32
|
};
|
|
33
33
|
}>;
|
|
34
34
|
export declare const globalRoleBindingSchema: z.ZodObject<{
|
package/dist/schema/secret.d.ts
CHANGED
|
@@ -257,11 +257,11 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
257
257
|
} & {
|
|
258
258
|
project: z.ZodString;
|
|
259
259
|
}, "strip", z.ZodTypeAny, {
|
|
260
|
-
project: string;
|
|
261
260
|
name: string;
|
|
262
|
-
}, {
|
|
263
261
|
project: string;
|
|
262
|
+
}, {
|
|
264
263
|
name: string;
|
|
264
|
+
project: string;
|
|
265
265
|
}>;
|
|
266
266
|
spec: z.ZodEffects<z.ZodObject<{
|
|
267
267
|
basicAuth: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
@@ -548,8 +548,8 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
548
548
|
} | undefined;
|
|
549
549
|
};
|
|
550
550
|
metadata: {
|
|
551
|
-
project: string;
|
|
552
551
|
name: string;
|
|
552
|
+
project: string;
|
|
553
553
|
};
|
|
554
554
|
}, {
|
|
555
555
|
kind: "Secret";
|
|
@@ -585,8 +585,8 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
585
585
|
} | undefined;
|
|
586
586
|
};
|
|
587
587
|
metadata: {
|
|
588
|
-
project: string;
|
|
589
588
|
name: string;
|
|
589
|
+
project: string;
|
|
590
590
|
};
|
|
591
591
|
}>;
|
|
592
592
|
export declare const globalSecretSchema: z.ZodObject<{
|
|
@@ -929,11 +929,11 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
929
929
|
} & {
|
|
930
930
|
project: z.ZodString;
|
|
931
931
|
}, "strip", z.ZodTypeAny, {
|
|
932
|
-
project: string;
|
|
933
932
|
name: string;
|
|
934
|
-
}, {
|
|
935
933
|
project: string;
|
|
934
|
+
}, {
|
|
936
935
|
name: string;
|
|
936
|
+
project: string;
|
|
937
937
|
}>;
|
|
938
938
|
spec: z.ZodEffects<z.ZodObject<{
|
|
939
939
|
basicAuth: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
@@ -1220,8 +1220,8 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1220
1220
|
} | undefined;
|
|
1221
1221
|
};
|
|
1222
1222
|
metadata: {
|
|
1223
|
-
project: string;
|
|
1224
1223
|
name: string;
|
|
1224
|
+
project: string;
|
|
1225
1225
|
};
|
|
1226
1226
|
}, {
|
|
1227
1227
|
kind: "Secret";
|
|
@@ -1257,8 +1257,8 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1257
1257
|
} | undefined;
|
|
1258
1258
|
};
|
|
1259
1259
|
metadata: {
|
|
1260
|
-
project: string;
|
|
1261
1260
|
name: string;
|
|
1261
|
+
project: string;
|
|
1262
1262
|
};
|
|
1263
1263
|
}>, z.ZodObject<{
|
|
1264
1264
|
kind: z.ZodLiteral<"GlobalSecret">;
|
|
@@ -35,26 +35,26 @@ export declare const variableSchema: z.ZodObject<{
|
|
|
35
35
|
} & {
|
|
36
36
|
project: z.ZodString;
|
|
37
37
|
}, "strip", z.ZodTypeAny, {
|
|
38
|
-
project: string;
|
|
39
38
|
name: string;
|
|
40
|
-
}, {
|
|
41
39
|
project: string;
|
|
40
|
+
}, {
|
|
42
41
|
name: string;
|
|
42
|
+
project: string;
|
|
43
43
|
}>;
|
|
44
44
|
spec: z.ZodType<TextVariableDefinition | ListVariableDefinition, z.ZodTypeDef, TextVariableDefinition | ListVariableDefinition>;
|
|
45
45
|
}, "strip", z.ZodTypeAny, {
|
|
46
46
|
kind: "Variable";
|
|
47
47
|
spec: TextVariableDefinition | ListVariableDefinition;
|
|
48
48
|
metadata: {
|
|
49
|
-
project: string;
|
|
50
49
|
name: string;
|
|
50
|
+
project: string;
|
|
51
51
|
};
|
|
52
52
|
}, {
|
|
53
53
|
kind: "Variable";
|
|
54
54
|
spec: TextVariableDefinition | ListVariableDefinition;
|
|
55
55
|
metadata: {
|
|
56
|
-
project: string;
|
|
57
56
|
name: string;
|
|
57
|
+
project: string;
|
|
58
58
|
};
|
|
59
59
|
}>;
|
|
60
60
|
export declare const globalVariableSchema: z.ZodObject<{
|
|
@@ -64,26 +64,26 @@ export declare const globalVariableSchema: z.ZodObject<{
|
|
|
64
64
|
} & {
|
|
65
65
|
project: z.ZodString;
|
|
66
66
|
}, "strip", z.ZodTypeAny, {
|
|
67
|
-
project: string;
|
|
68
67
|
name: string;
|
|
69
|
-
}, {
|
|
70
68
|
project: string;
|
|
69
|
+
}, {
|
|
71
70
|
name: string;
|
|
71
|
+
project: string;
|
|
72
72
|
}>;
|
|
73
73
|
spec: z.ZodType<TextVariableDefinition | ListVariableDefinition, z.ZodTypeDef, TextVariableDefinition | ListVariableDefinition>;
|
|
74
74
|
}, "strip", z.ZodTypeAny, {
|
|
75
75
|
kind: "GlobalVariable";
|
|
76
76
|
spec: TextVariableDefinition | ListVariableDefinition;
|
|
77
77
|
metadata: {
|
|
78
|
-
project: string;
|
|
79
78
|
name: string;
|
|
79
|
+
project: string;
|
|
80
80
|
};
|
|
81
81
|
}, {
|
|
82
82
|
kind: "GlobalVariable";
|
|
83
83
|
spec: TextVariableDefinition | ListVariableDefinition;
|
|
84
84
|
metadata: {
|
|
85
|
-
project: string;
|
|
86
85
|
name: string;
|
|
86
|
+
project: string;
|
|
87
87
|
};
|
|
88
88
|
}>;
|
|
89
89
|
export declare const variablesSchema: z.ZodSchema<Variable>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/core",
|
|
3
|
-
"version": "0.53.0-beta.
|
|
3
|
+
"version": "0.53.0-beta.4",
|
|
4
4
|
"description": "Core functionality consumed by both the Perses UI and plugins",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|