@inweb/client 25.8.16 → 25.8.19

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/src/Api/Model.ts CHANGED
@@ -24,9 +24,10 @@
24
24
  import { IHttpClient } from "./IHttpClient";
25
25
  import type { File } from "./File";
26
26
  import type { Assembly } from "./Assembly";
27
+ import type { IModelTransformMatrix } from "./IAssembly";
27
28
 
28
29
  /**
29
- * The class representing the is a description of view of the file or assembly. For example,
30
+ * Provides properties and methods for working with view of the file or assembly. For example,
30
31
  * for `dwg` it is a `Model` space or layout, and for `rvt` files it is a `3D` view.
31
32
  */
32
33
  export class Model {
@@ -36,8 +37,8 @@ export class Model {
36
37
  public path: string;
37
38
 
38
39
  /**
39
- * @param data - An object that implements model data storage.
40
- * @param file - The `File` of 'Assembly' instance that owns the model.
40
+ * @param data - Raw model data received from the server.
41
+ * @param file - The file/assembly instance that owns the model.
41
42
  */
42
43
  constructor(data: any, file: File | Assembly) {
43
44
  this.path = `${file.path}/downloads`;
@@ -160,22 +161,22 @@ export class Model {
160
161
  *
161
162
  * @param handle - Model handle.
162
163
  */
163
- getModelTransformMatrix(handle: string): any {
164
+ getModelTransformMatrix(handle: string): IModelTransformMatrix {
164
165
  return this.file.getModelTransformMatrix(handle);
165
166
  }
166
167
 
167
168
  /**
168
- * Set or delete a model transformation.
169
+ * Sets or removes a model transformation.
169
170
  *
170
171
  * @param handle - Model handle.
171
- * @param transform - Transformation matrix. To delete transformation provide this to `undefined`.
172
+ * @param transform - Transformation matrix. Specify `undefined` to remove transformation.
172
173
  */
173
- setModelTransformMatrix(handle: string, transform: any): Promise<this> {
174
+ setModelTransformMatrix(handle: string, transform: IModelTransformMatrix): Promise<this> {
174
175
  return this.file.setModelTransformMatrix(handle, transform).then(() => this);
175
176
  }
176
177
 
177
178
  /**
178
- * Returns model viewpoint list.
179
+ * Returns a list of viewpoints of the owner file/assembly.
179
180
  */
180
181
  getViewpoints(): Promise<any[]> {
181
182
  return this._file
@@ -188,7 +189,8 @@ export class Model {
188
189
  }
189
190
 
190
191
  /**
191
- * Add new model viewpoint. To create a new viewpoint use `Viewer.createViewpoint()`.
192
+ * Adds a new viewpoint to the owner file/assembly. To create a new viewpoint use
193
+ * `Viewer.createViewpoint()`.
192
194
  *
193
195
  * @param viewpoint - Viewpoint.
194
196
  */
@@ -200,7 +202,7 @@ export class Model {
200
202
  }
201
203
 
202
204
  /**
203
- * Delete model viewpoint.
205
+ * Deletes the specified viewpoint from the owner file/assembly.
204
206
  *
205
207
  * @param guid - Viewpoint GUID.
206
208
  * @returns Returns the raw data of a deleted viewpoint.
@@ -220,7 +222,7 @@ export class Model {
220
222
  }
221
223
 
222
224
  /**
223
- * Returns snapshot data.
225
+ * Returns viewpoint snapshot data.
224
226
  *
225
227
  * @param guid - Viewpoint GUID.
226
228
  * @param bitmapGuid - Bitmap GUID.
@@ -230,8 +232,8 @@ export class Model {
230
232
  }
231
233
 
232
234
  /**
233
- * Download model resource file. Resource files are files that contain model scene
234
- * descriptions, or geometry data.
235
+ * Downloads a resource file. Resource files are files that contain model scene descriptions,
236
+ * or geometry data.
235
237
  *
236
238
  * @param dataId - Resource file name.
237
239
  * @param onProgress - Download progress callback.
@@ -248,7 +250,7 @@ export class Model {
248
250
  }
249
251
 
250
252
  /**
251
- * Download a part of model resource file. Resource files are files that contain model scene
253
+ * Downloads a part of resource file. Resource files are files that contain model scene
252
254
  * descriptions, or geometry data.
253
255
  *
254
256
  * @param dataId - Resource file name.
@@ -318,7 +320,9 @@ export class Model {
318
320
  }
319
321
 
320
322
  /**
321
- * Returns a list of references to files used to extract geometry data.
323
+ * Returns a list of references of the owner file/assembly.
324
+ *
325
+ * References are images, fonts, or any other files to correct rendering of the file.
322
326
  *
323
327
  * @param signal - An
324
328
  * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
@@ -24,8 +24,8 @@
24
24
  import { IHttpClient } from "./IHttpClient";
25
25
 
26
26
  /**
27
- * A permission provides information about {@link File | file} sharing granted to a specific
28
- * {@link User | users}, group, or project {@link Member | member}.
27
+ * Provides properties and methods for obtaining information about {@link File | file} actions
28
+ * granted to a specific {@link User | users}, or project {@link Member | member}.
29
29
  */
30
30
  export class Permission {
31
31
  private _data: any;
@@ -33,9 +33,9 @@ export class Permission {
33
33
  public httpClient: IHttpClient;
34
34
 
35
35
  /**
36
- * @param data - An object that implements permission data storage.
36
+ * @param data - Raw permission data received from the server.
37
37
  * @param fileId - Owner file ID.
38
- * @param httpClient - Http client.
38
+ * @param httpClient - HTTP client instance used to send REST API requests to the server.
39
39
  */
40
40
  constructor(data: any, fileId: string, httpClient: IHttpClient) {
41
41
  this.httpClient = httpClient;
@@ -58,11 +58,11 @@ export class Permission {
58
58
  /**
59
59
  * Defines what actions are allowed to be performed on a file with this permission:
60
60
  *
61
- * - `read` - The ability to read file description, geometry data and properties
62
- * - `readSourceFile` - The ability to read source file
63
- * - `write` - The ability to modify file name, description and references
64
- * - `readViewpoint` - The ability to read file viewpoints
65
- * - `createViewpoint` - The ability to create file viewpoints
61
+ * - `read` - The ability to read file description, geometry data and properties.
62
+ * - `readSourceFile` - The ability to read source file.
63
+ * - `write` - The ability to modify file name, description and references.
64
+ * - `readViewpoint` - The ability to read file viewpoints.
65
+ * - `createViewpoint` - The ability to create file viewpoints.
66
66
  */
67
67
  get actions(): string[] {
68
68
  return this.data.actions;
@@ -108,7 +108,7 @@ export class Permission {
108
108
  */
109
109
 
110
110
  /**
111
- * A collection of principials that will get access to the file.
111
+ * A list of principials that will get access to the file.
112
112
  */
113
113
  get grantedTo(): any[] {
114
114
  return this.data.grantedTo;
@@ -130,7 +130,7 @@ export class Permission {
130
130
  }
131
131
 
132
132
  /**
133
- * Refresh permission data.
133
+ * Reloads permission data from the server.
134
134
  */
135
135
  async checkout(): Promise<this> {
136
136
  const response = await this.internalGet();
@@ -139,7 +139,7 @@ export class Permission {
139
139
  }
140
140
 
141
141
  /**
142
- * Update permission data on the server.
142
+ * Updates permission data on the server.
143
143
  *
144
144
  * @param data - Raw permission data.
145
145
  */
@@ -150,7 +150,7 @@ export class Permission {
150
150
  }
151
151
 
152
152
  /**
153
- * Remove a permission from a file.
153
+ * Removes a permission from the file.
154
154
  *
155
155
  * @returns Returns the raw data of a deleted permission.
156
156
  */
@@ -159,8 +159,8 @@ export class Permission {
159
159
  }
160
160
 
161
161
  /**
162
- * Save permission data changes to the server. Call this method to update permission data on
163
- * the server after any changes.
162
+ * Saves permission properties changes to the server. Call this method to update permission
163
+ * data on the server after any property changes.
164
164
  */
165
165
  save(): Promise<this> {
166
166
  return this.update(this.data);
@@ -28,15 +28,16 @@ import { Member } from "./Member";
28
28
  import { userFullName, userInitials } from "./Utils";
29
29
 
30
30
  /**
31
- * Projects are used to collaborate on models and track issues.
31
+ * Provides properties and methods for obtaining information about a project on the server and
32
+ * managing its {@link Role | roles}, {@link Member | members} and models.
32
33
  */
33
34
  export class Project {
34
35
  private _data: any;
35
36
  public httpClient: IHttpClient;
36
37
 
37
38
  /**
38
- * @param data - An object that implements project data storage.
39
- * @param httpClient - Http client.
39
+ * @param data - Raw project data received from the server.
40
+ * @param httpClient - HTTP client instance used to send REST API requests to the server.
40
41
  */
41
42
  constructor(data: any, httpClient: IHttpClient) {
42
43
  this.httpClient = httpClient;
@@ -62,11 +63,18 @@ export class Project {
62
63
  /**
63
64
  * Project features the user has access to.
64
65
  *
65
- * @property {string[]} project_actions - Actions are allowed to be performed: `update`,
66
- * `createTopic`, `createDocument`.
67
66
  * @readonly
68
67
  */
69
- get authorization(): any {
68
+ get authorization(): {
69
+ /**
70
+ * Actions are allowed to be performed:
71
+ *
72
+ * - `update` - The ability to update the project details.
73
+ * - `createTopic` - The ability to create a new topic.
74
+ * - `createDocument` - The ability to create a new document.
75
+ */
76
+ project_actions: string[];
77
+ } {
70
78
  return this.data.authorization;
71
79
  }
72
80
 
@@ -199,7 +207,7 @@ export class Project {
199
207
  }
200
208
 
201
209
  /**
202
- * `true` if project is public (shared) project.
210
+ * `true` if project is shared project.
203
211
  */
204
212
  get public(): boolean {
205
213
  return this.data.public;
@@ -241,7 +249,7 @@ export class Project {
241
249
  }
242
250
 
243
251
  /**
244
- * Refresh project data.
252
+ * Reloads project data from the server.
245
253
  */
246
254
  async checkout(): Promise<this> {
247
255
  const response = await this.internalGet("");
@@ -250,7 +258,7 @@ export class Project {
250
258
  }
251
259
 
252
260
  /**
253
- * Update project data on the server.
261
+ * Updates project data on the server.
254
262
  *
255
263
  * @param data - Raw project data.
256
264
  */
@@ -261,7 +269,7 @@ export class Project {
261
269
  }
262
270
 
263
271
  /**
264
- * Delete the project from the server.
272
+ * Deletes a project from the server.
265
273
  *
266
274
  * @returns Returns the raw data of a deleted project.
267
275
  */
@@ -279,23 +287,23 @@ export class Project {
279
287
  }
280
288
 
281
289
  /**
282
- * Save project data changes to the server. Call this method to update project data on the
283
- * server after any changes.
290
+ * Saves project properties changes to the server. Call this method to update project data on
291
+ * the server after any property changes.
284
292
  */
285
293
  save(): Promise<this> {
286
294
  return this.update(this.data);
287
295
  }
288
296
 
289
297
  /**
290
- * Set or remove the project preview.
298
+ * Sets or removes the project preview.
291
299
  *
292
300
  * @param image - Preview image. Can be a
293
301
  * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}
294
302
  * string,
295
303
  * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
296
- * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or Web API
297
- * {@link https://developer.mozilla.org/docs/Web/API/File | File} object. Setting the
298
- * `image` to `null` will remove the preview.
304
+ * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or
305
+ * {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object. Setting
306
+ * the `image` to `null` will remove the preview.
299
307
  */
300
308
 
301
309
  async setPreview(image?: BodyInit | null): Promise<any> {
@@ -309,7 +317,7 @@ export class Project {
309
317
  }
310
318
 
311
319
  /**
312
- * Remove the project preview.
320
+ * Removes the project preview.
313
321
  */
314
322
  async deletePreview(): Promise<this> {
315
323
  const response = await this.internalDelete("/preview");
@@ -328,7 +336,7 @@ export class Project {
328
336
  }
329
337
 
330
338
  /**
331
- * Returns the role information.
339
+ * Returns information about the specified project role.
332
340
  *
333
341
  * @param name - Role name.
334
342
  */
@@ -339,7 +347,7 @@ export class Project {
339
347
  }
340
348
 
341
349
  /**
342
- * Create a new project role.
350
+ * Creates a new project role.
343
351
  *
344
352
  * @param name - Role name.
345
353
  * @param description - Role description.
@@ -357,7 +365,7 @@ export class Project {
357
365
  }
358
366
 
359
367
  /**
360
- * Delete project role.
368
+ * Deletes the specified project role.
361
369
  *
362
370
  * @param name - Role name.
363
371
  * @returns Returns the raw data of a deleted role.
@@ -376,7 +384,7 @@ export class Project {
376
384
  }
377
385
 
378
386
  /**
379
- * Returns the member information.
387
+ * Returns information about the specified project member.
380
388
  *
381
389
  * @param memberId - Member ID.
382
390
  */
@@ -390,7 +398,7 @@ export class Project {
390
398
  * Add a user to the project to become a member and have permission to perform actions.
391
399
  *
392
400
  * @param userId - User ID.
393
- * @param role - User role from the list of project roles.
401
+ * @param role - Role name from the list of project roles.
394
402
  */
395
403
  addMember(userId: string, role: string): Promise<Member> {
396
404
  return this.internalPost("/members", { userId, role })
@@ -399,7 +407,7 @@ export class Project {
399
407
  }
400
408
 
401
409
  /**
402
- * Remove a member from a project.
410
+ * Remove the specified member from a project.
403
411
  *
404
412
  * @param memberId - Member ID.
405
413
  * @returns Returns the raw data of a deleted member.
package/src/Api/Role.ts CHANGED
@@ -24,7 +24,8 @@
24
24
  import { IHttpClient } from "./IHttpClient";
25
25
 
26
26
  /**
27
- * A roles determines what permissions {@link User | users} have on a {@link Project | project}.
27
+ * A role determines what actions allowed to be performed by {@link User | users} on a
28
+ * {@link Project | project}.
28
29
  */
29
30
  export class Role {
30
31
  private _data: any;
@@ -32,9 +33,9 @@ export class Role {
32
33
  public httpClient: IHttpClient;
33
34
 
34
35
  /**
35
- * @param data - An object that implements role data storage.
36
+ * @param data - Raw role data received from the server.
36
37
  * @param projectId - Owner project ID.
37
- * @param httpClient - Http client.
38
+ * @param httpClient - HTTP client instance used to send REST API requests to the server.
38
39
  */
39
40
  constructor(data: any, projectId: string, httpClient: IHttpClient) {
40
41
  this.httpClient = httpClient;
@@ -115,7 +116,7 @@ export class Role {
115
116
  }
116
117
 
117
118
  /**
118
- * Refresh role data.
119
+ * Reloads role data from the server.
119
120
  */
120
121
  async checkout(): Promise<this> {
121
122
  const response = await this.internalGet();
@@ -124,7 +125,7 @@ export class Role {
124
125
  }
125
126
 
126
127
  /**
127
- * Update role data on the server.
128
+ * Updates role data on the server.
128
129
  *
129
130
  * @param data - Raw role data.
130
131
  */
@@ -135,7 +136,7 @@ export class Role {
135
136
  }
136
137
 
137
138
  /**
138
- * Delete a role from the project.
139
+ * Deletes a role from the project.
139
140
  *
140
141
  * @returns Returns the raw data of a deleted role.
141
142
  */
@@ -144,8 +145,8 @@ export class Role {
144
145
  }
145
146
 
146
147
  /**
147
- * Save role data changes to the server. Call this method to update role data on the server
148
- * after any changes.
148
+ * Saves role properties changes to the server. Call this method to update role data on the
149
+ * server after any property changes.
149
150
  */
150
151
  save(): Promise<this> {
151
152
  return this.update(this.data);
package/src/Api/User.ts CHANGED
@@ -26,15 +26,15 @@ import { FetchError } from "./FetchError";
26
26
  import { userFullName, userInitials } from "./Utils";
27
27
 
28
28
  /**
29
- * The class representing a `user` entity.
29
+ * Provides properties and methods for obtaining information about a server user and manage its data.
30
30
  */
31
31
  export class User {
32
32
  private _data: any;
33
33
  public httpClient: IHttpClient;
34
34
 
35
35
  /**
36
- * @param data - An object that implements user data storage.
37
- * @param httpClient - Http client.
36
+ * @param data - Raw user data received from the server.
37
+ * @param httpClient - HTTP client instance used to send REST API requests to the server.
38
38
  */
39
39
  constructor(data: any, httpClient: IHttpClient) {
40
40
  this.httpClient = httpClient;
@@ -52,7 +52,7 @@ export class User {
52
52
  }
53
53
 
54
54
  /**
55
- * `true` if user is allowed to create a project.
55
+ * `true` if user is allowed to create a projects.
56
56
  *
57
57
  * Only administrators can change create project permission.
58
58
  */
@@ -227,7 +227,8 @@ export class User {
227
227
  }
228
228
 
229
229
  /**
230
- * The identity provider used to create the account. Can be `ldap`, `oauth`, `saml` or empty.
230
+ * The identity provider used to create the account. Can be `ldap`, `oauth`, `saml` or empty
231
+ * for local accounts.
231
232
  *
232
233
  * @readonly
233
234
  */
@@ -258,8 +259,8 @@ export class User {
258
259
  }
259
260
 
260
261
  /**
261
- * The user's access token (API key). Use {@link signInWithToken | Client.signInWithToken()}
262
- * to log in using token.
262
+ * The user's access token (API key). Use
263
+ * {@link Client.signInWithToken | Client.signInWithToken()} to sign in to the server using this token.
263
264
  *
264
265
  * @readonly
265
266
  */
@@ -279,7 +280,7 @@ export class User {
279
280
  }
280
281
 
281
282
  /**
282
- * Refresh user data.
283
+ * Reloads user data from the server.
283
284
  *
284
285
  * Only administrators can checkout other users. If the current logged in user is not an
285
286
  * administrator, they can only checkout themselves, otherwise an exception will be thrown.
@@ -300,7 +301,7 @@ export class User {
300
301
  }
301
302
 
302
303
  /**
303
- * Update user data on the server.
304
+ * Updates user data on the server.
304
305
  *
305
306
  * Only administrators can update other users. If the current logged in user is not an
306
307
  * administrator, they can only update themself, otherwise an exception will be thrown.
@@ -323,7 +324,7 @@ export class User {
323
324
  }
324
325
 
325
326
  /**
326
- * Delete a user from the server.
327
+ * Deletes a user from the server.
327
328
  *
328
329
  * Only administrators can delete users. If the current logged in user is not an
329
330
  * administrator, an exception will be thrown.
@@ -331,7 +332,7 @@ export class User {
331
332
  * Administrators can delete themselves or other administrators. An administrator can only
332
333
  * delete themself if they is not the last administrator.
333
334
  *
334
- * You need to re-login to continue working after deleting the current logged in user.
335
+ * You need to re-login after deleting the current logged in user.
335
336
  *
336
337
  * @returns Returns the raw data of a deleted user.
337
338
  */
@@ -354,15 +355,15 @@ export class User {
354
355
  }
355
356
 
356
357
  /**
357
- * Save user data changes to the server. Call this method to update user data on the server
358
- * after any changes.
358
+ * Saves user properties changes to the server. Call this method to update user data on the
359
+ * server after any property changes.
359
360
  */
360
361
  save(): Promise<this> {
361
362
  return this.update(this.data);
362
363
  }
363
364
 
364
365
  /**
365
- * Set or remove the user avatar.
366
+ * Sets or removes the user avatar.
366
367
  *
367
368
  * Only administrators can set the avatar of other users. If the current logged in user is
368
369
  * not an administrator, they can only set their avatar, otherwise an exception will be thrown.
@@ -371,9 +372,9 @@ export class User {
371
372
  * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}
372
373
  * string,
373
374
  * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
374
- * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or Web API
375
- * {@link https://developer.mozilla.org/docs/Web/API/File | File} object. Setting the
376
- * `image` to `null` will remove the avatar.
375
+ * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or
376
+ * {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object. Setting
377
+ * the `image` to `null` will remove the avatar.
377
378
  */
378
379
  async setAvatar(image?: BodyInit | null): Promise<this> {
379
380
  if (!image) {
@@ -393,7 +394,7 @@ export class User {
393
394
  }
394
395
 
395
396
  /**
396
- * Remove the user avatar.
397
+ * Removes the user avatar.
397
398
  *
398
399
  * Only administrators can remove the avatar of other users. If the current logged in user is
399
400
  * not an administrator, they can only remove their avatar, otherwise an exception will be thrown.
@@ -414,13 +415,13 @@ export class User {
414
415
  }
415
416
 
416
417
  /**
417
- * Change the user password.
418
+ * Changes the user password.
418
419
  *
419
420
  * Only administrators can change the passwords of other users. If the current logged in user
420
421
  * is not an administrator, they can only change their password, otherwise an exception will
421
422
  * be thrown.
422
423
  *
423
- * To change their password, non-administrator users must provide their old password.
424
+ * To change their password, non-administrator users must specify their old password.
424
425
  *
425
426
  * @param newPassword - New user password.
426
427
  * @param oldPassword - Old user password. Only required for non-administrator users to
package/src/index.ts CHANGED
@@ -28,6 +28,7 @@ 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 { IModelTransformMatrix } from "./Api/IAssembly";
31
32
  export { Member } from "./Api/Member";
32
33
  export { Model } from "./Api/Model";
33
34
  export { Permission } from "./Api/Permission";