@hocuspocus/extension-redis 2.6.1 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ export interface DatabaseConfiguration {
8
8
  /**
9
9
  * Pass a function to store updates in your database.
10
10
  */
11
- store: (data: storePayload) => void;
11
+ store: (data: storePayload) => Promise<void>;
12
12
  }
13
13
  export declare class Database implements Extension {
14
14
  /**
@@ -91,7 +91,6 @@ export declare class HocuspocusProvider extends EventEmitter {
91
91
  boundBroadcastChannelSubscriber: (data: ArrayBuffer) => void;
92
92
  boundPageUnload: () => void;
93
93
  boundOnOpen: (event: Event) => Promise<void>;
94
- boundOnMessage: (event: MessageEvent) => void;
95
94
  boundOnClose: (event: CloseEvent) => void;
96
95
  boundOnStatus: ({ status }: onStatusParameters) => void;
97
96
  forwardConnect: (e: any) => this;
@@ -77,6 +77,10 @@ export interface CompleteHocuspocusProviderWebsocketConfiguration {
77
77
  * Don’t output any warnings.
78
78
  */
79
79
  quiet: boolean;
80
+ /**
81
+ * Map of attached providers keyed by documentName.
82
+ */
83
+ providerMap: Map<string, HocuspocusProvider>;
80
84
  }
81
85
  export declare class HocuspocusProviderWebsocket extends EventEmitter {
82
86
  private messageQueue;
@@ -6,6 +6,7 @@ export declare class IncomingMessage {
6
6
  encoder: Encoder;
7
7
  decoder: Decoder;
8
8
  constructor(data: any);
9
+ peekVarString(): string;
9
10
  readVarUint(): MessageType;
10
11
  readVarString(): string;
11
12
  readVarUint8Array(): Uint8Array;
@@ -10,5 +10,5 @@ export declare class DirectConnection implements DirectConnectionInterface {
10
10
  */
11
11
  constructor(document: Document, instance: Hocuspocus, context?: any);
12
12
  transact(transaction: (document: Document) => void, transactionOrigin?: any): Promise<void>;
13
- disconnect(): void;
13
+ disconnect(): Promise<void>;
14
14
  }
@@ -19,6 +19,7 @@ export declare class Document extends Doc {
19
19
  mux: mutex;
20
20
  logger: Debugger;
21
21
  isLoading: boolean;
22
+ isDestroyed: boolean;
22
23
  /**
23
24
  * Constructor.
24
25
  */
@@ -87,5 +88,6 @@ export declare class Document extends Doc {
87
88
  * Broadcast stateless message to all connections
88
89
  */
89
90
  broadcastStateless(payload: string): void;
91
+ destroy(): void;
90
92
  }
91
93
  export default Document;
@@ -82,7 +82,7 @@ export declare class Hocuspocus {
82
82
  * Create a new document by the given request
83
83
  */
84
84
  createDocument(documentName: string, request: Partial<Pick<IncomingMessage, 'headers' | 'url'>>, socketId: string, connection: ConnectionConfiguration, context?: any): Promise<Document>;
85
- storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload): void;
85
+ storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload): Promise<void>;
86
86
  /**
87
87
  * Run the given hook on all configured extensions.
88
88
  * Runs the given callback after each hook.
@@ -131,6 +131,7 @@ export interface onStatelessPayload {
131
131
  payload: string;
132
132
  }
133
133
  export interface onAuthenticatePayload {
134
+ context: any;
134
135
  documentName: string;
135
136
  instance: Hocuspocus;
136
137
  requestHeaders: IncomingHttpHeaders;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-redis",
3
- "version": "2.6.1",
3
+ "version": "2.7.1",
4
4
  "description": "Scale Hocuspocus horizontally with Redis",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -33,7 +33,7 @@
33
33
  "@types/redlock": "^4.0.3"
34
34
  },
35
35
  "dependencies": {
36
- "@hocuspocus/server": "^2.6.1",
36
+ "@hocuspocus/server": "^2.7.1",
37
37
  "ioredis": "^4.28.2",
38
38
  "kleur": "^4.1.4",
39
39
  "lodash.debounce": "^4.0.8",