Skip to content

js-bao-wss-client


js-bao-wss-client / WorkflowsAPI

Interface: WorkflowsAPI

Methods

claimApply()

claimApply(options): Promise<ClaimApplyResult>

Claim a workflow result for client-side apply. Returns { claimed: true } if this client won the lock.

Parameters

options

ClaimApplyOptions

Returns

Promise<ClaimApplyResult>


confirmApply()

confirmApply(options): Promise<ConfirmApplyResult>

Confirm that a claimed workflow result has been applied to the document.

Parameters

options

ConfirmApplyOptions

Returns

Promise<ConfirmApplyResult>


define()

define(workflowKey, options): void

Define a workflow with its apply handler. Call once at app initialization so any client can handle apply.

Parameters

workflowKey

string

options

WorkflowDefineOptions

Returns

void


getPendingApplies()

getPendingApplies(options): Promise<any[]>

Fetch pending workflow applies for a document.

Parameters

options
contextDocId

string

Returns

Promise<any[]>


getStatus()

getStatus(options): Promise<WorkflowStatusResult>

Get the status of a workflow run. If contextDocId is not provided, uses the user's root document.

Parameters

options

GetWorkflowStatusOptions

Returns

Promise<WorkflowStatusResult>


listRuns()

listRuns(options?): Promise<ListWorkflowRunsResult>

List workflow runs for the current user

Parameters

options?

ListWorkflowRunsOptions

Returns

Promise<ListWorkflowRunsResult>


releaseApply()

releaseApply(options): Promise<ReleaseApplyResult>

Release a claimed workflow apply so another client can retry. Called automatically on apply handler failure.

Parameters

options

ReleaseApplyOptions

Returns

Promise<ReleaseApplyResult>


start()

start(options): Promise<StartWorkflowResult>

Start a workflow and return the run information

Parameters

options

StartWorkflowOptions

Returns

Promise<StartWorkflowResult>


terminate()

terminate(options): Promise<WorkflowStatusResult>

Terminate a running workflow. If contextDocId is not provided, uses the user's root document.

Parameters

options

TerminateWorkflowOptions

Returns

Promise<WorkflowStatusResult>