@docx-editor.dev/pro 2.27.0 → 2.28.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/chunk-CNXDNDD3.js +1 -0
- package/dist/{chunk-PVRTSPHN.cjs → chunk-FD2KDBHX.cjs} +1 -1
- package/dist/chunk-JRHEYVVY.cjs +1 -0
- package/dist/chunk-L567WP3J.js +5 -0
- package/dist/chunk-MJECUVHQ.cjs +5 -0
- package/dist/chunk-MWO2ZUEJ.js +1 -0
- package/dist/chunk-N34IUO36.cjs +1 -0
- package/dist/chunk-OT5R3IYV.cjs +1 -0
- package/dist/chunk-P2EF7WMV.js +1 -0
- package/dist/chunk-Q5JTCGJI.js +1 -0
- package/dist/chunk-SNQCYZLT.js +1 -0
- package/dist/chunk-ZSAAX6HV.cjs +1 -0
- package/dist/collaboration/hocuspocus.cjs +1 -1
- package/dist/collaboration/hocuspocus.d.cts +18 -11
- package/dist/collaboration/hocuspocus.d.ts +18 -11
- package/dist/collaboration/hocuspocus.js +1 -1
- package/dist/collaboration/index.cjs +2 -2
- package/dist/collaboration/index.d.cts +333 -18
- package/dist/collaboration/index.d.ts +333 -18
- package/dist/collaboration/index.js +2 -2
- package/dist/collaboration/webrtc.cjs +2 -2
- package/dist/collaboration/webrtc.d.cts +26 -3
- package/dist/collaboration/webrtc.d.ts +26 -3
- package/dist/collaboration/webrtc.js +2 -2
- package/dist/{collaboration-module-DlSv0oAd.d.cts → collaboration-module-DWn2heE1.d.cts} +1 -0
- package/dist/{collaboration-module-DlSv0oAd.d.ts → collaboration-module-DWn2heE1.d.ts} +1 -0
- package/dist/{define-custom-node-DUJ4ZZdo.d.ts → define-custom-node-CNRQG1TI.d.cts} +12 -4
- package/dist/{define-custom-node-DG5gpRa5.d.cts → define-custom-node-D0c36PpZ.d.ts} +12 -4
- package/dist/document-session-3VC43WNI.cjs +1 -0
- package/dist/{document-session-BKKfJzKB.d.cts → document-session-Bxs4_GgX.d.ts} +55 -33
- package/dist/document-session-J2YKWERI.js +1 -0
- package/dist/{document-session-BQ4nBDTd.d.ts → document-session-_v9vqiSX.d.cts} +55 -33
- package/dist/document-session-options-CfKypp9c.d.cts +37 -0
- package/dist/document-session-options-DelOC7PX.d.ts +37 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +29 -4
- package/dist/index.d.ts +29 -4
- package/dist/index.js +1 -1
- package/dist/react/hocuspocus.cjs +1 -1
- package/dist/react/hocuspocus.d.cts +52 -8
- package/dist/react/hocuspocus.d.ts +52 -8
- package/dist/react/hocuspocus.js +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.cts +354 -156
- package/dist/react/index.d.ts +354 -156
- package/dist/react/index.js +2 -2
- package/dist/react/webrtc.cjs +1 -1
- package/dist/react/webrtc.d.cts +35 -7
- package/dist/react/webrtc.d.ts +35 -7
- package/dist/react/webrtc.js +1 -1
- package/dist/{session-okdqygLg.d.cts → types-6EmrEn4n.d.cts} +26 -4
- package/dist/{session-okdqygLg.d.ts → types-6EmrEn4n.d.ts} +26 -4
- package/dist/{session-B-ds4k64.d.cts → types-BQ1vBt5Q.d.cts} +32 -54
- package/dist/{session-B-ds4k64.d.ts → types-BQ1vBt5Q.d.ts} +32 -54
- package/dist/vue/hocuspocus.cjs +1 -1
- package/dist/vue/hocuspocus.d.cts +52 -7
- package/dist/vue/hocuspocus.d.ts +52 -7
- package/dist/vue/hocuspocus.js +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.cts +235 -24
- package/dist/vue/index.d.ts +235 -24
- package/dist/vue/index.js +2 -2
- package/dist/vue/webrtc.cjs +1 -1
- package/dist/vue/webrtc.d.cts +36 -6
- package/dist/vue/webrtc.d.ts +36 -6
- package/dist/vue/webrtc.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-6CDC4KCE.js +0 -4
- package/dist/chunk-6SR5OK66.cjs +0 -4
- package/dist/chunk-GDTCNTK7.cjs +0 -1
- package/dist/chunk-HJB77VBO.js +0 -1
- package/dist/chunk-HZEWGK5A.cjs +0 -4
- package/dist/chunk-Q4YPX2DT.cjs +0 -1
- package/dist/chunk-Q7P2DQ33.js +0 -1
- package/dist/chunk-RGR2BLZD.js +0 -4
- package/dist/chunk-W3V54DWZ.js +0 -1
- package/dist/document-session-32FPPQHT.js +0 -1
- package/dist/document-session-32ULDU2C.js +0 -1
- package/dist/document-session-HCU2O55L.cjs +0 -1
- package/dist/document-session-ZOM2KHHX.cjs +0 -1
- package/dist/hocuspocus-BMF7MTMJ.js +0 -1
- package/dist/hocuspocus-JPJOC6ZV.cjs +0 -1
- package/dist/webrtc-MM3LDVLU.cjs +0 -2
- package/dist/webrtc-RYONN7E7.js +0 -2
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `@docx-editor.dev/pro/collaboration` — Yjs replica factories and the module factory.
|
|
3
|
+
*
|
|
4
|
+
* The default entry imports no network provider. Import
|
|
5
|
+
* `@docx-editor.dev/pro/collaboration/webrtc` for the WebRTC wrapper and
|
|
6
|
+
* `@docx-editor.dev/pro/collaboration/hocuspocus` for the Hocuspocus wrapper.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export { C as CollaborationModuleOptions, c as collaborationModule } from '../collaboration-module-DWn2heE1.cjs';
|
|
12
|
+
export { a as CollaborationBootstrap, c as CollaborationHandle, b as CollaborationIdentityUpdate, C as CollaborationSession } from '../types-BQ1vBt5Q.cjs';
|
|
13
|
+
export { C as CollaborationResourceUsage, D as DocumentCollaborationHandle, a as DocumentCollaborationSession, c as createDocumentCollaboration, r as readCollaborationResourceUsage } from '../document-session-_v9vqiSX.cjs';
|
|
5
14
|
import * as Y from 'yjs';
|
|
15
|
+
import { CollaborationFailureCode, EditorCollaborationSession } from '@docx-editor.dev/core/collaboration';
|
|
16
|
+
export { C as CreateDocumentCollaborationOptions } from '../document-session-options-CfKypp9c.cjs';
|
|
6
17
|
import '@docx-editor.dev/core/editor';
|
|
7
18
|
import 'y-protocols/awareness';
|
|
8
19
|
|
|
@@ -20,10 +31,14 @@ interface DocumentCollaborationVersions {
|
|
|
20
31
|
/**
|
|
21
32
|
* Versions supported by this full-document collaboration release.
|
|
22
33
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
34
|
+
* These values describe the application schema, not the DOCX format or the Yjs binary
|
|
35
|
+
* update format. Releases with the same tuple can share rooms. A changed tuple requires a
|
|
36
|
+
* coordinated upgrade. This descriptor does not migrate persisted rooms or authenticate
|
|
37
|
+
* clients.
|
|
38
|
+
*
|
|
39
|
+
* @deprecated Send `COLLABORATION_FORMAT_VERSION` in the connection handshake and check it
|
|
40
|
+
* with `assertCollaborationFormatCompatibility`. This tuple stays supported for existing
|
|
41
|
+
* handshakes.
|
|
27
42
|
* @public
|
|
28
43
|
*/
|
|
29
44
|
declare const DOCUMENT_COLLABORATION_VERSIONS: DocumentCollaborationVersions;
|
|
@@ -39,6 +54,9 @@ declare const DOCUMENT_COLLABORATION_VERSIONS: DocumentCollaborationVersions;
|
|
|
39
54
|
*
|
|
40
55
|
* @throws CollaborationSchemaError with `protocol-version-mismatch` or
|
|
41
56
|
* `schema-version-mismatch`, including the field and expected/received version in `detail`.
|
|
57
|
+
* Both codes mean that this client and the room have different collaboration formats.
|
|
58
|
+
* @deprecated Use `assertCollaborationFormatCompatibility` with
|
|
59
|
+
* `COLLABORATION_FORMAT_VERSION`. This function stays supported for existing handshakes.
|
|
42
60
|
* @public
|
|
43
61
|
*/
|
|
44
62
|
declare function assertDocumentCollaborationCompatibility(versions: unknown): void;
|
|
@@ -76,12 +94,272 @@ declare function assertDocumentCollaborationCompatibility(versions: unknown): vo
|
|
|
76
94
|
*/
|
|
77
95
|
declare function readCollaborationDocument(ydoc: Y.Doc): Uint8Array;
|
|
78
96
|
|
|
79
|
-
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Prepare a room's `Y.Doc` on a server that holds it, such as a Hocuspocus server. Call it
|
|
99
|
+
* once when the server creates or loads the document, before it applies any update.
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* Paragraph text keeps formatting in Yjs formatting markers. After a remote update, Yjs
|
|
103
|
+
* removes the markers it finds redundant from the document that received it. On a server,
|
|
104
|
+
* that removal is a change of the server's own, which the server sends to every participant,
|
|
105
|
+
* and it can remove the formatting of text a participant is typing. A prepared document does
|
|
106
|
+
* not remove markers. Every editor replica is prepared already.
|
|
107
|
+
*
|
|
108
|
+
* @param document - The room document the server holds.
|
|
109
|
+
* @returns A function that stops the preparation. Call it only when the server discards the
|
|
110
|
+
* document.
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
113
|
+
declare function prepareCollaborationServerDocument(document: Y.Doc): () => void;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Room compaction by generation.
|
|
117
|
+
*
|
|
118
|
+
* Yjs state only grows: deleted text, deleted records, formatting markers, and media nobody
|
|
119
|
+
* references stay in a room. A server compacts a room by building a new generation: a fresh
|
|
120
|
+
* document seeded from the room's current content, with a new generation ID. It does so when
|
|
121
|
+
* it loads the room, before any participant syncs, so no participant connected at the time
|
|
122
|
+
* can lose an edit.
|
|
123
|
+
*
|
|
124
|
+
* A replica that still holds the previous generation must not sync with the new one: its
|
|
125
|
+
* items would merge into the fresh document as unrelated state. Every client therefore sends
|
|
126
|
+
* the generation it holds before its first sync message, and the server refuses a mismatch
|
|
127
|
+
* with `room-generation-changed`. The replica keeps its document; it rejoins to continue.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The generation ID of the room a document holds: empty for a room never compacted, and
|
|
132
|
+
* empty for a document that holds no room yet.
|
|
133
|
+
*
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
declare function readCollaborationRoomGeneration(document: Y.Doc): string;
|
|
137
|
+
/** Options for {@link compactCollaborationState}. @public */
|
|
138
|
+
interface CompactCollaborationStateOptions {
|
|
139
|
+
/**
|
|
140
|
+
* Compact only when the stored state is at least this many times the size of the compacted
|
|
141
|
+
* state. Default 2. Pass 1 to compact whenever it makes the room smaller.
|
|
142
|
+
*/
|
|
143
|
+
readonly minimumGain?: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Build a new generation of a room from its stored state, or return null when compaction
|
|
147
|
+
* would gain less than `minimumGain`.
|
|
148
|
+
*
|
|
149
|
+
* The new generation holds the room's current content, read as a `.docx` package, under the
|
|
150
|
+
* same document ID and a new generation ID. Deleted text and records, formatting history, and
|
|
151
|
+
* unreferenced media are gone. Call it when the server loads a room, before any participant
|
|
152
|
+
* syncs, and store the result in place of the old state.
|
|
153
|
+
*
|
|
154
|
+
* A check reads the whole room and builds it again. The answer for a state found not worth
|
|
155
|
+
* compacting is remembered in this process, so the same bytes are checked once. A state that
|
|
156
|
+
* changed is checked again.
|
|
157
|
+
*
|
|
158
|
+
* Throws `CollaborationSchemaError` when the stored state cannot be read, as
|
|
159
|
+
* `readCollaborationDocument` does.
|
|
160
|
+
*
|
|
161
|
+
* @public
|
|
162
|
+
*/
|
|
163
|
+
declare function compactCollaborationState(state: Uint8Array, options?: CompactCollaborationStateOptions): Promise<Uint8Array | null>;
|
|
164
|
+
/** What the gate reads of a Hocuspocus `beforeHandleMessage` payload. @public */
|
|
165
|
+
interface CollaborationRoomGatePayload {
|
|
166
|
+
/** The connection's context object, which the gate marks once the generation matched. */
|
|
167
|
+
readonly context: object;
|
|
168
|
+
/** The room's server-side `Y.Doc`. */
|
|
169
|
+
readonly document: Y.Doc;
|
|
170
|
+
/** The incoming message bytes. */
|
|
171
|
+
readonly update: Uint8Array;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Refuse a connection whose replica holds another generation of the room. Call it from the
|
|
175
|
+
* Hocuspocus `beforeHandleMessage` hook. A client sends the generation it holds before its
|
|
176
|
+
* first sync message; on a mismatch, or a sync message without one, this throws an error
|
|
177
|
+
* that closes the connection with `room-generation-changed` before any of its state merges.
|
|
178
|
+
* A message the gate cannot read is refused the same way.
|
|
179
|
+
*
|
|
180
|
+
* A replica that holds no room yet names no generation and passes: it has no state of an
|
|
181
|
+
* earlier generation to merge. The gate keeps honest replicas of two generations apart. It
|
|
182
|
+
* is not access control: a client that may write to the room can send any update, so
|
|
183
|
+
* authenticate connections in `onAuthenticate`.
|
|
184
|
+
*
|
|
185
|
+
* @public
|
|
186
|
+
*/
|
|
187
|
+
declare function checkCollaborationRoomGeneration(payload: CollaborationRoomGatePayload): void;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* How saved room state relates to the format this build writes.
|
|
191
|
+
*
|
|
192
|
+
* - `current`: the room is in this build's format; it needs no migration.
|
|
193
|
+
* - `earlier-format`: an earlier build wrote it; export it with that build and migrate it.
|
|
194
|
+
* - `later-format`: a later build wrote it; this build must not open or replace it.
|
|
195
|
+
*
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
198
|
+
type CollaborationMigrationNeed = 'current' | 'earlier-format' | 'later-format';
|
|
199
|
+
/**
|
|
200
|
+
* Whether saved room state needs a migration before this build can serve it.
|
|
201
|
+
*
|
|
202
|
+
* A room whose version information is missing or malformed was written before collaboration
|
|
203
|
+
* formats were versioned, and counts as `earlier-format`.
|
|
204
|
+
*
|
|
205
|
+
* Throws `CollaborationSchemaError` with code `not-initialized` for state that holds no room,
|
|
206
|
+
* and with code `invalid-baseline` for bytes that are not room state.
|
|
207
|
+
*
|
|
208
|
+
* @public
|
|
209
|
+
*/
|
|
210
|
+
declare function collaborationMigrationNeed(state: Uint8Array): CollaborationMigrationNeed;
|
|
211
|
+
/**
|
|
212
|
+
* A check that a migration runs on the new room, compared with the export.
|
|
213
|
+
*
|
|
214
|
+
* - `paragraphs`: the new room holds a different number of paragraphs.
|
|
215
|
+
* - `text`: a paragraph's text differs.
|
|
216
|
+
* - `formatting`: a paragraph's properties, or the character formatting of its text, differ.
|
|
217
|
+
* - `structure`: an XML part differs in something the other checks do not cover, such as
|
|
218
|
+
* tables, sections, styles, numbering, tracked changes, comments, or notes.
|
|
219
|
+
* - `media`: a media part's bytes are missing.
|
|
220
|
+
* - `links`: an external link target is missing.
|
|
221
|
+
*
|
|
222
|
+
* @public
|
|
223
|
+
*/
|
|
224
|
+
type CollaborationMigrationCheck = 'paragraphs' | 'text' | 'formatting' | 'structure' | 'media' | 'links';
|
|
225
|
+
/** A paragraph by its part and its position in that part, from 1. @public */
|
|
226
|
+
interface CollaborationMigrationPosition {
|
|
227
|
+
/** The package part that holds the paragraph, such as `/word/document.xml`. */
|
|
228
|
+
readonly part: string;
|
|
229
|
+
/** The paragraph's position in its part, from 1, in document order. */
|
|
230
|
+
readonly paragraph: number;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* One paragraph that differs between the export and the new room.
|
|
234
|
+
*
|
|
235
|
+
* `expected` and `actual` hold document text. Treat them as document content: keep them out
|
|
236
|
+
* of logs that people without access to the document can read.
|
|
237
|
+
*
|
|
238
|
+
* @public
|
|
239
|
+
*/
|
|
240
|
+
interface CollaborationMigrationDifference extends CollaborationMigrationPosition {
|
|
241
|
+
/**
|
|
242
|
+
* - `text`: the paragraph's text differs.
|
|
243
|
+
* - `formatting`: its text is the same, but its properties or character formatting differ.
|
|
244
|
+
* - `missing`: the export has the paragraph and the new room does not.
|
|
245
|
+
* - `added`: the new room has a paragraph the export does not.
|
|
246
|
+
*/
|
|
247
|
+
readonly kind: 'text' | 'formatting' | 'missing' | 'added';
|
|
248
|
+
/** The paragraph's text in the export, or null when the export has no such paragraph. */
|
|
249
|
+
readonly expected: string | null;
|
|
250
|
+
/** The paragraph's text in the new room, or null when the new room has no such paragraph. */
|
|
251
|
+
readonly actual: string | null;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* What a migration found, comparing the new room with the export it was seeded from.
|
|
255
|
+
*
|
|
256
|
+
* The check compares each XML part of the export with the new room's. It ignores only what
|
|
257
|
+
* every save writes anew: namespace declarations, the values of paragraph IDs
|
|
258
|
+
* (`w14:paraId`, `w14:textId`) and of `w:id`, and the relationship parts. A reference to an ID,
|
|
259
|
+
* such as a comment anchor or a comment extension, must still name the same element. Revision
|
|
260
|
+
* IDs are not compared: they only have to be unique. For each paragraph it also
|
|
261
|
+
* reports its text and formatting, to locate a difference. It compares every media part by its
|
|
262
|
+
* bytes, and every external link target.
|
|
263
|
+
*
|
|
264
|
+
* @public
|
|
265
|
+
*/
|
|
266
|
+
interface CollaborationMigrationReport {
|
|
267
|
+
/** True when every check passed. */
|
|
268
|
+
readonly ok: boolean;
|
|
269
|
+
/** The checks that failed. Empty when `ok` is true. */
|
|
270
|
+
readonly failed: readonly CollaborationMigrationCheck[];
|
|
271
|
+
/** The earlier room's format, or `unversioned` for a room written before formats had one. */
|
|
272
|
+
readonly from: string;
|
|
273
|
+
/** The format of the new room: this build's. */
|
|
274
|
+
readonly to: string;
|
|
275
|
+
/** The document ID of the new room. Every client must open the room with this ID. */
|
|
276
|
+
readonly documentId: string;
|
|
277
|
+
/**
|
|
278
|
+
* Paragraphs in the export, in every part: body, tables, headers, footers, notes, and
|
|
279
|
+
* comments. A paragraph inside another, as in a text box, counts with the one that holds it.
|
|
280
|
+
*/
|
|
281
|
+
readonly paragraphs: number;
|
|
282
|
+
/**
|
|
283
|
+
* Paragraphs the new room keeps but the editor can neither show nor edit. They save back
|
|
284
|
+
* unchanged, and they do not fail the check. Check such rooms before people edit them.
|
|
285
|
+
*/
|
|
286
|
+
readonly hidden: number;
|
|
287
|
+
/** Where the first hidden paragraphs are, at most 20. */
|
|
288
|
+
readonly hiddenAt: readonly CollaborationMigrationPosition[];
|
|
289
|
+
/**
|
|
290
|
+
* XML parts that differ, by name, or that one side does not have. A part whose paragraphs
|
|
291
|
+
* differ is listed too.
|
|
292
|
+
*/
|
|
293
|
+
readonly changedParts: readonly string[];
|
|
294
|
+
/** How many paragraphs differ. `differences` lists at most the first 20. */
|
|
295
|
+
readonly differenceCount: number;
|
|
296
|
+
/** The first paragraphs that differ, at most 20. */
|
|
297
|
+
readonly differences: readonly CollaborationMigrationDifference[];
|
|
298
|
+
/** Media parts of the export, by name, whose bytes the new room does not hold. */
|
|
299
|
+
readonly missingMedia: readonly string[];
|
|
300
|
+
/** External link targets of the export that the new room does not hold. */
|
|
301
|
+
readonly missingLinks: readonly string[];
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* The result of `migrateCollaborationRoom`.
|
|
305
|
+
*
|
|
306
|
+
* - `ok: true`: the check passed. Store `state` in place of the earlier room's state.
|
|
307
|
+
* - `reason: 'check-failed'`: the new room differs from the export. Nothing is returned to
|
|
308
|
+
* store; `report` says what differs.
|
|
309
|
+
* - `reason: 'current'`: the room is already in this build's format. Leave it as it is.
|
|
310
|
+
* - `reason: 'later-format'`: a later build wrote the room. Do not open or replace it.
|
|
311
|
+
*
|
|
312
|
+
* @public
|
|
313
|
+
*/
|
|
314
|
+
type CollaborationMigration = {
|
|
315
|
+
readonly ok: true;
|
|
316
|
+
readonly state: Uint8Array;
|
|
317
|
+
readonly report: CollaborationMigrationReport;
|
|
318
|
+
} | {
|
|
319
|
+
readonly ok: false;
|
|
320
|
+
readonly reason: 'check-failed';
|
|
321
|
+
readonly report: CollaborationMigrationReport;
|
|
322
|
+
} | {
|
|
323
|
+
readonly ok: false;
|
|
324
|
+
readonly reason: 'current' | 'later-format';
|
|
325
|
+
};
|
|
326
|
+
/** Options for {@link migrateCollaborationRoom}. @public */
|
|
327
|
+
interface MigrateCollaborationRoomOptions {
|
|
328
|
+
/** The earlier room's saved state: the exact bytes that `exported` was exported from. */
|
|
329
|
+
readonly state: Uint8Array;
|
|
330
|
+
/**
|
|
331
|
+
* The `.docx` that the build which created the room exported from `state`, with
|
|
332
|
+
* `readCollaborationDocument`.
|
|
333
|
+
*/
|
|
334
|
+
readonly exported: Uint8Array;
|
|
335
|
+
/**
|
|
336
|
+
* The document ID of the new room. Omit it to keep the earlier room's ID, which is what its
|
|
337
|
+
* clients open the room with: a client whose ID differs is refused with
|
|
338
|
+
* `document-id-mismatch`. Pass it only to give the room a new ID, and open it with that ID.
|
|
339
|
+
*/
|
|
340
|
+
readonly documentId?: string;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Seed a room in this build's format from the `.docx` that the earlier build exported, and
|
|
344
|
+
* check the new room against that export.
|
|
345
|
+
*
|
|
346
|
+
* The new room keeps the earlier room's document ID unless `documentId` gives another. It is a
|
|
347
|
+
* new room generation: a replica that still holds the earlier room is refused with
|
|
348
|
+
* `room-generation-changed` and rejoins.
|
|
349
|
+
*
|
|
350
|
+
* This function does not check that `exported` was made from `state`. Store a digest of the
|
|
351
|
+
* state with each export, and compare it before you call this function: an export made before
|
|
352
|
+
* later edits would lose them.
|
|
353
|
+
*
|
|
354
|
+
* Throws `CollaborationSchemaError` when the inputs cannot be used: `invalid-baseline` for
|
|
355
|
+
* bytes that are not room state or not a `.docx`, `not-initialized` for state that holds no
|
|
356
|
+
* room, `invalid-document-id` for an unusable document ID, and a limit code such as
|
|
357
|
+
* `too-many-nodes` for an export larger than a room's limits.
|
|
358
|
+
*
|
|
359
|
+
* @public
|
|
360
|
+
*/
|
|
361
|
+
declare function migrateCollaborationRoom(options: MigrateCollaborationRoomOptions): Promise<CollaborationMigration>;
|
|
362
|
+
|
|
85
363
|
/**
|
|
86
364
|
* Typed collaboration schema or trust-boundary failure.
|
|
87
365
|
* Version-mismatch messages include recovery guidance and a documentation link.
|
|
@@ -89,9 +367,15 @@ declare const MAX_BASELINE_BYTES: number;
|
|
|
89
367
|
* @public
|
|
90
368
|
*/
|
|
91
369
|
declare class CollaborationSchemaError extends Error {
|
|
370
|
+
/** Stable failure code. Branch on it. */
|
|
92
371
|
readonly code: CollaborationFailureCode;
|
|
372
|
+
/** Bounded diagnostic text for logs. Not a parsing contract. */
|
|
93
373
|
readonly detail?: string | undefined;
|
|
94
|
-
constructor(
|
|
374
|
+
constructor(
|
|
375
|
+
/** Stable failure code. Branch on it. */
|
|
376
|
+
code: CollaborationFailureCode,
|
|
377
|
+
/** Bounded diagnostic text for logs. Not a parsing contract. */
|
|
378
|
+
detail?: string | undefined);
|
|
95
379
|
}
|
|
96
380
|
|
|
97
381
|
/**
|
|
@@ -113,7 +397,10 @@ declare const COLLABORATION_FORMAT_VERSION: string;
|
|
|
113
397
|
* This check does not authenticate clients, validate room content, or migrate data.
|
|
114
398
|
*
|
|
115
399
|
* @throws CollaborationSchemaError with `collaboration-format-mismatch` for an
|
|
116
|
-
* incompatible, missing, or malformed version. Use `code` for application logic.
|
|
400
|
+
* incompatible, missing, or malformed version. Use `code` for application logic. This code,
|
|
401
|
+
* `protocol-version-mismatch`, and `schema-version-mismatch` all mean that this client and
|
|
402
|
+
* the room have different collaboration formats. Refuse the connection and direct the user
|
|
403
|
+
* to a compatible deployment; reconnecting does not help.
|
|
117
404
|
* @public
|
|
118
405
|
*/
|
|
119
406
|
declare function assertCollaborationFormatCompatibility(version: unknown): void;
|
|
@@ -132,5 +419,33 @@ declare function assertCollaborationFormatCompatibility(version: unknown): void;
|
|
|
132
419
|
*/
|
|
133
420
|
declare function readCollaborationFormatVersion(ydoc: Y.Doc): string;
|
|
134
421
|
|
|
135
|
-
|
|
136
|
-
|
|
422
|
+
/**
|
|
423
|
+
* Protocol identifier for the retired text-only collaboration format.
|
|
424
|
+
* @deprecated Use COLLABORATION_FORMAT_VERSION for full-document connection checks.
|
|
425
|
+
* @public
|
|
426
|
+
*/
|
|
427
|
+
declare const PROTOCOL_VERSION = 1;
|
|
428
|
+
/**
|
|
429
|
+
* Schema identifier for the retired text-only collaboration format.
|
|
430
|
+
* @deprecated Use COLLABORATION_FORMAT_VERSION for full-document connection checks.
|
|
431
|
+
* @public
|
|
432
|
+
*/
|
|
433
|
+
declare const SCHEMA_VERSION = 1;
|
|
434
|
+
/**
|
|
435
|
+
* Historical baseline byte limit for the retired text-only collaboration factory.
|
|
436
|
+
* This value does not configure full-document collaboration limits.
|
|
437
|
+
* @deprecated Use the full-document factory's validation and typed failure codes.
|
|
438
|
+
* @public
|
|
439
|
+
*/
|
|
440
|
+
declare const MAX_BASELINE_BYTES: number;
|
|
441
|
+
/**
|
|
442
|
+
* Retained type for integrations with the retired text-only collaboration factory.
|
|
443
|
+
* @deprecated Use DocumentCollaborationSession for full-document collaboration.
|
|
444
|
+
* @public
|
|
445
|
+
*/
|
|
446
|
+
interface TextCollaborationSession extends EditorCollaborationSession {
|
|
447
|
+
setTransportStatus(status: 'ready' | 'disconnected' | 'error', reason?: CollaborationFailureCode, detail?: string): void;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export { COLLABORATION_FORMAT_VERSION, CollaborationSchemaError, DOCUMENT_COLLABORATION_VERSIONS, MAX_BASELINE_BYTES, PROTOCOL_VERSION, SCHEMA_VERSION, assertCollaborationFormatCompatibility, assertDocumentCollaborationCompatibility, checkCollaborationRoomGeneration, collaborationMigrationNeed, compactCollaborationState, migrateCollaborationRoom, prepareCollaborationServerDocument, readCollaborationDocument, readCollaborationFormatVersion, readCollaborationRoomGeneration };
|
|
451
|
+
export type { CollaborationMigration, CollaborationMigrationCheck, CollaborationMigrationDifference, CollaborationMigrationNeed, CollaborationMigrationPosition, CollaborationMigrationReport, CollaborationRoomGatePayload, CompactCollaborationStateOptions, DocumentCollaborationVersions, MigrateCollaborationRoomOptions, TextCollaborationSession };
|