attlaz-client 1.9.59 → 1.9.61

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.
@@ -11,7 +11,7 @@ class Adapter {
11
11
  adapter.icon = rawAdapter.icon;
12
12
  adapter.logo = rawAdapter.logo;
13
13
  adapter.type = rawAdapter.type;
14
- adapter.categoryIds = rawAdapter.category_ids;
14
+ adapter.categoryIds = rawAdapter.categories;
15
15
  adapter.docs = rawAdapter.docs;
16
16
  adapter.website = rawAdapter.website;
17
17
  return adapter;
@@ -0,0 +1,9 @@
1
+ import { LogLevel } from './LogLevel';
2
+ import { DataValueValue } from '../DataValue';
3
+ export declare class LogItemFilter {
4
+ logLevels: LogLevel[] | null;
5
+ tags: Array<{
6
+ key: string;
7
+ values: DataValueValue[];
8
+ }> | null;
9
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogItemFilter = void 0;
4
+ class LogItemFilter {
5
+ constructor() {
6
+ this.logLevels = null;
7
+ this.tags = null;
8
+ }
9
+ }
10
+ exports.LogItemFilter = LogItemFilter;
@@ -65,6 +65,10 @@ class Endpoint {
65
65
  if (formattedKey.endsWith('_id')) {
66
66
  formattedKey = formattedKey.substring(0, formattedKey.length - '_id'.length);
67
67
  }
68
+ if (formattedKey.endsWith('_ids')) {
69
+ // TODO: update this to format correct plurals (for example category_ids should become categories instead of categorys)
70
+ formattedKey = formattedKey.substring(0, formattedKey.length - '_ids'.length) + 's';
71
+ }
68
72
  return formattedKey;
69
73
  }
70
74
  async requestCollection(action, parser, parameters = null, method = 'GET', signWithOauthToken = true) {
@@ -6,9 +6,10 @@ import { CollectionResult } from '../Model/Result/CollectionResult';
6
6
  import { LogStreamInformation } from '../Model/Log/LogStreamInformation';
7
7
  import { LogStream } from '../Model/Log/LogStream';
8
8
  import { CursorPagination } from '../Model/Pagination/CursorPagination';
9
+ import { LogItemFilter } from '../Model/Log/LogItemFilter';
9
10
  export declare class LogEndpoint extends Endpoint {
10
11
  getLogs(logQuery: LogQuery): Promise<CollectionResult<Log>>;
11
- getCursoredLogEntries(logStreamId: LogStreamId, pagination: CursorPagination | null): Promise<CollectionResult<Log>>;
12
+ getCursoredLogEntries(logStreamId: LogStreamId, pagination: CursorPagination | null, filter: LogItemFilter | null): Promise<CollectionResult<Log>>;
12
13
  save(log: Log): Promise<Log>;
13
14
  delete(logId: string): Promise<boolean>;
14
15
  clear(logStreamId: LogStreamId): Promise<boolean>;
@@ -43,8 +43,23 @@ class LogEndpoint extends Endpoint_1.Endpoint {
43
43
  const result = await this.requestCollection(cmd, Log_1.Log.parse);
44
44
  return result;
45
45
  }
46
- async getCursoredLogEntries(logStreamId, pagination) {
46
+ async getCursoredLogEntries(logStreamId, pagination, filter) {
47
47
  const queryString = this.buildQuery(pagination);
48
+ if (filter !== null && filter !== undefined) {
49
+ if (filter.tags !== null && filter.tags.length > 0) {
50
+ const arrTags = [];
51
+ //TODO: map this
52
+ for (const tag of filter.tags) {
53
+ arrTags.push(tag.key + ':' + tag.values.join(' OR '));
54
+ }
55
+ const strTags = arrTags.join(' OR ');
56
+ //filter_tags=color:gree OR color:blue
57
+ queryString.set('filter_tags', strTags);
58
+ }
59
+ if (filter.logLevels !== null && filter.logLevels.length > 0) {
60
+ queryString.set('filter_log_levels', filter.logLevels.join(','));
61
+ }
62
+ }
48
63
  let cmd = '/logstreams/' + Utils_1.Utils.base64encode(logStreamId.id) + '/logs' + queryString.build();
49
64
  const result = await this.requestCollection(cmd, Log_1.Log.parse);
50
65
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.9.59",
3
+ "version": "1.9.61",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",