@fonderie/customers 6.2.2 → 6.2.4

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.cjs CHANGED
@@ -1518,11 +1518,10 @@ function customerController(store, config = {}, bus) {
1518
1518
  }
1519
1519
  throw err;
1520
1520
  }
1521
- bus?.emit(EVENT_KEYS.customerCreated, {
1521
+ await (0, import_core2.background)(bus?.emit(EVENT_KEYS.customerCreated, {
1522
1522
  customerId: customer.id,
1523
1523
  workspaceId: customer.workspaceId
1524
- }).catch(() => {
1525
- });
1524
+ }));
1526
1525
  return (0, import_core2.setApiResponse)(import_core2.HTTP.CREATED, "CUSTOMER_CREATED", "Customer created successfully.", {
1527
1526
  customer: toCustomerDTO(customer)
1528
1527
  });
@@ -1587,11 +1586,10 @@ function customerController(store, config = {}, bus) {
1587
1586
  if (!customer) {
1588
1587
  return (0, import_core2.setApiResponse)(import_core2.HTTP.NOT_FOUND, "NOT_FOUND", "Customer not found");
1589
1588
  }
1590
- bus?.emit(EVENT_KEYS.customerUpdated, {
1589
+ await (0, import_core2.background)(bus?.emit(EVENT_KEYS.customerUpdated, {
1591
1590
  customerId: customer.id,
1592
1591
  workspaceId: customer.workspaceId
1593
- }).catch(() => {
1594
- });
1592
+ }));
1595
1593
  return (0, import_core2.setApiResponse)(import_core2.HTTP.OK, "CUSTOMER_UPDATED", "Customer updated successfully.", {
1596
1594
  customer: toCustomerDTO(customer)
1597
1595
  });
@@ -1615,11 +1613,10 @@ function customerController(store, config = {}, bus) {
1615
1613
  return (0, import_core2.setApiResponse)(import_core2.HTTP.NOT_FOUND, "NOT_FOUND", "Customer not found");
1616
1614
  }
1617
1615
  await customers.delete(id, workspaceId);
1618
- bus?.emit(EVENT_KEYS.customerDeleted, {
1616
+ await (0, import_core2.background)(bus?.emit(EVENT_KEYS.customerDeleted, {
1619
1617
  customerId: id,
1620
1618
  workspaceId
1621
- }).catch(() => {
1622
- });
1619
+ }));
1623
1620
  return (0, import_core2.setApiResponse)(import_core2.HTTP.OK, "CUSTOMER_DELETED", "Customer deleted successfully.");
1624
1621
  },
1625
1622
  async blacklist(ctx) {
@@ -1643,11 +1640,10 @@ function customerController(store, config = {}, bus) {
1643
1640
  const body = ctx.meta["body"];
1644
1641
  const reason = typeof body?.["reason"] === "string" ? body["reason"].trim() || null : null;
1645
1642
  await customers.blacklist(id, workspaceId, reason);
1646
- bus?.emit(EVENT_KEYS.customerBlacklisted, {
1643
+ await (0, import_core2.background)(bus?.emit(EVENT_KEYS.customerBlacklisted, {
1647
1644
  customerId: id,
1648
1645
  workspaceId
1649
- }).catch(() => {
1650
- });
1646
+ }));
1651
1647
  return (0, import_core2.setApiResponse)(import_core2.HTTP.OK, "CUSTOMER_BLACKLISTED", "Customer blacklisted successfully.");
1652
1648
  },
1653
1649
  async unblacklist(ctx) {
@@ -1669,11 +1665,10 @@ function customerController(store, config = {}, bus) {
1669
1665
  return (0, import_core2.setApiResponse)(import_core2.HTTP.NOT_FOUND, "NOT_FOUND", "Customer not found");
1670
1666
  }
1671
1667
  await customers.unblacklist(id, workspaceId);
1672
- bus?.emit(EVENT_KEYS.customerUnblacklisted, {
1668
+ await (0, import_core2.background)(bus?.emit(EVENT_KEYS.customerUnblacklisted, {
1673
1669
  customerId: id,
1674
1670
  workspaceId
1675
- }).catch(() => {
1676
- });
1671
+ }));
1677
1672
  return (0, import_core2.setApiResponse)(import_core2.HTTP.OK, "CUSTOMER_UNBLACKLISTED", "Customer removed from blacklist successfully.");
1678
1673
  }
1679
1674
  };