@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/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 {};