cardus 0.0.42 → 0.0.43

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.
package/dist/index.js CHANGED
@@ -204,13 +204,15 @@ class IntegrationManager {
204
204
  insertQuantityRelatedLines(_a) {
205
205
  return __awaiter(this, arguments, void 0, function* ({ orders, idUsuario, crearBulto, estaAgrupado }) {
206
206
  const createBultoFromLine = (_b) => __awaiter(this, [_b], void 0, function* ({ line, idEnvioTemporal }) {
207
- const { bulto, cantidad = 0 } = yield crearBulto({
207
+ const result = yield crearBulto({
208
208
  lineItems: { idEnvioTemporal, line },
209
209
  idUsuario
210
210
  });
211
- if (cantidad === 0)
212
- return null;
213
- return { bulto, cantidad, idEnvioTemporal };
211
+ const { bulto, cantidad } = result;
212
+ if (cantidad && bulto) {
213
+ return { bulto, cantidad, idEnvioTemporal };
214
+ }
215
+ return null;
214
216
  });
215
217
  const obtenerBultosYCantidades = [];
216
218
  orders.forEach(({ idEnvioTemporal, lineas }) => {
package/index.ts CHANGED
@@ -376,12 +376,16 @@ export class IntegrationManager {
376
376
  line: InsertContentShipmentLine;
377
377
  idEnvioTemporal: number;
378
378
  }): Promise<BultoYCantidad | null> => {
379
- const { bulto, cantidad = 0 } = await crearBulto({
379
+ const result = await crearBulto({
380
380
  lineItems: { idEnvioTemporal, line },
381
381
  idUsuario
382
382
  });
383
- if (cantidad === 0) return null;
384
- return { bulto, cantidad, idEnvioTemporal };
383
+ const { bulto, cantidad } = result;
384
+
385
+ if (cantidad && bulto) {
386
+ return { bulto, cantidad, idEnvioTemporal };
387
+ }
388
+ return null;
385
389
  };
386
390
 
387
391
  const obtenerBultosYCantidades: Array<Promise<BultoYCantidad | null>> = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/types/index.ts CHANGED
@@ -108,7 +108,7 @@ type FetchAllOrders = () => Promise<OriginalOrder[]>;
108
108
  export type CrearBulto = (params: {
109
109
  lineItems: { idEnvioTemporal: number; line: AnyObject };
110
110
  idUsuario: number;
111
- }) => Promise<Bulto>;
111
+ }) => Promise<Bulto | { bulto: null; cantidad: 0 }>;
112
112
 
113
113
  type ModificarOrdenOriginal = (param: {
114
114
  originalOrder: OriginalOrder;