@zauru-sdk/graphql 6.13.0 → 6.15.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;
@@ -116,6 +120,7 @@ export type GetInvoicesOptions = {
116
120
  lastId?: number;
117
121
  limit?: number;
118
122
  };
123
+ export declare const getWebAppTableByIdStringQuery: (id: number) => string;
119
124
  export declare const getWebAppRowsByWebAppTableIdStringQuery: (webapp_table_id: number, options?: GetWebAppRowsByTableIdOptions) => string;
120
125
  export declare const getPayeeCategoryByIdStringQuery: (id: number) => string;
121
126
  export declare const getPayeeCategoriesByNotesMatchStringQuery: (match: string) => string;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInvoicesByAgencyIdStringQuery = exports.getInvoicesStringQuery = exports.getPaymentByIdStringQuery = 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.getBookingByPurchaseOrderAndReferenceStringQuery = exports.getShipmentsStringQuery = exports.getPurchaseOrderStringQuery = exports.getPurchaseOrderByIdNumberStringQuery = exports.getLast100ReceptionsStringQuery = void 0;
4
- exports.getProductionWorkOrderStringQuery = exports.getPrintTemplatesStringQuery = exports.getCasesStringQuery = void 0;
3
+ exports.getInvoicesStringQuery = exports.getPaymentByIdStringQuery = 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.getWebAppTableByIdStringQuery = exports.getWebAppRowStringQuery = exports.getAgenciesStringQuery = exports.getProvidersStringQuery = exports.getPayeesStringQuery = exports.getPurchaseOrdersBetweenDatesStringQuery = exports.getSerialsStringQuery = exports.getLotStocksByAgencyIdStringQuery = exports.getLotsByNameStringQuery = exports.getBookingByPurchaseOrderAndReferenceStringQuery = exports.getShipmentsStringQuery = exports.getPurchaseOrderStringQuery = exports.getPurchaseOrderByIdNumberStringQuery = exports.getLast100ReceptionsStringQuery = void 0;
4
+ exports.getProductionWorkOrderStringQuery = exports.getPrintTemplatesStringQuery = exports.getCasesStringQuery = exports.getInvoicesByAgencyIdStringQuery = void 0;
5
5
  const getLast100ReceptionsStringQuery = (agency_id) => {
6
6
  const conditions = ["voided: {_eq: false}"];
7
7
  if (agency_id) {
@@ -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} }`);
511
522
  }
512
- if (!config.id_number && !config.ids?.length) {
523
+ if (lotStockConditions.length > 0) {
524
+ lotsWhereConditions.push(`lot_stocks: { ${lotStockConditions.join(", ")} }`);
525
+ }
526
+ if (lotsWhereConditions.length > 0) {
527
+ conditions.push(`lots: { ${lotsWhereConditions.join(", ")} }`);
528
+ }
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
  : "";
@@ -791,6 +814,25 @@ const requirePositiveInt = (value, label) => {
791
814
  }
792
815
  return n;
793
816
  };
817
+ const getWebAppTableByIdStringQuery = (id) => {
818
+ const tableId = requirePositiveInt(id, "webapp table id");
819
+ return `
820
+ query getWebAppTableById {
821
+ webapp_tables(where: {id: {_eq: ${tableId}}}) {
822
+ id
823
+ zid
824
+ entity_id
825
+ name
826
+ structure
827
+ creator_id
828
+ updater_id
829
+ created_at
830
+ updated_at
831
+ }
832
+ }
833
+ `;
834
+ };
835
+ exports.getWebAppTableByIdStringQuery = getWebAppTableByIdStringQuery;
794
836
  const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id, options) => {
795
837
  const { limit, data, createdAt, idLt } = options ?? {};
796
838
  const tableId = Number(webapp_table_id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "6.13.0",
3
+ "version": "6.15.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": "a2e3412dde7cdfd7f33ebc6c5b90b022ab24ae27"
26
+ "gitHead": "0d200efdc7dca9e32d4d9357fe416b48c6ebd777"
27
27
  }