Skip to main content

Interface: PayloadConverter

common.PayloadConverter

Used by the framework to serialize/deserialize data like parameters and return values.

This is called inside the Workflow isolate. To write async code or use Node APIs (or use packages that use Node APIs), use a PayloadCodec.

Implemented by​

Properties​

validateConverterHint​

• Optional validateConverterHint: (hint: ConverterHint<unknown>) => boolean

Return whether this converter can handle the supplied converter hint.

Implementations may also use this method to validate hints within toPayload and fromPayload.

Type declaration​

▸ (hint): boolean

Parameters​
NameType
hintConverterHint<unknown>
Returns​

boolean

Methods​

fromPayload​

▸ fromPayload<T>(payload, context?, hint?): T

Converts a Payload back to a value.

Type parameters​

Name
T

Parameters​

NameType
payloadIPayload
context?SerializationContext
hint?ConverterHint<T>

Returns​

T


toPayload​

▸ toPayload<T>(value, context?, hint?): IPayload

Converts a value to a Payload.

Type parameters​

Name
T

Parameters​

NameTypeDescription
valueTThe value to convert. Example values include the Workflow args sent from the Client and the values returned by a Workflow or Activity.
context?SerializationContext-
hint?ConverterHint<T>-

Returns​

IPayload

The Payload.

Should throw ValueError if unable to convert.