attlaz-client 1.4.25 → 1.4.26
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,7 +1,7 @@
|
|
|
1
1
|
import { DataValue, DataValueValue } from './DataValue';
|
|
2
2
|
import { JsonSerializable } from './JsonSerializable';
|
|
3
3
|
export declare class DataValueCollection extends JsonSerializable implements Iterable<DataValue> {
|
|
4
|
-
private
|
|
4
|
+
private _values;
|
|
5
5
|
get length(): number;
|
|
6
6
|
static fromObject(rawValues: {
|
|
7
7
|
key: string;
|
|
@@ -7,10 +7,10 @@ const JsonSerializable_1 = require("./JsonSerializable");
|
|
|
7
7
|
class DataValueCollection extends JsonSerializable_1.JsonSerializable {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|
|
10
|
-
this.
|
|
10
|
+
this._values = [];
|
|
11
11
|
}
|
|
12
12
|
get length() {
|
|
13
|
-
return this.
|
|
13
|
+
return this._values.length;
|
|
14
14
|
}
|
|
15
15
|
static fromObject(rawValues) {
|
|
16
16
|
if (Utils_1.Utils.isNullOrUndefined(rawValues)) {
|
|
@@ -24,16 +24,16 @@ class DataValueCollection extends JsonSerializable_1.JsonSerializable {
|
|
|
24
24
|
return result;
|
|
25
25
|
}
|
|
26
26
|
set(key, value) {
|
|
27
|
-
const existingIndex = this.
|
|
27
|
+
const existingIndex = this._values.findIndex((tag) => {
|
|
28
28
|
return tag.key === key;
|
|
29
29
|
});
|
|
30
30
|
if (existingIndex !== -1) {
|
|
31
|
-
this.
|
|
31
|
+
this._values.splice(existingIndex);
|
|
32
32
|
}
|
|
33
|
-
this.
|
|
33
|
+
this._values.push(new DataValue_1.DataValue(key, value));
|
|
34
34
|
}
|
|
35
35
|
get(key) {
|
|
36
|
-
for (const tag of this.
|
|
36
|
+
for (const tag of this._values) {
|
|
37
37
|
if (tag.key === key) {
|
|
38
38
|
return tag.value;
|
|
39
39
|
}
|
|
@@ -41,21 +41,21 @@ class DataValueCollection extends JsonSerializable_1.JsonSerializable {
|
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
unset(key) {
|
|
44
|
-
this.
|
|
44
|
+
this._values = this._values.filter((tag) => {
|
|
45
45
|
return tag.key !== key;
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
serialize() {
|
|
49
|
-
if (this.
|
|
49
|
+
if (this._values.length === 0) {
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
|
-
return JSON.stringify(this.
|
|
52
|
+
return JSON.stringify(this._values);
|
|
53
53
|
}
|
|
54
54
|
[Symbol.iterator]() {
|
|
55
|
-
return this.
|
|
55
|
+
return this._values.values();
|
|
56
56
|
}
|
|
57
57
|
jsonSerialize() {
|
|
58
|
-
return this.
|
|
58
|
+
return this._values;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
exports.DataValueCollection = DataValueCollection;
|
package/dist/Model/Log/Log.d.ts
CHANGED
|
@@ -3,15 +3,15 @@ import { LogStreamId } from './LogStreamId';
|
|
|
3
3
|
import { LogStatus } from './LogStatus';
|
|
4
4
|
import { DataValueCollection } from '../DataValueCollection';
|
|
5
5
|
export declare class Log {
|
|
6
|
-
id: string;
|
|
6
|
+
id: string | null;
|
|
7
7
|
readonly logStream: LogStreamId;
|
|
8
8
|
readonly date: Date;
|
|
9
9
|
readonly level: LogLevel;
|
|
10
|
-
message: string;
|
|
10
|
+
readonly message: string;
|
|
11
11
|
context: object;
|
|
12
12
|
status: LogStatus;
|
|
13
13
|
tags: DataValueCollection;
|
|
14
14
|
_version: string;
|
|
15
|
-
constructor(logStream: LogStreamId, level: LogLevel, date: Date);
|
|
15
|
+
constructor(logStream: LogStreamId, message: string, level: LogLevel, date: Date);
|
|
16
16
|
static parse(rawLog: any): Log;
|
|
17
17
|
}
|
package/dist/Model/Log/Log.js
CHANGED
|
@@ -6,9 +6,11 @@ const LogStreamId_1 = require("./LogStreamId");
|
|
|
6
6
|
const LogStatus_1 = require("./LogStatus");
|
|
7
7
|
const DataValueCollection_1 = require("../DataValueCollection");
|
|
8
8
|
class Log {
|
|
9
|
-
constructor(logStream, level, date) {
|
|
9
|
+
constructor(logStream, message, level, date) {
|
|
10
|
+
this.id = null;
|
|
10
11
|
this.status = LogStatus_1.LogStatus.Normal;
|
|
11
12
|
this.logStream = logStream;
|
|
13
|
+
this.message = message;
|
|
12
14
|
this.level = level;
|
|
13
15
|
this.date = date;
|
|
14
16
|
this.tags = new DataValueCollection_1.DataValueCollection();
|
|
@@ -17,9 +19,8 @@ class Log {
|
|
|
17
19
|
const date = new Date(rawLog.date);
|
|
18
20
|
const level = LogLevel_1.LogLevel.fromString(rawLog.level);
|
|
19
21
|
const logStream = new LogStreamId_1.LogStreamId(rawLog.logStream.id);
|
|
20
|
-
let log = new Log(logStream, level, date);
|
|
22
|
+
let log = new Log(logStream, rawLog.message, level, date);
|
|
21
23
|
log.id = rawLog.id;
|
|
22
|
-
log.message = rawLog.message;
|
|
23
24
|
log.context = rawLog.context;
|
|
24
25
|
if (rawLog.status !== null && rawLog.status !== undefined && rawLog.status !== '') {
|
|
25
26
|
log.status = LogStatus_1.LogStatus.fromString(rawLog.status);
|