import { Search } from './common'; /** * Returns a `Search` session handle for reading and writing key-value data * on the workflow's backend HASH record. Search fields are flat string * key-value pairs stored alongside the job state, making them queryable * via `Durable.Client.workflow.search()` (FT.SEARCH). * * Each call produces a unique session ID tied to the deterministic * execution counter, ensuring correct replay behavior. * * Use `search()` for flat, indexable key-value data. For structured * JSON documents, use `entity()` instead. * * ## Examples * * ```typescript * import { Durable } from '@hotmeshio/hotmesh'; * * export async function orderWorkflow(orderId: string): Promise { * const search = await Durable.workflow.search(); * * // Write searchable fields * await search.set({ * orderId, * status: 'processing', * createdAt: new Date().toISOString(), * }); * * const { processOrder } = Durable.workflow.proxyActivities(); * await processOrder(orderId); * * // Update status * await search.set({ status: 'completed' }); * * // Read a field back * const status = await search.get('status'); * } * ``` * * ```typescript * // Increment a numeric counter * export async function counterWorkflow(): Promise { * const search = await Durable.workflow.search(); * await search.set({ count: '0' }); * await search.incr('count', 1); * await search.incr('count', 1); * return Number(await search.get('count')); // 2 * } * ``` * * **Not available with `workerCredentials`.** This method writes directly * to the `jobs` and `jobs_attributes` tables, bypassing the SECURITY * DEFINER stored procedures that scoped worker roles are restricted to. * Workers connecting with `workerCredentials` will receive a permission * error. Use `search()` only in workflows running with full database * credentials. * * @returns {Promise} A search session scoped to the current workflow job. */ export declare function search(): Promise;