resend 6.34.1 → 6.35.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.
package/dist/index.cjs CHANGED
@@ -57,7 +57,7 @@ const MOVE_THREAD_FOLDERS = [
57
57
  ];
58
58
  //#endregion
59
59
  //#region package.json
60
- var version = "6.34.1";
60
+ var version = "6.35.0";
61
61
  //#endregion
62
62
  //#region src/common/utils/build-pagination-query.ts
63
63
  function buildPaginationUrl(base, options) {
@@ -1659,6 +1659,9 @@ function getDefaultBaseUrl() {
1659
1659
  function getDefaultUserAgent() {
1660
1660
  return typeof process !== "undefined" && process.env ? process.env.RESEND_USER_AGENT || defaultUserAgent : defaultUserAgent;
1661
1661
  }
1662
+ function isDebugEnabled() {
1663
+ return typeof process !== "undefined" && process.env ? process.env.RESEND_DEBUG === "true" : false;
1664
+ }
1662
1665
  var Resend = class {
1663
1666
  constructor(key, options) {
1664
1667
  this.key = key;
@@ -1687,6 +1690,7 @@ var Resend = class {
1687
1690
  }
1688
1691
  this.baseUrl = options?.baseUrl ?? getDefaultBaseUrl();
1689
1692
  this.userAgent = options?.userAgent ?? getDefaultUserAgent();
1693
+ this.debug = isDebugEnabled();
1690
1694
  this.headers = new Headers({
1691
1695
  Authorization: `Bearer ${this.key}`,
1692
1696
  "User-Agent": this.userAgent,
@@ -1694,7 +1698,8 @@ var Resend = class {
1694
1698
  });
1695
1699
  }
1696
1700
  logError(error, path, status) {
1697
- if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production") console.error("[Resend API Error]:", {
1701
+ if (!this.debug) return;
1702
+ console.error("[Resend API Error]:", {
1698
1703
  ...status !== void 0 && { status },
1699
1704
  error,
1700
1705
  path
package/dist/index.d.cts CHANGED
@@ -3552,6 +3552,7 @@ export declare class Resend {
3552
3552
  readonly key?: string | undefined;
3553
3553
  readonly baseUrl: string;
3554
3554
  readonly userAgent: string;
3555
+ private readonly debug;
3555
3556
  private readonly headers;
3556
3557
  readonly segments: Segments;
3557
3558
  readonly apiKeys: ApiKeys;
package/dist/index.d.mts CHANGED
@@ -3552,6 +3552,7 @@ export declare class Resend {
3552
3552
  readonly key?: string | undefined;
3553
3553
  readonly baseUrl: string;
3554
3554
  readonly userAgent: string;
3555
+ private readonly debug;
3555
3556
  private readonly headers;
3556
3557
  readonly segments: Segments;
3557
3558
  readonly apiKeys: ApiKeys;
package/dist/index.mjs CHANGED
@@ -33,7 +33,7 @@ const MOVE_THREAD_FOLDERS = [
33
33
  ];
34
34
  //#endregion
35
35
  //#region package.json
36
- var version = "6.34.1";
36
+ var version = "6.35.0";
37
37
  //#endregion
38
38
  //#region src/common/utils/build-pagination-query.ts
39
39
  function buildPaginationUrl(base, options) {
@@ -1635,6 +1635,9 @@ function getDefaultBaseUrl() {
1635
1635
  function getDefaultUserAgent() {
1636
1636
  return typeof process !== "undefined" && process.env ? process.env.RESEND_USER_AGENT || defaultUserAgent : defaultUserAgent;
1637
1637
  }
1638
+ function isDebugEnabled() {
1639
+ return typeof process !== "undefined" && process.env ? process.env.RESEND_DEBUG === "true" : false;
1640
+ }
1638
1641
  var Resend = class {
1639
1642
  constructor(key, options) {
1640
1643
  this.key = key;
@@ -1663,6 +1666,7 @@ var Resend = class {
1663
1666
  }
1664
1667
  this.baseUrl = options?.baseUrl ?? getDefaultBaseUrl();
1665
1668
  this.userAgent = options?.userAgent ?? getDefaultUserAgent();
1669
+ this.debug = isDebugEnabled();
1666
1670
  this.headers = new Headers({
1667
1671
  Authorization: `Bearer ${this.key}`,
1668
1672
  "User-Agent": this.userAgent,
@@ -1670,7 +1674,8 @@ var Resend = class {
1670
1674
  });
1671
1675
  }
1672
1676
  logError(error, path, status) {
1673
- if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production") console.error("[Resend API Error]:", {
1677
+ if (!this.debug) return;
1678
+ console.error("[Resend API Error]:", {
1674
1679
  ...status !== void 0 && { status },
1675
1680
  error,
1676
1681
  path
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "6.34.1",
3
+ "version": "6.35.0",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",