Skip to content

Commit 26a6495

Browse files
committed
fix: use require instead of module import
1 parent 2edf848 commit 26a6495

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

package-lock.json

Lines changed: 14 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/logging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@mongosh/types": "3.6.0",
2424
"mongodb-log-writer": "^2.3.1",
2525
"mongodb-redact": "^1.1.5",
26-
"native-machine-id": "^0.0.11"
26+
"native-machine-id": "^0.1.0"
2727
},
2828
"devDependencies": {
2929
"@mongodb-js/eslint-config-mongosh": "^1.0.0",

packages/logging/src/logging-and-telemetry.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import type {
5353
MongoshLoggingAndTelemetryArguments,
5454
MongoshTrackingProperties,
5555
} from './types';
56-
import { getMachineId } from 'native-machine-id';
5756
import { createHmac } from 'crypto';
5857

5958
export function setupLoggingAndTelemetry(
@@ -71,7 +70,10 @@ export function setupLoggingAndTelemetry(
7170
export async function getDeviceId(): Promise<string | 'unknown'> {
7271
// Create a hashed format from the all uppercase version of the machine ID
7372
// to match it exactly with the denisbrodbeck/machineid library that Atlas CLI uses.
74-
const originalId = (await getMachineId({ raw: true }))?.toUpperCase();
73+
const originalId = (
74+
await require('native-machine-id').getMachineId({ raw: true })
75+
)?.toUpperCase();
76+
7577
if (!originalId) {
7678
return 'unknown';
7779
}

0 commit comments

Comments
 (0)