export type ConditionPredicate = () => boolean; export interface ConditionOptions { timeout?: Promise; } /** * A condition which will resolve when the predicate resolves to true. * * The contents of the condition should be deterministic and contain no task calls. * Should only be called from within a workflow. * * ```ts * workflow("myWorkflow", async () => { * let n = 0; * onSignal("mySignal", () => { n++ }); * * await condition(() => n === 5); // after 5 mySignals, this promise will be resolved. * * return "got 5!" * }); * ``` * * Supports a timeout to avoid running forever. When the condition times out, it returns false. * * ```ts * workflow("myWorkflow", async () => { * let n = 0; * onSignal("mySignal", () => { n++ }); * * // after 5 mySignals, this promise will be resolved. * if(!(await condition({ timeout: duration(5, "minutes") }, () => n === 5))) { * return "did not get 5 in 5 minutes." * } * * return "got 5!" * }); * ``` */ export declare function condition(predicate: ConditionPredicate): Promise; export declare function condition(opts: ConditionOptions, predicate: ConditionPredicate): Promise; //# sourceMappingURL=condition.d.ts.map