@cloudflare/realtimekit 1.2.3 → 1.2.4-staging.10

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
  }
@@ -1425,6 +1455,10 @@ interface PinChatMessageResponse {
1425
1455
  * @generated from protobuf field: optional string channel_id = 3;
1426
1456
  */
1427
1457
  channelId?: string;
1458
+ /**
1459
+ * @generated from protobuf field: socket.chat.ChatMessage message = 4;
1460
+ */
1461
+ message?: ChatMessage;
1428
1462
  }
1429
1463
  /**
1430
1464
  * @generated MessageType for protobuf message socket.chat.PinChatMessageResponse
@@ -1467,83 +1501,6 @@ interface DeleteChatMessageResponse {
1467
1501
  */
1468
1502
  declare const DeleteChatMessageResponse: DeleteChatMessageResponse$Type;
1469
1503
 
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
1504
  declare class EnablePluginResponse$Type extends MessageType$1<EnablePluginResponse> {
1548
1505
  constructor();
1549
1506
  }
@@ -2953,48 +2910,6 @@ declare class TypedEventEmitter$1<Events extends EventMap$1 & WildCardEvent<Even
2953
2910
  listenerCount<T extends StringKeyOf<Events>>(event: T): number;
2954
2911
  }
2955
2912
 
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
2913
  declare enum ChatMessageType {
2999
2914
  TEXT = 0,
3000
2915
  IMAGE = 1,
@@ -3003,10 +2918,10 @@ declare enum ChatMessageType {
3003
2918
  }
3004
2919
  type ChatSocketMessage = SendChatMessageToRoomResponse | SendChatMessageToPeersResponse | EditChatMessageResponse | DeleteChatMessageResponse;
3005
2920
  interface SearchFilters {
3006
- channelId?: string;
3007
2921
  timestamp?: number;
3008
- size?: number;
2922
+ limit?: number;
3009
2923
  reversed?: boolean;
2924
+ offset?: number;
3010
2925
  }
3011
2926
  declare class ChatSocketHandler {
3012
2927
  get telemetry(): Telemetry;
@@ -3016,20 +2931,16 @@ declare class ChatSocketHandler {
3016
2931
  id: string;
3017
2932
  payload: Uint8Array;
3018
2933
  }>;
3019
- getChatMessagesPaginated(timeStamp: number, size: number, reversed: boolean, offset?: number, channelId?: string): Promise<GetPaginatedChatMessageRoomResponse>;
2934
+ getChatMessagesPaginated(timeStamp: number, size: number, reversed: boolean, filters?: GetPaginatedChatMessageFilters['filters']): Promise<GetPaginatedChatMessageRoomResponse>;
3020
2935
  sendMessageToRoom(message: string, messageType: ChatMessageType): void;
3021
2936
  sendMessageToPeers(message: string, messageType: ChatMessageType, peerIds: string[]): void;
3022
- sendMessageToChannel(message: string, messageType: ChatMessageType, channelId: string): void;
3023
- sendMessage(message: string, messageType: ChatMessageType, peerIds?: string[], channelId?: string): void;
3024
- editMessage(chatId: string, message: string, payloadType: ChatMessageType, channelId?: string, pinned?: boolean): Promise<ChatMessage>;
3025
- deleteMessage(chatId: string, channelId?: string): Promise<{
3026
- channelId?: string;
2937
+ sendMessage(message: string, messageType: ChatMessageType, peerIds?: string[]): void;
2938
+ editMessage(chatId: string, message: string, payloadType: ChatMessageType, pinned?: boolean): Promise<ChatMessage>;
2939
+ deleteMessage(chatId: string): Promise<{
3027
2940
  id: string;
3028
2941
  }>;
3029
2942
  searchMessages(query: string, filters: SearchFilters): Promise<ChatMessage[]>;
3030
- getAllChannels(): Promise<ChatChannel[]>;
3031
- markLastReadMessage(channelId: string, message: Message): Promise<string>;
3032
- setPinState(message: Message, pin: boolean): Promise<PinChatMessageResponse>;
2943
+ setPinState(id: string, pin: boolean): Promise<PinChatMessageResponse>;
3033
2944
  on(event: number, handler: (socketMessage: ChatSocketMessage) => void): void;
3034
2945
  }
3035
2946
 
@@ -3118,6 +3029,20 @@ type MediaConnectionState = {
3118
3029
  };
3119
3030
  };
3120
3031
 
3032
+ interface BasicParticipant {
3033
+ userId: string;
3034
+ name?: string;
3035
+ picture?: string;
3036
+ customParticipantId: string;
3037
+ }
3038
+ declare class BasicParticipantsMap extends CustomEventEmitter<'participantsUpdate'> {
3039
+ constructor(logger: Logger);
3040
+ __set(objId: string, obj: BasicParticipant): Map<string, BasicParticipant>;
3041
+ __clear(): void;
3042
+ get(objId: string): BasicParticipant;
3043
+ toArray(): BasicParticipant[];
3044
+ }
3045
+
3121
3046
  type EventHandlerTypes = PeerInfoResponse | GetWaitingRoomRequests | RecordingEvent | UpdatePeersPresetResponse | PeerJoinBroadcastResponse | PeerJoinCompleteResponse | GlobalPeerPinningBroadcastResponse | PeerLeaveResponse | SelectedPeersResponse | SelectedPeersDiffResponse;
3122
3047
  declare class RoomSocketHandler {
3123
3048
  socket: SocketService;
@@ -3984,18 +3909,6 @@ type PresetV2CamelCased = {
3984
3909
  text: boolean;
3985
3910
  files: boolean;
3986
3911
  };
3987
- channel?: {
3988
- canCreate: 'NONE' | 'PRIVATE' | 'PUBLIC' | 'ALL';
3989
- canDelete: 'NONE' | 'PRIVATE' | 'PUBLIC' | 'ALL';
3990
- canUpdate: 'NONE' | 'PRIVATE' | 'PUBLIC' | 'ALL';
3991
- canReadAll: boolean;
3992
- };
3993
- message?: {
3994
- canDelete: 'NONE' | 'SELF' | 'ALL';
3995
- canEdit: 'NONE' | 'SELF' | 'ALL';
3996
- deleteCutoffTimeSeconds: number;
3997
- editCutoffTimeSeconds: number;
3998
- };
3999
3912
  };
4000
3913
  isRecorder?: boolean;
4001
3914
  recorderType: RecorderType$1;
@@ -4142,8 +4055,6 @@ declare class PermissionPreset extends TypedEventEmitter$1<PermissionEvents> {
4142
4055
  get canProduceAudio(): Readonly<MediaProductionPermissionType>;
4143
4056
  get chatPublic(): Readonly<PresetPermissions['chat']['public']>;
4144
4057
  get chatPrivate(): Readonly<PresetPermissions['chat']['private']>;
4145
- get chatChannel(): Readonly<PresetPermissions['chat']['channel']>;
4146
- get chatMessage(): Readonly<PresetPermissions['chat']['message']>;
4147
4058
  get connectedMeetings(): Readonly<PresetPermissions['connectedMeetings']>;
4148
4059
  get hiddenParticipant(): Readonly<boolean>;
4149
4060
  get showParticipantList(): Readonly<boolean>;
@@ -4391,7 +4302,7 @@ declare class APIClient extends API {
4391
4302
  getPluginDetails(pluginId: string): Promise<PluginResponse>;
4392
4303
  getPluginConfig(pluginBaseUrl: string): Promise<PluginConfig>;
4393
4304
  authorizePlugin(pluginId: string): Promise<string>;
4394
- getPresignedUrls(filename: string, viewType: string): Promise<{
4305
+ getPresignedUrls(filename: string): Promise<{
4395
4306
  getLocation: any;
4396
4307
  putLocation: any;
4397
4308
  }>;
@@ -4431,8 +4342,6 @@ interface BaseMessage<T extends MessageType> {
4431
4342
  pluginId?: string;
4432
4343
  pinned?: boolean;
4433
4344
  targetUserIds?: string[];
4434
- channelId?: string;
4435
- channelIndex?: string;
4436
4345
  }
4437
4346
  interface TextMessage extends BaseMessage<MessageType.text> {
4438
4347
  message: string;
@@ -4493,28 +4402,29 @@ interface FileMessagePayload {
4493
4402
  type MessagePayload = TextMessagePayload | ImageMessagePayload | FileMessagePayload | CustomMessagePayload;
4494
4403
  interface ChatUpdateParams {
4495
4404
  action: 'add' | 'edit' | 'delete';
4496
- message: Message | {
4497
- id: string;
4498
- channelId: string;
4499
- };
4405
+ message: Message;
4500
4406
  messages: Message[];
4501
4407
  }
4502
4408
  type ChatEvents = {
4503
4409
  ['chatUpdate']: (payload: ChatUpdateParams) => void;
4504
4410
  ['pinMessage']: (payload: Omit<ChatUpdateParams, 'action'>) => void;
4505
4411
  ['unpinMessage']: (payload: Omit<ChatUpdateParams, 'action'>) => void;
4506
- ['channelCreate']: (channel: ChatChannel) => void;
4507
- ['channelMessageUpdate']: (channel: ChatChannel) => void;
4508
- ['channelUpdate']: (channel?: ChatChannel) => void;
4509
4412
  ['*']: (event: string, ...args: any[]) => void;
4510
4413
  };
4414
+ interface FetchMessageOptions {
4415
+ timestamp?: number;
4416
+ limit: number;
4417
+ direction: 'before' | 'after';
4418
+ }
4419
+ interface FetchPrivateMessagesOptions extends FetchMessageOptions {
4420
+ userId: string;
4421
+ }
4511
4422
  declare class Chat extends TypedEventEmitter$1<ChatEvents> {
4512
4423
  messages: Message[];
4513
- channels: ChatChannel[];
4514
4424
  maxTextLimit: number;
4515
4425
  get telemetry(): Telemetry;
4516
4426
  setMaxTextLimit(limit: number): void;
4517
- constructor(context: Context<ContextState>, chatSocketHandler: ChatSocketHandler, chatChannelSocketHandler: ChatChannelSocketHandler, self: Self, participants: Participants);
4427
+ constructor(context: Context<ContextState>, chatSocketHandler: ChatSocketHandler, self: Self, participants: Participants);
4518
4428
  private sendMessageInternal;
4519
4429
  private sendTextMessageInternal;
4520
4430
  private sendImageMessageInternal;
@@ -4529,31 +4439,23 @@ declare class Chat extends TypedEventEmitter$1<ChatEvents> {
4529
4439
  sendImageMessage(image: File | ReactNativeFile, peerIds?: string[]): Promise<void>;
4530
4440
  sendFileMessage(file: File | ReactNativeFile, peerIds?: string[]): Promise<void>;
4531
4441
  sendMessage(message: MessagePayload, participantIds?: string[]): Promise<void>;
4532
- editTextMessage(messageId: string, message: string, channelId?: string): Promise<void>;
4533
- editImageMessage(messageId: string, image: File | ReactNativeFile, channelId?: string): Promise<void>;
4534
- editFileMessage(messageId: string, file: File | ReactNativeFile, channelId?: string): Promise<void>;
4535
- editMessage(messageId: string, message: MessagePayload, channelId?: string): Promise<void>;
4536
- deleteMessage(messageId: string, channelId?: string): Promise<void>;
4442
+ editTextMessage(messageId: string, message: string): Promise<void>;
4443
+ editImageMessage(messageId: string, image: File | ReactNativeFile): Promise<void>;
4444
+ editFileMessage(messageId: string, file: File | ReactNativeFile): Promise<void>;
4445
+ editMessage(messageId: string, message: MessagePayload): Promise<void>;
4446
+ deleteMessage(messageId: string): Promise<void>;
4537
4447
  getMessagesByUser(userId: string): Message[];
4538
4448
  getMessagesByType(type: keyof typeof MessageType): Message[];
4539
4449
  pin(id: string): Promise<void>;
4540
4450
  unpin(id: string): Promise<void>;
4541
- getMessages(timeStamp: number, size: number, reversed: boolean, offset?: number, channelId?: string): Promise<{
4451
+ fetchPublicMessages({ timestamp, limit, direction, }: FetchMessageOptions): Promise<Message[]>;
4452
+ fetchPrivateMessages({ timestamp, limit, direction, userId, }: FetchPrivateMessagesOptions): Promise<Message[]>;
4453
+ fetchPinnedMessages({ timestamp, limit, direction, }: FetchMessageOptions): Promise<Message[]>;
4454
+ getMessages(timeStamp: number, size: number, reversed: boolean, offset?: number): Promise<{
4542
4455
  messages: Message[];
4543
4456
  next: boolean;
4544
4457
  }>;
4545
- createChannel(channelName: string, memberIds: string[], options?: {
4546
- displayPictureUrl?: string;
4547
- visibility?: string;
4548
- isDirectMessage?: boolean;
4549
- }): Promise<ChatChannel>;
4550
- updateChannel(channelId: string, payload: UpdateChannelRequestPayload): Promise<ChatChannel>;
4551
- sendMessageToChannel(message: MessagePayload, channelId: string, options?: {
4552
- replyTo?: Message;
4553
- }): Promise<void>;
4554
- getChannelMembers(channelId: string): Promise<BasicParticipant[]>;
4555
- searchMessages(query: string, filters?: SearchFilters): Promise<Message[]>;
4556
- markLastReadMessage(channelId: string, message: Message): Promise<void>;
4458
+ searchMessages(query: string, filters: unknown): Promise<unknown[]>;
4557
4459
  get pinned(): Message[];
4558
4460
  }
4559
4461
 
@@ -4834,15 +4736,15 @@ declare class Store {
4834
4736
  });
4835
4737
  set(key: string, value: any, sync?: boolean, emit?: boolean): Promise<void>;
4836
4738
  private remoteSet;
4837
- bulkSet(data: {
4739
+ bulkSet(data: Array<{
4838
4740
  key: string;
4839
4741
  payload: any;
4840
- }[]): Promise<void>;
4742
+ }>): Promise<void>;
4841
4743
  update(key: string, value: any, sync?: boolean): Promise<void>;
4842
4744
  delete(key: string, sync?: boolean, emit?: boolean): Promise<void>;
4843
- bulkDelete(data: {
4745
+ bulkDelete(data: Array<{
4844
4746
  key: string;
4845
- }[]): Promise<void>;
4747
+ }>): Promise<void>;
4846
4748
  get(key: string): any;
4847
4749
  getAll(): StoreData;
4848
4750
  get rateLimits(): {
@@ -5146,7 +5048,6 @@ declare const ERROR_CODES: {
5146
5048
  '0504': string;
5147
5049
  '0505': string;
5148
5050
  '0506': string;
5149
- '0510': string;
5150
5051
  '0600': string;
5151
5052
  '0601': string;
5152
5053
  '0602': string;
@@ -6052,4 +5953,4 @@ declare global {
6052
5953
  }
6053
5954
  }
6054
5955
 
6055
- 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 };
5956
+ 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 };