@inweb/client 25.9.4 → 25.9.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 +91 -8
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +35 -7
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Assembly.d.ts +12 -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/Assembly.ts +21 -4
- 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
|
@@ -1108,9 +1108,24 @@
|
|
|
1108
1108
|
async downloadFileRange(requestId, records, dataId, onProgress, signal) {
|
|
1109
1109
|
await this.downloadResourceRange(dataId, requestId, records, onProgress, signal);
|
|
1110
1110
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1111
|
+
/**
|
|
1112
|
+
* Returns a list of assembly references containing references from all the files from which
|
|
1113
|
+
* the assembly was created.
|
|
1114
|
+
*
|
|
1115
|
+
* References are images, fonts, or any other files to correct rendering of the assembly.
|
|
1116
|
+
*
|
|
1117
|
+
* @param signal - An
|
|
1118
|
+
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
|
|
1119
|
+
* signal, which can be used to abort waiting as desired.
|
|
1120
|
+
*/
|
|
1121
|
+
async getReferences(signal) {
|
|
1122
|
+
const references = await Promise.all(this.associatedFiles
|
|
1123
|
+
.map((file) => `/files/${file.fileId}/references`)
|
|
1124
|
+
.map((link) => this.httpClient.get(link, signal).then((response) => response.json())))
|
|
1125
|
+
.then((references) => references.map((x) => x.references))
|
|
1126
|
+
.then((references) => references.reduce((x, v) => [...v, ...x], []))
|
|
1127
|
+
.then((references) => [...new Set(references.map(JSON.stringify))].map((x) => JSON.parse(x)));
|
|
1128
|
+
return { id: "", references };
|
|
1114
1129
|
}
|
|
1115
1130
|
/**
|
|
1116
1131
|
* Waits for assembly to be created. Assembly is created when it changes to `done` or `failed` status.
|
|
@@ -1706,6 +1721,17 @@
|
|
|
1706
1721
|
/**
|
|
1707
1722
|
* Updates permission data on the server.
|
|
1708
1723
|
*
|
|
1724
|
+
* @example <caption>Update file permissions for the the specified project.</caption>
|
|
1725
|
+
* const myFile = client.getFile(myFileId);
|
|
1726
|
+
* const permissions = await myFile.getPermissions();
|
|
1727
|
+
* const projectPermissions = permissions.filter((permission) =>
|
|
1728
|
+
* permission.grantedTo.some((x) => x.project?.id === myProjectId)
|
|
1729
|
+
* );
|
|
1730
|
+
* const newActions = ["read", "readSourceFile", "update"];
|
|
1731
|
+
* await Promise.allSettled(
|
|
1732
|
+
* projectPermissions.map((permission) => permission.update({ newActions }))
|
|
1733
|
+
* );
|
|
1734
|
+
*
|
|
1709
1735
|
* @param data - Raw permission data.
|
|
1710
1736
|
*/
|
|
1711
1737
|
async update(data) {
|
|
@@ -2633,7 +2659,7 @@
|
|
|
2633
2659
|
.then((data) => new Permission(data, this.id, this.httpClient));
|
|
2634
2660
|
}
|
|
2635
2661
|
/**
|
|
2636
|
-
* Creates a new file permission.
|
|
2662
|
+
* Creates a new file permission for a user, project, or group.
|
|
2637
2663
|
*
|
|
2638
2664
|
* @example <caption>Grant the specified user permission to "update" the file.</caption>
|
|
2639
2665
|
* const action = "update";
|
|
@@ -3382,7 +3408,7 @@
|
|
|
3382
3408
|
.then((data) => new Member(data, this.id, this.httpClient));
|
|
3383
3409
|
}
|
|
3384
3410
|
/**
|
|
3385
|
-
*
|
|
3411
|
+
* Adds a user to the project to become a member and have permission to perform actions.
|
|
3386
3412
|
*
|
|
3387
3413
|
* @param userId - User ID.
|
|
3388
3414
|
* @param role - Role name from the list of project {@link getRoles | roles}.
|
|
@@ -3393,7 +3419,7 @@
|
|
|
3393
3419
|
.then((data) => new Member(data, this.id, this.httpClient));
|
|
3394
3420
|
}
|
|
3395
3421
|
/**
|
|
3396
|
-
*
|
|
3422
|
+
* Removes the specified member from a project.
|
|
3397
3423
|
*
|
|
3398
3424
|
* @param memberId - Member ID.
|
|
3399
3425
|
* @returns Returns the raw data of a deleted member.
|
|
@@ -3462,6 +3488,63 @@
|
|
|
3462
3488
|
return items;
|
|
3463
3489
|
});
|
|
3464
3490
|
}
|
|
3491
|
+
/**
|
|
3492
|
+
* Returns a list of project models.
|
|
3493
|
+
*/
|
|
3494
|
+
getModels() {
|
|
3495
|
+
return this.getFilesInformation()
|
|
3496
|
+
.then((filesInformation) => filesInformation.map((item) => item.file.reference))
|
|
3497
|
+
.then((ids) => {
|
|
3498
|
+
const searchParams = new URLSearchParams();
|
|
3499
|
+
searchParams.set("id", ids.join("|"));
|
|
3500
|
+
return this.httpClient.get(`/files?${searchParams.toString()}`);
|
|
3501
|
+
})
|
|
3502
|
+
.then((response) => response.json())
|
|
3503
|
+
.then((files) => files.result.map((data) => new File(data, this.httpClient)));
|
|
3504
|
+
}
|
|
3505
|
+
/**
|
|
3506
|
+
* Adds a file to the project with specified permissions.
|
|
3507
|
+
*
|
|
3508
|
+
* To change file permissions for the project use {@link Permission.update | Permissions.update()}.
|
|
3509
|
+
*
|
|
3510
|
+
* @param fileId - File ID.
|
|
3511
|
+
* @param actions - Actions are allowed to be performed on a file:
|
|
3512
|
+
*
|
|
3513
|
+
* - `read` - The ability to read file description, geometry data and properties.
|
|
3514
|
+
* - `readSourceFile` - The ability to read source file.
|
|
3515
|
+
* - `write` - The ability to modify file name, description and references.
|
|
3516
|
+
* - `readViewpoint` - The ability to read file viewpoints.
|
|
3517
|
+
* - `createViewpoint` - The ability to create file viewpoints.
|
|
3518
|
+
*
|
|
3519
|
+
* @param _public - Specifies whether all users have access to the file or not.
|
|
3520
|
+
* @returns Returns a file instance added to the project.
|
|
3521
|
+
*/
|
|
3522
|
+
async addModel(fileId, actions, _public) {
|
|
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 grantedTo = [{ project: { id: this.id, name: this.name } }];
|
|
3528
|
+
await file.createPermission(actions, grantedTo, _public);
|
|
3529
|
+
return file;
|
|
3530
|
+
}
|
|
3531
|
+
/**
|
|
3532
|
+
* Removes the specified file from a project.
|
|
3533
|
+
*
|
|
3534
|
+
* @param fileId - File ID.
|
|
3535
|
+
* @returns Returns a file instance removed from the project.
|
|
3536
|
+
*/
|
|
3537
|
+
async removeModel(fileId) {
|
|
3538
|
+
const file = await this.httpClient
|
|
3539
|
+
.get(`/files/${fileId}`)
|
|
3540
|
+
.then((response) => response.json())
|
|
3541
|
+
.then((data) => new File(data, this.httpClient));
|
|
3542
|
+
const permissions = await file.getPermissions();
|
|
3543
|
+
await Promise.allSettled(permissions
|
|
3544
|
+
.filter((permission) => permission.grantedTo.some((x) => { var _a; return ((_a = x.project) === null || _a === void 0 ? void 0 : _a.id) === this.id; }))
|
|
3545
|
+
.map((permission) => permission.delete()));
|
|
3546
|
+
return file;
|
|
3547
|
+
}
|
|
3465
3548
|
}
|
|
3466
3549
|
|
|
3467
3550
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -4003,7 +4086,7 @@
|
|
|
4003
4086
|
.then((data) => ({
|
|
4004
4087
|
...data,
|
|
4005
4088
|
server: data.version,
|
|
4006
|
-
client: "25.9.
|
|
4089
|
+
client: "25.9.6",
|
|
4007
4090
|
}));
|
|
4008
4091
|
}
|
|
4009
4092
|
/**
|
|
@@ -4718,7 +4801,7 @@
|
|
|
4718
4801
|
// By use of this software, its documentation or related materials, you
|
|
4719
4802
|
// acknowledge and accept the above terms.
|
|
4720
4803
|
///////////////////////////////////////////////////////////////////////////////
|
|
4721
|
-
const version = "25.9.
|
|
4804
|
+
const version = "25.9.6";
|
|
4722
4805
|
|
|
4723
4806
|
exports.Assembly = Assembly;
|
|
4724
4807
|
exports.ClashTest = ClashTest;
|