MCPcopy Index your code
hub / github.com/TanStack/ai / createPersistor

Function createPersistor

packages/ai-client/tests/client-persistor.test.ts:30–34  ·  view source on GitHub ↗

* Build a persistor wired to `adapter` with a spy `applyMessages` callback so * tests can assert what (if anything) gets re-applied to the client.

(adapter: ChatClientPersistence, id: string = CHAT_ID)

Source from the content-addressed store, hash-verified

28 * tests can assert what (if anything) gets re-applied to the client.
29 */
30function createPersistor(adapter: ChatClientPersistence, id: string = CHAT_ID) {
31 const applyMessages = vi.fn<(messages: Array<UIMessage>) => void>()
32 const persistor = new ChatPersistor(adapter, id, applyMessages)
33 return { persistor, applyMessages }
34}
35
36// --- typed StreamChunk fixtures -------------------------------------------
37// These satisfy the StreamChunk union directly (no casts). The persistor only

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected