nylas 7.7.1 → 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.
- package/lib/cjs/apiClient.js +8 -3
- package/lib/cjs/resources/credentials.js +5 -5
- package/lib/cjs/resources/threads.js +11 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/apiClient.js +8 -3
- package/lib/esm/resources/credentials.js +5 -5
- package/lib/esm/resources/threads.js +11 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/models/messages.d.ts +1 -5
- package/lib/types/models/threads.d.ts +3 -3
- package/lib/types/resources/credentials.d.ts +3 -3
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/apiClient.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
},
|
|
72
|
+
}, timeoutDuration);
|
|
70
73
|
try {
|
|
71
|
-
const response = await (0, node_fetch_1.default)(req, {
|
|
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');
|
|
@@ -11,7 +11,7 @@ class Credentials extends resource_js_1.Resource {
|
|
|
11
11
|
return super._list({
|
|
12
12
|
queryParams,
|
|
13
13
|
overrides,
|
|
14
|
-
path: `/v3/
|
|
14
|
+
path: `/v3/connectors/${provider}/creds`,
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -20,7 +20,7 @@ class Credentials extends resource_js_1.Resource {
|
|
|
20
20
|
*/
|
|
21
21
|
find({ provider, credentialsId, overrides, }) {
|
|
22
22
|
return super._find({
|
|
23
|
-
path: `/v3/
|
|
23
|
+
path: `/v3/connectors/${provider}/creds/${credentialsId}`,
|
|
24
24
|
overrides,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -30,7 +30,7 @@ class Credentials extends resource_js_1.Resource {
|
|
|
30
30
|
*/
|
|
31
31
|
create({ provider, requestBody, overrides, }) {
|
|
32
32
|
return super._create({
|
|
33
|
-
path: `/v3/
|
|
33
|
+
path: `/v3/connectors/${provider}/creds`,
|
|
34
34
|
requestBody,
|
|
35
35
|
overrides,
|
|
36
36
|
});
|
|
@@ -41,7 +41,7 @@ class Credentials extends resource_js_1.Resource {
|
|
|
41
41
|
*/
|
|
42
42
|
update({ provider, credentialsId, requestBody, overrides, }) {
|
|
43
43
|
return super._update({
|
|
44
|
-
path: `/v3/
|
|
44
|
+
path: `/v3/connectors/${provider}/creds/${credentialsId}`,
|
|
45
45
|
requestBody,
|
|
46
46
|
overrides,
|
|
47
47
|
});
|
|
@@ -52,7 +52,7 @@ class Credentials extends resource_js_1.Resource {
|
|
|
52
52
|
*/
|
|
53
53
|
destroy({ provider, credentialsId, overrides, }) {
|
|
54
54
|
return super._destroy({
|
|
55
|
-
path: `/v3/
|
|
55
|
+
path: `/v3/connectors/${provider}/creds/${credentialsId}`,
|
|
56
56
|
overrides,
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -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
|
});
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/apiClient.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
},
|
|
70
|
+
}, timeoutDuration);
|
|
68
71
|
try {
|
|
69
|
-
const response = await fetch(req, {
|
|
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');
|
|
@@ -8,7 +8,7 @@ export class Credentials extends Resource {
|
|
|
8
8
|
return super._list({
|
|
9
9
|
queryParams,
|
|
10
10
|
overrides,
|
|
11
|
-
path: `/v3/
|
|
11
|
+
path: `/v3/connectors/${provider}/creds`,
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -17,7 +17,7 @@ export class Credentials extends Resource {
|
|
|
17
17
|
*/
|
|
18
18
|
find({ provider, credentialsId, overrides, }) {
|
|
19
19
|
return super._find({
|
|
20
|
-
path: `/v3/
|
|
20
|
+
path: `/v3/connectors/${provider}/creds/${credentialsId}`,
|
|
21
21
|
overrides,
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -27,7 +27,7 @@ export class Credentials extends Resource {
|
|
|
27
27
|
*/
|
|
28
28
|
create({ provider, requestBody, overrides, }) {
|
|
29
29
|
return super._create({
|
|
30
|
-
path: `/v3/
|
|
30
|
+
path: `/v3/connectors/${provider}/creds`,
|
|
31
31
|
requestBody,
|
|
32
32
|
overrides,
|
|
33
33
|
});
|
|
@@ -38,7 +38,7 @@ export class Credentials extends Resource {
|
|
|
38
38
|
*/
|
|
39
39
|
update({ provider, credentialsId, requestBody, overrides, }) {
|
|
40
40
|
return super._update({
|
|
41
|
-
path: `/v3/
|
|
41
|
+
path: `/v3/connectors/${provider}/creds/${credentialsId}`,
|
|
42
42
|
requestBody,
|
|
43
43
|
overrides,
|
|
44
44
|
});
|
|
@@ -49,7 +49,7 @@ export class Credentials extends Resource {
|
|
|
49
49
|
*/
|
|
50
50
|
destroy({ provider, credentialsId, overrides, }) {
|
|
51
51
|
return super._destroy({
|
|
52
|
-
path: `/v3/
|
|
52
|
+
path: `/v3/connectors/${provider}/creds/${credentialsId}`,
|
|
53
53
|
overrides,
|
|
54
54
|
});
|
|
55
55
|
}
|
|
@@ -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
|
});
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is generated by scripts/exportVersion.js
|
|
2
|
-
export const SDK_VERSION = '7.7.
|
|
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
|
|
44
|
+
latestMessageReceivedDate?: number;
|
|
45
45
|
/**
|
|
46
46
|
* Unix timestamp of the most recent message sent in the thread.
|
|
47
47
|
*/
|
|
48
|
-
latestMessageSentDate
|
|
48
|
+
latestMessageSentDate?: number;
|
|
49
49
|
/**
|
|
50
50
|
* An array of participants in the thread.
|
|
51
51
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AsyncListResponse, Resource } from './resource.js';
|
|
2
|
-
import { Credential, CreateCredentialRequest, ListCredentialsQueryParams, UpdateCredentialRequest } from '../models/credentials.js';
|
|
3
1
|
import { Overrides } from '../config.js';
|
|
4
|
-
import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
|
|
5
2
|
import { Provider } from '../models/auth.js';
|
|
3
|
+
import { CreateCredentialRequest, Credential, ListCredentialsQueryParams, UpdateCredentialRequest } from '../models/credentials.js';
|
|
4
|
+
import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
|
|
5
|
+
import { AsyncListResponse, Resource } from './resource.js';
|
|
6
6
|
/**
|
|
7
7
|
* The parameters for the {@link Credentials.find} method
|
|
8
8
|
* @property provider The provider associated to the credential to retrieve.
|
package/lib/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "7.7.
|
|
1
|
+
export declare const SDK_VERSION = "7.7.3";
|