@inweb/client 27.1.1 → 27.1.3
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 +4 -4
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +4 -4
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Client.d.ts +2 -0
- package/lib/Api/File.d.ts +4 -4
- package/package.json +2 -2
- package/src/Api/Client.ts +2 -0
- package/src/Api/File.ts +9 -5
package/lib/Api/Client.d.ts
CHANGED
|
@@ -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
|
@@ -513,7 +513,7 @@ export declare class File extends Endpoint {
|
|
|
513
513
|
*
|
|
514
514
|
* ```javascript
|
|
515
515
|
* const action = "update";
|
|
516
|
-
* const grantedTo =
|
|
516
|
+
* const grantedTo = { user: { id: myUser.id, email: myUser.email } };
|
|
517
517
|
* await file.createPermission(action, grantedTo);
|
|
518
518
|
* ```
|
|
519
519
|
*
|
|
@@ -521,7 +521,7 @@ export declare class File extends Endpoint {
|
|
|
521
521
|
*
|
|
522
522
|
* ```javascript
|
|
523
523
|
* const actions = ["read", "readSourceFile"];
|
|
524
|
-
* const grantedTo =
|
|
524
|
+
* const grantedTo = { project: { id: myProject.id, name: myProject.name } };
|
|
525
525
|
* await file.createPermission(actions, grantedTo);
|
|
526
526
|
* ```
|
|
527
527
|
*
|
|
@@ -533,10 +533,10 @@ export declare class File extends Endpoint {
|
|
|
533
533
|
* - `readViewpoint` - The ability to read file viewpoints.
|
|
534
534
|
* - `createViewpoint` - The ability to create file viewpoints.
|
|
535
535
|
*
|
|
536
|
-
* @param grantedTo -
|
|
536
|
+
* @param grantedTo - An entity or a list of entities that will get access to the file.
|
|
537
537
|
* @param _public - Specifies whether all users have access to the file or not.
|
|
538
538
|
*/
|
|
539
|
-
createPermission(actions: string | string[], grantedTo: IGrantedTo[], _public
|
|
539
|
+
createPermission(actions: string | string[], grantedTo: IGrantedTo | IGrantedTo[], _public?: boolean): Promise<Permission>;
|
|
540
540
|
/**
|
|
541
541
|
* Removes the specified permission from the file.
|
|
542
542
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/client",
|
|
3
|
-
"version": "27.1.
|
|
3
|
+
"version": "27.1.3",
|
|
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.
|
|
29
|
+
"@inweb/eventemitter2": "~27.1.3"
|
|
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
|
@@ -833,7 +833,7 @@ export class File extends Endpoint {
|
|
|
833
833
|
*
|
|
834
834
|
* ```javascript
|
|
835
835
|
* const action = "update";
|
|
836
|
-
* const grantedTo =
|
|
836
|
+
* const grantedTo = { user: { id: myUser.id, email: myUser.email } };
|
|
837
837
|
* await file.createPermission(action, grantedTo);
|
|
838
838
|
* ```
|
|
839
839
|
*
|
|
@@ -841,7 +841,7 @@ export class File extends Endpoint {
|
|
|
841
841
|
*
|
|
842
842
|
* ```javascript
|
|
843
843
|
* const actions = ["read", "readSourceFile"];
|
|
844
|
-
* const grantedTo =
|
|
844
|
+
* const grantedTo = { project: { id: myProject.id, name: myProject.name } };
|
|
845
845
|
* await file.createPermission(actions, grantedTo);
|
|
846
846
|
* ```
|
|
847
847
|
*
|
|
@@ -853,13 +853,17 @@ export class File extends Endpoint {
|
|
|
853
853
|
* - `readViewpoint` - The ability to read file viewpoints.
|
|
854
854
|
* - `createViewpoint` - The ability to create file viewpoints.
|
|
855
855
|
*
|
|
856
|
-
* @param grantedTo -
|
|
856
|
+
* @param grantedTo - An entity or a list of entities that will get access to the file.
|
|
857
857
|
* @param _public - Specifies whether all users have access to the file or not.
|
|
858
858
|
*/
|
|
859
|
-
createPermission(
|
|
859
|
+
createPermission(
|
|
860
|
+
actions: string | string[],
|
|
861
|
+
grantedTo: IGrantedTo | IGrantedTo[],
|
|
862
|
+
_public = false
|
|
863
|
+
): Promise<Permission> {
|
|
860
864
|
return this.post("/permissions", {
|
|
861
865
|
actions: Array.isArray(actions) ? actions : [actions],
|
|
862
|
-
grantedTo,
|
|
866
|
+
grantedTo: Array.isArray(grantedTo) ? grantedTo : [grantedTo],
|
|
863
867
|
public: _public,
|
|
864
868
|
})
|
|
865
869
|
.then((response) => response.json())
|