All files / collaborative-presence/src constants.ts

100% Statements 8/8
100% Branches 2/2
100% Functions 1/1
100% Lines 8/8

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 26 27              5x                     5x 5x 5x 5x 5x 5x 5x    
import type {JsonCrdtDataType} from 'json-joy/lib/json-crdt-patch/constants';
 
/**
 * Runtime-safe mirror of json-joy's {@link JsonCrdtDataType}. That enum is
 * declared as a `const enum`, so it is erased from the emitted JS and reads as
 * `undefined` at runtime whenever this package is transpiled file-by-file.
 */
export const NodeType = {
  con: 0 as JsonCrdtDataType.con,
  val: 1 as JsonCrdtDataType.val,
  obj: 2 as JsonCrdtDataType.obj,
  vec: 3 as JsonCrdtDataType.vec,
  str: 4 as JsonCrdtDataType.str,
  bin: 5 as JsonCrdtDataType.bin,
  arr: 6 as JsonCrdtDataType.arr,
};
 
/** Indices into the {@link UserPresence} tuple. */
export enum UserPresenceIdx {
  UserId = 0,
  ProcessId = 1,
  Seq = 2,
  Ts = 3,
  Selections = 4,
  Meta = 5,
}