@hocuspocus/provider 2.5.0-rc.0 → 2.6.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/hocuspocus-provider.cjs +68 -31
- package/dist/hocuspocus-provider.cjs.map +1 -1
- package/dist/hocuspocus-provider.esm.js +68 -31
- package/dist/hocuspocus-provider.esm.js.map +1 -1
- package/dist/packages/extension-redis/src/Redis.d.ts +6 -1
- package/dist/packages/provider/src/HocuspocusProviderWebsocket.d.ts +10 -2
- package/dist/packages/provider/src/TiptapCollabProvider.d.ts +19 -8
- package/dist/packages/provider/src/types.d.ts +45 -0
- 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 +4 -12
- package/dist/packages/server/src/util/debounce.d.ts +1 -0
- package/package.json +2 -2
- package/src/HocuspocusProvider.ts +4 -0
- package/src/HocuspocusProviderWebsocket.ts +78 -37
- package/src/TiptapCollabProvider.ts +26 -21
- package/src/types.ts +63 -0
- 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
package/src/types.ts
CHANGED
|
@@ -103,3 +103,66 @@ export type onStatelessParameters = {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
export type StatesArray = { clientId: number, [key: string | number]: any }[]
|
|
106
|
+
|
|
107
|
+
// hocuspocus-pro types
|
|
108
|
+
|
|
109
|
+
export type THistoryVersion = {
|
|
110
|
+
name?: string;
|
|
111
|
+
version: number;
|
|
112
|
+
date: number;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export type THistoryConfiguration = {
|
|
116
|
+
autoVersioning: boolean;
|
|
117
|
+
currentVersion: number;
|
|
118
|
+
stateCaptured: number; // indicates whether changes have been made since the last version
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export type THistoryAction =
|
|
122
|
+
| THistoryDocumentRevertAction
|
|
123
|
+
| THistoryVersionCreateAction
|
|
124
|
+
| THistoryVersionPreviewAction;
|
|
125
|
+
|
|
126
|
+
export type THistoryDocumentRevertAction = {
|
|
127
|
+
action: 'document.revert';
|
|
128
|
+
/**
|
|
129
|
+
* if changes havent been persisted to a version yet, we'll create one with the specified name,
|
|
130
|
+
* expect when `false` is passed.
|
|
131
|
+
*/
|
|
132
|
+
currentVersionName?: string | false;
|
|
133
|
+
/**
|
|
134
|
+
* Name of the version that is created after the revert. Pass `false` to avoid generating a new version.
|
|
135
|
+
*/
|
|
136
|
+
newVersionName?: string | false;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export type THistoryVersionCreateAction = {
|
|
140
|
+
action: 'version.create';
|
|
141
|
+
name?: string;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export type THistoryVersionPreviewAction = {
|
|
145
|
+
action: 'version.preview';
|
|
146
|
+
version: number;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export type THistoryEvent =
|
|
150
|
+
| THistoryVersionPreviewEvent
|
|
151
|
+
| THistoryVersionCreatedEvent
|
|
152
|
+
| THistoryDocumentRevertedEvent;
|
|
153
|
+
|
|
154
|
+
export type THistoryVersionCreatedEvent = {
|
|
155
|
+
event: 'version.created';
|
|
156
|
+
version: number;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export type THistoryVersionPreviewEvent = {
|
|
160
|
+
event: 'version.preview';
|
|
161
|
+
version: number;
|
|
162
|
+
ydoc: string; // base64-encoded Uint8Array
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export type THistoryDocumentRevertedEvent = {
|
|
166
|
+
event: 'document.reverted';
|
|
167
|
+
version: number;
|
|
168
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|