@zauru-sdk/graphql 6.12.0 → 6.14.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.
@@ -54,6 +54,10 @@ export declare const getPurchaseOrdersBetweenDatesStringQuery: (startDate: strin
54
54
  payeeId?: number | string;
55
55
  consolidateIdFilter?: boolean;
56
56
  lotItemIdExclusion?: number;
57
+ lotStockAgencyId?: number | string;
58
+ lotStockAvailableGt?: number;
59
+ excludeAgencyId?: number | string;
60
+ skipDateFilter?: boolean;
57
61
  withLotStocks?: boolean;
58
62
  betweenIssueDate?: boolean;
59
63
  id_number?: string;
@@ -77,6 +81,9 @@ export declare const getPayeesStringQuery: (filters?: {
77
81
  name?: string;
78
82
  vendor?: boolean;
79
83
  tin?: string;
84
+ active?: boolean;
85
+ id_number_not_empty?: boolean;
86
+ id_number_not_null?: boolean;
80
87
  }) => string;
81
88
  export declare const getProvidersStringQuery = "\nquery getProviders {\n payees (where: {vendor: {_eq: true}}) {\n id\n id_number\n name\n tin\n address_line_1\n }\n}\n";
82
89
  export declare const getAgenciesStringQuery = "\nquery getAgencies {\n agencies {\n id\n name\n address_line_2\n }\n}\n";
@@ -444,6 +444,9 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
444
444
  if (config.agencyId) {
445
445
  conditions.push(`agency_id: { _eq: ${config.agencyId} }`);
446
446
  }
447
+ if (config.excludeAgencyId) {
448
+ conditions.push(`agency_id: { _neq: ${config.excludeAgencyId} }`);
449
+ }
447
450
  if (config.consolidateIdFilter) {
448
451
  conditions.push("consolidate_id: { _is_null: true }");
449
452
  }
@@ -506,10 +509,24 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
506
509
  conditions.push(`reference: { _eq: "${config.reference}" }`);
507
510
  }
508
511
  }
512
+ const lotsWhereConditions = [];
509
513
  if (config.lotItemIdExclusion) {
510
- conditions.push(`lots: { item_id: { _neq: ${config.lotItemIdExclusion} } }`);
514
+ lotsWhereConditions.push(`item_id: { _neq: ${config.lotItemIdExclusion} }`);
515
+ }
516
+ const lotStockConditions = [];
517
+ if (config.lotStockAgencyId) {
518
+ lotStockConditions.push(`agency_id: { _eq: ${config.lotStockAgencyId} }`);
519
+ }
520
+ if (config.lotStockAvailableGt != null) {
521
+ lotStockConditions.push(`available: { _gt: ${config.lotStockAvailableGt} }`);
522
+ }
523
+ if (lotStockConditions.length > 0) {
524
+ lotsWhereConditions.push(`lot_stocks: { ${lotStockConditions.join(", ")} }`);
525
+ }
526
+ if (lotsWhereConditions.length > 0) {
527
+ conditions.push(`lots: { ${lotsWhereConditions.join(", ")} }`);
511
528
  }
512
- if (!config.id_number && !config.ids?.length) {
529
+ if (!config.id_number && !config.ids?.length && !config.skipDateFilter) {
513
530
  conditions.push(config.betweenIssueDate
514
531
  ? `issue_date: { _gte: "${startDate}", _lte: "${endDate}" }`
515
532
  : `created_at: { _gte: "${startDate}", _lte: "${endDate}"}`);
@@ -575,6 +592,12 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
575
592
  booker_id
576
593
  agency_from_id
577
594
  agency_to_id
595
+ memo
596
+ voided
597
+ shipped
598
+ delivered
599
+ returned
600
+ created_at
578
601
  }
579
602
  }`
580
603
  : "";
@@ -614,8 +637,18 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
614
637
  exports.getPurchaseOrdersBetweenDatesStringQuery = getPurchaseOrdersBetweenDatesStringQuery;
615
638
  const getPayeesStringQuery = (filters) => {
616
639
  const conditions = [];
640
+ const idNumberConditions = [];
617
641
  if (filters?.id_number) {
618
- conditions.push(`id_number: { _ilike: "%${filters.id_number}%" }`);
642
+ idNumberConditions.push(`_ilike: "%${filters.id_number}%"`);
643
+ }
644
+ if (filters?.id_number_not_empty) {
645
+ idNumberConditions.push(`_neq: ""`);
646
+ }
647
+ if (filters?.id_number_not_null) {
648
+ idNumberConditions.push(`_is_null: false`);
649
+ }
650
+ if (idNumberConditions.length) {
651
+ conditions.push(`id_number: { ${idNumberConditions.join(", ")} }`);
619
652
  }
620
653
  if (filters?.name) {
621
654
  conditions.push(`name: { _ilike: "%${filters.name}%" }`);
@@ -626,6 +659,9 @@ const getPayeesStringQuery = (filters) => {
626
659
  if (filters?.tin) {
627
660
  conditions.push(`tin: { _eq: "${filters.tin}" }`);
628
661
  }
662
+ if (filters?.active !== undefined) {
663
+ conditions.push(`active: { _eq: ${filters.active} }`);
664
+ }
629
665
  const whereClause = conditions.length
630
666
  ? `where: { ${conditions.join(", ")} }`
631
667
  : "";
@@ -639,6 +675,7 @@ const getPayeesStringQuery = (filters) => {
639
675
  name
640
676
  tin
641
677
  vendor
678
+ active
642
679
  address_line_1
643
680
  payee_category_id
644
681
  payee_category {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "6.12.0",
3
+ "version": "6.14.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",
@@ -23,5 +23,5 @@
23
23
  "tsx": "^4.23.15",
24
24
  "typescript": "^5.1.6"
25
25
  },
26
- "gitHead": "c8dd0d32d207bb10ce9ab3f5be040bb3b2e482c1"
26
+ "gitHead": "dcb32bf5736b393e6164a49e3903909a4caf7363"
27
27
  }