/** * One thread with everything said in it, held for as long as the reader has it open. * * Comments are kept in the order they were posted, oldest first, the way the API * returns them. A comment that arrives later, whether this reader posted it or someone * else did, is slotted in by its time rather than tacked on the end, so two writers * posting at once read the same way to both of them. An agent rewrites its own comment * as its work moves along, so a comment already in the thread is replaced in place. */ import type { QueryClient } from '@tanstack/react-query'; import type { Comment, ThreadWithComments } from '@pantheon-systems/css-client'; export declare const THREAD_COMMENTS_KEY = "p1-thread-comments"; export declare const NO_COMMENTS: readonly Comment[]; export declare function threadCommentsKey(siteId: string | undefined, threadId: string | undefined): readonly ["p1-thread-comments", string | undefined, string | undefined]; export declare function insertComment(comments: readonly Comment[], comment: Comment): readonly Comment[]; /** Puts a whole thread in place, as when the reader has just started it. */ export declare function storeThread(queryClient: QueryClient, thread: ThreadWithComments): void; /** * Adds one comment to its thread, or replaces the one it rewrites, if that thread has * been loaded. A thread nobody has opened is left alone: one comment would stand in for * a thread never fetched. * * @returns Whether a loaded thread was there to add to. */ export declare function appendThreadComment(queryClient: QueryClient, siteId: string, comment: Comment): boolean;