import type { temporal } from '@temporalio/proto'; import type { Payload } from '../interfaces'; import type { PayloadCodec } from '../converter/payload-codec'; import type { ProtoFailure } from '../failure'; import type { LoadedDataConverter } from '../converter/data-converter'; import type { UserMetadata } from '../user-metadata'; import type { TypeInfo } from '../type-info'; import type { SerializationContext } from '../converter/serialization-context'; import type { DecodedPayload, DecodedProtoFailure, EncodedPayload, EncodedProtoFailure } from './codec-types'; /** * Decode through each codec, starting with the last codec. */ export declare function decode(codecs: PayloadCodec[], payloads: Payload[], context?: SerializationContext): Promise; /** * Encode through each codec, starting with the first codec. */ export declare function encode(codecs: PayloadCodec[], payloads: Payload[], context?: SerializationContext): Promise; /** Run {@link PayloadCodec.decode} on a single Payload */ export declare function decodeOptionalSingle(codecs: PayloadCodec[], payload: Payload | null | undefined, context?: SerializationContext): Promise; /** Run {@link PayloadCodec.decode} and convert from a single Payload */ export declare function decodeOptionalSinglePayload(dataConverter: LoadedDataConverter, payload?: Payload | null | undefined, context?: SerializationContext): Promise; /** Apply optional TypeInfo, run payload conversion, and then encode the resulting Payload. */ export declare function encodeToPayload(converter: LoadedDataConverter, value: T, context?: SerializationContext, typeInfo?: TypeInfo): Promise; /** * Decode `payloads` and then return {@link arrayFromPayloads}`. */ export declare function decodeArrayFromPayloads(converter: LoadedDataConverter, payloads?: Payload[] | null, context?: SerializationContext, typeInfo?: readonly TypeInfo[]): Promise; /** * Decode `payloads` and then return {@link fromPayloadsAtIndex}. */ export declare function decodeFromPayloadsAtIndex(converter: LoadedDataConverter, index: number, payloads?: Payload[] | null, context?: SerializationContext, typeInfo?: TypeInfo): Promise; /** * Run {@link decodeFailure} and then return {@link failureToError}. */ export declare function decodeOptionalFailureToOptionalError(converter: LoadedDataConverter, failure: ProtoFailure | undefined | null, context?: SerializationContext): Promise; /** * Run {@link PayloadConverter.toPayload} on values, and then encode them. */ export declare function encodeToPayloads(converter: LoadedDataConverter, ...values: unknown[]): Promise; /** * Run {@link PayloadConverter.toPayload} on values with an optional serialization context, and then encode them. */ export declare function encodeToPayloadsWithContext(converter: LoadedDataConverter, context: SerializationContext | undefined, values: unknown[], typeInfo?: readonly TypeInfo[]): Promise; /** * Run {@link PayloadCodec.decode} and then {@link PayloadConverter.fromPayload} on values in `map`. */ export declare function decodeMapFromPayloads(converter: LoadedDataConverter, map: Record | null | undefined, context?: SerializationContext): Promise | undefined>; /** * Run {@link PayloadConverter.toPayload} and then {@link PayloadCodec.encode} on values in `map`. */ export declare function encodeMapToPayloads(converter: LoadedDataConverter, map: Record, context?: SerializationContext): Promise>; /** * Run {@link errorToFailure} on `error`, and then {@link encodeFailure}. */ export declare function encodeErrorToFailure(dataConverter: LoadedDataConverter, error: unknown, context?: SerializationContext): Promise; /** * Return a new {@link ProtoFailure} with `codec.encode()` run on all the {@link Payload}s. */ export declare function encodeFailure(codecs: PayloadCodec[], failure: ProtoFailure, context?: SerializationContext): Promise; /** * Return a new {@link ProtoFailure} with `codec.decode()` run on all the {@link Payload}s. */ export declare function decodeFailure(codecs: PayloadCodec[], failure: ProtoFailure, context?: SerializationContext): Promise; export declare function encodeUserMetadata(dataConverter: LoadedDataConverter, staticSummary: string | undefined, staticDetails: string | undefined, context?: SerializationContext): Promise; export declare function decodeUserMetadata(dataConverter: LoadedDataConverter, metadata: temporal.api.sdk.v1.IUserMetadata | undefined | null, context?: SerializationContext): Promise;