@hocuspocus/common 2.11.3 → 2.12.1-rc.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/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
## Introduction
|
|
8
8
|
Hocuspocus is an opinionated collaborative editing backend for [Tiptap](https://github.com/ueberdosis/tiptap) – based on [Y.js](https://github.com/yjs/yjs), a CRDT framework with a powerful abstraction of shared data.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Official Documentation
|
|
11
11
|
Documentation can be found in the [GitHub repository](https://github.com/ueberdosis/hocuspocus).
|
|
12
12
|
|
|
13
13
|
## License
|
|
@@ -110,7 +110,7 @@ export declare class Redis implements Extension {
|
|
|
110
110
|
onChange(data: onChangePayload): Promise<any>;
|
|
111
111
|
/**
|
|
112
112
|
* Make sure to *not* listen for further changes, when there’s
|
|
113
|
-
*
|
|
113
|
+
* no one connected anymore.
|
|
114
114
|
*/
|
|
115
115
|
onDisconnect: ({ documentName }: onDisconnectPayload) => Promise<void>;
|
|
116
116
|
beforeBroadcastStateless(data: beforeBroadcastStatelessPayload): Promise<number>;
|
|
@@ -35,7 +35,7 @@ export interface CompleteHocuspocusProviderWebsocketConfiguration {
|
|
|
35
35
|
*/
|
|
36
36
|
delay: number;
|
|
37
37
|
/**
|
|
38
|
-
* The
|
|
38
|
+
* The initialDelay is the amount of time to wait before making the first attempt. This option should typically be 0 since you typically want the first attempt to happen immediately.
|
|
39
39
|
*/
|
|
40
40
|
initialDelay: number;
|
|
41
41
|
/**
|
|
@@ -113,7 +113,7 @@ export type THistoryAction = THistoryDocumentRevertAction | THistoryVersionCreat
|
|
|
113
113
|
export type THistoryDocumentRevertAction = {
|
|
114
114
|
action: 'document.revert';
|
|
115
115
|
/**
|
|
116
|
-
* if changes
|
|
116
|
+
* if changes haven't been persisted to a version yet, we'll create one with the specified name,
|
|
117
117
|
* expect when `false` is passed.
|
|
118
118
|
*/
|
|
119
119
|
currentVersionName?: string | false;
|
|
@@ -38,6 +38,7 @@ export interface Extension {
|
|
|
38
38
|
onConnect?(data: onConnectPayload): Promise<any>;
|
|
39
39
|
connected?(data: connectedPayload): Promise<any>;
|
|
40
40
|
onAuthenticate?(data: onAuthenticatePayload): Promise<any>;
|
|
41
|
+
onCreateDocument?(data: onCreateDocumentPayload): Promise<any>;
|
|
41
42
|
onLoadDocument?(data: onLoadDocumentPayload): Promise<any>;
|
|
42
43
|
afterLoadDocument?(data: afterLoadDocumentPayload): Promise<any>;
|
|
43
44
|
beforeHandleMessage?(data: beforeHandleMessagePayload): Promise<any>;
|
|
@@ -52,7 +53,7 @@ export interface Extension {
|
|
|
52
53
|
afterUnloadDocument?(data: afterUnloadDocumentPayload): Promise<any>;
|
|
53
54
|
onDestroy?(data: onDestroyPayload): Promise<any>;
|
|
54
55
|
}
|
|
55
|
-
export type HookName = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' | 'onLoadDocument' | 'afterLoadDocument' | 'beforeHandleMessage' | 'beforeBroadcastStateless' | 'onStateless' | 'onChange' | 'onStoreDocument' | 'afterStoreDocument' | 'onAwarenessUpdate' | 'onRequest' | 'onDisconnect' | 'afterUnloadDocument' | 'onDestroy';
|
|
56
|
+
export type HookName = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' | 'onCreateDocument' | 'onLoadDocument' | 'afterLoadDocument' | 'beforeHandleMessage' | 'beforeBroadcastStateless' | 'onStateless' | 'onChange' | 'onStoreDocument' | 'afterStoreDocument' | 'onAwarenessUpdate' | 'onRequest' | 'onDisconnect' | 'afterUnloadDocument' | 'onDestroy';
|
|
56
57
|
export type HookPayloadByName = {
|
|
57
58
|
onConfigure: onConfigurePayload;
|
|
58
59
|
onListen: onListenPayload;
|
|
@@ -60,6 +61,7 @@ export type HookPayloadByName = {
|
|
|
60
61
|
onConnect: onConnectPayload;
|
|
61
62
|
connected: connectedPayload;
|
|
62
63
|
onAuthenticate: onAuthenticatePayload;
|
|
64
|
+
onCreateDocument: onCreateDocumentPayload;
|
|
63
65
|
onLoadDocument: onLoadDocumentPayload;
|
|
64
66
|
afterLoadDocument: afterLoadDocumentPayload;
|
|
65
67
|
beforeHandleMessage: beforeHandleMessagePayload;
|
|
@@ -80,7 +82,7 @@ export interface Configuration extends Extension {
|
|
|
80
82
|
*/
|
|
81
83
|
name: string | null;
|
|
82
84
|
/**
|
|
83
|
-
* A list of hocuspocus
|
|
85
|
+
* A list of hocuspocus extensions.
|
|
84
86
|
*/
|
|
85
87
|
extensions: Array<Extension>;
|
|
86
88
|
/**
|
|
@@ -142,10 +144,20 @@ export interface onAuthenticatePayload {
|
|
|
142
144
|
instance: Hocuspocus;
|
|
143
145
|
requestHeaders: IncomingHttpHeaders;
|
|
144
146
|
requestParameters: URLSearchParams;
|
|
147
|
+
request: IncomingMessage;
|
|
145
148
|
socketId: string;
|
|
146
149
|
token: string;
|
|
147
150
|
connection: ConnectionConfiguration;
|
|
148
151
|
}
|
|
152
|
+
export interface onCreateDocumentPayload {
|
|
153
|
+
context: any;
|
|
154
|
+
documentName: string;
|
|
155
|
+
instance: Hocuspocus;
|
|
156
|
+
requestHeaders: IncomingHttpHeaders;
|
|
157
|
+
requestParameters: URLSearchParams;
|
|
158
|
+
socketId: string;
|
|
159
|
+
connection: ConnectionConfiguration;
|
|
160
|
+
}
|
|
149
161
|
export interface onConnectPayload {
|
|
150
162
|
context: any;
|
|
151
163
|
documentName: string;
|