All files / json-crdt-server/src/services Services.ts

88.88% Statements 8/9
100% Branches 2/2
50% Functions 1/2
88.88% Lines 8/9

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 276x 6x 6x 6x               6x           105x 105x 105x              
import {PresenceService} from './PresenceService';
import {PubsubService} from './PubSubService';
import {BlocksServices, type BlocksServicesOpts} from './blocks/BlocksServices';
import {MemoryStore} from './blocks/store/MemoryStore';
import type {Store} from './blocks/store/types';
 
export interface ServicesOpts {
  store?: Store;
  blocks?: BlocksServicesOpts;
}
 
export class Services {
  public readonly pubsub: PubsubService;
  public readonly presence: PresenceService;
  public readonly blocks: BlocksServices;
 
  constructor({store = new MemoryStore(), blocks}: ServicesOpts = {}) {
    this.pubsub = new PubsubService();
    this.presence = new PresenceService();
    this.blocks = new BlocksServices(this, store, blocks);
  }
 
  async stop() {
    await this.blocks.stop();
  }
}