/** * Sends a signal payload to a paused workflow thread that is awaiting this * `signalId` via `condition()`. Signals are the primary mechanism for * inter-workflow communication and for delivering results from hook * functions back to the orchestrating workflow. * * `signal` is the **send** side of the coordination pair. The **receive** * side is `condition()`. A signal can be sent from: * - Another workflow function * - A hook function (most common pattern with `execHook`) * - An external client via `Durable.Client.workflow.signal()` * * Signals fire exactly once per workflow execution — the `isSideEffectAllowed` * guard ensures they are not re-sent on replay. * * ## Examples * * ```typescript * import { Durable } from '@hotmeshio/hotmesh'; * * // Hook function that signals completion back to the parent workflow * export async function processOrder( * orderId: string, * signalInfo?: { signal: string; $durable: boolean }, * ): Promise<{ total: number }> { * const { calculateTotal } = Durable.workflow.proxyActivities(); * const total = await calculateTotal(orderId); * * // Signal the waiting workflow with the result * if (signalInfo?.signal) { * await Durable.workflow.signal(signalInfo.signal, { total }); * } * return { total }; * } * ``` * * ```typescript * // Cross-workflow coordination: workflow A signals workflow B * export async function coordinatorWorkflow(): Promise { * const { prepareData } = Durable.workflow.proxyActivities(); * const data = await prepareData(); * * // Signal another workflow that is paused on condition('data-ready') * await Durable.workflow.signal('data-ready', { payload: data }); * } * ``` * * ```typescript * // External signal from an API handler (outside a workflow) * const client = new Durable.Client({ connection }); * await client.workflow.signal('approval-signal', { approved: true }); * ``` * * @param {string} signalId - Unique signal identifier that matches a `condition()` call. * @param {Record} data - The payload to deliver to the waiting workflow. * @returns {Promise} The resulting hook/stream ID. */ export declare function signal(signalId: string, data: Record, expire?: string): Promise;