@zauru-sdk/graphql 2.0.161 → 2.0.166

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.
@@ -23,6 +23,9 @@ export declare const getShipmentsStringQuery: ({ agency_to_id, agency_from_id, s
23
23
  }) => string;
24
24
  export declare const getLotsByNameStringQuery: (name: string, entity_id: number) => string;
25
25
  export declare const getLotStocksByAgencyIdStringQuery: (agency_id: number) => string;
26
+ export declare const getSerialsStringQuery: (filters: {
27
+ name?: string;
28
+ }) => string;
26
29
  export declare const getPurchaseOrdersBetweenDatesStringQuery: (startDate: string, endDate: string, config: {
27
30
  agencyId?: number | string;
28
31
  itemId?: number | string;
@@ -47,7 +50,12 @@ export declare const getPurchaseOrdersBetweenDatesStringQuery: (startDate: strin
47
50
  discount?: number;
48
51
  excludeVoided?: boolean;
49
52
  }) => string;
50
- export declare const getPayeesStringQuery = "\nquery getPayees {\n payees {\n id\n id_number\n name\n tin\n vendor\n address_line_1\n }\n}\n";
53
+ export declare const getPayeesStringQuery: (filters?: {
54
+ id_number?: string;
55
+ name?: string;
56
+ vendor?: boolean;
57
+ tin?: string;
58
+ }) => string;
51
59
  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";
52
60
  export declare const getAgenciesStringQuery = "\nquery getAgencies {\n agencies {\n id\n name\n address_line_2\n }\n}\n";
53
61
  export declare const getWebAppRowStringQuery: (id: number) => string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPrintTemplatesStringQuery = exports.getCasesByResponsibleIdStringQuery = exports.getInvoicesByAgencyIdStringQuery = exports.getPaymentTermByIdStringQuery = exports.getPaymentMethodsStringQuery = exports.getPaymentTermsStringQuery = exports.getSuggestedPricesStringQuery = exports.getCurrenciesStringQuery = exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = 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.getLotStocksByAgencyIdStringQuery = exports.getLotsByNameStringQuery = exports.getShipmentsStringQuery = exports.getPurchaseOrderStringQuery = exports.getPurchaseOrderByIdNumberStringQuery = exports.getLast100ReceptionsStringQuery = void 0;
3
+ exports.getPrintTemplatesStringQuery = exports.getCasesByResponsibleIdStringQuery = exports.getInvoicesByAgencyIdStringQuery = exports.getPaymentTermByIdStringQuery = exports.getPaymentMethodsStringQuery = exports.getPaymentTermsStringQuery = exports.getSuggestedPricesStringQuery = exports.getCurrenciesStringQuery = exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = 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
4
  const getLast100ReceptionsStringQuery = (agency_id) => `
5
5
  query getLast100Receptions {
6
6
  purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: ${agency_id}}}) {
@@ -289,6 +289,34 @@ query getLotStocksByAgencyId {
289
289
  }
290
290
  `;
291
291
  exports.getLotStocksByAgencyIdStringQuery = getLotStocksByAgencyIdStringQuery;
292
+ const getSerialsStringQuery = (filters) => {
293
+ const conditions = [];
294
+ if (filters.name) {
295
+ conditions.push(`name: {_ilike: "%${filters.name}%"}`);
296
+ }
297
+ const whereClause = conditions.length
298
+ ? `where: { ${conditions.join(", ")} }`
299
+ : "";
300
+ return `
301
+ query getSerials {
302
+ serials (
303
+ order_by: { id: desc },
304
+ ${whereClause}
305
+ ) {
306
+ id
307
+ id_number
308
+ name
309
+ description
310
+ item_id
311
+ entity_id
312
+ agency_id
313
+ agency_future_id
314
+ created_at
315
+ }
316
+ }
317
+ `;
318
+ };
319
+ exports.getSerialsStringQuery = getSerialsStringQuery;
292
320
  const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) => {
293
321
  const conditions = [];
294
322
  if (config.excludeVoided) {
@@ -438,18 +466,39 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
438
466
  `;
439
467
  };
440
468
  exports.getPurchaseOrdersBetweenDatesStringQuery = getPurchaseOrdersBetweenDatesStringQuery;
441
- exports.getPayeesStringQuery = `
442
- query getPayees {
443
- payees {
444
- id
445
- id_number
446
- name
447
- tin
448
- vendor
449
- address_line_1
469
+ const getPayeesStringQuery = (filters) => {
470
+ const conditions = [];
471
+ if (filters?.id_number) {
472
+ conditions.push(`id_number: { _ilike: "%${filters.id_number}%" }`);
450
473
  }
451
- }
452
- `;
474
+ if (filters?.name) {
475
+ conditions.push(`name: { _ilike: "%${filters.name}%" }`);
476
+ }
477
+ if (filters?.vendor !== undefined) {
478
+ conditions.push(`vendor: { _eq: ${filters.vendor} }`);
479
+ }
480
+ if (filters?.tin) {
481
+ conditions.push(`tin: { _eq: "${filters.tin}" }`);
482
+ }
483
+ const whereClause = conditions.length
484
+ ? `where: { ${conditions.join(", ")} }`
485
+ : "";
486
+ return `query getPayees {
487
+ payees (
488
+ order_by: { id: desc },
489
+ ${whereClause}
490
+ ) {
491
+ id
492
+ id_number
493
+ name
494
+ tin
495
+ vendor
496
+ address_line_1
497
+ }
498
+ }
499
+ `;
500
+ };
501
+ exports.getPayeesStringQuery = getPayeesStringQuery;
453
502
  exports.getProvidersStringQuery = `
454
503
  query getProviders {
455
504
  payees (where: {vendor: {_eq: true}}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "2.0.161",
3
+ "version": "2.0.166",
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": "c1fb36ef2266c186a766f9a5831a783b0f2fb0b3"
24
+ "gitHead": "39835f008adba7bc3f9d1ef997089a09c34ae322"
25
25
  }