import Databox from "../Databox"; import Socket from '../../Socket'; import { DeepReadonly } from '../../../main/utils/typeUtils'; import { DbContentAPI, DataboxContentCompatible } from '../../../main/databox/dbContentAPI'; export default class DataboxContainer implements DataboxContentCompatible { private readonly _databoxes; private readonly _count; constructor(databoxes: Databox[]); get databoxes(): Databox[]; /** * @description * The content API provides a typesafe and readable way to * update, delete, or insert new data in the databox. * It is also possible to do multiple cud operations in one bundle. * Don't forget to update your database before updating the databox. */ readonly content: DbContentAPI; /** * The close function will close a Databox member for every client on every server. * You optionally can provide a code or any other information for the client. * Usually, the close function is used when the data is completely deleted from the system. * For example, a chat that doesn't exist anymore. * @param member The member to close * @param code * @param metadata * @param forEveryServer * @return The returned promise is resolved when * the close is fully processed on the current server. */ close(member: M, code?: number | string, metadata?: any, forEveryServer?: boolean): Promise; /** * The reload function will force all connected * clients of the Databox member to reload the data. * @param member * @param forEveryServer */ forceReload(member: M, forEveryServer?: boolean): void; /** * With this function, you can kick out a socket from a member of the Databox. * This method is used internally. * @param member * @param socket * @param code * @param metadata */ kickOut(member: M, socket: Socket, code?: number | string, metadata?: any): void; /** * With this function, you can do a recheck of all sockets on a specific member. * It can be useful when the access rights to member have changed, * and you want to kick out all sockets that not have access anymore. * Notice that the promise is resolved when the access was checked * on the current server and request sent to other servers. * @param member * @param forEveryServer */ recheckMemberAccess(member: M, forEveryServer?: boolean): Promise; /** * Transmit a signal to all client Databoxes that * are connected with a specific member of this Databox. * The clients can listen to any received signal. * You also can send additional data with the signal. * @param member * @param signal * @param data * @param forEveryServer */ transmitSignal(member: M, signal: string, data?: any, forEveryServer?: boolean): void; /** * This method returns an array with all * members where the socket is registered. * @param socket */ getSocketRegMembers(socket: Socket): DeepReadonly[]; }