@inweb/client 25.9.3 → 25.9.5
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 +117 -108
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +30 -3
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Assembly.d.ts +5 -13
- package/lib/Api/ClashTest.d.ts +3 -11
- package/lib/Api/Client.d.ts +4 -3
- package/lib/Api/FetchError.d.ts +8 -2
- package/lib/Api/File.d.ts +20 -26
- package/lib/Api/HttpClient.d.ts +1 -1
- package/lib/Api/IFile.d.ts +72 -0
- package/lib/Api/IHttpClient.d.ts +82 -1
- package/lib/Api/IRole.d.ts +59 -0
- package/lib/Api/IUser.d.ts +30 -1
- package/lib/Api/Job.d.ts +2 -2
- package/lib/Api/Member.d.ts +5 -12
- package/lib/Api/Permission.d.ts +16 -16
- package/lib/Api/Project.d.ts +46 -21
- package/lib/Api/Role.d.ts +4 -17
- package/lib/Api/User.d.ts +3 -2
- package/lib/index.d.ts +4 -0
- package/package.json +2 -2
- package/src/Api/Assembly.ts +5 -13
- package/src/Api/ClashTest.ts +3 -11
- package/src/Api/Client.ts +4 -3
- package/src/Api/FetchError.ts +9 -2
- package/src/Api/File.ts +20 -26
- package/src/Api/HttpClient.ts +1 -1
- package/src/Api/IFile.ts +84 -0
- package/src/Api/IHttpClient.ts +85 -1
- package/src/Api/IRole.ts +88 -0
- package/src/Api/IUser.ts +37 -1
- package/src/Api/Job.ts +2 -2
- package/src/Api/Member.ts +5 -12
- package/src/Api/Permission.ts +16 -17
- package/src/Api/Project.ts +83 -21
- package/src/Api/Role.ts +4 -17
- package/src/Api/User.ts +3 -2
- package/src/index.ts +4 -0
package/src/Api/IRole.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Defines the {@link Role | role} actions are allowed to be performed.
|
|
26
|
+
*/
|
|
27
|
+
export interface IRoleActions {
|
|
28
|
+
/**
|
|
29
|
+
* Defines what actions are allowed to be performed at the project level. The available
|
|
30
|
+
* actions include:
|
|
31
|
+
*
|
|
32
|
+
* - `update` - The ability to update the project details.
|
|
33
|
+
* - `createTopic` - The ability to create a new topic.
|
|
34
|
+
* - `createDocument` - The ability to create a new document.
|
|
35
|
+
*/
|
|
36
|
+
projectActions?: string[];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Defines what actions are allowed to be performed at the topic level. The available actions include:
|
|
40
|
+
*
|
|
41
|
+
* - `update` - The ability to update the topic.
|
|
42
|
+
* - `updateBimSnippet` - The ability to update the BIM snippet for topics.
|
|
43
|
+
* - `updateRelatedTopics` - The ability to update the collection of related topics.
|
|
44
|
+
* - `updateDocumentReferences` - The ability to update the collection of document references.
|
|
45
|
+
* - `updateFiles` - The ability to update the file header.
|
|
46
|
+
* - `createComment` - The ability to create a comment.
|
|
47
|
+
* - `createViewpoint` - The ability to create a new viewpoint.
|
|
48
|
+
*/
|
|
49
|
+
topicActions?: string[];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Defines what actions are allowed to be performed at the comment level. The available
|
|
53
|
+
* actions include:
|
|
54
|
+
*
|
|
55
|
+
* - `update` - The ability to update the comment.
|
|
56
|
+
* - `delete` - The ability to delete the comment.
|
|
57
|
+
*/
|
|
58
|
+
commentActions?: string[];
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Defines what actions are allowed to be performed at the viewpoint level. The available
|
|
62
|
+
* actions include:
|
|
63
|
+
*
|
|
64
|
+
* - `update` - The ability to update the viewpoint.
|
|
65
|
+
* - `delete` - The ability to delete the viewpoint.
|
|
66
|
+
*/
|
|
67
|
+
viewpointActions?: string[];
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Defines what actions are allowed to be performed at the groups level. The available actions include:
|
|
71
|
+
*
|
|
72
|
+
* - `create` - The ability to create the group.
|
|
73
|
+
* - `update` - The ability to update the group.
|
|
74
|
+
* - `updateUser` - The ability to add users to the group.
|
|
75
|
+
* - `delete` - The ability to delete the group.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
odaGroupActions?: string[];
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Defines what actions are allowed to be performed at the roles level. The available actions include:
|
|
82
|
+
*
|
|
83
|
+
* - `create` - The ability to create the role.
|
|
84
|
+
* - `update` - The ability to update the role.
|
|
85
|
+
* - `delete` - The ability to delete the role.
|
|
86
|
+
*/
|
|
87
|
+
odaRoleActions?: string[];
|
|
88
|
+
}
|
package/src/Api/IUser.ts
CHANGED
|
@@ -21,13 +21,49 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Defines brief user information.
|
|
26
|
+
*/
|
|
27
|
+
export interface IShortUserDesc {
|
|
28
|
+
/**
|
|
29
|
+
* Unique user ID.
|
|
30
|
+
*/
|
|
25
31
|
userId: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* User name.
|
|
35
|
+
*/
|
|
26
36
|
userName: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* First name.
|
|
40
|
+
*/
|
|
27
41
|
name: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Last name.
|
|
45
|
+
*/
|
|
28
46
|
lastName: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* User email.
|
|
50
|
+
*/
|
|
29
51
|
email: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* User avatar image URL or empty string if the user does not have an avatar.
|
|
55
|
+
*/
|
|
30
56
|
avatarUrl?: string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* User full name. Contains the user's first and last name. If first name and last names are
|
|
60
|
+
* empty, contains the user name.
|
|
61
|
+
*/
|
|
31
62
|
fullName?: string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* User initials. Contains a first letters of the user's first and last names. If first name
|
|
66
|
+
* and last names are empty, contains the first letter of the user name.
|
|
67
|
+
*/
|
|
32
68
|
initials?: string;
|
|
33
69
|
}
|
package/src/Api/Job.ts
CHANGED
|
@@ -25,7 +25,7 @@ import { IHttpClient } from "./IHttpClient";
|
|
|
25
25
|
import { waitFor } from "./Utils";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Provides properties and methods for obtaining information about a job on the
|
|
28
|
+
* Provides properties and methods for obtaining information about a job on the Open Cloud Server.
|
|
29
29
|
*/
|
|
30
30
|
export class Job {
|
|
31
31
|
private _data: any;
|
|
@@ -33,7 +33,7 @@ export class Job {
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* @param data - Raw job data received from the server.
|
|
36
|
-
* @param httpClient - HTTP client instance used to send
|
|
36
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server.
|
|
37
37
|
*/
|
|
38
38
|
constructor(data: any, httpClient: IHttpClient) {
|
|
39
39
|
this.httpClient = httpClient;
|
package/src/Api/Member.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
import { IHttpClient } from "./IHttpClient";
|
|
25
|
-
import {
|
|
25
|
+
import { IShortUserDesc } from "./IUser";
|
|
26
26
|
import { userFullName, userInitials } from "./Utils";
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -37,7 +37,7 @@ export class Member {
|
|
|
37
37
|
/**
|
|
38
38
|
* @param data - Raw member data received from the server.
|
|
39
39
|
* @param projectId - Owner project ID.
|
|
40
|
-
* @param httpClient - HTTP client instance used to send
|
|
40
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server.
|
|
41
41
|
*/
|
|
42
42
|
constructor(data: any, projectId: string, httpClient: IHttpClient) {
|
|
43
43
|
this.httpClient = httpClient;
|
|
@@ -83,7 +83,8 @@ export class Member {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* Member role. See {@link Project.getRoles | Project.getRoles()} for
|
|
86
|
+
* Member role name in the project. See {@link Project.getRoles | Project.getRoles()} for list
|
|
87
|
+
* of project roles.
|
|
87
88
|
*/
|
|
88
89
|
get role(): string {
|
|
89
90
|
return this.data.role;
|
|
@@ -105,17 +106,9 @@ export class Member {
|
|
|
105
106
|
/**
|
|
106
107
|
* User information.
|
|
107
108
|
*
|
|
108
|
-
* @property {string} userId - User ID.
|
|
109
|
-
* @property {string} userName - User name.
|
|
110
|
-
* @property {string} name - First name.
|
|
111
|
-
* @property {string} lastName - Last name.
|
|
112
|
-
* @property {string} fullName - Full name.
|
|
113
|
-
* @property {string} initials - Initials.
|
|
114
|
-
* @property {string} email - User email.
|
|
115
|
-
* @property {string} avatarUrl - User avatar image URL.
|
|
116
109
|
* @readonly
|
|
117
110
|
*/
|
|
118
|
-
get user():
|
|
111
|
+
get user(): IShortUserDesc {
|
|
119
112
|
return this.data.user;
|
|
120
113
|
}
|
|
121
114
|
|
package/src/Api/Permission.ts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
import { IHttpClient } from "./IHttpClient";
|
|
25
|
+
import { IGrantedTo } from "./IFile";
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Provides properties and methods for obtaining information about {@link File | file} actions
|
|
@@ -35,7 +36,7 @@ export class Permission {
|
|
|
35
36
|
/**
|
|
36
37
|
* @param data - Raw permission data received from the server.
|
|
37
38
|
* @param fileId - Owner file ID.
|
|
38
|
-
* @param httpClient - HTTP client instance used to send
|
|
39
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server.
|
|
39
40
|
*/
|
|
40
41
|
constructor(data: any, fileId: string, httpClient: IHttpClient) {
|
|
41
42
|
this.httpClient = httpClient;
|
|
@@ -95,26 +96,13 @@ export class Permission {
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
/**
|
|
98
|
-
*
|
|
99
|
-
* project that will get access to the file.
|
|
100
|
-
*
|
|
101
|
-
* @typedef {any} Principial
|
|
102
|
-
* @property {any} user - The user entry that get access to the file.
|
|
103
|
-
* @property {string} user.id - User ID.
|
|
104
|
-
* @property {string} user.name - User name.
|
|
105
|
-
* @property {any} project - The project entry that get access to the file.
|
|
106
|
-
* @property {string} project.id - Project ID.
|
|
107
|
-
* @property {string} project.name - Project name.
|
|
99
|
+
* A list of entities that will get access to the file.
|
|
108
100
|
*/
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* A list of principials that will get access to the file.
|
|
112
|
-
*/
|
|
113
|
-
get grantedTo(): any[] {
|
|
101
|
+
get grantedTo(): IGrantedTo[] {
|
|
114
102
|
return this.data.grantedTo;
|
|
115
103
|
}
|
|
116
104
|
|
|
117
|
-
set grantedTo(value:
|
|
105
|
+
set grantedTo(value: IGrantedTo[]) {
|
|
118
106
|
this.data.grantedTo = value;
|
|
119
107
|
}
|
|
120
108
|
|
|
@@ -141,6 +129,17 @@ export class Permission {
|
|
|
141
129
|
/**
|
|
142
130
|
* Updates permission data on the server.
|
|
143
131
|
*
|
|
132
|
+
* @example <caption>Update file permissions for the the specified project.</caption>
|
|
133
|
+
* const myFile = client.getFile(myFileId);
|
|
134
|
+
* const permissions = await myFile.getPermissions();
|
|
135
|
+
* const projectPermissions = permissions.filter((permission) =>
|
|
136
|
+
* permission.grantedTo.some((x) => x.project?.id === myProjectId)
|
|
137
|
+
* );
|
|
138
|
+
* const newActions = ["read", "readSourceFile", "update"];
|
|
139
|
+
* await Promise.allSettled(
|
|
140
|
+
* projectPermissions.map((permission) => permission.update({ newActions }))
|
|
141
|
+
* );
|
|
142
|
+
*
|
|
144
143
|
* @param data - Raw permission data.
|
|
145
144
|
*/
|
|
146
145
|
async update(data: any): Promise<this> {
|
package/src/Api/Project.ts
CHANGED
|
@@ -22,14 +22,16 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
import { IHttpClient } from "./IHttpClient";
|
|
25
|
-
import {
|
|
25
|
+
import { IShortUserDesc } from "./IUser";
|
|
26
26
|
import { Role } from "./Role";
|
|
27
|
+
import { IRoleActions } from "./IRole";
|
|
27
28
|
import { Member } from "./Member";
|
|
29
|
+
import { File } from "./File";
|
|
28
30
|
import { userFullName, userInitials } from "./Utils";
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
|
-
* Provides properties and methods for obtaining information about a project on the
|
|
32
|
-
* managing its {@link Role | roles}, {@link Member | members} and models.
|
|
33
|
+
* Provides properties and methods for obtaining information about a project on the Open Cloud
|
|
34
|
+
* Server and managing its {@link Role | roles}, {@link Member | members} and models.
|
|
33
35
|
*/
|
|
34
36
|
export class Project {
|
|
35
37
|
private _data: any;
|
|
@@ -37,7 +39,7 @@ export class Project {
|
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
41
|
* @param data - Raw project data received from the server.
|
|
40
|
-
* @param httpClient - HTTP client instance used to send
|
|
42
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server.
|
|
41
43
|
*/
|
|
42
44
|
constructor(data: any, httpClient: IHttpClient) {
|
|
43
45
|
this.httpClient = httpClient;
|
|
@@ -182,17 +184,9 @@ export class Project {
|
|
|
182
184
|
/**
|
|
183
185
|
* Project owner information.
|
|
184
186
|
*
|
|
185
|
-
* @property {string} userId - User ID.
|
|
186
|
-
* @property {string} userName - User name.
|
|
187
|
-
* @property {string} name - First name.
|
|
188
|
-
* @property {string} lastName - Last name.
|
|
189
|
-
* @property {string} fullName - Full name.
|
|
190
|
-
* @property {string} initials - Initials.
|
|
191
|
-
* @property {string} email - User email.
|
|
192
|
-
* @property {string} avatarUrl - User avatar image URL.
|
|
193
187
|
* @readonly
|
|
194
188
|
*/
|
|
195
|
-
get owner():
|
|
189
|
+
get owner(): IShortUserDesc {
|
|
196
190
|
return this.data.owner;
|
|
197
191
|
}
|
|
198
192
|
|
|
@@ -351,10 +345,9 @@ export class Project {
|
|
|
351
345
|
*
|
|
352
346
|
* @param name - Role name.
|
|
353
347
|
* @param description - Role description.
|
|
354
|
-
* @param permissions - Actions are allowed to be performed
|
|
355
|
-
* more details.
|
|
348
|
+
* @param permissions - Actions are allowed to be performed for the role.
|
|
356
349
|
*/
|
|
357
|
-
createRole(name: string, description: string, permissions:
|
|
350
|
+
createRole(name: string, description: string, permissions: IRoleActions): Promise<Role> {
|
|
358
351
|
return this.internalPost("/roles", {
|
|
359
352
|
name,
|
|
360
353
|
description,
|
|
@@ -395,10 +388,10 @@ export class Project {
|
|
|
395
388
|
}
|
|
396
389
|
|
|
397
390
|
/**
|
|
398
|
-
*
|
|
391
|
+
* Adds a user to the project to become a member and have permission to perform actions.
|
|
399
392
|
*
|
|
400
393
|
* @param userId - User ID.
|
|
401
|
-
* @param role - Role name from the list of project roles.
|
|
394
|
+
* @param role - Role name from the list of project {@link getRoles | roles}.
|
|
402
395
|
*/
|
|
403
396
|
addMember(userId: string, role: string): Promise<Member> {
|
|
404
397
|
return this.internalPost("/members", { userId, role })
|
|
@@ -407,7 +400,7 @@ export class Project {
|
|
|
407
400
|
}
|
|
408
401
|
|
|
409
402
|
/**
|
|
410
|
-
*
|
|
403
|
+
* Removes the specified member from a project.
|
|
411
404
|
*
|
|
412
405
|
* @param memberId - Member ID.
|
|
413
406
|
* @returns Returns the raw data of a deleted member.
|
|
@@ -430,8 +423,11 @@ export class Project {
|
|
|
430
423
|
*/
|
|
431
424
|
|
|
432
425
|
/**
|
|
433
|
-
* Returns a list of project files.
|
|
434
|
-
*
|
|
426
|
+
* Returns a list of project files.
|
|
427
|
+
*
|
|
428
|
+
* This list contains all files that the project has access to. To add a file to this list,
|
|
429
|
+
* create a {@link IGrantedTo.project | project} permission on the file using
|
|
430
|
+
* {@link File.createPermission | File.createPermission()}.
|
|
435
431
|
*/
|
|
436
432
|
getFilesInformation(): Promise<any[]> {
|
|
437
433
|
return this.httpClient
|
|
@@ -485,4 +481,70 @@ export class Project {
|
|
|
485
481
|
return items;
|
|
486
482
|
});
|
|
487
483
|
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Returns a list of project models.
|
|
487
|
+
*/
|
|
488
|
+
getModels(): Promise<File[]> {
|
|
489
|
+
return this.getFilesInformation()
|
|
490
|
+
.then((filesInformation) => filesInformation.map((item) => item.file.reference))
|
|
491
|
+
.then((ids) => {
|
|
492
|
+
const searchParams = new URLSearchParams();
|
|
493
|
+
searchParams.set("id", ids.join("|"));
|
|
494
|
+
return this.httpClient.get(`/files?${searchParams.toString()}`);
|
|
495
|
+
})
|
|
496
|
+
.then((response) => response.json())
|
|
497
|
+
.then((files) => files.result.map((data) => new File(data, this.httpClient)));
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Adds a file to the project with specified permissions.
|
|
502
|
+
*
|
|
503
|
+
* To change file permissions for the project use {@link Permission.update | Permissions.update()}.
|
|
504
|
+
*
|
|
505
|
+
* @param fileId - File ID.
|
|
506
|
+
* @param actions - Actions are allowed to be performed on a file:
|
|
507
|
+
*
|
|
508
|
+
* - `read` - The ability to read file description, geometry data and properties.
|
|
509
|
+
* - `readSourceFile` - The ability to read source file.
|
|
510
|
+
* - `write` - The ability to modify file name, description and references.
|
|
511
|
+
* - `readViewpoint` - The ability to read file viewpoints.
|
|
512
|
+
* - `createViewpoint` - The ability to create file viewpoints.
|
|
513
|
+
*
|
|
514
|
+
* @param _public - Specifies whether all users have access to the file or not.
|
|
515
|
+
* @returns Returns a file instance added to the project.
|
|
516
|
+
*/
|
|
517
|
+
async addModel(fileId: string, actions: string | string[], _public: boolean): Promise<File> {
|
|
518
|
+
const file = await this.httpClient
|
|
519
|
+
.get(`/files/${fileId}`)
|
|
520
|
+
.then((response) => response.json())
|
|
521
|
+
.then((data) => new File(data, this.httpClient));
|
|
522
|
+
|
|
523
|
+
const grantedTo = [{ project: { id: this.id, name: this.name } }];
|
|
524
|
+
await file.createPermission(actions, grantedTo, _public);
|
|
525
|
+
|
|
526
|
+
return file;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Removes the specified file from a project.
|
|
531
|
+
*
|
|
532
|
+
* @param fileId - File ID.
|
|
533
|
+
* @returns Returns a file instance removed from the project.
|
|
534
|
+
*/
|
|
535
|
+
async removeModel(fileId: string): Promise<File> {
|
|
536
|
+
const file = await this.httpClient
|
|
537
|
+
.get(`/files/${fileId}`)
|
|
538
|
+
.then((response) => response.json())
|
|
539
|
+
.then((data) => new File(data, this.httpClient));
|
|
540
|
+
|
|
541
|
+
const permissions = await file.getPermissions();
|
|
542
|
+
await Promise.allSettled(
|
|
543
|
+
permissions
|
|
544
|
+
.filter((permission) => permission.grantedTo.some((x) => x.project?.id === this.id))
|
|
545
|
+
.map((permission) => permission.delete())
|
|
546
|
+
);
|
|
547
|
+
|
|
548
|
+
return file;
|
|
549
|
+
}
|
|
488
550
|
}
|
package/src/Api/Role.ts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
import { IHttpClient } from "./IHttpClient";
|
|
25
|
+
import { IRoleActions } from "./IRole";
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* A role determines what actions allowed to be performed by {@link User | users} on a
|
|
@@ -35,7 +36,7 @@ export class Role {
|
|
|
35
36
|
/**
|
|
36
37
|
* @param data - Raw role data received from the server.
|
|
37
38
|
* @param projectId - Owner project ID.
|
|
38
|
-
* @param httpClient - HTTP client instance used to send
|
|
39
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server.
|
|
39
40
|
*/
|
|
40
41
|
constructor(data: any, projectId: string, httpClient: IHttpClient) {
|
|
41
42
|
this.httpClient = httpClient;
|
|
@@ -92,26 +93,12 @@ export class Role {
|
|
|
92
93
|
|
|
93
94
|
/**
|
|
94
95
|
* Role actions are allowed to be performed.
|
|
95
|
-
*
|
|
96
|
-
* @property {string[]} projectActions - Actions are allowed to be performed at the project
|
|
97
|
-
* level: `update`, `createTopic`, `createDocument`.
|
|
98
|
-
* @property {string[]} topicActions - Actions are allowed to be performed at the topic
|
|
99
|
-
* level: `update`, `updateBimSnippet`, `updateRelatedTopics`, `updateDocumentReferences`,
|
|
100
|
-
* `updateFiles`, `createComment`, `createViewpoint`, `delete`.
|
|
101
|
-
* @property {string[]} commentActions - Actions are allowed to be performed at the comment
|
|
102
|
-
* level: `update`, `delete`.
|
|
103
|
-
* @property {string[]} viewpointActions - Actions are allowed to be performed at the
|
|
104
|
-
* viewpoint level: `delete`.
|
|
105
|
-
* @property {string[]} odaGroupActions - Actions are allowed to be performed at the members
|
|
106
|
-
* level: `update`, `delete`.
|
|
107
|
-
* @property {string[]} odaRoleActions - Actions are allowed to be performed at the roles
|
|
108
|
-
* level: `update`, `delete`.
|
|
109
96
|
*/
|
|
110
|
-
get permissions():
|
|
97
|
+
get permissions(): IRoleActions {
|
|
111
98
|
return this.data.permissions;
|
|
112
99
|
}
|
|
113
100
|
|
|
114
|
-
set permissions(value:
|
|
101
|
+
set permissions(value: IRoleActions) {
|
|
115
102
|
this.data.permissions = value || {};
|
|
116
103
|
}
|
|
117
104
|
|
package/src/Api/User.ts
CHANGED
|
@@ -26,7 +26,8 @@ import { FetchError } from "./FetchError";
|
|
|
26
26
|
import { userFullName, userInitials } from "./Utils";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Provides properties and methods for obtaining information about a
|
|
29
|
+
* Provides properties and methods for obtaining information about a Open Cloud Server user and
|
|
30
|
+
* manage its data.
|
|
30
31
|
*/
|
|
31
32
|
export class User {
|
|
32
33
|
private _data: any;
|
|
@@ -34,7 +35,7 @@ export class User {
|
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* @param data - Raw user data received from the server.
|
|
37
|
-
* @param httpClient - HTTP client instance used to send
|
|
38
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server.
|
|
38
39
|
*/
|
|
39
40
|
constructor(data: any, httpClient: IHttpClient) {
|
|
40
41
|
this.httpClient = httpClient;
|
package/src/index.ts
CHANGED
|
@@ -28,7 +28,11 @@ export * from "./Api/ClientEvents";
|
|
|
28
28
|
export { File } from "./Api/File";
|
|
29
29
|
export { FetchError, statusText } from "./Api/FetchError";
|
|
30
30
|
export { Job } from "./Api/Job";
|
|
31
|
+
export { IHttpClient } from "./Api/IHttpClient";
|
|
31
32
|
export { IModelTransformMatrix } from "./Api/IAssembly";
|
|
33
|
+
export { IFileDataStatus, IFileReference, IFileReferences, IFileStatus, IGrantedTo } from "./Api/IFile";
|
|
34
|
+
export { IRoleActions } from "./Api/IRole";
|
|
35
|
+
export { IShortUserDesc } from "./Api/IUser";
|
|
32
36
|
export { Member } from "./Api/Member";
|
|
33
37
|
export { Model } from "./Api/Model";
|
|
34
38
|
export { Permission } from "./Api/Permission";
|