@liveblocks/core 1.8.1 → 1.9.0-example1

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.mts CHANGED
@@ -686,13 +686,16 @@ declare type CommentBody = {
686
686
  content: CommentBodyBlockElement[];
687
687
  };
688
688
 
689
- declare type CommentReactionUser = {
690
- id: string;
689
+ declare type DateToString<T> = {
690
+ [P in keyof T]: T[P] extends Date ? string : T[P];
691
691
  };
692
+
692
693
  declare type CommentReaction = {
693
694
  emoji: string;
694
- createdAt: string;
695
- users: CommentReactionUser[];
695
+ createdAt: Date;
696
+ users: {
697
+ id: string;
698
+ }[];
696
699
  };
697
700
  /**
698
701
  * Represents a comment.
@@ -703,17 +706,33 @@ declare type CommentData = {
703
706
  threadId: string;
704
707
  roomId: string;
705
708
  userId: string;
706
- createdAt: string;
707
- editedAt?: string;
709
+ createdAt: Date;
710
+ editedAt?: Date;
708
711
  reactions: CommentReaction[];
709
712
  } & ({
710
713
  body: CommentBody;
711
714
  deletedAt?: never;
715
+ } | {
716
+ body?: never;
717
+ deletedAt: Date;
718
+ });
719
+ declare type CommentDataPlain = Omit<DateToString<CommentData>, "reaction" | "body"> & {
720
+ reactions: DateToString<CommentReaction[]>;
721
+ } & ({
722
+ body: CommentBody;
723
+ deletedAt?: never;
712
724
  } | {
713
725
  body?: never;
714
726
  deletedAt: string;
715
727
  });
716
728
 
729
+ declare type CommentUserReaction = {
730
+ emoji: string;
731
+ createdAt: Date;
732
+ userId: string;
733
+ };
734
+ declare type CommentUserReactionPlain = DateToString<CommentUserReaction>;
735
+
717
736
  /**
718
737
  * Represents a thread of comments.
719
738
  */
@@ -721,11 +740,15 @@ declare type ThreadData<TThreadMetadata extends BaseMetadata = never> = {
721
740
  type: "thread";
722
741
  id: string;
723
742
  roomId: string;
724
- createdAt: string;
725
- updatedAt?: string;
743
+ createdAt: Date;
744
+ updatedAt?: Date;
726
745
  comments: CommentData[];
727
746
  metadata: [TThreadMetadata] extends [never] ? Record<string, never> : TThreadMetadata;
728
747
  };
748
+ declare type ThreadDataPlain<TThreadMetadata extends BaseMetadata = never> = Omit<DateToString<ThreadData<TThreadMetadata>>, "comments" | "metadata"> & {
749
+ comments: CommentDataPlain[];
750
+ metadata: [TThreadMetadata] extends [never] ? Record<string, never> : TThreadMetadata;
751
+ };
729
752
 
730
753
  declare type Options = {
731
754
  baseUrl: string;
@@ -744,7 +767,7 @@ declare type CommentsApi<TThreadMetadata extends BaseMetadata> = {
744
767
  editThreadMetadata(options: {
745
768
  metadata: PartialNullable<TThreadMetadata>;
746
769
  threadId: string;
747
- }): Promise<ThreadData<TThreadMetadata>>;
770
+ }): Promise<TThreadMetadata>;
748
771
  createComment(options: {
749
772
  threadId: string;
750
773
  commentId: string;
@@ -763,12 +786,12 @@ declare type CommentsApi<TThreadMetadata extends BaseMetadata> = {
763
786
  threadId: string;
764
787
  commentId: string;
765
788
  emoji: string;
766
- }): Promise<CommentData>;
789
+ }): Promise<CommentUserReaction>;
767
790
  removeReaction(options: {
768
791
  threadId: string;
769
792
  commentId: string;
770
793
  emoji: string;
771
- }): Promise<CommentData>;
794
+ }): Promise<void>;
772
795
  };
773
796
  declare class CommentsApiError extends Error {
774
797
  message: string;
@@ -2007,8 +2030,8 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
2007
2030
  */
2008
2031
  declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
2009
2032
 
2010
- declare type PromiseOrNot<T> = T | Promise<T>;
2011
- declare type AsyncCacheFunction<T, A extends any[] = any[]> = (...args: A) => PromiseOrNot<T>;
2033
+ declare type PromiseOrNot$1<T> = T | Promise<T>;
2034
+ declare type AsyncCacheFunction<T, A extends any[] = any[]> = (...args: A) => PromiseOrNot$1<T>;
2012
2035
  declare type AsyncCacheOptions<T, E> = {
2013
2036
  isStateEqual?: (a: AsyncState<T, E>, b: AsyncState<T, E>) => boolean;
2014
2037
  };
@@ -2435,6 +2458,117 @@ declare namespace protocol {
2435
2458
  };
2436
2459
  }
2437
2460
 
2461
+ declare type PromiseOrNot<T> = T | Promise<T>;
2462
+ declare type CommentBodyResolveUsersArgs = {
2463
+ /**
2464
+ * The ID of the users to resolve.
2465
+ */
2466
+ userIds: string[];
2467
+ };
2468
+ declare type CommentBodyParagraphElementArgs = {
2469
+ /**
2470
+ * The paragraph element.
2471
+ */
2472
+ element: CommentBodyParagraph;
2473
+ /**
2474
+ * The text content of the paragraph.
2475
+ */
2476
+ children: string;
2477
+ };
2478
+ declare type CommentBodyTextElementArgs = {
2479
+ /**
2480
+ * The text element.
2481
+ */
2482
+ element: CommentBodyText;
2483
+ };
2484
+ declare type CommentBodyLinkElementArgs = {
2485
+ /**
2486
+ * The link element.
2487
+ */
2488
+ element: CommentBodyLink;
2489
+ /**
2490
+ * The absolute URL of the link.
2491
+ */
2492
+ href: string;
2493
+ };
2494
+ declare type CommentBodyMentionElementArgs<TUserMeta extends BaseUserMeta = BaseUserMeta> = {
2495
+ /**
2496
+ * The mention element.
2497
+ */
2498
+ element: CommentBodyMention;
2499
+ /**
2500
+ * The mention's user info, if the `resolvedUsers` option was provided.
2501
+ */
2502
+ user?: TUserMeta["info"];
2503
+ };
2504
+ declare type StringifyCommentBodyElements<TUserMeta extends BaseUserMeta = BaseUserMeta> = {
2505
+ /**
2506
+ * The element used to display paragraphs.
2507
+ */
2508
+ paragraph: (args: CommentBodyParagraphElementArgs, index: number) => string;
2509
+ /**
2510
+ * The element used to display text elements.
2511
+ */
2512
+ text: (args: CommentBodyTextElementArgs, index: number) => string;
2513
+ /**
2514
+ * The element used to display links.
2515
+ */
2516
+ link: (args: CommentBodyLinkElementArgs, index: number) => string;
2517
+ /**
2518
+ * The element used to display mentions.
2519
+ */
2520
+ mention: (args: CommentBodyMentionElementArgs<TUserMeta>, index: number) => string;
2521
+ };
2522
+ declare type StringifyCommentBodyOptions<TUserMeta extends BaseUserMeta = BaseUserMeta> = {
2523
+ /**
2524
+ * Which format to convert the comment to.
2525
+ */
2526
+ format?: "plain" | "html" | "markdown";
2527
+ /**
2528
+ * The elements used to customize the resulting string. Each element has
2529
+ * priority over the defaults inherited from the `format` option.
2530
+ */
2531
+ elements?: Partial<StringifyCommentBodyElements<TUserMeta>>;
2532
+ /**
2533
+ * The separator used between paragraphs.
2534
+ */
2535
+ separator?: string;
2536
+ /**
2537
+ * A function that returns user info from user IDs.
2538
+ */
2539
+ resolveUsers?: (args: CommentBodyResolveUsersArgs) => PromiseOrNot<(TUserMeta["info"] | undefined)[] | undefined>;
2540
+ };
2541
+ /**
2542
+ * Get an array of each user's ID that has been mentioned in a `CommentBody`.
2543
+ */
2544
+ declare function getMentionedIdsFromCommentBody(body: CommentBody): string[];
2545
+ /**
2546
+ * Convert a `CommentBody` into either a plain string,
2547
+ * Markdown, HTML, or a custom format.
2548
+ */
2549
+ declare function stringifyCommentBody<TUserMeta extends BaseUserMeta = BaseUserMeta>(body: CommentBody, options?: StringifyCommentBodyOptions<TUserMeta>): Promise<string>;
2550
+ /**
2551
+ * Converts a plain comment data object (usually returned by the API) to a comment data object that can be used by the client.
2552
+ * This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
2553
+ * @param data The plain comment data object (usually returned by the API)
2554
+ * @returns The rich comment data object that can be used by the client.
2555
+ */
2556
+ declare function convertToCommentData(data: CommentDataPlain): CommentData;
2557
+ /**
2558
+ * Converts a plain thread data object (usually returned by the API) to a thread data object that can be used by the client.
2559
+ * This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
2560
+ * @param data The plain thread data object (usually returned by the API)
2561
+ * @returns The rich hread data object that can be used by the client.
2562
+ */
2563
+ declare function convertToThreadData<TThreadMetadata extends BaseMetadata = never>(data: ThreadDataPlain<TThreadMetadata>): ThreadData<TThreadMetadata>;
2564
+ /**
2565
+ * Converts a plain comment reaction object (usually returned by the API) to a comment reaction object that can be used by the client.
2566
+ * This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
2567
+ * @param data The plain comment reaction object (usually returned by the API)
2568
+ * @returns The rich comment reaction object that can be used by the client.
2569
+ */
2570
+ declare function convertToCommentUserReaction(data: CommentUserReactionPlain): CommentUserReaction;
2571
+
2438
2572
  /**
2439
2573
  * Helper type to help users adopt to Lson types from interface definitions.
2440
2574
  * You should only use this to wrap interfaces you don't control. For more
@@ -2447,4 +2581,4 @@ declare type EnsureJson<T> = [
2447
2581
  [K in keyof T]: EnsureJson<T[K]>;
2448
2582
  };
2449
2583
 
2450
- export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, Brand, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentBodyText, CommentData, CommentReaction, CommentsApi, CommentsApiError, CrdtType, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EnterOptions, EventSource, FetchStorageClientMsg, FetchYDocClientMsg, History, IUserInfo, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, OthersEvent, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomEventMessage, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, YDocUpdateServerMsg, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, raise, shallow, stringify, throwUsageError, toPlainLson, tryParseJson, withTimeout };
2584
+ export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, Brand, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyResolveUsersArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentDataPlain, CommentReaction, CommentUserReaction, CommentUserReactionPlain, CommentsApi, CommentsApiError, CrdtType, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EnterOptions, EventSource, FetchStorageClientMsg, FetchYDocClientMsg, History, IUserInfo, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, OthersEvent, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomEventMessage, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, ThreadDataPlain, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, YDocUpdateServerMsg, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToThreadData, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, withTimeout };
package/dist/index.d.ts CHANGED
@@ -686,13 +686,16 @@ declare type CommentBody = {
686
686
  content: CommentBodyBlockElement[];
687
687
  };
688
688
 
689
- declare type CommentReactionUser = {
690
- id: string;
689
+ declare type DateToString<T> = {
690
+ [P in keyof T]: T[P] extends Date ? string : T[P];
691
691
  };
692
+
692
693
  declare type CommentReaction = {
693
694
  emoji: string;
694
- createdAt: string;
695
- users: CommentReactionUser[];
695
+ createdAt: Date;
696
+ users: {
697
+ id: string;
698
+ }[];
696
699
  };
697
700
  /**
698
701
  * Represents a comment.
@@ -703,17 +706,33 @@ declare type CommentData = {
703
706
  threadId: string;
704
707
  roomId: string;
705
708
  userId: string;
706
- createdAt: string;
707
- editedAt?: string;
709
+ createdAt: Date;
710
+ editedAt?: Date;
708
711
  reactions: CommentReaction[];
709
712
  } & ({
710
713
  body: CommentBody;
711
714
  deletedAt?: never;
715
+ } | {
716
+ body?: never;
717
+ deletedAt: Date;
718
+ });
719
+ declare type CommentDataPlain = Omit<DateToString<CommentData>, "reaction" | "body"> & {
720
+ reactions: DateToString<CommentReaction[]>;
721
+ } & ({
722
+ body: CommentBody;
723
+ deletedAt?: never;
712
724
  } | {
713
725
  body?: never;
714
726
  deletedAt: string;
715
727
  });
716
728
 
729
+ declare type CommentUserReaction = {
730
+ emoji: string;
731
+ createdAt: Date;
732
+ userId: string;
733
+ };
734
+ declare type CommentUserReactionPlain = DateToString<CommentUserReaction>;
735
+
717
736
  /**
718
737
  * Represents a thread of comments.
719
738
  */
@@ -721,11 +740,15 @@ declare type ThreadData<TThreadMetadata extends BaseMetadata = never> = {
721
740
  type: "thread";
722
741
  id: string;
723
742
  roomId: string;
724
- createdAt: string;
725
- updatedAt?: string;
743
+ createdAt: Date;
744
+ updatedAt?: Date;
726
745
  comments: CommentData[];
727
746
  metadata: [TThreadMetadata] extends [never] ? Record<string, never> : TThreadMetadata;
728
747
  };
748
+ declare type ThreadDataPlain<TThreadMetadata extends BaseMetadata = never> = Omit<DateToString<ThreadData<TThreadMetadata>>, "comments" | "metadata"> & {
749
+ comments: CommentDataPlain[];
750
+ metadata: [TThreadMetadata] extends [never] ? Record<string, never> : TThreadMetadata;
751
+ };
729
752
 
730
753
  declare type Options = {
731
754
  baseUrl: string;
@@ -744,7 +767,7 @@ declare type CommentsApi<TThreadMetadata extends BaseMetadata> = {
744
767
  editThreadMetadata(options: {
745
768
  metadata: PartialNullable<TThreadMetadata>;
746
769
  threadId: string;
747
- }): Promise<ThreadData<TThreadMetadata>>;
770
+ }): Promise<TThreadMetadata>;
748
771
  createComment(options: {
749
772
  threadId: string;
750
773
  commentId: string;
@@ -763,12 +786,12 @@ declare type CommentsApi<TThreadMetadata extends BaseMetadata> = {
763
786
  threadId: string;
764
787
  commentId: string;
765
788
  emoji: string;
766
- }): Promise<CommentData>;
789
+ }): Promise<CommentUserReaction>;
767
790
  removeReaction(options: {
768
791
  threadId: string;
769
792
  commentId: string;
770
793
  emoji: string;
771
- }): Promise<CommentData>;
794
+ }): Promise<void>;
772
795
  };
773
796
  declare class CommentsApiError extends Error {
774
797
  message: string;
@@ -2007,8 +2030,8 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
2007
2030
  */
2008
2031
  declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
2009
2032
 
2010
- declare type PromiseOrNot<T> = T | Promise<T>;
2011
- declare type AsyncCacheFunction<T, A extends any[] = any[]> = (...args: A) => PromiseOrNot<T>;
2033
+ declare type PromiseOrNot$1<T> = T | Promise<T>;
2034
+ declare type AsyncCacheFunction<T, A extends any[] = any[]> = (...args: A) => PromiseOrNot$1<T>;
2012
2035
  declare type AsyncCacheOptions<T, E> = {
2013
2036
  isStateEqual?: (a: AsyncState<T, E>, b: AsyncState<T, E>) => boolean;
2014
2037
  };
@@ -2435,6 +2458,117 @@ declare namespace protocol {
2435
2458
  };
2436
2459
  }
2437
2460
 
2461
+ declare type PromiseOrNot<T> = T | Promise<T>;
2462
+ declare type CommentBodyResolveUsersArgs = {
2463
+ /**
2464
+ * The ID of the users to resolve.
2465
+ */
2466
+ userIds: string[];
2467
+ };
2468
+ declare type CommentBodyParagraphElementArgs = {
2469
+ /**
2470
+ * The paragraph element.
2471
+ */
2472
+ element: CommentBodyParagraph;
2473
+ /**
2474
+ * The text content of the paragraph.
2475
+ */
2476
+ children: string;
2477
+ };
2478
+ declare type CommentBodyTextElementArgs = {
2479
+ /**
2480
+ * The text element.
2481
+ */
2482
+ element: CommentBodyText;
2483
+ };
2484
+ declare type CommentBodyLinkElementArgs = {
2485
+ /**
2486
+ * The link element.
2487
+ */
2488
+ element: CommentBodyLink;
2489
+ /**
2490
+ * The absolute URL of the link.
2491
+ */
2492
+ href: string;
2493
+ };
2494
+ declare type CommentBodyMentionElementArgs<TUserMeta extends BaseUserMeta = BaseUserMeta> = {
2495
+ /**
2496
+ * The mention element.
2497
+ */
2498
+ element: CommentBodyMention;
2499
+ /**
2500
+ * The mention's user info, if the `resolvedUsers` option was provided.
2501
+ */
2502
+ user?: TUserMeta["info"];
2503
+ };
2504
+ declare type StringifyCommentBodyElements<TUserMeta extends BaseUserMeta = BaseUserMeta> = {
2505
+ /**
2506
+ * The element used to display paragraphs.
2507
+ */
2508
+ paragraph: (args: CommentBodyParagraphElementArgs, index: number) => string;
2509
+ /**
2510
+ * The element used to display text elements.
2511
+ */
2512
+ text: (args: CommentBodyTextElementArgs, index: number) => string;
2513
+ /**
2514
+ * The element used to display links.
2515
+ */
2516
+ link: (args: CommentBodyLinkElementArgs, index: number) => string;
2517
+ /**
2518
+ * The element used to display mentions.
2519
+ */
2520
+ mention: (args: CommentBodyMentionElementArgs<TUserMeta>, index: number) => string;
2521
+ };
2522
+ declare type StringifyCommentBodyOptions<TUserMeta extends BaseUserMeta = BaseUserMeta> = {
2523
+ /**
2524
+ * Which format to convert the comment to.
2525
+ */
2526
+ format?: "plain" | "html" | "markdown";
2527
+ /**
2528
+ * The elements used to customize the resulting string. Each element has
2529
+ * priority over the defaults inherited from the `format` option.
2530
+ */
2531
+ elements?: Partial<StringifyCommentBodyElements<TUserMeta>>;
2532
+ /**
2533
+ * The separator used between paragraphs.
2534
+ */
2535
+ separator?: string;
2536
+ /**
2537
+ * A function that returns user info from user IDs.
2538
+ */
2539
+ resolveUsers?: (args: CommentBodyResolveUsersArgs) => PromiseOrNot<(TUserMeta["info"] | undefined)[] | undefined>;
2540
+ };
2541
+ /**
2542
+ * Get an array of each user's ID that has been mentioned in a `CommentBody`.
2543
+ */
2544
+ declare function getMentionedIdsFromCommentBody(body: CommentBody): string[];
2545
+ /**
2546
+ * Convert a `CommentBody` into either a plain string,
2547
+ * Markdown, HTML, or a custom format.
2548
+ */
2549
+ declare function stringifyCommentBody<TUserMeta extends BaseUserMeta = BaseUserMeta>(body: CommentBody, options?: StringifyCommentBodyOptions<TUserMeta>): Promise<string>;
2550
+ /**
2551
+ * Converts a plain comment data object (usually returned by the API) to a comment data object that can be used by the client.
2552
+ * This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
2553
+ * @param data The plain comment data object (usually returned by the API)
2554
+ * @returns The rich comment data object that can be used by the client.
2555
+ */
2556
+ declare function convertToCommentData(data: CommentDataPlain): CommentData;
2557
+ /**
2558
+ * Converts a plain thread data object (usually returned by the API) to a thread data object that can be used by the client.
2559
+ * This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
2560
+ * @param data The plain thread data object (usually returned by the API)
2561
+ * @returns The rich hread data object that can be used by the client.
2562
+ */
2563
+ declare function convertToThreadData<TThreadMetadata extends BaseMetadata = never>(data: ThreadDataPlain<TThreadMetadata>): ThreadData<TThreadMetadata>;
2564
+ /**
2565
+ * Converts a plain comment reaction object (usually returned by the API) to a comment reaction object that can be used by the client.
2566
+ * This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
2567
+ * @param data The plain comment reaction object (usually returned by the API)
2568
+ * @returns The rich comment reaction object that can be used by the client.
2569
+ */
2570
+ declare function convertToCommentUserReaction(data: CommentUserReactionPlain): CommentUserReaction;
2571
+
2438
2572
  /**
2439
2573
  * Helper type to help users adopt to Lson types from interface definitions.
2440
2574
  * You should only use this to wrap interfaces you don't control. For more
@@ -2447,4 +2581,4 @@ declare type EnsureJson<T> = [
2447
2581
  [K in keyof T]: EnsureJson<T[K]>;
2448
2582
  };
2449
2583
 
2450
- export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, Brand, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentBodyText, CommentData, CommentReaction, CommentsApi, CommentsApiError, CrdtType, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EnterOptions, EventSource, FetchStorageClientMsg, FetchYDocClientMsg, History, IUserInfo, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, OthersEvent, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomEventMessage, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, YDocUpdateServerMsg, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, raise, shallow, stringify, throwUsageError, toPlainLson, tryParseJson, withTimeout };
2584
+ export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, Brand, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyResolveUsersArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentDataPlain, CommentReaction, CommentUserReaction, CommentUserReactionPlain, CommentsApi, CommentsApiError, CrdtType, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EnterOptions, EventSource, FetchStorageClientMsg, FetchYDocClientMsg, History, IUserInfo, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, OthersEvent, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomEventMessage, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, ThreadDataPlain, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, YDocUpdateServerMsg, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToThreadData, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, withTimeout };