@ansonlai/docx-redline-js 0.8.3 → 0.9.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/ARCHITECTURE.md +221 -12
- package/CHANGELOG.md +803 -586
- package/README.md +1018 -901
- package/core/current-properties.js +136 -0
- package/core/paragraph-text.js +211 -209
- package/core/types.js +9 -3
- package/core/word-revision-semantics.js +256 -0
- package/dist/docx-redline-js.esm.js +4551 -967
- package/dist/docx-redline-js.esm.js.map +4 -4
- package/dist/docx-redline-js.esm.min.js +112 -106
- package/dist/docx-redline-js.esm.min.js.map +4 -4
- package/dist/docx-redline.bundle.cjs +4690 -1106
- package/dist/docx-redline.bundle.cjs.map +4 -4
- package/dist/docx-redline.bundle.js +4690 -1106
- package/dist/docx-redline.bundle.js.map +4 -4
- package/docs/AGENT_FAST_START.md +2 -0
- package/docs/AGENT_KNOWLEDGE_BASE.md +23 -4
- package/docs/SKILL_AUTHORING.md +165 -150
- package/docs/TESTING.md +1142 -1059
- package/docs/schemas/document-operations.schema.json +221 -168
- package/document/docx-document.js +1022 -1010
- package/engine/oxml-engine.js +567 -560
- package/engine/paragraph-mark-revisions.js +292 -0
- package/engine/reconstruction-mapper.js +312 -311
- package/engine/reconstruction-mode.js +183 -183
- package/engine/reconstruction-writer.js +67 -10
- package/engine/rpr-helpers.js +42 -0
- package/engine/run-builders.js +0 -73
- package/engine/surgical-diff-application.js +604 -605
- package/engine/table-mode.js +63 -63
- package/index.d.ts +51 -1
- package/index.js +47 -3
- package/node/cli-help.js +1 -0
- package/node/cli.js +992 -974
- package/orchestration/list-structural-fallback.js +67 -9
- package/package.json +1 -1
- package/pipeline/diff-engine.js +130 -1
- package/pipeline/ingestion-export.js +227 -243
- package/pipeline/ingestion-paragraph.js +93 -98
- package/pipeline/list-generation.js +415 -419
- package/pipeline/pipeline.js +206 -204
- package/pipeline/serialization.js +111 -94
- package/scripts/export-validation-fixtures.mjs +19 -6
- package/scripts/generate-word-revision-semantics-matrix.mjs +134 -0
- package/scripts/lib/word-coverage-catalogue.mjs +7 -2
- package/scripts/render-multilevel-bullet-visual.ps1 +2 -2
- package/scripts/word-com-corpus-visual-suite.ps1 +2 -2
- package/scripts/word-com-differential.ps1 +443 -335
- package/scripts/word-com-visual-suite.ps1 +2 -2
- package/scripts/word-revision-semantics-matrix.ps1 +108 -0
- package/services/batch-operation-orchestrator.js +26 -0
- package/services/capture-engine.js +228 -226
- package/services/document-operation-applier.js +215 -0
- package/services/document-operation-contract.js +628 -537
- package/services/document-operation-mutations.js +789 -46
- package/services/error-recovery.js +17 -0
- package/services/list-conversion-diagnostics.js +296 -0
- package/services/list-format-change.js +586 -0
- package/services/list-format-mutation.js +416 -0
- package/services/list-format.js +305 -0
- package/services/numbering-allocation.js +642 -0
- package/services/numbering-helpers.js +354 -524
- package/services/operation-batch-compiler.js +612 -436
- package/services/operation-heuristics.js +197 -173
- package/services/operation-preflight.js +1 -0
- package/services/receipt-collector.js +288 -288
- package/services/revision-comment-management.js +634 -594
- package/services/revision-fidelity-verifier.js +498 -0
- package/services/standalone-docx-plumbing.js +627 -631
- package/services/standalone-operation-runner.d.ts +606 -427
- package/services/table-reconciliation.js +103 -49
|
@@ -1,427 +1,606 @@
|
|
|
1
|
-
import type { ExistingRevisionsPolicy, RedlineError, RedlineStatus, RevisionToken } from '../index.js';
|
|
2
|
-
|
|
3
|
-
export interface ParagraphTargetDescriptor {
|
|
4
|
-
text?: string;
|
|
5
|
-
exactText?: string;
|
|
6
|
-
index?: number | string;
|
|
7
|
-
paragraphIndex?: number | string;
|
|
8
|
-
paragraphId?: string;
|
|
9
|
-
occurrence?: number;
|
|
10
|
-
inTable?: boolean;
|
|
11
|
-
fingerprint?: string;
|
|
12
|
-
sourceFingerprint?: string;
|
|
13
|
-
/** Defaults to rejected for restore operations and accepted for all other operations. */
|
|
14
|
-
revisionView?: 'accepted' | 'rejected';
|
|
15
|
-
captureRef?: string;
|
|
16
|
-
select?: string;
|
|
17
|
-
createdByOperation?: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface InsertionAffinity {
|
|
21
|
-
formatting?: 'left' | 'right' | 'none';
|
|
22
|
-
hyperlink?: 'inside' | 'outside' | 'preserve';
|
|
23
|
-
revision?: 'coalesce_same_author' | 'separate';
|
|
24
|
-
bookmark?: 'inside' | 'outside';
|
|
25
|
-
comment?: 'inside' | 'outside';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface RejectedTextInsertionAnchor {
|
|
29
|
-
exactText: string;
|
|
30
|
-
occurrence?: number;
|
|
31
|
-
offset: number;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface LocalizedReplacement {
|
|
35
|
-
find: string;
|
|
36
|
-
replace: string;
|
|
37
|
-
occurrence?: number;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** A header/footer part path from `inspect().headersFooters`, or a selector. */
|
|
41
|
-
export type HeaderFooterPartSelector =
|
|
42
|
-
| string
|
|
43
|
-
| { kind: 'header' | 'footer'; type?: 'default' | 'first' | 'even'; section?: number };
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
export
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
1
|
+
import type { ExistingRevisionsPolicy, RedlineError, RedlineStatus, RevisionToken } from '../index.js';
|
|
2
|
+
|
|
3
|
+
export interface ParagraphTargetDescriptor {
|
|
4
|
+
text?: string;
|
|
5
|
+
exactText?: string;
|
|
6
|
+
index?: number | string;
|
|
7
|
+
paragraphIndex?: number | string;
|
|
8
|
+
paragraphId?: string;
|
|
9
|
+
occurrence?: number;
|
|
10
|
+
inTable?: boolean;
|
|
11
|
+
fingerprint?: string;
|
|
12
|
+
sourceFingerprint?: string;
|
|
13
|
+
/** Defaults to rejected for restore operations and accepted for all other operations. */
|
|
14
|
+
revisionView?: 'accepted' | 'rejected';
|
|
15
|
+
captureRef?: string;
|
|
16
|
+
select?: string;
|
|
17
|
+
createdByOperation?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface InsertionAffinity {
|
|
21
|
+
formatting?: 'left' | 'right' | 'none';
|
|
22
|
+
hyperlink?: 'inside' | 'outside' | 'preserve';
|
|
23
|
+
revision?: 'coalesce_same_author' | 'separate';
|
|
24
|
+
bookmark?: 'inside' | 'outside';
|
|
25
|
+
comment?: 'inside' | 'outside';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface RejectedTextInsertionAnchor {
|
|
29
|
+
exactText: string;
|
|
30
|
+
occurrence?: number;
|
|
31
|
+
offset: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface LocalizedReplacement {
|
|
35
|
+
find: string;
|
|
36
|
+
replace: string;
|
|
37
|
+
occurrence?: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A header/footer part path from `inspect().headersFooters`, or a selector. */
|
|
41
|
+
export type HeaderFooterPartSelector =
|
|
42
|
+
| string
|
|
43
|
+
| { kind: 'header' | 'footer'; type?: 'default' | 'first' | 'even'; section?: number };
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Structured list-conversion diagnostic (`list-conversion-diagnostics-v1`). Warnings appear in
|
|
47
|
+
* `diagnostics` (and as `CODE: message` strings in `warnings`) on an operation that succeeded;
|
|
48
|
+
* the same details appear on `error` when the strict policy refuses the operation. They are
|
|
49
|
+
* unrelated to `REVISION_FIDELITY_VIOLATION`.
|
|
50
|
+
*/
|
|
51
|
+
export interface ListConversionDiagnostic {
|
|
52
|
+
code:
|
|
53
|
+
| 'LIST_MARKER_NOT_BOUND'
|
|
54
|
+
| 'UNSUPPORTED_LIST_CONVERSION'
|
|
55
|
+
| 'LIST_FORMAT_NOT_APPLIED'
|
|
56
|
+
| 'UNSUPPORTED_LIST_FORMAT_CHANGE'
|
|
57
|
+
| 'UNKNOWN_PARAGRAPH_FORMAT_PROPERTY';
|
|
58
|
+
severity: 'warning' | 'error';
|
|
59
|
+
message: string;
|
|
60
|
+
/** The literal marker text (for example `A.`) the edit introduced. */
|
|
61
|
+
listMarker?: string;
|
|
62
|
+
requestedList?: { kind: 'bullet' | 'numbered'; format: string };
|
|
63
|
+
/** The numbering definition the list item keeps (format-change diagnostics). */
|
|
64
|
+
sourceList?: { numId: string; level: number; kind: 'bullet' | 'numbered'; format: string };
|
|
65
|
+
targetExcerpt?: string;
|
|
66
|
+
operationIndex?: number;
|
|
67
|
+
/** Rejected `paragraph-format.properties` keys (UNKNOWN_PARAGRAPH_FORMAT_PROPERTY). */
|
|
68
|
+
properties?: string[];
|
|
69
|
+
recovery?: {
|
|
70
|
+
action: string;
|
|
71
|
+
hint?: string;
|
|
72
|
+
field?: string;
|
|
73
|
+
allowedValue?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The list-format operation to send (add a target): convert-plain for LIST_MARKER_NOT_BOUND /
|
|
76
|
+
* UNSUPPORTED_LIST_CONVERSION, change-format (scope "list") for LIST_FORMAT_NOT_APPLIED / UNSUPPORTED_LIST_FORMAT_CHANGE.
|
|
77
|
+
*/
|
|
78
|
+
suggestedOperation?: { type: 'list-format'; list: ListFormatRequest };
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface DocumentOperationBase {
|
|
83
|
+
operationId?: string;
|
|
84
|
+
/** Target a header or footer instead of the body. Comments are not supported there. */
|
|
85
|
+
part?: HeaderFooterPartSelector;
|
|
86
|
+
captureKey?: string;
|
|
87
|
+
target?: string | ParagraphTargetDescriptor;
|
|
88
|
+
targetRef?: number | string | null;
|
|
89
|
+
author?: string;
|
|
90
|
+
generateRedlines?: boolean;
|
|
91
|
+
existingRevisions?: ExistingRevisionsPolicy;
|
|
92
|
+
pairReplacements?: boolean;
|
|
93
|
+
insertionAffinity?: InsertionAffinity;
|
|
94
|
+
/**
|
|
95
|
+
* `'literal'` accepts list-marker text as literal text and suppresses LIST_MARKER_NOT_BOUND,
|
|
96
|
+
* UNSUPPORTED_LIST_CONVERSION, LIST_FORMAT_NOT_APPLIED and UNSUPPORTED_LIST_FORMAT_CHANGE for this operation.
|
|
97
|
+
*/
|
|
98
|
+
listMarkers?: 'literal';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface RedlineDocumentOperationCommon extends DocumentOperationBase {
|
|
102
|
+
structuredContent?: boolean;
|
|
103
|
+
targetEnd?: ParagraphTargetDescriptor;
|
|
104
|
+
targetEndRef?: number | string | null;
|
|
105
|
+
/** Required when type is insert and target.revisionView is rejected. */
|
|
106
|
+
anchor?: RejectedTextInsertionAnchor;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type RedlineDocumentOperation =
|
|
110
|
+
| (RedlineDocumentOperationCommon & {
|
|
111
|
+
type: 'redline' | 'replace';
|
|
112
|
+
modified: string;
|
|
113
|
+
replacements?: never;
|
|
114
|
+
})
|
|
115
|
+
| (RedlineDocumentOperationCommon & {
|
|
116
|
+
type: 'redline' | 'replace';
|
|
117
|
+
modified?: never;
|
|
118
|
+
/** Exact, case-sensitive replacements in one batch-start accepted-view paragraph. */
|
|
119
|
+
replacements: LocalizedReplacement[];
|
|
120
|
+
})
|
|
121
|
+
| (RedlineDocumentOperationCommon & {
|
|
122
|
+
type: 'format' | 'list-change' | 'table-reconciliation' | 'insert';
|
|
123
|
+
modified: string;
|
|
124
|
+
replacements?: never;
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
interface RestoreDocumentOperationCommon extends DocumentOperationBase {
|
|
128
|
+
type: 'restore';
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type RestoreDocumentOperation =
|
|
132
|
+
| (RestoreDocumentOperationCommon & {
|
|
133
|
+
modified: string | string[];
|
|
134
|
+
replacements?: never;
|
|
135
|
+
targetEnd?: ParagraphTargetDescriptor;
|
|
136
|
+
targetEndRef?: number | string | null;
|
|
137
|
+
})
|
|
138
|
+
| (RestoreDocumentOperationCommon & {
|
|
139
|
+
modified?: never;
|
|
140
|
+
/** Exact, case-sensitive replacements in one strong rejected-view paragraph. */
|
|
141
|
+
replacements: LocalizedReplacement[];
|
|
142
|
+
targetEnd?: never;
|
|
143
|
+
targetEndRef?: never;
|
|
144
|
+
})
|
|
145
|
+
| (RestoreDocumentOperationCommon & {
|
|
146
|
+
/** Omit modified to restore one strong rejected-view paragraph verbatim. */
|
|
147
|
+
modified?: never;
|
|
148
|
+
replacements?: never;
|
|
149
|
+
targetEnd?: never;
|
|
150
|
+
targetEndRef?: never;
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
export interface DeleteDocumentOperation extends DocumentOperationBase {
|
|
154
|
+
type: 'delete';
|
|
155
|
+
modified?: '';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface CommentDocumentOperation extends DocumentOperationBase {
|
|
159
|
+
type: 'comment';
|
|
160
|
+
textToComment?: string;
|
|
161
|
+
commentContent: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface CommentReplyDocumentOperation {
|
|
165
|
+
type: 'comment_reply';
|
|
166
|
+
operationId?: string;
|
|
167
|
+
parentCommentId: number | string;
|
|
168
|
+
commentContent: string;
|
|
169
|
+
author?: string;
|
|
170
|
+
date?: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Resolves (or with `resolved: false`, reopens) the whole thread containing `commentId`. Body-only. */
|
|
174
|
+
export interface CommentResolveDocumentOperation {
|
|
175
|
+
type: 'comment_resolve';
|
|
176
|
+
operationId?: string;
|
|
177
|
+
commentId: number | string;
|
|
178
|
+
resolved?: boolean;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface CharacterFormatProperties {
|
|
182
|
+
bold?: boolean;
|
|
183
|
+
italic?: boolean;
|
|
184
|
+
underline?: boolean;
|
|
185
|
+
strike?: boolean;
|
|
186
|
+
strikethrough?: boolean;
|
|
187
|
+
highlight?: string | null;
|
|
188
|
+
color?: string | null;
|
|
189
|
+
fontSize?: number | string | null;
|
|
190
|
+
fontFamily?: string | null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Closed set. Unknown keys are rejected with INVALID_OPERATION (field `properties.<key>`) since 0.9.0. */
|
|
194
|
+
export interface ParagraphFormatProperties {
|
|
195
|
+
alignment?: 'left' | 'center' | 'right' | 'both';
|
|
196
|
+
keepNext?: boolean;
|
|
197
|
+
keepLines?: boolean;
|
|
198
|
+
pageBreakBefore?: boolean;
|
|
199
|
+
style?: string | null;
|
|
200
|
+
/**
|
|
201
|
+
* Binds the paragraph to an EXISTING list (`numId` and `level` as reported by inspect), or `null` to remove its direct
|
|
202
|
+
* list binding. Tracked as `w:pPrChange`; refuses `PARAGRAPH_NUMBERING_NOT_FOUND` when the numId/level is not defined.
|
|
203
|
+
* Capability `paragraph-numbering-binding-v1`.
|
|
204
|
+
*/
|
|
205
|
+
numbering?: { numId: number | string; level?: number } | null;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface HighlightDocumentOperation extends DocumentOperationBase {
|
|
209
|
+
type: 'highlight';
|
|
210
|
+
textToHighlight: string;
|
|
211
|
+
color?: string;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface CharacterFormatDocumentOperation extends DocumentOperationBase {
|
|
215
|
+
type: 'format' | 'character-format';
|
|
216
|
+
textToFormat: string;
|
|
217
|
+
/** 1-based match of `textToFormat` inside the resolved paragraph (default 1). Independent of `target.occurrence`. */
|
|
218
|
+
textOccurrence?: number;
|
|
219
|
+
properties: CharacterFormatProperties;
|
|
220
|
+
formattingRevisionPolicy?: 'always' | 'coalesce-own-insertion';
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface ParagraphFormatDocumentOperation extends DocumentOperationBase {
|
|
224
|
+
type: 'paragraph-format';
|
|
225
|
+
properties: ParagraphFormatProperties;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export type ListNumberFormat = 'decimal' | 'upperLetter' | 'lowerLetter' | 'upperRoman' | 'lowerRoman' | 'bullet';
|
|
229
|
+
|
|
230
|
+
/** `list-format` request. `convert-plain`: `list-format-v1` (CLI contract version 9); `change-format` and `join`: `list-format-change-v1`. */
|
|
231
|
+
export type ListFormatRequest = ListFormatConvertPlainRequest | ListFormatChangeFormatRequest | ListFormatJoinRequest;
|
|
232
|
+
|
|
233
|
+
/** `convert-plain` (`list-format-v1`): bind plain paragraphs to a NEW list. */
|
|
234
|
+
export interface ListFormatConvertPlainRequest {
|
|
235
|
+
mode: 'convert-plain';
|
|
236
|
+
kind?: 'bullet' | 'numbered';
|
|
237
|
+
/** Required with `strip: 'none'`; with `strip: 'marker'` it must match the typed markers (and disambiguates `I.`/`C.`). */
|
|
238
|
+
format?: 'decimal' | 'upperLetter' | 'lowerLetter' | 'upperRoman' | 'lowerRoman' | 'bullet';
|
|
239
|
+
/** 0-8, default 0. */
|
|
240
|
+
level?: number;
|
|
241
|
+
/** `'marker'` (default) removes the typed marker as a tracked deletion; `'none'` keeps the text and only binds. */
|
|
242
|
+
strip?: 'marker' | 'none';
|
|
243
|
+
/** `strip: 'none'` only. Defaults to continuing the batch's previous converted list of the same format, else 1. */
|
|
244
|
+
start?: number;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* `change-format` (`list-format-change-v1`): change the numbering format of the target's list. Allocates a NEW
|
|
249
|
+
* definition (copying the source levels and geometry, one level redefined) and rebinds the items with tracked
|
|
250
|
+
* `w:pPrChange`s; the shared definition is never edited, so Reject All restores the original labels.
|
|
251
|
+
*/
|
|
252
|
+
export interface ListFormatChangeFormatRequest {
|
|
253
|
+
mode: 'change-format';
|
|
254
|
+
kind?: 'bullet' | 'numbered';
|
|
255
|
+
/** The new format of the level (`kind: 'numbered'` alone is refused: name the format). */
|
|
256
|
+
format?: ListNumberFormat;
|
|
257
|
+
/** Level text: numbered `%1`..`%9` with the level's own placeholder (`"%1."`, `"(%2)"`); bullet: the bullet character. */
|
|
258
|
+
lvlText?: string;
|
|
259
|
+
/** Restart value of the level (the new definition's `w:start`); scope `'list'` only. */
|
|
260
|
+
start?: number;
|
|
261
|
+
/** The level to redefine; default: the one level the target paragraphs use. */
|
|
262
|
+
level?: number;
|
|
263
|
+
/** `'list'` (default): every live item of the list; `'range'`: the target range, which must run to the end of the list. */
|
|
264
|
+
scope?: 'list' | 'range';
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** `join` (`list-format-change-v1`): the target list (or a range running to its end) continues an earlier list. */
|
|
268
|
+
export interface ListFormatJoinRequest {
|
|
269
|
+
mode: 'join';
|
|
270
|
+
/** An item of the earlier list to continue; bound at batch start like `target`. */
|
|
271
|
+
continueFrom: ParagraphTargetDescriptor;
|
|
272
|
+
scope?: 'list' | 'range';
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Binds plain paragraphs (target, or target..targetEnd in one container) to a NEW list definition in place. The
|
|
277
|
+
* binding is a tracked `w:pPrChange`; the stripped marker is a tracked `w:del`. Each typed marker's value is the
|
|
278
|
+
* item's value, so Accept All renders the labels the text showed. Body only (no `part`); text changes belong in a
|
|
279
|
+
* separate single-paragraph `redline` of the same paragraph that keeps the typed marker exactly: the batch compiler
|
|
280
|
+
* lets that pair share one batch and runs the redline first ("1. Old" -> "1. New": redline the text, convert-plain
|
|
281
|
+
* strips "1. "); other pairs fail LIST_FORMAT_COMPOSITION_CONFLICT. Refusals: LIST_MARKER_NOT_FOUND, LIST_MARKER_AMBIGUOUS, LIST_MARKER_UNSUPPORTED,
|
|
282
|
+
* LIST_FORMAT_TARGET_IS_LIST, LIST_FORMAT_STYLE_NUMBERED, PARAGRAPH_FORMAT_REVISION_CONFLICT.
|
|
283
|
+
*
|
|
284
|
+
* `change-format` / `join` (`list-format-change-v1`) rebind existing list items with tracked `w:pPrChange`s. With
|
|
285
|
+
* `scope: 'list'` every rebound item counts as a write of the operation in the batch compiler: only a single-paragraph
|
|
286
|
+
* `redline` per item composes with it (LIST_FORMAT_COMPOSITION_CONFLICT `reason: list-rebind` otherwise).
|
|
287
|
+
* Refusals: LIST_FORMAT_TARGET_NOT_LIST, LIST_FORMAT_MIXED_RANGE, LIST_FORMAT_STYLE_LINKED, LIST_FORMAT_STYLE_NUMBERED,
|
|
288
|
+
* LIST_FORMAT_SPLIT_UNSUPPORTED, LIST_FORMAT_DEFINITION_UNSUPPORTED, LIST_FORMAT_JOIN_INVALID,
|
|
289
|
+
* PARAGRAPH_FORMAT_REVISION_CONFLICT; a no-op is `ok` with a LIST_FORMAT_UNCHANGED warning.
|
|
290
|
+
*/
|
|
291
|
+
export interface ListFormatDocumentOperation extends Omit<DocumentOperationBase, 'part'> {
|
|
292
|
+
type: 'list-format';
|
|
293
|
+
list: ListFormatRequest;
|
|
294
|
+
targetEnd?: ParagraphTargetDescriptor;
|
|
295
|
+
targetEndRef?: number | string | null;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** What a `list-format` operation bound or rebound (`result.list`). */
|
|
299
|
+
export type ListFormatResult = ListFormatConvertPlainResult | ListFormatRebindResult;
|
|
300
|
+
|
|
301
|
+
/** `convert-plain` result. */
|
|
302
|
+
export interface ListFormatConvertPlainResult {
|
|
303
|
+
mode: 'convert-plain';
|
|
304
|
+
format: 'decimal' | 'upperLetter' | 'lowerLetter' | 'upperRoman' | 'lowerRoman' | 'bullet';
|
|
305
|
+
level: number;
|
|
306
|
+
strip: 'marker' | 'none';
|
|
307
|
+
items: Array<{ paragraphIndex: number; paragraphId: string | null; marker: string | null; value: number | null; numId: string }>;
|
|
308
|
+
/** Paragraphs of the range left as they were: empty, or (strip 'marker') body text without a marker. */
|
|
309
|
+
skipped: Array<{ paragraphIndex: number; reason: 'empty' | 'no-marker' }>;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** `change-format` / `join` result: every paragraph rebound (scope `'list'` includes items outside the target). */
|
|
313
|
+
export interface ListFormatRebindResult {
|
|
314
|
+
mode: 'change-format' | 'join';
|
|
315
|
+
scope: 'list' | 'range';
|
|
316
|
+
sourceNumId: string;
|
|
317
|
+
/** change-format: the newly allocated numId; join: the continued list's numId. */
|
|
318
|
+
numId: string;
|
|
319
|
+
format?: ListNumberFormat;
|
|
320
|
+
level?: number;
|
|
321
|
+
lvlText?: string;
|
|
322
|
+
/** change-format: per-level `w:start` values of the new definition (carried restarts, split continuation, `start`). */
|
|
323
|
+
levelStarts?: Record<string, number>;
|
|
324
|
+
continueFrom?: { paragraphIndex: number | null; numId: string };
|
|
325
|
+
items: Array<{ paragraphIndex: number | null; paragraphId: string | null; level: number; numId: string; sourceNumId: string; inTarget: boolean }>;
|
|
326
|
+
/** Tracked-deleted paragraphs in the range keep their binding. */
|
|
327
|
+
skipped: Array<{ paragraphIndex: number | null; reason: 'tracked-deleted' }>;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export type DocumentOperation =
|
|
331
|
+
| RedlineDocumentOperation
|
|
332
|
+
| RestoreDocumentOperation
|
|
333
|
+
| DeleteDocumentOperation
|
|
334
|
+
| CommentDocumentOperation
|
|
335
|
+
| CommentReplyDocumentOperation
|
|
336
|
+
| CommentResolveDocumentOperation
|
|
337
|
+
| HighlightDocumentOperation
|
|
338
|
+
| CharacterFormatDocumentOperation
|
|
339
|
+
| ParagraphFormatDocumentOperation
|
|
340
|
+
| ListFormatDocumentOperation;
|
|
341
|
+
|
|
342
|
+
export interface ResolvedDocumentTarget {
|
|
343
|
+
index: number;
|
|
344
|
+
paragraphId: string | null;
|
|
345
|
+
text: string;
|
|
346
|
+
fingerprint?: string;
|
|
347
|
+
revisionView?: 'accepted' | 'rejected';
|
|
348
|
+
inTable?: boolean;
|
|
349
|
+
targetTextMatch?: {
|
|
350
|
+
mode: 'exact' | 'space_equivalent' | 'normalized';
|
|
351
|
+
differences?: Array<{
|
|
352
|
+
offset: number;
|
|
353
|
+
sourceCodePoint: string;
|
|
354
|
+
requestedCodePoint: string;
|
|
355
|
+
}>;
|
|
356
|
+
sourceExcerpt?: string;
|
|
357
|
+
requestedExcerpt?: string;
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface ResolvedCommentAnchor {
|
|
362
|
+
requestIndex: number;
|
|
363
|
+
paragraphIndex: number;
|
|
364
|
+
text: string;
|
|
365
|
+
resolvedBy: 'exact_anchor' | 'space_equivalent_anchor';
|
|
366
|
+
start: number;
|
|
367
|
+
end: number;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export interface StandaloneRunnerOptions {
|
|
371
|
+
atomic?: boolean;
|
|
372
|
+
continueOnError?: boolean;
|
|
373
|
+
generateRedlines?: boolean;
|
|
374
|
+
existingRevisions?: ExistingRevisionsPolicy;
|
|
375
|
+
strictTargets?: boolean;
|
|
376
|
+
/**
|
|
377
|
+
* Make list-conversion diagnostics errors (UNSUPPORTED_LIST_CONVERSION, UNSUPPORTED_LIST_FORMAT_CHANGE)
|
|
378
|
+
* instead of warnings. Defaults to `atomic`; the CLI agent profile sets it. An operation's
|
|
379
|
+
* `listMarkers: 'literal'` always wins.
|
|
380
|
+
*/
|
|
381
|
+
strictListConversion?: boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Post-apply check that Word's Reject All of each tracked operation's output equals the source
|
|
384
|
+
* (paragraph count, text, properties, numbering, wrapper membership). Default `'enforce'` refuses
|
|
385
|
+
* the operation with `REVISION_FIDELITY_VIOLATION` (per-invariant `violations[]` and
|
|
386
|
+
* `recovery.retryGuidance`); `'warn'` applies it and appends the same message to `warnings`;
|
|
387
|
+
* `'off'` is for diagnosis only.
|
|
388
|
+
*/
|
|
389
|
+
verifyRevisionFidelity?: 'enforce' | 'warn' | 'off';
|
|
390
|
+
expectedRevision?: RevisionToken;
|
|
391
|
+
pairReplacements?: boolean;
|
|
392
|
+
insertionAffinity?: InsertionAffinity;
|
|
393
|
+
onInfo?: (message: string) => void;
|
|
394
|
+
onWarn?: (message: string) => void;
|
|
395
|
+
[key: string]: unknown;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export interface MutationReceiptRevisionItem {
|
|
399
|
+
id: string;
|
|
400
|
+
kind: 'ins' | 'del' | 'move_from' | 'move_to' | 'rPrChange' | 'pPrChange' | 'structural';
|
|
401
|
+
partName: string;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export interface MutationReceipt {
|
|
405
|
+
operationIndex: number;
|
|
406
|
+
operationId?: string;
|
|
407
|
+
attemptedDisposition: 'applied' | 'no_change' | 'refused' | 'not_attempted';
|
|
408
|
+
finalDisposition: 'applied' | 'no_change' | 'refused' | 'rolled_back' | 'not_attempted';
|
|
409
|
+
committed: boolean;
|
|
410
|
+
authorUsed?: string;
|
|
411
|
+
revisionItems: MutationReceiptRevisionItem[];
|
|
412
|
+
commentIds: string[];
|
|
413
|
+
numberingIds: string[];
|
|
414
|
+
relationshipIds: string[];
|
|
415
|
+
affectedTargets: ResolvedDocumentTarget[];
|
|
416
|
+
warnings: string[];
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export interface LocalizedReplacementChange {
|
|
420
|
+
kind: 'localized_replacement';
|
|
421
|
+
committed: boolean;
|
|
422
|
+
finalDisposition: 'applied' | 'rolled_back';
|
|
423
|
+
target: {
|
|
424
|
+
paragraphId?: string;
|
|
425
|
+
index?: number;
|
|
426
|
+
fingerprint?: string;
|
|
427
|
+
humanReference?: string;
|
|
428
|
+
};
|
|
429
|
+
context?: {
|
|
430
|
+
search?: string;
|
|
431
|
+
range?: string;
|
|
432
|
+
anchorMatchCount?: number;
|
|
433
|
+
humanReference?: string;
|
|
434
|
+
};
|
|
435
|
+
replacements: Array<{
|
|
436
|
+
find: string;
|
|
437
|
+
replace: string;
|
|
438
|
+
occurrence?: number;
|
|
439
|
+
matchMode?: 'space_equivalent';
|
|
440
|
+
beforeExcerpt: string;
|
|
441
|
+
afterExcerpt: string;
|
|
442
|
+
}>;
|
|
443
|
+
verification: {
|
|
444
|
+
acceptedViewMatchesCompiledText: boolean;
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export interface DocumentOperationResult {
|
|
449
|
+
documentXml: string;
|
|
450
|
+
hasChanges: boolean;
|
|
451
|
+
numberingXml?: string | null;
|
|
452
|
+
commentsXml?: string | null;
|
|
453
|
+
commentsExtendedXml?: string | null;
|
|
454
|
+
commentsXmlMode?: 'merge' | 'replace';
|
|
455
|
+
commentsExtendedXmlMode?: 'merge' | 'replace';
|
|
456
|
+
warnings?: string[];
|
|
457
|
+
diagnostics?: ListConversionDiagnostic[];
|
|
458
|
+
status?: RedlineStatus;
|
|
459
|
+
error?: RedlineError;
|
|
460
|
+
operationType: 'redline' | 'comment' | 'comment_reply' | 'comment_resolve' | 'highlight' | 'format' | 'paragraph-format' | 'list-format';
|
|
461
|
+
authorUsed: string;
|
|
462
|
+
resolvedBy?: string;
|
|
463
|
+
resolvedTarget?: ResolvedDocumentTarget;
|
|
464
|
+
resolvedAnchor?: ResolvedCommentAnchor;
|
|
465
|
+
receipt?: MutationReceipt;
|
|
466
|
+
change?: LocalizedReplacementChange;
|
|
467
|
+
/** `list-format` operations: what was bound. */
|
|
468
|
+
list?: ListFormatResult;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export interface BatchOperationItemResult {
|
|
472
|
+
index: number;
|
|
473
|
+
type: string;
|
|
474
|
+
operationType: 'redline' | 'comment' | 'comment_reply' | 'comment_resolve' | 'highlight' | 'format' | 'paragraph-format' | 'list-format';
|
|
475
|
+
status: 'applied' | 'no_change' | 'error';
|
|
476
|
+
authorUsed: string;
|
|
477
|
+
resolvedBy?: string;
|
|
478
|
+
resolvedTarget?: ResolvedDocumentTarget;
|
|
479
|
+
resolvedAnchor?: ResolvedCommentAnchor;
|
|
480
|
+
warnings?: string[];
|
|
481
|
+
diagnostics?: ListConversionDiagnostic[];
|
|
482
|
+
error?: RedlineError;
|
|
483
|
+
receipt?: MutationReceipt;
|
|
484
|
+
change?: LocalizedReplacementChange;
|
|
485
|
+
/** `list-format` operations: what was bound. */
|
|
486
|
+
list?: ListFormatResult;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export interface DocumentOperationBatchResult {
|
|
490
|
+
documentXml: string;
|
|
491
|
+
hasChanges: boolean;
|
|
492
|
+
commentsXml: string | null;
|
|
493
|
+
commentsExtendedXml?: string | null;
|
|
494
|
+
commentsXmlMode?: 'merge' | 'replace';
|
|
495
|
+
commentsExtendedXmlMode?: 'merge' | 'replace';
|
|
496
|
+
numberingXmlParts: string[];
|
|
497
|
+
results: BatchOperationItemResult[];
|
|
498
|
+
receipts?: MutationReceipt[];
|
|
499
|
+
executionOrder: number[];
|
|
500
|
+
/** Authors attached to committed changes. Empty when an atomic batch rolls back. */
|
|
501
|
+
authorsUsed: string[];
|
|
502
|
+
rolledBack?: boolean;
|
|
503
|
+
status?: RedlineStatus;
|
|
504
|
+
error?: RedlineError;
|
|
505
|
+
warnings?: string[];
|
|
506
|
+
conflicts?: OperationConflict[];
|
|
507
|
+
retryPlan?: MutationRetryPlan;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export interface MutationRetryPlan {
|
|
511
|
+
base: 'original' | 'output';
|
|
512
|
+
committedIndexes: number[];
|
|
513
|
+
failedIndexes: number[];
|
|
514
|
+
unattemptedIndexes: number[];
|
|
515
|
+
replayWholeBatch: boolean;
|
|
516
|
+
sameArgumentsSafe: false;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export interface OperationPreflightItemResult {
|
|
520
|
+
index: number;
|
|
521
|
+
type: string;
|
|
522
|
+
operationType: 'redline' | 'comment' | 'comment_reply' | 'comment_resolve' | 'highlight' | 'format' | 'paragraph-format' | 'list-format';
|
|
523
|
+
status: 'ready' | 'deferred' | 'error';
|
|
524
|
+
authorUsed: string;
|
|
525
|
+
resolvedBy?: string;
|
|
526
|
+
captureRef?: string;
|
|
527
|
+
select?: string;
|
|
528
|
+
resolvedTarget?: ResolvedDocumentTarget;
|
|
529
|
+
matchDiagnostics?: {
|
|
530
|
+
exactTextMatch: boolean;
|
|
531
|
+
normalizedTextMatch: boolean;
|
|
532
|
+
suppliedText: string;
|
|
533
|
+
actualText: string;
|
|
534
|
+
};
|
|
535
|
+
anchor?: {
|
|
536
|
+
text: string;
|
|
537
|
+
found: boolean;
|
|
538
|
+
resolvedBy?: 'exact_anchor' | 'space_equivalent_anchor';
|
|
539
|
+
start?: number;
|
|
540
|
+
end?: number;
|
|
541
|
+
candidates?: Array<{ start: number; end: number }>;
|
|
542
|
+
} | null;
|
|
543
|
+
hasRevisions?: boolean;
|
|
544
|
+
existingRevisions?: ExistingRevisionsPolicy;
|
|
545
|
+
warnings?: string[];
|
|
546
|
+
error?: RedlineError & { candidates?: ResolvedDocumentTarget[] };
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export interface OperationConflict {
|
|
550
|
+
code: 'OVERLAPPING_SOURCE_TARGETS' | 'OVERLAPPING_TEXT_EDITS' | 'REVISION_ORDER_CONFLICT' | 'LIST_FORMAT_COMPOSITION_CONFLICT' | 'CAPTURE_FANOUT_CONFLICT' | string;
|
|
551
|
+
message: string;
|
|
552
|
+
operationIndexes: number[];
|
|
553
|
+
target: ResolvedDocumentTarget;
|
|
554
|
+
/** LIST_FORMAT_COMPOSITION_CONFLICT: why the redline and the list-format do not compose. */
|
|
555
|
+
reason?: 'marker-changed' | 'redline-unchanged' | 'redline-shape' | 'list-rebind' | string;
|
|
556
|
+
sourceMarker?: string | null;
|
|
557
|
+
modifiedMarker?: string | null;
|
|
558
|
+
rebindingOperationIndexes?: number[];
|
|
559
|
+
recoveryVersion?: number;
|
|
560
|
+
category?: string;
|
|
561
|
+
recovery?: RedlineError['recovery'];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
export interface OperationPreflightResult {
|
|
565
|
+
valid: boolean;
|
|
566
|
+
status: 'ok' | 'error';
|
|
567
|
+
results: OperationPreflightItemResult[];
|
|
568
|
+
conflicts: OperationConflict[];
|
|
569
|
+
authorsUsed: string[];
|
|
570
|
+
requiredArtifacts: { comments: boolean; numbering: boolean };
|
|
571
|
+
error?: RedlineError;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export interface OperationDependencyPlan {
|
|
575
|
+
valid: boolean;
|
|
576
|
+
scheduled?: Array<{ operation: DocumentOperation; index: number }>;
|
|
577
|
+
captureProducers?: Map<string, number>;
|
|
578
|
+
error?: RedlineError;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export function buildOperationDependencyPlan(operations?: DocumentOperation[]): OperationDependencyPlan;
|
|
582
|
+
|
|
583
|
+
export function orderOperationsForStableTargets(operations?: DocumentOperation[]): DocumentOperation[];
|
|
584
|
+
|
|
585
|
+
export function preflightOperations(
|
|
586
|
+
documentXml: string,
|
|
587
|
+
operations: DocumentOperation[],
|
|
588
|
+
author?: string,
|
|
589
|
+
options?: StandaloneRunnerOptions
|
|
590
|
+
): OperationPreflightResult;
|
|
591
|
+
|
|
592
|
+
export function applyOperationToDocumentXml(
|
|
593
|
+
documentXml: string,
|
|
594
|
+
operation: DocumentOperation,
|
|
595
|
+
author?: string,
|
|
596
|
+
runtimeContext?: Record<string, unknown> | null,
|
|
597
|
+
options?: StandaloneRunnerOptions
|
|
598
|
+
): Promise<DocumentOperationResult>;
|
|
599
|
+
|
|
600
|
+
export function applyOperationsToDocumentXml(
|
|
601
|
+
documentXml: string,
|
|
602
|
+
operations: DocumentOperation[],
|
|
603
|
+
author?: string,
|
|
604
|
+
runtimeContext?: Record<string, unknown> | null,
|
|
605
|
+
options?: StandaloneRunnerOptions
|
|
606
|
+
): Promise<DocumentOperationBatchResult>;
|