@zauru-sdk/utils 1.0.13 → 1.0.16

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.16](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.15...v1.0.16) (2024-03-21)
7
+
8
+ **Note:** Version bump only for package @zauru-sdk/utils
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.0.15](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.14...v1.0.15) (2024-03-21)
15
+
16
+ **Note:** Version bump only for package @zauru-sdk/utils
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.0.13](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.12...v1.0.13) (2024-03-21)
7
23
 
8
24
  **Note:** Version bump only for package @zauru-sdk/utils
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./zauru/4pinos-receptions-form-history.utils.js";
1
2
  export * from "./zauru/automatic-number.utils.js";
2
3
  export * from "./zauru/bitacora-edicion-masiva.utils.js";
3
4
  export * from "./zauru/bundles.utils.js";
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./zauru/4pinos-receptions-form-history.utils.js";
1
2
  export * from "./zauru/automatic-number.utils.js";
2
3
  export * from "./zauru/bitacora-edicion-masiva.utils.js";
3
4
  export * from "./zauru/bundles.utils.js";
@@ -0,0 +1,37 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { AxiosUtilsResponse, QueueFormReceptionWebAppTable, WebAppRowGraphQL, WebAppTableUpdateResponse } from "@zauru-sdk/types";
3
+ export declare const ESTADOS_COLA_RECEPCIONES: {
4
+ EN_PROCESO: string;
5
+ ERROR: string;
6
+ REINTENTANDO: string;
7
+ OFFLINE: string;
8
+ };
9
+ /**
10
+ * Get getQueueFormReceptionHistories from the web app table.
11
+ * @param headers Request headers.
12
+ * @param session Session object.
13
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
14
+ */
15
+ export declare function getQueueFormReceptionHistories(headers: any, session: Session): Promise<AxiosUtilsResponse<WebAppRowGraphQL<QueueFormReceptionWebAppTable>[]>>;
16
+ /**
17
+ * Create a template in the web app table.
18
+ * @param headers Request headers.
19
+ * @param session Session object.
20
+ * @param body QueueFormReceptionWebAppTable data to be created.
21
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable>.
22
+ */
23
+ export declare function createQueueFormReceptionHistory(headers: any, session: Session, body: QueueFormReceptionWebAppTable): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
24
+ /**
25
+ * Put updateQueueFormReception from the web app table.
26
+ * @param headers Request headers.
27
+ * @param session Session object.
28
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
29
+ */
30
+ export declare function updateQueueFormReceptionHistory(headers: any, session: Session, body: Partial<QueueFormReceptionWebAppTable>, id_registro: string | number): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
31
+ /**
32
+ * Delete QueueFormReceptionHistory from the web app table.
33
+ * @param headers Request headers.
34
+ * @param session Session object.
35
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
36
+ */
37
+ export declare function deleteQueueFormReceptionHistory(headers: any, session: Session, id: string): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
@@ -0,0 +1,73 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import { createWebAppTableRegister, deleteWebAppTableRegister, getVariablesByName, getWebAppTableRegisters, updateWebAppTableRegister, } from "@zauru-sdk/services";
3
+ export const ESTADOS_COLA_RECEPCIONES = {
4
+ EN_PROCESO: "En proceso",
5
+ ERROR: "Con error",
6
+ REINTENTANDO: "Reintentando",
7
+ OFFLINE: "Registro local",
8
+ };
9
+ /**
10
+ * Get getQueueFormReceptionHistories from the web app table.
11
+ * @param headers Request headers.
12
+ * @param session Session object.
13
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
14
+ */
15
+ export async function getQueueFormReceptionHistories(headers, session) {
16
+ return handlePossibleAxiosErrors(async () => {
17
+ const { queue_form_recepcion_submited_web_app_table_id } = await getVariablesByName(headers, session, [
18
+ "queue_form_recepcion_submited_web_app_table_id",
19
+ ]);
20
+ const response = await getWebAppTableRegisters(session, queue_form_recepcion_submited_web_app_table_id);
21
+ if (response.error) {
22
+ throw new Error(`Ocurrió un error al consultar el historial de colas: ${response.userMsg}`);
23
+ }
24
+ const history = response?.data ?? [];
25
+ return history;
26
+ });
27
+ }
28
+ /**
29
+ * Create a template in the web app table.
30
+ * @param headers Request headers.
31
+ * @param session Session object.
32
+ * @param body QueueFormReceptionWebAppTable data to be created.
33
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable>.
34
+ */
35
+ export async function createQueueFormReceptionHistory(headers, session, body) {
36
+ return handlePossibleAxiosErrors(async () => {
37
+ const { queue_form_recepcion_submited_web_app_table_id } = await getVariablesByName(headers, session, [
38
+ "queue_form_recepcion_submited_web_app_table_id",
39
+ ]);
40
+ const response = await createWebAppTableRegister(headers, queue_form_recepcion_submited_web_app_table_id, body);
41
+ return response;
42
+ });
43
+ }
44
+ /**
45
+ * Put updateQueueFormReception from the web app table.
46
+ * @param headers Request headers.
47
+ * @param session Session object.
48
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
49
+ */
50
+ export async function updateQueueFormReceptionHistory(headers, session, body, id_registro) {
51
+ return handlePossibleAxiosErrors(async () => {
52
+ const { queue_form_recepcion_submited_web_app_table_id } = await getVariablesByName(headers, session, [
53
+ "queue_form_recepcion_submited_web_app_table_id",
54
+ ]);
55
+ const response = await updateWebAppTableRegister(headers, queue_form_recepcion_submited_web_app_table_id, id_registro, { ...body });
56
+ return response;
57
+ });
58
+ }
59
+ /**
60
+ * Delete QueueFormReceptionHistory from the web app table.
61
+ * @param headers Request headers.
62
+ * @param session Session object.
63
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
64
+ */
65
+ export async function deleteQueueFormReceptionHistory(headers, session, id) {
66
+ return handlePossibleAxiosErrors(async () => {
67
+ const { queue_form_recepcion_submited_web_app_table_id } = await getVariablesByName(headers, session, [
68
+ "queue_form_recepcion_submited_web_app_table_id",
69
+ ]);
70
+ const response = await deleteWebAppTableRegister(headers, queue_form_recepcion_submited_web_app_table_id, Number(id));
71
+ return response;
72
+ });
73
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/utils",
3
- "version": "1.0.13",
3
+ "version": "1.0.16",
4
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",
@@ -22,11 +22,11 @@
22
22
  "@zauru-sdk/common": "^1.0.13",
23
23
  "@zauru-sdk/config": "^1.0.4",
24
24
  "@zauru-sdk/graphql": "^1.0.9",
25
- "@zauru-sdk/services": "^1.0.13",
25
+ "@zauru-sdk/services": "^1.0.15",
26
26
  "@zauru-sdk/types": "^1.0.13"
27
27
  },
28
28
  "engines": {
29
29
  "node": ">=18.0.0"
30
30
  },
31
- "gitHead": "9bca61fddd7c538e7f95a489d59436b5557c61cc"
31
+ "gitHead": "15053a96216edb53a2876d5236c5b2fda511217a"
32
32
  }
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./zauru/4pinos-receptions-form-history.utils.js";
1
2
  export * from "./zauru/automatic-number.utils.js";
2
3
  export * from "./zauru/bitacora-edicion-masiva.utils.js";
3
4
  export * from "./zauru/bundles.utils.js";
@@ -0,0 +1,142 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
+ import {
4
+ createWebAppTableRegister,
5
+ deleteWebAppTableRegister,
6
+ getVariablesByName,
7
+ getWebAppTableRegisters,
8
+ updateWebAppTableRegister,
9
+ } from "@zauru-sdk/services";
10
+ import {
11
+ AxiosUtilsResponse,
12
+ QueueFormReceptionWebAppTable,
13
+ WebAppRowGraphQL,
14
+ WebAppTableUpdateResponse,
15
+ } from "@zauru-sdk/types";
16
+
17
+ export const ESTADOS_COLA_RECEPCIONES = {
18
+ EN_PROCESO: "En proceso",
19
+ ERROR: "Con error",
20
+ REINTENTANDO: "Reintentando",
21
+ OFFLINE: "Registro local",
22
+ };
23
+
24
+ /**
25
+ * Get getQueueFormReceptionHistories from the web app table.
26
+ * @param headers Request headers.
27
+ * @param session Session object.
28
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
29
+ */
30
+ export async function getQueueFormReceptionHistories(
31
+ headers: any,
32
+ session: Session
33
+ ): Promise<
34
+ AxiosUtilsResponse<WebAppRowGraphQL<QueueFormReceptionWebAppTable>[]>
35
+ > {
36
+ return handlePossibleAxiosErrors(async () => {
37
+ const { queue_form_recepcion_submited_web_app_table_id } =
38
+ await getVariablesByName(headers, session, [
39
+ "queue_form_recepcion_submited_web_app_table_id",
40
+ ]);
41
+
42
+ const response =
43
+ await getWebAppTableRegisters<QueueFormReceptionWebAppTable>(
44
+ session,
45
+ queue_form_recepcion_submited_web_app_table_id
46
+ );
47
+
48
+ if (response.error) {
49
+ throw new Error(
50
+ `Ocurrió un error al consultar el historial de colas: ${response.userMsg}`
51
+ );
52
+ }
53
+
54
+ const history = response?.data ?? [];
55
+
56
+ return history;
57
+ });
58
+ }
59
+
60
+ /**
61
+ * Create a template in the web app table.
62
+ * @param headers Request headers.
63
+ * @param session Session object.
64
+ * @param body QueueFormReceptionWebAppTable data to be created.
65
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable>.
66
+ */
67
+ export async function createQueueFormReceptionHistory(
68
+ headers: any,
69
+ session: Session,
70
+ body: QueueFormReceptionWebAppTable
71
+ ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> {
72
+ return handlePossibleAxiosErrors(async () => {
73
+ const { queue_form_recepcion_submited_web_app_table_id } =
74
+ await getVariablesByName(headers, session, [
75
+ "queue_form_recepcion_submited_web_app_table_id",
76
+ ]);
77
+ const response =
78
+ await createWebAppTableRegister<QueueFormReceptionWebAppTable>(
79
+ headers,
80
+ queue_form_recepcion_submited_web_app_table_id,
81
+ body
82
+ );
83
+ return response;
84
+ });
85
+ }
86
+
87
+ /**
88
+ * Put updateQueueFormReception from the web app table.
89
+ * @param headers Request headers.
90
+ * @param session Session object.
91
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
92
+ */
93
+ export async function updateQueueFormReceptionHistory(
94
+ headers: any,
95
+ session: Session,
96
+ body: Partial<QueueFormReceptionWebAppTable>,
97
+ id_registro: string | number
98
+ ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> {
99
+ return handlePossibleAxiosErrors(async () => {
100
+ const { queue_form_recepcion_submited_web_app_table_id } =
101
+ await getVariablesByName(headers, session, [
102
+ "queue_form_recepcion_submited_web_app_table_id",
103
+ ]);
104
+
105
+ const response =
106
+ await updateWebAppTableRegister<QueueFormReceptionWebAppTable>(
107
+ headers,
108
+ queue_form_recepcion_submited_web_app_table_id,
109
+ id_registro,
110
+ { ...body }
111
+ );
112
+
113
+ return response;
114
+ });
115
+ }
116
+
117
+ /**
118
+ * Delete QueueFormReceptionHistory from the web app table.
119
+ * @param headers Request headers.
120
+ * @param session Session object.
121
+ * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
122
+ */
123
+ export async function deleteQueueFormReceptionHistory(
124
+ headers: any,
125
+ session: Session,
126
+ id: string
127
+ ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> {
128
+ return handlePossibleAxiosErrors(async () => {
129
+ const { queue_form_recepcion_submited_web_app_table_id } =
130
+ await getVariablesByName(headers, session, [
131
+ "queue_form_recepcion_submited_web_app_table_id",
132
+ ]);
133
+
134
+ const response = await deleteWebAppTableRegister(
135
+ headers,
136
+ queue_form_recepcion_submited_web_app_table_id,
137
+ Number(id)
138
+ );
139
+
140
+ return response;
141
+ });
142
+ }