Namespace: common
Common library for code that's used across the Client, Worker, and/or Workflow
Enumerations
Classes
- ActivityCancellationDetails
- ActivityFailure
- ApplicationFailure
- BinaryPayloadConverter
- CancelledFailure
- ChildWorkflowFailure
- CompositePayloadConverter
- DefaultFailureConverter
- DefaultPayloadConverter
- IllegalStateError
- JsonPayloadConverter
- NamespaceNotFoundError
- NexusOperationFailure
- PayloadConverterError
- RawValue
- ServerFailure
- TemporalFailure
- TerminatedFailure
- TimeoutFailure
- TypedSearchAttributes
- UndefinedPayloadConverter
- ValueError
- WorkflowExecutionAlreadyStartedError
- WorkflowNotFoundError
Interfaces
- ActivityCancellationDetailsOptions
- ActivityFunction
- ActivityOptions
- ApplicationFailureOptions
- BaseWorkflowHandle
- BaseWorkflowOptions
- DataConverter
- DefaultEncodedFailureAttributes
- DefaultFailureConverterOptions
- FailureConverter
- HistoryAndWorkflowId
- LoadedDataConverter
- LocalActivityOptions
- Logger
- Metric
- MetricCounter
- MetricGauge
- MetricHistogram
- MetricMeter
- PayloadCodec
- PayloadConverter
- PayloadConverterWithEncoding
- PinnedVersioningOverride
- Priority
- QueryDefinition
- RetryPolicy
- SignalDefinition
- UpdateDefinition
- WorkerDeploymentVersion
- WorkflowDefinitionOptions
- WorkflowDurationOptions
Type Aliases
ActivityCancellationType
Ƭ ActivityCancellationType: typeof ActivityCancellationType[keyof typeof ActivityCancellationType]
ActivityInterface
Ƭ ActivityInterface: Record<string, ActivityFunction>
Mapping of Activity name to function
Deprecated
not required anymore, for untyped activities use UntypedActivities
ApplicationFailureCategory
Ƭ ApplicationFailureCategory: typeof ApplicationFailureCategory[keyof typeof ApplicationFailureCategory]
AutoUpgradeVersioningOverride
Ƭ AutoUpgradeVersioningOverride: "AUTO_UPGRADE"
The workflow will auto-upgrade to the current deployment version on the next workflow task.
CommonWorkflowOptions
Ƭ CommonWorkflowOptions: BaseWorkflowOptions & WorkflowDurationOptions
Duration
Ƭ Duration: StringValue | number
A duration, expressed either as a number of milliseconds, or as a ms-formatted string.
EncodingType
Ƭ EncodingType: typeof encodingTypes[keyof typeof encodingTypes]
HandlerUnfinishedPolicy
Ƭ HandlerUnfinishedPolicy: typeof HandlerUnfinishedPolicy[keyof typeof HandlerUnfinishedPolicy]
Headers
Ƭ Headers: Record<string, Payload>
Headers are just a mapping of header name to Payload
LogLevel
Ƭ LogLevel: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR"
LogMetadata
Ƭ LogMetadata: Record<string | symbol, any>
MetricTags
Ƭ MetricTags: Record<string, string | number | boolean>
Tags to be attached to some metrics.
The Metric API is an experimental feature and may be subject to change.
MetricTagsOrFunc
Ƭ MetricTagsOrFunc: MetricTags | () => MetricTags
Next
Ƭ Next<IF, FN>: Required<IF>[FN] extends AnyFunc ? OmitLastParam<Required<IF>[FN]> : never
Type of the next function for a given interceptor function
Called from an interceptor to continue the interception chain
Type parameters
| Name | Type |
|---|---|
IF | IF |
FN | extends keyof IF |
NumericMetricValueType
Ƭ NumericMetricValueType: "int" | "float"
Payload
Ƭ Payload: IPayload
ProtoFailure
Ƭ ProtoFailure: IFailure
RetryState
Ƭ RetryState: typeof RetryState[keyof typeof RetryState]
SearchAttributePair
Ƭ SearchAttributePair: { [T in SearchAttributeType]: Object }[SearchAttributeType]
SearchAttributeType
Ƭ SearchAttributeType: typeof SearchAttributeType[keyof typeof SearchAttributeType]
SearchAttributeUpdatePair
Ƭ SearchAttributeUpdatePair: { [T in SearchAttributeType]: Object }[SearchAttributeType]
SearchAttributeValue
Ƭ SearchAttributeValue: string[] | number[] | boolean[] | Date[]
@deprecated: Use TypedSearchAttributes instead
SearchAttributes
Ƭ SearchAttributes: Record<string, SearchAttributeValueOrReadonly>
@deprecated: Use TypedSearchAttributes instead
StringValue
Ƭ StringValue: `${number}` | `${number}${UnitAnyCase}` | `${number} ${UnitAnyCase}`
TimeoutType
Ƭ TimeoutType: typeof TimeoutType[keyof typeof TimeoutType]
Timestamp
Ƭ Timestamp: ITimestamp
UntypedActivities
Ƭ UntypedActivities: Record<string, ActivityFunction>
Mapping of Activity name to function
VersioningBehavior
Ƭ VersioningBehavior: typeof VersioningBehavior[keyof typeof VersioningBehavior]
VersioningIntent
Ƭ VersioningIntent: "COMPATIBLE" | "DEFAULT"
Indicates whether the user intends certain commands to be run on a compatible worker Build Id version or not.
COMPATIBLE indicates that the command should run on a worker with compatible version if possible. It may not be
possible if the target task queue does not also have knowledge of the current worker's Build Id.
DEFAULT indicates that the command should run on the target task queue's current overall-default Build Id.
Where this type is accepted optionally, an unset value indicates that the SDK should choose the most sensible default
behavior for the type of command, accounting for whether the command will be run on the same task queue as the
current worker. The default behavior for starting Workflows is DEFAULT. The default behavior for Workflows starting
Activities, starting Child Workflows, or Continuing As New is COMPATIBLE.
Deprecated
In favor of the new Worker Deployment API. The Worker Versioning API is still being designed. Major changes are expected.
VersioningOverride
Ƭ VersioningOverride: PinnedVersioningOverride | "AUTO_UPGRADE"
Represents versioning overrides. For example, when starting workflows.
WithWorkflowArgs
Ƭ WithWorkflowArgs<W, T>: T & Parameters<W> extends [any, ...any[]] ? { args: Parameters<W> | Readonly<Parameters<W>> } : { args?: Parameters<W> | Readonly<Parameters<W>> }
Type parameters
| Name | Type |
|---|---|
W | extends Workflow |
T | T |
Workflow
Ƭ Workflow: (...args: any[]) => WorkflowReturnType
Broad Workflow function definition, specific Workflows will typically use a narrower type definition, e.g:
export async function myWorkflow(arg1: number, arg2: string): Promise<string>;
Type declaration
▸ (...args): WorkflowReturnType
Parameters
| Name | Type |
|---|---|
...args | any[] |
Returns
WorkflowDefinitionOptionsOrGetter
Ƭ WorkflowDefinitionOptionsOrGetter: WorkflowDefinitionOptions | () => WorkflowDefinitionOptions
WorkflowExecution
Ƭ WorkflowExecution: IWorkflowExecution
WorkflowIdConflictPolicy
Ƭ WorkflowIdConflictPolicy: typeof WorkflowIdConflictPolicy[keyof typeof WorkflowIdConflictPolicy]
Defines what happens when trying to start a Workflow with the same ID as a Running Workflow.
See WorkflowOptions.workflowIdReusePolicy for what happens when trying to start a Workflow with the same ID as a Closed Workflow.
Note: It is never possible to have two actively running Workflows with the same ID.
WorkflowIdReusePolicy
Ƭ WorkflowIdReusePolicy: typeof WorkflowIdReusePolicy[keyof typeof WorkflowIdReusePolicy]
WorkflowQueryAnnotatedType
Ƭ WorkflowQueryAnnotatedType: Object
Type declaration
| Name | Type |
|---|---|
description? | string |
handler | WorkflowQueryType |
WorkflowQueryType
Ƭ WorkflowQueryType: (...args: any[]) => any
Type declaration
▸ (...args): any
Parameters
| Name | Type |
|---|---|
...args | any[] |
Returns
any
WorkflowResultType
Ƭ WorkflowResultType<W>: ReturnType<W> extends Promise<infer R> ? R : never
Get the "unwrapped" return type (without Promise) of the execute handler from Workflow type W
Type parameters
| Name | Type |
|---|---|
W | extends Workflow |
WorkflowReturnType
Ƭ WorkflowReturnType: Promise<any>
Type that can be returned from a Workflow execute function
WorkflowSignalAnnotatedType
Ƭ WorkflowSignalAnnotatedType: Object
Type declaration
| Name | Type |
|---|---|
description? | string |
handler | WorkflowSignalType |
unfinishedPolicy | HandlerUnfinishedPolicy |
WorkflowSignalType
Ƭ WorkflowSignalType: (...args: any[]) => Promise<void> | void
Type declaration
▸ (...args): Promise<void> | void
Parameters
| Name | Type |
|---|---|
...args | any[] |
Returns
Promise<void> | void
WorkflowUpdateAnnotatedType
Ƭ WorkflowUpdateAnnotatedType: Object
Type declaration
| Name | Type |
|---|---|
description? | string |
handler | WorkflowUpdateType |
unfinishedPolicy | HandlerUnfinishedPolicy |
validator? | WorkflowUpdateValidatorType |
WorkflowUpdateType
Ƭ WorkflowUpdateType: (...args: any[]) => Promise<any> | any
Type declaration
▸ (...args): Promise<any> | any
Parameters
| Name | Type |
|---|---|
...args | any[] |
Returns
Promise<any> | any
WorkflowUpdateValidatorType
Ƭ WorkflowUpdateValidatorType: (...args: any[]) => void
Type declaration
▸ (...args): void
Parameters
| Name | Type |
|---|---|
...args | any[] |
Returns
void
Variables
ActivityCancellationType
• Const ActivityCancellationType: Object
Type declaration
| Name | Type |
|---|---|
ABANDON | "ABANDON" |
TRY_CANCEL | "TRY_CANCEL" |
WAIT_CANCELLATION_COMPLETED | "WAIT_CANCELLATION_COMPLETED" |
ApplicationFailureCategory
• Const ApplicationFailureCategory: Object
A category to describe the severity and change the observability behavior of an application failure.
Currently, observability behaviour changes are limited to:
- activities that fail due to a BENIGN application failure emit DEBUG level logs and do not record metrics
Category is a new feature and may be subject to change.
Type declaration
| Name | Type |
|---|---|
BENIGN | "BENIGN" |
FAILURE_SOURCE
• Const FAILURE_SOURCE: "TypeScriptSDK"
HandlerUnfinishedPolicy
• Const HandlerUnfinishedPolicy: Object
Policy defining actions taken when a workflow exits while update or signal handlers are running. The workflow exit may be due to successful return, failure, cancellation, or continue-as-new.
Type declaration
| Name | Type | Description |
|---|---|---|
ABANDON | "ABANDON" | Abandon the handler execution. In the case of an update handler this means that the client will receive an error rather than the update result. |
WARN_AND_ABANDON | "WARN_AND_ABANDON" | Issue a warning in addition to abandoning the handler execution. The warning will not be issued if the workflow fails. |
METADATA_ENCODING_KEY
• Const METADATA_ENCODING_KEY: "encoding"
METADATA_MESSAGE_TYPE_KEY
• Const METADATA_MESSAGE_TYPE_KEY: "messageType"
RetryState
• Const RetryState: Object
Type declaration
| Name | Type | Description |
|---|---|---|
CANCEL_REQUESTED | "CANCEL_REQUESTED" | - |
INTERNAL_SERVER_ERROR | "INTERNAL_SERVER_ERROR" | - |
IN_PROGRESS | "IN_PROGRESS" | - |
MAXIMUM_ATTEMPTS_REACHED | "MAXIMUM_ATTEMPTS_REACHED" | - |
NON_RETRYABLE_FAILURE | "NON_RETRYABLE_FAILURE" | - |
RETRY_POLICY_NOT_SET | "RETRY_POLICY_NOT_SET" | - |
RETRY_STATE_CANCEL_REQUESTED | "CANCEL_REQUESTED" | Deprecated Use CANCEL_REQUESTED instead. |
RETRY_STATE_INTERNAL_SERVER_ERROR | "INTERNAL_SERVER_ERROR" | Deprecated Use INTERNAL_SERVER_ERROR instead. |
RETRY_STATE_IN_PROGRESS | "IN_PROGRESS" | Deprecated Use IN_PROGRESS instead. |
RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED | "MAXIMUM_ATTEMPTS_REACHED" | Deprecated Use MAXIMUM_ATTEMPTS_REACHED instead. |
RETRY_STATE_NON_RETRYABLE_FAILURE | "NON_RETRYABLE_FAILURE" | Deprecated Use NON_RETRYABLE_FAILURE instead. |
RETRY_STATE_RETRY_POLICY_NOT_SET | "RETRY_POLICY_NOT_SET" | Deprecated Use RETRY_POLICY_NOT_SET instead. |
RETRY_STATE_TIMEOUT | "TIMEOUT" | Deprecated Use TIMEOUT instead. |
RETRY_STATE_UNSPECIFIED | undefined | Deprecated Use undefined instead. |
TIMEOUT | "TIMEOUT" | - |
SearchAttributeType
• Const SearchAttributeType: Object
Type declaration
| Name | Type |
|---|---|
BOOL | "BOOL" |
DATETIME | "DATETIME" |
DOUBLE | "DOUBLE" |
INT | "INT" |
KEYWORD | "KEYWORD" |
KEYWORD_LIST | "KEYWORD_LIST" |
TEXT | "TEXT" |
TimeoutType
• Const TimeoutType: Object
Type declaration
| Name | Type | Description |
|---|---|---|
HEARTBEAT | "HEARTBEAT" | - |
SCHEDULE_TO_CLOSE | "SCHEDULE_TO_CLOSE" | - |
SCHEDULE_TO_START | "SCHEDULE_TO_START" | - |
START_TO_CLOSE | "START_TO_CLOSE" | - |
TIMEOUT_TYPE_HEARTBEAT | "HEARTBEAT" | Deprecated Use HEARTBEAT instead. |
TIMEOUT_TYPE_SCHEDULE_TO_CLOSE | "SCHEDULE_TO_CLOSE" | Deprecated Use SCHEDULE_TO_CLOSE instead. |
TIMEOUT_TYPE_SCHEDULE_TO_START | "SCHEDULE_TO_START" | Deprecated Use SCHEDULE_TO_START instead. |
TIMEOUT_TYPE_START_TO_CLOSE | "START_TO_CLOSE" | Deprecated Use START_TO_CLOSE instead. |
TIMEOUT_TYPE_UNSPECIFIED | undefined | Deprecated Use undefined instead. |
VersioningBehavior
• Const VersioningBehavior: Object
Specifies when a workflow might move from a worker of one Build Id to another.
- 'PINNED' - The workflow will be pinned to the current Build ID unless manually moved.
- 'AUTO_UPGRADE' - The workflow will automatically move to the latest version (default Build ID of the task queue) when the next task is dispatched.
Deployment based versioning is experimental and may change in the future.
Type declaration
| Name | Type |
|---|---|
AUTO_UPGRADE | "AUTO_UPGRADE" |
PINNED | "PINNED" |
WorkflowIdConflictPolicy
• WorkflowIdConflictPolicy: Object
Type declaration
| Name | Type | Description |
|---|---|---|
FAIL | "FAIL" | Do not start a new Workflow. Instead raise a WorkflowExecutionAlreadyStartedError. |
TERMINATE_EXISTING | "TERMINATE_EXISTING" | Start a new Workflow, terminating the current workflow if one is already running. |
USE_EXISTING | "USE_EXISTING" | Do not start a new Workflow. Instead return a Workflow Handle for the already Running Workflow. |
WorkflowIdReusePolicy
• Const WorkflowIdReusePolicy: Object
Defines what happens when trying to start a Workflow with the same ID as a Closed Workflow.
See WorkflowOptions.workflowIdConflictPolicy for what happens when trying to start a Workflow with the same ID as a Running Workflow.
Concept: Workflow Id Reuse Policy
Note: It is not possible to have two actively running Workflows with the same ID.
Type declaration
| Name | Type | Description |
|---|---|---|
ALLOW_DUPLICATE | "ALLOW_DUPLICATE" | The Workflow can be started if the previous Workflow is in a Closed state. Default ts |
ALLOW_DUPLICATE_FAILED_ONLY | "ALLOW_DUPLICATE_FAILED_ONLY" | The Workflow can be started if the previous Workflow is in a Closed state that is not Completed. |
REJECT_DUPLICATE | "REJECT_DUPLICATE" | The Workflow cannot be started. |
TERMINATE_IF_RUNNING | "TERMINATE_IF_RUNNING" | Terminate the current Workflow if one is already running; otherwise allow reusing the Workflow ID. Deprecated Use WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE instead, and set WorkflowOptions.workflowIdConflictPolicy to WorkflowIdConflictPolicy.WORKFLOW_ID_CONFLICT_POLICY_TERMINATE_EXISTING. When using this option, WorkflowOptions.workflowIdConflictPolicy must be left unspecified. |
WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE | "ALLOW_DUPLICATE" | Deprecated Use ALLOW_DUPLICATE instead. |
WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY | "ALLOW_DUPLICATE_FAILED_ONLY" | Deprecated Use ALLOW_DUPLICATE_FAILED_ONLY instead. |
WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE | "REJECT_DUPLICATE" | Deprecated Use REJECT_DUPLICATE instead. |
WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING | "TERMINATE_IF_RUNNING" | Deprecated Use TERMINATE_IF_RUNNING instead. |
WORKFLOW_ID_REUSE_POLICY_UNSPECIFIED | undefined | No need to use this. If a WorkflowIdReusePolicy is set to this, or is not set at all, the default value will be used. Deprecated Either leave property undefined, or use ALLOW_DUPLICATE instead. |
defaultDataConverter
• Const defaultDataConverter: LoadedDataConverter
A "loaded" data converter that uses the default set of failure and payload converters.
defaultFailureConverter
• Const defaultFailureConverter: FailureConverter
The default FailureConverter used by the SDK.
Error messages and stack traces are serizalized as plain text.
defaultPayloadConverter
• Const defaultPayloadConverter: DefaultPayloadConverter
The default PayloadConverter used by the SDK. Supports Uint8Array and JSON serializables (so if
JSON.stringify(yourArgOrRetval)
works, the default payload converter will work).
To also support Protobufs, create a custom payload converter with DefaultPayloadConverter:
const myConverter = new DefaultPayloadConverter({ protobufRoot })
encodingKeys
• Const encodingKeys: Object
Type declaration
| Name | Type |
|---|---|
METADATA_ENCODING_JSON | Uint8Array |
METADATA_ENCODING_NULL | Uint8Array |
METADATA_ENCODING_PROTOBUF | Uint8Array |
METADATA_ENCODING_PROTOBUF_JSON | Uint8Array |
METADATA_ENCODING_RAW | Uint8Array |
encodingTypes
• Const encodingTypes: Object
Type declaration
| Name | Type |
|---|---|
METADATA_ENCODING_JSON | "json/plain" |
METADATA_ENCODING_NULL | "binary/null" |
METADATA_ENCODING_PROTOBUF | "binary/protobuf" |
METADATA_ENCODING_PROTOBUF_JSON | "json/protobuf" |
METADATA_ENCODING_RAW | "binary/plain" |
noopMetricMeter
• Const noopMetricMeter: NoopMetricMeter
rawPayloadTypeBrand
• Const rawPayloadTypeBrand: unique symbol
Functions
arrayFromPayloads
▸ arrayFromPayloads(converter, payloads?): unknown[]
Run PayloadConverter.fromPayload on each value in the array.
Parameters
| Name | Type |
|---|---|
converter | PayloadConverter |
payloads? | null | IPayload[] |
Returns
unknown[]
compilePriority
▸ compilePriority(priority): IPriority
Turn a TS Priority into a proto compatible Priority
Parameters
| Name | Type |
|---|---|
priority | Priority |
Returns
compileRetryPolicy
▸ compileRetryPolicy(retryPolicy): IRetryPolicy
Turn a TS RetryPolicy into a proto compatible RetryPolicy
Parameters
| Name | Type |
|---|---|
retryPolicy | RetryPolicy |
Returns
convertOptionalToPayload
▸ convertOptionalToPayload(payloadConverter, value): Payload | null | undefined
Run PayloadConverter.toPayload on an optional value, and then encode it.
Parameters
| Name | Type |
|---|---|
payloadConverter | PayloadConverter |
value | unknown |
Returns
Payload | null | undefined
cutoffStackTrace
▸ cutoffStackTrace(stack?): string
Cuts out the framework part of a stack trace, leaving only user code entries
Parameters
| Name | Type |
|---|---|
stack? | string |
Returns
string
decodeActivityCancellationType
▸ decodeActivityCancellationType(input): undefined | RemovePrefix<"", "TRY_CANCEL" | "WAIT_CANCELLATION_COMPLETED" | "ABANDON">
Parameters
| Name | Type |
|---|---|
input | undefined | null | ActivityCancellationType |
Returns
undefined | RemovePrefix<"", "TRY_CANCEL" | "WAIT_CANCELLATION_COMPLETED" | "ABANDON">
decodeApplicationFailureCategory
▸ decodeApplicationFailureCategory(input): undefined | "BENIGN"
Parameters
| Name | Type |
|---|---|
input | undefined | null | ApplicationErrorCategory |
Returns
undefined | "BENIGN"
decodePriority
▸ decodePriority(priority?): Priority
Turn a proto compatible Priority into a TS Priority
Parameters
| Name | Type |
|---|---|
priority? | null | IPriority |
Returns
decodeRetryState
▸ decodeRetryState(input): undefined | "IN_PROGRESS" | "NON_RETRYABLE_FAILURE" | "TIMEOUT" | "MAXIMUM_ATTEMPTS_REACHED" | "RETRY_POLICY_NOT_SET" | "INTERNAL_SERVER_ERROR" | "CANCEL_REQUESTED"
Parameters
| Name | Type |
|---|---|
input | undefined | null | RetryState |
Returns
undefined | "IN_PROGRESS" | "NON_RETRYABLE_FAILURE" | "TIMEOUT" | "MAXIMUM_ATTEMPTS_REACHED" | "RETRY_POLICY_NOT_SET" | "INTERNAL_SERVER_ERROR" | "CANCEL_REQUESTED"
decodeTimeoutType
▸ decodeTimeoutType(input): undefined | "START_TO_CLOSE" | "SCHEDULE_TO_START" | "SCHEDULE_TO_CLOSE" | "HEARTBEAT"
Parameters
| Name | Type |
|---|---|
input | undefined | null | TimeoutType |
Returns
undefined | "START_TO_CLOSE" | "SCHEDULE_TO_START" | "SCHEDULE_TO_CLOSE" | "HEARTBEAT"
decodeVersioningBehavior
▸ decodeVersioningBehavior(input): undefined | "PINNED" | "AUTO_UPGRADE"
Parameters
| Name | Type |
|---|---|
input | undefined | null | VersioningBehavior |
Returns
undefined | "PINNED" | "AUTO_UPGRADE"
decodeWorkflowIdConflictPolicy
▸ decodeWorkflowIdConflictPolicy(input): undefined | "FAIL" | "USE_EXISTING" | "TERMINATE_EXISTING"
Parameters
| Name | Type |
|---|---|
input | undefined | null | WorkflowIdConflictPolicy |
Returns
undefined | "FAIL" | "USE_EXISTING" | "TERMINATE_EXISTING"
decodeWorkflowIdReusePolicy
▸ decodeWorkflowIdReusePolicy(input): undefined | "ALLOW_DUPLICATE" | "ALLOW_DUPLICATE_FAILED_ONLY" | "REJECT_DUPLICATE" | "TERMINATE_IF_RUNNING"
Parameters
| Name | Type |
|---|---|
input | undefined | null | WorkflowIdReusePolicy |
Returns
undefined | "ALLOW_DUPLICATE" | "ALLOW_DUPLICATE_FAILED_ONLY" | "REJECT_DUPLICATE" | "TERMINATE_IF_RUNNING"
decompileRetryPolicy
▸ decompileRetryPolicy(retryPolicy?): RetryPolicy | undefined
Turn a proto compatible RetryPolicy into a TS RetryPolicy
Parameters
| Name | Type |
|---|---|
retryPolicy? | null | IRetryPolicy |
Returns
RetryPolicy | undefined
defineSearchAttributeKey
▸ defineSearchAttributeKey<T>(name, type): SearchAttributeKey<T>
Type parameters
| Name | Type |
|---|---|
T | extends SearchAttributeType |
Parameters
| Name | Type |
|---|---|
name | string |
type | T |
Returns
SearchAttributeKey<T>
encodeActivityCancellationType
▸ encodeActivityCancellationType(input): undefined | ActivityCancellationType
Parameters
| Name | Type |
|---|---|
input | undefined | null | ActivityCancellationType | RemovePrefix<"", "TRY_CANCEL" | "WAIT_CANCELLATION_COMPLETED" | "ABANDON"> |
Returns
undefined | ActivityCancellationType
encodeApplicationFailureCategory
▸ encodeApplicationFailureCategory(input): undefined | ApplicationErrorCategory
Parameters
| Name | Type |
|---|---|
input | undefined | null | ApplicationErrorCategory | "BENIGN" | "APPLICATION_ERROR_CATEGORY_BENIGN" |
Returns
undefined | ApplicationErrorCategory
encodeRetryState
▸ encodeRetryState(input): undefined | RetryState
Parameters
| Name | Type |
|---|---|
input | undefined | null | RetryState | "IN_PROGRESS" | "NON_RETRYABLE_FAILURE" | "TIMEOUT" | "MAXIMUM_ATTEMPTS_REACHED" | "RETRY_POLICY_NOT_SET" | "INTERNAL_SERVER_ERROR" | "CANCEL_REQUESTED" | "RETRY_STATE_IN_PROGRESS" | "RETRY_STATE_NON_RETRYABLE_FAILURE" | "RETRY_STATE_TIMEOUT" | "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" | "RETRY_STATE_RETRY_POLICY_NOT_SET" | "RETRY_STATE_INTERNAL_SERVER_ERROR" | "RETRY_STATE_CANCEL_REQUESTED" |
Returns
undefined | RetryState
encodeTimeoutType
▸ encodeTimeoutType(input): undefined | TimeoutType
Parameters
| Name | Type |
|---|---|
input | undefined | null | TimeoutType | "START_TO_CLOSE" | "SCHEDULE_TO_START" | "SCHEDULE_TO_CLOSE" | "HEARTBEAT" | "TIMEOUT_TYPE_START_TO_CLOSE" | "TIMEOUT_TYPE_SCHEDULE_TO_START" | "TIMEOUT_TYPE_SCHEDULE_TO_CLOSE" | "TIMEOUT_TYPE_HEARTBEAT" |
Returns
undefined | TimeoutType
encodeVersioningBehavior
▸ encodeVersioningBehavior(input): undefined | VersioningBehavior
Parameters
| Name | Type |
|---|---|
input | undefined | null | VersioningBehavior | "PINNED" | "AUTO_UPGRADE" | "VERSIONING_BEHAVIOR_PINNED" | "VERSIONING_BEHAVIOR_AUTO_UPGRADE" |
Returns
undefined | VersioningBehavior
encodeWorkflowIdConflictPolicy
▸ encodeWorkflowIdConflictPolicy(input): undefined | WorkflowIdConflictPolicy
Parameters
| Name | Type |
|---|---|
input | undefined | null | WorkflowIdConflictPolicy | "WORKFLOW_ID_CONFLICT_POLICY_TERMINATE_EXISTING" | "FAIL" | "USE_EXISTING" | "TERMINATE_EXISTING" | "WORKFLOW_ID_CONFLICT_POLICY_FAIL" | "WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING" |
Returns
undefined | WorkflowIdConflictPolicy
encodeWorkflowIdReusePolicy
▸ encodeWorkflowIdReusePolicy(input): undefined | WorkflowIdReusePolicy
Parameters
| Name | Type |
|---|---|
input | undefined | null | WorkflowIdReusePolicy | "ALLOW_DUPLICATE" | "ALLOW_DUPLICATE_FAILED_ONLY" | "REJECT_DUPLICATE" | "TERMINATE_IF_RUNNING" | "WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE" | "WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY" | "WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE" | "WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING" |
Returns
undefined | WorkflowIdReusePolicy
ensureApplicationFailure
▸ ensureApplicationFailure(error): ApplicationFailure
If error is already an ApplicationFailure, returns error.
Otherwise, converts error into an ApplicationFailure with:
message:error.messageorString(error)type:error.constructor.nameorerror.namestack:error.stackor''
Parameters
| Name | Type |
|---|---|
error | unknown |
Returns
ensureTemporalFailure
▸ ensureTemporalFailure(err): TemporalFailure
If err is an Error it is turned into an ApplicationFailure.
If err was already a TemporalFailure, returns the original error.
Otherwise returns an ApplicationFailure with String(err) as the message.
Parameters
| Name | Type |
|---|---|
err | unknown |
Returns
extractWorkflowType
▸ extractWorkflowType<T>(workflowTypeOrFunc): string
Type parameters
| Name | Type |
|---|---|
T | extends Workflow |
Parameters
| Name | Type |
|---|---|
workflowTypeOrFunc | string | T | WorkflowFunctionWithOptions<any[], any> |
Returns
string
fromPayloadsAtIndex
▸ fromPayloadsAtIndex<T>(converter, index, payloads?): T
Implements conversion of an array of values of different types. Useful for deserializing arguments of function invocations.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
converter | PayloadConverter | |
index | number | index of the value in the payloads |
payloads? | null | IPayload[] | serialized value to convert to JS values. |
Returns
T
converted JS value
Throws
PayloadConverterError if conversion of the data passed as parameter failed for any reason.
mapFromPayloads
▸ mapFromPayloads<K, T>(converter, map?): Record<K, T> | undefined
Type parameters
| Name | Type |
|---|---|
K | extends string |
T | unknown |
Parameters
| Name | Type |
|---|---|
converter | PayloadConverter |
map? | null | Record<K, IPayload> |
Returns
Record<K, T> | undefined
mapToPayloads
▸ mapToPayloads<K, T>(converter, map): Record<K, Payload>
Run PayloadConverter.toPayload on each value in the map.
Type parameters
| Name | Type |
|---|---|
K | extends string |
T | any |
Parameters
| Name | Type |
|---|---|
converter | PayloadConverter |
map | Record<K, T> |
Returns
Record<K, Payload>
Throws
ValueError if conversion of any value in the map fails
rootCause
▸ rootCause(error): string | undefined
Get the root cause message of given error.
In case error is a TemporalFailure, recurse the cause chain and return the root cause.message.
Otherwise, return error.message.
Parameters
| Name | Type |
|---|---|
error | unknown |
Returns
string | undefined
toCanonicalString
▸ toCanonicalString(version): string
Parameters
| Name | Type |
|---|---|
version | WorkerDeploymentVersion |
Returns
string
The canonical representation of a deployment version, which is a string in the format
deploymentName.buildId.
toPayloads
▸ toPayloads(converter, ...values): Payload[] | undefined
Implements conversion of a list of values.
Parameters
| Name | Type | Description |
|---|---|---|
converter | PayloadConverter | |
...values | unknown[] | JS values to convert to Payloads |
Returns
Payload[] | undefined
list of Payloads
Throws
ValueError if conversion of the value passed as parameter failed for any reason.