@inweb/client 26.5.4 → 26.5.6
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 +82 -20
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +24 -8
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Assembly.d.ts +16 -2
- package/lib/Api/Client.d.ts +4 -4
- package/lib/Api/File.d.ts +30 -8
- package/package.json +2 -2
- package/src/Api/Assembly.ts +28 -4
- package/src/Api/Client.ts +4 -4
- package/src/Api/File.ts +43 -11
package/lib/Api/Assembly.d.ts
CHANGED
|
@@ -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
|
@@ -320,7 +320,7 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
320
320
|
* - `gltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
321
321
|
*
|
|
322
322
|
* @param params.properties - Run File Converter job to extract properties after uploading the file.
|
|
323
|
-
* @param params.jobParameters - Parameters for the File Converter
|
|
323
|
+
* @param params.jobParameters - Parameters for the File Converter jobs. Use this to specify aditional
|
|
324
324
|
* parameters for retrieving the geometry and properties of uploaded file. Can be given as command
|
|
325
325
|
* line arguments in form `--arg=value`.
|
|
326
326
|
* @param params.waitForDone - Wait for geometry and properties jobs to complete.
|
|
@@ -413,8 +413,8 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
413
413
|
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
|
|
414
414
|
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
415
415
|
*
|
|
416
|
-
* @param parameters - Parameters for the File Converter
|
|
417
|
-
*
|
|
416
|
+
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as command
|
|
417
|
+
* line arguments in form `--arg=value`.
|
|
418
418
|
*/
|
|
419
419
|
createJob(fileId: string, outputFormat: string, parameters?: string | object): Promise<Job>;
|
|
420
420
|
/**
|
|
@@ -467,7 +467,7 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
|
|
|
467
467
|
* @param files - List of file IDs.
|
|
468
468
|
* @param name - Assembly name.
|
|
469
469
|
* @param params - Additional assembly creating parameters.
|
|
470
|
-
* @param params.jobParameters - Parameters for the File Converter
|
|
470
|
+
* @param params.jobParameters - Parameters for the File Converter jobs. Use this to specify aditional
|
|
471
471
|
* parameters for generating the geometry and properties of the new assembly. Can be given as command
|
|
472
472
|
* line arguments in form `--arg=value`.
|
|
473
473
|
* @param params.waitForDone - Wait for assembly to be created.
|
package/lib/Api/File.d.ts
CHANGED
|
@@ -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
|
*
|
|
@@ -410,8 +432,8 @@ export declare class File extends Endpoint {
|
|
|
410
432
|
* {@link downloadResource | downloadResource()} to download the exported file.
|
|
411
433
|
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
412
434
|
*
|
|
413
|
-
* @param parameters - Parameters for the File Converter
|
|
414
|
-
*
|
|
435
|
+
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as command
|
|
436
|
+
* line arguments in form `--arg=value`.
|
|
415
437
|
*/
|
|
416
438
|
createJob(outputFormat: string, parameters?: string | object): Promise<Job>;
|
|
417
439
|
/**
|
|
@@ -423,16 +445,16 @@ export declare class File extends Endpoint {
|
|
|
423
445
|
* - `vsfx` - `VSFX` format (default), for opening a file in `VisualizeJS` 3D viewer.
|
|
424
446
|
* - `gltf` - `glTF` format, for opening a file in `Three.js` 3D viewer.
|
|
425
447
|
*
|
|
426
|
-
* @param parameters - Parameters for the File Converter
|
|
427
|
-
*
|
|
448
|
+
* @param parameters - Parameters for the File Converter job. Can be given as command line arguments in
|
|
449
|
+
* form `--arg=value`.
|
|
428
450
|
*/
|
|
429
451
|
extractGeometry(type?: string, parameters?: string | object): Promise<Job>;
|
|
430
452
|
/**
|
|
431
453
|
* Runs a File Converter job to extract properties of the active version of the file. This is alias to
|
|
432
454
|
* {@link createJob | createJob("properties")}.
|
|
433
455
|
*
|
|
434
|
-
* @param parameters - Parameters for the File Converter
|
|
435
|
-
*
|
|
456
|
+
* @param parameters - Parameters for the File Converter job. Can be given as command line arguments in
|
|
457
|
+
* form `--arg=value`.
|
|
436
458
|
*/
|
|
437
459
|
extractProperties(parameters?: string | object): Promise<Job>;
|
|
438
460
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/client",
|
|
3
|
-
"version": "26.5.
|
|
3
|
+
"version": "26.5.6",
|
|
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.6"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/Api/Assembly.ts
CHANGED
|
@@ -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
|
@@ -613,7 +613,7 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
613
613
|
* - `gltf` - Convert file geometry data to `glTF` format for opening in `Three.js` 3D viewer.
|
|
614
614
|
*
|
|
615
615
|
* @param params.properties - Run File Converter job to extract properties after uploading the file.
|
|
616
|
-
* @param params.jobParameters - Parameters for the File Converter
|
|
616
|
+
* @param params.jobParameters - Parameters for the File Converter jobs. Use this to specify aditional
|
|
617
617
|
* parameters for retrieving the geometry and properties of uploaded file. Can be given as command
|
|
618
618
|
* line arguments in form `--arg=value`.
|
|
619
619
|
* @param params.waitForDone - Wait for geometry and properties jobs to complete.
|
|
@@ -778,8 +778,8 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
778
778
|
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
|
|
779
779
|
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
780
780
|
*
|
|
781
|
-
* @param parameters - Parameters for the File Converter
|
|
782
|
-
*
|
|
781
|
+
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as command
|
|
782
|
+
* line arguments in form `--arg=value`.
|
|
783
783
|
*/
|
|
784
784
|
createJob(fileId: string, outputFormat: string, parameters?: string | object): Promise<Job> {
|
|
785
785
|
return this.httpClient
|
|
@@ -885,7 +885,7 @@ export class Client extends EventEmitter2<ClientEventMap> {
|
|
|
885
885
|
* @param files - List of file IDs.
|
|
886
886
|
* @param name - Assembly name.
|
|
887
887
|
* @param params - Additional assembly creating parameters.
|
|
888
|
-
* @param params.jobParameters - Parameters for the File Converter
|
|
888
|
+
* @param params.jobParameters - Parameters for the File Converter jobs. Use this to specify aditional
|
|
889
889
|
* parameters for generating the geometry and properties of the new assembly. Can be given as command
|
|
890
890
|
* line arguments in form `--arg=value`.
|
|
891
891
|
* @param params.waitForDone - Wait for assembly to be created.
|
package/src/Api/File.ts
CHANGED
|
@@ -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
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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
|
/**
|
|
@@ -669,8 +701,8 @@ export class File extends Endpoint {
|
|
|
669
701
|
* {@link downloadResource | downloadResource()} to download the exported file.
|
|
670
702
|
* - Other custom job name. Custom job must be registered in the job templates before running.
|
|
671
703
|
*
|
|
672
|
-
* @param parameters - Parameters for the File Converter
|
|
673
|
-
*
|
|
704
|
+
* @param parameters - Parameters for the File Converter jobs or custom job. Can be given as command
|
|
705
|
+
* line arguments in form `--arg=value`.
|
|
674
706
|
*/
|
|
675
707
|
createJob(outputFormat: string, parameters?: string | object): Promise<Job> {
|
|
676
708
|
const jobs = new Endpoint("/jobs", this.httpClient, this.headers);
|
|
@@ -693,8 +725,8 @@ export class File extends Endpoint {
|
|
|
693
725
|
* - `vsfx` - `VSFX` format (default), for opening a file in `VisualizeJS` 3D viewer.
|
|
694
726
|
* - `gltf` - `glTF` format, for opening a file in `Three.js` 3D viewer.
|
|
695
727
|
*
|
|
696
|
-
* @param parameters - Parameters for the File Converter
|
|
697
|
-
*
|
|
728
|
+
* @param parameters - Parameters for the File Converter job. Can be given as command line arguments in
|
|
729
|
+
* form `--arg=value`.
|
|
698
730
|
*/
|
|
699
731
|
extractGeometry(type?: string, parameters?: string | object): Promise<Job> {
|
|
700
732
|
return this.createJob(type === "gltf" ? "geometryGltf" : "geometry", parameters);
|
|
@@ -704,8 +736,8 @@ export class File extends Endpoint {
|
|
|
704
736
|
* Runs a File Converter job to extract properties of the active version of the file. This is alias to
|
|
705
737
|
* {@link createJob | createJob("properties")}.
|
|
706
738
|
*
|
|
707
|
-
* @param parameters - Parameters for the File Converter
|
|
708
|
-
*
|
|
739
|
+
* @param parameters - Parameters for the File Converter job. Can be given as command line arguments in
|
|
740
|
+
* form `--arg=value`.
|
|
709
741
|
*/
|
|
710
742
|
extractProperties(parameters?: string | object): Promise<Job> {
|
|
711
743
|
return this.createJob("properties", parameters);
|