openvidu-node-client: update dependencies

v2
pabloFuente 2025-11-19 17:46:48 +01:00
parent 5cf0cf0e11
commit 390fdc4870
16 changed files with 4524 additions and 496 deletions

View File

@ -0,0 +1,4 @@
node_modules
lib
coverage
dist

View File

@ -0,0 +1,8 @@
{
"printWidth": 120,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "none",
"semi": true,
"arrowParens": "avoid"
}

View File

@ -5,8 +5,7 @@
[![][OpenViduLogo]](https://openvidu.io)
openvidu-node-client
===
# openvidu-node-client
- **Description**: Library for your NODE server. It is a fully compatible and simple alternative to the REST API exposed by OpenVidu Server.

View File

@ -1,81 +1,37 @@
{
"extends": "tslint:recommended",
"rules": {
"array-type": [
true,
"array"
],
"array-type": [true, "array"],
"ban-types": {
"options": [
[
"Object",
"Avoid using the `Object` type. Did you mean `object`?"
],
["Object", "Avoid using the `Object` type. Did you mean `object`?"],
[
"Function",
"Avoid using the `Function` type. Prefer a specific function type, like `() => void`, or use `ts.AnyFunction`."
],
[
"Boolean",
"Avoid using the `Boolean` type. Did you mean `boolean`?"
],
[
"Number",
"Avoid using the `Number` type. Did you mean `number`?"
],
[
"String",
"Avoid using the `String` type. Did you mean `string`?"
]
["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
["Number", "Avoid using the `Number` type. Did you mean `number`?"],
["String", "Avoid using the `String` type. Did you mean `string`?"]
]
},
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": [
true,
"ignore-same-line"
],
"indent": [
true,
"spaces",
2
],
"interface-name": [
true,
"never-prefix"
],
"comment-format": [true, "check-space"],
"curly": [true, "ignore-same-line"],
"indent": [true, "spaces", 2],
"interface-name": [true, "never-prefix"],
"interface-over-type-literal": true,
"jsdoc-format": true,
"no-inferrable-types": true,
"no-internal-module": true,
"no-null-keyword": false,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": [
true,
"ignore-template-strings"
],
"no-trailing-whitespace": [true, "ignore-template-strings"],
"no-var-keyword": true,
"object-literal-shorthand": true,
"one-line": [
true,
"check-open-brace",
"check-whitespace"
],
"one-line": [true, "check-open-brace", "check-whitespace"],
"prefer-const": true,
"quotemark": [
true,
"single",
"avoid-escape",
"avoid-template"
],
"semicolon": [
true,
"always",
"ignore-bound-class-methods"
],
"quotemark": [true, "single", "avoid-escape", "avoid-template"],
"semicolon": [true, "always", "ignore-bound-class-methods"],
"space-within-parens": true,
"triple-equals": true,
"typedef-whitespace": [
@ -95,29 +51,10 @@
"variable-declaration": "onespace"
}
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type"
],
"no-implicit-dependencies": [
true,
"dev"
],
"object-literal-key-quotes": [
true,
"consistent-as-needed"
],
"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-leading-underscore"
],
"whitespace": [true, "check-branch", "check-decl", "check-operator", "check-module", "check-separator", "check-type"],
"no-implicit-dependencies": [true, "dev"],
"object-literal-key-quotes": [true, "consistent-as-needed"],
"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"],
"arrow-parens": false,
"arrow-return-shorthand": false,
"forin": false,

View File

@ -1,22 +1,17 @@
module.exports = {
lib: [
"lib.dom.d.ts",
"lib.es5.d.ts",
"lib.es2015.promise.d.ts",
"lib.scripthost.d.ts"
],
mode: "file",
module: "commonjs",
name: "OpenVidu Node Client",
target: "es5",
externalPattern: "node_modules",
lib: ['lib.dom.d.ts', 'lib.es5.d.ts', 'lib.es2015.promise.d.ts', 'lib.scripthost.d.ts'],
mode: 'file',
module: 'commonjs',
name: 'OpenVidu Node Client',
target: 'es5',
externalPattern: 'node_modules',
excludeExternals: true,
excludePrivate: true,
excludeProtected: true,
excludeNotExported: true,
theme: "default",
readme: "none",
theme: 'default',
readme: 'none',
includeVersion: true,
listInvalidSymbolLinks: true,
out: "./docs"
}
out: './docs'
};

View File

@ -0,0 +1,90 @@
import importPlugin from 'eslint-plugin-import';
import jsdoc from 'eslint-plugin-jsdoc';
import tseslint from 'typescript-eslint';
export default tseslint.config(
{
ignores: ['lib/**', 'node_modules/**']
},
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
{
files: ['src/**/*.ts'],
languageOptions: {
parser: tseslint.parser
},
plugins: {
'@typescript-eslint': tseslint.plugin,
import: importPlugin,
jsdoc
},
settings: {
jsdoc: {
mode: 'typescript'
},
'import/resolver': {
typescript: {
project: ['./tsconfig.json']
}
}
},
rules: {
'@typescript-eslint/array-type': ['error', { default: 'array-simple', readonly: 'array-simple' }],
'@typescript-eslint/no-restricted-types': [
'error',
{
types: {
Object: {
message: 'Avoid using the `Object` type. Did you mean `object`?'
},
Function: {
message: 'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.'
},
Boolean: {
message: 'Avoid using the `Boolean` type. Did you mean `boolean`?'
},
Number: {
message: 'Avoid using the `Number` type. Did you mean `number`?'
},
String: {
message: 'Avoid using the `String` type. Did you mean `string`?'
}
}
}
],
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/no-duplicate-enum-values': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' }
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: false
}
}
],
'dot-notation': 'error',
semi: ['error', 'always'],
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'jsdoc/check-alignment': 'off',
'jsdoc/check-indentation': 'off',
'no-trailing-spaces': ['error', { skipBlankLines: false, ignoreComments: false }],
'no-var': 'off',
'prefer-rest-params': 'off',
'prefer-const': 'off',
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }]
}
}
);

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,22 @@
{
"author": "OpenVidu",
"dependencies": {
"axios": "1.7.9",
"axios": "1.13.2",
"buffer": "6.0.3"
},
"description": "OpenVidu Node Client",
"devDependencies": {
"@types/node": "20.12.12",
"@eslint/js": "9.39.1",
"@types/node": "24.10.1",
"eslint": "9.39.1",
"eslint-import-resolver-typescript": "4.4.4",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-jsdoc": "61.3.0",
"prettier": "3.6.2",
"ts-node": "10.9.2",
"tslint": "6.1.3",
"typedoc": "0.25.13",
"typescript": "5.4.5"
"typedoc": "0.28.14",
"typescript": "5.9.3",
"typescript-eslint": "8.47.0"
},
"license": "Apache-2.0",
"main": "lib/index.js",
@ -20,8 +26,10 @@
"url": "git://github.com/OpenVidu/openvidu"
},
"scripts": {
"build": "./node_modules/typescript/bin/tsc",
"docs": "./generate-docs.sh"
"build": "npm run lint && npm run beautify && ./node_modules/typescript/bin/tsc",
"docs": "./generate-docs.sh",
"lint": "eslint \"src/**/*.ts\"",
"beautify": "prettier --write ."
},
"typings": "lib/index.d.ts",
"version": "2.31.0"

View File

@ -162,7 +162,7 @@ export class Connection {
json.publishers.forEach((jsonPublisher) => {
const publisherObj: Publisher = new Publisher(jsonPublisher);
fetchedPublisherIds.push(publisherObj.streamId);
let storedPublisher = this.publishers.find((c) => c.streamId === publisherObj.streamId);
const storedPublisher = this.publishers.find((c) => c.streamId === publisherObj.streamId);
if (!!storedPublisher) {
// 2. Update existing Publisher
@ -174,7 +174,7 @@ export class Connection {
});
// 4. Remove closed Publishers from local collection
for (var i = this.publishers.length - 1; i >= 0; --i) {
for (let i = this.publishers.length - 1; i >= 0; --i) {
if (!fetchedPublisherIds.includes(this.publishers[i].streamId)) {
this.publishers.splice(i, 1);
}
@ -194,7 +194,7 @@ export class Connection {
});
// 3. Remove closed Subscribers from local collection
for (var i = this.subscribers.length - 1; i >= 0; --i) {
for (let i = this.subscribers.length - 1; i >= 0; --i) {
if (!fetchedSubscriberIds.includes(this.subscribers[i])) {
this.subscribers.splice(i, 1);
}

View File

@ -20,7 +20,7 @@ export class OpenViduLogger {
*/
log(...args: any[]) {
if (!this.isProdMode) {
this.defaultConsoleLogger.log.apply(this.defaultConsoleLogger.logger, arguments);
this.defaultConsoleLogger.log.apply(this.defaultConsoleLogger.logger, args);
}
}
@ -29,7 +29,7 @@ export class OpenViduLogger {
*/
debug(...args: any[]) {
if (!this.isProdMode) {
this.defaultConsoleLogger.debug.apply(this.defaultConsoleLogger.logger, arguments);
this.defaultConsoleLogger.debug.apply(this.defaultConsoleLogger.logger, args);
}
}
@ -38,7 +38,7 @@ export class OpenViduLogger {
*/
info(...args: any[]) {
if (!this.isProdMode) {
this.defaultConsoleLogger.info.apply(this.defaultConsoleLogger.logger, arguments);
this.defaultConsoleLogger.info.apply(this.defaultConsoleLogger.logger, args);
}
}
@ -46,14 +46,14 @@ export class OpenViduLogger {
* @hidden
*/
warn(...args: any[]) {
this.defaultConsoleLogger.warn.apply(this.defaultConsoleLogger.logger, arguments);
this.defaultConsoleLogger.warn.apply(this.defaultConsoleLogger.logger, args);
}
/**
* @hidden
*/
error(...args: any[]) {
this.defaultConsoleLogger.error.apply(this.defaultConsoleLogger.logger, arguments);
this.defaultConsoleLogger.error.apply(this.defaultConsoleLogger.logger, args);
}
enableProdMode() {

View File

@ -114,7 +114,10 @@ export class OpenVidu {
*
* @param secret Secret configured in your OpenVidu deployment
*/
constructor(private hostname: string, secret: string) {
constructor(
private hostname: string,
secret: string
) {
this.setHostnameAndPort();
this.basicAuth = this.getBasicAuth(secret);
}
@ -136,7 +139,7 @@ export class OpenVidu {
const session = new Session(this, properties);
session
.getSessionHttp()
.then((response) => {
.then((_response) => {
this.activeSessions.push(session);
resolve(session);
})
@ -542,7 +545,7 @@ export class OpenVidu {
res.data.content.forEach((jsonSession) => {
const fetchedSession: Session = new Session(this, jsonSession);
fetchedSessionIds.push(fetchedSession.sessionId);
let storedSession = this.activeSessions.find((s) => s.sessionId === fetchedSession.sessionId);
const storedSession = this.activeSessions.find((s) => s.sessionId === fetchedSession.sessionId);
if (!!storedSession) {
// 2. Update existing Session
@ -559,8 +562,8 @@ export class OpenVidu {
});
// 4. Remove closed sessions from local collection
for (var i = this.activeSessions.length - 1; i >= 0; --i) {
let sessionId = this.activeSessions[i].sessionId;
for (let i = this.activeSessions.length - 1; i >= 0; --i) {
const sessionId = this.activeSessions[i].sessionId;
if (!fetchedSessionIds.includes(sessionId)) {
logger.log("Removing closed session '" + sessionId + "'");
hasChanged = true;
@ -587,7 +590,7 @@ export class OpenVidu {
* @returns A map paring every existing sessionId with true or false depending on whether it has changed or not
*/
fetchWebRtc(): Promise<any> {
// tslint:disable:no-string-literal
/* eslint-disable dot-notation */
const addWebRtcStatsToConnections = (connection: Connection, connectionsExtendedInfo: any) => {
const connectionExtended = connectionsExtendedInfo.find((c) => c.connectionId === connection.connectionId);
if (!!connectionExtended) {
@ -679,7 +682,7 @@ export class OpenVidu {
addWebRtcStatsToConnections(connection, jsonSession.connections.content);
});
fetchedSessionIds.push(fetchedSession.sessionId);
let storedSession = this.activeSessions.find((s) => s.sessionId === fetchedSession.sessionId);
const storedSession = this.activeSessions.find((s) => s.sessionId === fetchedSession.sessionId);
if (!!storedSession) {
// 2. Update existing Session
@ -713,8 +716,8 @@ export class OpenVidu {
});
// 4. Remove closed sessions from local collection
for (var i = this.activeSessions.length - 1; i >= 0; --i) {
let sessionId = this.activeSessions[i].sessionId;
for (let i = this.activeSessions.length - 1; i >= 0; --i) {
const sessionId = this.activeSessions[i].sessionId;
if (!fetchedSessionIds.includes(sessionId)) {
logger.log("Removing closed session '" + sessionId + "'");
sessionChanges[sessionId] = true;
@ -736,7 +739,7 @@ export class OpenVidu {
});
});
}
// tslint:enable:no-string-literal
/* eslint-enable dot-notation */
/**
* Disable all logging except error level

View File

@ -62,7 +62,7 @@ export class Recording {
*/
properties: RecordingProperties;
/* tslint:disable:no-string-literal */
/* eslint-disable dot-notation */
/**
* @hidden
*/
@ -105,7 +105,7 @@ export class Recording {
: Recording.DefaultRecordingPropertiesValues.ignoreFailedStreams;
}
}
/* tslint:enable:no-string-literal */
/* eslint-enable dot-notation */
}
export namespace Recording {

View File

@ -85,7 +85,10 @@ export class Session {
/**
* @hidden
*/
constructor(private ov: OpenVidu, propertiesOrJson?) {
constructor(
private ov: OpenVidu,
propertiesOrJson?
) {
if (!!propertiesOrJson) {
// Defined parameter
if (!!propertiesOrJson.sessionId) {
@ -315,11 +318,11 @@ export class Session {
connectionClosed.publishers.forEach((publisher) => {
this.connections.forEach((con) => {
con.subscribers = con.subscribers.filter((subscriber) => {
// tslint:disable:no-string-literal
/* eslint-disable dot-notation */
if (!!subscriber['streamId']) {
// Subscriber with advanced webRtc configuration properties
return subscriber['streamId'] !== publisher.streamId;
// tslint:enable:no-string-literal
/* eslint-enable dot-notation */
} else {
// Regular string subscribers
return subscriber !== publisher.streamId;
@ -381,11 +384,11 @@ export class Session {
connection.publishers = connection.publishers.filter((pub) => pub.streamId !== streamId);
// Try to remove the Publisher from the Connection subscribers collection
if (!!connection.subscribers && connection.subscribers.length > 0) {
// tslint:disable:no-string-literal
/* eslint-disable dot-notation */
if (!!connection.subscribers[0]['streamId']) {
// Subscriber with advanced webRtc configuration properties
connection.subscribers = connection.subscribers.filter((sub) => sub['streamId'] !== streamId);
// tslint:enable:no-string-literal
/* eslint-enable dot-notation */
} else {
// Regular string subscribers
connection.subscribers = connection.subscribers.filter((sub) => sub !== streamId);
@ -570,7 +573,7 @@ export class Session {
json.connections.content.forEach((jsonConnection) => {
const connectionObj: Connection = new Connection(jsonConnection);
fetchedConnectionIds.push(connectionObj.connectionId);
let storedConnection = this.connections.find((c) => c.connectionId === connectionObj.connectionId);
const storedConnection = this.connections.find((c) => c.connectionId === connectionObj.connectionId);
if (!!storedConnection) {
// 2. Update existing Connection
@ -582,7 +585,7 @@ export class Session {
});
// 4. Remove closed sessions from local collection
for (var i = this.connections.length - 1; i >= 0; --i) {
for (let i = this.connections.length - 1; i >= 0; --i) {
if (!fetchedConnectionIds.includes(this.connections[i].connectionId)) {
this.connections.splice(i, 1);
}

View File

@ -9,19 +9,9 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"typeRoots": ["node_modules/@types"],
"types": ["node"],
"lib": [
"es2016",
"dom"
]
"lib": ["es2016", "dom"]
},
"exclude": [
"config",
"docs",
"lib",
"node_modules"
]
"exclude": ["config", "docs", "lib", "node_modules"]
}