@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/File.ts CHANGED
@@ -30,7 +30,8 @@ import { Job } from "./Job";
30
30
  import { waitFor, parseArgs, userFullName, userInitials } from "./Utils";
31
31
 
32
32
  /**
33
- * The class representing a `file` entity.
33
+ * Provides properties and methods for obtaining information about a file on the server and
34
+ * managing its data and versions.
34
35
  */
35
36
  export class File {
36
37
  private _data: any;
@@ -39,8 +40,8 @@ export class File {
39
40
  public path: string;
40
41
 
41
42
  /**
42
- * @param data - An object that implements file data storage.
43
- * @param httpClient - Http client for API.
43
+ * @param data - Raw file data received from the server.
44
+ * @param httpClient - HTTP client instance used to send REST API requests to the server.
44
45
  */
45
46
  constructor(data: any, httpClient: IHttpClient) {
46
47
  this.path = `/files/${data.id}`;
@@ -145,8 +146,9 @@ export class File {
145
146
  }
146
147
 
147
148
  /**
148
- * Returns a list of files in different formats in which the active version of the file was
149
- * exported. To export file to one of the supported formats create File Converter job using
149
+ * Returns a list of file formats in which the active version of the file was exported.
150
+ *
151
+ * To export file to one of the supported formats create File Converter job using
150
152
  * {@link createJob | createJob()}. To download exported file use
151
153
  * {@link downloadResource | downloadResource()}.
152
154
  *
@@ -159,10 +161,10 @@ export class File {
159
161
  /**
160
162
  * Geometry data type of the active file version. Can be one of:
161
163
  *
162
- * - `vsfx` - `VSFX`, file can be opened in `VisualizeJS` viewer.
163
- * - `gltf` - `glTF`, file can be opened in `Three.js` viewer.
164
+ * - `vsfx` - `VSFX` format, file can be opened in `VisualizeJS` viewer.
165
+ * - `gltf` - `glTF` format, file can be opened in `Three.js` viewer.
164
166
  *
165
- * Returns an empty string if geometry data has not yet been extracted. A files without
167
+ * Returns an empty string if geometry data has not yet been converted. A files without
166
168
  * geometry data can be exported to other formas, but cannot be opened in viewer.
167
169
  */
168
170
  get geometryType(): string {
@@ -181,7 +183,10 @@ export class File {
181
183
  }
182
184
 
183
185
  /**
184
- * Returns `true` if source of the active file version has been deleted.
186
+ * Returns `true` if the source file of the active file version has been deleted.
187
+ *
188
+ * A files with deleted source file can be opened in the viewer, but cannot be exported to
189
+ * other formats.
185
190
  *
186
191
  * @readonly
187
192
  */
@@ -246,7 +251,7 @@ export class File {
246
251
  }
247
252
 
248
253
  /**
249
- * Total size of all versions of the file in the storage in bytes.
254
+ * Total size of all versions of the file in bytes.
250
255
  *
251
256
  * @readonly
252
257
  */
@@ -257,8 +262,8 @@ export class File {
257
262
  /**
258
263
  * Data status of the active version of the file. Contains:
259
264
  *
260
- * - `geometry` - status of geometry data of `VSFX` type.
261
- * - `geometryGltf` - status of geometry data of `glTF` type.
265
+ * - `geometry` - status of geometry data of `vsfx` type.
266
+ * - `geometryGltf` - status of geometry data of `gltf` type.
262
267
  * - `properties` - status of properties.
263
268
  * - `validation` - status of validation.
264
269
  *
@@ -327,7 +332,7 @@ export class File {
327
332
  }
328
333
 
329
334
  /**
330
- * Refresh file data.
335
+ * Reloads file data from the server.
331
336
  */
332
337
  async checkout(): Promise<this> {
333
338
  const response = await this.internalGet("");
@@ -336,7 +341,7 @@ export class File {
336
341
  }
337
342
 
338
343
  /**
339
- * Update file data on the server.
344
+ * Updates file data on the server.
340
345
  *
341
346
  * @param data - Raw file data.
342
347
  */
@@ -347,7 +352,10 @@ export class File {
347
352
  }
348
353
 
349
354
  /**
350
- * Delete the file and all its versions from the server.
355
+ * Deletes a file and all its versions from the server.
356
+ *
357
+ * You cannot delete a version file using `delete()`, only the original file. To delete a
358
+ * version file use {@link deleteVersion | deleteVersion()}.
351
359
  *
352
360
  * @returns Returns the raw data of a deleted file.
353
361
  */
@@ -356,23 +364,23 @@ export class File {
356
364
  }
357
365
 
358
366
  /**
359
- * Save file data changes to the server. Call this method to update file data on the server
360
- * after any changes.
367
+ * Saves file properties changes to the server. Call this method to update file data on the
368
+ * server after any property changes.
361
369
  */
362
370
  save(): Promise<this> {
363
371
  return this.update(this.data);
364
372
  }
365
373
 
366
374
  /**
367
- * Set or remove the file preview.
375
+ * Sets or removes the file preview.
368
376
  *
369
- * @param image - Preview image.Can be a
377
+ * @param image - Preview image. Can be a
370
378
  * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}
371
379
  * string,
372
380
  * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
373
- * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or Web API
374
- * {@link https://developer.mozilla.org/docs/Web/API/File | File} object. Setting the
375
- * `image` to `null` will remove the preview.
381
+ * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or
382
+ * {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object. Setting
383
+ * the `image` to `null` will remove the preview.
376
384
  */
377
385
  async setPreview(image?: BodyInit | null): Promise<this> {
378
386
  if (!image) {
@@ -385,7 +393,7 @@ export class File {
385
393
  }
386
394
 
387
395
  /**
388
- * Remove the file preview.
396
+ * Removes the file preview.
389
397
  */
390
398
  async deletePreview(): Promise<this> {
391
399
  const response = await this.internalDelete("/preview");
@@ -424,8 +432,8 @@ export class File {
424
432
  /**
425
433
  * Returns the properties for an objects in the active version of the file.
426
434
  *
427
- * @param handles - Object original handle or handles array. Leave this parameter `undefined`
428
- * to get properties for all objects in the file.
435
+ * @param handles - Object original handle or handles array. Specify `undefined` to get
436
+ * properties for all objects in the file.
429
437
  */
430
438
  getProperties(handles?: string | string[]): Promise<any[]> {
431
439
  const relativePath = handles !== undefined ? `/properties?handles=${handles}` : "/properties";
@@ -471,7 +479,7 @@ export class File {
471
479
  * ],
472
480
  * };
473
481
  *
474
- * @param {SearchPattern | QueryOperator} searchPattern - Search pattern or combination of
482
+ * @param {SeacrhPattern | QueryOperator} searchPattern - Search pattern or combination of
475
483
  * the patterns, see example below.
476
484
  * @returns {Promise<Properties[]>}
477
485
  */
@@ -481,7 +489,7 @@ export class File {
481
489
  }
482
490
 
483
491
  /**
484
- * Returns the cda.json for an active version of the file.
492
+ * Returns the CDA tree for an active version of the file.
485
493
  */
486
494
  getCdaTree(): Promise<any[]> {
487
495
  return this.internalGet(`/properties/tree`).then((response) => response.json());
@@ -497,7 +505,7 @@ export class File {
497
505
  }
498
506
 
499
507
  /**
500
- * Add new file viewpoint. To create a viewpoint use `Viewer.createViewpoint()`.
508
+ * Adds a new viewpoint to the file. To create a viewpoint use `Viewer.createViewpoint()`.
501
509
  *
502
510
  * @param viewpoint - Viewpoint.
503
511
  */
@@ -506,7 +514,7 @@ export class File {
506
514
  }
507
515
 
508
516
  /**
509
- * Delete file viewpoint.
517
+ * Deletes the specified file viewpoint.
510
518
  *
511
519
  * @param guid - Viewpoint GUID.
512
520
  * @returns Returns the raw data of a deleted viewpoint.
@@ -536,7 +544,7 @@ export class File {
536
544
  }
537
545
 
538
546
  /**
539
- * Download source of active version of the file.
547
+ * Downloads the source file of active version of the file from the server.
540
548
  *
541
549
  * @param onProgress - Download progress callback.
542
550
  * @param signal - An
@@ -551,7 +559,7 @@ export class File {
551
559
  }
552
560
 
553
561
  /**
554
- * Download a resource file of the active version of the file. Resource files are files that
562
+ * Downloads a resource file of the active version of the file. Resource files are files that
555
563
  * contain model scene descriptions, or geometry data, or exported files.
556
564
  *
557
565
  * @example <caption>Export file to DWG.</caption>
@@ -581,7 +589,7 @@ export class File {
581
589
  }
582
590
 
583
591
  /**
584
- * Download a part of resource file of the active version of the file. Resource files are
592
+ * Downloads a part of resource file of the active version of the file. Resource files are
585
593
  * files that contain model scene descriptions, or geometry data, or exported files.
586
594
  *
587
595
  * @param dataId - Resource file name.
@@ -637,7 +645,9 @@ export class File {
637
645
  }
638
646
 
639
647
  /**
640
- * Returns a list of references to files used to correct rendering of the current file.
648
+ * Returns a list of file references.
649
+ *
650
+ * References are images, fonts, or any other files to correct rendering of the file.
641
651
  *
642
652
  * @param signal - An
643
653
  * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
@@ -648,7 +658,10 @@ export class File {
648
658
  }
649
659
 
650
660
  /**
651
- * Set the file references.
661
+ * Sets the file references.
662
+ *
663
+ * References are images, fonts, or any other files to correct rendering of the file.
664
+ * Reference files must be uploaded to the server before they can be assigned to the current file.
652
665
  *
653
666
  * @param references - File references.
654
667
  */
@@ -657,14 +670,14 @@ export class File {
657
670
  }
658
671
 
659
672
  /**
660
- * Create a new job for the active version of the file.
673
+ * Runs a new job on the server for the active version of the file.
661
674
  *
662
675
  * @param outputFormat - The job type. Can be one of:
663
676
  *
664
- * - `geometry` - Extract file geometry data into `VSFX`.
665
- * - `geometryGltf` - Extract file geometry data into `glTF`.
677
+ * - `geometry` - Convert file geometry data to `VSFX` format suitable for `VisualizeJS` viewer.
678
+ * - `geometryGltf` - Convert file geometry data to `glTF` format suitable for `Three.js` viewer.
666
679
  * - `properties` - Extract file properties.
667
- * - `validation` - Validate the file. Only for `IFC`.
680
+ * - `validation` - Validate the file. Only for `IFC` files.
668
681
  * - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the one of the
669
682
  * supported format. Use {@link exports | exports()} to get the list of completed file
670
683
  * exports. Use {@link downloadResource | downloadResource()} to download the exported file.
@@ -687,13 +700,13 @@ export class File {
687
700
  }
688
701
 
689
702
  /**
690
- * Create job to extract geometry data of active version of the file. This is alias to
703
+ * Runs a job to convert geometry data of active version of the file. This is alias to
691
704
  * {@link createJob | createJob("geometry")}.
692
705
  *
693
706
  * @param type - Geometry data type. Can be one of:
694
707
  *
695
- * - `vsfx` - `VSFX` (default), for opening a file in `VisualizeJS` viewer.
696
- * - `gltf` - `glTF`, for opening a file in `Three.js` viewer.
708
+ * - `vsfx` - `VSFX` format (default), for opening a file in `VisualizeJS` viewer.
709
+ * - `gltf` - `glTF` format, for opening a file in `Three.js` viewer.
697
710
  *
698
711
  * @param parameters - Parameters for the job runner. Can be given as command line arguments
699
712
  * for the File Converter tool in form `--arg=value`.
@@ -703,7 +716,7 @@ export class File {
703
716
  }
704
717
 
705
718
  /**
706
- * Create job to extract properties of the active version of the file. This is alias to
719
+ * Runs a job to extract properties of the active version of the file. This is alias to
707
720
  * {@link createJob | createJob("properties")}.
708
721
  *
709
722
  * @param parameters - Parameters for the job runner. Can be given as command line arguments
@@ -714,7 +727,7 @@ export class File {
714
727
  }
715
728
 
716
729
  /**
717
- * Create a job to validate the active version of the file. This is alias to
730
+ * Runs a job to validate the active version of the file. This is alias to
718
731
  * {@link createJob | createJob("validation")}.
719
732
  *
720
733
  * To get validation report use {@link downloadResource | downloadResource("validation_report.json")}.
@@ -727,8 +740,8 @@ export class File {
727
740
  }
728
741
 
729
742
  /**
730
- * Wait for jobs of the active version of the file to be done. Job is done when it changes to
731
- * `none`, `done` or `failed` status.
743
+ * Waits for jobs of the active version of the file to be done. Job is done when it changes
744
+ * to `none`, `done` or `failed` status.
732
745
  *
733
746
  * @param jobs - Job or job array to wait on. Can be `geometry`, `geometryGltf`,
734
747
  * `properties`, `validation`, `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom
@@ -782,7 +795,7 @@ export class File {
782
795
  }
783
796
 
784
797
  /**
785
- * Returns the permission information.
798
+ * Returns information about specified file permission.
786
799
  *
787
800
  * @param permissionId - Permission ID.
788
801
  */
@@ -793,10 +806,16 @@ export class File {
793
806
  }
794
807
 
795
808
  /**
796
- * Create a new file permission.
809
+ * Creates a new file permission.
810
+ *
811
+ * @param actions - Actions are allowed to be performed on a file with this permission:
812
+ *
813
+ * - `read` - The ability to read file description, geometry data and properties.
814
+ * - `readSourceFile` - The ability to read source file.
815
+ * - `write` - The ability to modify file name, description and references.
816
+ * - `readViewpoint` - The ability to read file viewpoints.
817
+ * - `createViewpoint` - The ability to create file viewpoints.
797
818
  *
798
- * @param actions - Actions are allowed to be performed on a file with this permission. See
799
- * {@link Permission.actions} for more details.
800
819
  * @param grantedTo - A collection of principials that will get access to the file.
801
820
  * @param _public - Specifies whether all users have access to the file or not.
802
821
  */
@@ -811,7 +830,7 @@ export class File {
811
830
  }
812
831
 
813
832
  /**
814
- * Delete file permission.
833
+ * Removes the specified permission from the file.
815
834
  *
816
835
  * @param permissionId - Permission ID.
817
836
  * @returns Returns the raw data of a deleted permission.
@@ -821,14 +840,15 @@ export class File {
821
840
  }
822
841
 
823
842
  /**
824
- * Upload the new version of the file to the server and extract the geometry and properties as needed.
843
+ * Uploads the new version of the file to the server, convert the geometry data and extract
844
+ * properties as needed.
825
845
  *
826
- * @param file - Web API {@link https://developer.mozilla.org/docs/Web/API/File | File} object
846
+ * @param file - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object
827
847
  * are generally retrieved from a
828
848
  * {@link https://developer.mozilla.org/docs/Web/API/FileList | FileList} object returned as
829
849
  * a result of a user selecting files using the HTML `<input>` element.
830
850
  * @param params - An object containing upload parameters.
831
- * @param params.geometry - Create job to extract file geometry data. The geometry data type
851
+ * @param params.geometry - Create job to convert file geometry data. The geometry data type
832
852
  * is the same as the original file.
833
853
  * @param params.properties - Create job to extract file properties.
834
854
  * @param params.waitForDone - Wait for geometry and properties jobs to complete.
@@ -892,7 +912,7 @@ export class File {
892
912
  }
893
913
 
894
914
  /**
895
- * Returns the version file.
915
+ * Returns information about the specified version file.
896
916
  *
897
917
  * @param version - Desired version.
898
918
  */
@@ -904,7 +924,7 @@ export class File {
904
924
  }
905
925
 
906
926
  /**
907
- * Delete version file.
927
+ * Deletes the specified version file.
908
928
  *
909
929
  * @param version - Version to delete.
910
930
  */
@@ -916,7 +936,7 @@ export class File {
916
936
  }
917
937
 
918
938
  /**
919
- * Replace the active version of the file with the selected version.
939
+ * Replaces the active version of the file with the selected version.
920
940
  *
921
941
  * @param version - Desired active version.
922
942
  */
@@ -926,27 +946,29 @@ export class File {
926
946
  }
927
947
 
928
948
  /**
929
- * Use given version instead of active version for current file on client side. This version
930
- * change will affect the result:
949
+ * Makes the given version active on client side. Does not change the active file version on
950
+ * the server.
951
+ *
952
+ * This version change will affect the result:
931
953
  *
932
- * - getModels()
933
- * - getProperties()
934
- * - searchProperties()
935
- * - getCdaTree()
936
- * - download()
937
- * - downloadResource()
938
- * - createJob()
939
- * - extractGeometry()
940
- * - extractProperties()
941
- * - validate()
942
- * - waitForDone()
954
+ * - {@link getModels | getModels()}
955
+ * - {@link getProperties | getProperties()}
956
+ * - {@link searchProperties | searchProperties()}
957
+ * - {@link getCdaTree | getCdaTree()}
958
+ * - {@link download | download()}
959
+ * - {@link downloadResource | downloadResource()}
960
+ * - {@link createJob | createJob()}
961
+ * - {@link extractGeometry | extractGeometry()}
962
+ * - {@link extractProperties | extractProperties()}
963
+ * - {@link validate | validate()}
964
+ * - {@link waitForDone | waitForDone()}
943
965
  * - Viewer.open()
944
966
  *
945
967
  * Other clients will still continue to use the current active version of the file. Use
946
968
  * `undefined` to revert back to the active version.
947
969
  *
948
- * Note. You need to update the file data using {@link checkout | checkout()} to match the
949
- * size and status fields to the version you selected.
970
+ * You need to reload the file data using {@link checkout | checkout()} to match the size and
971
+ * status fields to the version you selected.
950
972
  */
951
973
  useVersion(version?: number): this {
952
974
  this._useVersion = version;
@@ -954,7 +976,7 @@ export class File {
954
976
  }
955
977
 
956
978
  /**
957
- * Delete the source of the active file version.
979
+ * Deletes the source file of the active file version from the server.
958
980
  */
959
981
  async deleteSource(): Promise<this> {
960
982
  const response = await this.internalDelete("/source");
@@ -35,3 +35,30 @@ export interface IAssemblyVersionInfo {
35
35
  createdAt: string;
36
36
  ownerId: string;
37
37
  }
38
+
39
+ /**
40
+ * Model transformation matrix.
41
+ */
42
+ export interface IModelTransformMatrix {
43
+ /**
44
+ * Translation part, move by specified offset along the X, Y, Z axes.
45
+ */
46
+ translate: {
47
+ x: number;
48
+ y: number;
49
+ z: number;
50
+ };
51
+ /**
52
+ * Rotation part, rotate by the specified angle, around the specified vector.
53
+ */
54
+ rotation: {
55
+ x: number;
56
+ y: number;
57
+ z: number;
58
+ angle: number;
59
+ };
60
+ /**
61
+ * Scaling part, scale with multiplier, from center of extends.
62
+ */
63
+ scale: number;
64
+ }
package/src/Api/Job.ts CHANGED
@@ -25,16 +25,15 @@ import { IHttpClient } from "./IHttpClient";
25
25
  import { waitFor } from "./Utils";
26
26
 
27
27
  /**
28
- * The class representing a `job` entity describes the process of converting a file from one
29
- * format to another, to obtain geometric data, validate the file, or run a clash test.
28
+ * Provides properties and methods for obtaining information about a job on the server.
30
29
  */
31
30
  export class Job {
32
31
  private _data: any;
33
32
  public httpClient: IHttpClient;
34
33
 
35
34
  /**
36
- * @param data - An object that implements job data storage.
37
- * @param httpClient - Http client.
35
+ * @param data - Raw job data received from the server.
36
+ * @param httpClient - HTTP client instance used to send REST API requests to the server.
38
37
  */
39
38
  constructor(data: any, httpClient: IHttpClient) {
40
39
  this.httpClient = httpClient;
@@ -179,7 +178,7 @@ export class Job {
179
178
  }
180
179
 
181
180
  /**
182
- * Refresh job data.
181
+ * Reloads job data from the server.
183
182
  */
184
183
  async checkout(): Promise<this> {
185
184
  const response = await this.internalGet();
@@ -188,7 +187,7 @@ export class Job {
188
187
  }
189
188
 
190
189
  /**
191
- * Update job data on the server.
190
+ * Updates job data on the server.
192
191
  *
193
192
  * Only administrators can update job data. If the current logged in user is not an
194
193
  * administrator, an exception will be thrown.
@@ -202,7 +201,7 @@ export class Job {
202
201
  }
203
202
 
204
203
  /**
205
- * Remove a job from the server job list. Jobs that are in progress or have already been
204
+ * Deletes a job from the server job list. Jobs that are in progress or have already been
206
205
  * completed cannot be deleted.
207
206
  *
208
207
  * @returns Returns the raw data of a deleted job.
@@ -212,18 +211,15 @@ export class Job {
212
211
  }
213
212
 
214
213
  // /**
215
- // * Save job data changes to the server. Call this method to update job data on the server
216
- // * after any changes.
217
- // *
218
- // *
219
- // * @returns {Promise<Job>}
214
+ // * Save job properties changes to the server. Call this method to update job data on the server
215
+ // * after any property changes.
220
216
  // */
221
217
  // save() {
222
218
  // return this.update(this.data);
223
219
  // }
224
220
 
225
221
  /**
226
- * Wait for job to be done. Job is done when it changes to `done` or `failed` status.
222
+ * Waits for job to be done. Job is done when it changes to `done` or `failed` status.
227
223
  *
228
224
  * @param params - An object containing waiting parameters.
229
225
  * @param params.timeout - The time, in milliseconds that the function should wait job. If
package/src/Api/Member.ts CHANGED
@@ -26,7 +26,8 @@ import { IShortUserDescription } from "./IUser";
26
26
  import { userFullName, userInitials } from "./Utils";
27
27
 
28
28
  /**
29
- * Members are the {@link User | users} who have access to the {@link Project | project}.
29
+ * Provides properties and methods for obtaining information about a {@link User | user} who has
30
+ * access to the {@link Project | project}.
30
31
  */
31
32
  export class Member {
32
33
  private _data: any;
@@ -34,9 +35,9 @@ export class Member {
34
35
  public httpClient: IHttpClient;
35
36
 
36
37
  /**
37
- * @param data - An object that implements member data storage.
38
+ * @param data - Raw member data received from the server.
38
39
  * @param projectId - Owner project ID.
39
- * @param httpClient - Http client.
40
+ * @param httpClient - HTTP client instance used to send REST API requests to the server.
40
41
  */
41
42
  constructor(data: any, projectId: string, httpClient: IHttpClient) {
42
43
  this.httpClient = httpClient;
@@ -119,7 +120,7 @@ export class Member {
119
120
  }
120
121
 
121
122
  /**
122
- * Refresh member data.
123
+ * Reloads member data from the server.
123
124
  */
124
125
  async checkout(): Promise<this> {
125
126
  const response = await this.internalGet();
@@ -128,7 +129,7 @@ export class Member {
128
129
  }
129
130
 
130
131
  /**
131
- * Update member data on the server.
132
+ * Updates member data on the server.
132
133
  *
133
134
  * @param data - Raw member data.
134
135
  */
@@ -139,7 +140,7 @@ export class Member {
139
140
  }
140
141
 
141
142
  /**
142
- * Remove a member from a project.
143
+ * Removes a member from the project.
143
144
  *
144
145
  * @returns Returns the raw data of a deleted member.
145
146
  */
@@ -148,8 +149,8 @@ export class Member {
148
149
  }
149
150
 
150
151
  /**
151
- * Save member data changes to the server. Call this method to update member data on the
152
- * server after any changes.
152
+ * Saves member properties changes to the server. Call this method to update member data on
153
+ * the server after any property changes.
153
154
  */
154
155
  save(): Promise<this> {
155
156
  return this.update(this.data);