Skip to content

Commit a9cd585

Browse files
chore(deps): bump cookie and @types/cookie in /superset-websocket (#34335)
Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: hainenber <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hainenber <[email protected]>
1 parent 122bb68 commit a9cd585

File tree

5 files changed

+38
-38
lines changed

5 files changed

+38
-38
lines changed

superset-websocket/package-lock.json

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

superset-websocket/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"license": "Apache-2.0",
1919
"dependencies": {
20-
"cookie": "^0.7.0",
20+
"cookie": "^1.0.2",
2121
"hot-shots": "^11.1.0",
2222
"ioredis": "^5.6.1",
2323
"jsonwebtoken": "^9.0.2",
@@ -28,7 +28,6 @@
2828
},
2929
"devDependencies": {
3030
"@eslint/js": "^9.25.1",
31-
"@types/cookie": "^0.6.0",
3231
"@types/eslint__js": "^8.42.3",
3332
"@types/ioredis": "^4.27.8",
3433
"@types/jest": "^29.5.14",
@@ -52,7 +51,7 @@
5251
"typescript-eslint": "^8.19.0"
5352
},
5453
"engines": {
55-
"node": "^16.9.1",
56-
"npm": "^7.5.4 || ^8.1.2"
54+
"node": "^20.19.4",
55+
"npm": "^10.8.2"
5756
}
5857
}

superset-websocket/spec/config.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* under the License.
1818
*/
1919
import { buildConfig } from '../src/config';
20+
import { expect, test } from '@jest/globals';
2021

2122
test('buildConfig() builds configuration and applies env var overrides', () => {
2223
let config = buildConfig();

superset-websocket/spec/index.test.ts

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,26 @@
1919
const jwt = require('jsonwebtoken');
2020
const config = require('../config.test.json');
2121

22-
import { describe, expect, test, beforeEach, afterEach } from '@jest/globals';
22+
import {
23+
describe,
24+
expect,
25+
test,
26+
beforeEach,
27+
afterEach,
28+
jest,
29+
} from '@jest/globals';
2330
import * as http from 'http';
2431
import * as net from 'net';
2532
import { WebSocket } from 'ws';
2633

34+
interface MockedRedisXrange {
35+
(): Promise<server.StreamResult[]>;
36+
}
37+
2738
// NOTE: these mock variables needs to start with "mock" due to
2839
// calls to `jest.mock` being hoisted to the top of the file.
2940
// https://jestjs.io/docs/es6-class-mocks#calling-jestmock-with-the-module-factory-parameter
30-
const mockRedisXrange = jest.fn();
41+
const mockRedisXrange = jest.fn() as jest.MockedFunction<MockedRedisXrange>;
3142

3243
jest.mock('ws');
3344
jest.mock('ioredis', () => {
@@ -59,7 +70,7 @@ import * as server from '../src/index';
5970
import { statsd } from '../src/index';
6071

6172
describe('server', () => {
62-
let statsdIncrementMock: jest.SpyInstance;
73+
let statsdIncrementMock: jest.SpiedFunction<typeof statsd.increment>;
6374

6475
beforeEach(() => {
6576
mockRedisXrange.mockClear();
@@ -319,10 +330,12 @@ describe('server', () => {
319330

320331
describe('wsConnection', () => {
321332
let ws: WebSocket;
322-
let wsEventMock: jest.SpyInstance;
323-
let trackClientSpy: jest.SpyInstance;
324-
let fetchRangeFromStreamSpy: jest.SpyInstance;
325-
let dateNowSpy: jest.SpyInstance;
333+
let wsEventMock: jest.SpiedFunction<typeof ws.on>;
334+
let trackClientSpy: jest.SpiedFunction<typeof server.trackClient>;
335+
let fetchRangeFromStreamSpy: jest.SpiedFunction<
336+
typeof server.fetchRangeFromStream
337+
>;
338+
let dateNowSpy: jest.SpiedFunction<typeof Date.now>;
326339
let socketInstanceExpected: server.SocketInstance;
327340

328341
const getRequest = (token: string, url: string): http.IncomingMessage => {
@@ -431,8 +444,8 @@ describe('server', () => {
431444

432445
describe('httpUpgrade', () => {
433446
let socket: net.Socket;
434-
let socketDestroySpy: jest.SpyInstance;
435-
let wssUpgradeSpy: jest.SpyInstance;
447+
let socketDestroySpy: jest.SpiedFunction<typeof socket.destroy>;
448+
let wssUpgradeSpy: jest.SpiedFunction<typeof server.wss.handleUpgrade>;
436449

437450
const getRequest = (token: string, url: string): http.IncomingMessage => {
438451
const request = new http.IncomingMessage(new net.Socket());
@@ -496,8 +509,8 @@ describe('server', () => {
496509

497510
describe('checkSockets', () => {
498511
let ws: WebSocket;
499-
let pingSpy: jest.SpyInstance;
500-
let terminateSpy: jest.SpyInstance;
512+
let pingSpy: jest.SpiedFunction<typeof ws.ping>;
513+
let terminateSpy: jest.SpiedFunction<typeof ws.terminate>;
501514
let socketInstance: server.SocketInstance;
502515

503516
beforeEach(() => {

superset-websocket/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import * as net from 'net';
2121
import WebSocket from 'ws';
2222
import { v4 as uuidv4 } from 'uuid';
2323
import jwt, { Algorithm } from 'jsonwebtoken';
24-
import cookie from 'cookie';
24+
import { parse } from 'cookie';
2525
import Redis, { RedisOptions } from 'ioredis';
2626
import StatsD from 'hot-shots';
2727

@@ -285,7 +285,7 @@ export const processStreamResults = (results: StreamResult[]): void => {
285285
* configured via 'jwtCookieName' in the config.
286286
*/
287287
const readChannelId = (request: http.IncomingMessage): string => {
288-
const cookies = cookie.parse(request.headers.cookie || '');
288+
const cookies = parse(request.headers.cookie || '');
289289
const token = cookies[opts.jwtCookieName];
290290

291291
if (!token) throw new Error('JWT not present');

0 commit comments

Comments
 (0)