@inweb/client 26.5.3 → 26.5.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/src/Api/File.ts CHANGED
@@ -123,7 +123,7 @@ export class File extends Endpoint {
123
123
  /**
124
124
  * Returns a list of file formats in which the active version of the file was exported.
125
125
  *
126
- * To export file to one of the supported formats create File Converter job using
126
+ * To export file to one of the supported formats run the File Converter job using
127
127
  * {@link createJob | createJob()}. To download exported file use
128
128
  * {@link downloadResource | downloadResource()}.
129
129
  *
@@ -138,8 +138,8 @@ export class File extends Endpoint {
138
138
  /**
139
139
  * Geometry data type of the active file version. Can be one of:
140
140
  *
141
- * - `vsfx` - `VSFX` format, file can be opened in `VisualizeJS` viewer.
142
- * - `gltf` - `glTF` format, file can be opened in `Three.js` viewer.
141
+ * - `vsfx` - `VSFX` format, file can be opened in `VisualizeJS` 3D viewer.
142
+ * - `gltf` - `glTF` format, file can be opened in `Three.js` 3D viewer.
143
143
  *
144
144
  * Returns an empty string if geometry data has not yet been converted. A files without geometry data
145
145
  * can be exported to other formas, but cannot be opened in viewer.
@@ -397,7 +397,7 @@ export class File extends Endpoint {
397
397
  *
398
398
  * @typedef {any} Properties
399
399
  * @property {string} handle - Object original handle.
400
- * @property {string | any} - Object property. Can be `any` for nested properties.
400
+ * @property {string | any} * - Object property. Can be `any` for nested group properties.
401
401
  */
402
402
 
403
403
  /**
@@ -405,10 +405,42 @@ export class File extends Endpoint {
405
405
  *
406
406
  * @param handles - Object original handle or handles array. Specify `undefined` to get properties for
407
407
  * all objects in the file.
408
- */
409
- getProperties(handles?: string | string[]): Promise<any[]> {
410
- const relativePath = handles !== undefined ? `/properties?handles=${handles}` : "/properties";
411
- return this.get(relativePath).then((response) => response.json());
408
+ * @param group - If the `group` parameter is `true`, properties are returned grouped by category. By
409
+ * default, or if `group` is set to `false`, properties are returned ungrouped.
410
+ *
411
+ * To get grouped properties, the `--properties_group` command line argument must be specified for the
412
+ * `properties` File Converter job when {@link Client.uploadFile | uploading the file}:
413
+ *
414
+ * ```javascript
415
+ * await client.uploadFile(file, {
416
+ * geometry: true,
417
+ * properties: true,
418
+ * jobParameters: { properties: "--properties_group" },
419
+ * waitForDone: true,
420
+ * });
421
+ * ```
422
+ *
423
+ * or when running the {@link extractProperties | extract file properties} job:
424
+ *
425
+ * ```javascript
426
+ * await file.extractProperties("--properties_group");
427
+ * ```
428
+ *
429
+ * Otherwise, the properties will be returned ungrouped, even if the `group` is `true`.
430
+ */
431
+ getProperties(handles?: string | string[], group = false): Promise<any[]> {
432
+ const searchParams = new URLSearchParams();
433
+ if (handles) {
434
+ if (Array.isArray(handles)) handles = handles.join(",");
435
+ if (typeof handles === "string") handles = handles.trim();
436
+ if (handles) searchParams.set("handles", handles);
437
+ }
438
+ if (group) searchParams.set("group", "true");
439
+
440
+ let queryString = searchParams.toString();
441
+ if (queryString) queryString = "?" + queryString;
442
+
443
+ return this.get(`/properties${queryString}`).then((response) => response.json());
412
444
  }
413
445
 
414
446
  /**
@@ -541,15 +573,15 @@ export class File extends Endpoint {
541
573
  * Downloads a resource file of the active version of the file. Resource files are files that contain
542
574
  * model scene descriptions, or geometry data, or exported files.
543
575
  *
544
- * @example Export file to DWG.
576
+ * @example Export file to PDF.
545
577
  *
546
578
  * ```javascript
547
- * const job = await file.crateJob("dwg");
579
+ * const job = await file.createJob("pdf");
548
580
  * await job.waitForDone();
549
- * const dwgFileName = file.exports.find((x) => x.endsWith(".dwg"));
550
- * const arrayBuffer = await file.downloadResource(dwgFileName);
581
+ * const pdfResourceName = file.exports.find((x) => x.endsWith(".pdf"));
582
+ * const arrayBuffer = await file.downloadResource(pdfResourceName);
551
583
  * const blob = new Blob([arrayBuffer]);
552
- * const fileName = file.name + ".dwg";
584
+ * const fileName = file.name + ".pdf";
553
585
  * FileSaver.saveAs(blob, fileName);
554
586
  * ```
555
587
  *
@@ -658,20 +690,19 @@ export class File extends Endpoint {
658
690
  /**
659
691
  * Runs a new job on the server for the active version of the file.
660
692
  *
661
- * @param outputFormat - The job type. Can be one of:
693
+ * @param outputFormat - The job type. Can be:
662
694
  *
663
- * - `geometry` - Convert file geometry data to `VSFX` format suitable for `VisualizeJS` viewer.
664
- * - `geometryGltf` - Convert file geometry data to `glTF` format suitable for `Three.js` viewer.
695
+ * - `geometry` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
696
+ * - `geometryGltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
665
697
  * - `properties` - Extract file properties.
666
- * - `validation` - Validate the file. Only for `IFC` files.
667
- * - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the one of the supported format.
668
- * Use {@link exports | exports()} to get the list of completed file exports. Use
698
+ * - `validation` - Validate the IFC file.
699
+ * - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format. Use
700
+ * {@link exports} to get the list of completed file exports. Use
669
701
  * {@link downloadResource | downloadResource()} to download the exported file.
670
- * - Other custom job name. Custom job runner must be registered in the job templates before creating a
671
- * job.
702
+ * - Other custom job name. Custom job must be registered in the job templates before running.
672
703
  *
673
- * @param parameters - Parameters for the job runner. Can be given as command line arguments for the
674
- * File Converter tool in form `--arg=value`.
704
+ * @param parameters - Parameters for the File Converter jobs or custom job. Can be given as command
705
+ * line arguments in form `--arg=value`.
675
706
  */
676
707
  createJob(outputFormat: string, parameters?: string | object): Promise<Job> {
677
708
  const jobs = new Endpoint("/jobs", this.httpClient, this.headers);
@@ -686,40 +717,40 @@ export class File extends Endpoint {
686
717
  }
687
718
 
688
719
  /**
689
- * Runs a job to convert geometry data of active version of the file. This is alias to
690
- * {@link createJob | createJob("geometry")}.
720
+ * Runs a File Converter job to convert geometry data of active version of the file to the specified
721
+ * format. This is alias to {@link createJob | createJob("geometry")}.
691
722
  *
692
723
  * @param type - Geometry data type. Can be one of:
693
724
  *
694
- * - `vsfx` - `VSFX` format (default), for opening a file in `VisualizeJS` viewer.
695
- * - `gltf` - `glTF` format, for opening a file in `Three.js` viewer.
725
+ * - `vsfx` - `VSFX` format (default), for opening a file in `VisualizeJS` 3D viewer.
726
+ * - `gltf` - `glTF` format, for opening a file in `Three.js` 3D viewer.
696
727
  *
697
- * @param parameters - Parameters for the job runner. Can be given as command line arguments for the
698
- * File Converter tool in form `--arg=value`.
728
+ * @param parameters - Parameters for the File Converter job. Can be given as command line arguments in
729
+ * form `--arg=value`.
699
730
  */
700
731
  extractGeometry(type?: string, parameters?: string | object): Promise<Job> {
701
732
  return this.createJob(type === "gltf" ? "geometryGltf" : "geometry", parameters);
702
733
  }
703
734
 
704
735
  /**
705
- * Runs a job to extract properties of the active version of the file. This is alias to
736
+ * Runs a File Converter job to extract properties of the active version of the file. This is alias to
706
737
  * {@link createJob | createJob("properties")}.
707
738
  *
708
- * @param parameters - Parameters for the job runner. Can be given as command line arguments for the
709
- * File Converter tool in form `--arg=value`.
739
+ * @param parameters - Parameters for the File Converter job. Can be given as command line arguments in
740
+ * form `--arg=value`.
710
741
  */
711
742
  extractProperties(parameters?: string | object): Promise<Job> {
712
743
  return this.createJob("properties", parameters);
713
744
  }
714
745
 
715
746
  /**
716
- * Runs a job to validate the active version of the file. This is alias to
747
+ * Runs an IFC validator job to validate the active version of the file. This is alias to
717
748
  * {@link createJob | createJob("validation")}.
718
749
  *
719
750
  * To get validation report use {@link downloadResource | downloadResource("validation_report.json")}.
720
751
  *
721
- * @param parameters - Parameters for the job runner. Can be given as command line arguments for the
722
- * File Converter tool in form `--arg=value`.
752
+ * @param parameters - Parameters for the IFC validator tool. Can be given as command line arguments in
753
+ * form `--arg=value`.
723
754
  */
724
755
  validate(parameters?: string | object): Promise<Job> {
725
756
  return this.createJob("validation", parameters);
@@ -729,8 +760,9 @@ export class File extends Endpoint {
729
760
  * Waits for jobs of the active version of the file to be done. Job is done when it changes to `none`,
730
761
  * `done` or `failed` status.
731
762
  *
732
- * @param jobs - Job or job array to wait on. Can be `geometry`, `geometryGltf`, `properties`,
733
- * `validation`, `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job name.
763
+ * @param jobs - Job name or array of job names to wait on. Can be `geometry`, `geometryGltf`,
764
+ * `properties`, `validation`, `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job
765
+ * name.
734
766
  * @param waitAll - If this parameter is `true`, the function returns when all the specified jobs have
735
767
  * done. If `false`, the function returns when any one of the jobs are done.
736
768
  * @param params - An object containing waiting parameters.
package/src/Api/Job.ts CHANGED
@@ -121,8 +121,15 @@ export class Job extends Endpoint {
121
121
  }
122
122
 
123
123
  /**
124
- * Job type. Can be `properties`, `geomerty`, `geomertyGltf`, `validation`, `clash`, `dwg`, `obj`,
125
- * `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job name.
124
+ * Job type. Can be:
125
+ *
126
+ * - `geometry` - Convert file geometry data to `VSFX` format.
127
+ * - `geometryGltf` - Convert file geometry data to `glTF` format.
128
+ * - `properties` - Extract file properties.
129
+ * - `validation` - Validate the IFC file.
130
+ * - `clash` - Create the clash detection report.
131
+ * - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
132
+ * - Other custom job name.
126
133
  *
127
134
  * @readonly
128
135
  */
@@ -131,7 +138,7 @@ export class Job extends Endpoint {
131
138
  }
132
139
 
133
140
  /**
134
- * Parameters with which the job runner was started. For more information, see
141
+ * Parameters with which the job was started. For more information, see
135
142
  * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Jobs | Open Cloud Jobs API}.
136
143
  *
137
144
  * @readonly