@zauru-sdk/graphql 6.3.0 → 6.5.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.
@@ -31,6 +31,13 @@ export declare const getShipmentsStringQuery: ({ agency_to_id, agency_from_id, s
31
31
  endDate: string;
32
32
  };
33
33
  }) => string;
34
+ /**
35
+ * Lightweight lookup of a shipment already linked to a purchase order
36
+ * by reference. Used to reuse an existing booking instead of creating
37
+ * a duplicate when a previous attempt persisted the shipment but not
38
+ * the local apiCall.
39
+ */
40
+ export declare const getBookingByPurchaseOrderAndReferenceStringQuery: (purchaseOrderId: number | string, reference: string) => string;
34
41
  export declare const getLotsByNameStringQuery: (name: string, entity_id: number) => string;
35
42
  export declare const getLotStocksByAgencyIdStringQuery: (agency_id: number) => string;
36
43
  export declare const getSerialsStringQuery: (filters: {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProductionWorkOrderStringQuery = exports.getPrintTemplatesStringQuery = exports.getCasesStringQuery = exports.getInvoicesByAgencyIdStringQuery = 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.getShipmentsStringQuery = exports.getPurchaseOrderStringQuery = exports.getPurchaseOrderByIdNumberStringQuery = exports.getLast100ReceptionsStringQuery = void 0;
3
+ exports.getPrintTemplatesStringQuery = exports.getCasesStringQuery = exports.getInvoicesByAgencyIdStringQuery = 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 = void 0;
4
5
  const getLast100ReceptionsStringQuery = (agency_id) => {
5
6
  const conditions = ["voided: {_eq: false}"];
6
7
  if (agency_id) {
@@ -37,6 +38,7 @@ const getLast100ReceptionsStringQuery = (agency_id) => {
37
38
  reference
38
39
  booked_quantity
39
40
  delivered_quantity
41
+ unit_cost
40
42
  }
41
43
  lots(where: {active: {_eq: true}}) {
42
44
  id
@@ -80,6 +82,7 @@ query getPurchaseOrderByIdNumber {
80
82
  reference
81
83
  booked_quantity
82
84
  delivered_quantity
85
+ unit_cost
83
86
  }
84
87
  lots(where: {active: {_eq: true}}) {
85
88
  id
@@ -180,6 +183,7 @@ query getPurchaseOrder($id: bigint) @cached {
180
183
  reference
181
184
  booked_quantity
182
185
  delivered_quantity
186
+ unit_cost
183
187
  item {
184
188
  name
185
189
  stocks_only_integer
@@ -278,6 +282,7 @@ const getShipmentsStringQuery = ({ agency_to_id, agency_from_id, suffix, voided,
278
282
  reference
279
283
  booked_quantity
280
284
  delivered_quantity
285
+ unit_cost
281
286
  }
282
287
  }`
283
288
  : "";
@@ -327,6 +332,42 @@ const getShipmentsStringQuery = ({ agency_to_id, agency_from_id, suffix, voided,
327
332
  }`;
328
333
  };
329
334
  exports.getShipmentsStringQuery = getShipmentsStringQuery;
335
+ /**
336
+ * Lightweight lookup of a shipment already linked to a purchase order
337
+ * by reference. Used to reuse an existing booking instead of creating
338
+ * a duplicate when a previous attempt persisted the shipment but not
339
+ * the local apiCall.
340
+ */
341
+ const getBookingByPurchaseOrderAndReferenceStringQuery = (purchaseOrderId, reference) => {
342
+ const escapedReference = String(reference)
343
+ .replace(/\\/g, "\\\\")
344
+ .replace(/"/g, '\\"');
345
+ return `
346
+ query getBookingByPurchaseOrderAndReference {
347
+ purchase_orders(where: {id: {_eq: ${Number(purchaseOrderId)}}}) {
348
+ shipment_purchase_orders(
349
+ where: {
350
+ shipment: {
351
+ reference: { _eq: "${escapedReference}" }
352
+ voided: { _eq: false }
353
+ returned: { _eq: false }
354
+ }
355
+ }
356
+ limit: 1
357
+ ) {
358
+ shipment {
359
+ id
360
+ reference
361
+ delivered
362
+ voided
363
+ returned
364
+ }
365
+ }
366
+ }
367
+ }
368
+ `;
369
+ };
370
+ exports.getBookingByPurchaseOrderAndReferenceStringQuery = getBookingByPurchaseOrderAndReferenceStringQuery;
330
371
  const getLotsByNameStringQuery = (name, entity_id) => `
331
372
  query getLots {
332
373
  lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: ${entity_id}}, name: {_eq: "${name}"}}) {
@@ -497,6 +538,7 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
497
538
  reference
498
539
  booked_quantity
499
540
  delivered_quantity
541
+ unit_cost
500
542
  }`
501
543
  : "";
502
544
  const lots = config.withLots
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "6.3.0",
3
+ "version": "6.5.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",
@@ -22,5 +22,5 @@
22
22
  "devDependencies": {
23
23
  "typescript": "^5.1.6"
24
24
  },
25
- "gitHead": "0b76f82d8d5169437231694b666c29ce50a37a77"
25
+ "gitHead": "4df5f4a0b8160018e6047ed2afdd284c2ea0c8a6"
26
26
  }