cardus 0.0.57 → 0.0.60

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
@@ -83,7 +83,7 @@ class IntegrationManager {
83
83
  this.getAgencyIdForTempShipment = params.getAgencyIdForTempShipment;
84
84
  }
85
85
  insertTempShipments(_a) {
86
- return __awaiter(this, arguments, void 0, function* ({ payload: { idUsuario, agencyId, addressId, warehouseId, group }, fetchAllOrders, crearBulto, modificarOrdenOriginal }) {
86
+ return __awaiter(this, arguments, void 0, function* ({ payload: { idUsuario, agencyId, addressId, warehouseId, group, sequentialInsertion = false }, fetchAllOrders, crearBulto, modificarOrdenOriginal }) {
87
87
  const user = yield this.services.usersService.obtenerUsuarioId(idUsuario);
88
88
  const { integrationsService, addressesService } = this.services;
89
89
  // esto hay que pasarlo ya en los parametros
@@ -134,7 +134,7 @@ class IntegrationManager {
134
134
  return Object.assign(parsedOrder, { idEnvioTemporal, agencyId });
135
135
  }),
136
136
  regularExecutionTime: 8000, // ms
137
- initialBatchQuantity: 5 // de cinco en cinco
137
+ initialBatchQuantity: sequentialInsertion ? 1 : 5 // si la insercion no es secuencial, de cinco en cinco
138
138
  }).upload();
139
139
  const successfullShipments = insertOrdersResult
140
140
  .filter(Boolean)
@@ -177,7 +177,11 @@ class IntegrationManager {
177
177
  integrationsService.insertTempShipmentMultipleContents(this.dataToInsert.contents),
178
178
  integrationsService.insertTempShipmentMultipleExternals(this.dataToInsert.externals)
179
179
  ]);
180
- return { filteredOrders, insertedTempShipments: successfullShipments };
180
+ return {
181
+ filteredOrders,
182
+ insertedTempShipments: successfullShipments,
183
+ sequentialInsertion
184
+ };
181
185
  });
182
186
  }
183
187
  insertUserDefaultConfigurationContent(_a) {
@@ -199,7 +203,7 @@ class IntegrationManager {
199
203
  const userFakeData = configurationService.getFakeDefaultProformaConfiguration(idUsuario, user.dni);
200
204
  userConfiguration = userFakeData;
201
205
  }
202
- if (userConfiguration && userConfiguration !== null) {
206
+ if (userConfiguration) {
203
207
  tempShimpmentIds.forEach((tempShimpmentId) => {
204
208
  if (userConfiguration) {
205
209
  insert(userConfiguration, tempShimpmentId);
@@ -109,6 +109,9 @@ const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ or
109
109
  const setReferenciaCliente = (order) => ({
110
110
  referencia_cliente: order.referenciaCliente || null
111
111
  });
112
+ const setDatosAdicionales = (order) => ({
113
+ datos_adicionales: order.etiquetaExtraInfo || null
114
+ });
112
115
  const setters = [
113
116
  setDatosVendedor,
114
117
  setDatosComprador,
@@ -116,7 +119,8 @@ const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ or
116
119
  setReembolso,
117
120
  setFechas,
118
121
  setBultos,
119
- setReferenciaCliente
122
+ setReferenciaCliente,
123
+ setDatosAdicionales
120
124
  ];
121
125
  const dataInsert = (yield setters.reduce((acc, curr) => __awaiter(void 0, void 0, void 0, function* () {
122
126
  const accumulated = yield acc;
package/index.ts CHANGED
@@ -88,7 +88,14 @@ export class IntegrationManager {
88
88
  }
89
89
 
90
90
  async insertTempShipments({
91
- payload: { idUsuario, agencyId, addressId, warehouseId, group },
91
+ payload: {
92
+ idUsuario,
93
+ agencyId,
94
+ addressId,
95
+ warehouseId,
96
+ group,
97
+ sequentialInsertion = false
98
+ },
92
99
  fetchAllOrders,
93
100
  crearBulto,
94
101
  modificarOrdenOriginal
@@ -161,7 +168,7 @@ export class IntegrationManager {
161
168
  return Object.assign(parsedOrder, { idEnvioTemporal, agencyId });
162
169
  },
163
170
  regularExecutionTime: 8000, // ms
164
- initialBatchQuantity: 5 // de cinco en cinco
171
+ initialBatchQuantity: sequentialInsertion ? 1 : 5 // si la insercion no es secuencial, de cinco en cinco
165
172
  }).upload();
166
173
 
167
174
  const successfullShipments = insertOrdersResult
@@ -229,7 +236,11 @@ export class IntegrationManager {
229
236
  )
230
237
  ]);
231
238
 
232
- return { filteredOrders, insertedTempShipments: successfullShipments };
239
+ return {
240
+ filteredOrders,
241
+ insertedTempShipments: successfullShipments,
242
+ sequentialInsertion
243
+ };
233
244
  }
234
245
 
235
246
  async insertUserDefaultConfigurationContent({
@@ -268,7 +279,7 @@ export class IntegrationManager {
268
279
  );
269
280
  userConfiguration = userFakeData;
270
281
  }
271
- if (userConfiguration && userConfiguration !== null) {
282
+ if (userConfiguration) {
272
283
  tempShimpmentIds.forEach((tempShimpmentId) => {
273
284
  if (userConfiguration) {
274
285
  insert(userConfiguration, tempShimpmentId);
@@ -158,6 +158,10 @@ export const cookTempShipment = async ({
158
158
  referencia_cliente: order.referenciaCliente || null
159
159
  });
160
160
 
161
+ const setDatosAdicionales = (order: ModifiedOrder) => ({
162
+ datos_adicionales: order.etiquetaExtraInfo || null
163
+ });
164
+
161
165
  const setters = [
162
166
  setDatosVendedor,
163
167
  setDatosComprador,
@@ -165,7 +169,8 @@ export const cookTempShipment = async ({
165
169
  setReembolso,
166
170
  setFechas,
167
171
  setBultos,
168
- setReferenciaCliente
172
+ setReferenciaCliente,
173
+ setDatosAdicionales
169
174
  ];
170
175
 
171
176
  const dataInsert = (await setters.reduce(async (acc, curr) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.57",
3
+ "version": "0.0.60",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/types/index.ts CHANGED
@@ -119,6 +119,7 @@ export type ModifiedOrder = {
119
119
  idCarrier?: number | null;
120
120
  agenciaEnvioIntegracion: string | null;
121
121
  referenciaCliente?: string;
122
+ etiquetaExtraInfo?: string;
122
123
  };
123
124
 
124
125
  export interface ModifiedOrderExtended extends ModifiedOrder {
@@ -157,6 +158,7 @@ export interface InsertParams {
157
158
  addressId: number;
158
159
  warehouseId: number;
159
160
  group: Group;
161
+ sequentialInsertion?: boolean;
160
162
  };
161
163
  fetchAllOrders: FetchAllOrders;
162
164
  crearBulto: CrearBulto;