@evergis/api 4.1.9 → 4.1.11

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Everpoint
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Everpoint
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # @evergis/api
2
-
3
- Библиотека API.
4
-
5
- ### Генерирование API
6
-
7
- ```shell
8
- $ yarn generate
9
- ```
10
-
11
- ***ВАЖНО!!!***: Никогда и ни при каких обстоятельствах нельзя вручную править файлы, размещенные в директории `src/__generated__`!
1
+ # @evergis/api
2
+
3
+ Библиотека API.
4
+
5
+ ### Генерирование API
6
+
7
+ ```shell
8
+ $ yarn generate
9
+ ```
10
+
11
+ ***ВАЖНО!!!***: Никогда и ни при каких обстоятельствах нельзя вручную править файлы, размещенные в директории `src/__generated__`!
package/dist/api.esm.js CHANGED
@@ -789,6 +789,17 @@ class EventEmitter {
789
789
  }
790
790
  }
791
791
 
792
+ const getUserInfo = () => JSON.parse(localStorage.getItem(API_USER_INFO_KEY) || "null") || void 0;
793
+ const updateUserInfo = (newUserInfo) => {
794
+ if (newUserInfo) {
795
+ const oldUserInfo = getUserInfo();
796
+ localStorage.setItem(API_USER_INFO_KEY, JSON.stringify({ ...oldUserInfo, ...newUserInfo }));
797
+ }
798
+ else {
799
+ localStorage.removeItem(API_USER_INFO_KEY);
800
+ }
801
+ };
802
+
792
803
  /* eslint-disable */
793
804
  /* tslint:disable */
794
805
  /*
@@ -1396,19 +1407,24 @@ class AccountService extends Service {
1396
1407
  }
1397
1408
  }
1398
1409
 
1399
- const getUserInfo = () => JSON.parse(localStorage.getItem(API_USER_INFO_KEY) || "null") || void 0;
1400
- const updateUserInfo = (newUserInfo) => {
1401
- if (newUserInfo) {
1402
- const oldUserInfo = getUserInfo();
1403
- localStorage.setItem(API_USER_INFO_KEY, JSON.stringify({ ...oldUserInfo, ...newUserInfo }));
1404
- }
1405
- else {
1406
- localStorage.removeItem(API_USER_INFO_KEY);
1407
- }
1408
- };
1409
-
1410
1410
  class Account extends AccountService {
1411
1411
  userInfo;
1412
+ get username() {
1413
+ return this.userInfo?.username || "";
1414
+ }
1415
+ get isAuth() {
1416
+ return !!this.userInfo?.username && this.userInfo.username !== "public";
1417
+ }
1418
+ get user() {
1419
+ if (this.userInfo) {
1420
+ return this.userInfo;
1421
+ }
1422
+ const userInfo = getUserInfo();
1423
+ if (userInfo) {
1424
+ this.userInfo = userInfo;
1425
+ }
1426
+ return userInfo;
1427
+ }
1412
1428
  async login(params, authParams = {}, useJwt = false) {
1413
1429
  if (params) {
1414
1430
  const response = await super.authenticate(authParams, params);
@@ -1422,9 +1438,6 @@ class Account extends AccountService {
1422
1438
  this.userInfo = await this.getUserInfo();
1423
1439
  return this.userInfo;
1424
1440
  }
1425
- get username() {
1426
- return this.userInfo?.username || "";
1427
- }
1428
1441
  async logout() {
1429
1442
  const token = window.localStorage.getItem(STORAGE_TOKEN_KEY);
1430
1443
  if (token) {
@@ -1445,19 +1458,6 @@ class Account extends AccountService {
1445
1458
  setPassword(password) {
1446
1459
  return this.setUserPassword({ username: this.username, password });
1447
1460
  }
1448
- get isAuth() {
1449
- return !!this.userInfo?.username && this.userInfo.username !== "public";
1450
- }
1451
- get user() {
1452
- if (this.userInfo) {
1453
- return this.userInfo;
1454
- }
1455
- const userInfo = getUserInfo();
1456
- if (userInfo) {
1457
- this.userInfo = userInfo;
1458
- }
1459
- return userInfo;
1460
- }
1461
1461
  }
1462
1462
 
1463
1463
  /* eslint-disable */