attlaz-client 1.7.0 → 1.7.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.
|
@@ -10,7 +10,6 @@ export declare class HttpClient {
|
|
|
10
10
|
static HTTP_INTERNAL_SERVER_ERROR: number;
|
|
11
11
|
static HTTP_BAD_GATEWAY: number;
|
|
12
12
|
static HTTP_UNAVAILABLE: number;
|
|
13
|
-
static get(url: string, requestData?: any): Promise<any>;
|
|
14
13
|
static request2(request: HttpClientRequest): Promise<HttpClientResponse>;
|
|
15
14
|
private static getContentType;
|
|
16
15
|
private static formatContentType;
|
package/dist/Http/HttpClient.js
CHANGED
|
@@ -2,26 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HttpClient = void 0;
|
|
4
4
|
const popsicle_1 = require("popsicle");
|
|
5
|
-
const Utils_1 = require("../Utils");
|
|
6
5
|
const HttpClientResponse_1 = require("./HttpClientResponse");
|
|
7
6
|
const ClientError_1 = require("../Model/Error/ClientError");
|
|
8
7
|
const version_1 = require("../version");
|
|
9
8
|
class HttpClient {
|
|
10
|
-
static async get(url, requestData = {}) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
// public static async get(url: string, requestData: any = {}): Promise<any> {
|
|
10
|
+
// if (Utils.isNullOrUndefined(requestData)) {
|
|
11
|
+
// requestData = {};
|
|
12
|
+
// }
|
|
13
|
+
// const response: Response = await fetch(url, requestData);
|
|
14
|
+
//
|
|
15
|
+
// //TODO: validate status
|
|
16
|
+
// const error: ClientError | null = ClientError.byStatus(response.status, response.statusText);
|
|
17
|
+
// if (!Utils.isNullOrUndefined(error)) {
|
|
18
|
+
// throw error;
|
|
19
|
+
// }
|
|
20
|
+
//
|
|
21
|
+
// // TODO: make it possible to do request without parsing the json
|
|
22
|
+
// return await response.json();
|
|
23
|
+
// }
|
|
23
24
|
static async request2(request) {
|
|
24
|
-
|
|
25
|
+
if (typeof window === 'undefined') {
|
|
26
|
+
// Add user agent when running in Node
|
|
27
|
+
request.headers['User-Agent'] = 'Attlaz Http/' + version_1.VERSION;
|
|
28
|
+
}
|
|
25
29
|
const rawRequest = {
|
|
26
30
|
url: request.getFullUrl(),
|
|
27
31
|
method: request.method,
|
|
@@ -52,18 +56,6 @@ class HttpClient {
|
|
|
52
56
|
error.body = httpResponse.body;
|
|
53
57
|
throw error;
|
|
54
58
|
}
|
|
55
|
-
// //TODO: validate status
|
|
56
|
-
//
|
|
57
|
-
// const error: ClientError = ClientError.byStatus(response.status, response.statusText);
|
|
58
|
-
// if (!Utils.isNullOrUndefined(error)) {
|
|
59
|
-
//
|
|
60
|
-
// // const body: string = await response.text();
|
|
61
|
-
// // console.log('Text' + body);
|
|
62
|
-
// //
|
|
63
|
-
// // console.log(response);
|
|
64
|
-
// throw error;
|
|
65
|
-
// }
|
|
66
|
-
//
|
|
67
59
|
return httpResponse;
|
|
68
60
|
}
|
|
69
61
|
static getContentType(response) {
|
|
@@ -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>;
|
|
9
|
+
getTaskExecutionSummary(taskExecutionId: string): Promise<TaskExecutionSummary | null>;
|
|
10
10
|
getTaskExecutionHistory(taskExecutionId: string): Promise<TaskExecutionHistory[]>;
|
|
11
11
|
updateTaskExecution(taskExecutionId: string, status: TaskExecutionStatus, time?: Date | null): Promise<TaskExecution>;
|
|
12
12
|
}
|
|
@@ -61,8 +61,8 @@ class TaskExecutionEndpoint extends Endpoint_1.Endpoint {
|
|
|
61
61
|
async getTaskExecutionSummary(taskExecutionId) {
|
|
62
62
|
try {
|
|
63
63
|
const rawTaskExecution = await this.httpClient.request('/taskexecutions/' + taskExecutionId + '/summaries');
|
|
64
|
-
if (
|
|
65
|
-
|
|
64
|
+
if (rawTaskExecution === null || rawTaskExecution === undefined) {
|
|
65
|
+
return null;
|
|
66
66
|
}
|
|
67
67
|
return TaskExecutionSummary_1.TaskExecutionSummary.parse(rawTaskExecution);
|
|
68
68
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.7.
|
|
1
|
+
export declare const VERSION = "1.7.1";
|
package/dist/version.js
CHANGED