@temporalio/client
Version:
Temporal.io SDK Client sub-package
90 lines (89 loc) • 3.61 kB
TypeScript
import type { BaseClientOptions, LoadedWithDefaults } from './base-client';
import { BaseClient } from './base-client';
import type { WorkflowService } from './types';
/**
* Options used to configure {@link AsyncCompletionClient}
*/
export type AsyncCompletionClientOptions = BaseClientOptions;
export type LoadedAsyncCompletionClientOptions = LoadedWithDefaults<AsyncCompletionClientOptions>;
/**
* A mostly unique Activity identifier. If {@link workflowId} is set, it refers to a Workflow Activity.
* If {@link workflowId} is unset, it refers to a Standalone Activity. In both cases, it can optionally contain
* {@link runId}.
*
* Activity IDs may be reused in a single Workflow run as long as a previous Activity with the same ID has completed
* already. Standalone Activity IDs may be reused if `idReusePolicy` is set in Activity options when starting a new
* Activity, but a combination of Activity ID and Activity run ID is unique.
*/
export interface FullActivityId {
/**
* ID of the Workflow that started the Activity. Unset for Standalone Activities.
*/
workflowId?: string;
/**
* If {@link workflowId} is set, this optionally specifies the Workflow run ID in order to differentiate between
* Workflow runs with the same Workflow ID. If {@link workflowId} is unset, this optionally specifies the
* Activity run ID in order to differentiate between Standalone Activity runs with the same Activity ID.
*
* If {@link runId} is unset, then the {@link FullActivityId} object refers to the latest run of the Workflow or
* the Standalone Activity with the specified ID.
*/
runId?: string;
/**
* ID of the Activity.
*/
activityId: string;
}
/**
* A client for asynchronous completion and heartbeating of Activities.
*
* Typically this client should not be instantiated directly, instead create the high level {@link Client} and use
* {@link Client.activity} to complete async activities.
*/
export declare class AsyncCompletionClient extends BaseClient {
readonly options: LoadedAsyncCompletionClientOptions;
constructor(options?: AsyncCompletionClientOptions);
/**
* Raw gRPC access to the Temporal service.
*
* **NOTE**: The namespace provided in {@link options} is **not** automatically set on requests made via this service
* object.
*/
get workflowService(): WorkflowService;
/**
* Transforms grpc errors into well defined TS errors.
*/
protected handleError(err: unknown): never;
/**
* Complete an Activity by task token
*/
complete(taskToken: Uint8Array, result: unknown): Promise<void>;
/**
* Complete an Activity by full ID
*/
complete(fullActivityId: FullActivityId, result: unknown): Promise<void>;
/**
* Fail an Activity by task token
*/
fail(taskToken: Uint8Array, err: unknown): Promise<void>;
/**
* Fail an Activity by full ID
*/
fail(fullActivityId: FullActivityId, err: unknown): Promise<void>;
/**
* Report Activity cancellation by task token
*/
reportCancellation(taskToken: Uint8Array, details?: unknown): Promise<void>;
/**
* Report Activity cancellation by full ID
*/
reportCancellation(fullActivityId: FullActivityId, details?: unknown): Promise<void>;
/**
* Send Activity heartbeat by task token
*/
heartbeat(taskToken: Uint8Array, details?: unknown): Promise<void>;
/**
* Send Activity heartbeat by full ID
*/
heartbeat(fullActivityId: FullActivityId, details?: unknown): Promise<void>;
}