attlaz-client 1.9.26 → 1.9.28
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.
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { LogLevel } from './LogLevel';
|
|
2
2
|
import { DataValueValue } from '../DataValue';
|
|
3
|
+
import { LogStreamId } from './LogStreamId';
|
|
3
4
|
export declare class LogStreamInformation {
|
|
5
|
+
logStreamId: LogStreamId;
|
|
4
6
|
logLevels: {
|
|
5
7
|
logLevel: LogLevel;
|
|
6
|
-
|
|
8
|
+
count: number;
|
|
7
9
|
}[];
|
|
8
10
|
tags: {
|
|
9
11
|
tag: string;
|
|
10
12
|
values: {
|
|
11
13
|
value: DataValueValue;
|
|
12
|
-
|
|
14
|
+
count: number;
|
|
13
15
|
}[];
|
|
14
16
|
}[];
|
|
15
17
|
static parse(raw: any): LogStreamInformation;
|
|
@@ -2,32 +2,58 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LogStreamInformation = void 0;
|
|
4
4
|
const LogLevel_1 = require("./LogLevel");
|
|
5
|
+
const LogStreamId_1 = require("./LogStreamId");
|
|
5
6
|
class LogStreamInformation {
|
|
6
7
|
static parse(raw) {
|
|
7
8
|
const rawData = raw;
|
|
8
9
|
if (rawData === null || rawData === undefined) {
|
|
9
10
|
throw new Error('Invalid response');
|
|
10
11
|
}
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const result = new LogStreamInformation();
|
|
13
|
+
result.logStreamId = new LogStreamId_1.LogStreamId(rawData.log_stream);
|
|
14
|
+
/**
|
|
15
|
+
* LogLevel
|
|
16
|
+
*/
|
|
17
|
+
result.logLevels = [];
|
|
18
|
+
for (const logLevel of rawData.log_levels) {
|
|
19
|
+
result.logLevels.push({ logLevel: LogLevel_1.LogLevel.fromString(logLevel.log_level), count: logLevel.count });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Tags
|
|
23
|
+
*/
|
|
24
|
+
result.tags = [];
|
|
25
|
+
for (const tag of rawData.tags) {
|
|
26
|
+
const values = [];
|
|
27
|
+
for (const tagValue of tag.values) {
|
|
28
|
+
values.push({ value: tagValue.value, count: tagValue.count });
|
|
20
29
|
}
|
|
21
|
-
|
|
22
|
-
const tags = new Map();
|
|
23
|
-
if (rawData.tags !== null && rawData.tags !== undefined) {
|
|
24
|
-
Object.keys(rawData.tags).forEach((tagKey, index) => {
|
|
25
|
-
const values = rawData.tags[tagKey];
|
|
26
|
-
tags.set(tagKey, values);
|
|
27
|
-
});
|
|
30
|
+
result.tags.push({ tag: tag.tag, values: values });
|
|
28
31
|
}
|
|
29
|
-
|
|
30
|
-
//
|
|
32
|
+
// Object.keys(rawData.level_count).forEach((logLevelKey: string, index) => {
|
|
33
|
+
//
|
|
34
|
+
// const logLevel: LogLevel = LogLevel.fromString(logLevelKey);
|
|
35
|
+
//
|
|
36
|
+
// const parsedCount: number | null = parseInt(rawData.level_count[logLevelKey], undefined);
|
|
37
|
+
// if (parsedCount !== null) {
|
|
38
|
+
// logLevels.set(logLevel, parsedCount);
|
|
39
|
+
// } else {
|
|
40
|
+
// console.error('Unserialize log level count: Unable to parse log level count', rawData.level_count[logLevelKey]);
|
|
41
|
+
// }
|
|
42
|
+
//
|
|
43
|
+
// });
|
|
44
|
+
// const tags: Map<string, DataValueValue[]> = new Map<string, DataValueValue[]>();
|
|
45
|
+
// if (rawData.tags !== null && rawData.tags !== undefined) {
|
|
46
|
+
//
|
|
47
|
+
// Object.keys(rawData.tags).forEach((tagKey: string, index) => {
|
|
48
|
+
//
|
|
49
|
+
// const values: DataValueValue[] = rawData.tags[tagKey];
|
|
50
|
+
//
|
|
51
|
+
// tags.set(tagKey, values);
|
|
52
|
+
//
|
|
53
|
+
// });
|
|
54
|
+
// }
|
|
55
|
+
// throw new Error('Need update!');
|
|
56
|
+
return result;
|
|
31
57
|
}
|
|
32
58
|
}
|
|
33
59
|
exports.LogStreamInformation = LogStreamInformation;
|