This is an automated email from the ASF dual-hosted git repository. hainenber pushed a commit to branch chore/prefer-node-native-uuid-generator in repository https://gitbox.apache.org/repos/asf/superset.git
commit 3f7a2daf48c90d5f040f13e1865fdd745741ece7 Author: hainenber <[email protected]> AuthorDate: Tue Jan 13 21:36:22 2026 +0700 chore(websocket): migrate external `uuid` usage with Node's native UUID generator Signed-off-by: hainenber <[email protected]> --- superset-websocket/package-lock.json | 53 ------------------------------------ superset-websocket/package.json | 3 -- superset-websocket/src/index.ts | 4 +-- superset-websocket/utils/loadtest.js | 4 +-- 4 files changed, 4 insertions(+), 60 deletions(-) diff --git a/superset-websocket/package-lock.json b/superset-websocket/package-lock.json index a4a3f6c50f..a257d26959 100644 --- a/superset-websocket/package-lock.json +++ b/superset-websocket/package-lock.json @@ -14,19 +14,16 @@ "ioredis": "^5.9.0", "jsonwebtoken": "^9.0.3", "lodash": "^4.17.21", - "uuid": "^11.1.0", "winston": "^3.19.0", "ws": "^8.19.0" }, "devDependencies": { "@eslint/js": "^9.25.1", "@types/eslint__js": "^8.42.3", - "@types/ioredis": "^5.0.0", "@types/jest": "^29.5.14", "@types/jsonwebtoken": "^9.0.10", "@types/lodash": "^4.17.23", "@types/node": "^25.0.3", - "@types/uuid": "^10.0.0", "@types/ws": "^8.18.1", "@typescript-eslint/eslint-plugin": "^8.26.0", "@typescript-eslint/parser": "^8.51.0", @@ -1745,17 +1742,6 @@ "@types/node": "*" } }, - "node_modules/@types/ioredis": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/ioredis/-/ioredis-5.0.0.tgz", - "integrity": "sha512-zJbJ3FVE17CNl5KXzdeSPtdltc4tMT3TzC6fxQS0sQngkbFZ6h+0uTafsRqu+eSLIugf6Yb0Ea0SUuRr42Nk9g==", - "deprecated": "This is a stub types definition. ioredis provides its own type definitions, so you do not need this installed.", - "dev": true, - "license": "MIT", - "dependencies": { - "ioredis": "*" - } - }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", @@ -1843,12 +1829,6 @@ "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==" }, - "node_modules/@types/uuid": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", - "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", - "dev": true - }, "node_modules/@types/ws": { "version": "8.18.1", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", @@ -6321,19 +6301,6 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, - "node_modules/uuid": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", - "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist/esm/bin/uuid" - } - }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -7871,15 +7838,6 @@ "@types/node": "*" } }, - "@types/ioredis": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/ioredis/-/ioredis-5.0.0.tgz", - "integrity": "sha512-zJbJ3FVE17CNl5KXzdeSPtdltc4tMT3TzC6fxQS0sQngkbFZ6h+0uTafsRqu+eSLIugf6Yb0Ea0SUuRr42Nk9g==", - "dev": true, - "requires": { - "ioredis": "*" - } - }, "@types/istanbul-lib-coverage": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", @@ -7962,12 +7920,6 @@ "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==" }, - "@types/uuid": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", - "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", - "dev": true - }, "@types/ws": { "version": "8.18.1", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", @@ -11162,11 +11114,6 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, - "uuid": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", - "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==" - }, "v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", diff --git a/superset-websocket/package.json b/superset-websocket/package.json index 320761bd16..680539971a 100644 --- a/superset-websocket/package.json +++ b/superset-websocket/package.json @@ -22,19 +22,16 @@ "ioredis": "^5.9.0", "jsonwebtoken": "^9.0.3", "lodash": "^4.17.21", - "uuid": "^11.1.0", "winston": "^3.19.0", "ws": "^8.19.0" }, "devDependencies": { "@eslint/js": "^9.25.1", "@types/eslint__js": "^8.42.3", - "@types/ioredis": "^5.0.0", "@types/jest": "^29.5.14", "@types/jsonwebtoken": "^9.0.10", "@types/lodash": "^4.17.23", "@types/node": "^25.0.3", - "@types/uuid": "^10.0.0", "@types/ws": "^8.18.1", "@typescript-eslint/eslint-plugin": "^8.26.0", "@typescript-eslint/parser": "^8.51.0", diff --git a/superset-websocket/src/index.ts b/superset-websocket/src/index.ts index 6d54bf53ad..961ae45209 100644 --- a/superset-websocket/src/index.ts +++ b/superset-websocket/src/index.ts @@ -19,7 +19,7 @@ import * as http from 'http'; import * as net from 'net'; import WebSocket from 'ws'; -import { v4 as uuidv4 } from 'uuid'; +import { randomUUID } from 'crypto' import jwt, { Algorithm } from 'jsonwebtoken'; import { parse } from 'cookie'; import Redis, { RedisOptions } from 'ioredis'; @@ -168,7 +168,7 @@ export const trackClient = ( ): string => { statsd.increment('ws_connected_client'); - const socketId = uuidv4(); + const socketId = randomUUID(); sockets[socketId] = socketInstance; if (channel in channels) { diff --git a/superset-websocket/utils/loadtest.js b/superset-websocket/utils/loadtest.js index b1da94417c..2cfb618fe9 100644 --- a/superset-websocket/utils/loadtest.js +++ b/superset-websocket/utils/loadtest.js @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -const { v4: uuidv4 } = require('uuid'); const Redis = require('ioredis'); const config = require('../config.json'); +const { randomUUID } = require('crypto'); const redis = new Redis(config.redis); const numClients = 256; @@ -30,7 +30,7 @@ function pushData() { const streamId = `${config.redisStreamPrefix}${channelId}`; const data = { channel_id: channelId, - job_id: uuidv4(), + job_id: randomUUID(), status: 'pending', };
