nylas 7.0.0-beta.0 → 7.0.0-beta.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.
Files changed (204) hide show
  1. package/README.md +27 -19
  2. package/lib/cjs/apiClient.js +114 -0
  3. package/lib/cjs/config.js +32 -0
  4. package/lib/cjs/models/applicationDetails.js +2 -0
  5. package/lib/cjs/models/auth.js +2 -0
  6. package/lib/cjs/models/availability.js +11 -0
  7. package/lib/cjs/models/calendars.js +2 -0
  8. package/lib/cjs/models/error.js +53 -0
  9. package/lib/cjs/models/events.js +2 -0
  10. package/lib/cjs/models/grants.js +2 -0
  11. package/lib/cjs/models/listQueryParams.js +2 -0
  12. package/lib/cjs/models/redirectUri.js +2 -0
  13. package/lib/cjs/models/response.js +2 -0
  14. package/lib/cjs/models/webhooks.js +18 -0
  15. package/lib/cjs/nylas.js +34 -0
  16. package/lib/cjs/package.json +3 -0
  17. package/lib/cjs/resources/applications.js +30 -0
  18. package/lib/cjs/resources/auth.js +153 -0
  19. package/lib/cjs/resources/calendars.js +78 -0
  20. package/lib/cjs/resources/events.js +69 -0
  21. package/lib/cjs/resources/grants.js +65 -0
  22. package/lib/cjs/resources/redirectUris.js +64 -0
  23. package/lib/cjs/resources/resource.js +111 -0
  24. package/lib/cjs/resources/webhooks.js +98 -0
  25. package/lib/cjs/utils.js +58 -0
  26. package/lib/cjs/version.js +5 -0
  27. package/lib/esm/apiClient.js +111 -0
  28. package/lib/esm/config.js +29 -0
  29. package/lib/esm/models/applicationDetails.js +1 -0
  30. package/lib/esm/models/auth.js +1 -0
  31. package/lib/esm/models/availability.js +8 -0
  32. package/lib/esm/models/calendars.js +1 -0
  33. package/lib/esm/models/error.js +45 -0
  34. package/lib/esm/models/events.js +1 -0
  35. package/lib/esm/models/grants.js +1 -0
  36. package/lib/esm/models/listQueryParams.js +1 -0
  37. package/lib/esm/models/redirectUri.js +1 -0
  38. package/lib/esm/models/response.js +1 -0
  39. package/lib/esm/models/webhooks.js +15 -0
  40. package/lib/esm/nylas.js +31 -0
  41. package/lib/esm/package.json +3 -0
  42. package/lib/esm/resources/applications.js +26 -0
  43. package/lib/esm/resources/auth.js +149 -0
  44. package/lib/esm/resources/calendars.js +74 -0
  45. package/lib/esm/resources/events.js +65 -0
  46. package/lib/esm/resources/grants.js +61 -0
  47. package/lib/esm/resources/redirectUris.js +60 -0
  48. package/lib/esm/resources/resource.js +107 -0
  49. package/lib/esm/resources/webhooks.js +94 -0
  50. package/lib/esm/utils.js +53 -0
  51. package/lib/esm/version.js +2 -0
  52. package/lib/types/apiClient.d.ts +65 -0
  53. package/lib/types/config.d.ts +50 -0
  54. package/lib/types/models/applicationDetails.d.ts +93 -0
  55. package/lib/types/models/auth.d.ts +196 -0
  56. package/lib/types/models/availability.d.ts +159 -0
  57. package/lib/types/models/calendars.d.ts +121 -0
  58. package/lib/types/models/error.d.ts +104 -0
  59. package/lib/types/models/events.d.ts +494 -0
  60. package/lib/types/models/grants.d.ts +134 -0
  61. package/lib/types/models/listQueryParams.d.ts +4 -0
  62. package/lib/types/models/redirectUri.d.ts +71 -0
  63. package/lib/types/models/response.d.ts +40 -0
  64. package/lib/types/models/webhooks.d.ts +45 -0
  65. package/lib/types/nylas.d.ts +44 -0
  66. package/lib/types/resources/applications.d.ts +26 -0
  67. package/lib/types/resources/auth.d.ts +66 -0
  68. package/lib/types/resources/calendars.d.ts +97 -0
  69. package/lib/types/resources/events.d.ts +87 -0
  70. package/lib/types/resources/grants.d.ts +63 -0
  71. package/lib/types/resources/redirectUris.d.ts +63 -0
  72. package/lib/types/resources/resource.d.ts +55 -0
  73. package/lib/types/resources/webhooks.d.ts +79 -0
  74. package/lib/types/utils.d.ts +22 -0
  75. package/lib/types/version.d.ts +1 -0
  76. package/package.json +33 -42
  77. package/lib/config.d.ts +0 -70
  78. package/lib/config.js +0 -68
  79. package/lib/models/access-token.d.ts +0 -18
  80. package/lib/models/access-token.js +0 -56
  81. package/lib/models/account.d.ts +0 -27
  82. package/lib/models/account.js +0 -73
  83. package/lib/models/application-details.d.ts +0 -14
  84. package/lib/models/application-details.js +0 -47
  85. package/lib/models/attributes.d.ts +0 -151
  86. package/lib/models/attributes.js +0 -382
  87. package/lib/models/calendar-availability.d.ts +0 -76
  88. package/lib/models/calendar-availability.js +0 -121
  89. package/lib/models/calendar-restful-model-collection.d.ts +0 -17
  90. package/lib/models/calendar-restful-model-collection.js +0 -181
  91. package/lib/models/calendar.d.ts +0 -31
  92. package/lib/models/calendar.js +0 -93
  93. package/lib/models/component-restful-model-collection.d.ts +0 -9
  94. package/lib/models/component-restful-model-collection.js +0 -34
  95. package/lib/models/component.d.ts +0 -37
  96. package/lib/models/component.js +0 -91
  97. package/lib/models/connect.d.ts +0 -73
  98. package/lib/models/connect.js +0 -193
  99. package/lib/models/contact-restful-model-collection.d.ts +0 -9
  100. package/lib/models/contact-restful-model-collection.js +0 -60
  101. package/lib/models/contact.d.ts +0 -129
  102. package/lib/models/contact.js +0 -289
  103. package/lib/models/delta-collection.d.ts +0 -17
  104. package/lib/models/delta-collection.js +0 -139
  105. package/lib/models/delta-stream.d.ts +0 -32
  106. package/lib/models/delta-stream.js +0 -250
  107. package/lib/models/delta.d.ts +0 -28
  108. package/lib/models/delta.js +0 -88
  109. package/lib/models/deltas.d.ts +0 -17
  110. package/lib/models/deltas.js +0 -49
  111. package/lib/models/draft.d.ts +0 -27
  112. package/lib/models/draft.js +0 -156
  113. package/lib/models/email-participant.d.ts +0 -13
  114. package/lib/models/email-participant.js +0 -46
  115. package/lib/models/event-conferencing.d.ts +0 -34
  116. package/lib/models/event-conferencing.js +0 -71
  117. package/lib/models/event-notification.d.ts +0 -27
  118. package/lib/models/event-notification.js +0 -62
  119. package/lib/models/event-participant.d.ts +0 -19
  120. package/lib/models/event-participant.js +0 -56
  121. package/lib/models/event.d.ts +0 -96
  122. package/lib/models/event.js +0 -297
  123. package/lib/models/file.d.ts +0 -29
  124. package/lib/models/file.js +0 -136
  125. package/lib/models/folder.d.ts +0 -21
  126. package/lib/models/folder.js +0 -69
  127. package/lib/models/free-busy.d.ts +0 -58
  128. package/lib/models/free-busy.js +0 -132
  129. package/lib/models/job-status-restful-model-collection.d.ts +0 -9
  130. package/lib/models/job-status-restful-model-collection.js +0 -38
  131. package/lib/models/job-status.d.ts +0 -24
  132. package/lib/models/job-status.js +0 -68
  133. package/lib/models/management-account.d.ts +0 -63
  134. package/lib/models/management-account.js +0 -187
  135. package/lib/models/management-model-collection.d.ts +0 -10
  136. package/lib/models/management-model-collection.js +0 -39
  137. package/lib/models/management-model.d.ts +0 -6
  138. package/lib/models/management-model.js +0 -29
  139. package/lib/models/message-restful-model-collection.d.ts +0 -26
  140. package/lib/models/message-restful-model-collection.js +0 -80
  141. package/lib/models/message.d.ts +0 -57
  142. package/lib/models/message.js +0 -173
  143. package/lib/models/model-collection.d.ts +0 -25
  144. package/lib/models/model-collection.js +0 -201
  145. package/lib/models/model.d.ts +0 -12
  146. package/lib/models/model.js +0 -64
  147. package/lib/models/neural-categorizer.d.ts +0 -28
  148. package/lib/models/neural-categorizer.js +0 -139
  149. package/lib/models/neural-clean-conversation.d.ts +0 -16
  150. package/lib/models/neural-clean-conversation.js +0 -114
  151. package/lib/models/neural-ocr.d.ts +0 -14
  152. package/lib/models/neural-ocr.js +0 -50
  153. package/lib/models/neural-sentiment-analysis.d.ts +0 -20
  154. package/lib/models/neural-sentiment-analysis.js +0 -56
  155. package/lib/models/neural-signature-contact.d.ts +0 -43
  156. package/lib/models/neural-signature-contact.js +0 -142
  157. package/lib/models/neural-signature-extraction.d.ts +0 -17
  158. package/lib/models/neural-signature-extraction.js +0 -54
  159. package/lib/models/neural.d.ts +0 -36
  160. package/lib/models/neural.js +0 -163
  161. package/lib/models/nylas-api-error.d.ts +0 -26
  162. package/lib/models/nylas-api-error.js +0 -61
  163. package/lib/models/outbox-job-status.d.ts +0 -20
  164. package/lib/models/outbox-job-status.js +0 -64
  165. package/lib/models/outbox-message.d.ts +0 -16
  166. package/lib/models/outbox-message.js +0 -54
  167. package/lib/models/outbox.d.ts +0 -35
  168. package/lib/models/outbox.js +0 -158
  169. package/lib/models/resource.d.ts +0 -22
  170. package/lib/models/resource.js +0 -66
  171. package/lib/models/restful-model-collection.d.ts +0 -15
  172. package/lib/models/restful-model-collection.js +0 -169
  173. package/lib/models/restful-model-instance.d.ts +0 -9
  174. package/lib/models/restful-model-instance.js +0 -37
  175. package/lib/models/restful-model.d.ts +0 -36
  176. package/lib/models/restful-model.js +0 -146
  177. package/lib/models/scheduler-booking-request.d.ts +0 -64
  178. package/lib/models/scheduler-booking-request.js +0 -148
  179. package/lib/models/scheduler-restful-model-collection.d.ts +0 -26
  180. package/lib/models/scheduler-restful-model-collection.js +0 -133
  181. package/lib/models/scheduler-time-slot.d.ts +0 -20
  182. package/lib/models/scheduler-time-slot.js +0 -53
  183. package/lib/models/scheduler.d.ts +0 -226
  184. package/lib/models/scheduler.js +0 -446
  185. package/lib/models/thread.d.ts +0 -49
  186. package/lib/models/thread.js +0 -127
  187. package/lib/models/webhook-notification.d.ts +0 -108
  188. package/lib/models/webhook-notification.js +0 -239
  189. package/lib/models/webhook.d.ts +0 -50
  190. package/lib/models/webhook.js +0 -101
  191. package/lib/models/when.d.ts +0 -23
  192. package/lib/models/when.js +0 -65
  193. package/lib/nylas-connection.d.ts +0 -71
  194. package/lib/nylas-connection.js +0 -258
  195. package/lib/nylas.d.ts +0 -57
  196. package/lib/nylas.js +0 -210
  197. package/lib/server-bindings/express-binding.d.ts +0 -18
  198. package/lib/server-bindings/express-binding.js +0 -163
  199. package/lib/server-bindings/server-binding.d.ts +0 -65
  200. package/lib/server-bindings/server-binding.js +0 -87
  201. package/lib/services/routes.d.ts +0 -26
  202. package/lib/services/routes.js +0 -95
  203. package/lib/services/tunnel.d.ts +0 -29
  204. package/lib/services/tunnel.js +0 -112
@@ -0,0 +1,63 @@
1
+ import { AsyncListResponse, Resource } from './resource.js';
2
+ import { NylasDeleteResponse, NylasResponse, NylasListResponse } from '../models/response.js';
3
+ import { CreateRedirectUriRequest, RedirectUri, UpdateRedirectUriRequest } from '../models/redirectUri.js';
4
+ import { Overrides } from '../config.js';
5
+ /**
6
+ * @property redirectUriId The id of the Redirect URI to retrieve.
7
+ */
8
+ interface FindRedirectUrisParams {
9
+ redirectUriId: string;
10
+ }
11
+ /**
12
+ * @property requestBody The values to create the Redirect URI with.
13
+ */
14
+ interface CreateRedirectUrisParams {
15
+ requestBody: CreateRedirectUriRequest;
16
+ }
17
+ /**
18
+ * @property redirectUriId The id of the Redirect URI to update.
19
+ * @property requestBody The values to update the Redirect URI with.
20
+ */
21
+ interface UpdateRedirectUrisParams {
22
+ redirectUriId: string;
23
+ requestBody: UpdateRedirectUriRequest;
24
+ }
25
+ /**
26
+ * @property redirectUriId The id of the Redirect URI to delete.
27
+ */
28
+ interface DestroyRedirectUrisParams {
29
+ redirectUriId: string;
30
+ }
31
+ /**
32
+ * A collection of redirect URI related API endpoints.
33
+ *
34
+ * These endpoints allows for the management of redirect URIs.
35
+ */
36
+ export declare class RedirectUris extends Resource {
37
+ /**
38
+ * Return all Redirect URIs
39
+ * @return The list of Redirect URIs
40
+ */
41
+ list({ overrides }?: Overrides): AsyncListResponse<NylasListResponse<RedirectUri>>;
42
+ /**
43
+ * Return a Redirect URI
44
+ * @return The Redirect URI
45
+ */
46
+ find({ redirectUriId, overrides, }: FindRedirectUrisParams & Overrides): Promise<NylasResponse<RedirectUri>>;
47
+ /**
48
+ * Create a Redirect URI
49
+ * @return The created Redirect URI
50
+ */
51
+ create({ requestBody, overrides, }: CreateRedirectUrisParams & Overrides): Promise<NylasResponse<RedirectUri>>;
52
+ /**
53
+ * Update a Redirect URI
54
+ * @return The updated Redirect URI
55
+ */
56
+ update({ redirectUriId, requestBody, overrides, }: UpdateRedirectUrisParams & Overrides): Promise<NylasResponse<RedirectUri>>;
57
+ /**
58
+ * Delete a Redirect URI
59
+ * @return The deleted Redirect URI
60
+ */
61
+ destroy({ redirectUriId, overrides, }: DestroyRedirectUrisParams & Overrides): Promise<NylasResponse<NylasDeleteResponse>>;
62
+ }
63
+ export {};
@@ -0,0 +1,55 @@
1
+ import APIClient from '../apiClient.js';
2
+ import { OverridableNylasConfig } from '../config.js';
3
+ import { ListQueryParams } from '../models/listQueryParams.js';
4
+ import { NylasResponse, NylasListResponse, ListResponseInnerType } from '../models/response.js';
5
+ interface ListParams<T> {
6
+ queryParams?: ListQueryParams;
7
+ path: string;
8
+ overrides?: OverridableNylasConfig;
9
+ useGenerator?: boolean;
10
+ }
11
+ interface FindParams<T> {
12
+ path: string;
13
+ queryParams?: Record<string, any>;
14
+ overrides?: OverridableNylasConfig;
15
+ }
16
+ interface PayloadParams<T> {
17
+ path: string;
18
+ queryParams?: Record<string, any>;
19
+ requestBody: Record<string, any>;
20
+ overrides?: OverridableNylasConfig;
21
+ }
22
+ interface DestroyParams {
23
+ path: string;
24
+ queryParams?: Record<string, any>;
25
+ overrides?: OverridableNylasConfig;
26
+ }
27
+ type List<T> = NylasListResponse<ListResponseInnerType<T>>;
28
+ /**
29
+ * Base class for Nylas API resources
30
+ *
31
+ * @ignore No public constructor or functions
32
+ */
33
+ export declare class Resource {
34
+ protected apiClient: APIClient;
35
+ /**
36
+ * @param apiClient client The configured Nylas API client
37
+ */
38
+ constructor(apiClient: APIClient);
39
+ private fetchList;
40
+ private listIterator;
41
+ protected _list<T extends List<T>>(listParams: ListParams<T>): AsyncListResponse<T>;
42
+ protected _find<T>({ path, queryParams, overrides, }: FindParams<T>): Promise<NylasResponse<T>>;
43
+ private payloadRequest;
44
+ protected _create<T>(params: PayloadParams<T>): Promise<NylasResponse<T>>;
45
+ protected _update<T>(params: PayloadParams<T>): Promise<NylasResponse<T>>;
46
+ protected _updatePatch<T>(params: PayloadParams<T>): Promise<NylasResponse<T>>;
47
+ protected _destroy<T>({ path, queryParams, overrides, }: DestroyParams): Promise<T>;
48
+ }
49
+ type ListYieldReturn<T> = T & {
50
+ next: () => Promise<IteratorResult<T, undefined>>;
51
+ };
52
+ export interface AsyncListResponse<T> extends Promise<ListYieldReturn<T>> {
53
+ [Symbol.asyncIterator](): AsyncGenerator<T, undefined>;
54
+ }
55
+ export {};
@@ -0,0 +1,79 @@
1
+ import { AsyncListResponse, Resource } from './resource.js';
2
+ import { Overrides } from '../config.js';
3
+ import { NylasResponse, NylasListResponse } from '../models/response.js';
4
+ import { CreateWebhookRequest, UpdateWebhookRequest, Webhook, WebhookDeleteResponse, WebhookIpAddressesResponse, WebhookWithSecret } from '../models/webhooks.js';
5
+ /**
6
+ * @property webhookId The ID of the webhook destination to update
7
+ */
8
+ interface FindWebhookParams {
9
+ webhookId: string;
10
+ }
11
+ /**
12
+ * @property requestBody The webhook destination details
13
+ */
14
+ interface CreateWebhookParams {
15
+ requestBody: CreateWebhookRequest;
16
+ }
17
+ /**
18
+ * @property webhookId The ID of the webhook destination to update
19
+ * @property requestBody The updated webview destination details
20
+ */
21
+ interface UpdateWebhookParams {
22
+ webhookId: string;
23
+ requestBody: UpdateWebhookRequest;
24
+ }
25
+ /**
26
+ * @property webhookId The ID of the webhook destination to delete
27
+ */
28
+ interface DestroyWebhookParams {
29
+ webhookId: string;
30
+ }
31
+ /**
32
+ * Nylas Webhooks API
33
+ *
34
+ * The Nylas Webhooks API allows your application to receive notifications in real-time when certain events occur.
35
+ */
36
+ export declare class Webhooks extends Resource {
37
+ /**
38
+ * List all webhook destinations for the application
39
+ * @returns The list of webhook destinations
40
+ */
41
+ list({ overrides }?: Overrides): AsyncListResponse<NylasListResponse<Webhook>>;
42
+ /**
43
+ * Return a webhook destination
44
+ * @return The webhook destination
45
+ */
46
+ find({ webhookId, overrides, }: FindWebhookParams & Overrides): Promise<NylasResponse<Webhook>>;
47
+ /**
48
+ * Create a webhook destination
49
+ * @returns The created webhook destination
50
+ */
51
+ create({ requestBody, overrides, }: CreateWebhookParams & Overrides): Promise<NylasResponse<Webhook>>;
52
+ /**
53
+ * Update a webhook destination
54
+ * @returns The updated webhook destination
55
+ */
56
+ update({ webhookId, requestBody, overrides, }: UpdateWebhookParams & Overrides): Promise<NylasResponse<Webhook>>;
57
+ /**
58
+ * Delete a webhook destination
59
+ * @returns The deletion response
60
+ */
61
+ destroy({ webhookId, overrides, }: DestroyWebhookParams & Overrides): Promise<WebhookDeleteResponse>;
62
+ /**
63
+ * Update the webhook secret value for a destination
64
+ * @returns The updated webhook destination with the webhook secret
65
+ */
66
+ rotateSecret({ webhookId, overrides, }: DestroyWebhookParams & Overrides): Promise<NylasResponse<WebhookWithSecret>>;
67
+ /**
68
+ * Get the current list of IP addresses that Nylas sends webhooks from
69
+ * @returns The list of IP addresses that Nylas sends webhooks from
70
+ */
71
+ ipAddresses({ overrides }?: Overrides): Promise<NylasResponse<WebhookIpAddressesResponse>>;
72
+ /**
73
+ * Extract the challenge parameter from a URL
74
+ * @param url The URL sent by Nylas containing the challenge parameter
75
+ * @returns The challenge parameter
76
+ */
77
+ extractChallengeParameter(url: string): string;
78
+ }
79
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A utility function that recursively converts all keys in an object to camelCase.
3
+ * @param obj The object to convert
4
+ * @param exclude An array of keys to exclude from conversion
5
+ * @returns The converted object
6
+ * @ignore Not for public use.
7
+ */
8
+ export declare function objKeysToCamelCase(obj: Record<string, unknown>, exclude?: string[]): any;
9
+ /**
10
+ * A utility function that recursively converts all keys in an object to snake_case.
11
+ * @param obj The object to convert
12
+ * @param exclude An array of keys to exclude from conversion
13
+ * @returns The converted object
14
+ */
15
+ export declare function objKeysToSnakeCase(obj: Record<string, unknown>, exclude?: string[]): any;
16
+ /**
17
+ * A better "Partial" type that makes all properties optional, including nested ones.
18
+ * @see https://grrr.tech/posts/2021/typescript-partial/
19
+ */
20
+ export type Subset<K> = {
21
+ [attr in keyof K]?: K[attr] extends object ? Subset<K[attr]> : K[attr] extends object | null ? Subset<K[attr]> | null : K[attr] extends object | null | undefined ? Subset<K[attr]> | null | undefined : K[attr];
22
+ };
@@ -0,0 +1 @@
1
+ export declare const SDK_VERSION = "7.0.0-beta.2";
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "7.0.0-beta.0",
3
+ "version": "7.0.0-beta.2",
4
4
  "description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.",
5
- "main": "lib/nylas.js",
6
- "types": "lib/nylas.d.ts",
5
+ "main": "lib/cjs/nylas.js",
6
+ "types": "lib/types/nylas.d.ts",
7
+ "module": "lib/esm/nylas.js",
7
8
  "files": [
8
9
  "lib"
9
10
  ],
11
+ "engines": {
12
+ "node": ">=16"
13
+ },
10
14
  "scripts": {
11
15
  "test": "jest",
12
16
  "test:coverage": "npm run test -- --coverage",
@@ -15,24 +19,15 @@
15
19
  "lint:ci": "npm run lint:fix -- --quiet",
16
20
  "lint:prettier": "prettier --write '**/*.{ts,js}'",
17
21
  "lint:prettier:check": "prettier --check '**/*.{ts,js}'",
18
- "build": "tsc",
22
+ "export-version": "node scripts/exportVersion.js",
23
+ "generate-lib-package-json": "node scripts/generateLibPackageJson.js",
24
+ "prebuild": "npm run export-version",
25
+ "build": "rm -rf lib && npm run build-esm && npm run build-cjs && npm run generate-lib-package-json",
26
+ "build-esm": "tsc -p tsconfig.esm.json",
27
+ "build-cjs": "tsc -p tsconfig.cjs.json",
19
28
  "prepare": "npm run build",
20
- "watch": "nodemon -w src --exec npm run build"
21
- },
22
- "jest": {
23
- "preset": "ts-jest/presets/js-with-ts",
24
- "globals": {
25
- "ts-jest": {
26
- "tsConfig": "tsconfig.test.json"
27
- }
28
- },
29
- "coverageThreshold": {
30
- "global": {
31
- "functions": 80,
32
- "lines": 80,
33
- "statements": 80
34
- }
35
- }
29
+ "build:docs": "typedoc --out docs",
30
+ "version": "npm run export-version && git add src/version.ts"
36
31
  },
37
32
  "keywords": [
38
33
  "email",
@@ -43,42 +38,38 @@
43
38
  "author": "Nylas, Inc.",
44
39
  "license": "MIT",
45
40
  "dependencies": {
46
- "abort-controller": "^3.0.0",
47
- "backoff": "^2.5.0",
48
- "form-data": "^4.0.0",
49
- "JSONStream": "^1.3.5",
50
- "node-fetch": "^2.6.1",
51
- "express": "^4.17.13",
52
- "body-parser": "^1.20.0",
53
- "uuid": "^8.3.2",
54
- "websocket": "^1.0.34"
41
+ "change-case": "^4.1.2",
42
+ "eslint-plugin-import": "^2.28.1",
43
+ "node-fetch": "^2.6.12",
44
+ "sha256": "^0.2.0",
45
+ "uuid": "^8.3.2"
55
46
  },
56
47
  "devDependencies": {
57
- "@babel/cli": "^7.13.16",
58
48
  "@babel/core": "^7.3.3",
59
- "@babel/plugin-proposal-object-rest-spread": "^7.3.2",
60
- "@babel/preset-env": "^7.3.1",
61
- "@types/backoff": "^2.5.1",
62
- "@types/jest": "^25.1.4",
63
- "@types/node-fetch": "^2.5.8",
49
+ "@types/jest": "^29.5.2",
50
+ "@types/node-fetch": "^2.6.4",
51
+ "@types/sha256": "^0.2.0",
64
52
  "@types/uuid": "^8.3.4",
65
- "@types/websocket": "^1.0.5",
66
- "@types/express": "^4.17.13",
67
53
  "@typescript-eslint/eslint-plugin": "^2.25.0",
68
54
  "@typescript-eslint/parser": "^2.25.0",
69
- "babel-eslint": "^10.0.1",
70
55
  "eslint": "^5.14.0",
71
56
  "eslint-config-prettier": "^4.0.0",
72
57
  "eslint-plugin-custom-rules": "^0.0.0",
73
58
  "eslint-plugin-prettier": "^3.0.1",
74
- "jest": "^24.9.0",
59
+ "jest": "^29.6.1",
75
60
  "prettier": "^1.19.1",
76
- "pretty-format": "^25.2.6",
77
- "ts-jest": "^25.2.1",
78
- "typescript": "^3.8.3"
61
+ "ts-jest": "^29.1.1",
62
+ "typedoc": "^0.24.8",
63
+ "typedoc-plugin-rename-defaults": "^0.6.5",
64
+ "typescript": "^4.9.5"
79
65
  },
80
66
  "repository": {
81
67
  "type": "git",
82
68
  "url": "https://github.com/nylas/nylas-nodejs.git"
69
+ },
70
+ "exports": {
71
+ "import": "./lib/esm/nylas.js",
72
+ "require": "./lib/cjs/nylas.js",
73
+ "types": "./lib/types/nylas.d.ts"
83
74
  }
84
75
  }
package/lib/config.d.ts DELETED
@@ -1,70 +0,0 @@
1
- import { WebhookTriggers } from './models/webhook';
2
- import ExpressBinding from './server-bindings/express-binding';
3
- import AccessToken from './models/access-token';
4
- export declare let apiServer: string | null;
5
- export declare function setApiServer(newApiServer: string | null): void;
6
- export declare let clientSecret: string;
7
- export declare function setClientSecret(newClientSecret: string): void;
8
- export declare type NylasConfig = {
9
- clientId: string;
10
- clientSecret: string;
11
- apiServer?: string;
12
- };
13
- export declare type AuthenticateUrlConfig = {
14
- redirectURI: string;
15
- redirectOnError?: boolean;
16
- loginHint?: string;
17
- state?: string;
18
- provider?: string;
19
- scopes?: string[];
20
- };
21
- export declare enum Region {
22
- Us = "us",
23
- Canada = "canada",
24
- Ireland = "ireland",
25
- Australia = "australia",
26
- Staging = "staging"
27
- }
28
- export declare const DEFAULT_REGION = Region.Us;
29
- export declare const regionConfig: {
30
- us: {
31
- nylasAPIUrl: string;
32
- dashboardApiUrl: string;
33
- callbackDomain: string;
34
- websocketDomain: string;
35
- telemetryApiUrl: string;
36
- };
37
- canada: {
38
- nylasAPIUrl: string;
39
- dashboardApiUrl: string;
40
- callbackDomain: string;
41
- websocketDomain: string;
42
- telemetryApiUrl: string;
43
- };
44
- ireland: {
45
- nylasAPIUrl: string;
46
- dashboardApiUrl: string;
47
- callbackDomain: string;
48
- websocketDomain: string;
49
- telemetryApiUrl: string;
50
- };
51
- australia: {
52
- nylasAPIUrl: string;
53
- dashboardApiUrl: string;
54
- callbackDomain: string;
55
- websocketDomain: string;
56
- telemetryApiUrl: string;
57
- };
58
- staging: {
59
- nylasAPIUrl: string;
60
- dashboardApiUrl: string;
61
- callbackDomain: string;
62
- websocketDomain: string;
63
- telemetryApiUrl: string;
64
- };
65
- };
66
- export declare const DEFAULT_WEBHOOK_TRIGGERS: WebhookTriggers[];
67
- export declare const ServerBindings: {
68
- express: typeof ExpressBinding;
69
- };
70
- export declare type ExchangeCodeForTokenCallback = (error: Error | null, accessToken?: AccessToken) => void;
package/lib/config.js DELETED
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- var _a;
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var webhook_1 = require("./models/webhook");
8
- var express_binding_1 = __importDefault(require("./server-bindings/express-binding"));
9
- exports.apiServer = null;
10
- function setApiServer(newApiServer) {
11
- exports.apiServer = newApiServer;
12
- }
13
- exports.setApiServer = setApiServer;
14
- exports.clientSecret = '';
15
- function setClientSecret(newClientSecret) {
16
- exports.clientSecret = newClientSecret;
17
- }
18
- exports.setClientSecret = setClientSecret;
19
- var Region;
20
- (function (Region) {
21
- Region["Us"] = "us";
22
- Region["Canada"] = "canada";
23
- Region["Ireland"] = "ireland";
24
- Region["Australia"] = "australia";
25
- Region["Staging"] = "staging";
26
- })(Region = exports.Region || (exports.Region = {}));
27
- exports.DEFAULT_REGION = Region.Us;
28
- exports.regionConfig = (_a = {},
29
- _a[Region.Us] = {
30
- nylasAPIUrl: 'https://api.nylas.com',
31
- dashboardApiUrl: 'https://dashboard-api.nylas.com',
32
- callbackDomain: 'cb.nylas.com',
33
- websocketDomain: 'tunnel.nylas.com',
34
- telemetryApiUrl: 'https://cli.nylas.com',
35
- },
36
- _a[Region.Canada] = {
37
- nylasAPIUrl: 'https://canada.api.nylas.com',
38
- dashboardApiUrl: 'https://canada.dashboard.nylas.com',
39
- callbackDomain: 'cb.nylas.com',
40
- websocketDomain: 'tunnel.nylas.com',
41
- telemetryApiUrl: 'https://cli.nylas.com',
42
- },
43
- _a[Region.Ireland] = {
44
- nylasAPIUrl: 'https://ireland.api.nylas.com',
45
- dashboardApiUrl: 'https://ireland.dashboard.nylas.com',
46
- callbackDomain: 'cb.nylas.com',
47
- websocketDomain: 'tunnel.nylas.com',
48
- telemetryApiUrl: 'https://cli.nylas.com',
49
- },
50
- _a[Region.Australia] = {
51
- nylasAPIUrl: 'https://australia.api.nylas.com',
52
- dashboardApiUrl: 'https://australia.dashboard.nylas.com',
53
- callbackDomain: 'cb.nylas.com',
54
- websocketDomain: 'tunnel.nylas.com',
55
- telemetryApiUrl: 'https://cli.nylas.com',
56
- },
57
- _a[Region.Staging] = {
58
- nylasAPIUrl: 'https://api-staging.nylas.com',
59
- dashboardApiUrl: 'https://staging-dashboard.nylas.com',
60
- callbackDomain: 'cb.nylas.com',
61
- websocketDomain: 'tunnel.nylas.com',
62
- telemetryApiUrl: 'https://cli.nylas.com',
63
- },
64
- _a);
65
- exports.DEFAULT_WEBHOOK_TRIGGERS = Object.values(webhook_1.WebhookTriggers);
66
- exports.ServerBindings = {
67
- express: express_binding_1.default,
68
- };
@@ -1,18 +0,0 @@
1
- import Model from './model';
2
- import { Attribute } from './attributes';
3
- export declare type AccessTokenProperties = {
4
- accessToken: string;
5
- accountId: string;
6
- emailAddress: string;
7
- provider: string;
8
- tokenType: string;
9
- };
10
- export default class AccessToken extends Model implements AccessTokenProperties {
11
- accessToken: string;
12
- accountId: string;
13
- emailAddress: string;
14
- provider: string;
15
- tokenType: string;
16
- static attributes: Record<string, Attribute>;
17
- constructor(props?: AccessTokenProperties);
18
- }
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- var __importDefault = (this && this.__importDefault) || function (mod) {
16
- return (mod && mod.__esModule) ? mod : { "default": mod };
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- var model_1 = __importDefault(require("./model"));
20
- var attributes_1 = __importDefault(require("./attributes"));
21
- var AccessToken = /** @class */ (function (_super) {
22
- __extends(AccessToken, _super);
23
- function AccessToken(props) {
24
- var _this = _super.call(this) || this;
25
- _this.accessToken = '';
26
- _this.accountId = '';
27
- _this.emailAddress = '';
28
- _this.provider = '';
29
- _this.tokenType = 'bearer';
30
- _this.initAttributes(props);
31
- return _this;
32
- }
33
- AccessToken.attributes = {
34
- accessToken: attributes_1.default.String({
35
- modelKey: 'accessToken',
36
- jsonKey: 'access_token',
37
- }),
38
- accountId: attributes_1.default.String({
39
- modelKey: 'accountId',
40
- jsonKey: 'account_id',
41
- }),
42
- emailAddress: attributes_1.default.String({
43
- modelKey: 'emailAddress',
44
- jsonKey: 'email_address',
45
- }),
46
- provider: attributes_1.default.String({
47
- modelKey: 'provider',
48
- }),
49
- tokenType: attributes_1.default.String({
50
- modelKey: 'tokenType',
51
- jsonKey: 'token_type',
52
- }),
53
- };
54
- return AccessToken;
55
- }(model_1.default));
56
- exports.default = AccessToken;
@@ -1,27 +0,0 @@
1
- import RestfulModel from './restful-model';
2
- import { Attribute } from './attributes';
3
- import NylasConnection from '../nylas-connection';
4
- export declare type AccountProperties = {
5
- name: string;
6
- emailAddress: string;
7
- provider: string;
8
- organizationUnit: string;
9
- syncState: string;
10
- linkedAt: Date;
11
- billingState?: string;
12
- accessToken?: string;
13
- };
14
- export default class Account extends RestfulModel implements AccountProperties {
15
- name: string;
16
- emailAddress: string;
17
- provider: string;
18
- organizationUnit: string;
19
- syncState: string;
20
- linkedAt: Date;
21
- accessToken: string;
22
- billingState?: string;
23
- static collectionName: string;
24
- static endpointName: string;
25
- static attributes: Record<string, Attribute>;
26
- constructor(connection: NylasConnection, props?: AccountProperties);
27
- }
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- var __assign = (this && this.__assign) || function () {
16
- __assign = Object.assign || function(t) {
17
- for (var s, i = 1, n = arguments.length; i < n; i++) {
18
- s = arguments[i];
19
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
- t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- var restful_model_1 = __importDefault(require("./restful-model"));
31
- var attributes_1 = __importDefault(require("./attributes"));
32
- var Account = /** @class */ (function (_super) {
33
- __extends(Account, _super);
34
- function Account(connection, props) {
35
- var _this = _super.call(this, connection, props) || this;
36
- _this.name = '';
37
- _this.emailAddress = '';
38
- _this.provider = '';
39
- _this.organizationUnit = '';
40
- _this.syncState = '';
41
- _this.linkedAt = new Date();
42
- _this.accessToken = '';
43
- _this.initAttributes(props);
44
- return _this;
45
- }
46
- Account.collectionName = 'accounts';
47
- Account.endpointName = 'account';
48
- Account.attributes = __assign(__assign({}, restful_model_1.default.attributes), { name: attributes_1.default.String({
49
- modelKey: 'name',
50
- }), emailAddress: attributes_1.default.String({
51
- modelKey: 'emailAddress',
52
- jsonKey: 'email_address',
53
- }), provider: attributes_1.default.String({
54
- modelKey: 'provider',
55
- }), organizationUnit: attributes_1.default.String({
56
- modelKey: 'organizationUnit',
57
- jsonKey: 'organization_unit',
58
- }), syncState: attributes_1.default.String({
59
- modelKey: 'syncState',
60
- jsonKey: 'sync_state',
61
- }), billingState: attributes_1.default.String({
62
- modelKey: 'billingState',
63
- jsonKey: 'billing_state',
64
- }), linkedAt: attributes_1.default.DateTime({
65
- modelKey: 'linkedAt',
66
- jsonKey: 'linked_at',
67
- }), accessToken: attributes_1.default.String({
68
- modelKey: 'accessToken',
69
- jsonKey: 'access_token',
70
- }) });
71
- return Account;
72
- }(restful_model_1.default));
73
- exports.default = Account;
@@ -1,14 +0,0 @@
1
- import Model from './model';
2
- import { Attribute } from './attributes';
3
- export declare type ApplicationDetailsProperties = {
4
- applicationName?: string;
5
- iconUrl?: string;
6
- redirectUris?: string[];
7
- };
8
- export default class ApplicationDetails extends Model implements ApplicationDetailsProperties {
9
- applicationName: string;
10
- iconUrl: string;
11
- redirectUris: string[];
12
- static attributes: Record<string, Attribute>;
13
- constructor(props?: ApplicationDetailsProperties);
14
- }