attlaz-client 1.11.14 → 1.12.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.
- package/dist/Client.d.ts +5 -5
- package/dist/Client.js +20 -20
- package/dist/Http/Data/QueryString.d.ts +6 -0
- package/dist/Http/Data/QueryString.js +24 -2
- package/dist/Http/HttpClient.js +0 -1
- package/dist/Http/OAuthClient.js +2 -2
- package/dist/Http/OAuthClientOptions.d.ts +4 -4
- package/dist/Http/OAuthClientOptions.js +1 -1
- package/dist/Service/ChannelEndpoint.d.ts +4 -3
- package/dist/Service/ChannelEndpoint.js +13 -25
- package/dist/Service/Endpoint.d.ts +1 -3
- package/dist/Service/Endpoint.js +3 -15
- package/dist/Service/FlowRunEndpoint.js +4 -2
- package/dist/Service/LogEndpoint.js +4 -3
- package/dist/Service/ProjectEndpoint.d.ts +2 -1
- package/dist/Service/ProjectEndpoint.js +5 -6
- package/dist/Service/SourcesAccountEndpoint.d.ts +5 -4
- package/dist/Service/SourcesAccountEndpoint.js +17 -8
- package/dist/Service/WorkspaceMemberEndpoint.d.ts +2 -1
- package/dist/Service/WorkspaceMemberEndpoint.js +5 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/Client.d.ts
CHANGED
|
@@ -29,13 +29,13 @@ import { FirewallEndpoint } from './Service/FirewallEndpoint.js';
|
|
|
29
29
|
import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
|
|
30
30
|
import { SearchEndpoint } from './Service/SearchEndpoint.js';
|
|
31
31
|
export declare class Client {
|
|
32
|
-
private readonly apiEndpoint;
|
|
33
|
-
private readonly clientId;
|
|
34
|
-
private readonly clientSecret;
|
|
35
32
|
private endpoints;
|
|
36
|
-
private
|
|
33
|
+
private httpClient;
|
|
37
34
|
private Store;
|
|
38
|
-
|
|
35
|
+
private apiEndpoint;
|
|
36
|
+
private parseConfig;
|
|
37
|
+
constructor(token?: string | null, config?: Record<string, unknown>);
|
|
38
|
+
setClientCredentials(clientId: string, clientSecret?: string): void;
|
|
39
39
|
private getHeaders;
|
|
40
40
|
getHttpClient(): OAuthClient;
|
|
41
41
|
authenticate(): Promise<boolean>;
|
package/dist/Client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OAuthClientToken } from './Http/OAuthClientToken.js';
|
|
1
2
|
import { WorkerEndpoint } from './Service/WorkerEndpoint.js';
|
|
2
3
|
import { AdapterEndpoint } from './Service/AdapterEndpoint.js';
|
|
3
4
|
import { ProjectEnvironmentEndpoint } from './Service/ProjectEnvironmentEndpoint.js';
|
|
@@ -30,9 +31,6 @@ import { VERSION } from './version.js';
|
|
|
30
31
|
import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
|
|
31
32
|
import { SearchEndpoint } from './Service/SearchEndpoint.js';
|
|
32
33
|
export class Client {
|
|
33
|
-
apiEndpoint;
|
|
34
|
-
clientId;
|
|
35
|
-
clientSecret;
|
|
36
34
|
endpoints;
|
|
37
35
|
httpClient;
|
|
38
36
|
Store = {
|
|
@@ -65,21 +63,26 @@ export class Client {
|
|
|
65
63
|
FirewallEndpoint,
|
|
66
64
|
SearchEndpoint,
|
|
67
65
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
apiEndpoint = 'https://api.attlaz.com';
|
|
67
|
+
parseConfig(config) {
|
|
68
|
+
return config;
|
|
69
|
+
}
|
|
70
|
+
constructor(token = null, config = {}) {
|
|
71
|
+
const parsedConfig = this.parseConfig(config);
|
|
72
|
+
if (parsedConfig.apiEndpoint !== undefined) {
|
|
73
|
+
this.apiEndpoint = parsedConfig.apiEndpoint;
|
|
74
|
+
}
|
|
75
|
+
const options = new OAuthClientOptions(this.apiEndpoint, null, null, this.getHeaders());
|
|
73
76
|
this.httpClient = new OAuthClient(options);
|
|
77
|
+
if (token !== null) {
|
|
78
|
+
const clientToken = new OAuthClientToken(token, 'Bearer', '', '');
|
|
79
|
+
this.httpClient.setToken(clientToken);
|
|
80
|
+
}
|
|
74
81
|
this.endpoints = new Map();
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
//
|
|
80
|
-
// this.socketService.on('message', (data: any) => {
|
|
81
|
-
// console.log('Incoming:', data);
|
|
82
|
-
// });
|
|
82
|
+
}
|
|
83
|
+
setClientCredentials(clientId, clientSecret = '') {
|
|
84
|
+
const options = new OAuthClientOptions(this.apiEndpoint, clientId, clientSecret, this.getHeaders());
|
|
85
|
+
this.httpClient = new OAuthClient(options);
|
|
83
86
|
}
|
|
84
87
|
getHeaders() {
|
|
85
88
|
const userAgentInfo = {
|
|
@@ -100,6 +103,7 @@ export class Client {
|
|
|
100
103
|
if (username === null || password === null) {
|
|
101
104
|
return this.httpClient.authenticate();
|
|
102
105
|
}
|
|
106
|
+
// TODO: this is only possible when clientId and clientSecret are defined
|
|
103
107
|
return this.httpClient.authenticate(username, password);
|
|
104
108
|
}
|
|
105
109
|
isAuthenticated() {
|
|
@@ -108,10 +112,6 @@ export class Client {
|
|
|
108
112
|
getToken() {
|
|
109
113
|
return this.httpClient.getToken();
|
|
110
114
|
}
|
|
111
|
-
// public getAccessToken(): string {
|
|
112
|
-
// return this.httpClient.getAccessToken();
|
|
113
|
-
// }
|
|
114
|
-
//
|
|
115
115
|
setToken(token) {
|
|
116
116
|
this.httpClient.setToken(token);
|
|
117
117
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { CursorPagination } from '../../Model/Pagination/CursorPagination';
|
|
2
|
+
import { State } from '../../Model/State';
|
|
1
3
|
export declare class QueryString {
|
|
4
|
+
private readonly command;
|
|
2
5
|
private parameters;
|
|
6
|
+
constructor(command: string);
|
|
3
7
|
set(parameter: string, value: string | number | boolean | string[]): void;
|
|
8
|
+
addPagination(pagination: CursorPagination | null): void;
|
|
9
|
+
addStateFilter(states: State[] | null): void;
|
|
4
10
|
getParameters(): {
|
|
5
11
|
parameter: string;
|
|
6
12
|
value: string | number | boolean | string[];
|
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
export class QueryString {
|
|
2
|
+
command;
|
|
2
3
|
parameters = [];
|
|
4
|
+
constructor(command) {
|
|
5
|
+
this.command = command;
|
|
6
|
+
}
|
|
3
7
|
set(parameter, value) {
|
|
4
8
|
this.parameters.push({ parameter, value });
|
|
5
9
|
}
|
|
10
|
+
addPagination(pagination) {
|
|
11
|
+
if (pagination !== null && pagination !== undefined) {
|
|
12
|
+
if (pagination.limit !== null && pagination.limit !== undefined) {
|
|
13
|
+
this.set('limit', pagination.limit);
|
|
14
|
+
}
|
|
15
|
+
if (pagination.startingAfter !== null && pagination.startingAfter !== undefined && pagination.startingAfter !== '') {
|
|
16
|
+
this.set('starting_after', pagination.startingAfter);
|
|
17
|
+
}
|
|
18
|
+
if (pagination.endingBefore !== null && pagination.endingBefore !== undefined && pagination.endingBefore !== '') {
|
|
19
|
+
this.set('ending_before', pagination.endingBefore);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
addStateFilter(states) {
|
|
24
|
+
if (states !== null) {
|
|
25
|
+
this.set('state', states);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
6
28
|
getParameters() {
|
|
7
29
|
return this.parameters;
|
|
8
30
|
}
|
|
9
31
|
build() {
|
|
10
32
|
if (this.parameters.length === 0) {
|
|
11
|
-
return
|
|
33
|
+
return this.command;
|
|
12
34
|
}
|
|
13
35
|
const output = [];
|
|
14
36
|
for (const parameter of this.parameters) {
|
|
@@ -18,6 +40,6 @@ export class QueryString {
|
|
|
18
40
|
}
|
|
19
41
|
output.push(parameter.parameter + '=' + value);
|
|
20
42
|
}
|
|
21
|
-
return '?' + output.join('&');
|
|
43
|
+
return this.command + '?' + output.join('&');
|
|
22
44
|
}
|
|
23
45
|
}
|
package/dist/Http/HttpClient.js
CHANGED
|
@@ -63,7 +63,6 @@ export class HttpClient {
|
|
|
63
63
|
}
|
|
64
64
|
const error = ClientError.byStatus(response.status, response.statusText);
|
|
65
65
|
if (error !== null && error !== undefined) {
|
|
66
|
-
console.log(httpResponse.body);
|
|
67
66
|
error.message = httpResponse.body.error.message;
|
|
68
67
|
throw error;
|
|
69
68
|
}
|
package/dist/Http/OAuthClient.js
CHANGED
|
@@ -13,8 +13,8 @@ export class OAuthClient {
|
|
|
13
13
|
constructor(options) {
|
|
14
14
|
this.options = options;
|
|
15
15
|
this.oauthClient = new ClientOAuth2({
|
|
16
|
-
clientId: options.clientId,
|
|
17
|
-
clientSecret: options.clientSecret,
|
|
16
|
+
clientId: options.clientId === null ? undefined : options.clientId,
|
|
17
|
+
clientSecret: options.clientSecret === null ? undefined : options.clientSecret,
|
|
18
18
|
accessTokenUri: this.getUri(options.accessTokenUri),
|
|
19
19
|
authorizationUri: this.getUri(options.authorizationUri),
|
|
20
20
|
redirectUri: options.redirectUri,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Headers } from './Data/Header.js';
|
|
2
2
|
export declare class OAuthClientOptions {
|
|
3
3
|
apiEndpoint: string;
|
|
4
|
-
clientId: string;
|
|
5
|
-
clientSecret: string;
|
|
4
|
+
readonly clientId: string | null;
|
|
5
|
+
readonly clientSecret: string | null;
|
|
6
|
+
headers: Headers;
|
|
6
7
|
accessTokenUri: string;
|
|
7
8
|
authorizationUri: string;
|
|
8
9
|
redirectUri: string;
|
|
9
10
|
scopes: string[];
|
|
10
11
|
state: string;
|
|
11
|
-
headers: Headers;
|
|
12
|
-
constructor(apiEndpoint: string, clientId: string, clientSecret: string, headers: Headers);
|
|
12
|
+
constructor(apiEndpoint: string, clientId: string | null, clientSecret: string | null, headers: Headers);
|
|
13
13
|
}
|
|
@@ -2,12 +2,12 @@ export class OAuthClientOptions {
|
|
|
2
2
|
apiEndpoint;
|
|
3
3
|
clientId;
|
|
4
4
|
clientSecret;
|
|
5
|
+
headers;
|
|
5
6
|
accessTokenUri = 'oauth/token';
|
|
6
7
|
authorizationUri = 'oauth/authorize';
|
|
7
8
|
redirectUri = 'https://example.com/auth/github/callback';
|
|
8
9
|
scopes = ['all'];
|
|
9
10
|
state = 'xyz';
|
|
10
|
-
headers;
|
|
11
11
|
constructor(apiEndpoint, clientId, clientSecret, headers) {
|
|
12
12
|
this.apiEndpoint = apiEndpoint;
|
|
13
13
|
this.clientId = clientId;
|
|
@@ -2,11 +2,12 @@ import { Endpoint } from './Endpoint.js';
|
|
|
2
2
|
import { Channel } from '../Model/Messaging/Channel/Channel.js';
|
|
3
3
|
import { ChannelHistory } from '../Model/Messaging/ChannelHistory.js';
|
|
4
4
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
5
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination';
|
|
5
6
|
export declare class ChannelEndpoint extends Endpoint {
|
|
6
7
|
getById(channelId: string): Promise<Channel | null>;
|
|
7
|
-
getByWorkspace(workspaceId: string): Promise<CollectionResult<Channel>>;
|
|
8
|
-
getByOwner(): Promise<CollectionResult<Channel>>;
|
|
9
|
-
getMessages(channelId: string): Promise<CollectionResult<ChannelHistory>>;
|
|
8
|
+
getByWorkspace(workspaceId: string, pagination?: CursorPagination | null): Promise<CollectionResult<Channel>>;
|
|
9
|
+
getByOwner(pagination?: CursorPagination | null): Promise<CollectionResult<Channel>>;
|
|
10
|
+
getMessages(channelId: string, pagination?: CursorPagination | null): Promise<CollectionResult<ChannelHistory>>;
|
|
10
11
|
save(subscriberChannel: Channel): Promise<Channel>;
|
|
11
12
|
testChannel(subscriberChannel: Channel): Promise<boolean>;
|
|
12
13
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Endpoint } from './Endpoint.js';
|
|
2
2
|
import { Channel } from '../Model/Messaging/Channel/Channel.js';
|
|
3
3
|
import { ChannelHistory } from '../Model/Messaging/ChannelHistory.js';
|
|
4
|
+
import { QueryString } from '../Http/Data/QueryString';
|
|
4
5
|
export class ChannelEndpoint extends Endpoint {
|
|
5
6
|
async getById(channelId) {
|
|
6
7
|
try {
|
|
@@ -19,9 +20,11 @@ export class ChannelEndpoint extends Endpoint {
|
|
|
19
20
|
throw ex;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
|
-
async getByWorkspace(workspaceId) {
|
|
23
|
+
async getByWorkspace(workspaceId, pagination = null) {
|
|
23
24
|
try {
|
|
24
|
-
const
|
|
25
|
+
const queryString = new QueryString('/workspaces/' + workspaceId + '/channels');
|
|
26
|
+
queryString.addPagination(pagination);
|
|
27
|
+
const result = await this.requestCollection(queryString, Channel.parse);
|
|
25
28
|
return result;
|
|
26
29
|
}
|
|
27
30
|
catch (ex) {
|
|
@@ -31,9 +34,11 @@ export class ChannelEndpoint extends Endpoint {
|
|
|
31
34
|
throw ex;
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
|
-
async getByOwner() {
|
|
37
|
+
async getByOwner(pagination = null) {
|
|
35
38
|
try {
|
|
36
|
-
const
|
|
39
|
+
const queryString = new QueryString('channels');
|
|
40
|
+
queryString.addPagination(pagination);
|
|
41
|
+
const result = await this.requestCollection(queryString, Channel.parse);
|
|
37
42
|
return result;
|
|
38
43
|
}
|
|
39
44
|
catch (ex) {
|
|
@@ -43,29 +48,12 @@ export class ChannelEndpoint extends Endpoint {
|
|
|
43
48
|
throw ex;
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
|
-
async getMessages(channelId) {
|
|
51
|
+
async getMessages(channelId, pagination = null) {
|
|
47
52
|
try {
|
|
48
|
-
const
|
|
53
|
+
const querystring = new QueryString('/channels/' + channelId + '/messages');
|
|
54
|
+
querystring.addPagination(pagination);
|
|
55
|
+
const result = await this.requestCollection(querystring, ChannelHistory.parse);
|
|
49
56
|
return result;
|
|
50
|
-
// const data: ChannelHistory[] = [];
|
|
51
|
-
//
|
|
52
|
-
// const resultData: any | null = rawChannelHistory.getData();
|
|
53
|
-
// if (resultData !== null) {
|
|
54
|
-
// const orig: ChannelHistory[] = resultData;
|
|
55
|
-
//
|
|
56
|
-
// for (const rawChannelMessage of orig) {
|
|
57
|
-
// data.push(ChannelHistory.parse(rawChannelMessage));
|
|
58
|
-
// }
|
|
59
|
-
// }
|
|
60
|
-
//
|
|
61
|
-
// rawChannelHistory.setData(data);
|
|
62
|
-
//
|
|
63
|
-
// return rawChannelHistory;
|
|
64
|
-
// let subscriberChannels: Channel[] = [];
|
|
65
|
-
// for (let rawChannel of rawChannels) {
|
|
66
|
-
// subscriberChannels.push(Channel.parse(rawChannel));
|
|
67
|
-
// }
|
|
68
|
-
// return subscriberChannels;
|
|
69
57
|
}
|
|
70
58
|
catch (ex) {
|
|
71
59
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -2,16 +2,14 @@ import { OAuthClient } from '../Http/OAuthClient.js';
|
|
|
2
2
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
3
3
|
import { ObjectResult } from '../Model/Result/ObjectResult.js';
|
|
4
4
|
import { Parameters } from '../Http/Data/Parameters.js';
|
|
5
|
-
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
6
5
|
import { QueryString } from '../Http/Data/QueryString.js';
|
|
7
6
|
export declare abstract class Endpoint {
|
|
8
7
|
protected httpClient: OAuthClient;
|
|
9
8
|
constructor(httpClient: OAuthClient);
|
|
10
9
|
private formatParameters;
|
|
11
10
|
private formatKey;
|
|
12
|
-
requestCollection<T>(action: string, parser: (input: any) => T, parameters?: Parameters, method?: string, signWithOauthToken?: boolean): Promise<CollectionResult<T>>;
|
|
11
|
+
requestCollection<T>(action: string | QueryString, parser: (input: any) => T, parameters?: Parameters, method?: string, signWithOauthToken?: boolean): Promise<CollectionResult<T>>;
|
|
13
12
|
requestObject<T>(action: string, parameters: Parameters | undefined, parser: (input: any) => T, method?: string, signWithOauthToken?: boolean): Promise<ObjectResult<T>>;
|
|
14
13
|
parseCollection<T>(rawData: object[], parser: (input: any) => T): T[];
|
|
15
14
|
private parseObject;
|
|
16
|
-
protected buildQuery(pagination: CursorPagination | null): QueryString;
|
|
17
15
|
}
|
package/dist/Service/Endpoint.js
CHANGED
|
@@ -71,6 +71,9 @@ export class Endpoint {
|
|
|
71
71
|
}
|
|
72
72
|
async requestCollection(action, parser, parameters = null, method = 'GET', signWithOauthToken = true) {
|
|
73
73
|
parameters = this.formatParameters(parameters);
|
|
74
|
+
if (action instanceof QueryString) {
|
|
75
|
+
action = action.build();
|
|
76
|
+
}
|
|
74
77
|
const requestResponse = await this.httpClient.request(action, parameters, method, signWithOauthToken);
|
|
75
78
|
const result = new CollectionResult();
|
|
76
79
|
/**
|
|
@@ -151,19 +154,4 @@ export class Endpoint {
|
|
|
151
154
|
}
|
|
152
155
|
return null;
|
|
153
156
|
}
|
|
154
|
-
buildQuery(pagination) {
|
|
155
|
-
const queryString = new QueryString();
|
|
156
|
-
if (pagination !== null && pagination !== undefined) {
|
|
157
|
-
if (pagination.limit !== null && pagination.limit !== undefined) {
|
|
158
|
-
queryString.set('limit', pagination.limit);
|
|
159
|
-
}
|
|
160
|
-
if (pagination.startingAfter !== null && pagination.startingAfter !== undefined && pagination.startingAfter !== '') {
|
|
161
|
-
queryString.set('starting_after', pagination.startingAfter);
|
|
162
|
-
}
|
|
163
|
-
if (pagination.endingBefore !== null && pagination.endingBefore !== undefined && pagination.endingBefore !== '') {
|
|
164
|
-
queryString.set('ending_before', pagination.endingBefore);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return queryString;
|
|
168
|
-
}
|
|
169
157
|
}
|
|
@@ -4,6 +4,7 @@ import { HttpClient } from '../Http/HttpClient.js';
|
|
|
4
4
|
import { FlowRun } from '../Model/Flow/FlowRun.js';
|
|
5
5
|
import { FlowRunSummary } from '../Model/Flow/FlowRunSummary.js';
|
|
6
6
|
import { FlowRunHistory } from '../Model/Flow/FlowRunHistory.js';
|
|
7
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
7
8
|
export class FlowRunEndpoint extends Endpoint {
|
|
8
9
|
async getFlowRuns(flowId) {
|
|
9
10
|
const result = await this.requestCollection('/flows/' + flowId + '/runs', FlowRun.parse);
|
|
@@ -11,7 +12,8 @@ export class FlowRunEndpoint extends Endpoint {
|
|
|
11
12
|
}
|
|
12
13
|
async getFlowRunSummaries(flowId, flowRunStatuses = null, pagination = null, projectEnvironmentId = null) {
|
|
13
14
|
try {
|
|
14
|
-
const queryString =
|
|
15
|
+
const queryString = new QueryString('/flows/' + flowId + '/runsummaries');
|
|
16
|
+
queryString.addPagination(pagination);
|
|
15
17
|
// if (from !== null && from !== undefined) {
|
|
16
18
|
//
|
|
17
19
|
// params = {};
|
|
@@ -36,7 +38,7 @@ export class FlowRunEndpoint extends Endpoint {
|
|
|
36
38
|
// }
|
|
37
39
|
// params.statuses = flowRunStatuses;
|
|
38
40
|
// }
|
|
39
|
-
const result = await this.requestCollection(
|
|
41
|
+
const result = await this.requestCollection(queryString.build(), FlowRunSummary.parse);
|
|
40
42
|
return result;
|
|
41
43
|
}
|
|
42
44
|
catch (error) {
|
|
@@ -4,6 +4,7 @@ import { Utils } from '../Utils.js';
|
|
|
4
4
|
import { LogStreamId } from '../Model/Log/LogStreamId.js';
|
|
5
5
|
import { LogStreamInformation } from '../Model/Log/LogStreamInformation.js';
|
|
6
6
|
import { LogStream } from '../Model/Log/LogStream.js';
|
|
7
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
7
8
|
export class LogEndpoint extends Endpoint {
|
|
8
9
|
async getLogs(logQuery) {
|
|
9
10
|
const arrQuery = [];
|
|
@@ -41,7 +42,8 @@ export class LogEndpoint extends Endpoint {
|
|
|
41
42
|
return result;
|
|
42
43
|
}
|
|
43
44
|
async getCursoredLogEntries(logStreamId, pagination, filter) {
|
|
44
|
-
const queryString =
|
|
45
|
+
const queryString = new QueryString('/logstreams/' + Utils.base64encode(logStreamId.id) + '/logs');
|
|
46
|
+
queryString.addPagination(pagination);
|
|
45
47
|
if (filter !== null && filter !== undefined) {
|
|
46
48
|
if (filter.tags !== null && filter.tags.length > 0) {
|
|
47
49
|
const arrTags = [];
|
|
@@ -57,8 +59,7 @@ export class LogEndpoint extends Endpoint {
|
|
|
57
59
|
queryString.set('filter_log_levels', filter.logLevels.join(','));
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
const
|
|
61
|
-
const result = await this.requestCollection(cmd, Log.parse);
|
|
62
|
+
const result = await this.requestCollection(queryString, Log.parse);
|
|
62
63
|
return result;
|
|
63
64
|
}
|
|
64
65
|
async save(log) {
|
|
@@ -2,9 +2,10 @@ import { Endpoint } from './Endpoint.js';
|
|
|
2
2
|
import { Project } from '../Model/Project/Project.js';
|
|
3
3
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
4
4
|
import { State } from '../Model/State.js';
|
|
5
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination';
|
|
5
6
|
export declare class ProjectEndpoint extends Endpoint {
|
|
6
7
|
getAll(): Promise<CollectionResult<Project>>;
|
|
7
|
-
getByWorkspace(workspaceId: string, states?: State[] | null): Promise<CollectionResult<Project>>;
|
|
8
|
+
getByWorkspace(workspaceId: string, pagination?: CursorPagination | null, states?: State[] | null): Promise<CollectionResult<Project>>;
|
|
8
9
|
getById(projectId: string): Promise<Project | null>;
|
|
9
10
|
save(project: Project): Promise<Project>;
|
|
10
11
|
}
|
|
@@ -14,13 +14,12 @@ export class ProjectEndpoint extends Endpoint {
|
|
|
14
14
|
throw e;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
async getByWorkspace(workspaceId, states = null) {
|
|
17
|
+
async getByWorkspace(workspaceId, pagination = null, states = null) {
|
|
18
18
|
try {
|
|
19
|
-
const queryString = new QueryString();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const result = await this.requestCollection('workspaces/' + workspaceId + '/projects' + queryString.build(), Project.parse);
|
|
19
|
+
const queryString = new QueryString('workspaces/' + workspaceId + '/projects');
|
|
20
|
+
queryString.addPagination(pagination);
|
|
21
|
+
queryString.addStateFilter(states);
|
|
22
|
+
const result = await this.requestCollection(queryString, Project.parse);
|
|
24
23
|
return result;
|
|
25
24
|
}
|
|
26
25
|
catch (e) {
|
|
@@ -4,12 +4,13 @@ import { CodeSource } from '../Model/Deployment/CodeSource.js';
|
|
|
4
4
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
5
5
|
import { SourcesAccountRepository } from '../Model/Deployment/SourcesAccountRepository.js';
|
|
6
6
|
import { SourcesAccountRepositoryBranch } from '../Model/Deployment/SourcesAccountRepositoryBranch.js';
|
|
7
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination';
|
|
7
8
|
export declare class SourcesAccountEndpoint extends Endpoint {
|
|
8
|
-
getAllCodeSources(workspaceId: string): Promise<CollectionResult<CodeSource>>;
|
|
9
|
-
getAllCodeSourceAccounts(workspaceId: string): Promise<CollectionResult<CodeSourceAccount>>;
|
|
9
|
+
getAllCodeSources(workspaceId: string, pagination?: CursorPagination | null): Promise<CollectionResult<CodeSource>>;
|
|
10
|
+
getAllCodeSourceAccounts(workspaceId: string, pagination?: CursorPagination | null): Promise<CollectionResult<CodeSourceAccount>>;
|
|
10
11
|
getCodeSourceAccountById(id: string): Promise<CodeSourceAccount | null>;
|
|
11
12
|
getCodeSourceById(codeSourceId: string): Promise<CodeSource | null>;
|
|
12
|
-
getRepositories(codeSourceAccountId: string): Promise<CollectionResult<SourcesAccountRepository>>;
|
|
13
|
-
getRepositoryBranches(codeSourceAccountId: string, repositoryKey: string): Promise<CollectionResult<SourcesAccountRepositoryBranch>>;
|
|
13
|
+
getRepositories(codeSourceAccountId: string, pagination?: CursorPagination | null): Promise<CollectionResult<SourcesAccountRepository>>;
|
|
14
|
+
getRepositoryBranches(codeSourceAccountId: string, repositoryKey: string, pagination?: CursorPagination | null): Promise<CollectionResult<SourcesAccountRepositoryBranch>>;
|
|
14
15
|
saveCodeSource(codeSource: CodeSource): Promise<CodeSource>;
|
|
15
16
|
}
|
|
@@ -5,13 +5,18 @@ import { CodeSource } from '../Model/Deployment/CodeSource.js';
|
|
|
5
5
|
import { HttpClient } from '../Http/HttpClient.js';
|
|
6
6
|
import { SourcesAccountRepository } from '../Model/Deployment/SourcesAccountRepository.js';
|
|
7
7
|
import { SourcesAccountRepositoryBranch } from '../Model/Deployment/SourcesAccountRepositoryBranch.js';
|
|
8
|
+
import { QueryString } from '../Http/Data/QueryString';
|
|
8
9
|
export class SourcesAccountEndpoint extends Endpoint {
|
|
9
|
-
async getAllCodeSources(workspaceId) {
|
|
10
|
-
const
|
|
10
|
+
async getAllCodeSources(workspaceId, pagination = null) {
|
|
11
|
+
const queryString = new QueryString('workspaces/' + workspaceId + '/codesources');
|
|
12
|
+
queryString.addPagination(pagination);
|
|
13
|
+
const result = await this.requestCollection(queryString, CodeSource.parse);
|
|
11
14
|
return result;
|
|
12
15
|
}
|
|
13
|
-
async getAllCodeSourceAccounts(workspaceId) {
|
|
14
|
-
const
|
|
16
|
+
async getAllCodeSourceAccounts(workspaceId, pagination = null) {
|
|
17
|
+
const queryString = new QueryString('workspaces/' + workspaceId + '/codesourceaccounts');
|
|
18
|
+
queryString.addPagination(pagination);
|
|
19
|
+
const result = await this.requestCollection(queryString, CodeSourceAccount.parse);
|
|
15
20
|
return result;
|
|
16
21
|
}
|
|
17
22
|
async getCodeSourceAccountById(id) {
|
|
@@ -49,13 +54,17 @@ export class SourcesAccountEndpoint extends Endpoint {
|
|
|
49
54
|
throw error;
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
|
-
async getRepositories(codeSourceAccountId) {
|
|
53
|
-
const
|
|
57
|
+
async getRepositories(codeSourceAccountId, pagination = null) {
|
|
58
|
+
const queryString = new QueryString('codesourceaccounts/' + codeSourceAccountId + '/repositories');
|
|
59
|
+
queryString.addPagination(pagination);
|
|
60
|
+
const rawSourcesAccountRepositories = await this.requestCollection(queryString, SourcesAccountRepository.parse);
|
|
54
61
|
return rawSourcesAccountRepositories;
|
|
55
62
|
}
|
|
56
|
-
async getRepositoryBranches(codeSourceAccountId, repositoryKey) {
|
|
63
|
+
async getRepositoryBranches(codeSourceAccountId, repositoryKey, pagination = null) {
|
|
64
|
+
const queryString = new QueryString('codesourceaccounts/' + codeSourceAccountId + '/repositories/' + repositoryKey + '/branches');
|
|
65
|
+
queryString.addPagination(pagination);
|
|
57
66
|
repositoryKey = Utils.base64encode(repositoryKey);
|
|
58
|
-
const rawBranches = await this.requestCollection(
|
|
67
|
+
const rawBranches = await this.requestCollection(queryString, SourcesAccountRepositoryBranch.parse);
|
|
59
68
|
return rawBranches;
|
|
60
69
|
}
|
|
61
70
|
async saveCodeSource(codeSource) {
|
|
@@ -4,8 +4,9 @@ import { WorkspaceMember } from '../Model/Workspace/WorkspaceMember.js';
|
|
|
4
4
|
import { WorkspaceMemberInvite } from '../Model/Workspace/WorkspaceMemberInvite.js';
|
|
5
5
|
import { WorkspaceMemberInvite2 } from '../Model/Workspace/WorkspaceMemberInvite2.js';
|
|
6
6
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
7
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination';
|
|
7
8
|
export declare class WorkspaceMemberEndpoint extends Endpoint {
|
|
8
|
-
getByWorkspace(workspaceId: string): Promise<CollectionResult<WorkspaceMember>>;
|
|
9
|
+
getByWorkspace(workspaceId: string, pagination?: CursorPagination | null): Promise<CollectionResult<WorkspaceMember>>;
|
|
9
10
|
invite(workspaceId: string, invites: WorkspaceMemberInvite[]): Promise<boolean>;
|
|
10
11
|
getWorkspaceInviteByCode(inviteCode: string): Promise<WorkspaceMemberInvite2 | null>;
|
|
11
12
|
getWorkspaceMemberEvents(workspaceId: string, memberId: string): Promise<CollectionResult<UserAction>>;
|
|
@@ -7,9 +7,11 @@ import { WorkspaceMember } from '../Model/Workspace/WorkspaceMember.js';
|
|
|
7
7
|
import { WorkspaceMemberRole } from '../Model/Workspace/WorkspaceMemberRole.js';
|
|
8
8
|
import { WorkspaceMemberInviteState } from '../Model/Workspace/WorkspaceMemberInviteState.js';
|
|
9
9
|
import { WorkspaceMemberInvite2 } from '../Model/Workspace/WorkspaceMemberInvite2.js';
|
|
10
|
+
import { QueryString } from '../Http/Data/QueryString';
|
|
10
11
|
export class WorkspaceMemberEndpoint extends Endpoint {
|
|
11
|
-
async getByWorkspace(workspaceId) {
|
|
12
|
-
const
|
|
12
|
+
async getByWorkspace(workspaceId, pagination = null) {
|
|
13
|
+
const queryString = new QueryString('workspaces/' + workspaceId + '/members');
|
|
14
|
+
queryString.addPagination(pagination);
|
|
13
15
|
const parser = (rawMember) => {
|
|
14
16
|
const member = new WorkspaceMember();
|
|
15
17
|
member.id = rawMember.id;
|
|
@@ -28,7 +30,7 @@ export class WorkspaceMemberEndpoint extends Endpoint {
|
|
|
28
30
|
}
|
|
29
31
|
return member;
|
|
30
32
|
};
|
|
31
|
-
const result = await this.requestCollection(
|
|
33
|
+
const result = await this.requestCollection(queryString, parser);
|
|
32
34
|
return result;
|
|
33
35
|
}
|
|
34
36
|
async invite(workspaceId, invites) {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.11.
|
|
1
|
+
export declare const VERSION = "1.11.14";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.11.
|
|
1
|
+
export const VERSION = "1.11.14";
|