/** * Trellis Svelte — schema-typed, live entity stores. * * The Svelte half of the typed read surface. Like the realtime adapter, it takes * no dependency on the `svelte` package — it returns the structural store * contract (`subscribe(run) => unsubscribe`), so `$entities` works in markup. The * store is lazy: the first subscriber opens the {@link liveEntities} subscription * (live + hydrated) and the last to unsubscribe disposes it. Shipped under * `trellis/svelte/typed`. * * import { defineType } from 'trellis/schema'; * import { entitiesStore, mutations } from 'trellis/svelte/typed'; * * const sections = entitiesStore(client, NavSection); // {#each $sections.data as s}… * * @module trellis/svelte/typed */ import { type LiveEntitiesOptions, type LiveEntityOptions } from '../client/live.js'; import type { TrellisDb } from '../client/sdk.js'; import { type EntityMutations } from '../schema/mutations.js'; import type { AnyType, InferEntitiesRead, InferEntityRead, InferType, ResolveSpecFor } from '../schema/define.js'; import type { WhereInput } from '../schema/eql.js'; /** Minimal Svelte store contract (a structural subset of `svelte/store`'s `Readable`). */ export interface Readable { subscribe(run: (value: T) => void): () => void; } export interface TypedRead { data: T; loading: boolean; error: Error | null; } export type TypedReadOptions = LiveEntitiesOptions & { where?: WhereInput; resolve?: ResolveSpecFor; }; export type TypedEntityOptions = LiveEntityOptions & { resolve?: ResolveSpecFor; }; /** Live list of a type as a Svelte store. */ export declare function entitiesStore> | TypedReadOptions | undefined = undefined>(client: TrellisDb, schema: S, opts?: O): Readable>>; /** Live single entity by id as a Svelte store — read-first, then type subscription. */ export declare function entityStore | undefined = undefined>(client: TrellisDb, schema: S, id: string | null | undefined, opts?: O): Readable>>; /** Schema-typed create/update/remove. */ export declare function mutations(client: TrellisDb, schema: S): EntityMutations>; //# sourceMappingURL=schema-hooks.d.ts.map