nylas 7.13.3 → 8.0.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.
package/README.md CHANGED
@@ -1,12 +1,30 @@
1
- <a href="https://www.nylas.com/">
2
- <img src="https://brand.nylas.com/assets/downloads/logo_horizontal_png/Nylas-Logo-Horizontal-Blue_.png" alt="Aimeos logo" title="Aimeos" align="right" height="60" />
3
- </a>
4
-
5
- # Nylas Node.js SDK
6
-
7
- [![npm](https://img.shields.io/npm/v/nylas)
8
- ](https://www.npmjs.com/package/nylas)
9
- [![codecov](https://codecov.io/gh/nylas/nylas-nodejs/branch/main/graph/badge.svg?token=94IMGU4F09)](https://codecov.io/gh/nylas/nylas-nodejs)
1
+ <div align="center">
2
+ <a href="https://www.nylas.com/">
3
+ <img src="/diagrams/nylas-logo.png" alt="Nylas" height="80" />
4
+ </a>
5
+
6
+ <h1>Nylas Node.js SDK</h1>
7
+
8
+ <p>
9
+ <strong>The official Node.js SDK for the Nylas Communications Platform</strong>
10
+ </p>
11
+
12
+ <p>
13
+ <a href="https://www.npmjs.com/package/nylas"><img src="https://img.shields.io/npm/v/nylas" alt="npm version" /></a>
14
+ <a href="https://codecov.io/gh/nylas/nylas-nodejs"><img src="https://codecov.io/gh/nylas/nylas-nodejs/branch/main/graph/badge.svg?token=94IMGU4F09" alt="code coverage" /></a>
15
+ <a href="https://www.npmjs.com/package/nylas"><img src="https://img.shields.io/npm/dm/nylas" alt="downloads" /></a>
16
+ <a href="LICENSE.txt"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license" /></a>
17
+ </p>
18
+
19
+ <p>
20
+ <a href="https://developer.nylas.com/docs/v3/sdks/node/">📖 Documentation</a> •
21
+ <a href="https://dashboard.nylas.com/register">🚀 Get Started</a> •
22
+ <a href="https://github.com/orgs/nylas-samples/repositories?q=&type=all&language=javascript">💡 Examples</a> •
23
+ <a href="https://developer.nylas.com/docs/api/">📚 API Reference</a>
24
+ </p>
25
+ </div>
26
+
27
+ <br />
10
28
 
11
29
  This is the GitHub repository for the Nylas Node SDK. This repo is primarily for anyone who wants to make contributions to the SDK, or install it from source. If you are looking to use Node to access the Nylas Email, Calendar, or Contacts API you should refer to our official [Node SDK Quickstart Guide](https://developer.nylas.com/docs/developer-tools/sdk/node-sdk/).
12
30
 
@@ -4,8 +4,9 @@ exports.REQUEST_ID_HEADER = exports.FLOW_ID_HEADER = void 0;
4
4
  const error_js_1 = require("./models/error.js");
5
5
  const utils_js_1 = require("./utils.js");
6
6
  const version_js_1 = require("./version.js");
7
+ const form_data_encoder_1 = require("form-data-encoder");
8
+ const stream_1 = require("stream");
7
9
  const change_case_1 = require("change-case");
8
- const fetchWrapper_js_1 = require("./utils/fetchWrapper.js");
9
10
  /**
10
11
  * The header key for the debugging flow ID
11
12
  */
@@ -94,7 +95,6 @@ class APIClient {
94
95
  controller.abort();
95
96
  }, timeoutDuration);
96
97
  try {
97
- const fetch = await (0, fetchWrapper_js_1.getFetch)();
98
98
  const response = await fetch(req, {
99
99
  signal: controller.signal,
100
100
  });
@@ -156,18 +156,32 @@ class APIClient {
156
156
  requestOptions.headers['Content-Type'] = 'application/json';
157
157
  }
158
158
  if (optionParams.form) {
159
- requestOptions.body = optionParams.form;
159
+ // Use FormDataEncoder to properly encode the form data with the correct
160
+ // Content-Type header including the multipart boundary.
161
+ // This is required for Node.js environments where formdata-node's FormData
162
+ // doesn't automatically set the Content-Type header on fetch requests.
163
+ const encoder = new form_data_encoder_1.FormDataEncoder(optionParams.form);
164
+ // Set the Content-Type header with the boundary from the encoder
165
+ requestOptions.headers['Content-Type'] = encoder.contentType;
166
+ // Convert the encoded form data to a readable stream for the request body
167
+ requestOptions.body = stream_1.Readable.from(encoder);
168
+ // Node.js native fetch requires duplex: 'half' when sending a streaming body
169
+ requestOptions.duplex = 'half';
160
170
  }
161
171
  return requestOptions;
162
172
  }
163
173
  async newRequest(options) {
164
174
  const newOptions = this.requestOptions(options);
165
- const RequestConstructor = await (0, fetchWrapper_js_1.getRequest)();
166
- return new RequestConstructor(newOptions.url, {
175
+ const requestInit = {
167
176
  method: newOptions.method,
168
177
  headers: newOptions.headers,
169
178
  body: newOptions.body,
170
- });
179
+ };
180
+ // Add duplex option for streaming bodies (required by Node.js native fetch)
181
+ if (newOptions.duplex) {
182
+ requestInit.duplex = newOptions.duplex;
183
+ }
184
+ return new Request(newOptions.url, requestInit);
171
185
  }
172
186
  async requestWithResponse(response) {
173
187
  const headers = response?.headers?.entries
@@ -200,11 +214,11 @@ class APIClient {
200
214
  }
201
215
  async requestRaw(options) {
202
216
  const response = await this.sendRequest(options);
203
- return response.buffer();
217
+ const arrayBuffer = await response.arrayBuffer();
218
+ return Buffer.from(arrayBuffer);
204
219
  }
205
220
  async requestStream(options) {
206
221
  const response = await this.sendRequest(options);
207
- // TODO: See if we can fix this in a backwards compatible way
208
222
  if (!response.body) {
209
223
  throw new Error('No response body');
210
224
  }
@@ -32,12 +32,13 @@ class Folders extends resource_js_1.Resource {
32
32
  * Return a Folder
33
33
  * @return The folder
34
34
  */
35
- find({ identifier, folderId, overrides, }) {
35
+ find({ identifier, folderId, queryParams, overrides, }) {
36
36
  return super._find({
37
37
  path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/folders/{folderId}', {
38
38
  identifier,
39
39
  folderId,
40
40
  }),
41
+ queryParams,
41
42
  overrides,
42
43
  });
43
44
  }
@@ -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.13.3';
5
+ exports.SDK_VERSION = '8.0.1';
@@ -1,8 +1,9 @@
1
1
  import { NylasApiError, NylasOAuthError, NylasSdkTimeoutError, } from './models/error.js';
2
2
  import { objKeysToCamelCase, objKeysToSnakeCase } from './utils.js';
3
3
  import { SDK_VERSION } from './version.js';
4
+ import { FormDataEncoder } from 'form-data-encoder';
5
+ import { Readable } from 'stream';
4
6
  import { snakeCase } from 'change-case';
5
- import { getFetch, getRequest } from './utils/fetchWrapper.js';
6
7
  /**
7
8
  * The header key for the debugging flow ID
8
9
  */
@@ -91,7 +92,6 @@ export default class APIClient {
91
92
  controller.abort();
92
93
  }, timeoutDuration);
93
94
  try {
94
- const fetch = await getFetch();
95
95
  const response = await fetch(req, {
96
96
  signal: controller.signal,
97
97
  });
@@ -153,18 +153,32 @@ export default class APIClient {
153
153
  requestOptions.headers['Content-Type'] = 'application/json';
154
154
  }
155
155
  if (optionParams.form) {
156
- requestOptions.body = optionParams.form;
156
+ // Use FormDataEncoder to properly encode the form data with the correct
157
+ // Content-Type header including the multipart boundary.
158
+ // This is required for Node.js environments where formdata-node's FormData
159
+ // doesn't automatically set the Content-Type header on fetch requests.
160
+ const encoder = new FormDataEncoder(optionParams.form);
161
+ // Set the Content-Type header with the boundary from the encoder
162
+ requestOptions.headers['Content-Type'] = encoder.contentType;
163
+ // Convert the encoded form data to a readable stream for the request body
164
+ requestOptions.body = Readable.from(encoder);
165
+ // Node.js native fetch requires duplex: 'half' when sending a streaming body
166
+ requestOptions.duplex = 'half';
157
167
  }
158
168
  return requestOptions;
159
169
  }
160
170
  async newRequest(options) {
161
171
  const newOptions = this.requestOptions(options);
162
- const RequestConstructor = await getRequest();
163
- return new RequestConstructor(newOptions.url, {
172
+ const requestInit = {
164
173
  method: newOptions.method,
165
174
  headers: newOptions.headers,
166
175
  body: newOptions.body,
167
- });
176
+ };
177
+ // Add duplex option for streaming bodies (required by Node.js native fetch)
178
+ if (newOptions.duplex) {
179
+ requestInit.duplex = newOptions.duplex;
180
+ }
181
+ return new Request(newOptions.url, requestInit);
168
182
  }
169
183
  async requestWithResponse(response) {
170
184
  const headers = response?.headers?.entries
@@ -197,11 +211,11 @@ export default class APIClient {
197
211
  }
198
212
  async requestRaw(options) {
199
213
  const response = await this.sendRequest(options);
200
- return response.buffer();
214
+ const arrayBuffer = await response.arrayBuffer();
215
+ return Buffer.from(arrayBuffer);
201
216
  }
202
217
  async requestStream(options) {
203
218
  const response = await this.sendRequest(options);
204
- // TODO: See if we can fix this in a backwards compatible way
205
219
  if (!response.body) {
206
220
  throw new Error('No response body');
207
221
  }
@@ -29,12 +29,13 @@ export class Folders extends Resource {
29
29
  * Return a Folder
30
30
  * @return The folder
31
31
  */
32
- find({ identifier, folderId, overrides, }) {
32
+ find({ identifier, folderId, queryParams, overrides, }) {
33
33
  return super._find({
34
34
  path: makePathParams('/v3/grants/{identifier}/folders/{folderId}', {
35
35
  identifier,
36
36
  folderId,
37
37
  }),
38
+ queryParams,
38
39
  overrides,
39
40
  });
40
41
  }
@@ -1,2 +1,2 @@
1
1
  // This file is generated by scripts/exportVersion.js
2
- export const SDK_VERSION = '7.13.3';
2
+ export const SDK_VERSION = '8.0.1';
@@ -1,6 +1,5 @@
1
1
  import { NylasConfig, OverridableNylasConfig } from './config.js';
2
2
  import { FormData } from 'formdata-node';
3
- import type { Request, Response } from './utils/fetchWrapper.js';
4
3
  /**
5
4
  * The header key for the debugging flow ID
6
5
  */
@@ -45,6 +44,7 @@ interface RequestOptions {
45
44
  url: URL;
46
45
  body?: any;
47
46
  overrides?: Partial<NylasConfig>;
47
+ duplex?: 'half';
48
48
  }
49
49
  /**
50
50
  * The API client for communicating with the Nylas API
@@ -77,6 +77,6 @@ export default class APIClient {
77
77
  requestWithResponse<T>(response: Response): Promise<T>;
78
78
  request<T>(options: RequestOptionsParams): Promise<T>;
79
79
  requestRaw(options: RequestOptionsParams): Promise<Buffer>;
80
- requestStream(options: RequestOptionsParams): Promise<NodeJS.ReadableStream>;
80
+ requestStream(options: RequestOptionsParams): Promise<ReadableStream<Uint8Array>>;
81
81
  }
82
82
  export {};
@@ -130,6 +130,11 @@ export interface Event {
130
130
  * Master event id if recurring events.
131
131
  */
132
132
  masterEventId?: string;
133
+ /**
134
+ * The original start time of the event, in Unix timestamp format.
135
+ * This field is present only if the event is an instance of a recurring event.
136
+ */
137
+ originalStartTime?: number;
133
138
  /**
134
139
  * Notetaker meeting bot settings
135
140
  */
@@ -95,4 +95,20 @@ export interface ListFolderQueryParams extends ListQueryParams {
95
95
  */
96
96
  singleLevel?: boolean;
97
97
  }
98
+ /**
99
+ * Interface representing the query parameters for finding a folder.
100
+ */
101
+ export interface FindFolderQueryParams {
102
+ /**
103
+ * (Microsoft only) When true, Nylas includes hidden folders in its response.
104
+ * @default false
105
+ */
106
+ includeHiddenFolders?: boolean;
107
+ /**
108
+ * Specify fields that you want Nylas to return, as a comma-separated list (for example, select=id,updated_at).
109
+ * This allows you to receive only the portion of object data that you're interested in.
110
+ * You can use select to optimize response size and reduce latency by limiting queries to only the information that you need.
111
+ */
112
+ select?: string;
113
+ }
98
114
  export type UpdateFolderRequest = Partial<CreateFolderRequest>;
@@ -46,7 +46,7 @@ export declare class Attachments extends Resource {
46
46
  * @param queryParams The query parameters to include in the request
47
47
  * @returns {NodeJS.ReadableStream} The ReadableStream containing the file data.
48
48
  */
49
- download({ identifier, attachmentId, queryParams, overrides, }: DownloadAttachmentParams & Overrides): Promise<NodeJS.ReadableStream>;
49
+ download({ identifier, attachmentId, queryParams, overrides, }: DownloadAttachmentParams & Overrides): Promise<ReadableStream<Uint8Array>>;
50
50
  /**
51
51
  * Download the attachment as a byte array
52
52
  * @param identifier Grant ID or email account to query
@@ -1,5 +1,5 @@
1
1
  import { Overrides } from '../config.js';
2
- import { Folder, CreateFolderRequest, UpdateFolderRequest, ListFolderQueryParams } from '../models/folders.js';
2
+ import { Folder, CreateFolderRequest, UpdateFolderRequest, ListFolderQueryParams, FindFolderQueryParams } from '../models/folders.js';
3
3
  import { NylasBaseResponse, NylasResponse, NylasListResponse } from '../models/response.js';
4
4
  import { Resource, AsyncListResponse } from './resource.js';
5
5
  /**
@@ -15,10 +15,12 @@ interface ListFoldersParams {
15
15
  * The parameters for the {@link Folders.find} method
16
16
  * @property identifier The identifier of the grant to act upon
17
17
  * @property folderId The id of the Folder to retrieve
18
+ * @property queryParams The query parameters to include in the request
18
19
  */
19
20
  interface FindFolderParams {
20
21
  identifier: string;
21
22
  folderId: string;
23
+ queryParams?: FindFolderQueryParams;
22
24
  }
23
25
  /**
24
26
  * The parameters for the {@link Folders.create} method
@@ -72,7 +74,7 @@ export declare class Folders extends Resource {
72
74
  * Return a Folder
73
75
  * @return The folder
74
76
  */
75
- find({ identifier, folderId, overrides, }: FindFolderParams & Overrides): Promise<NylasResponse<Folder>>;
77
+ find({ identifier, folderId, queryParams, overrides, }: FindFolderParams & Overrides): Promise<NylasResponse<Folder>>;
76
78
  /**
77
79
  * Create a Folder
78
80
  * @return The created folder
@@ -47,7 +47,7 @@ export declare class Resource {
47
47
  protected _updatePatch<T>(params: PayloadParams<T>): Promise<NylasResponse<T>>;
48
48
  protected _destroy<T>({ path, queryParams, requestBody, overrides, }: DestroyParams): Promise<T>;
49
49
  protected _getRaw({ path, queryParams, overrides, }: FindParams<void>): Promise<Buffer>;
50
- protected _getStream({ path, queryParams, overrides, }: FindParams<void>): Promise<NodeJS.ReadableStream>;
50
+ protected _getStream({ path, queryParams, overrides, }: FindParams<void>): Promise<ReadableStream<Uint8Array>>;
51
51
  }
52
52
  type ListYieldReturn<T> = T & {
53
53
  next: () => Promise<IteratorResult<T, undefined>>;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "7.13.3";
1
+ export declare const SDK_VERSION = "8.0.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "7.13.3",
3
+ "version": "8.0.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",
@@ -11,7 +11,7 @@
11
11
  "cjs-wrapper.d.ts"
12
12
  ],
13
13
  "engines": {
14
- "node": ">=16"
14
+ "node": ">=18"
15
15
  },
16
16
  "scripts": {
17
17
  "test": "jest",
@@ -26,8 +26,8 @@
26
26
  "generate-model-index": "node scripts/generateModelIndex.js",
27
27
  "prebuild": "npm run export-version && npm run generate-model-index",
28
28
  "build": "rm -rf lib && npm run build-esm && npm run build-cjs && npm run generate-lib-package-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
+ "build-esm": "tsc -p tsconfig.esm.json",
30
+ "build-cjs": "tsc -p tsconfig.cjs.json",
31
31
  "prepare": "npm run build",
32
32
  "build:docs": "typedoc --out docs",
33
33
  "version": "npm run export-version && git add src/version.ts"
@@ -45,7 +45,6 @@
45
45
  "form-data-encoder": "^4.1.0",
46
46
  "formdata-node": "^6.0.3",
47
47
  "mime-types": "^2.1.35",
48
- "node-fetch": "^3.3.2",
49
48
  "uuid": "^8.3.2"
50
49
  },
51
50
  "devDependencies": {
@@ -1,55 +0,0 @@
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
- }
@@ -1,55 +0,0 @@
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
- }
@@ -1,22 +0,0 @@
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,22 +0,0 @@
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,19 +0,0 @@
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,18 +0,0 @@
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 };
@@ -1,19 +0,0 @@
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;