diff --git a/meet-ce/typings/src/analytics.ts b/meet-ce/typings/src/analytics.ts index 3f7744ea..0dd381ae 100644 --- a/meet-ce/typings/src/analytics.ts +++ b/meet-ce/typings/src/analytics.ts @@ -6,17 +6,14 @@ export interface MeetAnalytics { * Total number of rooms created */ totalRooms: number; - /** * Number of rooms currently with an active meeting */ activeRooms: number; - /** * Total number of recordings created */ totalRecordings: number; - /** * Number of recordings that are complete and playable */ diff --git a/meet-ce/typings/src/api-key.ts b/meet-ce/typings/src/api-key.ts deleted file mode 100644 index 9eac9c28..00000000 --- a/meet-ce/typings/src/api-key.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface MeetApiKey { - key: string; - creationDate: number; -} diff --git a/meet-ce/typings/src/auth-config.ts b/meet-ce/typings/src/auth-config.ts deleted file mode 100644 index b6ca98a1..00000000 --- a/meet-ce/typings/src/auth-config.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Authentication configuration. - */ -export interface AuthenticationConfig { - /** - * List of allowed OAuth providers for user registration. - */ - oauthProviders: OAuthProviderConfig[]; -} - -/** - * Configuration for OAuth authentication. - */ -export interface OAuthProviderConfig { - provider: OAuthProvider; - clientId: string; - clientSecret: string; - redirectUri: string; -} - -/** - * Supported OAuth providers. - */ -export enum OAuthProvider { - GOOGLE = 'google', - GITHUB = 'github' -} diff --git a/meet-ce/typings/src/database/api-key.entity.ts b/meet-ce/typings/src/database/api-key.entity.ts new file mode 100644 index 00000000..8a8d5313 --- /dev/null +++ b/meet-ce/typings/src/database/api-key.entity.ts @@ -0,0 +1,9 @@ +/** + * Interface representing an API key in the Meet application. + */ +export interface MeetApiKey { + /** Unique identifier for the API key */ + key: string; + /** Timestamp in milliseconds since epoch when the API key was created */ + creationDate: number; +} diff --git a/meet-ce/typings/src/database/global-config.entity.ts b/meet-ce/typings/src/database/global-config.entity.ts new file mode 100644 index 00000000..dcb76617 --- /dev/null +++ b/meet-ce/typings/src/database/global-config.entity.ts @@ -0,0 +1,65 @@ +import { MeetAppearanceConfig } from './room-config.js'; + +/** + * Represents global config for OpenVidu Meet. + */ +export interface GlobalConfig { + /** The projectId is used to identify the project in which the OpenVidu Meet instance is running. */ + projectId: string; + /** Security configuration. See {@link SecurityConfig} for details. */ + securityConfig: SecurityConfig; + /** Webhooks configuration. See {@link WebhookConfig} for details. */ + webhooksConfig: WebhookConfig; + /** Rooms configuration. See {@link MeetAppearanceConfig} for details. */ + roomsConfig: { + appearance: MeetAppearanceConfig; + }; +} + +/** + * Represents the configuration for webhooks in OpenVidu Meet. + */ +export interface WebhookConfig { + /** Indicates whether webhooks are enabled or not */ + enabled: boolean; + /** The URL to which webhook events will be sent */ + url?: string; +} + +/** + * Represents the security configuration for OpenVidu Meet, including authentication settings. + */ +export interface SecurityConfig { + /** Authentication configuration. See {@link AuthenticationConfig} for details */ + authentication: AuthenticationConfig; +} + +/** + * Authentication configuration. + */ +export interface AuthenticationConfig { + /** List of allowed OAuth providers for user registration */ + oauthProviders: OAuthProviderConfig[]; +} + +/** + * Configuration for OAuth authentication. + */ +export interface OAuthProviderConfig { + /** OAuth provider. See {@link OAuthProvider} for details */ + provider: OAuthProvider; + /** Client ID obtained from the OAuth provider. */ + clientId: string; + /** Client secret obtained from the OAuth provider. */ + clientSecret: string; + /** Redirect URI registered with the OAuth provider. */ + redirectUri: string; +} + +/** + * Supported OAuth providers. + */ +export enum OAuthProvider { + GOOGLE = 'google', + GITHUB = 'github' +} diff --git a/meet-ce/typings/src/database/index.ts b/meet-ce/typings/src/database/index.ts new file mode 100644 index 00000000..770fee36 --- /dev/null +++ b/meet-ce/typings/src/database/index.ts @@ -0,0 +1,8 @@ +export * from './api-key.entity.js'; +export * from './global-config.entity.js'; +export * from './recording.entity.js'; +export * from './room-config.js'; +export * from './room-member-permissions.js'; +export * from './room-member.entity.js'; +export * from './room.entity.js'; +export * from './user.entity.js'; diff --git a/meet-ce/typings/src/recording.model.ts b/meet-ce/typings/src/database/recording.entity.ts similarity index 66% rename from meet-ce/typings/src/recording.model.ts rename to meet-ce/typings/src/database/recording.entity.ts index bc4efb43..cdd3314e 100644 --- a/meet-ce/typings/src/recording.model.ts +++ b/meet-ce/typings/src/database/recording.entity.ts @@ -1,14 +1,59 @@ +/** + * Interface representing a recording of a meeting room. + */ +export interface MeetRecordingInfo { + /** Unique identifier for the recording */ + recordingId: string; + /** Identifier of the room being recorded */ + roomId: string; + /** Name of the room being recorded */ + roomName: string; + // outputMode: MeetRecordingOutputMode; + /** Current status of the recording. See {@link MeetRecordingStatus} for details */ + status: MeetRecordingStatus; + /** Layout used for the recording. See {@link MeetRecordingLayout} for details */ + layout?: MeetRecordingLayout; + /** + * Encoding options used for the recording. + * Can be a preset from {@link MeetRecordingEncodingPreset} or + * custom options defined in {@link MeetRecordingEncodingOptions}. + */ + encoding?: MeetRecordingEncodingPreset | MeetRecordingEncodingOptions; + /** Filename of the recording file (if available) */ + filename?: string; + /** Timestamp in milliseconds since epoch when the recording started (if available) */ + startDate?: number; + /** Timestamp in milliseconds since epoch when the recording ended (if available) */ + endDate?: number; + /** Duration in seconds of the recording (if available) */ + duration?: number; + /** Size in bytes of the recording file (if available) */ + size?: number; + /** Error code if the recording failed (if available) */ + errorCode?: number; + /** Error message if the recording failed (if available) */ + error?: string; + /** Additional details about the recording status or errors (if available) */ + details?: string; +} /** - * Recording status enumeration. + * Possible statuses for a recording. */ export enum MeetRecordingStatus { + /** Recording is being prepared and will start soon */ STARTING = 'starting', + /** Recording is currently in progress */ ACTIVE = 'active', + /** Recording is being finalized and will be available soon */ ENDING = 'ending', + /** Recording completed successfully and is available */ COMPLETE = 'complete', + /** Recording failed due to an error */ FAILED = 'failed', + /** Recording was aborted by the system */ ABORTED = 'aborted', + /** Recording could not finish because the system limit was reached */ LIMIT_REACHED = 'limit_reached' } @@ -16,8 +61,11 @@ export enum MeetRecordingStatus { * Layout options for recordings. */ export enum MeetRecordingLayout { + /** Grid layout showing all participants equally */ GRID = 'grid', + /** Layout focusing on the active speaker */ SPEAKER = 'speaker', + /** Layout showing only the dominant speaker */ SINGLE_SPEAKER = 'single-speaker' // GRID_LIGHT = 'grid-light', // SPEAKER_LIGHT = 'speaker-light', @@ -36,32 +84,26 @@ export enum MeetRecordingEncodingPreset { * 1280x720, 60fps, ~4500 kbps. Smooth motion for fast action. */ H264_720P_60 = 'H264_720P_60', - /** * 1920x1080, 30fps, ~4500 kbps. High visual quality for detailed content. */ H264_1080P_30 = 'H264_1080P_30', - /** * 1920x1080, 60fps, ~6000 kbps. Premium quality with very smooth motion. */ H264_1080P_60 = 'H264_1080P_60', - /** * Portrait 720x1280, 30fps. Vertical video optimized for mobile/portrait use. */ PORTRAIT_H264_720P_30 = 'PORTRAIT_H264_720P_30', - /** * Portrait 720x1280, 60fps. Vertical video with smoother motion. */ PORTRAIT_H264_720P_60 = 'PORTRAIT_H264_720P_60', - /** * Portrait 1080x1920, 30fps. High-quality vertical recording. */ PORTRAIT_H264_1080P_30 = 'PORTRAIT_H264_1080P_30', - /** * Portrait 1080x1920, 60fps. Premium vertical recording with smooth motion. */ @@ -129,24 +171,3 @@ export enum MeetRecordingAudioCodec { // export enum MeetRecordingOutputMode { // COMPOSED = 'composed', // } - -/** - * Interface representing a recording - */ -export interface MeetRecordingInfo { - recordingId: string; - roomId: string; - roomName: string; - // outputMode: MeetRecordingOutputMode; - status: MeetRecordingStatus; - layout?: MeetRecordingLayout; - encoding?: MeetRecordingEncodingPreset | MeetRecordingEncodingOptions; - filename?: string; - startDate?: number; - endDate?: number; - duration?: number; - size?: number; - errorCode?: number; - error?: string; - details?: string; -} diff --git a/meet-ce/typings/src/room-config.ts b/meet-ce/typings/src/database/room-config.ts similarity index 71% rename from meet-ce/typings/src/room-config.ts rename to meet-ce/typings/src/database/room-config.ts index 65cdb15e..ecf189c1 100644 --- a/meet-ce/typings/src/room-config.ts +++ b/meet-ce/typings/src/database/room-config.ts @@ -1,4 +1,4 @@ -import { MeetRecordingEncodingOptions, MeetRecordingEncodingPreset, MeetRecordingLayout } from './recording.model.js'; +import { MeetRecordingEncodingOptions, MeetRecordingEncodingPreset, MeetRecordingLayout } from './recording.entity.js'; /** * Interface representing the config for a room. @@ -46,6 +46,9 @@ export interface MeetRecordingConfig { encoding?: MeetRecordingEncodingPreset | MeetRecordingEncodingOptions; } +/** + * Interface representing the config for chat in a room. + */ export interface MeetChatConfig { /** * Indicates if chat is enabled in the room @@ -53,6 +56,9 @@ export interface MeetChatConfig { enabled: boolean; } +/** + * Interface representing the config for virtual backgrounds in a room. + */ export interface MeetVirtualBackgroundConfig { /** * Indicates if virtual backgrounds are enabled in the room @@ -60,12 +66,19 @@ export interface MeetVirtualBackgroundConfig { enabled: boolean; } +/** + * Interface representing the config for end-to-end encryption in a room. + */ export interface MeetE2EEConfig { /** * Indicates if end-to-end encryption is enabled in the room */ enabled: boolean; } + +/** + * Interface representing the config for captions in a room. + */ export interface MeetRoomCaptionsConfig { /** * Indicates if captions are enabled in the room @@ -73,6 +86,9 @@ export interface MeetRoomCaptionsConfig { enabled: boolean; } +/** + * Interface representing the appearance configuration for a room. + */ export interface MeetAppearanceConfig { /** * List of themes available in the room @@ -80,18 +96,34 @@ export interface MeetAppearanceConfig { themes: MeetRoomTheme[]; } +/** + * Interface representing a theme for a room's appearance. + */ export interface MeetRoomTheme { + /** Name of the theme */ name: string; + /** Indicates if the theme is enabled in the room */ enabled: boolean; + /** Base theme mode (light or dark) */ baseTheme: MeetRoomThemeMode; + /** Optional custom background color */ backgroundColor?: string; + /** Optional custom primary color */ primaryColor?: string; + /** Optional custom secondary color */ secondaryColor?: string; + /** Optional custom accent color */ accentColor?: string; + /** Optional custom surface color */ surfaceColor?: string; } +/** + * Enum representing the base theme mode for a room's appearance. + */ export enum MeetRoomThemeMode { + /** Light mode theme */ LIGHT = 'light', + /** Dark mode theme */ DARK = 'dark' } diff --git a/meet-ce/typings/src/permissions/meet-permissions.ts b/meet-ce/typings/src/database/room-member-permissions.ts similarity index 96% rename from meet-ce/typings/src/permissions/meet-permissions.ts rename to meet-ce/typings/src/database/room-member-permissions.ts index c604f88d..9f7d88fe 100644 --- a/meet-ce/typings/src/permissions/meet-permissions.ts +++ b/meet-ce/typings/src/database/room-member-permissions.ts @@ -1,5 +1,5 @@ /** - * Defines permissions for a room member. + * List of permissions for a room member. */ export interface MeetRoomMemberPermissions { /** diff --git a/meet-ce/typings/src/database/room-member.entity.ts b/meet-ce/typings/src/database/room-member.entity.ts new file mode 100644 index 00000000..9698f456 --- /dev/null +++ b/meet-ce/typings/src/database/room-member.entity.ts @@ -0,0 +1,34 @@ +import { MeetRoomMemberPermissions } from './room-member-permissions.js'; + +/** + * Represents a room member. + * A member can be an internal user (identified by userId) or an external user (identified by name). + */ +export interface MeetRoomMember { + /** Unique identifier for the member (equals userId for registered users, or generated for external users) */ + memberId: string; + /** ID of the room the member belongs to */ + roomId: string; + /** Name of the member (either registered or external user name) */ + name: string; + /** Timestamp when the member was added to the room (milliseconds since epoch) */ + membershipDate: number; + /** URL for the member to access the room */ + accessUrl: string; + /** Base role of the member in the room. See {@link MeetRoomMemberRole} for details. */ + baseRole: MeetRoomMemberRole; + /** Custom permissions for the member (if any). Overrides permissions from the base role. See {@link MeetRoomMemberPermissions} for details. */ + customPermissions?: Partial; + /** Effective permissions for the member, calculated from the base role and custom permissions. See {@link MeetRoomMemberPermissions} for details. */ + effectivePermissions: MeetRoomMemberPermissions; + /** Timestamp when the member's effective permissions were last updated (milliseconds since epoch) */ + permissionsUpdatedAt: number; +} + +/** + * Represents the role of a member in a room. + */ +export enum MeetRoomMemberRole { + MODERATOR = 'moderator', + SPEAKER = 'speaker' +} diff --git a/meet-ce/typings/src/room.ts b/meet-ce/typings/src/database/room.entity.ts similarity index 55% rename from meet-ce/typings/src/room.ts rename to meet-ce/typings/src/database/room.entity.ts index 84135b87..c5586551 100644 --- a/meet-ce/typings/src/room.ts +++ b/meet-ce/typings/src/database/room.entity.ts @@ -1,41 +1,10 @@ -import { MeetRoomMemberPermissions } from './permissions/meet-permissions.js'; import { MeetRoomConfig } from './room-config.js'; +import { MeetRoomMemberPermissions } from './room-member-permissions.js'; /** - * Options for creating a room. + * Interface representing a meeting room in the system. */ -export interface MeetRoomOptions { - /** - * Name of the room - */ - roomName?: string; - /** - * Date in milliseconds since epoch when the room will be automatically deleted - */ - autoDeletionDate?: number; - /** - * Configuration for automatic deletion behavior of the room. See {@link MeetRoomAutoDeletionPolicy} for details. - */ - autoDeletionPolicy?: MeetRoomAutoDeletionPolicy; - /** - * Configuration of the room. See {@link MeetRoomConfig} for details. - */ - config?: Partial; - /** - * Roles configuration for the room. See {@link MeetRoomRolesConfig} for details. - */ - roles?: MeetRoomRolesConfig; - /** - * Anonymous access configuration for the room. See {@link MeetRoomAnonymousConfig} for details. - */ - anonymous?: MeetRoomAnonymousConfig; - // maxParticipants?: number | null; -} - -/** - * Representation of a room - */ -export interface MeetRoom extends MeetRoomOptions { +export interface MeetRoom { /** * Unique identifier of the room */ @@ -45,13 +14,21 @@ export interface MeetRoom extends MeetRoomOptions { */ roomName: string; /** - * User ID of the internal Meet user who owns this room + * User ID of the registered Meet user who owns this room */ owner: string; /** - * Timestamp of room creation in milliseconds since epoch + * Timestamp in milliseconds since epoch when the room was created */ creationDate: number; + /** + * Timestamp in milliseconds since epoch when the room will be automatically deleted + */ + autoDeletionDate?: number; + /** + * Configuration for automatic deletion behavior of the room. See {@link MeetRoomAutoDeletionPolicy} for details. + */ + autoDeletionPolicy?: MeetRoomAutoDeletionPolicy; /** * Configuration of the room. See {@link MeetRoomConfig} for details. */ @@ -65,7 +42,7 @@ export interface MeetRoom extends MeetRoomOptions { */ anonymous: MeetRoomAnonymous; /** - * General access URL for authenticated users (owner and internal members) + * General access URL for registered users with access to the room. */ accessUrl: string; /** @@ -73,7 +50,7 @@ export interface MeetRoom extends MeetRoomOptions { */ status: MeetRoomStatus; /** - * Timestamp in milliseconds of the last time the room's role permissions or anonymous access were updated + * Timestamp in milliseconds since epoch of the last time the room's role permissions or anonymous access were updated */ rolesUpdatedAt: number; /** @@ -95,19 +72,6 @@ export interface MeetRoomRoles { }; } -/** - * Roles configuration for creating/updating a room. - * Allows partial permission updates. - */ -export interface MeetRoomRolesConfig { - moderator?: { - permissions: Partial; - }; - speaker?: { - permissions: Partial; - }; -} - /** * Anonymous access configuration for a room. * Defines which roles have anonymous access enabled and their access URLs. @@ -123,19 +87,6 @@ export interface MeetRoomAnonymous { }; } -/** - * Anonymous access configuration for creating/updating a room. - * Only includes enabled flags. - */ -export interface MeetRoomAnonymousConfig { - moderator?: { - enabled: boolean; - }; - speaker?: { - enabled: boolean; - }; -} - /** * Represents the current status of a meeting room. */ @@ -144,12 +95,10 @@ export enum MeetRoomStatus { * Room is open and available to host a meeting. */ OPEN = 'open', - /** * There is an ongoing meeting in the room. */ ACTIVE_MEETING = 'active_meeting', - /** * Room is closed to hosting new meetings. */ @@ -164,12 +113,10 @@ export enum MeetingEndAction { * No action is taken when the meeting ends. */ NONE = 'none', - /** * The room will be closed when the meeting ends. */ CLOSE = 'close', - /** * The room (and its recordings, if any) will be deleted * when the meeting ends. @@ -185,7 +132,6 @@ export interface MeetRoomAutoDeletionPolicy { * Deletion policy when there is an active meeting. */ withMeeting: MeetRoomDeletionPolicyWithMeeting; - /** * Deletion policy when recordings exist. */ @@ -200,12 +146,10 @@ export enum MeetRoomDeletionPolicyWithMeeting { * Force deletion even if there is an active meeting. */ FORCE = 'force', - /** * Delete the room when the meeting ends. */ WHEN_MEETING_ENDS = 'when_meeting_ends', - /** * Fail the deletion if there is an active meeting. */ @@ -220,34 +164,12 @@ export enum MeetRoomDeletionPolicyWithRecordings { * Force deletion even if there are ongoing or previous recordings. */ FORCE = 'force', - /** * Close the room and keep recordings. */ CLOSE = 'close', - /** * Fail the deletion if there are ongoing or previous recordings. */ FAIL = 'fail' } - -export enum MeetRoomDeletionSuccessCode { - ROOM_DELETED = 'room_deleted', - ROOM_WITH_ACTIVE_MEETING_DELETED = 'room_with_active_meeting_deleted', - ROOM_WITH_ACTIVE_MEETING_SCHEDULED_TO_BE_DELETED = 'room_with_active_meeting_scheduled_to_be_deleted', - ROOM_AND_RECORDINGS_DELETED = 'room_and_recordings_deleted', - ROOM_CLOSED = 'room_closed', - ROOM_WITH_ACTIVE_MEETING_AND_RECORDINGS_DELETED = 'room_with_active_meeting_and_recordings_deleted', - ROOM_WITH_ACTIVE_MEETING_CLOSED = 'room_with_active_meeting_closed', - ROOM_WITH_ACTIVE_MEETING_AND_RECORDINGS_SCHEDULED_TO_BE_DELETED = 'room_with_active_meeting_and_recordings_scheduled_to_be_deleted', - ROOM_WITH_ACTIVE_MEETING_SCHEDULED_TO_BE_CLOSED = 'room_with_active_meeting_scheduled_to_be_closed' -} - -export enum MeetRoomDeletionErrorCode { - ROOM_HAS_ACTIVE_MEETING = 'room_has_active_meeting', - ROOM_HAS_RECORDINGS = 'room_has_recordings', - ROOM_WITH_ACTIVE_MEETING_HAS_RECORDINGS = 'room_with_active_meeting_has_recordings', - ROOM_WITH_ACTIVE_MEETING_HAS_RECORDINGS_CANNOT_SCHEDULE_DELETION = 'room_with_active_meeting_has_recordings_cannot_schedule_deletion', - ROOM_WITH_RECORDINGS_HAS_ACTIVE_MEETING = 'room_with_recordings_has_active_meeting' -} diff --git a/meet-ce/typings/src/database/user.entity.ts b/meet-ce/typings/src/database/user.entity.ts new file mode 100644 index 00000000..c570cb44 --- /dev/null +++ b/meet-ce/typings/src/database/user.entity.ts @@ -0,0 +1,29 @@ +/** + * Represents a user in the Meet application. + */ +export interface MeetUser { + /** Unique identifier for the user (lowercase letters, numbers, underscores) */ + userId: string; + /** Name of the user */ + name: string; + /** Timestamp in milliseconds since epoch when the user was registered */ + registrationDate: number; + /** Role of the user. See {@link MeetUserRole} for details. */ + role: MeetUserRole; + /** Hashed password for the user */ + passwordHash: string; + /** Indicates whether the user must change their password on next login */ + mustChangePassword: boolean; +} + +/** + * Defines the possible roles for a Meet user. + */ +export enum MeetUserRole { + /** Represents a user with administrative privileges (can manage all rooms and users) */ + ADMIN = 'admin', + /** Represents a regular user (can manage own rooms and access rooms where they are members) */ + USER = 'user', + /** Represents a user with permissions limited to specific rooms (can only access rooms where they are members) */ + ROOM_MEMBER = 'room_member' +} diff --git a/meet-ce/typings/src/event.model.ts b/meet-ce/typings/src/event.model.ts deleted file mode 100644 index 71db1600..00000000 --- a/meet-ce/typings/src/event.model.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { MeetRoomConfig } from './room-config.js'; -import { MeetRoomMemberRole } from './room-member.js'; - -export enum MeetSignalType { - MEET_ROOM_CONFIG_UPDATED = 'meet_room_config_updated', - MEET_PARTICIPANT_ROLE_UPDATED = 'meet_participant_role_updated' -} - -export interface MeetRoomConfigUpdatedPayload { - roomId: string; - config: MeetRoomConfig; - timestamp: number; -} - -export interface MeetParticipantRoleUpdatedPayload { - roomId: string; - participantIdentity: string; - newRole: MeetRoomMemberRole; - secret?: string; - timestamp: number; -} - -export type MeetSignalPayload = MeetRoomConfigUpdatedPayload | MeetParticipantRoleUpdatedPayload; diff --git a/meet-ce/typings/src/frontend-signal.ts b/meet-ce/typings/src/frontend-signal.ts new file mode 100644 index 00000000..534df9c2 --- /dev/null +++ b/meet-ce/typings/src/frontend-signal.ts @@ -0,0 +1,48 @@ +import { MeetRoomConfig } from './database/room-config.js'; +import { MeetRoomMemberRole } from './database/room-member.entity.js'; + +/** + * Interface representing a signal emitted by OpenVidu Meet to notify clients about real-time updates in the meeting. + */ +export enum MeetSignalType { + /** Emitted when the configuration of a meeting room is updated */ + MEET_ROOM_CONFIG_UPDATED = 'meet_room_config_updated', + /** Emitted when a participant's role in a meeting room is updated */ + MEET_PARTICIPANT_ROLE_UPDATED = 'meet_participant_role_updated' +} + +/** + * Payload for MEET_ROOM_CONFIG_UPDATED signal, + * containing the updated room configuration and related information. + */ +export interface MeetRoomConfigUpdatedPayload { + /** ID of the room whose configuration has been updated */ + roomId: string; + /** Updated configuration of the meeting room */ + config: MeetRoomConfig; + /** Timestamp in milliseconds when the update occurred */ + timestamp: number; +} + +/** + * Payload for MEET_PARTICIPANT_ROLE_UPDATED signal, + * containing information about the participant whose role was updated and the new role. + */ +export interface MeetParticipantRoleUpdatedPayload { + /** ID of the room where the participant's role was updated */ + roomId: string; + /** Identity of the participant whose role was updated */ + participantIdentity: string; + /** New role assigned to the participant */ + newRole: MeetRoomMemberRole; + /** Optional secret for regenerating the participant's token if needed */ + secret?: string; + /** Timestamp in milliseconds when the role update occurred */ + timestamp: number; +} + +/** + * Union type representing the payload of a MeetSignal. + * It can be either a {@link MeetRoomConfigUpdatedPayload} or a {@link MeetParticipantRoleUpdatedPayload}, depending on the signal type. + */ +export type MeetSignalPayload = MeetRoomConfigUpdatedPayload | MeetParticipantRoleUpdatedPayload; diff --git a/meet-ce/typings/src/global-config.ts b/meet-ce/typings/src/global-config.ts deleted file mode 100644 index 6d24cbda..00000000 --- a/meet-ce/typings/src/global-config.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { AuthenticationConfig } from './auth-config.js'; -import { MeetAppearanceConfig } from './room-config.js'; - -/** - * Represents global config for OpenVidu Meet. - */ -export interface GlobalConfig { - projectId: string; - securityConfig: SecurityConfig; - webhooksConfig: WebhookConfig; - roomsConfig: { - appearance: MeetAppearanceConfig; - }; -} - -export interface WebhookConfig { - enabled: boolean; - url?: string; - // events: WebhookEvent[]; -} - -export interface SecurityConfig { - authentication: AuthenticationConfig; -} diff --git a/meet-ce/typings/src/index.ts b/meet-ce/typings/src/index.ts index a53a471a..1bb9643f 100644 --- a/meet-ce/typings/src/index.ts +++ b/meet-ce/typings/src/index.ts @@ -1,23 +1,10 @@ export * from './analytics.js'; -export * from './api-key.js'; -export * from './auth-config.js'; -export * from './event.model.js'; -export * from './global-config.js'; -export * from './permissions/livekit-permissions.js'; -export * from './permissions/meet-permissions.js'; -export * from './recording-response.js'; -export * from './recording.model.js'; -export * from './room-config.js'; -export * from './room-member.js'; -export * from './room-response.js'; -export * from './room.js'; -export * from './sort-pagination.js'; -export * from './user.js'; -export * from './webhook.model.js'; - -// Webcomponent types -export * from './webcomponent/command.model.js'; -export * from './webcomponent/event.model.js'; -export * from './webcomponent/message.type.js'; -export * from './webcomponent/properties.model.js'; +export * from './frontend-signal.js'; +export * from './livekit-permissions.js'; +export * from './request/room-member-request.js'; +export * from './webhook.js'; +export * from './database/index.js'; +export * from './request/index.js'; +export * from './response/index.js'; +export * from './webcomponent/index.js'; diff --git a/meet-ce/typings/src/permissions/livekit-permissions.ts b/meet-ce/typings/src/livekit-permissions.ts similarity index 99% rename from meet-ce/typings/src/permissions/livekit-permissions.ts rename to meet-ce/typings/src/livekit-permissions.ts index ae476e03..96bded8a 100644 --- a/meet-ce/typings/src/permissions/livekit-permissions.ts +++ b/meet-ce/typings/src/livekit-permissions.ts @@ -3,22 +3,18 @@ export enum TrackSource { * @generated from enum value: UNKNOWN = 0; */ UNKNOWN = 0, - /** * @generated from enum value: CAMERA = 1; */ CAMERA = 1, - /** * @generated from enum value: MICROPHONE = 2; */ MICROPHONE = 2, - /** * @generated from enum value: SCREEN_SHARE = 3; */ SCREEN_SHARE = 3, - /** * @generated from enum value: SCREEN_SHARE_AUDIO = 4; */ @@ -28,65 +24,50 @@ export enum TrackSource { interface VideoGrant { /** permission to create a room */ roomCreate?: boolean; - /** permission to join a room as a participant, room must be set */ roomJoin?: boolean; - /** permission to list rooms */ roomList?: boolean; - /** permission to start a recording */ roomRecord?: boolean; - /** permission to control a specific room, room must be set */ roomAdmin?: boolean; - /** name of the room, must be set for admin or join permissions */ room?: string; - /** permissions to control ingress, not specific to any room or ingress */ ingressAdmin?: boolean; - /** * allow participant to publish. If neither canPublish or canSubscribe is set, * both publish and subscribe are enabled */ canPublish?: boolean; - /** * TrackSource types that the participant is allowed to publish * When set, it supersedes CanPublish. Only sources explicitly set here can be published */ canPublishSources?: TrackSource[]; - /** allow participant to subscribe to other tracks */ canSubscribe?: boolean; - /** * allow participants to publish data, defaults to true if not set */ canPublishData?: boolean; - /** * by default, a participant is not allowed to update its own metadata */ canUpdateOwnMetadata?: boolean; - /** participant isn't visible to others */ hidden?: boolean; - /** participant is recording the room, when set, allows room to indicate it's being recorded */ recorder?: boolean; - /** participant allowed to connect to LiveKit as Agent Framework worker */ agent?: boolean; - /** allow participant to subscribe to metrics */ canSubscribeMetrics?: boolean; - /** destination room which this participant can forward to */ destinationRoom?: string; } + /** * Defines LiveKit-specific permissions for a participant. */ diff --git a/meet-ce/typings/src/request/index.ts b/meet-ce/typings/src/request/index.ts new file mode 100644 index 00000000..fc99aa46 --- /dev/null +++ b/meet-ce/typings/src/request/index.ts @@ -0,0 +1,3 @@ +export * from './room-member-request.js'; +export * from './room-request.js'; +export * from './user-request.js'; diff --git a/meet-ce/typings/src/request/room-member-request.ts b/meet-ce/typings/src/request/room-member-request.ts new file mode 100644 index 00000000..ebdc05aa --- /dev/null +++ b/meet-ce/typings/src/request/room-member-request.ts @@ -0,0 +1,42 @@ +import { MeetRoomMemberPermissions } from '../database/room-member-permissions.js'; +import { MeetRoomMemberRole } from '../database/room-member.entity.js'; + +/** + * Options for adding a member to a room. + */ +export interface MeetRoomMemberOptions { + /** Unique identifier for a registered Meet user (mutually exclusive with name) */ + userId?: string; + /** Name for an external user (mutually exclusive with userId) */ + name?: string; + /** The base role assigned to the member. See {@link MeetRoomMemberRole} for details. */ + baseRole: MeetRoomMemberRole; + /** Custom permissions for the member (overrides base role permissions). See {@link MeetRoomMemberPermissions} for details. */ + customPermissions?: Partial; +} + +/** + * Options for generating a room member token. + * A room member token provides access to room resources (recordings, meetings, etc.) + */ +export interface MeetRoomMemberTokenOptions { + /** + * A secret key for room access. Determines the member's role. + */ + secret?: string; + /** + * Whether the token is intended for joining a meeting. + * If true, participantName must be provided. + */ + joinMeeting?: boolean; + /** + * The name of the participant when joining the meeting. + * Required if joinMeeting is true. + */ + participantName?: string; + /** + * The identity of the participant in the meeting. + * Required when refreshing an existing token used to join a meeting. + */ + participantIdentity?: string; +} diff --git a/meet-ce/typings/src/request/room-request.ts b/meet-ce/typings/src/request/room-request.ts new file mode 100644 index 00000000..fc912b41 --- /dev/null +++ b/meet-ce/typings/src/request/room-request.ts @@ -0,0 +1,59 @@ +import { MeetRoomConfig } from '../database/room-config.js'; +import { MeetRoomMemberPermissions } from '../database/room-member-permissions.js'; +import { MeetRoomAutoDeletionPolicy } from '../database/room.entity.js'; + +/** + * Options for creating a room. + */ +export interface MeetRoomOptions { + /** + * Name of the room + */ + roomName?: string; + /** + * Timestamp in milliseconds since epoch when the room will be automatically deleted + */ + autoDeletionDate?: number; + /** + * Configuration for automatic deletion behavior of the room. See {@link MeetRoomAutoDeletionPolicy} for details. + */ + autoDeletionPolicy?: MeetRoomAutoDeletionPolicy; + /** + * Configuration of the room. See {@link MeetRoomConfig} for details. + */ + config?: Partial; + /** + * Roles configuration for the room. See {@link MeetRoomRolesConfig} for details. + */ + roles?: MeetRoomRolesConfig; + /** + * Anonymous access configuration for the room. See {@link MeetRoomAnonymousConfig} for details. + */ + anonymous?: MeetRoomAnonymousConfig; +} + +/** + * Roles configuration for creating/updating a room. + * Allows partial permission updates. + */ +export interface MeetRoomRolesConfig { + moderator?: { + permissions: Partial; + }; + speaker?: { + permissions: Partial; + }; +} + +/** + * Anonymous access configuration for creating/updating a room. + * Only includes enabled flags. + */ +export interface MeetRoomAnonymousConfig { + moderator?: { + enabled: boolean; + }; + speaker?: { + enabled: boolean; + }; +} diff --git a/meet-ce/typings/src/request/user-request.ts b/meet-ce/typings/src/request/user-request.ts new file mode 100644 index 00000000..660988a0 --- /dev/null +++ b/meet-ce/typings/src/request/user-request.ts @@ -0,0 +1,15 @@ +import { MeetUserRole } from '../database/user.entity.js'; + +/** + * Options for creating a new Meet user. + */ +export interface MeetUserOptions { + /** Unique identifier for the user (lowercase letters, numbers, underscores) */ + userId: string; + /** Name of the user */ + name: string; + /** Role of the user. See {@link MeetUserRole} for details. */ + role: MeetUserRole; + /** Plain text password for the user (will be hashed before storage) */ + password: string; +} diff --git a/meet-ce/typings/src/response/index.ts b/meet-ce/typings/src/response/index.ts new file mode 100644 index 00000000..ecc61d5c --- /dev/null +++ b/meet-ce/typings/src/response/index.ts @@ -0,0 +1,5 @@ +export * from './recording-response.js'; +export * from './room-member-response.js'; +export * from './room-response.js'; +export * from './sort-pagination.js'; +export * from './user-response.js'; diff --git a/meet-ce/typings/src/recording-response.ts b/meet-ce/typings/src/response/recording-response.ts similarity index 94% rename from meet-ce/typings/src/recording-response.ts rename to meet-ce/typings/src/response/recording-response.ts index 432bfb7a..b8ff63ec 100644 --- a/meet-ce/typings/src/recording-response.ts +++ b/meet-ce/typings/src/response/recording-response.ts @@ -1,4 +1,4 @@ -import { MeetRecordingInfo, MeetRecordingStatus } from './recording.model.js'; +import { MeetRecordingInfo, MeetRecordingStatus } from '../database/recording.entity.js'; import { SortAndPagination } from './sort-pagination.js'; /** diff --git a/meet-ce/typings/src/response/room-member-response.ts b/meet-ce/typings/src/response/room-member-response.ts new file mode 100644 index 00000000..49bacf8a --- /dev/null +++ b/meet-ce/typings/src/response/room-member-response.ts @@ -0,0 +1,34 @@ +import { MeetRoomMemberPermissions } from '../database/room-member-permissions.js'; +import { MeetRoomMemberRole } from '../database/room-member.entity.js'; +import { SortAndPagination } from './sort-pagination.js'; + +/** + * Filters for querying room members with pagination, sorting, and field selection support. + */ +export interface MeetRoomMemberFilters extends SortAndPagination { + /** Filter by member name (partial match) */ + name?: string; + /** Comma-separated list of fields to include in the response (e.g., "userId,name,baseRole") */ + fields?: string; +} + +/** + * Metadata stored in room member tokens. + * Contains information about the room and member permissions. + */ +export interface MeetRoomMemberTokenMetadata { + /** Token issued at timestamp (milliseconds since epoch) */ + iat: number; + /** URL of the LiveKit server to connect to */ + livekitUrl: string; + /** Unique identifier for the room */ + roomId: string; + /** Unique identifier for the member if defined */ + memberId?: string; + /** Base role assigned to the member. See {@link MeetRoomMemberRole} for details. */ + baseRole: MeetRoomMemberRole; + /** Custom permissions for the member (overrides base role permissions). See {@link MeetRoomMemberPermissions} for details. */ + customPermissions?: Partial; + /** Effective permissions for the member (combination of base role and custom permissions). See {@link MeetRoomMemberPermissions} for details. */ + effectivePermissions: MeetRoomMemberPermissions; +} diff --git a/meet-ce/typings/src/room-response.ts b/meet-ce/typings/src/response/room-response.ts similarity index 60% rename from meet-ce/typings/src/room-response.ts rename to meet-ce/typings/src/response/room-response.ts index 1806ff03..a4df7151 100644 --- a/meet-ce/typings/src/room-response.ts +++ b/meet-ce/typings/src/response/room-response.ts @@ -1,5 +1,5 @@ -import { MeetRoomMemberPermissions } from './permissions/meet-permissions.js'; -import { MeetRoom, MeetRoomStatus } from './room.js'; +import { MeetRoomMemberPermissions } from '../database/room-member-permissions.js'; +import { MeetRoom, MeetRoomStatus } from '../database/room.entity.js'; import { SortAndPagination } from './sort-pagination.js'; /** @@ -34,7 +34,6 @@ export const MEET_ROOM_EXTRA_FIELDS = ['config'] as const satisfies readonly Ext */ export type MeetRoomExtraField = (typeof MEET_ROOM_EXTRA_FIELDS)[number]; - /** * Properties of a {@link MeetRoom} that can be included in the API response when fields filtering is applied. * Derived from MEET_ROOM_FIELDS array which is validated by TypeScript to match MeetRoom keys. @@ -74,6 +73,32 @@ export interface MeetRoomFilters extends SortAndPagination { extraFields?: MeetRoomExtraField[]; } +/** + * Successs codes returned after successfully deleting a room, indicating the outcome of the deletion operation. + */ +export enum MeetRoomDeletionSuccessCode { + ROOM_DELETED = 'room_deleted', + ROOM_WITH_ACTIVE_MEETING_DELETED = 'room_with_active_meeting_deleted', + ROOM_WITH_ACTIVE_MEETING_SCHEDULED_TO_BE_DELETED = 'room_with_active_meeting_scheduled_to_be_deleted', + ROOM_AND_RECORDINGS_DELETED = 'room_and_recordings_deleted', + ROOM_CLOSED = 'room_closed', + ROOM_WITH_ACTIVE_MEETING_AND_RECORDINGS_DELETED = 'room_with_active_meeting_and_recordings_deleted', + ROOM_WITH_ACTIVE_MEETING_CLOSED = 'room_with_active_meeting_closed', + ROOM_WITH_ACTIVE_MEETING_AND_RECORDINGS_SCHEDULED_TO_BE_DELETED = 'room_with_active_meeting_and_recordings_scheduled_to_be_deleted', + ROOM_WITH_ACTIVE_MEETING_SCHEDULED_TO_BE_CLOSED = 'room_with_active_meeting_scheduled_to_be_closed' +} + +/** + * Error codes that can be returned when attempting to delete a room, indicating why the deletion operation failed. + */ +export enum MeetRoomDeletionErrorCode { + ROOM_HAS_ACTIVE_MEETING = 'room_has_active_meeting', + ROOM_HAS_RECORDINGS = 'room_has_recordings', + ROOM_WITH_ACTIVE_MEETING_HAS_RECORDINGS = 'room_with_active_meeting_has_recordings', + ROOM_WITH_ACTIVE_MEETING_HAS_RECORDINGS_CANNOT_SCHEDULE_DELETION = 'room_with_active_meeting_has_recordings_cannot_schedule_deletion', + ROOM_WITH_RECORDINGS_HAS_ACTIVE_MEETING = 'room_with_recordings_has_active_meeting' +} + /** * Utility type to extract keys of T that are objects, used to define which fields can be extraFields. */ diff --git a/meet-ce/typings/src/response/sort-pagination.ts b/meet-ce/typings/src/response/sort-pagination.ts new file mode 100644 index 00000000..0d4e6ef3 --- /dev/null +++ b/meet-ce/typings/src/response/sort-pagination.ts @@ -0,0 +1,35 @@ +/** + * Supported sorting directions for list responses. + */ +export enum SortOrder { + /** + * Sorts results in ascending order. + */ + ASC = 'asc', + /** + * Sorts results in descending order. + */ + DESC = 'desc' +} + +/** + * Common sorting and pagination options for list responses. + */ +export interface SortAndPagination { + /** + * Maximum number of items to include in the current page. + */ + maxItems?: number; + /** + * Token used to request the next page of results. + */ + nextPageToken?: string; + /** + * Field name used to sort the result list. + */ + sortField?: string; + /** + * Sorting direction applied to the result list. + */ + sortOrder?: SortOrder; +} diff --git a/meet-ce/typings/src/response/user-response.ts b/meet-ce/typings/src/response/user-response.ts new file mode 100644 index 00000000..5f10fd3e --- /dev/null +++ b/meet-ce/typings/src/response/user-response.ts @@ -0,0 +1,19 @@ +import { MeetUser, MeetUserRole } from '../database/user.entity.js'; +import { SortAndPagination } from './sort-pagination.js'; + +/** + * Data Transfer Object (DTO) for MeetUser, excluding sensitive fields. + */ +export type MeetUserDTO = Omit; + +/** + * Filters for querying Meet users, extending sorting and pagination options. + */ +export interface MeetUserFilters extends SortAndPagination { + /** Optional filter by user ID (supports partial matches) */ + userId?: string; + /** Optional filter by user name (supports partial matches) */ + name?: string; + /** Optional filter by user role */ + role?: MeetUserRole; +} diff --git a/meet-ce/typings/src/room-member.ts b/meet-ce/typings/src/room-member.ts deleted file mode 100644 index 6e39bc6a..00000000 --- a/meet-ce/typings/src/room-member.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { MeetRoomMemberPermissions } from './permissions/meet-permissions.js'; -import { SortAndPagination } from './sort-pagination.js'; - -/** - * Options for adding a member to a room. - */ -export interface MeetRoomMemberOptions { - userId?: string; // userId of a registered Meet user (mutually exclusive with name) - name?: string; // Name for an external user (mutually exclusive with userId) - baseRole: MeetRoomMemberRole; // The base role assigned to the member - customPermissions?: Partial; // Custom permissions for the member (overrides base role permissions) -} - -/** - * Represents a room member. - * A member can be an internal user (identified by userId) or an external user (identified by name). - */ -export interface MeetRoomMember { - memberId: string; // Unique identifier for the member (equals userId for registered users, or generated for external users) - roomId: string; // ID of the room the member belongs to - name: string; // Name of the member (either registered or external user name) - membershipDate: number; // Timestamp when the member was added to the room - accessUrl: string; // URL for the member to access the room - baseRole: MeetRoomMemberRole; // The base role of the member in the room - customPermissions?: Partial; // Custom permissions for the member (if any) - effectivePermissions: MeetRoomMemberPermissions; // Effective permissions for the member (base role + custom permissions) - permissionsUpdatedAt: number; // Timestamp when the effective permissions were last updated -} - -/** - * Represents the role of a member in a room. - */ -export enum MeetRoomMemberRole { - MODERATOR = 'moderator', - SPEAKER = 'speaker' -} - -export interface MeetRoomMemberFilters extends SortAndPagination { - name?: string; - fields?: string; -} - -/** - * Options for generating a room member token. - * A room member token provides access to room resources (recordings, meetings, etc.) - */ -export interface MeetRoomMemberTokenOptions { - /** - * A secret key for room access. Determines the member's role. - */ - secret?: string; - /** - * Whether the token is intended for joining a meeting. - * If true, participantName must be provided. - */ - joinMeeting?: boolean; - /** - * The name of the participant when joining the meeting. - * Required if joinMeeting is true. - */ - participantName?: string; - /** - * The identity of the participant in the meeting. - * Required when refreshing an existing token used to join a meeting. - */ - participantIdentity?: string; -} - -/** - * Metadata stored in room member tokens. - * Contains information about the room and member permissions. - */ -export interface MeetRoomMemberTokenMetadata { - /** Token issued at timestamp (milliseconds since epoch) */ - iat: number; - livekitUrl: string; - roomId: string; - memberId?: string; - baseRole: MeetRoomMemberRole; - customPermissions?: Partial; - effectivePermissions: MeetRoomMemberPermissions; -} diff --git a/meet-ce/typings/src/sort-pagination.ts b/meet-ce/typings/src/sort-pagination.ts deleted file mode 100644 index f3c3b786..00000000 --- a/meet-ce/typings/src/sort-pagination.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface SortAndPagination { - maxItems?: number; - nextPageToken?: string; - sortField?: string; - sortOrder?: 'asc' | 'desc'; -} diff --git a/meet-ce/typings/src/user.ts b/meet-ce/typings/src/user.ts deleted file mode 100644 index fba2b20c..00000000 --- a/meet-ce/typings/src/user.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { SortAndPagination } from './sort-pagination.js'; - -/** - * Options for creating a new Meet user. - */ -export interface MeetUserOptions { - userId: string; // Unique identifier for the user (lowercase letters, numbers, underscores) - name: string; // Name of the user - role: MeetUserRole; // Role of the user - password: string; // Plain text password for the user (will be hashed before storage) -} - -export interface MeetUser { - userId: string; - name: string; - registrationDate: number; - role: MeetUserRole; - passwordHash: string; - mustChangePassword: boolean; -} - -export enum MeetUserRole { - // Represents a user with administrative privileges (can manage all rooms and users) - ADMIN = 'admin', - // Represents a regular user (can manage own rooms and access rooms where they are members) - USER = 'user', - // Represents a room member role (used for room-specific access) - ROOM_MEMBER = 'room_member' -} - -export type MeetUserDTO = Omit; - -export interface MeetUserFilters extends SortAndPagination { - userId?: string; - name?: string; - role?: MeetUserRole; -} diff --git a/meet-ce/typings/src/webcomponent/command.model.ts b/meet-ce/typings/src/webcomponent/commands.ts similarity index 73% rename from meet-ce/typings/src/webcomponent/command.model.ts rename to meet-ce/typings/src/webcomponent/commands.ts index 17dc0870..b5ca44ac 100644 --- a/meet-ce/typings/src/webcomponent/command.model.ts +++ b/meet-ce/typings/src/webcomponent/commands.ts @@ -4,7 +4,7 @@ export enum WebComponentCommand { /** * Initializes the WebComponent with the given configuration. - * This command is sent from the webcomponent to the iframe for intialice the domain. + * This command is sent from the webcomponent to the iframe to intialice the domain. * @private */ INITIALIZE = 'initialize', @@ -31,14 +31,23 @@ export enum WebComponentCommand { */ export interface WebComponentCommandPayloads { /** - * Payload for the INITIALIZE command. + * Payload for the {@link WebComponentCommand.INITIALIZE} command. * @private */ [WebComponentCommand.INITIALIZE]: { domain: string; }; + /** + * Payload for the {@link WebComponentCommand.END_MEETING} command. + */ [WebComponentCommand.END_MEETING]: void; + /** + * Payload for the {@link WebComponentCommand.LEAVE_ROOM} command. + */ [WebComponentCommand.LEAVE_ROOM]: void; + /** + * Payload for the {@link WebComponentCommand.KICK_PARTICIPANT} command. + */ [WebComponentCommand.KICK_PARTICIPANT]: { participantIdentity: string; }; @@ -50,6 +59,6 @@ export interface WebComponentCommandPayloads { * @category Type Helpers * @private */ -export type WenComponentCommandPayloadFor = T extends keyof WebComponentCommandPayloads +export type WebComponentCommandPayloadFor = T extends keyof WebComponentCommandPayloads ? WebComponentCommandPayloads[T] : never; diff --git a/meet-ce/typings/src/webcomponent/event.model.ts b/meet-ce/typings/src/webcomponent/events.ts similarity index 63% rename from meet-ce/typings/src/webcomponent/event.model.ts rename to meet-ce/typings/src/webcomponent/events.ts index b766f9aa..f20fc4ce 100644 --- a/meet-ce/typings/src/webcomponent/event.model.ts +++ b/meet-ce/typings/src/webcomponent/events.ts @@ -26,13 +26,20 @@ export enum WebComponentEvent { * Reason for emitting the LEFT event in OpenVidu Meet. */ export enum LeftEventReason { - VOLUNTARY_LEAVE = 'voluntary_leave', // The participant left the meeting voluntarily - NETWORK_DISCONNECT = 'network_disconnect', // The participant was disconnected due to network issues - SERVER_SHUTDOWN = 'server_shutdown', // The server was shut down - PARTICIPANT_KICKED = 'participant_kicked', // The participant was removed from the meeting by a moderator - MEETING_ENDED = 'meeting_ended', // The meeting was ended by a moderator or the room was deleted - MEETING_ENDED_BY_SELF = 'meeting_ended_by_self', // The local participant ended the meeting - UNKNOWN = 'unknown' // An unknown reason for leaving the meeting + /** The participant left the meeting voluntarily */ + VOLUNTARY_LEAVE = 'voluntary_leave', + /** The participant was disconnected due to network issues */ + NETWORK_DISCONNECT = 'network_disconnect', + /** The server was shut down unexpectedly */ + SERVER_SHUTDOWN = 'server_shutdown', + /** The participant was kicked from the meeting by a moderator */ + PARTICIPANT_KICKED = 'participant_kicked', + /** A moderator ended the meeting for all participants */ + MEETING_ENDED = 'meeting_ended', + /** The local participant ended the meeting for all participants */ + MEETING_ENDED_BY_SELF = 'meeting_ended_by_self', + /** Unknown reason for leaving the meeting */ + UNKNOWN = 'unknown' } /** @@ -46,10 +53,16 @@ export interface WebComponentEventPayloads { * @private */ [WebComponentEvent.READY]: {}; + /** + * Payload for the {@link WebComponentEvent.JOINED} event. + */ [WebComponentEvent.JOINED]: { roomId: string; participantIdentity: string; }; + /** + * Payload for the {@link WebComponentEvent.LEFT} event. + */ [WebComponentEvent.LEFT]: { roomId: string; participantIdentity: string; diff --git a/meet-ce/typings/src/webcomponent/index.ts b/meet-ce/typings/src/webcomponent/index.ts new file mode 100644 index 00000000..8ef95442 --- /dev/null +++ b/meet-ce/typings/src/webcomponent/index.ts @@ -0,0 +1,4 @@ +export * from './commands.js'; +export * from './events.js'; +export * from './messages.js'; +export * from './properties.js'; diff --git a/meet-ce/typings/src/webcomponent/message.type.ts b/meet-ce/typings/src/webcomponent/messages.ts similarity index 90% rename from meet-ce/typings/src/webcomponent/message.type.ts rename to meet-ce/typings/src/webcomponent/messages.ts index 0e1062a1..be191f37 100644 --- a/meet-ce/typings/src/webcomponent/message.type.ts +++ b/meet-ce/typings/src/webcomponent/messages.ts @@ -1,5 +1,5 @@ -import { WebComponentCommand, WenComponentCommandPayloadFor } from './command.model.js'; -import { WebComponentEvent, WebComponentEventPayloadFor } from './event.model.js'; +import { WebComponentCommand, WebComponentCommandPayloadFor } from './commands.js'; +import { WebComponentEvent, WebComponentEventPayloadFor } from './events.js'; /** * Represents all possible messages exchanged between the host application and WebComponent. @@ -18,7 +18,7 @@ export interface WebComponentInboundCommandMessage; + payload?: WebComponentCommandPayloadFor; } /** @@ -43,7 +43,7 @@ export interface WebComponentOutboundEventMessage( command: T, - payload?: WenComponentCommandPayloadFor + payload?: WebComponentCommandPayloadFor ): WebComponentInboundCommandMessage { return { command, payload }; } diff --git a/meet-ce/typings/src/webcomponent/properties.model.ts b/meet-ce/typings/src/webcomponent/properties.ts similarity index 86% rename from meet-ce/typings/src/webcomponent/properties.model.ts rename to meet-ce/typings/src/webcomponent/properties.ts index 756f800d..f0e97f07 100644 --- a/meet-ce/typings/src/webcomponent/properties.model.ts +++ b/meet-ce/typings/src/webcomponent/properties.ts @@ -1,6 +1,9 @@ +/** + * Enum representing the properties of the OpenVidu Meet web component. + */ export enum WebComponentProperty { /** - * The OpenVidu Meet room URL to connect to (moderator or speaker url) + * The OpenVidu Meet room URL to connect to. * @required This attribute is required unless `recording-url` is provided. */ ROOM_URL = 'room-url', @@ -13,13 +16,11 @@ export enum WebComponentProperty { * Display name for the local participant. */ PARTICIPANT_NAME = 'participant-name', - /** * Secret key for end-to-end encryption (E2EE). * If provided, the participant will join the meeting using E2EE key. */ E2EE_KEY = 'e2ee-key', - /** * URL to redirect to when leaving the meeting. * Redirection occurs after the **`CLOSED` event** fires. diff --git a/meet-ce/typings/src/webhook.model.ts b/meet-ce/typings/src/webhook.model.ts deleted file mode 100644 index 744f6604..00000000 --- a/meet-ce/typings/src/webhook.model.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { MeetRecordingInfo } from './recording.model.js'; -import { MeetRoom } from './room.js'; - -export type MeetWebhookPayload = MeetRecordingInfo | MeetRoom; - -export enum MeetWebhookEventType { - MEETING_STARTED = 'meetingStarted', - MEETING_ENDED = 'meetingEnded', - RECORDING_STARTED = 'recordingStarted', - RECORDING_UPDATED = 'recordingUpdated', - RECORDING_ENDED = 'recordingEnded', - ROOM_FINISHED = 'roomFinished' -} - -export interface MeetWebhookEvent { - creationDate: number; - event: MeetWebhookEventType; - data: MeetWebhookPayload; -} diff --git a/meet-ce/typings/src/webhook.ts b/meet-ce/typings/src/webhook.ts new file mode 100644 index 00000000..30c13a21 --- /dev/null +++ b/meet-ce/typings/src/webhook.ts @@ -0,0 +1,36 @@ +import { MeetRecordingInfo } from './database/recording.entity.js'; +import { MeetRoom } from './database/room.entity.js'; + +/** + * Interface representing a webhook event emitted by OpenVidu Meet. + */ +export interface MeetWebhookEvent { + /** Timestamp in milliseconds since epoch when the event was created */ + creationDate: number; + /** Type of the webhook event. See {@link MeetWebhookEventType} for details. */ + event: MeetWebhookEventType; + /** Payload of the webhook event, containing relevant data about the event. See {@link MeetWebhookPayload} for details. */ + data: MeetWebhookPayload; +} + +/** + * Webhook event types that can be emitted by OpenVidu Meet. + */ +export enum MeetWebhookEventType { + /** Emitted when a meeting starts in a room */ + MEETING_STARTED = 'meetingStarted', + /** Emitted when a meeting ends in a room */ + MEETING_ENDED = 'meetingEnded', + /** Emitted when a recording starts in a room */ + RECORDING_STARTED = 'recordingStarted', + /** Emitted when a recording is updated */ + RECORDING_UPDATED = 'recordingUpdated', + /** Emitted when a recording ends */ + RECORDING_ENDED = 'recordingEnded' +} + +/** + * Payload for OpenVidu Meet webhook events. + * Depending on the event type, the payload can be either {@link MeetRecordingInfo} or {@link MeetRoom}. + */ +export type MeetWebhookPayload = MeetRecordingInfo | MeetRoom;