attlaz-client 1.9.27 → 1.9.29

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,6 +1,8 @@
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;
@@ -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 logLevels = new Map();
12
- Object.keys(rawData.level_count).forEach((logLevelKey, index) => {
13
- const logLevel = LogLevel_1.LogLevel.fromString(logLevelKey);
14
- const parsedCount = parseInt(rawData.level_count[logLevelKey], undefined);
15
- if (parsedCount !== null) {
16
- logLevels.set(logLevel, parsedCount);
17
- }
18
- else {
19
- console.error('Unserialize log level count: Unable to parse log level count', rawData.level_count[logLevelKey]);
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
- throw new Error('Need update!');
30
- //return {logLevels: logLevels, tags};
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;
package/dist/Utils.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Utils = void 0;
4
- const util_1 = require("util");
5
4
  class Utils {
6
5
  static isNullOrUndefined(variable) {
7
6
  return variable === null || variable === undefined;
@@ -10,7 +9,7 @@ class Utils {
10
9
  return (input === true || input === 'true' || input === 1 || input === '1');
11
10
  }
12
11
  static isDate(value) {
13
- return value !== null && util_1.types.isDate(value) && !isNaN(value.getTime());
12
+ return value !== null && value instanceof Date && !isNaN(value.getTime());
14
13
  }
15
14
  static parseRawDate(input) {
16
15
  if (input !== null && input !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.9.27",
3
+ "version": "1.9.29",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",