attlaz-client 1.19.9 → 1.21.0

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.js CHANGED
@@ -91,6 +91,7 @@ export class Client {
91
91
  const options = new OAuthClientOptions(this.apiEndpoint, clientId, clientSecret);
92
92
  // TODO: how to know these scopes?
93
93
  options.scopes = ['all'];
94
+ // TODO: do we need to create a new oauth client, or can we update with these credentials?
94
95
  this.httpClient = new OAuthClient(options);
95
96
  }
96
97
  getHttpClient() {
@@ -1,11 +1,11 @@
1
1
  import { clientCredentials, ownerCredentials, refreshToken } from 'axios-oauth-client';
2
2
  import axios from 'axios';
3
+ import { VERSION } from '../version.js';
4
+ import { JsonSerializable } from '../Model/JsonSerializable.js';
3
5
  import { ClientError } from './ClientError.js';
4
6
  import { HttpClient } from './HttpClient.js';
5
7
  import { HttpClientRequest } from './HttpClientRequest.js';
6
8
  import { OAuthClientToken } from './OAuthClientToken.js';
7
- import { JsonSerializable } from '../Model/JsonSerializable.js';
8
- import { VERSION } from '../version.js';
9
9
  export class OAuthClient {
10
10
  options;
11
11
  debug = false;
@@ -4,8 +4,8 @@ export declare class UserAction {
4
4
  userId: string;
5
5
  workspaceId: string;
6
6
  action: string;
7
- resourceId: string;
8
- resourceType: string;
7
+ entityId: string;
8
+ entityType: string;
9
9
  description: string;
10
10
  ip: string;
11
11
  time: Date;
@@ -3,8 +3,8 @@ export class UserAction {
3
3
  userId;
4
4
  workspaceId;
5
5
  action;
6
- resourceId;
7
- resourceType;
6
+ entityId;
7
+ entityType;
8
8
  description;
9
9
  ip;
10
10
  time;
@@ -52,8 +52,8 @@ export class UserActionEndpoint extends Endpoint {
52
52
  userAction.userId = rawUserEvent.user;
53
53
  userAction.workspaceId = rawUserEvent.workspace;
54
54
  userAction.action = rawUserEvent.action;
55
- userAction.resourceId = rawUserEvent.resource;
56
- userAction.resourceType = rawUserEvent.resource_type;
55
+ userAction.entityId = rawUserEvent.entity;
56
+ userAction.entityType = rawUserEvent.entity_type;
57
57
  userAction.description = rawUserEvent.description;
58
58
  userAction.ip = rawUserEvent.ip;
59
59
  userAction.time = Utils.parseRawDate(rawUserEvent.time);
@@ -10,4 +10,5 @@ export declare class WorkspaceMemberEndpoint extends Endpoint {
10
10
  invite(workspaceId: string, invites: WorkspaceMemberInvite[]): Promise<boolean>;
11
11
  getWorkspaceInviteByCode(inviteCode: string): Promise<WorkspaceMemberInvite2 | null>;
12
12
  getRoles(workspaceId: string): Promise<CollectionResult<WorkspaceMemberRole>>;
13
+ saveMember(member: WorkspaceMember): Promise<WorkspaceMember>;
13
14
  }
@@ -55,4 +55,21 @@ export class WorkspaceMemberEndpoint extends Endpoint {
55
55
  };
56
56
  return await this.requestCollection(cmd, parser);
57
57
  }
58
+ async saveMember(member) {
59
+ try {
60
+ const url = '/workspaces/' + member.workspaceId + '/members/' + member.id;
61
+ const result = await this.requestObject(url, member, WorkspaceMember.parse, 'POST');
62
+ const updatedWorkspaceMember = result.getData();
63
+ if (updatedWorkspaceMember === null) {
64
+ throw new Error('WorkspaceMember not updated');
65
+ }
66
+ return updatedWorkspaceMember;
67
+ }
68
+ catch (error) {
69
+ if (this.httpClient.isDebugEnabled()) {
70
+ console.error('Failed to save workspace members: ', error);
71
+ }
72
+ throw error;
73
+ }
74
+ }
58
75
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.19.5";
1
+ export declare const VERSION = "1.20.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.19.5";
1
+ export const VERSION = "1.20.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.19.9",
3
+ "version": "1.21.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -29,9 +29,10 @@
29
29
  "author": "Stijn Duynslaeger <stijn@attlaz.com> (stijn@attlaz.com)",
30
30
  "license": "MIT",
31
31
  "scripts": {
32
- "prebuild": "node -p \"'export const VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
33
- "prepare": "npm run clean && tsc --project tsconfig.production.json",
32
+ "prebuild": "npm run setversion",
33
+ "prepare": "npm run clean && tsc --project tsconfig.production.json && npm run setversion",
34
34
  "build": "npm run clean && tsc",
35
+ "setversion": "node -p \"'export const VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
35
36
  "clean": "rimraf dist",
36
37
  "scan": "docker run -v .:/path zricethezav/gitleaks:latest detect --source=\"/path\" ",
37
38
  "test": "jest"