-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from anzusystems/upgrade
Upgrade dependencies
- Loading branch information
Showing
17 changed files
with
2,644 additions
and
2,521 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import eslint from '@eslint/js' | ||
import prettierPluginRecommended from 'eslint-plugin-prettier/recommended' | ||
import tsEslint from 'typescript-eslint' | ||
import unicornPlugin from 'eslint-plugin-unicorn' | ||
import jestPlugin from 'eslint-plugin-jest' | ||
|
||
export default tsEslint.config( | ||
{ | ||
ignores: [ | ||
'node_modules/**', | ||
'coverage/**', | ||
'eslint.config.mjs', | ||
'jest.config.js', | ||
'dist/**', | ||
], | ||
}, | ||
|
||
eslint.configs.recommended, | ||
...tsEslint.configs.recommended, | ||
...tsEslint.configs.stylisticTypeChecked, | ||
unicornPlugin.configs['flat/recommended'], | ||
jestPlugin.configs['flat/recommended'], | ||
prettierPluginRecommended, | ||
{ | ||
rules: { | ||
'prettier/prettier': 2, | ||
'unicorn/no-null': 'off', | ||
'unicorn/filename-case': 'off', | ||
'unicorn/prefer-node-protocol': 'off', | ||
'unicorn/import-style': [ | ||
'error', | ||
{ | ||
extendDefaultStyles: false, | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.ts'], | ||
languageOptions: { | ||
parserOptions: { | ||
project: ['tsconfig.json'], | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: ['test/**/*.ts'], | ||
languageOptions: { | ||
parserOptions: { | ||
project: ['test.tsconfig.json'], | ||
}, | ||
}, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
module.exports = { | ||
'preset': 'ts-jest', | ||
'testEnvironment': 'node', | ||
'testMatch': ['**/test/**/?(*.)+(spec|test).[jt]s?(x)'], | ||
'collectCoverage': true, | ||
'collectCoverageFrom': ['src/**/*.ts'], | ||
'coverageReporters': ['text-summary', 'json', 'html', 'cobertura'], | ||
'reporters': [ | ||
'default', | ||
[ 'jest-junit', { | ||
suiteName: 'Notification jest tests', | ||
outputName: 'TEST-junit.xml' | ||
} ] | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testMatch: ['**/test/**/?(*.)+(spec|test).[jt]s?(x)'], | ||
collectCoverage: true, | ||
collectCoverageFrom: ['src/**/*.ts'], | ||
coverageReporters: ['text-summary', 'json', 'html', 'cobertura'], | ||
reporters: [ | ||
'default', | ||
[ | ||
'jest-junit', | ||
{ | ||
suiteName: 'Notification jest tests', | ||
outputName: 'TEST-junit.xml', | ||
}, | ||
], | ||
'verbose': true, | ||
'setupFiles': [ | ||
'<rootDir>/test/setup-tests.ts' | ||
], | ||
}; | ||
], | ||
verbose: true, | ||
setupFiles: ['<rootDir>/test/setup-tests.ts'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import {Service} from 'typedi' | ||
import {WebSocket} from 'ws' | ||
import {UserWebSocket} from './user-web-socket' | ||
|
||
@Service({global: true}) | ||
export class UserConnections { | ||
private readonly users: Map<string, Set<WebSocket>> = new Map<string, Set<WebSocket>>() | ||
private readonly users: Map<string, Set<UserWebSocket>> = new Map<string, Set<UserWebSocket>>() | ||
|
||
add(socket: WebSocket): void { | ||
add(socket: UserWebSocket): void { | ||
const userSockets = this.users.get(socket.ssoUserId) | ||
if (userSockets && userSockets.add(socket)) { | ||
if (userSockets?.add(socket)) { | ||
return | ||
} | ||
|
||
this.users.set(socket.ssoUserId, new Set<WebSocket>().add(socket)) | ||
this.users.set(socket.ssoUserId, new Set<UserWebSocket>().add(socket)) | ||
} | ||
|
||
remove(socket: WebSocket): void { | ||
remove(socket: UserWebSocket): void { | ||
this.users.get(socket.ssoUserId)?.delete(socket) | ||
} | ||
|
||
getAllForUser(ssoUserId: string): Set<WebSocket> { | ||
return this.users.get(ssoUserId) ?? new Set<WebSocket>() | ||
getAllForUser(ssoUserId: string): Set<UserWebSocket> { | ||
return this.users.get(ssoUserId) ?? new Set<UserWebSocket>() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {WebSocket} from 'ws' | ||
|
||
export interface UserWebSocket extends WebSocket { | ||
isAlive: boolean | ||
ssoUserId: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"include": [ | ||
"test/**/*" | ||
], | ||
"extends": "./tsconfig.json" | ||
} |
Oops, something went wrong.