attlaz-client 1.9.2 → 1.9.4
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/Model/Log/LogStreamInformation.d.ts +7 -0
- package/dist/Model/Log/LogStreamInformation.js +32 -0
- package/dist/Model/Project/Project.d.ts +1 -2
- package/dist/Model/Project/Project.js +5 -12
- package/dist/Model/Result/CollectionResult.d.ts +1 -1
- package/dist/Model/Result/CollectionResult.js +3 -2
- package/dist/Model/User/UserAction.d.ts +1 -1
- package/dist/Model/Workspace/Workspace.d.ts +1 -1
- package/dist/Model/Workspace/Workspace.js +6 -6
- package/dist/Model/Workspace/WorkspaceMemberInvite.d.ts +1 -1
- package/dist/Model/Workspace/WorkspaceMemberInvite2.d.ts +3 -3
- package/dist/Model/Workspace/WorkspaceMemberInvite2.js +3 -3
- package/dist/Model/Workspace/WorkspaceMemberInviteState.js +1 -1
- package/dist/Service/ChannelEndpoint.js +10 -2
- package/dist/Service/FlowRunEndpoint.d.ts +3 -3
- package/dist/Service/FlowRunEndpoint.js +12 -15
- package/dist/Service/FlowRunRequestEndpoint.d.ts +1 -1
- package/dist/Service/FlowRunRequestEndpoint.js +10 -4
- package/dist/Service/HealthAlertEndpoint.d.ts +2 -1
- package/dist/Service/HealthAlertEndpoint.js +2 -12
- package/dist/Service/LogEndpoint.d.ts +2 -6
- package/dist/Service/LogEndpoint.js +29 -35
- package/dist/Service/ProjectDeployEndpoint.d.ts +1 -1
- package/dist/Service/ProjectDeployEndpoint.js +6 -3
- package/dist/Service/ProjectEndpoint.d.ts +1 -1
- package/dist/Service/ProjectEndpoint.js +4 -12
- package/dist/Service/StorageEndpoint.d.ts +6 -6
- package/dist/Service/StorageEndpoint.js +35 -15
- package/dist/Service/UserEndpoint.js +47 -11
- package/dist/Service/WorkspaceMemberEndpoint.d.ts +2 -3
- package/dist/Service/WorkspaceMemberEndpoint.js +17 -8
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogStreamInformation = void 0;
|
|
4
|
+
const LogLevel_1 = require("./LogLevel");
|
|
5
|
+
class LogStreamInformation {
|
|
6
|
+
static parse(raw) {
|
|
7
|
+
const rawData = raw;
|
|
8
|
+
if (rawData === null || rawData === undefined) {
|
|
9
|
+
throw new Error('Invalid response');
|
|
10
|
+
}
|
|
11
|
+
const logLevels = new Map();
|
|
12
|
+
Object.keys(rawData.level_count).forEach((logLevelKey, index) => {
|
|
13
|
+
const logLevel = LogLevel_1.LogLevel.fromString(logLevelKey);
|
|
14
|
+
const parsedCount = parseInt(rawData.level_count[logLevelKey], undefined);
|
|
15
|
+
if (parsedCount !== null) {
|
|
16
|
+
logLevels.set(logLevel, parsedCount);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
console.error('Unserialize log level count: Unable to parse log level count', rawData.level_count[logLevelKey]);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const tags = new Map();
|
|
23
|
+
if (rawData.tags !== null && rawData.tags !== undefined) {
|
|
24
|
+
Object.keys(rawData.tags).forEach((tagKey, index) => {
|
|
25
|
+
const values = rawData.tags[tagKey];
|
|
26
|
+
tags.set(tagKey, values);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return { logLevels: logLevels, tags };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.LogStreamInformation = LogStreamInformation;
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Project = void 0;
|
|
4
4
|
const State_1 = require("../State");
|
|
5
|
-
const Utils_1 = require("../../Utils");
|
|
6
5
|
class Project {
|
|
7
6
|
constructor(id, key, name) {
|
|
8
|
-
this.default = false;
|
|
9
7
|
this.state = State_1.State.Active;
|
|
10
8
|
this.id = id;
|
|
11
9
|
this.key = key;
|
|
@@ -13,16 +11,11 @@ class Project {
|
|
|
13
11
|
}
|
|
14
12
|
static parse(rawProject) {
|
|
15
13
|
let project = new Project(rawProject.id, rawProject.key, rawProject.name);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
if (rawProject.default !== null && rawProject.default !== undefined) {
|
|
23
|
-
project.default = Utils_1.Utils.isTrue(rawProject.default);
|
|
24
|
-
}
|
|
25
|
-
project.defaultEnvironmentId = rawProject.defaultEnvironmentId;
|
|
14
|
+
project.workspaceId = rawProject.workspace;
|
|
15
|
+
// if (rawProject.default !== null && rawProject.default !== undefined) {
|
|
16
|
+
// project.default = Utils.isTrue(rawProject.default);
|
|
17
|
+
// }
|
|
18
|
+
project.defaultEnvironmentId = rawProject.default_environment;
|
|
26
19
|
project.state = State_1.State.fromString(rawProject.state);
|
|
27
20
|
return project;
|
|
28
21
|
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CollectionResult = void 0;
|
|
4
4
|
class CollectionResult {
|
|
5
|
-
constructor() {
|
|
5
|
+
constructor(data = null, hasMore = false) {
|
|
6
6
|
this.hasMore = false;
|
|
7
|
-
this.data = [];
|
|
7
|
+
this.data = data === null ? [] : data;
|
|
8
|
+
this.hasMore = hasMore;
|
|
8
9
|
}
|
|
9
10
|
// public static parse<T>(raw: any): DataResult<T> {
|
|
10
11
|
// const result: DataResult<T> = new DataResult<T>();
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Workspace = void 0;
|
|
4
4
|
const State_1 = require("../State");
|
|
5
5
|
class Workspace {
|
|
6
|
-
static parse(
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return
|
|
6
|
+
static parse(raw) {
|
|
7
|
+
const workspace = new Workspace();
|
|
8
|
+
workspace.id = raw.id;
|
|
9
|
+
workspace.name = raw.name;
|
|
10
|
+
workspace.state = State_1.State.fromString(raw.state);
|
|
11
|
+
return workspace;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
exports.Workspace = Workspace;
|
|
@@ -2,9 +2,9 @@ import { WorkspaceMemberInviteState } from './WorkspaceMemberInviteState';
|
|
|
2
2
|
export declare class WorkspaceMemberInvite2 {
|
|
3
3
|
code: string;
|
|
4
4
|
email: string | null;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
inviterName: string | null;
|
|
6
|
+
inviterEmail: string | null;
|
|
7
|
+
workspaceName: string | null;
|
|
8
8
|
state: WorkspaceMemberInviteState;
|
|
9
9
|
static parse(rawInvite: any): WorkspaceMemberInvite2;
|
|
10
10
|
}
|
|
@@ -7,9 +7,9 @@ class WorkspaceMemberInvite2 {
|
|
|
7
7
|
return {
|
|
8
8
|
code: rawInvite.code,
|
|
9
9
|
email: rawInvite.email,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
inviterName: rawInvite.inviter_name,
|
|
11
|
+
inviterEmail: rawInvite.inviter_email,
|
|
12
|
+
workspaceName: rawInvite.workspace_name,
|
|
13
13
|
state: WorkspaceMemberInviteState_1.WorkspaceMemberInviteState.fromString(rawInvite.state)
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -15,7 +15,7 @@ var WorkspaceMemberInviteState;
|
|
|
15
15
|
function fromString(input) {
|
|
16
16
|
const result = Utils_1.Utils.parseEnum(input, WorkspaceMemberInviteState);
|
|
17
17
|
if (result === null) {
|
|
18
|
-
throw new Error('Unable to parse WorkspaceMemberInviteState from string: Unknown
|
|
18
|
+
throw new Error('Unable to parse WorkspaceMemberInviteState from string: Unknown WorkspaceMemberInviteState "' + input + '"');
|
|
19
19
|
}
|
|
20
20
|
return result;
|
|
21
21
|
}
|
|
@@ -29,7 +29,7 @@ class ChannelEndpoint extends Endpoint_1.Endpoint {
|
|
|
29
29
|
}
|
|
30
30
|
catch (ex) {
|
|
31
31
|
if (this.httpClient.isDebugEnabled()) {
|
|
32
|
-
console.error('Failed to load channels for
|
|
32
|
+
console.error('Failed to load channels for workspace "' + workspaceId + '": ', ex);
|
|
33
33
|
}
|
|
34
34
|
throw ex;
|
|
35
35
|
}
|
|
@@ -97,7 +97,15 @@ class ChannelEndpoint extends Endpoint_1.Endpoint {
|
|
|
97
97
|
async testChannel(subscriberChannel) {
|
|
98
98
|
try {
|
|
99
99
|
let url = '/channels/' + subscriberChannel.id + '/test';
|
|
100
|
-
const
|
|
100
|
+
const parser = (raw) => {
|
|
101
|
+
return { tested: raw.tested };
|
|
102
|
+
};
|
|
103
|
+
const result = await this.requestObject(url, {}, parser, 'POST');
|
|
104
|
+
const re = result.getData();
|
|
105
|
+
if (re === null) {
|
|
106
|
+
console.log('testChannel wrong data', { result, parsed: re });
|
|
107
|
+
throw new Error('Something went wrong');
|
|
108
|
+
}
|
|
101
109
|
return result;
|
|
102
110
|
}
|
|
103
111
|
catch (ex) {
|
|
@@ -6,8 +6,8 @@ import { FlowRunHistory } from '../Model/Flow/FlowRunHistory';
|
|
|
6
6
|
import { CollectionResult } from '../Model/Result/CollectionResult';
|
|
7
7
|
export declare class FlowRunEndpoint extends Endpoint {
|
|
8
8
|
getFlowRuns(flowId: string): Promise<CollectionResult<FlowRun>>;
|
|
9
|
-
getFlowRunSummaries(flowId: string, from?: Date | null, to?: Date | null, flowRunStatuses?: FlowRunStatus[] | null, projectEnvironmentId?: string | null): Promise<FlowRunSummary
|
|
10
|
-
|
|
9
|
+
getFlowRunSummaries(flowId: string, from?: Date | null, to?: Date | null, flowRunStatuses?: FlowRunStatus[] | null, projectEnvironmentId?: string | null): Promise<CollectionResult<FlowRunSummary>>;
|
|
10
|
+
getFlowRunSummary(flowRunId: string): Promise<FlowRunSummary | null>;
|
|
11
11
|
getFlowRunHistory(flowRunId: string): Promise<CollectionResult<FlowRunHistory>>;
|
|
12
|
-
|
|
12
|
+
updateFlowRun(taskExecutionId: string, status: FlowRunStatus, time?: Date | null): Promise<FlowRun>;
|
|
13
13
|
}
|
|
@@ -38,12 +38,8 @@ class FlowRunEndpoint extends Endpoint_1.Endpoint {
|
|
|
38
38
|
}
|
|
39
39
|
params.statuses = flowRunStatuses;
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
for (let rawTaskExecution of rawTaskExecutions) {
|
|
44
|
-
taskExecutions.push(FlowRunSummary_1.FlowRunSummary.parse(rawTaskExecution));
|
|
45
|
-
}
|
|
46
|
-
return taskExecutions;
|
|
41
|
+
const result = await this.requestCollection('/flows/' + flowId + '/runsummaries', params, FlowRunSummary_1.FlowRunSummary.parse);
|
|
42
|
+
return result;
|
|
47
43
|
}
|
|
48
44
|
catch (error) {
|
|
49
45
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -52,13 +48,10 @@ class FlowRunEndpoint extends Endpoint_1.Endpoint {
|
|
|
52
48
|
throw error;
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
|
-
async
|
|
51
|
+
async getFlowRunSummary(flowRunId) {
|
|
56
52
|
try {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
return FlowRunSummary_1.FlowRunSummary.parse(rawTaskExecution);
|
|
53
|
+
const result = await this.requestObject('/taskexecutions/' + flowRunId + '/summaries', null, FlowRunSummary_1.FlowRunSummary.parse);
|
|
54
|
+
return result;
|
|
62
55
|
}
|
|
63
56
|
catch (error) {
|
|
64
57
|
if (error instanceof ClientError_1.ClientError && error.code === HttpClient_1.HttpClient.HTTP_NOTFOUND) {
|
|
@@ -74,7 +67,7 @@ class FlowRunEndpoint extends Endpoint_1.Endpoint {
|
|
|
74
67
|
const result = await this.requestCollection('/flowruns/' + flowRunId + '/history', null, FlowRunHistory_1.FlowRunHistory.parse);
|
|
75
68
|
return result;
|
|
76
69
|
}
|
|
77
|
-
async
|
|
70
|
+
async updateFlowRun(taskExecutionId, status, time = null) {
|
|
78
71
|
if (taskExecutionId.length === 0) {
|
|
79
72
|
throw new Error('Task execution id cannot be empty');
|
|
80
73
|
}
|
|
@@ -85,8 +78,12 @@ class FlowRunEndpoint extends Endpoint_1.Endpoint {
|
|
|
85
78
|
if (!Utils_1.Utils.isNullOrUndefined(time)) {
|
|
86
79
|
params.time = time;
|
|
87
80
|
}
|
|
88
|
-
const
|
|
89
|
-
|
|
81
|
+
const result = await this.requestObject('/flowruns/' + taskExecutionId + '', params, FlowRun_1.FlowRun.parse, 'POST');
|
|
82
|
+
const updatedFlowRun = result.getData();
|
|
83
|
+
if (updatedFlowRun === null) {
|
|
84
|
+
throw new Error('FlowRun not updated');
|
|
85
|
+
}
|
|
86
|
+
return updatedFlowRun;
|
|
90
87
|
}
|
|
91
88
|
}
|
|
92
89
|
exports.FlowRunEndpoint = FlowRunEndpoint;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Endpoint } from './Endpoint';
|
|
2
2
|
import { FlowRunResponse } from '../Model/Flow/FlowRunResponse';
|
|
3
3
|
export declare class FlowRunRequestEndpoint extends Endpoint {
|
|
4
|
-
|
|
4
|
+
postFlowRunRequest(taskId: string, params: any, wait?: boolean): Promise<FlowRunResponse>;
|
|
5
5
|
}
|
|
@@ -3,16 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FlowRunRequestEndpoint = void 0;
|
|
4
4
|
const Endpoint_1 = require("./Endpoint");
|
|
5
5
|
class FlowRunRequestEndpoint extends Endpoint_1.Endpoint {
|
|
6
|
-
async
|
|
6
|
+
async postFlowRunRequest(taskId, params, wait = false) {
|
|
7
7
|
let url = '/flows/' + taskId + '/flowrunrequests';
|
|
8
8
|
if (wait) {
|
|
9
9
|
url = url + "?wait=true";
|
|
10
10
|
}
|
|
11
11
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const parser = (raw) => {
|
|
13
|
+
return raw;
|
|
14
|
+
};
|
|
15
|
+
const result = await this.requestObject(url, params, parser, 'POST');
|
|
14
16
|
// console.log('TODO: parse postTaskExecutionRequest result', result);
|
|
15
|
-
|
|
17
|
+
const postedFlowRunResponse = result.getData();
|
|
18
|
+
if (postedFlowRunResponse === null) {
|
|
19
|
+
throw new Error('FlowRunResponse not updated');
|
|
20
|
+
}
|
|
21
|
+
return postedFlowRunResponse;
|
|
16
22
|
}
|
|
17
23
|
catch (ex) {
|
|
18
24
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Endpoint } from './Endpoint';
|
|
2
2
|
import { HealthAlert } from '../Model/HealthAlert/HealthAlert';
|
|
3
|
+
import { CollectionResult } from '../Model/Result/CollectionResult';
|
|
3
4
|
export declare class HealthAlertEndpoint extends Endpoint {
|
|
4
|
-
getLatestByProjectEnvironment(projectEnvironmentId: string): Promise<HealthAlert
|
|
5
|
+
getLatestByProjectEnvironment(projectEnvironmentId: string): Promise<CollectionResult<HealthAlert>>;
|
|
5
6
|
}
|
|
@@ -7,18 +7,8 @@ class HealthAlertEndpoint extends Endpoint_1.Endpoint {
|
|
|
7
7
|
async getLatestByProjectEnvironment(projectEnvironmentId) {
|
|
8
8
|
try {
|
|
9
9
|
let url = '/projectenvironments/' + projectEnvironmentId + '/health';
|
|
10
|
-
const result = await this.
|
|
11
|
-
|
|
12
|
-
// return null;
|
|
13
|
-
// }
|
|
14
|
-
let alerts = [];
|
|
15
|
-
const resultData = result.getData();
|
|
16
|
-
if (resultData !== null) {
|
|
17
|
-
for (let raw of resultData) {
|
|
18
|
-
alerts.push(HealthAlert_1.HealthAlert.parse(raw));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return alerts;
|
|
10
|
+
const result = await this.requestCollection(url, null, HealthAlert_1.HealthAlert.parse);
|
|
11
|
+
return result;
|
|
22
12
|
}
|
|
23
13
|
catch (error) {
|
|
24
14
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -2,16 +2,12 @@ import { Endpoint } from './Endpoint';
|
|
|
2
2
|
import { LogQuery } from '../Model/Log/LogQuery';
|
|
3
3
|
import { Log } from '../Model/Log/Log';
|
|
4
4
|
import { LogStreamId } from '../Model/Log/LogStreamId';
|
|
5
|
-
import { LogLevel } from '../Model/Log/LogLevel';
|
|
6
|
-
import { DataValueValue } from '../Model/DataValue';
|
|
7
5
|
import { CollectionResult } from '../Model/Result/CollectionResult';
|
|
6
|
+
import { LogStreamInformation } from '../Model/Log/LogStreamInformation';
|
|
8
7
|
export declare class LogEndpoint extends Endpoint {
|
|
9
8
|
getLogs(logQuery: LogQuery): Promise<CollectionResult<Log>>;
|
|
10
9
|
save(log: Log): Promise<Log>;
|
|
11
10
|
delete(logId: string): Promise<boolean>;
|
|
12
11
|
clear(logStreamId: LogStreamId): Promise<boolean>;
|
|
13
|
-
getInformation(logStreamId: LogStreamId): Promise<
|
|
14
|
-
logLevels: Map<LogLevel, number>;
|
|
15
|
-
tags: Map<string, (DataValueValue)[]>;
|
|
16
|
-
}>;
|
|
12
|
+
getInformation(logStreamId: LogStreamId): Promise<LogStreamInformation | null>;
|
|
17
13
|
}
|
|
@@ -4,7 +4,7 @@ exports.LogEndpoint = void 0;
|
|
|
4
4
|
const Endpoint_1 = require("./Endpoint");
|
|
5
5
|
const Log_1 = require("../Model/Log/Log");
|
|
6
6
|
const Utils_1 = require("../Utils");
|
|
7
|
-
const
|
|
7
|
+
const LogStreamInformation_1 = require("../Model/Log/LogStreamInformation");
|
|
8
8
|
class LogEndpoint extends Endpoint_1.Endpoint {
|
|
9
9
|
async getLogs(logQuery) {
|
|
10
10
|
const arrQuery = [];
|
|
@@ -40,8 +40,12 @@ class LogEndpoint extends Endpoint_1.Endpoint {
|
|
|
40
40
|
async save(log) {
|
|
41
41
|
try {
|
|
42
42
|
let cmd = '/logstreams/' + Utils_1.Utils.base64encode(log.logStream.id) + '/logs';
|
|
43
|
-
const result = await this.
|
|
44
|
-
|
|
43
|
+
const result = await this.requestObject(cmd, log, Log_1.Log.parse, 'POST');
|
|
44
|
+
const updatedLogEntry = result.getData();
|
|
45
|
+
if (updatedLogEntry === null) {
|
|
46
|
+
throw new Error('Log not updated');
|
|
47
|
+
}
|
|
48
|
+
return updatedLogEntry;
|
|
45
49
|
}
|
|
46
50
|
catch (error) {
|
|
47
51
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -53,8 +57,16 @@ class LogEndpoint extends Endpoint_1.Endpoint {
|
|
|
53
57
|
async delete(logId) {
|
|
54
58
|
let cmd = '/logstreams/:streamId/logs/' + logId;
|
|
55
59
|
try {
|
|
56
|
-
const
|
|
57
|
-
|
|
60
|
+
const parser = (raw) => {
|
|
61
|
+
return { deleted: raw.deleted };
|
|
62
|
+
};
|
|
63
|
+
const result = await this.requestObject(cmd, null, parser, 'DELETE');
|
|
64
|
+
const re = result.getData();
|
|
65
|
+
if (re === null) {
|
|
66
|
+
console.log('delete log entry wrong data', { result, parsed: re });
|
|
67
|
+
throw new Error('Something went wrong');
|
|
68
|
+
}
|
|
69
|
+
return re.deleted;
|
|
58
70
|
}
|
|
59
71
|
catch (e) {
|
|
60
72
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -66,8 +78,16 @@ class LogEndpoint extends Endpoint_1.Endpoint {
|
|
|
66
78
|
async clear(logStreamId) {
|
|
67
79
|
let cmd = '/logstreams/' + Utils_1.Utils.base64encode(logStreamId.id) + '/clear';
|
|
68
80
|
try {
|
|
69
|
-
const
|
|
70
|
-
|
|
81
|
+
const parser = (raw) => {
|
|
82
|
+
return { cleared: raw.cleared };
|
|
83
|
+
};
|
|
84
|
+
const result = await this.requestObject(cmd, null, parser, 'POST');
|
|
85
|
+
const re = result.getData();
|
|
86
|
+
if (re === null) {
|
|
87
|
+
console.log('Log stream cleared wrong data', { result, parsed: re });
|
|
88
|
+
throw new Error('Something went wrong');
|
|
89
|
+
}
|
|
90
|
+
return re.cleared;
|
|
71
91
|
}
|
|
72
92
|
catch (e) {
|
|
73
93
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -79,34 +99,8 @@ class LogEndpoint extends Endpoint_1.Endpoint {
|
|
|
79
99
|
async getInformation(logStreamId) {
|
|
80
100
|
try {
|
|
81
101
|
let url = '/logstreams/' + Utils_1.Utils.base64encode(logStreamId.id) + '/info';
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
throw new Error('Invalid response');
|
|
85
|
-
}
|
|
86
|
-
const data = dataResult.getData();
|
|
87
|
-
if (data === null) {
|
|
88
|
-
throw new Error('Invalid response');
|
|
89
|
-
}
|
|
90
|
-
const rawData = data;
|
|
91
|
-
const logLevels = new Map();
|
|
92
|
-
Object.keys(rawData.level_count).forEach((logLevelKey, index) => {
|
|
93
|
-
const logLevel = LogLevel_1.LogLevel.fromString(logLevelKey);
|
|
94
|
-
const parsedCount = parseInt(rawData.level_count[logLevelKey], undefined);
|
|
95
|
-
if (parsedCount !== null) {
|
|
96
|
-
logLevels.set(logLevel, parsedCount);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
console.error('Unserialize log level count: Unable to parse log level count', rawData.level_count[logLevelKey]);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
const tags = new Map();
|
|
103
|
-
if (rawData.tags !== null && rawData.tags !== undefined) {
|
|
104
|
-
Object.keys(rawData.tags).forEach((tagKey, index) => {
|
|
105
|
-
const values = rawData.tags[tagKey];
|
|
106
|
-
tags.set(tagKey, values);
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
return { logLevels: logLevels, tags };
|
|
102
|
+
const result = await this.requestObject(url, null, LogStreamInformation_1.LogStreamInformation.parse);
|
|
103
|
+
return result.getData();
|
|
110
104
|
}
|
|
111
105
|
catch (error) {
|
|
112
106
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -5,5 +5,5 @@ export declare class ProjectDeployEndpoint extends Endpoint {
|
|
|
5
5
|
getById(deployId: string): Promise<ProjectDeploy | null>;
|
|
6
6
|
getLatestDeploy(codeSourceId: string): Promise<ProjectDeploy | null>;
|
|
7
7
|
getByCodeSource(codeSourceId: string): Promise<CollectionResult<ProjectDeploy>>;
|
|
8
|
-
requestDeploy(codeSourceId: string): Promise<
|
|
8
|
+
requestDeploy(codeSourceId: string): Promise<ProjectDeploy>;
|
|
9
9
|
}
|
|
@@ -42,9 +42,12 @@ class ProjectDeployEndpoint extends Endpoint_1.Endpoint {
|
|
|
42
42
|
}
|
|
43
43
|
async requestDeploy(codeSourceId) {
|
|
44
44
|
try {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const result = await this.requestObject('/codesources/' + codeSourceId + '/deploys', null, ProjectDeploy_1.ProjectDeploy.parse, 'POST');
|
|
46
|
+
const requestedDeploy = result.getData();
|
|
47
|
+
if (requestedDeploy === null) {
|
|
48
|
+
throw new Error('ProjectDeploy not requested');
|
|
49
|
+
}
|
|
50
|
+
return requestedDeploy;
|
|
48
51
|
}
|
|
49
52
|
catch (error) {
|
|
50
53
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -3,7 +3,7 @@ import { Project } from '../Model/Project/Project';
|
|
|
3
3
|
import { CollectionResult } from '../Model/Result/CollectionResult';
|
|
4
4
|
export declare class ProjectEndpoint extends Endpoint {
|
|
5
5
|
getAll(): Promise<CollectionResult<Project>>;
|
|
6
|
-
|
|
6
|
+
getByWorkspace(workspaceId: string): Promise<CollectionResult<Project>>;
|
|
7
7
|
getById(projectId: string): Promise<Project | null>;
|
|
8
8
|
save(project: Project): Promise<Project>;
|
|
9
9
|
}
|
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ProjectEndpoint = void 0;
|
|
4
4
|
const Endpoint_1 = require("./Endpoint");
|
|
5
5
|
const Project_1 = require("../Model/Project/Project");
|
|
6
|
-
const Utils_1 = require("../Utils");
|
|
7
|
-
const HttpClient_1 = require("../Http/HttpClient");
|
|
8
6
|
class ProjectEndpoint extends Endpoint_1.Endpoint {
|
|
9
7
|
async getAll() {
|
|
10
8
|
try {
|
|
@@ -18,9 +16,9 @@ class ProjectEndpoint extends Endpoint_1.Endpoint {
|
|
|
18
16
|
throw e;
|
|
19
17
|
}
|
|
20
18
|
}
|
|
21
|
-
async
|
|
19
|
+
async getByWorkspace(workspaceId) {
|
|
22
20
|
try {
|
|
23
|
-
const result = await this.requestCollection('
|
|
21
|
+
const result = await this.requestCollection('workspaces/' + workspaceId + '/projects', null, Project_1.Project.parse);
|
|
24
22
|
return result;
|
|
25
23
|
}
|
|
26
24
|
catch (e) {
|
|
@@ -32,16 +30,10 @@ class ProjectEndpoint extends Endpoint_1.Endpoint {
|
|
|
32
30
|
}
|
|
33
31
|
async getById(projectId) {
|
|
34
32
|
try {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
return Project_1.Project.parse(rawProject);
|
|
33
|
+
const result = await this.requestObject('projects/' + projectId + '', null, Project_1.Project.parse);
|
|
34
|
+
return result;
|
|
40
35
|
}
|
|
41
36
|
catch (error) {
|
|
42
|
-
if (error.code === HttpClient_1.HttpClient.HTTP_NOTFOUND) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
37
|
if (this.httpClient.isDebugEnabled()) {
|
|
46
38
|
console.error('Failed to load project by id: ' + error);
|
|
47
39
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Endpoint } from './Endpoint';
|
|
2
|
-
import { DataResult } from '../Model/Result/DataResult';
|
|
3
2
|
import { StorageType } from '../Model/Storage/StorageType';
|
|
4
3
|
import { StorageInformation } from '../Model/Storage/StorageInformation';
|
|
5
4
|
import { StorageItem } from '../Model/Storage/StorageItem';
|
|
6
5
|
import { StorageItemInformation } from '../Model/Storage/StorageItemInformation';
|
|
6
|
+
import { CollectionResult } from '../Model/Result/CollectionResult';
|
|
7
7
|
export declare class StorageEndpoint extends Endpoint {
|
|
8
|
-
getInformation(projectEnvironmentId: string, storageType: StorageType): Promise<
|
|
9
|
-
clearPool(projectEnvironmentId: string, storageType: StorageType, poolKey: string): Promise<
|
|
10
|
-
getPoolItemsInformation(projectEnvironmentId: string, storageType: StorageType, poolKey: string): Promise<
|
|
8
|
+
getInformation(projectEnvironmentId: string, storageType: StorageType): Promise<StorageInformation | null>;
|
|
9
|
+
clearPool(projectEnvironmentId: string, storageType: StorageType, poolKey: string): Promise<boolean>;
|
|
10
|
+
getPoolItemsInformation(projectEnvironmentId: string, storageType: StorageType, poolKey: string): Promise<CollectionResult<StorageItemInformation>>;
|
|
11
11
|
getItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItemKey: string): Promise<StorageItem | null>;
|
|
12
|
-
setItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItem: StorageItem): Promise<
|
|
13
|
-
deleteItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItemKey: string): Promise<
|
|
12
|
+
setItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItem: StorageItem): Promise<StorageItem>;
|
|
13
|
+
deleteItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItemKey: string): Promise<boolean>;
|
|
14
14
|
}
|
|
@@ -8,8 +8,11 @@ class StorageEndpoint extends Endpoint_1.Endpoint {
|
|
|
8
8
|
async getInformation(projectEnvironmentId, storageType) {
|
|
9
9
|
let cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType;
|
|
10
10
|
try {
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const parser = (raw) => {
|
|
12
|
+
return raw;
|
|
13
|
+
};
|
|
14
|
+
const result = await this.requestObject(cmd, null, parser, 'GET');
|
|
15
|
+
return result.getData();
|
|
13
16
|
}
|
|
14
17
|
catch (ex) {
|
|
15
18
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -21,8 +24,16 @@ class StorageEndpoint extends Endpoint_1.Endpoint {
|
|
|
21
24
|
async clearPool(projectEnvironmentId, storageType, poolKey) {
|
|
22
25
|
let cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + poolKey;
|
|
23
26
|
try {
|
|
24
|
-
const
|
|
25
|
-
|
|
27
|
+
const parser = (raw) => {
|
|
28
|
+
return raw.cleared;
|
|
29
|
+
};
|
|
30
|
+
const result = await this.requestObject(cmd, null, parser, 'DELETE');
|
|
31
|
+
const re = result.getData();
|
|
32
|
+
if (re === null) {
|
|
33
|
+
console.log('clearpool wrong data', { result, parsed: re });
|
|
34
|
+
throw new Error('Something went wrong');
|
|
35
|
+
}
|
|
36
|
+
return re.cleared;
|
|
26
37
|
}
|
|
27
38
|
catch (ex) {
|
|
28
39
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -34,8 +45,7 @@ class StorageEndpoint extends Endpoint_1.Endpoint {
|
|
|
34
45
|
async getPoolItemsInformation(projectEnvironmentId, storageType, poolKey) {
|
|
35
46
|
let cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + poolKey + '/items';
|
|
36
47
|
try {
|
|
37
|
-
const result = await this.
|
|
38
|
-
result.setData(this.parseCollection(result, StorageItemInformation_1.StorageItemInformation.parse));
|
|
48
|
+
const result = await this.requestCollection(cmd, null, StorageItemInformation_1.StorageItemInformation.parse, 'GET');
|
|
39
49
|
return result;
|
|
40
50
|
}
|
|
41
51
|
catch (ex) {
|
|
@@ -48,11 +58,8 @@ class StorageEndpoint extends Endpoint_1.Endpoint {
|
|
|
48
58
|
async getItem(projectEnvironmentId, storageType, poolKey, storageItemKey) {
|
|
49
59
|
let cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + poolKey + '/items/' + storageItemKey;
|
|
50
60
|
try {
|
|
51
|
-
const result = await this.
|
|
52
|
-
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
return StorageItem_1.StorageItem.parse(result.getData());
|
|
61
|
+
const result = await this.requestObject(cmd, null, StorageItem_1.StorageItem.parse, 'GET');
|
|
62
|
+
return result.getData();
|
|
56
63
|
}
|
|
57
64
|
catch (ex) {
|
|
58
65
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -64,8 +71,13 @@ class StorageEndpoint extends Endpoint_1.Endpoint {
|
|
|
64
71
|
async setItem(projectEnvironmentId, storageType, poolKey, storageItem) {
|
|
65
72
|
let cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + poolKey + '/items/' + storageItem.key;
|
|
66
73
|
try {
|
|
67
|
-
const result = await this.
|
|
68
|
-
|
|
74
|
+
const result = await this.requestObject(cmd, { 'storage_item': storageItem }, StorageItem_1.StorageItem.parse, 'POST');
|
|
75
|
+
const savedItem = result.getData();
|
|
76
|
+
if (savedItem === null) {
|
|
77
|
+
console.log('Storage set item wrong data', { result, parsed: savedItem });
|
|
78
|
+
throw new Error('Something went wrong');
|
|
79
|
+
}
|
|
80
|
+
return savedItem;
|
|
69
81
|
}
|
|
70
82
|
catch (ex) {
|
|
71
83
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -77,8 +89,16 @@ class StorageEndpoint extends Endpoint_1.Endpoint {
|
|
|
77
89
|
async deleteItem(projectEnvironmentId, storageType, poolKey, storageItemKey) {
|
|
78
90
|
let cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + poolKey + '/items/' + storageItemKey;
|
|
79
91
|
try {
|
|
80
|
-
const
|
|
81
|
-
|
|
92
|
+
const parser = (raw) => {
|
|
93
|
+
return { deleted: raw.deleted };
|
|
94
|
+
};
|
|
95
|
+
const result = await this.requestObject(cmd, null, parser, 'DELETE');
|
|
96
|
+
const x = result.getData();
|
|
97
|
+
if (x === null) {
|
|
98
|
+
console.log('Storage delete item wrong data', { result, parsed: x });
|
|
99
|
+
throw new Error('Something went wrong');
|
|
100
|
+
}
|
|
101
|
+
return x.deleted;
|
|
82
102
|
}
|
|
83
103
|
catch (ex) {
|
|
84
104
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -12,10 +12,18 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
12
12
|
}
|
|
13
13
|
async authenticateByAuthProvider(providerType, data) {
|
|
14
14
|
try {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const parser = (raw) => {
|
|
16
|
+
// TODO: should we validate this more?
|
|
17
|
+
const token = raw;
|
|
18
|
+
token.expires = new Date(raw.expires);
|
|
19
|
+
return token;
|
|
20
|
+
};
|
|
21
|
+
const result = await this.requestObject('/auth/providers/' + providerType, data, parser, 'POST', false);
|
|
22
|
+
const token = result.getData();
|
|
23
|
+
if (token === null) {
|
|
24
|
+
console.log('auth by auth provider wrong data', { result, parsed: token });
|
|
25
|
+
throw new Error('Something went wrong');
|
|
26
|
+
}
|
|
19
27
|
return token;
|
|
20
28
|
}
|
|
21
29
|
catch (e) {
|
|
@@ -27,7 +35,11 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
27
35
|
}
|
|
28
36
|
async createAuthProvider(providerType, data) {
|
|
29
37
|
try {
|
|
30
|
-
const
|
|
38
|
+
const parser = (raw) => {
|
|
39
|
+
return raw;
|
|
40
|
+
};
|
|
41
|
+
const result = await this.requestObject('/user/auth/providers', { provider_type: providerType, code: data.code, state: data.state }, parser, 'POST');
|
|
42
|
+
// TODO validation
|
|
31
43
|
return true;
|
|
32
44
|
}
|
|
33
45
|
catch (e) {
|
|
@@ -39,8 +51,16 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
39
51
|
}
|
|
40
52
|
async removeAuthProvider(providerId) {
|
|
41
53
|
try {
|
|
42
|
-
const
|
|
43
|
-
|
|
54
|
+
const parser = (raw) => {
|
|
55
|
+
return { deleted: raw.deleted };
|
|
56
|
+
};
|
|
57
|
+
const result = await this.requestObject('/user/auth/providers', { provider: providerId }, parser, 'DELETE');
|
|
58
|
+
const re = result.getData();
|
|
59
|
+
if (re === null) {
|
|
60
|
+
console.log('remove auth provider wrong data', { result, parsed: re });
|
|
61
|
+
throw new Error('Something went wrong');
|
|
62
|
+
}
|
|
63
|
+
return re.deleted;
|
|
44
64
|
}
|
|
45
65
|
catch (e) {
|
|
46
66
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -95,8 +115,16 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
95
115
|
async requestResetPassword(email) {
|
|
96
116
|
try {
|
|
97
117
|
let url = '/users/resetpassword';
|
|
98
|
-
const
|
|
99
|
-
|
|
118
|
+
const parser = (raw) => {
|
|
119
|
+
return { requested: raw.requested };
|
|
120
|
+
};
|
|
121
|
+
const result = await this.requestObject(url, { email }, parser, 'POST', false);
|
|
122
|
+
const re = result.getData();
|
|
123
|
+
if (re === null) {
|
|
124
|
+
console.log('reset password request wrong data', { result, parsed: re });
|
|
125
|
+
throw new Error('Something went wrong');
|
|
126
|
+
}
|
|
127
|
+
return re.requested;
|
|
100
128
|
}
|
|
101
129
|
catch (e) {
|
|
102
130
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -108,8 +136,16 @@ class UserEndpoint extends Endpoint_1.Endpoint {
|
|
|
108
136
|
async resetPassword(code, password) {
|
|
109
137
|
try {
|
|
110
138
|
let url = '/users/resetpassword/' + code;
|
|
111
|
-
const
|
|
112
|
-
|
|
139
|
+
const parser = (raw) => {
|
|
140
|
+
return { updated: raw.updated };
|
|
141
|
+
};
|
|
142
|
+
const result = await this.requestObject(url, { password }, parser, 'POST', false);
|
|
143
|
+
const re = result.getData();
|
|
144
|
+
if (re === null) {
|
|
145
|
+
console.log('reset password wrong data', { result, parsed: re });
|
|
146
|
+
throw new Error('Something went wrong');
|
|
147
|
+
}
|
|
148
|
+
return re.updated;
|
|
113
149
|
}
|
|
114
150
|
catch (e) {
|
|
115
151
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Endpoint } from './Endpoint';
|
|
2
|
-
import { DataResult } from '../Model/Result/DataResult';
|
|
3
2
|
import { UserAction } from '../Model/User/UserAction';
|
|
4
3
|
import { WorkspaceMember } from '../Model/Workspace/WorkspaceMember';
|
|
5
4
|
import { WorkspaceMemberInvite } from '../Model/Workspace/WorkspaceMemberInvite';
|
|
@@ -7,8 +6,8 @@ import { WorkspaceMemberInvite2 } from '../Model/Workspace/WorkspaceMemberInvite
|
|
|
7
6
|
import { CollectionResult } from '../Model/Result/CollectionResult';
|
|
8
7
|
export declare class WorkspaceMemberEndpoint extends Endpoint {
|
|
9
8
|
getByWorkspace(workspaceId: string): Promise<CollectionResult<WorkspaceMember>>;
|
|
10
|
-
invite(
|
|
9
|
+
invite(workspaceId: string, invites: WorkspaceMemberInvite[]): Promise<boolean>;
|
|
11
10
|
getWorkspaceInviteByCode(inviteCode: string): Promise<WorkspaceMemberInvite2 | null>;
|
|
12
|
-
|
|
11
|
+
getWorkspaceMemberEvents(workspaceId: string, memberId: string): Promise<CollectionResult<UserAction>>;
|
|
13
12
|
private static parse;
|
|
14
13
|
}
|
|
@@ -34,22 +34,31 @@ class WorkspaceMemberEndpoint extends Endpoint_1.Endpoint {
|
|
|
34
34
|
const result = await this.requestCollection(cmd, null, parser);
|
|
35
35
|
return result;
|
|
36
36
|
}
|
|
37
|
-
async invite(
|
|
38
|
-
let cmd = '/workspaces/' +
|
|
37
|
+
async invite(workspaceId, invites) {
|
|
38
|
+
let cmd = '/workspaces/' + workspaceId + '/invites';
|
|
39
39
|
const rawInvites = [];
|
|
40
40
|
for (let invite of invites) {
|
|
41
41
|
rawInvites.push({ email: invite.email, role: invite.role.toString() });
|
|
42
42
|
}
|
|
43
43
|
try {
|
|
44
|
-
const
|
|
44
|
+
const parser = (raw) => {
|
|
45
|
+
return raw;
|
|
46
|
+
};
|
|
47
|
+
const result = await this.requestObject(cmd, { invites: rawInvites }, parser, 'POST');
|
|
48
|
+
const re = result.getData();
|
|
49
|
+
if (re === null) {
|
|
50
|
+
console.log('invite member wrong data', { result, parsed: re });
|
|
51
|
+
throw new Error('Something went wrong');
|
|
52
|
+
}
|
|
45
53
|
// if (Utils.isNullOrUndefined(result)) {
|
|
46
54
|
// return null;
|
|
47
55
|
// }
|
|
48
|
-
|
|
56
|
+
console.log('Invite', re);
|
|
57
|
+
return true;
|
|
49
58
|
}
|
|
50
59
|
catch (ex) {
|
|
51
60
|
if (this.httpClient.isDebugEnabled()) {
|
|
52
|
-
console.error('Failed to invite members to
|
|
61
|
+
console.error('Failed to invite members to workspace "' + workspaceId + '": ', ex);
|
|
53
62
|
}
|
|
54
63
|
throw ex;
|
|
55
64
|
}
|
|
@@ -62,9 +71,9 @@ class WorkspaceMemberEndpoint extends Endpoint_1.Endpoint {
|
|
|
62
71
|
}
|
|
63
72
|
return null;
|
|
64
73
|
}
|
|
65
|
-
async
|
|
74
|
+
async getWorkspaceMemberEvents(workspaceId, memberId) {
|
|
66
75
|
try {
|
|
67
|
-
const url = '/
|
|
76
|
+
const url = '/workspaces/' + workspaceId + '/members/' + memberId + '/events';
|
|
68
77
|
const result = await this.requestCollection(url, null, WorkspaceMemberEndpoint.parse, 'GET');
|
|
69
78
|
return result;
|
|
70
79
|
}
|
|
@@ -79,7 +88,7 @@ class WorkspaceMemberEndpoint extends Endpoint_1.Endpoint {
|
|
|
79
88
|
const userAction = new UserAction_1.UserAction();
|
|
80
89
|
userAction.id = rawUserEvent.id;
|
|
81
90
|
userAction.userId = rawUserEvent.user;
|
|
82
|
-
userAction.
|
|
91
|
+
userAction.workspaceId = rawUserEvent.workspace;
|
|
83
92
|
userAction.action = rawUserEvent.action;
|
|
84
93
|
userAction.resourceId = rawUserEvent.resource_id;
|
|
85
94
|
userAction.resourceType = rawUserEvent.resource_type;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.9.
|
|
1
|
+
export declare const VERSION = "1.9.4";
|
package/dist/version.js
CHANGED