backend: Prevent instantiation of utility classes by adding private constructors in helpers

This commit is contained in:
Carlos Santos 2025-03-28 10:19:41 +01:00
parent 74254be37b
commit 7dffc6b60a
3 changed files with 15 additions and 2 deletions

View File

@ -13,6 +13,10 @@ const enum OpenViduComponentsDataTopic {
}
export class OpenViduComponentsAdapterHelper {
private constructor() {
// Prevent instantiation of this utility class
}
static generateRecordingSignal(recordingInfo: MeetRecordingInfo) {
const options: SendDataOptions = {
destinationSids: [],

View File

@ -3,6 +3,10 @@ import { MeetRecordingInfo, MeetRecordingOutputMode, MeetRecordingStatus } from
import { EgressStatus } from '@livekit/protocol';
export class RecordingHelper {
private constructor() {
// Prevent instantiation of this utility class
}
static toRecordingInfo(egressInfo: EgressInfo): MeetRecordingInfo {
const status = RecordingHelper.extractOpenViduStatus(egressInfo.status);
const size = RecordingHelper.extractSize(egressInfo);
@ -140,8 +144,9 @@ export class RecordingHelper {
* @param egressInfo - The EgressInfo object containing the endedAt value.
* @returns The endedAt value converted to milliseconds.
*/
static extractEndDate(egressInfo: EgressInfo): number {
return this.toMilliseconds(Number(egressInfo.endedAt ?? 0));
static extractEndDate(egressInfo: EgressInfo): number | undefined {
const endDateMs = this.toMilliseconds(Number(egressInfo.endedAt ?? 0));
return endDateMs !== 0 ? endDateMs : undefined;
}
/**

View File

@ -4,6 +4,10 @@ import { MEET_NAME_ID } from '../environment.js';
import { uid } from 'uid/single';
export class OpenViduRoomHelper {
private constructor() {
// Prevent instantiation of this utility class
}
/**
* Converts an OpenViduMeetRoom object to an OpenViduMeetRoomOptions object.
*