|
1 | 1 | import createClient, { Client, Middleware } from "openapi-fetch"; |
2 | | -import type { FetchOptions } from "openapi-fetch"; |
| 2 | +import type { ClientOptions, FetchOptions } from "openapi-fetch"; |
3 | 3 | import { ApiClientError } from "./apiClientError.js"; |
4 | 4 | import { paths, operations } from "./openapi.js"; |
5 | 5 | import { CommonProperties, TelemetryEvent } from "../../telemetry/types.js"; |
6 | 6 | import { packageInfo } from "../packageInfo.js"; |
7 | 7 | import logger, { LogId } from "../logger.js"; |
8 | 8 | import { createFetch } from "@mongodb-js/devtools-proxy-support"; |
9 | 9 | import * as oauth from "oauth4webapi"; |
10 | | -import { Request } from "node-fetch"; |
| 10 | +import { Request as NodeFetchRequest } from "node-fetch"; |
11 | 11 |
|
12 | 12 | const ATLAS_API_VERSION = "2025-03-12"; |
13 | 13 |
|
@@ -104,7 +104,7 @@ export class ApiClient { |
104 | 104 | Accept: `application/vnd.atlas.${ATLAS_API_VERSION}+json`, |
105 | 105 | }, |
106 | 106 | fetch: ApiClient.customFetch, |
107 | | - Request: Request, |
| 107 | + Request: NodeFetchRequest as unknown as ClientOptions["Request"], |
108 | 108 | }); |
109 | 109 |
|
110 | 110 | if (this.options.credentials?.clientId && this.options.credentials?.clientSecret) { |
@@ -468,18 +468,10 @@ export class ApiClient { |
468 | 468 | } |
469 | 469 |
|
470 | 470 | async listOrganizations(options?: FetchOptions<operations["listOrganizations"]>) { |
471 | | - console.log(">> listOrg1 "); |
472 | | - try { |
473 | | - const { data, error, response } = await this.client.GET("/api/atlas/v2/orgs", options); |
474 | | - } catch (ex) { |
475 | | - console.error(ex); |
476 | | - } |
477 | | - console.log(">> listOrg2 "); |
| 471 | + const { data, error, response } = await this.client.GET("/api/atlas/v2/orgs", options); |
478 | 472 | if (error) { |
479 | | - console.log(">> listOrg3 "); |
480 | 473 | throw ApiClientError.fromError(response, error); |
481 | 474 | } |
482 | | - console.log(">> listOrg4 "); |
483 | 475 | return data; |
484 | 476 | } |
485 | 477 |
|
|
0 commit comments