nylas 7.7.2 → 7.7.3

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.
@@ -34,7 +34,9 @@ class APIClient {
34
34
  url.searchParams.set('metadata_pair', metadataPair.join(','));
35
35
  }
36
36
  else if (Array.isArray(value)) {
37
- url.searchParams.append(snakeCaseKey, value.join(','));
37
+ for (const item of value) {
38
+ url.searchParams.append(snakeCaseKey, item);
39
+ }
38
40
  }
39
41
  else if (typeof value === 'object') {
40
42
  for (const item in value) {
@@ -64,11 +66,14 @@ class APIClient {
64
66
  async sendRequest(options) {
65
67
  const req = this.newRequest(options);
66
68
  const controller = new AbortController();
69
+ const timeoutDuration = options.overrides?.timeout || this.timeout;
67
70
  const timeout = setTimeout(() => {
68
71
  controller.abort();
69
- }, this.timeout);
72
+ }, timeoutDuration);
70
73
  try {
71
- const response = await (0, node_fetch_1.default)(req, { signal: controller.signal });
74
+ const response = await (0, node_fetch_1.default)(req, {
75
+ signal: controller.signal,
76
+ });
72
77
  clearTimeout(timeout);
73
78
  if (typeof response === 'undefined') {
74
79
  throw new Error('Failed to fetch response');
@@ -13,8 +13,18 @@ class Threads extends resource_js_1.Resource {
13
13
  * @return A list of threads
14
14
  */
15
15
  list({ identifier, queryParams, overrides, }) {
16
+ const modifiedQueryParams = queryParams
17
+ ? { ...queryParams }
18
+ : undefined;
19
+ // Transform some query params that are arrays into comma-delimited strings
20
+ if (modifiedQueryParams && queryParams) {
21
+ if (Array.isArray(queryParams?.anyEmail)) {
22
+ delete modifiedQueryParams.anyEmail;
23
+ modifiedQueryParams['any_email'] = queryParams.anyEmail.join(',');
24
+ }
25
+ }
16
26
  return super._list({
17
- queryParams,
27
+ queryParams: modifiedQueryParams,
18
28
  overrides,
19
29
  path: `/v3/grants/${identifier}/threads`,
20
30
  });
@@ -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.7.2';
5
+ exports.SDK_VERSION = '7.7.3';
@@ -32,7 +32,9 @@ export default class APIClient {
32
32
  url.searchParams.set('metadata_pair', metadataPair.join(','));
33
33
  }
34
34
  else if (Array.isArray(value)) {
35
- url.searchParams.append(snakeCaseKey, value.join(','));
35
+ for (const item of value) {
36
+ url.searchParams.append(snakeCaseKey, item);
37
+ }
36
38
  }
37
39
  else if (typeof value === 'object') {
38
40
  for (const item in value) {
@@ -62,11 +64,14 @@ export default class APIClient {
62
64
  async sendRequest(options) {
63
65
  const req = this.newRequest(options);
64
66
  const controller = new AbortController();
67
+ const timeoutDuration = options.overrides?.timeout || this.timeout;
65
68
  const timeout = setTimeout(() => {
66
69
  controller.abort();
67
- }, this.timeout);
70
+ }, timeoutDuration);
68
71
  try {
69
- const response = await fetch(req, { signal: controller.signal });
72
+ const response = await fetch(req, {
73
+ signal: controller.signal,
74
+ });
70
75
  clearTimeout(timeout);
71
76
  if (typeof response === 'undefined') {
72
77
  throw new Error('Failed to fetch response');
@@ -10,8 +10,18 @@ export class Threads extends Resource {
10
10
  * @return A list of threads
11
11
  */
12
12
  list({ identifier, queryParams, overrides, }) {
13
+ const modifiedQueryParams = queryParams
14
+ ? { ...queryParams }
15
+ : undefined;
16
+ // Transform some query params that are arrays into comma-delimited strings
17
+ if (modifiedQueryParams && queryParams) {
18
+ if (Array.isArray(queryParams?.anyEmail)) {
19
+ delete modifiedQueryParams.anyEmail;
20
+ modifiedQueryParams['any_email'] = queryParams.anyEmail.join(',');
21
+ }
22
+ }
13
23
  return super._list({
14
- queryParams,
24
+ queryParams: modifiedQueryParams,
15
25
  overrides,
16
26
  path: `/v3/grants/${identifier}/threads`,
17
27
  });
@@ -1,2 +1,2 @@
1
1
  // This file is generated by scripts/exportVersion.js
2
- export const SDK_VERSION = '7.7.2';
2
+ export const SDK_VERSION = '7.7.3';
@@ -1,6 +1,6 @@
1
+ import { Attachment } from './attachments.js';
1
2
  import { EmailName } from './events.js';
2
3
  import { ListQueryParams } from './listQueryParams.js';
3
- import { Attachment } from './attachments.js';
4
4
  /**
5
5
  * @internal Internal interface for a message.
6
6
  */
@@ -18,10 +18,6 @@ export interface BaseMessage {
18
18
  * This may be different from the unverified Date header in raw message object.
19
19
  */
20
20
  date: number;
21
- /**
22
- * Unix timestamp of when the message was created.
23
- */
24
- createdAt: number;
25
21
  /**
26
22
  * The ID of the folder(s) the message appears in.
27
23
  */
@@ -1,7 +1,7 @@
1
- import { Message } from './messages.js';
2
1
  import { Draft } from './drafts.js';
3
2
  import { EmailName } from './events.js';
4
3
  import { ListQueryParams } from './listQueryParams.js';
4
+ import { Message } from './messages.js';
5
5
  /**
6
6
  * Interface representing a Nylas thread object.
7
7
  */
@@ -41,11 +41,11 @@ export interface Thread {
41
41
  /**
42
42
  * Unix timestamp of the most recent message received in the thread.
43
43
  */
44
- latestMessageReceivedDate: number;
44
+ latestMessageReceivedDate?: number;
45
45
  /**
46
46
  * Unix timestamp of the most recent message sent in the thread.
47
47
  */
48
- latestMessageSentDate: number;
48
+ latestMessageSentDate?: number;
49
49
  /**
50
50
  * An array of participants in the thread.
51
51
  */
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "7.7.2";
1
+ export declare const SDK_VERSION = "7.7.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "7.7.2",
3
+ "version": "7.7.3",
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",