@liveblocks/core 3.15.5 → 3.16.0-feeds2

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
@@ -127,7 +127,8 @@ declare enum Permission {
127
127
  Write = "room:write",
128
128
  PresenceWrite = "room:presence:write",
129
129
  CommentsWrite = "comments:write",
130
- CommentsRead = "comments:read"
130
+ CommentsRead = "comments:read",
131
+ FeedsWrite = "feeds:write"
131
132
  }
132
133
 
133
134
  type RenameDataField<T, TFieldName extends string> = T extends any ? {
@@ -1203,7 +1204,7 @@ declare global {
1203
1204
  [key: string]: unknown;
1204
1205
  }
1205
1206
  }
1206
- type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "CommentMetadata" | "RoomInfo" | "GroupInfo" | "ActivitiesData";
1207
+ type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "CommentMetadata" | "FeedMetadata" | "FeedMessageData" | "RoomInfo" | "GroupInfo" | "ActivitiesData";
1207
1208
  type MakeErrorString<K extends ExtendableTypes, Reason extends string = "does not match its requirements"> = `The type you provided for '${K}' ${Reason}. To learn how to fix this, see https://liveblocks.io/docs/errors/${K}`;
1208
1209
  type GetOverride<K extends ExtendableTypes, B, Reason extends string = "does not match its requirements"> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
1209
1210
  type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
@@ -1213,6 +1214,8 @@ type DU = GetOverrideOrErrorValue<"UserMeta", BaseUserMeta, Record<"id" | "info"
1213
1214
  type DE = GetOverride<"RoomEvent", Json, "is not a valid JSON value">;
1214
1215
  type DTM = GetOverride<"ThreadMetadata", BaseMetadata>;
1215
1216
  type DCM = GetOverride<"CommentMetadata", BaseMetadata>;
1217
+ type DFM = GetOverride<"FeedMetadata", Json, "is not a valid JSON value">;
1218
+ type DFMD = GetOverride<"FeedMessageData", Json, "is not a valid JSON value">;
1216
1219
  type DRI = GetOverride<"RoomInfo", BaseRoomInfo>;
1217
1220
  type DGI = GetOverride<"GroupInfo", BaseGroupInfo>;
1218
1221
  type DAD = GetOverrideOrErrorValue<"ActivitiesData", BaseActivitiesData, {
@@ -1970,6 +1973,13 @@ type RoomConnectionErrorContext = {
1970
1973
  type LargeMessageErrorContext = {
1971
1974
  type: "LARGE_MESSAGE_ERROR";
1972
1975
  };
1976
+ type FeedRequestErrorContext = {
1977
+ type: "FEED_REQUEST_ERROR";
1978
+ roomId: string;
1979
+ requestId: string;
1980
+ code: string;
1981
+ reason?: string;
1982
+ };
1973
1983
  type CommentsOrNotificationsErrorContext = {
1974
1984
  type: "CREATE_THREAD_ERROR";
1975
1985
  roomId: string;
@@ -2030,7 +2040,7 @@ type CommentsOrNotificationsErrorContext = {
2030
2040
  } | {
2031
2041
  type: "UPDATE_NOTIFICATION_SETTINGS_ERROR";
2032
2042
  };
2033
- type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext | AiConnectionErrorContext | LargeMessageErrorContext>;
2043
+ type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext | AiConnectionErrorContext | LargeMessageErrorContext | FeedRequestErrorContext>;
2034
2044
  declare class LiveblocksError extends Error {
2035
2045
  readonly context: LiveblocksErrorContext;
2036
2046
  constructor(message: string, context: LiveblocksErrorContext, cause?: Error);
@@ -2113,7 +2123,7 @@ type InternalSyncStatus = SyncStatus | "has-local-changes";
2113
2123
  * of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
2114
2124
  * will probably happen if you do.
2115
2125
  */
2116
- type PrivateClientApi<U extends BaseUserMeta, TM extends BaseMetadata, CM extends BaseMetadata> = {
2126
+ type PrivateClientApi<U extends BaseUserMeta, TM extends BaseMetadata, CM extends BaseMetadata, FM extends Json = DFM, FMD extends Json = DFMD> = {
2117
2127
  readonly currentUserId: Signal<string | undefined>;
2118
2128
  readonly mentionSuggestionsCache: Map<string, MentionData[]>;
2119
2129
  readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
@@ -2122,7 +2132,7 @@ type PrivateClientApi<U extends BaseUserMeta, TM extends BaseMetadata, CM extend
2122
2132
  readonly groupsInfoStore: BatchStore<DGI | undefined, string>;
2123
2133
  readonly getRoomIds: () => string[];
2124
2134
  readonly httpClient: LiveblocksHttpApi<TM, CM>;
2125
- as<TM2 extends BaseMetadata, CM2 extends BaseMetadata>(): Client<U, TM2, CM2>;
2135
+ as<TM2 extends BaseMetadata, CM2 extends BaseMetadata, FM2 extends Json = FM, FMD2 extends Json = FMD>(): Client<U, TM2, CM2, FM2, FMD2>;
2126
2136
  createSyncSource(): SyncSource;
2127
2137
  emitError(context: LiveblocksErrorContext, cause?: Error): void;
2128
2138
  ai: Ai;
@@ -2275,23 +2285,23 @@ type NotificationsApi<TM extends BaseMetadata, CM extends BaseMetadata> = {
2275
2285
  * narrower.
2276
2286
  */
2277
2287
  type OpaqueClient = Client<BaseUserMeta>;
2278
- type Client<U extends BaseUserMeta = DU, TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> = {
2288
+ type Client<U extends BaseUserMeta = DU, TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM, FM extends Json = DFM, FMD extends Json = DFMD> = {
2279
2289
  /**
2280
2290
  * Gets a room. Returns null if {@link Client.enter} has not been called previously.
2281
2291
  *
2282
2292
  * @param roomId The id of the room
2283
2293
  */
2284
- getRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE, TM2 extends BaseMetadata = TM, CM2 extends BaseMetadata = CM>(roomId: string): Room<P, S, U, E, TM2, CM2> | null;
2294
+ getRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE, TM2 extends BaseMetadata = TM, CM2 extends BaseMetadata = CM, FM2 extends Json = FM, FMD2 extends Json = FMD>(roomId: string): Room<P, S, U, E, TM2, CM2, FM2, FMD2> | null;
2285
2295
  /**
2286
2296
  * Enter a room.
2287
2297
  * @param roomId The id of the room
2288
2298
  * @param options Optional. You can provide initializers for the Presence or Storage when entering the Room.
2289
2299
  * @returns The room and a leave function. Call the returned leave() function when you no longer need the room.
2290
2300
  */
2291
- enterRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE, TM2 extends BaseMetadata = TM, CM2 extends BaseMetadata = CM>(roomId: string, ...args: OptionalTupleUnless<P & S, [
2301
+ enterRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE, TM2 extends BaseMetadata = TM, CM2 extends BaseMetadata = CM, FM2 extends Json = FM, FMD2 extends Json = FMD>(roomId: string, ...args: OptionalTupleUnless<P & S, [
2292
2302
  options: EnterOptions<NoInfr<P>, NoInfr<S>>
2293
2303
  ]>): {
2294
- room: Room<P, S, U, E, TM2, CM2>;
2304
+ room: Room<P, S, U, E, TM2, CM2, FM2, FMD2>;
2295
2305
  leave: () => void;
2296
2306
  };
2297
2307
  /**
@@ -2357,7 +2367,7 @@ type Client<U extends BaseUserMeta = DU, TM extends BaseMetadata = DTM, CM exten
2357
2367
  * of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
2358
2368
  * will probably happen if you do.
2359
2369
  */
2360
- readonly [kInternal]: PrivateClientApi<U, TM, CM>;
2370
+ readonly [kInternal]: PrivateClientApi<U, TM, CM, FM, FMD>;
2361
2371
  /**
2362
2372
  * Returns the current global sync status of the Liveblocks client. If any
2363
2373
  * part of Liveblocks has any local pending changes that haven't been
@@ -2582,6 +2592,14 @@ declare const ClientMsgCode: Readonly<{
2582
2592
  UPDATE_STORAGE: 201;
2583
2593
  FETCH_YDOC: 300;
2584
2594
  UPDATE_YDOC: 301;
2595
+ FETCH_FEEDS: 510;
2596
+ FETCH_FEED_MESSAGES: 511;
2597
+ ADD_FEED: 512;
2598
+ UPDATE_FEED: 513;
2599
+ DELETE_FEED: 514;
2600
+ ADD_FEED_MESSAGE: 515;
2601
+ UPDATE_FEED_MESSAGE: 516;
2602
+ DELETE_FEED_MESSAGE: 517;
2585
2603
  }>;
2586
2604
  declare namespace ClientMsgCode {
2587
2605
  type UPDATE_PRESENCE = typeof ClientMsgCode.UPDATE_PRESENCE;
@@ -2590,11 +2608,19 @@ declare namespace ClientMsgCode {
2590
2608
  type UPDATE_STORAGE = typeof ClientMsgCode.UPDATE_STORAGE;
2591
2609
  type FETCH_YDOC = typeof ClientMsgCode.FETCH_YDOC;
2592
2610
  type UPDATE_YDOC = typeof ClientMsgCode.UPDATE_YDOC;
2611
+ type FETCH_FEEDS = typeof ClientMsgCode.FETCH_FEEDS;
2612
+ type FETCH_FEED_MESSAGES = typeof ClientMsgCode.FETCH_FEED_MESSAGES;
2613
+ type ADD_FEED = typeof ClientMsgCode.ADD_FEED;
2614
+ type UPDATE_FEED = typeof ClientMsgCode.UPDATE_FEED;
2615
+ type DELETE_FEED = typeof ClientMsgCode.DELETE_FEED;
2616
+ type ADD_FEED_MESSAGE = typeof ClientMsgCode.ADD_FEED_MESSAGE;
2617
+ type UPDATE_FEED_MESSAGE = typeof ClientMsgCode.UPDATE_FEED_MESSAGE;
2618
+ type DELETE_FEED_MESSAGE = typeof ClientMsgCode.DELETE_FEED_MESSAGE;
2593
2619
  }
2594
2620
  /**
2595
2621
  * Messages that can be sent from the client to the server.
2596
2622
  */
2597
- type ClientMsg<P extends JsonObject, E extends Json> = BroadcastEventClientMsg<E> | UpdatePresenceClientMsg<P> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchYDocClientMsg | UpdateYDocClientMsg;
2623
+ type ClientMsg<P extends JsonObject, E extends Json> = BroadcastEventClientMsg<E> | UpdatePresenceClientMsg<P> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchYDocClientMsg | UpdateYDocClientMsg | FetchFeedsClientMsg | FetchFeedMessagesClientMsg | AddFeedClientMsg | UpdateFeedClientMsg | DeleteFeedClientMsg | AddFeedMessageClientMsg | UpdateFeedMessageClientMsg | DeleteFeedMessageClientMsg;
2598
2624
  type BroadcastEventClientMsg<E extends Json> = {
2599
2625
  type: ClientMsgCode.BROADCAST_EVENT;
2600
2626
  event: E;
@@ -2644,6 +2670,81 @@ type UpdateYDocClientMsg = {
2644
2670
  readonly guid?: string;
2645
2671
  readonly v2?: boolean;
2646
2672
  };
2673
+ /** Metadata filter for {@link FetchFeedsClientMsg}. Values are matched as strings. */
2674
+ type FeedFetchMetadataFilter = Record<string, string>;
2675
+ /** Metadata for {@link AddFeedClientMsg}. */
2676
+ type FeedCreateMetadata = Record<string, string | string[]>;
2677
+ /** Metadata for {@link UpdateFeedClientMsg}. Use `null` to remove a key. */
2678
+ type FeedUpdateMetadata = Record<string, string | string[] | null>;
2679
+ type FetchFeedsClientMsg = {
2680
+ readonly type: ClientMsgCode.FETCH_FEEDS;
2681
+ readonly requestId: string;
2682
+ readonly cursor?: string;
2683
+ readonly since?: number;
2684
+ readonly limit?: number;
2685
+ readonly metadata?: FeedFetchMetadataFilter;
2686
+ };
2687
+ type FetchFeedMessagesClientMsg = {
2688
+ readonly type: ClientMsgCode.FETCH_FEED_MESSAGES;
2689
+ readonly requestId: string;
2690
+ readonly feedId: string;
2691
+ readonly cursor?: string;
2692
+ readonly since?: number;
2693
+ readonly limit?: number;
2694
+ };
2695
+ type AddFeedClientMsg = {
2696
+ readonly type: ClientMsgCode.ADD_FEED;
2697
+ readonly requestId: string;
2698
+ readonly feedId: string;
2699
+ readonly metadata?: FeedCreateMetadata;
2700
+ readonly createdAt?: number;
2701
+ };
2702
+ type UpdateFeedClientMsg = {
2703
+ readonly type: ClientMsgCode.UPDATE_FEED;
2704
+ readonly requestId: string;
2705
+ readonly feedId: string;
2706
+ readonly metadata: FeedUpdateMetadata;
2707
+ };
2708
+ type DeleteFeedClientMsg = {
2709
+ readonly type: ClientMsgCode.DELETE_FEED;
2710
+ readonly requestId: string;
2711
+ readonly feedId: string;
2712
+ };
2713
+ type AddFeedMessageClientMsg = {
2714
+ readonly type: ClientMsgCode.ADD_FEED_MESSAGE;
2715
+ readonly requestId: string;
2716
+ readonly feedId: string;
2717
+ readonly data: JsonObject;
2718
+ readonly id?: string;
2719
+ readonly createdAt?: number;
2720
+ };
2721
+ type UpdateFeedMessageClientMsg = {
2722
+ readonly type: ClientMsgCode.UPDATE_FEED_MESSAGE;
2723
+ readonly requestId: string;
2724
+ readonly feedId: string;
2725
+ readonly messageId: string;
2726
+ readonly data: JsonObject;
2727
+ readonly updatedAt?: number;
2728
+ };
2729
+ type DeleteFeedMessageClientMsg = {
2730
+ readonly type: ClientMsgCode.DELETE_FEED_MESSAGE;
2731
+ readonly requestId: string;
2732
+ readonly feedId: string;
2733
+ readonly messageId: string;
2734
+ };
2735
+
2736
+ type Feed<FM extends Json = Json> = {
2737
+ feedId: string;
2738
+ metadata: FM;
2739
+ createdAt: number;
2740
+ updatedAt: number;
2741
+ };
2742
+ type FeedMessage<FMD extends Json = Json> = {
2743
+ id: string;
2744
+ createdAt: number;
2745
+ updatedAt: number;
2746
+ data: FMD;
2747
+ };
2647
2748
 
2648
2749
  type ServerMsgCode = (typeof ServerMsgCode)[keyof typeof ServerMsgCode];
2649
2750
  declare const ServerMsgCode: Readonly<{
@@ -2667,6 +2768,15 @@ declare const ServerMsgCode: Readonly<{
2667
2768
  COMMENT_REACTION_ADDED: 405;
2668
2769
  COMMENT_REACTION_REMOVED: 406;
2669
2770
  COMMENT_METADATA_UPDATED: 409;
2771
+ FEEDS_LIST: 500;
2772
+ FEEDS_ADDED: 501;
2773
+ FEEDS_UPDATED: 502;
2774
+ FEED_DELETED: 503;
2775
+ FEED_MESSAGES_LIST: 504;
2776
+ FEED_MESSAGES_ADDED: 505;
2777
+ FEED_MESSAGES_UPDATED: 506;
2778
+ FEED_MESSAGES_DELETED: 507;
2779
+ FEED_REQUEST_FAILED: 508;
2670
2780
  REJECT_STORAGE_OP: 299;
2671
2781
  }>;
2672
2782
  declare namespace ServerMsgCode {
@@ -2689,13 +2799,22 @@ declare namespace ServerMsgCode {
2689
2799
  type COMMENT_DELETED = typeof ServerMsgCode.COMMENT_DELETED;
2690
2800
  type COMMENT_REACTION_ADDED = typeof ServerMsgCode.COMMENT_REACTION_ADDED;
2691
2801
  type COMMENT_REACTION_REMOVED = typeof ServerMsgCode.COMMENT_REACTION_REMOVED;
2802
+ type FEEDS_LIST = typeof ServerMsgCode.FEEDS_LIST;
2803
+ type FEEDS_ADDED = typeof ServerMsgCode.FEEDS_ADDED;
2804
+ type FEEDS_UPDATED = typeof ServerMsgCode.FEEDS_UPDATED;
2805
+ type FEED_DELETED = typeof ServerMsgCode.FEED_DELETED;
2806
+ type FEED_MESSAGES_LIST = typeof ServerMsgCode.FEED_MESSAGES_LIST;
2807
+ type FEED_MESSAGES_ADDED = typeof ServerMsgCode.FEED_MESSAGES_ADDED;
2808
+ type FEED_MESSAGES_UPDATED = typeof ServerMsgCode.FEED_MESSAGES_UPDATED;
2809
+ type FEED_MESSAGES_DELETED = typeof ServerMsgCode.FEED_MESSAGES_DELETED;
2810
+ type FEED_REQUEST_FAILED = typeof ServerMsgCode.FEED_REQUEST_FAILED;
2692
2811
  type COMMENT_METADATA_UPDATED = typeof ServerMsgCode.COMMENT_METADATA_UPDATED;
2693
2812
  type REJECT_STORAGE_OP = typeof ServerMsgCode.REJECT_STORAGE_OP;
2694
2813
  }
2695
2814
  /**
2696
2815
  * Messages that can be sent from the server to the client.
2697
2816
  */
2698
- type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | StorageStateServerMsg_V7 | StorageChunkServerMsg | StorageEndServerMsg | UpdateStorageServerMsg | YDocUpdateServerMsg | RejectedStorageOpServerMsg | CommentsEventServerMsg;
2817
+ type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | StorageStateServerMsg_V7 | StorageChunkServerMsg | StorageEndServerMsg | UpdateStorageServerMsg | YDocUpdateServerMsg | RejectedStorageOpServerMsg | CommentsEventServerMsg | FeedsEventServerMsg;
2699
2818
  type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | CommentMetadataUpdatedEvent;
2700
2819
  type ThreadCreatedEvent = {
2701
2820
  type: ServerMsgCode.THREAD_CREATED;
@@ -2926,6 +3045,66 @@ type RejectedStorageOpServerMsg = {
2926
3045
  readonly opIds: string[];
2927
3046
  readonly reason: string;
2928
3047
  };
3048
+ type FeedsEventServerMsg<FM extends Json = Json, FMD extends Json = Json> = FeedsListServerMsg<FM> | FeedsAddedServerMsg<FM> | FeedsUpdatedServerMsg<FM> | FeedDeletedServerMsg | FeedMessagesListServerMsg<FMD> | FeedMessagesAddedServerMsg<FMD> | FeedMessagesUpdatedServerMsg<FMD> | FeedMessagesDeletedServerMsg | FeedRequestFailedServerMsg;
3049
+ /** Error codes for {@link FeedRequestFailedServerMsg}. */
3050
+ declare const FeedRequestErrorCode: {
3051
+ readonly INTERNAL: "INTERNAL";
3052
+ readonly FEED_ALREADY_EXISTS: "FEED_ALREADY_EXISTS";
3053
+ readonly FEED_NOT_FOUND: "FEED_NOT_FOUND";
3054
+ readonly FEED_MESSAGE_NOT_FOUND: "FEED_MESSAGE_NOT_FOUND";
3055
+ };
3056
+ /** String literals accepted in {@link FeedRequestFailedServerMsg}.code */
3057
+ type FeedRequestError = (typeof FeedRequestErrorCode)[keyof typeof FeedRequestErrorCode];
3058
+ /**
3059
+ * Sent to the client when a feed mutation referenced by `requestId` failed
3060
+ * (e.g. validation or permission error).
3061
+ */
3062
+ type FeedRequestFailedServerMsg = {
3063
+ readonly type: ServerMsgCode.FEED_REQUEST_FAILED;
3064
+ readonly requestId: string;
3065
+ readonly code: string;
3066
+ readonly reason?: string;
3067
+ };
3068
+ type FeedsListServerMsg<FM extends Json = Json> = {
3069
+ readonly type: ServerMsgCode.FEEDS_LIST;
3070
+ readonly requestId: string;
3071
+ readonly feeds: Feed<FM>[];
3072
+ readonly nextCursor?: string;
3073
+ };
3074
+ type FeedsAddedServerMsg<FM extends Json = Json> = {
3075
+ readonly type: ServerMsgCode.FEEDS_ADDED;
3076
+ readonly feeds: Feed<FM>[];
3077
+ };
3078
+ type FeedsUpdatedServerMsg<FM extends Json = Json> = {
3079
+ readonly type: ServerMsgCode.FEEDS_UPDATED;
3080
+ readonly feeds: Feed<FM>[];
3081
+ };
3082
+ type FeedDeletedServerMsg = {
3083
+ readonly type: ServerMsgCode.FEED_DELETED;
3084
+ readonly feedId: string;
3085
+ };
3086
+ type FeedMessagesListServerMsg<FMD extends Json = Json> = {
3087
+ readonly type: ServerMsgCode.FEED_MESSAGES_LIST;
3088
+ readonly requestId: string;
3089
+ readonly feedId: string;
3090
+ readonly messages: FeedMessage<FMD>[];
3091
+ readonly nextCursor?: string;
3092
+ };
3093
+ type FeedMessagesAddedServerMsg<FMD extends Json = Json> = {
3094
+ readonly type: ServerMsgCode.FEED_MESSAGES_ADDED;
3095
+ readonly feedId: string;
3096
+ readonly messages: FeedMessage<FMD>[];
3097
+ };
3098
+ type FeedMessagesUpdatedServerMsg<FMD extends Json = Json> = {
3099
+ readonly type: ServerMsgCode.FEED_MESSAGES_UPDATED;
3100
+ readonly feedId: string;
3101
+ readonly messages: FeedMessage<FMD>[];
3102
+ };
3103
+ type FeedMessagesDeletedServerMsg = {
3104
+ readonly type: ServerMsgCode.FEED_MESSAGES_DELETED;
3105
+ readonly feedId: string;
3106
+ readonly messageIds: readonly string[];
3107
+ };
2929
3108
 
2930
3109
  type HistoryVersion = {
2931
3110
  type: "historyVersion";
@@ -3260,8 +3439,8 @@ type GetSubscriptionSettingsOptions = {
3260
3439
  * this type is different from `Room`-without-type-arguments. That represents
3261
3440
  * a Room instance using globally augmented types only, which is narrower.
3262
3441
  */
3263
- type OpaqueRoom = Room<JsonObject, LsonObject, BaseUserMeta, Json, BaseMetadata>;
3264
- type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> = {
3442
+ type OpaqueRoom = Room<JsonObject, LsonObject, BaseUserMeta, Json, BaseMetadata, BaseMetadata, Json, Json>;
3443
+ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM, FM extends Json = DFM, FMD extends Json = DFMD> = {
3265
3444
  /**
3266
3445
  * @private
3267
3446
  *
@@ -3334,6 +3513,63 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
3334
3513
  * Sends a request for the current document from liveblocks server
3335
3514
  */
3336
3515
  fetchYDoc(stateVector: string, guid?: string, isV2?: boolean): void;
3516
+ /**
3517
+ * Fetches feeds for the room.
3518
+ */
3519
+ fetchFeeds(options?: {
3520
+ cursor?: string;
3521
+ since?: number;
3522
+ limit?: number;
3523
+ metadata?: FeedFetchMetadataFilter;
3524
+ }): Promise<{
3525
+ feeds: Feed<FM>[];
3526
+ nextCursor?: string;
3527
+ }>;
3528
+ /**
3529
+ * Fetches messages for a specific feed.
3530
+ */
3531
+ fetchFeedMessages(feedId: string, options?: {
3532
+ cursor?: string;
3533
+ since?: number;
3534
+ limit?: number;
3535
+ }): Promise<{
3536
+ messages: FeedMessage<FMD>[];
3537
+ nextCursor?: string;
3538
+ }>;
3539
+ /**
3540
+ * Adds a new feed to the room via WebSocket.
3541
+ * Resolves when the server broadcasts the new feed, or rejects on
3542
+ * FEED_REQUEST_FAILED (508) or timeout.
3543
+ */
3544
+ addFeed(feedId: string, options?: {
3545
+ metadata?: FeedCreateMetadata;
3546
+ createdAt?: number;
3547
+ }): Promise<void>;
3548
+ /**
3549
+ * Updates metadata for an existing feed via WebSocket.
3550
+ */
3551
+ updateFeed(feedId: string, metadata: FeedUpdateMetadata): Promise<void>;
3552
+ /**
3553
+ * Deletes a feed via WebSocket.
3554
+ */
3555
+ deleteFeed(feedId: string): Promise<void>;
3556
+ /**
3557
+ * Adds a new message to a feed via WebSocket.
3558
+ */
3559
+ addFeedMessage(feedId: string, data: JsonObject, options?: {
3560
+ id?: string;
3561
+ createdAt?: number;
3562
+ }): Promise<void>;
3563
+ /**
3564
+ * Updates an existing feed message via WebSocket.
3565
+ */
3566
+ updateFeedMessage(feedId: string, messageId: string, data: JsonObject, options?: {
3567
+ updatedAt?: number;
3568
+ }): Promise<void>;
3569
+ /**
3570
+ * Deletes a feed message via WebSocket.
3571
+ */
3572
+ deleteFeedMessage(feedId: string, messageId: string): Promise<void>;
3337
3573
  /**
3338
3574
  * Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
3339
3575
  * @param {any} event the event to broadcast. Should be serializable to JSON
@@ -3392,6 +3628,7 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
3392
3628
  readonly storageStatus: Observable<StorageStatus>;
3393
3629
  readonly ydoc: Observable<YDocUpdateServerMsg | UpdateYDocClientMsg>;
3394
3630
  readonly comments: Observable<CommentsEventServerMsg>;
3631
+ readonly feeds: Observable<FeedsEventServerMsg<FM, FMD>>;
3395
3632
  /**
3396
3633
  * Called right before the room is destroyed. The event cannot be used to
3397
3634
  * prevent the room from being destroyed, only to be informed that this is
@@ -5320,4 +5557,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
5320
5557
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
5321
5558
  };
5322
5559
 
5323
- export { type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, type RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactNodesToNodeStream, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, nodeStreamToCompactNodes, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };
5560
+ export { type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DFM, type DFMD, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type Feed, type FeedCreateMetadata, type FeedDeletedServerMsg, type FeedFetchMetadataFilter, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedRequestError, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedUpdateMetadata, type FeedsAddedServerMsg, type FeedsEventServerMsg, type FeedsListServerMsg, type FeedsUpdatedServerMsg, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, type RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactNodesToNodeStream, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, nodeStreamToCompactNodes, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };