nylas 7.12.0 → 7.13.1

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,14 @@
1
+ /**
2
+ * TypeScript definitions for the CommonJS wrapper
3
+ * This provides proper typing for CommonJS imports
4
+ */
5
+
6
+ // Re-export all types from the main module
7
+ export * from './lib/types/models/index.js';
8
+
9
+ // Import the main Nylas class type
10
+ import Nylas from './lib/types/nylas.js';
11
+
12
+ // Export as both default and named for maximum compatibility
13
+ declare const nylasExport: typeof Nylas;
14
+ export = nylasExport;
package/cjs-wrapper.js ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * CommonJS wrapper for the Nylas SDK
3
+ * This file provides CommonJS compatibility by re-exporting the default export
4
+ * as the main module export while preserving named exports
5
+ */
6
+
7
+ const nylasModule = require('./lib/cjs/nylas.js');
8
+
9
+ // Export the default export as the main module export for CJS compatibility
10
+ module.exports = nylasModule.default;
11
+
12
+ // Preserve all named exports
13
+ Object.assign(module.exports, nylasModule);
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.REQUEST_ID_HEADER = exports.FLOW_ID_HEADER = void 0;
4
- const node_fetch_1 = require("node-fetch");
5
4
  const error_js_1 = require("./models/error.js");
6
5
  const utils_js_1 = require("./utils.js");
7
6
  const version_js_1 = require("./version.js");
8
7
  const change_case_1 = require("change-case");
8
+ const fetchWrapper_js_1 = require("./utils/fetchWrapper.js");
9
9
  /**
10
10
  * The header key for the debugging flow ID
11
11
  */
@@ -73,7 +73,7 @@ class APIClient {
73
73
  };
74
74
  }
75
75
  async sendRequest(options) {
76
- const req = this.newRequest(options);
76
+ const req = await this.newRequest(options);
77
77
  const controller = new AbortController();
78
78
  // Handle timeout
79
79
  let timeoutDuration;
@@ -94,7 +94,8 @@ class APIClient {
94
94
  controller.abort();
95
95
  }, timeoutDuration);
96
96
  try {
97
- const response = await (0, node_fetch_1.default)(req, {
97
+ const fetch = await (0, fetchWrapper_js_1.getFetch)();
98
+ const response = await fetch(req, {
98
99
  signal: controller.signal,
99
100
  });
100
101
  clearTimeout(timeout);
@@ -159,9 +160,10 @@ class APIClient {
159
160
  }
160
161
  return requestOptions;
161
162
  }
162
- newRequest(options) {
163
+ async newRequest(options) {
163
164
  const newOptions = this.requestOptions(options);
164
- return new node_fetch_1.Request(newOptions.url, {
165
+ const RequestConstructor = await (0, fetchWrapper_js_1.getRequest)();
166
+ return new RequestConstructor(newOptions.url, {
165
167
  method: newOptions.method,
166
168
  headers: newOptions.headers,
167
169
  body: newOptions.body,
@@ -174,11 +176,19 @@ class APIClient {
174
176
  const flowId = headers[exports.FLOW_ID_HEADER];
175
177
  const text = await response.text();
176
178
  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']);
179
+ const parsed = JSON.parse(text);
180
+ const payload = (0, utils_js_1.objKeysToCamelCase)({
181
+ ...parsed,
182
+ flowId,
183
+ // deprecated: headers will be removed in a future release. This is for backwards compatibility.
184
+ headers,
185
+ }, ['metadata']);
186
+ // Attach rawHeaders as a non-enumerable property to avoid breaking deep equality
187
+ Object.defineProperty(payload, 'rawHeaders', {
188
+ value: headers,
189
+ enumerable: false,
190
+ });
191
+ return payload;
182
192
  }
183
193
  catch (e) {
184
194
  throw new Error(`Could not parse response from the server: ${text}`);
package/lib/cjs/nylas.js CHANGED
@@ -13,9 +13,12 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
16
19
  Object.defineProperty(exports, "__esModule", { value: true });
17
20
  __exportStar(require("./models/index.js"), exports);
18
- const apiClient_js_1 = require("./apiClient.js");
21
+ const apiClient_js_1 = __importDefault(require("./apiClient.js"));
19
22
  const config_js_1 = require("./config.js");
20
23
  const calendars_js_1 = require("./resources/calendars.js");
21
24
  const events_js_1 = require("./resources/events.js");
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ /**
3
+ * Fetch wrapper for CJS builds - uses dynamic imports for node-fetch compatibility
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getFetch = getFetch;
7
+ exports.getRequest = getRequest;
8
+ exports.getResponse = getResponse;
9
+ // Cache for the dynamically imported module
10
+ let nodeFetchModule = null;
11
+ /**
12
+ * Get fetch function - uses dynamic import for CJS
13
+ */
14
+ async function getFetch() {
15
+ // In test environment, use global fetch (mocked by jest-fetch-mock)
16
+ if (typeof global !== 'undefined' && global.fetch) {
17
+ return global.fetch;
18
+ }
19
+ if (!nodeFetchModule) {
20
+ // Use Function constructor to prevent TypeScript from converting to require()
21
+ const dynamicImport = new Function('specifier', 'return import(specifier)');
22
+ nodeFetchModule = (await dynamicImport('node-fetch'));
23
+ }
24
+ return nodeFetchModule.default;
25
+ }
26
+ /**
27
+ * Get Request constructor - uses dynamic import for CJS
28
+ */
29
+ async function getRequest() {
30
+ // In test environment, use global Request or a mock
31
+ if (typeof global !== 'undefined' && global.Request) {
32
+ return global.Request;
33
+ }
34
+ if (!nodeFetchModule) {
35
+ // Use Function constructor to prevent TypeScript from converting to require()
36
+ const dynamicImport = new Function('specifier', 'return import(specifier)');
37
+ nodeFetchModule = (await dynamicImport('node-fetch'));
38
+ }
39
+ return nodeFetchModule.Request;
40
+ }
41
+ /**
42
+ * Get Response constructor - uses dynamic import for CJS
43
+ */
44
+ async function getResponse() {
45
+ // In test environment, use global Response or a mock
46
+ if (typeof global !== 'undefined' && global.Response) {
47
+ return global.Response;
48
+ }
49
+ if (!nodeFetchModule) {
50
+ // Use Function constructor to prevent TypeScript from converting to require()
51
+ const dynamicImport = new Function('specifier', 'return import(specifier)');
52
+ nodeFetchModule = (await dynamicImport('node-fetch'));
53
+ }
54
+ return nodeFetchModule.Response;
55
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ /**
3
+ * Fetch wrapper for CJS builds - uses dynamic imports for node-fetch compatibility
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getFetch = getFetch;
7
+ exports.getRequest = getRequest;
8
+ exports.getResponse = getResponse;
9
+ // Cache for the dynamically imported module
10
+ let nodeFetchModule = null;
11
+ /**
12
+ * Get fetch function - uses dynamic import for CJS
13
+ */
14
+ async function getFetch() {
15
+ // In test environment, use global fetch (mocked by jest-fetch-mock)
16
+ if (typeof global !== 'undefined' && global.fetch) {
17
+ return global.fetch;
18
+ }
19
+ if (!nodeFetchModule) {
20
+ // Use Function constructor to prevent TypeScript from converting to require()
21
+ const dynamicImport = new Function('specifier', 'return import(specifier)');
22
+ nodeFetchModule = (await dynamicImport('node-fetch'));
23
+ }
24
+ return nodeFetchModule.default;
25
+ }
26
+ /**
27
+ * Get Request constructor - uses dynamic import for CJS
28
+ */
29
+ async function getRequest() {
30
+ // In test environment, use global Request or a mock
31
+ if (typeof global !== 'undefined' && global.Request) {
32
+ return global.Request;
33
+ }
34
+ if (!nodeFetchModule) {
35
+ // Use Function constructor to prevent TypeScript from converting to require()
36
+ const dynamicImport = new Function('specifier', 'return import(specifier)');
37
+ nodeFetchModule = (await dynamicImport('node-fetch'));
38
+ }
39
+ return nodeFetchModule.Request;
40
+ }
41
+ /**
42
+ * Get Response constructor - uses dynamic import for CJS
43
+ */
44
+ async function getResponse() {
45
+ // In test environment, use global Response or a mock
46
+ if (typeof global !== 'undefined' && global.Response) {
47
+ return global.Response;
48
+ }
49
+ if (!nodeFetchModule) {
50
+ // Use Function constructor to prevent TypeScript from converting to require()
51
+ const dynamicImport = new Function('specifier', 'return import(specifier)');
52
+ nodeFetchModule = (await dynamicImport('node-fetch'));
53
+ }
54
+ return nodeFetchModule.Response;
55
+ }
package/lib/cjs/utils.js CHANGED
@@ -1,4 +1,37 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.createFileRequestBuilder = createFileRequestBuilder;
4
37
  exports.attachmentStreamToFile = attachmentStreamToFile;
@@ -10,9 +43,9 @@ exports.safePath = safePath;
10
43
  exports.makePathParams = makePathParams;
11
44
  exports.calculateTotalPayloadSize = calculateTotalPayloadSize;
12
45
  const change_case_1 = require("change-case");
13
- const fs = require("node:fs");
14
- const path = require("node:path");
15
- const mime = require("mime-types");
46
+ const fs = __importStar(require("node:fs"));
47
+ const path = __importStar(require("node:path"));
48
+ const mime = __importStar(require("mime-types"));
16
49
  const node_stream_1 = require("node:stream");
17
50
  function createFileRequestBuilder(filePath) {
18
51
  const stats = fs.statSync(filePath);
@@ -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.1';
@@ -1,8 +1,8 @@
1
- import fetch, { Request } from 'node-fetch';
2
1
  import { NylasApiError, NylasOAuthError, NylasSdkTimeoutError, } from './models/error.js';
3
2
  import { objKeysToCamelCase, objKeysToSnakeCase } from './utils.js';
4
3
  import { SDK_VERSION } from './version.js';
5
4
  import { snakeCase } from 'change-case';
5
+ import { getFetch, getRequest } from './utils/fetchWrapper.js';
6
6
  /**
7
7
  * The header key for the debugging flow ID
8
8
  */
@@ -70,7 +70,7 @@ export default class APIClient {
70
70
  };
71
71
  }
72
72
  async sendRequest(options) {
73
- const req = this.newRequest(options);
73
+ const req = await this.newRequest(options);
74
74
  const controller = new AbortController();
75
75
  // Handle timeout
76
76
  let timeoutDuration;
@@ -91,6 +91,7 @@ export default class APIClient {
91
91
  controller.abort();
92
92
  }, timeoutDuration);
93
93
  try {
94
+ const fetch = await getFetch();
94
95
  const response = await fetch(req, {
95
96
  signal: controller.signal,
96
97
  });
@@ -156,9 +157,10 @@ export default class APIClient {
156
157
  }
157
158
  return requestOptions;
158
159
  }
159
- newRequest(options) {
160
+ async newRequest(options) {
160
161
  const newOptions = this.requestOptions(options);
161
- return new Request(newOptions.url, {
162
+ const RequestConstructor = await getRequest();
163
+ return new RequestConstructor(newOptions.url, {
162
164
  method: newOptions.method,
163
165
  headers: newOptions.headers,
164
166
  body: newOptions.body,
@@ -171,11 +173,19 @@ export default class APIClient {
171
173
  const flowId = headers[FLOW_ID_HEADER];
172
174
  const text = await response.text();
173
175
  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']);
176
+ const parsed = JSON.parse(text);
177
+ const payload = objKeysToCamelCase({
178
+ ...parsed,
179
+ flowId,
180
+ // deprecated: headers will be removed in a future release. This is for backwards compatibility.
181
+ headers,
182
+ }, ['metadata']);
183
+ // Attach rawHeaders as a non-enumerable property to avoid breaking deep equality
184
+ Object.defineProperty(payload, 'rawHeaders', {
185
+ value: headers,
186
+ enumerable: false,
187
+ });
188
+ return payload;
179
189
  }
180
190
  catch (e) {
181
191
  throw new Error(`Could not parse response from the server: ${text}`);
package/lib/esm/nylas.js CHANGED
@@ -22,7 +22,7 @@ import { Notetakers } from './resources/notetakers.js';
22
22
  * A Nylas instance holds a configured http client pointing to a base URL and is intended to be reused and shared
23
23
  * across threads and time.
24
24
  */
25
- export default class Nylas {
25
+ class Nylas {
26
26
  /**
27
27
  * @param config Configuration options for the Nylas SDK
28
28
  */
@@ -51,3 +51,4 @@ export default class Nylas {
51
51
  return this;
52
52
  }
53
53
  }
54
+ export default Nylas;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Fetch wrapper for ESM builds - uses static imports for optimal performance
3
+ */
4
+ import fetch, { Request, Response } from 'node-fetch';
5
+ /**
6
+ * Get fetch function - uses static import for ESM
7
+ */
8
+ export async function getFetch() {
9
+ return fetch;
10
+ }
11
+ /**
12
+ * Get Request constructor - uses static import for ESM
13
+ */
14
+ export async function getRequest() {
15
+ return Request;
16
+ }
17
+ /**
18
+ * Get Response constructor - uses static import for ESM
19
+ */
20
+ export async function getResponse() {
21
+ return Response;
22
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Fetch wrapper for ESM builds - uses static imports for optimal performance
3
+ */
4
+ import fetch, { Request, Response } from 'node-fetch';
5
+ /**
6
+ * Get fetch function - uses static import for ESM
7
+ */
8
+ export async function getFetch() {
9
+ return fetch;
10
+ }
11
+ /**
12
+ * Get Request constructor - uses static import for ESM
13
+ */
14
+ export async function getRequest() {
15
+ return Request;
16
+ }
17
+ /**
18
+ * Get Response constructor - uses static import for ESM
19
+ */
20
+ export async function getResponse() {
21
+ return Response;
22
+ }
@@ -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.1';
@@ -1,6 +1,6 @@
1
- import { Request, Response } from 'node-fetch';
2
1
  import { NylasConfig, OverridableNylasConfig } from './config.js';
3
2
  import { FormData } from 'formdata-node';
3
+ import type { Request, Response } from './utils/fetchWrapper.js';
4
4
  /**
5
5
  * The header key for the debugging flow ID
6
6
  */
@@ -73,7 +73,7 @@ export default class APIClient {
73
73
  private setRequestHeaders;
74
74
  private sendRequest;
75
75
  requestOptions(optionParams: RequestOptionsParams): RequestOptions;
76
- newRequest(options: RequestOptionsParams): Request;
76
+ newRequest(options: RequestOptionsParams): Promise<Request>;
77
77
  requestWithResponse<T>(response: Response): Promise<T>;
78
78
  request<T>(options: RequestOptionsParams): Promise<T>;
79
79
  requestRaw(options: RequestOptionsParams): Promise<Buffer>;
@@ -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
@@ -22,7 +22,7 @@ import { Notetakers } from './resources/notetakers.js';
22
22
  * A Nylas instance holds a configured http client pointing to a base URL and is intended to be reused and shared
23
23
  * across threads and time.
24
24
  */
25
- export default class Nylas {
25
+ declare class Nylas {
26
26
  /**
27
27
  * Access the Applications API
28
28
  */
@@ -93,3 +93,4 @@ export default class Nylas {
93
93
  */
94
94
  constructor(config: NylasConfig);
95
95
  }
96
+ export default Nylas;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Fetch wrapper for CJS builds - uses dynamic imports for node-fetch compatibility
3
+ */
4
+ /**
5
+ * Get fetch function - uses dynamic import for CJS
6
+ */
7
+ export declare function getFetch(): Promise<any>;
8
+ /**
9
+ * Get Request constructor - uses dynamic import for CJS
10
+ */
11
+ export declare function getRequest(): Promise<any>;
12
+ /**
13
+ * Get Response constructor - uses dynamic import for CJS
14
+ */
15
+ export declare function getResponse(): Promise<any>;
16
+ export type RequestInit = any;
17
+ export type HeadersInit = any;
18
+ export type Request = any;
19
+ export type Response = any;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Fetch wrapper for ESM builds - uses static imports for optimal performance
3
+ */
4
+ import fetch, { Request, Response } from 'node-fetch';
5
+ import type { RequestInit, HeadersInit } from 'node-fetch';
6
+ /**
7
+ * Get fetch function - uses static import for ESM
8
+ */
9
+ export declare function getFetch(): Promise<typeof fetch>;
10
+ /**
11
+ * Get Request constructor - uses static import for ESM
12
+ */
13
+ export declare function getRequest(): Promise<typeof Request>;
14
+ /**
15
+ * Get Response constructor - uses static import for ESM
16
+ */
17
+ export declare function getResponse(): Promise<typeof Response>;
18
+ export type { RequestInit, HeadersInit, Request, Response };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Fetch wrapper for CJS builds - uses dynamic imports for node-fetch compatibility
3
+ */
4
+ /**
5
+ * Get fetch function - uses dynamic import for CJS
6
+ */
7
+ export declare function getFetch(): Promise<any>;
8
+ /**
9
+ * Get Request constructor - uses dynamic import for CJS
10
+ */
11
+ export declare function getRequest(): Promise<any>;
12
+ /**
13
+ * Get Response constructor - uses dynamic import for CJS
14
+ */
15
+ export declare function getResponse(): Promise<any>;
16
+ export type RequestInit = any;
17
+ export type HeadersInit = any;
18
+ export type Request = any;
19
+ export type Response = any;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "7.12.0";
1
+ export declare const SDK_VERSION = "7.13.1";
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "7.12.0",
3
+ "version": "7.13.1",
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",
7
7
  "module": "lib/esm/nylas.js",
8
8
  "files": [
9
- "lib"
9
+ "lib",
10
+ "cjs-wrapper.js",
11
+ "cjs-wrapper.d.ts"
10
12
  ],
11
13
  "engines": {
12
14
  "node": ">=16"
@@ -24,8 +26,8 @@
24
26
  "generate-model-index": "node scripts/generateModelIndex.js",
25
27
  "prebuild": "npm run export-version && npm run generate-model-index",
26
28
  "build": "rm -rf lib && npm run build-esm && npm run build-cjs && npm run generate-lib-package-json",
27
- "build-esm": "tsc -p tsconfig.esm.json",
28
- "build-cjs": "tsc -p tsconfig.cjs.json",
29
+ "build-esm": "node scripts/setupFetchWrapper.js esm && tsc -p tsconfig.esm.json",
30
+ "build-cjs": "node scripts/setupFetchWrapper.js cjs && tsc -p tsconfig.cjs.json",
29
31
  "prepare": "npm run build",
30
32
  "build:docs": "typedoc --out docs",
31
33
  "version": "npm run export-version && git add src/version.ts"
@@ -72,8 +74,13 @@
72
74
  "url": "https://github.com/nylas/nylas-nodejs.git"
73
75
  },
74
76
  "exports": {
75
- "import": "./lib/esm/nylas.js",
76
- "require": "./lib/cjs/nylas.js",
77
- "types": "./lib/types/nylas.d.ts"
77
+ "import": {
78
+ "types": "./lib/types/nylas.d.ts",
79
+ "default": "./lib/esm/nylas.js"
80
+ },
81
+ "require": {
82
+ "types": "./cjs-wrapper.d.ts",
83
+ "default": "./cjs-wrapper.js"
84
+ }
78
85
  }
79
86
  }