@zauru-sdk/graphql 1.0.89 → 1.0.90

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.
@@ -21,6 +21,8 @@ export declare const getPurchaseOrdersBetweenDatesStringQuery: (config: {
21
21
  withLots?: boolean;
22
22
  withShipmentPurchaseOrders?: boolean;
23
23
  withWebAppRows?: boolean;
24
+ payeeCategoryIds?: number[];
25
+ excludePayeeCategoryIds?: number[];
24
26
  }) => string;
25
27
  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";
26
28
  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";
@@ -239,6 +239,13 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
239
239
  ? "issue_date: { _gte: $startDate, _lte: $endDate }"
240
240
  : "created_at: { _gte: $startDate, _lte: $endDate }");
241
241
  }
242
+ if (config.payeeCategoryIds && config.payeeCategoryIds.length > 0) {
243
+ conditions.push(`payee: { payee_category: { id: { _in: ${config.payeeCategoryIds} } } }`);
244
+ }
245
+ if (config.excludePayeeCategoryIds &&
246
+ config.excludePayeeCategoryIds.length > 0) {
247
+ conditions.push(`payee: { payee_category: { id: { _nin: ${config.excludePayeeCategoryIds} } } }`);
248
+ }
242
249
  const whereClause = conditions.length
243
250
  ? `where: { ${conditions.join(", ")} }`
244
251
  : "";
@@ -259,6 +266,46 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
259
266
  }
260
267
  `
261
268
  : "";
269
+ const purchaseOrderDetails = config.withPODetails
270
+ ? `purchase_order_details {
271
+ item_id
272
+ id
273
+ reference
274
+ booked_quantity
275
+ delivered_quantity
276
+ }`
277
+ : "";
278
+ const lots = config.withLots
279
+ ? `lots {
280
+ id
281
+ name
282
+ description
283
+ ${lotStocksFragment}
284
+ }`
285
+ : "";
286
+ const webAppRows = config.withWebAppRows
287
+ ? `webapp_table_rowables {
288
+ webapp_rows {
289
+ data
290
+ }
291
+ }`
292
+ : "";
293
+ const shipmentPurchase = config.withShipmentPurchaseOrders
294
+ ? `shipment_purchase_orders {
295
+ shipment {
296
+ id
297
+ zid
298
+ id_number
299
+ reference
300
+ needs_transport
301
+ payee_id
302
+ income
303
+ booker_id
304
+ agency_from_id
305
+ agency_to_id
306
+ }
307
+ }`
308
+ : "";
262
309
  return `
263
310
  query getPurchaseOrdersBetweenDates ${dateVariables} {
264
311
  purchase_orders (
@@ -276,46 +323,10 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
276
323
  discount
277
324
  other_charges
278
325
  consolidate_id
279
- ${config.withPODetails
280
- ? `purchase_order_details {
281
- item_id
282
- id
283
- reference
284
- booked_quantity
285
- delivered_quantity
286
- }`
287
- : ""}
288
- ${config.withLots
289
- ? `lots {
290
- id
291
- name
292
- description
293
- ${lotStocksFragment}
294
- }`
295
- : ""}
296
- ${config.withWebAppRows
297
- ? `webapp_table_rowables {
298
- webapp_rows {
299
- data
300
- }
301
- }`
302
- : ""}
303
- ${config.withShipmentPurchaseOrders
304
- ? `shipment_purchase_orders {
305
- shipment {
306
- id
307
- zid
308
- id_number
309
- reference
310
- needs_transport
311
- payee_id
312
- income
313
- booker_id
314
- agency_from_id
315
- agency_to_id
316
- }
317
- }`
318
- : ""}
326
+ ${purchaseOrderDetails}
327
+ ${lots}
328
+ ${webAppRows}
329
+ ${shipmentPurchase}
319
330
  }
320
331
  }
321
332
  `;
@@ -239,6 +239,13 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
239
239
  ? "issue_date: { _gte: $startDate, _lte: $endDate }"
240
240
  : "created_at: { _gte: $startDate, _lte: $endDate }");
241
241
  }
242
+ if (config.payeeCategoryIds && config.payeeCategoryIds.length > 0) {
243
+ conditions.push(`payee: { payee_category: { id: { _in: ${config.payeeCategoryIds} } } }`);
244
+ }
245
+ if (config.excludePayeeCategoryIds &&
246
+ config.excludePayeeCategoryIds.length > 0) {
247
+ conditions.push(`payee: { payee_category: { id: { _nin: ${config.excludePayeeCategoryIds} } } }`);
248
+ }
242
249
  const whereClause = conditions.length
243
250
  ? `where: { ${conditions.join(", ")} }`
244
251
  : "";
@@ -259,6 +266,46 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
259
266
  }
260
267
  `
261
268
  : "";
269
+ const purchaseOrderDetails = config.withPODetails
270
+ ? `purchase_order_details {
271
+ item_id
272
+ id
273
+ reference
274
+ booked_quantity
275
+ delivered_quantity
276
+ }`
277
+ : "";
278
+ const lots = config.withLots
279
+ ? `lots {
280
+ id
281
+ name
282
+ description
283
+ ${lotStocksFragment}
284
+ }`
285
+ : "";
286
+ const webAppRows = config.withWebAppRows
287
+ ? `webapp_table_rowables {
288
+ webapp_rows {
289
+ data
290
+ }
291
+ }`
292
+ : "";
293
+ const shipmentPurchase = config.withShipmentPurchaseOrders
294
+ ? `shipment_purchase_orders {
295
+ shipment {
296
+ id
297
+ zid
298
+ id_number
299
+ reference
300
+ needs_transport
301
+ payee_id
302
+ income
303
+ booker_id
304
+ agency_from_id
305
+ agency_to_id
306
+ }
307
+ }`
308
+ : "";
262
309
  return `
263
310
  query getPurchaseOrdersBetweenDates ${dateVariables} {
264
311
  purchase_orders (
@@ -276,46 +323,10 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
276
323
  discount
277
324
  other_charges
278
325
  consolidate_id
279
- ${config.withPODetails
280
- ? `purchase_order_details {
281
- item_id
282
- id
283
- reference
284
- booked_quantity
285
- delivered_quantity
286
- }`
287
- : ""}
288
- ${config.withLots
289
- ? `lots {
290
- id
291
- name
292
- description
293
- ${lotStocksFragment}
294
- }`
295
- : ""}
296
- ${config.withWebAppRows
297
- ? `webapp_table_rowables {
298
- webapp_rows {
299
- data
300
- }
301
- }`
302
- : ""}
303
- ${config.withShipmentPurchaseOrders
304
- ? `shipment_purchase_orders {
305
- shipment {
306
- id
307
- zid
308
- id_number
309
- reference
310
- needs_transport
311
- payee_id
312
- income
313
- booker_id
314
- agency_from_id
315
- agency_to_id
316
- }
317
- }`
318
- : ""}
326
+ ${purchaseOrderDetails}
327
+ ${lots}
328
+ ${webAppRows}
329
+ ${shipmentPurchase}
319
330
  }
320
331
  }
321
332
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "1.0.89",
3
+ "version": "1.0.90",
4
4
  "description": "Queries de uso común para las aplicación de Zauru.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -22,5 +22,5 @@
22
22
  "devDependencies": {
23
23
  "typescript": "^5.1.6"
24
24
  },
25
- "gitHead": "289145b578d297a2247e5017c894d3a2e1fd6629"
25
+ "gitHead": "478ab8b28cd8758f4048969c94f6b8962a1751c7"
26
26
  }