Skip to content

Commit c118770

Browse files
authored
chore: refactor package.json import (#43)
1 parent 280ceaf commit c118770

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

src/common/atlas/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ApiClient } from "./apiClient";
2-
import { State } from "../../state";
1+
import { ApiClient } from "./apiClient.js";
2+
import { State } from "../../state.js";
33

44
export async function ensureAuthenticated(state: State, apiClient: ApiClient): Promise<void> {
55
if (!(await isAuthenticated(state, apiClient))) {

src/config.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import path from "path";
2-
import fs from "fs";
3-
import { fileURLToPath } from "url";
42
import os from "os";
5-
6-
const __filename = fileURLToPath(import.meta.url);
7-
const __dirname = path.dirname(__filename);
8-
9-
const packageMetadata = fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8");
10-
const packageJson = JSON.parse(packageMetadata);
3+
import packageJson from "../package.json" with { type: "json" };
114

125
export const config = {
136
atlasApiVersion: `2025-03-12`,

src/tools/mongodb/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { z } from "zod";
22
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
33
import { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver";
44
import { DbOperationType, MongoDBToolBase } from "./mongodbTool.js";
5-
import { ToolArgs } from "../tool";
5+
import { ToolArgs } from "../tool.js";
66
import { ErrorCodes, MongoDBError } from "../../errors.js";
77

88
export class ConnectTool extends MongoDBToolBase {

src/types/mongodb-redact.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "mongodb-redact" {
2+
function redact<T>(message: T): T;
3+
export default redact;
4+
}

tsconfig.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
{
22
"compilerOptions": {
33
"target": "es2020",
4-
"module": "esnext",
5-
"moduleResolution": "node",
4+
"module": "nodenext",
5+
"moduleResolution": "nodenext",
66
"rootDir": "./src",
77
"outDir": "./dist",
88
"strict": true,
99
"esModuleInterop": true,
1010
"types": ["node"],
1111
"sourceMap": true,
12-
"skipLibCheck": true
12+
"skipLibCheck": true,
13+
"resolveJsonModule": true,
14+
"allowSyntheticDefaultImports": true,
15+
"typeRoots": ["./node_modules/@types", "./src/types"]
1316
},
1417
"include": ["src/**/*.ts"]
1518
}

0 commit comments

Comments
 (0)