import { IClient , ISignalClient } from "@fluidframework/protocol-definitions" ; import { IClientManager } from "@fluidframework/server-services-core" ; export class TestClientManager implements IClientManager { private readonly clients : Map < string , Map < string , Map < string , IClient > > > = new Map ( ) ; public async addClient ( tenantId , documentId , clientId , details ) { if ( ! this . clients . has ( tenantId ) ) { this . clients . set ( tenantId , new Map ( ) ) ; } if ( ! this . clients . get ( tenantId ) . has ( documentId ) ) { this . clients . get ( tenantId ) . set ( documentId , new Map ( ) ) ; } this . clients . get ( tenantId ) . get ( documentId ) . set ( clientId , details ) ; } public async removeClient ( tenantId , documentId , clientId ) { if ( this . clients . has ( tenantId ) && this . clients . get ( tenantId ) . has ( documentId ) ) { this . clients . get ( tenantId ) . get ( documentId ) . delete ( clientId ) ; } } public async getClients ( tenantId , documentId ) { const signalClients = [ ] ; if ( this . clients . has ( tenantId ) && this . clients . get ( tenantId ) . has ( documentId ) ) { for ( const [ clientId , client ] of this . clients . get ( tenantId ) . get ( documentId ) ) { signalClients . push ( { clientId , client } ) ; } } return signalClients ; } }