@inweb/client 25.9.2 → 25.9.4
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 +46 -105
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +3 -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/File.d.ts +19 -25
- package/lib/Api/HttpClient.d.ts +1 -1
- package/lib/Api/IFile.d.ts +31 -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 +5 -16
- package/lib/Api/Project.d.ts +14 -19
- 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/File.ts +19 -25
- package/src/Api/HttpClient.ts +1 -1
- package/src/Api/IFile.ts +35 -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 +5 -17
- package/src/Api/Project.ts +14 -19
- package/src/Api/Role.ts +4 -17
- package/src/Api/User.ts +3 -2
- package/src/index.ts +4 -0
package/lib/Api/User.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { IHttpClient } from "./IHttpClient";
|
|
2
2
|
/**
|
|
3
|
-
* Provides properties and methods for obtaining information about a
|
|
3
|
+
* Provides properties and methods for obtaining information about a Open Cloud Server user and
|
|
4
|
+
* manage its data.
|
|
4
5
|
*/
|
|
5
6
|
export declare class User {
|
|
6
7
|
private _data;
|
|
7
8
|
httpClient: IHttpClient;
|
|
8
9
|
/**
|
|
9
10
|
* @param data - Raw user data received from the server.
|
|
10
|
-
* @param httpClient - HTTP client instance used to send
|
|
11
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server.
|
|
11
12
|
*/
|
|
12
13
|
constructor(data: any, httpClient: IHttpClient);
|
|
13
14
|
/**
|
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,11 @@ export * from "./Api/ClientEvents";
|
|
|
5
5
|
export { File } from "./Api/File";
|
|
6
6
|
export { FetchError, statusText } from "./Api/FetchError";
|
|
7
7
|
export { Job } from "./Api/Job";
|
|
8
|
+
export { IHttpClient } from "./Api/IHttpClient";
|
|
8
9
|
export { IModelTransformMatrix } from "./Api/IAssembly";
|
|
10
|
+
export { IGrantedTo } from "./Api/IFile";
|
|
11
|
+
export { IRoleActions } from "./Api/IRole";
|
|
12
|
+
export { IShortUserDesc } from "./Api/IUser";
|
|
9
13
|
export { Member } from "./Api/Member";
|
|
10
14
|
export { Model } from "./Api/Model";
|
|
11
15
|
export { Permission } from "./Api/Permission";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/client",
|
|
3
|
-
"version": "25.9.
|
|
3
|
+
"version": "25.9.4",
|
|
4
4
|
"description": "JavaScript REST API client for the Open Cloud Server",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"docs": "typedoc"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@inweb/eventemitter2": "~25.9.
|
|
29
|
+
"@inweb/eventemitter2": "~25.9.4"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/Api/Assembly.ts
CHANGED
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
import { IHttpClient } from "./IHttpClient";
|
|
25
25
|
import { FetchError } from "./FetchError";
|
|
26
26
|
import { IAssociatedFileData, IAssemblyVersionInfo, IModelTransformMatrix } from "./IAssembly";
|
|
27
|
-
import {
|
|
27
|
+
import { IShortUserDesc } from "./IUser";
|
|
28
28
|
import { Model } from "./Model";
|
|
29
29
|
import { ClashTest } from "./ClashTest";
|
|
30
30
|
import { waitFor, userFullName, userInitials } from "./Utils";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Provides properties and methods for obtaining information about an assembly on the
|
|
34
|
-
* and managing its data.
|
|
33
|
+
* Provides properties and methods for obtaining information about an assembly on the Open
|
|
34
|
+
* Cloud Server and managing its data.
|
|
35
35
|
*/
|
|
36
36
|
export class Assembly {
|
|
37
37
|
private _data: any;
|
|
@@ -41,7 +41,7 @@ export class Assembly {
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @param data - Raw assembly data received from the server.
|
|
44
|
-
* @param httpClient - HTTP client instance used to send
|
|
44
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server..
|
|
45
45
|
*/
|
|
46
46
|
constructor(data: any, httpClient: IHttpClient) {
|
|
47
47
|
this.path = `/assemblies/${data.id}`;
|
|
@@ -168,17 +168,9 @@ export class Assembly {
|
|
|
168
168
|
/**
|
|
169
169
|
* Assembly owner information.
|
|
170
170
|
*
|
|
171
|
-
* @property {string} userId - User ID.
|
|
172
|
-
* @property {string} userName - User name.
|
|
173
|
-
* @property {string} name - First name.
|
|
174
|
-
* @property {string} lastName - Last name.
|
|
175
|
-
* @property {string} fullName - Full name.
|
|
176
|
-
* @property {string} initials - Initials.
|
|
177
|
-
* @property {string} email - User email.
|
|
178
|
-
* @property {string} avatarUrl - User avatar image URL.
|
|
179
171
|
* @readonly
|
|
180
172
|
*/
|
|
181
|
-
get owner():
|
|
173
|
+
get owner(): IShortUserDesc {
|
|
182
174
|
return this.data.owner;
|
|
183
175
|
}
|
|
184
176
|
|
package/src/Api/ClashTest.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 { waitFor, userFullName, userInitials } from "./Utils";
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -36,7 +36,7 @@ export class ClashTest {
|
|
|
36
36
|
/**
|
|
37
37
|
* @param data - Raw test data received from the server.
|
|
38
38
|
* @param basePath - The clash test API base path of the file/assembly that owns the test.
|
|
39
|
-
* @param httpClient - HTTP client instance used to send
|
|
39
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server.
|
|
40
40
|
*/
|
|
41
41
|
constructor(data: any, basePath: string, httpClient: IHttpClient) {
|
|
42
42
|
this.httpClient = httpClient;
|
|
@@ -129,17 +129,9 @@ export class ClashTest {
|
|
|
129
129
|
/**
|
|
130
130
|
* Test owner information.
|
|
131
131
|
*
|
|
132
|
-
* @property {string} userId - User ID.
|
|
133
|
-
* @property {string} userName - User name.
|
|
134
|
-
* @property {string} name - First name.
|
|
135
|
-
* @property {string} lastName - Last name.
|
|
136
|
-
* @property {string} fullName - Full name.
|
|
137
|
-
* @property {string} initials - Initials.
|
|
138
|
-
* @property {string} email - User email.
|
|
139
|
-
* @property {string} avatarUrl - User avatar image URL.
|
|
140
132
|
* @readonly
|
|
141
133
|
*/
|
|
142
|
-
get owner():
|
|
134
|
+
get owner(): IShortUserDesc {
|
|
143
135
|
return this.data.owner;
|
|
144
136
|
}
|
|
145
137
|
|
package/src/Api/Client.ts
CHANGED
|
@@ -35,7 +35,8 @@ import { User } from "./User";
|
|
|
35
35
|
import { parseArgs } from "./Utils";
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* Provides methods for managing
|
|
38
|
+
* Provides methods for managing Open Cloud Server resources such as users, files, assemblies,
|
|
39
|
+
* jobs, projects, etc.
|
|
39
40
|
*/
|
|
40
41
|
export class Client extends EventEmitter2<ClientEventMap> {
|
|
41
42
|
private _serverUrl = "";
|
|
@@ -54,7 +55,7 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
|
-
* Open Cloud
|
|
58
|
+
* Open Cloud REST API server base URL. Use {@link configure | configure()} to change server URL.
|
|
58
59
|
*
|
|
59
60
|
* @readonly
|
|
60
61
|
*/
|
|
@@ -63,7 +64,7 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
|
-
* HTTP client instance used to send
|
|
67
|
+
* HTTP client instance used to send requests to the REST API server.
|
|
67
68
|
*
|
|
68
69
|
* @readonly
|
|
69
70
|
*/
|
package/src/Api/File.ts
CHANGED
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
import { IHttpClient } from "./IHttpClient";
|
|
25
|
-
import { IFileStatus, IFileReferences, IFileVersionInfo } from "./IFile";
|
|
26
|
-
import {
|
|
25
|
+
import { IFileStatus, IFileReferences, IFileVersionInfo, IGrantedTo } from "./IFile";
|
|
26
|
+
import { IShortUserDesc } from "./IUser";
|
|
27
27
|
import { Model } from "./Model";
|
|
28
28
|
import { Permission } from "./Permission";
|
|
29
29
|
import { Job } from "./Job";
|
|
30
30
|
import { waitFor, parseArgs, userFullName, userInitials } from "./Utils";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Provides properties and methods for obtaining information about a file on the
|
|
34
|
-
* managing its data and versions.
|
|
33
|
+
* Provides properties and methods for obtaining information about a file on the Open Cloud
|
|
34
|
+
* Server and managing its data and versions.
|
|
35
35
|
*/
|
|
36
36
|
export class File {
|
|
37
37
|
private _data: any;
|
|
@@ -41,7 +41,7 @@ export class File {
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @param data - Raw file data received from the server.
|
|
44
|
-
* @param httpClient - HTTP client instance used to send
|
|
44
|
+
* @param httpClient - HTTP client instance used to send requests to the REST API server.
|
|
45
45
|
*/
|
|
46
46
|
constructor(data: any, httpClient: IHttpClient) {
|
|
47
47
|
this.path = `/files/${data.id}`;
|
|
@@ -217,17 +217,9 @@ export class File {
|
|
|
217
217
|
/**
|
|
218
218
|
* File owner information.
|
|
219
219
|
*
|
|
220
|
-
* @property {string} userId - User ID.
|
|
221
|
-
* @property {string} userName - User name.
|
|
222
|
-
* @property {string} name - First name.
|
|
223
|
-
* @property {string} lastName - Last name.
|
|
224
|
-
* @property {string} fullName - Full name.
|
|
225
|
-
* @property {string} initials - Initials.
|
|
226
|
-
* @property {string} email - User email.
|
|
227
|
-
* @property {string} avatarUrl - User avatar image URL.
|
|
228
220
|
* @readonly
|
|
229
221
|
*/
|
|
230
|
-
get owner():
|
|
222
|
+
get owner(): IShortUserDesc {
|
|
231
223
|
return this.data.owner;
|
|
232
224
|
}
|
|
233
225
|
|
|
@@ -300,17 +292,9 @@ export class File {
|
|
|
300
292
|
/**
|
|
301
293
|
* Information about the user who made the last update.
|
|
302
294
|
*
|
|
303
|
-
* @property {string} userId - User ID.
|
|
304
|
-
* @property {string} userName - User name.
|
|
305
|
-
* @property {string} name - First name.
|
|
306
|
-
* @property {string} lastName - Last name.
|
|
307
|
-
* @property {string} fullName - Full name.
|
|
308
|
-
* @property {string} initials - Initials.
|
|
309
|
-
* @property {string} email - User email.
|
|
310
|
-
* @property {string} avatarUrl - User avatar image URL.
|
|
311
295
|
* @readonly
|
|
312
296
|
*/
|
|
313
|
-
get updatedBy():
|
|
297
|
+
get updatedBy(): IShortUserDesc {
|
|
314
298
|
return this.data.updatedBy;
|
|
315
299
|
}
|
|
316
300
|
|
|
@@ -808,6 +792,16 @@ export class File {
|
|
|
808
792
|
/**
|
|
809
793
|
* Creates a new file permission.
|
|
810
794
|
*
|
|
795
|
+
* @example <caption>Grant the specified user permission to "update" the file.</caption>
|
|
796
|
+
* const action = "update";
|
|
797
|
+
* const grantedTo = [{ user: { id: myUser.id, email: myUser.email } }];
|
|
798
|
+
* await file.createPermission(action, grantedTo);
|
|
799
|
+
*
|
|
800
|
+
* @example <caption>Add a file to the specified project in `read-only` mode.</caption>
|
|
801
|
+
* const actions = ["read", "readSourceFile"];
|
|
802
|
+
* const grantedTo = [{ project: { id: myProject.id, name: myProject.name } }];
|
|
803
|
+
* await file.createPermission(actions, grantedTo);
|
|
804
|
+
*
|
|
811
805
|
* @param actions - Actions are allowed to be performed on a file with this permission:
|
|
812
806
|
*
|
|
813
807
|
* - `read` - The ability to read file description, geometry data and properties.
|
|
@@ -816,10 +810,10 @@ export class File {
|
|
|
816
810
|
* - `readViewpoint` - The ability to read file viewpoints.
|
|
817
811
|
* - `createViewpoint` - The ability to create file viewpoints.
|
|
818
812
|
*
|
|
819
|
-
* @param grantedTo - A list of
|
|
813
|
+
* @param grantedTo - A list of entities that will get access to the file.
|
|
820
814
|
* @param _public - Specifies whether all users have access to the file or not.
|
|
821
815
|
*/
|
|
822
|
-
createPermission(actions: string | string[], grantedTo:
|
|
816
|
+
createPermission(actions: string | string[], grantedTo: IGrantedTo[], _public: boolean): Promise<Permission> {
|
|
823
817
|
return this.internalPost("/permissions", {
|
|
824
818
|
actions: Array.isArray(actions) ? actions : [actions],
|
|
825
819
|
grantedTo,
|
package/src/Api/HttpClient.ts
CHANGED
|
@@ -112,7 +112,7 @@ export class HttpClient implements IHttpClient {
|
|
|
112
112
|
|
|
113
113
|
async downloadFileRange(
|
|
114
114
|
relativePath: string,
|
|
115
|
-
|
|
115
|
+
reserved: number,
|
|
116
116
|
ranges: Array<{ begin: number; end: number; requestId: number }>,
|
|
117
117
|
onProgress?: (progress: number, chunk: Uint8Array, requestId: number) => void,
|
|
118
118
|
signal?: AbortSignal
|
package/src/Api/IFile.ts
CHANGED
|
@@ -72,3 +72,38 @@ export interface IFileVersionInfo {
|
|
|
72
72
|
size: number;
|
|
73
73
|
ownerId: string;
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Defines the entity, that will have access to the file.
|
|
78
|
+
*/
|
|
79
|
+
export interface IGrantedTo {
|
|
80
|
+
/**
|
|
81
|
+
* The user entry that has access to the file.
|
|
82
|
+
*/
|
|
83
|
+
user?: {
|
|
84
|
+
/**
|
|
85
|
+
* User ID.
|
|
86
|
+
*/
|
|
87
|
+
id: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* User email.
|
|
91
|
+
*/
|
|
92
|
+
email: string;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The project entry that has access to the file.
|
|
97
|
+
*/
|
|
98
|
+
project?: {
|
|
99
|
+
/**
|
|
100
|
+
* Project ID.
|
|
101
|
+
*/
|
|
102
|
+
id: string;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Project name.
|
|
106
|
+
*/
|
|
107
|
+
name: string;
|
|
108
|
+
};
|
|
109
|
+
}
|
package/src/Api/IHttpClient.ts
CHANGED
|
@@ -21,35 +21,119 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Defines the HTTP client used to send requests to the REST API server.
|
|
26
|
+
*/
|
|
24
27
|
export interface IHttpClient {
|
|
28
|
+
/**
|
|
29
|
+
* REST API server base URL.
|
|
30
|
+
*/
|
|
25
31
|
serverUrl: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Request HTTP headers. You can add specific headers after user log in.
|
|
35
|
+
*
|
|
36
|
+
* The following headers are added automatically:
|
|
37
|
+
*
|
|
38
|
+
* - `Authorization`- Added after user log in.
|
|
39
|
+
* - `Content-Type` - Added before sending `POST` and `PUT` request according the request body.
|
|
40
|
+
*/
|
|
26
41
|
headers: HeadersInit;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Current logged in user ID.
|
|
45
|
+
*/
|
|
27
46
|
signInUserId: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* `True` if the current logged in user is and administrator.
|
|
50
|
+
*/
|
|
28
51
|
signInUserIsAdmin: boolean;
|
|
29
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Sends the GET request to the specified endpoint.
|
|
55
|
+
*
|
|
56
|
+
* @param relativePath - Endpoint relative path.
|
|
57
|
+
* @param signal - An
|
|
58
|
+
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
|
|
59
|
+
* signal, which can be used to abort waiting as desired.
|
|
60
|
+
*/
|
|
30
61
|
get(relativePath: string, signal?: AbortSignal): Promise<Response>;
|
|
31
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Sends the POST request to the specified endpoint.
|
|
65
|
+
*
|
|
66
|
+
* @param relativePath - Endpoint relative path.
|
|
67
|
+
* @param body - Request body. Can be
|
|
68
|
+
* {@link https://developer.mozilla.org/docs/Web/API/FormData | FormData},
|
|
69
|
+
* {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
|
|
70
|
+
* {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob}, JSON object or plain text.
|
|
71
|
+
*/
|
|
32
72
|
post(relativePath: string, body?: BodyInit | object): Promise<Response>;
|
|
33
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Sends the PUT request to the specified endpoint.
|
|
76
|
+
*
|
|
77
|
+
* @param relativePath - Endpoint relative path.
|
|
78
|
+
* @param body - Request body. Can be
|
|
79
|
+
* {@link https://developer.mozilla.org/docs/Web/API/FormData | FormData},
|
|
80
|
+
* {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
|
|
81
|
+
* {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob}, JSON object or plain text.
|
|
82
|
+
*/
|
|
34
83
|
put(relativePath: string, body?: BodyInit | object): Promise<Response>;
|
|
35
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Sends the DELETE request to the specified endpoint.
|
|
87
|
+
*
|
|
88
|
+
* @param relativePath - Endpoint relative path.
|
|
89
|
+
*/
|
|
36
90
|
delete(relativePath: string): Promise<Response>;
|
|
37
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Upload a file to the server.
|
|
94
|
+
*
|
|
95
|
+
* @param relativePath - File relative path.
|
|
96
|
+
* @param file - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object
|
|
97
|
+
* are generally retrieved from a
|
|
98
|
+
* {@link https://developer.mozilla.org/docs/Web/API/FileList | FileList} object returned as
|
|
99
|
+
* a result of a user selecting files using the HTML `<input>` element.
|
|
100
|
+
* @param onProgress - Upload progress callback.
|
|
101
|
+
*/
|
|
38
102
|
uploadFile(
|
|
39
103
|
relativePath: string,
|
|
40
104
|
file: globalThis.File,
|
|
41
105
|
onProgress?: (progress: number) => void
|
|
42
106
|
): Promise<XMLHttpRequest>;
|
|
43
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Downloads the specified file from the server.
|
|
110
|
+
*
|
|
111
|
+
* @param relativePath - File relative path.
|
|
112
|
+
* @param onProgress - Download progress callback.
|
|
113
|
+
* @param signal - An
|
|
114
|
+
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
|
|
115
|
+
* signal. Allows to communicate with a fetch request and abort it if desired.
|
|
116
|
+
*/
|
|
44
117
|
downloadFile(
|
|
45
118
|
relativePath: string,
|
|
46
119
|
onProgress?: (progress: number, chunk: Uint8Array) => void,
|
|
47
120
|
signal?: AbortSignal
|
|
48
121
|
): Promise<Response>;
|
|
49
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Downloads a part of file from the server.
|
|
125
|
+
*
|
|
126
|
+
* @param relativePath - File relative path.
|
|
127
|
+
* @param reserved - Reserved, do not use.
|
|
128
|
+
* @param ranges - A range of resource file contents to download.
|
|
129
|
+
* @param onProgress - Download progress callback.
|
|
130
|
+
* @param signal - An
|
|
131
|
+
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
|
|
132
|
+
* signal. Allows to communicate with a fetch request and abort it if desired.
|
|
133
|
+
*/
|
|
50
134
|
downloadFileRange(
|
|
51
135
|
relativePath: string,
|
|
52
|
-
|
|
136
|
+
reserved: number,
|
|
53
137
|
ranges: Array<{ begin: number; end: number; requestId: number }>,
|
|
54
138
|
onProgress?: (progress: number, chunk: Uint8Array, requestId: number) => void,
|
|
55
139
|
signal?: AbortSignal
|
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
|
|