attlaz-client 1.13.42 → 1.13.44
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/AccessToken/UserAccessToken.d.ts +1 -1
- package/dist/Model/AccessToken/UserAccessToken.js +2 -2
- package/dist/Service/AccessTokenEndpoint.d.ts +2 -0
- package/dist/Service/AccessTokenEndpoint.js +34 -0
- package/dist/Service/TriggerEndpoint.d.ts +1 -0
- package/dist/Service/TriggerEndpoint.js +16 -4
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ export class UserAccessToken {
|
|
|
6
6
|
ipAllowList = [];
|
|
7
7
|
name;
|
|
8
8
|
scopes = [];
|
|
9
|
-
|
|
9
|
+
secret;
|
|
10
10
|
createdAt;
|
|
11
11
|
lastUsedAt = null;
|
|
12
12
|
expiresAt = null;
|
|
@@ -19,7 +19,7 @@ export class UserAccessToken {
|
|
|
19
19
|
userAccessToken.ipAllowList = rawUser.ip_allow_list;
|
|
20
20
|
userAccessToken.name = rawUser.name;
|
|
21
21
|
userAccessToken.scopes = rawUser.scopes;
|
|
22
|
-
userAccessToken.
|
|
22
|
+
userAccessToken.secret = rawUser.secret;
|
|
23
23
|
userAccessToken.createdAt = Utils.parseRawDate(rawUser.created_at);
|
|
24
24
|
userAccessToken.lastUsedAt = rawUser.last_used_at === null ? null : Utils.parseRawDate(rawUser.last_used_at);
|
|
25
25
|
userAccessToken.expiresAt = rawUser.expires_at === null ? null : Utils.parseRawDate(rawUser.expires_at);
|
|
@@ -4,4 +4,6 @@ import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
|
4
4
|
import { UserAccessToken } from '../Model/AccessToken/UserAccessToken.js';
|
|
5
5
|
export declare class AccessTokenEndpoint extends Endpoint {
|
|
6
6
|
getByUser(pagination: CursorPagination): Promise<CollectionResult<UserAccessToken>>;
|
|
7
|
+
create(name: string, scopes: string[]): Promise<UserAccessToken>;
|
|
8
|
+
update(tokenId: string, name: string, scopes: string[]): Promise<UserAccessToken>;
|
|
7
9
|
}
|
|
@@ -16,4 +16,38 @@ export class AccessTokenEndpoint extends Endpoint {
|
|
|
16
16
|
throw e;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
async create(name, scopes) {
|
|
20
|
+
try {
|
|
21
|
+
const url = '/access-tokens';
|
|
22
|
+
const result = await this.requestObject(url, { name, scopes }, UserAccessToken.parse, 'POST');
|
|
23
|
+
const createdToken = result.getData();
|
|
24
|
+
if (createdToken === null) {
|
|
25
|
+
throw new Error('Unable to create token: wrong response from API');
|
|
26
|
+
}
|
|
27
|
+
return createdToken;
|
|
28
|
+
}
|
|
29
|
+
catch (ex) {
|
|
30
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
31
|
+
console.error('Failed to save token: ', ex);
|
|
32
|
+
}
|
|
33
|
+
throw ex;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async update(tokenId, name, scopes) {
|
|
37
|
+
try {
|
|
38
|
+
const url = '/access-tokens/' + tokenId;
|
|
39
|
+
const result = await this.requestObject(url, { name, scopes }, UserAccessToken.parse, 'POST');
|
|
40
|
+
const updatedToken = result.getData();
|
|
41
|
+
if (updatedToken === null) {
|
|
42
|
+
throw new Error('Unable to create token: wrong response from API');
|
|
43
|
+
}
|
|
44
|
+
return updatedToken;
|
|
45
|
+
}
|
|
46
|
+
catch (ex) {
|
|
47
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
48
|
+
console.error('Failed to save token: ', ex);
|
|
49
|
+
}
|
|
50
|
+
throw ex;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
19
53
|
}
|
|
@@ -4,6 +4,7 @@ import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
|
4
4
|
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
5
5
|
export declare class TriggerEndpoint extends Endpoint {
|
|
6
6
|
getByFlow(flowId: string, projectEnvironmentId?: string | null, pagination?: CursorPagination | null): Promise<CollectionResult<Trigger>>;
|
|
7
|
+
getByCodeSource(codeSourceId: string, pagination?: CursorPagination | null): Promise<CollectionResult<Trigger>>;
|
|
7
8
|
getById(id: string): Promise<Trigger | null>;
|
|
8
9
|
save(trigger: Trigger): Promise<Trigger>;
|
|
9
10
|
}
|
|
@@ -5,10 +5,8 @@ import { QueryString } from '../Http/Data/QueryString.js';
|
|
|
5
5
|
export class TriggerEndpoint extends Endpoint {
|
|
6
6
|
async getByFlow(flowId, projectEnvironmentId = null, pagination = null) {
|
|
7
7
|
try {
|
|
8
|
-
const queryString = new QueryString('/
|
|
9
|
-
|
|
10
|
-
queryString.addPagination(pagination);
|
|
11
|
-
}
|
|
8
|
+
const queryString = new QueryString('/triggers/rfr/' + flowId + '');
|
|
9
|
+
queryString.addPagination(pagination);
|
|
12
10
|
let parameters = null;
|
|
13
11
|
if (!Utils.isNullOrUndefined(projectEnvironmentId)) {
|
|
14
12
|
parameters = { environment: projectEnvironmentId };
|
|
@@ -23,6 +21,20 @@ export class TriggerEndpoint extends Endpoint {
|
|
|
23
21
|
throw error;
|
|
24
22
|
}
|
|
25
23
|
}
|
|
24
|
+
async getByCodeSource(codeSourceId, pagination = null) {
|
|
25
|
+
try {
|
|
26
|
+
const queryString = new QueryString('/triggers/csd/' + codeSourceId + '');
|
|
27
|
+
queryString.addPagination(pagination);
|
|
28
|
+
const rawTriggers = await this.requestCollection(queryString, Trigger.parse, null);
|
|
29
|
+
return rawTriggers;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
33
|
+
console.error('Failed to load triggers: ', error);
|
|
34
|
+
}
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
26
38
|
async getById(id) {
|
|
27
39
|
try {
|
|
28
40
|
const result = await this.requestObject('/triggers/' + id, null, Trigger.parse);
|