@getbrevo/brevo 5.0.3 → 5.0.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.
Files changed (52) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/contacts/client/Client.d.ts +1 -1
  3. package/dist/cjs/api/resources/contacts/client/Client.js +4 -1
  4. package/dist/cjs/api/resources/contacts/client/requests/CreateContactRequest.d.ts +1 -1
  5. package/dist/cjs/api/resources/contacts/client/requests/UpdateContactRequest.d.ts +1 -1
  6. package/dist/cjs/api/resources/ecommerce/client/Client.d.ts +2 -2
  7. package/dist/cjs/api/resources/ecommerce/client/Client.js +8 -2
  8. package/dist/cjs/api/resources/event/client/requests/CreateEventRequest.d.ts +2 -2
  9. package/dist/cjs/api/resources/event/types/CreateBatchEventsRequestItem.d.ts +2 -2
  10. package/dist/cjs/api/resources/process/types/GetProcessResponse.d.ts +3 -2
  11. package/dist/cjs/api/resources/process/types/GetProcessResponse.js +1 -0
  12. package/dist/cjs/api/resources/process/types/GetProcessesResponse.d.ts +3 -2
  13. package/dist/cjs/api/resources/process/types/GetProcessesResponse.js +1 -0
  14. package/dist/cjs/core/auth/BasicAuth.d.ts +2 -2
  15. package/dist/cjs/core/auth/BasicAuth.js +7 -1
  16. package/dist/cjs/core/fetcher/Fetcher.d.ts +2 -0
  17. package/dist/cjs/core/fetcher/Fetcher.js +4 -0
  18. package/dist/cjs/core/file/file.js +3 -2
  19. package/dist/cjs/errors/BrevoError.d.ts +3 -1
  20. package/dist/cjs/errors/BrevoError.js +4 -1
  21. package/dist/cjs/errors/BrevoTimeoutError.d.ts +4 -1
  22. package/dist/cjs/errors/BrevoTimeoutError.js +4 -1
  23. package/dist/cjs/errors/handleNonStatusCodeError.js +4 -1
  24. package/dist/cjs/version.d.ts +1 -1
  25. package/dist/cjs/version.js +1 -1
  26. package/dist/esm/BaseClient.mjs +2 -2
  27. package/dist/esm/api/resources/contacts/client/Client.d.mts +1 -1
  28. package/dist/esm/api/resources/contacts/client/Client.mjs +4 -1
  29. package/dist/esm/api/resources/contacts/client/requests/CreateContactRequest.d.mts +1 -1
  30. package/dist/esm/api/resources/contacts/client/requests/UpdateContactRequest.d.mts +1 -1
  31. package/dist/esm/api/resources/ecommerce/client/Client.d.mts +2 -2
  32. package/dist/esm/api/resources/ecommerce/client/Client.mjs +8 -2
  33. package/dist/esm/api/resources/event/client/requests/CreateEventRequest.d.mts +2 -2
  34. package/dist/esm/api/resources/event/types/CreateBatchEventsRequestItem.d.mts +2 -2
  35. package/dist/esm/api/resources/process/types/GetProcessResponse.d.mts +3 -2
  36. package/dist/esm/api/resources/process/types/GetProcessResponse.mjs +1 -0
  37. package/dist/esm/api/resources/process/types/GetProcessesResponse.d.mts +3 -2
  38. package/dist/esm/api/resources/process/types/GetProcessesResponse.mjs +1 -0
  39. package/dist/esm/core/auth/BasicAuth.d.mts +2 -2
  40. package/dist/esm/core/auth/BasicAuth.mjs +7 -1
  41. package/dist/esm/core/fetcher/Fetcher.d.mts +2 -0
  42. package/dist/esm/core/fetcher/Fetcher.mjs +4 -0
  43. package/dist/esm/core/file/file.mjs +3 -2
  44. package/dist/esm/errors/BrevoError.d.mts +3 -1
  45. package/dist/esm/errors/BrevoError.mjs +4 -1
  46. package/dist/esm/errors/BrevoTimeoutError.d.mts +4 -1
  47. package/dist/esm/errors/BrevoTimeoutError.mjs +4 -1
  48. package/dist/esm/errors/handleNonStatusCodeError.mjs +4 -1
  49. package/dist/esm/version.d.mts +1 -1
  50. package/dist/esm/version.mjs +1 -1
  51. package/package.json +7 -7
  52. package/reference.md +3 -3
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@getbrevo/brevo",
46
- "X-Fern-SDK-Version": "5.0.3",
47
- "User-Agent": "@getbrevo/brevo/5.0.3",
46
+ "X-Fern-SDK-Version": "5.0.4",
47
+ "User-Agent": "@getbrevo/brevo/5.0.4",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -36,7 +36,7 @@ export declare class ContactsClient {
36
36
  * @example
37
37
  * await client.contacts.createContact()
38
38
  */
39
- createContact(request?: Brevo.CreateContactRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateContactResponse>;
39
+ createContact(request?: Brevo.CreateContactRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateContactResponse | undefined>;
40
40
  private __createContact;
41
41
  /**
42
42
  * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -163,7 +163,10 @@ class ContactsClient {
163
163
  logging: this._options.logging,
164
164
  });
165
165
  if (_response.ok) {
166
- return { data: _response.body, rawResponse: _response.rawResponse };
166
+ return {
167
+ data: _response.body,
168
+ rawResponse: _response.rawResponse,
169
+ };
167
170
  }
168
171
  if (_response.error.reason === "status-code") {
169
172
  switch (_response.error.statusCode) {
@@ -22,6 +22,6 @@ export interface CreateContactRequest {
22
22
  }
23
23
  export declare namespace CreateContactRequest {
24
24
  namespace Attributes {
25
- type Value = number | string | boolean | string[];
25
+ type Value = number | number | string | boolean | string[];
26
26
  }
27
27
  }
@@ -27,6 +27,6 @@ export interface UpdateContactRequest {
27
27
  }
28
28
  export declare namespace UpdateContactRequest {
29
29
  namespace Attributes {
30
- type Value = number | string | boolean | string[];
30
+ type Value = number | number | string | boolean | string[];
31
31
  }
32
32
  }
@@ -32,7 +32,7 @@ export declare class EcommerceClient {
32
32
  * id: "CAT123"
33
33
  * })
34
34
  */
35
- createUpdateCategory(request: Brevo.CreateUpdateCategoryRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateCategoryResponse>;
35
+ createUpdateCategory(request: Brevo.CreateUpdateCategoryRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateCategoryResponse | undefined>;
36
36
  private __createUpdateCategory;
37
37
  /**
38
38
  * @param {Brevo.CreateUpdateBatchCategoryRequest} request
@@ -230,7 +230,7 @@ export declare class EcommerceClient {
230
230
  * name: "Iphone 11"
231
231
  * })
232
232
  */
233
- createUpdateProduct(request: Brevo.CreateUpdateProductRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateProductResponse>;
233
+ createUpdateProduct(request: Brevo.CreateUpdateProductRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateProductResponse | undefined>;
234
234
  private __createUpdateProduct;
235
235
  /**
236
236
  * @param {Brevo.CreateUpdateBatchProductsRequest} request
@@ -157,7 +157,10 @@ class EcommerceClient {
157
157
  logging: this._options.logging,
158
158
  });
159
159
  if (_response.ok) {
160
- return { data: _response.body, rawResponse: _response.rawResponse };
160
+ return {
161
+ data: _response.body,
162
+ rawResponse: _response.rawResponse,
163
+ };
161
164
  }
162
165
  if (_response.error.reason === "status-code") {
163
166
  switch (_response.error.statusCode) {
@@ -895,7 +898,10 @@ class EcommerceClient {
895
898
  logging: this._options.logging,
896
899
  });
897
900
  if (_response.ok) {
898
- return { data: _response.body, rawResponse: _response.rawResponse };
901
+ return {
902
+ data: _response.body,
903
+ rawResponse: _response.rawResponse,
904
+ };
899
905
  }
900
906
  if (_response.error.reason === "status-code") {
901
907
  switch (_response.error.statusCode) {
@@ -21,10 +21,10 @@ export interface CreateEventRequest {
21
21
  }
22
22
  export declare namespace CreateEventRequest {
23
23
  namespace ContactProperties {
24
- type Value = string | number;
24
+ type Value = string | number | boolean;
25
25
  }
26
26
  namespace EventProperties {
27
- type Value = string | number | Record<string, unknown> | unknown[];
27
+ type Value = string | number | boolean | Record<string, unknown> | unknown[];
28
28
  }
29
29
  /**
30
30
  * Identifies the contact associated with the event. At least one identifier is required.
@@ -14,10 +14,10 @@ export interface CreateBatchEventsRequestItem {
14
14
  }
15
15
  export declare namespace CreateBatchEventsRequestItem {
16
16
  namespace ContactProperties {
17
- type Value = string | number;
17
+ type Value = string | number | boolean;
18
18
  }
19
19
  namespace EventProperties {
20
- type Value = string | number | Record<string, unknown> | unknown[];
20
+ type Value = string | number | boolean | Record<string, unknown> | unknown[];
21
21
  }
22
22
  /**
23
23
  * Identifies the contact associated with the event. At least one identifier is required.
@@ -31,6 +31,7 @@ export declare namespace GetProcessResponse {
31
31
  /** Current status of the process */
32
32
  const Status: {
33
33
  readonly Queued: "queued";
34
+ readonly InProcess: "in_process";
34
35
  readonly Processing: "processing";
35
36
  readonly Completed: "completed";
36
37
  readonly Failed: "failed";
@@ -57,8 +58,8 @@ export declare namespace GetProcessResponse {
57
58
  duplicate_contact_id?: (number | null) | undefined;
58
59
  /** Number of duplicate external IDs */
59
60
  duplicate_ext_id?: (number | null) | undefined;
60
- /** Number of duplicate email IDs */
61
- duplicate_email_id?: (number | null) | undefined;
61
+ /** URL to CSV file containing duplicate email IDs, or null if none */
62
+ duplicate_email_id?: (string | null) | undefined;
62
63
  /** Number of duplicate phone numbers */
63
64
  duplicate_phone_id?: (number | null) | undefined;
64
65
  /** Number of duplicate WhatsApp numbers */
@@ -17,6 +17,7 @@ var GetProcessResponse;
17
17
  /** Current status of the process */
18
18
  GetProcessResponse.Status = {
19
19
  Queued: "queued",
20
+ InProcess: "in_process",
20
21
  Processing: "processing",
21
22
  Completed: "completed",
22
23
  Failed: "failed",
@@ -40,6 +40,7 @@ export declare namespace GetProcessesResponse {
40
40
  /** Current status of the process */
41
41
  const Status: {
42
42
  readonly Queued: "queued";
43
+ readonly InProcess: "in_process";
43
44
  readonly Processing: "processing";
44
45
  readonly Completed: "completed";
45
46
  readonly Failed: "failed";
@@ -66,8 +67,8 @@ export declare namespace GetProcessesResponse {
66
67
  duplicate_contact_id?: (number | null) | undefined;
67
68
  /** Number of duplicate external IDs */
68
69
  duplicate_ext_id?: (number | null) | undefined;
69
- /** Number of duplicate email IDs */
70
- duplicate_email_id?: (number | null) | undefined;
70
+ /** URL to CSV file containing duplicate email IDs, or null if none */
71
+ duplicate_email_id?: (string | null) | undefined;
71
72
  /** Number of duplicate phone numbers */
72
73
  duplicate_phone_id?: (number | null) | undefined;
73
74
  /** Number of duplicate WhatsApp numbers */
@@ -21,6 +21,7 @@ var GetProcessesResponse;
21
21
  /** Current status of the process */
22
22
  Item.Status = {
23
23
  Queued: "queued",
24
+ InProcess: "in_process",
24
25
  Processing: "processing",
25
26
  Completed: "completed",
26
27
  Failed: "failed",
@@ -1,6 +1,6 @@
1
1
  export interface BasicAuth {
2
- username: string;
3
- password: string;
2
+ username?: string;
3
+ password?: string;
4
4
  }
5
5
  export declare const BasicAuth: {
6
6
  toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
@@ -5,10 +5,16 @@ const base64_js_1 = require("../base64.js");
5
5
  const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
6
6
  exports.BasicAuth = {
7
7
  toAuthorizationHeader: (basicAuth) => {
8
+ var _a, _b;
8
9
  if (basicAuth == null) {
9
10
  return undefined;
10
11
  }
11
- const token = (0, base64_js_1.base64Encode)(`${basicAuth.username}:${basicAuth.password}`);
12
+ const username = (_a = basicAuth.username) !== null && _a !== void 0 ? _a : "";
13
+ const password = (_b = basicAuth.password) !== null && _b !== void 0 ? _b : "";
14
+ if (username === "" && password === "") {
15
+ return undefined;
16
+ }
17
+ const token = (0, base64_js_1.base64Encode)(`${username}:${password}`);
12
18
  return `Basic ${token}`;
13
19
  },
14
20
  fromAuthorizationHeader: (header) => {
@@ -38,10 +38,12 @@ export declare namespace Fetcher {
38
38
  }
39
39
  interface TimeoutError {
40
40
  reason: "timeout";
41
+ cause?: unknown;
41
42
  }
42
43
  interface UnknownError {
43
44
  reason: "unknown";
44
45
  errorMessage: string;
46
+ cause?: unknown;
45
47
  }
46
48
  }
47
49
  export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>;
@@ -261,6 +261,7 @@ function fetcherImpl(args) {
261
261
  error: {
262
262
  reason: "unknown",
263
263
  errorMessage: "The user aborted a request",
264
+ cause: error,
264
265
  },
265
266
  rawResponse: RawResponse_js_1.abortRawResponse,
266
267
  };
@@ -278,6 +279,7 @@ function fetcherImpl(args) {
278
279
  ok: false,
279
280
  error: {
280
281
  reason: "timeout",
282
+ cause: error,
281
283
  },
282
284
  rawResponse: RawResponse_js_1.abortRawResponse,
283
285
  };
@@ -296,6 +298,7 @@ function fetcherImpl(args) {
296
298
  error: {
297
299
  reason: "unknown",
298
300
  errorMessage: error.message,
301
+ cause: error,
299
302
  },
300
303
  rawResponse: RawResponse_js_1.unknownRawResponse,
301
304
  };
@@ -313,6 +316,7 @@ function fetcherImpl(args) {
313
316
  error: {
314
317
  reason: "unknown",
315
318
  errorMessage: (0, json_js_1.toJson)(error),
319
+ cause: error,
316
320
  },
317
321
  rawResponse: RawResponse_js_1.unknownRawResponse,
318
322
  };
@@ -85,7 +85,7 @@ function getFileWithMetadata(file_1) {
85
85
  }
86
86
  if ("path" in file) {
87
87
  const fs = yield Promise.resolve().then(() => __importStar(require("fs")));
88
- if (!fs || !fs.createReadStream) {
88
+ if (!(fs === null || fs === void 0 ? void 0 : fs.createReadStream)) {
89
89
  throw new Error("File path uploads are not supported in this environment.");
90
90
  }
91
91
  const data = fs.createReadStream(file.path);
@@ -126,9 +126,10 @@ function isFileLike(value) {
126
126
  }
127
127
  function tryGetFileSizeFromPath(path) {
128
128
  return __awaiter(this, void 0, void 0, function* () {
129
+ var _a;
129
130
  try {
130
131
  const fs = yield Promise.resolve().then(() => __importStar(require("fs")));
131
- if (!fs || !fs.promises || !fs.promises.stat) {
132
+ if (!((_a = fs === null || fs === void 0 ? void 0 : fs.promises) === null || _a === void 0 ? void 0 : _a.stat)) {
132
133
  return undefined;
133
134
  }
134
135
  const fileStat = yield fs.promises.stat(path);
@@ -3,10 +3,12 @@ export declare class BrevoError extends Error {
3
3
  readonly statusCode?: number;
4
4
  readonly body?: unknown;
5
5
  readonly rawResponse?: core.RawResponse;
6
- constructor({ message, statusCode, body, rawResponse, }: {
6
+ readonly cause?: unknown;
7
+ constructor({ message, statusCode, body, rawResponse, cause, }: {
7
8
  message?: string;
8
9
  statusCode?: number;
9
10
  body?: unknown;
10
11
  rawResponse?: core.RawResponse;
12
+ cause?: unknown;
11
13
  });
12
14
  }
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.BrevoError = void 0;
5
5
  const json_js_1 = require("../core/json.js");
6
6
  class BrevoError extends Error {
7
- constructor({ message, statusCode, body, rawResponse, }) {
7
+ constructor({ message, statusCode, body, rawResponse, cause, }) {
8
8
  super(buildMessage({ message, statusCode, body }));
9
9
  Object.setPrototypeOf(this, new.target.prototype);
10
10
  if (Error.captureStackTrace) {
@@ -14,6 +14,9 @@ class BrevoError extends Error {
14
14
  this.statusCode = statusCode;
15
15
  this.body = body;
16
16
  this.rawResponse = rawResponse;
17
+ if (cause != null) {
18
+ this.cause = cause;
19
+ }
17
20
  }
18
21
  }
19
22
  exports.BrevoError = BrevoError;
@@ -1,3 +1,6 @@
1
1
  export declare class BrevoTimeoutError extends Error {
2
- constructor(message: string);
2
+ readonly cause?: unknown;
3
+ constructor(message: string, opts?: {
4
+ cause?: unknown;
5
+ });
3
6
  }
@@ -3,13 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.BrevoTimeoutError = void 0;
5
5
  class BrevoTimeoutError extends Error {
6
- constructor(message) {
6
+ constructor(message, opts) {
7
7
  super(message);
8
8
  Object.setPrototypeOf(this, new.target.prototype);
9
9
  if (Error.captureStackTrace) {
10
10
  Error.captureStackTrace(this, this.constructor);
11
11
  }
12
12
  this.name = this.constructor.name;
13
+ if ((opts === null || opts === void 0 ? void 0 : opts.cause) != null) {
14
+ this.cause = opts.cause;
15
+ }
13
16
  }
14
17
  }
15
18
  exports.BrevoTimeoutError = BrevoTimeoutError;
@@ -50,11 +50,14 @@ function handleNonStatusCodeError(error, rawResponse, method, path) {
50
50
  rawResponse: rawResponse,
51
51
  });
52
52
  case "timeout":
53
- throw new errors.BrevoTimeoutError(`Timeout exceeded when calling ${method} ${path}.`);
53
+ throw new errors.BrevoTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
54
+ cause: error.cause,
55
+ });
54
56
  case "unknown":
55
57
  throw new errors.BrevoError({
56
58
  message: error.errorMessage,
57
59
  rawResponse: rawResponse,
60
+ cause: error.cause,
58
61
  });
59
62
  default:
60
63
  throw new errors.BrevoError({
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "5.0.3";
1
+ export declare const SDK_VERSION = "5.0.4";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "5.0.3";
4
+ exports.SDK_VERSION = "5.0.4";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "@getbrevo/brevo",
9
- "X-Fern-SDK-Version": "5.0.3",
10
- "User-Agent": "@getbrevo/brevo/5.0.3",
9
+ "X-Fern-SDK-Version": "5.0.4",
10
+ "User-Agent": "@getbrevo/brevo/5.0.4",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -36,7 +36,7 @@ export declare class ContactsClient {
36
36
  * @example
37
37
  * await client.contacts.createContact()
38
38
  */
39
- createContact(request?: Brevo.CreateContactRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateContactResponse>;
39
+ createContact(request?: Brevo.CreateContactRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateContactResponse | undefined>;
40
40
  private __createContact;
41
41
  /**
42
42
  * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -127,7 +127,10 @@ export class ContactsClient {
127
127
  logging: this._options.logging,
128
128
  });
129
129
  if (_response.ok) {
130
- return { data: _response.body, rawResponse: _response.rawResponse };
130
+ return {
131
+ data: _response.body,
132
+ rawResponse: _response.rawResponse,
133
+ };
131
134
  }
132
135
  if (_response.error.reason === "status-code") {
133
136
  switch (_response.error.statusCode) {
@@ -22,6 +22,6 @@ export interface CreateContactRequest {
22
22
  }
23
23
  export declare namespace CreateContactRequest {
24
24
  namespace Attributes {
25
- type Value = number | string | boolean | string[];
25
+ type Value = number | number | string | boolean | string[];
26
26
  }
27
27
  }
@@ -27,6 +27,6 @@ export interface UpdateContactRequest {
27
27
  }
28
28
  export declare namespace UpdateContactRequest {
29
29
  namespace Attributes {
30
- type Value = number | string | boolean | string[];
30
+ type Value = number | number | string | boolean | string[];
31
31
  }
32
32
  }
@@ -32,7 +32,7 @@ export declare class EcommerceClient {
32
32
  * id: "CAT123"
33
33
  * })
34
34
  */
35
- createUpdateCategory(request: Brevo.CreateUpdateCategoryRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateCategoryResponse>;
35
+ createUpdateCategory(request: Brevo.CreateUpdateCategoryRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateCategoryResponse | undefined>;
36
36
  private __createUpdateCategory;
37
37
  /**
38
38
  * @param {Brevo.CreateUpdateBatchCategoryRequest} request
@@ -230,7 +230,7 @@ export declare class EcommerceClient {
230
230
  * name: "Iphone 11"
231
231
  * })
232
232
  */
233
- createUpdateProduct(request: Brevo.CreateUpdateProductRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateProductResponse>;
233
+ createUpdateProduct(request: Brevo.CreateUpdateProductRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateProductResponse | undefined>;
234
234
  private __createUpdateProduct;
235
235
  /**
236
236
  * @param {Brevo.CreateUpdateBatchProductsRequest} request
@@ -121,7 +121,10 @@ export class EcommerceClient {
121
121
  logging: this._options.logging,
122
122
  });
123
123
  if (_response.ok) {
124
- return { data: _response.body, rawResponse: _response.rawResponse };
124
+ return {
125
+ data: _response.body,
126
+ rawResponse: _response.rawResponse,
127
+ };
125
128
  }
126
129
  if (_response.error.reason === "status-code") {
127
130
  switch (_response.error.statusCode) {
@@ -859,7 +862,10 @@ export class EcommerceClient {
859
862
  logging: this._options.logging,
860
863
  });
861
864
  if (_response.ok) {
862
- return { data: _response.body, rawResponse: _response.rawResponse };
865
+ return {
866
+ data: _response.body,
867
+ rawResponse: _response.rawResponse,
868
+ };
863
869
  }
864
870
  if (_response.error.reason === "status-code") {
865
871
  switch (_response.error.statusCode) {
@@ -21,10 +21,10 @@ export interface CreateEventRequest {
21
21
  }
22
22
  export declare namespace CreateEventRequest {
23
23
  namespace ContactProperties {
24
- type Value = string | number;
24
+ type Value = string | number | boolean;
25
25
  }
26
26
  namespace EventProperties {
27
- type Value = string | number | Record<string, unknown> | unknown[];
27
+ type Value = string | number | boolean | Record<string, unknown> | unknown[];
28
28
  }
29
29
  /**
30
30
  * Identifies the contact associated with the event. At least one identifier is required.
@@ -14,10 +14,10 @@ export interface CreateBatchEventsRequestItem {
14
14
  }
15
15
  export declare namespace CreateBatchEventsRequestItem {
16
16
  namespace ContactProperties {
17
- type Value = string | number;
17
+ type Value = string | number | boolean;
18
18
  }
19
19
  namespace EventProperties {
20
- type Value = string | number | Record<string, unknown> | unknown[];
20
+ type Value = string | number | boolean | Record<string, unknown> | unknown[];
21
21
  }
22
22
  /**
23
23
  * Identifies the contact associated with the event. At least one identifier is required.
@@ -31,6 +31,7 @@ export declare namespace GetProcessResponse {
31
31
  /** Current status of the process */
32
32
  const Status: {
33
33
  readonly Queued: "queued";
34
+ readonly InProcess: "in_process";
34
35
  readonly Processing: "processing";
35
36
  readonly Completed: "completed";
36
37
  readonly Failed: "failed";
@@ -57,8 +58,8 @@ export declare namespace GetProcessResponse {
57
58
  duplicate_contact_id?: (number | null) | undefined;
58
59
  /** Number of duplicate external IDs */
59
60
  duplicate_ext_id?: (number | null) | undefined;
60
- /** Number of duplicate email IDs */
61
- duplicate_email_id?: (number | null) | undefined;
61
+ /** URL to CSV file containing duplicate email IDs, or null if none */
62
+ duplicate_email_id?: (string | null) | undefined;
62
63
  /** Number of duplicate phone numbers */
63
64
  duplicate_phone_id?: (number | null) | undefined;
64
65
  /** Number of duplicate WhatsApp numbers */
@@ -14,6 +14,7 @@ export var GetProcessResponse;
14
14
  /** Current status of the process */
15
15
  GetProcessResponse.Status = {
16
16
  Queued: "queued",
17
+ InProcess: "in_process",
17
18
  Processing: "processing",
18
19
  Completed: "completed",
19
20
  Failed: "failed",
@@ -40,6 +40,7 @@ export declare namespace GetProcessesResponse {
40
40
  /** Current status of the process */
41
41
  const Status: {
42
42
  readonly Queued: "queued";
43
+ readonly InProcess: "in_process";
43
44
  readonly Processing: "processing";
44
45
  readonly Completed: "completed";
45
46
  readonly Failed: "failed";
@@ -66,8 +67,8 @@ export declare namespace GetProcessesResponse {
66
67
  duplicate_contact_id?: (number | null) | undefined;
67
68
  /** Number of duplicate external IDs */
68
69
  duplicate_ext_id?: (number | null) | undefined;
69
- /** Number of duplicate email IDs */
70
- duplicate_email_id?: (number | null) | undefined;
70
+ /** URL to CSV file containing duplicate email IDs, or null if none */
71
+ duplicate_email_id?: (string | null) | undefined;
71
72
  /** Number of duplicate phone numbers */
72
73
  duplicate_phone_id?: (number | null) | undefined;
73
74
  /** Number of duplicate WhatsApp numbers */
@@ -18,6 +18,7 @@ export var GetProcessesResponse;
18
18
  /** Current status of the process */
19
19
  Item.Status = {
20
20
  Queued: "queued",
21
+ InProcess: "in_process",
21
22
  Processing: "processing",
22
23
  Completed: "completed",
23
24
  Failed: "failed",
@@ -1,6 +1,6 @@
1
1
  export interface BasicAuth {
2
- username: string;
3
- password: string;
2
+ username?: string;
3
+ password?: string;
4
4
  }
5
5
  export declare const BasicAuth: {
6
6
  toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
@@ -2,10 +2,16 @@ import { base64Decode, base64Encode } from "../base64.mjs";
2
2
  const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
3
3
  export const BasicAuth = {
4
4
  toAuthorizationHeader: (basicAuth) => {
5
+ var _a, _b;
5
6
  if (basicAuth == null) {
6
7
  return undefined;
7
8
  }
8
- const token = base64Encode(`${basicAuth.username}:${basicAuth.password}`);
9
+ const username = (_a = basicAuth.username) !== null && _a !== void 0 ? _a : "";
10
+ const password = (_b = basicAuth.password) !== null && _b !== void 0 ? _b : "";
11
+ if (username === "" && password === "") {
12
+ return undefined;
13
+ }
14
+ const token = base64Encode(`${username}:${password}`);
9
15
  return `Basic ${token}`;
10
16
  },
11
17
  fromAuthorizationHeader: (header) => {
@@ -38,10 +38,12 @@ export declare namespace Fetcher {
38
38
  }
39
39
  interface TimeoutError {
40
40
  reason: "timeout";
41
+ cause?: unknown;
41
42
  }
42
43
  interface UnknownError {
43
44
  reason: "unknown";
44
45
  errorMessage: string;
46
+ cause?: unknown;
45
47
  }
46
48
  }
47
49
  export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>;
@@ -257,6 +257,7 @@ export function fetcherImpl(args) {
257
257
  error: {
258
258
  reason: "unknown",
259
259
  errorMessage: "The user aborted a request",
260
+ cause: error,
260
261
  },
261
262
  rawResponse: abortRawResponse,
262
263
  };
@@ -274,6 +275,7 @@ export function fetcherImpl(args) {
274
275
  ok: false,
275
276
  error: {
276
277
  reason: "timeout",
278
+ cause: error,
277
279
  },
278
280
  rawResponse: abortRawResponse,
279
281
  };
@@ -292,6 +294,7 @@ export function fetcherImpl(args) {
292
294
  error: {
293
295
  reason: "unknown",
294
296
  errorMessage: error.message,
297
+ cause: error,
295
298
  },
296
299
  rawResponse: unknownRawResponse,
297
300
  };
@@ -309,6 +312,7 @@ export function fetcherImpl(args) {
309
312
  error: {
310
313
  reason: "unknown",
311
314
  errorMessage: toJson(error),
315
+ cause: error,
312
316
  },
313
317
  rawResponse: unknownRawResponse,
314
318
  };
@@ -48,7 +48,7 @@ function getFileWithMetadata(file_1) {
48
48
  }
49
49
  if ("path" in file) {
50
50
  const fs = yield import("fs");
51
- if (!fs || !fs.createReadStream) {
51
+ if (!(fs === null || fs === void 0 ? void 0 : fs.createReadStream)) {
52
52
  throw new Error("File path uploads are not supported in this environment.");
53
53
  }
54
54
  const data = fs.createReadStream(file.path);
@@ -89,9 +89,10 @@ function isFileLike(value) {
89
89
  }
90
90
  function tryGetFileSizeFromPath(path) {
91
91
  return __awaiter(this, void 0, void 0, function* () {
92
+ var _a;
92
93
  try {
93
94
  const fs = yield import("fs");
94
- if (!fs || !fs.promises || !fs.promises.stat) {
95
+ if (!((_a = fs === null || fs === void 0 ? void 0 : fs.promises) === null || _a === void 0 ? void 0 : _a.stat)) {
95
96
  return undefined;
96
97
  }
97
98
  const fileStat = yield fs.promises.stat(path);
@@ -3,10 +3,12 @@ export declare class BrevoError extends Error {
3
3
  readonly statusCode?: number;
4
4
  readonly body?: unknown;
5
5
  readonly rawResponse?: core.RawResponse;
6
- constructor({ message, statusCode, body, rawResponse, }: {
6
+ readonly cause?: unknown;
7
+ constructor({ message, statusCode, body, rawResponse, cause, }: {
7
8
  message?: string;
8
9
  statusCode?: number;
9
10
  body?: unknown;
10
11
  rawResponse?: core.RawResponse;
12
+ cause?: unknown;
11
13
  });
12
14
  }
@@ -1,7 +1,7 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  import { toJson } from "../core/json.mjs";
3
3
  export class BrevoError extends Error {
4
- constructor({ message, statusCode, body, rawResponse, }) {
4
+ constructor({ message, statusCode, body, rawResponse, cause, }) {
5
5
  super(buildMessage({ message, statusCode, body }));
6
6
  Object.setPrototypeOf(this, new.target.prototype);
7
7
  if (Error.captureStackTrace) {
@@ -11,6 +11,9 @@ export class BrevoError extends Error {
11
11
  this.statusCode = statusCode;
12
12
  this.body = body;
13
13
  this.rawResponse = rawResponse;
14
+ if (cause != null) {
15
+ this.cause = cause;
16
+ }
14
17
  }
15
18
  }
16
19
  function buildMessage({ message, statusCode, body, }) {
@@ -1,3 +1,6 @@
1
1
  export declare class BrevoTimeoutError extends Error {
2
- constructor(message: string);
2
+ readonly cause?: unknown;
3
+ constructor(message: string, opts?: {
4
+ cause?: unknown;
5
+ });
3
6
  }
@@ -1,11 +1,14 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  export class BrevoTimeoutError extends Error {
3
- constructor(message) {
3
+ constructor(message, opts) {
4
4
  super(message);
5
5
  Object.setPrototypeOf(this, new.target.prototype);
6
6
  if (Error.captureStackTrace) {
7
7
  Error.captureStackTrace(this, this.constructor);
8
8
  }
9
9
  this.name = this.constructor.name;
10
+ if ((opts === null || opts === void 0 ? void 0 : opts.cause) != null) {
11
+ this.cause = opts.cause;
12
+ }
10
13
  }
11
14
  }
@@ -14,11 +14,14 @@ export function handleNonStatusCodeError(error, rawResponse, method, path) {
14
14
  rawResponse: rawResponse,
15
15
  });
16
16
  case "timeout":
17
- throw new errors.BrevoTimeoutError(`Timeout exceeded when calling ${method} ${path}.`);
17
+ throw new errors.BrevoTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
18
+ cause: error.cause,
19
+ });
18
20
  case "unknown":
19
21
  throw new errors.BrevoError({
20
22
  message: error.errorMessage,
21
23
  rawResponse: rawResponse,
24
+ cause: error.cause,
22
25
  });
23
26
  default:
24
27
  throw new errors.BrevoError({
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "5.0.3";
1
+ export declare const SDK_VERSION = "5.0.4";
@@ -1 +1 @@
1
- export const SDK_VERSION = "5.0.3";
1
+ export const SDK_VERSION = "5.0.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getbrevo/brevo",
3
- "version": "5.0.3",
3
+ "version": "5.0.4",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -398,13 +398,13 @@
398
398
  },
399
399
  "dependencies": {},
400
400
  "devDependencies": {
401
- "webpack": "^5.97.1",
402
- "ts-loader": "^9.5.1",
403
- "vitest": "^3.2.4",
401
+ "webpack": "^5.105.4",
402
+ "ts-loader": "^9.5.4",
403
+ "vitest": "^4.1.1",
404
404
  "msw": "2.11.2",
405
405
  "@types/node": "^18.19.70",
406
- "typescript": "~5.7.2",
407
- "@biomejs/biome": "2.4.3"
406
+ "typescript": "~5.9.3",
407
+ "@biomejs/biome": "2.4.10"
408
408
  },
409
409
  "browser": {
410
410
  "fs": false,
@@ -413,7 +413,7 @@
413
413
  "stream": false,
414
414
  "crypto": false
415
415
  },
416
- "packageManager": "pnpm@10.20.0",
416
+ "packageManager": "pnpm@10.33.0",
417
417
  "engines": {
418
418
  "node": ">=18.0.0"
419
419
  },
package/reference.md CHANGED
@@ -4637,7 +4637,7 @@ await client.contacts.getContacts();
4637
4637
  </dl>
4638
4638
  </details>
4639
4639
 
4640
- <details><summary><code>client.contacts.<a href="/src/api/resources/contacts/client/Client.ts">createContact</a>({ ...params }) -> Brevo.CreateContactResponse</code></summary>
4640
+ <details><summary><code>client.contacts.<a href="/src/api/resources/contacts/client/Client.ts">createContact</a>({ ...params }) -> Brevo.CreateContactResponse | undefined</code></summary>
4641
4641
  <dl>
4642
4642
  <dd>
4643
4643
 
@@ -6915,7 +6915,7 @@ await client.ecommerce.getCategories();
6915
6915
  </dl>
6916
6916
  </details>
6917
6917
 
6918
- <details><summary><code>client.ecommerce.<a href="/src/api/resources/ecommerce/client/Client.ts">createUpdateCategory</a>({ ...params }) -> Brevo.CreateUpdateCategoryResponse</code></summary>
6918
+ <details><summary><code>client.ecommerce.<a href="/src/api/resources/ecommerce/client/Client.ts">createUpdateCategory</a>({ ...params }) -> Brevo.CreateUpdateCategoryResponse | undefined</code></summary>
6919
6919
  <dl>
6920
6920
  <dd>
6921
6921
 
@@ -7633,7 +7633,7 @@ await client.ecommerce.getProducts();
7633
7633
  </dl>
7634
7634
  </details>
7635
7635
 
7636
- <details><summary><code>client.ecommerce.<a href="/src/api/resources/ecommerce/client/Client.ts">createUpdateProduct</a>({ ...params }) -> Brevo.CreateUpdateProductResponse</code></summary>
7636
+ <details><summary><code>client.ecommerce.<a href="/src/api/resources/ecommerce/client/Client.ts">createUpdateProduct</a>({ ...params }) -> Brevo.CreateUpdateProductResponse | undefined</code></summary>
7637
7637
  <dl>
7638
7638
  <dd>
7639
7639