diff --git a/types/sharedb/lib/client.d.ts b/types/sharedb/lib/client.d.ts index f3275b8a19..a406a1fa2c 100644 --- a/types/sharedb/lib/client.d.ts +++ b/types/sharedb/lib/client.d.ts @@ -1,9 +1,15 @@ /// import * as WS from 'ws'; import * as ShareDB from './sharedb'; +import Agent = require('./agent'); export class Connection { constructor(ws: WebSocket | WS); + + // This direct reference from connection to agent is not used internal to + // ShareDB, but it is handy for server-side only user code that may cache + // state on the agent and read it in middleware + agent: Agent | null; get(collectionName: string, documentID: string): Doc; createFetchQuery(collectionName: string, query: any, options: {results?: Query[]}, callback: (err: Error, results: any[]) => void): Query; createSubscribeQuery(collectionName: string, query: any, options: {results?: Query[]}, callback: (err: Error, results: any[]) => void): Query;