import { callEcho, callFindUser, callRenameUser, callUpdateProfile, callWhoami, createUserContext, type ContextState, } from '../src/stores/svelte' import type { UserContextData, UserContextParams } from '../src/index' export async function everySvelteStoreEntryPoint(): Promise { const params: UserContextParams = { user_id: 1 } const store = createUserContext(params) const unsubscribe = store.subscribe((state: ContextState) => { console.log(state.status, state.data?.user_profile.name ?? '') }) unsubscribe() const echoed = await callEcho({ text: 'hello' }) const found = await callFindUser({ user_id: 1 }) const renamed = await callRenameUser({ user_id: 1, name: 'renamed' }) const updated = await callUpdateProfile({ user_id: 1, name: 'renamed' }) const identity = await callWhoami() console.log(echoed.message, found.name, renamed.name, updated.ok, identity.authenticated) }