@zauru-sdk/utils 2.0.7 → 2.0.10
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/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./zauru/4pinos-receptions-form-history.utils.js";
|
|
2
2
|
export * from "./zauru/4pinos-reception-register.utils.js";
|
|
3
|
+
export * from "./zauru/4pinos-shipments-form-history.utils.js";
|
|
3
4
|
export * from "./zauru/automatic-number.utils.js";
|
|
4
5
|
export * from "./zauru/bitacora-edicion-masiva.utils.js";
|
|
5
6
|
export * from "./zauru/bundles.utils.js";
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
2
|
+
import { createWebAppTableRegister, deleteWebAppTableRegister, getVariablesByName, getWebAppRow, getWebAppTableRegisters, updateWebAppTableRegister, } from "@zauru-sdk/services";
|
|
3
|
+
/**
|
|
4
|
+
* Get getQueueShipmentsFormHistories from the web app table.
|
|
5
|
+
* @param headers Request headers.
|
|
6
|
+
* @param session Session object.
|
|
7
|
+
* @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
|
|
8
|
+
*/
|
|
9
|
+
export const getQueueShipmentsFormHistories = (headers, session) => {
|
|
10
|
+
return handlePossibleAxiosErrors(async () => {
|
|
11
|
+
const { queue_form_shipment_submited_web_app_table_id } = await getVariablesByName(headers, session, [
|
|
12
|
+
"queue_form_shipment_submited_web_app_table_id",
|
|
13
|
+
]);
|
|
14
|
+
const response = await getWebAppTableRegisters(session, queue_form_shipment_submited_web_app_table_id);
|
|
15
|
+
if (response.error) {
|
|
16
|
+
throw new Error(`Ocurrió un error al consultar el historial de envíos: ${response.userMsg}`);
|
|
17
|
+
}
|
|
18
|
+
const history = response?.data ?? [];
|
|
19
|
+
return history;
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Get getQueueShipmentsFormHistories from the web app table.
|
|
24
|
+
* @param headers Request headers.
|
|
25
|
+
* @param session Session object.
|
|
26
|
+
* @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
|
|
27
|
+
*/
|
|
28
|
+
export const getQueueShipmentsFormHistoryByID = (session, id) => {
|
|
29
|
+
return handlePossibleAxiosErrors(async () => {
|
|
30
|
+
const response = await getWebAppRow(session, Number(id));
|
|
31
|
+
if (response.error) {
|
|
32
|
+
throw new Error(`Ocurrió un error al consultar el historial de colas: ${response.userMsg}`);
|
|
33
|
+
}
|
|
34
|
+
const history = response?.data ?? null;
|
|
35
|
+
return history;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Create a template in the web app table.
|
|
40
|
+
* @param headers Request headers.
|
|
41
|
+
* @param session Session object.
|
|
42
|
+
* @param body QueueShipmentsForm data to be created.
|
|
43
|
+
* @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm>.
|
|
44
|
+
*/
|
|
45
|
+
export const createQueueShipmentsFormHistory = (headers, session, body) => {
|
|
46
|
+
return handlePossibleAxiosErrors(async () => {
|
|
47
|
+
const { queue_form_shipment_submited_web_app_table_id } = await getVariablesByName(headers, session, [
|
|
48
|
+
"queue_form_shipment_submited_web_app_table_id",
|
|
49
|
+
]);
|
|
50
|
+
//Esto es para simular el tiempo de carga de la API nunca subir a producción
|
|
51
|
+
//await new Promise((resolve) => setTimeout(resolve, 7000));
|
|
52
|
+
//throw new Error("Error al crear el historial de colas");
|
|
53
|
+
const response = await createWebAppTableRegister(headers, queue_form_shipment_submited_web_app_table_id, body);
|
|
54
|
+
return response;
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Put updateQueueShipmentsForm from the web app table.
|
|
59
|
+
* @param headers Request headers.
|
|
60
|
+
* @param session Session object.
|
|
61
|
+
* @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
|
|
62
|
+
*/
|
|
63
|
+
export const updateQueueShipmentsFormHistory = (headers, session, body, id_registro) => {
|
|
64
|
+
return handlePossibleAxiosErrors(async () => {
|
|
65
|
+
const { queue_form_shipment_submited_web_app_table_id } = await getVariablesByName(headers, session, [
|
|
66
|
+
"queue_form_shipment_submited_web_app_table_id",
|
|
67
|
+
]);
|
|
68
|
+
const response = await updateWebAppTableRegister(headers, queue_form_shipment_submited_web_app_table_id, id_registro, { ...body });
|
|
69
|
+
return response;
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Delete QueueShipmentsFormHistory from the web app table.
|
|
74
|
+
* @param headers Request headers.
|
|
75
|
+
* @param session Session object.
|
|
76
|
+
* @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
|
|
77
|
+
*/
|
|
78
|
+
export const deleteQueueShipmentsFormHistory = (headers, session, id) => {
|
|
79
|
+
return handlePossibleAxiosErrors(async () => {
|
|
80
|
+
const { queue_form_shipment_submited_web_app_table_id } = await getVariablesByName(headers, session, [
|
|
81
|
+
"queue_form_shipment_submited_web_app_table_id",
|
|
82
|
+
]);
|
|
83
|
+
const response = await deleteWebAppTableRegister(headers, queue_form_shipment_submited_web_app_table_id, Number(id));
|
|
84
|
+
return response;
|
|
85
|
+
});
|
|
86
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./zauru/4pinos-receptions-form-history.utils.js";
|
|
2
2
|
export * from "./zauru/4pinos-reception-register.utils.js";
|
|
3
|
+
export * from "./zauru/4pinos-shipments-form-history.utils.js";
|
|
3
4
|
export * from "./zauru/automatic-number.utils.js";
|
|
4
5
|
export * from "./zauru/bitacora-edicion-masiva.utils.js";
|
|
5
6
|
export * from "./zauru/bundles.utils.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Session } from "@remix-run/node";
|
|
2
|
+
import { AxiosUtilsResponse, QueueShipmentsForm, WebAppRowGraphQL, WebAppTableUpdateResponse } from "@zauru-sdk/types";
|
|
3
|
+
/**
|
|
4
|
+
* Get getQueueShipmentsFormHistories from the web app table.
|
|
5
|
+
* @param headers Request headers.
|
|
6
|
+
* @param session Session object.
|
|
7
|
+
* @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getQueueShipmentsFormHistories: (headers: any, session: Session) => Promise<AxiosUtilsResponse<WebAppRowGraphQL<QueueShipmentsForm>[]>>;
|
|
10
|
+
/**
|
|
11
|
+
* Get getQueueShipmentsFormHistories from the web app table.
|
|
12
|
+
* @param headers Request headers.
|
|
13
|
+
* @param session Session object.
|
|
14
|
+
* @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getQueueShipmentsFormHistoryByID: (session: Session, id: string | number) => Promise<AxiosUtilsResponse<QueueShipmentsForm | null>>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a template in the web app table.
|
|
19
|
+
* @param headers Request headers.
|
|
20
|
+
* @param session Session object.
|
|
21
|
+
* @param body QueueShipmentsForm data to be created.
|
|
22
|
+
* @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm>.
|
|
23
|
+
*/
|
|
24
|
+
export declare const createQueueShipmentsFormHistory: (headers: any, session: Session, body: QueueShipmentsForm) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
|
|
25
|
+
/**
|
|
26
|
+
* Put updateQueueShipmentsForm from the web app table.
|
|
27
|
+
* @param headers Request headers.
|
|
28
|
+
* @param session Session object.
|
|
29
|
+
* @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
|
|
30
|
+
*/
|
|
31
|
+
export declare const updateQueueShipmentsFormHistory: (headers: any, session: Session, body: Partial<QueueShipmentsForm>, id_registro: string | number) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete QueueShipmentsFormHistory from the web app table.
|
|
34
|
+
* @param headers Request headers.
|
|
35
|
+
* @param session Session object.
|
|
36
|
+
* @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
|
|
37
|
+
*/
|
|
38
|
+
export declare const deleteQueueShipmentsFormHistory: (headers: any, session: Session, id: string) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "Utilidades, parseo de request y demás para desarrollo de webapps de Zauru",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@remix-run/node": "^2.8.1",
|
|
27
|
-
"@zauru-sdk/common": "^2.0.
|
|
27
|
+
"@zauru-sdk/common": "^2.0.10",
|
|
28
28
|
"@zauru-sdk/config": "^2.0.0",
|
|
29
29
|
"@zauru-sdk/graphql": "^2.0.7",
|
|
30
|
-
"@zauru-sdk/services": "^2.0.
|
|
31
|
-
"@zauru-sdk/types": "^2.0.
|
|
30
|
+
"@zauru-sdk/services": "^2.0.10",
|
|
31
|
+
"@zauru-sdk/types": "^2.0.10"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "7297f4948865ee522c3e617e972c88921c9851d2"
|
|
34
34
|
}
|