@zauru-sdk/utils 1.0.4 → 1.0.6

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
+ ## [1.0.6](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.5...v1.0.6) (2024-03-16)
7
+
8
+ **Note:** Version bump only for package @zauru-sdk/utils
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.0.5](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.4...v1.0.5) (2024-03-16)
15
+
16
+ **Note:** Version bump only for package @zauru-sdk/utils
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.0.4](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.3...v1.0.4) (2024-03-15)
7
23
 
8
24
  **Note:** Version bump only for package @zauru-sdk/utils
@@ -0,0 +1,9 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { AxiosUtilsResponse } from "@zauru-sdk/types";
3
+ /**
4
+ * updateMuestraAutomaticNumber
5
+ * @param headers
6
+ * @param session
7
+ * @returns
8
+ */
9
+ export declare const updateMuestraAutomaticNumber: (headers: any, session: Session, current_number: number) => Promise<AxiosUtilsResponse<boolean>>;
@@ -0,0 +1,24 @@
1
+ import { updateAutomaticNumber, getVariablesByName } from "@zauru-sdk/services";
2
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
+ /**
4
+ * updateMuestraAutomaticNumber
5
+ * @param headers
6
+ * @param session
7
+ * @returns
8
+ */
9
+ export const updateMuestraAutomaticNumber = async (headers, session, current_number) => {
10
+ return handlePossibleAxiosErrors(async () => {
11
+ let msg = "";
12
+ const { lab_muestra_automatic_number_id } = await getVariablesByName(headers, session, ["lab_muestra_automatic_number_id"]);
13
+ const response = await updateAutomaticNumber(headers, {
14
+ id: Number(lab_muestra_automatic_number_id),
15
+ variable_doc_number: current_number,
16
+ });
17
+ if (response.error) {
18
+ msg = `Ocurrió un error al intentar actualizar el número automático de muestras: ${response.userMsg}`;
19
+ console.error(msg);
20
+ throw new Error(msg);
21
+ }
22
+ return true;
23
+ });
24
+ };
package/dist/common.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import "moment-timezone";
2
2
  import "moment/locale/es";
3
- import type { PayeeGraphQL } from "@zauru-sdk/graphql";
3
+ import type { PayeeGraphQL } from "@zauru-sdk/types";
4
4
  export type SelectFieldOption = {
5
5
  label: any;
6
6
  value: any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zauru-sdk/utils",
3
- "version": "1.0.4",
4
- "description": "Configuración centralizada para aplicaciones Zauru SDK",
3
+ "version": "1.0.6",
4
+ "description": "Utilidades, parseo de request y demás para desarrollo de webapps de Zauru",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "module",
@@ -19,16 +19,14 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@remix-run/node": "^2.8.1",
22
+ "@zauru-sdk/common": "^1.0.6",
22
23
  "@zauru-sdk/config": "^1.0.4",
23
- "@zauru-sdk/graphql": "^1.0.4",
24
- "@zauru-sdk/services": "^1.0.4",
25
- "axios": "^1.6.7",
26
- "chalk": "5.3.0",
27
- "moment": "^2.30.1",
28
- "moment-timezone": "^0.5.45"
24
+ "@zauru-sdk/graphql": "^1.0.5",
25
+ "@zauru-sdk/services": "^1.0.6",
26
+ "@zauru-sdk/types": "^1.0.6"
29
27
  },
30
28
  "engines": {
31
29
  "node": ">=18.0.0"
32
30
  },
33
- "gitHead": "75cef0c437edf8240adc811bc7b395e1030adf90"
31
+ "gitHead": "d49d7b1cec4ab5685b34983c46d97db129115aaf"
34
32
  }
@@ -0,0 +1,38 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { updateAutomaticNumber, getVariablesByName } from "@zauru-sdk/services";
3
+ import { AxiosUtilsResponse } from "@zauru-sdk/types";
4
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
5
+
6
+ /**
7
+ * updateMuestraAutomaticNumber
8
+ * @param headers
9
+ * @param session
10
+ * @returns
11
+ */
12
+ export const updateMuestraAutomaticNumber = async (
13
+ headers: any,
14
+ session: Session,
15
+ current_number: number
16
+ ): Promise<AxiosUtilsResponse<boolean>> => {
17
+ return handlePossibleAxiosErrors(async () => {
18
+ let msg = "";
19
+ const { lab_muestra_automatic_number_id } = await getVariablesByName(
20
+ headers,
21
+ session,
22
+ ["lab_muestra_automatic_number_id"]
23
+ );
24
+
25
+ const response = await updateAutomaticNumber(headers, {
26
+ id: Number(lab_muestra_automatic_number_id),
27
+ variable_doc_number: current_number,
28
+ });
29
+
30
+ if (response.error) {
31
+ msg = `Ocurrió un error al intentar actualizar el número automático de muestras: ${response.userMsg}`;
32
+ console.error(msg);
33
+ throw new Error(msg);
34
+ }
35
+
36
+ return true;
37
+ });
38
+ };