attlaz-client 1.16.0 → 1.16.2

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.
@@ -43,6 +43,9 @@ export class ClientError {
43
43
  clientError.code = HttpClient.HTTP_UNAVAILABLE;
44
44
  }
45
45
  break;
46
+ case 500:
47
+ clientError.code = HttpClient.HTTP_INTERNAL_SERVER_ERROR;
48
+ break;
46
49
  default:
47
50
  console.warn('[Client error] Error code `' + error.code + '` not recognised');
48
51
  clientError.code = error.code;
@@ -23,7 +23,7 @@ export class Log {
23
23
  static parse(rawLog) {
24
24
  const date = Utils.parseRawDate(rawLog.date);
25
25
  const level = LogLevel.fromString(rawLog.level);
26
- const logStream = new LogStreamId(rawLog.log_stream.id);
26
+ const logStream = new LogStreamId(rawLog.log_stream);
27
27
  const log = new Log(logStream, rawLog.message, level, date);
28
28
  log.id = rawLog.id;
29
29
  log.context = rawLog.context;
@@ -3,6 +3,7 @@ import { LogStreamId } from './LogStreamId.js';
3
3
  import { DataValueValue } from '../DataValue.js';
4
4
  export declare class LogQuery {
5
5
  readonly logStreamId: LogStreamId;
6
+ /** @deprecated use filters property instead **/
6
7
  message: string | null;
7
8
  hidden: boolean | null;
8
9
  logLevels: LogLevel[] | null;
@@ -10,6 +11,11 @@ export declare class LogQuery {
10
11
  key: string;
11
12
  values: DataValueValue[];
12
13
  }> | null;
14
+ filters: {
15
+ field: 'message' | 'context';
16
+ value: string;
17
+ method: 'contains';
18
+ }[];
13
19
  limit: number | null;
14
20
  startingAfterId: string | null;
15
21
  sort: Array<{
@@ -1,9 +1,11 @@
1
1
  export class LogQuery {
2
2
  logStreamId;
3
+ /** @deprecated use filters property instead **/
3
4
  message = null;
4
5
  hidden = null;
5
6
  logLevels = null;
6
7
  tags = null;
8
+ filters = [];
7
9
  limit = null;
8
10
  startingAfterId = null;
9
11
  sort;
package/dist/Utils.js CHANGED
@@ -18,7 +18,7 @@ export class Utils {
18
18
  if (this.isNullOrUndefined(input)) {
19
19
  return null;
20
20
  }
21
- // tslint:disable-next-line:forin
21
+ // eslint-disable-next-line guard-for-in
22
22
  for (const property in Enum) {
23
23
  // noinspection JSUnfilteredForInLoop
24
24
  const enumMember = Enum[property];
@@ -31,6 +31,7 @@ export class Utils {
31
31
  }
32
32
  return res;
33
33
  }
34
+ // eslint-disable-next-line no-dupe-else-if
34
35
  }
35
36
  else if (typeof enumMember === 'string') {
36
37
  console.error('Unable to parse enum type: ' + typeof enumMember + ' for enum ', Enum);
@@ -45,13 +46,17 @@ export class Utils {
45
46
  if (input === null || input === undefined || input === '') {
46
47
  return '';
47
48
  }
48
- return Buffer.from(input.toString()).toString('base64');
49
+ // Use btoa as we want this package to work both in Node and Browser
50
+ return btoa(input);
51
+ // return Buffer.from(input.toString()).toString('base64');
49
52
  }
50
53
  static base64decode(encodedString) {
51
54
  if (encodedString === null || encodedString === undefined || encodedString === '') {
52
55
  return '';
53
56
  }
54
- return Buffer.from(encodedString, 'base64').toString();
57
+ // Use atob as we want this package to work both in Node and Browser
58
+ return atob(encodedString);
59
+ // return Buffer.from(encodedString, 'base64').toString();
55
60
  }
56
61
  static isIterable(variable) {
57
62
  if (Utils.isNullOrUndefined(variable) || typeof variable === 'string') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.16.0",
3
+ "version": "1.16.2",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",