import { Effect, Option, Ref } from "effect"; import { NotFoundError } from "../errors/crud-errors.js"; /** * Entity constraint: must have a readonly string `id` field. */ type HasId = { readonly id: string; }; /** * Gets a single entity by ID from a collection Ref. * Returns Option.some if found, Option.none if not. */ export declare const getEntity: (ref: Ref.Ref>, id: string) => Effect.Effect>; /** * Gets a single entity by ID, failing with NotFoundError if not present. */ export declare const getEntityOrFail: (ref: Ref.Ref>, id: string, collection: string) => Effect.Effect; /** * Gets all entities from a collection Ref as a ReadonlyArray. */ export declare const getAllEntities: (ref: Ref.Ref>) => Effect.Effect>; /** * Sets (creates or replaces) an entity in the collection Ref. * The entity is keyed by its `id` field. */ export declare const setEntity: (ref: Ref.Ref>, entity: T) => Effect.Effect; /** * Removes an entity by ID from the collection Ref. * Returns true if the entity existed and was removed, false if it was not present. */ export declare const removeEntity: (ref: Ref.Ref>, id: string) => Effect.Effect; /** * Atomically updates an entity by ID using an updater function. * Returns the updated entity. Fails with NotFoundError if the entity doesn't exist. */ export declare const updateEntity: (ref: Ref.Ref>, id: string, updater: (entity: T) => T, collection: string) => Effect.Effect; export {}; //# sourceMappingURL=state-operations.d.ts.map