@zauru-sdk/utils 1.0.50 → 1.0.52

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.
Files changed (78) hide show
  1. package/dist/cjs/index.js +40 -0
  2. package/dist/cjs/zauru/4pinos-receptions-form-history.utils.js +80 -0
  3. package/dist/cjs/zauru/automatic-number.utils.js +28 -0
  4. package/dist/cjs/zauru/bitacora-edicion-masiva.utils.js +56 -0
  5. package/dist/cjs/zauru/bundles.utils.js +168 -0
  6. package/dist/cjs/zauru/cases.utils.js +21 -0
  7. package/dist/cjs/zauru/consolidated-history.utils.js +58 -0
  8. package/dist/cjs/zauru/costos-items.utils.js +617 -0
  9. package/dist/cjs/zauru/deliveries.utils.js +50 -0
  10. package/dist/cjs/zauru/discharges-histsory.utils.js +52 -0
  11. package/dist/cjs/zauru/employees.utils.js +44 -0
  12. package/dist/cjs/zauru/form.utils.js +160 -0
  13. package/dist/cjs/zauru/invoices.utils.js +85 -0
  14. package/dist/cjs/zauru/items.utils.js +126 -0
  15. package/dist/cjs/zauru/lotes.utils.js +313 -0
  16. package/dist/cjs/zauru/motivos-rechazo.utils.js +23 -0
  17. package/dist/cjs/zauru/payees.utils.js +136 -0
  18. package/dist/cjs/zauru/profiles.utils.js +41 -0
  19. package/dist/cjs/zauru/providers.utils.js +40 -0
  20. package/dist/cjs/zauru/purchase-orders.utils.js +390 -0
  21. package/dist/cjs/zauru/shipments.utils.js +95 -0
  22. package/dist/cjs/zauru/specialItem.utils.js +69 -0
  23. package/dist/cjs/zauru/templates.utils.js +102 -0
  24. package/dist/cjs/zauru/tiposMuestra.utils.js +69 -0
  25. package/dist/cjs/zauru/webapp-tables.utils.js +20 -0
  26. package/package.json +12 -9
  27. package/CHANGELOG.md +0 -256
  28. package/src/index.ts +0 -24
  29. package/src/zauru/4pinos-receptions-form-history.utils.ts +0 -142
  30. package/src/zauru/automatic-number.utils.ts +0 -38
  31. package/src/zauru/bitacora-edicion-masiva.utils.ts +0 -99
  32. package/src/zauru/bundles.utils.ts +0 -251
  33. package/src/zauru/cases.utils.ts +0 -31
  34. package/src/zauru/consolidated-history.utils.ts +0 -102
  35. package/src/zauru/costos-items.utils.ts +0 -871
  36. package/src/zauru/deliveries.utils.ts +0 -77
  37. package/src/zauru/discharges-histsory.utils.ts +0 -105
  38. package/src/zauru/employees.utils.ts +0 -59
  39. package/src/zauru/form.utils.ts +0 -243
  40. package/src/zauru/invoices.utils.ts +0 -114
  41. package/src/zauru/items.utils.ts +0 -221
  42. package/src/zauru/lotes.utils.ts +0 -411
  43. package/src/zauru/motivos-rechazo.utils.ts +0 -47
  44. package/src/zauru/payees.utils.ts +0 -213
  45. package/src/zauru/profiles.utils.ts +0 -44
  46. package/src/zauru/providers.utils.ts +0 -67
  47. package/src/zauru/purchase-orders.utils.ts +0 -594
  48. package/src/zauru/shipments.utils.ts +0 -139
  49. package/src/zauru/specialItem.utils.ts +0 -136
  50. package/src/zauru/templates.utils.ts +0 -199
  51. package/src/zauru/tiposMuestra.utils.ts +0 -136
  52. package/src/zauru/webapp-tables.utils.ts +0 -36
  53. package/tsconfig.json +0 -24
  54. /package/dist/{index.js → esm/index.js} +0 -0
  55. /package/dist/{zauru → esm/zauru}/4pinos-receptions-form-history.utils.js +0 -0
  56. /package/dist/{zauru → esm/zauru}/automatic-number.utils.js +0 -0
  57. /package/dist/{zauru → esm/zauru}/bitacora-edicion-masiva.utils.js +0 -0
  58. /package/dist/{zauru → esm/zauru}/bundles.utils.js +0 -0
  59. /package/dist/{zauru → esm/zauru}/cases.utils.js +0 -0
  60. /package/dist/{zauru → esm/zauru}/consolidated-history.utils.js +0 -0
  61. /package/dist/{zauru → esm/zauru}/costos-items.utils.js +0 -0
  62. /package/dist/{zauru → esm/zauru}/deliveries.utils.js +0 -0
  63. /package/dist/{zauru → esm/zauru}/discharges-histsory.utils.js +0 -0
  64. /package/dist/{zauru → esm/zauru}/employees.utils.js +0 -0
  65. /package/dist/{zauru → esm/zauru}/form.utils.js +0 -0
  66. /package/dist/{zauru → esm/zauru}/invoices.utils.js +0 -0
  67. /package/dist/{zauru → esm/zauru}/items.utils.js +0 -0
  68. /package/dist/{zauru → esm/zauru}/lotes.utils.js +0 -0
  69. /package/dist/{zauru → esm/zauru}/motivos-rechazo.utils.js +0 -0
  70. /package/dist/{zauru → esm/zauru}/payees.utils.js +0 -0
  71. /package/dist/{zauru → esm/zauru}/profiles.utils.js +0 -0
  72. /package/dist/{zauru → esm/zauru}/providers.utils.js +0 -0
  73. /package/dist/{zauru → esm/zauru}/purchase-orders.utils.js +0 -0
  74. /package/dist/{zauru → esm/zauru}/shipments.utils.js +0 -0
  75. /package/dist/{zauru → esm/zauru}/specialItem.utils.js +0 -0
  76. /package/dist/{zauru → esm/zauru}/templates.utils.js +0 -0
  77. /package/dist/{zauru → esm/zauru}/tiposMuestra.utils.js +0 -0
  78. /package/dist/{zauru → esm/zauru}/webapp-tables.utils.js +0 -0
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateTipoMuestra = exports.deleteTipoMuestra = exports.createTipoMuestra = exports.getTipoMuestras = void 0;
4
+ const common_1 = require("@zauru-sdk/common");
5
+ const services_1 = require("@zauru-sdk/services");
6
+ /**
7
+ * Get tipoMuestras from the web app table.
8
+ * @param headers Request headers.
9
+ * @param session Session object.
10
+ * @returns A Promise of AxiosUtilsResponse<WebAppRowGraphQL<TipoMuestra>[]>>.
11
+ */
12
+ const getTipoMuestras = (headers, session) => {
13
+ return (0, common_1.handlePossibleAxiosErrors)(async () => {
14
+ const { tipo_muestra_web_app_table_id } = await (0, services_1.getVariablesByName)(headers, session, ["tipo_muestra_web_app_table_id"]);
15
+ const response = await (0, services_1.getWebAppTableRegisters)(session, tipo_muestra_web_app_table_id);
16
+ if (response.error) {
17
+ throw new Error(`Ocurrió un error al consultar los tipos de muestra: ${response.userMsg}`);
18
+ }
19
+ const tipoMuestras = response.data ?? [];
20
+ return tipoMuestras;
21
+ });
22
+ };
23
+ exports.getTipoMuestras = getTipoMuestras;
24
+ /**
25
+ * Create a tipoMuestra in the web app table.
26
+ * @param headers Request headers.
27
+ * @param session Session object.
28
+ * @param body TipoMuestra data to be created.
29
+ * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
30
+ */
31
+ const createTipoMuestra = (headers, session, body) => {
32
+ return (0, common_1.handlePossibleAxiosErrors)(async () => {
33
+ const { tipo_muestra_web_app_table_id } = await (0, services_1.getVariablesByName)(headers, session, ["tipo_muestra_web_app_table_id"]);
34
+ const response = await (0, services_1.createWebAppTableRegister)(headers, tipo_muestra_web_app_table_id, body);
35
+ return response;
36
+ });
37
+ };
38
+ exports.createTipoMuestra = createTipoMuestra;
39
+ /**
40
+ * Delete a tipoMuestra from the web app table.
41
+ * @param headers Request headers.
42
+ * @param session Session object.
43
+ * @param id ID of the tipoMuestra to be deleted.
44
+ * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
45
+ */
46
+ const deleteTipoMuestra = (headers, session, id) => {
47
+ return (0, common_1.handlePossibleAxiosErrors)(async () => {
48
+ const { tipo_muestra_web_app_table_id } = await (0, services_1.getVariablesByName)(headers, session, ["tipo_muestra_web_app_table_id"]);
49
+ const response = await (0, services_1.deleteWebAppTableRegister)(headers, tipo_muestra_web_app_table_id, Number(id));
50
+ return response;
51
+ });
52
+ };
53
+ exports.deleteTipoMuestra = deleteTipoMuestra;
54
+ /**
55
+ * Update a tipoMuestra in the web app table.
56
+ * @param headers Request headers.
57
+ * @param session Session object.
58
+ * @param id ID of the tipoMuestra to be updated.
59
+ * @param body Updated tipoMuestra data.
60
+ * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
61
+ */
62
+ const updateTipoMuestra = (headers, session, id, body) => {
63
+ return (0, common_1.handlePossibleAxiosErrors)(async () => {
64
+ const { tipo_muestra_web_app_table_id } = await (0, services_1.getVariablesByName)(headers, session, ["tipo_muestra_web_app_table_id"]);
65
+ const response = await (0, services_1.updateWebAppTableRegister)(headers, tipo_muestra_web_app_table_id, Number(id), body);
66
+ return response;
67
+ });
68
+ };
69
+ exports.updateTipoMuestra = updateTipoMuestra;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getReceptionTypes = void 0;
4
+ const common_1 = require("@zauru-sdk/common");
5
+ const services_1 = require("@zauru-sdk/services");
6
+ /**
7
+ * Get template history entries from the web app table.
8
+ * @param headers Request headers.
9
+ * @param session Session object.
10
+ * @returns A Promise of AxiosUtilsResponse<ReceptionType[]>.
11
+ */
12
+ const getReceptionTypes = (headers, session) => {
13
+ return (0, common_1.handlePossibleAxiosErrors)(async () => {
14
+ const { recepciones_receptions_type_table_id } = await (0, services_1.getVariablesByName)(headers, session, ["recepciones_receptions_type_table_id"]);
15
+ const response = await (0, services_1.getWebAppTableRegisters)(session, recepciones_receptions_type_table_id);
16
+ const receptionTypes = response?.data ?? [];
17
+ return receptionTypes;
18
+ });
19
+ };
20
+ exports.getReceptionTypes = getReceptionTypes;
package/package.json CHANGED
@@ -1,17 +1,23 @@
1
1
  {
2
2
  "name": "@zauru-sdk/utils",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "description": "Utilidades, parseo de request y demás para desarrollo de webapps de Zauru",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "./dist/cjs/index.js",
6
+ "module": "./dist/esm/index.js",
7
+ "types": "./dist/index.d.ts",
7
8
  "type": "module",
8
9
  "publishConfig": {
9
10
  "access": "public"
10
11
  },
11
12
  "scripts": {
12
- "build": "tsc",
13
+ "build": "npm run build:cjs && npm run build:esm",
14
+ "build:cjs": "tsc -p tsconfig.cjs.json",
15
+ "build:esm": "tsc -p tsconfig.esm.json",
13
16
  "test": "echo \"Error: no test specified\" && exit 1"
14
17
  },
18
+ "files": [
19
+ "dist"
20
+ ],
15
21
  "author": "Oscar Cuéllar",
16
22
  "license": "MIT",
17
23
  "devDependencies": {
@@ -22,11 +28,8 @@
22
28
  "@zauru-sdk/common": "^1.0.50",
23
29
  "@zauru-sdk/config": "^1.0.48",
24
30
  "@zauru-sdk/graphql": "^1.0.48",
25
- "@zauru-sdk/services": "^1.0.50",
31
+ "@zauru-sdk/services": "^1.0.52",
26
32
  "@zauru-sdk/types": "^1.0.49"
27
33
  },
28
- "engines": {
29
- "node": ">=18.0.0"
30
- },
31
- "gitHead": "e3705ad637542bb4a7d22b01f0e7f837f332c6de"
34
+ "gitHead": "f5c0e92ea8dbca13f636f8bdeaf3976a0b294424"
32
35
  }
package/CHANGELOG.md DELETED
@@ -1,256 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [1.0.50](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.49...v1.0.50) (2024-04-02)
7
-
8
- **Note:** Version bump only for package @zauru-sdk/utils
9
-
10
-
11
-
12
-
13
-
14
- ## [1.0.49](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.48...v1.0.49) (2024-04-02)
15
-
16
- **Note:** Version bump only for package @zauru-sdk/utils
17
-
18
-
19
-
20
-
21
-
22
- ## [1.0.48](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.47...v1.0.48) (2024-04-02)
23
-
24
- **Note:** Version bump only for package @zauru-sdk/utils
25
-
26
-
27
-
28
-
29
-
30
- ## [1.0.47](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.46...v1.0.47) (2024-04-02)
31
-
32
- **Note:** Version bump only for package @zauru-sdk/utils
33
-
34
-
35
-
36
-
37
-
38
- ## [1.0.46](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.45...v1.0.46) (2024-04-02)
39
-
40
- **Note:** Version bump only for package @zauru-sdk/utils
41
-
42
-
43
-
44
-
45
-
46
- ## [1.0.45](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.44...v1.0.45) (2024-04-01)
47
-
48
- **Note:** Version bump only for package @zauru-sdk/utils
49
-
50
-
51
-
52
-
53
-
54
- ## [1.0.44](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.43...v1.0.44) (2024-04-01)
55
-
56
- **Note:** Version bump only for package @zauru-sdk/utils
57
-
58
-
59
-
60
-
61
-
62
- ## [1.0.33](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.32...v1.0.33) (2024-03-25)
63
-
64
- **Note:** Version bump only for package @zauru-sdk/utils
65
-
66
-
67
-
68
-
69
-
70
- ## [1.0.32](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.31...v1.0.32) (2024-03-25)
71
-
72
- **Note:** Version bump only for package @zauru-sdk/utils
73
-
74
-
75
-
76
-
77
-
78
- ## [1.0.31](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.30...v1.0.31) (2024-03-25)
79
-
80
- **Note:** Version bump only for package @zauru-sdk/utils
81
-
82
-
83
-
84
-
85
-
86
- ## [1.0.30](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.29...v1.0.30) (2024-03-25)
87
-
88
- **Note:** Version bump only for package @zauru-sdk/utils
89
-
90
-
91
-
92
-
93
-
94
- ## [1.0.29](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.28...v1.0.29) (2024-03-25)
95
-
96
- **Note:** Version bump only for package @zauru-sdk/utils
97
-
98
-
99
-
100
-
101
-
102
- ## [1.0.26](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.25...v1.0.26) (2024-03-25)
103
-
104
- **Note:** Version bump only for package @zauru-sdk/utils
105
-
106
-
107
-
108
-
109
-
110
- ## [1.0.25](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.24...v1.0.25) (2024-03-25)
111
-
112
- **Note:** Version bump only for package @zauru-sdk/utils
113
-
114
-
115
-
116
-
117
-
118
- ## [1.0.24](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.23...v1.0.24) (2024-03-25)
119
-
120
- **Note:** Version bump only for package @zauru-sdk/utils
121
-
122
-
123
-
124
-
125
-
126
- ## [1.0.23](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.22...v1.0.23) (2024-03-22)
127
-
128
- **Note:** Version bump only for package @zauru-sdk/utils
129
-
130
-
131
-
132
-
133
-
134
- ## [1.0.20](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.19...v1.0.20) (2024-03-22)
135
-
136
- **Note:** Version bump only for package @zauru-sdk/utils
137
-
138
-
139
-
140
-
141
-
142
- ## [1.0.18](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.17...v1.0.18) (2024-03-22)
143
-
144
- **Note:** Version bump only for package @zauru-sdk/utils
145
-
146
-
147
-
148
-
149
-
150
- ## [1.0.17](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.16...v1.0.17) (2024-03-21)
151
-
152
- **Note:** Version bump only for package @zauru-sdk/utils
153
-
154
-
155
-
156
-
157
-
158
- ## [1.0.16](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.15...v1.0.16) (2024-03-21)
159
-
160
- **Note:** Version bump only for package @zauru-sdk/utils
161
-
162
-
163
-
164
-
165
-
166
- ## [1.0.15](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.14...v1.0.15) (2024-03-21)
167
-
168
- **Note:** Version bump only for package @zauru-sdk/utils
169
-
170
-
171
-
172
-
173
-
174
- ## [1.0.13](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.12...v1.0.13) (2024-03-21)
175
-
176
- **Note:** Version bump only for package @zauru-sdk/utils
177
-
178
-
179
-
180
-
181
-
182
- ## [1.0.10](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.9...v1.0.10) (2024-03-17)
183
-
184
- **Note:** Version bump only for package @zauru-sdk/utils
185
-
186
-
187
-
188
-
189
-
190
- ## [1.0.9](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.8...v1.0.9) (2024-03-16)
191
-
192
- **Note:** Version bump only for package @zauru-sdk/utils
193
-
194
-
195
-
196
-
197
-
198
- ## [1.0.8](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.7...v1.0.8) (2024-03-16)
199
-
200
- **Note:** Version bump only for package @zauru-sdk/utils
201
-
202
-
203
-
204
-
205
-
206
- ## [1.0.7](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.6...v1.0.7) (2024-03-16)
207
-
208
- **Note:** Version bump only for package @zauru-sdk/utils
209
-
210
-
211
-
212
-
213
-
214
- ## [1.0.6](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.5...v1.0.6) (2024-03-16)
215
-
216
- **Note:** Version bump only for package @zauru-sdk/utils
217
-
218
-
219
-
220
-
221
-
222
- ## [1.0.5](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.4...v1.0.5) (2024-03-16)
223
-
224
- **Note:** Version bump only for package @zauru-sdk/utils
225
-
226
-
227
-
228
-
229
-
230
- ## [1.0.4](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.3...v1.0.4) (2024-03-15)
231
-
232
- **Note:** Version bump only for package @zauru-sdk/utils
233
-
234
-
235
-
236
-
237
-
238
- ## [1.0.3](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.2...v1.0.3) (2024-03-15)
239
-
240
- **Note:** Version bump only for package @zauru-sdk/utils
241
-
242
-
243
-
244
-
245
-
246
- ## [1.0.2](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.1...v1.0.2) (2024-03-15)
247
-
248
- **Note:** Version bump only for package @zauru-sdk/utils
249
-
250
-
251
-
252
-
253
-
254
- ## 1.0.1 (2024-03-15)
255
-
256
- **Note:** Version bump only for package @zauru-sdk/utils
package/src/index.ts DELETED
@@ -1,24 +0,0 @@
1
- export * from "./zauru/4pinos-receptions-form-history.utils.js";
2
- export * from "./zauru/automatic-number.utils.js";
3
- export * from "./zauru/bitacora-edicion-masiva.utils.js";
4
- export * from "./zauru/bundles.utils.js";
5
- export * from "./zauru/cases.utils.js";
6
- export * from "./zauru/consolidated-history.utils.js";
7
- export * from "./zauru/costos-items.utils.js";
8
- export * from "./zauru/deliveries.utils.js";
9
- export * from "./zauru/discharges-histsory.utils.js";
10
- export * from "./zauru/employees.utils.js";
11
- export * from "./zauru/form.utils.js";
12
- export * from "./zauru/invoices.utils.js";
13
- export * from "./zauru/items.utils.js";
14
- export * from "./zauru/lotes.utils.js";
15
- export * from "./zauru/motivos-rechazo.utils.js";
16
- export * from "./zauru/payees.utils.js";
17
- export * from "./zauru/profiles.utils.js";
18
- export * from "./zauru/providers.utils.js";
19
- export * from "./zauru/purchase-orders.utils.js";
20
- export * from "./zauru/shipments.utils.js";
21
- export * from "./zauru/specialItem.utils.js";
22
- export * from "./zauru/templates.utils.js";
23
- export * from "./zauru/tiposMuestra.utils.js";
24
- export * from "./zauru/webapp-tables.utils.js";
@@ -1,142 +0,0 @@
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 const 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 const 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 const 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 const 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
- };
@@ -1,38 +0,0 @@
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
- };
@@ -1,99 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
- import {
4
- createWebAppTableRegister,
5
- getVariablesByName,
6
- getWebAppTableRegisters,
7
- updateWebAppTableRegister,
8
- } from "@zauru-sdk/services";
9
- import {
10
- AxiosUtilsResponse,
11
- WebAppTableUpdateResponse,
12
- BitacoraPOMassive,
13
- WebAppRowGraphQL,
14
- } from "@zauru-sdk/types";
15
-
16
- /**
17
- * Get saveBitacoraPOMassive from the web app table.
18
- * @param headers Request headers.
19
- * @param session Session object.
20
- * @returns A Promise of AxiosUtilsResponse<WebAppRowGraphQL<BitacoraPOMassive>[]>.
21
- */
22
- export const saveBitacoraPOMassive = (
23
- headers: any,
24
- session: Session,
25
- body: BitacoraPOMassive
26
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
27
- return handlePossibleAxiosErrors(async () => {
28
- const { bitacora_ediciones_masivas_web_app_table_id } =
29
- await getVariablesByName(headers, session, [
30
- "bitacora_ediciones_masivas_web_app_table_id",
31
- ]);
32
-
33
- const response = await createWebAppTableRegister<BitacoraPOMassive>(
34
- headers,
35
- bitacora_ediciones_masivas_web_app_table_id,
36
- { ...body, modificadoPor: session.get("name") }
37
- );
38
-
39
- return response;
40
- });
41
- };
42
-
43
- /**
44
- * Get getBitacorasPOMassive from the web app table.
45
- * @param headers Request headers.
46
- * @param session Session object.
47
- * @returns A Promise of AxiosUtilsResponse<WebAppRowGraphQL<BitacoraPOMassive>[]>.
48
- */
49
- export const getBitacorasPOMassive = (
50
- headers: any,
51
- session: Session
52
- ): Promise<AxiosUtilsResponse<WebAppRowGraphQL<BitacoraPOMassive>[]>> => {
53
- return handlePossibleAxiosErrors(async () => {
54
- const { bitacora_ediciones_masivas_web_app_table_id } =
55
- await getVariablesByName(headers, session, [
56
- "bitacora_ediciones_masivas_web_app_table_id",
57
- ]);
58
-
59
- const response = await getWebAppTableRegisters<BitacoraPOMassive>(
60
- session,
61
- bitacora_ediciones_masivas_web_app_table_id
62
- );
63
-
64
- if (response.error || !response.data) {
65
- throw new Error(response.userMsg);
66
- }
67
-
68
- return response.data;
69
- });
70
- };
71
-
72
- /**
73
- * Put updateBitacorasPOMassive from the web app table.
74
- * @param headers Request headers.
75
- * @param session Session object.
76
- * @returns A Promise of AxiosUtilsResponse<BitacorasPOMassiveWebAppTable[]>.
77
- */
78
- export const updateBitacorasPOMassive = (
79
- headers: any,
80
- session: Session,
81
- body: BitacoraPOMassive,
82
- id_registro: string | number
83
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
84
- return handlePossibleAxiosErrors(async () => {
85
- const { bitacora_ediciones_masivas_web_app_table_id } =
86
- await getVariablesByName(headers, session, [
87
- "bitacora_ediciones_masivas_web_app_table_id",
88
- ]);
89
-
90
- const response = await updateWebAppTableRegister<BitacoraPOMassive>(
91
- headers,
92
- bitacora_ediciones_masivas_web_app_table_id,
93
- id_registro,
94
- { ...body, modificadoPor: session.get("name") }
95
- );
96
-
97
- return response;
98
- });
99
- };