UNPKG

trellis

Version:

Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications

20 lines 939 B
/** * Framework-agnostic, schema-typed mutations. The React `useMutation`, Vue * `useMutation`, and Svelte mutation helper all delegate here so create/update * payloads are checked against the schema in exactly one place. * * @module trellis/schema */ import type { TrellisDb } from '../client/sdk.js'; import type { AnyType, InferType } from './define.js'; export interface EntityMutations<E> { /** Create an entity of this type. Returns the new id. */ create(attrs: Omit<E, 'id' | 'type'>): Promise<string>; /** Patch an entity's attributes. */ update(id: string, attrs: Partial<Omit<E, 'id' | 'type'>>): Promise<void>; /** Delete an entity by id. */ remove(id: string): Promise<void>; } /** Bind create/update/remove for a schema to a client. */ export declare function entityMutations<S extends AnyType>(client: TrellisDb, schema: S): EntityMutations<InferType<S>>; //# sourceMappingURL=mutations.d.ts.map