@zauru-sdk/graphql 1.0.83 → 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.
@@ -6,7 +6,7 @@ export declare const getPurchaseOrderStringQuery: (config?: {
6
6
  export declare const getShipmentsByToAgencyLast100StringQuery = "\nquery getShipmentsByToAgencyLast100(\n $agency_to_id: Int\n ){\n shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: $agency_to_id}}) {\n id\n zid\n id_number\n reference\n needs_transport\n payee_id\n income\n booker_id\n agency_from_id\n agency_to_id\n transporter_id\n created_at\n movements {\n id\n booked_quantity\n delivered_quantity\n reference\n lot {\n id\n name\n description\n }\n }\n }\n }\n";
7
7
  export declare const getLotsByNameStringQuery = "\nquery getLots($name: String, $entity_id: Int){\n lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: $entity_id}, name: {_eq: $name}}) {\n id\n name\n description\n }\n}\n";
8
8
  export declare const getLotStocksByAgencyIdStringQuery = "\nquery getLotStocksByAgencyId($agency_id: Int){\n lot_stocks (\n order_by: { id: desc },\n where: { agency_id: { _eq: $agency_id }}\n ){\n id\n available\n lot_id\n lot {\n id\n item_id\n expires\n }\n }\n}\n";
9
- export declare const getPurchaseOrdersBetweenDatesStringQuery: (config?: {
9
+ export declare const getPurchaseOrdersBetweenDatesStringQuery: (config: {
10
10
  agencyId?: number | string;
11
11
  itemId?: number | string;
12
12
  payeeCategoryId?: number | string;
@@ -17,6 +17,12 @@ export declare const getPurchaseOrdersBetweenDatesStringQuery: (config?: {
17
17
  withLotStocks?: boolean;
18
18
  betweenIssueDate?: boolean;
19
19
  id_number?: string;
20
+ withPODetails?: boolean;
21
+ withLots?: boolean;
22
+ withShipmentPurchaseOrders?: boolean;
23
+ withWebAppRows?: boolean;
24
+ payeeCategoryIds?: number[];
25
+ excludePayeeCategoryIds?: number[];
20
26
  }) => string;
21
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";
22
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";
@@ -204,11 +204,7 @@ query getLotStocksByAgencyId($agency_id: Int){
204
204
  }
205
205
  }
206
206
  `;
207
- const getPurchaseOrdersBetweenDatesStringQuery = (config = {
208
- consolidateIdFilter: false,
209
- withLotStocks: false,
210
- betweenIssueDate: false,
211
- }) => {
207
+ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
212
208
  const conditions = [];
213
209
  if (config.agencyId) {
214
210
  conditions.push(`agency_id: { _eq: ${config.agencyId} }`);
@@ -243,6 +239,13 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config = {
243
239
  ? "issue_date: { _gte: $startDate, _lte: $endDate }"
244
240
  : "created_at: { _gte: $startDate, _lte: $endDate }");
245
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
+ }
246
249
  const whereClause = conditions.length
247
250
  ? `where: { ${conditions.join(", ")} }`
248
251
  : "";
@@ -263,6 +266,46 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config = {
263
266
  }
264
267
  `
265
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
+ : "";
266
309
  return `
267
310
  query getPurchaseOrdersBetweenDates ${dateVariables} {
268
311
  purchase_orders (
@@ -280,38 +323,10 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config = {
280
323
  discount
281
324
  other_charges
282
325
  consolidate_id
283
- purchase_order_details {
284
- item_id
285
- id
286
- reference
287
- booked_quantity
288
- delivered_quantity
289
- }
290
- lots(where: { active: { _eq: true } }) {
291
- id
292
- name
293
- description
294
- ${lotStocksFragment}
295
- }
296
- webapp_table_rowables {
297
- webapp_rows {
298
- data
299
- }
300
- }
301
- shipment_purchase_orders {
302
- shipment {
303
- id
304
- zid
305
- id_number
306
- reference
307
- needs_transport
308
- payee_id
309
- income
310
- booker_id
311
- agency_from_id
312
- agency_to_id
313
- }
314
- }
326
+ ${purchaseOrderDetails}
327
+ ${lots}
328
+ ${webAppRows}
329
+ ${shipmentPurchase}
315
330
  }
316
331
  }
317
332
  `;
@@ -204,11 +204,7 @@ query getLotStocksByAgencyId($agency_id: Int){
204
204
  }
205
205
  }
206
206
  `;
207
- const getPurchaseOrdersBetweenDatesStringQuery = (config = {
208
- consolidateIdFilter: false,
209
- withLotStocks: false,
210
- betweenIssueDate: false,
211
- }) => {
207
+ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
212
208
  const conditions = [];
213
209
  if (config.agencyId) {
214
210
  conditions.push(`agency_id: { _eq: ${config.agencyId} }`);
@@ -243,6 +239,13 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config = {
243
239
  ? "issue_date: { _gte: $startDate, _lte: $endDate }"
244
240
  : "created_at: { _gte: $startDate, _lte: $endDate }");
245
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
+ }
246
249
  const whereClause = conditions.length
247
250
  ? `where: { ${conditions.join(", ")} }`
248
251
  : "";
@@ -263,6 +266,46 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config = {
263
266
  }
264
267
  `
265
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
+ : "";
266
309
  return `
267
310
  query getPurchaseOrdersBetweenDates ${dateVariables} {
268
311
  purchase_orders (
@@ -280,38 +323,10 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config = {
280
323
  discount
281
324
  other_charges
282
325
  consolidate_id
283
- purchase_order_details {
284
- item_id
285
- id
286
- reference
287
- booked_quantity
288
- delivered_quantity
289
- }
290
- lots(where: { active: { _eq: true } }) {
291
- id
292
- name
293
- description
294
- ${lotStocksFragment}
295
- }
296
- webapp_table_rowables {
297
- webapp_rows {
298
- data
299
- }
300
- }
301
- shipment_purchase_orders {
302
- shipment {
303
- id
304
- zid
305
- id_number
306
- reference
307
- needs_transport
308
- payee_id
309
- income
310
- booker_id
311
- agency_from_id
312
- agency_to_id
313
- }
314
- }
326
+ ${purchaseOrderDetails}
327
+ ${lots}
328
+ ${webAppRows}
329
+ ${shipmentPurchase}
315
330
  }
316
331
  }
317
332
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "1.0.83",
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": "ee7c5a89327913cc2cb8755e215014e236e8799d"
25
+ "gitHead": "478ab8b28cd8758f4048969c94f6b8962a1751c7"
26
26
  }