@cloudflare/realtimekit 1.2.4-staging.6 → 1.2.4-staging.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1354,6 +1354,36 @@ interface ChatMessage {
1354
1354
  * @generated MessageType for protobuf message socket.chat.ChatMessage
1355
1355
  */
1356
1356
  declare const ChatMessage: ChatMessage$Type;
1357
+ declare class GetPaginatedChatMessageFilters$Type extends MessageType$1<GetPaginatedChatMessageFilters> {
1358
+ constructor();
1359
+ }
1360
+ /**
1361
+ * @generated from protobuf message socket.chat.GetPaginatedChatMessageFilters
1362
+ */
1363
+ interface GetPaginatedChatMessageFilters {
1364
+ /**
1365
+ * @generated from protobuf oneof: filters
1366
+ */
1367
+ filters: {
1368
+ oneofKind: "pinned";
1369
+ /**
1370
+ * @generated from protobuf field: bool pinned = 1;
1371
+ */
1372
+ pinned: boolean;
1373
+ } | {
1374
+ oneofKind: "userId";
1375
+ /**
1376
+ * @generated from protobuf field: string user_id = 2;
1377
+ */
1378
+ userId: string;
1379
+ } | {
1380
+ oneofKind: undefined;
1381
+ };
1382
+ }
1383
+ /**
1384
+ * @generated MessageType for protobuf message socket.chat.GetPaginatedChatMessageFilters
1385
+ */
1386
+ declare const GetPaginatedChatMessageFilters: GetPaginatedChatMessageFilters$Type;
1357
1387
  declare class GetPaginatedChatMessageRoomResponse$Type extends MessageType$1<GetPaginatedChatMessageRoomResponse> {
1358
1388
  constructor();
1359
1389
  }
@@ -1467,83 +1497,6 @@ interface DeleteChatMessageResponse {
1467
1497
  */
1468
1498
  declare const DeleteChatMessageResponse: DeleteChatMessageResponse$Type;
1469
1499
 
1470
- declare class LatestMessageAndUnreadCount$Type extends MessageType$1<LatestMessageAndUnreadCount> {
1471
- constructor();
1472
- }
1473
- /**
1474
- * @generated from protobuf message socket.chat.LatestMessageAndUnreadCount
1475
- */
1476
- interface LatestMessageAndUnreadCount {
1477
- /**
1478
- * @generated from protobuf field: optional socket.chat.ChatMessage message = 1;
1479
- */
1480
- message?: ChatMessage;
1481
- /**
1482
- * @generated from protobuf field: uint64 unread_count = 2 [jstype = JS_NUMBER];
1483
- */
1484
- unreadCount: number;
1485
- }
1486
- /**
1487
- * @generated MessageType for protobuf message socket.chat.LatestMessageAndUnreadCount
1488
- */
1489
- declare const LatestMessageAndUnreadCount: LatestMessageAndUnreadCount$Type;
1490
- declare class ChatChannel$Type extends MessageType$1<ChatChannel$1> {
1491
- constructor();
1492
- }
1493
- /**
1494
- * @generated from protobuf message socket.chat.ChatChannel
1495
- */
1496
- interface ChatChannel$1 {
1497
- /**
1498
- * @generated from protobuf field: string chat_channel_id = 1;
1499
- */
1500
- chatChannelId: string;
1501
- /**
1502
- * @generated from protobuf field: string display_name = 2;
1503
- */
1504
- displayName: string;
1505
- /**
1506
- * @generated from protobuf field: optional string display_picture_url = 3;
1507
- */
1508
- displayPictureUrl?: string;
1509
- /**
1510
- * @generated from protobuf field: string visibility = 4;
1511
- */
1512
- visibility: string;
1513
- /**
1514
- * @generated from protobuf field: bool is_direct_message = 5;
1515
- */
1516
- isDirectMessage: boolean;
1517
- /**
1518
- * @generated from protobuf field: socket.chat.LatestMessageAndUnreadCount latest_message_and_unread_count = 6;
1519
- */
1520
- latestMessageAndUnreadCount?: LatestMessageAndUnreadCount;
1521
- /**
1522
- * @generated from protobuf field: repeated string target_user_ids = 7;
1523
- */
1524
- targetUserIds: string[];
1525
- }
1526
- /**
1527
- * @generated MessageType for protobuf message socket.chat.ChatChannel
1528
- */
1529
- declare const ChatChannel$1: ChatChannel$Type;
1530
- declare class GetChatChannelResponse$Type extends MessageType$1<GetChatChannelResponse> {
1531
- constructor();
1532
- }
1533
- /**
1534
- * @generated from protobuf message socket.chat.GetChatChannelResponse
1535
- */
1536
- interface GetChatChannelResponse {
1537
- /**
1538
- * @generated from protobuf field: repeated socket.chat.ChatChannel chat_channels = 1;
1539
- */
1540
- chatChannels: ChatChannel$1[];
1541
- }
1542
- /**
1543
- * @generated MessageType for protobuf message socket.chat.GetChatChannelResponse
1544
- */
1545
- declare const GetChatChannelResponse: GetChatChannelResponse$Type;
1546
-
1547
1500
  declare class EnablePluginResponse$Type extends MessageType$1<EnablePluginResponse> {
1548
1501
  constructor();
1549
1502
  }
@@ -2953,48 +2906,6 @@ declare class TypedEventEmitter$1<Events extends EventMap$1 & WildCardEvent<Even
2953
2906
  listenerCount<T extends StringKeyOf<Events>>(event: T): number;
2954
2907
  }
2955
2908
 
2956
- interface BasicParticipant {
2957
- userId: string;
2958
- name?: string;
2959
- picture?: string;
2960
- customParticipantId: string;
2961
- }
2962
- declare class BasicParticipantsMap extends CustomEventEmitter<'participantsUpdate'> {
2963
- constructor(logger: Logger);
2964
- __set(objId: string, obj: BasicParticipant): Map<string, BasicParticipant>;
2965
- __clear(): void;
2966
- get(objId: string): BasicParticipant;
2967
- toArray(): BasicParticipant[];
2968
- }
2969
-
2970
- type ChatChannelSocketMessage = GetChatChannelResponse;
2971
- interface ChatChannel {
2972
- id: string;
2973
- displayName: string;
2974
- memberIds: string[];
2975
- displayPictureUrl?: string;
2976
- visibility?: string;
2977
- isDirectMessage?: boolean;
2978
- latestMessage?: Message;
2979
- unreadCount: number;
2980
- }
2981
- interface UpdateChannelRequestPayload {
2982
- memberIds?: string[];
2983
- displayName?: string;
2984
- displayPictureUrl?: string;
2985
- visibility?: string;
2986
- }
2987
- declare class ChatChannelSocketHandler {
2988
- get telemetry(): Telemetry;
2989
- get logger(): Logger;
2990
- constructor(context: Context<ContextState>, socketService: SocketService);
2991
- createChannel(displayName: string, memberIds: string[], displayPictureUrl?: string, visibility?: string, isDirectMessage?: boolean): Promise<ChatChannel>;
2992
- updateChannel(channelId: string, payload: UpdateChannelRequestPayload): Promise<ChatChannel>;
2993
- static formatChannel(socketChannel: ChatChannel$1): ChatChannel;
2994
- getChannelMembers(channelId: string): Promise<BasicParticipant[]>;
2995
- on(event: number, handler: (socketMessage: ChatChannelSocketMessage) => void): void;
2996
- }
2997
-
2998
2909
  declare enum ChatMessageType {
2999
2910
  TEXT = 0,
3000
2911
  IMAGE = 1,
@@ -3003,7 +2914,6 @@ declare enum ChatMessageType {
3003
2914
  }
3004
2915
  type ChatSocketMessage = SendChatMessageToRoomResponse | SendChatMessageToPeersResponse | EditChatMessageResponse | DeleteChatMessageResponse;
3005
2916
  interface SearchFilters {
3006
- channelId?: string;
3007
2917
  timestamp?: number;
3008
2918
  limit?: number;
3009
2919
  reversed?: boolean;
@@ -3017,19 +2927,15 @@ declare class ChatSocketHandler {
3017
2927
  id: string;
3018
2928
  payload: Uint8Array;
3019
2929
  }>;
3020
- getChatMessagesPaginated(timeStamp: number, size: number, reversed: boolean, offset?: number, channelId?: string): Promise<GetPaginatedChatMessageRoomResponse>;
2930
+ getChatMessagesPaginated(timeStamp: number, size: number, reversed: boolean, filters?: GetPaginatedChatMessageFilters['filters']): Promise<GetPaginatedChatMessageRoomResponse>;
3021
2931
  sendMessageToRoom(message: string, messageType: ChatMessageType): void;
3022
2932
  sendMessageToPeers(message: string, messageType: ChatMessageType, peerIds: string[]): void;
3023
- sendMessageToChannel(message: string, messageType: ChatMessageType, channelId: string): void;
3024
- sendMessage(message: string, messageType: ChatMessageType, peerIds?: string[], channelId?: string): void;
3025
- editMessage(chatId: string, message: string, payloadType: ChatMessageType, channelId?: string, pinned?: boolean): Promise<ChatMessage>;
3026
- deleteMessage(chatId: string, channelId?: string): Promise<{
3027
- channelId?: string;
2933
+ sendMessage(message: string, messageType: ChatMessageType, peerIds?: string[]): void;
2934
+ editMessage(chatId: string, message: string, payloadType: ChatMessageType, pinned?: boolean): Promise<ChatMessage>;
2935
+ deleteMessage(chatId: string): Promise<{
3028
2936
  id: string;
3029
2937
  }>;
3030
2938
  searchMessages(query: string, filters: SearchFilters): Promise<ChatMessage[]>;
3031
- getAllChannels(): Promise<ChatChannel[]>;
3032
- markLastReadMessage(channelId: string, message: Message): Promise<string>;
3033
2939
  setPinState(message: Message, pin: boolean): Promise<PinChatMessageResponse>;
3034
2940
  on(event: number, handler: (socketMessage: ChatSocketMessage) => void): void;
3035
2941
  }
@@ -3119,6 +3025,20 @@ type MediaConnectionState = {
3119
3025
  };
3120
3026
  };
3121
3027
 
3028
+ interface BasicParticipant {
3029
+ userId: string;
3030
+ name?: string;
3031
+ picture?: string;
3032
+ customParticipantId: string;
3033
+ }
3034
+ declare class BasicParticipantsMap extends CustomEventEmitter<'participantsUpdate'> {
3035
+ constructor(logger: Logger);
3036
+ __set(objId: string, obj: BasicParticipant): Map<string, BasicParticipant>;
3037
+ __clear(): void;
3038
+ get(objId: string): BasicParticipant;
3039
+ toArray(): BasicParticipant[];
3040
+ }
3041
+
3122
3042
  type EventHandlerTypes = PeerInfoResponse | GetWaitingRoomRequests | RecordingEvent | UpdatePeersPresetResponse | PeerJoinBroadcastResponse | PeerJoinCompleteResponse | GlobalPeerPinningBroadcastResponse | PeerLeaveResponse | SelectedPeersResponse | SelectedPeersDiffResponse;
3123
3043
  declare class RoomSocketHandler {
3124
3044
  socket: SocketService;
@@ -3985,18 +3905,6 @@ type PresetV2CamelCased = {
3985
3905
  text: boolean;
3986
3906
  files: boolean;
3987
3907
  };
3988
- channel?: {
3989
- canCreate: 'NONE' | 'PRIVATE' | 'PUBLIC' | 'ALL';
3990
- canDelete: 'NONE' | 'PRIVATE' | 'PUBLIC' | 'ALL';
3991
- canUpdate: 'NONE' | 'PRIVATE' | 'PUBLIC' | 'ALL';
3992
- canReadAll: boolean;
3993
- };
3994
- message?: {
3995
- canDelete: 'NONE' | 'SELF' | 'ALL';
3996
- canEdit: 'NONE' | 'SELF' | 'ALL';
3997
- deleteCutoffTimeSeconds: number;
3998
- editCutoffTimeSeconds: number;
3999
- };
4000
3908
  };
4001
3909
  isRecorder?: boolean;
4002
3910
  recorderType: RecorderType$1;
@@ -4143,8 +4051,6 @@ declare class PermissionPreset extends TypedEventEmitter$1<PermissionEvents> {
4143
4051
  get canProduceAudio(): Readonly<MediaProductionPermissionType>;
4144
4052
  get chatPublic(): Readonly<PresetPermissions['chat']['public']>;
4145
4053
  get chatPrivate(): Readonly<PresetPermissions['chat']['private']>;
4146
- get chatChannel(): Readonly<PresetPermissions['chat']['channel']>;
4147
- get chatMessage(): Readonly<PresetPermissions['chat']['message']>;
4148
4054
  get connectedMeetings(): Readonly<PresetPermissions['connectedMeetings']>;
4149
4055
  get hiddenParticipant(): Readonly<boolean>;
4150
4056
  get showParticipantList(): Readonly<boolean>;
@@ -4392,7 +4298,7 @@ declare class APIClient extends API {
4392
4298
  getPluginDetails(pluginId: string): Promise<PluginResponse>;
4393
4299
  getPluginConfig(pluginBaseUrl: string): Promise<PluginConfig>;
4394
4300
  authorizePlugin(pluginId: string): Promise<string>;
4395
- getPresignedUrls(filename: string, viewType: string): Promise<{
4301
+ getPresignedUrls(filename: string): Promise<{
4396
4302
  getLocation: any;
4397
4303
  putLocation: any;
4398
4304
  }>;
@@ -4432,8 +4338,6 @@ interface BaseMessage<T extends MessageType> {
4432
4338
  pluginId?: string;
4433
4339
  pinned?: boolean;
4434
4340
  targetUserIds?: string[];
4435
- channelId?: string;
4436
- channelIndex?: string;
4437
4341
  }
4438
4342
  interface TextMessage extends BaseMessage<MessageType.text> {
4439
4343
  message: string;
@@ -4494,28 +4398,30 @@ interface FileMessagePayload {
4494
4398
  type MessagePayload = TextMessagePayload | ImageMessagePayload | FileMessagePayload | CustomMessagePayload;
4495
4399
  interface ChatUpdateParams {
4496
4400
  action: 'add' | 'edit' | 'delete';
4497
- message: Message | {
4498
- id: string;
4499
- channelId: string;
4500
- };
4401
+ message: Message;
4501
4402
  messages: Message[];
4502
4403
  }
4503
4404
  type ChatEvents = {
4504
4405
  ['chatUpdate']: (payload: ChatUpdateParams) => void;
4505
4406
  ['pinMessage']: (payload: Omit<ChatUpdateParams, 'action'>) => void;
4506
4407
  ['unpinMessage']: (payload: Omit<ChatUpdateParams, 'action'>) => void;
4507
- ['channelCreate']: (channel: ChatChannel) => void;
4508
- ['channelMessageUpdate']: (channel: ChatChannel) => void;
4509
- ['channelUpdate']: (channel?: ChatChannel) => void;
4510
4408
  ['*']: (event: string, ...args: any[]) => void;
4511
4409
  };
4410
+ interface FetchMessageOptions {
4411
+ timestamp?: number;
4412
+ offset: number;
4413
+ limit: number;
4414
+ direction: 'before' | 'after';
4415
+ }
4416
+ interface FetchPrivateMessagesOptions extends FetchMessageOptions {
4417
+ userId: string;
4418
+ }
4512
4419
  declare class Chat extends TypedEventEmitter$1<ChatEvents> {
4513
4420
  messages: Message[];
4514
- channels: ChatChannel[];
4515
4421
  maxTextLimit: number;
4516
4422
  get telemetry(): Telemetry;
4517
4423
  setMaxTextLimit(limit: number): void;
4518
- constructor(context: Context<ContextState>, chatSocketHandler: ChatSocketHandler, chatChannelSocketHandler: ChatChannelSocketHandler, self: Self, participants: Participants);
4424
+ constructor(context: Context<ContextState>, chatSocketHandler: ChatSocketHandler, self: Self, participants: Participants);
4519
4425
  private sendMessageInternal;
4520
4426
  private sendTextMessageInternal;
4521
4427
  private sendImageMessageInternal;
@@ -4530,40 +4436,23 @@ declare class Chat extends TypedEventEmitter$1<ChatEvents> {
4530
4436
  sendImageMessage(image: File | ReactNativeFile, peerIds?: string[]): Promise<void>;
4531
4437
  sendFileMessage(file: File | ReactNativeFile, peerIds?: string[]): Promise<void>;
4532
4438
  sendMessage(message: MessagePayload, participantIds?: string[]): Promise<void>;
4533
- editTextMessage(messageId: string, message: string, channelId?: string): Promise<void>;
4534
- editImageMessage(messageId: string, image: File | ReactNativeFile, channelId?: string): Promise<void>;
4535
- editFileMessage(messageId: string, file: File | ReactNativeFile, channelId?: string): Promise<void>;
4536
- editMessage(messageId: string, message: MessagePayload, channelId?: string): Promise<void>;
4537
- deleteMessage(messageId: string, channelId?: string): Promise<void>;
4439
+ editTextMessage(messageId: string, message: string): Promise<void>;
4440
+ editImageMessage(messageId: string, image: File | ReactNativeFile): Promise<void>;
4441
+ editFileMessage(messageId: string, file: File | ReactNativeFile): Promise<void>;
4442
+ editMessage(messageId: string, message: MessagePayload): Promise<void>;
4443
+ deleteMessage(messageId: string): Promise<void>;
4538
4444
  getMessagesByUser(userId: string): Message[];
4539
4445
  getMessagesByType(type: keyof typeof MessageType): Message[];
4540
4446
  pin(id: string): Promise<void>;
4541
4447
  unpin(id: string): Promise<void>;
4542
- fetchMessages({ timestamp, offset, limit, direction, searchQuery, type, userId, }: {
4543
- timestamp?: number;
4544
- offset: number;
4545
- limit: number;
4546
- direction: 'before' | 'after';
4547
- searchQuery?: string;
4548
- type?: keyof typeof MessageType;
4549
- userId?: string;
4550
- }): Promise<Message[]>;
4551
- getMessages(timeStamp: number, size: number, reversed: boolean, offset?: number, channelId?: string): Promise<{
4448
+ fetchMessages({ timestamp, limit, direction, }: FetchMessageOptions): Promise<Message[]>;
4449
+ fetchPrivateMessages({ timestamp, limit, direction, userId, }: FetchPrivateMessagesOptions): Promise<Message[]>;
4450
+ fetchPinnedMessages({ timestamp, limit, direction, }: FetchMessageOptions): Promise<Message[]>;
4451
+ getMessages(timeStamp: number, size: number, reversed: boolean, offset?: number): Promise<{
4552
4452
  messages: Message[];
4553
4453
  next: boolean;
4554
4454
  }>;
4555
- createChannel(channelName: string, memberIds: string[], options?: {
4556
- displayPictureUrl?: string;
4557
- visibility?: string;
4558
- isDirectMessage?: boolean;
4559
- }): Promise<ChatChannel>;
4560
- updateChannel(channelId: string, payload: UpdateChannelRequestPayload): Promise<ChatChannel>;
4561
- sendMessageToChannel(message: MessagePayload, channelId: string, options?: {
4562
- replyTo?: Message;
4563
- }): Promise<void>;
4564
- getChannelMembers(channelId: string): Promise<BasicParticipant[]>;
4565
4455
  searchMessages(query: string, filters: unknown): Promise<unknown[]>;
4566
- markLastReadMessage(channelId: string, message: Message): Promise<void>;
4567
4456
  get pinned(): Message[];
4568
4457
  }
4569
4458
 
@@ -5156,7 +5045,6 @@ declare const ERROR_CODES: {
5156
5045
  '0504': string;
5157
5046
  '0505': string;
5158
5047
  '0506': string;
5159
- '0510': string;
5160
5048
  '0600': string;
5161
5049
  '0601': string;
5162
5050
  '0602': string;
@@ -6062,4 +5950,4 @@ declare global {
6062
5950
  }
6063
5951
  }
6064
5952
 
6065
- export { ActiveTab, ActiveTabType, AudioConsumerScoreStats, AudioMiddleware, AudioProducerScoreStats, BroadcastMessagePayload, CachedUserDetails, ChatChannel, ChatUpdateParams, ClientError, ConsumerScoreStats, CustomMessage, DeviceConfig, FileMessage, ImageMessage, JoinedPeer, LeaveRoomState, LivestreamIngestionCredentials, LivestreamState, LogData, MediaConnectionState, MediaConnectionUpdate, MediaConstraints, MediaKind, MediaPermission, Message, ProducerScoreStats, BasicParticipant as RTKBasicParticipant, BasicParticipantsMap as RTKBasicParticipantsMap, RTKChat, ClientOptions as RTKClientOptions, RTKConfigOptions, RTKConnectedMeetings, RTKLivestream, RTKLogger, RTKMeta, RTKParticipant, RTKParticipantMap, RTKParticipants, RTKPermissionsPreset, RTKPlugin, RTKPluginMap, RTKPlugins, RTKPolls, RTKRecording, RTKSelf, RTKSelfMedia, RTKStore, StoreData as RTKStoreData, RateLimitConfig as RTKStoreRateLimitConfig, RTKThemePreset, RecordingState, RequestToJoinType, SocketConnectionState, StageStatus, StartLivestreamConfig, TextMessage, UserDetailsResponseV2, VideoConsumerScoreStats, VideoMiddleware, VideoProducerScoreStats, VideoQualityConstraints, Client as default, LeaveRoomState as leaveRoomState };
5953
+ export { ActiveTab, ActiveTabType, AudioConsumerScoreStats, AudioMiddleware, AudioProducerScoreStats, BroadcastMessagePayload, CachedUserDetails, ChatUpdateParams, ClientError, ConsumerScoreStats, CustomMessage, DeviceConfig, FileMessage, ImageMessage, JoinedPeer, LeaveRoomState, LivestreamIngestionCredentials, LivestreamState, LogData, MediaConnectionState, MediaConnectionUpdate, MediaConstraints, MediaKind, MediaPermission, Message, ProducerScoreStats, BasicParticipant as RTKBasicParticipant, BasicParticipantsMap as RTKBasicParticipantsMap, RTKChat, ClientOptions as RTKClientOptions, RTKConfigOptions, RTKConnectedMeetings, RTKLivestream, RTKLogger, RTKMeta, RTKParticipant, RTKParticipantMap, RTKParticipants, RTKPermissionsPreset, RTKPlugin, RTKPluginMap, RTKPlugins, RTKPolls, RTKRecording, RTKSelf, RTKSelfMedia, RTKStore, StoreData as RTKStoreData, RateLimitConfig as RTKStoreRateLimitConfig, RTKThemePreset, RecordingState, RequestToJoinType, SocketConnectionState, StageStatus, StartLivestreamConfig, TextMessage, UserDetailsResponseV2, VideoConsumerScoreStats, VideoMiddleware, VideoProducerScoreStats, VideoQualityConstraints, Client as default, LeaveRoomState as leaveRoomState };