cardus 0.0.56 → 0.0.57

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.
Files changed (3) hide show
  1. package/dist/index.js +9 -7
  2. package/index.ts +37 -34
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -151,7 +151,7 @@ class IntegrationManager {
151
151
  tempShimpmentIds: successfullShipments.map((successfullShipment) => successfullShipment.idEnvioTemporal)
152
152
  });
153
153
  // modificamos la agencia, cuando se tenga que hacer
154
- successfullShipments.forEach((order) => __awaiter(this, void 0, void 0, function* () {
154
+ yield Promise.allSettled(successfullShipments.map((order) => __awaiter(this, void 0, void 0, function* () {
155
155
  const shipmentDetails = this.dataToInsert.details.filter(({ id_envio }) => {
156
156
  return id_envio === order.idEnvioTemporal;
157
157
  });
@@ -164,17 +164,19 @@ class IntegrationManager {
164
164
  shipmentDetails
165
165
  });
166
166
  if (newAgencyId !== order.agencyId) {
167
- integrationsService.updateTempShimpment({
167
+ yield integrationsService.updateTempShimpment({
168
168
  id_envio: order.idEnvioTemporal,
169
169
  id_usuario: idUsuario,
170
170
  id_agencia: newAgencyId
171
171
  });
172
172
  }
173
- }));
174
- integrationsService.insertTempShipmentMultipleLines(this.dataToInsert.lines);
175
- integrationsService.insertTempShipmentMultipleDetails(this.dataToInsert.details);
176
- integrationsService.insertTempShipmentMultipleContents(this.dataToInsert.contents);
177
- integrationsService.insertTempShipmentMultipleExternals(this.dataToInsert.externals);
173
+ })));
174
+ yield Promise.allSettled([
175
+ integrationsService.insertTempShipmentMultipleLines(this.dataToInsert.lines),
176
+ integrationsService.insertTempShipmentMultipleDetails(this.dataToInsert.details),
177
+ integrationsService.insertTempShipmentMultipleContents(this.dataToInsert.contents),
178
+ integrationsService.insertTempShipmentMultipleExternals(this.dataToInsert.externals)
179
+ ]);
178
180
  return { filteredOrders, insertedTempShipments: successfullShipments };
179
181
  });
180
182
  }
package/index.ts CHANGED
@@ -187,45 +187,48 @@ export class IntegrationManager {
187
187
  });
188
188
 
189
189
  // modificamos la agencia, cuando se tenga que hacer
190
+ await Promise.allSettled(
191
+ successfullShipments.map(async (order) => {
192
+ const shipmentDetails = this.dataToInsert.details.filter(
193
+ ({ id_envio }) => {
194
+ return id_envio === order.idEnvioTemporal;
195
+ }
196
+ );
190
197
 
191
- successfullShipments.forEach(async (order) => {
192
- const shipmentDetails = this.dataToInsert.details.filter(
193
- ({ id_envio }) => {
194
- return id_envio === order.idEnvioTemporal;
195
- }
196
- );
197
-
198
- const newAgencyId = await this.getAgencyIdForTempShipment({
199
- defaultAgencyId: agencyId,
200
- userId: idUsuario,
201
- integrationId: this.integrationType,
202
- tempShipmentData: order,
203
- sellerAddress,
204
- shipmentDetails
205
- });
206
-
207
- if (newAgencyId !== order.agencyId) {
208
- integrationsService.updateTempShimpment({
209
- id_envio: order.idEnvioTemporal,
210
- id_usuario: idUsuario,
211
- id_agencia: newAgencyId
198
+ const newAgencyId = await this.getAgencyIdForTempShipment({
199
+ defaultAgencyId: agencyId,
200
+ userId: idUsuario,
201
+ integrationId: this.integrationType,
202
+ tempShipmentData: order,
203
+ sellerAddress,
204
+ shipmentDetails
212
205
  });
213
- }
214
- });
215
206
 
216
- integrationsService.insertTempShipmentMultipleLines(
217
- this.dataToInsert.lines
218
- );
219
- integrationsService.insertTempShipmentMultipleDetails(
220
- this.dataToInsert.details
221
- );
222
- integrationsService.insertTempShipmentMultipleContents(
223
- this.dataToInsert.contents
224
- );
225
- integrationsService.insertTempShipmentMultipleExternals(
226
- this.dataToInsert.externals
207
+ if (newAgencyId !== order.agencyId) {
208
+ await integrationsService.updateTempShimpment({
209
+ id_envio: order.idEnvioTemporal,
210
+ id_usuario: idUsuario,
211
+ id_agencia: newAgencyId
212
+ });
213
+ }
214
+ })
227
215
  );
228
216
 
217
+ await Promise.allSettled([
218
+ integrationsService.insertTempShipmentMultipleLines(
219
+ this.dataToInsert.lines
220
+ ),
221
+ integrationsService.insertTempShipmentMultipleDetails(
222
+ this.dataToInsert.details
223
+ ),
224
+ integrationsService.insertTempShipmentMultipleContents(
225
+ this.dataToInsert.contents
226
+ ),
227
+ integrationsService.insertTempShipmentMultipleExternals(
228
+ this.dataToInsert.externals
229
+ )
230
+ ]);
231
+
229
232
  return { filteredOrders, insertedTempShipments: successfullShipments };
230
233
  }
231
234
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.56",
3
+ "version": "0.0.57",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",