@zauru-sdk/common 2.0.51 → 2.0.74

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 CHANGED
@@ -3,6 +3,22 @@
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.74](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.73...v2.0.74) (2024-12-11)
7
+
8
+ **Note:** Version bump only for package @zauru-sdk/common
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.0.70](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.69...v2.0.70) (2024-11-29)
15
+
16
+ **Note:** Version bump only for package @zauru-sdk/common
17
+
18
+
19
+
20
+
21
+
6
22
  ## [2.0.51](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.50...v2.0.51) (2024-10-23)
7
23
 
8
24
  **Note:** Version bump only for package @zauru-sdk/common
@@ -558,8 +558,10 @@ exports.sortByProperty = sortByProperty;
558
558
  * @returns A Promise of AxiosUtilsResponse<T>.
559
559
  */
560
560
  async function handlePossibleAxiosErrors(action) {
561
+ const SECONDS_TO_TIMEOUT = 18;
562
+ const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`Timeout skipped after ${SECONDS_TO_TIMEOUT} seconds`)), SECONDS_TO_TIMEOUT * 1000));
561
563
  try {
562
- const result = await action();
564
+ const result = await Promise.race([action(), timeoutPromise]);
563
565
  return { error: false, data: result };
564
566
  }
565
567
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/common",
3
- "version": "2.0.51",
3
+ "version": "2.0.74",
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",
@@ -20,9 +20,9 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@remix-run/node": "^2.8.1",
23
- "@zauru-sdk/types": "^2.0.51",
23
+ "@zauru-sdk/types": "^2.0.70",
24
24
  "moment": "^2.30.1",
25
25
  "moment-timezone": "^0.5.45"
26
26
  },
27
- "gitHead": "8e73cc127487f184bb23bd3fa4668e25520356a2"
27
+ "gitHead": "c034cf75933f01e59afcd0e5bd8147086dbe501f"
28
28
  }
package/src/common.ts CHANGED
@@ -629,8 +629,20 @@ export const sortByProperty = (array: any[], property: string) => {
629
629
  export async function handlePossibleAxiosErrors<T>(
630
630
  action: () => Promise<T>
631
631
  ): Promise<AxiosUtilsResponse<T>> {
632
+ const SECONDS_TO_TIMEOUT = 18;
633
+
634
+ const timeoutPromise = new Promise((_, reject) =>
635
+ setTimeout(
636
+ () =>
637
+ reject(
638
+ new Error(`Timeout skipped after ${SECONDS_TO_TIMEOUT} seconds`)
639
+ ),
640
+ SECONDS_TO_TIMEOUT * 1000
641
+ )
642
+ );
643
+
632
644
  try {
633
- const result = await action();
645
+ const result = await Promise.race([action(), timeoutPromise]);
634
646
  return { error: false, data: result } as AxiosUtilsResponse<T>;
635
647
  } catch (error) {
636
648
  return { error: true, userMsg: error?.toString() } as AxiosUtilsResponse<T>;