@zauru-sdk/services 1.0.44 → 1.0.46

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 (70) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +3 -3
  3. package/dist/common.server.d.ts +0 -55
  4. package/dist/common.server.js +0 -222
  5. package/dist/sessions/sessions.server.d.ts +0 -2
  6. package/dist/sessions/sessions.server.js +0 -13
  7. package/dist/sessions/upstash.server.d.ts +0 -1
  8. package/dist/sessions/upstash.server.js +0 -52
  9. package/dist/zauru/httpGraphQL.server.d.ts +0 -2
  10. package/dist/zauru/httpGraphQL.server.js +0 -37
  11. package/dist/zauru/httpOauth.server.d.ts +0 -2
  12. package/dist/zauru/httpOauth.server.js +0 -37
  13. package/dist/zauru/httpZauru.server.d.ts +0 -2
  14. package/dist/zauru/httpZauru.server.js +0 -37
  15. package/dist/zauru/zauru-agencies.server.d.ts +0 -8
  16. package/dist/zauru/zauru-agencies.server.js +0 -20
  17. package/dist/zauru/zauru-automatic-numbers.server.d.ts +0 -8
  18. package/dist/zauru/zauru-automatic-numbers.server.js +0 -21
  19. package/dist/zauru/zauru-bookings.server.d.ts +0 -28
  20. package/dist/zauru/zauru-bookings.server.js +0 -80
  21. package/dist/zauru/zauru-bundles.server.d.ts +0 -28
  22. package/dist/zauru/zauru-bundles.server.js +0 -93
  23. package/dist/zauru/zauru-cases.server.d.ts +0 -6
  24. package/dist/zauru/zauru-cases.server.js +0 -23
  25. package/dist/zauru/zauru-consolidated.server.d.ts +0 -36
  26. package/dist/zauru/zauru-consolidated.server.js +0 -71
  27. package/dist/zauru/zauru-currencies.server.d.ts +0 -6
  28. package/dist/zauru/zauru-currencies.server.js +0 -20
  29. package/dist/zauru/zauru-deliveries.server.d.ts +0 -22
  30. package/dist/zauru/zauru-deliveries.server.js +0 -44
  31. package/dist/zauru/zauru-discharges.server.d.ts +0 -26
  32. package/dist/zauru/zauru-discharges.server.js +0 -46
  33. package/dist/zauru/zauru-employees.server.d.ts +0 -6
  34. package/dist/zauru/zauru-employees.server.js +0 -23
  35. package/dist/zauru/zauru-forms.server.d.ts +0 -96
  36. package/dist/zauru/zauru-forms.server.js +0 -343
  37. package/dist/zauru/zauru-invoices.server.d.ts +0 -26
  38. package/dist/zauru/zauru-invoices.server.js +0 -94
  39. package/dist/zauru/zauru-items.server.d.ts +0 -97
  40. package/dist/zauru/zauru-items.server.js +0 -272
  41. package/dist/zauru/zauru-lote-record.server.d.ts +0 -8
  42. package/dist/zauru/zauru-lote-record.server.js +0 -26
  43. package/dist/zauru/zauru-lotes.server.d.ts +0 -91
  44. package/dist/zauru/zauru-lotes.server.js +0 -294
  45. package/dist/zauru/zauru-motivos-rechazo.server.d.ts +0 -9
  46. package/dist/zauru/zauru-motivos-rechazo.server.js +0 -49
  47. package/dist/zauru/zauru-payees.server.d.ts +0 -97
  48. package/dist/zauru/zauru-payees.server.js +0 -227
  49. package/dist/zauru/zauru-payment-terms.server.d.ts +0 -20
  50. package/dist/zauru/zauru-payment-terms.server.js +0 -65
  51. package/dist/zauru/zauru-price-lists.server.d.ts +0 -22
  52. package/dist/zauru/zauru-price-lists.server.js +0 -40
  53. package/dist/zauru/zauru-profiles.server.d.ts +0 -28
  54. package/dist/zauru/zauru-profiles.server.js +0 -69
  55. package/dist/zauru/zauru-purchase-orders.server.d.ts +0 -160
  56. package/dist/zauru/zauru-purchase-orders.server.js +0 -414
  57. package/dist/zauru/zauru-receptions.server.d.ts +0 -33
  58. package/dist/zauru/zauru-receptions.server.js +0 -94
  59. package/dist/zauru/zauru-shipments.server.d.ts +0 -20
  60. package/dist/zauru/zauru-shipments.server.js +0 -53
  61. package/dist/zauru/zauru-suggested-prices.server.d.ts +0 -31
  62. package/dist/zauru/zauru-suggested-prices.server.js +0 -84
  63. package/dist/zauru/zauru-tags.server.d.ts +0 -7
  64. package/dist/zauru/zauru-tags.server.js +0 -13
  65. package/dist/zauru/zauru-templates.server.d.ts +0 -7
  66. package/dist/zauru/zauru-templates.server.js +0 -15
  67. package/dist/zauru/zauru-variables.server.d.ts +0 -14
  68. package/dist/zauru/zauru-variables.server.js +0 -48
  69. package/dist/zauru/zauru-web-app-tables.server.d.ts +0 -55
  70. package/dist/zauru/zauru-web-app-tables.server.js +0 -154
@@ -1,20 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { AxiosUtilsResponse, ShipmentGraphQL } from "@zauru-sdk/types";
3
- /**
4
- * getShipmentsByToAgencyLast100Id_booking
5
- */
6
- export declare function getShipmentsByToAgencyLast100Id_booking(session: Session, agency_to_id: string | number): Promise<AxiosUtilsResponse<ShipmentGraphQL[]>>;
7
- /**
8
- * receiveShipment_booking
9
- * @param headers
10
- * @param id
11
- * @returns
12
- */
13
- export declare function receiveShipment_booking(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
14
- /**
15
- * deleteShipment_booking
16
- * @param headers
17
- * @param id
18
- * @returns
19
- */
20
- export declare function deleteShipment_booking(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
@@ -1,53 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import { getGraphQLAPIHeaders } from "../common.server.js";
3
- import httpGraphQLAPI from "./httpGraphQL.server.js";
4
- import { getShipmentsByToAgencyLast100StringQuery } from "@zauru-sdk/graphql";
5
- import httpZauru from "./httpZauru.server.js";
6
- /**
7
- * getShipmentsByToAgencyLast100Id_booking
8
- */
9
- export async function getShipmentsByToAgencyLast100Id_booking(session, agency_to_id) {
10
- return handlePossibleAxiosErrors(async () => {
11
- const headers = await getGraphQLAPIHeaders(session);
12
- const response = await httpGraphQLAPI.post("", {
13
- query: getShipmentsByToAgencyLast100StringQuery,
14
- variables: {
15
- agency_to_id,
16
- },
17
- }, { headers });
18
- if (response.data.errors) {
19
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
20
- }
21
- const registers = response?.data?.data?.shipments;
22
- return registers;
23
- });
24
- }
25
- /**
26
- * receiveShipment_booking
27
- * @param headers
28
- * @param id
29
- * @returns
30
- */
31
- export async function receiveShipment_booking(headers, id) {
32
- return handlePossibleAxiosErrors(async () => {
33
- const response = await httpZauru.get(`/inventories/bookings/${id}/deliver.json`, { headers });
34
- if (!response.data) {
35
- throw new Error("Sin respuesta de: /inventories/bookings/id/deliver.json");
36
- }
37
- return true;
38
- });
39
- }
40
- /**
41
- * deleteShipment_booking
42
- * @param headers
43
- * @param id
44
- * @returns
45
- */
46
- export async function deleteShipment_booking(headers, id) {
47
- return handlePossibleAxiosErrors(async () => {
48
- await httpZauru.delete(`/inventories/bookings/${id}.json`, {
49
- headers,
50
- });
51
- return true;
52
- });
53
- }
@@ -1,31 +0,0 @@
1
- import { AxiosUtilsResponse, ItemWithPrices, SuggestedPriceGraphQL } from "@zauru-sdk/types";
2
- import { Session } from "@remix-run/node";
3
- /**
4
- *
5
- * @param headers
6
- * @returns
7
- */
8
- export declare const getSuggestedPricesExportJSON: (headers: any) => Promise<AxiosUtilsResponse<ItemWithPrices[]>>;
9
- /**
10
- * getSuggestedPrices
11
- * @param session
12
- * @param id
13
- */
14
- export declare function getSuggestedPrices(session: Session, config: {
15
- notNullPriceList?: boolean;
16
- withItems?: boolean;
17
- withItemCategories?: boolean;
18
- onlyCurrent?: boolean;
19
- }): Promise<AxiosUtilsResponse<SuggestedPriceGraphQL[]>>;
20
- /**
21
- * createSuggestedPrice
22
- * @param headers
23
- * @param body
24
- */
25
- export declare function createSuggestedPrice(headers: any, body: Partial<SuggestedPriceGraphQL>): Promise<AxiosUtilsResponse<SuggestedPriceGraphQL>>;
26
- /**
27
- * deleteSuggestedPrice
28
- * @param headers
29
- * @param body
30
- */
31
- export declare function deleteSuggestedPrice(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
@@ -1,84 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import httpZauru from "./httpZauru.server.js";
3
- import { getGraphQLAPIHeaders } from "../common.server.js";
4
- import httpGraphQLAPI from "./httpGraphQL.server.js";
5
- import { getSuggestedPricesStringQuery } from "@zauru-sdk/graphql";
6
- /**
7
- *
8
- * @param headers
9
- * @returns
10
- */
11
- export const getSuggestedPricesExportJSON = async (headers) => {
12
- return handlePossibleAxiosErrors(async () => {
13
- const response = await httpZauru.get(`/sales/suggested_prices/export.json`, {
14
- headers,
15
- });
16
- return response.data;
17
- });
18
- };
19
- /**
20
- * getSuggestedPrices
21
- * @param session
22
- * @param id
23
- */
24
- export async function getSuggestedPrices(session, config) {
25
- return handlePossibleAxiosErrors(async () => {
26
- const { notNullPriceList = false, withItems = false, withItemCategories = false, onlyCurrent = false, } = config;
27
- const headers = await getGraphQLAPIHeaders(session);
28
- const response = await httpGraphQLAPI.post("", {
29
- query: getSuggestedPricesStringQuery({
30
- notNullPriceList,
31
- withItems,
32
- withItemCategories,
33
- onlyCurrent,
34
- }),
35
- }, { headers });
36
- if (response.data.errors) {
37
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
38
- }
39
- return response?.data?.data?.suggested_prices ?? [];
40
- });
41
- }
42
- /**
43
- * createSuggestedPrice
44
- * @param headers
45
- * @param body
46
- */
47
- export async function createSuggestedPrice(headers, body) {
48
- return handlePossibleAxiosErrors(async () => {
49
- const response = await httpZauru.post(`/sales/suggested_prices.json`, { suggested_price: body }, { headers });
50
- return response.data;
51
- });
52
- }
53
- //No existe actualizar
54
- // /**
55
- // * updateSuggestedPrice
56
- // * @param headers
57
- // * @param body
58
- // */
59
- // export async function updateSuggestedPrice(
60
- // headers: any,
61
- // body: Partial<SuggestedPriceGraphQL>
62
- // ): Promise<AxiosUtilsResponse<SuggestedPriceGraphQL>> {
63
- // return handlePossibleAxiosErrors(async () => {
64
- // const response = await httpZauru.patch<SuggestedPriceGraphQL>(
65
- // `/sales/suggested_prices.json`,
66
- // { suggested_price: body },
67
- // { headers }
68
- // );
69
- // return response.data;
70
- // });
71
- // }
72
- /**
73
- * deleteSuggestedPrice
74
- * @param headers
75
- * @param body
76
- */
77
- export async function deleteSuggestedPrice(headers, id) {
78
- return handlePossibleAxiosErrors(async () => {
79
- await httpZauru.delete(`/sales/suggested_prices/${id}?destroy=true`, {
80
- headers,
81
- });
82
- return true;
83
- });
84
- }
@@ -1,7 +0,0 @@
1
- import { AxiosUtilsResponse, TagGraphQL } from "@zauru-sdk/types";
2
- /**
3
- * createTag
4
- * @param headers
5
- * @param body
6
- */
7
- export declare function createTag(headers: any, body: Partial<TagGraphQL>): Promise<AxiosUtilsResponse<TagGraphQL>>;
@@ -1,13 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import httpZauru from "./httpZauru.server.js";
3
- /**
4
- * createTag
5
- * @param headers
6
- * @param body
7
- */
8
- export async function createTag(headers, body) {
9
- return handlePossibleAxiosErrors(async () => {
10
- const response = await httpZauru.post(`/settings/tags.json`, { tag: body }, { headers });
11
- return response.data;
12
- });
13
- }
@@ -1,7 +0,0 @@
1
- import { AxiosUtilsResponse } from "@zauru-sdk/types";
2
- /**
3
- *
4
- * @param headers
5
- * @returns
6
- */
7
- export declare const getReceptionTemplate: (headers: any, id: string | number) => Promise<AxiosUtilsResponse<string>>;
@@ -1,15 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import httpZauru from "./httpZauru.server.js";
3
- /**
4
- *
5
- * @param headers
6
- * @returns
7
- */
8
- export const getReceptionTemplate = async (headers, id) => {
9
- return handlePossibleAxiosErrors(async () => {
10
- const response = await httpZauru.get(`/settings/templates/print_templates/${id}/preview_with_vars`, {
11
- headers,
12
- });
13
- return response.data;
14
- });
15
- };
@@ -1,14 +0,0 @@
1
- import { VariableGraphQL, AxiosUtilsResponse } from "@zauru-sdk/types";
2
- /**
3
- * getVariables Function for get all zauru variables
4
- * @param headers
5
- * @returns
6
- */
7
- export declare function getVariables(headers: any): Promise<AxiosUtilsResponse<VariableGraphQL[]>>;
8
- /**
9
- *
10
- * @param headers
11
- * @param body
12
- * @returns
13
- */
14
- export declare function createVariable(headers: any, body: Partial<VariableGraphQL>): Promise<AxiosUtilsResponse<VariableGraphQL>>;
@@ -1,48 +0,0 @@
1
- import chalk from "chalk";
2
- import httpZauru from "./httpZauru.server.js";
3
- /**
4
- * getVariables Function for get all zauru variables
5
- * @param headers
6
- * @returns
7
- */
8
- export async function getVariables(headers) {
9
- try {
10
- const response = await httpZauru(`/apps/webapp_vars.json`, {
11
- method: "GET",
12
- headers: headers,
13
- });
14
- return { data: response.data, error: false };
15
- }
16
- catch (error) {
17
- console.log(chalk.red(`OCURRIÓ UN ERROR AL CARGAR LAS VARIABLES: ${error}`));
18
- return {
19
- msg: error,
20
- error: true,
21
- userMsg: "Ocurrió un error al intentar obtener las variables",
22
- };
23
- }
24
- }
25
- /**
26
- *
27
- * @param headers
28
- * @param body
29
- * @returns
30
- */
31
- export async function createVariable(headers, body) {
32
- try {
33
- const response = await httpZauru.post(`/apps/webapp_vars.json`, { variable: body }, {
34
- headers,
35
- });
36
- return {
37
- data: response.data,
38
- error: false,
39
- };
40
- }
41
- catch (error) {
42
- return {
43
- msg: error,
44
- error: true,
45
- userMsg: `Ocurrió un error al intentar crear la variable ${body.name}`,
46
- };
47
- }
48
- }
@@ -1,55 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { AxiosUtilsResponse, RejectionWebAppTableObject, WebAppRowGraphQL, WebAppTableCreateBody, WebAppTableGraphQL, WebAppTableUpdateResponse } from "@zauru-sdk/types";
3
- /**
4
- * getWebAppRow
5
- * @param headers
6
- * @returns
7
- */
8
- export declare function getWebAppRow<T>(session: Session, id: number): Promise<AxiosUtilsResponse<T>>;
9
- /**
10
- * getWebAppTableRegisters Function for get all web app table registers
11
- * @param headers
12
- * @param webapp_table_id web app table id
13
- * @returns
14
- */
15
- export declare function getWebAppTableRegisters<T>(session: Session, webapp_table_id: string): Promise<AxiosUtilsResponse<WebAppRowGraphQL<T>[]>>;
16
- /**
17
- * deleteWebAppTableRegister Function for delete a web app table register
18
- * @param headers
19
- * @param id_web_app_table
20
- * @param id_register
21
- * @returns
22
- */
23
- export declare function deleteWebAppTableRegister(headers: any, id_web_app_table: string, id_register: number): Promise<WebAppTableUpdateResponse>;
24
- /**
25
- * createWebAppTableRegister function for create a new web app table register
26
- * @param headers
27
- * @param body
28
- * @param id_web_app_table
29
- * @returns
30
- */
31
- export declare function createWebAppTableRegister<T>(headers: any, id_web_app_table: string, body: T, extraBody?: {
32
- temp_purchase_order_id: string;
33
- }): Promise<WebAppTableUpdateResponse>;
34
- /**
35
- * updateWebAppTableRegister Function for update a web app table register
36
- * @param headers
37
- * @param id_web_app_table
38
- * @param id_register
39
- * @returns
40
- */
41
- export declare function updateWebAppTableRegister<T>(headers: any, id_web_app_table: string, id_register: number | string, body: Partial<T>): Promise<WebAppTableUpdateResponse>;
42
- /**
43
- *
44
- * @param headers
45
- * @param body
46
- * @returns
47
- */
48
- export declare function createWebAppTable(headers: any, body: WebAppTableCreateBody): Promise<AxiosUtilsResponse<WebAppTableGraphQL>>;
49
- /**
50
- * getWebappTable
51
- * @param headers
52
- * @param session
53
- * @returns
54
- */
55
- export declare const getRejectionWebAppTable: (headers: any, session: Session) => Promise<AxiosUtilsResponse<RejectionWebAppTableObject>>;
@@ -1,154 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import { getGraphQLAPIHeaders, getVariablesByName } from "../common.server.js";
3
- import httpGraphQLAPI from "./httpGraphQL.server.js";
4
- import { getWebAppRowStringQuery, getWebAppRowsByWebAppTableIdStringQuery, } from "@zauru-sdk/graphql";
5
- import httpZauru from "./httpZauru.server.js";
6
- /**
7
- * getWebAppRow
8
- * @param headers
9
- * @returns
10
- */
11
- export async function getWebAppRow(session, id) {
12
- return handlePossibleAxiosErrors(async () => {
13
- const headers = await getGraphQLAPIHeaders(session);
14
- const response = await httpGraphQLAPI.post("", {
15
- query: getWebAppRowStringQuery,
16
- variables: {
17
- id,
18
- },
19
- }, { headers });
20
- return response.data?.data?.webapp_rows[0]?.data;
21
- });
22
- }
23
- /**
24
- * getWebAppTableRegisters Function for get all web app table registers
25
- * @param headers
26
- * @param webapp_table_id web app table id
27
- * @returns
28
- */
29
- export async function getWebAppTableRegisters(session, webapp_table_id) {
30
- return handlePossibleAxiosErrors(async () => {
31
- const headers = await getGraphQLAPIHeaders(session);
32
- const response = await httpGraphQLAPI.post("", {
33
- query: getWebAppRowsByWebAppTableIdStringQuery,
34
- variables: {
35
- webapp_table_id,
36
- },
37
- }, { headers });
38
- if (response.data.errors) {
39
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
40
- }
41
- if (!response?.data?.data.webapp_rows) {
42
- return [];
43
- }
44
- return response.data?.data?.webapp_rows;
45
- });
46
- }
47
- /**
48
- * deleteWebAppTableRegister Function for delete a web app table register
49
- * @param headers
50
- * @param id_web_app_table
51
- * @param id_register
52
- * @returns
53
- */
54
- export async function deleteWebAppTableRegister(headers, id_web_app_table, id_register) {
55
- const response = await httpZauru(`/apps/webapp_tables/${id_web_app_table}/webapp_rows/${id_register}.json`, {
56
- method: "DELETE",
57
- headers: headers,
58
- });
59
- return response.data;
60
- }
61
- /**
62
- * createWebAppTableRegister function for create a new web app table register
63
- * @param headers
64
- * @param body
65
- * @param id_web_app_table
66
- * @returns
67
- */
68
- export async function createWebAppTableRegister(headers, id_web_app_table, body, extraBody) {
69
- const requestBody = {
70
- webapp_row: { data: body },
71
- ...(extraBody ?? {}),
72
- };
73
- const response = await httpZauru(`/apps/webapp_tables/${id_web_app_table}/webapp_rows.json`, {
74
- method: "POST",
75
- headers: headers,
76
- data: requestBody,
77
- });
78
- return response.data;
79
- }
80
- /**
81
- * updateWebAppTableRegister Function for update a web app table register
82
- * @param headers
83
- * @param id_web_app_table
84
- * @param id_register
85
- * @returns
86
- */
87
- export async function updateWebAppTableRegister(headers, id_web_app_table, id_register, body) {
88
- const requestBody = { webapp_row: { data: body } };
89
- const response = await httpZauru(`/apps/webapp_tables/${id_web_app_table}/webapp_rows/${id_register}.json`, {
90
- method: "PATCH",
91
- headers: headers,
92
- data: requestBody,
93
- });
94
- return response.data;
95
- }
96
- //============================== WEB APP TABLE
97
- /**
98
- *
99
- * @param headers
100
- * @param body
101
- * @returns
102
- */
103
- export async function createWebAppTable(headers, body) {
104
- try {
105
- const response = await httpZauru.post(`/apps/webapp_tables.json`, { webapp_table: body }, {
106
- headers,
107
- });
108
- return {
109
- data: response.data,
110
- error: false,
111
- };
112
- }
113
- catch (error) {
114
- return {
115
- msg: error,
116
- error: true,
117
- userMsg: `Ocurrió un error al intentar crear la web app table ${body.name}`,
118
- };
119
- }
120
- }
121
- /**
122
- * getWebappTable
123
- * @param headers
124
- * @param session
125
- * @returns
126
- */
127
- export const getRejectionWebAppTable = async (headers, session) => {
128
- return handlePossibleAxiosErrors(async () => {
129
- const { recepciones_rejections_webapp_table_id, recepciones_rejection_types_webapp_table_id, } = await getVariablesByName(headers, session, [
130
- "recepciones_rejections_webapp_table_id",
131
- "recepciones_rejection_types_webapp_table_id",
132
- ]);
133
- const webappTableResponse = await httpZauru.get(`/apps/webapp_tables/${recepciones_rejections_webapp_table_id}.json`, { headers });
134
- const webappTableRejectionsResponse = await httpZauru.get(`/apps/webapp_tables/${recepciones_rejection_types_webapp_table_id}/webapp_rows.json`, { headers });
135
- const rejections_select = [];
136
- const rejections_complete = webappTableRejectionsResponse.data;
137
- const keyName = Object.keys(rejections_complete[0].data)[0]; //get the first value
138
- const rejections_list = [];
139
- rejections_complete.forEach((val) => {
140
- rejections_list.push(val.data[keyName]);
141
- });
142
- rejections_complete.forEach((rc) => {
143
- rejections_select.push({
144
- value: rc.data[keyName],
145
- label: rc.data[keyName],
146
- });
147
- });
148
- return {
149
- webapp_table: webappTableResponse.data.structure,
150
- rejection_list: rejections_list,
151
- rejection_select: rejections_select,
152
- };
153
- });
154
- };