attlaz-client 1.9.21 → 1.9.23

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.
@@ -5,13 +5,13 @@ export declare class LogQuery {
5
5
  readonly logStreamId: LogStreamId;
6
6
  message: string | null;
7
7
  hidden: boolean | null;
8
- logLevels: LogLevel[];
8
+ logLevels: LogLevel[] | null;
9
9
  tags: Array<{
10
10
  key: string;
11
11
  values: DataValueValue[];
12
- }>;
13
- pageSize: number;
14
- pageNum: number;
12
+ }> | null;
13
+ limit: number;
14
+ startingAfterId: string | null;
15
15
  sort: Array<{
16
16
  field: string;
17
17
  direction: number;
@@ -5,8 +5,10 @@ class LogQuery {
5
5
  constructor(logStreamId) {
6
6
  this.message = null;
7
7
  this.hidden = null;
8
- this.pageSize = 1000;
9
- this.pageNum = 0;
8
+ this.logLevels = null;
9
+ this.tags = null;
10
+ this.limit = 1000;
11
+ this.startingAfterId = null;
10
12
  this.logStreamId = logStreamId;
11
13
  }
12
14
  }
@@ -1,4 +1,5 @@
1
1
  export declare class LogStreamId {
2
2
  readonly id: string;
3
3
  constructor(id: string);
4
+ jsonSerialize(): string;
4
5
  }
@@ -5,5 +5,8 @@ class LogStreamId {
5
5
  constructor(id) {
6
6
  this.id = id;
7
7
  }
8
+ jsonSerialize() {
9
+ return this.id;
10
+ }
8
11
  }
9
12
  exports.LogStreamId = LogStreamId;
@@ -12,7 +12,7 @@ class ProjectDeploy {
12
12
  static parse(rawProjectDeploy) {
13
13
  const projectDeploy = new ProjectDeploy();
14
14
  projectDeploy.id = rawProjectDeploy.id.toString();
15
- projectDeploy.platformId = rawProjectDeploy.platformId;
15
+ projectDeploy.platformId = rawProjectDeploy.platform;
16
16
  projectDeploy.buildStrategyId = rawProjectDeploy.build_strategy;
17
17
  projectDeploy.userId = rawProjectDeploy.user;
18
18
  projectDeploy.requested = new Date(rawProjectDeploy.requested);
@@ -15,9 +15,7 @@ class UserAuthProvider {
15
15
  userAuthProvider.provider = raw.provider;
16
16
  userAuthProvider.providerUserId = raw.provider_user;
17
17
  userAuthProvider.providerUserEmail = raw.provider_user_email;
18
- if (raw.lastUsed !== null && raw.lastUsed !== undefined) {
19
- userAuthProvider.lastUsed = Utils_1.Utils.parseRawDate(raw.last_used);
20
- }
18
+ userAuthProvider.lastUsed = Utils_1.Utils.parseRawDate(raw.last_used);
21
19
  userAuthProvider.state = State_1.State.fromString(raw.state);
22
20
  return userAuthProvider;
23
21
  }
@@ -8,6 +8,7 @@ const Utils_1 = require("../Utils");
8
8
  const ObjectWrapper_1 = require("../Model/Result/ObjectWrapper");
9
9
  const DataValueCollection_1 = require("../Model/DataValueCollection");
10
10
  const JsonSerializable_1 = require("../Model/JsonSerializable");
11
+ const LogStreamId_1 = require("../Model/Log/LogStreamId");
11
12
  class Endpoint {
12
13
  constructor(httpClient) {
13
14
  this.httpClient = httpClient;
@@ -23,9 +24,9 @@ class Endpoint {
23
24
  }
24
25
  return result;
25
26
  }
26
- // if (DateHelper.isDate(data)) {
27
- // return DateHelper.toString(data);
28
- // }
27
+ if (Utils_1.Utils.isDate(data)) {
28
+ return data.toISOString();
29
+ }
29
30
  // tODo: this does not seem to work correclty
30
31
  if (data instanceof JsonSerializable_1.JsonSerializable && 'jsonSerialize' in data) {
31
32
  return data.jsonSerialize();
@@ -41,7 +42,8 @@ class Endpoint {
41
42
  // data instanceof UserId ||
42
43
  // data instanceof DataCollectionResult ||
43
44
  // data instanceof SuccessResult ||
44
- data instanceof DataValueCollection_1.DataValueCollection) {
45
+ data instanceof DataValueCollection_1.DataValueCollection ||
46
+ data instanceof LogStreamId_1.LogStreamId) {
45
47
  return this.formatParameters(data.jsonSerialize());
46
48
  }
47
49
  const result = {};
@@ -10,8 +10,12 @@ const LogStream_1 = require("../Model/Log/LogStream");
10
10
  class LogEndpoint extends Endpoint_1.Endpoint {
11
11
  async getLogs(logQuery) {
12
12
  const arrQuery = [];
13
- arrQuery.push('pageSize=' + logQuery.pageSize);
14
- arrQuery.push('pageNum=' + logQuery.pageNum);
13
+ if (logQuery.limit !== null) {
14
+ arrQuery.push('limit=' + logQuery.limit);
15
+ }
16
+ if (logQuery.startingAfterId !== null) {
17
+ arrQuery.push('starting_after=' + logQuery.startingAfterId);
18
+ }
15
19
  // Resolved
16
20
  if (logQuery.hidden !== null && logQuery.hidden !== undefined) {
17
21
  if (logQuery.hidden) {
@@ -6,7 +6,7 @@ const Endpoint_1 = require("./Endpoint");
6
6
  const User_1 = require("../Model/User");
7
7
  class UserEndpoint extends Endpoint_1.Endpoint {
8
8
  async getUser() {
9
- let cmd = '/user';
9
+ let cmd = '/users';
10
10
  const rawUser = await this.requestObject(cmd, null, User_1.User.parse);
11
11
  return rawUser.getData();
12
12
  }
@@ -38,7 +38,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
38
38
  const parser = (raw) => {
39
39
  return raw;
40
40
  };
41
- const result = await this.requestObject('/user/auth/providers', { provider_type: providerType, code: data.code, state: data.state }, parser, 'POST');
41
+ const result = await this.requestObject('/users/auth/providers', { provider_type: providerType, code: data.code, state: data.state }, parser, 'POST');
42
42
  // TODO validation
43
43
  return true;
44
44
  }
@@ -54,7 +54,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
54
54
  const parser = (raw) => {
55
55
  return { deleted: raw.deleted };
56
56
  };
57
- const result = await this.requestObject('/user/auth/providers', { provider: providerId }, parser, 'DELETE');
57
+ const result = await this.requestObject('/users/auth/providers', { provider: providerId }, parser, 'DELETE');
58
58
  const re = result.getData();
59
59
  if (re === null) {
60
60
  console.log('remove auth provider wrong data', { result, parsed: re });
@@ -70,7 +70,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
70
70
  }
71
71
  }
72
72
  async getAuthProviders() {
73
- let cmd = '/user/auth/providers';
73
+ let cmd = '/users/auth/providers';
74
74
  const rawAuthProviders = await this.requestCollection(cmd, null, UserAuthProvider_1.UserAuthProvider.parse);
75
75
  return rawAuthProviders;
76
76
  }
@@ -84,7 +84,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
84
84
  }
85
85
  async update(user) {
86
86
  try {
87
- let url = '/user/' + user.id;
87
+ let url = '/users/' + user.id;
88
88
  const result = await this.requestObject(url, { user }, User_1.User.parse, 'POST');
89
89
  const updatedUser = result.getData();
90
90
  if (updatedUser === null) {
@@ -101,7 +101,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
101
101
  }
102
102
  async create(user, invitationCode = null) {
103
103
  try {
104
- let url = '/user/';
104
+ let url = '/users/';
105
105
  const data = { user, invitation_code: invitationCode };
106
106
  const parser = (raw) => {
107
107
  return User_1.User.parse(raw.createdUser);
package/dist/Utils.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export declare class Utils {
2
2
  static isNullOrUndefined(variable: any): boolean;
3
3
  static isTrue(input: string | number | boolean | null | undefined): boolean;
4
+ static isDate(value: any): boolean;
4
5
  static parseRawDate(input: Date): Date;
5
6
  static parseEnum<T>(input: string, Enum: any): T | null;
6
7
  static parseInt(input: string | number | boolean): number;
package/dist/Utils.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Utils = void 0;
4
+ const util_1 = require("util");
4
5
  class Utils {
5
6
  static isNullOrUndefined(variable) {
6
7
  return variable === null || variable === undefined;
@@ -8,6 +9,9 @@ class Utils {
8
9
  static isTrue(input) {
9
10
  return (input === true || input === 'true' || input === 1 || input === '1');
10
11
  }
12
+ static isDate(value) {
13
+ return value !== null && util_1.types.isDate(value) && !isNaN(value.getTime());
14
+ }
11
15
  static parseRawDate(input) {
12
16
  if (input !== null && input !== undefined) {
13
17
  return new Date(input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.9.21",
3
+ "version": "1.9.23",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",