Interface: Client
Defined in: sdk/ts/sdk/src/client/index.ts:101
The control-plane client. Every method maps to one /v1 route and throws a plain Error carrying the status and body on a non-2xx answer. Names may be passed as the definition objects themselves (activity(...), signal(...), defineWorkflow(...)).
Methods
cancel()
cancel(
runId):Promise<RunView>
Defined in: sdk/ts/sdk/src/client/index.ts:132
Cancels the run and returns its view.
Parameters
runId
string
Returns
Promise<RunView>
events()
events(
runId,since?):Promise<Envelope[]>
Defined in: sdk/ts/sdk/src/client/index.ts:128
Journaled events with seq > since (default 0).
Parameters
runId
string
since?
number
Returns
Promise<Envelope[]>
find()
find(
runId):Promise<RunView|null>
Defined in: sdk/ts/sdk/src/client/index.ts:126
The run's current view, or null when the host has no such run.
Parameters
runId
string
Returns
Promise<RunView | null>
get()
get(
runId):Promise<RunView>
Defined in: sdk/ts/sdk/src/client/index.ts:124
The run's current view.
Parameters
runId
string
Returns
Promise<RunView>
list()
list(
query?):Promise<RunView[]>
Defined in: sdk/ts/sdk/src/client/index.ts:134
Runs in the host's namespace matching the query.
Parameters
query?
Returns
Promise<RunView[]>
signal()
signal(
runId,name,payload):Promise<SignalResult>
Defined in: sdk/ts/sdk/src/client/index.ts:105
Sends a signal; buffered when the run is not waiting for it yet.
Parameters
runId
string
name
string | { name: string; }
payload
Returns
Promise<SignalResult>
signalLink()
signalLink(
runId,name,options?):Promise<SignalLink>
Defined in: sdk/ts/sdk/src/client/index.ts:111
Mints a URL that delivers this one signal to this one run without a bearer token — the thing you put in an email. The host signs it; opening it renders a confirmation form, and submitting that form is what signals the run.
Parameters
runId
string
name
string | { name: string; }
options?
Returns
Promise<SignalLink>
start()
start(
workflow,input,options?):Promise<RunView>
Defined in: sdk/ts/sdk/src/client/index.ts:103
Starts a run and returns its view once the row exists (status created or later).
Parameters
workflow
string | { name: string; }
input
options?
Returns
Promise<RunView>
startFresh()
startFresh(
workflow,input,options):Promise<StartFreshResult>
Defined in: sdk/ts/sdk/src/client/index.ts:122
Starts a run under runId, or under ${runId}_2, _3, … once earlier runs with the key have ended: the first id with no run is started, a live one is joined. The walk is deterministic, so two concurrent callers land on the same id and the insert's ON CONFLICT DO NOTHING makes one of them the joiner.
Parameters
workflow
string | { name: string; }
input
options
Returns
Promise<StartFreshResult>
stream()
stream(
runId,options?):AsyncIterable<StreamMessage>
Defined in: sdk/ts/sdk/src/client/index.ts:130
Live events over SSE: journal envelopes, cmd.emit payloads, then one end.
Parameters
runId
string
options?
Returns
AsyncIterable<StreamMessage>
waitFor()
waitFor(
runId,status,timeoutMs?):Promise<RunView>
Defined in: sdk/ts/sdk/src/client/index.ts:136
Polls every 50 ms until the run reaches one of status. Throws after timeoutMs (default 10 s).
Parameters
runId
string
status
RunStatus | readonly RunStatus[]
timeoutMs?
number
Returns
Promise<RunView>