Skip to content

Commit e9a2860

Browse files
authored
feat(types): Add wait and resolve types to tailor.workflow (#154)
1 parent 1cf0b40 commit e9a2860

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

packages/types/tailor.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,4 +466,29 @@ declare namespace tailor.workflow {
466466
implementation.
467467
*/
468468
function triggerJobFunction(job_name: string, args?: any): any;
469+
470+
/**
471+
* Suspends the current workflow execution and waits for an external signal to resume.
472+
* The workflow will be parked in "Waiting" status until resolved via `resolve()`.
473+
*
474+
* @param key - A unique key identifying this wait point. Must match `^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$`.
475+
* @param payload - Optional JSON-serializable payload persisted with the wait. Accessible by the resolve callback.
476+
* @returns The result provided by the `resolve()` callback when the workflow resumes.
477+
*/
478+
function wait(key: string, payload?: any): any;
479+
480+
/**
481+
* Resolves a waiting workflow execution, causing it to resume.
482+
* The callback receives the wait payload and must return a JSON-serializable result
483+
* that will be passed back to the `wait()` caller.
484+
*
485+
* @param executionId - The workflow execution ID to resolve
486+
* @param key - The wait key that was used in the `wait()` call
487+
* @param callback - A function that receives the wait payload and returns a result
488+
*/
489+
function resolve(
490+
executionId: string,
491+
key: string,
492+
callback: (waitPayload: any) => any
493+
): Promise<void>;
469494
}

0 commit comments

Comments
 (0)