/** * The query parameters for a page of a paginated result, taken from the `Link` header of the response. * Fetching a page again with these parameters is equivalent to calling `first()`, `current()` or `next()` on an * Ably `PaginatedResult`. */ export type PageParams = Record; /** The links from a page of a paginated result to its related pages. */ export interface PageLinks { first?: PageParams; current?: PageParams; next?: PageParams; } /** A page of a paginated result, as returned from an activity. */ export interface WirePage { items: T[]; links: PageLinks; } /** A page of the result of `rest.request()`, as returned from an activity. */ export interface WireHttpPaginatedResponse extends WirePage { statusCode: number; success: boolean; errorCode?: number | null; errorMessage?: string | null; errorDetail?: Record; headers: Record; } /** Encodes bytes as a base64 string. */ export type Base64Encoder = (bytes: Uint8Array) => string; /** * Handles a binary value found by {@link toWireValue}, and returns the value to replace it with. * * @param bytes - The bytes of the binary value. * @param path - Where the value is, such as `messages[0].data.image`. */ export type BinaryHandler = (bytes: Uint8Array, path: string) => unknown; export declare function isBinary(value: unknown): value is ArrayBuffer | ArrayBufferView; /** * Sets an own enumerable property on `target`. A key of `__proto__` is defined as an own property, because * assigning it would set the prototype of `target` instead. */ export declare function setOwnProperty(target: Record, key: string, value: unknown): void; /** * Returns a copy of `value` that can be safely JSON-serialised: every binary value (an `ArrayBuffer`, or an * `ArrayBufferView` such as a `Uint8Array` or Node `Buffer`) is replaced with the result of `onBinary`, and every * other non-null object is copied to a plain object of its own enumerable properties. * * As with `JSON.stringify()`, an object with a `toJSON()` method is replaced by the result of calling it. A `Date` * is left for the payload converter to serialise as an ISO string, and an `Error` also keeps its non-enumerable * `message` and `cause`. */ export declare function toWireValue(value: unknown, onBinary: BinaryHandler): unknown; /** * Returns `message` with binary `data` encoded as base64, and `base64` appended to its `encoding`, as Ably's JSON * protocol sends binary data (RSL4d1). Anything else is returned as it is. The message passed in is not modified. * * @param message - A message, presence message or annotation. * @param base64 - Encodes the data as base64. */ export declare function encodeBinaryData(message: T, base64?: Base64Encoder): T; /** * Reverses {@link encodeBinaryData}: returns `message` with string `data` whose last `encoding` is `base64` decoded * to a `Uint8Array`, and that encoding removed. When no encoding remains, `encoding` is `null`, as for a message the * Ably SDK has decoded. Anything else is returned as it is. The message passed in is not modified. * * @param message - A message, presence message or annotation. */ export declare function decodeBinaryData(message: T): T; /** Applies {@link decodeBinaryData} to each item of a page of messages. The page passed in is not modified. */ export declare function decodePageData

>(page: P): P; /** * Returns a LiveObjects operation with `map` applied to the `bytes` of each value it publishes: the `value` of a * `mapSet`, and the `data` of each entry of a `mapCreate`. The operation passed in is not modified. */ export declare function mapOperationBytes(operation: T, map: (bytes: unknown) => unknown): T; /** * Returns a full-format LiveObjects `get()` result with `map` applied to the `bytes` of each value in it: those of a * leaf value, and those of each map entry, at any depth. The result passed in is not modified. */ export declare function mapFullObjectBytes(node: T, map: (bytes: unknown) => unknown): T; export declare function toBytes(value: ArrayBuffer | ArrayBufferView): Uint8Array; export declare function bytesToBase64(bytes: Uint8Array): string; export declare function base64ToBytes(base64: string): Uint8Array;