@zauru-sdk/common 2.0.197 → 2.0.203

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.203](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.202...v2.0.203) (2025-03-27)
7
+
8
+ **Note:** Version bump only for package @zauru-sdk/common
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.0.198](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.197...v2.0.198) (2025-03-17)
15
+
16
+ **Note:** Version bump only for package @zauru-sdk/common
17
+
18
+
19
+
20
+
21
+
6
22
  ## [2.0.197](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.196...v2.0.197) (2025-03-14)
7
23
 
8
24
  **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>): Promise<AxiosUtilsResponse<T>>;
150
+ export declare function handlePossibleAxiosErrors<T>(action: () => Promise<T>, timeout?: number): Promise<AxiosUtilsResponse<T>>;
151
151
  /**
152
152
  * createPostgresUrl
153
153
  * @param host
@@ -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 SECONDS_TO_TIMEOUT = 20;
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.197",
3
+ "version": "2.0.203",
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.197",
23
+ "@zauru-sdk/types": "^2.0.203",
24
24
  "moment": "^2.30.1",
25
25
  "moment-timezone": "^0.5.45"
26
26
  },
27
- "gitHead": "7956011aa4bc12fedb326930e16d6a3aebf4cd5f"
27
+ "gitHead": "71ffd90ef4de8f031f2b507b38151902caaeb006"
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
- reject(
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