import type { ExpressionBuilder, ExpressionWrapper, SqlBool } from "kysely"; import type { LixDatabaseSchema } from "../database/schema.js"; import type { LixEntity, LixEntityCanonical } from "./types.js"; /** * Entity Expression Builder - provides fluent API for entity operations in queries. * * This allows for more readable query syntax like: * .where(ebEntity("file").hasLabel({ name: "important" })) * .where(ebEntity("state").equals(userAccount)) * .where(ebEntity().in(entities)) // When context is unambiguous (no joins) * * @param entityType - The type of entity table being queried (e.g., "file", "account", "conversation"). * Optional when the context is unambiguous (e.g., single table queries with no joins). */ export declare function ebEntity(entityType?: TB): { /** * Creates a filter that matches entities having the specified label. * * @param label - The label to filter by (either { name: "..." } or { id: "..." }) * @returns Expression wrapper for use in WHERE clauses * * @example * ```ts * await lix.db.selectFrom("file") * .where(ebEntity("file").hasLabel({ name: "important" })) * .selectAll() * .execute(); * ``` */ hasLabel(label: { id: string; name?: string; } | { name: string; id?: string; }): (eb: ExpressionBuilder) => ExpressionWrapper; /** * Creates a filter that matches entities equal to the specified entity. * * @param entity - The entity to match against (must have entity_id, schema_key, file_id) * @returns Expression wrapper for use in WHERE clauses * * @example * ```ts * await lix.db.selectFrom("account") * .where(ebEntity("account").equals(targetAccount)) * .selectAll() * .execute(); * ``` */ equals(entity: LixEntity | LixEntityCanonical): (eb: ExpressionBuilder) => ExpressionWrapper; /** * Creates a filter that matches entities in the specified list. * * @param entities - Array of entities to match against * @returns Expression wrapper for use in WHERE clauses * * @example * ```ts * await lix.db.selectFrom("conversation") * .where(ebEntity("conversation").in([c1, c2, c3])) * .selectAll() * .execute(); * ``` */ in(entities: Array<{ entity_id: string; schema_key: string; file_id: string; } | { lixcol_entity_id: string; lixcol_schema_key: string; lixcol_file_id: string; }>): (eb: ExpressionBuilder) => ExpressionWrapper; }; //# sourceMappingURL=eb-entity.d.ts.map