attlaz-client 1.5.0 → 1.5.1

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.
@@ -3,7 +3,7 @@ import { DataResult } from '../Model/Result/DataResult';
3
3
  import { Channel } from '../Model/Messaging/Channel/Channel';
4
4
  import { ChannelHistory } from '../Model/Messaging/ChannelHistory';
5
5
  export declare class ChannelEndpoint extends Endpoint {
6
- getById(channelId: string): Promise<DataResult<Channel | null>>;
6
+ getById(channelId: string): Promise<DataResult<Channel>>;
7
7
  getByTeam(teamId: string): Promise<Channel[]>;
8
8
  getByOwner(): Promise<Channel[]>;
9
9
  getMessages(channelId: string): Promise<DataResult<ChannelHistory[]>>;
@@ -1,5 +1,5 @@
1
1
  import { Endpoint } from './Endpoint';
2
2
  import { HealthAlert } from '../Model/HealthAlert/HealthAlert';
3
3
  export declare class HealthAlertEndpoint extends Endpoint {
4
- getLatestByProjectEnvironment(projectEnvironmentId: string): Promise<HealthAlert[] | null>;
4
+ getLatestByProjectEnvironment(projectEnvironmentId: string): Promise<HealthAlert[]>;
5
5
  }
@@ -3,15 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HealthAlertEndpoint = void 0;
4
4
  const Endpoint_1 = require("./Endpoint");
5
5
  const HealthAlert_1 = require("../Model/HealthAlert/HealthAlert");
6
- const Utils_1 = require("../Utils");
7
6
  class HealthAlertEndpoint extends Endpoint_1.Endpoint {
8
7
  async getLatestByProjectEnvironment(projectEnvironmentId) {
9
8
  try {
10
9
  let url = '/projectenvironments/' + projectEnvironmentId + '/health';
11
10
  const result = await this.request(url);
12
- if (Utils_1.Utils.isNullOrUndefined(result)) {
13
- return null;
14
- }
11
+ // if (Utils.isNullOrUndefined(result)) {
12
+ // return null;
13
+ // }
15
14
  let alerts = [];
16
15
  const resultData = result.getData();
17
16
  if (resultData !== null) {
@@ -13,5 +13,5 @@ export declare class LogEndpoint extends Endpoint {
13
13
  getInformation(logStreamId: LogStreamId): Promise<{
14
14
  logLevels: Map<LogLevel, number>;
15
15
  tags: Map<string, (DataValueValue)[]>;
16
- } | null>;
16
+ }>;
17
17
  }
@@ -95,11 +95,11 @@ class LogEndpoint extends Endpoint_1.Endpoint {
95
95
  let url = '/logstreams/' + Utils_1.Utils.base64encode(logStreamId.id) + '/info';
96
96
  const dataResult = await this.request(url);
97
97
  if (Utils_1.Utils.isNullOrUndefined(dataResult)) {
98
- return null;
98
+ throw new Error('Invalid response');
99
99
  }
100
100
  const data = dataResult.getData();
101
101
  if (data === null) {
102
- return null;
102
+ throw new Error('Invalid response');
103
103
  }
104
104
  const rawData = data;
105
105
  const logLevels = new Map();
@@ -2,6 +2,6 @@ import { Endpoint } from './Endpoint';
2
2
  import { ProjectEnvironment } from '../Model/Project/ProjectEnvironment';
3
3
  export declare class ProjectEnvironmentEndpoint extends Endpoint {
4
4
  getByProject(id: string): Promise<ProjectEnvironment[]>;
5
- getById(id: string): Promise<ProjectEnvironment | null>;
5
+ getById(id: string): Promise<ProjectEnvironment>;
6
6
  save(projectEnvironment: ProjectEnvironment): Promise<ProjectEnvironment>;
7
7
  }
@@ -23,9 +23,6 @@ class ProjectEnvironmentEndpoint extends Endpoint_1.Endpoint {
23
23
  async getById(id) {
24
24
  try {
25
25
  const rawProjectEnvironment = await this.httpClient.request('/projectenvironments/' + id + '');
26
- if (rawProjectEnvironment === null) {
27
- return null;
28
- }
29
26
  const projectEnvironment = rawProjectEnvironment;
30
27
  return projectEnvironment;
31
28
  }
@@ -3,8 +3,8 @@ import { Task } from '../Model/Task';
3
3
  import { TaskSummary } from '../Model/TaskSummary';
4
4
  export declare class TaskEndpoint extends Endpoint {
5
5
  getTasks(projectId: string): Promise<Task[]>;
6
- getTask(taskId: string): Promise<Task | null>;
6
+ getTask(taskId: string): Promise<Task>;
7
7
  getTaskSummaries(projectId: string, projectEnvironmentId?: string | null): Promise<TaskSummary[]>;
8
- getTaskSummary(taskId: string, projectEnvironmentId?: string | null): Promise<TaskSummary | null>;
8
+ getTaskSummary(taskId: string, projectEnvironmentId?: string | null): Promise<TaskSummary>;
9
9
  save(task: Task): Promise<Task>;
10
10
  }
@@ -26,7 +26,7 @@ class TaskEndpoint extends Endpoint_1.Endpoint {
26
26
  try {
27
27
  const rawTask = await this.httpClient.request('/tasks/' + taskId);
28
28
  if (Utils_1.Utils.isNullOrUndefined(rawTask)) {
29
- return null;
29
+ throw new Error('Task not found');
30
30
  }
31
31
  return Task_1.Task.parse(rawTask);
32
32
  }
@@ -65,7 +65,7 @@ class TaskEndpoint extends Endpoint_1.Endpoint {
65
65
  try {
66
66
  const rawTaskSummary = await this.httpClient.request('tasks/' + taskId + '/summaries', parameters);
67
67
  if (Utils_1.Utils.isNullOrUndefined(rawTaskSummary)) {
68
- return null;
68
+ throw new Error('Task not found');
69
69
  }
70
70
  return TaskSummary_1.TaskSummary.parse(rawTaskSummary);
71
71
  }
@@ -6,7 +6,7 @@ import { TaskExecutionStatus } from '../Model/TaskExecutionStatus';
6
6
  export declare class TaskExecutionEndpoint extends Endpoint {
7
7
  getTaskExecutions(taskId: string): Promise<TaskExecution[]>;
8
8
  getTaskExecutionSummaries(taskId: string, from?: Date | null, to?: Date | null, projectEnvironmentId?: string | null): Promise<TaskExecutionSummary[]>;
9
- getTaskExecutionSummary(taskExecutionId: string): Promise<TaskExecutionSummary | null>;
9
+ getTaskExecutionSummary(taskExecutionId: string): Promise<TaskExecutionSummary>;
10
10
  getTaskExecutionHistory(taskExecutionId: string): Promise<TaskExecutionHistory[]>;
11
11
  updateTaskExecution(taskExecutionId: string, status: TaskExecutionStatus, time?: Date | null): Promise<TaskExecution>;
12
12
  }
@@ -62,7 +62,7 @@ class TaskExecutionEndpoint extends Endpoint_1.Endpoint {
62
62
  try {
63
63
  const rawTaskExecution = await this.httpClient.request('/taskexecutions/' + taskExecutionId + '/summaries');
64
64
  if (Utils_1.Utils.isNullOrUndefined(rawTaskExecution)) {
65
- return null;
65
+ throw new Error('Unable to get task execution');
66
66
  }
67
67
  return TaskExecutionSummary_1.TaskExecutionSummary.parse(rawTaskExecution);
68
68
  }
@@ -3,7 +3,7 @@ import { Worker } from '../Model/Worker/Worker';
3
3
  import { DataResult } from '../Model/Result/DataResult';
4
4
  import { Platform } from '../Model/Worker/Platform';
5
5
  export declare class WorkerEndpoint extends Endpoint {
6
- getByProjectEnvironment(projectEnvironmentId: string): Promise<Worker | null>;
6
+ getByProjectEnvironment(projectEnvironmentId: string): Promise<Worker>;
7
7
  update(projectEnvironmentId: string): Promise<DataResult<boolean>>;
8
8
  getPlatforms(): Promise<Platform[]>;
9
9
  }
@@ -12,7 +12,7 @@ class WorkerEndpoint extends Endpoint_1.Endpoint {
12
12
  let url = '/projectenvironments/' + projectEnvironmentId + '/workers';
13
13
  const result = await this.httpClient.request(url);
14
14
  if (Utils_1.Utils.isNullOrUndefined(result)) {
15
- return null;
15
+ throw new Error('Unable to find worker');
16
16
  }
17
17
  return Worker_1.Worker.parse(result);
18
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",