attlaz-client 1.18.4 → 1.18.6

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.
package/dist/Client.d.ts CHANGED
@@ -31,12 +31,14 @@ import { SearchEndpoint } from './Service/SearchEndpoint.js';
31
31
  import { UserActionEndpoint } from './Service/UserActionEndpoint.js';
32
32
  import { AccessTokenEndpoint } from './Service/AccessTokenEndpoint.js';
33
33
  export declare class Client {
34
- private endpoints;
34
+ private readonly endpoints;
35
35
  private httpClient;
36
- private Store;
36
+ private readonly Store;
37
37
  private apiEndpoint;
38
38
  private parseConfig;
39
- constructor(token?: string | null, config?: Record<string, unknown>);
39
+ constructor(token?: string | null, config?: {
40
+ apiEndpoint: string | undefined;
41
+ });
40
42
  setClientCredentials(clientId: string, clientSecret?: string): void;
41
43
  getHttpClient(): OAuthClient;
42
44
  authenticate(): Promise<boolean>;
package/dist/Client.js CHANGED
@@ -71,7 +71,7 @@ export class Client {
71
71
  // TODO: go over other records in config and warn if any unknown ones
72
72
  return config;
73
73
  }
74
- constructor(token = null, config = {}) {
74
+ constructor(token = null, config = { apiEndpoint: undefined }) {
75
75
  const parsedConfig = this.parseConfig(config);
76
76
  if (parsedConfig.apiEndpoint !== undefined) {
77
77
  this.apiEndpoint = parsedConfig.apiEndpoint;
@@ -95,10 +95,10 @@ export class Client {
95
95
  }
96
96
  async authenticate(username = null, password = null) {
97
97
  if (username === null || password === null) {
98
- return this.httpClient.authenticate();
98
+ return await this.httpClient.authenticate();
99
99
  }
100
100
  // TODO: this is only possible when clientId and clientSecret are defined
101
- return this.httpClient.authenticate(username, password);
101
+ return await this.httpClient.authenticate(username, password);
102
102
  }
103
103
  isAuthenticated() {
104
104
  return this.httpClient.isAuthenticated();
@@ -208,18 +208,18 @@ export class Client {
208
208
  getFirewallEndpoint() {
209
209
  return this.getEndpoint('firewall', this.Store.FirewallEndpoint);
210
210
  }
211
- getEndpoint(key, className) {
211
+ getEndpoint(key, ClassName) {
212
212
  // const classNameString: string = className.name;
213
213
  if (!this.endpoints.has(key)) {
214
214
  // if (this.Store[classNameString] === undefined || this.Store[classNameString] === null) {
215
215
  // throw new Error(`Class type of \'${classNameString}\' is not in the store`);
216
216
  // }
217
217
  try {
218
- const endpoint = new className(this.httpClient);
218
+ const endpoint = new ClassName(this.httpClient);
219
219
  this.endpoints.set(key, endpoint);
220
220
  }
221
- catch (e) {
222
- throw new Error('Unable to initialize ' + key + ' endpoint (' + e.message + ')');
221
+ catch (error) {
222
+ throw new Error('Unable to initialize ' + key + ' endpoint (' + error.message + ')');
223
223
  }
224
224
  }
225
225
  return this.endpoints.get(key);
@@ -1,8 +1,12 @@
1
+ import { AxiosError } from 'axios';
1
2
  export declare class ClientError extends Error {
2
- code: number | null;
3
- name: string;
4
- stack?: string;
5
- constructor(name: string, code?: number | null);
6
- static fromError(error: Error | any): ClientError;
3
+ httpStatus: number | null;
4
+ type: string;
5
+ code: string;
6
+ message: string;
7
+ param?: string | undefined;
8
+ stack?: string | undefined;
9
+ constructor(code: string, httpErrorCode?: number | null);
10
+ static fromError(error: Error | AxiosError): ClientError;
7
11
  static byStatus(statusCode: number, statusText: string): ClientError | null;
8
12
  }
@@ -1,51 +1,88 @@
1
- import { HttpClient } from './HttpClient.js';
1
+ import { AxiosError } from 'axios';
2
+ import { HttpStatus } from './HttpStatus.js';
2
3
  export class ClientError extends Error {
4
+ httpStatus = null;
5
+ type;
3
6
  code;
4
- name;
7
+ message;
8
+ param = undefined;
5
9
  stack = undefined;
6
- constructor(name, code = null) {
7
- super(name);
8
- this.name = name;
10
+ constructor(code, httpErrorCode = null) {
11
+ super(code);
9
12
  this.code = code;
13
+ this.httpStatus = httpErrorCode;
10
14
  }
11
15
  static fromError(error) {
12
- if (error.body !== undefined && error.body !== null && error.body.error !== undefined && error.body.error !== null) {
13
- error = error.body.error;
14
- }
15
- let message = error;
16
- if (error.message !== undefined && error.message !== null) {
17
- message = error.message;
16
+ let clientError = new ClientError('Unknown error', HttpStatus.HTTP_INTERNAL_SERVER_ERROR);
17
+ if (error instanceof AxiosError) {
18
+ if (error.status !== undefined) {
19
+ clientError.httpStatus = error.status;
20
+ }
21
+ // console.log('Status', clientError.httpStatus);
22
+ // if(clientError.httpStatus === HttpStatusCode.Ref)
23
+ clientError.message = error.message;
24
+ if (error.code !== undefined) {
25
+ clientError.code = error.code;
26
+ }
27
+ if (error.response === undefined) {
28
+ console.error('Unable to parse AxiosError response', { error });
29
+ }
30
+ else {
31
+ // console.debug('Parse response', {error: error, data: error.response.data});
32
+ const errorData = error.response.data;
33
+ if (errorData.type !== undefined) {
34
+ clientError.type = errorData.type;
35
+ }
36
+ if (errorData.code !== undefined) {
37
+ clientError.code = errorData.code;
38
+ }
39
+ if (errorData.message !== undefined) {
40
+ clientError.message = errorData.message;
41
+ }
42
+ if (errorData.param !== undefined) {
43
+ clientError.param = errorData.param;
44
+ }
45
+ }
46
+ return clientError;
18
47
  }
19
- let clientError = new ClientError(message);
48
+ // if (error.body !== undefined && error.body !== null && error.body.error !== undefined && error.body.error !== null) {
49
+ // error = error.body.error;
50
+ // }
51
+ // let message: string = error;
52
+ // if (error.message !== undefined && error.message !== null) {
53
+ // message = error.message;
54
+ // }
55
+ //
20
56
  // console.error(error);
21
- if (error.status !== null && error.status !== undefined) {
22
- const statusCode = error.status;
23
- const { body } = error;
57
+ const xError = error;
58
+ if (xError.status !== null && xError.status !== undefined) {
59
+ const statusCode = xError.status;
60
+ const { body } = xError;
24
61
  const clientErrorByStatus = this.byStatus(statusCode, body);
25
62
  if (clientErrorByStatus !== null) {
26
63
  clientError = clientErrorByStatus;
27
64
  }
28
65
  }
29
- else if (error.code !== null && error.code !== undefined) {
30
- switch (error.code) {
66
+ else if (xError.code !== null && xError.code !== undefined) {
67
+ switch (xError.code) {
31
68
  case 'EUNAVAILABLE':
32
- clientError.code = HttpClient.HTTP_UNAVAILABLE;
69
+ clientError.httpStatus = HttpStatus.HTTP_UNAVAILABLE;
33
70
  break;
34
71
  case 'EAUTH':
35
72
  case 401:
36
- clientError.code = HttpClient.HTTP_UNAUTHORIZED;
73
+ clientError.httpStatus = HttpStatus.HTTP_UNAUTHORIZED;
37
74
  break;
38
75
  case 'ESTATUS':
39
76
  if (error.message === 'HTTP status 503') {
40
- clientError.code = HttpClient.HTTP_UNAVAILABLE;
77
+ clientError.httpStatus = HttpStatus.HTTP_UNAVAILABLE;
41
78
  }
42
79
  break;
43
80
  case 500:
44
- clientError.code = HttpClient.HTTP_INTERNAL_SERVER_ERROR;
81
+ clientError.httpStatus = HttpStatus.HTTP_INTERNAL_SERVER_ERROR;
45
82
  break;
46
83
  default:
47
- console.warn('[Client error] Error code `' + error.code + '` not recognised');
48
- clientError.code = error.code;
84
+ console.warn('[Client error] Error code `' + xError.code + '` not recognised');
85
+ clientError.httpStatus = HttpStatus.HTTP_INTERNAL_SERVER_ERROR;
49
86
  }
50
87
  }
51
88
  clientError.name = error.name;
@@ -60,29 +97,28 @@ export class ClientError extends Error {
60
97
  case 202:
61
98
  return null;
62
99
  case 400:
63
- return new ClientError('Bad Request', HttpClient.HTTP_BAD_REQUEST);
100
+ return new ClientError('Bad Request', HttpStatus.HTTP_BAD_REQUEST);
64
101
  case 401:
65
- return new ClientError('Unauthorized', HttpClient.HTTP_UNAUTHORIZED);
102
+ return new ClientError('Unauthorized', HttpStatus.HTTP_UNAUTHORIZED);
66
103
  case 403:
67
- return new ClientError('Forbidden', HttpClient.HTTP_FORBIDDEN);
104
+ return new ClientError('Forbidden', HttpStatus.HTTP_FORBIDDEN);
68
105
  case 404:
69
- return new ClientError('Not Found', HttpClient.HTTP_NOTFOUND);
106
+ return new ClientError('Not Found', HttpStatus.HTTP_NOTFOUND);
70
107
  case 405:
71
- return new ClientError('Not allowed', HttpClient.HTTP_NOT_ALLOWED);
108
+ return new ClientError('Not allowed', HttpStatus.HTTP_NOT_ALLOWED);
72
109
  case 422:
73
- return new ClientError('Unprocessable Entity', HttpClient.HTTP_UNPROCESSABLE_ENTITY);
110
+ return new ClientError('Unprocessable Entity', HttpStatus.HTTP_UNPROCESSABLE_ENTITY);
74
111
  case 500:
75
- return new ClientError('Internal Server Error', HttpClient.HTTP_INTERNAL_SERVER_ERROR);
112
+ return new ClientError('Internal Server Error', HttpStatus.HTTP_INTERNAL_SERVER_ERROR);
76
113
  case 502:
77
- return new ClientError('Bad gateway', HttpClient.HTTP_BAD_GATEWAY);
114
+ return new ClientError('Bad gateway', HttpStatus.HTTP_BAD_GATEWAY);
78
115
  case 503:
79
- return new ClientError('Service not available', HttpClient.HTTP_UNAVAILABLE);
116
+ return new ClientError('Service not available', HttpStatus.HTTP_UNAVAILABLE);
80
117
  case 504:
81
- return new ClientError('Gateway Time-out', HttpClient.HTTP_TIMEOUT);
118
+ return new ClientError('Gateway Time-out', HttpStatus.HTTP_TIMEOUT);
82
119
  default:
83
120
  console.error('Unknown status code "' + statusCode + '"', { code: statusCode, text: statusText });
84
121
  return new ClientError('Status code ' + statusCode + ': ' + statusText, statusCode);
85
122
  }
86
- return null;
87
123
  }
88
124
  }
@@ -0,0 +1,6 @@
1
+ export declare class ContentTypeHelper {
2
+ static formatContentType(input: string): {
3
+ type: string;
4
+ options: string | null;
5
+ };
6
+ }
@@ -0,0 +1,13 @@
1
+ export class ContentTypeHelper {
2
+ static formatContentType(input) {
3
+ const arrInput = input.split(';');
4
+ if (arrInput.length === 1) {
5
+ return { type: arrInput[0], options: null };
6
+ }
7
+ if (arrInput.length === 2) {
8
+ return { type: arrInput[0], options: arrInput[1].trim() };
9
+ }
10
+ console.error('Unable to parse content type "' + input + '"');
11
+ return { type: input, options: null };
12
+ }
13
+ }
@@ -1,21 +1,6 @@
1
1
  import { HttpClientRequest } from './HttpClientRequest.js';
2
2
  import { HttpClientResponse } from './HttpClientResponse.js';
3
3
  export declare class HttpClient {
4
- static HTTP_BAD_REQUEST: number;
5
- static HTTP_UNAUTHORIZED: number;
6
- static HTTP_FORBIDDEN: number;
7
- static HTTP_NOTFOUND: number;
8
- static HTTP_NOT_ALLOWED: number;
9
- static HTTP_UNPROCESSABLE_ENTITY: number;
10
- static HTTP_INTERNAL_SERVER_ERROR: number;
11
- static HTTP_BAD_GATEWAY: number;
12
- static HTTP_UNAVAILABLE: number;
13
- static HTTP_TIMEOUT: number;
14
4
  static request(request: HttpClientRequest): Promise<HttpClientResponse>;
15
5
  private static axiosRequest;
16
- private static isJson;
17
- static formatContentType(input: string): {
18
- type: string;
19
- options: string | null;
20
- };
21
6
  }
@@ -1,26 +1,18 @@
1
- import axios, { AxiosError } from 'axios';
1
+ import axios from 'axios';
2
2
  import { HttpClientResponse } from './HttpClientResponse.js';
3
3
  import { ClientError } from './ClientError.js';
4
4
  export class HttpClient {
5
- static HTTP_BAD_REQUEST = 400;
6
- static HTTP_UNAUTHORIZED = 401;
7
- static HTTP_FORBIDDEN = 403;
8
- static HTTP_NOTFOUND = 404;
9
- static HTTP_NOT_ALLOWED = 405;
10
- static HTTP_UNPROCESSABLE_ENTITY = 422;
11
- static HTTP_INTERNAL_SERVER_ERROR = 500;
12
- static HTTP_BAD_GATEWAY = 502;
13
- static HTTP_UNAVAILABLE = 503;
14
- static HTTP_TIMEOUT = 504;
15
5
  static async request(request) {
16
6
  const response = await HttpClient.axiosRequest(request);
17
- const error = ClientError.byStatus(response.status, response.statusText);
18
- if (error !== null && error !== undefined) {
19
- if (response.body !== null && response.body !== undefined && response.body.error !== null && response.body.error !== undefined && response.body.error.message !== null && response.body.error.message !== undefined) {
20
- error.message = response.body.error.message;
21
- }
22
- throw error;
23
- }
7
+ // const error: ClientError | null = ClientError.byStatus(response.status, response.statusText);
8
+ // if (error !== null && error !== undefined) {
9
+ // if (response.body !== null && response.body !== undefined && response.body.error !== null && response.body.error !== undefined && response.body.error.message !== null && response.body.error.message !== undefined
10
+ // ) {
11
+ // error.message = response.body.error.message;
12
+ // }
13
+ //
14
+ // throw error;
15
+ // }
24
16
  return response;
25
17
  }
26
18
  static async axiosRequest(request) {
@@ -45,33 +37,17 @@ export class HttpClient {
45
37
  httpResponse.body = await rawResponse.data;
46
38
  return httpResponse;
47
39
  }
48
- catch (e) {
49
- if (e instanceof AxiosError) {
50
- const status = e.status === undefined ? 500 : e.status;
51
- const statusCode = e.code === undefined ? 'Error' : e.code;
52
- const response = new HttpClientResponse(status, statusCode);
53
- if (e.response !== undefined) {
54
- response.body = e.response.data;
55
- }
56
- return response;
57
- }
58
- console.error('Unable to perform request', { error: e });
59
- const response = new HttpClientResponse(500, '');
60
- return response;
61
- }
62
- }
63
- static isJson(response) {
64
- return response.getContentType() === 'application/json';
65
- }
66
- static formatContentType(input) {
67
- const d = input.split(';');
68
- if (d.length === 1) {
69
- return { type: d[0], options: null };
70
- }
71
- if (d.length === 2) {
72
- return { type: d[0], options: d[1].trim() };
40
+ catch (requestError) {
41
+ // if (requestError instanceof AxiosError) {
42
+ // const status: number = requestError.status === undefined ? 500 : requestError.status;
43
+ // const statusCode: string = requestError.code === undefined ? 'Error' : requestError.code;
44
+ //
45
+ // const response: HttpClientResponse = new HttpClientResponse(status, statusCode);
46
+ //
47
+ //
48
+ // throw ClientError.fromError(requestError);
49
+ // }
50
+ throw ClientError.fromError(requestError);
73
51
  }
74
- console.error('Unable to parse content type "' + input + '"');
75
- return { type: input, options: null };
76
52
  }
77
53
  }
@@ -6,4 +6,5 @@ export declare class HttpClientResponse {
6
6
  headers: Headers;
7
7
  constructor(status: number, statusText: string);
8
8
  getContentType(): string | null;
9
+ isJson(): boolean;
9
10
  }
@@ -1,4 +1,4 @@
1
- import { HttpClient } from './HttpClient.js';
1
+ import { ContentTypeHelper } from './ContentTypeHelper.js';
2
2
  export class HttpClientResponse {
3
3
  status;
4
4
  statusText;
@@ -20,7 +20,10 @@ export class HttpClientResponse {
20
20
  if (contentType === null || contentType === undefined) {
21
21
  return null;
22
22
  }
23
- const parsedContentType = HttpClient.formatContentType(contentType);
23
+ const parsedContentType = ContentTypeHelper.formatContentType(contentType);
24
24
  return parsedContentType.type;
25
25
  }
26
+ isJson() {
27
+ return this.getContentType() === 'application/json';
28
+ }
26
29
  }
@@ -0,0 +1,12 @@
1
+ export declare class HttpStatus {
2
+ static HTTP_BAD_REQUEST: number;
3
+ static HTTP_UNAUTHORIZED: number;
4
+ static HTTP_FORBIDDEN: number;
5
+ static HTTP_NOTFOUND: number;
6
+ static HTTP_NOT_ALLOWED: number;
7
+ static HTTP_UNPROCESSABLE_ENTITY: number;
8
+ static HTTP_INTERNAL_SERVER_ERROR: number;
9
+ static HTTP_BAD_GATEWAY: number;
10
+ static HTTP_UNAVAILABLE: number;
11
+ static HTTP_TIMEOUT: number;
12
+ }
@@ -0,0 +1,12 @@
1
+ export class HttpStatus {
2
+ static HTTP_BAD_REQUEST = 400;
3
+ static HTTP_UNAUTHORIZED = 401;
4
+ static HTTP_FORBIDDEN = 403;
5
+ static HTTP_NOTFOUND = 404;
6
+ static HTTP_NOT_ALLOWED = 405;
7
+ static HTTP_UNPROCESSABLE_ENTITY = 422;
8
+ static HTTP_INTERNAL_SERVER_ERROR = 500;
9
+ static HTTP_BAD_GATEWAY = 502;
10
+ static HTTP_UNAVAILABLE = 503;
11
+ static HTTP_TIMEOUT = 504;
12
+ }
@@ -28,14 +28,23 @@ export class OAuthClient {
28
28
  // Client credentials flow
29
29
  const getClientCredentials = clientCredentials(this.getAxiosInstance(), this.getApiEndpointUrl(this.options.accessTokenUri), this.options.clientId === null ? undefined : this.options.clientId, this.options.clientSecret === null ? undefined : this.options.clientSecret);
30
30
  const rawAuthToken = await getClientCredentials(this.options.scopes.join(' '));
31
+ // console.log('Raw token', rawAuthToken);
31
32
  this.oathClientToken = this.tokenToOauthClientToken(rawAuthToken);
33
+ // const getRefreshToken = refreshToken(
34
+ // this.getAxiosInstance(),
35
+ // this.getApiEndpointUrl(this.options.accessTokenUri),
36
+ // this.options.clientId === null ? undefined : this.options.clientId,
37
+ // this.options.clientSecret === null ? undefined : this.options.clientSecret,
38
+ // );
39
+ // const auth = await getRefreshToken(this.oathClientToken.access_token, this.options.scopes.join(' '))
40
+ // console.log('Refresh token', auth);
32
41
  return true;
33
42
  }
34
- catch (e) {
43
+ catch (requestError) {
35
44
  if (this.debug) {
36
- console.debug('[Client] Error during authentication', e);
45
+ console.debug('[Client] Error during authentication', requestError);
37
46
  }
38
- throw ClientError.fromError(e);
47
+ throw ClientError.fromError(requestError);
39
48
  }
40
49
  }
41
50
  async refreshToken() {
@@ -112,6 +121,9 @@ export class OAuthClient {
112
121
  }
113
122
  throw clientError;
114
123
  }
124
+ if (this.debug) {
125
+ console.error('[Client] Error:', { error });
126
+ }
115
127
  throw error;
116
128
  }
117
129
  }
@@ -1,12 +1,12 @@
1
1
  import { CollectionResult } from '../Model/Result/CollectionResult.js';
2
2
  import { ObjectResult } from '../Model/Result/ObjectResult.js';
3
- import { HttpClient } from '../Http/HttpClient.js';
4
3
  import { Utils } from '../Utils.js';
5
4
  import { ObjectWrapper } from '../Model/Result/ObjectWrapper.js';
6
5
  import { DataValueCollection } from '../Model/DataValueCollection.js';
7
6
  import { JsonSerializable } from '../Model/JsonSerializable.js';
8
7
  import { LogStreamId } from '../Model/Log/LogStreamId.js';
9
8
  import { QueryString } from '../Http/Data/QueryString.js';
9
+ import { HttpStatus } from '../Http/HttpStatus.js';
10
10
  export class Endpoint {
11
11
  httpClient;
12
12
  constructor(httpClient) {
@@ -74,6 +74,10 @@ export class Endpoint {
74
74
  if (action instanceof QueryString) {
75
75
  action = action.build();
76
76
  }
77
+ try {
78
+ }
79
+ catch (e) {
80
+ }
77
81
  const requestResponse = await this.httpClient.request(action, parameters, method, signWithOauthToken);
78
82
  const result = new CollectionResult();
79
83
  /**
@@ -119,7 +123,7 @@ export class Endpoint {
119
123
  result.setData(this.parseObject(requestResponse, parser));
120
124
  }
121
125
  catch (error) {
122
- if (error.code === HttpClient.HTTP_NOTFOUND) {
126
+ if (error.httpStatus === HttpStatus.HTTP_NOTFOUND) {
123
127
  result.setData(null);
124
128
  }
125
129
  else {
@@ -1,8 +1,8 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
2
  import { Utils } from '../Utils.js';
3
- import { HttpClient } from '../Http/HttpClient.js';
4
3
  import { Flow } from '../Model/Flow/Flow.js';
5
4
  import { FlowSummary } from '../Model/Flow/FlowSummary.js';
5
+ import { HttpStatus } from '../Http/HttpStatus.js';
6
6
  export class FlowEndpoint extends Endpoint {
7
7
  async getByProject(projectId) {
8
8
  try {
@@ -23,7 +23,7 @@ export class FlowEndpoint extends Endpoint {
23
23
  return result.getData();
24
24
  }
25
25
  catch (error) {
26
- if (error.code === HttpClient.HTTP_NOTFOUND) {
26
+ if (error.httpStatus === HttpStatus.HTTP_NOTFOUND) {
27
27
  return null;
28
28
  }
29
29
  if (this.httpClient.isDebugEnabled()) {
@@ -1,7 +1,7 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
2
  import { ProjectEnvironment } from '../Model/Project/ProjectEnvironment.js';
3
- import { HttpClient } from '../Http/HttpClient.js';
4
3
  import { ProjectEnvironmentConfiguration } from '../Model/Project/ProjectEnvironmentConfiguration.js';
4
+ import { HttpStatus } from '../Http/HttpStatus.js';
5
5
  export class ProjectEnvironmentEndpoint extends Endpoint {
6
6
  async getByProject(id) {
7
7
  try {
@@ -21,7 +21,7 @@ export class ProjectEnvironmentEndpoint extends Endpoint {
21
21
  return rawProjectEnvironment.getData();
22
22
  }
23
23
  catch (error) {
24
- if (error.code === HttpClient.HTTP_NOTFOUND) {
24
+ if (error.httpStatus === HttpStatus.HTTP_NOTFOUND) {
25
25
  return null;
26
26
  }
27
27
  if (this.httpClient.isDebugEnabled()) {
@@ -60,7 +60,7 @@ export class ProjectEnvironmentEndpoint extends Endpoint {
60
60
  return rawProjectEnvironment.getData();
61
61
  }
62
62
  catch (error) {
63
- if (error.code === HttpClient.HTTP_NOTFOUND) {
63
+ if (error.httpStatus === HttpStatus.HTTP_NOTFOUND) {
64
64
  return null;
65
65
  }
66
66
  if (this.httpClient.isDebugEnabled()) {
@@ -1,10 +1,10 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
2
  import { CodeSourceAccount } from '../Model/Deployment/CodeSourceAccount.js';
3
3
  import { CodeSource } from '../Model/Deployment/CodeSource.js';
4
- import { HttpClient } from '../Http/HttpClient.js';
5
4
  import { SourcesAccountRepository } from '../Model/Deployment/SourcesAccountRepository.js';
6
5
  import { SourcesAccountRepositoryBranch } from '../Model/Deployment/SourcesAccountRepositoryBranch.js';
7
6
  import { QueryString } from '../Http/Data/QueryString.js';
7
+ import { HttpStatus } from '../Http/HttpStatus.js';
8
8
  export class SourcesAccountEndpoint extends Endpoint {
9
9
  async getAllCodeSources(workspaceId, pagination = null) {
10
10
  const queryString = new QueryString('workspaces/' + workspaceId + '/codesources');
@@ -24,7 +24,7 @@ export class SourcesAccountEndpoint extends Endpoint {
24
24
  return rawSourcesAccounts.getData();
25
25
  }
26
26
  catch (error) {
27
- if (error.code === HttpClient.HTTP_NOTFOUND) {
27
+ if (error.httpStatus === HttpStatus.HTTP_NOTFOUND) {
28
28
  return null;
29
29
  }
30
30
  if (this.httpClient.isDebugEnabled()) {
@@ -44,7 +44,7 @@ export class SourcesAccountEndpoint extends Endpoint {
44
44
  return result.getData();
45
45
  }
46
46
  catch (error) {
47
- if (error.code === HttpClient.HTTP_NOTFOUND) {
47
+ if (error.httpStatus === HttpStatus.HTTP_NOTFOUND) {
48
48
  return null;
49
49
  }
50
50
  if (this.httpClient.isDebugEnabled()) {
package/dist/index.d.ts CHANGED
@@ -11,6 +11,8 @@ export { OAuthClient } from './Http/OAuthClient.js';
11
11
  export { OAuthClientOptions } from './Http/OAuthClientOptions.js';
12
12
  export { OAuthClientToken } from './Http/OAuthClientToken.js';
13
13
  export { ClientError } from './Http/ClientError.js';
14
+ export { HttpStatus } from './Http/HttpStatus.js';
15
+ export { ContentTypeHelper } from './Http/ContentTypeHelper.js';
14
16
  /**
15
17
  * Models
16
18
  */
package/dist/index.js CHANGED
@@ -6,6 +6,8 @@ export { OAuthClient } from './Http/OAuthClient.js';
6
6
  export { OAuthClientOptions } from './Http/OAuthClientOptions.js';
7
7
  export { OAuthClientToken } from './Http/OAuthClientToken.js';
8
8
  export { ClientError } from './Http/ClientError.js';
9
+ export { HttpStatus } from './Http/HttpStatus.js';
10
+ export { ContentTypeHelper } from './Http/ContentTypeHelper.js';
9
11
  /**
10
12
  * Models
11
13
  */
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.16.3";
1
+ export declare const VERSION = "1.18.5";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.16.3";
1
+ export const VERSION = "1.18.5";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.18.4",
3
+ "version": "1.18.6",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",