diff --git a/package-lock.json b/package-lock.json index 0696f37a23..360333d546 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3539,18 +3539,6 @@ "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==", "dev": true }, - "node_modules/@types/uuid": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.2.tgz", - "integrity": "sha512-kNnC1GFBLuhImSnV7w4njQkUiJi0ZXUycu1rUaouPqiKlXkh77JKgdRnTAp1x5eBwcIwbtI+3otwzuIDEuDoxQ==", - "dev": true - }, - "node_modules/@types/wrap-ansi": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz", - "integrity": "sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==", - "dev": true - }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "7.13.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.13.0.tgz", @@ -20892,6 +20880,7 @@ "version": "9.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "dev": true, "bin": { "uuid": "dist/bin/uuid" } @@ -22002,8 +21991,7 @@ "oas": "^20.10.2", "ssri": "^10.0.1", "timeout-signal": "^1.1.0", - "type-is": "^1.6.18", - "uuid": "^9.0.0" + "type-is": "^1.6.18" }, "devDependencies": { "@readme/eslint-config": "^14.0.0", @@ -22018,7 +22006,6 @@ "@types/ssri": "^7.1.1", "@types/supertest": "^2.0.12", "@types/type-is": "^1.6.3", - "@types/uuid": "^9.0.2", "@vitest/coverage-v8": "^2.0.4", "eslint": "^8.34.0", "express": "^4.18.2", diff --git a/packages/node/package.json b/packages/node/package.json index 49fd2664f9..140b800d9c 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -32,8 +32,7 @@ "oas": "^20.10.2", "ssri": "^10.0.1", "timeout-signal": "^1.1.0", - "type-is": "^1.6.18", - "uuid": "^9.0.0" + "type-is": "^1.6.18" }, "devDependencies": { "@readme/eslint-config": "^14.0.0", @@ -48,7 +47,6 @@ "@types/ssri": "^7.1.1", "@types/supertest": "^2.0.12", "@types/type-is": "^1.6.3", - "@types/uuid": "^9.0.2", "@vitest/coverage-v8": "^2.0.4", "eslint": "^8.34.0", "express": "^4.18.2", diff --git a/packages/node/src/lib/construct-payload.ts b/packages/node/src/lib/construct-payload.ts index 67927674f0..0c1b1a707e 100644 --- a/packages/node/src/lib/construct-payload.ts +++ b/packages/node/src/lib/construct-payload.ts @@ -3,11 +3,11 @@ import type { UUID } from 'node:crypto'; import type { IncomingMessage, ServerResponse } from 'node:http'; import type { TLSSocket } from 'tls'; +import { randomUUID } from 'node:crypto'; import os from 'os'; import { URL } from 'url'; import ssri from 'ssri'; -import { v4 as uuidv4 } from 'uuid'; import { version } from '../../package.json'; @@ -142,7 +142,7 @@ export function constructPayload( const serverTime = payloadData.responseEndDateTime.getTime() - payloadData.startedDateTime.getTime(); return { - _id: payloadData.logId || (uuidv4() as UUID), + _id: payloadData.logId || randomUUID(), _version: 3, group: { id: mask(payloadData.apiKey), diff --git a/packages/node/src/lib/log.ts b/packages/node/src/lib/log.ts index 6b9deb5f1d..ad4a5a324a 100644 --- a/packages/node/src/lib/log.ts +++ b/packages/node/src/lib/log.ts @@ -1,12 +1,11 @@ import type { LogOptions } from './construct-payload'; import type { GroupingObject, OutgoingLogBody } from './metrics-log'; -import type { UUID } from 'node:crypto'; import type { IncomingMessage, ServerResponse } from 'node:http'; +import { randomUUID } from 'node:crypto'; import * as url from 'url'; import clamp from 'lodash/clamp'; -import { v4 as uuidv4 } from 'uuid'; import config from '../config'; @@ -108,7 +107,7 @@ export function log( const bufferLength = clamp(options.bufferLength || config.bufferLength, 1, 30); const startedDateTime = new Date(); - const logId = uuidv4() as UUID; + const logId = randomUUID(); // baseLogUrl can be provided, but if it isn't then we // attempt to fetch it from the ReadMe API diff --git a/packages/node/src/lib/metrics-log.ts b/packages/node/src/lib/metrics-log.ts index d487303199..1701d16657 100644 --- a/packages/node/src/lib/metrics-log.ts +++ b/packages/node/src/lib/metrics-log.ts @@ -1,6 +1,6 @@ import type { Options } from './log'; -import type { UUID } from 'crypto'; import type { Har } from 'har-format'; +import type { UUID } from 'node:crypto'; import timeoutSignal from 'timeout-signal';