@inweb/client 25.6.2 → 25.6.4
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 +74 -36
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +30 -5
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Client.d.ts +12 -12
- package/lib/Api/File.d.ts +2 -1
- package/lib/Api/Job.d.ts +2 -2
- package/lib/Api/Project.d.ts +2 -1
- package/lib/Api/User.d.ts +30 -15
- package/package.json +2 -2
- package/src/Api/Client.ts +12 -12
- package/src/Api/File.ts +5 -2
- package/src/Api/Job.ts +2 -2
- package/src/Api/Project.ts +5 -2
- package/src/Api/User.ts +47 -16
package/dist/client.js
CHANGED
|
@@ -1836,8 +1836,8 @@
|
|
|
1836
1836
|
/**
|
|
1837
1837
|
* Update job data on the server.
|
|
1838
1838
|
*
|
|
1839
|
-
* Only
|
|
1840
|
-
*
|
|
1839
|
+
* Only administrators can update job data, if the current logged in user is not an
|
|
1840
|
+
* administrator, an exception will be thrown.
|
|
1841
1841
|
*
|
|
1842
1842
|
* @async
|
|
1843
1843
|
* @param data - Raw job data.
|
|
@@ -1968,7 +1968,9 @@
|
|
|
1968
1968
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1969
1969
|
var _m, _o, _p, _q, _r, _s, _t, _u;
|
|
1970
1970
|
this._data = value;
|
|
1971
|
-
this._data.previewUrl = value.preview
|
|
1971
|
+
this._data.previewUrl = value.preview
|
|
1972
|
+
? `${this.httpClient.serverUrl}${this.path}/preview?updated=${value.updatedAt}`
|
|
1973
|
+
: "";
|
|
1972
1974
|
// owner since 24.8
|
|
1973
1975
|
if (typeof this._data.owner === "string")
|
|
1974
1976
|
this._data.owner = { userId: this._data.owner };
|
|
@@ -2060,7 +2062,8 @@
|
|
|
2060
2062
|
return this.data.owner;
|
|
2061
2063
|
}
|
|
2062
2064
|
/**
|
|
2063
|
-
* File preview image URL
|
|
2065
|
+
* File preview image URL or empty string if the file does not have a preview. Use
|
|
2066
|
+
* {@link File.setPreview | setPreview()} to change preview image.
|
|
2064
2067
|
*
|
|
2065
2068
|
* @readonly
|
|
2066
2069
|
*/
|
|
@@ -3052,7 +3055,9 @@
|
|
|
3052
3055
|
}
|
|
3053
3056
|
set data(value) {
|
|
3054
3057
|
this._data = value;
|
|
3055
|
-
this._data.previewUrl = value.avatarUrl
|
|
3058
|
+
this._data.previewUrl = value.avatarUrl
|
|
3059
|
+
? `${this.httpClient.serverUrl}/projects/${this._data.id}/preview?updated=${value.updatedAt}`
|
|
3060
|
+
: "";
|
|
3056
3061
|
this._data.owner.avatarUrl = `${this.httpClient.serverUrl}/users/${this._data.owner.userId}/avatar`;
|
|
3057
3062
|
this._data.owner.fullName = userFullName(this._data.owner);
|
|
3058
3063
|
this._data.owner.initials = userInitials(this._data.owner.fullName);
|
|
@@ -3126,7 +3131,8 @@
|
|
|
3126
3131
|
return this.data.owner;
|
|
3127
3132
|
}
|
|
3128
3133
|
/**
|
|
3129
|
-
* Project preview image URL
|
|
3134
|
+
* Project preview image URL or empty string if the project does not have a preview. Use
|
|
3135
|
+
* {@link Project.setPreview | setPreview()} to change preview image.
|
|
3130
3136
|
*
|
|
3131
3137
|
* @readonly
|
|
3132
3138
|
*/
|
|
@@ -3419,7 +3425,8 @@
|
|
|
3419
3425
|
this.data = data;
|
|
3420
3426
|
}
|
|
3421
3427
|
/**
|
|
3422
|
-
* User avatar image URL
|
|
3428
|
+
* User avatar image URL or empty string if the user does not have an avatar. Use
|
|
3429
|
+
* {@link User.setAvatar | setAvatar()} to change avatar image.
|
|
3423
3430
|
*
|
|
3424
3431
|
* @readonly
|
|
3425
3432
|
*/
|
|
@@ -3462,7 +3469,9 @@
|
|
|
3462
3469
|
}
|
|
3463
3470
|
set data(value) {
|
|
3464
3471
|
this._data = value;
|
|
3465
|
-
this._data.avatarUrl = value.avatarImage
|
|
3472
|
+
this._data.avatarUrl = value.avatarImage
|
|
3473
|
+
? `${this.httpClient.serverUrl}/users/${this._data.id}/avatar?updated=${value.lastModified}`
|
|
3474
|
+
: "";
|
|
3466
3475
|
this._data.fullName = userFullName(this._data);
|
|
3467
3476
|
this._data.initials = userInitials(this._data.fullName);
|
|
3468
3477
|
}
|
|
@@ -3514,7 +3523,7 @@
|
|
|
3514
3523
|
return this.data.initials;
|
|
3515
3524
|
}
|
|
3516
3525
|
/**
|
|
3517
|
-
* `true` if user is
|
|
3526
|
+
* `true` if user is an administrator.
|
|
3518
3527
|
*/
|
|
3519
3528
|
get isAdmin() {
|
|
3520
3529
|
return this.data.isAdmin;
|
|
@@ -3584,8 +3593,8 @@
|
|
|
3584
3593
|
/**
|
|
3585
3594
|
* Refresh user data.
|
|
3586
3595
|
*
|
|
3587
|
-
* Only
|
|
3588
|
-
* administrator
|
|
3596
|
+
* Only administrators can checkout other users, if the current logged in user is not an
|
|
3597
|
+
* administrator, they can only checkout themselves, otherwise an exception will be thrown.
|
|
3589
3598
|
*/
|
|
3590
3599
|
async checkout() {
|
|
3591
3600
|
if (this.httpClient.signInUserIsAdmin) {
|
|
@@ -3606,8 +3615,8 @@
|
|
|
3606
3615
|
/**
|
|
3607
3616
|
* Update user data on the server.
|
|
3608
3617
|
*
|
|
3609
|
-
* Only
|
|
3610
|
-
* administrator
|
|
3618
|
+
* Only administrators can update other users, if the current logged in user is not an
|
|
3619
|
+
* administrator, they can only update themself, otherwise an exception will be thrown.
|
|
3611
3620
|
*
|
|
3612
3621
|
* @async
|
|
3613
3622
|
* @param data - Raw user data.
|
|
@@ -3631,11 +3640,11 @@
|
|
|
3631
3640
|
/**
|
|
3632
3641
|
* Delete a user from the server.
|
|
3633
3642
|
*
|
|
3634
|
-
* Only
|
|
3635
|
-
*
|
|
3643
|
+
* Only administrators can delete users, if the current logged in user is not an
|
|
3644
|
+
* administrator, an exception will be thrown.
|
|
3636
3645
|
*
|
|
3637
|
-
*
|
|
3638
|
-
* not the last administrator.
|
|
3646
|
+
* Administrators can delete themselves or other administrators. An administrator can only
|
|
3647
|
+
* delete themself if they is not the last administrator.
|
|
3639
3648
|
*
|
|
3640
3649
|
* You need to re-login to continue working after deleting the current logged in user.
|
|
3641
3650
|
*
|
|
@@ -3672,8 +3681,8 @@
|
|
|
3672
3681
|
/**
|
|
3673
3682
|
* Set or remove the user avatar.
|
|
3674
3683
|
*
|
|
3675
|
-
* Only
|
|
3676
|
-
* administrator
|
|
3684
|
+
* Only administrators can set the avatar of other users, if the current logged in user is
|
|
3685
|
+
* not an administrator, they can only set their avatar, otherwise an exception will be thrown.
|
|
3677
3686
|
*
|
|
3678
3687
|
* @async
|
|
3679
3688
|
* @param image - Avatar image. Can be a
|
|
@@ -3706,9 +3715,8 @@
|
|
|
3706
3715
|
/**
|
|
3707
3716
|
* Remove the user avatar.
|
|
3708
3717
|
*
|
|
3709
|
-
* Only
|
|
3710
|
-
*
|
|
3711
|
-
* will be thrown.
|
|
3718
|
+
* Only administrators can remove the avatar of other users, if the current logged in user is
|
|
3719
|
+
* not an administrator, they can only remove their avatar, otherwise an exception will be thrown.
|
|
3712
3720
|
*
|
|
3713
3721
|
* @async
|
|
3714
3722
|
*/
|
|
@@ -3728,6 +3736,36 @@
|
|
|
3728
3736
|
}
|
|
3729
3737
|
return this;
|
|
3730
3738
|
}
|
|
3739
|
+
/**
|
|
3740
|
+
* Change the user password.
|
|
3741
|
+
*
|
|
3742
|
+
* Only administrators can change the passwords of other users, if the current logged in user
|
|
3743
|
+
* is not an administrator, they can only change their password, otherwise an exception will
|
|
3744
|
+
* be thrown.
|
|
3745
|
+
*
|
|
3746
|
+
* To change their password, non-administrator users must provide their old password.
|
|
3747
|
+
*
|
|
3748
|
+
* @async
|
|
3749
|
+
* @param newPassword - New user password.
|
|
3750
|
+
* @param oldPassword - Old user password. Only required for non-administrator users to
|
|
3751
|
+
* change their password.
|
|
3752
|
+
*/
|
|
3753
|
+
async changePassword(newPassword, oldPassword) {
|
|
3754
|
+
if (this.httpClient.signInUserIsAdmin) {
|
|
3755
|
+
const response = await this.httpClient.put(`/users/${this.id}/password`, { new: newPassword });
|
|
3756
|
+
const data = await response.json();
|
|
3757
|
+
this.data = { id: data.id, ...data.userBrief };
|
|
3758
|
+
}
|
|
3759
|
+
else if (this.id === this.httpClient.signInUserId) {
|
|
3760
|
+
const response = await this.httpClient.put("/user/password", { old: oldPassword, new: newPassword });
|
|
3761
|
+
const data = await response.json();
|
|
3762
|
+
this.data = { id: this.id, ...data };
|
|
3763
|
+
}
|
|
3764
|
+
else {
|
|
3765
|
+
return Promise.reject(new FetchError(403));
|
|
3766
|
+
}
|
|
3767
|
+
return this;
|
|
3768
|
+
}
|
|
3731
3769
|
}
|
|
3732
3770
|
|
|
3733
3771
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -3829,7 +3867,7 @@
|
|
|
3829
3867
|
.then((data) => ({
|
|
3830
3868
|
...data,
|
|
3831
3869
|
server: data.version,
|
|
3832
|
-
client: "25.6.
|
|
3870
|
+
client: "25.6.4",
|
|
3833
3871
|
}));
|
|
3834
3872
|
}
|
|
3835
3873
|
/**
|
|
@@ -3949,8 +3987,8 @@
|
|
|
3949
3987
|
/**
|
|
3950
3988
|
* Change server settings.
|
|
3951
3989
|
*
|
|
3952
|
-
* Only
|
|
3953
|
-
* administrator
|
|
3990
|
+
* Only administrators can change server settings, if the current logged in user is not an
|
|
3991
|
+
* administrator, an exception will be thrown.
|
|
3954
3992
|
*
|
|
3955
3993
|
* @async
|
|
3956
3994
|
*/
|
|
@@ -3960,8 +3998,8 @@
|
|
|
3960
3998
|
/**
|
|
3961
3999
|
* Returns a list of server users.
|
|
3962
4000
|
*
|
|
3963
|
-
* Only
|
|
3964
|
-
* administrator
|
|
4001
|
+
* Only administrators can get a list of users, if the current logged in user is not an
|
|
4002
|
+
* administrator, an exception will be thrown.
|
|
3965
4003
|
*
|
|
3966
4004
|
* @async
|
|
3967
4005
|
*/
|
|
@@ -3975,8 +4013,8 @@
|
|
|
3975
4013
|
/**
|
|
3976
4014
|
* Returns the user information.
|
|
3977
4015
|
*
|
|
3978
|
-
* Only
|
|
3979
|
-
*
|
|
4016
|
+
* Only administrators can get other users, if the currently logged in user is not an
|
|
4017
|
+
* administrator, they can only get themselves, otherwise an exception will be thrown.
|
|
3980
4018
|
*
|
|
3981
4019
|
* @async
|
|
3982
4020
|
* @param userId - User ID.
|
|
@@ -4003,8 +4041,8 @@
|
|
|
4003
4041
|
/**
|
|
4004
4042
|
* Create a new user.
|
|
4005
4043
|
*
|
|
4006
|
-
* Only
|
|
4007
|
-
*
|
|
4044
|
+
* Only administrators can create users, if the current logged in user is not an
|
|
4045
|
+
* administrator, an exception will be thrown.
|
|
4008
4046
|
*
|
|
4009
4047
|
* @async
|
|
4010
4048
|
* @param email - User email. Cannot be empty.
|
|
@@ -4039,11 +4077,11 @@
|
|
|
4039
4077
|
/**
|
|
4040
4078
|
* Delete a user from the server.
|
|
4041
4079
|
*
|
|
4042
|
-
* Only
|
|
4043
|
-
*
|
|
4080
|
+
* Only administrators can delete users, if the current logged in user is not an
|
|
4081
|
+
* administrator, an exception will be thrown.
|
|
4044
4082
|
*
|
|
4045
|
-
*
|
|
4046
|
-
* not the last administrator.
|
|
4083
|
+
* Administrators can delete themselves or other administrators. An administrator can only
|
|
4084
|
+
* delete themself if they is not the last administrator.
|
|
4047
4085
|
*
|
|
4048
4086
|
* You need to re-login to continue working after deleting the current logged in user.
|
|
4049
4087
|
*
|
|
@@ -4554,7 +4592,7 @@
|
|
|
4554
4592
|
}
|
|
4555
4593
|
|
|
4556
4594
|
///////////////////////////////////////////////////////////////////////////////
|
|
4557
|
-
const version = "25.6.
|
|
4595
|
+
const version = "25.6.4";
|
|
4558
4596
|
|
|
4559
4597
|
exports.Assembly = Assembly;
|
|
4560
4598
|
exports.ClashTest = ClashTest;
|