@zauru-sdk/services 1.0.6 → 1.0.7

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 (65) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.d.ts +20 -0
  3. package/dist/index.js +20 -0
  4. package/dist/zauru/zauru-currencies.server.d.ts +6 -0
  5. package/dist/zauru/zauru-currencies.server.js +20 -0
  6. package/dist/zauru/zauru-deliveries.server.d.ts +22 -0
  7. package/dist/zauru/zauru-deliveries.server.js +44 -0
  8. package/dist/zauru/zauru-discharges.server.d.ts +26 -0
  9. package/dist/zauru/zauru-discharges.server.js +46 -0
  10. package/dist/zauru/zauru-employees.server.d.ts +6 -0
  11. package/dist/zauru/zauru-employees.server.js +23 -0
  12. package/dist/zauru/zauru-forms.server.d.ts +96 -0
  13. package/dist/zauru/zauru-forms.server.js +343 -0
  14. package/dist/zauru/zauru-invoices.server.d.ts +26 -0
  15. package/dist/zauru/zauru-invoices.server.js +94 -0
  16. package/dist/zauru/zauru-items.server.d.ts +91 -0
  17. package/dist/zauru/zauru-items.server.js +238 -0
  18. package/dist/zauru/zauru-lote-record.server.d.ts +8 -0
  19. package/dist/zauru/zauru-lote-record.server.js +26 -0
  20. package/dist/zauru/zauru-lotes.server.d.ts +91 -0
  21. package/dist/zauru/zauru-lotes.server.js +294 -0
  22. package/dist/zauru/zauru-motivos-rechazo.server.d.ts +9 -0
  23. package/dist/zauru/zauru-motivos-rechazo.server.js +49 -0
  24. package/dist/zauru/zauru-payees.server.d.ts +97 -0
  25. package/dist/zauru/zauru-payees.server.js +227 -0
  26. package/dist/zauru/zauru-payment-terms.server.d.ts +20 -0
  27. package/dist/zauru/zauru-payment-terms.server.js +65 -0
  28. package/dist/zauru/zauru-price-lists.server.d.ts +22 -0
  29. package/dist/zauru/zauru-price-lists.server.js +40 -0
  30. package/dist/zauru/zauru-purchase-orders.server.d.ts +160 -0
  31. package/dist/zauru/zauru-purchase-orders.server.js +414 -0
  32. package/dist/zauru/zauru-receptions.server.d.ts +33 -0
  33. package/dist/zauru/zauru-receptions.server.js +94 -0
  34. package/dist/zauru/zauru-shipments.server.d.ts +20 -0
  35. package/dist/zauru/zauru-shipments.server.js +53 -0
  36. package/dist/zauru/zauru-suggested-prices.server.d.ts +30 -0
  37. package/dist/zauru/zauru-suggested-prices.server.js +83 -0
  38. package/dist/zauru/zauru-tags.server.d.ts +7 -0
  39. package/dist/zauru/zauru-tags.server.js +13 -0
  40. package/dist/zauru/zauru-templates.server.d.ts +7 -0
  41. package/dist/zauru/zauru-templates.server.js +15 -0
  42. package/dist/zauru/zauru-web-app-tables.server.d.ts +48 -0
  43. package/dist/zauru/zauru-web-app-tables.server.js +120 -0
  44. package/package.json +6 -6
  45. package/src/index.ts +20 -0
  46. package/src/zauru/zauru-currencies.server.ts +39 -0
  47. package/src/zauru/zauru-deliveries.server.ts +70 -0
  48. package/src/zauru/zauru-discharges.server.ts +90 -0
  49. package/src/zauru/zauru-employees.server.ts +43 -0
  50. package/src/zauru/zauru-forms.server.ts +618 -0
  51. package/src/zauru/zauru-invoices.server.ts +142 -0
  52. package/src/zauru/zauru-items.server.ts +427 -0
  53. package/src/zauru/zauru-lote-record.server.ts +77 -0
  54. package/src/zauru/zauru-lotes.server.ts +484 -0
  55. package/src/zauru/zauru-motivos-rechazo.server.ts +121 -0
  56. package/src/zauru/zauru-payees.server.ts +398 -0
  57. package/src/zauru/zauru-payment-terms.server.ts +126 -0
  58. package/src/zauru/zauru-price-lists.server.ts +68 -0
  59. package/src/zauru/zauru-purchase-orders.server.ts +701 -0
  60. package/src/zauru/zauru-receptions.server.ts +148 -0
  61. package/src/zauru/zauru-shipments.server.ts +88 -0
  62. package/src/zauru/zauru-suggested-prices.server.ts +134 -0
  63. package/src/zauru/zauru-tags.server.ts +22 -0
  64. package/src/zauru/zauru-templates.server.ts +24 -0
  65. package/src/zauru/zauru-web-app-tables.server.ts +200 -0
@@ -0,0 +1,148 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import {
3
+ arrayToObject,
4
+ getDatePickerCurrentDate,
5
+ handlePossibleAxiosErrors,
6
+ } from "@zauru-sdk/common";
7
+ import {
8
+ AxiosUtilsResponse,
9
+ NewReceptionBody,
10
+ PurchaseOrderGraphQL,
11
+ } from "@zauru-sdk/types";
12
+ import httpZauru from "./httpZauru.server.js";
13
+
14
+ /**
15
+ * createNewReception
16
+ * @param headers
17
+ * @param body
18
+ * @param purchase_order_id
19
+ * @returns
20
+ */
21
+ export async function createNewReception(
22
+ headers: any,
23
+ body: NewReceptionBody,
24
+ purchase_order_id: number | string
25
+ ) {
26
+ return handlePossibleAxiosErrors(async () => {
27
+ const response = await httpZauru<any>(
28
+ `/purchases/purchase_orders/${purchase_order_id}/receptions.json`,
29
+ { method: "POST", headers, data: body }
30
+ );
31
+
32
+ return response.data;
33
+ });
34
+ }
35
+
36
+ /**
37
+ * deleteReception
38
+ * @param headers
39
+ * @param id
40
+ * @returns
41
+ */
42
+ export async function deleteReception(
43
+ headers: any,
44
+ receptionId: string | number,
45
+ poId: string | number
46
+ ): Promise<AxiosUtilsResponse<boolean>> {
47
+ return handlePossibleAxiosErrors(async () => {
48
+ await httpZauru.get(
49
+ `/purchases/receptions/${receptionId}/rebound.json?purchase_order_id=${poId}`,
50
+ {
51
+ headers,
52
+ }
53
+ );
54
+
55
+ return true;
56
+ });
57
+ }
58
+
59
+ /**
60
+ *
61
+ * @param headers
62
+ * @param poId
63
+ * @returns
64
+ */
65
+ export async function createNewPurchaseOrderReception(
66
+ headers: any,
67
+ session: Session,
68
+ body: Partial<PurchaseOrderGraphQL>
69
+ ): Promise<AxiosUtilsResponse<boolean>> {
70
+ return handlePossibleAxiosErrors(async () => {
71
+ const sendBody = {
72
+ reception: {
73
+ memo: "LABORATORIO - Recibido parcialmente desde WebApp",
74
+ purchase_order_id: body.id,
75
+ needs_transit: false,
76
+ agency_id: session.get("agency_id"),
77
+ entity_id: session.get("selectedEntity"),
78
+ received_at: getDatePickerCurrentDate(),
79
+ invoice_number: "",
80
+ reception_details_attributes: arrayToObject(
81
+ body?.purchase_order_details?.map((x) => {
82
+ return {
83
+ item_id: x.item_id,
84
+ purchase_order_detail_id: x.id,
85
+ quantity: x.delivered_quantity,
86
+ };
87
+ })
88
+ ),
89
+ },
90
+ purchase_order_id: body.id,
91
+ };
92
+
93
+ await httpZauru.post(
94
+ `/purchases/purchase_orders/${body.id}/receptions.json`,
95
+ sendBody,
96
+ {
97
+ headers,
98
+ }
99
+ );
100
+
101
+ return true;
102
+ });
103
+ }
104
+
105
+ /**
106
+ *
107
+ * @param headers
108
+ * @param poId
109
+ * @returns
110
+ */
111
+ export async function createNewLotPurchaseOrderReception(
112
+ headers: any,
113
+ session: Session,
114
+ body: Partial<PurchaseOrderGraphQL> & { fechaVencimiento: string }
115
+ ): Promise<AxiosUtilsResponse<boolean>> {
116
+ return handlePossibleAxiosErrors(async () => {
117
+ const sendBody = {
118
+ memo: "LABORATORIO - Recibido parcialmente desde WebApp",
119
+ purchase_order_id: body.id,
120
+ needs_transit: false,
121
+ received_at: getDatePickerCurrentDate(),
122
+ invoice_number: "",
123
+ agency_id: session.get("agency_id"),
124
+ entity_id: session.get("selectedEntity"),
125
+ reception_details_attributes: arrayToObject(
126
+ body?.purchase_order_details?.map((x) => {
127
+ return {
128
+ item_id: x.item_id,
129
+ purchase_order_detail_id: x.id,
130
+ lot_delivered_quantity: [x.delivered_quantity],
131
+ lot_name: [body.id_number],
132
+ lot_expire: [body.fechaVencimiento],
133
+ };
134
+ })
135
+ ),
136
+ };
137
+
138
+ await httpZauru.post(
139
+ `/purchases/purchase_orders/${body.id}/receptions.json`,
140
+ { reception: sendBody, purchase_order_id: body.id },
141
+ {
142
+ headers,
143
+ }
144
+ );
145
+
146
+ return true;
147
+ });
148
+ }
@@ -0,0 +1,88 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
+ import { AxiosUtilsResponse, ShipmentGraphQL } from "@zauru-sdk/types";
4
+ import { getGraphQLAPIHeaders } from "~/common.server.js";
5
+ import httpGraphQLAPI from "./httpGraphQL.server.js";
6
+ import { getShipmentsByToAgencyLast100StringQuery } from "@zauru-sdk/graphql";
7
+ import httpZauru from "./httpZauru.server.js";
8
+
9
+ /**
10
+ * getShipmentsByToAgencyLast100Id_booking
11
+ */
12
+ export async function getShipmentsByToAgencyLast100Id_booking(
13
+ session: Session,
14
+ agency_to_id: string | number
15
+ ): Promise<AxiosUtilsResponse<ShipmentGraphQL[]>> {
16
+ return handlePossibleAxiosErrors(async () => {
17
+ const headers = await getGraphQLAPIHeaders(session);
18
+
19
+ const response = await httpGraphQLAPI.post<{
20
+ data: { shipments: ShipmentGraphQL[] };
21
+ errors?: {
22
+ message: string;
23
+ extensions: { path: string; code: string };
24
+ }[];
25
+ }>(
26
+ "",
27
+ {
28
+ query: getShipmentsByToAgencyLast100StringQuery,
29
+ variables: {
30
+ agency_to_id,
31
+ },
32
+ },
33
+ { headers }
34
+ );
35
+
36
+ if (response.data.errors) {
37
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
38
+ }
39
+
40
+ const registers = response?.data?.data?.shipments;
41
+
42
+ return registers;
43
+ });
44
+ }
45
+
46
+ /**
47
+ * receiveShipment_booking
48
+ * @param headers
49
+ * @param id
50
+ * @returns
51
+ */
52
+ export async function receiveShipment_booking(
53
+ headers: any,
54
+ id: string | number
55
+ ): Promise<AxiosUtilsResponse<boolean>> {
56
+ return handlePossibleAxiosErrors(async () => {
57
+ const response = await httpZauru.get<any>(
58
+ `/inventories/bookings/${id}/deliver.json`,
59
+ { headers }
60
+ );
61
+
62
+ if (!response.data) {
63
+ throw new Error(
64
+ "Sin respuesta de: /inventories/bookings/id/deliver.json"
65
+ );
66
+ }
67
+
68
+ return true;
69
+ });
70
+ }
71
+
72
+ /**
73
+ * deleteShipment_booking
74
+ * @param headers
75
+ * @param id
76
+ * @returns
77
+ */
78
+ export async function deleteShipment_booking(
79
+ headers: any,
80
+ id: string | number
81
+ ): Promise<AxiosUtilsResponse<boolean>> {
82
+ return handlePossibleAxiosErrors(async () => {
83
+ await httpZauru.delete<any>(`/inventories/bookings/${id}.json`, {
84
+ headers,
85
+ });
86
+ return true;
87
+ });
88
+ }
@@ -0,0 +1,134 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import {
3
+ AxiosUtilsResponse,
4
+ ItemWithPrices,
5
+ SuggestedPriceGraphQL,
6
+ } from "@zauru-sdk/types";
7
+ import httpZauru from "./httpZauru.server.js";
8
+ import { Session } from "@remix-run/node";
9
+ import { getGraphQLAPIHeaders } from "~/common.server.js";
10
+ import httpGraphQLAPI from "./httpGraphQL.server.js";
11
+ import { getSuggestedPricesStringQuery } from "@zauru-sdk/graphql";
12
+
13
+ /**
14
+ *
15
+ * @param headers
16
+ * @returns
17
+ */
18
+ export const getSuggestedPricesExportJSON = async (
19
+ headers: any
20
+ ): Promise<AxiosUtilsResponse<ItemWithPrices[]>> => {
21
+ return handlePossibleAxiosErrors(async () => {
22
+ const response = await httpZauru.get<ItemWithPrices[]>(
23
+ `/sales/suggested_prices/export.json`,
24
+ {
25
+ headers,
26
+ }
27
+ );
28
+
29
+ return response.data;
30
+ });
31
+ };
32
+
33
+ /**
34
+ * getSuggestedPrices
35
+ * @param session
36
+ * @param id
37
+ */
38
+ export async function getSuggestedPrices(
39
+ session: Session,
40
+ config: {
41
+ notNullPriceList?: boolean;
42
+ withItems?: boolean;
43
+ withItemCategories?: boolean;
44
+ }
45
+ ): Promise<AxiosUtilsResponse<SuggestedPriceGraphQL[]>> {
46
+ return handlePossibleAxiosErrors(async () => {
47
+ const {
48
+ notNullPriceList = false,
49
+ withItems = false,
50
+ withItemCategories = false,
51
+ } = config;
52
+ const headers = await getGraphQLAPIHeaders(session);
53
+
54
+ const response = await httpGraphQLAPI.post<{
55
+ data: { suggested_prices: SuggestedPriceGraphQL[] };
56
+ errors?: {
57
+ message: string;
58
+ extensions: { path: string; code: string };
59
+ }[];
60
+ }>(
61
+ "",
62
+ {
63
+ query: getSuggestedPricesStringQuery({
64
+ notNullPriceList,
65
+ withItems,
66
+ withItemCategories,
67
+ }),
68
+ },
69
+ { headers }
70
+ );
71
+
72
+ if (response.data.errors) {
73
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
74
+ }
75
+
76
+ return response?.data?.data?.suggested_prices ?? [];
77
+ });
78
+ }
79
+
80
+ /**
81
+ * createSuggestedPrice
82
+ * @param headers
83
+ * @param body
84
+ */
85
+ export async function createSuggestedPrice(
86
+ headers: any,
87
+ body: Partial<SuggestedPriceGraphQL>
88
+ ): Promise<AxiosUtilsResponse<SuggestedPriceGraphQL>> {
89
+ return handlePossibleAxiosErrors(async () => {
90
+ const response = await httpZauru.post<SuggestedPriceGraphQL>(
91
+ `/sales/suggested_prices.json`,
92
+ { suggested_price: body },
93
+ { headers }
94
+ );
95
+ return response.data;
96
+ });
97
+ }
98
+
99
+ //No existe actualizar
100
+ // /**
101
+ // * updateSuggestedPrice
102
+ // * @param headers
103
+ // * @param body
104
+ // */
105
+ // export async function updateSuggestedPrice(
106
+ // headers: any,
107
+ // body: Partial<SuggestedPriceGraphQL>
108
+ // ): Promise<AxiosUtilsResponse<SuggestedPriceGraphQL>> {
109
+ // return handlePossibleAxiosErrors(async () => {
110
+ // const response = await httpZauru.patch<SuggestedPriceGraphQL>(
111
+ // `/sales/suggested_prices.json`,
112
+ // { suggested_price: body },
113
+ // { headers }
114
+ // );
115
+ // return response.data;
116
+ // });
117
+ // }
118
+
119
+ /**
120
+ * deleteSuggestedPrice
121
+ * @param headers
122
+ * @param body
123
+ */
124
+ export async function deleteSuggestedPrice(
125
+ headers: any,
126
+ id: string | number
127
+ ): Promise<AxiosUtilsResponse<boolean>> {
128
+ return handlePossibleAxiosErrors(async () => {
129
+ await httpZauru.delete<any>(`/sales/suggested_prices/${id}?destroy=true`, {
130
+ headers,
131
+ });
132
+ return true;
133
+ });
134
+ }
@@ -0,0 +1,22 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import { AxiosUtilsResponse, TagGraphQL } from "@zauru-sdk/types";
3
+ import httpZauru from "./httpZauru.server.js";
4
+
5
+ /**
6
+ * createTag
7
+ * @param headers
8
+ * @param body
9
+ */
10
+ export async function createTag(
11
+ headers: any,
12
+ body: Partial<TagGraphQL>
13
+ ): Promise<AxiosUtilsResponse<TagGraphQL>> {
14
+ return handlePossibleAxiosErrors(async () => {
15
+ const response = await httpZauru.post<TagGraphQL>(
16
+ `/settings/tags.json`,
17
+ { tag: body },
18
+ { headers }
19
+ );
20
+ return response.data;
21
+ });
22
+ }
@@ -0,0 +1,24 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import { AxiosUtilsResponse } from "@zauru-sdk/types";
3
+ import httpZauru from "./httpZauru.server.js";
4
+
5
+ /**
6
+ *
7
+ * @param headers
8
+ * @returns
9
+ */
10
+ export const getReceptionTemplate = async (
11
+ headers: any,
12
+ id: string | number
13
+ ): Promise<AxiosUtilsResponse<string>> => {
14
+ return handlePossibleAxiosErrors(async () => {
15
+ const response = await httpZauru.get<string>(
16
+ `/settings/templates/print_templates/${id}/preview_with_vars`,
17
+ {
18
+ headers,
19
+ }
20
+ );
21
+
22
+ return response.data;
23
+ });
24
+ };
@@ -0,0 +1,200 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
+ import {
4
+ AxiosUtilsResponse,
5
+ WebAppRowGraphQL,
6
+ WebAppTableBody,
7
+ WebAppTableCreateBody,
8
+ WebAppTableGraphQL,
9
+ WebAppTableUpdateResponse,
10
+ } from "@zauru-sdk/types";
11
+ import { getGraphQLAPIHeaders } from "~/common.server.js";
12
+ import httpGraphQLAPI from "./httpGraphQL.server.js";
13
+ import {
14
+ getWebAppRowStringQuery,
15
+ getWebAppRowsByWebAppTableIdStringQuery,
16
+ } from "@zauru-sdk/graphql";
17
+ import httpZauru from "./httpZauru.server.js";
18
+
19
+ /**
20
+ * getWebAppRow
21
+ * @param headers
22
+ * @returns
23
+ */
24
+ export async function getWebAppRow<T>(
25
+ session: Session,
26
+ id: number
27
+ ): Promise<AxiosUtilsResponse<T>> {
28
+ return handlePossibleAxiosErrors(async () => {
29
+ const headers = await getGraphQLAPIHeaders(session);
30
+
31
+ const response = await httpGraphQLAPI.post<{
32
+ data: { webapp_rows: WebAppRowGraphQL<T>[] };
33
+ }>(
34
+ "",
35
+ {
36
+ query: getWebAppRowStringQuery,
37
+ variables: {
38
+ id,
39
+ },
40
+ },
41
+ { headers }
42
+ );
43
+
44
+ return response.data?.data?.webapp_rows[0]?.data;
45
+ });
46
+ }
47
+
48
+ /**
49
+ * getWebAppTableRegisters Function for get all web app table registers
50
+ * @param headers
51
+ * @param webapp_table_id web app table id
52
+ * @returns
53
+ */
54
+ export async function getWebAppTableRegisters<T>(
55
+ session: Session,
56
+ webapp_table_id: string
57
+ ): Promise<AxiosUtilsResponse<WebAppRowGraphQL<T>[]>> {
58
+ return handlePossibleAxiosErrors(async () => {
59
+ const headers = await getGraphQLAPIHeaders(session);
60
+
61
+ const response = await httpGraphQLAPI.post<{
62
+ data: { webapp_rows: WebAppRowGraphQL<T>[] };
63
+ errors?: {
64
+ message: string;
65
+ extensions: { path: string; code: string };
66
+ }[];
67
+ }>(
68
+ "",
69
+ {
70
+ query: getWebAppRowsByWebAppTableIdStringQuery,
71
+ variables: {
72
+ webapp_table_id,
73
+ },
74
+ },
75
+ { headers }
76
+ );
77
+
78
+ if (response.data.errors) {
79
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
80
+ }
81
+
82
+ if (!response?.data?.data.webapp_rows) {
83
+ return [];
84
+ }
85
+
86
+ return response.data?.data?.webapp_rows;
87
+ });
88
+ }
89
+
90
+ /**
91
+ * deleteWebAppTableRegister Function for delete a web app table register
92
+ * @param headers
93
+ * @param id_web_app_table
94
+ * @param id_register
95
+ * @returns
96
+ */
97
+ export async function deleteWebAppTableRegister(
98
+ headers: any,
99
+ id_web_app_table: string,
100
+ id_register: number
101
+ ): Promise<WebAppTableUpdateResponse> {
102
+ const response = await httpZauru<WebAppTableUpdateResponse>(
103
+ `/apps/webapp_tables/${id_web_app_table}/webapp_rows/${id_register}.json`,
104
+ {
105
+ method: "DELETE",
106
+ headers: headers,
107
+ }
108
+ );
109
+
110
+ return response.data;
111
+ }
112
+
113
+ /**
114
+ * createWebAppTableRegister function for create a new web app table register
115
+ * @param headers
116
+ * @param body
117
+ * @param id_web_app_table
118
+ * @returns
119
+ */
120
+ export async function createWebAppTableRegister<T>(
121
+ headers: any,
122
+ id_web_app_table: string,
123
+ body: T,
124
+ extraBody?: { temp_purchase_order_id: string }
125
+ ): Promise<WebAppTableUpdateResponse> {
126
+ const requestBody = {
127
+ webapp_row: { data: body },
128
+ ...(extraBody ?? {}),
129
+ } as WebAppTableBody<T>;
130
+ const response = await httpZauru<WebAppTableUpdateResponse>(
131
+ `/apps/webapp_tables/${id_web_app_table}/webapp_rows.json`,
132
+ {
133
+ method: "POST",
134
+ headers: headers,
135
+ data: requestBody,
136
+ }
137
+ );
138
+
139
+ return response.data;
140
+ }
141
+
142
+ /**
143
+ * updateWebAppTableRegister Function for update a web app table register
144
+ * @param headers
145
+ * @param id_web_app_table
146
+ * @param id_register
147
+ * @returns
148
+ */
149
+ export async function updateWebAppTableRegister<T>(
150
+ headers: any,
151
+ id_web_app_table: string,
152
+ id_register: number | string,
153
+ body: Partial<T>
154
+ ): Promise<WebAppTableUpdateResponse> {
155
+ const requestBody = { webapp_row: { data: body } } as WebAppTableBody<T>;
156
+ const response = await httpZauru<WebAppTableUpdateResponse>(
157
+ `/apps/webapp_tables/${id_web_app_table}/webapp_rows/${id_register}.json`,
158
+ {
159
+ method: "PATCH",
160
+ headers: headers,
161
+ data: requestBody,
162
+ }
163
+ );
164
+
165
+ return response.data;
166
+ }
167
+
168
+ //============================== WEB APP TABLE
169
+
170
+ /**
171
+ *
172
+ * @param headers
173
+ * @param body
174
+ * @returns
175
+ */
176
+ export async function createWebAppTable(
177
+ headers: any,
178
+ body: WebAppTableCreateBody
179
+ ) {
180
+ try {
181
+ const response = await httpZauru.post<WebAppTableGraphQL>(
182
+ `/apps/webapp_tables.json`,
183
+ { webapp_table: body },
184
+ {
185
+ headers,
186
+ }
187
+ );
188
+
189
+ return {
190
+ data: response.data,
191
+ error: false,
192
+ } as AxiosUtilsResponse<WebAppTableGraphQL>;
193
+ } catch (error) {
194
+ return {
195
+ msg: error,
196
+ error: true,
197
+ userMsg: `Ocurrió un error al intentar crear la web app table ${body.name}`,
198
+ } as AxiosUtilsResponse<WebAppTableGraphQL>;
199
+ }
200
+ }