Class: TimeSkippingWorkflowClient
testing.TimeSkippingWorkflowClient
A client with the exact same API as the "normal" client with 1 exception, When this client waits on a Workflow's result, it will enable time skipping in the test server.
Hierarchy
-
↳
TimeSkippingWorkflowClient
Constructors
constructor
• new TimeSkippingWorkflowClient(options
): TimeSkippingWorkflowClient
Parameters
Name | Type |
---|---|
options | TimeSkippingWorkflowClientOptions |
Returns
Overrides
Properties
connection
• Readonly
connection: ConnectionLike
The underlying Connection | connection used by this client.
Clients are cheap to create, but connections are expensive. Where that make sense,
a single connection may and should be reused by multiple Client
.
Inherited from
options
• Readonly
options: LoadedWorkflowClientOptions
Inherited from
Accessors
workflowService
• get
workflowService(): WorkflowService
Raw gRPC access to the Temporal service.
NOTE: The namespace provided in options is not automatically set on requests made via this service object.
Returns
Inherited from
WorkflowClient.workflowService
Methods
count
▸ count(query?
): Promise
<CountWorkflowExecution
>
Return the number of Workflow Executions matching the given query
. If no query
is provided, then return the
total number of Workflow Executions for this namespace.
Note that the number of Workflow Executions returned is approximate and eventually consistent.
More info on the concept of "visibility" and the query syntax on the Temporal documentation site: https://docs.temporal.io/visibility
Parameters
Name | Type |
---|---|
query? | string |
Returns
Promise
<CountWorkflowExecution
>
Inherited from
execute
▸ execute<T
>(workflowTypeOrFunc
, options
): Promise
<WorkflowResultType
<T
>>
Starts a new Workflow execution and awaits its completion.
Type parameters
Name | Type |
---|---|
T | extends Workflow |
Parameters
Name | Type |
---|---|
workflowTypeOrFunc | string | T |
options | WorkflowStartOptions <T > |
Returns
Promise
<WorkflowResultType
<T
>>
the result of the Workflow execution
Inherited from
getHandle
▸ getHandle<T
>(workflowId
, runId?
, options?
): WorkflowHandle
<T
>
Create a handle to an existing Workflow.
- If only
workflowId
is passed, and there are multiple Workflow Executions with that ID, the handle will refer to the most recent one. - If
workflowId
andrunId
are passed, the handle will refer to the specific Workflow Execution with that Run ID. - If
workflowId
and GetWorkflowHandleOptions.firstExecutionRunId are passed, the handle will refer to the most recent Workflow Execution in the Chain that started withfirstExecutionRunId
.
A Chain is a series of Workflow Executions that share the same Workflow ID and are connected by:
- Being part of the same Cron
- Continue As New
- Retries
This method does not validate workflowId
. If there is no Workflow Execution with the given workflowId
, handle
methods like handle.describe()
will throw a WorkflowNotFoundError error.
Type parameters
Name | Type |
---|---|
T | extends Workflow |
Parameters
Name | Type |
---|---|
workflowId | string |
runId? | string |
options? | GetWorkflowHandleOptions |
Returns
Inherited from
list
▸ list(options?
): AsyncWorkflowListIterable
Return a list of Workflow Executions matching the given query
.
Note that the list of Workflow Executions returned is approximate and eventually consistent.
More info on the concept of "visibility" and the query syntax on the Temporal documentation site: https://docs.temporal.io/visibility
Parameters
Name | Type |
---|---|
options? | ListOptions |
Returns
Inherited from
result
▸ result<T
>(workflowId
, runId?
, opts?
): Promise
<T
>
Gets the result of a Workflow execution.
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
workflowId | string |
runId? | string |
opts? | WorkflowResultOptions |
Returns
Promise
<T
>
See
Overrides
signalWithStart
▸ signalWithStart<WorkflowFn
, SignalArgs
>(workflowTypeOrFunc
, options
): Promise
<WorkflowHandleWithSignaledRunId
<WorkflowFn
>>
Sends a Signal to a running Workflow or starts a new one if not already running and immediately Signals it. Useful when you're unsure whether the Workflow has been started.
Type parameters
Name | Type |
---|---|
WorkflowFn | extends Workflow |
SignalArgs | extends any [] = [] |
Parameters
Name | Type |
---|---|
workflowTypeOrFunc | string | WorkflowFn |
options | WithWorkflowArgs <WorkflowFn , WorkflowSignalWithStartOptions <SignalArgs >> |
Returns
Promise
<WorkflowHandleWithSignaledRunId
<WorkflowFn
>>
a WorkflowHandle to the started Workflow
Inherited from
WorkflowClient.signalWithStart
start
▸ start<T
>(workflowTypeOrFunc
, options
): Promise
<WorkflowHandleWithFirstExecutionRunId
<T
>>
Start a new Workflow execution.
Type parameters
Name | Type |
---|---|
T | extends Workflow |
Parameters
Name | Type |
---|---|
workflowTypeOrFunc | string | T |
options | WorkflowStartOptions <T > |
Returns
Promise
<WorkflowHandleWithFirstExecutionRunId
<T
>>
a WorkflowHandle to the started Workflow
Inherited from
withAbortSignal
▸ withAbortSignal<R
>(abortSignal
, fn
): Promise
<R
>
Set an AbortSignal that, when aborted, cancels any ongoing service requests executed in
fn
's scope. This will locally result in the request call throwing a _grpc.ServiceError|ServiceError
with code _grpc.status.CANCELLED|CANCELLED; see isGrpcCancelledError.
This method is only a convenience wrapper around Connection.withAbortSignal.
Type parameters
Name |
---|
R |
Parameters
Name | Type |
---|---|
abortSignal | AbortSignal |
fn | () => Promise <R > |
Returns
Promise
<R
>
value returned from fn
See
https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
Inherited from
WorkflowClient.withAbortSignal
withDeadline
▸ withDeadline<R
>(deadline
, fn
): Promise
<R
>
Set a deadline for any service requests executed in fn
's scope.
The deadline is a point in time after which any pending gRPC request will be considered as failed; this will locally result in the request call throwing a _grpc.ServiceError|ServiceError with code _grpc.status.DEADLINE_EXCEEDED|DEADLINE_EXCEEDED; see isGrpcDeadlineError.
It is stronly recommended to explicitly set deadlines. If no deadline is set, then it is possible for the client to end up waiting forever for a response.
This method is only a convenience wrapper around Connection.withDeadline.
Type parameters
Name |
---|
R |
Parameters
Name | Type | Description |
---|---|---|
deadline | number | Date | a point in time after which the request will be considered as failed; either a Date object, or a number of milliseconds since the Unix epoch (UTC). |
fn | () => Promise <R > | - |
Returns
Promise
<R
>
the value returned from fn
See
https://grpc.io/docs/guides/deadlines/
Inherited from
withMetadata
▸ withMetadata<R
>(metadata
, fn
): Promise
<R
>
Set metadata for any service requests executed in fn
's scope.
This method is only a convenience wrapper around Connection.withMetadata.
Type parameters
Name |
---|
R |
Parameters
Name | Type |
---|---|
metadata | Metadata |
fn | () => Promise <R > |
Returns
Promise
<R
>
returned value of fn