@zauru-sdk/services 1.0.116 → 1.0.119

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 (42) hide show
  1. package/dist/esm/zauru/httpZauru.js +3 -3
  2. package/dist/sessions/sessions.d.ts +1 -1
  3. package/package.json +7 -8
  4. package/dist/cjs/common.js +0 -277
  5. package/dist/cjs/graphql/index.js +0 -31
  6. package/dist/cjs/index.js +0 -54
  7. package/dist/cjs/sessions/sessions.js +0 -18
  8. package/dist/cjs/sessions/upstash.js +0 -59
  9. package/dist/cjs/zauru/httpGraphQL.js +0 -42
  10. package/dist/cjs/zauru/httpOauth.js +0 -42
  11. package/dist/cjs/zauru/httpZauru.js +0 -42
  12. package/dist/cjs/zauru/zauru-agencies.js +0 -27
  13. package/dist/cjs/zauru/zauru-automatic-numbers.js +0 -28
  14. package/dist/cjs/zauru/zauru-bookings.js +0 -90
  15. package/dist/cjs/zauru/zauru-bundles.js +0 -101
  16. package/dist/cjs/zauru/zauru-cases.js +0 -27
  17. package/dist/cjs/zauru/zauru-consolidated.js +0 -77
  18. package/dist/cjs/zauru/zauru-currencies.js +0 -27
  19. package/dist/cjs/zauru/zauru-deliveries.js +0 -53
  20. package/dist/cjs/zauru/zauru-discharges.js +0 -55
  21. package/dist/cjs/zauru/zauru-employees.js +0 -27
  22. package/dist/cjs/zauru/zauru-forms.js +0 -381
  23. package/dist/cjs/zauru/zauru-invoices.js +0 -134
  24. package/dist/cjs/zauru/zauru-items.js +0 -282
  25. package/dist/cjs/zauru/zauru-lote-record.js +0 -33
  26. package/dist/cjs/zauru/zauru-lotes.js +0 -307
  27. package/dist/cjs/zauru/zauru-motivos-rechazo.js +0 -57
  28. package/dist/cjs/zauru/zauru-payees.js +0 -259
  29. package/dist/cjs/zauru/zauru-payment-method.js +0 -34
  30. package/dist/cjs/zauru/zauru-payment-terms.js +0 -76
  31. package/dist/cjs/zauru/zauru-payments.js +0 -34
  32. package/dist/cjs/zauru/zauru-price-lists.js +0 -49
  33. package/dist/cjs/zauru/zauru-print-templates.js +0 -27
  34. package/dist/cjs/zauru/zauru-profiles.js +0 -80
  35. package/dist/cjs/zauru/zauru-purchase-orders.js +0 -423
  36. package/dist/cjs/zauru/zauru-receptions.js +0 -80
  37. package/dist/cjs/zauru/zauru-shipments.js +0 -59
  38. package/dist/cjs/zauru/zauru-suggested-prices.js +0 -94
  39. package/dist/cjs/zauru/zauru-tags.js +0 -20
  40. package/dist/cjs/zauru/zauru-templates.js +0 -22
  41. package/dist/cjs/zauru/zauru-variables.js +0 -64
  42. package/dist/cjs/zauru/zauru-web-app-tables.js +0 -164
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getReceptionTemplate = void 0;
7
- const common_1 = require("@zauru-sdk/common");
8
- const httpZauru_js_1 = __importDefault(require("./httpZauru.js"));
9
- /**
10
- *
11
- * @param headers
12
- * @returns
13
- */
14
- const getReceptionTemplate = async (headers, id) => {
15
- return (0, common_1.handlePossibleAxiosErrors)(async () => {
16
- const response = await httpZauru_js_1.default.get(`/settings/templates/print_templates/${id}/preview_with_vars`, {
17
- headers,
18
- });
19
- return response.data;
20
- });
21
- };
22
- exports.getReceptionTemplate = getReceptionTemplate;
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.updateVariable = exports.createVariable = exports.getVariables = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const httpZauru_js_1 = __importDefault(require("./httpZauru.js"));
9
- const common_1 = require("@zauru-sdk/common");
10
- /**
11
- * getVariables Function for get all zauru variables
12
- * @param headers
13
- * @returns
14
- */
15
- async function getVariables(headers) {
16
- try {
17
- const response = await (0, httpZauru_js_1.default)(`/apps/webapp_vars.json`, {
18
- method: "GET",
19
- headers: headers,
20
- });
21
- return { data: response.data, error: false };
22
- }
23
- catch (error) {
24
- console.log(chalk_1.default.red(`OCURRIÓ UN ERROR AL CARGAR LAS VARIABLES: ${error}`));
25
- return {
26
- msg: error,
27
- error: true,
28
- userMsg: "Ocurrió un error al intentar obtener las variables",
29
- };
30
- }
31
- }
32
- exports.getVariables = getVariables;
33
- /**
34
- *
35
- * @param headers
36
- * @param body
37
- * @returns
38
- */
39
- async function createVariable(headers, body) {
40
- try {
41
- const response = await httpZauru_js_1.default.post(`/apps/webapp_vars.json`, { variable: body }, {
42
- headers,
43
- });
44
- return {
45
- data: response.data,
46
- error: false,
47
- };
48
- }
49
- catch (error) {
50
- return {
51
- msg: error,
52
- error: true,
53
- userMsg: `Ocurrió un error al intentar crear la variable ${body.name}`,
54
- };
55
- }
56
- }
57
- exports.createVariable = createVariable;
58
- const updateVariable = async (headers, body) => {
59
- return (0, common_1.handlePossibleAxiosErrors)(async () => {
60
- await httpZauru_js_1.default.patch(`/apps/webapp_vars/${body.id}.json`, { variable: body }, { headers });
61
- return true;
62
- });
63
- };
64
- exports.updateVariable = updateVariable;
@@ -1,164 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getRejectionWebAppTable = exports.createWebAppTable = exports.updateWebAppTableRegister = exports.createWebAppTableRegister = exports.deleteWebAppTableRegister = exports.getWebAppTableRegisters = exports.getWebAppRow = void 0;
7
- const common_1 = require("@zauru-sdk/common");
8
- const common_js_1 = require("../common.js");
9
- const httpGraphQL_js_1 = __importDefault(require("./httpGraphQL.js"));
10
- const graphql_1 = require("@zauru-sdk/graphql");
11
- const httpZauru_js_1 = __importDefault(require("./httpZauru.js"));
12
- /**
13
- * getWebAppRow
14
- * @param headers
15
- * @returns
16
- */
17
- async function getWebAppRow(session, id) {
18
- return (0, common_1.handlePossibleAxiosErrors)(async () => {
19
- const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
20
- const response = await httpGraphQL_js_1.default.post("", {
21
- query: (0, graphql_1.getWebAppRowStringQuery)(id),
22
- }, { headers });
23
- if (response.data.errors) {
24
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
25
- }
26
- return response.data?.data?.webapp_rows[0]?.data;
27
- });
28
- }
29
- exports.getWebAppRow = getWebAppRow;
30
- /**
31
- * getWebAppTableRegisters Function for get all web app table registers
32
- * @param headers
33
- * @param webapp_table_id web app table id
34
- * @returns
35
- */
36
- async function getWebAppTableRegisters(session, webapp_table_id) {
37
- return (0, common_1.handlePossibleAxiosErrors)(async () => {
38
- const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
39
- const response = await httpGraphQL_js_1.default.post("", {
40
- query: (0, graphql_1.getWebAppRowsByWebAppTableIdStringQuery)(Number(webapp_table_id)),
41
- }, { headers });
42
- if (response.data.errors) {
43
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
44
- }
45
- if (!response?.data?.data.webapp_rows) {
46
- return [];
47
- }
48
- return response.data?.data?.webapp_rows;
49
- });
50
- }
51
- exports.getWebAppTableRegisters = getWebAppTableRegisters;
52
- /**
53
- * deleteWebAppTableRegister Function for delete a web app table register
54
- * @param headers
55
- * @param id_web_app_table
56
- * @param id_register
57
- * @returns
58
- */
59
- async function deleteWebAppTableRegister(headers, id_web_app_table, id_register) {
60
- const response = await (0, httpZauru_js_1.default)(`/apps/webapp_tables/${id_web_app_table}/webapp_rows/${id_register}.json`, {
61
- method: "DELETE",
62
- headers: headers,
63
- });
64
- return response.data;
65
- }
66
- exports.deleteWebAppTableRegister = deleteWebAppTableRegister;
67
- /**
68
- * createWebAppTableRegister function for create a new web app table register
69
- * @param headers
70
- * @param body
71
- * @param id_web_app_table
72
- * @returns
73
- */
74
- async function createWebAppTableRegister(headers, id_web_app_table, body, extraBody) {
75
- const requestBody = {
76
- webapp_row: { data: body },
77
- ...(extraBody ?? {}),
78
- };
79
- const response = await (0, httpZauru_js_1.default)(`/apps/webapp_tables/${id_web_app_table}/webapp_rows.json`, {
80
- method: "POST",
81
- headers: headers,
82
- data: requestBody,
83
- });
84
- return response.data;
85
- }
86
- exports.createWebAppTableRegister = createWebAppTableRegister;
87
- /**
88
- * updateWebAppTableRegister Function for update a web app table register
89
- * @param headers
90
- * @param id_web_app_table
91
- * @param id_register
92
- * @returns
93
- */
94
- async function updateWebAppTableRegister(headers, id_web_app_table, id_register, body) {
95
- const requestBody = { webapp_row: { data: body } };
96
- const response = await (0, httpZauru_js_1.default)(`/apps/webapp_tables/${id_web_app_table}/webapp_rows/${id_register}.json`, {
97
- method: "PATCH",
98
- headers: headers,
99
- data: requestBody,
100
- });
101
- return response.data;
102
- }
103
- exports.updateWebAppTableRegister = updateWebAppTableRegister;
104
- //============================== WEB APP TABLE
105
- /**
106
- *
107
- * @param headers
108
- * @param body
109
- * @returns
110
- */
111
- async function createWebAppTable(headers, body) {
112
- try {
113
- const response = await httpZauru_js_1.default.post(`/apps/webapp_tables.json`, { webapp_table: body }, {
114
- headers,
115
- });
116
- return {
117
- data: response.data,
118
- error: false,
119
- };
120
- }
121
- catch (error) {
122
- return {
123
- msg: error,
124
- error: true,
125
- userMsg: `Ocurrió un error al intentar crear la web app table ${body.name}`,
126
- };
127
- }
128
- }
129
- exports.createWebAppTable = createWebAppTable;
130
- /**
131
- * getWebappTable
132
- * @param headers
133
- * @param session
134
- * @returns
135
- */
136
- const getRejectionWebAppTable = async (headers, session) => {
137
- return (0, common_1.handlePossibleAxiosErrors)(async () => {
138
- const { recepciones_rejections_webapp_table_id, recepciones_rejection_types_webapp_table_id, } = await (0, common_js_1.getVariablesByName)(headers, session, [
139
- "recepciones_rejections_webapp_table_id",
140
- "recepciones_rejection_types_webapp_table_id",
141
- ]);
142
- const webappTableResponse = await httpZauru_js_1.default.get(`/apps/webapp_tables/${recepciones_rejections_webapp_table_id}.json`, { headers });
143
- const webappTableRejectionsResponse = await httpZauru_js_1.default.get(`/apps/webapp_tables/${recepciones_rejection_types_webapp_table_id}/webapp_rows.json`, { headers });
144
- const rejections_select = [];
145
- const rejections_complete = webappTableRejectionsResponse.data;
146
- const keyName = Object.keys(rejections_complete[0].data)[0]; //get the first value
147
- const rejections_list = [];
148
- rejections_complete.forEach((val) => {
149
- rejections_list.push(val.data[keyName]);
150
- });
151
- rejections_complete.forEach((rc) => {
152
- rejections_select.push({
153
- value: rc.data[keyName],
154
- label: rc.data[keyName],
155
- });
156
- });
157
- return {
158
- webapp_table: webappTableResponse.data.structure,
159
- rejection_list: rejections_list,
160
- rejection_select: rejections_select,
161
- };
162
- });
163
- };
164
- exports.getRejectionWebAppTable = getRejectionWebAppTable;