@inweb/client 25.9.4 → 25.9.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 +73 -5
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +29 -2
- package/dist/client.module.js.map +1 -1
- package/lib/Api/FetchError.d.ts +8 -2
- package/lib/Api/File.d.ts +1 -1
- package/lib/Api/IFile.d.ts +44 -3
- package/lib/Api/Permission.d.ts +11 -0
- package/lib/Api/Project.d.ts +32 -2
- package/lib/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/Api/FetchError.ts +9 -2
- package/src/Api/File.ts +1 -1
- package/src/Api/IFile.ts +52 -3
- package/src/Api/Permission.ts +11 -0
- package/src/Api/Project.ts +69 -2
- package/src/index.ts +1 -1
package/dist/client.js
CHANGED
|
@@ -1706,6 +1706,17 @@
|
|
|
1706
1706
|
/**
|
|
1707
1707
|
* Updates permission data on the server.
|
|
1708
1708
|
*
|
|
1709
|
+
* @example <caption>Update file permissions for the the specified project.</caption>
|
|
1710
|
+
* const myFile = client.getFile(myFileId);
|
|
1711
|
+
* const permissions = await myFile.getPermissions();
|
|
1712
|
+
* const projectPermissions = permissions.filter((permission) =>
|
|
1713
|
+
* permission.grantedTo.some((x) => x.project?.id === myProjectId)
|
|
1714
|
+
* );
|
|
1715
|
+
* const newActions = ["read", "readSourceFile", "update"];
|
|
1716
|
+
* await Promise.allSettled(
|
|
1717
|
+
* projectPermissions.map((permission) => permission.update({ newActions }))
|
|
1718
|
+
* );
|
|
1719
|
+
*
|
|
1709
1720
|
* @param data - Raw permission data.
|
|
1710
1721
|
*/
|
|
1711
1722
|
async update(data) {
|
|
@@ -2633,7 +2644,7 @@
|
|
|
2633
2644
|
.then((data) => new Permission(data, this.id, this.httpClient));
|
|
2634
2645
|
}
|
|
2635
2646
|
/**
|
|
2636
|
-
* Creates a new file permission.
|
|
2647
|
+
* Creates a new file permission for a user, project, or group.
|
|
2637
2648
|
*
|
|
2638
2649
|
* @example <caption>Grant the specified user permission to "update" the file.</caption>
|
|
2639
2650
|
* const action = "update";
|
|
@@ -3382,7 +3393,7 @@
|
|
|
3382
3393
|
.then((data) => new Member(data, this.id, this.httpClient));
|
|
3383
3394
|
}
|
|
3384
3395
|
/**
|
|
3385
|
-
*
|
|
3396
|
+
* Adds a user to the project to become a member and have permission to perform actions.
|
|
3386
3397
|
*
|
|
3387
3398
|
* @param userId - User ID.
|
|
3388
3399
|
* @param role - Role name from the list of project {@link getRoles | roles}.
|
|
@@ -3393,7 +3404,7 @@
|
|
|
3393
3404
|
.then((data) => new Member(data, this.id, this.httpClient));
|
|
3394
3405
|
}
|
|
3395
3406
|
/**
|
|
3396
|
-
*
|
|
3407
|
+
* Removes the specified member from a project.
|
|
3397
3408
|
*
|
|
3398
3409
|
* @param memberId - Member ID.
|
|
3399
3410
|
* @returns Returns the raw data of a deleted member.
|
|
@@ -3462,6 +3473,63 @@
|
|
|
3462
3473
|
return items;
|
|
3463
3474
|
});
|
|
3464
3475
|
}
|
|
3476
|
+
/**
|
|
3477
|
+
* Returns a list of project models.
|
|
3478
|
+
*/
|
|
3479
|
+
getModels() {
|
|
3480
|
+
return this.getFilesInformation()
|
|
3481
|
+
.then((filesInformation) => filesInformation.map((item) => item.file.reference))
|
|
3482
|
+
.then((ids) => {
|
|
3483
|
+
const searchParams = new URLSearchParams();
|
|
3484
|
+
searchParams.set("id", ids.join("|"));
|
|
3485
|
+
return this.httpClient.get(`/files?${searchParams.toString()}`);
|
|
3486
|
+
})
|
|
3487
|
+
.then((response) => response.json())
|
|
3488
|
+
.then((files) => files.result.map((data) => new File(data, this.httpClient)));
|
|
3489
|
+
}
|
|
3490
|
+
/**
|
|
3491
|
+
* Adds a file to the project with specified permissions.
|
|
3492
|
+
*
|
|
3493
|
+
* To change file permissions for the project use {@link Permission.update | Permissions.update()}.
|
|
3494
|
+
*
|
|
3495
|
+
* @param fileId - File ID.
|
|
3496
|
+
* @param actions - Actions are allowed to be performed on a file:
|
|
3497
|
+
*
|
|
3498
|
+
* - `read` - The ability to read file description, geometry data and properties.
|
|
3499
|
+
* - `readSourceFile` - The ability to read source file.
|
|
3500
|
+
* - `write` - The ability to modify file name, description and references.
|
|
3501
|
+
* - `readViewpoint` - The ability to read file viewpoints.
|
|
3502
|
+
* - `createViewpoint` - The ability to create file viewpoints.
|
|
3503
|
+
*
|
|
3504
|
+
* @param _public - Specifies whether all users have access to the file or not.
|
|
3505
|
+
* @returns Returns a file instance added to the project.
|
|
3506
|
+
*/
|
|
3507
|
+
async addModel(fileId, actions, _public) {
|
|
3508
|
+
const file = await this.httpClient
|
|
3509
|
+
.get(`/files/${fileId}`)
|
|
3510
|
+
.then((response) => response.json())
|
|
3511
|
+
.then((data) => new File(data, this.httpClient));
|
|
3512
|
+
const grantedTo = [{ project: { id: this.id, name: this.name } }];
|
|
3513
|
+
await file.createPermission(actions, grantedTo, _public);
|
|
3514
|
+
return file;
|
|
3515
|
+
}
|
|
3516
|
+
/**
|
|
3517
|
+
* Removes the specified file from a project.
|
|
3518
|
+
*
|
|
3519
|
+
* @param fileId - File ID.
|
|
3520
|
+
* @returns Returns a file instance removed from the project.
|
|
3521
|
+
*/
|
|
3522
|
+
async removeModel(fileId) {
|
|
3523
|
+
const file = await this.httpClient
|
|
3524
|
+
.get(`/files/${fileId}`)
|
|
3525
|
+
.then((response) => response.json())
|
|
3526
|
+
.then((data) => new File(data, this.httpClient));
|
|
3527
|
+
const permissions = await file.getPermissions();
|
|
3528
|
+
await Promise.allSettled(permissions
|
|
3529
|
+
.filter((permission) => permission.grantedTo.some((x) => { var _a; return ((_a = x.project) === null || _a === void 0 ? void 0 : _a.id) === this.id; }))
|
|
3530
|
+
.map((permission) => permission.delete()));
|
|
3531
|
+
return file;
|
|
3532
|
+
}
|
|
3465
3533
|
}
|
|
3466
3534
|
|
|
3467
3535
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -4003,7 +4071,7 @@
|
|
|
4003
4071
|
.then((data) => ({
|
|
4004
4072
|
...data,
|
|
4005
4073
|
server: data.version,
|
|
4006
|
-
client: "25.9.
|
|
4074
|
+
client: "25.9.5",
|
|
4007
4075
|
}));
|
|
4008
4076
|
}
|
|
4009
4077
|
/**
|
|
@@ -4718,7 +4786,7 @@
|
|
|
4718
4786
|
// By use of this software, its documentation or related materials, you
|
|
4719
4787
|
// acknowledge and accept the above terms.
|
|
4720
4788
|
///////////////////////////////////////////////////////////////////////////////
|
|
4721
|
-
const version = "25.9.
|
|
4789
|
+
const version = "25.9.5";
|
|
4722
4790
|
|
|
4723
4791
|
exports.Assembly = Assembly;
|
|
4724
4792
|
exports.ClashTest = ClashTest;
|