@zauru-sdk/services 2.0.162 → 2.0.164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -32,6 +32,7 @@ export * from "./zauru/zauru-print-templates.js";
32
32
  export * from "./zauru/zauru-purchase-orders.js";
33
33
  export * from "./zauru/zauru-profiles.js";
34
34
  export * from "./zauru/zauru-receptions.js";
35
+ export * from "./zauru/zauru-serial-numbers.js";
35
36
  export * from "./zauru/zauru-shipments.js";
36
37
  export * from "./zauru/zauru-suggested-prices.js";
37
38
  export * from "./zauru/zauru-tags.js";
@@ -0,0 +1,36 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import { httpZauru } from "./httpZauru.js";
3
+ import { getGraphQLAPIHeaders } from "~/common.js";
4
+ import { httpGraphQLAPI } from "./httpGraphQL.js";
5
+ import { getSerialsStringQuery } from "@zauru-sdk/graphql";
6
+ /**
7
+ * getSerials
8
+ */
9
+ export async function getSerials(session, filters) {
10
+ return handlePossibleAxiosErrors(async () => {
11
+ const headers = await getGraphQLAPIHeaders(session);
12
+ const defaultFilters = {
13
+ name: undefined,
14
+ };
15
+ const finalFilters = { ...defaultFilters, ...filters };
16
+ const response = await httpGraphQLAPI.post("", {
17
+ query: getSerialsStringQuery(finalFilters),
18
+ }, { headers });
19
+ if (response.data.errors) {
20
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
21
+ }
22
+ const registers = response?.data?.data?.serials;
23
+ return registers;
24
+ });
25
+ }
26
+ /**
27
+ * createSupportSerialAttended
28
+ * @param headers
29
+ * @param body
30
+ */
31
+ export async function createSupportSerialAttended(headers, body) {
32
+ return handlePossibleAxiosErrors(async () => {
33
+ const response = await httpZauru.post(`/support/serials_attended.json`, { serial: body }, { headers });
34
+ return response.data;
35
+ });
36
+ }
@@ -10,23 +10,13 @@ export async function getShipments(session, config) {
10
10
  return handlePossibleAxiosErrors(async () => {
11
11
  const headers = await getGraphQLAPIHeaders(session);
12
12
  const query = getShipmentsStringQuery({
13
+ ...config,
13
14
  agency_to_id: config.agency_to_id
14
15
  ? Number(config.agency_to_id)
15
16
  : undefined,
16
17
  agency_from_id: config.agency_from_id
17
18
  ? Number(config.agency_from_id)
18
19
  : undefined,
19
- suffix: config.suffix,
20
- id_number: config.id_number,
21
- id_number_not_null: config.id_number_not_null,
22
- id_number_not_empty: config.id_number_not_empty,
23
- withMovementLots: config.withMovementLots,
24
- memoILike: config.memoILike,
25
- voided: config.voided,
26
- delivered: config.delivered,
27
- shipped: config.shipped,
28
- returned: config.returned,
29
- withPurchaseOrdersByShipmentReference: config.withPurchaseOrdersByShipmentReference,
30
20
  });
31
21
  const response = await httpGraphQLAPI.post("", {
32
22
  query,
package/dist/index.d.ts CHANGED
@@ -32,6 +32,7 @@ export * from "./zauru/zauru-print-templates.js";
32
32
  export * from "./zauru/zauru-purchase-orders.js";
33
33
  export * from "./zauru/zauru-profiles.js";
34
34
  export * from "./zauru/zauru-receptions.js";
35
+ export * from "./zauru/zauru-serial-numbers.js";
35
36
  export * from "./zauru/zauru-shipments.js";
36
37
  export * from "./zauru/zauru-suggested-prices.js";
37
38
  export * from "./zauru/zauru-tags.js";
@@ -0,0 +1,16 @@
1
+ import { AxiosUtilsResponse, SerialGraphQL } from "@zauru-sdk/types";
2
+ import { Session } from "@remix-run/node";
3
+ /**
4
+ * getSerials
5
+ */
6
+ export declare function getSerials(session: Session, filters?: {
7
+ name?: string;
8
+ }): Promise<AxiosUtilsResponse<SerialGraphQL[]>>;
9
+ /**
10
+ * createSupportSerialAttended
11
+ * @param headers
12
+ * @param body
13
+ */
14
+ export declare function createSupportSerialAttended(headers: any, body: Partial<SerialGraphQL> & {
15
+ payee_id: number;
16
+ }): Promise<AxiosUtilsResponse<SerialGraphQL>>;
@@ -17,6 +17,7 @@ export declare function getShipments(session: Session, config: {
17
17
  shipped?: boolean;
18
18
  returned?: boolean;
19
19
  withPurchaseOrdersByShipmentReference?: boolean;
20
+ limit?: number;
20
21
  }): Promise<AxiosUtilsResponse<ShipmentGraphQL[]>>;
21
22
  /**
22
23
  * receiveShipment_booking
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/services",
3
- "version": "2.0.162",
3
+ "version": "2.0.164",
4
4
  "description": "Servicios de consulta a Zauru",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -24,12 +24,12 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@remix-run/node": "^2.8.1",
27
- "@zauru-sdk/common": "^2.0.162",
27
+ "@zauru-sdk/common": "^2.0.164",
28
28
  "@zauru-sdk/config": "^2.0.100",
29
- "@zauru-sdk/graphql": "^2.0.161",
30
- "@zauru-sdk/types": "^2.0.162",
29
+ "@zauru-sdk/graphql": "^2.0.164",
30
+ "@zauru-sdk/types": "^2.0.164",
31
31
  "axios": "^1.6.7",
32
32
  "chalk": "5.3.0"
33
33
  },
34
- "gitHead": "1217c8b95d203981331c96793db293f3a022cc51"
34
+ "gitHead": "44804384967c4f4a6315c49550b464b79b55a06a"
35
35
  }