UNPKG

@fishjam-cloud/js-server-sdk

Version:
1,230 lines (1,192 loc) 61.6 kB
import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire'; /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Connection details for a MoQ relay client * @export * @interface MoqAccess */ interface MoqAccess { /** * Relay connection URL with the JWT embedded as a `?jwt=` query parameter. Pass directly to a MoQ client SDK. * @type {string} * @memberof MoqAccess */ connection_url: string; /** * JWT authorizing the MoQ relay connection, also embedded in `connection_url` * @type {string} * @memberof MoqAccess */ token: string; } /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * MoQ access configuration * @export * @interface MoqAccessConfig */ interface MoqAccessConfig { /** * Path under the root the token grants publish access to * @type {string} * @memberof MoqAccessConfig */ publishPath?: string | null; /** * Path under the root the token grants subscribe access to * @type {string} * @memberof MoqAccessConfig */ subscribePath?: string | null; } /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * The sample rate of the output audio * @export */ declare const AudioSampleRate: { readonly NUMBER_16000: 16000; readonly NUMBER_24000: 24000; }; type AudioSampleRate = typeof AudioSampleRate[keyof typeof AudioSampleRate]; /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * The format of the output audio * @export */ declare const AudioFormat: { readonly Pcm16: "pcm16"; }; type AudioFormat = typeof AudioFormat[keyof typeof AudioFormat]; /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Output audio options * @export * @interface AgentOutput */ interface AgentOutput { /** * * @type {AudioFormat} * @memberof AgentOutput */ audioFormat?: AudioFormat; /** * * @type {AudioSampleRate} * @memberof AgentOutput */ audioSampleRate?: AudioSampleRate; } /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Configuration of peer's subscribing policy * @export */ declare const SubscribeMode: { readonly Auto: "auto"; readonly Manual: "manual"; }; type SubscribeMode = typeof SubscribeMode[keyof typeof SubscribeMode]; /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Options specific to the Agent peer * @export * @interface PeerOptionsAgent */ interface PeerOptionsAgent { /** * * @type {AgentOutput} * @memberof PeerOptionsAgent */ output?: AgentOutput; /** * * @type {SubscribeMode} * @memberof PeerOptionsAgent */ subscribeMode?: SubscribeMode; } /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Options specific to the VAPI peer * @export * @interface PeerOptionsVapi */ interface PeerOptionsVapi { /** * VAPI API key * @type {string} * @memberof PeerOptionsVapi */ apiKey: string; /** * VAPI call ID * @type {string} * @memberof PeerOptionsVapi */ callId: string; /** * * @type {SubscribeMode} * @memberof PeerOptionsVapi */ subscribeMode?: SubscribeMode; } /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Options specific to the WebRTC peer * @export * @interface PeerOptionsWebRTC */ interface PeerOptionsWebRTC { /** * Custom peer metadata * @type {{ [key: string]: any; }} * @memberof PeerOptionsWebRTC */ metadata?: { [key: string]: any; }; /** * * @type {SubscribeMode} * @memberof PeerOptionsWebRTC */ subscribeMode?: SubscribeMode; } /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Describes peer's subscriptions in manual mode * @export * @interface Subscriptions */ interface Subscriptions { /** * List of peer IDs this peer subscribes to * @type {Array<string>} * @memberof Subscriptions */ peers: Array<string>; /** * List of track IDs this peer subscribes to * @type {Array<string>} * @memberof Subscriptions */ tracks: Array<string>; } /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Informs about the peer status * @export */ declare const PeerStatus: { readonly Connected: "connected"; readonly Disconnected: "disconnected"; }; type PeerStatus = typeof PeerStatus[keyof typeof PeerStatus]; /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Peer type * @export */ declare const PeerType$1: { readonly Webrtc: "webrtc"; readonly Agent: "agent"; readonly Vapi: "vapi"; }; type PeerType$1 = typeof PeerType$1[keyof typeof PeerType$1]; /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Media type carried by the track * @export */ declare const TrackType$2: { readonly Audio: "audio"; readonly Video: "video"; }; type TrackType$2 = typeof TrackType$2[keyof typeof TrackType$2]; /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Media track of a Peer * @export * @interface Track */ interface Track$2 { /** * Assigned track id * @type {string} * @memberof Track */ id?: string; /** * Metadata attached to the track by the peer * @type {object} * @memberof Track */ metadata?: object | null; /** * * @type {TrackType} * @memberof Track */ type?: TrackType$2; } /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Describes peer status * @export * @interface Peer */ interface Peer$1 { /** * Assigned peer id * @type {string} * @memberof Peer */ id: string; /** * Custom metadata set by the peer * @type {object} * @memberof Peer */ metadata: object | null; /** * * @type {PeerStatus} * @memberof Peer */ status: PeerStatus; /** * * @type {SubscribeMode} * @memberof Peer */ subscribeMode: SubscribeMode; /** * * @type {Subscriptions} * @memberof Peer */ subscriptions: Subscriptions; /** * List of all peer's tracks * @type {Array<Track>} * @memberof Peer */ tracks: Array<Track$2>; /** * * @type {PeerType} * @memberof Peer */ type: PeerType$1; } /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * The use-case of the room. If not provided, this defaults to conference. * @export */ declare const RoomType: { readonly FullFeature: "full_feature"; readonly AudioOnly: "audio_only"; readonly Broadcaster: "broadcaster"; readonly Livestream: "livestream"; readonly Conference: "conference"; readonly AudioOnlyLivestream: "audio_only_livestream"; }; type RoomType = typeof RoomType[keyof typeof RoomType]; /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Enforces video codec for each peer in the room * @export */ declare const VideoCodec: { readonly H264: "h264"; readonly Vp8: "vp8"; }; type VideoCodec = typeof VideoCodec[keyof typeof VideoCodec]; /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Room configuration * @export * @interface RoomConfig */ interface RoomConfig { /** * If true, webhook notifications for this room are coalesced into a single NotificationBatch per HTTP send instead of one request per notification. VAD notifications are unaffected. * @type {boolean} * @memberof RoomConfig */ batchWebhookNotifications?: boolean; /** * Maximum amount of peers allowed into the room * @type {number} * @memberof RoomConfig */ maxPeers?: number | null; /** * True if livestream viewers can omit specifying a token. * @type {boolean} * @memberof RoomConfig */ public?: boolean; /** * * @type {RoomType} * @memberof RoomConfig */ roomType?: RoomType; /** * * @type {VideoCodec} * @memberof RoomConfig */ videoCodec?: VideoCodec; /** * Deprecated: configure the webhook in the Dashboard instead. URL where Fishjam notifications will be sent; overrides the Dashboard-configured webhook URL * @type {string} * @memberof RoomConfig * @deprecated */ webhookUrl?: string | null; } /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Streamer authorization token * @export * @interface StreamerToken */ interface StreamerToken { /** * Token streamer should authorize with * @type {string} * @memberof StreamerToken */ token: string; } /** * Fishjam API * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) * * The version of the OpenAPI document: 0.28.1 * Contact: contact@fishjam.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * Viewer authorization token * @export * @interface ViewerToken */ interface ViewerToken { /** * Token viewer should authorize with * @type {string} * @memberof ViewerToken */ token: string; } /** Defines types of tracks being published by peers and component */ declare enum TrackType$1 { TRACK_TYPE_UNSPECIFIED = 0, TRACK_TYPE_VIDEO = 1, TRACK_TYPE_AUDIO = 2, UNRECOGNIZED = -1 } /** Describes a media track */ interface Track$1 { id: string; type: TrackType$1; metadata: string; } declare const Track$1: MessageFns$2<Track$1>; type Builtin$2 = Date | Function | Uint8Array | string | number | boolean | undefined; type DeepPartial$2<T> = T extends Builtin$2 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$2<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$2<U>> : T extends {} ? { [K in keyof T]?: DeepPartial$2<T[K]>; } : Partial<T>; type KeysOfUnion$2<T> = T extends T ? keyof T : never; type Exact$2<P, I extends P> = P extends Builtin$2 ? P : P & { [K in keyof P]: Exact$2<P[K], I[K]>; } & { [K in Exclude<keyof I, KeysOfUnion$2<P>>]: never; }; interface MessageFns$2<T> { encode(message: T, writer?: BinaryWriter): BinaryWriter; decode(input: BinaryReader | Uint8Array, length?: number): T; fromJSON(object: any): T; toJSON(message: T): unknown; create<I extends Exact$2<DeepPartial$2<T>, I>>(base?: I): T; fromPartial<I extends Exact$2<DeepPartial$2<T>, I>>(object: I): T; } declare enum ServerMessage_PeerType { PEER_TYPE_UNSPECIFIED = 0, PEER_TYPE_WEBRTC = 1, PEER_TYPE_AGENT = 2, PEER_TYPE_VAPI = 3, UNRECOGNIZED = -1 } /** Defines message groups for which peer can subscribe */ declare enum ServerMessage_EventType { EVENT_TYPE_UNSPECIFIED = 0, EVENT_TYPE_SERVER_NOTIFICATION = 1, UNRECOGNIZED = -1 } declare enum ServerMessage_VadNotification_Status { STATUS_UNSPECIFIED = 0, STATUS_SILENCE = 1, STATUS_SPEECH = 2, UNRECOGNIZED = -1 } /** Defines any type of message passed between FJ and server peer */ interface ServerMessage { authenticated?: ServerMessage_Authenticated | undefined; authRequest?: ServerMessage_AuthRequest | undefined; subscribeRequest?: ServerMessage_SubscribeRequest | undefined; subscribeResponse?: ServerMessage_SubscribeResponse | undefined; roomCreated?: ServerMessage_RoomCreated | undefined; roomDeleted?: ServerMessage_RoomDeleted | undefined; roomCrashed?: ServerMessage_RoomCrashed | undefined; peerConnected?: ServerMessage_PeerConnected | undefined; peerDisconnected?: ServerMessage_PeerDisconnected | undefined; peerCrashed?: ServerMessage_PeerCrashed | undefined; peerMetadataUpdated?: ServerMessage_PeerMetadataUpdated | undefined; trackAdded?: ServerMessage_TrackAdded | undefined; trackRemoved?: ServerMessage_TrackRemoved | undefined; trackMetadataUpdated?: ServerMessage_TrackMetadataUpdated | undefined; peerAdded?: ServerMessage_PeerAdded | undefined; peerDeleted?: ServerMessage_PeerDeleted | undefined; channelAdded?: ServerMessage_ChannelAdded | undefined; channelRemoved?: ServerMessage_ChannelRemoved | undefined; trackForwarding?: ServerMessage_TrackForwarding | undefined; trackForwardingRemoved?: ServerMessage_TrackForwardingRemoved | undefined; vadNotification?: ServerMessage_VadNotification | undefined; viewerConnected?: ServerMessage_ViewerConnected | undefined; viewerDisconnected?: ServerMessage_ViewerDisconnected | undefined; streamerConnected?: ServerMessage_StreamerConnected | undefined; streamerDisconnected?: ServerMessage_StreamerDisconnected | undefined; /** Batch */ notificationBatch?: ServerMessage_NotificationBatch | undefined; /** @deprecated */ streamConnected?: ServerMessage_StreamConnected | undefined; /** @deprecated */ streamDisconnected?: ServerMessage_StreamDisconnected | undefined; /** @deprecated */ hlsPlayable?: ServerMessage_HlsPlayable | undefined; /** @deprecated */ hlsUploaded?: ServerMessage_HlsUploaded | undefined; /** @deprecated */ hlsUploadCrashed?: ServerMessage_HlsUploadCrashed | undefined; /** @deprecated */ componentCrashed?: ServerMessage_ComponentCrashed | undefined; } declare const ServerMessage: MessageFns$1<ServerMessage>; /** Notification sent when a room crashes */ interface ServerMessage_RoomCrashed { roomId: string; } declare const ServerMessage_RoomCrashed: MessageFns$1<ServerMessage_RoomCrashed>; /** Notification sent when a peer is added */ interface ServerMessage_PeerAdded { roomId: string; peerId: string; peerType: ServerMessage_PeerType; } declare const ServerMessage_PeerAdded: MessageFns$1<ServerMessage_PeerAdded>; /** Notification sent when a peer is removed */ interface ServerMessage_PeerDeleted { roomId: string; peerId: string; peerType: ServerMessage_PeerType; } declare const ServerMessage_PeerDeleted: MessageFns$1<ServerMessage_PeerDeleted>; /** Notification sent when a peer connects */ interface ServerMessage_PeerConnected { roomId: string; peerId: string; peerType: ServerMessage_PeerType; } declare const ServerMessage_PeerConnected: MessageFns$1<ServerMessage_PeerConnected>; /** Notification sent when a peer disconnects from FJ */ interface ServerMessage_PeerDisconnected { roomId: string; peerId: string; peerType: ServerMessage_PeerType; } declare const ServerMessage_PeerDisconnected: MessageFns$1<ServerMessage_PeerDisconnected>; /** Notification sent when a peer crashes */ interface ServerMessage_PeerCrashed { roomId: string; peerId: string; reason: string; peerType: ServerMessage_PeerType; } declare const ServerMessage_PeerCrashed: MessageFns$1<ServerMessage_PeerCrashed>; /** Notification sent when a component crashes */ interface ServerMessage_ComponentCrashed { roomId: string; componentId: string; } declare const ServerMessage_ComponentCrashed: MessageFns$1<ServerMessage_ComponentCrashed>; /** Response sent by FJ, confirming successfull authentication */ interface ServerMessage_Authenticated { } declare const ServerMessage_Authenticated: MessageFns$1<ServerMessage_Authenticated>; /** Request sent by peer, to authenticate to FJ server */ interface ServerMessage_AuthRequest { token: string; } declare const ServerMessage_AuthRequest: MessageFns$1<ServerMessage_AuthRequest>; /** Request sent by peer to subscribe for certain message type */ interface ServerMessage_SubscribeRequest { eventType: ServerMessage_EventType; } declare const ServerMessage_SubscribeRequest: MessageFns$1<ServerMessage_SubscribeRequest>; /** Response sent by FJ, confirming subscription for message type */ interface ServerMessage_SubscribeResponse { eventType: ServerMessage_EventType; } declare const ServerMessage_SubscribeResponse: MessageFns$1<ServerMessage_SubscribeResponse>; /** Notification sent when a room is created */ interface ServerMessage_RoomCreated { roomId: string; } declare const ServerMessage_RoomCreated: MessageFns$1<ServerMessage_RoomCreated>; /** Notification sent when a room is deleted */ interface ServerMessage_RoomDeleted { roomId: string; } declare const ServerMessage_RoomDeleted: MessageFns$1<ServerMessage_RoomDeleted>; /** Notification sent when the HLS stream becomes available in a room */ interface ServerMessage_HlsPlayable { roomId: string; componentId: string; } declare const ServerMessage_HlsPlayable: MessageFns$1<ServerMessage_HlsPlayable>; /** Notification sent when the HLS recording is successfully uploaded to AWS S3 */ interface ServerMessage_HlsUploaded { roomId: string; } declare const ServerMessage_HlsUploaded: MessageFns$1<ServerMessage_HlsUploaded>; /** Notification sent when the upload of HLS recording to AWS S3 fails */ interface ServerMessage_HlsUploadCrashed { roomId: string; } declare const ServerMessage_HlsUploadCrashed: MessageFns$1<ServerMessage_HlsUploadCrashed>; /** Notification sent when peer updates its metadata */ interface ServerMessage_PeerMetadataUpdated { roomId: string; peerId: string; metadata: string; peerType: ServerMessage_PeerType; } declare const ServerMessage_PeerMetadataUpdated: MessageFns$1<ServerMessage_PeerMetadataUpdated>; /** Notification sent when peer or component adds new track */ interface ServerMessage_TrackAdded { roomId: string; peerId?: string | undefined; componentId?: string | undefined; track: Track$1 | undefined; } declare const ServerMessage_TrackAdded: MessageFns$1<ServerMessage_TrackAdded>; /** Notification sent when a track is removed */ interface ServerMessage_TrackRemoved { roomId: string; peerId?: string | undefined; componentId?: string | undefined; track: Track$1 | undefined; } declare const ServerMessage_TrackRemoved: MessageFns$1<ServerMessage_TrackRemoved>; /** Notification sent when metadata of a multimedia track is updated */ interface ServerMessage_TrackMetadataUpdated { roomId: string; peerId?: string | undefined; componentId?: string | undefined; track: Track$1 | undefined; } declare const ServerMessage_TrackMetadataUpdated: MessageFns$1<ServerMessage_TrackMetadataUpdated>; /** Notification sent when a peer creates a channel */ interface ServerMessage_ChannelAdded { roomId: string; peerId?: string | undefined; componentId?: string | undefined; channelId: string; } declare const ServerMessage_ChannelAdded: MessageFns$1<ServerMessage_ChannelAdded>; /** Notification sent when a peer deletes a channel */ interface ServerMessage_ChannelRemoved { roomId: string; peerId?: string | undefined; componentId?: string | undefined; channelId: string; } declare const ServerMessage_ChannelRemoved: MessageFns$1<ServerMessage_ChannelRemoved>; /** Sent when there is an upsert to track forwardings from Fishjam to Composition */ interface ServerMessage_TrackForwarding { roomId: string; peerId: string; compositionUrl: string; inputId: string; /** Track has id, type, and metadata */ audioTrack?: Track$1 | undefined; videoTrack?: Track$1 | undefined; } declare const ServerMessage_TrackForwarding: MessageFns$1<ServerMessage_TrackForwarding>; /** Sent when track forwarding is removed */ interface ServerMessage_TrackForwardingRemoved { roomId: string; peerId: string; compositionUrl: string; inputId: string; } declare const ServerMessage_TrackForwardingRemoved: MessageFns$1<ServerMessage_TrackForwardingRemoved>; /** Notification sent when voice activity changes on a track */ interface ServerMessage_VadNotification { roomId: string; peerId: string; trackId: string; status: ServerMessage_VadNotification_Status; } declare const ServerMessage_VadNotification: MessageFns$1<ServerMessage_VadNotification>; /** Notification sent when streamer successfully connects */ interface ServerMessage_StreamConnected { streamId: string; } declare const ServerMessage_StreamConnected: MessageFns$1<ServerMessage_StreamConnected>; /** Notification sent when streamer disconnects */ interface ServerMessage_StreamDisconnected { streamId: string; } declare const ServerMessage_StreamDisconnected: MessageFns$1<ServerMessage_StreamDisconnected>; /** Notification sent when viewer successfully connects */ interface ServerMessage_ViewerConnected { streamId: string; viewerId: string; } declare const ServerMessage_ViewerConnected: MessageFns$1<ServerMessage_ViewerConnected>; /** Notification sent when viewer disconnects */ interface ServerMessage_ViewerDisconnected { streamId: string; viewerId: string; } declare const ServerMessage_ViewerDisconnected: MessageFns$1<ServerMessage_ViewerDisconnected>; interface ServerMessage_StreamerConnected { streamId: string; streamerId: string; } declare const ServerMessage_StreamerConnected: MessageFns$1<ServerMessage_StreamerConnected>; interface ServerMessage_StreamerDisconnected { streamId: string; streamerId: string; } declare const ServerMessage_StreamerDisconnected: MessageFns$1<ServerMessage_StreamerDisconnected>; /** * Carries multiple notifications in a single wire frame. * * Constraints (documented, not schema-enforced): * - Each element's `content` MUST be a notification variant — never * Authenticated, AuthRequest, SubscribeRequest, or SubscribeResponse. * - NotificationBatch MUST NOT be nested inside another NotificationBatch. * The schema technically permits this, but senders must not emit * recursive batches and receivers may treat them as a protocol violation. * - Notifications are delivered in array order; consumers must process * them in order. * - Sent only for webhooks, for peers that . */ interface ServerMessage_NotificationBatch { notifications: ServerMessage[]; } declare const ServerMessage_NotificationBatch: MessageFns$1<ServerMessage_NotificationBatch>; type Builtin$1 = Date | Function | Uint8Array | string | number | boolean | undefined; type DeepPartial$1<T> = T extends Builtin$1 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$1<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$1<U>> : T extends {} ? { [K in keyof T]?: DeepPartial$1<T[K]>; } : Partial<T>; type KeysOfUnion$1<T> = T extends T ? keyof T : never; type Exact$1<P, I extends P> = P extends Builtin$1 ? P : P & { [K in keyof P]: Exact$1<P[K], I[K]>; } & { [K in Exclude<keyof I, KeysOfUnion$1<P>>]: never; }; interface MessageFns$1<T> { encode(message: T, writer?: BinaryWriter): BinaryWriter; decode(input: BinaryReader | Uint8Array, length?: number): T; fromJSON(object: any): T; toJSON(message: T): unknown; create<I extends Exact$1<DeepPartial$1<T>, I>>(base?: I): T; fromPartial<I extends Exact$1<DeepPartial$1<T>, I>>(object: I): T; } /** Notification containing a chunk of an agent's track's data stream */ interface AgentRequest_TrackData { trackId: string; data: Uint8Array; } declare const AgentRequest_TrackData: MessageFns<AgentRequest_TrackData>; /** Defines any type of message passed from Fishjam to agent peer */ interface AgentResponse { authenticated?: AgentResponse_Authenticated | undefined; trackData?: AgentResponse_TrackData | undefined; trackImage?: AgentResponse_TrackImage | undefined; } declare const AgentResponse: MessageFns<AgentResponse>; /** Response confirming successful authentication */ interface AgentResponse_Authenticated { } declare const AgentResponse_Authenticated: MessageFns<AgentResponse_Authenticated>; /** Notification containing a chunk of a track's data stream */ interface AgentResponse_TrackData { peerId: string; track: Track$1 | undefined; data: Uint8Array; } declare const AgentResponse_TrackData: MessageFns<AgentResponse_TrackData>; interface AgentResponse_TrackImage { trackId: string; contentType: string; data: Uint8Array; } declare const AgentResponse_TrackImage: MessageFns<AgentResponse_TrackImage>; type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]>; } : Partial<T>; type KeysOfUnion<T> = T extends T ? keyof T : never; type Exact<P, I extends P> = P extends Builtin ? P : P & { [K in keyof P]: Exact<P[K], I[K]>; } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never; }; interface MessageFns<T> { encode(message: T, writer?: BinaryWriter): BinaryWriter; decode(input: BinaryReader | Uint8Array, length?: number): T; fromJSON(object: any): T; toJSON(message: T): unknown; create<I extends Exact<DeepPartial<T>, I>>(base?: I): T; fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T; } type EventMap = { [key: string]: (...args: any[]) => void } /** * Type-safe event emitter. * * Use it like this: * * ```typescript * type MyEvents = { * error: (error: Error) => void; * message: (from: string, content: string) => void; * } * * const myEmitter = new EventEmitter() as TypedEmitter<MyEvents>; * * myEmitter.emit("error", "x") // <- Will catch this type error; * ``` */ interface TypedEventEmitter<Events extends EventMap> { addListener<E extends keyof Events> (event: E, listener: Events[E]): this on<E extends keyof Events> (event: E, listener: Events[E]): this once<E extends keyof Events> (event: E, listener: Events[E]): this prependListener<E extends keyof Events> (event: E, listener: Events[E]): this prependOnceListener<E extends keyof Events> (event: E, listener: Events[E]): this off<E extends keyof Events>(event: E, listener: Events[E]): this removeAllListeners<E extends keyof Events> (event?: E): this removeListener<E extends keyof Events> (event: E, listener: Events[E]): this emit<E extends keyof Events> (event: E, ...args: Parameters<Events[E]>): boolean // The sloppy `eventNames()` return type is to mitigate type incompatibilities - see #5 eventNames (): (keyof Events | string | symbol)[] rawListeners<E extends keyof Events> (event: E): Events[E][] listeners<E extends keyof Events> (event: E): Events[E][] listenerCount<E extends keyof Events> (event: E): number getMaxListeners (): number setMaxListeners (maxListeners: number): this } declare const brand: unique symbol; /** * Branded type helper */ type Brand<T, TBrand extends string> = T & { [brand]: TBrand; }; /** * Replaces the types of fields in `T` whose names appear in `M`, leaving the rest untouched. * Produces a flat object type (single mapped type, no `Omit & {...}` chain) so editor hover * displays the resulting properties directly. * * Keys present in `M` but not in `T` are ignored — only fields that already exist on `T` * are overridden, so a shared override map can be reused across multiple source types. * * `undefined` is re-added to the override when the original field allowed it, so optional * fields on generated proto types (e.g. `peerId?: string | undefined`) remain assignable * from `undefined` under `exactOptionalPropertyTypes`. */ type Override<T, M> = { [K in keyof T]: K extends keyof M ? (undefined extends T[K] ? M[K] | undefined : M[K]) : T[K]; }; /** * ID of the Room. * Room can be created with {@link FishjamClient.createRoom}. */ type RoomId = Brand<string, 'RoomId'>; /** * ID of Peer. Peer is associated with Room and can be created with {@link FishjamClient.createPeer}. */ type PeerId = Brand<string, 'PeerId'>; type Peer = Override<Peer$1, { id: PeerId; }>; /** * Peer type as emitted by {@link FishjamWSNotifier}. Matches the REST API's `PeerType`, * with the addition of `'unspecified'` for messages whose peer type is not set on the wire. */ type PeerType = PeerType$1 | 'unspecified'; /** * Track type as emitted by {@link FishjamWSNotifier}. Matches the REST API's `TrackType`, * with the addition of `'unspecified'` for messages whose track type is not set on the wire. */ type TrackType = TrackType$2 | 'unspecified'; /** * Voice activity status of a track. */ type VadStatus = 'speech' | 'silence'; type Room = { id: RoomId; peers: Peer[]; config: RoomConfig; }; type FishjamConfig = { fishjamId: string; managementToken: string; }; type ErrorEventHandler = (msg: Event) => void; type CloseEventHandler = (code: number, reason: string) => void; type AgentCallbacks = { onError?: ErrorEventHandler; onClose?: CloseEventHandler; }; /** * Track payload embedded in {@link TrackAdded}, {@link TrackRemoved}, {@link TrackMetadataUpdated}. */ type Track = { id: string; type: TrackType; metadata: string; }; declare const expectedEventsList$1: readonly ["roomCreated", "roomDeleted", "roomCrashed", "peerAdded", "peerDeleted", "peerConnected", "peerDisconnected", "peerMetadataUpdated", "peerCrashed", "streamerConnected", "streamerDisconnected", "viewerConnected", "viewerDisconnected", "trackAdded", "trackRemoved", "trackMetadataUpdated", "trackForwarding", "trackForwardingRemoved", "vadNotification", "channelAdded", "channelRemoved"]; type ExpectedEvents = (typeof expectedEventsList$1)[number]; /** * `ServerMessage` oneof members that are intentionally NOT emitted to users. * Grouped with a brief rationale so the classification stays reviewable. * Mirrors the Python SDK's `IGNORED_NOTIFICATIONS` partition (FCE-3215). */ declare const ignoredEventsList: readonly ["authenticated", "authRequest", "subscribeRequest", "subscribeResponse", "notificationBatch", "streamConnected", "streamDisconnected", "hlsPlayable", "hlsUploaded", "hlsUploadCrashed", "componentCrashed"]; type IgnoredEvents = (typeof ignoredEventsList)[number]; /** * Field-level overrides applied to every notification payload: branded ID types * and the user-facing enums replace their raw protobuf counterparts. {@link Override} * only swaps keys that exist on the source type, so a single map covers all variants. * * @inline */ type NotificationOverrides = { roomId: RoomId; peerId: PeerId; peerType: PeerType; track: Track | undefined; audioTrack: Track | undefined; videoTrack: Track | undefined; status: VadStatus; }; /** @inline */ type Notification<K extends keyof ServerMessage> = Override<NonNullable<ServerMessage[K]>, NotificationOverrides>; /** * @inline */ type Notifications = { roomCreated: Notification<'roomCreated'>; roomDeleted: Notification<'roomDeleted'>; roomCrashed: Notification<'roomCrashed'>; peerAdded: Notification<'peerAdded'>; peerDeleted: Notification<'peerDeleted'>; peerConnected: Notification<'peerConnected'>; peerDisconnected: Notification<'peerDisconnected'>; peerMetadataUpdated: Notification<'peerMetadataUpdated'>; peerCrashed: Notification<'peerCrashed'>; streamerConnected: Notification<'streamerConnected'>; streamerDisconnected: Notification<'streamerDisconnected'>; viewerConnected: Notification<'viewerConnected'>; viewerDisconnected: Notification<'viewerDisconnected'>; trackAdded: Notification<'trackAdded'>; trackRemoved: Notification<'trackRemoved'>; trackMetadataUpdated: Notification<'trackMetadataUpdated'>; trackForwarding: Notification<'trackForwarding'>; trackForwardingRemoved: Notification<'trackForwardingRemoved'>; vadNotification: Notification<'vadNotification'>; channelAdded: Notification<'channelAdded'>; channelRemoved: Notification<'channelRemoved'>; }; type RoomCreated = Notifications['roomCreated']; type RoomDeleted = Notifications['roomDeleted']; type RoomCrashed = Notifications['roomCrashed']; type PeerAdded = Notifications['peerAdded']; type PeerDeleted = Notifications['peerDeleted']; type PeerConnected = Notifications['peerConnected']; type PeerDisconnected = Notifications['peerDisconnected']; type PeerMetadataUpdated = Notifications['peerMetadataUpdated']; type PeerCrashed = Notifications['peerCrashed']; type StreamerConnected = Notifications['streamerConnected']; type StreamerDisconnected = Notifications['streamerDisconnected']; type ViewerConnected = Notifications['viewerConnected']; type ViewerDisconnected = Notifications['viewerDisconnected']; type TrackAdded = Notifications['trackAdded']; type TrackRemoved = Notifications['trackRemoved']; type TrackMetadataUpdated = Notifications['trackMetadataUpdated']; type TrackForwarding = Notifications['trackForwarding']; type TrackForwardingRemoved = Notifications['trackForwardingRemoved']; type VadNotification = Notifications['vadNotification']; type ChannelAdded = Notifications['channelAdded']; type ChannelRemoved = Notifications['channelRemoved']; type NotificationEvents = { [K in ExpectedEvents]: (message: Notifications[K]) => void; }; /** * A single decoded, mapped server notification tagged with its event type. * The discriminated `type` lets consumers narrow `notification` to the matching * payload (e.g. `if (n.type === 'peerConnected') n.notification.peerType`). */ type ServerNotification = { [K in ExpectedEvents]: { type: K; notification: Notifications[K]; }; }[ExpectedEvents]; declare const FishjamWSNotifier_base: new () => TypedEventEmitter<NotificationEvents>; /** * Notifier object that can be used to get notified about various events related to the Fishjam App. * @category Client */ declare class FishjamWSNotifier extends FishjamWSNotifier_base { private readonly client; constructor(config: FishjamConfig, onError: ErrorEventHandler, onClose: CloseEventHandler); /** * Close the underlying WebSocket and stop emitting notifications. */ disconnect(): void; private dispatchNotification; private setupConnection; } /** * Decode a raw Fishjam webhook body (`application/x-protobuf`) into typed, * mapped notifications. * * A room/stream created with `batchWebhookNotifications: true` may deliver * several notifications coalesced into a single `NotificationBatch`; this helper * transparently unwraps that batch, so a single message and a batch are handled * the same way. Notifications are returned in wire order, with the same payload * mapping the {@link FishjamWSNotifier} applies (branded ids, `peerType`/`track` * enums). Non-surfaced variants (handshake, deprecated) are omitted. * * Accepts a Node `Buffer` (a `Uint8Array` subclass), a `Uint8Array`, or an * `ArrayBuffer`. * * @example * ```ts * import { decodeServerNotifications } from '@fishjam-cloud/js-server-sdk'; * * declare const body: Uint8Array; * declare const handlePeerConnected: (notification: unknown) => void; * // ---cut--- * for (const { type, notification } of decodeServerNotifications(body)) { * if (type === 'peerConnected') han