@hocuspocus/extension-redis 1.0.0-alpha.55 → 1.0.0-alpha.59
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.
- package/dist/packages/common/src/awarenessStatesToArray.d.ts +3 -0
- package/dist/packages/common/src/index.d.ts +2 -0
- package/dist/packages/common/src/types.d.ts +10 -0
- package/dist/packages/extension-monitor/src/index.d.ts +2 -2
- package/dist/packages/extension-throttle/src/index.d.ts +6 -2
- package/dist/packages/provider/src/HocuspocusProvider.d.ts +2 -2
- package/dist/packages/provider/src/index.d.ts +0 -1
- package/dist/packages/server/src/MessageReceiver.d.ts +1 -1
- package/dist/packages/server/src/types.d.ts +11 -11
- package/dist/tests/extension-throttle/configuration.d.ts +1 -0
- package/dist/tests/provider/observe.d.ts +1 -0
- package/dist/tests/provider/observeDeep.d.ts +1 -0
- package/package.json +3 -3
- package/dist/packages/provider/src/utils/awarenessStatesToArray.d.ts +0 -4
- package/dist/packages/provider/src/utils/index.d.ts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { Extension, onChangePayload, onConfigurePayload,
|
|
2
|
+
import { Extension, onChangePayload, onConfigurePayload, onLoadDocumentPayload, onDisconnectPayload, onRequestPayload, onUpgradePayload, connectedPayload } from '@hocuspocus/server';
|
|
3
3
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
4
4
|
import WebSocket from 'ws';
|
|
5
5
|
import { Storage } from './Storage';
|
|
@@ -30,7 +30,7 @@ export declare class Monitor implements Extension {
|
|
|
30
30
|
handleConnection(websocket: WebSocket, request: IncomingMessage): void | undefined;
|
|
31
31
|
onRequest({ request, response }: onRequestPayload): Promise<void>;
|
|
32
32
|
onUpgrade({ request, socket, head }: onUpgradePayload): Promise<void>;
|
|
33
|
-
|
|
33
|
+
connected(data: connectedPayload): Promise<void>;
|
|
34
34
|
onDisconnect(data: onDisconnectPayload): Promise<void>;
|
|
35
35
|
onLoadDocument(data: onLoadDocumentPayload): Promise<void>;
|
|
36
36
|
onChange(data: onChangePayload): Promise<void>;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { Extension, onConnectPayload } from '@hocuspocus/server';
|
|
2
|
-
export interface
|
|
2
|
+
export interface ThrottleConfiguration {
|
|
3
3
|
throttle: number | null | false;
|
|
4
4
|
banTime: number;
|
|
5
5
|
}
|
|
6
6
|
export declare class Throttle implements Extension {
|
|
7
|
-
configuration:
|
|
7
|
+
configuration: ThrottleConfiguration;
|
|
8
8
|
connectionsByIp: Map<string, Array<number>>;
|
|
9
9
|
bannedIps: Map<string, number>;
|
|
10
|
+
/**
|
|
11
|
+
* Constructor
|
|
12
|
+
*/
|
|
13
|
+
constructor(configuration?: Partial<ThrottleConfiguration>);
|
|
10
14
|
/**
|
|
11
15
|
* Throttle requests
|
|
12
16
|
* @private
|
|
@@ -133,6 +133,7 @@ export declare class HocuspocusProvider extends EventEmitter {
|
|
|
133
133
|
connect(): Promise<void>;
|
|
134
134
|
createWebSocketConnection(): Promise<unknown>;
|
|
135
135
|
resolveConnectionAttempt(): void;
|
|
136
|
+
stopConnectionAttempt(): void;
|
|
136
137
|
rejectConnectionAttempt(): void;
|
|
137
138
|
get document(): Y.Doc;
|
|
138
139
|
get awareness(): Awareness;
|
|
@@ -149,9 +150,8 @@ export declare class HocuspocusProvider extends EventEmitter {
|
|
|
149
150
|
set synced(state: boolean);
|
|
150
151
|
get isAuthenticationRequired(): boolean;
|
|
151
152
|
disconnect(): void;
|
|
152
|
-
onOpen(event: Event): void
|
|
153
|
+
onOpen(event: Event): Promise<void>;
|
|
153
154
|
getToken(): Promise<string | null>;
|
|
154
|
-
webSocketConnectionEstablished(): Promise<void>;
|
|
155
155
|
startSync(): void;
|
|
156
156
|
send(Message: ConstructableOutgoingMessage, args: any, broadcast?: boolean): void;
|
|
157
157
|
onMessage(event: MessageEvent): void;
|
|
@@ -8,6 +8,6 @@ export declare class MessageReceiver {
|
|
|
8
8
|
logger: Debugger;
|
|
9
9
|
constructor(message: IncomingMessage, logger: Debugger);
|
|
10
10
|
apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): void;
|
|
11
|
-
readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): 0 |
|
|
11
|
+
readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): 0 | 2 | 1;
|
|
12
12
|
applyQueryAwarenessMessage(awareness: Awareness, reply?: (message: Uint8Array) => void): void;
|
|
13
13
|
}
|
|
@@ -12,16 +12,6 @@ export declare enum MessageType {
|
|
|
12
12
|
Auth = 2,
|
|
13
13
|
QueryAwareness = 3
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* State of the WebSocket connection.
|
|
17
|
-
* https://developer.mozilla.org/de/docs/Web/API/WebSocket/readyState
|
|
18
|
-
*/
|
|
19
|
-
export declare enum WsReadyStates {
|
|
20
|
-
Connecting = 0,
|
|
21
|
-
Open = 1,
|
|
22
|
-
Closing = 2,
|
|
23
|
-
Closed = 3
|
|
24
|
-
}
|
|
25
15
|
export interface AwarenessUpdate {
|
|
26
16
|
added: Array<any>;
|
|
27
17
|
updated: Array<any>;
|
|
@@ -38,6 +28,7 @@ export interface Extension {
|
|
|
38
28
|
onListen?(data: onListenPayload): Promise<any>;
|
|
39
29
|
onUpgrade?(data: onUpgradePayload): Promise<any>;
|
|
40
30
|
onConnect?(data: onConnectPayload): Promise<any>;
|
|
31
|
+
connected?(data: connectedPayload): Promise<any>;
|
|
41
32
|
onAuthenticate?(data: onAuthenticatePayload): Promise<any>;
|
|
42
33
|
/**
|
|
43
34
|
* @deprecated onCreateDocument is deprecated, use onLoadDocument instead
|
|
@@ -53,7 +44,7 @@ export interface Extension {
|
|
|
53
44
|
onDisconnect?(data: onDisconnectPayload): Promise<any>;
|
|
54
45
|
onDestroy?(data: onDestroyPayload): Promise<any>;
|
|
55
46
|
}
|
|
56
|
-
export declare type Hook = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'onAuthenticate' |
|
|
47
|
+
export declare type Hook = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' |
|
|
57
48
|
/**
|
|
58
49
|
* @deprecated onCreateDocument is deprecated, use onLoadDocument instead
|
|
59
50
|
*/
|
|
@@ -116,6 +107,15 @@ export interface onConnectPayload {
|
|
|
116
107
|
socketId: string;
|
|
117
108
|
connection: ConnectionConfiguration;
|
|
118
109
|
}
|
|
110
|
+
export interface connectedPayload {
|
|
111
|
+
documentName: string;
|
|
112
|
+
instance: Hocuspocus;
|
|
113
|
+
request: IncomingMessage;
|
|
114
|
+
requestHeaders: IncomingHttpHeaders;
|
|
115
|
+
requestParameters: URLSearchParams;
|
|
116
|
+
socketId: string;
|
|
117
|
+
connection: ConnectionConfiguration;
|
|
118
|
+
}
|
|
119
119
|
export interface onLoadDocumentPayload {
|
|
120
120
|
context: any;
|
|
121
121
|
document: Document;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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.
|
|
3
|
+
"version": "1.0.0-alpha.59",
|
|
4
4
|
"description": "hocuspocus persistence driver for Redis",
|
|
5
5
|
"homepage": "https://hocuspocus.dev",
|
|
6
6
|
"keywords": [
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@hocuspocus/server": "^1.0.0-alpha.
|
|
30
|
+
"@hocuspocus/server": "^1.0.0-alpha.96",
|
|
31
31
|
"y-redis": "^1.0.3",
|
|
32
32
|
"yjs": "^13.5.24"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "771a8cbad1016dd12080ff4b35fabb9680ec69a7"
|
|
35
35
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as awarenessStatesToArray } from './awarenessStatesToArray';
|