/** * Suspends workflow execution for a durable, crash-safe duration. Unlike * `setTimeout`, this sleep survives process restarts — the engine persists * the wake-up time and resumes the workflow when the timer expires. * * On replay, `sleep` returns immediately with the stored duration * (no actual waiting occurs). This makes it safe for deterministic * re-execution. * * ## Duration Formats * * Accepts any human-readable duration string parsed by the `ms` module: * `'5 seconds'`, `'30s'`, `'2 minutes'`, `'1m'`, `'1 hour'`, `'2h'`, * `'1 day'`, `'7d'`. * * ## Examples * * ```typescript * import { Durable } from '@hotmeshio/hotmesh'; * * // Simple delay before continuing * export async function reminderWorkflow(userId: string): Promise { * const { sendReminder } = Durable.workflow.proxyActivities(); * * // Wait 24 hours (survives server restarts) * await Durable.workflow.sleep('24 hours'); * await sendReminder(userId, 'Your trial expires tomorrow'); * * // Wait another 6 days * await Durable.workflow.sleep('6 days'); * await sendReminder(userId, 'Your trial has expired'); * } * ``` * * ```typescript * // Exponential backoff with retry loop * export async function pollingWorkflow(resourceId: string): Promise { * const { checkStatus } = Durable.workflow.proxyActivities(); * * for (let attempt = 0; attempt < 10; attempt++) { * const status = await checkStatus(resourceId); * if (status === 'ready') return status; * * // Exponential backoff: 1s, 2s, 4s, 8s, ... * const delay = Math.pow(2, attempt); * await Durable.workflow.sleep(`${delay} seconds`); * } * return 'timeout'; * } * ``` * * ```typescript * // Race a sleep against an activity * const [result, _] = await Promise.all([ * activities.fetchData(id), * Durable.workflow.sleep('30 seconds'), * ]); * ``` * * @param {string | number} duration - A human-readable duration string (e.g., `'30s'`, `'5 minutes'`) or milliseconds as a number. * @returns {Promise} The resolved duration in seconds. */ export declare function sleep(duration: string | number): Promise;