@zauru-sdk/services 1.0.13 → 1.0.18

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 CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.0.18](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.17...v1.0.18) (2024-03-22)
7
+
8
+ **Note:** Version bump only for package @zauru-sdk/services
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.0.15](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.14...v1.0.15) (2024-03-21)
15
+
16
+ **Note:** Version bump only for package @zauru-sdk/services
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.0.13](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.12...v1.0.13) (2024-03-21)
7
23
 
8
24
  **Note:** Version bump only for package @zauru-sdk/services
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from "./zauru/zauru-automatic-numbers.server.js";
9
9
  export * from "./zauru/zauru-bookings.server.js";
10
10
  export * from "./zauru/zauru-bundles.service.js";
11
11
  export * from "./zauru/zauru-cases.server.js";
12
+ export * from "./zauru/zauru-currencies.server.js";
12
13
  export * from "./zauru/zauru-consolidated.server.js";
13
14
  export * from "./zauru/zauru-deliveries.server.js";
14
15
  export * from "./zauru/zauru-discharges.server.js";
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export * from "./zauru/zauru-automatic-numbers.server.js";
9
9
  export * from "./zauru/zauru-bookings.server.js";
10
10
  export * from "./zauru/zauru-bundles.service.js";
11
11
  export * from "./zauru/zauru-cases.server.js";
12
+ export * from "./zauru/zauru-currencies.server.js";
12
13
  export * from "./zauru/zauru-consolidated.server.js";
13
14
  export * from "./zauru/zauru-deliveries.server.js";
14
15
  export * from "./zauru/zauru-discharges.server.js";
@@ -8,67 +8,67 @@ import { AxiosUtilsResponse, BasketSchema, CreateNewPurchaseOrderBody, DataTable
8
8
  * @param body
9
9
  * @returns
10
10
  */
11
- export declare function markAsReceivePurchaseOrder(headers: any, body: Partial<PurchaseOrderGraphQL> & {
11
+ export declare const markAsReceivePurchaseOrder: (headers: any, body: Partial<PurchaseOrderGraphQL> & {
12
12
  fechaVencimiento?: string;
13
- }): Promise<AxiosUtilsResponse<boolean>>;
13
+ }) => Promise<AxiosUtilsResponse<boolean>>;
14
14
  /**
15
15
  * markAsReceivePartialPurchaseOrder
16
16
  * @param headers
17
17
  * @param body
18
18
  * @returns
19
19
  */
20
- export declare function markAsReceivePartialPurchaseOrder(headers: any, session: Session, body: Partial<PurchaseOrderGraphQL> & {
20
+ export declare const markAsReceivePartialPurchaseOrder: (headers: any, session: Session, body: Partial<PurchaseOrderGraphQL> & {
21
21
  fechaVencimiento?: string;
22
- }): Promise<AxiosUtilsResponse<boolean>>;
22
+ }) => Promise<AxiosUtilsResponse<boolean>>;
23
23
  /**
24
24
  *
25
25
  * @param headers
26
26
  * @param body
27
27
  * @returns
28
28
  */
29
- export declare function createNewPurchaseOrder(headers: any, body: Partial<PurchaseOrderGraphQL>): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>>;
29
+ export declare const createNewPurchaseOrder: (headers: any, body: Partial<PurchaseOrderGraphQL>) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>>;
30
30
  /**
31
31
  *
32
32
  * @param headers
33
33
  * @param body
34
34
  * @returns
35
35
  */
36
- export declare function createNewAuthorizedPurchaseOrder(headers: any, body: CreateNewPurchaseOrderBody, withReceive?: boolean): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>>;
36
+ export declare const createNewAuthorizedPurchaseOrder: (headers: any, body: CreateNewPurchaseOrderBody, withReceive?: boolean) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>>;
37
37
  /**
38
38
  * receiveLotPurchaseOrder
39
39
  * @param headers
40
40
  * @param body
41
41
  * @returns
42
42
  */
43
- export declare function receiveLotPurchaseOrder(headers: any, body: PurchaseOrderGraphQL & {
43
+ export declare const receiveLotPurchaseOrder: (headers: any, body: PurchaseOrderGraphQL & {
44
44
  fechaVencimiento: string;
45
- }): Promise<AxiosUtilsResponse<boolean>>;
45
+ }) => Promise<AxiosUtilsResponse<boolean>>;
46
46
  /**
47
47
  * receivePurchaseOrder
48
48
  * @param headers
49
49
  * @param body
50
50
  * @returns
51
51
  */
52
- export declare function receivePurchaseOrder(headers: any, body: PurchaseOrderGraphQL): Promise<AxiosUtilsResponse<boolean>>;
52
+ export declare const receivePurchaseOrder: (headers: any, body: PurchaseOrderGraphQL) => Promise<AxiosUtilsResponse<boolean>>;
53
53
  /**
54
54
  *
55
55
  * @param headers
56
56
  * @returns
57
57
  */
58
- export declare function getNewPurchaseOrderInfo(headers: any): Promise<AxiosUtilsResponse<NewPurchaseOrderResponse>>;
58
+ export declare const getNewPurchaseOrderInfo: (headers: any) => Promise<AxiosUtilsResponse<NewPurchaseOrderResponse>>;
59
59
  /**
60
60
  * getPurchasesListDataTables Function for get all zauru orden-compras
61
61
  * @param headers
62
62
  * @returns
63
63
  */
64
- export declare function getPurchasesListDataTables(headers: any, body: DataTablesFilterBody): Promise<AxiosUtilsResponse<PurchasesListResponseSchema<HTMLPurchasesListSchema>>>;
64
+ export declare const getPurchasesListDataTables: (headers: any, body: DataTablesFilterBody) => Promise<AxiosUtilsResponse<PurchasesListResponseSchema<HTMLPurchasesListSchema>>>;
65
65
  /**
66
66
  * getPurchasesList Function for get all zauru orden-compras
67
67
  * @param headers
68
68
  * @param params
69
69
  * @returns
70
70
  */
71
- export declare function getPurchasesList(headers: any, session: Session, params?: {
71
+ export declare const getPurchasesList: (headers: any, session: Session, params?: {
72
72
  fechaInicio?: string;
73
73
  fechaFin?: string;
74
74
  item?: string | number;
@@ -76,13 +76,13 @@ export declare function getPurchasesList(headers: any, session: Session, params?
76
76
  agency_id?: string | number;
77
77
  }, config?: {
78
78
  fromProduction?: boolean;
79
- }): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
79
+ }) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
80
80
  /**
81
81
  * getPurchase Function for get an especific purchase order
82
82
  * @param headers
83
83
  * @returns
84
84
  */
85
- export declare function getPurchase(headers: any, purchase_order_id: number | string): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL & {
85
+ export declare const getPurchase: (headers: any, purchase_order_id: number | string) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL & {
86
86
  baskets_memo: BasketSchema[];
87
87
  baskets_memo_quantity: number;
88
88
  }>>;
@@ -93,7 +93,7 @@ export declare function getPurchase(headers: any, purchase_order_id: number | st
93
93
  * @param reception_id
94
94
  * @returns
95
95
  */
96
- export declare function enablePurchase(headers: any, purchase_order_id: number, reception_id: number): Promise<AxiosUtilsResponse<any>>;
96
+ export declare const enablePurchase: (headers: any, purchase_order_id: number, reception_id: number) => Promise<AxiosUtilsResponse<any>>;
97
97
  /**
98
98
  * updatePurchaseOrder
99
99
  * @param headers
@@ -101,7 +101,7 @@ export declare function enablePurchase(headers: any, purchase_order_id: number,
101
101
  * @param purchase_order_id
102
102
  * @returns
103
103
  */
104
- export declare function updatePurchaseOrder(headers: any, body: UpdatePurchaseOrderBody, purchase_order_id: number): Promise<AxiosUtilsResponse<any>>;
104
+ export declare const updatePurchaseOrder: (headers: any, body: UpdatePurchaseOrderBody, purchase_order_id: number) => Promise<AxiosUtilsResponse<any>>;
105
105
  /**
106
106
  * updatePurchaseOrder
107
107
  * @param headers
@@ -109,27 +109,27 @@ export declare function updatePurchaseOrder(headers: any, body: UpdatePurchaseOr
109
109
  * @param purchase_order_id
110
110
  * @returns
111
111
  */
112
- export declare function updateReceivedPurchaseOrder(headers: any, body: UpdatePurchaseOrderBody, purchase_order_id: number): Promise<AxiosUtilsResponse<any>>;
112
+ export declare const updateReceivedPurchaseOrder: (headers: any, body: UpdatePurchaseOrderBody, purchase_order_id: number) => Promise<AxiosUtilsResponse<any>>;
113
113
  /**
114
114
  * getLast100Receptions
115
115
  * @param headers
116
116
  * @returns
117
117
  */
118
- export declare function getLast100Receptions(session: Session, agency_id?: number | string): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
118
+ export declare const getLast100Receptions: (session: Session, agency_id?: number | string) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
119
119
  /**
120
120
  * getPurchaseOrder
121
121
  * @param headers
122
122
  * @returns
123
123
  */
124
- export declare function getPurchaseOrder(session: Session, poId: string | number, config?: {
124
+ export declare const getPurchaseOrder: (session: Session, poId: string | number, config?: {
125
125
  withLotStocksToMyAgency: boolean;
126
- }): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>>;
126
+ }) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>>;
127
127
  /**
128
128
  * getPurchaseOrder
129
129
  * @param headers
130
130
  * @returns
131
131
  */
132
- export declare function getGraphQLPurchaseOrderBetweenDates(session: Session, dates: {
132
+ export declare const getGraphQLPurchaseOrderBetweenDates: (session: Session, dates: {
133
133
  startDate: string;
134
134
  endDate: string;
135
135
  }, config?: {
@@ -143,18 +143,18 @@ export declare function getGraphQLPurchaseOrderBetweenDates(session: Session, da
143
143
  withLotStocksToMyAgency?: boolean;
144
144
  itemId?: number | string;
145
145
  payeeCategoryId?: number | string;
146
- }): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
146
+ }) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
147
147
  /**
148
148
  * deletePurchaseOrder
149
149
  * @param headers
150
150
  * @param id
151
151
  * @returns
152
152
  */
153
- export declare function deletePurchaseOrder(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
153
+ export declare const deletePurchaseOrder: (headers: any, id: string | number) => Promise<AxiosUtilsResponse<boolean>>;
154
154
  /**
155
155
  * getPurchaseOrderByIdNumber
156
156
  * @param session
157
157
  * @param idNumber
158
158
  * @returns
159
159
  */
160
- export declare function getPurchasesOrderByIdNumber(session: Session, id_number: string): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
160
+ export declare const getPurchasesOrderByIdNumber: (session: Session, id_number: string) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
@@ -12,7 +12,7 @@ import { getLast100ReceptionsStringQuery, getPurchaseOrderByIdNumberStringQuery,
12
12
  * @param body
13
13
  * @returns
14
14
  */
15
- export async function markAsReceivePurchaseOrder(headers, body) {
15
+ export const markAsReceivePurchaseOrder = (headers, body) => {
16
16
  return handlePossibleAxiosErrors(async () => {
17
17
  const sendBody = { ...body };
18
18
  if (sendBody.fechaVencimiento) {
@@ -23,14 +23,14 @@ export async function markAsReceivePurchaseOrder(headers, body) {
23
23
  }
24
24
  return true;
25
25
  });
26
- }
26
+ };
27
27
  /**
28
28
  * markAsReceivePartialPurchaseOrder
29
29
  * @param headers
30
30
  * @param body
31
31
  * @returns
32
32
  */
33
- export async function markAsReceivePartialPurchaseOrder(headers, session, body) {
33
+ export const markAsReceivePartialPurchaseOrder = (headers, session, body) => {
34
34
  return handlePossibleAxiosErrors(async () => {
35
35
  const sendBody = { ...body };
36
36
  if (sendBody.fechaVencimiento) {
@@ -41,14 +41,14 @@ export async function markAsReceivePartialPurchaseOrder(headers, session, body)
41
41
  }
42
42
  return true;
43
43
  });
44
- }
44
+ };
45
45
  /**
46
46
  *
47
47
  * @param headers
48
48
  * @param body
49
49
  * @returns
50
50
  */
51
- export async function createNewPurchaseOrder(headers, body) {
51
+ export const createNewPurchaseOrder = (headers, body) => {
52
52
  return handlePossibleAxiosErrors(async () => {
53
53
  let sendBody = {
54
54
  ...body,
@@ -71,14 +71,14 @@ export async function createNewPurchaseOrder(headers, body) {
71
71
  const response = await httpZauru.post(`/purchases/purchase_orders.json`, sendBody, { headers });
72
72
  return response.data;
73
73
  });
74
- }
74
+ };
75
75
  /**
76
76
  *
77
77
  * @param headers
78
78
  * @param body
79
79
  * @returns
80
80
  */
81
- export async function createNewAuthorizedPurchaseOrder(headers, body, withReceive = true) {
81
+ export const createNewAuthorizedPurchaseOrder = (headers, body, withReceive = true) => {
82
82
  return handlePossibleAxiosErrors(async () => {
83
83
  const sendBody = {
84
84
  ...body,
@@ -96,14 +96,14 @@ export async function createNewAuthorizedPurchaseOrder(headers, body, withReceiv
96
96
  }
97
97
  return response.data;
98
98
  });
99
- }
99
+ };
100
100
  /**
101
101
  * receiveLotPurchaseOrder
102
102
  * @param headers
103
103
  * @param body
104
104
  * @returns
105
105
  */
106
- export async function receiveLotPurchaseOrder(headers, body) {
106
+ export const receiveLotPurchaseOrder = (headers, body) => {
107
107
  return handlePossibleAxiosErrors(async () => {
108
108
  const sendBody = {
109
109
  agency_id: body.agency_id,
@@ -125,14 +125,14 @@ export async function receiveLotPurchaseOrder(headers, body) {
125
125
  await httpZauru.patch(`/purchases/purchase_orders/${body.id}/receive_action`, { purchase_order: sendBody }, { headers });
126
126
  return true;
127
127
  });
128
- }
128
+ };
129
129
  /**
130
130
  * receivePurchaseOrder
131
131
  * @param headers
132
132
  * @param body
133
133
  * @returns
134
134
  */
135
- export async function receivePurchaseOrder(headers, body) {
135
+ export const receivePurchaseOrder = (headers, body) => {
136
136
  return handlePossibleAxiosErrors(async () => {
137
137
  const sendBody = {
138
138
  agency_id: body.agency_id,
@@ -152,13 +152,13 @@ export async function receivePurchaseOrder(headers, body) {
152
152
  await httpZauru.patch(`/purchases/purchase_orders/${body.id}/receive_action`, { purchase_order: sendBody }, { headers });
153
153
  return true;
154
154
  });
155
- }
155
+ };
156
156
  /**
157
157
  *
158
158
  * @param headers
159
159
  * @returns
160
160
  */
161
- export async function getNewPurchaseOrderInfo(headers) {
161
+ export const getNewPurchaseOrderInfo = (headers) => {
162
162
  return handlePossibleAxiosErrors(async () => {
163
163
  const response = await httpZauru.get("/purchases/purchase_orders/new.json", { headers });
164
164
  const purchasersList = [];
@@ -172,25 +172,25 @@ export async function getNewPurchaseOrderInfo(headers) {
172
172
  });
173
173
  return { ...response.data, purchasersList };
174
174
  });
175
- }
175
+ };
176
176
  /**
177
177
  * getPurchasesListDataTables Function for get all zauru orden-compras
178
178
  * @param headers
179
179
  * @returns
180
180
  */
181
- export async function getPurchasesListDataTables(headers, body) {
181
+ export const getPurchasesListDataTables = (headers, body) => {
182
182
  return handlePossibleAxiosErrors(async () => {
183
183
  const response = await httpZauru.post(`/purchases/purchase_orders/datatables.json`, body, { headers });
184
184
  return response.data;
185
185
  });
186
- }
186
+ };
187
187
  /**
188
188
  * getPurchasesList Function for get all zauru orden-compras
189
189
  * @param headers
190
190
  * @param params
191
191
  * @returns
192
192
  */
193
- export async function getPurchasesList(headers, session, params = {}, config) {
193
+ export const getPurchasesList = (headers, session, params = {}, config) => {
194
194
  return handlePossibleAxiosErrors(async () => {
195
195
  //Si quiere obtener los de producción, obtengo primero su agencia producción
196
196
  if (config?.fromProduction) {
@@ -205,13 +205,13 @@ export async function getPurchasesList(headers, session, params = {}, config) {
205
205
  });
206
206
  return response.data;
207
207
  });
208
- }
208
+ };
209
209
  /**
210
210
  * getPurchase Function for get an especific purchase order
211
211
  * @param headers
212
212
  * @returns
213
213
  */
214
- export async function getPurchase(headers, purchase_order_id) {
214
+ export const getPurchase = (headers, purchase_order_id) => {
215
215
  return handlePossibleAxiosErrors(async () => {
216
216
  const response = await httpZauru(`/purchases/purchase_orders/${purchase_order_id}.json`, { method: "GET", headers });
217
217
  const baskets_memo = getBasketsSchema(response.data.memo);
@@ -224,7 +224,7 @@ export async function getPurchase(headers, purchase_order_id) {
224
224
  baskets_memo_quantity,
225
225
  };
226
226
  });
227
- }
227
+ };
228
228
  /**
229
229
  * enablePurchase Enable a purchase order
230
230
  * @param headers
@@ -232,12 +232,12 @@ export async function getPurchase(headers, purchase_order_id) {
232
232
  * @param reception_id
233
233
  * @returns
234
234
  */
235
- export async function enablePurchase(headers, purchase_order_id, reception_id) {
235
+ export const enablePurchase = (headers, purchase_order_id, reception_id) => {
236
236
  return handlePossibleAxiosErrors(async () => {
237
237
  const response = await httpZauru.get(`/purchases/receptions/${reception_id}/rebound.json?purchase_order_id=${purchase_order_id}`, { headers });
238
238
  return response.data;
239
239
  });
240
- }
240
+ };
241
241
  /**
242
242
  * updatePurchaseOrder
243
243
  * @param headers
@@ -245,12 +245,12 @@ export async function enablePurchase(headers, purchase_order_id, reception_id) {
245
245
  * @param purchase_order_id
246
246
  * @returns
247
247
  */
248
- export async function updatePurchaseOrder(headers, body, purchase_order_id) {
248
+ export const updatePurchaseOrder = (headers, body, purchase_order_id) => {
249
249
  return handlePossibleAxiosErrors(async () => {
250
250
  const response = await httpZauru.patch(`/purchases/purchase_orders/${purchase_order_id}.json`, body, { headers });
251
251
  return response.data;
252
252
  });
253
- }
253
+ };
254
254
  /**
255
255
  * updatePurchaseOrder
256
256
  * @param headers
@@ -258,18 +258,18 @@ export async function updatePurchaseOrder(headers, body, purchase_order_id) {
258
258
  * @param purchase_order_id
259
259
  * @returns
260
260
  */
261
- export async function updateReceivedPurchaseOrder(headers, body, purchase_order_id) {
261
+ export const updateReceivedPurchaseOrder = (headers, body, purchase_order_id) => {
262
262
  return handlePossibleAxiosErrors(async () => {
263
263
  const response = await httpZauru.patch(`/purchases/purchase_orders/${purchase_order_id}/update_received.json`, body, { headers });
264
264
  return response.data;
265
265
  });
266
- }
266
+ };
267
267
  /**
268
268
  * getLast100Receptions
269
269
  * @param headers
270
270
  * @returns
271
271
  */
272
- export async function getLast100Receptions(session, agency_id) {
272
+ export const getLast100Receptions = (session, agency_id) => {
273
273
  return handlePossibleAxiosErrors(async () => {
274
274
  const headers = await getGraphQLAPIHeaders(session);
275
275
  const response = await httpGraphQLAPI.post("", {
@@ -283,15 +283,15 @@ export async function getLast100Receptions(session, agency_id) {
283
283
  }
284
284
  return response.data?.data?.purchase_orders;
285
285
  });
286
- }
286
+ };
287
287
  /**
288
288
  * getPurchaseOrder
289
289
  * @param headers
290
290
  * @returns
291
291
  */
292
- export async function getPurchaseOrder(session, poId, config = {
292
+ export const getPurchaseOrder = (session, poId, config = {
293
293
  withLotStocksToMyAgency: false,
294
- }) {
294
+ }) => {
295
295
  return handlePossibleAxiosErrors(async () => {
296
296
  const headers = await getGraphQLAPIHeaders(session);
297
297
  const response = await httpGraphQLAPI.post("", {
@@ -311,19 +311,19 @@ export async function getPurchaseOrder(session, poId, config = {
311
311
  }
312
312
  return tempResponse;
313
313
  });
314
- }
314
+ };
315
315
  /**
316
316
  * getPurchaseOrder
317
317
  * @param headers
318
318
  * @returns
319
319
  */
320
- export async function getGraphQLPurchaseOrderBetweenDates(session, dates, config = {
320
+ export const getGraphQLPurchaseOrderBetweenDates = (session, dates, config = {
321
321
  agencyFilter: true,
322
322
  consolidateIdFilter: false,
323
323
  useProductionAgencyId: false,
324
324
  withShipmentToMyAgency: false,
325
325
  withLotStocksToMyAgency: false,
326
- }) {
326
+ }) => {
327
327
  return handlePossibleAxiosErrors(async () => {
328
328
  const headers = await getGraphQLAPIHeaders(session);
329
329
  let agency_id = config.agencyId;
@@ -375,26 +375,26 @@ export async function getGraphQLPurchaseOrderBetweenDates(session, dates, config
375
375
  }
376
376
  return responseData;
377
377
  });
378
- }
378
+ };
379
379
  /**
380
380
  * deletePurchaseOrder
381
381
  * @param headers
382
382
  * @param id
383
383
  * @returns
384
384
  */
385
- export async function deletePurchaseOrder(headers, id) {
385
+ export const deletePurchaseOrder = (headers, id) => {
386
386
  return handlePossibleAxiosErrors(async () => {
387
387
  await httpZauru.delete(`/purchases/purchase_orders/${id}.json?destroy=true`, { headers });
388
388
  return true;
389
389
  });
390
- }
390
+ };
391
391
  /**
392
392
  * getPurchaseOrderByIdNumber
393
393
  * @param session
394
394
  * @param idNumber
395
395
  * @returns
396
396
  */
397
- export async function getPurchasesOrderByIdNumber(session, id_number) {
397
+ export const getPurchasesOrderByIdNumber = (session, id_number) => {
398
398
  return handlePossibleAxiosErrors(async () => {
399
399
  const headers = await getGraphQLAPIHeaders(session);
400
400
  const response = await httpGraphQLAPI.post("", {
@@ -411,4 +411,4 @@ export async function getPurchasesOrderByIdNumber(session, id_number) {
411
411
  }
412
412
  return response.data?.data?.purchase_orders;
413
413
  });
414
- }
414
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/services",
3
- "version": "1.0.13",
3
+ "version": "1.0.18",
4
4
  "description": "Servicios de consulta a Zauru",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,5 +29,5 @@
29
29
  "engines": {
30
30
  "node": ">=18.0.0"
31
31
  },
32
- "gitHead": "9bca61fddd7c538e7f95a489d59436b5557c61cc"
32
+ "gitHead": "bcd403ed2996283a6eed13ce56cc24b2ee824369"
33
33
  }
package/src/index.ts CHANGED
@@ -12,6 +12,7 @@ export * from "./zauru/zauru-automatic-numbers.server.js";
12
12
  export * from "./zauru/zauru-bookings.server.js";
13
13
  export * from "./zauru/zauru-bundles.service.js";
14
14
  export * from "./zauru/zauru-cases.server.js";
15
+ export * from "./zauru/zauru-currencies.server.js";
15
16
  export * from "./zauru/zauru-consolidated.server.js";
16
17
  export * from "./zauru/zauru-deliveries.server.js";
17
18
  export * from "./zauru/zauru-discharges.server.js";
@@ -41,10 +41,10 @@ import {
41
41
  * @param body
42
42
  * @returns
43
43
  */
44
- export async function markAsReceivePurchaseOrder(
44
+ export const markAsReceivePurchaseOrder = (
45
45
  headers: any,
46
46
  body: Partial<PurchaseOrderGraphQL> & { fechaVencimiento?: string }
47
- ): Promise<AxiosUtilsResponse<boolean>> {
47
+ ): Promise<AxiosUtilsResponse<boolean>> => {
48
48
  return handlePossibleAxiosErrors(async () => {
49
49
  const sendBody = { ...body };
50
50
 
@@ -55,7 +55,7 @@ export async function markAsReceivePurchaseOrder(
55
55
  }
56
56
  return true;
57
57
  });
58
- }
58
+ };
59
59
 
60
60
  /**
61
61
  * markAsReceivePartialPurchaseOrder
@@ -63,11 +63,11 @@ export async function markAsReceivePurchaseOrder(
63
63
  * @param body
64
64
  * @returns
65
65
  */
66
- export async function markAsReceivePartialPurchaseOrder(
66
+ export const markAsReceivePartialPurchaseOrder = (
67
67
  headers: any,
68
68
  session: Session,
69
69
  body: Partial<PurchaseOrderGraphQL> & { fechaVencimiento?: string }
70
- ): Promise<AxiosUtilsResponse<boolean>> {
70
+ ): Promise<AxiosUtilsResponse<boolean>> => {
71
71
  return handlePossibleAxiosErrors(async () => {
72
72
  const sendBody = { ...body };
73
73
 
@@ -82,7 +82,7 @@ export async function markAsReceivePartialPurchaseOrder(
82
82
  }
83
83
  return true;
84
84
  });
85
- }
85
+ };
86
86
 
87
87
  /**
88
88
  *
@@ -90,10 +90,10 @@ export async function markAsReceivePartialPurchaseOrder(
90
90
  * @param body
91
91
  * @returns
92
92
  */
93
- export async function createNewPurchaseOrder(
93
+ export const createNewPurchaseOrder = (
94
94
  headers: any,
95
95
  body: Partial<PurchaseOrderGraphQL>
96
- ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>> {
96
+ ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>> => {
97
97
  return handlePossibleAxiosErrors(async () => {
98
98
  let sendBody = {
99
99
  ...body,
@@ -127,7 +127,7 @@ export async function createNewPurchaseOrder(
127
127
 
128
128
  return response.data;
129
129
  });
130
- }
130
+ };
131
131
 
132
132
  /**
133
133
  *
@@ -135,11 +135,11 @@ export async function createNewPurchaseOrder(
135
135
  * @param body
136
136
  * @returns
137
137
  */
138
- export async function createNewAuthorizedPurchaseOrder(
138
+ export const createNewAuthorizedPurchaseOrder = (
139
139
  headers: any,
140
140
  body: CreateNewPurchaseOrderBody,
141
141
  withReceive: boolean = true
142
- ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>> {
142
+ ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>> => {
143
143
  return handlePossibleAxiosErrors(async () => {
144
144
  const sendBody = {
145
145
  ...body,
@@ -169,7 +169,7 @@ export async function createNewAuthorizedPurchaseOrder(
169
169
 
170
170
  return response.data;
171
171
  });
172
- }
172
+ };
173
173
 
174
174
  /**
175
175
  * receiveLotPurchaseOrder
@@ -177,10 +177,10 @@ export async function createNewAuthorizedPurchaseOrder(
177
177
  * @param body
178
178
  * @returns
179
179
  */
180
- export async function receiveLotPurchaseOrder(
180
+ export const receiveLotPurchaseOrder = (
181
181
  headers: any,
182
182
  body: PurchaseOrderGraphQL & { fechaVencimiento: string }
183
- ): Promise<AxiosUtilsResponse<boolean>> {
183
+ ): Promise<AxiosUtilsResponse<boolean>> => {
184
184
  return handlePossibleAxiosErrors(async () => {
185
185
  const sendBody = {
186
186
  agency_id: body.agency_id,
@@ -208,7 +208,7 @@ export async function receiveLotPurchaseOrder(
208
208
  );
209
209
  return true;
210
210
  });
211
- }
211
+ };
212
212
 
213
213
  /**
214
214
  * receivePurchaseOrder
@@ -216,10 +216,10 @@ export async function receiveLotPurchaseOrder(
216
216
  * @param body
217
217
  * @returns
218
218
  */
219
- export async function receivePurchaseOrder(
219
+ export const receivePurchaseOrder = (
220
220
  headers: any,
221
221
  body: PurchaseOrderGraphQL
222
- ): Promise<AxiosUtilsResponse<boolean>> {
222
+ ): Promise<AxiosUtilsResponse<boolean>> => {
223
223
  return handlePossibleAxiosErrors(async () => {
224
224
  const sendBody = {
225
225
  agency_id: body.agency_id,
@@ -245,16 +245,16 @@ export async function receivePurchaseOrder(
245
245
  );
246
246
  return true;
247
247
  });
248
- }
248
+ };
249
249
 
250
250
  /**
251
251
  *
252
252
  * @param headers
253
253
  * @returns
254
254
  */
255
- export async function getNewPurchaseOrderInfo(
255
+ export const getNewPurchaseOrderInfo = (
256
256
  headers: any
257
- ): Promise<AxiosUtilsResponse<NewPurchaseOrderResponse>> {
257
+ ): Promise<AxiosUtilsResponse<NewPurchaseOrderResponse>> => {
258
258
  return handlePossibleAxiosErrors(async () => {
259
259
  const response = await httpZauru.get<NewPurchaseOrderResponse>(
260
260
  "/purchases/purchase_orders/new.json",
@@ -273,19 +273,19 @@ export async function getNewPurchaseOrderInfo(
273
273
 
274
274
  return { ...response.data, purchasersList } as NewPurchaseOrderResponse;
275
275
  });
276
- }
276
+ };
277
277
 
278
278
  /**
279
279
  * getPurchasesListDataTables Function for get all zauru orden-compras
280
280
  * @param headers
281
281
  * @returns
282
282
  */
283
- export async function getPurchasesListDataTables(
283
+ export const getPurchasesListDataTables = (
284
284
  headers: any,
285
285
  body: DataTablesFilterBody
286
286
  ): Promise<
287
287
  AxiosUtilsResponse<PurchasesListResponseSchema<HTMLPurchasesListSchema>>
288
- > {
288
+ > => {
289
289
  return handlePossibleAxiosErrors(async () => {
290
290
  const response = await httpZauru.post<
291
291
  PurchasesListResponseSchema<HTMLPurchasesListSchema>
@@ -293,7 +293,7 @@ export async function getPurchasesListDataTables(
293
293
 
294
294
  return response.data;
295
295
  });
296
- }
296
+ };
297
297
 
298
298
  /**
299
299
  * getPurchasesList Function for get all zauru orden-compras
@@ -301,7 +301,7 @@ export async function getPurchasesListDataTables(
301
301
  * @param params
302
302
  * @returns
303
303
  */
304
- export async function getPurchasesList(
304
+ export const getPurchasesList = (
305
305
  headers: any,
306
306
  session: Session,
307
307
  params: {
@@ -312,7 +312,7 @@ export async function getPurchasesList(
312
312
  agency_id?: string | number;
313
313
  } = {},
314
314
  config?: { fromProduction?: boolean }
315
- ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>> {
315
+ ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>> => {
316
316
  return handlePossibleAxiosErrors(async () => {
317
317
  //Si quiere obtener los de producción, obtengo primero su agencia producción
318
318
  if (config?.fromProduction) {
@@ -336,14 +336,14 @@ export async function getPurchasesList(
336
336
 
337
337
  return response.data;
338
338
  });
339
- }
339
+ };
340
340
 
341
341
  /**
342
342
  * getPurchase Function for get an especific purchase order
343
343
  * @param headers
344
344
  * @returns
345
345
  */
346
- export async function getPurchase(
346
+ export const getPurchase = (
347
347
  headers: any,
348
348
  purchase_order_id: number | string
349
349
  ): Promise<
@@ -353,7 +353,7 @@ export async function getPurchase(
353
353
  baskets_memo_quantity: number;
354
354
  }
355
355
  >
356
- > {
356
+ > => {
357
357
  return handlePossibleAxiosErrors(async () => {
358
358
  const response = await httpZauru<PurchaseOrderGraphQL>(
359
359
  `/purchases/purchase_orders/${purchase_order_id}.json`,
@@ -371,7 +371,7 @@ export async function getPurchase(
371
371
  baskets_memo_quantity,
372
372
  };
373
373
  });
374
- }
374
+ };
375
375
 
376
376
  /**
377
377
  * enablePurchase Enable a purchase order
@@ -380,11 +380,11 @@ export async function getPurchase(
380
380
  * @param reception_id
381
381
  * @returns
382
382
  */
383
- export async function enablePurchase(
383
+ export const enablePurchase = (
384
384
  headers: any,
385
385
  purchase_order_id: number,
386
386
  reception_id: number
387
- ): Promise<AxiosUtilsResponse<any>> {
387
+ ): Promise<AxiosUtilsResponse<any>> => {
388
388
  return handlePossibleAxiosErrors(async () => {
389
389
  const response = await httpZauru.get<any>(
390
390
  `/purchases/receptions/${reception_id}/rebound.json?purchase_order_id=${purchase_order_id}`,
@@ -393,7 +393,7 @@ export async function enablePurchase(
393
393
 
394
394
  return response.data;
395
395
  });
396
- }
396
+ };
397
397
 
398
398
  /**
399
399
  * updatePurchaseOrder
@@ -402,11 +402,11 @@ export async function enablePurchase(
402
402
  * @param purchase_order_id
403
403
  * @returns
404
404
  */
405
- export async function updatePurchaseOrder(
405
+ export const updatePurchaseOrder = (
406
406
  headers: any,
407
407
  body: UpdatePurchaseOrderBody,
408
408
  purchase_order_id: number
409
- ): Promise<AxiosUtilsResponse<any>> {
409
+ ): Promise<AxiosUtilsResponse<any>> => {
410
410
  return handlePossibleAxiosErrors(async () => {
411
411
  const response = await httpZauru.patch<any>(
412
412
  `/purchases/purchase_orders/${purchase_order_id}.json`,
@@ -416,7 +416,7 @@ export async function updatePurchaseOrder(
416
416
 
417
417
  return response.data;
418
418
  });
419
- }
419
+ };
420
420
 
421
421
  /**
422
422
  * updatePurchaseOrder
@@ -425,11 +425,11 @@ export async function updatePurchaseOrder(
425
425
  * @param purchase_order_id
426
426
  * @returns
427
427
  */
428
- export async function updateReceivedPurchaseOrder(
428
+ export const updateReceivedPurchaseOrder = (
429
429
  headers: any,
430
430
  body: UpdatePurchaseOrderBody,
431
431
  purchase_order_id: number
432
- ): Promise<AxiosUtilsResponse<any>> {
432
+ ): Promise<AxiosUtilsResponse<any>> => {
433
433
  return handlePossibleAxiosErrors(async () => {
434
434
  const response = await httpZauru.patch<any>(
435
435
  `/purchases/purchase_orders/${purchase_order_id}/update_received.json`,
@@ -439,17 +439,17 @@ export async function updateReceivedPurchaseOrder(
439
439
 
440
440
  return response.data;
441
441
  });
442
- }
442
+ };
443
443
 
444
444
  /**
445
445
  * getLast100Receptions
446
446
  * @param headers
447
447
  * @returns
448
448
  */
449
- export async function getLast100Receptions(
449
+ export const getLast100Receptions = (
450
450
  session: Session,
451
451
  agency_id?: number | string
452
- ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>> {
452
+ ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>> => {
453
453
  return handlePossibleAxiosErrors(async () => {
454
454
  const headers = await getGraphQLAPIHeaders(session);
455
455
 
@@ -476,20 +476,20 @@ export async function getLast100Receptions(
476
476
 
477
477
  return response.data?.data?.purchase_orders;
478
478
  });
479
- }
479
+ };
480
480
 
481
481
  /**
482
482
  * getPurchaseOrder
483
483
  * @param headers
484
484
  * @returns
485
485
  */
486
- export async function getPurchaseOrder(
486
+ export const getPurchaseOrder = (
487
487
  session: Session,
488
488
  poId: string | number,
489
489
  config: { withLotStocksToMyAgency: boolean } = {
490
490
  withLotStocksToMyAgency: false,
491
491
  }
492
- ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>> {
492
+ ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>> => {
493
493
  return handlePossibleAxiosErrors(async () => {
494
494
  const headers = await getGraphQLAPIHeaders(session);
495
495
 
@@ -526,14 +526,14 @@ export async function getPurchaseOrder(
526
526
 
527
527
  return tempResponse;
528
528
  });
529
- }
529
+ };
530
530
 
531
531
  /**
532
532
  * getPurchaseOrder
533
533
  * @param headers
534
534
  * @returns
535
535
  */
536
- export async function getGraphQLPurchaseOrderBetweenDates(
536
+ export const getGraphQLPurchaseOrderBetweenDates = (
537
537
  session: Session,
538
538
  dates: {
539
539
  startDate: string;
@@ -557,7 +557,7 @@ export async function getGraphQLPurchaseOrderBetweenDates(
557
557
  withShipmentToMyAgency: false,
558
558
  withLotStocksToMyAgency: false,
559
559
  }
560
- ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>> {
560
+ ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>> => {
561
561
  return handlePossibleAxiosErrors(async () => {
562
562
  const headers = await getGraphQLAPIHeaders(session);
563
563
 
@@ -636,7 +636,7 @@ export async function getGraphQLPurchaseOrderBetweenDates(
636
636
 
637
637
  return responseData;
638
638
  });
639
- }
639
+ };
640
640
 
641
641
  /**
642
642
  * deletePurchaseOrder
@@ -644,10 +644,10 @@ export async function getGraphQLPurchaseOrderBetweenDates(
644
644
  * @param id
645
645
  * @returns
646
646
  */
647
- export async function deletePurchaseOrder(
647
+ export const deletePurchaseOrder = (
648
648
  headers: any,
649
649
  id: string | number
650
- ): Promise<AxiosUtilsResponse<boolean>> {
650
+ ): Promise<AxiosUtilsResponse<boolean>> => {
651
651
  return handlePossibleAxiosErrors(async () => {
652
652
  await httpZauru.delete(
653
653
  `/purchases/purchase_orders/${id}.json?destroy=true`,
@@ -656,7 +656,7 @@ export async function deletePurchaseOrder(
656
656
 
657
657
  return true;
658
658
  });
659
- }
659
+ };
660
660
 
661
661
  /**
662
662
  * getPurchaseOrderByIdNumber
@@ -664,10 +664,10 @@ export async function deletePurchaseOrder(
664
664
  * @param idNumber
665
665
  * @returns
666
666
  */
667
- export async function getPurchasesOrderByIdNumber(
667
+ export const getPurchasesOrderByIdNumber = (
668
668
  session: Session,
669
669
  id_number: string
670
- ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>> {
670
+ ): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>> => {
671
671
  return handlePossibleAxiosErrors(async () => {
672
672
  const headers = await getGraphQLAPIHeaders(session);
673
673
 
@@ -698,4 +698,4 @@ export async function getPurchasesOrderByIdNumber(
698
698
 
699
699
  return response.data?.data?.purchase_orders;
700
700
  });
701
- }
701
+ };