attlaz-client 1.8.28 → 1.8.30

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.
@@ -2,6 +2,7 @@ import { Endpoint } from './Endpoint';
2
2
  import { ProjectDeploy } from '../Model/Project/ProjectDeploy';
3
3
  export declare class ProjectDeployEndpoint extends Endpoint {
4
4
  getById(deployId: string): Promise<ProjectDeploy | null>;
5
+ getLatestDeploy(codeSourceId: string): Promise<ProjectDeploy | null>;
5
6
  getByCodeSource(codeSourceId: string): Promise<ProjectDeploy[]>;
6
7
  requestDeploy(codeSourceId: string): Promise<any>;
7
8
  }
@@ -24,6 +24,24 @@ class ProjectDeployEndpoint extends Endpoint_1.Endpoint {
24
24
  throw error;
25
25
  }
26
26
  }
27
+ async getLatestDeploy(codeSourceId) {
28
+ try {
29
+ const rawProjectDeploy = await this.httpClient.request('/codesources/' + codeSourceId + '/latestdeploy');
30
+ if (Utils_1.Utils.isNullOrUndefined(rawProjectDeploy)) {
31
+ return null;
32
+ }
33
+ return ProjectDeploy_1.ProjectDeploy.parse(rawProjectDeploy);
34
+ }
35
+ catch (error) {
36
+ if (error.code === HttpClient_1.HttpClient.HTTP_NOTFOUND) {
37
+ return null;
38
+ }
39
+ if (this.httpClient.isDebugEnabled()) {
40
+ console.error('Failed to load project deploy by id', error);
41
+ }
42
+ throw error;
43
+ }
44
+ }
27
45
  async getByCodeSource(codeSourceId) {
28
46
  try {
29
47
  const rawProjectDeploys = await this.httpClient.request('/codesources/' + codeSourceId + '/deploys');
@@ -4,8 +4,8 @@ import { CodeSourceAccount } from '../Model/Deployment/CodeSourceAccount';
4
4
  import { CodeSource } from '../Model/Deployment/CodeSource';
5
5
  export declare class SourcesAccountEndpoint extends Endpoint {
6
6
  getAllCodeSourceAccounts(): Promise<CodeSourceAccount[]>;
7
- getCodeSourceAccountById(id: string): Promise<CodeSourceAccount>;
8
- getCodeSourceById(id: string): Promise<CodeSource>;
7
+ getCodeSourceAccountById(id: string): Promise<CodeSourceAccount | null>;
8
+ getCodeSourceById(codeSourceId: string): Promise<CodeSource | null>;
9
9
  getRepositories(codeSourceAccountId: string): Promise<SourcesAccountRepository[]>;
10
10
  getRepositoryBranches(codeSourceAccountId: string, repositoryKey: string): Promise<string[]>;
11
11
  }
@@ -6,6 +6,7 @@ const SourcesAccountRepository_1 = require("../Model/SourcesAccountRepository");
6
6
  const Utils_1 = require("../Utils");
7
7
  const CodeSourceAccount_1 = require("../Model/Deployment/CodeSourceAccount");
8
8
  const CodeSource_1 = require("../Model/Deployment/CodeSource");
9
+ const HttpClient_1 = require("../Http/HttpClient");
9
10
  class SourcesAccountEndpoint extends Endpoint_1.Endpoint {
10
11
  async getAllCodeSourceAccounts() {
11
12
  const rawSourcesAccounts = await this.httpClient.request('codesourceaccounts');
@@ -16,17 +17,45 @@ class SourcesAccountEndpoint extends Endpoint_1.Endpoint {
16
17
  return sourcesAccounts;
17
18
  }
18
19
  async getCodeSourceAccountById(id) {
19
- const rawSourcesAccounts = await this.httpClient.request('codesourceaccounts/' + id);
20
- return CodeSourceAccount_1.CodeSourceAccount.parse(rawSourcesAccounts);
20
+ try {
21
+ const rawSourcesAccounts = await this.httpClient.request('codesourceaccounts/' + id);
22
+ if (rawSourcesAccounts === null) {
23
+ return null;
24
+ }
25
+ return CodeSourceAccount_1.CodeSourceAccount.parse(rawSourcesAccounts);
26
+ }
27
+ catch (error) {
28
+ if (error.code === HttpClient_1.HttpClient.HTTP_NOTFOUND) {
29
+ return null;
30
+ }
31
+ if (this.httpClient.isDebugEnabled()) {
32
+ console.error('Failed to load code source account by id', error);
33
+ }
34
+ throw error;
35
+ }
21
36
  // let sourcesAccounts: CodeSourceAccount[] = [];
22
37
  // for (let rawSourcesAccount of rawSourcesAccounts) {
23
38
  // sourcesAccounts.push(CodeSourceAccount.parse(rawSourcesAccount));
24
39
  // }
25
40
  // return sourcesAccounts;
26
41
  }
27
- async getCodeSourceById(id) {
28
- const rawCodeSource = await this.httpClient.request('codesources/' + id);
29
- return CodeSource_1.CodeSource.parse(rawCodeSource);
42
+ async getCodeSourceById(codeSourceId) {
43
+ try {
44
+ const rawCodeSource = await this.httpClient.request('/codesources/' + codeSourceId);
45
+ if (rawCodeSource === null) {
46
+ return null;
47
+ }
48
+ return CodeSource_1.CodeSource.parse(rawCodeSource);
49
+ }
50
+ catch (error) {
51
+ if (error.code === HttpClient_1.HttpClient.HTTP_NOTFOUND) {
52
+ return null;
53
+ }
54
+ if (this.httpClient.isDebugEnabled()) {
55
+ console.error('Failed to load code source by id', error);
56
+ }
57
+ throw error;
58
+ }
30
59
  }
31
60
  async getRepositories(codeSourceAccountId) {
32
61
  const rawSourcesAccountRepositories = await this.httpClient.request('codesourceaccounts/' + codeSourceAccountId + '/repositories');
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.8.28";
1
+ export declare const VERSION = "1.8.30";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "1.8.28";
4
+ exports.VERSION = "1.8.30";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.8.28",
3
+ "version": "1.8.30",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",