@zauru-sdk/services 1.0.32 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/common.d.ts +55 -0
- package/dist/common.js +222 -0
- package/dist/index.d.ts +34 -34
- package/dist/index.js +34 -34
- package/dist/sessions/sessions.d.ts +2 -0
- package/dist/sessions/sessions.js +13 -0
- package/dist/sessions/upstash.d.ts +1 -0
- package/dist/sessions/upstash.js +52 -0
- package/dist/zauru/httpGraphQL.d.ts +2 -0
- package/dist/zauru/httpGraphQL.js +37 -0
- package/dist/zauru/httpOauth.d.ts +2 -0
- package/dist/zauru/httpOauth.js +37 -0
- package/dist/zauru/httpZauru.d.ts +2 -0
- package/dist/zauru/httpZauru.js +37 -0
- package/dist/zauru/zauru-agencies.d.ts +8 -0
- package/dist/zauru/zauru-agencies.js +20 -0
- package/dist/zauru/zauru-automatic-numbers.d.ts +8 -0
- package/dist/zauru/zauru-automatic-numbers.js +21 -0
- package/dist/zauru/zauru-bookings.d.ts +28 -0
- package/dist/zauru/zauru-bookings.js +80 -0
- package/dist/zauru/zauru-bundles.d.ts +28 -0
- package/dist/zauru/zauru-bundles.js +93 -0
- package/dist/zauru/zauru-cases.d.ts +6 -0
- package/dist/zauru/zauru-cases.js +23 -0
- package/dist/zauru/zauru-consolidated.d.ts +36 -0
- package/dist/zauru/zauru-consolidated.js +71 -0
- package/dist/zauru/zauru-currencies.d.ts +6 -0
- package/dist/zauru/zauru-currencies.js +20 -0
- package/dist/zauru/zauru-deliveries.d.ts +22 -0
- package/dist/zauru/zauru-deliveries.js +44 -0
- package/dist/zauru/zauru-discharges.d.ts +26 -0
- package/dist/zauru/zauru-discharges.js +46 -0
- package/dist/zauru/zauru-employees.d.ts +6 -0
- package/dist/zauru/zauru-employees.js +23 -0
- package/dist/zauru/zauru-forms.d.ts +96 -0
- package/dist/zauru/zauru-forms.js +343 -0
- package/dist/zauru/zauru-invoices.d.ts +26 -0
- package/dist/zauru/zauru-invoices.js +94 -0
- package/dist/zauru/zauru-items.d.ts +97 -0
- package/dist/zauru/zauru-items.js +272 -0
- package/dist/zauru/zauru-lote-record.d.ts +8 -0
- package/dist/zauru/zauru-lote-record.js +26 -0
- package/dist/zauru/zauru-lotes.d.ts +111 -0
- package/dist/zauru/zauru-lotes.js +294 -0
- package/dist/zauru/zauru-motivos-rechazo.d.ts +9 -0
- package/dist/zauru/zauru-motivos-rechazo.js +49 -0
- package/dist/zauru/zauru-payees.d.ts +97 -0
- package/dist/zauru/zauru-payees.js +227 -0
- package/dist/zauru/zauru-payment-terms.d.ts +20 -0
- package/dist/zauru/zauru-payment-terms.js +65 -0
- package/dist/zauru/zauru-price-lists.d.ts +22 -0
- package/dist/zauru/zauru-price-lists.js +40 -0
- package/dist/zauru/zauru-profiles.d.ts +28 -0
- package/dist/zauru/zauru-profiles.js +69 -0
- package/dist/zauru/zauru-purchase-orders.d.ts +160 -0
- package/dist/zauru/zauru-purchase-orders.js +414 -0
- package/dist/zauru/zauru-receptions.d.ts +33 -0
- package/dist/zauru/zauru-receptions.js +94 -0
- package/dist/zauru/zauru-shipments.d.ts +20 -0
- package/dist/zauru/zauru-shipments.js +53 -0
- package/dist/zauru/zauru-suggested-prices.d.ts +31 -0
- package/dist/zauru/zauru-suggested-prices.js +84 -0
- package/dist/zauru/zauru-tags.d.ts +7 -0
- package/dist/zauru/zauru-tags.js +13 -0
- package/dist/zauru/zauru-templates.d.ts +7 -0
- package/dist/zauru/zauru-templates.js +15 -0
- package/dist/zauru/zauru-variables.d.ts +14 -0
- package/dist/zauru/zauru-variables.js +48 -0
- package/dist/zauru/zauru-web-app-tables.d.ts +55 -0
- package/dist/zauru/zauru-web-app-tables.js +154 -0
- package/package.json +5 -5
- package/src/{common.server.ts → common.ts} +4 -4
- package/src/index.ts +34 -34
- package/src/sessions/{sessions.server.ts → sessions.ts} +1 -1
- package/src/zauru/{zauru-agencies.server.ts → zauru-agencies.ts} +2 -2
- package/src/zauru/{zauru-automatic-numbers.server.ts → zauru-automatic-numbers.ts} +1 -1
- package/src/zauru/{zauru-bookings.server.ts → zauru-bookings.ts} +3 -3
- package/src/zauru/{zauru-bundles.server.ts → zauru-bundles.ts} +3 -3
- package/src/zauru/{zauru-cases.server.ts → zauru-cases.ts} +2 -2
- package/src/zauru/{zauru-consolidated.server.ts → zauru-consolidated.ts} +3 -3
- package/src/zauru/{zauru-currencies.server.ts → zauru-currencies.ts} +2 -2
- package/src/zauru/{zauru-deliveries.server.ts → zauru-deliveries.ts} +1 -1
- package/src/zauru/{zauru-discharges.server.ts → zauru-discharges.ts} +2 -2
- package/src/zauru/{zauru-employees.server.ts → zauru-employees.ts} +2 -2
- package/src/zauru/{zauru-forms.server.ts → zauru-forms.ts} +3 -3
- package/src/zauru/{zauru-invoices.server.ts → zauru-invoices.ts} +3 -3
- package/src/zauru/{zauru-items.server.ts → zauru-items.ts} +3 -3
- package/src/zauru/{zauru-lote-record.server.ts → zauru-lote-record.ts} +2 -2
- package/src/zauru/{zauru-lotes.server.ts → zauru-lotes.ts} +5 -5
- package/src/zauru/{zauru-motivos-rechazo.server.ts → zauru-motivos-rechazo.ts} +2 -2
- package/src/zauru/{zauru-payees.server.ts → zauru-payees.ts} +3 -3
- package/src/zauru/{zauru-payment-terms.server.ts → zauru-payment-terms.ts} +3 -3
- package/src/zauru/{zauru-price-lists.server.ts → zauru-price-lists.ts} +1 -1
- package/src/zauru/{zauru-profiles.server.ts → zauru-profiles.ts} +2 -2
- package/src/zauru/{zauru-purchase-orders.server.ts → zauru-purchase-orders.ts} +4 -4
- package/src/zauru/{zauru-receptions.server.ts → zauru-receptions.ts} +1 -1
- package/src/zauru/{zauru-shipments.server.ts → zauru-shipments.ts} +3 -3
- package/src/zauru/{zauru-suggested-prices.server.ts → zauru-suggested-prices.ts} +3 -3
- package/src/zauru/{zauru-tags.server.ts → zauru-tags.ts} +1 -1
- package/src/zauru/{zauru-templates.server.ts → zauru-templates.ts} +1 -1
- package/src/zauru/{zauru-variables.server.ts → zauru-variables.ts} +1 -1
- package/src/zauru/{zauru-web-app-tables.server.ts → zauru-web-app-tables.ts} +3 -3
- /package/src/sessions/{upstash.server.ts → upstash.ts} +0 -0
- /package/src/zauru/{httpGraphQL.server.ts → httpGraphQL.ts} +0 -0
- /package/src/zauru/{httpOauth.server.ts → httpOauth.ts} +0 -0
- /package/src/zauru/{httpZauru.server.ts → httpZauru.ts} +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
2
|
+
import httpZauru from "./httpZauru.js";
|
|
3
|
+
import { getGraphQLAPIHeaders } from "../common.js";
|
|
4
|
+
import httpGraphQLAPI from "./httpGraphQL.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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
2
|
+
import httpZauru from "./httpZauru.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
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
2
|
+
import httpZauru from "./httpZauru.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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import httpZauru from "./httpZauru.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
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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>>;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
2
|
+
import { getGraphQLAPIHeaders, getVariablesByName } from "../common.js";
|
|
3
|
+
import httpGraphQLAPI from "./httpGraphQL.js";
|
|
4
|
+
import { getWebAppRowStringQuery, getWebAppRowsByWebAppTableIdStringQuery, } from "@zauru-sdk/graphql";
|
|
5
|
+
import httpZauru from "./httpZauru.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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/services",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"description": "Servicios de consulta a Zauru",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@remix-run/node": "^2.8.1",
|
|
22
|
-
"@zauru-sdk/common": "^1.0.
|
|
22
|
+
"@zauru-sdk/common": "^1.0.33",
|
|
23
23
|
"@zauru-sdk/config": "^1.0.25",
|
|
24
|
-
"@zauru-sdk/graphql": "^1.0.
|
|
25
|
-
"@zauru-sdk/types": "^1.0.
|
|
24
|
+
"@zauru-sdk/graphql": "^1.0.33",
|
|
25
|
+
"@zauru-sdk/types": "^1.0.33",
|
|
26
26
|
"axios": "^1.6.7",
|
|
27
27
|
"chalk": "5.3.0"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">=18.0.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "94db7a87f5978f2640ba2180e2ed497cd9a3848a"
|
|
33
33
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Session, redirect } from "@remix-run/node";
|
|
2
|
-
import { commitSession, getSession } from "./sessions/sessions.
|
|
2
|
+
import { commitSession, getSession } from "./sessions/sessions.js";
|
|
3
3
|
import { AxiosRequestHeaders } from "axios";
|
|
4
4
|
import chalk from "chalk";
|
|
5
|
-
import httpZauru from "./zauru/httpZauru.
|
|
5
|
+
import httpZauru from "./zauru/httpZauru.js";
|
|
6
6
|
import {
|
|
7
7
|
getAgencyInfo,
|
|
8
8
|
getEmployeeInfo,
|
|
9
9
|
getOauthUserInfo,
|
|
10
10
|
getProfileInformation,
|
|
11
|
-
} from "./zauru/zauru-profiles.
|
|
11
|
+
} from "./zauru/zauru-profiles.js";
|
|
12
12
|
import {
|
|
13
13
|
EmployeeGraphQL,
|
|
14
14
|
OauthProfile,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
AxiosUtilsResponse,
|
|
20
20
|
} from "@zauru-sdk/types";
|
|
21
21
|
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
22
|
-
import { getVariables } from "./zauru/zauru-variables.
|
|
22
|
+
import { getVariables } from "./zauru/zauru-variables.js";
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* loginWebApp
|
package/src/index.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
export * from "./common.
|
|
1
|
+
export * from "./common.js";
|
|
2
2
|
|
|
3
|
-
export * from "./sessions/sessions.
|
|
4
|
-
export * from "./sessions/upstash.
|
|
3
|
+
export * from "./sessions/sessions.js";
|
|
4
|
+
export * from "./sessions/upstash.js";
|
|
5
5
|
|
|
6
|
-
export * from "./zauru/httpGraphQL.
|
|
7
|
-
export * from "./zauru/httpOauth.
|
|
8
|
-
export * from "./zauru/httpZauru.
|
|
6
|
+
export * from "./zauru/httpGraphQL.js";
|
|
7
|
+
export * from "./zauru/httpOauth.js";
|
|
8
|
+
export * from "./zauru/httpZauru.js";
|
|
9
9
|
|
|
10
|
-
export * from "./zauru/zauru-agencies.
|
|
11
|
-
export * from "./zauru/zauru-automatic-numbers.
|
|
12
|
-
export * from "./zauru/zauru-bookings.
|
|
13
|
-
export * from "./zauru/zauru-bundles.
|
|
14
|
-
export * from "./zauru/zauru-cases.
|
|
15
|
-
export * from "./zauru/zauru-currencies.
|
|
16
|
-
export * from "./zauru/zauru-consolidated.
|
|
17
|
-
export * from "./zauru/zauru-deliveries.
|
|
18
|
-
export * from "./zauru/zauru-discharges.
|
|
19
|
-
export * from "./zauru/zauru-employees.
|
|
20
|
-
export * from "./zauru/zauru-forms.
|
|
21
|
-
export * from "./zauru/zauru-invoices.
|
|
22
|
-
export * from "./zauru/zauru-items.
|
|
23
|
-
export * from "./zauru/zauru-lote-record.
|
|
24
|
-
export * from "./zauru/zauru-lotes.
|
|
25
|
-
export * from "./zauru/zauru-motivos-rechazo.
|
|
26
|
-
export * from "./zauru/zauru-payees.
|
|
27
|
-
export * from "./zauru/zauru-payment-terms.
|
|
28
|
-
export * from "./zauru/zauru-price-lists.
|
|
29
|
-
export * from "./zauru/zauru-purchase-orders.
|
|
30
|
-
export * from "./zauru/zauru-profiles.
|
|
31
|
-
export * from "./zauru/zauru-receptions.
|
|
32
|
-
export * from "./zauru/zauru-shipments.
|
|
33
|
-
export * from "./zauru/zauru-suggested-prices.
|
|
34
|
-
export * from "./zauru/zauru-tags.
|
|
35
|
-
export * from "./zauru/zauru-templates.
|
|
36
|
-
export * from "./zauru/zauru-web-app-tables.
|
|
37
|
-
export * from "./zauru/zauru-variables.
|
|
10
|
+
export * from "./zauru/zauru-agencies.js";
|
|
11
|
+
export * from "./zauru/zauru-automatic-numbers.js";
|
|
12
|
+
export * from "./zauru/zauru-bookings.js";
|
|
13
|
+
export * from "./zauru/zauru-bundles.js";
|
|
14
|
+
export * from "./zauru/zauru-cases.js";
|
|
15
|
+
export * from "./zauru/zauru-currencies.js";
|
|
16
|
+
export * from "./zauru/zauru-consolidated.js";
|
|
17
|
+
export * from "./zauru/zauru-deliveries.js";
|
|
18
|
+
export * from "./zauru/zauru-discharges.js";
|
|
19
|
+
export * from "./zauru/zauru-employees.js";
|
|
20
|
+
export * from "./zauru/zauru-forms.js";
|
|
21
|
+
export * from "./zauru/zauru-invoices.js";
|
|
22
|
+
export * from "./zauru/zauru-items.js";
|
|
23
|
+
export * from "./zauru/zauru-lote-record.js";
|
|
24
|
+
export * from "./zauru/zauru-lotes.js";
|
|
25
|
+
export * from "./zauru/zauru-motivos-rechazo.js";
|
|
26
|
+
export * from "./zauru/zauru-payees.js";
|
|
27
|
+
export * from "./zauru/zauru-payment-terms.js";
|
|
28
|
+
export * from "./zauru/zauru-price-lists.js";
|
|
29
|
+
export * from "./zauru/zauru-purchase-orders.js";
|
|
30
|
+
export * from "./zauru/zauru-profiles.js";
|
|
31
|
+
export * from "./zauru/zauru-receptions.js";
|
|
32
|
+
export * from "./zauru/zauru-shipments.js";
|
|
33
|
+
export * from "./zauru/zauru-suggested-prices.js";
|
|
34
|
+
export * from "./zauru/zauru-tags.js";
|
|
35
|
+
export * from "./zauru/zauru-templates.js";
|
|
36
|
+
export * from "./zauru/zauru-web-app-tables.js";
|
|
37
|
+
export * from "./zauru/zauru-variables.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Session } from "@remix-run/node";
|
|
2
2
|
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
3
|
-
import httpGraphQLAPI from "./httpGraphQL.
|
|
3
|
+
import httpGraphQLAPI from "./httpGraphQL.js";
|
|
4
4
|
import { getAgenciesStringQuery } from "@zauru-sdk/graphql";
|
|
5
5
|
import type { AgencyGraphQL, AxiosUtilsResponse } from "@zauru-sdk/types";
|
|
6
|
-
import { getGraphQLAPIHeaders } from "../common.
|
|
6
|
+
import { getGraphQLAPIHeaders } from "../common.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* getAgencies
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
InsertBookingBody,
|
|
5
5
|
ShipmentGraphQL,
|
|
6
6
|
} from "@zauru-sdk/types";
|
|
7
|
-
import httpZauru from "./httpZauru.
|
|
8
|
-
import { getGraphQLAPIHeaders } from "../common.
|
|
7
|
+
import httpZauru from "./httpZauru.js";
|
|
8
|
+
import { getGraphQLAPIHeaders } from "../common.js";
|
|
9
9
|
import { Session } from "@remix-run/node";
|
|
10
|
-
import httpGraphQLAPI from "./httpGraphQL.
|
|
10
|
+
import httpGraphQLAPI from "./httpGraphQL.js";
|
|
11
11
|
import { getShipmentsStringQuery } from "@zauru-sdk/graphql";
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Session } from "@remix-run/node";
|
|
2
2
|
import { arrayToObject, handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
3
3
|
import { AxiosUtilsResponse, BundleGraphQL } from "@zauru-sdk/types";
|
|
4
|
-
import { getGraphQLAPIHeaders } from "../common.
|
|
5
|
-
import httpGraphQLAPI from "./httpGraphQL.
|
|
4
|
+
import { getGraphQLAPIHeaders } from "../common.js";
|
|
5
|
+
import httpGraphQLAPI from "./httpGraphQL.js";
|
|
6
6
|
import {
|
|
7
7
|
getBundleByNameStringQuery,
|
|
8
8
|
getBundlesByItemCategoryIdStringQuery,
|
|
9
9
|
} from "@zauru-sdk/graphql";
|
|
10
|
-
import httpZauru from "./httpZauru.
|
|
10
|
+
import httpZauru from "./httpZauru.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* getBundlesByItemCategoryId
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Session } from "@remix-run/node";
|
|
2
2
|
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
3
3
|
import { AxiosUtilsResponse, CaseGraphQL } from "@zauru-sdk/types";
|
|
4
|
-
import { getGraphQLAPIHeaders } from "../common.
|
|
5
|
-
import httpGraphQLAPI from "./httpGraphQL.
|
|
4
|
+
import { getGraphQLAPIHeaders } from "../common.js";
|
|
5
|
+
import httpGraphQLAPI from "./httpGraphQL.js";
|
|
6
6
|
import { getCasesByResponsibleIdStringQuery } from "@zauru-sdk/graphql";
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
NewConsolidatedBody,
|
|
8
8
|
PDFResult,
|
|
9
9
|
} from "@zauru-sdk/types";
|
|
10
|
-
import httpZauru from "./httpZauru.
|
|
11
|
-
import { getGraphQLAPIHeaders, getVariablesByName } from "../common.
|
|
12
|
-
import httpGraphQLAPI from "./httpGraphQL.
|
|
10
|
+
import httpZauru from "./httpZauru.js";
|
|
11
|
+
import { getGraphQLAPIHeaders, getVariablesByName } from "../common.js";
|
|
12
|
+
import httpGraphQLAPI from "./httpGraphQL.js";
|
|
13
13
|
import { getConsolidatesBetweenDatesStringQuery } from "@zauru-sdk/graphql";
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Session } from "@remix-run/node";
|
|
2
2
|
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
3
3
|
import { AxiosUtilsResponse, CurrencyGraphQL } from "@zauru-sdk/types";
|
|
4
|
-
import { getGraphQLAPIHeaders } from "../common.
|
|
5
|
-
import httpGraphQLAPI from "./httpGraphQL.
|
|
4
|
+
import { getGraphQLAPIHeaders } from "../common.js";
|
|
5
|
+
import httpGraphQLAPI from "./httpGraphQL.js";
|
|
6
6
|
import { getCurrenciesStringQuery } from "@zauru-sdk/graphql";
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
NewDischargeBody,
|
|
6
6
|
PDFResult,
|
|
7
7
|
} from "@zauru-sdk/types";
|
|
8
|
-
import { getVariablesByName } from "../common.
|
|
8
|
+
import { getVariablesByName } from "../common.js";
|
|
9
9
|
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
10
|
-
import httpZauru from "./httpZauru.
|
|
10
|
+
import httpZauru from "./httpZauru.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
*
|