@perses-dev/core 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-explorer-plugin-c4a7621
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/model/calculations.js +1 -1
- package/dist/cjs/model/index.js +3 -0
- package/dist/cjs/model/query.js +12 -0
- package/dist/cjs/model/resource.js +14 -3
- package/dist/cjs/model/time.js +9 -11
- package/dist/cjs/model/trace-data.js +29 -1
- package/dist/cjs/model/transforms.js +28 -0
- package/dist/cjs/model/units/bytes.js +0 -3
- package/dist/cjs/model/units/decimal.js +0 -3
- package/dist/cjs/model/units/percent.js +0 -5
- package/dist/cjs/model/units/throughput.js +18 -12
- package/dist/cjs/model/units/time.js +0 -10
- package/dist/cjs/model/units/types.js +0 -13
- package/dist/cjs/model/units/units.js +1 -1
- package/dist/cjs/model/user.js +16 -0
- package/dist/cjs/model/value-mapping.js +16 -0
- package/dist/cjs/schema/datasource.js +85 -0
- package/dist/cjs/schema/display.js +27 -0
- package/dist/cjs/schema/duration.js +25 -0
- package/dist/cjs/schema/index.js +40 -0
- package/dist/cjs/schema/metadata.js +41 -0
- package/dist/cjs/schema/panel.js +106 -0
- package/dist/cjs/schema/plugin.js +27 -0
- package/dist/cjs/schema/role.js +86 -0
- package/dist/cjs/schema/rolebinding.js +65 -0
- package/dist/cjs/schema/secret.js +174 -0
- package/dist/cjs/schema/user.js +57 -0
- package/dist/cjs/schema/variable.js +171 -0
- package/dist/cjs/utils/fetch.js +14 -20
- package/dist/cjs/utils/index.js +3 -0
- package/dist/cjs/utils/memo.js +1 -2
- package/dist/cjs/utils/regexp.js +54 -0
- package/dist/cjs/utils/text.js +21 -46
- package/dist/cjs/utils/transform-data.js +167 -0
- package/dist/cjs/utils/value-mapping.js +105 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/model/calculations.d.ts +1 -1
- package/dist/model/calculations.d.ts.map +1 -1
- package/dist/model/calculations.js +1 -1
- package/dist/model/calculations.js.map +1 -1
- package/dist/model/datasource.d.ts +8 -8
- package/dist/model/datasource.d.ts.map +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/http.d.ts +5 -0
- package/dist/model/http.d.ts.map +1 -1
- package/dist/model/http.js.map +1 -1
- package/dist/model/index.d.ts +3 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +3 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.d.ts +3 -3
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js.map +1 -1
- package/dist/model/panels.d.ts +17 -1
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/project.d.ts +5 -0
- package/dist/model/project.d.ts.map +1 -1
- package/dist/model/project.js.map +1 -1
- package/dist/model/query.d.ts +10 -0
- package/dist/model/query.d.ts.map +1 -1
- package/dist/model/query.js +8 -3
- package/dist/model/query.js.map +1 -1
- package/dist/model/resource.d.ts +7 -0
- package/dist/model/resource.d.ts.map +1 -1
- package/dist/model/resource.js +3 -0
- package/dist/model/resource.js.map +1 -1
- package/dist/model/time-series-data.d.ts +1 -0
- package/dist/model/time-series-data.d.ts.map +1 -1
- package/dist/model/time-series-data.js.map +1 -1
- package/dist/model/time.d.ts.map +1 -1
- package/dist/model/time.js +9 -11
- package/dist/model/time.js.map +1 -1
- package/dist/model/trace-data.d.ts +80 -7
- package/dist/model/trace-data.d.ts.map +1 -1
- package/dist/model/trace-data.js +7 -3
- package/dist/model/trace-data.js.map +1 -1
- package/dist/model/transforms.d.ts +34 -0
- package/dist/model/transforms.d.ts.map +1 -0
- package/dist/model/transforms.js +21 -0
- package/dist/model/transforms.js.map +1 -0
- package/dist/model/units/bytes.d.ts +1 -2
- package/dist/model/units/bytes.d.ts.map +1 -1
- package/dist/model/units/bytes.js +0 -3
- package/dist/model/units/bytes.js.map +1 -1
- package/dist/model/units/decimal.d.ts +1 -2
- package/dist/model/units/decimal.d.ts.map +1 -1
- package/dist/model/units/decimal.js +0 -3
- package/dist/model/units/decimal.js.map +1 -1
- package/dist/model/units/percent.d.ts +1 -2
- package/dist/model/units/percent.d.ts.map +1 -1
- package/dist/model/units/percent.js +0 -5
- package/dist/model/units/percent.js.map +1 -1
- package/dist/model/units/throughput.d.ts +1 -2
- package/dist/model/units/throughput.d.ts.map +1 -1
- package/dist/model/units/throughput.js +18 -12
- package/dist/model/units/throughput.js.map +1 -1
- package/dist/model/units/time.d.ts +1 -2
- package/dist/model/units/time.d.ts.map +1 -1
- package/dist/model/units/time.js +0 -10
- package/dist/model/units/time.js.map +1 -1
- package/dist/model/units/types.d.ts +1 -2
- package/dist/model/units/types.d.ts.map +1 -1
- package/dist/model/units/types.js +1 -7
- package/dist/model/units/types.js.map +1 -1
- package/dist/model/units/units.d.ts +2 -0
- package/dist/model/units/units.d.ts.map +1 -1
- package/dist/model/units/units.js +1 -1
- package/dist/model/units/units.js.map +1 -1
- package/dist/model/units/utils.d.ts.map +1 -1
- package/dist/model/units/utils.js.map +1 -1
- package/dist/model/user.d.ts +21 -0
- package/dist/model/user.d.ts.map +1 -0
- package/dist/model/user.js +15 -0
- package/dist/model/user.js.map +1 -0
- package/dist/model/value-mapping.d.ts +35 -0
- package/dist/model/value-mapping.d.ts.map +1 -0
- package/dist/model/value-mapping.js +15 -0
- package/dist/model/value-mapping.js.map +1 -0
- package/dist/model/variables.d.ts +9 -8
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js.map +1 -1
- package/dist/schema/datasource.d.ts +61 -0
- package/dist/schema/datasource.d.ts.map +1 -0
- package/dist/schema/datasource.js +54 -0
- package/dist/schema/datasource.js.map +1 -0
- package/dist/schema/display.d.ts +12 -0
- package/dist/schema/display.d.ts.map +1 -0
- package/dist/schema/display.js +19 -0
- package/dist/schema/display.js.map +1 -0
- package/dist/schema/duration.d.ts +3 -0
- package/dist/schema/duration.d.ts.map +1 -0
- package/dist/schema/duration.js +17 -0
- package/dist/schema/duration.js.map +1 -0
- package/dist/schema/index.d.ts +12 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +25 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/metadata.d.ts +21 -0
- package/dist/schema/metadata.d.ts.map +1 -0
- package/dist/schema/metadata.js +22 -0
- package/dist/schema/metadata.js.map +1 -0
- package/dist/schema/panel.d.ts +13 -0
- package/dist/schema/panel.d.ts.map +1 -0
- package/dist/schema/panel.js +69 -0
- package/dist/schema/panel.js.map +1 -0
- package/dist/schema/plugin.d.ts +14 -0
- package/dist/schema/plugin.d.ts.map +1 -0
- package/dist/schema/plugin.js +19 -0
- package/dist/schema/plugin.js.map +1 -0
- package/dist/schema/role.d.ts +58 -0
- package/dist/schema/role.d.ts.map +1 -0
- package/dist/schema/role.js +61 -0
- package/dist/schema/role.js.map +1 -0
- package/dist/schema/rolebinding.d.ts +58 -0
- package/dist/schema/rolebinding.d.ts.map +1 -0
- package/dist/schema/rolebinding.js +40 -0
- package/dist/schema/rolebinding.js.map +1 -0
- package/dist/schema/secret.d.ts +1140 -0
- package/dist/schema/secret.d.ts.map +1 -0
- package/dist/schema/secret.js +152 -0
- package/dist/schema/secret.js.map +1 -0
- package/dist/schema/user.d.ts +8 -0
- package/dist/schema/user.d.ts.map +1 -0
- package/dist/schema/user.js +36 -0
- package/dist/schema/user.js.map +1 -0
- package/dist/schema/variable.d.ts +92 -0
- package/dist/schema/variable.d.ts.map +1 -0
- package/dist/schema/variable.js +119 -0
- package/dist/schema/variable.js.map +1 -0
- package/dist/utils/fetch.d.ts +5 -2
- package/dist/utils/fetch.d.ts.map +1 -1
- package/dist/utils/fetch.js +15 -21
- package/dist/utils/fetch.js.map +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/is-empty-object.d.ts.map +1 -1
- package/dist/utils/is-empty-object.js.map +1 -1
- package/dist/utils/memo.d.ts.map +1 -1
- package/dist/utils/memo.js +1 -2
- package/dist/utils/memo.js.map +1 -1
- package/dist/utils/panel-refs.d.ts +2 -2
- package/dist/utils/panel-refs.d.ts.map +1 -1
- package/dist/utils/panel-refs.js.map +1 -1
- package/dist/utils/regexp.d.ts +11 -0
- package/dist/utils/regexp.d.ts.map +1 -0
- package/dist/utils/regexp.js +42 -0
- package/dist/utils/regexp.js.map +1 -0
- package/dist/utils/text.d.ts +7 -33
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/text.js +21 -52
- package/dist/utils/text.js.map +1 -1
- package/dist/utils/time-series-data.d.ts.map +1 -1
- package/dist/utils/time-series-data.js.map +1 -1
- package/dist/utils/transform-data.d.ts +8 -0
- package/dist/utils/transform-data.d.ts.map +1 -0
- package/dist/utils/transform-data.js +221 -0
- package/dist/utils/transform-data.js.map +1 -0
- package/dist/utils/value-mapping.d.ts +3 -0
- package/dist/utils/value-mapping.d.ts.map +1 -0
- package/dist/utils/value-mapping.js +97 -0
- package/dist/utils/value-mapping.js.map +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
_export_star(require("./constants"), exports);
|
|
18
18
|
_export_star(require("./model"), exports);
|
|
19
|
+
_export_star(require("./schema"), exports);
|
|
19
20
|
_export_star(require("./utils"), exports);
|
|
20
21
|
function _export_star(from, to) {
|
|
21
22
|
Object.keys(from).forEach(function(k) {
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -38,8 +38,11 @@ _export_star(require("./time"), exports);
|
|
|
38
38
|
_export_star(require("./time-series-data"), exports);
|
|
39
39
|
_export_star(require("./time-series-queries"), exports);
|
|
40
40
|
_export_star(require("./trace-data"), exports);
|
|
41
|
+
_export_star(require("./transforms"), exports);
|
|
41
42
|
_export_star(require("./units"), exports);
|
|
43
|
+
_export_star(require("./user"), exports);
|
|
42
44
|
_export_star(require("./variables"), exports);
|
|
45
|
+
_export_star(require("./value-mapping"), exports);
|
|
43
46
|
function _export_star(from, to) {
|
|
44
47
|
Object.keys(from).forEach(function(k) {
|
|
45
48
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/dist/cjs/model/query.js
CHANGED
|
@@ -14,3 +14,15 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
Object.defineProperty(exports, "isValidQueryPluginType", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return isValidQueryPluginType;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function isValidQueryPluginType(type) {
|
|
24
|
+
return [
|
|
25
|
+
'TimeSeriesQuery',
|
|
26
|
+
'TraceQuery'
|
|
27
|
+
].includes(type);
|
|
28
|
+
}
|
|
@@ -14,12 +14,23 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
getMetadataProject: function() {
|
|
20
25
|
return getMetadataProject;
|
|
26
|
+
},
|
|
27
|
+
isProjectMetadata: function() {
|
|
28
|
+
return isProjectMetadata;
|
|
21
29
|
}
|
|
22
30
|
});
|
|
31
|
+
function isProjectMetadata(metadata) {
|
|
32
|
+
return 'project' in metadata;
|
|
33
|
+
}
|
|
23
34
|
function getMetadataProject(metadata) {
|
|
24
35
|
return 'project' in metadata ? metadata.project : undefined;
|
|
25
36
|
}
|
package/dist/cjs/model/time.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -69,8 +69,7 @@ function isAbsoluteTimeRange(timeRange) {
|
|
|
69
69
|
return timeRange.start !== undefined && timeRange.end !== undefined;
|
|
70
70
|
}
|
|
71
71
|
function toAbsoluteTimeRange(timeRange) {
|
|
72
|
-
|
|
73
|
-
const end = (_timeRange_end = timeRange.end) !== null && _timeRange_end !== void 0 ? _timeRange_end : new Date();
|
|
72
|
+
const end = timeRange.end ?? new Date();
|
|
74
73
|
return {
|
|
75
74
|
start: (0, _datefns.sub)(end, parseDurationString(timeRange.pastDuration)),
|
|
76
75
|
end
|
|
@@ -82,15 +81,14 @@ function parseDurationString(durationString) {
|
|
|
82
81
|
if (matches === null) {
|
|
83
82
|
throw new Error(`Invalid duration string '${durationString}'`);
|
|
84
83
|
}
|
|
85
|
-
var _matches_, _matches_1, _matches_2, _matches_3, _matches_4, _matches_5, _matches_6;
|
|
86
84
|
return {
|
|
87
|
-
years: parseInt(
|
|
85
|
+
years: parseInt(matches[1] ?? '0'),
|
|
88
86
|
months: 0,
|
|
89
|
-
weeks: parseInt(
|
|
90
|
-
days: parseInt(
|
|
91
|
-
hours: parseInt(
|
|
92
|
-
minutes: parseInt(
|
|
93
|
-
seconds: parseInt(
|
|
87
|
+
weeks: parseInt(matches[2] ?? '0'),
|
|
88
|
+
days: parseInt(matches[3] ?? '0'),
|
|
89
|
+
hours: parseInt(matches[4] ?? '0'),
|
|
90
|
+
minutes: parseInt(matches[5] ?? '0'),
|
|
91
|
+
seconds: parseInt(matches[6] ?? '0') + parseInt(matches[7] ?? '0') / 1000
|
|
94
92
|
};
|
|
95
93
|
}
|
|
96
94
|
function isDurationString(maybeDuration) {
|
|
@@ -144,7 +142,7 @@ function formatDuration(duration) {
|
|
|
144
142
|
if (seconds) {
|
|
145
143
|
result.push(`${seconds}s`);
|
|
146
144
|
}
|
|
147
|
-
const ms = (duration.seconds - seconds) * 1000;
|
|
145
|
+
const ms = Math.round((duration.seconds - seconds) * 1000);
|
|
148
146
|
if (ms) {
|
|
149
147
|
result.push(`${ms}ms`);
|
|
150
148
|
}
|
|
@@ -10,7 +10,35 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Common types
|
|
15
|
+
*/ "use strict";
|
|
14
16
|
Object.defineProperty(exports, "__esModule", {
|
|
15
17
|
value: true
|
|
16
18
|
});
|
|
19
|
+
function _export(target, all) {
|
|
20
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: all[name]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
_export(exports, {
|
|
26
|
+
SpanStatusError: function() {
|
|
27
|
+
return SpanStatusError;
|
|
28
|
+
},
|
|
29
|
+
SpanStatusOk: function() {
|
|
30
|
+
return SpanStatusOk;
|
|
31
|
+
},
|
|
32
|
+
SpanStatusUnset: function() {
|
|
33
|
+
return SpanStatusUnset;
|
|
34
|
+
},
|
|
35
|
+
isValidTraceId: function() {
|
|
36
|
+
return isValidTraceId;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const SpanStatusUnset = 'STATUS_CODE_UNSET';
|
|
40
|
+
const SpanStatusOk = 'STATUS_CODE_OK';
|
|
41
|
+
const SpanStatusError = 'STATUS_CODE_ERROR';
|
|
42
|
+
function isValidTraceId(traceId) {
|
|
43
|
+
return /^[0-9a-fA-F]+$/.test(traceId);
|
|
44
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "TRANSFORM_TEXT", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return TRANSFORM_TEXT;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const TRANSFORM_TEXT = {
|
|
24
|
+
JoinByColumnValue: 'Join by column value',
|
|
25
|
+
MergeColumns: 'Merge columns',
|
|
26
|
+
MergeIndexedColumns: 'Merge indexed columns',
|
|
27
|
+
MergeSeries: 'Merge series'
|
|
28
|
+
};
|
|
@@ -33,11 +33,6 @@ _export(exports, {
|
|
|
33
33
|
});
|
|
34
34
|
const _constants = require("./constants");
|
|
35
35
|
const _utils = require("./utils");
|
|
36
|
-
const percentUnits = [
|
|
37
|
-
'percent',
|
|
38
|
-
'percent-decimal',
|
|
39
|
-
'%'
|
|
40
|
-
];
|
|
41
36
|
const PERCENT_GROUP_CONFIG = {
|
|
42
37
|
label: 'percent',
|
|
43
38
|
decimalPlaces: true
|
|
@@ -31,26 +31,23 @@ _export(exports, {
|
|
|
31
31
|
return formatThroughput;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
+
const _bytes = require("./bytes");
|
|
34
35
|
const _constants = require("./constants");
|
|
35
36
|
const _utils = require("./utils");
|
|
36
|
-
const throughputUnits = [
|
|
37
|
-
'counts/sec',
|
|
38
|
-
'events/sec',
|
|
39
|
-
'messages/sec',
|
|
40
|
-
'ops/sec',
|
|
41
|
-
'packets/sec',
|
|
42
|
-
'reads/sec',
|
|
43
|
-
'records/sec',
|
|
44
|
-
'requests/sec',
|
|
45
|
-
'rows/sec',
|
|
46
|
-
'writes/sec'
|
|
47
|
-
];
|
|
48
37
|
const THROUGHPUT_GROUP_CONFIG = {
|
|
49
38
|
label: 'Throughput',
|
|
50
39
|
decimalPlaces: true
|
|
51
40
|
};
|
|
52
41
|
const THROUGHPUT_GROUP = 'Throughput';
|
|
53
42
|
const THROUGHPUT_UNIT_CONFIG = {
|
|
43
|
+
'bits/sec': {
|
|
44
|
+
group: THROUGHPUT_GROUP,
|
|
45
|
+
label: 'Bits/sec'
|
|
46
|
+
},
|
|
47
|
+
'bytes/sec': {
|
|
48
|
+
group: THROUGHPUT_GROUP,
|
|
49
|
+
label: 'Bytes/sec'
|
|
50
|
+
},
|
|
54
51
|
'counts/sec': {
|
|
55
52
|
group: THROUGHPUT_GROUP,
|
|
56
53
|
label: 'Counts/sec'
|
|
@@ -93,6 +90,15 @@ const THROUGHPUT_UNIT_CONFIG = {
|
|
|
93
90
|
}
|
|
94
91
|
};
|
|
95
92
|
function formatThroughput(value, { unit, shortValues, decimalPlaces }) {
|
|
93
|
+
// special case for data throughput
|
|
94
|
+
if (unit === 'bytes/sec') {
|
|
95
|
+
const denominator = Math.abs(value) < 1000 ? 'sec' : 's';
|
|
96
|
+
return (0, _bytes.formatBytes)(value, {
|
|
97
|
+
unit: 'bytes',
|
|
98
|
+
shortValues,
|
|
99
|
+
decimalPlaces
|
|
100
|
+
}) + '/' + denominator;
|
|
101
|
+
}
|
|
96
102
|
const formatterOptions = {
|
|
97
103
|
style: 'decimal',
|
|
98
104
|
useGrouping: true
|
|
@@ -36,16 +36,6 @@ _export(exports, {
|
|
|
36
36
|
});
|
|
37
37
|
const _constants = require("./constants");
|
|
38
38
|
const _utils = require("./utils");
|
|
39
|
-
const timeUnits = [
|
|
40
|
-
'milliseconds',
|
|
41
|
-
'seconds',
|
|
42
|
-
'minutes',
|
|
43
|
-
'hours',
|
|
44
|
-
'days',
|
|
45
|
-
'weeks',
|
|
46
|
-
'months',
|
|
47
|
-
'years'
|
|
48
|
-
];
|
|
49
39
|
const TIME_GROUP = 'Time';
|
|
50
40
|
const TIME_GROUP_CONFIG = {
|
|
51
41
|
label: 'Time',
|
|
@@ -16,16 +16,3 @@
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", {
|
|
17
17
|
value: true
|
|
18
18
|
});
|
|
19
|
-
Object.defineProperty(exports, "UNIT_GROUPS", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function() {
|
|
22
|
-
return UNIT_GROUPS;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
const UNIT_GROUPS = [
|
|
26
|
-
'Time',
|
|
27
|
-
'Percent',
|
|
28
|
-
'Decimal',
|
|
29
|
-
'Bytes',
|
|
30
|
-
'Throughput'
|
|
31
|
-
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
buildDatasourceDefinitionSchema: function() {
|
|
25
|
+
return buildDatasourceDefinitionSchema;
|
|
26
|
+
},
|
|
27
|
+
buildDatasourceSpecSchema: function() {
|
|
28
|
+
return buildDatasourceSpecSchema;
|
|
29
|
+
},
|
|
30
|
+
datasourceDefinitionSchema: function() {
|
|
31
|
+
return datasourceDefinitionSchema;
|
|
32
|
+
},
|
|
33
|
+
datasourceSchema: function() {
|
|
34
|
+
return datasourceSchema;
|
|
35
|
+
},
|
|
36
|
+
datasourceSpecSchema: function() {
|
|
37
|
+
return datasourceSpecSchema;
|
|
38
|
+
},
|
|
39
|
+
datasourcesSchema: function() {
|
|
40
|
+
return datasourcesSchema;
|
|
41
|
+
},
|
|
42
|
+
globalDatasourceSchema: function() {
|
|
43
|
+
return globalDatasourceSchema;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const _zod = require("zod");
|
|
47
|
+
const _metadata = require("./metadata");
|
|
48
|
+
const _plugin = require("./plugin");
|
|
49
|
+
const _display = require("./display");
|
|
50
|
+
const datasourceSpecSchema = _zod.z.object({
|
|
51
|
+
display: _display.displaySchema.optional(),
|
|
52
|
+
default: _zod.z.boolean(),
|
|
53
|
+
plugin: _plugin.pluginSchema
|
|
54
|
+
});
|
|
55
|
+
function buildDatasourceSpecSchema(pluginSchema) {
|
|
56
|
+
return _zod.z.object({
|
|
57
|
+
display: _display.displaySchema.optional(),
|
|
58
|
+
default: _zod.z.boolean(),
|
|
59
|
+
plugin: pluginSchema
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const datasourceSchema = _zod.z.object({
|
|
63
|
+
kind: _zod.z.literal('Datasource'),
|
|
64
|
+
metadata: _metadata.projectMetadataSchema,
|
|
65
|
+
spec: datasourceSpecSchema
|
|
66
|
+
});
|
|
67
|
+
const globalDatasourceSchema = _zod.z.object({
|
|
68
|
+
kind: _zod.z.literal('GlobalDatasource'),
|
|
69
|
+
metadata: _metadata.metadataSchema,
|
|
70
|
+
spec: datasourceSpecSchema
|
|
71
|
+
});
|
|
72
|
+
const datasourcesSchema = _zod.z.discriminatedUnion('kind', [
|
|
73
|
+
datasourceSchema,
|
|
74
|
+
globalDatasourceSchema
|
|
75
|
+
]);
|
|
76
|
+
const datasourceDefinitionSchema = _zod.z.object({
|
|
77
|
+
name: _zod.z.string().min(1),
|
|
78
|
+
spec: datasourceSpecSchema
|
|
79
|
+
});
|
|
80
|
+
function buildDatasourceDefinitionSchema(pluginSchema) {
|
|
81
|
+
return _zod.z.object({
|
|
82
|
+
name: _zod.z.string().min(1),
|
|
83
|
+
spec: buildDatasourceSpecSchema(pluginSchema)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "displaySchema", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return displaySchema;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _zod = require("zod");
|
|
24
|
+
const displaySchema = _zod.z.object({
|
|
25
|
+
name: _zod.z.string().optional(),
|
|
26
|
+
description: _zod.z.string().optional()
|
|
27
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "durationValidationSchema", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return durationValidationSchema;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _zod = require("zod");
|
|
24
|
+
const _model = require("../model");
|
|
25
|
+
const durationValidationSchema = _zod.z.string().min(1, 'Required').regex(_model.DURATION_REGEX, 'Must be a valid duration string');
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
_export_star(require("./datasource"), exports);
|
|
18
|
+
_export_star(require("./display"), exports);
|
|
19
|
+
_export_star(require("./duration"), exports);
|
|
20
|
+
_export_star(require("./metadata"), exports);
|
|
21
|
+
_export_star(require("./panel"), exports);
|
|
22
|
+
_export_star(require("./plugin"), exports);
|
|
23
|
+
_export_star(require("./role"), exports);
|
|
24
|
+
_export_star(require("./rolebinding"), exports);
|
|
25
|
+
_export_star(require("./secret"), exports);
|
|
26
|
+
_export_star(require("./user"), exports);
|
|
27
|
+
_export_star(require("./variable"), exports);
|
|
28
|
+
function _export_star(from, to) {
|
|
29
|
+
Object.keys(from).forEach(function(k) {
|
|
30
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
31
|
+
Object.defineProperty(to, k, {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function() {
|
|
34
|
+
return from[k];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return from;
|
|
40
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
metadataSchema: function() {
|
|
25
|
+
return metadataSchema;
|
|
26
|
+
},
|
|
27
|
+
nameSchema: function() {
|
|
28
|
+
return nameSchema;
|
|
29
|
+
},
|
|
30
|
+
projectMetadataSchema: function() {
|
|
31
|
+
return projectMetadataSchema;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _zod = require("zod");
|
|
35
|
+
const nameSchema = _zod.z.string().min(1, 'Required').max(75, 'Must be 75 or fewer characters long').regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');
|
|
36
|
+
const metadataSchema = _zod.z.object({
|
|
37
|
+
name: nameSchema
|
|
38
|
+
});
|
|
39
|
+
const projectMetadataSchema = metadataSchema.extend({
|
|
40
|
+
project: nameSchema
|
|
41
|
+
});
|