@zauru-sdk/utils 1.0.49 → 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 +13 -10
  27. package/CHANGELOG.md +0 -248
  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
@@ -1,139 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { getDatePickerCurrentDate, handlePossibleAxiosErrors, reduceAdd } from "@zauru-sdk/common";
3
- import { getDeliveryByBooking, getMyAgencyLotStocks, getShipmentsByToAgencyLast100Id_booking, getVariablesByName, insertBookings } from "@zauru-sdk/services";
4
- import { AxiosUtilsResponse, InsertBookingBody, MovementGraphQL, ShipmentGraphQL } from "@zauru-sdk/types";
5
-
6
- /**
7
- *
8
- * @param headers
9
- * @param session
10
- * @returns
11
- */
12
- export const getShipmentsToMyAgency = async (
13
- session: Session
14
- ): Promise<AxiosUtilsResponse<ShipmentGraphQL[]>> => {
15
- return handlePossibleAxiosErrors(async () => {
16
- const response = await getShipmentsByToAgencyLast100Id_booking(
17
- session,
18
- session.get("agency_id")
19
- );
20
-
21
- if (response.error) {
22
- throw new Error(
23
- `Ocurrió un error al consultar los envíos a mi agencia actual: ${response.userMsg}`
24
- );
25
- }
26
-
27
- return response?.data ?? [];
28
- });
29
- };
30
-
31
- /**
32
- *
33
- * @param headers
34
- * @param session
35
- * @param props
36
- * @returns
37
- */
38
- export const shipmentToVirtualClientAgency = async (
39
- headers: any,
40
- session: Session,
41
- props: {
42
- deliver_quantity: number;
43
- item_id: number;
44
- esPerecedero?: boolean;
45
- }
46
- ): Promise<AxiosUtilsResponse<boolean>> => {
47
- return handlePossibleAxiosErrors(async () => {
48
- const { virtual_client_agency_id } = await getVariablesByName(
49
- headers,
50
- session,
51
- ["virtual_client_agency_id"]
52
- );
53
-
54
- let bookingBody: Partial<InsertBookingBody> = {};
55
-
56
- if (props?.esPerecedero) {
57
- const responseStocks = await getMyAgencyLotStocks(session);
58
- if (!responseStocks.data || responseStocks.error) {
59
- throw new Error(
60
- `Ocurrió un error al tratar de obtener los stocks de mi agencia. ${responseStocks.userMsg}`
61
- );
62
- }
63
-
64
- let deliverQuantity = props.deliver_quantity;
65
- const itemStocks = responseStocks.data
66
- .filter((x) => x.lot.item_id === props.item_id)
67
- .sort((a, b) => b.available - a.available);
68
-
69
- if (
70
- itemStocks.map((x) => x.available).reduce(reduceAdd, 0) <
71
- props.deliver_quantity
72
- ) {
73
- throw new Error(
74
- `No hay suficiente stock en los lotes para realizar el descuento.`
75
- );
76
- }
77
-
78
- const movements: Partial<MovementGraphQL>[] = itemStocks.reduce(
79
- (acc: Partial<MovementGraphQL>[], stock) => {
80
- if (deliverQuantity > 0 && stock.available > 0) {
81
- const bookedQuantity = Math.min(stock.available, deliverQuantity);
82
- deliverQuantity -= bookedQuantity;
83
-
84
- acc.push({
85
- item_id: props.item_id,
86
- booked_quantity: bookedQuantity,
87
- lot_id: stock.lot_id,
88
- });
89
- }
90
- return acc;
91
- },
92
- []
93
- );
94
-
95
- bookingBody = {
96
- reference: "LABORATORIO - Descuento de stock, desde webapp.",
97
- agency_from_id: session.get("agency_id"),
98
- agency_to_id: Number(virtual_client_agency_id),
99
- booker_id: session.get("employee_id"),
100
- transporter_id: session.get("employee_id"),
101
- planned_delivery: getDatePickerCurrentDate(),
102
- needs_transport: false,
103
- movements,
104
- };
105
- } else {
106
- bookingBody = {
107
- reference: "LABORATORIO - Descuento de stock, desde webapp.",
108
- agency_from_id: session.get("agency_id"),
109
- agency_to_id: Number(virtual_client_agency_id),
110
- booker_id: session.get("employee_id"),
111
- transporter_id: session.get("employee_id"),
112
- planned_delivery: getDatePickerCurrentDate(),
113
- needs_transport: false,
114
- movements: [
115
- { item_id: props.item_id, booked_quantity: props.deliver_quantity },
116
- ],
117
- };
118
- }
119
-
120
- const response1 = await insertBookings(headers, bookingBody);
121
-
122
- if (response1.error || !response1.data) {
123
- throw new Error(
124
- `Ocurrió un error al tratar de crear el envío a agencia virtual de cliente: ${response1.userMsg}`
125
- );
126
- }
127
-
128
- //Entregar el envío
129
- const response2 = await getDeliveryByBooking(headers, response1.data.id);
130
-
131
- if (response2.error || !response2.data) {
132
- throw new Error(
133
- `Ocurrió un error al tratar de recibir: ${response1.userMsg}`
134
- );
135
- }
136
-
137
- return true;
138
- });
139
- };
@@ -1,136 +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
- SpecialItem,
13
- WebAppRowGraphQL,
14
- WebAppTableUpdateResponse,
15
- } from "@zauru-sdk/types";
16
-
17
- /**
18
- * Get specialItems from the web app table.
19
- * @param headers Request headers.
20
- * @param session Session object.
21
- * @returns A Promise of AxiosUtilsResponse<WebAppRowGraphQL<SpecialItem>[]>>.
22
- */
23
- export const getSpecialItems = (
24
- headers: any,
25
- session: Session
26
- ): Promise<AxiosUtilsResponse<WebAppRowGraphQL<SpecialItem>[]>> => {
27
- return handlePossibleAxiosErrors(async () => {
28
- const { special_product_web_app_table_id } = await getVariablesByName(
29
- headers,
30
- session,
31
- ["special_product_web_app_table_id"]
32
- );
33
-
34
- const response = await getWebAppTableRegisters<SpecialItem>(
35
- session,
36
- special_product_web_app_table_id
37
- );
38
-
39
- if (response.error) {
40
- throw new Error(
41
- `Ocurrió un error al consultar los items especiales: ${response.userMsg}`
42
- );
43
- }
44
-
45
- const specialItems = response.data ?? [];
46
-
47
- return specialItems;
48
- });
49
- };
50
-
51
- /**
52
- * Create a specialItem in the web app table.
53
- * @param headers Request headers.
54
- * @param session Session object.
55
- * @param body SpecialItem data to be created.
56
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
57
- */
58
- export const createSpecialItem = (
59
- headers: any,
60
- session: Session,
61
- body: SpecialItem
62
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
63
- return handlePossibleAxiosErrors(async () => {
64
- const { special_product_web_app_table_id } = await getVariablesByName(
65
- headers,
66
- session,
67
- ["special_product_web_app_table_id"]
68
- );
69
- const response = await createWebAppTableRegister<SpecialItem>(
70
- headers,
71
- special_product_web_app_table_id,
72
- body
73
- );
74
- return response;
75
- });
76
- };
77
-
78
- /**
79
- * Delete a specialItem from the web app table.
80
- * @param headers Request headers.
81
- * @param session Session object.
82
- * @param id ID of the specialItem to be deleted.
83
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
84
- */
85
- export const deleteSpecialItem = (
86
- headers: any,
87
- session: Session,
88
- id: string
89
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
90
- return handlePossibleAxiosErrors(async () => {
91
- const { special_product_web_app_table_id } = await getVariablesByName(
92
- headers,
93
- session,
94
- ["special_product_web_app_table_id"]
95
- );
96
-
97
- const response = await deleteWebAppTableRegister(
98
- headers,
99
- special_product_web_app_table_id,
100
- Number(id)
101
- );
102
- return response;
103
- });
104
- };
105
-
106
- /**
107
- * Update a specialItem in the web app table.
108
- * @param headers Request headers.
109
- * @param session Session object.
110
- * @param id ID of the specialItem to be updated.
111
- * @param body Updated specialItem data.
112
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
113
- */
114
- export const updateSpecialItem = (
115
- headers: any,
116
- session: Session,
117
- id: string,
118
- body: Partial<SpecialItem>
119
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
120
- return handlePossibleAxiosErrors(async () => {
121
- const { special_product_web_app_table_id } = await getVariablesByName(
122
- headers,
123
- session,
124
- ["special_product_web_app_table_id"]
125
- );
126
-
127
- const response = await updateWebAppTableRegister(
128
- headers,
129
- special_product_web_app_table_id,
130
- Number(id),
131
- body
132
- );
133
-
134
- return response;
135
- });
136
- };
@@ -1,199 +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
- WebAppRowGraphQL,
13
- Template,
14
- WebAppTableUpdateResponse,
15
- HistoryTemplate,
16
- } from "@zauru-sdk/types";
17
-
18
- /**
19
- * Get templates from the web app table.
20
- * @param headers Request headers.
21
- * @param session Session object.
22
- * @returns A Promise of AxiosUtilsResponse<TemplateWebAppTable[]>.
23
- */
24
- export const getTemplates = (
25
- headers: any,
26
- session: Session
27
- ): Promise<AxiosUtilsResponse<WebAppRowGraphQL<Template>[]>> => {
28
- return handlePossibleAxiosErrors(async () => {
29
- const { templates_web_app_table_id } = await getVariablesByName(
30
- headers,
31
- session,
32
- ["templates_web_app_table_id"]
33
- );
34
-
35
- const response = await getWebAppTableRegisters<Template>(
36
- session,
37
- templates_web_app_table_id
38
- );
39
-
40
- if (response.error) {
41
- throw new Error(
42
- `Ocurrió un error al intentar obtener los templates: ${response.userMsg}`
43
- );
44
- }
45
-
46
- const templateRegisters = response.data ?? [];
47
-
48
- return templateRegisters;
49
- });
50
- };
51
-
52
- /**
53
- * Create a template in the web app table.
54
- * @param headers Request headers.
55
- * @param session Session object.
56
- * @param body Template data to be created.
57
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
58
- */
59
- export const createTemplate = (
60
- headers: any,
61
- session: Session,
62
- body: Template
63
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
64
- return handlePossibleAxiosErrors(async () => {
65
- const { templates_web_app_table_id } = await getVariablesByName(
66
- headers,
67
- session,
68
- ["templates_web_app_table_id"]
69
- );
70
- const response = await createWebAppTableRegister<Template>(
71
- headers,
72
- templates_web_app_table_id,
73
- body
74
- );
75
- return response;
76
- });
77
- };
78
-
79
- /**
80
- * Delete a template from the web app table.
81
- * @param headers Request headers.
82
- * @param session Session object.
83
- * @param id ID of the template to be deleted.
84
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
85
- */
86
- export const deleteTemplate = (
87
- headers: any,
88
- session: Session,
89
- id: string
90
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
91
- return handlePossibleAxiosErrors(async () => {
92
- const { templates_web_app_table_id } = await getVariablesByName(
93
- headers,
94
- session,
95
- ["templates_web_app_table_id"]
96
- );
97
-
98
- const response = await deleteWebAppTableRegister(
99
- headers,
100
- templates_web_app_table_id,
101
- Number(id)
102
- );
103
- return response;
104
- });
105
- };
106
-
107
- /**
108
- * Update a template in the web app table.
109
- * @param headers Request headers.
110
- * @param session Session object.
111
- * @param id ID of the template to be updated.
112
- * @param body Updated template data.
113
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
114
- */
115
- export const updateTemplate = (
116
- headers: any,
117
- session: Session,
118
- id: string,
119
- body: Partial<Template>
120
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
121
- return handlePossibleAxiosErrors(async () => {
122
- const { templates_web_app_table_id } = await getVariablesByName(
123
- headers,
124
- session,
125
- ["templates_web_app_table_id"]
126
- );
127
-
128
- const response = await updateWebAppTableRegister(
129
- headers,
130
- templates_web_app_table_id,
131
- Number(id),
132
- body
133
- );
134
-
135
- return response;
136
- });
137
- };
138
-
139
- /**
140
- * Create a template history entry in the web app table.
141
- * @param headers Request headers.
142
- * @param session Session object.
143
- * @param body Template history data to be created.
144
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
145
- */
146
- export const createTemplateHistory = (
147
- headers: any,
148
- session: Session,
149
- body: Partial<HistoryTemplate>
150
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
151
- return handlePossibleAxiosErrors(async () => {
152
- const { history_templates_web_app_table_id } = await getVariablesByName(
153
- headers,
154
- session,
155
- ["history_templates_web_app_table_id"]
156
- );
157
-
158
- const response = await createWebAppTableRegister<Partial<HistoryTemplate>>(
159
- headers,
160
- history_templates_web_app_table_id,
161
- body
162
- );
163
-
164
- return response;
165
- });
166
- };
167
-
168
- /**
169
- * Get template history entries from the web app table.
170
- * @param headers Request headers.
171
- * @param session Session object.
172
- * @returns A Promise of AxiosUtilsResponse<TemplateHistoryWebAppTable[]>.
173
- */
174
- export const getTemplatesHistory = (
175
- headers: any,
176
- session: Session
177
- ): Promise<AxiosUtilsResponse<WebAppRowGraphQL<HistoryTemplate>[]>> => {
178
- return handlePossibleAxiosErrors(async () => {
179
- const { history_templates_web_app_table_id } = await getVariablesByName(
180
- headers,
181
- session,
182
- ["history_templates_web_app_table_id"]
183
- );
184
- const response = await getWebAppTableRegisters<HistoryTemplate>(
185
- session,
186
- history_templates_web_app_table_id
187
- );
188
-
189
- if (response.error) {
190
- throw new Error(
191
- `Ocurrió un error al intentar obtener los history templates: ${response.userMsg}`
192
- );
193
- }
194
-
195
- const templateRegisters = response.data ?? [];
196
-
197
- return templateRegisters;
198
- });
199
- };
@@ -1,136 +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
- WebAppRowGraphQL,
12
- TipoMuestra,
13
- AxiosUtilsResponse,
14
- WebAppTableUpdateResponse,
15
- } from "@zauru-sdk/types";
16
-
17
- /**
18
- * Get tipoMuestras from the web app table.
19
- * @param headers Request headers.
20
- * @param session Session object.
21
- * @returns A Promise of AxiosUtilsResponse<WebAppRowGraphQL<TipoMuestra>[]>>.
22
- */
23
- export const getTipoMuestras = (
24
- headers: any,
25
- session: Session
26
- ): Promise<AxiosUtilsResponse<WebAppRowGraphQL<TipoMuestra>[]>> => {
27
- return handlePossibleAxiosErrors(async () => {
28
- const { tipo_muestra_web_app_table_id } = await getVariablesByName(
29
- headers,
30
- session,
31
- ["tipo_muestra_web_app_table_id"]
32
- );
33
-
34
- const response = await getWebAppTableRegisters<TipoMuestra>(
35
- session,
36
- tipo_muestra_web_app_table_id
37
- );
38
-
39
- if (response.error) {
40
- throw new Error(
41
- `Ocurrió un error al consultar los tipos de muestra: ${response.userMsg}`
42
- );
43
- }
44
-
45
- const tipoMuestras = response.data ?? [];
46
-
47
- return tipoMuestras;
48
- });
49
- };
50
-
51
- /**
52
- * Create a tipoMuestra in the web app table.
53
- * @param headers Request headers.
54
- * @param session Session object.
55
- * @param body TipoMuestra data to be created.
56
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
57
- */
58
- export const createTipoMuestra = (
59
- headers: any,
60
- session: Session,
61
- body: TipoMuestra
62
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
63
- return handlePossibleAxiosErrors(async () => {
64
- const { tipo_muestra_web_app_table_id } = await getVariablesByName(
65
- headers,
66
- session,
67
- ["tipo_muestra_web_app_table_id"]
68
- );
69
- const response = await createWebAppTableRegister<TipoMuestra>(
70
- headers,
71
- tipo_muestra_web_app_table_id,
72
- body
73
- );
74
- return response;
75
- });
76
- };
77
-
78
- /**
79
- * Delete a tipoMuestra from the web app table.
80
- * @param headers Request headers.
81
- * @param session Session object.
82
- * @param id ID of the tipoMuestra to be deleted.
83
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
84
- */
85
- export const deleteTipoMuestra = (
86
- headers: any,
87
- session: Session,
88
- id: string
89
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
90
- return handlePossibleAxiosErrors(async () => {
91
- const { tipo_muestra_web_app_table_id } = await getVariablesByName(
92
- headers,
93
- session,
94
- ["tipo_muestra_web_app_table_id"]
95
- );
96
-
97
- const response = await deleteWebAppTableRegister(
98
- headers,
99
- tipo_muestra_web_app_table_id,
100
- Number(id)
101
- );
102
- return response;
103
- });
104
- };
105
-
106
- /**
107
- * Update a tipoMuestra in the web app table.
108
- * @param headers Request headers.
109
- * @param session Session object.
110
- * @param id ID of the tipoMuestra to be updated.
111
- * @param body Updated tipoMuestra data.
112
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
113
- */
114
- export const updateTipoMuestra = (
115
- headers: any,
116
- session: Session,
117
- id: string,
118
- body: Partial<TipoMuestra>
119
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
120
- return handlePossibleAxiosErrors(async () => {
121
- const { tipo_muestra_web_app_table_id } = await getVariablesByName(
122
- headers,
123
- session,
124
- ["tipo_muestra_web_app_table_id"]
125
- );
126
-
127
- const response = await updateWebAppTableRegister(
128
- headers,
129
- tipo_muestra_web_app_table_id,
130
- Number(id),
131
- body
132
- );
133
-
134
- return response;
135
- });
136
- };
@@ -1,36 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
- import {
4
- getVariablesByName,
5
- getWebAppTableRegisters,
6
- } from "@zauru-sdk/services";
7
- import {
8
- AxiosUtilsResponse,
9
- WebAppRowGraphQL,
10
- ReceptionType,
11
- } from "@zauru-sdk/types";
12
-
13
- /**
14
- * Get template history entries from the web app table.
15
- * @param headers Request headers.
16
- * @param session Session object.
17
- * @returns A Promise of AxiosUtilsResponse<ReceptionType[]>.
18
- */
19
- export const getReceptionTypes = (
20
- headers: any,
21
- session: Session
22
- ): Promise<AxiosUtilsResponse<WebAppRowGraphQL<ReceptionType>[]>> => {
23
- return handlePossibleAxiosErrors(async () => {
24
- const { recepciones_receptions_type_table_id } = await getVariablesByName(
25
- headers,
26
- session,
27
- ["recepciones_receptions_type_table_id"]
28
- );
29
- const response = await getWebAppTableRegisters<ReceptionType>(
30
- session,
31
- recepciones_receptions_type_table_id
32
- );
33
- const receptionTypes = response?.data ?? [];
34
- return receptionTypes;
35
- });
36
- };
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "include": ["env.d.ts", "**/*.ts", "**/*.tsx"],
3
- "compilerOptions": {
4
- "allowSyntheticDefaultImports": true,
5
- "lib": ["ES2022"],
6
- "isolatedModules": true,
7
- "moduleResolution": "NodeNext",
8
- "module": "NodeNext",
9
- "esModuleInterop": true,
10
- "target": "ES2022",
11
- "strict": true,
12
- "allowJs": true,
13
- "skipLibCheck": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "baseUrl": ".",
16
- "outDir": "./dist",
17
- "rootDir": "./src",
18
- "declaration": true,
19
- "declarationDir": "./dist",
20
- "paths": {
21
- "~/*": ["./src/*"]
22
- }
23
- }
24
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes