import { WorkflowOptions } from './common'; /** * Spawns a child workflow and awaits its result. The child runs as an * independent job with its own lifecycle, retry policy, and dimensional * isolation. If the child fails, the error is propagated to the parent * as a typed error (`DurableFatalError`, `DurableMaxedError`, * `DurableTimeoutError`, or `DurableRetryError`). * * On replay, the stored child result is returned immediately without * re-spawning the child workflow. * * ## Child Job ID * * If `options.workflowId` is provided, it is used directly. Otherwise, * the child ID is generated from the entity/workflow name, a GUID, the * parent's dimensional coordinates, and the execution index — ensuring * uniqueness across parallel and re-entrant executions. * * ## Examples * * ```typescript * import { Durable } from '@hotmeshio/hotmesh'; * * // Spawn a child workflow and await its result * export async function parentWorkflow(orderId: string): Promise { * const result = await Durable.workflow.executeChild<{ status: string }>({ * taskQueue: 'payments', * workflowName: 'processPayment', * args: [orderId, 99.99], * config: { * maximumAttempts: 3, * backoffCoefficient: 2, * }, * }); * return result.status; * } * ``` * * ```typescript * // Fan-out: spawn multiple children in parallel * export async function batchWorkflow(items: string[]): Promise { * const results = await Promise.all( * items.map((item) => * Durable.workflow.executeChild({ * taskQueue: 'processors', * workflowName: 'processItem', * args: [item], * }), * ), * ); * return results; * } * ``` * * ```typescript * // Entity-based child (uses entity name as task queue) * const user = await Durable.workflow.executeChild({ * entity: 'user', * args: [{ name: 'Alice', email: 'alice@example.com' }], * workflowId: 'user-alice', // deterministic ID * expire: 3600, // 1 hour TTL * }); * ``` * * @template T - The return type of the child workflow. * @param {WorkflowOptions} options - Child workflow configuration. * @returns {Promise} The child workflow's return value. */ export declare function executeChild(options: WorkflowOptions): Promise; export declare function startChild(options: WorkflowOptions): Promise;