nylas 7.12.0 → 7.13.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.
@@ -174,11 +174,19 @@ class APIClient {
174
174
  const flowId = headers[exports.FLOW_ID_HEADER];
175
175
  const text = await response.text();
176
176
  try {
177
- const responseJSON = JSON.parse(text);
178
- // Inject the flow ID and headers into the response
179
- responseJSON.flowId = flowId;
180
- responseJSON.headers = headers;
181
- return (0, utils_js_1.objKeysToCamelCase)(responseJSON, ['metadata']);
177
+ const parsed = JSON.parse(text);
178
+ const payload = (0, utils_js_1.objKeysToCamelCase)({
179
+ ...parsed,
180
+ flowId,
181
+ // deprecated: headers will be removed in a future release. This is for backwards compatibility.
182
+ headers,
183
+ }, ['metadata']);
184
+ // Attach rawHeaders as a non-enumerable property to avoid breaking deep equality
185
+ Object.defineProperty(payload, 'rawHeaders', {
186
+ value: headers,
187
+ enumerable: false,
188
+ });
189
+ return payload;
182
190
  }
183
191
  catch (e) {
184
192
  throw new Error(`Could not parse response from the server: ${text}`);
@@ -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.12.0';
5
+ exports.SDK_VERSION = '7.13.0';
@@ -171,11 +171,19 @@ export default class APIClient {
171
171
  const flowId = headers[FLOW_ID_HEADER];
172
172
  const text = await response.text();
173
173
  try {
174
- const responseJSON = JSON.parse(text);
175
- // Inject the flow ID and headers into the response
176
- responseJSON.flowId = flowId;
177
- responseJSON.headers = headers;
178
- return objKeysToCamelCase(responseJSON, ['metadata']);
174
+ const parsed = JSON.parse(text);
175
+ const payload = objKeysToCamelCase({
176
+ ...parsed,
177
+ flowId,
178
+ // deprecated: headers will be removed in a future release. This is for backwards compatibility.
179
+ headers,
180
+ }, ['metadata']);
181
+ // Attach rawHeaders as a non-enumerable property to avoid breaking deep equality
182
+ Object.defineProperty(payload, 'rawHeaders', {
183
+ value: headers,
184
+ enumerable: false,
185
+ });
186
+ return payload;
179
187
  }
180
188
  catch (e) {
181
189
  throw new Error(`Could not parse response from the server: ${text}`);
@@ -1,2 +1,2 @@
1
1
  // This file is generated by scripts/exportVersion.js
2
- export const SDK_VERSION = '7.12.0';
2
+ export const SDK_VERSION = '7.13.0';
@@ -69,6 +69,11 @@ export interface CreateDraftRequest {
69
69
  * An array of custom headers to add to the message.
70
70
  */
71
71
  customHeaders?: CustomHeader[];
72
+ /**
73
+ * When true, the message body is sent as plain text and the MIME data doesn't include the HTML version of the message.
74
+ * When false, the message body is sent as HTML. Defaults to false.
75
+ */
76
+ isPlaintext?: boolean;
72
77
  }
73
78
  /**
74
79
  * Interface representing a request to send a message.
@@ -96,7 +101,7 @@ export interface Draft extends BaseMessage, Omit<CreateDraftRequest, 'attachment
96
101
  /**
97
102
  * Interface representing a request to update a draft.
98
103
  */
99
- export type UpdateDraftRequest = Partial<CreateDraftRequest> & {
104
+ export type UpdateDraftRequest = Omit<Partial<CreateDraftRequest>, 'isPlaintext'> & {
100
105
  /**
101
106
  * Return drafts that are unread.
102
107
  */
@@ -3,6 +3,20 @@
3
3
  */
4
4
  export interface NylasBaseResponse {
5
5
  requestId: string;
6
+ /**
7
+ * The flow ID
8
+ * Provide this to Nylas support to help trace requests and responses
9
+ */
10
+ flowId?: string;
11
+ /**
12
+ * The response headers with camelCased keys (backwards compatible)
13
+ * @deprecated Use rawHeaders instead
14
+ */
15
+ headers?: Record<string, string>;
16
+ /**
17
+ * The raw response headers with original dashed lowercase keys
18
+ */
19
+ rawHeaders?: Record<string, string>;
6
20
  }
7
21
  /**
8
22
  * Interface representation of a Nylas response object
@@ -23,8 +37,13 @@ export interface NylasResponse<T> {
23
37
  flowId?: string;
24
38
  /**
25
39
  * The response headers
40
+ * @deprecated Use rawHeaders instead
26
41
  */
27
42
  headers?: Record<string, string>;
43
+ /**
44
+ * The raw response headers with original dashed lowercase keys
45
+ */
46
+ rawHeaders?: Record<string, string>;
28
47
  }
29
48
  /**
30
49
  * Interface representation of a Nylas response object that contains a list of objects.
@@ -42,6 +61,20 @@ export interface NylasListResponse<T> {
42
61
  * The cursor to use to get the next page of data.
43
62
  */
44
63
  nextCursor?: string;
64
+ /**
65
+ * The flow ID
66
+ * Provide this to Nylas support to help trace requests and responses
67
+ */
68
+ flowId?: string;
69
+ /**
70
+ * The response headers with camelCased keys (backwards compatible)
71
+ * @deprecated Use rawHeaders instead
72
+ */
73
+ headers?: Record<string, string>;
74
+ /**
75
+ * The raw response headers with original dashed lowercase keys
76
+ */
77
+ rawHeaders?: Record<string, string>;
45
78
  }
46
79
  /**
47
80
  * Helper type for pagination
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "7.12.0";
1
+ export declare const SDK_VERSION = "7.13.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "7.12.0",
3
+ "version": "7.13.0",
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",