@hocuspocus/extension-redis 1.0.0-alpha.69 → 1.0.0-beta.2

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.
@@ -121,8 +121,9 @@ export declare class HocuspocusProvider extends EventEmitter {
121
121
  } | null;
122
122
  constructor(configuration: HocuspocusProviderConfiguration);
123
123
  setConfiguration(configuration?: Partial<HocuspocusProviderConfiguration>): void;
124
- boundConnect: () => Promise<void>;
125
- connect(): Promise<void>;
124
+ boundConnect: () => Promise<unknown>;
125
+ cancelWebsocketRetry?: () => void;
126
+ connect(): Promise<unknown>;
126
127
  createWebSocketConnection(): Promise<unknown>;
127
128
  resolveConnectionAttempt(): void;
128
129
  stopConnectionAttempt(): void;
@@ -26,6 +26,10 @@ export declare class Connection {
26
26
  * Set a callback that will be triggered when the connection is closed
27
27
  */
28
28
  onClose(callback: (document: Document) => void): Connection;
29
+ /**
30
+ * Set a callback that will be triggered before an message is handled
31
+ */
32
+ beforeHandleMessage(callback: (payload: Document, update: Uint8Array) => Promise<any>): Connection;
29
33
  /**
30
34
  * Send the given message
31
35
  */
@@ -36,6 +36,7 @@ export interface Extension {
36
36
  onCreateDocument?(data: onLoadDocumentPayload): Promise<any>;
37
37
  onLoadDocument?(data: onLoadDocumentPayload): Promise<any>;
38
38
  afterLoadDocument?(data: onLoadDocumentPayload): Promise<any>;
39
+ beforeHandleMessage?(data: beforeHandleMessagePayload): Promise<any>;
39
40
  onChange?(data: onChangePayload): Promise<any>;
40
41
  onStoreDocument?(data: onStoreDocumentPayload): Promise<any>;
41
42
  afterStoreDocument?(data: afterStoreDocumentPayload): Promise<any>;
@@ -48,7 +49,7 @@ export declare type HookName = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onCon
48
49
  /**
49
50
  * @deprecated onCreateDocument is deprecated, use onLoadDocument instead
50
51
  */
51
- 'onCreateDocument' | 'onLoadDocument' | 'afterLoadDocument' | 'onChange' | 'onStoreDocument' | 'afterStoreDocument' | 'onAwarenessUpdate' | 'onRequest' | 'onDisconnect' | 'onDestroy';
52
+ 'onCreateDocument' | 'onLoadDocument' | 'afterLoadDocument' | 'beforeHandleMessage' | 'onChange' | 'onStoreDocument' | 'afterStoreDocument' | 'onAwarenessUpdate' | 'onRequest' | 'onDisconnect' | 'onDestroy';
52
53
  export declare type HookPayload = onConfigurePayload | onListenPayload | onUpgradePayload | onConnectPayload | connectedPayload | onAuthenticatePayload | onLoadDocumentPayload | onChangePayload | onStoreDocumentPayload | afterStoreDocumentPayload | onAwarenessUpdatePayload | onRequestPayload | onDisconnectPayload | onDestroyPayload;
53
54
  export interface Configuration extends Extension {
54
55
  /**
@@ -155,6 +156,17 @@ export interface onChangePayload {
155
156
  update: Uint8Array;
156
157
  socketId: string;
157
158
  }
159
+ export interface beforeHandleMessagePayload {
160
+ clientsCount: number;
161
+ context: any;
162
+ document: Document;
163
+ documentName: string;
164
+ instance: Hocuspocus;
165
+ requestHeaders: IncomingHttpHeaders;
166
+ requestParameters: URLSearchParams;
167
+ update: Uint8Array;
168
+ socketId: string;
169
+ }
158
170
  export interface onStoreDocumentPayload {
159
171
  clientsCount: number;
160
172
  context: any;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-redis",
3
- "version": "1.0.0-alpha.69",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Scale Hocuspocus horizontally with Redis",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -32,7 +32,7 @@
32
32
  "@types/redlock": "^4.0.3"
33
33
  },
34
34
  "dependencies": {
35
- "@hocuspocus/server": "^1.0.0-alpha.106",
35
+ "@hocuspocus/server": "^1.0.0-beta.2",
36
36
  "ioredis": "^4.28.2",
37
37
  "kleur": "^4.1.4",
38
38
  "lodash.debounce": "^4.0.8",
@@ -41,5 +41,5 @@
41
41
  "y-protocols": "^1.0.5",
42
42
  "yjs": "^13.5.23"
43
43
  },
44
- "gitHead": "6074a6cb832b40bc579f28db2823ba5723887312"
44
+ "gitHead": "b3454a4ca289a84ddfb7fa5607a2d4b8d5c37e9d"
45
45
  }
package/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021, überdosis GbR
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.