UNPKG

@temporalio/common

Version:

Common library for code that's used across the Client, Worker, and/or Workflow

34 lines (33 loc) 1.11 kB
import * as proto from '@temporalio/proto'; export type History = proto.temporal.api.history.v1.IHistory; export type Payload = proto.temporal.api.common.v1.IPayload; /** * JSON representation of Temporal's {@link Payload} protobuf object */ export interface JSONPayload { /** * Mapping of key to base64 encoded value */ metadata?: Record<string, string> | null; /** * base64 encoded value */ data?: string | null; } /** * Convert a proto JSON representation of History to a valid History object */ export declare function historyFromJSON(history: unknown): History; /** * Convert an History object, e.g. as returned by `WorkflowClient.list().withHistory()`, to a JSON * string that adheres to the same norm as JSON history files produced by other Temporal tools. */ export declare function historyToJSON(history: History): string; /** * Convert from protobuf payload to JSON */ export declare function payloadToJSON(payload: Payload): JSONPayload; /** * Convert from JSON to protobuf payload */ export declare function JSONToPayload(json: JSONPayload): Payload;