@zauru-sdk/graphql 2.0.215 → 2.0.220

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.
@@ -69,7 +69,7 @@ export declare const getPayeesStringQuery: (filters?: {
69
69
  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";
70
70
  export declare const getAgenciesStringQuery = "\nquery getAgencies {\n agencies {\n id\n name\n address_line_2\n }\n}\n";
71
71
  export declare const getWebAppRowStringQuery: (id: number) => string;
72
- export declare const getWebAppRowsByWebAppTableIdStringQuery: (webapp_table_id: number) => string;
72
+ export declare const getWebAppRowsByWebAppTableIdStringQuery: (webapp_table_id: number, limit?: number) => string;
73
73
  export declare const getPayeeCategoryByIdStringQuery: (id: number) => string;
74
74
  export declare const getPayeeCategoriesByNotesMatchStringQuery: (match: string) => string;
75
75
  export declare const getPayeeCategoriesStringQuery = "\nquery getPayeeCategories {\n payee_categories {\n id\n name\n notes\n payees_count\n price_list_id\n }\n}\n";
@@ -383,7 +383,7 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
383
383
  if (config.poDetailTagId) {
384
384
  conditions.push(`purchase_order_details: { tag_id: { _eq: ${config.poDetailTagId} } }`);
385
385
  }
386
- if (!config.id_number) {
386
+ if (!config.id_number && !config.ids?.length) {
387
387
  conditions.push(config.betweenIssueDate
388
388
  ? `issue_date: { _gte: "${startDate}", _lte: "${endDate}" }`
389
389
  : `created_at: { _gte: "${startDate}", _lte: "${endDate}"}`);
@@ -543,24 +543,28 @@ query getWebAppRow {
543
543
  }
544
544
  `;
545
545
  exports.getWebAppRowStringQuery = getWebAppRowStringQuery;
546
- const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id) => `
547
- query getWebAppRowsByWebAppTableId {
548
- webapp_rows (
549
- where: {
550
- webapp_table_id: {
551
- _eq: ${webapp_table_id}
546
+ const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id, limit) => {
547
+ const conditions = [];
548
+ if (webapp_table_id) {
549
+ conditions.push(`webapp_table_id: {_eq: ${webapp_table_id}}`);
550
+ }
551
+ const whereClause = conditions.length
552
+ ? `where: { ${conditions.join(", ")} }`
553
+ : "";
554
+ const limitClause = limit ? `limit: ${limit}` : "";
555
+ const orderByClause = `order_by: { id: desc }`;
556
+ return `
557
+ query getWebAppRowsByWebAppTableId {
558
+ webapp_rows (${[whereClause, orderByClause, limitClause]
559
+ .filter(Boolean)
560
+ .join(", ")}) {
561
+ id
562
+ data
563
+ created_at
552
564
  }
553
- },
554
- order_by: {
555
- id: desc
556
565
  }
557
- ) {
558
- id
559
- data
560
- created_at
561
- }
562
- }
563
566
  `;
567
+ };
564
568
  exports.getWebAppRowsByWebAppTableIdStringQuery = getWebAppRowsByWebAppTableIdStringQuery;
565
569
  const getPayeeCategoryByIdStringQuery = (id) => `
566
570
  query getPayeeCategoryById {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "2.0.215",
3
+ "version": "2.0.220",
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": "de66fec20d71561f11b35a0113838db838db6b56"
24
+ "gitHead": "c8ca154d7c11e35c916f2e7f7bfc27f5ba2c14f1"
25
25
  }