UNPKG

@temporalio/client

Version:
97 lines (96 loc) 3.37 kB
import { BaseClient, BaseClientOptions, LoadedWithDefaults } from './base-client'; import { WorkflowService } from './types'; /** * Thrown by {@link AsyncCompletionClient} when trying to complete or heartbeat an Activity that does not exist in the * system. */ export declare class ActivityNotFoundError extends Error { } /** * Thrown by {@link AsyncCompletionClient} when trying to complete or heartbeat * an Activity for any reason apart from {@link ActivityNotFoundError}. */ export declare class ActivityCompletionError extends Error { } /** * Thrown by {@link AsyncCompletionClient.heartbeat} when the Workflow has * requested to cancel the reporting Activity. */ export declare class ActivityCancelledError extends Error { } /** * Thrown by {@link AsyncCompletionClient.heartbeat} when the reporting Activity * has been paused. */ export declare class ActivityPausedError extends Error { } /** * Options used to configure {@link AsyncCompletionClient} */ export type AsyncCompletionClientOptions = BaseClientOptions; export type LoadedAsyncCompletionClientOptions = LoadedWithDefaults<AsyncCompletionClientOptions>; /** * A mostly unique Activity identifier including its scheduling workflow's ID * and an optional runId. * * Activity IDs may be reused in a single Workflow run as long as a previous * Activity with the same ID has completed already. */ export interface FullActivityId { workflowId: string; runId?: string; 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>; }