@zauru-sdk/utils 2.30.0 → 2.31.0
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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
2
|
+
import { createWebAppTableRegister, deleteWebAppTableRegister, getVariablesByName, getWebAppTableRegisters, updateWebAppTableRegister, } from "@zauru-sdk/services";
|
|
3
|
+
/**
|
|
4
|
+
* Get programaciones from the web app table.
|
|
5
|
+
* @param headers Request headers.
|
|
6
|
+
* @param session Session object.
|
|
7
|
+
* @returns A Promise of AxiosUtilsResponse<WebAppRowGraphQL<Programacion>[]>>.
|
|
8
|
+
*/
|
|
9
|
+
export const getProgramaciones = (headers, session) => {
|
|
10
|
+
return handlePossibleAxiosErrors(async () => {
|
|
11
|
+
const { programaciones_webapp_table_id } = await getVariablesByName(headers, session, ["programaciones_webapp_table_id"]);
|
|
12
|
+
const response = await getWebAppTableRegisters(session, programaciones_webapp_table_id);
|
|
13
|
+
if (response.error) {
|
|
14
|
+
throw new Error(`Ocurrió un error al consultar las programaciones: ${response.userMsg}`);
|
|
15
|
+
}
|
|
16
|
+
const registers = response.data ?? [];
|
|
17
|
+
return registers;
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Create a programacion in the web app table.
|
|
22
|
+
* @param headers Request headers.
|
|
23
|
+
* @param session Session object.
|
|
24
|
+
* @param body Programacion data to be created.
|
|
25
|
+
* @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
|
|
26
|
+
*/
|
|
27
|
+
export const createProgramacion = (headers, session, body) => {
|
|
28
|
+
return handlePossibleAxiosErrors(async () => {
|
|
29
|
+
const { programaciones_webapp_table_id } = await getVariablesByName(headers, session, ["programaciones_webapp_table_id"]);
|
|
30
|
+
const response = await createWebAppTableRegister(headers, programaciones_webapp_table_id, body);
|
|
31
|
+
return response;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Delete a programacion from the web app table.
|
|
36
|
+
* @param headers Request headers.
|
|
37
|
+
* @param session Session object.
|
|
38
|
+
* @param id ID of the programacion to be deleted.
|
|
39
|
+
* @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
|
|
40
|
+
*/
|
|
41
|
+
export const deleteProgramacion = (headers, session, id) => {
|
|
42
|
+
return handlePossibleAxiosErrors(async () => {
|
|
43
|
+
const { programaciones_webapp_table_id } = await getVariablesByName(headers, session, ["programaciones_webapp_table_id"]);
|
|
44
|
+
const response = await deleteWebAppTableRegister(headers, programaciones_webapp_table_id, Number(id));
|
|
45
|
+
return response;
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Update a programacion in the web app table.
|
|
50
|
+
* @param headers Request headers.
|
|
51
|
+
* @param session Session object.
|
|
52
|
+
* @param id ID of the programacion to be updated.
|
|
53
|
+
* @param body Updated programacion data.
|
|
54
|
+
* @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
|
|
55
|
+
*/
|
|
56
|
+
export const updateProgramacion = (headers, session, id, body) => {
|
|
57
|
+
return handlePossibleAxiosErrors(async () => {
|
|
58
|
+
const { programaciones_webapp_table_id } = await getVariablesByName(headers, session, ["programaciones_webapp_table_id"]);
|
|
59
|
+
const response = await updateWebAppTableRegister(headers, programaciones_webapp_table_id, Number(id), body);
|
|
60
|
+
return response;
|
|
61
|
+
});
|
|
62
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Session } from "@remix-run/node";
|
|
2
|
+
import { WebAppRowGraphQL, Programacion, AxiosUtilsResponse, WebAppTableUpdateResponse } from "@zauru-sdk/types";
|
|
3
|
+
/**
|
|
4
|
+
* Get programaciones from the web app table.
|
|
5
|
+
* @param headers Request headers.
|
|
6
|
+
* @param session Session object.
|
|
7
|
+
* @returns A Promise of AxiosUtilsResponse<WebAppRowGraphQL<Programacion>[]>>.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getProgramaciones: (headers: any, session: Session) => Promise<AxiosUtilsResponse<WebAppRowGraphQL<Programacion>[]>>;
|
|
10
|
+
/**
|
|
11
|
+
* Create a programacion in the web app table.
|
|
12
|
+
* @param headers Request headers.
|
|
13
|
+
* @param session Session object.
|
|
14
|
+
* @param body Programacion data to be created.
|
|
15
|
+
* @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
|
|
16
|
+
*/
|
|
17
|
+
export declare const createProgramacion: (headers: any, session: Session, body: Programacion) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
|
|
18
|
+
/**
|
|
19
|
+
* Delete a programacion from the web app table.
|
|
20
|
+
* @param headers Request headers.
|
|
21
|
+
* @param session Session object.
|
|
22
|
+
* @param id ID of the programacion to be deleted.
|
|
23
|
+
* @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
|
|
24
|
+
*/
|
|
25
|
+
export declare const deleteProgramacion: (headers: any, session: Session, id: string) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
|
|
26
|
+
/**
|
|
27
|
+
* Update a programacion in the web app table.
|
|
28
|
+
* @param headers Request headers.
|
|
29
|
+
* @param session Session object.
|
|
30
|
+
* @param id ID of the programacion to be updated.
|
|
31
|
+
* @param body Updated programacion data.
|
|
32
|
+
* @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
|
|
33
|
+
*/
|
|
34
|
+
export declare const updateProgramacion: (headers: any, session: Session, id: string, body: Partial<Programacion>) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.0",
|
|
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",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"@zauru-sdk/services": "^2.30.0",
|
|
31
31
|
"@zauru-sdk/types": "^2.30.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "2f9ee02a1ef76fbf71637b8455e4840786489628"
|
|
34
34
|
}
|