@zauru-sdk/graphql 2.14.2 → 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.
@@ -1,4 +1,4 @@
1
- export declare const getLast100ReceptionsStringQuery: (agency_id: number) => string;
1
+ export declare const getLast100ReceptionsStringQuery: (agency_id?: number | string) => string;
2
2
  export declare const getPurchaseOrderByIdNumberStringQuery: (id_number: string) => string;
3
3
  export declare const getPurchaseOrderStringQuery: (id: number, config?: {
4
4
  withLotStocks: boolean;
@@ -1,38 +1,53 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPrintTemplatesStringQuery = exports.getCasesStringQuery = exports.getInvoicesByAgencyIdStringQuery = exports.getPaymentTermByIdStringQuery = exports.getPaymentMethodsStringQuery = exports.getPaymentTermsStringQuery = exports.getSuggestedPricesStringQuery = exports.getCurrenciesStringQuery = exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = exports.getCaseFormSubmissionsByCaseIdStringQuery = exports.getLastInvoiceFormSubmissionStringQuery = exports.getInvoiceFormSubmissionsByAgencyIdStringQuery = exports.getFormSubmissionByIdStringQuery = exports.getMyCaseFormSubmissionsStringQuery = exports.getFormsByDocumentTypeStringQuery = exports.getFormsStringQuery = exports.getFormByNameStringQuery = exports.getAllFormsStringQuery = exports.getItemByNameStringQuery = exports.getBundleByNameStringQuery = exports.getBundlesByItemCategoryIdStringQuery = exports.getEmployeesByAgencyIdStringQuery = exports.getEmployeesStringQuery = exports.getEmployeeProfileStringQuery = exports.getConsolidatesBetweenDatesStringQuery = exports.getItemsBySuperCategoryStringQuery = exports.getItemsStringQuery = exports.getItemsByCategoryStringQuery = exports.getItemCategoryByIdStringQuery = exports.getSuperCategoryByIdStringQuery = exports.getPayeeByIdStringQuery = exports.getClientCategoriesStringQuery = exports.getProviderCategoriesStringQuery = exports.getPayeeCategoriesStringQuery = exports.getPayeeCategoriesByNotesMatchStringQuery = exports.getPayeeCategoryByIdStringQuery = exports.getWebAppRowsByWebAppTableIdStringQuery = exports.getWebAppRowStringQuery = exports.getAgenciesStringQuery = exports.getProvidersStringQuery = exports.getPayeesStringQuery = exports.getPurchaseOrdersBetweenDatesStringQuery = exports.getSerialsStringQuery = exports.getLotStocksByAgencyIdStringQuery = exports.getLotsByNameStringQuery = exports.getShipmentsStringQuery = exports.getPurchaseOrderStringQuery = exports.getPurchaseOrderByIdNumberStringQuery = exports.getLast100ReceptionsStringQuery = void 0;
4
- const getLast100ReceptionsStringQuery = (agency_id) => `
5
- query getLast100Receptions {
6
- purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: ${agency_id}}}) {
7
- id
8
- created_at
9
- due
10
- id_number
11
- memo
12
- payee_id
13
- issue_date
14
- discount
15
- other_charges
16
- authorized
17
- received
18
- transport_type
19
- shipment_reference
20
- purchase_order_details {
21
- item_id
22
- id
23
- reference
24
- booked_quantity
25
- delivered_quantity
4
+ const getLast100ReceptionsStringQuery = (agency_id) => {
5
+ const conditions = ["voided: {_eq: false}"];
6
+ if (agency_id) {
7
+ conditions.push(`agency_id: {_eq: ${agency_id}}`);
26
8
  }
27
- lots(where: {active: {_eq: true}}) {
28
- id
29
- name
30
- description
31
- item_id
9
+ return `
10
+ query getLast100Receptions {
11
+ purchase_orders(
12
+ limit: 100,
13
+ order_by: {
14
+ created_at: desc
15
+ },
16
+ where: {
17
+ ${conditions.join(", ")}
18
+ }
19
+ ) {
20
+ id
21
+ created_at
22
+ due
23
+ id_number
24
+ memo
25
+ payee_id
26
+ issue_date
27
+ discount
28
+ other_charges
29
+ authorized
30
+ received
31
+ transport_type
32
+ shipment_reference
33
+ reference
34
+ purchase_order_details {
35
+ item_id
36
+ id
37
+ reference
38
+ booked_quantity
39
+ delivered_quantity
40
+ }
41
+ lots(where: {active: {_eq: true}}) {
42
+ id
43
+ name
44
+ description
45
+ item_id
46
+ }
47
+ }
32
48
  }
33
- }
34
- }
35
- `;
49
+ `;
50
+ };
36
51
  exports.getLast100ReceptionsStringQuery = getLast100ReceptionsStringQuery;
37
52
  const getPurchaseOrderByIdNumberStringQuery = (id_number) => `
38
53
  query getPurchaseOrderByIdNumber {
@@ -386,7 +401,12 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
386
401
  if (config.payeeId || config.payeeCategoryId) {
387
402
  const payeeConditions = [];
388
403
  if (config.payeeId) {
389
- payeeConditions.push(`id: { _eq: ${config.payeeId} }`);
404
+ if (config.payeeId.toString().includes(",")) {
405
+ payeeConditions.push(`id: { _in: [${config.payeeId}] }`);
406
+ }
407
+ else {
408
+ payeeConditions.push(`id: { _eq: ${config.payeeId} }`);
409
+ }
390
410
  }
391
411
  if (config.payeeCategoryId) {
392
412
  payeeConditions.push(`payee_category: { id: { _eq: ${config.payeeCategoryId} } }`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "2.14.2",
3
+ "version": "2.25.0",
4
4
  "description": "Queries de uso común para las aplicación de Zauru.",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -21,5 +21,5 @@
21
21
  "devDependencies": {
22
22
  "typescript": "^5.1.6"
23
23
  },
24
- "gitHead": "1dea85f0e6cf3552334115097392b6e616f6d061"
24
+ "gitHead": "da550f653a8f3439364198939bb2fc1e3aeb2752"
25
25
  }