Skip to content

Commit

Permalink
refactor: update type
Browse files Browse the repository at this point in the history
  • Loading branch information
raviteja83 committed Mar 26, 2024
1 parent a7d1d61 commit af75aec
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/hms-video-store/src/interfaces/peer/hms-peer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { HMSAudioTrack, HMSTrack, HMSVideoTrack } from '../../media/tracks';
import { HMSRole } from '../role';

export type HMSPeerType = 'sip' | 'regular';

export interface HMSPeer {
peerId: string;
name: string;
Expand All @@ -16,7 +18,7 @@ export interface HMSPeer {
groups?: string[];
realtime?: boolean;
isHandRaised: boolean;
type: 'sip' | 'regular';
type: HMSPeerType;

updateRole(newRole: HMSRole): void;
updateName(newName: string): void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { VideoTrackLayerUpdate } from '../connection/channel-messages';
import { HMSPeerType } from '../interfaces/peer/hms-peer';
import { HMSRole } from '../interfaces/role';
import { HMSLocalTrack } from '../media/tracks';
import { HMSTrack, HMSTrackSource } from '../media/tracks/HMSTrack';
Expand Down Expand Up @@ -39,7 +40,7 @@ export interface Info {
name: string;
data: string;
user_id: string;
type: 'sip' | 'regular';
type: HMSPeerType;
}

export enum HMSRecordingState {
Expand Down
1 change: 1 addition & 0 deletions packages/hms-video-store/src/reactive-store/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class SDKToHMS {
joinedAt: sdkPeer.joinedAt,
groups: sdkPeer.groups,
isHandRaised: sdkPeer.isHandRaised,
type: sdkPeer.type,
};
}

Expand Down
2 changes: 2 additions & 0 deletions packages/hms-video-store/src/schema/peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
HMSSimulcastLayerDefinition,
ScreenCaptureHandle,
} from '../interfaces';
import { HMSPeerType } from '../interfaces/peer/hms-peer';

export type HMSPeerID = string;
export type HMSTrackID = string;
Expand Down Expand Up @@ -42,6 +43,7 @@ export interface HMSPeer {
joinedAt?: Date;
groups?: HMSGroupName[];
isHandRaised: boolean;
type: HMSPeerType;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions packages/hms-video-store/src/sdk/models/peer/HMSPeer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { HMSPeer as IHMSPeer } from '../../../interfaces/peer';
import { HMSPeerType } from '../../../interfaces/peer/hms-peer';
import { HMSRole } from '../../../interfaces/role';
import { HMSAudioTrack, HMSTrack, HMSVideoTrack } from '../../../media/tracks';
import { HAND_RAISE_GROUP_NAME } from '../../../utils/constants';
Expand All @@ -16,7 +17,7 @@ export type HMSPeerInit = {
groups?: string[];
realtime?: boolean;
isHandRaised?: boolean;
type: 'sip' | 'regular';
type: HMSPeerType;
};

export class HMSPeer implements IHMSPeer {
Expand All @@ -33,7 +34,7 @@ export class HMSPeer implements IHMSPeer {
networkQuality?: number;
groups?: string[];
realtime?: boolean;
type: 'sip' | 'regular';
type: HMSPeerType;

constructor({
peerId,
Expand Down
3 changes: 3 additions & 0 deletions packages/hms-video-store/src/test/fakeStore/fakeHMSStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const makeFakeStore = (): HMSStore => {
metadata: '{}',
groups: [],
isHandRaised: false,
type: 'regular',
},
'2': {
id: '2',
Expand All @@ -110,6 +111,7 @@ export const makeFakeStore = (): HMSStore => {
metadata: '{"hello":"world"}',
groups: [],
isHandRaised: false,
type: 'regular',
},
'3': {
id: '3',
Expand All @@ -121,6 +123,7 @@ export const makeFakeStore = (): HMSStore => {
auxiliaryTracks: [],
groups: [],
isHandRaised: false,
type: 'regular',
},
},
tracks: {
Expand Down
1 change: 1 addition & 0 deletions packages/hms-video-store/src/test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ export const makeFakePeer = (): HMSPeer => {
videoTrack: '',
groups: [],
isHandRaised: false,
type: 'regular',
};
};

0 comments on commit af75aec

Please sign in to comment.