Skip to content

Commit 66839d7

Browse files
committed
chore: Fix compilation errors and make more explicit required types
1 parent 5e81707 commit 66839d7

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/common/atlas/apiClient.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import createClient, { Client, Middleware } from "openapi-fetch";
2-
import type { FetchOptions } from "openapi-fetch";
2+
import type { ClientOptions, FetchOptions } from "openapi-fetch";
33
import { ApiClientError } from "./apiClientError.js";
44
import { paths, operations } from "./openapi.js";
55
import { CommonProperties, TelemetryEvent } from "../../telemetry/types.js";
66
import { packageInfo } from "../packageInfo.js";
77
import logger, { LogId } from "../logger.js";
88
import { createFetch } from "@mongodb-js/devtools-proxy-support";
99
import * as oauth from "oauth4webapi";
10-
import { Request } from "node-fetch";
10+
import { Request as NodeFetchRequest } from "node-fetch";
1111

1212
const ATLAS_API_VERSION = "2025-03-12";
1313

@@ -104,7 +104,7 @@ export class ApiClient {
104104
Accept: `application/vnd.atlas.${ATLAS_API_VERSION}+json`,
105105
},
106106
fetch: ApiClient.customFetch,
107-
Request: Request,
107+
Request: NodeFetchRequest as unknown as ClientOptions["Request"],
108108
});
109109

110110
if (this.options.credentials?.clientId && this.options.credentials?.clientSecret) {
@@ -468,18 +468,10 @@ export class ApiClient {
468468
}
469469

470470
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);
478472
if (error) {
479-
console.log(">> listOrg3 ");
480473
throw ApiClientError.fromError(response, error);
481474
}
482-
console.log(">> listOrg4 ");
483475
return data;
484476
}
485477

0 commit comments

Comments
 (0)