Variable converterConst

converter: {
    PbChangeID: typeof ChangeID;
    bytesToChangeID: ((bytes) => ChangeID);
    bytesToHex: ((bytes?) => string);
    bytesToObject: ((bytes?) => CRDTObject);
    bytesToOperation: ((bytes) => Operation);
    bytesToSnapshot: (<P>(bytes?) => {
        presences: Map<ActorID, P>;
        root: CRDTObject;
    });
    fromChangePack: (<P>(pbPack) => ChangePack<P>);
    fromChanges: (<P>(pbChanges) => Change<P>[]);
    fromPresence: (<P>(pbPresence) => P);
    fromTreeNodes: ((pbTreeNodes) => CRDTTreeNode | undefined);
    hexToBytes: ((hex) => Uint8Array);
    hexToVersionVector: ((hex) => VersionVector);
    objectToBytes: ((obj) => Uint8Array);
    toChangeID: ((changeID) => PbChangeID);
    toChangePack: ((pack) => PbChangePack);
    toHexString: ((bytes) => string);
    toOperation: ((operation) => PbOperation);
    toTreeNodes: ((node) => PbTreeNode[]);
    toUint8Array: ((hex) => Uint8Array);
    versionVectorToHex: ((vector) => string);
} = ...

converter is a converter that converts the given model to protobuf format. is also used to convert models to bytes and vice versa.

Type declaration

  • PbChangeID: typeof ChangeID
  • bytesToChangeID: ((bytes) => ChangeID)
      • (bytes): ChangeID
      • bytesToChangeID creates a ChangeID from the given bytes.

        Parameters

        • bytes: Uint8Array

        Returns ChangeID

  • bytesToHex: ((bytes?) => string)
      • (bytes?): string
      • bytesToHex creates an hex string from the given byte array.

        Parameters

        • Optional bytes: Uint8Array

        Returns string

  • bytesToObject: ((bytes?) => CRDTObject)
      • (bytes?): CRDTObject
      • bytesToObject creates an JSONObject from the given byte array.

        Parameters

        • Optional bytes: Uint8Array

        Returns CRDTObject

  • bytesToOperation: ((bytes) => Operation)
      • (bytes): Operation
      • bytesToOperation creates an Operation from the given bytes.

        Parameters

        • bytes: Uint8Array

        Returns Operation

  • bytesToSnapshot: (<P>(bytes?) => {
        presences: Map<ActorID, P>;
        root: CRDTObject;
    })
      • <P>(bytes?): {
            presences: Map<ActorID, P>;
            root: CRDTObject;
        }
      • bytesToSnapshot creates a Snapshot from the given byte array.

        Type Parameters

        Parameters

        • Optional bytes: Uint8Array

        Returns {
            presences: Map<ActorID, P>;
            root: CRDTObject;
        }

        • presences: Map<ActorID, P>
        • root: CRDTObject
  • fromChangePack: (<P>(pbPack) => ChangePack<P>)
      • <P>(pbPack): ChangePack<P>
      • fromChangePack converts the given Protobuf format to model format.

        Type Parameters

        Parameters

        • pbPack: ChangePack

        Returns ChangePack<P>

  • fromChanges: (<P>(pbChanges) => Change<P>[])
      • <P>(pbChanges): Change<P>[]
      • fromChanges converts the given Protobuf format to model format.

        Type Parameters

        Parameters

        • pbChanges: Change[]

        Returns Change<P>[]

  • fromPresence: (<P>(pbPresence) => P)
      • <P>(pbPresence): P
      • fromPresence converts the given Protobuf format to model format.

        Type Parameters

        Parameters

        • pbPresence: Presence

        Returns P

  • fromTreeNodes: ((pbTreeNodes) => CRDTTreeNode | undefined)
      • (pbTreeNodes): CRDTTreeNode | undefined
      • fromTreeNodes converts the given Protobuf format to model format.

        Parameters

        • pbTreeNodes: TreeNode[]

        Returns CRDTTreeNode | undefined

  • hexToBytes: ((hex) => Uint8Array)
      • (hex): Uint8Array
      • hexToBytes converts the given hex string to byte array.

        Parameters

        • hex: string

        Returns Uint8Array

  • hexToVersionVector: ((hex) => VersionVector)
  • objectToBytes: ((obj) => Uint8Array)
      • (obj): Uint8Array
      • objectToBytes converts the given JSONObject to byte array.

        Parameters

        • obj: CRDTObject

        Returns Uint8Array

  • toChangeID: ((changeID) => PbChangeID)
      • (changeID): PbChangeID
      • toChangeID converts the given model to Protobuf format.

        Parameters

        • changeID: ChangeID

        Returns PbChangeID

  • toChangePack: ((pack) => PbChangePack)
      • (pack): PbChangePack
      • toChangePack converts the given model to Protobuf format.

        Parameters

        Returns PbChangePack

  • toHexString: ((bytes) => string)
      • (bytes): string
      • toHexString converts the given byte array to hex string.

        Parameters

        • bytes: Uint8Array

        Returns string

  • toOperation: ((operation) => PbOperation)
      • (operation): PbOperation
      • toOperation converts the given model to Protobuf format.

        Parameters

        • operation: Operation

        Returns PbOperation

  • toTreeNodes: ((node) => PbTreeNode[])
      • (node): PbTreeNode[]
      • toTreeNodes converts the given model to Protobuf format.

        Parameters

        • node: CRDTTreeNode

        Returns PbTreeNode[]

  • toUint8Array: ((hex) => Uint8Array)
      • (hex): Uint8Array
      • toUnit8Array converts the given hex string to byte array.

        Parameters

        • hex: string

        Returns Uint8Array

  • versionVectorToHex: ((vector) => string)
      • (vector): string
      • versionVectorToHex converts the given VersionVector to bytes.

        Parameters

        Returns string