attlaz-client 1.11.0 → 1.11.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.
@@ -0,0 +1,6 @@
1
+ export declare class ProjectEnvironmentConfiguration {
2
+ id: string;
3
+ key: string;
4
+ environment: string;
5
+ value: string | null;
6
+ }
@@ -0,0 +1,6 @@
1
+ export class ProjectEnvironmentConfiguration {
2
+ id;
3
+ key;
4
+ environment;
5
+ value;
6
+ }
@@ -3,5 +3,5 @@ import { CollectionResult } from '../Model/Result/CollectionResult.js';
3
3
  import { InboxMessage } from '../Model/Inbox/InboxMessage';
4
4
  export declare class InboxEndpoint extends Endpoint {
5
5
  getAll(unacknowledgedOnly?: boolean): Promise<CollectionResult<InboxMessage>>;
6
- save(notification: Notification): Promise<InboxMessage>;
6
+ save(message: InboxMessage): Promise<InboxMessage>;
7
7
  }
@@ -5,8 +5,8 @@ export class InboxEndpoint extends Endpoint {
5
5
  const result = await this.requestCollection('/inbox_messages?unacknowledgedOnly=' + unacknowledgedOnly, InboxMessage.parse);
6
6
  return result;
7
7
  }
8
- async save(notification) {
9
- const result = await this.requestObject('/inbox_messages', notification, InboxMessage.parse, 'POST');
8
+ async save(message) {
9
+ const result = await this.requestObject('/inbox_messages', message, InboxMessage.parse, 'POST');
10
10
  const savedNotification = result.getData();
11
11
  if (savedNotification === null) {
12
12
  throw new Error('Unable to save inbox message: wrong response from API');
@@ -1,8 +1,10 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
2
  import { ProjectEnvironment } from '../Model/Project/ProjectEnvironment.js';
3
3
  import { CollectionResult } from '../Model/Result/CollectionResult.js';
4
+ import { ProjectEnvironmentConfiguration } from '../Model/Project/ProjectEnvironmentConfiguration';
4
5
  export declare class ProjectEnvironmentEndpoint extends Endpoint {
5
6
  getByProject(id: string): Promise<CollectionResult<ProjectEnvironment>>;
6
7
  getById(id: string): Promise<ProjectEnvironment | null>;
7
8
  save(projectEnvironment: ProjectEnvironment): Promise<ProjectEnvironment>;
9
+ getConfigByKey(projectEnvironmentId: string, configKey: string): Promise<ProjectEnvironmentConfiguration | null>;
8
10
  }
@@ -1,6 +1,7 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
2
  import { ProjectEnvironment } from '../Model/Project/ProjectEnvironment.js';
3
3
  import { HttpClient } from '../Http/HttpClient.js';
4
+ import { ProjectEnvironmentConfiguration } from '../Model/Project/ProjectEnvironmentConfiguration';
4
5
  export class ProjectEnvironmentEndpoint extends Endpoint {
5
6
  async getByProject(id) {
6
7
  try {
@@ -45,4 +46,27 @@ export class ProjectEnvironmentEndpoint extends Endpoint {
45
46
  throw error;
46
47
  }
47
48
  }
49
+ async getConfigByKey(projectEnvironmentId, configKey) {
50
+ try {
51
+ const parser = (raw) => {
52
+ const value = new ProjectEnvironmentConfiguration();
53
+ value.id = raw.id;
54
+ value.key = raw.key;
55
+ value.environment = raw.environment;
56
+ value.value = raw.value;
57
+ return value;
58
+ };
59
+ const rawProjectEnvironment = await this.requestObject('/projectenvironments/' + projectEnvironmentId + '/configurations/' + configKey, null, parser);
60
+ return rawProjectEnvironment.getData();
61
+ }
62
+ catch (error) {
63
+ if (error.code === HttpClient.HTTP_NOTFOUND) {
64
+ return null;
65
+ }
66
+ if (this.httpClient.isDebugEnabled()) {
67
+ console.error('Failed to load project environment configuration', error);
68
+ }
69
+ throw error;
70
+ }
71
+ }
48
72
  }
package/dist/index.d.ts CHANGED
@@ -44,6 +44,7 @@ export { CodeDeploy } from './Model/Project/CodeDeploy.js';
44
44
  export { ProjectDeployCommit } from './Model/Project/ProjectDeployCommit.js';
45
45
  export { CodeDeployStatus } from './Model/Project/CodeDeployStatus.js';
46
46
  export { ProjectEnvironment } from './Model/Project/ProjectEnvironment.js';
47
+ export { ProjectEnvironmentConfiguration } from './Model/Project/ProjectEnvironmentConfiguration.js';
47
48
  /** Queue * */
48
49
  export { QueueStatus } from './Model/Queue/QueueStatus.js';
49
50
  /** Result * */
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ export { CodeDeploy } from './Model/Project/CodeDeploy.js';
44
44
  export { ProjectDeployCommit } from './Model/Project/ProjectDeployCommit.js';
45
45
  export { CodeDeployStatus } from './Model/Project/CodeDeployStatus.js';
46
46
  export { ProjectEnvironment } from './Model/Project/ProjectEnvironment.js';
47
+ export { ProjectEnvironmentConfiguration } from './Model/Project/ProjectEnvironmentConfiguration.js';
47
48
  /** Queue * */
48
49
  export { QueueStatus } from './Model/Queue/QueueStatus.js';
49
50
  /** Result * */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.11.0",
3
+ "version": "1.11.3",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",