import { FindResult, LogicalCondition, SDKCollectionClient, SDKQueryBuilderInterface, WhereFilterOp, WhereValueFor, type ComputedSortField } from "@rebasepro/types"; /** * SDK Query Builder — returns flat rows (`FindResult`) instead of * Entity-wrapped results (`FindResponse`). * * @example * const { data } = await rebase.data.posts * .where("status", "==", "published") * .orderBy("created_at", "desc") * .limit(10) * .find(); * * console.log(data[0].title); // flat access */ export declare class SDKQueryBuilder = Record> implements SDKQueryBuilderInterface { private collection; private params; constructor(collection: SDKCollectionClient); /** * Add a filter condition to your query. * @example * client.data.users.where('age', '>=', 18).find() */ where(column: K, operator: Op, value: WhereValueFor): this; where(logicalCondition: LogicalCondition): this; /** * Order the results by a specific column. * * Call it again to add a tie-breaker rather than replace the sort: keys * apply in the order they were added, so * `.orderBy("roles").orderBy("created_at", "desc")` sorts by role and * shows the newest first within each one. */ orderBy(column: (keyof M & string) | ComputedSortField, direction?: "asc" | "desc"): this; /** * Limit the number of results returned. */ limit(count: number): this; /** * Skip the first N results. */ offset(count: number): this; /** * Set a free-text search string if supported by the backend. * * By default this is a substring match across the collection's top-level * string properties. A Postgres collection that declares a `search` block * gets ranked full-text matching over the fields it named instead, and each * row comes back with a `_score` you can sort on: * * ```ts * client.data.talents.search("auditor iso 14001").orderBy("_score", "desc").find() * ``` * * Pass `{ explain: true }` to have each row report which of the declared * fields matched, with a highlighted snippet, on `_matches`: * * ```ts * const { data } = await client.data.talents.search("iso 14001", { explain: true }).find(); * data[0]._matches * // [{ field: "questionnaire.certifications", snippet: "ISO 14001 Lead Auditor" }] * ``` */ search(searchString: string, options?: { explain?: boolean; }): this; /** * Order rows by nearest-neighbour distance to `vector`. * * The server has supported this from the REST layer since vectors landed; * this is the SDK reaching it. Results come back closest-first with a * `_distance` on each row, and any `where` / `orderBy` on the same query is * a filter applied before the ordering — distance decides the order. * * You supply the query vector. Rebase stores and searches embeddings; it * does not produce them, so this is where whatever model you already use * for the stored vectors gets called. * * @param property - Name of the `vector` property to compare against. * @param vector - The query embedding. Its length must match the property's * declared `dimensions`, or the server answers 400. * @example * client.data.docs.vectorSearch("embedding", queryVector, { threshold: 0.35 }).limit(10).find() */ vectorSearch(property: string, vector: number[], options?: { distance?: "cosine" | "l2" | "inner_product"; threshold?: number; }): this; /** * Include related entities in the response. * Relations will be populated with full data instead of just IDs. * * @param relations - Relation names to include, or "*" for all. * @example * client.data.posts.include("tags", "author").find() */ include(...relations: string[]): this; /** * Execute the find query and return the results as flat rows. */ find(): Promise>; /** * Count the records matching this query. */ count(): Promise; /** * Listen to realtime updates matching this query. */ listen(onUpdate: (data: FindResult) => void, onError?: (error: Error) => void): () => void; }