import * as operations from './operations';
import { type ITimestampStruct } from './clock';
import type { Printable } from 'tree-dump/lib/types';
/**
 * A union type of all possible JSON CRDT patch operations.
 */
export type JsonCrdtPatchOperation = operations.NewConOp | operations.NewValOp | operations.NewVecOp | operations.NewObjOp | operations.NewStrOp | operations.NewBinOp | operations.NewArrOp | operations.InsValOp | operations.InsObjOp | operations.InsVecOp | operations.InsStrOp | operations.InsBinOp | operations.InsArrOp | operations.UpdArrOp | operations.DelOp | operations.NopOp;
/**
 * Represents a JSON CRDT patch.
 *
 * Normally, you would create a new patch using the {@link PatchBuilder} class.
 *
 * ```ts
 * import {Patch, PatchBuilder, LogicalClock} from 'json-joy/lib/json-crdt-patch';
 *
 * const clock = new LogicalClock(3, 100);
 * const builder = new PatchBuilder(clock);
 * const patch = builder.flush();
 * ```
 *
 * Save patch to a binary representation:
 *
 * ```ts
 * const binary = patch.toBinary();
 * ```
 *
 * Load patch from a binary representation:
 *
 * ```ts
 * const patch = Patch.fromBinary(binary);
 * ```
 *
 * @category Patch
 */
export declare class Patch implements Printable {
    /**
     * Un-marshals a JSON CRDT patch from a binary representation.
     */
    static fromBinary(data: Uint8Array): Patch;
    /**
     * A list of operations in the patch.
     */
    ops: JsonCrdtPatchOperation[];
    /**
     * Arbitrary metadata associated with the patch, which is not used by the
     * library.
     */
    meta: unknown;
    /**
     * Returns the patch ID, which is equal to the ID of the first operation
     * in the patch.
     *
     * @returns The ID of the first operation in the patch.
     */
    getId(): ITimestampStruct | undefined;
    /**
     * Returns the total time span of the patch, which is the sum of all
     * operation spans.
     *
     * @returns The length of the patch.
     */
    span(): number;
    /**
     * Returns the expected time of the next inserted operation.
     */
    nextTime(): number;
    /**
     * Creates a new patch where all timestamps are transformed using the
     * provided function.
     *
     * @param ts Timestamp transformation function.
     * @returns A new patch with transformed timestamps.
     */
    rewriteTime(ts: (id: ITimestampStruct) => ITimestampStruct): Patch;
    /**
     * The `.rebase()` operation is meant to be applied to patches which have not
     * yet been advertised to the server (other peers), or when
     * the server clock is used and concurrent change on the server happened.
     *
     * The .rebase() operation returns a new `Patch` with the IDs recalculated
     * such that the first operation has the `time` equal to `newTime`.
     *
     * @param newTime Time where the patch ID should begin (ID of the first operation).
     * @param transformAfter Time after (and including) which the IDs should be
     *     transformed. If not specified, equals to the time of the first operation.
     */
    rebase(newTime: number, transformAfter?: number): Patch;
    /**
     * Creates a deep clone of the patch.
     *
     * @returns A deep clone of the patch.
     */
    clone(): Patch;
    /**
     * Marshals the patch into a binary representation.
     *
     * @returns A binary representation of the patch.
     */
    toBinary(): Uint8Array<ArrayBufferLike>;
    /**
     * Returns a textual human-readable representation of the patch. This can be
     * used for debugging purposes.
     *
     * @param tab Start string for each line.
     * @returns Text representation of the patch.
     */
    toString(tab?: string): string;
}
