All files / json-crdt/log/codec logEncoderOpts.ts

100% Statements 10/10
100% Branches 0/0
100% Functions 0/0
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 262x 2x 2x 2x 2x 2x 2x 2x     2x           2x                  
import {Writer} from '@jsonjoy.com/util/lib/buffers/Writer';
import {Encoder as SidecarEncoder} from '../../codec/sidecar/binary/Encoder';
import {Encoder as StructuralEncoderCompact} from '../../codec/structural/compact/Encoder';
import {Encoder as StructuralEncoderVerbose} from '../../codec/structural/verbose/Encoder';
import {encode as encodeCompact} from '../../../json-crdt-patch/codec/compact/encode';
import {encode as encodeVerbose} from '../../../json-crdt-patch/codec/verbose/encode';
import {CborEncoder} from '@jsonjoy.com/json-pack/lib/cbor/CborEncoder';
import {JsonEncoder} from '@jsonjoy.com/json-pack/lib/json/JsonEncoder';
import type {LogEncoderOpts} from './LogEncoder';
 
const writer = new Writer(4096);
 
/**
 * Default {@link LogEncoderOpts} for {@link LogEncoder}. Instantiates all
 * possible encoders.
 */
export const logEncoderOpts: LogEncoderOpts = {
  jsonEncoder: new JsonEncoder(writer),
  cborEncoder: new CborEncoder(writer),
  structuralCompactEncoder: new StructuralEncoderCompact(),
  structuralVerboseEncoder: new StructuralEncoderVerbose(),
  sidecarEncoder: new SidecarEncoder(),
  patchCompactEncoder: encodeCompact,
  patchVerboseEncoder: encodeVerbose,
};