attlaz-client 1.13.18 → 1.13.20

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 CHANGED
@@ -28,6 +28,7 @@ import { FlowRunStatsEndpoint } from './Service/FlowRunStatsEndpoint.js';
28
28
  import { FirewallEndpoint } from './Service/FirewallEndpoint.js';
29
29
  import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
30
30
  import { SearchEndpoint } from './Service/SearchEndpoint.js';
31
+ import { UserActionEndpoint } from './Service/UserActionEndpoint.js';
31
32
  export declare class Client {
32
33
  private endpoints;
33
34
  private httpClient;
@@ -73,6 +74,7 @@ export declare class Client {
73
74
  getHealthAlertEndpoint(): HealthAlertEndpoint;
74
75
  getCodeSourceStrategiesEndpoint(): CodeSourceStrategiesEndpoint;
75
76
  getSearchEndpoint(): SearchEndpoint;
77
+ getUserActionEndpoint(): UserActionEndpoint;
76
78
  getFirewallEndpoint(): FirewallEndpoint;
77
79
  private getEndpoint;
78
80
  }
package/dist/Client.js CHANGED
@@ -29,6 +29,7 @@ import { FlowRunStatsEndpoint } from './Service/FlowRunStatsEndpoint.js';
29
29
  import { FirewallEndpoint } from './Service/FirewallEndpoint.js';
30
30
  import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
31
31
  import { SearchEndpoint } from './Service/SearchEndpoint.js';
32
+ import { UserActionEndpoint } from './Service/UserActionEndpoint.js';
32
33
  export class Client {
33
34
  endpoints;
34
35
  httpClient;
@@ -61,6 +62,7 @@ export class Client {
61
62
  CodeSourceStrategiesEndpoint,
62
63
  FirewallEndpoint,
63
64
  SearchEndpoint,
65
+ UserActionEndpoint,
64
66
  };
65
67
  apiEndpoint = 'https://api.attlaz.com';
66
68
  parseConfig(config) {
@@ -192,6 +194,9 @@ export class Client {
192
194
  getSearchEndpoint() {
193
195
  return this.getEndpoint('search', this.Store.SearchEndpoint);
194
196
  }
197
+ getUserActionEndpoint() {
198
+ return this.getEndpoint('useraction', this.Store.UserActionEndpoint);
199
+ }
195
200
  // TODO: this should be in a separate API?
196
201
  getFirewallEndpoint() {
197
202
  return this.getEndpoint('firewall', this.Store.FirewallEndpoint);
@@ -2,7 +2,6 @@ import { State } from '../State.js';
2
2
  import { StateAware } from '../StateAware.js';
3
3
  export declare class CodeSourceAccount implements StateAware {
4
4
  id: string;
5
- key: string;
6
5
  name: string;
7
6
  userId: string;
8
7
  workspaceId: string;
@@ -1,7 +1,6 @@
1
1
  import { State } from '../State.js';
2
2
  export class CodeSourceAccount {
3
3
  id;
4
- key;
5
4
  name;
6
5
  userId;
7
6
  workspaceId;
@@ -13,7 +12,6 @@ export class CodeSourceAccount {
13
12
  static parse(rawSourcesAccount) {
14
13
  const sourcesAccount = new CodeSourceAccount();
15
14
  sourcesAccount.id = rawSourcesAccount.id;
16
- sourcesAccount.key = rawSourcesAccount.key;
17
15
  sourcesAccount.name = rawSourcesAccount.name;
18
16
  sourcesAccount.userId = rawSourcesAccount.user;
19
17
  sourcesAccount.workspaceId = rawSourcesAccount.workspace;
@@ -0,0 +1,10 @@
1
+ import { Endpoint } from './Endpoint.js';
2
+ import { UserAction } from '../Model/User/UserAction.js';
3
+ import { CollectionResult } from '../Model/Result/CollectionResult.js';
4
+ import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
5
+ export declare class UserActionEndpoint extends Endpoint {
6
+ getWorkspaceMemberActions(workspaceId: string, memberId: string, pagination?: CursorPagination | null): Promise<CollectionResult<UserAction>>;
7
+ getUserActions(userId: string, pagination?: CursorPagination | null): Promise<CollectionResult<UserAction>>;
8
+ getByResource(resourceId: string, resourceType: string, pagination?: CursorPagination | null): Promise<CollectionResult<UserAction>>;
9
+ private static parse;
10
+ }
@@ -0,0 +1,64 @@
1
+ import { Endpoint } from './Endpoint.js';
2
+ import { Utils } from '../Utils.js';
3
+ import { UserAction } from '../Model/User/UserAction.js';
4
+ import { DataValueCollection } from '../Model/DataValueCollection.js';
5
+ import { QueryString } from '../Http/Data/QueryString.js';
6
+ export class UserActionEndpoint extends Endpoint {
7
+ async getWorkspaceMemberActions(workspaceId, memberId, pagination = null) {
8
+ try {
9
+ const queryString = new QueryString('/workspaces/' + workspaceId + '/members/' + memberId + '/actions');
10
+ queryString.addPagination(pagination);
11
+ const result = await this.requestCollection(queryString, UserActionEndpoint.parse, null, 'GET');
12
+ return result;
13
+ }
14
+ catch (error) {
15
+ if (this.httpClient.isDebugEnabled()) {
16
+ console.error('Failed to load adapter configuration: ', error);
17
+ }
18
+ throw error;
19
+ }
20
+ }
21
+ async getUserActions(userId, pagination = null) {
22
+ try {
23
+ const queryString = new QueryString('/users/' + userId + '/actions');
24
+ queryString.addPagination(pagination);
25
+ const result = await this.requestCollection(queryString, UserActionEndpoint.parse, null, 'GET');
26
+ return result;
27
+ }
28
+ catch (error) {
29
+ if (this.httpClient.isDebugEnabled()) {
30
+ console.error('Failed to load adapter configuration: ', error);
31
+ }
32
+ throw error;
33
+ }
34
+ }
35
+ async getByResource(resourceId, resourceType, pagination = null) {
36
+ try {
37
+ const queryString = new QueryString('/resources/' + resourceType + '/' + resourceId + '/actions');
38
+ queryString.addPagination(pagination);
39
+ const result = await this.requestCollection(queryString, UserActionEndpoint.parse, null, 'GET');
40
+ return result;
41
+ }
42
+ catch (error) {
43
+ if (this.httpClient.isDebugEnabled()) {
44
+ console.error('Failed to load adapter configuration: ', error);
45
+ }
46
+ throw error;
47
+ }
48
+ }
49
+ static parse(rawUserEvent) {
50
+ const userAction = new UserAction();
51
+ userAction.id = rawUserEvent.id;
52
+ userAction.userId = rawUserEvent.user;
53
+ userAction.workspaceId = rawUserEvent.workspace;
54
+ userAction.action = rawUserEvent.action;
55
+ userAction.resourceId = rawUserEvent.resource;
56
+ userAction.resourceType = rawUserEvent.resource_type;
57
+ userAction.description = rawUserEvent.description;
58
+ userAction.ip = rawUserEvent.ip;
59
+ userAction.time = Utils.parseRawDate(rawUserEvent.time);
60
+ userAction.result = rawUserEvent.result;
61
+ userAction.data = DataValueCollection.fromObject(rawUserEvent.data);
62
+ return userAction;
63
+ }
64
+ }
@@ -7,27 +7,6 @@ export class UserEndpoint extends Endpoint {
7
7
  const rawUser = await this.requestObject(cmd, null, User.parse);
8
8
  return rawUser.getData();
9
9
  }
10
- // public async createAuthProvider(providerType: string, data: { code: string; state: string }): Promise<boolean> {
11
- // try {
12
- // const parser = (raw: any): { created: boolean } => raw;
13
- // const result: ObjectResult<{
14
- // created: boolean
15
- // }> = await this.requestObject('/users/auth/providers', {
16
- // provider_type: providerType, code: data.code, state: data.state
17
- // }, parser, 'POST');
18
- // const re: { created: boolean } | null = result.getData();
19
- // if (re === null) {
20
- // console.log('create auth provider wrong data', {result, parsed: re});
21
- // throw new Error('Unable to create auth provider: wrong response from API');
22
- // }
23
- // return re.created;
24
- // } catch (e) {
25
- // if (this.httpClient.isDebugEnabled()) {
26
- // console.error('Failed to assign auth provider: ', e);
27
- // }
28
- // throw e;
29
- // }
30
- // }
31
10
  async removeAuthProvider(providerId) {
32
11
  try {
33
12
  const parser = (raw) => ({ deleted: raw.deleted });
@@ -1,5 +1,4 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
- import { UserAction } from '../Model/User/UserAction.js';
3
2
  import { WorkspaceMember } from '../Model/Workspace/WorkspaceMember.js';
4
3
  import { WorkspaceMemberInvite } from '../Model/Workspace/WorkspaceMemberInvite.js';
5
4
  import { WorkspaceMemberInvite2 } from '../Model/Workspace/WorkspaceMemberInvite2.js';
@@ -9,6 +8,4 @@ export declare class WorkspaceMemberEndpoint extends Endpoint {
9
8
  getByWorkspace(workspaceId: string, pagination?: CursorPagination | null): Promise<CollectionResult<WorkspaceMember>>;
10
9
  invite(workspaceId: string, invites: WorkspaceMemberInvite[]): Promise<boolean>;
11
10
  getWorkspaceInviteByCode(inviteCode: string): Promise<WorkspaceMemberInvite2 | null>;
12
- getWorkspaceMemberEvents(workspaceId: string, memberId: string): Promise<CollectionResult<UserAction>>;
13
- private static parse;
14
11
  }
@@ -1,8 +1,6 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
2
  import { Utils } from '../Utils.js';
3
3
  import { State } from '../Model/State.js';
4
- import { UserAction } from '../Model/User/UserAction.js';
5
- import { DataValueCollection } from '../Model/DataValueCollection.js';
6
4
  import { WorkspaceMember } from '../Model/Workspace/WorkspaceMember.js';
7
5
  import { WorkspaceMemberRole } from '../Model/Workspace/WorkspaceMemberRole.js';
8
6
  import { WorkspaceMemberInviteState } from '../Model/Workspace/WorkspaceMemberInviteState.js';
@@ -68,32 +66,4 @@ export class WorkspaceMemberEndpoint extends Endpoint {
68
66
  }
69
67
  return null;
70
68
  }
71
- async getWorkspaceMemberEvents(workspaceId, memberId) {
72
- try {
73
- const url = '/workspaces/' + workspaceId + '/members/' + memberId + '/events';
74
- const result = await this.requestCollection(url, WorkspaceMemberEndpoint.parse, null, 'GET');
75
- return result;
76
- }
77
- catch (error) {
78
- if (this.httpClient.isDebugEnabled()) {
79
- console.error('Failed to load adapter configuration: ', error);
80
- }
81
- throw error;
82
- }
83
- }
84
- static parse(rawUserEvent) {
85
- const userAction = new UserAction();
86
- userAction.id = rawUserEvent.id;
87
- userAction.userId = rawUserEvent.user;
88
- userAction.workspaceId = rawUserEvent.workspace;
89
- userAction.action = rawUserEvent.action;
90
- userAction.resourceId = rawUserEvent.resource;
91
- userAction.resourceType = rawUserEvent.resource_type;
92
- userAction.description = rawUserEvent.description;
93
- userAction.ip = rawUserEvent.ip;
94
- userAction.time = Utils.parseRawDate(rawUserEvent.time);
95
- userAction.result = rawUserEvent.result;
96
- userAction.data = DataValueCollection.fromObject(rawUserEvent.data);
97
- return userAction;
98
- }
99
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.13.18",
3
+ "version": "1.13.20",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",