@hocuspocus/extension-database 2.5.0-rc.0 → 2.5.0
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/extension-redis/src/Redis.d.ts +6 -1
- package/dist/packages/server/src/Hocuspocus.d.ts +1 -9
- package/dist/packages/server/src/MessageReceiver.d.ts +2 -1
- package/dist/packages/server/src/index.d.ts +1 -0
- package/dist/packages/server/src/types.d.ts +0 -9
- package/dist/packages/server/src/util/debounce.d.ts +1 -0
- package/package.json +2 -2
- package/dist/tests/extension-redis/closeConnections.d.ts +0 -1
- package/dist/tests/extension-redis/getConnectionCount.d.ts +0 -1
- package/dist/tests/extension-redis/getDocumentsCount.d.ts +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import RedisClient, { ClusterNode, ClusterOptions, RedisOptions } from 'ioredis';
|
|
2
3
|
import Redlock from 'redlock';
|
|
3
4
|
import { Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, onChangePayload, Debugger, onConfigurePayload, beforeBroadcastStatelessPayload, Hocuspocus } from '@hocuspocus/server';
|
|
@@ -56,18 +57,22 @@ export declare class Redis implements Extension {
|
|
|
56
57
|
*/
|
|
57
58
|
priority: number;
|
|
58
59
|
configuration: Configuration;
|
|
60
|
+
redisTransactionOrigin: string;
|
|
59
61
|
pub: RedisInstance;
|
|
60
62
|
sub: RedisInstance;
|
|
61
63
|
instance: Hocuspocus;
|
|
62
64
|
redlock: Redlock;
|
|
63
65
|
locks: Map<string, Redlock.Lock>;
|
|
64
66
|
logger: Debugger;
|
|
67
|
+
messagePrefix: Buffer;
|
|
65
68
|
constructor(configuration: Partial<Configuration>);
|
|
66
69
|
onConfigure({ instance }: onConfigurePayload): Promise<void>;
|
|
67
70
|
private getKey;
|
|
68
71
|
private pubKey;
|
|
69
72
|
private subKey;
|
|
70
73
|
private lockKey;
|
|
74
|
+
private encodeMessage;
|
|
75
|
+
private decodeMessage;
|
|
71
76
|
/**
|
|
72
77
|
* Once a document is loaded, subscribe to the channel in Redis.
|
|
73
78
|
*/
|
|
@@ -94,7 +99,7 @@ export declare class Redis implements Extension {
|
|
|
94
99
|
*/
|
|
95
100
|
onAwarenessUpdate({ documentName, awareness, added, updated, removed, }: onAwarenessUpdatePayload): Promise<number>;
|
|
96
101
|
/**
|
|
97
|
-
* Handle incoming messages published on
|
|
102
|
+
* Handle incoming messages published on subscribed document channels.
|
|
98
103
|
* Note that this will also include messages from ourselves as it is not possible
|
|
99
104
|
* in Redis to filter these.
|
|
100
105
|
*/
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
2
|
import { IncomingMessage } from 'http';
|
|
4
3
|
import WebSocket, { AddressInfo } from 'ws';
|
|
5
4
|
import { Server as HocuspocusServer } from './Server';
|
|
@@ -29,6 +28,7 @@ export declare class Hocuspocus {
|
|
|
29
28
|
documents: Map<string, Document>;
|
|
30
29
|
server?: HocuspocusServer;
|
|
31
30
|
debugger: Debugger;
|
|
31
|
+
debounce: (id: string, func: Function, debounce: number, maxDebounce: number) => void;
|
|
32
32
|
constructor(configuration?: Partial<Configuration>);
|
|
33
33
|
/**
|
|
34
34
|
* Configure the server
|
|
@@ -78,14 +78,6 @@ export declare class Hocuspocus {
|
|
|
78
78
|
* the update is incoming from the provider, but can be anything if the updates is originated from an extension.
|
|
79
79
|
*/
|
|
80
80
|
private handleDocumentUpdate;
|
|
81
|
-
timers: Map<string, {
|
|
82
|
-
timeout: NodeJS.Timeout;
|
|
83
|
-
start: number;
|
|
84
|
-
}>;
|
|
85
|
-
/**
|
|
86
|
-
* debounce the given function, using the given identifier
|
|
87
|
-
*/
|
|
88
|
-
debounce(id: string, func: Function, immediately?: boolean): void;
|
|
89
81
|
/**
|
|
90
82
|
* Create a new document by the given request
|
|
91
83
|
*/
|
|
@@ -5,7 +5,8 @@ import { IncomingMessage } from './IncomingMessage.js';
|
|
|
5
5
|
export declare class MessageReceiver {
|
|
6
6
|
message: IncomingMessage;
|
|
7
7
|
logger: Debugger;
|
|
8
|
-
|
|
8
|
+
defaultTransactionOrigin?: string;
|
|
9
|
+
constructor(message: IncomingMessage, logger: Debugger, defaultTransactionOrigin?: string);
|
|
9
10
|
apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): void;
|
|
10
11
|
readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): 0 | 1 | 2;
|
|
11
12
|
applyQueryAwarenessMessage(document: Document, reply?: (message: Uint8Array) => void): void;
|
|
@@ -123,15 +123,6 @@ export interface Configuration extends Extension {
|
|
|
123
123
|
gc: boolean;
|
|
124
124
|
gcFilter: () => boolean;
|
|
125
125
|
};
|
|
126
|
-
/**
|
|
127
|
-
* Function which returns the (customized) document name based on the request
|
|
128
|
-
*/
|
|
129
|
-
getDocumentName?(data: getDocumentNamePayload): string | Promise<string>;
|
|
130
|
-
}
|
|
131
|
-
export interface getDocumentNamePayload {
|
|
132
|
-
documentName: string;
|
|
133
|
-
request: IncomingMessage;
|
|
134
|
-
requestParameters: URLSearchParams;
|
|
135
126
|
}
|
|
136
127
|
export interface onStatelessPayload {
|
|
137
128
|
connection: Connection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useDebounce: () => (id: string, func: Function, debounce: number, maxDebounce: number) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hocuspocus/extension-database",
|
|
3
3
|
"description": "a generic Hocuspocus persistence driver for the database",
|
|
4
|
-
"version": "2.5.0
|
|
4
|
+
"version": "2.5.0",
|
|
5
5
|
"homepage": "https://hocuspocus.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"hocuspocus",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@hocuspocus/server": "^2.5.0
|
|
30
|
+
"@hocuspocus/server": "^2.5.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"yjs": "^13.6.4"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|