nylas 7.0.0 → 7.1.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.
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // This file is generated by scripts/generateModelIndex.js
18
+ __exportStar(require("./applicationDetails.js"), exports);
19
+ __exportStar(require("./attachments.js"), exports);
20
+ __exportStar(require("./auth.js"), exports);
21
+ __exportStar(require("./availability.js"), exports);
22
+ __exportStar(require("./calendars.js"), exports);
23
+ __exportStar(require("./connectors.js"), exports);
24
+ __exportStar(require("./contacts.js"), exports);
25
+ __exportStar(require("./credentials.js"), exports);
26
+ __exportStar(require("./drafts.js"), exports);
27
+ __exportStar(require("./error.js"), exports);
28
+ __exportStar(require("./events.js"), exports);
29
+ __exportStar(require("./folders.js"), exports);
30
+ __exportStar(require("./freeBusy.js"), exports);
31
+ __exportStar(require("./grants.js"), exports);
32
+ __exportStar(require("./listQueryParams.js"), exports);
33
+ __exportStar(require("./messages.js"), exports);
34
+ __exportStar(require("./redirectUri.js"), exports);
35
+ __exportStar(require("./response.js"), exports);
36
+ __exportStar(require("./smartCompose.js"), exports);
37
+ __exportStar(require("./threads.js"), exports);
38
+ __exportStar(require("./webhooks.js"), exports);
package/lib/cjs/nylas.js CHANGED
@@ -1,5 +1,20 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./models/index.js"), exports);
3
18
  const apiClient_js_1 = require("./apiClient.js");
4
19
  const config_js_1 = require("./config.js");
5
20
  const calendars_js_1 = require("./resources/calendars.js");
@@ -122,6 +122,22 @@ class Auth extends resource_js_1.Resource {
122
122
  queryParams: params,
123
123
  });
124
124
  }
125
+ /**
126
+ * Get info about an ID token
127
+ * @param idToken The ID token to query.
128
+ * @return The token information
129
+ */
130
+ idTokenInfo(idToken) {
131
+ return this.getTokenInfo({ id_token: idToken });
132
+ }
133
+ /**
134
+ * Get info about an access token
135
+ * @param accessToken The access token to query.
136
+ * @return The token information
137
+ */
138
+ accessTokenInfo(accessToken) {
139
+ return this.getTokenInfo({ access_token: accessToken });
140
+ }
125
141
  urlAuthBuilder(config) {
126
142
  const url = new URL(`${this.apiClient.serverUrl}/v3/connect/auth`);
127
143
  url.searchParams.set('client_id', config.clientId);
@@ -156,5 +172,12 @@ class Auth extends resource_js_1.Resource {
156
172
  .toString('base64')
157
173
  .replace(/=+$/, '');
158
174
  }
175
+ getTokenInfo(params) {
176
+ return this.apiClient.request({
177
+ method: 'GET',
178
+ path: `/v3/connect/tokeninfo`,
179
+ queryParams: params,
180
+ });
181
+ }
159
182
  }
160
183
  exports.Auth = Auth;
@@ -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.0.0';
5
+ exports.SDK_VERSION = '7.1.0';
@@ -0,0 +1,22 @@
1
+ // This file is generated by scripts/generateModelIndex.js
2
+ export * from './applicationDetails.js';
3
+ export * from './attachments.js';
4
+ export * from './auth.js';
5
+ export * from './availability.js';
6
+ export * from './calendars.js';
7
+ export * from './connectors.js';
8
+ export * from './contacts.js';
9
+ export * from './credentials.js';
10
+ export * from './drafts.js';
11
+ export * from './error.js';
12
+ export * from './events.js';
13
+ export * from './folders.js';
14
+ export * from './freeBusy.js';
15
+ export * from './grants.js';
16
+ export * from './listQueryParams.js';
17
+ export * from './messages.js';
18
+ export * from './redirectUri.js';
19
+ export * from './response.js';
20
+ export * from './smartCompose.js';
21
+ export * from './threads.js';
22
+ export * from './webhooks.js';
package/lib/esm/nylas.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './models/index.js';
1
2
  import APIClient from './apiClient.js';
2
3
  import { DEFAULT_SERVER_URL } from './config.js';
3
4
  import { Calendars } from './resources/calendars.js';
@@ -119,6 +119,22 @@ export class Auth extends Resource {
119
119
  queryParams: params,
120
120
  });
121
121
  }
122
+ /**
123
+ * Get info about an ID token
124
+ * @param idToken The ID token to query.
125
+ * @return The token information
126
+ */
127
+ idTokenInfo(idToken) {
128
+ return this.getTokenInfo({ id_token: idToken });
129
+ }
130
+ /**
131
+ * Get info about an access token
132
+ * @param accessToken The access token to query.
133
+ * @return The token information
134
+ */
135
+ accessTokenInfo(accessToken) {
136
+ return this.getTokenInfo({ access_token: accessToken });
137
+ }
122
138
  urlAuthBuilder(config) {
123
139
  const url = new URL(`${this.apiClient.serverUrl}/v3/connect/auth`);
124
140
  url.searchParams.set('client_id', config.clientId);
@@ -153,4 +169,11 @@ export class Auth extends Resource {
153
169
  .toString('base64')
154
170
  .replace(/=+$/, '');
155
171
  }
172
+ getTokenInfo(params) {
173
+ return this.apiClient.request({
174
+ method: 'GET',
175
+ path: `/v3/connect/tokeninfo`,
176
+ queryParams: params,
177
+ });
178
+ }
156
179
  }
@@ -1,2 +1,2 @@
1
1
  // This file is generated by scripts/exportVersion.js
2
- export const SDK_VERSION = '7.0.0';
2
+ export const SDK_VERSION = '7.1.0';
@@ -197,4 +197,33 @@ export interface ProviderDetectResponse {
197
197
  */
198
198
  type?: string;
199
199
  }
200
+ /**
201
+ * Interface representing a Nylas token information response.
202
+ */
203
+ export interface TokenInfoResponse {
204
+ /**
205
+ * The issuer of the token.
206
+ */
207
+ iss: string;
208
+ /**
209
+ * The token's audience.
210
+ */
211
+ aud: string;
212
+ /**
213
+ * The time that the token was issued.
214
+ */
215
+ iat: number;
216
+ /**
217
+ * The time that the token expires.
218
+ */
219
+ exp: number;
220
+ /**
221
+ * The token's subject.
222
+ */
223
+ sub?: string;
224
+ /**
225
+ * The email address of the Grant belonging to the user's token.
226
+ */
227
+ email?: string;
228
+ }
200
229
  export {};
@@ -28,14 +28,6 @@ export interface Event {
28
28
  * If the event participants are able to edit the event.
29
29
  */
30
30
  readOnly: boolean;
31
- /**
32
- * Unix timestamp when the event was created.
33
- */
34
- createdAt: number;
35
- /**
36
- * Unix timestamp when the event was last updated.
37
- */
38
- updatedAt: number;
39
31
  /**
40
32
  * List of participants invited to the event. Participants may also be rooms or resources.
41
33
  */
@@ -109,6 +101,14 @@ export interface Event {
109
101
  * Status of the event.
110
102
  */
111
103
  status?: Status;
104
+ /**
105
+ * Unix timestamp when the event was created.
106
+ */
107
+ createdAt?: number;
108
+ /**
109
+ * Unix timestamp when the event was last updated.
110
+ */
111
+ updatedAt?: number;
112
112
  }
113
113
  /**
114
114
  * Interface representing a request to create an event.
@@ -0,0 +1,21 @@
1
+ export * from './applicationDetails.js';
2
+ export * from './attachments.js';
3
+ export * from './auth.js';
4
+ export * from './availability.js';
5
+ export * from './calendars.js';
6
+ export * from './connectors.js';
7
+ export * from './contacts.js';
8
+ export * from './credentials.js';
9
+ export * from './drafts.js';
10
+ export * from './error.js';
11
+ export * from './events.js';
12
+ export * from './folders.js';
13
+ export * from './freeBusy.js';
14
+ export * from './grants.js';
15
+ export * from './listQueryParams.js';
16
+ export * from './messages.js';
17
+ export * from './redirectUri.js';
18
+ export * from './response.js';
19
+ export * from './smartCompose.js';
20
+ export * from './threads.js';
21
+ export * from './webhooks.js';
@@ -13,11 +13,11 @@ export interface Webhook {
13
13
  /**
14
14
  * The url to send webhooks to.
15
15
  */
16
- callbackUrl: string;
16
+ webhookUrl: string;
17
17
  /**
18
18
  * The status of the new destination.
19
19
  */
20
- status: 'active' | 'failing' | 'failed' | 'pause';
20
+ status: WebhookStatus;
21
21
  /**
22
22
  * The time the status field was last updated, represented as a Unix timestamp in seconds.
23
23
  */
@@ -37,7 +37,7 @@ export interface Webhook {
37
37
  /**
38
38
  * The email addresses that Nylas notifies when a webhook is down for a while.
39
39
  */
40
- notificationEmailAddress?: string;
40
+ notificationEmailAddresses?: string[];
41
41
  }
42
42
  /**
43
43
  * Class representing a Nylas webhook with secret.
@@ -90,7 +90,7 @@ export interface CreateWebhookRequest {
90
90
  /**
91
91
  * The url to send webhooks to.
92
92
  */
93
- callbackUrl: string;
93
+ webhookUrl: string;
94
94
  /**
95
95
  * A human-readable description of the webhook destination.
96
96
  */
@@ -98,7 +98,7 @@ export interface CreateWebhookRequest {
98
98
  /**
99
99
  * The email addresses that Nylas notifies when a webhook is down for a while.
100
100
  */
101
- notificationEmailAddress?: string;
101
+ notificationEmailAddresses?: string[];
102
102
  }
103
103
  /**
104
104
  * Class representation of a Nylas update webhook request.
@@ -121,3 +121,7 @@ export declare enum WebhookTriggers {
121
121
  MessageSendSuccess = "message.send_success",
122
122
  MessageSendFailed = "message.send_failed"
123
123
  }
124
+ /**
125
+ * Enum representing the available webhook statuses.
126
+ */
127
+ export type WebhookStatus = 'active' | 'failing' | 'failed' | 'pause';
@@ -1,3 +1,4 @@
1
+ export * from './models/index.js';
1
2
  import APIClient from './apiClient.js';
2
3
  import { NylasConfig } from './config.js';
3
4
  import { Calendars } from './resources/calendars.js';
@@ -1,5 +1,5 @@
1
1
  import { Resource } from './resource.js';
2
- import { URLForAdminConsentConfig, URLForAuthenticationConfig, CodeExchangeRequest, PKCEAuthURL, TokenExchangeRequest, CodeExchangeResponse, ProviderDetectParams, ProviderDetectResponse } from '../models/auth.js';
2
+ import { URLForAdminConsentConfig, URLForAuthenticationConfig, CodeExchangeRequest, PKCEAuthURL, TokenExchangeRequest, CodeExchangeResponse, ProviderDetectParams, ProviderDetectResponse, TokenInfoResponse } from '../models/auth.js';
3
3
  import { Overrides } from '../config.js';
4
4
  import { NylasResponse } from '../models/response.js';
5
5
  import { CreateGrantRequest, Grant } from '../models/grants.js';
@@ -64,7 +64,20 @@ export declare class Auth extends Resource {
64
64
  * @return The detected provider, if found
65
65
  */
66
66
  detectProvider(params: ProviderDetectParams): Promise<NylasResponse<ProviderDetectResponse>>;
67
+ /**
68
+ * Get info about an ID token
69
+ * @param idToken The ID token to query.
70
+ * @return The token information
71
+ */
72
+ idTokenInfo(idToken: string): Promise<NylasResponse<TokenInfoResponse>>;
73
+ /**
74
+ * Get info about an access token
75
+ * @param accessToken The access token to query.
76
+ * @return The token information
77
+ */
78
+ accessTokenInfo(accessToken: string): Promise<NylasResponse<TokenInfoResponse>>;
67
79
  private urlAuthBuilder;
68
80
  private hashPKCESecret;
81
+ private getTokenInfo;
69
82
  }
70
83
  export {};
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "7.0.0";
1
+ export declare const SDK_VERSION = "7.1.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "7.0.0",
3
+ "version": "7.1.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",
@@ -21,7 +21,8 @@
21
21
  "lint:prettier:check": "prettier --check '**/*.{ts,js}'",
22
22
  "export-version": "node scripts/exportVersion.js",
23
23
  "generate-lib-package-json": "node scripts/generateLibPackageJson.js",
24
- "prebuild": "npm run export-version",
24
+ "generate-model-index": "node scripts/generateModelIndex.js",
25
+ "prebuild": "npm run export-version && npm run generate-model-index",
25
26
  "build": "rm -rf lib && npm run build-esm && npm run build-cjs && npm run generate-lib-package-json",
26
27
  "build-esm": "tsc -p tsconfig.esm.json",
27
28
  "build-cjs": "tsc -p tsconfig.cjs.json",