@zauru-sdk/common 2.0.197 → 2.0.198
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/CHANGELOG.md +8 -0
- package/dist/common.d.ts +1 -1
- package/dist/esm/common.js +2 -3
- package/package.json +2 -2
- package/src/common.ts +4 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.0.198](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.197...v2.0.198) (2025-03-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @zauru-sdk/common
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.0.197](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.196...v2.0.197) (2025-03-14)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @zauru-sdk/common
|
package/dist/common.d.ts
CHANGED
|
@@ -147,7 +147,7 @@ export declare const sortByProperty: (array: any[], property: string) => any[];
|
|
|
147
147
|
* @param action A function that returns a Promise of type T.
|
|
148
148
|
* @returns A Promise of AxiosUtilsResponse<T>.
|
|
149
149
|
*/
|
|
150
|
-
export declare function handlePossibleAxiosErrors<T>(action: () => Promise<T
|
|
150
|
+
export declare function handlePossibleAxiosErrors<T>(action: () => Promise<T>, timeout?: number): Promise<AxiosUtilsResponse<T>>;
|
|
151
151
|
/**
|
|
152
152
|
* createPostgresUrl
|
|
153
153
|
* @param host
|
package/dist/esm/common.js
CHANGED
|
@@ -570,9 +570,8 @@ exports.sortByProperty = sortByProperty;
|
|
|
570
570
|
* @param action A function that returns a Promise of type T.
|
|
571
571
|
* @returns A Promise of AxiosUtilsResponse<T>.
|
|
572
572
|
*/
|
|
573
|
-
async function handlePossibleAxiosErrors(action) {
|
|
574
|
-
const
|
|
575
|
-
const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`Timeout skipped after ${SECONDS_TO_TIMEOUT} seconds`)), SECONDS_TO_TIMEOUT * 1000));
|
|
573
|
+
async function handlePossibleAxiosErrors(action, timeout = 25) {
|
|
574
|
+
const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`Timeout skipped after ${timeout} seconds`)), timeout * 1000));
|
|
576
575
|
try {
|
|
577
576
|
const result = await Promise.race([action(), timeoutPromise]);
|
|
578
577
|
return { error: false, data: result };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/common",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.198",
|
|
4
4
|
"description": "Funciones de uso común en el desarrollo de webapps en Zauru",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"moment": "^2.30.1",
|
|
25
25
|
"moment-timezone": "^0.5.45"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "9eb96c25762ab502d51ac347e735fe46a7772952"
|
|
28
28
|
}
|
package/src/common.ts
CHANGED
|
@@ -639,17 +639,13 @@ export const sortByProperty = (array: any[], property: string) => {
|
|
|
639
639
|
* @returns A Promise of AxiosUtilsResponse<T>.
|
|
640
640
|
*/
|
|
641
641
|
export async function handlePossibleAxiosErrors<T>(
|
|
642
|
-
action: () => Promise<T
|
|
642
|
+
action: () => Promise<T>,
|
|
643
|
+
timeout: number = 25
|
|
643
644
|
): Promise<AxiosUtilsResponse<T>> {
|
|
644
|
-
const SECONDS_TO_TIMEOUT = 20;
|
|
645
|
-
|
|
646
645
|
const timeoutPromise = new Promise((_, reject) =>
|
|
647
646
|
setTimeout(
|
|
648
|
-
() =>
|
|
649
|
-
|
|
650
|
-
new Error(`Timeout skipped after ${SECONDS_TO_TIMEOUT} seconds`)
|
|
651
|
-
),
|
|
652
|
-
SECONDS_TO_TIMEOUT * 1000
|
|
647
|
+
() => reject(new Error(`Timeout skipped after ${timeout} seconds`)),
|
|
648
|
+
timeout * 1000
|
|
653
649
|
)
|
|
654
650
|
);
|
|
655
651
|
|