@zauru-sdk/graphql 6.4.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) {
@@ -331,6 +332,42 @@ const getShipmentsStringQuery = ({ agency_to_id, agency_from_id, suffix, voided,
331
332
  }`;
332
333
  };
333
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;
334
371
  const getLotsByNameStringQuery = (name, entity_id) => `
335
372
  query getLots {
336
373
  lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: ${entity_id}}, name: {_eq: "${name}"}}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "6.4.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": "65139162e998fda40e90035321542c4b881d2aed"
25
+ "gitHead": "4df5f4a0b8160018e6047ed2afdd284c2ea0c8a6"
26
26
  }