UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

31 lines (30 loc) 1.04 kB
import { CrdtReader } from '../../util/binary/CrdtReader'; import { type ITimespanStruct, type ITimestampStruct } from '../../clock'; import type { Patch } from '../../Patch'; import { PatchBuilder } from '../../PatchBuilder'; import { CborDecoder } from '@jsonjoy.com/json-pack/lib/cbor/CborDecoder'; /** * JSON CRDT Patch "binary" codec decoder. */ export declare class Decoder extends CborDecoder<CrdtReader> { protected builder: PatchBuilder; private patchSid?; /** * Creates a new JSON CRDT patch decoder. * * @param reader An optional custom implementation of a CRDT decoder. */ constructor(reader?: CrdtReader); /** * Decodes a JSON CRDT patch from a binary blob. * * @param data Binary data to decode. * @returns A JSON CRDT patch. */ decode(data: Uint8Array): Patch; readPatch(): Patch; protected decodeId(): ITimestampStruct; protected decodeTss(): ITimespanStruct; protected decodeOperations(): void; protected decodeOperation(): void; }