@zauru-sdk/services 1.0.92 → 1.0.94

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.
@@ -16,10 +16,7 @@ async function getBundlesByItemCategoryId(session, id) {
16
16
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
17
17
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
18
18
  const response = await httpGraphQL_js_1.default.post("", {
19
- query: graphql_1.getBundlesByItemCategoryIdStringQuery,
20
- variables: {
21
- id,
22
- },
19
+ query: (0, graphql_1.getBundlesByItemCategoryIdStringQuery)(Number(id)),
23
20
  }, { headers });
24
21
  if (response.data.errors) {
25
22
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -15,10 +15,7 @@ async function getCasesByResponsibleId(session, responsible_id, wheres = []) {
15
15
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
16
16
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
17
17
  const response = await httpGraphQL_js_1.default.post("", {
18
- query: (0, graphql_1.getCasesByResponsibleIdStringQuery)(wheres),
19
- variables: {
20
- responsible_id,
21
- },
18
+ query: (0, graphql_1.getCasesByResponsibleIdStringQuery)(Number(responsible_id), wheres),
22
19
  }, { headers });
23
20
  if (response.data.errors) {
24
21
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -63,11 +63,7 @@ const getConsolidatesBetweenDates = async (session, dates) => {
63
63
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
64
64
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
65
65
  const response = await httpGraphQL_js_1.default.post("", {
66
- query: graphql_1.getConsolidatesBetweenDatesStringQuery,
67
- variables: {
68
- startDate: (0, common_1.formatDateToUTC)(dates.startDate),
69
- endDate: (0, common_1.formatDateToUTC)(dates.endDate),
70
- },
66
+ query: (0, graphql_1.getConsolidatesBetweenDatesStringQuery)((0, common_1.formatDateToUTC)(dates.startDate), (0, common_1.formatDateToUTC)(dates.endDate)),
71
67
  }, { headers });
72
68
  if (response.data.errors) {
73
69
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -15,10 +15,7 @@ async function getEmployeesByAgencyId(session, id) {
15
15
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
16
16
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
17
17
  const response = await httpGraphQL_js_1.default.post("", {
18
- query: graphql_1.getEmployeesByAgencyIdStringQuery,
19
- variables: {
20
- id,
21
- },
18
+ query: (0, graphql_1.getEmployeesByAgencyIdStringQuery)(Number(id)),
22
19
  }, { headers });
23
20
  if (response.data.errors) {
24
21
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -33,10 +33,7 @@ async function getFormByName(session, name) {
33
33
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
34
34
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
35
35
  const response = await httpGraphQL_js_1.default.post("", {
36
- query: graphql_1.getFormByNameStringQuery,
37
- variables: {
38
- name,
39
- },
36
+ query: (0, graphql_1.getFormByNameStringQuery)(name),
40
37
  }, { headers });
41
38
  if (response.data.errors) {
42
39
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -84,10 +81,7 @@ async function getFormsByDocumentType(session, document_type, filters = {}) {
84
81
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
85
82
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
86
83
  const response = await httpGraphQL_js_1.default.post("", {
87
- query: (0, graphql_1.getFormsByDocumentTypeStringQuery)(filters),
88
- variables: {
89
- document_type,
90
- },
84
+ query: (0, graphql_1.getFormsByDocumentTypeStringQuery)(document_type, filters),
91
85
  }, { headers });
92
86
  if (response.data.errors) {
93
87
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -113,10 +107,7 @@ async function getFormSubmissionById(headersZauru, session, id, config = { withF
113
107
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
114
108
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
115
109
  const response = await httpGraphQL_js_1.default.post("", {
116
- query: graphql_1.getFormSubmissionByIdStringQuery,
117
- variables: {
118
- formId: id,
119
- },
110
+ query: (0, graphql_1.getFormSubmissionByIdStringQuery)(Number(id)),
120
111
  }, { headers });
121
112
  if (response.data.errors) {
122
113
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -151,7 +142,7 @@ exports.getFormSubmissionById = getFormSubmissionById;
151
142
  async function getInvoiceFormSubmissionsByAgencyId(session, agency_id, filters) {
152
143
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
153
144
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
154
- const queryBuilded = (0, graphql_1.getInvoiceFormSubmissionsByAgencyIdStringQuery)({
145
+ const queryBuilded = (0, graphql_1.getInvoiceFormSubmissionsByAgencyIdStringQuery)(Number(agency_id), {
155
146
  seller_id: filters?.seller_id,
156
147
  payee_id_number_search: filters?.payee_id_number_search,
157
148
  //some_field_value: filters?.some_field_value, //Este filtro ahora lo hago abajo, con código, porque al hacerlo así antes,
@@ -165,9 +156,6 @@ async function getInvoiceFormSubmissionsByAgencyId(session, agency_id, filters)
165
156
  });
166
157
  const response = await httpGraphQL_js_1.default.post("", {
167
158
  query: queryBuilded,
168
- variables: {
169
- agency_id,
170
- },
171
159
  }, { headers });
172
160
  if (response.data.errors) {
173
161
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -197,13 +185,10 @@ async function getMyCaseFormSubmissions(headersZauru, session, filters = {}, con
197
185
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
198
186
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
199
187
  const response = await httpGraphQL_js_1.default.post("", {
200
- query: (0, graphql_1.getMyCaseFormSubmissionsStringQuery)({
188
+ query: (0, graphql_1.getMyCaseFormSubmissionsStringQuery)(Number(session.get("employee_id")), {
201
189
  formZid: filters?.formZid,
202
190
  caseId: filters?.caseId,
203
191
  }),
204
- variables: {
205
- responsible_id: session.get("employee_id"),
206
- },
207
192
  }, { headers });
208
193
  if (response.data.errors) {
209
194
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -261,12 +246,9 @@ async function getInvoiceFormSubmissionsByInvoiceId(session, invoice_id, filters
261
246
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
262
247
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
263
248
  const response = await httpGraphQL_js_1.default.post("", {
264
- query: (0, graphql_1.getInvoiceFormSubmissionsByInvoiceIdStringQuery)({
249
+ query: (0, graphql_1.getInvoiceFormSubmissionsByInvoiceIdStringQuery)(Number(invoice_id), {
265
250
  formZid: filters?.formZid,
266
251
  }),
267
- variables: {
268
- invoice_id,
269
- },
270
252
  }, { headers });
271
253
  if (response.data.errors) {
272
254
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -68,10 +68,7 @@ async function getItemByName(session, name) {
68
68
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
69
69
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
70
70
  const response = await httpGraphQL_js_1.default.post("", {
71
- query: graphql_1.getItemByNameStringQuery,
72
- variables: {
73
- name,
74
- },
71
+ query: (0, graphql_1.getItemByNameStringQuery)(name),
75
72
  }, { headers });
76
73
  if (response.data.errors) {
77
74
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -105,10 +102,7 @@ async function getItemsByCategoryId(session, id) {
105
102
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
106
103
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
107
104
  const response = await httpGraphQL_js_1.default.post("", {
108
- query: graphql_1.getItemsByCategoryStringQuery,
109
- variables: {
110
- id,
111
- },
105
+ query: (0, graphql_1.getItemsByCategoryStringQuery)(Number(id)),
112
106
  }, { headers });
113
107
  if (response.data.errors) {
114
108
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -130,10 +124,7 @@ async function getItemCategory(session, id) {
130
124
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
131
125
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
132
126
  const response = await httpGraphQL_js_1.default.post("", {
133
- query: graphql_1.getItemCategoryByIdStringQuery,
134
- variables: {
135
- id,
136
- },
127
+ query: (0, graphql_1.getItemCategoryByIdStringQuery)(Number(id)),
137
128
  }, { headers });
138
129
  if (response.data.errors) {
139
130
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -155,8 +146,7 @@ async function getItemCategoriesBySuperCategoryId(session, id) {
155
146
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
156
147
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
157
148
  const response = await httpGraphQL_js_1.default.post(``, {
158
- query: graphql_1.getSuperCategoryByIdStringQuery,
159
- variables: { id },
149
+ query: (0, graphql_1.getSuperCategoryByIdStringQuery)(Number(id)),
160
150
  }, { headers });
161
151
  if (response.data.errors) {
162
152
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -178,8 +168,7 @@ async function getItemsBySuperCategoryId(session, id, agency_id) {
178
168
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
179
169
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
180
170
  const response = await httpGraphQL_js_1.default.post(``, {
181
- query: graphql_1.getItemsBySuperCategoryStringQuery,
182
- variables: { id, agency_id },
171
+ query: (0, graphql_1.getItemsBySuperCategoryStringQuery)(Number(id), Number(agency_id)),
183
172
  }, { headers });
184
173
  if (response.data.errors) {
185
174
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -115,11 +115,7 @@ async function getLoteByName(session, lot_name) {
115
115
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
116
116
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
117
117
  const response = await httpGraphQL_js_1.default.post("", {
118
- query: graphql_1.getLotsByNameStringQuery,
119
- variables: {
120
- name: lot_name,
121
- entity_id: session.get("selectedEntity"),
122
- },
118
+ query: (0, graphql_1.getLotsByNameStringQuery)(lot_name, Number(session.get("selectedEntity"))),
123
119
  }, { headers });
124
120
  if (response.data.errors) {
125
121
  throw new Error(`Ocurrió un error al obtener el lote por nombre: ${response.data.errors
@@ -143,10 +139,7 @@ async function getMyAgencyLotStocks(session) {
143
139
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
144
140
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
145
141
  const response = await httpGraphQL_js_1.default.post("", {
146
- query: graphql_1.getLotStocksByAgencyIdStringQuery,
147
- variables: {
148
- agency_id: session.get("agency_id"),
149
- },
142
+ query: (0, graphql_1.getLotStocksByAgencyIdStringQuery)(Number(session.get("agency_id"))),
150
143
  }, { headers });
151
144
  if (response.data.errors) {
152
145
  throw new Error(`Ocurrió un error al obtener el stock de lotes por agencia: ${response.data.errors
@@ -52,10 +52,7 @@ async function getPayee(session, id) {
52
52
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
53
53
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
54
54
  const responsePayee = await httpGraphQL_js_1.default.post("", {
55
- query: graphql_1.getPayeeByIdStringQuery,
56
- variables: {
57
- id,
58
- },
55
+ query: (0, graphql_1.getPayeeByIdStringQuery)(Number(id)),
59
56
  }, { headers });
60
57
  if (!responsePayee?.data?.data?.payees[0]) {
61
58
  throw new Error("No se encontró el beneficiario indicado");
@@ -90,8 +87,7 @@ async function getPayeesByCategoryId(session, id) {
90
87
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
91
88
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
92
89
  const response = await httpGraphQL_js_1.default.post(``, {
93
- query: graphql_1.getPayeeCategoryByIdStringQuery,
94
- variables: { id },
90
+ query: (0, graphql_1.getPayeeCategoryByIdStringQuery)(Number(id)),
95
91
  }, { headers });
96
92
  if (response.data.errors) {
97
93
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -35,8 +35,7 @@ async function getPaymentTermById(session, id) {
35
35
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
36
36
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
37
37
  const response = await httpGraphQL_js_1.default.post("", {
38
- query: graphql_1.getPaymentTermByIdStringQuery,
39
- variables: { id },
38
+ query: (0, graphql_1.getPaymentTermByIdStringQuery)(Number(id)),
40
39
  }, { headers });
41
40
  if (response.data.errors) {
42
41
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -271,11 +271,9 @@ exports.updateReceivedPurchaseOrder = updateReceivedPurchaseOrder;
271
271
  const getLast100Receptions = (session, agency_id) => {
272
272
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
273
273
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
274
+ const agencyId = agency_id ?? Number(session.get("agency_id"));
274
275
  const response = await httpGraphQL_js_1.default.post("", {
275
- query: graphql_1.getLast100ReceptionsStringQuery,
276
- variables: {
277
- agencyId: agency_id ?? session.get("agency_id"),
278
- },
276
+ query: (0, graphql_1.getLast100ReceptionsStringQuery)(Number(agencyId)),
279
277
  }, { headers });
280
278
  if (response.data.errors) {
281
279
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -295,12 +293,9 @@ const getPurchaseOrder = (session, poId, config = {
295
293
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
296
294
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
297
295
  const response = await httpGraphQL_js_1.default.post("", {
298
- query: (0, graphql_1.getPurchaseOrderStringQuery)({
296
+ query: (0, graphql_1.getPurchaseOrderStringQuery)(Number(poId), {
299
297
  withLotStocks: config.withLotStocksToMyAgency,
300
298
  }),
301
- variables: {
302
- id: poId,
303
- },
304
299
  }, { headers });
305
300
  if (response.data.errors) {
306
301
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -340,7 +335,7 @@ const getGraphQLPurchaseOrderBetweenDates = (session, dates, config = {
340
335
  const hashAgencyId = JSON.parse(production_agency_id ?? "{}");
341
336
  agency_id = hashAgencyId[session.get("agency_id")];
342
337
  }
343
- const query = (0, graphql_1.getPurchaseOrdersBetweenDatesStringQuery)({
338
+ const query = (0, graphql_1.getPurchaseOrdersBetweenDatesStringQuery)((0, common_1.formatDateToUTC)(dates.startDate), (0, common_1.formatDateToUTC)(dates.endDate), {
344
339
  agencyId: config.agencyFilter
345
340
  ? agency_id ?? session.get("agency_id")
346
341
  : undefined,
@@ -360,16 +355,9 @@ const getGraphQLPurchaseOrderBetweenDates = (session, dates, config = {
360
355
  payeeCategoryIds: config.payeeCategoryIds,
361
356
  excludePayeeCategoryIds: config.excludePayeeCategoryIds,
362
357
  });
363
- const variables = {
364
- startDate: (0, common_1.formatDateToUTC)(dates.startDate),
365
- endDate: (0, common_1.formatDateToUTC)(dates.endDate),
366
- };
367
358
  const graphQLBody = {
368
359
  query,
369
360
  };
370
- if (!config.id_number) {
371
- graphQLBody.variables = variables;
372
- }
373
361
  const response = await httpGraphQL_js_1.default.post("", graphQLBody, { headers });
374
362
  if (response.data.errors) {
375
363
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -415,10 +403,7 @@ const getPurchasesOrderByIdNumber = (session, id_number) => {
415
403
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
416
404
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
417
405
  const response = await httpGraphQL_js_1.default.post("", {
418
- query: graphql_1.getPurchaseOrderByIdNumberStringQuery,
419
- variables: {
420
- id_number,
421
- },
406
+ query: (0, graphql_1.getPurchaseOrderByIdNumberStringQuery)(id_number),
422
407
  }, { headers });
423
408
  if (response.data.errors) {
424
409
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -16,10 +16,7 @@ async function getShipmentsByToAgencyLast100Id_booking(session, agency_to_id) {
16
16
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
17
17
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
18
18
  const response = await httpGraphQL_js_1.default.post("", {
19
- query: graphql_1.getShipmentsByToAgencyLast100StringQuery,
20
- variables: {
21
- agency_to_id,
22
- },
19
+ query: (0, graphql_1.getShipmentsByToAgencyLast100StringQuery)(Number(agency_to_id)),
23
20
  }, { headers });
24
21
  if (response.data.errors) {
25
22
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -18,10 +18,7 @@ async function getWebAppRow(session, id) {
18
18
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
19
19
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
20
20
  const response = await httpGraphQL_js_1.default.post("", {
21
- query: graphql_1.getWebAppRowStringQuery,
22
- variables: {
23
- id,
24
- },
21
+ query: (0, graphql_1.getWebAppRowStringQuery)(id),
25
22
  }, { headers });
26
23
  if (response.data.errors) {
27
24
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -40,10 +37,7 @@ async function getWebAppTableRegisters(session, webapp_table_id) {
40
37
  return (0, common_1.handlePossibleAxiosErrors)(async () => {
41
38
  const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
42
39
  const response = await httpGraphQL_js_1.default.post("", {
43
- query: graphql_1.getWebAppRowsByWebAppTableIdStringQuery,
44
- variables: {
45
- webapp_table_id,
46
- },
40
+ query: (0, graphql_1.getWebAppRowsByWebAppTableIdStringQuery)(Number(webapp_table_id)),
47
41
  }, { headers });
48
42
  if (response.data.errors) {
49
43
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -10,10 +10,7 @@ export async function getBundlesByItemCategoryId(session, id) {
10
10
  return handlePossibleAxiosErrors(async () => {
11
11
  const headers = await getGraphQLAPIHeaders(session);
12
12
  const response = await httpGraphQLAPI.post("", {
13
- query: getBundlesByItemCategoryIdStringQuery,
14
- variables: {
15
- id,
16
- },
13
+ query: getBundlesByItemCategoryIdStringQuery(Number(id)),
17
14
  }, { headers });
18
15
  if (response.data.errors) {
19
16
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -9,10 +9,7 @@ export async function getCasesByResponsibleId(session, responsible_id, wheres =
9
9
  return handlePossibleAxiosErrors(async () => {
10
10
  const headers = await getGraphQLAPIHeaders(session);
11
11
  const response = await httpGraphQLAPI.post("", {
12
- query: getCasesByResponsibleIdStringQuery(wheres),
13
- variables: {
14
- responsible_id,
15
- },
12
+ query: getCasesByResponsibleIdStringQuery(Number(responsible_id), wheres),
16
13
  }, { headers });
17
14
  if (response.data.errors) {
18
15
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -54,11 +54,7 @@ export const getConsolidatesBetweenDates = async (session, dates) => {
54
54
  return handlePossibleAxiosErrors(async () => {
55
55
  const headers = await getGraphQLAPIHeaders(session);
56
56
  const response = await httpGraphQLAPI.post("", {
57
- query: getConsolidatesBetweenDatesStringQuery,
58
- variables: {
59
- startDate: formatDateToUTC(dates.startDate),
60
- endDate: formatDateToUTC(dates.endDate),
61
- },
57
+ query: getConsolidatesBetweenDatesStringQuery(formatDateToUTC(dates.startDate), formatDateToUTC(dates.endDate)),
62
58
  }, { headers });
63
59
  if (response.data.errors) {
64
60
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -9,10 +9,7 @@ export async function getEmployeesByAgencyId(session, id) {
9
9
  return handlePossibleAxiosErrors(async () => {
10
10
  const headers = await getGraphQLAPIHeaders(session);
11
11
  const response = await httpGraphQLAPI.post("", {
12
- query: getEmployeesByAgencyIdStringQuery,
13
- variables: {
14
- id,
15
- },
12
+ query: getEmployeesByAgencyIdStringQuery(Number(id)),
16
13
  }, { headers });
17
14
  if (response.data.errors) {
18
15
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -26,10 +26,7 @@ export async function getFormByName(session, name) {
26
26
  return handlePossibleAxiosErrors(async () => {
27
27
  const headers = await getGraphQLAPIHeaders(session);
28
28
  const response = await httpGraphQLAPI.post("", {
29
- query: getFormByNameStringQuery,
30
- variables: {
31
- name,
32
- },
29
+ query: getFormByNameStringQuery(name),
33
30
  }, { headers });
34
31
  if (response.data.errors) {
35
32
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -75,10 +72,7 @@ export async function getFormsByDocumentType(session, document_type, filters = {
75
72
  return handlePossibleAxiosErrors(async () => {
76
73
  const headers = await getGraphQLAPIHeaders(session);
77
74
  const response = await httpGraphQLAPI.post("", {
78
- query: getFormsByDocumentTypeStringQuery(filters),
79
- variables: {
80
- document_type,
81
- },
75
+ query: getFormsByDocumentTypeStringQuery(document_type, filters),
82
76
  }, { headers });
83
77
  if (response.data.errors) {
84
78
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -103,10 +97,7 @@ export async function getFormSubmissionById(headersZauru, session, id, config =
103
97
  return handlePossibleAxiosErrors(async () => {
104
98
  const headers = await getGraphQLAPIHeaders(session);
105
99
  const response = await httpGraphQLAPI.post("", {
106
- query: getFormSubmissionByIdStringQuery,
107
- variables: {
108
- formId: id,
109
- },
100
+ query: getFormSubmissionByIdStringQuery(Number(id)),
110
101
  }, { headers });
111
102
  if (response.data.errors) {
112
103
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -140,7 +131,7 @@ export async function getFormSubmissionById(headersZauru, session, id, config =
140
131
  export async function getInvoiceFormSubmissionsByAgencyId(session, agency_id, filters) {
141
132
  return handlePossibleAxiosErrors(async () => {
142
133
  const headers = await getGraphQLAPIHeaders(session);
143
- const queryBuilded = getInvoiceFormSubmissionsByAgencyIdStringQuery({
134
+ const queryBuilded = getInvoiceFormSubmissionsByAgencyIdStringQuery(Number(agency_id), {
144
135
  seller_id: filters?.seller_id,
145
136
  payee_id_number_search: filters?.payee_id_number_search,
146
137
  //some_field_value: filters?.some_field_value, //Este filtro ahora lo hago abajo, con código, porque al hacerlo así antes,
@@ -154,9 +145,6 @@ export async function getInvoiceFormSubmissionsByAgencyId(session, agency_id, fi
154
145
  });
155
146
  const response = await httpGraphQLAPI.post("", {
156
147
  query: queryBuilded,
157
- variables: {
158
- agency_id,
159
- },
160
148
  }, { headers });
161
149
  if (response.data.errors) {
162
150
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -185,13 +173,10 @@ export async function getMyCaseFormSubmissions(headersZauru, session, filters =
185
173
  return handlePossibleAxiosErrors(async () => {
186
174
  const headers = await getGraphQLAPIHeaders(session);
187
175
  const response = await httpGraphQLAPI.post("", {
188
- query: getMyCaseFormSubmissionsStringQuery({
176
+ query: getMyCaseFormSubmissionsStringQuery(Number(session.get("employee_id")), {
189
177
  formZid: filters?.formZid,
190
178
  caseId: filters?.caseId,
191
179
  }),
192
- variables: {
193
- responsible_id: session.get("employee_id"),
194
- },
195
180
  }, { headers });
196
181
  if (response.data.errors) {
197
182
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -247,12 +232,9 @@ export async function getInvoiceFormSubmissionsByInvoiceId(session, invoice_id,
247
232
  return handlePossibleAxiosErrors(async () => {
248
233
  const headers = await getGraphQLAPIHeaders(session);
249
234
  const response = await httpGraphQLAPI.post("", {
250
- query: getInvoiceFormSubmissionsByInvoiceIdStringQuery({
235
+ query: getInvoiceFormSubmissionsByInvoiceIdStringQuery(Number(invoice_id), {
251
236
  formZid: filters?.formZid,
252
237
  }),
253
- variables: {
254
- invoice_id,
255
- },
256
238
  }, { headers });
257
239
  if (response.data.errors) {
258
240
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -60,10 +60,7 @@ export async function getItemByName(session, name) {
60
60
  return handlePossibleAxiosErrors(async () => {
61
61
  const headers = await getGraphQLAPIHeaders(session);
62
62
  const response = await httpGraphQLAPI.post("", {
63
- query: getItemByNameStringQuery,
64
- variables: {
65
- name,
66
- },
63
+ query: getItemByNameStringQuery(name),
67
64
  }, { headers });
68
65
  if (response.data.errors) {
69
66
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -95,10 +92,7 @@ export async function getItemsByCategoryId(session, id) {
95
92
  return handlePossibleAxiosErrors(async () => {
96
93
  const headers = await getGraphQLAPIHeaders(session);
97
94
  const response = await httpGraphQLAPI.post("", {
98
- query: getItemsByCategoryStringQuery,
99
- variables: {
100
- id,
101
- },
95
+ query: getItemsByCategoryStringQuery(Number(id)),
102
96
  }, { headers });
103
97
  if (response.data.errors) {
104
98
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -119,10 +113,7 @@ export async function getItemCategory(session, id) {
119
113
  return handlePossibleAxiosErrors(async () => {
120
114
  const headers = await getGraphQLAPIHeaders(session);
121
115
  const response = await httpGraphQLAPI.post("", {
122
- query: getItemCategoryByIdStringQuery,
123
- variables: {
124
- id,
125
- },
116
+ query: getItemCategoryByIdStringQuery(Number(id)),
126
117
  }, { headers });
127
118
  if (response.data.errors) {
128
119
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -143,8 +134,7 @@ export async function getItemCategoriesBySuperCategoryId(session, id) {
143
134
  return handlePossibleAxiosErrors(async () => {
144
135
  const headers = await getGraphQLAPIHeaders(session);
145
136
  const response = await httpGraphQLAPI.post(``, {
146
- query: getSuperCategoryByIdStringQuery,
147
- variables: { id },
137
+ query: getSuperCategoryByIdStringQuery(Number(id)),
148
138
  }, { headers });
149
139
  if (response.data.errors) {
150
140
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -165,8 +155,7 @@ export async function getItemsBySuperCategoryId(session, id, agency_id) {
165
155
  return handlePossibleAxiosErrors(async () => {
166
156
  const headers = await getGraphQLAPIHeaders(session);
167
157
  const response = await httpGraphQLAPI.post(``, {
168
- query: getItemsBySuperCategoryStringQuery,
169
- variables: { id, agency_id },
158
+ query: getItemsBySuperCategoryStringQuery(Number(id), Number(agency_id)),
170
159
  }, { headers });
171
160
  if (response.data.errors) {
172
161
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -105,11 +105,7 @@ export async function getLoteByName(session, lot_name) {
105
105
  return handlePossibleAxiosErrors(async () => {
106
106
  const headers = await getGraphQLAPIHeaders(session);
107
107
  const response = await httpGraphQLAPI.post("", {
108
- query: getLotsByNameStringQuery,
109
- variables: {
110
- name: lot_name,
111
- entity_id: session.get("selectedEntity"),
112
- },
108
+ query: getLotsByNameStringQuery(lot_name, Number(session.get("selectedEntity"))),
113
109
  }, { headers });
114
110
  if (response.data.errors) {
115
111
  throw new Error(`Ocurrió un error al obtener el lote por nombre: ${response.data.errors
@@ -132,10 +128,7 @@ export async function getMyAgencyLotStocks(session) {
132
128
  return handlePossibleAxiosErrors(async () => {
133
129
  const headers = await getGraphQLAPIHeaders(session);
134
130
  const response = await httpGraphQLAPI.post("", {
135
- query: getLotStocksByAgencyIdStringQuery,
136
- variables: {
137
- agency_id: session.get("agency_id"),
138
- },
131
+ query: getLotStocksByAgencyIdStringQuery(Number(session.get("agency_id"))),
139
132
  }, { headers });
140
133
  if (response.data.errors) {
141
134
  throw new Error(`Ocurrió un error al obtener el stock de lotes por agencia: ${response.data.errors
@@ -44,10 +44,7 @@ export async function getPayee(session, id) {
44
44
  return handlePossibleAxiosErrors(async () => {
45
45
  const headers = await getGraphQLAPIHeaders(session);
46
46
  const responsePayee = await httpGraphQLAPI.post("", {
47
- query: getPayeeByIdStringQuery,
48
- variables: {
49
- id,
50
- },
47
+ query: getPayeeByIdStringQuery(Number(id)),
51
48
  }, { headers });
52
49
  if (!responsePayee?.data?.data?.payees[0]) {
53
50
  throw new Error("No se encontró el beneficiario indicado");
@@ -80,8 +77,7 @@ export async function getPayeesByCategoryId(session, id) {
80
77
  return handlePossibleAxiosErrors(async () => {
81
78
  const headers = await getGraphQLAPIHeaders(session);
82
79
  const response = await httpGraphQLAPI.post(``, {
83
- query: getPayeeCategoryByIdStringQuery,
84
- variables: { id },
80
+ query: getPayeeCategoryByIdStringQuery(Number(id)),
85
81
  }, { headers });
86
82
  if (response.data.errors) {
87
83
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -28,8 +28,7 @@ export async function getPaymentTermById(session, id) {
28
28
  return handlePossibleAxiosErrors(async () => {
29
29
  const headers = await getGraphQLAPIHeaders(session);
30
30
  const response = await httpGraphQLAPI.post("", {
31
- query: getPaymentTermByIdStringQuery,
32
- variables: { id },
31
+ query: getPaymentTermByIdStringQuery(Number(id)),
33
32
  }, { headers });
34
33
  if (response.data.errors) {
35
34
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -253,11 +253,9 @@ export const updateReceivedPurchaseOrder = (headers, body, purchase_order_id) =>
253
253
  export const getLast100Receptions = (session, agency_id) => {
254
254
  return handlePossibleAxiosErrors(async () => {
255
255
  const headers = await getGraphQLAPIHeaders(session);
256
+ const agencyId = agency_id ?? Number(session.get("agency_id"));
256
257
  const response = await httpGraphQLAPI.post("", {
257
- query: getLast100ReceptionsStringQuery,
258
- variables: {
259
- agencyId: agency_id ?? session.get("agency_id"),
260
- },
258
+ query: getLast100ReceptionsStringQuery(Number(agencyId)),
261
259
  }, { headers });
262
260
  if (response.data.errors) {
263
261
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -276,12 +274,9 @@ export const getPurchaseOrder = (session, poId, config = {
276
274
  return handlePossibleAxiosErrors(async () => {
277
275
  const headers = await getGraphQLAPIHeaders(session);
278
276
  const response = await httpGraphQLAPI.post("", {
279
- query: getPurchaseOrderStringQuery({
277
+ query: getPurchaseOrderStringQuery(Number(poId), {
280
278
  withLotStocks: config.withLotStocksToMyAgency,
281
279
  }),
282
- variables: {
283
- id: poId,
284
- },
285
280
  }, { headers });
286
281
  if (response.data.errors) {
287
282
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -320,7 +315,7 @@ export const getGraphQLPurchaseOrderBetweenDates = (session, dates, config = {
320
315
  const hashAgencyId = JSON.parse(production_agency_id ?? "{}");
321
316
  agency_id = hashAgencyId[session.get("agency_id")];
322
317
  }
323
- const query = getPurchaseOrdersBetweenDatesStringQuery({
318
+ const query = getPurchaseOrdersBetweenDatesStringQuery(formatDateToUTC(dates.startDate), formatDateToUTC(dates.endDate), {
324
319
  agencyId: config.agencyFilter
325
320
  ? agency_id ?? session.get("agency_id")
326
321
  : undefined,
@@ -340,16 +335,9 @@ export const getGraphQLPurchaseOrderBetweenDates = (session, dates, config = {
340
335
  payeeCategoryIds: config.payeeCategoryIds,
341
336
  excludePayeeCategoryIds: config.excludePayeeCategoryIds,
342
337
  });
343
- const variables = {
344
- startDate: formatDateToUTC(dates.startDate),
345
- endDate: formatDateToUTC(dates.endDate),
346
- };
347
338
  const graphQLBody = {
348
339
  query,
349
340
  };
350
- if (!config.id_number) {
351
- graphQLBody.variables = variables;
352
- }
353
341
  const response = await httpGraphQLAPI.post("", graphQLBody, { headers });
354
342
  if (response.data.errors) {
355
343
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -393,10 +381,7 @@ export const getPurchasesOrderByIdNumber = (session, id_number) => {
393
381
  return handlePossibleAxiosErrors(async () => {
394
382
  const headers = await getGraphQLAPIHeaders(session);
395
383
  const response = await httpGraphQLAPI.post("", {
396
- query: getPurchaseOrderByIdNumberStringQuery,
397
- variables: {
398
- id_number,
399
- },
384
+ query: getPurchaseOrderByIdNumberStringQuery(id_number),
400
385
  }, { headers });
401
386
  if (response.data.errors) {
402
387
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -10,10 +10,7 @@ export async function getShipmentsByToAgencyLast100Id_booking(session, agency_to
10
10
  return handlePossibleAxiosErrors(async () => {
11
11
  const headers = await getGraphQLAPIHeaders(session);
12
12
  const response = await httpGraphQLAPI.post("", {
13
- query: getShipmentsByToAgencyLast100StringQuery,
14
- variables: {
15
- agency_to_id,
16
- },
13
+ query: getShipmentsByToAgencyLast100StringQuery(Number(agency_to_id)),
17
14
  }, { headers });
18
15
  if (response.data.errors) {
19
16
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -12,10 +12,7 @@ export async function getWebAppRow(session, id) {
12
12
  return handlePossibleAxiosErrors(async () => {
13
13
  const headers = await getGraphQLAPIHeaders(session);
14
14
  const response = await httpGraphQLAPI.post("", {
15
- query: getWebAppRowStringQuery,
16
- variables: {
17
- id,
18
- },
15
+ query: getWebAppRowStringQuery(id),
19
16
  }, { headers });
20
17
  if (response.data.errors) {
21
18
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -33,10 +30,7 @@ export async function getWebAppTableRegisters(session, webapp_table_id) {
33
30
  return handlePossibleAxiosErrors(async () => {
34
31
  const headers = await getGraphQLAPIHeaders(session);
35
32
  const response = await httpGraphQLAPI.post("", {
36
- query: getWebAppRowsByWebAppTableIdStringQuery,
37
- variables: {
38
- webapp_table_id,
39
- },
33
+ query: getWebAppRowsByWebAppTableIdStringQuery(Number(webapp_table_id)),
40
34
  }, { headers });
41
35
  if (response.data.errors) {
42
36
  throw new Error(response.data.errors.map((x) => x.message).join(";"));
@@ -3,7 +3,7 @@ import { AxiosUtilsResponse, BundleGraphQL } from "@zauru-sdk/types";
3
3
  /**
4
4
  * getBundlesByItemCategoryId
5
5
  */
6
- export declare function getBundlesByItemCategoryId(session: Session, id: string): Promise<AxiosUtilsResponse<BundleGraphQL[]>>;
6
+ export declare function getBundlesByItemCategoryId(session: Session, id: string | number): Promise<AxiosUtilsResponse<BundleGraphQL[]>>;
7
7
  /**
8
8
  * getBundleByName
9
9
  */
@@ -3,4 +3,4 @@ import { AxiosUtilsResponse, CaseGraphQL } from "@zauru-sdk/types";
3
3
  /**
4
4
  * getCasesByResponsibleId
5
5
  */
6
- export declare function getCasesByResponsibleId(session: Session, responsible_id: string, wheres?: string[]): Promise<AxiosUtilsResponse<CaseGraphQL[]>>;
6
+ export declare function getCasesByResponsibleId(session: Session, responsible_id: number | string, wheres?: string[]): Promise<AxiosUtilsResponse<CaseGraphQL[]>>;
@@ -24,7 +24,7 @@ export declare function getItemCategories(headers: any, item_category_id: string
24
24
  /**
25
25
  * getItemsByCategoryId
26
26
  */
27
- export declare function getItemsByCategoryId(session: Session, id: string): Promise<AxiosUtilsResponse<ItemGraphQL[]>>;
27
+ export declare function getItemsByCategoryId(session: Session, id: string | number): Promise<AxiosUtilsResponse<ItemGraphQL[]>>;
28
28
  /**
29
29
  * getItemCategory
30
30
  * @param session
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/services",
3
- "version": "1.0.92",
3
+ "version": "1.0.94",
4
4
  "description": "Servicios de consulta a Zauru",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -27,10 +27,10 @@
27
27
  "@remix-run/node": "^2.8.1",
28
28
  "@zauru-sdk/common": "^1.0.88",
29
29
  "@zauru-sdk/config": "^1.0.60",
30
- "@zauru-sdk/graphql": "^1.0.92",
30
+ "@zauru-sdk/graphql": "^1.0.94",
31
31
  "@zauru-sdk/types": "^1.0.88",
32
32
  "axios": "^1.6.7",
33
33
  "chalk": "5.3.0"
34
34
  },
35
- "gitHead": "6b061d22b3981be4f09b16fdf1696b69e8c9c1be"
35
+ "gitHead": "9bb9ad806317e995dcb86262ed37ba73cd276c07"
36
36
  }