@evergis/api 4.1.41 → 4.1.43
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 +21 -21
- package/README.md +12 -12
- package/dist/api.esm.js +21 -15
- package/dist/api.esm.js.map +1 -1
- package/dist/index.js +21 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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,12 +1,12 @@
|
|
|
1
|
-
# @evergis/api
|
|
2
|
-
|
|
3
|
-
Библиотека API.
|
|
4
|
-
|
|
5
|
-
### Генерирование API
|
|
6
|
-
|
|
7
|
-
```shell
|
|
8
|
-
$ yarn generate
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
***ВАЖНО!!!***: Никогда и ни при каких обстоятельствах нельзя вручную править файлы,
|
|
12
|
-
размещенные в директории `src/__generated__`!
|
|
1
|
+
# @evergis/api
|
|
2
|
+
|
|
3
|
+
Библиотека API.
|
|
4
|
+
|
|
5
|
+
### Генерирование API
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
$ yarn generate
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
***ВАЖНО!!!***: Никогда и ни при каких обстоятельствах нельзя вручную править файлы,
|
|
12
|
+
размещенные в директории `src/__generated__`!
|
package/dist/api.esm.js
CHANGED
|
@@ -2946,23 +2946,29 @@ class Api extends EventEmitter {
|
|
|
2946
2946
|
beforeRetry: [
|
|
2947
2947
|
async ({ request, error, retryCount }) => {
|
|
2948
2948
|
if (error instanceof HTTPError &&
|
|
2949
|
-
error.response.status === 401 &&
|
|
2950
2949
|
retryCount === 1) {
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
refreshToken
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2950
|
+
switch (error.response.status) {
|
|
2951
|
+
case 401:
|
|
2952
|
+
try {
|
|
2953
|
+
const refreshToken = window.localStorage.getItem(STORAGE_REFRESH_TOKEN_KEY);
|
|
2954
|
+
if (refreshToken) {
|
|
2955
|
+
const refreshTokenResponse = await this.account.refreshToken({
|
|
2956
|
+
refreshToken,
|
|
2957
|
+
});
|
|
2958
|
+
if (refreshTokenResponse) {
|
|
2959
|
+
window.localStorage.setItem(STORAGE_TOKEN_KEY, refreshTokenResponse.token);
|
|
2960
|
+
window.localStorage.setItem(STORAGE_REFRESH_TOKEN_KEY, refreshTokenResponse.refreshToken);
|
|
2961
|
+
}
|
|
2962
|
+
request.headers?.set("Authorization", `Bearer ${refreshTokenResponse.token || ""}`);
|
|
2963
|
+
}
|
|
2964
|
+
else {
|
|
2965
|
+
await this.logout();
|
|
2966
|
+
}
|
|
2960
2967
|
}
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
throw new Error("Failed to refresh token");
|
|
2968
|
+
catch (error) {
|
|
2969
|
+
await this.logout();
|
|
2970
|
+
}
|
|
2971
|
+
break;
|
|
2966
2972
|
}
|
|
2967
2973
|
}
|
|
2968
2974
|
},
|