@inweb/client 27.1.0 → 27.1.2

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.
@@ -334,6 +334,7 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
334
334
  * @param params.signal - An
335
335
  * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal, which
336
336
  * can be used to abort waiting as desired.
337
+ * @param params.onCheckout - Waiting progress callback. Return `true` to cancel waiting.
337
338
  * @param params.onProgress - Upload progress callback.
338
339
  */
339
340
  uploadFile(file: globalThis.File, params?: {
@@ -347,6 +348,7 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
347
348
  timeout?: number;
348
349
  interval?: number;
349
350
  signal?: AbortSignal;
351
+ onCheckout?: (file: File, ready: boolean) => boolean;
350
352
  onProgress?: (progress: number, file: globalThis.File) => void;
351
353
  }): Promise<File>;
352
354
  /**
package/lib/Api/File.d.ts CHANGED
@@ -122,17 +122,21 @@ export declare class File extends Endpoint {
122
122
  */
123
123
  get sharedLinkToken(): string;
124
124
  /**
125
- * Data status of the active version of the file. Contains:
125
+ * Jobs status of the active version of the file. This is an object contains keys corresponding to
126
+ * different job types:
126
127
  *
127
- * - `geometry` - status of geometry data of `vsfx` type.
128
- * - `geometryGltf` - status of geometry data of `gltf` type.
129
- * - `properties` - status of properties.
130
- * - `validation` - status of validation.
128
+ * - `geometry` - status of geometry extraction job (`VSFX` format).
129
+ * - `geometryGltf` - status of geometry extraction job (`glTF` format).
130
+ * - `properties` - status of property extraction job .
131
+ * - `validation` - status of validation job .
132
+ *
133
+ * Export jobs (`dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf`) and custom jobs appear in the
134
+ * status object dynamically as jobs are started.
131
135
  *
132
136
  * Each status entity is a record with properties:
133
137
  *
134
- * - `state` - Data state. Can be `none`, `waiting`, `inprogress`, `done` or `failed`.
135
- * - `jobId` - Unique ID of the data job.
138
+ * - `state` - Job state. Can be `none`, `waiting`, `inprogress`, `done` or `failed`.
139
+ * - `jobId` - Unique ID of the job.
136
140
  *
137
141
  * @readonly
138
142
  */
@@ -482,7 +486,8 @@ export declare class File extends Endpoint {
482
486
  * jobs status.
483
487
  * @param params.signal - An
484
488
  * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal, which
485
- * can be used to abort waiting as desired.
489
+ * can be used to abort waiting as desired. If waiting has been aborted, the `AbortError` exception
490
+ * will be thrown.
486
491
  * @param params.onCheckout - Waiting progress callback. Return `true` to cancel waiting.
487
492
  */
488
493
  waitForDone(jobs: string | string[], waitAll?: boolean, params?: {
@@ -508,7 +513,7 @@ export declare class File extends Endpoint {
508
513
  *
509
514
  * ```javascript
510
515
  * const action = "update";
511
- * const grantedTo = [{ user: { id: myUser.id, email: myUser.email } }];
516
+ * const grantedTo = { user: { id: myUser.id, email: myUser.email } };
512
517
  * await file.createPermission(action, grantedTo);
513
518
  * ```
514
519
  *
@@ -516,7 +521,7 @@ export declare class File extends Endpoint {
516
521
  *
517
522
  * ```javascript
518
523
  * const actions = ["read", "readSourceFile"];
519
- * const grantedTo = [{ project: { id: myProject.id, name: myProject.name } }];
524
+ * const grantedTo = { project: { id: myProject.id, name: myProject.name } };
520
525
  * await file.createPermission(actions, grantedTo);
521
526
  * ```
522
527
  *
@@ -528,10 +533,10 @@ export declare class File extends Endpoint {
528
533
  * - `readViewpoint` - The ability to read file viewpoints.
529
534
  * - `createViewpoint` - The ability to create file viewpoints.
530
535
  *
531
- * @param grantedTo - A list of entities that will get access to the file.
536
+ * @param grantedTo - An entity or a list of entities that will get access to the file.
532
537
  * @param _public - Specifies whether all users have access to the file or not.
533
538
  */
534
- createPermission(actions: string | string[], grantedTo: IGrantedTo[], _public: boolean): Promise<Permission>;
539
+ createPermission(actions: string | string[], grantedTo: IGrantedTo | IGrantedTo[], _public?: boolean): Promise<Permission>;
535
540
  /**
536
541
  * Removes the specified permission from the file.
537
542
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/client",
3
- "version": "27.1.0",
3
+ "version": "27.1.2",
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,7 +26,7 @@
26
26
  "docs": "typedoc"
27
27
  },
28
28
  "dependencies": {
29
- "@inweb/eventemitter2": "~27.1.0"
29
+ "@inweb/eventemitter2": "~27.1.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "fflate": "^0.8.2"
package/src/Api/Client.ts CHANGED
@@ -629,6 +629,7 @@ export class Client extends EventEmitter2<ClientEventMap> {
629
629
  * @param params.signal - An
630
630
  * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal, which
631
631
  * can be used to abort waiting as desired.
632
+ * @param params.onCheckout - Waiting progress callback. Return `true` to cancel waiting.
632
633
  * @param params.onProgress - Upload progress callback.
633
634
  */
634
635
  async uploadFile(
@@ -644,6 +645,7 @@ export class Client extends EventEmitter2<ClientEventMap> {
644
645
  timeout?: number;
645
646
  interval?: number;
646
647
  signal?: AbortSignal;
648
+ onCheckout?: (file: File, ready: boolean) => boolean;
647
649
  onProgress?: (progress: number, file: globalThis.File) => void;
648
650
  } = {
649
651
  geometry: true,
package/src/Api/File.ts CHANGED
@@ -235,17 +235,21 @@ export class File extends Endpoint {
235
235
  }
236
236
 
237
237
  /**
238
- * Data status of the active version of the file. Contains:
238
+ * Jobs status of the active version of the file. This is an object contains keys corresponding to
239
+ * different job types:
239
240
  *
240
- * - `geometry` - status of geometry data of `vsfx` type.
241
- * - `geometryGltf` - status of geometry data of `gltf` type.
242
- * - `properties` - status of properties.
243
- * - `validation` - status of validation.
241
+ * - `geometry` - status of geometry extraction job (`VSFX` format).
242
+ * - `geometryGltf` - status of geometry extraction job (`glTF` format).
243
+ * - `properties` - status of property extraction job .
244
+ * - `validation` - status of validation job .
245
+ *
246
+ * Export jobs (`dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf`) and custom jobs appear in the
247
+ * status object dynamically as jobs are started.
244
248
  *
245
249
  * Each status entity is a record with properties:
246
250
  *
247
- * - `state` - Data state. Can be `none`, `waiting`, `inprogress`, `done` or `failed`.
248
- * - `jobId` - Unique ID of the data job.
251
+ * - `state` - Job state. Can be `none`, `waiting`, `inprogress`, `done` or `failed`.
252
+ * - `jobId` - Unique ID of the job.
249
253
  *
250
254
  * @readonly
251
255
  */
@@ -771,7 +775,8 @@ export class File extends Endpoint {
771
775
  * jobs status.
772
776
  * @param params.signal - An
773
777
  * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal, which
774
- * can be used to abort waiting as desired.
778
+ * can be used to abort waiting as desired. If waiting has been aborted, the `AbortError` exception
779
+ * will be thrown.
775
780
  * @param params.onCheckout - Waiting progress callback. Return `true` to cancel waiting.
776
781
  */
777
782
  waitForDone(
@@ -828,7 +833,7 @@ export class File extends Endpoint {
828
833
  *
829
834
  * ```javascript
830
835
  * const action = "update";
831
- * const grantedTo = [{ user: { id: myUser.id, email: myUser.email } }];
836
+ * const grantedTo = { user: { id: myUser.id, email: myUser.email } };
832
837
  * await file.createPermission(action, grantedTo);
833
838
  * ```
834
839
  *
@@ -836,7 +841,7 @@ export class File extends Endpoint {
836
841
  *
837
842
  * ```javascript
838
843
  * const actions = ["read", "readSourceFile"];
839
- * const grantedTo = [{ project: { id: myProject.id, name: myProject.name } }];
844
+ * const grantedTo = { project: { id: myProject.id, name: myProject.name } };
840
845
  * await file.createPermission(actions, grantedTo);
841
846
  * ```
842
847
  *
@@ -848,13 +853,17 @@ export class File extends Endpoint {
848
853
  * - `readViewpoint` - The ability to read file viewpoints.
849
854
  * - `createViewpoint` - The ability to create file viewpoints.
850
855
  *
851
- * @param grantedTo - A list of entities that will get access to the file.
856
+ * @param grantedTo - An entity or a list of entities that will get access to the file.
852
857
  * @param _public - Specifies whether all users have access to the file or not.
853
858
  */
854
- createPermission(actions: string | string[], grantedTo: IGrantedTo[], _public: boolean): Promise<Permission> {
859
+ createPermission(
860
+ actions: string | string[],
861
+ grantedTo: IGrantedTo | IGrantedTo[],
862
+ _public = false
863
+ ): Promise<Permission> {
855
864
  return this.post("/permissions", {
856
865
  actions: Array.isArray(actions) ? actions : [actions],
857
- grantedTo,
866
+ grantedTo: Array.isArray(grantedTo) ? grantedTo : [grantedTo],
858
867
  public: _public,
859
868
  })
860
869
  .then((response) => response.json())