@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/dist/client.js +149 -66
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +35 -14
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Assembly.d.ts +17 -3
- package/lib/Api/Client.d.ts +28 -14
- package/lib/Api/File.d.ts +56 -34
- package/lib/Api/Job.d.ts +10 -3
- package/package.json +2 -2
- package/src/Api/Assembly.ts +29 -5
- package/src/Api/Client.ts +43 -21
- package/src/Api/File.ts +69 -37
- package/src/Api/Job.ts +10 -3
package/lib/Api/Assembly.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare class Assembly extends Endpoint {
|
|
|
48
48
|
/**
|
|
49
49
|
* Assembly geometry data type:
|
|
50
50
|
*
|
|
51
|
-
* - `vsfx` - `VSFX` format, assembly can be opened in `VisualizeJS` viewer.
|
|
51
|
+
* - `vsfx` - `VSFX` format, assembly can be opened in `VisualizeJS` 3D viewer.
|
|
52
52
|
*
|
|
53
53
|
* Returns an empty string if the geometry data is not yet ready.
|
|
54
54
|
*/
|
|
@@ -141,15 +141,29 @@ export declare class Assembly extends Endpoint {
|
|
|
141
141
|
*
|
|
142
142
|
* @typedef {any} Properties
|
|
143
143
|
* @property {string} handle - Object original handle.
|
|
144
|
-
* @property {string | any} * - Object property. Can be `any` for nested properties.
|
|
144
|
+
* @property {string | any} * - Object property. Can be `any` for nested group properties.
|
|
145
145
|
*/
|
|
146
146
|
/**
|
|
147
147
|
* Returns the properties for an objects in the assembly.
|
|
148
148
|
*
|
|
149
149
|
* @param handles - Object original handle or handles array. Specify `undefined` to get properties for
|
|
150
150
|
* all objects in the assembly.
|
|
151
|
+
* @param group - If the `group` parameter is `true`, properties are returned grouped by category. By
|
|
152
|
+
* default, or if `group` is set to `false`, properties are returned ungrouped.
|
|
153
|
+
*
|
|
154
|
+
* To get grouped properties, the `--properties_group` command line argument must be specified for the
|
|
155
|
+
* `properties` File Converter job when {@link Client.createAssembly | creating the assembly}.
|
|
156
|
+
*
|
|
157
|
+
* ```javascript
|
|
158
|
+
* await client.createAssembly([file1.id, file2.id], "AssemblyName", {
|
|
159
|
+
* jobParameters: { properties: "--properties_group" },
|
|
160
|
+
* waitForDone: true,
|
|
161
|
+
* });
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* Otherwise, the properties will be returned ungrouped, even if the `group` is `true`.
|
|
151
165
|
*/
|
|
152
|
-
getProperties(handles?: string | string[]): Promise<any[]>;
|
|
166
|
+
getProperties(handles?: string | string[], group?: boolean): Promise<any[]>;
|
|
153
167
|
/**
|
|
154
168
|
* Returns the list of original handles for an objects in the file that match the specified patterns.
|
|
155
169
|
* Search patterns may be combined using query operators.
|
package/lib/Api/Client.d.ts
CHANGED
|
@@ -312,13 +312,17 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
312
312
|
* generally retrieved from a {@link https://developer.mozilla.org/docs/Web/API/FileList | FileList}
|
|
313
313
|
* object returned as a result of a user selecting files using the HTML `<input>` element.
|
|
314
314
|
* @param params - An object containing upload parameters.
|
|
315
|
-
* @param params.geometry -
|
|
315
|
+
* @param params.geometry - Run File Converter job to convert geometry data after uploading the file.
|
|
316
|
+
* Can be:
|
|
316
317
|
*
|
|
317
|
-
* - `true` - Convert file geometry data to `VSFX` format
|
|
318
|
-
* - `vsfx` - Convert file geometry data to `VSFX` format
|
|
319
|
-
* - `gltf` - Convert file geometry data to `glTF` format
|
|
318
|
+
* - `true` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
319
|
+
* - `vsfx` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
320
|
+
* - `gltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
320
321
|
*
|
|
321
|
-
* @param params.properties -
|
|
322
|
+
* @param params.properties - Run File Converter job to extract properties after uploading the file.
|
|
323
|
+
* @param params.jobParameters - Parameters for the File Converter jobs. Use this to specify aditional
|
|
324
|
+
* parameters for retrieving the geometry and properties of uploaded file. Can be given as command
|
|
325
|
+
* line arguments in form `--arg=value`.
|
|
322
326
|
* @param params.waitForDone - Wait for geometry and properties jobs to complete.
|
|
323
327
|
* @param params.timeout - The time, in milliseconds that the function should wait jobs. If no one jobs
|
|
324
328
|
* are done during this time, the `TimeoutError` exception will be thrown.
|
|
@@ -332,6 +336,10 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
332
336
|
uploadFile(file: globalThis.File, params?: {
|
|
333
337
|
geometry?: boolean | string;
|
|
334
338
|
properties?: boolean;
|
|
339
|
+
jobParameters?: {
|
|
340
|
+
geometry?: string | object;
|
|
341
|
+
properties?: string | object;
|
|
342
|
+
};
|
|
335
343
|
waitForDone?: boolean;
|
|
336
344
|
timeout?: number;
|
|
337
345
|
interval?: number;
|
|
@@ -396,18 +404,17 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
396
404
|
* Runs a new job on the server for the sepecified file.
|
|
397
405
|
*
|
|
398
406
|
* @param fileId - File ID.
|
|
399
|
-
* @param outputFormat - The job type. Can be
|
|
407
|
+
* @param outputFormat - The job type. Can be:
|
|
400
408
|
*
|
|
401
|
-
* - `geometry` - Convert file geometry data to `VSFX` format
|
|
402
|
-
* - `geometryGltf` - Convert file geometry data to `glTF` format
|
|
409
|
+
* - `geometry` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
410
|
+
* - `geometryGltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
403
411
|
* - `properties` - Extract file properties.
|
|
404
|
-
* - `validation` - Validate the
|
|
405
|
-
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the
|
|
406
|
-
* - Other custom job name. Custom job
|
|
407
|
-
* creating a job.
|
|
412
|
+
* - `validation` - Validate the IFC file.
|
|
413
|
+
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
|
|
414
|
+
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
408
415
|
*
|
|
409
|
-
* @param parameters - Parameters for the job
|
|
410
|
-
*
|
|
416
|
+
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as command
|
|
417
|
+
* line arguments in form `--arg=value`.
|
|
411
418
|
*/
|
|
412
419
|
createJob(fileId: string, outputFormat: string, parameters?: string | object): Promise<Job>;
|
|
413
420
|
/**
|
|
@@ -460,6 +467,9 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
460
467
|
* @param files - List of file IDs.
|
|
461
468
|
* @param name - Assembly name.
|
|
462
469
|
* @param params - Additional assembly creating parameters.
|
|
470
|
+
* @param params.jobParameters - Parameters for the File Converter jobs. Use this to specify aditional
|
|
471
|
+
* parameters for generating the geometry and properties of the new assembly. Can be given as command
|
|
472
|
+
* line arguments in form `--arg=value`.
|
|
463
473
|
* @param params.waitForDone - Wait for assembly to be created.
|
|
464
474
|
* @param params.timeout - The time, in milliseconds, that the function should wait for the assembly to
|
|
465
475
|
* be created. If the assembly is not created within this time, a TimeoutError exception will be
|
|
@@ -472,6 +482,10 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
472
482
|
* @param params.onCheckout - Waiting progress callback. Return `true` to cancel waiting.
|
|
473
483
|
*/
|
|
474
484
|
createAssembly(files: string[], name: string, params?: {
|
|
485
|
+
jobParameters?: {
|
|
486
|
+
geometry?: string | object;
|
|
487
|
+
properties?: string | object;
|
|
488
|
+
};
|
|
475
489
|
waitForDone?: boolean;
|
|
476
490
|
timeout?: number;
|
|
477
491
|
interval?: number;
|
package/lib/Api/File.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare class File extends Endpoint {
|
|
|
48
48
|
/**
|
|
49
49
|
* Returns a list of file formats in which the active version of the file was exported.
|
|
50
50
|
*
|
|
51
|
-
* To export file to one of the supported formats
|
|
51
|
+
* To export file to one of the supported formats run the File Converter job using
|
|
52
52
|
* {@link createJob | createJob()}. To download exported file use
|
|
53
53
|
* {@link downloadResource | downloadResource()}.
|
|
54
54
|
*
|
|
@@ -60,8 +60,8 @@ export declare class File extends Endpoint {
|
|
|
60
60
|
/**
|
|
61
61
|
* Geometry data type of the active file version. Can be one of:
|
|
62
62
|
*
|
|
63
|
-
* - `vsfx` - `VSFX` format, file can be opened in `VisualizeJS` viewer.
|
|
64
|
-
* - `gltf` - `glTF` format, file can be opened in `Three.js` viewer.
|
|
63
|
+
* - `vsfx` - `VSFX` format, file can be opened in `VisualizeJS` 3D viewer.
|
|
64
|
+
* - `gltf` - `glTF` format, file can be opened in `Three.js` 3D viewer.
|
|
65
65
|
*
|
|
66
66
|
* Returns an empty string if geometry data has not yet been converted. A files without geometry data
|
|
67
67
|
* can be exported to other formas, but cannot be opened in viewer.
|
|
@@ -221,15 +221,37 @@ export declare class File extends Endpoint {
|
|
|
221
221
|
*
|
|
222
222
|
* @typedef {any} Properties
|
|
223
223
|
* @property {string} handle - Object original handle.
|
|
224
|
-
* @property {string | any} - Object property. Can be `any` for nested properties.
|
|
224
|
+
* @property {string | any} * - Object property. Can be `any` for nested group properties.
|
|
225
225
|
*/
|
|
226
226
|
/**
|
|
227
227
|
* Returns the properties for an objects in the active version of the file.
|
|
228
228
|
*
|
|
229
229
|
* @param handles - Object original handle or handles array. Specify `undefined` to get properties for
|
|
230
230
|
* all objects in the file.
|
|
231
|
+
* @param group - If the `group` parameter is `true`, properties are returned grouped by category. By
|
|
232
|
+
* default, or if `group` is set to `false`, properties are returned ungrouped.
|
|
233
|
+
*
|
|
234
|
+
* To get grouped properties, the `--properties_group` command line argument must be specified for the
|
|
235
|
+
* `properties` File Converter job when {@link Client.uploadFile | uploading the file}:
|
|
236
|
+
*
|
|
237
|
+
* ```javascript
|
|
238
|
+
* await client.uploadFile(file, {
|
|
239
|
+
* geometry: true,
|
|
240
|
+
* properties: true,
|
|
241
|
+
* jobParameters: { properties: "--properties_group" },
|
|
242
|
+
* waitForDone: true,
|
|
243
|
+
* });
|
|
244
|
+
* ```
|
|
245
|
+
*
|
|
246
|
+
* or when running the {@link extractProperties | extract file properties} job:
|
|
247
|
+
*
|
|
248
|
+
* ```javascript
|
|
249
|
+
* await file.extractProperties("--properties_group");
|
|
250
|
+
* ```
|
|
251
|
+
*
|
|
252
|
+
* Otherwise, the properties will be returned ungrouped, even if the `group` is `true`.
|
|
231
253
|
*/
|
|
232
|
-
getProperties(handles?: string | string[]): Promise<any[]>;
|
|
254
|
+
getProperties(handles?: string | string[], group?: boolean): Promise<any[]>;
|
|
233
255
|
/**
|
|
234
256
|
* Search pattern.
|
|
235
257
|
*
|
|
@@ -329,15 +351,15 @@ export declare class File extends Endpoint {
|
|
|
329
351
|
* Downloads a resource file of the active version of the file. Resource files are files that contain
|
|
330
352
|
* model scene descriptions, or geometry data, or exported files.
|
|
331
353
|
*
|
|
332
|
-
* @example Export file to
|
|
354
|
+
* @example Export file to PDF.
|
|
333
355
|
*
|
|
334
356
|
* ```javascript
|
|
335
|
-
* const job = await file.
|
|
357
|
+
* const job = await file.createJob("pdf");
|
|
336
358
|
* await job.waitForDone();
|
|
337
|
-
* const
|
|
338
|
-
* const arrayBuffer = await file.downloadResource(
|
|
359
|
+
* const pdfResourceName = file.exports.find((x) => x.endsWith(".pdf"));
|
|
360
|
+
* const arrayBuffer = await file.downloadResource(pdfResourceName);
|
|
339
361
|
* const blob = new Blob([arrayBuffer]);
|
|
340
|
-
* const fileName = file.name + ".
|
|
362
|
+
* const fileName = file.name + ".pdf";
|
|
341
363
|
* FileSaver.saveAs(blob, fileName);
|
|
342
364
|
* ```
|
|
343
365
|
*
|
|
@@ -399,59 +421,59 @@ export declare class File extends Endpoint {
|
|
|
399
421
|
/**
|
|
400
422
|
* Runs a new job on the server for the active version of the file.
|
|
401
423
|
*
|
|
402
|
-
* @param outputFormat - The job type. Can be
|
|
424
|
+
* @param outputFormat - The job type. Can be:
|
|
403
425
|
*
|
|
404
|
-
* - `geometry` - Convert file geometry data to `VSFX` format
|
|
405
|
-
* - `geometryGltf` - Convert file geometry data to `glTF` format
|
|
426
|
+
* - `geometry` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
427
|
+
* - `geometryGltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
406
428
|
* - `properties` - Extract file properties.
|
|
407
|
-
* - `validation` - Validate the
|
|
408
|
-
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the
|
|
409
|
-
*
|
|
429
|
+
* - `validation` - Validate the IFC file.
|
|
430
|
+
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format. Use
|
|
431
|
+
* {@link exports} to get the list of completed file exports. Use
|
|
410
432
|
* {@link downloadResource | downloadResource()} to download the exported file.
|
|
411
|
-
* - Other custom job name. Custom job
|
|
412
|
-
* job.
|
|
433
|
+
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
413
434
|
*
|
|
414
|
-
* @param parameters - Parameters for the job
|
|
415
|
-
*
|
|
435
|
+
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as command
|
|
436
|
+
* line arguments in form `--arg=value`.
|
|
416
437
|
*/
|
|
417
438
|
createJob(outputFormat: string, parameters?: string | object): Promise<Job>;
|
|
418
439
|
/**
|
|
419
|
-
* Runs a job to convert geometry data of active version of the file
|
|
420
|
-
* {@link createJob | createJob("geometry")}.
|
|
440
|
+
* Runs a File Converter job to convert geometry data of active version of the file to the specified
|
|
441
|
+
* format. This is alias to {@link createJob | createJob("geometry")}.
|
|
421
442
|
*
|
|
422
443
|
* @param type - Geometry data type. Can be one of:
|
|
423
444
|
*
|
|
424
|
-
* - `vsfx` - `VSFX` format (default), for opening a file in `VisualizeJS` viewer.
|
|
425
|
-
* - `gltf` - `glTF` format, for opening a file in `Three.js` viewer.
|
|
445
|
+
* - `vsfx` - `VSFX` format (default), for opening a file in `VisualizeJS` 3D viewer.
|
|
446
|
+
* - `gltf` - `glTF` format, for opening a file in `Three.js` 3D viewer.
|
|
426
447
|
*
|
|
427
|
-
* @param parameters - Parameters for the job
|
|
428
|
-
*
|
|
448
|
+
* @param parameters - Parameters for the File Converter job. Can be given as command line arguments in
|
|
449
|
+
* form `--arg=value`.
|
|
429
450
|
*/
|
|
430
451
|
extractGeometry(type?: string, parameters?: string | object): Promise<Job>;
|
|
431
452
|
/**
|
|
432
|
-
* Runs a job to extract properties of the active version of the file. This is alias to
|
|
453
|
+
* Runs a File Converter job to extract properties of the active version of the file. This is alias to
|
|
433
454
|
* {@link createJob | createJob("properties")}.
|
|
434
455
|
*
|
|
435
|
-
* @param parameters - Parameters for the job
|
|
436
|
-
*
|
|
456
|
+
* @param parameters - Parameters for the File Converter job. Can be given as command line arguments in
|
|
457
|
+
* form `--arg=value`.
|
|
437
458
|
*/
|
|
438
459
|
extractProperties(parameters?: string | object): Promise<Job>;
|
|
439
460
|
/**
|
|
440
|
-
* Runs
|
|
461
|
+
* Runs an IFC validator job to validate the active version of the file. This is alias to
|
|
441
462
|
* {@link createJob | createJob("validation")}.
|
|
442
463
|
*
|
|
443
464
|
* To get validation report use {@link downloadResource | downloadResource("validation_report.json")}.
|
|
444
465
|
*
|
|
445
|
-
* @param parameters - Parameters for the
|
|
446
|
-
*
|
|
466
|
+
* @param parameters - Parameters for the IFC validator tool. Can be given as command line arguments in
|
|
467
|
+
* form `--arg=value`.
|
|
447
468
|
*/
|
|
448
469
|
validate(parameters?: string | object): Promise<Job>;
|
|
449
470
|
/**
|
|
450
471
|
* Waits for jobs of the active version of the file to be done. Job is done when it changes to `none`,
|
|
451
472
|
* `done` or `failed` status.
|
|
452
473
|
*
|
|
453
|
-
* @param jobs - Job or job
|
|
454
|
-
* `validation`, `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job
|
|
474
|
+
* @param jobs - Job name or array of job names to wait on. Can be `geometry`, `geometryGltf`,
|
|
475
|
+
* `properties`, `validation`, `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job
|
|
476
|
+
* name.
|
|
455
477
|
* @param waitAll - If this parameter is `true`, the function returns when all the specified jobs have
|
|
456
478
|
* done. If `false`, the function returns when any one of the jobs are done.
|
|
457
479
|
* @param params - An object containing waiting parameters.
|
package/lib/Api/Job.d.ts
CHANGED
|
@@ -64,14 +64,21 @@ export declare class Job extends Endpoint {
|
|
|
64
64
|
*/
|
|
65
65
|
get lastUpdate(): string;
|
|
66
66
|
/**
|
|
67
|
-
* Job type. Can be
|
|
68
|
-
*
|
|
67
|
+
* Job type. Can be:
|
|
68
|
+
*
|
|
69
|
+
* - `geometry` - Convert file geometry data to `VSFX` format.
|
|
70
|
+
* - `geometryGltf` - Convert file geometry data to `glTF` format.
|
|
71
|
+
* - `properties` - Extract file properties.
|
|
72
|
+
* - `validation` - Validate the IFC file.
|
|
73
|
+
* - `clash` - Create the clash detection report.
|
|
74
|
+
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
|
|
75
|
+
* - Other custom job name.
|
|
69
76
|
*
|
|
70
77
|
* @readonly
|
|
71
78
|
*/
|
|
72
79
|
get outputFormat(): string;
|
|
73
80
|
/**
|
|
74
|
-
* Parameters with which the job
|
|
81
|
+
* Parameters with which the job was started. For more information, see
|
|
75
82
|
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#Jobs | Open Cloud Jobs API}.
|
|
76
83
|
*
|
|
77
84
|
* @readonly
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/client",
|
|
3
|
-
"version": "26.5.
|
|
3
|
+
"version": "26.5.5",
|
|
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": "~26.5.
|
|
29
|
+
"@inweb/eventemitter2": "~26.5.5"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/Api/Assembly.ts
CHANGED
|
@@ -105,7 +105,7 @@ export class Assembly extends Endpoint {
|
|
|
105
105
|
/**
|
|
106
106
|
* Assembly geometry data type:
|
|
107
107
|
*
|
|
108
|
-
* - `vsfx` - `VSFX` format, assembly can be opened in `VisualizeJS` viewer.
|
|
108
|
+
* - `vsfx` - `VSFX` format, assembly can be opened in `VisualizeJS` 3D viewer.
|
|
109
109
|
*
|
|
110
110
|
* Returns an empty string if the geometry data is not yet ready.
|
|
111
111
|
*/
|
|
@@ -279,7 +279,7 @@ export class Assembly extends Endpoint {
|
|
|
279
279
|
*
|
|
280
280
|
* @typedef {any} Properties
|
|
281
281
|
* @property {string} handle - Object original handle.
|
|
282
|
-
* @property {string | any} * - Object property. Can be `any` for nested properties.
|
|
282
|
+
* @property {string | any} * - Object property. Can be `any` for nested group properties.
|
|
283
283
|
*/
|
|
284
284
|
|
|
285
285
|
/**
|
|
@@ -287,10 +287,34 @@ export class Assembly extends Endpoint {
|
|
|
287
287
|
*
|
|
288
288
|
* @param handles - Object original handle or handles array. Specify `undefined` to get properties for
|
|
289
289
|
* all objects in the assembly.
|
|
290
|
+
* @param group - If the `group` parameter is `true`, properties are returned grouped by category. By
|
|
291
|
+
* default, or if `group` is set to `false`, properties are returned ungrouped.
|
|
292
|
+
*
|
|
293
|
+
* To get grouped properties, the `--properties_group` command line argument must be specified for the
|
|
294
|
+
* `properties` File Converter job when {@link Client.createAssembly | creating the assembly}.
|
|
295
|
+
*
|
|
296
|
+
* ```javascript
|
|
297
|
+
* await client.createAssembly([file1.id, file2.id], "AssemblyName", {
|
|
298
|
+
* jobParameters: { properties: "--properties_group" },
|
|
299
|
+
* waitForDone: true,
|
|
300
|
+
* });
|
|
301
|
+
* ```
|
|
302
|
+
*
|
|
303
|
+
* Otherwise, the properties will be returned ungrouped, even if the `group` is `true`.
|
|
290
304
|
*/
|
|
291
|
-
getProperties(handles?: string | string[]): Promise<any[]> {
|
|
292
|
-
const
|
|
293
|
-
|
|
305
|
+
getProperties(handles?: string | string[], group = false): Promise<any[]> {
|
|
306
|
+
const searchParams = new URLSearchParams();
|
|
307
|
+
if (handles) {
|
|
308
|
+
if (Array.isArray(handles)) handles = handles.join(",");
|
|
309
|
+
if (typeof handles === "string") handles = handles.trim();
|
|
310
|
+
if (handles) searchParams.set("handles", handles);
|
|
311
|
+
}
|
|
312
|
+
if (group) searchParams.set("group", "true");
|
|
313
|
+
|
|
314
|
+
let queryString = searchParams.toString();
|
|
315
|
+
if (queryString) queryString = "?" + queryString;
|
|
316
|
+
|
|
317
|
+
return this.get(`/properties${queryString}`).then((response) => response.json());
|
|
294
318
|
}
|
|
295
319
|
|
|
296
320
|
/**
|
package/src/Api/Client.ts
CHANGED
|
@@ -605,13 +605,17 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
605
605
|
* generally retrieved from a {@link https://developer.mozilla.org/docs/Web/API/FileList | FileList}
|
|
606
606
|
* object returned as a result of a user selecting files using the HTML `<input>` element.
|
|
607
607
|
* @param params - An object containing upload parameters.
|
|
608
|
-
* @param params.geometry -
|
|
608
|
+
* @param params.geometry - Run File Converter job to convert geometry data after uploading the file.
|
|
609
|
+
* Can be:
|
|
609
610
|
*
|
|
610
|
-
* - `true` - Convert file geometry data to `VSFX` format
|
|
611
|
-
* - `vsfx` - Convert file geometry data to `VSFX` format
|
|
612
|
-
* - `gltf` - Convert file geometry data to `glTF` format
|
|
611
|
+
* - `true` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
612
|
+
* - `vsfx` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
613
|
+
* - `gltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
613
614
|
*
|
|
614
|
-
* @param params.properties -
|
|
615
|
+
* @param params.properties - Run File Converter job to extract properties after uploading the file.
|
|
616
|
+
* @param params.jobParameters - Parameters for the File Converter jobs. Use this to specify aditional
|
|
617
|
+
* parameters for retrieving the geometry and properties of uploaded file. Can be given as command
|
|
618
|
+
* line arguments in form `--arg=value`.
|
|
615
619
|
* @param params.waitForDone - Wait for geometry and properties jobs to complete.
|
|
616
620
|
* @param params.timeout - The time, in milliseconds that the function should wait jobs. If no one jobs
|
|
617
621
|
* are done during this time, the `TimeoutError` exception will be thrown.
|
|
@@ -627,6 +631,10 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
627
631
|
params: {
|
|
628
632
|
geometry?: boolean | string;
|
|
629
633
|
properties?: boolean;
|
|
634
|
+
jobParameters?: {
|
|
635
|
+
geometry?: string | object;
|
|
636
|
+
properties?: string | object;
|
|
637
|
+
};
|
|
630
638
|
waitForDone?: boolean;
|
|
631
639
|
timeout?: number;
|
|
632
640
|
interval?: number;
|
|
@@ -647,10 +655,11 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
647
655
|
.then((data) => new File(data, this.httpClient));
|
|
648
656
|
|
|
649
657
|
const geometryType = typeof params.geometry === "string" ? params.geometry : "vsfx";
|
|
658
|
+
const jobParameters = params.jobParameters || {};
|
|
650
659
|
|
|
651
660
|
const jobs: string[] = [];
|
|
652
|
-
if (params.geometry) jobs.push((await result.extractGeometry(geometryType)).outputFormat);
|
|
653
|
-
if (params.properties) jobs.push((await result.extractProperties()).outputFormat);
|
|
661
|
+
if (params.geometry) jobs.push((await result.extractGeometry(geometryType, jobParameters.geometry)).outputFormat);
|
|
662
|
+
if (params.properties) jobs.push((await result.extractProperties(jobParameters.properties)).outputFormat);
|
|
654
663
|
if (jobs.length > 0)
|
|
655
664
|
if (params.waitForDone) await result.waitForDone(jobs, true, params);
|
|
656
665
|
else await result.checkout();
|
|
@@ -760,18 +769,17 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
760
769
|
* Runs a new job on the server for the sepecified file.
|
|
761
770
|
*
|
|
762
771
|
* @param fileId - File ID.
|
|
763
|
-
* @param outputFormat - The job type. Can be
|
|
772
|
+
* @param outputFormat - The job type. Can be:
|
|
764
773
|
*
|
|
765
|
-
* - `geometry` - Convert file geometry data to `VSFX` format
|
|
766
|
-
* - `geometryGltf` - Convert file geometry data to `glTF` format
|
|
774
|
+
* - `geometry` - Convert file geometry data to `VSFX` format for opening in `VisualizeJS` 3D viewer.
|
|
775
|
+
* - `geometryGltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
767
776
|
* - `properties` - Extract file properties.
|
|
768
|
-
* - `validation` - Validate the
|
|
769
|
-
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the
|
|
770
|
-
* - Other custom job name. Custom job
|
|
771
|
-
* creating a job.
|
|
777
|
+
* - `validation` - Validate the IFC file.
|
|
778
|
+
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
|
|
779
|
+
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
772
780
|
*
|
|
773
|
-
* @param parameters - Parameters for the job
|
|
774
|
-
*
|
|
781
|
+
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as command
|
|
782
|
+
* line arguments in form `--arg=value`.
|
|
775
783
|
*/
|
|
776
784
|
createJob(fileId: string, outputFormat: string, parameters?: string | object): Promise<Job> {
|
|
777
785
|
return this.httpClient
|
|
@@ -877,6 +885,9 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
877
885
|
* @param files - List of file IDs.
|
|
878
886
|
* @param name - Assembly name.
|
|
879
887
|
* @param params - Additional assembly creating parameters.
|
|
888
|
+
* @param params.jobParameters - Parameters for the File Converter jobs. Use this to specify aditional
|
|
889
|
+
* parameters for generating the geometry and properties of the new assembly. Can be given as command
|
|
890
|
+
* line arguments in form `--arg=value`.
|
|
880
891
|
* @param params.waitForDone - Wait for assembly to be created.
|
|
881
892
|
* @param params.timeout - The time, in milliseconds, that the function should wait for the assembly to
|
|
882
893
|
* be created. If the assembly is not created within this time, a TimeoutError exception will be
|
|
@@ -891,20 +902,31 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
891
902
|
createAssembly(
|
|
892
903
|
files: string[],
|
|
893
904
|
name: string,
|
|
894
|
-
params
|
|
905
|
+
params: {
|
|
906
|
+
jobParameters?: {
|
|
907
|
+
geometry?: string | object;
|
|
908
|
+
properties?: string | object;
|
|
909
|
+
};
|
|
895
910
|
waitForDone?: boolean;
|
|
896
911
|
timeout?: number;
|
|
897
912
|
interval?: number;
|
|
898
913
|
signal?: AbortSignal;
|
|
899
914
|
onCheckout?: (assembly: Assembly, ready: boolean) => boolean;
|
|
900
|
-
}
|
|
915
|
+
} = {}
|
|
901
916
|
): Promise<Assembly> {
|
|
902
|
-
const
|
|
917
|
+
const jobParameters = params.jobParameters || {};
|
|
903
918
|
return this.httpClient
|
|
904
|
-
.post("/assemblies", {
|
|
919
|
+
.post("/assemblies", {
|
|
920
|
+
name,
|
|
921
|
+
files,
|
|
922
|
+
jobParameters: {
|
|
923
|
+
geometry: parseArgs(jobParameters.geometry),
|
|
924
|
+
properties: parseArgs(jobParameters.properties),
|
|
925
|
+
},
|
|
926
|
+
})
|
|
905
927
|
.then((response) => response.json())
|
|
906
928
|
.then((data) => new Assembly(data, this.httpClient))
|
|
907
|
-
.then((result) => (waitForDone ? result.waitForDone(params) : result));
|
|
929
|
+
.then((result) => (params.waitForDone ? result.waitForDone(params) : result));
|
|
908
930
|
}
|
|
909
931
|
|
|
910
932
|
/**
|