@liveblocks/core 3.15.0-components1 → 3.15.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.cjs +231 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +202 -13
- package/dist/index.d.ts +202 -13
- package/dist/index.js +192 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1203,7 +1203,7 @@ declare global {
|
|
|
1203
1203
|
[key: string]: unknown;
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
1206
|
-
type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "CommentMetadata" | "RoomInfo" | "GroupInfo" | "ActivitiesData";
|
|
1206
|
+
type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "CommentMetadata" | "FeedMetadata" | "FeedMessageData" | "RoomInfo" | "GroupInfo" | "ActivitiesData";
|
|
1207
1207
|
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
1208
|
type GetOverride<K extends ExtendableTypes, B, Reason extends string = "does not match its requirements"> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
|
|
1209
1209
|
type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
|
|
@@ -1213,6 +1213,8 @@ type DU = GetOverrideOrErrorValue<"UserMeta", BaseUserMeta, Record<"id" | "info"
|
|
|
1213
1213
|
type DE = GetOverride<"RoomEvent", Json, "is not a valid JSON value">;
|
|
1214
1214
|
type DTM = GetOverride<"ThreadMetadata", BaseMetadata>;
|
|
1215
1215
|
type DCM = GetOverride<"CommentMetadata", BaseMetadata>;
|
|
1216
|
+
type DSM = GetOverride<"FeedMetadata", Json, "is not a valid JSON value">;
|
|
1217
|
+
type DMD = GetOverride<"FeedMessageData", Json, "is not a valid JSON value">;
|
|
1216
1218
|
type DRI = GetOverride<"RoomInfo", BaseRoomInfo>;
|
|
1217
1219
|
type DGI = GetOverride<"GroupInfo", BaseGroupInfo>;
|
|
1218
1220
|
type DAD = GetOverrideOrErrorValue<"ActivitiesData", BaseActivitiesData, {
|
|
@@ -2114,7 +2116,7 @@ type InternalSyncStatus = SyncStatus | "has-local-changes";
|
|
|
2114
2116
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2115
2117
|
* will probably happen if you do.
|
|
2116
2118
|
*/
|
|
2117
|
-
type PrivateClientApi<U extends BaseUserMeta, TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
2119
|
+
type PrivateClientApi<U extends BaseUserMeta, TM extends BaseMetadata, CM extends BaseMetadata, SM extends Json = DSM, MD extends Json = DMD> = {
|
|
2118
2120
|
readonly currentUserId: Signal<string | undefined>;
|
|
2119
2121
|
readonly mentionSuggestionsCache: Map<string, MentionData[]>;
|
|
2120
2122
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
@@ -2123,7 +2125,7 @@ type PrivateClientApi<U extends BaseUserMeta, TM extends BaseMetadata, CM extend
|
|
|
2123
2125
|
readonly groupsInfoStore: BatchStore<DGI | undefined, string>;
|
|
2124
2126
|
readonly getRoomIds: () => string[];
|
|
2125
2127
|
readonly httpClient: LiveblocksHttpApi<TM, CM>;
|
|
2126
|
-
as<TM2 extends BaseMetadata, CM2 extends BaseMetadata>(): Client<U, TM2, CM2>;
|
|
2128
|
+
as<TM2 extends BaseMetadata, CM2 extends BaseMetadata, SM2 extends Json = SM, MD2 extends Json = MD>(): Client<U, TM2, CM2, SM2, MD2>;
|
|
2127
2129
|
createSyncSource(): SyncSource;
|
|
2128
2130
|
emitError(context: LiveblocksErrorContext, cause?: Error): void;
|
|
2129
2131
|
ai: Ai;
|
|
@@ -2276,23 +2278,23 @@ type NotificationsApi<TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
|
2276
2278
|
* narrower.
|
|
2277
2279
|
*/
|
|
2278
2280
|
type OpaqueClient = Client<BaseUserMeta>;
|
|
2279
|
-
type Client<U extends BaseUserMeta = DU, TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM> = {
|
|
2281
|
+
type Client<U extends BaseUserMeta = DU, TM extends BaseMetadata = DTM, CM extends BaseMetadata = DCM, SM extends Json = DSM, MD extends Json = DMD> = {
|
|
2280
2282
|
/**
|
|
2281
2283
|
* Gets a room. Returns null if {@link Client.enter} has not been called previously.
|
|
2282
2284
|
*
|
|
2283
2285
|
* @param roomId The id of the room
|
|
2284
2286
|
*/
|
|
2285
|
-
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;
|
|
2287
|
+
getRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE, TM2 extends BaseMetadata = TM, CM2 extends BaseMetadata = CM, SM2 extends Json = SM, MD2 extends Json = MD>(roomId: string): Room<P, S, U, E, TM2, CM2, SM2, MD2> | null;
|
|
2286
2288
|
/**
|
|
2287
2289
|
* Enter a room.
|
|
2288
2290
|
* @param roomId The id of the room
|
|
2289
2291
|
* @param options Optional. You can provide initializers for the Presence or Storage when entering the Room.
|
|
2290
2292
|
* @returns The room and a leave function. Call the returned leave() function when you no longer need the room.
|
|
2291
2293
|
*/
|
|
2292
|
-
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, [
|
|
2294
|
+
enterRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE, TM2 extends BaseMetadata = TM, CM2 extends BaseMetadata = CM, SM2 extends Json = SM, MD2 extends Json = MD>(roomId: string, ...args: OptionalTupleUnless<P & S, [
|
|
2293
2295
|
options: EnterOptions<NoInfr<P>, NoInfr<S>>
|
|
2294
2296
|
]>): {
|
|
2295
|
-
room: Room<P, S, U, E, TM2, CM2>;
|
|
2297
|
+
room: Room<P, S, U, E, TM2, CM2, SM2, MD2>;
|
|
2296
2298
|
leave: () => void;
|
|
2297
2299
|
};
|
|
2298
2300
|
/**
|
|
@@ -2358,7 +2360,7 @@ type Client<U extends BaseUserMeta = DU, TM extends BaseMetadata = DTM, CM exten
|
|
|
2358
2360
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2359
2361
|
* will probably happen if you do.
|
|
2360
2362
|
*/
|
|
2361
|
-
readonly [kInternal]: PrivateClientApi<U, TM, CM>;
|
|
2363
|
+
readonly [kInternal]: PrivateClientApi<U, TM, CM, SM, MD>;
|
|
2362
2364
|
/**
|
|
2363
2365
|
* Returns the current global sync status of the Liveblocks client. If any
|
|
2364
2366
|
* part of Liveblocks has any local pending changes that haven't been
|
|
@@ -2584,6 +2586,14 @@ declare const ClientMsgCode: Readonly<{
|
|
|
2584
2586
|
UPDATE_STORAGE: 201;
|
|
2585
2587
|
FETCH_YDOC: 300;
|
|
2586
2588
|
UPDATE_YDOC: 301;
|
|
2589
|
+
FETCH_FEEDS: 510;
|
|
2590
|
+
FETCH_FEED_MESSAGES: 511;
|
|
2591
|
+
ADD_FEED: 512;
|
|
2592
|
+
UPDATE_FEED: 513;
|
|
2593
|
+
DELETE_FEED: 514;
|
|
2594
|
+
ADD_FEED_MESSAGE: 515;
|
|
2595
|
+
UPDATE_FEED_MESSAGE: 516;
|
|
2596
|
+
DELETE_FEED_MESSAGE: 517;
|
|
2587
2597
|
}>;
|
|
2588
2598
|
declare namespace ClientMsgCode {
|
|
2589
2599
|
type UPDATE_PRESENCE = typeof ClientMsgCode.UPDATE_PRESENCE;
|
|
@@ -2592,11 +2602,19 @@ declare namespace ClientMsgCode {
|
|
|
2592
2602
|
type UPDATE_STORAGE = typeof ClientMsgCode.UPDATE_STORAGE;
|
|
2593
2603
|
type FETCH_YDOC = typeof ClientMsgCode.FETCH_YDOC;
|
|
2594
2604
|
type UPDATE_YDOC = typeof ClientMsgCode.UPDATE_YDOC;
|
|
2605
|
+
type FETCH_FEEDS = typeof ClientMsgCode.FETCH_FEEDS;
|
|
2606
|
+
type FETCH_FEED_MESSAGES = typeof ClientMsgCode.FETCH_FEED_MESSAGES;
|
|
2607
|
+
type ADD_FEED = typeof ClientMsgCode.ADD_FEED;
|
|
2608
|
+
type UPDATE_FEED = typeof ClientMsgCode.UPDATE_FEED;
|
|
2609
|
+
type DELETE_FEED = typeof ClientMsgCode.DELETE_FEED;
|
|
2610
|
+
type ADD_FEED_MESSAGE = typeof ClientMsgCode.ADD_FEED_MESSAGE;
|
|
2611
|
+
type UPDATE_FEED_MESSAGE = typeof ClientMsgCode.UPDATE_FEED_MESSAGE;
|
|
2612
|
+
type DELETE_FEED_MESSAGE = typeof ClientMsgCode.DELETE_FEED_MESSAGE;
|
|
2595
2613
|
}
|
|
2596
2614
|
/**
|
|
2597
2615
|
* Messages that can be sent from the client to the server.
|
|
2598
2616
|
*/
|
|
2599
|
-
type ClientMsg<P extends JsonObject, E extends Json> = BroadcastEventClientMsg<E> | UpdatePresenceClientMsg<P> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchYDocClientMsg | UpdateYDocClientMsg;
|
|
2617
|
+
type ClientMsg<P extends JsonObject, E extends Json> = BroadcastEventClientMsg<E> | UpdatePresenceClientMsg<P> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchYDocClientMsg | UpdateYDocClientMsg | FetchFeedsClientMsg | FetchFeedMessagesClientMsg | AddFeedClientMsg | UpdateFeedClientMsg | DeleteFeedClientMsg | AddFeedMessageClientMsg | UpdateFeedMessageClientMsg | DeleteFeedMessageClientMsg;
|
|
2600
2618
|
type BroadcastEventClientMsg<E extends Json> = {
|
|
2601
2619
|
type: ClientMsgCode.BROADCAST_EVENT;
|
|
2602
2620
|
event: E;
|
|
@@ -2646,6 +2664,66 @@ type UpdateYDocClientMsg = {
|
|
|
2646
2664
|
readonly guid?: string;
|
|
2647
2665
|
readonly v2?: boolean;
|
|
2648
2666
|
};
|
|
2667
|
+
type FetchFeedsClientMsg = {
|
|
2668
|
+
readonly type: ClientMsgCode.FETCH_FEEDS;
|
|
2669
|
+
readonly requestId: string;
|
|
2670
|
+
readonly cursor?: string;
|
|
2671
|
+
readonly since?: number;
|
|
2672
|
+
readonly limit?: number;
|
|
2673
|
+
readonly metadata?: Record<string, Json>;
|
|
2674
|
+
};
|
|
2675
|
+
type FetchFeedMessagesClientMsg = {
|
|
2676
|
+
readonly type: ClientMsgCode.FETCH_FEED_MESSAGES;
|
|
2677
|
+
readonly requestId: string;
|
|
2678
|
+
readonly feedId: string;
|
|
2679
|
+
readonly cursor?: string;
|
|
2680
|
+
readonly since?: number;
|
|
2681
|
+
readonly limit?: number;
|
|
2682
|
+
};
|
|
2683
|
+
type AddFeedClientMsg = {
|
|
2684
|
+
readonly type: ClientMsgCode.ADD_FEED;
|
|
2685
|
+
readonly feedId: string;
|
|
2686
|
+
readonly metadata?: JsonObject;
|
|
2687
|
+
readonly timestamp?: number;
|
|
2688
|
+
};
|
|
2689
|
+
type UpdateFeedClientMsg = {
|
|
2690
|
+
readonly type: ClientMsgCode.UPDATE_FEED;
|
|
2691
|
+
readonly feedId: string;
|
|
2692
|
+
readonly metadata: JsonObject;
|
|
2693
|
+
};
|
|
2694
|
+
type DeleteFeedClientMsg = {
|
|
2695
|
+
readonly type: ClientMsgCode.DELETE_FEED;
|
|
2696
|
+
readonly feedId: string;
|
|
2697
|
+
};
|
|
2698
|
+
type AddFeedMessageClientMsg = {
|
|
2699
|
+
readonly type: ClientMsgCode.ADD_FEED_MESSAGE;
|
|
2700
|
+
readonly feedId: string;
|
|
2701
|
+
readonly data: JsonObject;
|
|
2702
|
+
readonly id?: string;
|
|
2703
|
+
readonly timestamp?: number;
|
|
2704
|
+
};
|
|
2705
|
+
type UpdateFeedMessageClientMsg = {
|
|
2706
|
+
readonly type: ClientMsgCode.UPDATE_FEED_MESSAGE;
|
|
2707
|
+
readonly feedId: string;
|
|
2708
|
+
readonly messageId: string;
|
|
2709
|
+
readonly data: JsonObject;
|
|
2710
|
+
};
|
|
2711
|
+
type DeleteFeedMessageClientMsg = {
|
|
2712
|
+
readonly type: ClientMsgCode.DELETE_FEED_MESSAGE;
|
|
2713
|
+
readonly feedId: string;
|
|
2714
|
+
readonly messageId: string;
|
|
2715
|
+
};
|
|
2716
|
+
|
|
2717
|
+
type Feed<FM extends Json = Json> = {
|
|
2718
|
+
feedId: string;
|
|
2719
|
+
metadata: FM;
|
|
2720
|
+
timestamp: number;
|
|
2721
|
+
};
|
|
2722
|
+
type FeedMessage<FMD extends Json = Json> = {
|
|
2723
|
+
id: string;
|
|
2724
|
+
timestamp: number;
|
|
2725
|
+
data: FMD;
|
|
2726
|
+
};
|
|
2649
2727
|
|
|
2650
2728
|
type ServerMsgCode = (typeof ServerMsgCode)[keyof typeof ServerMsgCode];
|
|
2651
2729
|
declare const ServerMsgCode: Readonly<{
|
|
@@ -2669,6 +2747,14 @@ declare const ServerMsgCode: Readonly<{
|
|
|
2669
2747
|
COMMENT_REACTION_ADDED: 405;
|
|
2670
2748
|
COMMENT_REACTION_REMOVED: 406;
|
|
2671
2749
|
COMMENT_METADATA_UPDATED: 409;
|
|
2750
|
+
FEEDS_LIST: 500;
|
|
2751
|
+
FEEDS_ADDED: 501;
|
|
2752
|
+
FEEDS_UPDATED: 502;
|
|
2753
|
+
FEEDS_DELETED: 503;
|
|
2754
|
+
FEED_MESSAGES_LIST: 504;
|
|
2755
|
+
FEED_MESSAGES_ADDED: 505;
|
|
2756
|
+
FEED_MESSAGES_UPDATED: 506;
|
|
2757
|
+
FEED_MESSAGES_DELETED: 507;
|
|
2672
2758
|
REJECT_STORAGE_OP: 299;
|
|
2673
2759
|
}>;
|
|
2674
2760
|
declare namespace ServerMsgCode {
|
|
@@ -2691,13 +2777,21 @@ declare namespace ServerMsgCode {
|
|
|
2691
2777
|
type COMMENT_DELETED = typeof ServerMsgCode.COMMENT_DELETED;
|
|
2692
2778
|
type COMMENT_REACTION_ADDED = typeof ServerMsgCode.COMMENT_REACTION_ADDED;
|
|
2693
2779
|
type COMMENT_REACTION_REMOVED = typeof ServerMsgCode.COMMENT_REACTION_REMOVED;
|
|
2780
|
+
type FEEDS_LIST = typeof ServerMsgCode.FEEDS_LIST;
|
|
2781
|
+
type FEEDS_ADDED = typeof ServerMsgCode.FEEDS_ADDED;
|
|
2782
|
+
type FEEDS_UPDATED = typeof ServerMsgCode.FEEDS_UPDATED;
|
|
2783
|
+
type FEEDS_DELETED = typeof ServerMsgCode.FEEDS_DELETED;
|
|
2784
|
+
type FEED_MESSAGES_LIST = typeof ServerMsgCode.FEED_MESSAGES_LIST;
|
|
2785
|
+
type FEED_MESSAGES_ADDED = typeof ServerMsgCode.FEED_MESSAGES_ADDED;
|
|
2786
|
+
type FEED_MESSAGES_UPDATED = typeof ServerMsgCode.FEED_MESSAGES_UPDATED;
|
|
2787
|
+
type FEED_MESSAGES_DELETED = typeof ServerMsgCode.FEED_MESSAGES_DELETED;
|
|
2694
2788
|
type COMMENT_METADATA_UPDATED = typeof ServerMsgCode.COMMENT_METADATA_UPDATED;
|
|
2695
2789
|
type REJECT_STORAGE_OP = typeof ServerMsgCode.REJECT_STORAGE_OP;
|
|
2696
2790
|
}
|
|
2697
2791
|
/**
|
|
2698
2792
|
* Messages that can be sent from the server to the client.
|
|
2699
2793
|
*/
|
|
2700
|
-
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;
|
|
2794
|
+
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;
|
|
2701
2795
|
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | CommentMetadataUpdatedEvent;
|
|
2702
2796
|
type ThreadCreatedEvent = {
|
|
2703
2797
|
type: ServerMsgCode.THREAD_CREATED;
|
|
@@ -2928,6 +3022,47 @@ type RejectedStorageOpServerMsg = {
|
|
|
2928
3022
|
readonly opIds: string[];
|
|
2929
3023
|
readonly reason: string;
|
|
2930
3024
|
};
|
|
3025
|
+
type FeedsEventServerMsg<FM extends Json = Json, FMD extends Json = Json> = FeedsListServerMsg<FM> | FeedsAddedServerMsg<FM> | FeedsUpdatedServerMsg<FM> | FeedsDeletedServerMsg<FM> | FeedMessagesListServerMsg<FMD> | FeedMessagesAddedServerMsg<FMD> | FeedMessagesUpdatedServerMsg<FMD> | FeedMessagesDeletedServerMsg<FMD>;
|
|
3026
|
+
type FeedsListServerMsg<FM extends Json = Json> = {
|
|
3027
|
+
readonly type: ServerMsgCode.FEEDS_LIST;
|
|
3028
|
+
readonly requestId: string;
|
|
3029
|
+
readonly feeds: Feed<FM>[];
|
|
3030
|
+
readonly nextCursor?: string;
|
|
3031
|
+
};
|
|
3032
|
+
type FeedsAddedServerMsg<FM extends Json = Json> = {
|
|
3033
|
+
readonly type: ServerMsgCode.FEEDS_ADDED;
|
|
3034
|
+
readonly feeds: Feed<FM>[];
|
|
3035
|
+
};
|
|
3036
|
+
type FeedsUpdatedServerMsg<FM extends Json = Json> = {
|
|
3037
|
+
readonly type: ServerMsgCode.FEEDS_UPDATED;
|
|
3038
|
+
readonly feeds: Feed<FM>[];
|
|
3039
|
+
};
|
|
3040
|
+
type FeedsDeletedServerMsg<FM extends Json = Json> = {
|
|
3041
|
+
readonly type: ServerMsgCode.FEEDS_DELETED;
|
|
3042
|
+
readonly feeds: Feed<FM>[];
|
|
3043
|
+
};
|
|
3044
|
+
type FeedMessagesListServerMsg<FMD extends Json = Json> = {
|
|
3045
|
+
readonly type: ServerMsgCode.FEED_MESSAGES_LIST;
|
|
3046
|
+
readonly requestId: string;
|
|
3047
|
+
readonly feedId: string;
|
|
3048
|
+
readonly messages: FeedMessage<FMD>[];
|
|
3049
|
+
readonly nextCursor?: string;
|
|
3050
|
+
};
|
|
3051
|
+
type FeedMessagesAddedServerMsg<FMD extends Json = Json> = {
|
|
3052
|
+
readonly type: ServerMsgCode.FEED_MESSAGES_ADDED;
|
|
3053
|
+
readonly feedId: string;
|
|
3054
|
+
readonly messages: FeedMessage<FMD>[];
|
|
3055
|
+
};
|
|
3056
|
+
type FeedMessagesUpdatedServerMsg<FMD extends Json = Json> = {
|
|
3057
|
+
readonly type: ServerMsgCode.FEED_MESSAGES_UPDATED;
|
|
3058
|
+
readonly feedId: string;
|
|
3059
|
+
readonly messages: FeedMessage<FMD>[];
|
|
3060
|
+
};
|
|
3061
|
+
type FeedMessagesDeletedServerMsg<FMD extends Json = Json> = {
|
|
3062
|
+
readonly type: ServerMsgCode.FEED_MESSAGES_DELETED;
|
|
3063
|
+
readonly feedId: string;
|
|
3064
|
+
readonly messages: FeedMessage<FMD>[];
|
|
3065
|
+
};
|
|
2931
3066
|
|
|
2932
3067
|
type HistoryVersion = {
|
|
2933
3068
|
type: "historyVersion";
|
|
@@ -3262,8 +3397,8 @@ type GetSubscriptionSettingsOptions = {
|
|
|
3262
3397
|
* this type is different from `Room`-without-type-arguments. That represents
|
|
3263
3398
|
* a Room instance using globally augmented types only, which is narrower.
|
|
3264
3399
|
*/
|
|
3265
|
-
type OpaqueRoom = Room<JsonObject, LsonObject, BaseUserMeta, Json, BaseMetadata>;
|
|
3266
|
-
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> = {
|
|
3400
|
+
type OpaqueRoom = Room<JsonObject, LsonObject, BaseUserMeta, Json, BaseMetadata, BaseMetadata, Json, Json>;
|
|
3401
|
+
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, SM extends Json = DSM, MD extends Json = DMD> = {
|
|
3267
3402
|
/**
|
|
3268
3403
|
* @private
|
|
3269
3404
|
*
|
|
@@ -3336,6 +3471,59 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3336
3471
|
* Sends a request for the current document from liveblocks server
|
|
3337
3472
|
*/
|
|
3338
3473
|
fetchYDoc(stateVector: string, guid?: string, isV2?: boolean): void;
|
|
3474
|
+
/**
|
|
3475
|
+
* Fetches feeds for the room.
|
|
3476
|
+
*/
|
|
3477
|
+
fetchFeeds(options?: {
|
|
3478
|
+
cursor?: string;
|
|
3479
|
+
since?: number;
|
|
3480
|
+
limit?: number;
|
|
3481
|
+
metadata?: Record<string, Json>;
|
|
3482
|
+
}): Promise<{
|
|
3483
|
+
feeds: Feed<SM>[];
|
|
3484
|
+
nextCursor?: string;
|
|
3485
|
+
}>;
|
|
3486
|
+
/**
|
|
3487
|
+
* Fetches messages for a specific feed.
|
|
3488
|
+
*/
|
|
3489
|
+
fetchFeedMessages(feedId: string, options?: {
|
|
3490
|
+
cursor?: string;
|
|
3491
|
+
since?: number;
|
|
3492
|
+
limit?: number;
|
|
3493
|
+
}): Promise<{
|
|
3494
|
+
messages: FeedMessage<MD>[];
|
|
3495
|
+
nextCursor?: string;
|
|
3496
|
+
}>;
|
|
3497
|
+
/**
|
|
3498
|
+
* Adds a new feed to the room via WebSocket.
|
|
3499
|
+
*/
|
|
3500
|
+
addFeed(feedId: string, options?: {
|
|
3501
|
+
metadata?: JsonObject;
|
|
3502
|
+
timestamp?: number;
|
|
3503
|
+
}): void;
|
|
3504
|
+
/**
|
|
3505
|
+
* Updates metadata for an existing feed via WebSocket.
|
|
3506
|
+
*/
|
|
3507
|
+
updateFeed(feedId: string, metadata: JsonObject): void;
|
|
3508
|
+
/**
|
|
3509
|
+
* Deletes a feed via WebSocket.
|
|
3510
|
+
*/
|
|
3511
|
+
deleteFeed(feedId: string): void;
|
|
3512
|
+
/**
|
|
3513
|
+
* Adds a new message to a feed via WebSocket.
|
|
3514
|
+
*/
|
|
3515
|
+
addFeedMessage(feedId: string, data: JsonObject, options?: {
|
|
3516
|
+
id?: string;
|
|
3517
|
+
timestamp?: number;
|
|
3518
|
+
}): void;
|
|
3519
|
+
/**
|
|
3520
|
+
* Updates an existing feed message via WebSocket.
|
|
3521
|
+
*/
|
|
3522
|
+
updateFeedMessage(feedId: string, messageId: string, data: JsonObject): void;
|
|
3523
|
+
/**
|
|
3524
|
+
* Deletes a feed message via WebSocket.
|
|
3525
|
+
*/
|
|
3526
|
+
deleteFeedMessage(feedId: string, messageId: string): void;
|
|
3339
3527
|
/**
|
|
3340
3528
|
* Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
|
|
3341
3529
|
* @param {any} event the event to broadcast. Should be serializable to JSON
|
|
@@ -3394,6 +3582,7 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3394
3582
|
readonly storageStatus: Observable<StorageStatus>;
|
|
3395
3583
|
readonly ydoc: Observable<YDocUpdateServerMsg | UpdateYDocClientMsg>;
|
|
3396
3584
|
readonly comments: Observable<CommentsEventServerMsg>;
|
|
3585
|
+
readonly feeds: Observable<FeedsEventServerMsg<SM, MD>>;
|
|
3397
3586
|
/**
|
|
3398
3587
|
* Called right before the room is destroyed. The event cannot be used to
|
|
3399
3588
|
* prevent the room from being destroyed, only to be informed that this is
|
|
@@ -5321,4 +5510,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
5321
5510
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
5322
5511
|
};
|
|
5323
5512
|
|
|
5324
|
-
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 };
|
|
5513
|
+
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 DMD, type DP, type DRI, type DS, type DSM, 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 FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedsAddedServerMsg, type FeedsDeletedServerMsg, 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 };
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "3.15.0-
|
|
9
|
+
var PKG_VERSION = "3.15.0-feeds2";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -3219,6 +3219,15 @@ var ServerMsgCode = Object.freeze({
|
|
|
3219
3219
|
COMMENT_REACTION_ADDED: 405,
|
|
3220
3220
|
COMMENT_REACTION_REMOVED: 406,
|
|
3221
3221
|
COMMENT_METADATA_UPDATED: 409,
|
|
3222
|
+
// For Feeds
|
|
3223
|
+
FEEDS_LIST: 500,
|
|
3224
|
+
FEEDS_ADDED: 501,
|
|
3225
|
+
FEEDS_UPDATED: 502,
|
|
3226
|
+
FEEDS_DELETED: 503,
|
|
3227
|
+
FEED_MESSAGES_LIST: 504,
|
|
3228
|
+
FEED_MESSAGES_ADDED: 505,
|
|
3229
|
+
FEED_MESSAGES_UPDATED: 506,
|
|
3230
|
+
FEED_MESSAGES_DELETED: 507,
|
|
3222
3231
|
// Error codes
|
|
3223
3232
|
REJECT_STORAGE_OP: 299
|
|
3224
3233
|
// Sent if a mutation was not allowed on the server (i.e. due to permissions, limit exceeded, etc)
|
|
@@ -8774,7 +8783,16 @@ var ClientMsgCode = Object.freeze({
|
|
|
8774
8783
|
UPDATE_STORAGE: 201,
|
|
8775
8784
|
// For Yjs support
|
|
8776
8785
|
FETCH_YDOC: 300,
|
|
8777
|
-
UPDATE_YDOC: 301
|
|
8786
|
+
UPDATE_YDOC: 301,
|
|
8787
|
+
// For Feeds
|
|
8788
|
+
FETCH_FEEDS: 510,
|
|
8789
|
+
FETCH_FEED_MESSAGES: 511,
|
|
8790
|
+
ADD_FEED: 512,
|
|
8791
|
+
UPDATE_FEED: 513,
|
|
8792
|
+
DELETE_FEED: 514,
|
|
8793
|
+
ADD_FEED_MESSAGE: 515,
|
|
8794
|
+
UPDATE_FEED_MESSAGE: 516,
|
|
8795
|
+
DELETE_FEED_MESSAGE: 517
|
|
8778
8796
|
});
|
|
8779
8797
|
|
|
8780
8798
|
// src/refs/ManagedOthers.ts
|
|
@@ -9250,6 +9268,7 @@ function createRoom(options, config) {
|
|
|
9250
9268
|
storageStatus: makeEventSource(),
|
|
9251
9269
|
ydoc: makeEventSource(),
|
|
9252
9270
|
comments: makeEventSource(),
|
|
9271
|
+
feeds: makeEventSource(),
|
|
9253
9272
|
roomWillDestroy: makeEventSource()
|
|
9254
9273
|
};
|
|
9255
9274
|
async function createTextMention(mentionId, mention) {
|
|
@@ -9783,6 +9802,64 @@ function createRoom(options, config) {
|
|
|
9783
9802
|
eventHub.comments.notify(message);
|
|
9784
9803
|
break;
|
|
9785
9804
|
}
|
|
9805
|
+
case ServerMsgCode.FEEDS_LIST: {
|
|
9806
|
+
const feedsListMsg = message;
|
|
9807
|
+
const pending = pendingFeedsRequests.get(feedsListMsg.requestId);
|
|
9808
|
+
if (pending) {
|
|
9809
|
+
pending.resolve({
|
|
9810
|
+
feeds: feedsListMsg.feeds,
|
|
9811
|
+
nextCursor: feedsListMsg.nextCursor
|
|
9812
|
+
});
|
|
9813
|
+
pendingFeedsRequests.delete(feedsListMsg.requestId);
|
|
9814
|
+
}
|
|
9815
|
+
eventHub.feeds.notify(feedsListMsg);
|
|
9816
|
+
break;
|
|
9817
|
+
}
|
|
9818
|
+
case ServerMsgCode.FEEDS_ADDED: {
|
|
9819
|
+
const feedsAddedMsg = message;
|
|
9820
|
+
eventHub.feeds.notify(feedsAddedMsg);
|
|
9821
|
+
break;
|
|
9822
|
+
}
|
|
9823
|
+
case ServerMsgCode.FEEDS_UPDATED: {
|
|
9824
|
+
const feedsUpdatedMsg = message;
|
|
9825
|
+
eventHub.feeds.notify(feedsUpdatedMsg);
|
|
9826
|
+
break;
|
|
9827
|
+
}
|
|
9828
|
+
case ServerMsgCode.FEEDS_DELETED: {
|
|
9829
|
+
const feedsDeletedMsg = message;
|
|
9830
|
+
eventHub.feeds.notify(feedsDeletedMsg);
|
|
9831
|
+
break;
|
|
9832
|
+
}
|
|
9833
|
+
case ServerMsgCode.FEED_MESSAGES_LIST: {
|
|
9834
|
+
const feedMsgsListMsg = message;
|
|
9835
|
+
const pending = pendingFeedMessagesRequests.get(
|
|
9836
|
+
feedMsgsListMsg.requestId
|
|
9837
|
+
);
|
|
9838
|
+
if (pending) {
|
|
9839
|
+
pending.resolve({
|
|
9840
|
+
messages: feedMsgsListMsg.messages,
|
|
9841
|
+
nextCursor: feedMsgsListMsg.nextCursor
|
|
9842
|
+
});
|
|
9843
|
+
pendingFeedMessagesRequests.delete(feedMsgsListMsg.requestId);
|
|
9844
|
+
}
|
|
9845
|
+
eventHub.feeds.notify(feedMsgsListMsg);
|
|
9846
|
+
break;
|
|
9847
|
+
}
|
|
9848
|
+
case ServerMsgCode.FEED_MESSAGES_ADDED: {
|
|
9849
|
+
const feedMsgsAddedMsg = message;
|
|
9850
|
+
eventHub.feeds.notify(feedMsgsAddedMsg);
|
|
9851
|
+
break;
|
|
9852
|
+
}
|
|
9853
|
+
case ServerMsgCode.FEED_MESSAGES_UPDATED: {
|
|
9854
|
+
const feedMsgsUpdatedMsg = message;
|
|
9855
|
+
eventHub.feeds.notify(feedMsgsUpdatedMsg);
|
|
9856
|
+
break;
|
|
9857
|
+
}
|
|
9858
|
+
case ServerMsgCode.FEED_MESSAGES_DELETED: {
|
|
9859
|
+
const feedMsgsDeletedMsg = message;
|
|
9860
|
+
eventHub.feeds.notify(feedMsgsDeletedMsg);
|
|
9861
|
+
break;
|
|
9862
|
+
}
|
|
9786
9863
|
case ServerMsgCode.STORAGE_STATE_V7:
|
|
9787
9864
|
// No longer used in V8
|
|
9788
9865
|
default:
|
|
@@ -9886,6 +9963,8 @@ function createRoom(options, config) {
|
|
|
9886
9963
|
}
|
|
9887
9964
|
let _getStorage$ = null;
|
|
9888
9965
|
let _resolveStoragePromise = null;
|
|
9966
|
+
const pendingFeedsRequests = /* @__PURE__ */ new Map();
|
|
9967
|
+
const pendingFeedMessagesRequests = /* @__PURE__ */ new Map();
|
|
9889
9968
|
function processInitialStorage(nodes) {
|
|
9890
9969
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
9891
9970
|
createOrUpdateRootFromMessage(nodes);
|
|
@@ -9957,6 +10036,107 @@ function createRoom(options, config) {
|
|
|
9957
10036
|
}
|
|
9958
10037
|
flushNowOrSoon();
|
|
9959
10038
|
}
|
|
10039
|
+
async function fetchFeeds(options2) {
|
|
10040
|
+
const requestId = nanoid();
|
|
10041
|
+
const { promise, resolve, reject } = Promise_withResolvers();
|
|
10042
|
+
pendingFeedsRequests.set(requestId, { resolve, reject });
|
|
10043
|
+
const message = {
|
|
10044
|
+
type: ClientMsgCode.FETCH_FEEDS,
|
|
10045
|
+
requestId,
|
|
10046
|
+
cursor: options2?.cursor,
|
|
10047
|
+
since: options2?.since,
|
|
10048
|
+
limit: options2?.limit,
|
|
10049
|
+
metadata: options2?.metadata
|
|
10050
|
+
};
|
|
10051
|
+
context.buffer.messages.push(message);
|
|
10052
|
+
flushNowOrSoon();
|
|
10053
|
+
setTimeout(() => {
|
|
10054
|
+
if (pendingFeedsRequests.has(requestId)) {
|
|
10055
|
+
pendingFeedsRequests.delete(requestId);
|
|
10056
|
+
reject(new Error("Feeds fetch timeout"));
|
|
10057
|
+
}
|
|
10058
|
+
}, 3e4);
|
|
10059
|
+
return promise;
|
|
10060
|
+
}
|
|
10061
|
+
async function fetchFeedMessages(feedId, options2) {
|
|
10062
|
+
const requestId = nanoid();
|
|
10063
|
+
const { promise, resolve, reject } = Promise_withResolvers();
|
|
10064
|
+
pendingFeedMessagesRequests.set(requestId, { resolve, reject });
|
|
10065
|
+
const message = {
|
|
10066
|
+
type: ClientMsgCode.FETCH_FEED_MESSAGES,
|
|
10067
|
+
requestId,
|
|
10068
|
+
feedId,
|
|
10069
|
+
cursor: options2?.cursor,
|
|
10070
|
+
since: options2?.since,
|
|
10071
|
+
limit: options2?.limit
|
|
10072
|
+
};
|
|
10073
|
+
context.buffer.messages.push(message);
|
|
10074
|
+
flushNowOrSoon();
|
|
10075
|
+
setTimeout(() => {
|
|
10076
|
+
if (pendingFeedMessagesRequests.has(requestId)) {
|
|
10077
|
+
pendingFeedMessagesRequests.delete(requestId);
|
|
10078
|
+
reject(new Error("Feed messages fetch timeout"));
|
|
10079
|
+
}
|
|
10080
|
+
}, 3e4);
|
|
10081
|
+
return promise;
|
|
10082
|
+
}
|
|
10083
|
+
function addFeed(feedId, options2) {
|
|
10084
|
+
const message = {
|
|
10085
|
+
type: ClientMsgCode.ADD_FEED,
|
|
10086
|
+
feedId,
|
|
10087
|
+
metadata: options2?.metadata,
|
|
10088
|
+
timestamp: options2?.timestamp
|
|
10089
|
+
};
|
|
10090
|
+
context.buffer.messages.push(message);
|
|
10091
|
+
flushNowOrSoon();
|
|
10092
|
+
}
|
|
10093
|
+
function updateFeed(feedId, metadata) {
|
|
10094
|
+
const message = {
|
|
10095
|
+
type: ClientMsgCode.UPDATE_FEED,
|
|
10096
|
+
feedId,
|
|
10097
|
+
metadata
|
|
10098
|
+
};
|
|
10099
|
+
context.buffer.messages.push(message);
|
|
10100
|
+
flushNowOrSoon();
|
|
10101
|
+
}
|
|
10102
|
+
function deleteFeed(feedId) {
|
|
10103
|
+
const message = {
|
|
10104
|
+
type: ClientMsgCode.DELETE_FEED,
|
|
10105
|
+
feedId
|
|
10106
|
+
};
|
|
10107
|
+
context.buffer.messages.push(message);
|
|
10108
|
+
flushNowOrSoon();
|
|
10109
|
+
}
|
|
10110
|
+
function addFeedMessage(feedId, data, options2) {
|
|
10111
|
+
const message = {
|
|
10112
|
+
type: ClientMsgCode.ADD_FEED_MESSAGE,
|
|
10113
|
+
feedId,
|
|
10114
|
+
data,
|
|
10115
|
+
id: options2?.id,
|
|
10116
|
+
timestamp: options2?.timestamp
|
|
10117
|
+
};
|
|
10118
|
+
context.buffer.messages.push(message);
|
|
10119
|
+
flushNowOrSoon();
|
|
10120
|
+
}
|
|
10121
|
+
function updateFeedMessage(feedId, messageId, data) {
|
|
10122
|
+
const message = {
|
|
10123
|
+
type: ClientMsgCode.UPDATE_FEED_MESSAGE,
|
|
10124
|
+
feedId,
|
|
10125
|
+
messageId,
|
|
10126
|
+
data
|
|
10127
|
+
};
|
|
10128
|
+
context.buffer.messages.push(message);
|
|
10129
|
+
flushNowOrSoon();
|
|
10130
|
+
}
|
|
10131
|
+
function deleteFeedMessage(feedId, messageId) {
|
|
10132
|
+
const message = {
|
|
10133
|
+
type: ClientMsgCode.DELETE_FEED_MESSAGE,
|
|
10134
|
+
feedId,
|
|
10135
|
+
messageId
|
|
10136
|
+
};
|
|
10137
|
+
context.buffer.messages.push(message);
|
|
10138
|
+
flushNowOrSoon();
|
|
10139
|
+
}
|
|
9960
10140
|
function undo() {
|
|
9961
10141
|
if (context.activeBatch) {
|
|
9962
10142
|
throw new Error("undo is not allowed during a batch");
|
|
@@ -10099,6 +10279,7 @@ function createRoom(options, config) {
|
|
|
10099
10279
|
storageStatus: eventHub.storageStatus.observable,
|
|
10100
10280
|
ydoc: eventHub.ydoc.observable,
|
|
10101
10281
|
comments: eventHub.comments.observable,
|
|
10282
|
+
feeds: eventHub.feeds.observable,
|
|
10102
10283
|
roomWillDestroy: eventHub.roomWillDestroy.observable
|
|
10103
10284
|
};
|
|
10104
10285
|
async function getThreadsSince(options2) {
|
|
@@ -10307,7 +10488,7 @@ function createRoom(options, config) {
|
|
|
10307
10488
|
id: roomId,
|
|
10308
10489
|
subscribe: makeClassicSubscribeFn(
|
|
10309
10490
|
roomId,
|
|
10310
|
-
|
|
10491
|
+
eventHub,
|
|
10311
10492
|
config.errorEventSource
|
|
10312
10493
|
),
|
|
10313
10494
|
connect: () => managedSocket.connect(),
|
|
@@ -10342,6 +10523,14 @@ function createRoom(options, config) {
|
|
|
10342
10523
|
resume: resumeHistory
|
|
10343
10524
|
},
|
|
10344
10525
|
fetchYDoc,
|
|
10526
|
+
fetchFeeds,
|
|
10527
|
+
fetchFeedMessages,
|
|
10528
|
+
addFeed,
|
|
10529
|
+
updateFeed,
|
|
10530
|
+
deleteFeed,
|
|
10531
|
+
addFeedMessage,
|
|
10532
|
+
updateFeedMessage,
|
|
10533
|
+
deleteFeedMessage,
|
|
10345
10534
|
getStorage,
|
|
10346
10535
|
getStorageSnapshot,
|
|
10347
10536
|
getStorageStatus,
|