@zauru-sdk/services 2.23.1 → 2.25.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.
@@ -11,6 +11,7 @@ axiosInstance.interceptors.request.use(function (request) {
11
11
  request.timeout = 200000;
12
12
  request.metadata = { startTime: Date.now() };
13
13
  if (config.debugHTTP) {
14
+ console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
14
15
  console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
15
16
  }
16
17
  return request;
@@ -11,6 +11,7 @@ axiosInstance.interceptors.request.use(function (request) {
11
11
  request.timeout = 200000;
12
12
  request.metadata = { startTime: Date.now() };
13
13
  if (config.debugHTTP) {
14
+ console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
14
15
  console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
15
16
  }
16
17
  return request;
@@ -11,6 +11,7 @@ axiosInstance.interceptors.request.use(function (request) {
11
11
  request.timeout = 200000;
12
12
  request.metadata = { startTime: Date.now() };
13
13
  if (config.debugHTTP) {
14
+ console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
14
15
  console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
15
16
  }
16
17
  return request;
@@ -11,6 +11,7 @@ axiosInstance.interceptors.request.use(function (request) {
11
11
  request.timeout = 200000;
12
12
  request.metadata = { startTime: Date.now() };
13
13
  if (config.debugHTTP) {
14
+ console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
14
15
  console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), JSON.stringify(request.data, null, 2));
15
16
  }
16
17
  return request;
@@ -149,37 +149,6 @@ export async function createInvoicePOS(headers, body) {
149
149
  return response.data;
150
150
  });
151
151
  }
152
- /**
153
- * updateInvoicePOS
154
- * @param headers
155
- * @param body
156
- * @returns
157
- */
158
- /*
159
- export async function updateInvoicePOS(
160
- headers: any,
161
- body: Partial<InvoiceGraphQL>,
162
- ): Promise<AxiosUtilsResponse<InvoiceGraphQL>> {
163
- return handlePossibleAxiosErrors(async () => {
164
- const sendBody = {
165
- ...body,
166
- invoice_details_attributes: arrayToObject(body.invoice_details),
167
- } as any;
168
- if (sendBody.deleted_invoice_details)
169
- delete sendBody.deleted_invoice_details;
170
- if (sendBody.__rvfInternalFormId) delete sendBody.__rvfInternalFormId;
171
- if (sendBody.invoice_details) delete sendBody.invoice_details;
172
-
173
- const response = await httpZauru.patch<InvoiceGraphQL>(
174
- `/pos/invoices/${body.id}.json`,
175
- { invoice: sendBody },
176
- { headers },
177
- );
178
-
179
- return response.data;
180
- });
181
- }
182
- */
183
152
  /**
184
153
  * deleteInvoicePOS
185
154
  * @param headers
@@ -274,6 +274,23 @@ export const shallowUpdatePurchaseOrder = (headers, body) => {
274
274
  * @returns
275
275
  */
276
276
  export const getLast100Receptions = (session, agency_id) => {
277
+ return handlePossibleAxiosErrors(async () => {
278
+ const headers = await getGraphQLAPIHeaders(session);
279
+ const response = await httpGraphQLAPI.post("", {
280
+ query: getLast100ReceptionsStringQuery(agency_id),
281
+ }, { headers });
282
+ if (response.data.errors) {
283
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
284
+ }
285
+ return response.data?.data?.purchase_orders;
286
+ });
287
+ };
288
+ /**
289
+ * getLast100Receptions
290
+ * @param headers
291
+ * @returns
292
+ */
293
+ export const getLast100ReceptionsOnMyAgency = (session, agency_id) => {
277
294
  return handlePossibleAxiosErrors(async () => {
278
295
  const headers = await getGraphQLAPIHeaders(session);
279
296
  const agencyId = agency_id ?? Number(session.get("agency_id"));
@@ -44,12 +44,6 @@ export declare function deleteInvoiceOrder(headers: any, id: string | number): P
44
44
  * @returns
45
45
  */
46
46
  export declare function createInvoicePOS(headers: any, body: Partial<InvoiceGraphQL>): Promise<AxiosUtilsResponse<InvoiceGraphQL>>;
47
- /**
48
- * updateInvoicePOS
49
- * @param headers
50
- * @param body
51
- * @returns
52
- */
53
47
  /**
54
48
  * deleteInvoicePOS
55
49
  * @param headers
@@ -126,6 +126,12 @@ export declare const shallowUpdatePurchaseOrder: (headers: any, body: Partial<Pu
126
126
  * @returns
127
127
  */
128
128
  export declare const getLast100Receptions: (session: Session, agency_id?: number | string) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
129
+ /**
130
+ * getLast100Receptions
131
+ * @param headers
132
+ * @returns
133
+ */
134
+ export declare const getLast100ReceptionsOnMyAgency: (session: Session, agency_id?: number | string) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
129
135
  /**
130
136
  * getPurchaseOrder
131
137
  * @param headers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/services",
3
- "version": "2.23.1",
3
+ "version": "2.25.0",
4
4
  "description": "Servicios de consulta a Zauru",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -27,10 +27,10 @@
27
27
  "@upstash/redis": "^1.34.5",
28
28
  "@zauru-sdk/common": "^2.16.1",
29
29
  "@zauru-sdk/config": "^2.23.1",
30
- "@zauru-sdk/graphql": "^2.19.1",
30
+ "@zauru-sdk/graphql": "^2.25.0",
31
31
  "@zauru-sdk/types": "^2.16.0",
32
32
  "axios": "^1.6.7",
33
33
  "chalk": "5.3.0"
34
34
  },
35
- "gitHead": "286f920db89f530c25ed6173e3e90a75516aeea6"
35
+ "gitHead": "da550f653a8f3439364198939bb2fc1e3aeb2752"
36
36
  }