attlaz-client 1.16.1 → 1.16.3

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,6 @@
1
- export declare class ClientError implements Error {
1
+ export declare class ClientError extends Error {
2
2
  code: number | null;
3
3
  name: string;
4
- message: string;
5
4
  stack?: string;
6
5
  constructor(name: string, code?: number | null);
7
6
  static fromError(error: Error | any): ClientError;
@@ -1,14 +1,11 @@
1
1
  import { HttpClient } from './HttpClient.js';
2
- export class ClientError {
2
+ export class ClientError extends Error {
3
3
  code;
4
4
  name;
5
- message;
6
- // description: string | null;
7
5
  stack = undefined;
8
- // body: string | null = null;
9
6
  constructor(name, code = null) {
7
+ super(name);
10
8
  this.name = name;
11
- this.message = name;
12
9
  this.code = code;
13
10
  }
14
11
  static fromError(error) {
@@ -43,6 +40,9 @@ export class ClientError {
43
40
  clientError.code = HttpClient.HTTP_UNAVAILABLE;
44
41
  }
45
42
  break;
43
+ case 500:
44
+ clientError.code = HttpClient.HTTP_INTERNAL_SERVER_ERROR;
45
+ break;
46
46
  default:
47
47
  console.warn('[Client error] Error code `' + error.code + '` not recognised');
48
48
  clientError.code = error.code;
@@ -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/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.16.0";
1
+ export declare const VERSION = "1.16.3";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.16.0";
1
+ export const VERSION = "1.16.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.16.1",
3
+ "version": "1.16.3",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",