nylas 7.5.0 → 7.5.2

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.
@@ -68,7 +68,6 @@ class APIClient {
68
68
  const controller = new AbortController();
69
69
  const timeout = setTimeout(() => {
70
70
  controller.abort();
71
- throw new error_js_1.NylasSdkTimeoutError(req.url, this.timeout);
72
71
  }, this.timeout);
73
72
  try {
74
73
  const response = await (0, node_fetch_1.default)(req, { signal: controller.signal });
@@ -100,6 +99,9 @@ class APIClient {
100
99
  return response;
101
100
  }
102
101
  catch (error) {
102
+ if (error instanceof Error && error.name === 'AbortError') {
103
+ throw new error_js_1.NylasSdkTimeoutError(req.url, this.timeout);
104
+ }
103
105
  clearTimeout(timeout);
104
106
  throw error;
105
107
  }
@@ -110,7 +112,8 @@ class APIClient {
110
112
  requestOptions.headers = this.setRequestHeaders(optionParams);
111
113
  requestOptions.method = optionParams.method;
112
114
  if (optionParams.body) {
113
- requestOptions.body = JSON.stringify((0, utils_js_1.objKeysToSnakeCase)(optionParams.body));
115
+ requestOptions.body = JSON.stringify((0, utils_js_1.objKeysToSnakeCase)(optionParams.body, ['metadata']) // metadata should remain as is
116
+ );
114
117
  requestOptions.headers['Content-Type'] = 'application/json';
115
118
  }
116
119
  if (optionParams.form) {
@@ -134,7 +137,7 @@ class APIClient {
134
137
  const text = await response.text();
135
138
  try {
136
139
  const responseJSON = JSON.parse(text);
137
- return (0, utils_js_1.objKeysToCamelCase)(responseJSON);
140
+ return (0, utils_js_1.objKeysToCamelCase)(responseJSON, ['metadata']);
138
141
  }
139
142
  catch (e) {
140
143
  throw new Error(`Could not parse response from the server: ${text}`);
@@ -8,4 +8,5 @@ var AvailabilityMethod;
8
8
  (function (AvailabilityMethod) {
9
9
  AvailabilityMethod["MaxFairness"] = "max-fairness";
10
10
  AvailabilityMethod["MaxAvailability"] = "max-availability";
11
+ AvailabilityMethod["Collective"] = "collective";
11
12
  })(AvailabilityMethod = exports.AvailabilityMethod || (exports.AvailabilityMethod = {}));
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
4
  // This file is generated by scripts/exportVersion.js
5
- exports.SDK_VERSION = '7.5.0';
5
+ exports.SDK_VERSION = '7.5.2';
@@ -66,7 +66,6 @@ export default class APIClient {
66
66
  const controller = new AbortController();
67
67
  const timeout = setTimeout(() => {
68
68
  controller.abort();
69
- throw new NylasSdkTimeoutError(req.url, this.timeout);
70
69
  }, this.timeout);
71
70
  try {
72
71
  const response = await fetch(req, { signal: controller.signal });
@@ -98,6 +97,9 @@ export default class APIClient {
98
97
  return response;
99
98
  }
100
99
  catch (error) {
100
+ if (error instanceof Error && error.name === 'AbortError') {
101
+ throw new NylasSdkTimeoutError(req.url, this.timeout);
102
+ }
101
103
  clearTimeout(timeout);
102
104
  throw error;
103
105
  }
@@ -108,7 +110,8 @@ export default class APIClient {
108
110
  requestOptions.headers = this.setRequestHeaders(optionParams);
109
111
  requestOptions.method = optionParams.method;
110
112
  if (optionParams.body) {
111
- requestOptions.body = JSON.stringify(objKeysToSnakeCase(optionParams.body));
113
+ requestOptions.body = JSON.stringify(objKeysToSnakeCase(optionParams.body, ['metadata']) // metadata should remain as is
114
+ );
112
115
  requestOptions.headers['Content-Type'] = 'application/json';
113
116
  }
114
117
  if (optionParams.form) {
@@ -132,7 +135,7 @@ export default class APIClient {
132
135
  const text = await response.text();
133
136
  try {
134
137
  const responseJSON = JSON.parse(text);
135
- return objKeysToCamelCase(responseJSON);
138
+ return objKeysToCamelCase(responseJSON, ['metadata']);
136
139
  }
137
140
  catch (e) {
138
141
  throw new Error(`Could not parse response from the server: ${text}`);
@@ -5,4 +5,5 @@ export var AvailabilityMethod;
5
5
  (function (AvailabilityMethod) {
6
6
  AvailabilityMethod["MaxFairness"] = "max-fairness";
7
7
  AvailabilityMethod["MaxAvailability"] = "max-availability";
8
+ AvailabilityMethod["Collective"] = "collective";
8
9
  })(AvailabilityMethod || (AvailabilityMethod = {}));
@@ -1,2 +1,2 @@
1
1
  // This file is generated by scripts/exportVersion.js
2
- export const SDK_VERSION = '7.5.0';
2
+ export const SDK_VERSION = '7.5.2';
@@ -163,5 +163,6 @@ export interface AvailabilityParticipant {
163
163
  */
164
164
  export declare enum AvailabilityMethod {
165
165
  MaxFairness = "max-fairness",
166
- MaxAvailability = "max-availability"
166
+ MaxAvailability = "max-availability",
167
+ Collective = "collective"
167
168
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "7.5.0";
1
+ export declare const SDK_VERSION = "7.5.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "7.5.0",
3
+ "version": "7.5.2",
4
4
  "description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.",
5
5
  "main": "lib/cjs/nylas.js",
6
6
  "types": "lib/types/nylas.d.ts",