@ansonlai/docx-redline-js 0.8.0 → 0.8.1
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/CHANGELOG.md +539 -486
- package/README.md +331 -309
- package/dist/docx-redline-js.esm.js +1083 -163
- package/dist/docx-redline-js.esm.js.map +4 -4
- package/dist/docx-redline-js.esm.min.js +107 -107
- package/dist/docx-redline-js.esm.min.js.map +4 -4
- package/dist/docx-redline.bundle.cjs +1083 -163
- package/dist/docx-redline.bundle.cjs.map +4 -4
- package/dist/docx-redline.bundle.js +1083 -163
- package/dist/docx-redline.bundle.js.map +4 -4
- package/docs/AGENT_KNOWLEDGE_BASE.md +69 -8
- package/docs/schemas/document-operations.schema.json +29 -0
- package/document/docx-document.js +416 -22
- package/engine/reconstruction-writer.js +18 -0
- package/index.d.ts +598 -575
- package/index.js +349 -348
- package/node/cli-help.js +5 -5
- package/node/cli.js +760 -754
- package/node/index.d.ts +1 -1
- package/package.json +2 -1
- package/scripts/generate-word-comment-edge-case-fixture.ps1 +58 -0
- package/scripts/generate-word-comment-thread-fixture.ps1 +36 -0
- package/scripts/generate-word-header-footer-fixture.ps1 +32 -0
- package/scripts/generate-word-multi-section-fixture.ps1 +27 -0
- package/scripts/generate-word-package-integrity-cases.mjs +141 -0
- package/scripts/generate-word-thread-state-fixtures.ps1 +50 -0
- package/scripts/word-com-package-integrity.ps1 +98 -0
- package/services/batch-operation-orchestrator.js +262 -259
- package/services/comment-replies.js +96 -95
- package/services/comment-thread-parts.js +280 -0
- package/services/document-inspection.js +366 -365
- package/services/document-operation-applier.js +230 -202
- package/services/document-operation-contract.js +17 -2
- package/services/error-recovery.js +6 -0
- package/services/headers-footers.js +206 -0
- package/services/operation-batch-compiler.js +1 -0
- package/services/operation-preflight.js +231 -218
- package/services/package-parts.js +80 -0
- package/services/standalone-docx-plumbing.js +631 -569
- package/services/standalone-operation-runner.d.ts +19 -3
package/index.d.ts
CHANGED
|
@@ -1,575 +1,598 @@
|
|
|
1
|
-
export type OoxmlSourceType = 'package' | 'document' | 'fragment';
|
|
2
|
-
export type RedlineStatus = 'ok' | 'no-op' | 'partial' | 'error';
|
|
3
|
-
export type ExistingRevisionsPolicy = 'merge-same-author' | 'slice-cross-author' | 'reject-input' | 'accept-all-first' | 'accept-all-first-keep-normalized';
|
|
4
|
-
export type RevisionView = 'accepted' | 'rejected';
|
|
5
|
-
|
|
6
|
-
export interface RevisionTextSegment {
|
|
7
|
-
text: string;
|
|
8
|
-
kind: 'baseline' | 'insertion' | 'deletion' | 'move_from' | 'move_to';
|
|
9
|
-
author?: string;
|
|
10
|
-
revisionId?: string;
|
|
11
|
-
acceptedStart: number | null;
|
|
12
|
-
rejectedStart: number | null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
import type {
|
|
16
|
-
InsertionAffinity,
|
|
17
|
-
DocumentOperation,
|
|
18
|
-
DocumentOperationBatchResult,
|
|
19
|
-
OperationPreflightResult,
|
|
20
|
-
StandaloneRunnerOptions
|
|
21
|
-
} from './services/standalone-operation-runner.js';
|
|
22
|
-
|
|
23
|
-
export type {
|
|
24
|
-
BatchOperationItemResult,
|
|
25
|
-
CommentDocumentOperation,
|
|
26
|
-
CommentReplyDocumentOperation,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
error
|
|
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
|
-
export function
|
|
217
|
-
export function
|
|
218
|
-
export function
|
|
219
|
-
export function
|
|
220
|
-
export function
|
|
221
|
-
export function
|
|
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
|
-
export function
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
export function
|
|
277
|
-
export function
|
|
278
|
-
export function
|
|
279
|
-
export function
|
|
280
|
-
export function
|
|
281
|
-
export function
|
|
282
|
-
export function
|
|
283
|
-
export function
|
|
284
|
-
export function
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
export interface
|
|
309
|
-
export interface
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
export
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
export function
|
|
344
|
-
export function
|
|
345
|
-
|
|
346
|
-
export
|
|
347
|
-
|
|
348
|
-
export
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
export
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
export
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
export
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
export
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
export
|
|
395
|
-
export
|
|
396
|
-
export
|
|
397
|
-
export
|
|
398
|
-
export
|
|
399
|
-
|
|
400
|
-
export
|
|
401
|
-
|
|
402
|
-
export function
|
|
403
|
-
|
|
404
|
-
export
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
export
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
export
|
|
416
|
-
|
|
417
|
-
export
|
|
418
|
-
export
|
|
419
|
-
export
|
|
420
|
-
export
|
|
421
|
-
export
|
|
422
|
-
|
|
423
|
-
export function
|
|
424
|
-
export function
|
|
425
|
-
export function
|
|
426
|
-
|
|
427
|
-
export function
|
|
428
|
-
export function
|
|
429
|
-
|
|
430
|
-
export function
|
|
431
|
-
export function
|
|
432
|
-
|
|
433
|
-
export function
|
|
434
|
-
export function
|
|
435
|
-
export function
|
|
436
|
-
export function
|
|
437
|
-
|
|
438
|
-
export function
|
|
439
|
-
export function
|
|
440
|
-
export function
|
|
441
|
-
export function
|
|
442
|
-
export function
|
|
443
|
-
|
|
444
|
-
export function
|
|
445
|
-
export function
|
|
446
|
-
export function
|
|
447
|
-
export function
|
|
448
|
-
export function
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
):
|
|
457
|
-
export function
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
):
|
|
463
|
-
export function
|
|
464
|
-
|
|
465
|
-
export function
|
|
466
|
-
export function
|
|
467
|
-
export function
|
|
468
|
-
export function
|
|
469
|
-
export function
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
export function
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
export
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
export
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
):
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
):
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
1
|
+
export type OoxmlSourceType = 'package' | 'document' | 'fragment';
|
|
2
|
+
export type RedlineStatus = 'ok' | 'no-op' | 'partial' | 'error';
|
|
3
|
+
export type ExistingRevisionsPolicy = 'merge-same-author' | 'slice-cross-author' | 'reject-input' | 'accept-all-first' | 'accept-all-first-keep-normalized';
|
|
4
|
+
export type RevisionView = 'accepted' | 'rejected';
|
|
5
|
+
|
|
6
|
+
export interface RevisionTextSegment {
|
|
7
|
+
text: string;
|
|
8
|
+
kind: 'baseline' | 'insertion' | 'deletion' | 'move_from' | 'move_to';
|
|
9
|
+
author?: string;
|
|
10
|
+
revisionId?: string;
|
|
11
|
+
acceptedStart: number | null;
|
|
12
|
+
rejectedStart: number | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
import type {
|
|
16
|
+
InsertionAffinity,
|
|
17
|
+
DocumentOperation,
|
|
18
|
+
DocumentOperationBatchResult,
|
|
19
|
+
OperationPreflightResult,
|
|
20
|
+
StandaloneRunnerOptions
|
|
21
|
+
} from './services/standalone-operation-runner.js';
|
|
22
|
+
|
|
23
|
+
export type {
|
|
24
|
+
BatchOperationItemResult,
|
|
25
|
+
CommentDocumentOperation,
|
|
26
|
+
CommentReplyDocumentOperation,
|
|
27
|
+
CommentResolveDocumentOperation,
|
|
28
|
+
DeleteDocumentOperation,
|
|
29
|
+
DocumentOperation,
|
|
30
|
+
DocumentOperationBatchResult,
|
|
31
|
+
HighlightDocumentOperation,
|
|
32
|
+
InsertionAffinity,
|
|
33
|
+
LocalizedReplacement,
|
|
34
|
+
LocalizedReplacementChange,
|
|
35
|
+
OperationConflict,
|
|
36
|
+
OperationDependencyPlan,
|
|
37
|
+
OperationPreflightItemResult,
|
|
38
|
+
OperationPreflightResult,
|
|
39
|
+
ParagraphTargetDescriptor,
|
|
40
|
+
RedlineDocumentOperation,
|
|
41
|
+
RestoreDocumentOperation,
|
|
42
|
+
ResolvedCommentAnchor,
|
|
43
|
+
ResolvedDocumentTarget,
|
|
44
|
+
StandaloneRunnerOptions
|
|
45
|
+
} from './services/standalone-operation-runner.js';
|
|
46
|
+
|
|
47
|
+
export interface RedlineError {
|
|
48
|
+
code:
|
|
49
|
+
| 'PARSE_ERROR'
|
|
50
|
+
| 'TARGET_NOT_FOUND'
|
|
51
|
+
| 'EXISTING_REVISIONS'
|
|
52
|
+
| 'DIFF_TOKEN_LIMIT'
|
|
53
|
+
| 'UNSUPPORTED_REVISION_VIEW_MUTATION'
|
|
54
|
+
| 'UNSUPPORTED_INSERTION_AFFINITY'
|
|
55
|
+
| 'UNSAFE_PARAGRAPH_BOUNDARY'
|
|
56
|
+
| 'FOREIGN_PARAGRAPH_MARK_DELETION'
|
|
57
|
+
| 'RESTORATION_STATE_REQUIRED'
|
|
58
|
+
| 'RESTORATION_COUNT_MISMATCH'
|
|
59
|
+
| 'UNSAFE_DELETED_TABLE_ROW'
|
|
60
|
+
| 'UNSUPPORTED_MOVE_REVISION'
|
|
61
|
+
| 'SECTION_BREAK_PARAGRAPH'
|
|
62
|
+
| 'UNSAFE_PARAGRAPH_PLACEMENT'
|
|
63
|
+
| 'TARGET_INDEX_MISMATCH'
|
|
64
|
+
| 'REVISION_MISMATCH'
|
|
65
|
+
| 'REVISION_TOKEN_SCOPE_MISMATCH'
|
|
66
|
+
| 'INVALID_REVISION_TOKEN'
|
|
67
|
+
| 'DUPLICATE_CAPTURE_KEY'
|
|
68
|
+
| 'CAPTURE_NOT_FOUND'
|
|
69
|
+
| 'CAPTURE_DEPENDENCY_CYCLE'
|
|
70
|
+
| 'AMBIGUOUS_CAPTURE_SELECTION'
|
|
71
|
+
| 'CAPTURE_STALE'
|
|
72
|
+
| string;
|
|
73
|
+
message: string;
|
|
74
|
+
ownerAuthor?: string;
|
|
75
|
+
stage?: string;
|
|
76
|
+
expected?: unknown;
|
|
77
|
+
actual?: unknown;
|
|
78
|
+
commentIds?: string[];
|
|
79
|
+
comments?: Array<{ id: string; author: string; text: string }>;
|
|
80
|
+
recoveryVersion?: number;
|
|
81
|
+
category?: 'request_fixable' | 'target_refresh_required' | 'candidate_selection_required' | 'policy_choice_required' | 'user_authorization_required' | 'source_conflict' | 'library_or_builder_failure' | 'manual_document_resolution' | string;
|
|
82
|
+
context?: Record<string, unknown>;
|
|
83
|
+
recovery?: {
|
|
84
|
+
action: string;
|
|
85
|
+
sameArgumentsSafe: boolean;
|
|
86
|
+
requiresReinspection: boolean;
|
|
87
|
+
requiresUserAuthorization: boolean;
|
|
88
|
+
field?: string;
|
|
89
|
+
recommendedValue?: unknown;
|
|
90
|
+
};
|
|
91
|
+
expectedRevision?: RevisionToken;
|
|
92
|
+
currentRevision?: RevisionToken;
|
|
93
|
+
issueSummary?: { total: number; byCode: Array<{ code: string; count: number }> };
|
|
94
|
+
candidates?: unknown[];
|
|
95
|
+
[key: string]: unknown;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface RedlineOptions {
|
|
99
|
+
generateRedlines?: boolean;
|
|
100
|
+
author?: string;
|
|
101
|
+
targetParagraphId?: string | null;
|
|
102
|
+
existingRevisions?: ExistingRevisionsPolicy;
|
|
103
|
+
removeFormatting?: boolean;
|
|
104
|
+
sanitizeInput?: boolean;
|
|
105
|
+
structuredContent?: boolean;
|
|
106
|
+
pairReplacements?: boolean;
|
|
107
|
+
insertionAffinity?: InsertionAffinity;
|
|
108
|
+
[key: string]: unknown;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface RedlineResult {
|
|
112
|
+
oxml: string;
|
|
113
|
+
hasChanges: boolean;
|
|
114
|
+
sourceType?: OoxmlSourceType;
|
|
115
|
+
status?: RedlineStatus;
|
|
116
|
+
error?: RedlineError;
|
|
117
|
+
warnings?: string[];
|
|
118
|
+
numberingXml?: string;
|
|
119
|
+
useNativeApi?: boolean;
|
|
120
|
+
[key: string]: unknown;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface TableReconciliationResult extends RedlineResult {
|
|
124
|
+
isMarkdownTable: boolean;
|
|
125
|
+
tableData?: {
|
|
126
|
+
headers?: string[];
|
|
127
|
+
rows?: string[][];
|
|
128
|
+
[key: string]: unknown;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface RevisionFilterOptions {
|
|
133
|
+
author?: string;
|
|
134
|
+
allAuthors?: boolean;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface AcceptTrackedChangesResult {
|
|
138
|
+
oxml: string;
|
|
139
|
+
hasChanges: boolean;
|
|
140
|
+
acceptedCount: number;
|
|
141
|
+
warnings: string[];
|
|
142
|
+
status?: RedlineStatus;
|
|
143
|
+
error?: RedlineError;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface RejectTrackedChangesResult {
|
|
147
|
+
oxml: string;
|
|
148
|
+
hasChanges: boolean;
|
|
149
|
+
rejectedCount: number;
|
|
150
|
+
warnings: string[];
|
|
151
|
+
status?: RedlineStatus;
|
|
152
|
+
error?: RedlineError;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface DeleteCommentsResult {
|
|
156
|
+
oxml: string;
|
|
157
|
+
hasChanges: boolean;
|
|
158
|
+
commentsRemoved: number;
|
|
159
|
+
referencesRemoved: number;
|
|
160
|
+
warnings: string[];
|
|
161
|
+
status?: RedlineStatus;
|
|
162
|
+
error?: RedlineError;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface IngestionTextResult {
|
|
166
|
+
text: string;
|
|
167
|
+
status: 'ok' | 'error';
|
|
168
|
+
error?: RedlineError;
|
|
169
|
+
warnings?: string[];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface ParagraphTargetCandidate {
|
|
173
|
+
paragraph: Element;
|
|
174
|
+
index: number;
|
|
175
|
+
inTable: boolean;
|
|
176
|
+
paragraphId: string | null;
|
|
177
|
+
fingerprint: string | null;
|
|
178
|
+
text: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface ParagraphTargetResolution {
|
|
182
|
+
paragraph: Element;
|
|
183
|
+
resolvedBy:
|
|
184
|
+
| 'ref'
|
|
185
|
+
| 'paragraph_id'
|
|
186
|
+
| 'occurrence'
|
|
187
|
+
| 'fingerprint'
|
|
188
|
+
| 'strict_text'
|
|
189
|
+
| 'fuzzy_text'
|
|
190
|
+
| 'strict_text_after_ref_drift'
|
|
191
|
+
| 'fuzzy_text_after_ref_drift';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface XmlProvider {
|
|
195
|
+
DOMParser: typeof DOMParser;
|
|
196
|
+
XMLSerializer: typeof XMLSerializer;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface LoggerConfig {
|
|
200
|
+
log?: (...args: unknown[]) => void;
|
|
201
|
+
warn?: (...args: unknown[]) => void;
|
|
202
|
+
error?: (...args: unknown[]) => void;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface DocumentOperationResult {
|
|
206
|
+
documentXml: string;
|
|
207
|
+
hasChanges: boolean;
|
|
208
|
+
numberingXml?: string | null;
|
|
209
|
+
commentsXml?: string | null;
|
|
210
|
+
commentsExtendedXml?: string | null;
|
|
211
|
+
warnings?: string[];
|
|
212
|
+
status?: RedlineStatus;
|
|
213
|
+
error?: RedlineError;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function configureXmlProvider(provider: XmlProvider): void;
|
|
217
|
+
export function parseOoxmlSafe(oxml: unknown, contentType?: string): { doc: Document | null; error: RedlineError | null; warnings: string[] };
|
|
218
|
+
export function configureLogger(logger: LoggerConfig): void;
|
|
219
|
+
export function setDefaultAuthor(name: string): void;
|
|
220
|
+
export function getDefaultAuthor(): string;
|
|
221
|
+
export function setPlatform(label: string): void;
|
|
222
|
+
export function getPlatform(): string;
|
|
223
|
+
|
|
224
|
+
export function applyRedlineToOxml(
|
|
225
|
+
oxml: string,
|
|
226
|
+
originalText: string,
|
|
227
|
+
modifiedText: string,
|
|
228
|
+
options?: RedlineOptions
|
|
229
|
+
): Promise<RedlineResult>;
|
|
230
|
+
|
|
231
|
+
export function applyRedlineToOxmlWithListFallback(
|
|
232
|
+
oxml: string,
|
|
233
|
+
originalText: string,
|
|
234
|
+
modifiedText: string,
|
|
235
|
+
options?: RedlineOptions
|
|
236
|
+
): Promise<RedlineResult>;
|
|
237
|
+
|
|
238
|
+
export function reconcileMarkdownTableOoxml(
|
|
239
|
+
oxml: string,
|
|
240
|
+
originalText: string,
|
|
241
|
+
markdownTable: string,
|
|
242
|
+
options?: RedlineOptions
|
|
243
|
+
): Promise<TableReconciliationResult>;
|
|
244
|
+
|
|
245
|
+
export interface StructuredContentIssue {
|
|
246
|
+
severity: 'error' | 'warning';
|
|
247
|
+
code: string;
|
|
248
|
+
line: number;
|
|
249
|
+
message: string;
|
|
250
|
+
}
|
|
251
|
+
export interface StructuredContentBlock {
|
|
252
|
+
type: 'heading' | 'paragraph' | 'list' | 'table';
|
|
253
|
+
markdown: string;
|
|
254
|
+
text?: string;
|
|
255
|
+
level?: number;
|
|
256
|
+
items?: number;
|
|
257
|
+
columns?: number;
|
|
258
|
+
rows?: number;
|
|
259
|
+
hasHeader?: boolean;
|
|
260
|
+
}
|
|
261
|
+
export interface StructuredContentAnalysis {
|
|
262
|
+
valid: boolean;
|
|
263
|
+
normalizedMarkdown: string;
|
|
264
|
+
blocks: StructuredContentBlock[];
|
|
265
|
+
issues: StructuredContentIssue[];
|
|
266
|
+
counts: Record<'heading' | 'paragraph' | 'list' | 'table', number>;
|
|
267
|
+
requiresStructuredContent: boolean;
|
|
268
|
+
}
|
|
269
|
+
export function analyzeStructuredContent(markdown: string): StructuredContentAnalysis;
|
|
270
|
+
export function planStructuredReplacement(
|
|
271
|
+
target: string | import('./services/standalone-operation-runner.js').ParagraphTargetDescriptor,
|
|
272
|
+
markdown: string,
|
|
273
|
+
options?: { author?: string; generateRedlines?: boolean; existingRevisions?: ExistingRevisionsPolicy }
|
|
274
|
+
): StructuredContentAnalysis & { operation: import('./services/standalone-operation-runner.js').RedlineDocumentOperation | null };
|
|
275
|
+
|
|
276
|
+
export function ingestWordOoxmlToPlainText(oxml: string): string;
|
|
277
|
+
export function ingestWordOoxmlToMarkdown(oxml: string): string;
|
|
278
|
+
export function ingestWordOoxmlToPlainTextResult(oxml: unknown): IngestionTextResult;
|
|
279
|
+
export function ingestWordOoxmlToMarkdownResult(oxml: unknown): IngestionTextResult;
|
|
280
|
+
export function extractCanonicalParagraphText(paragraph: Element | null | undefined, options?: { revisionView?: 'accepted' | 'rejected' | 'current' }): string;
|
|
281
|
+
export function extractParagraphRevisionSegments(paragraph: Element | null | undefined, options?: { mergeRuns?: boolean; [key: string]: unknown }): RevisionTextSegment[];
|
|
282
|
+
export function readCanonicalRunText(run: Element, options?: { revisionView?: 'accepted' | 'rejected' | 'current'; boundary?: Element | null }): string;
|
|
283
|
+
export function isNodeVisibleInRevisionView(node: Node, boundary?: Node | null, revisionView?: 'accepted' | 'rejected' | 'current'): boolean;
|
|
284
|
+
export function containsTrackedChanges(xmlDoc: Document | Element | null | undefined): boolean;
|
|
285
|
+
export function getTrackedChangeAuthors(xmlDocOrElement: Document | Element | null | undefined): string[];
|
|
286
|
+
|
|
287
|
+
export interface InspectedParagraph {
|
|
288
|
+
index: number; ref: string; paragraphId: string | null; fingerprint: string | null;
|
|
289
|
+
text: string; exactText: string; excerpt: string; inTable: boolean;
|
|
290
|
+
humanReference: string; provision: string | null; styleId: string | null;
|
|
291
|
+
table: { tableIndex: number; rowIndex: number; cellIndex: number } | null;
|
|
292
|
+
structuralReferences: Array<{ type: 'footnote' | 'endnote' | 'comment'; id: string | null }>;
|
|
293
|
+
headingLevel: number | null; nearestHeading: { level: number; text: string } | null;
|
|
294
|
+
list: { numId: string; level: number; label: string | null; format: string | null } | null;
|
|
295
|
+
hasRevisions: boolean; revisionAuthors: string[]; commentIds: string[];
|
|
296
|
+
segments: RevisionTextSegment[];
|
|
297
|
+
selectionRole?: 'match' | 'context';
|
|
298
|
+
contextFor?: number[];
|
|
299
|
+
}
|
|
300
|
+
export interface RevisionToken {
|
|
301
|
+
algorithm: 'sha256';
|
|
302
|
+
version: 1;
|
|
303
|
+
scope: 'document-parts' | 'package';
|
|
304
|
+
value: string;
|
|
305
|
+
coveredParts?: string[];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface InspectedComment { id: string; author: string | null; date: string | null; text: string; paraId?: string | null; parentParaId?: string; parentCommentId?: string | null; done?: boolean; paragraphIndex?: number; targetRef?: string; anchoredText?: string; }
|
|
309
|
+
export interface DocumentInspectionOptions { revisionView?: 'accepted' | 'rejected' | 'current'; excerptLength?: number; revisedOnly?: boolean; inTable?: boolean; skipEmpty?: boolean; search?: string; indexes?: number[]; range?: { start: number; end: number } | [number, number]; around?: number; limit?: number; after?: number; digestFn?: (bytes: Uint8Array) => string; }
|
|
310
|
+
export interface DocumentInspectionSelection {
|
|
311
|
+
search?: string; caseSensitive?: false; totalMatches: number; returnedMatches: number;
|
|
312
|
+
returnedParagraphs: number; truncated: boolean; nextAfter: number | null;
|
|
313
|
+
limit?: number; after?: number; around?: number; softByteLimit?: number;
|
|
314
|
+
oversizeItem?: boolean; contextTruncated?: boolean;
|
|
315
|
+
}
|
|
316
|
+
/** A header or footer part, as listed by `DocxDocument.inspect().headersFooters`. */
|
|
317
|
+
export interface InspectedHeaderFooter {
|
|
318
|
+
path: string;
|
|
319
|
+
kind: 'header' | 'footer';
|
|
320
|
+
type: 'default' | 'first' | 'even';
|
|
321
|
+
/** Sections that reference the part explicitly. */
|
|
322
|
+
sections: number[];
|
|
323
|
+
/** Sections where the part is in force, including sections that inherit it (Word omits the reference to mean "same as previous"). */
|
|
324
|
+
appliesToSections: number[];
|
|
325
|
+
sharedBySections: boolean;
|
|
326
|
+
/** first-page parts need titlePg; even parts need evenAndOddHeaders. */
|
|
327
|
+
active: boolean;
|
|
328
|
+
/** Contains PAGE/NUMPAGES-style fields: edit the text around them, not inside. */
|
|
329
|
+
hasFields: boolean;
|
|
330
|
+
paragraphs: Array<{ index: number; text: string }>;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface DocumentInspectionResult {
|
|
334
|
+
status: 'ok' | 'error'; paragraphs: InspectedParagraph[]; comments: InspectedComment[];
|
|
335
|
+
/** Present on DocxDocument.inspect(); not produced by inspectDocumentParts. */
|
|
336
|
+
headersFooters?: InspectedHeaderFooter[];
|
|
337
|
+
revisionAuthors?: string[]; commentAuthors?: string[]; counts?: { paragraphs: number; comments: number; revisedParagraphs: number };
|
|
338
|
+
selection?: DocumentInspectionSelection;
|
|
339
|
+
revisionToken?: RevisionToken | null;
|
|
340
|
+
coveredParts?: string[];
|
|
341
|
+
warnings: string[]; error?: RedlineError;
|
|
342
|
+
}
|
|
343
|
+
export function inspectDocumentParts(parts: { documentXml: string; commentsXml?: string | null; commentsExtendedXml?: string | null; numberingXml?: string | null; stylesXml?: string | null; parts?: Map<string, unknown>; additionalParts?: Record<string, unknown> }, options?: DocumentInspectionOptions): DocumentInspectionResult;
|
|
344
|
+
export function buildRevisionTokenFraming(options: { scope: string; entries?: unknown }): { framing: Uint8Array; scope: string; version: number; coveredParts: string[] };
|
|
345
|
+
export function computeRevisionToken(options: { scope: string; entries?: unknown; digestFn?: (bytes: Uint8Array) => Promise<string> }): Promise<RevisionToken>;
|
|
346
|
+
export function computeRevisionTokenSync(options: { scope: string; entries?: unknown; digestFn: (bytes: Uint8Array) => string }): RevisionToken;
|
|
347
|
+
export function computeDocumentPartsRevisionToken(parts: unknown, options?: { digestFn?: (bytes: Uint8Array) => Promise<string> }): Promise<RevisionToken>;
|
|
348
|
+
export function validateRevisionToken(token: unknown): { valid: boolean; error?: { code: string; message: string } };
|
|
349
|
+
export function areRevisionTokensEqual(a: string, b: string): boolean;
|
|
350
|
+
export function normalizeOpcEntryName(name: string): string;
|
|
351
|
+
export function extractDocumentPartsEntries(parts: unknown): Array<{ name: string; payload: unknown }>;
|
|
352
|
+
|
|
353
|
+
export function ingestOoxml(oxml: string): unknown;
|
|
354
|
+
export function preprocessMarkdown(text: string): { cleanText: string; formatHints: unknown[] };
|
|
355
|
+
export function serializeToOoxml(runModel: unknown[], pPrXml?: string | null, formatHints?: unknown[], options?: Record<string, unknown>): string;
|
|
356
|
+
export function wrapInDocumentFragment(rawOoxml: string, options?: Record<string, unknown>): string;
|
|
357
|
+
|
|
358
|
+
export function injectCommentsIntoOoxml(oxml: string, comments: unknown[], options?: Record<string, unknown>): unknown;
|
|
359
|
+
export function injectCommentsIntoPackage(packageXml: string, comments: unknown[], options?: Record<string, unknown>): unknown;
|
|
360
|
+
export function applyCommentReplyToParts(options: { commentsXml: string; commentsExtendedXml?: string | null; parentCommentId: string | number; commentId: string | number; commentContent: string; author: string; date?: string }): { status: 'ok' | 'error'; hasChanges?: boolean; commentsXml?: string; commentsExtendedXml?: string; commentsXmlMode?: 'replace'; commentsExtendedXmlMode?: 'replace'; parentCommentId?: string; paraId?: string; parentParaId?: string; error?: RedlineError };
|
|
361
|
+
export function acceptTrackedChangesInOoxml(oxml: string, options?: RevisionFilterOptions): AcceptTrackedChangesResult;
|
|
362
|
+
export function rejectTrackedChangesInOoxml(oxml: string, options?: RevisionFilterOptions): RejectTrackedChangesResult;
|
|
363
|
+
export function deleteCommentsByAuthorInOoxml(oxml: string, options?: RevisionFilterOptions): DeleteCommentsResult;
|
|
364
|
+
export function containsTrackedChanges(xmlDoc: Document | Element): boolean;
|
|
365
|
+
|
|
366
|
+
export type RedlineValidationSeverity = 'error' | 'warning';
|
|
367
|
+
|
|
368
|
+
export interface RedlineValidationIssue {
|
|
369
|
+
code:
|
|
370
|
+
| 'PARSE_ERROR'
|
|
371
|
+
| 'NESTED_REVISION'
|
|
372
|
+
| 'DEL_CONTAINS_T'
|
|
373
|
+
| 'MISSING_REVISION_METADATA'
|
|
374
|
+
| 'DUPLICATE_REVISION_ID'
|
|
375
|
+
| 'MISSING_SPACE_PRESERVE'
|
|
376
|
+
| 'EMPTY_TEXT_ELEMENT'
|
|
377
|
+
| 'EMPTY_REVISION_WRAPPER'
|
|
378
|
+
| string;
|
|
379
|
+
severity: RedlineValidationSeverity;
|
|
380
|
+
message: string;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export interface RedlineValidationResult {
|
|
384
|
+
valid: boolean;
|
|
385
|
+
issues: RedlineValidationIssue[];
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export function validateRedlineOoxml(oxml: string): RedlineValidationResult;
|
|
389
|
+
|
|
390
|
+
export function applyHighlightToOoxml(oxml: string, targetText: string, color: string, options?: Record<string, unknown>): string;
|
|
391
|
+
export function generateTableOoxml(headersOrData: unknown, rowsOrOptions?: unknown, options?: Record<string, unknown>): string;
|
|
392
|
+
export function extractReplacementNodesFromOoxml(oxml: string): unknown;
|
|
393
|
+
export function validateDocxPackage(zip: unknown): Promise<unknown> | unknown;
|
|
394
|
+
export function ensureNumberingArtifactsInZip(zip: unknown, numberingXml: string): Promise<unknown> | unknown;
|
|
395
|
+
export function ensureCommentsArtifactsInZip(zip: unknown, commentsXml: string): Promise<unknown> | unknown;
|
|
396
|
+
export function repairKnownContentTypes(zip: unknown): Promise<Array<{ partName: string; from: string; to: string }>>;
|
|
397
|
+
export function ensureCommentsExtendedArtifactsInZip(zip: unknown, commentsExtendedXml: string): Promise<unknown> | unknown;
|
|
398
|
+
export function createDynamicNumberingIdState(numberingXml?: string): unknown;
|
|
399
|
+
|
|
400
|
+
export function parseOoxml(ooxml: string): Document | null;
|
|
401
|
+
export function serializeOoxml(node: Node): string;
|
|
402
|
+
export function sanitizeAiResponse(text: string): string;
|
|
403
|
+
|
|
404
|
+
export class ReconciliationPipeline {
|
|
405
|
+
constructor(options?: Record<string, unknown>);
|
|
406
|
+
execute(oxml: string, modifiedText: string, options?: Record<string, unknown>): Promise<unknown>;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export class NumberingService {
|
|
410
|
+
constructor(...args: unknown[]);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// Supporting public utilities. These declarations intentionally expose stable
|
|
414
|
+
// boundary shapes while leaving internal planning records extensible.
|
|
415
|
+
export const NS_W: string;
|
|
416
|
+
export const WORD_MAIN_NS: string;
|
|
417
|
+
export const DiffOp: Readonly<Record<'EQUAL' | 'DELETE' | 'INSERT', string>>;
|
|
418
|
+
export const RunKind: Readonly<Record<string, string>>;
|
|
419
|
+
export const ContainerKind: Readonly<Record<string, string>>;
|
|
420
|
+
export const ContentType: Readonly<Record<string, string>>;
|
|
421
|
+
export const RoutePlanKind: Readonly<Record<string, string>>;
|
|
422
|
+
|
|
423
|
+
export function escapeXml(value: unknown): string;
|
|
424
|
+
export function applyFormattingRemovalToOoxml(oxml: string, options?: Record<string, unknown>): string;
|
|
425
|
+
export function removeFormattingFromRPr(rPr: Element, options?: Record<string, unknown>): Element;
|
|
426
|
+
|
|
427
|
+
export function buildCommentElement(comment: Record<string, unknown>, id?: string | number): string;
|
|
428
|
+
export function buildCommentsPartXml(comments: unknown[]): string;
|
|
429
|
+
|
|
430
|
+
export function reserveNextNumberingId(state: unknown): number;
|
|
431
|
+
export function reserveNextNumberingIdPair(state: unknown): { abstractNumId: number; numId: number };
|
|
432
|
+
export function overwriteParagraphNumIds(oxml: string, numId: string | number): string;
|
|
433
|
+
export function extractFirstParagraphNumId(oxml: string): string | null;
|
|
434
|
+
export function buildExplicitDecimalMultilevelNumberingXml(options?: Record<string, unknown>): string;
|
|
435
|
+
export function remapNumberingPayloadForDocument(numberingXml: string, state: unknown): unknown;
|
|
436
|
+
export function mergeNumberingXmlBySchemaOrder(baseXml: string, incomingXml: string): string;
|
|
437
|
+
|
|
438
|
+
export function buildListMarkdown(items: unknown[], options?: Record<string, unknown>): string;
|
|
439
|
+
export function inferNumberingStyleFromMarker(marker: string): string;
|
|
440
|
+
export function normalizeListItemsWithLevels(items: unknown[]): unknown[];
|
|
441
|
+
export function parseMarkdownListContent(text: string): unknown;
|
|
442
|
+
export function hasListItems(parsed: unknown): boolean;
|
|
443
|
+
|
|
444
|
+
export function buildReconciliationPlan(params?: Record<string, unknown>): Record<string, unknown>;
|
|
445
|
+
export function normalizeContentEscapesForRouting(content: string): string;
|
|
446
|
+
export function buildSingleLineListStructuralFallbackPlan(options?: Record<string, unknown>): Record<string, unknown> | null;
|
|
447
|
+
export function executeSingleLineListStructuralFallback(plan: unknown, options?: Record<string, unknown>): Promise<RedlineResult>;
|
|
448
|
+
export function resolveSingleLineListFallbackNumberingAction(plan: unknown, sequenceState?: unknown): Record<string, unknown>;
|
|
449
|
+
export function recordSingleLineListFallbackExplicitSequence(sequenceState: unknown, numberingKey: string | null, numId: string | number | null, startAt: number | null): void;
|
|
450
|
+
export function clearSingleLineListFallbackExplicitSequence(sequenceState: unknown, numberingKey: string | null): void;
|
|
451
|
+
export function enforceListBindingOnParagraphNodes(nodes: Node[], options?: Record<string, unknown>): number;
|
|
452
|
+
export function stripSingleLineListMarkerPrefix(text: string): string;
|
|
453
|
+
|
|
454
|
+
export function getParagraphText(paragraph: Element | null | undefined): string;
|
|
455
|
+
export function getParagraphId(paragraph: Element | null | undefined): string | null;
|
|
456
|
+
export function createParagraphFingerprint(paragraph: Element | null | undefined): string | null;
|
|
457
|
+
export function getDocumentParagraphNodes(xmlDoc: Document | Element | null | undefined): Element[];
|
|
458
|
+
export function normalizeWhitespaceForTargeting(text: string): string;
|
|
459
|
+
export function isMarkdownTableText(text: string): boolean;
|
|
460
|
+
export function parseParagraphReference(reference: unknown): unknown;
|
|
461
|
+
export function stripLeadingParagraphMarker(text: string): string;
|
|
462
|
+
export function splitLeadingParagraphMarker(text: string): Record<string, unknown>;
|
|
463
|
+
export function findContainingWordElement(node: Node | null, localName: string): Element | null;
|
|
464
|
+
export function findParagraphByReference(xmlDoc: Document | Element, reference: unknown): Element | null;
|
|
465
|
+
export function findParagraphByStrictText(xmlDoc: Document | Element, text: string): Element | null;
|
|
466
|
+
export function findParagraphByBestTextMatch(xmlDoc: Document | Element, text: string): Element | null;
|
|
467
|
+
export function findStrictTargetCandidates(xmlDoc: Document | Element, text: string): ParagraphTargetCandidate[];
|
|
468
|
+
export function resolveTargetParagraph(xmlDoc: Document | Element, options?: Record<string, unknown>): ParagraphTargetResolution;
|
|
469
|
+
export function buildTargetReferenceSnapshot(xmlDoc: Document | Element): Map<number, {
|
|
470
|
+
text: string;
|
|
471
|
+
normalizedText: string;
|
|
472
|
+
inTable: boolean;
|
|
473
|
+
}>;
|
|
474
|
+
export function resolveTargetParagraphWithSnapshot(
|
|
475
|
+
xmlDoc: Document | Element,
|
|
476
|
+
options?: Record<string, unknown>
|
|
477
|
+
): ParagraphTargetResolution;
|
|
478
|
+
export function resolveParagraphRangeByRefs(
|
|
479
|
+
xmlDoc: Document | Element,
|
|
480
|
+
startRef: string | number | null,
|
|
481
|
+
endRef: string | number | null,
|
|
482
|
+
options?: Record<string, unknown>
|
|
483
|
+
): Element[] | null;
|
|
484
|
+
export function extractParagraphIdFromOoxml(oxml: string): string | null;
|
|
485
|
+
|
|
486
|
+
export function getParagraphListInfo(paragraph: Element): Record<string, unknown> | null;
|
|
487
|
+
export function collectContiguousListParagraphBlock(paragraph: Element): Element[];
|
|
488
|
+
export function synthesizeExpandedListScopeEdit(options: Record<string, unknown>): Record<string, unknown> | null;
|
|
489
|
+
export function planListInsertionOnlyEdit(options: Record<string, unknown>): Record<string, unknown> | null;
|
|
490
|
+
export function stripRedundantLeadingListMarkers(text: string): string;
|
|
491
|
+
|
|
492
|
+
export function inferTableReplacementParagraphBlock(options: Record<string, unknown>): Record<string, unknown> | null;
|
|
493
|
+
export function isLikelyStructuredTableSourceParagraph(paragraph: Element): boolean;
|
|
494
|
+
export function synthesizeTableMarkdownFromMultilineCellEdit(options: Record<string, unknown>): string | null;
|
|
495
|
+
|
|
496
|
+
export function getBodyElementFromDocument(xmlDoc: Document): Element | null;
|
|
497
|
+
export function insertBodyElementBeforeSectPr(body: Element, element: Element): Element;
|
|
498
|
+
export function normalizeBodySectionOrderStandalone(documentXml: string): string;
|
|
499
|
+
export function sanitizeNestedParagraphsInTables(documentXml: string): string;
|
|
500
|
+
export function getPackagePartName(part: unknown): string | null;
|
|
501
|
+
|
|
502
|
+
export interface MutationReceiptRevisionItem {
|
|
503
|
+
id: string;
|
|
504
|
+
kind: 'ins' | 'del' | 'move_from' | 'move_to' | 'rPrChange' | 'pPrChange' | 'structural';
|
|
505
|
+
partName: string;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export interface MutationReceipt {
|
|
509
|
+
operationIndex: number;
|
|
510
|
+
operationId?: string;
|
|
511
|
+
attemptedDisposition: 'applied' | 'no_change' | 'refused' | 'not_attempted';
|
|
512
|
+
finalDisposition: 'applied' | 'no_change' | 'refused' | 'rolled_back' | 'not_attempted';
|
|
513
|
+
committed: boolean;
|
|
514
|
+
authorUsed?: string;
|
|
515
|
+
revisionItems: MutationReceiptRevisionItem[];
|
|
516
|
+
commentIds: string[];
|
|
517
|
+
numberingIds: string[];
|
|
518
|
+
relationshipIds: string[];
|
|
519
|
+
affectedTargets: unknown[];
|
|
520
|
+
warnings: string[];
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export class ReceiptCollector {
|
|
524
|
+
constructor();
|
|
525
|
+
beginOperation(operationIndex: number, operationId?: string | null, authorUsed?: string | null): void;
|
|
526
|
+
recordRevision(id: string | number, kind?: string, partName?: string): void;
|
|
527
|
+
recordComment(id: string | number, partName?: string): void;
|
|
528
|
+
recordNumbering(id: string | number, partName?: string): void;
|
|
529
|
+
recordRelationship(id: string | number, partName?: string): void;
|
|
530
|
+
recordAffectedTarget(target: unknown): void;
|
|
531
|
+
recordWarning(warning: unknown): void;
|
|
532
|
+
commitOperation(disposition?: string): MutationReceipt | null;
|
|
533
|
+
abortOperation(disposition?: string): MutationReceipt | null;
|
|
534
|
+
createSavepoint(): unknown;
|
|
535
|
+
restoreSavepoint(savepoint: unknown): void;
|
|
536
|
+
clear(): void;
|
|
537
|
+
markRolledBack(): void;
|
|
538
|
+
getReceipts(): MutationReceipt[];
|
|
539
|
+
getCurrentReceipt(): MutationReceipt | null;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
export function createEmptyReceipt(
|
|
543
|
+
operationIndex: number,
|
|
544
|
+
operationId?: string | null,
|
|
545
|
+
authorUsed?: string | null,
|
|
546
|
+
disposition?: 'applied' | 'no_change' | 'refused' | 'not_attempted'
|
|
547
|
+
): MutationReceipt;
|
|
548
|
+
|
|
549
|
+
export function reconcileReceiptsAgainstOutput(
|
|
550
|
+
parts: {
|
|
551
|
+
documentXml: string;
|
|
552
|
+
commentsXml?: string | null;
|
|
553
|
+
numberingXml?: string | null;
|
|
554
|
+
numberingXmlParts?: string[];
|
|
555
|
+
relationshipsXml?: string | null;
|
|
556
|
+
},
|
|
557
|
+
receipts: MutationReceipt[]
|
|
558
|
+
): { valid: boolean; error?: { code: string; message: string } };
|
|
559
|
+
|
|
560
|
+
export interface DocxApplyOptions extends StandaloneRunnerOptions {
|
|
561
|
+
author?: string;
|
|
562
|
+
validate?: boolean;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export interface DocxApplyResult extends DocumentOperationBatchResult {
|
|
566
|
+
written: boolean;
|
|
567
|
+
uint8Array: Uint8Array;
|
|
568
|
+
buffer: Uint8Array;
|
|
569
|
+
inspection?: DocumentInspectionResult;
|
|
570
|
+
artifactsChanged?: string[];
|
|
571
|
+
validation?: { originalIssues: unknown[]; generatedIssues: unknown[] };
|
|
572
|
+
issues?: unknown[];
|
|
573
|
+
toUint8Array(): Uint8Array;
|
|
574
|
+
toBuffer(): Uint8Array;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
export class DocxDocument {
|
|
578
|
+
constructor(input: Uint8Array | ArrayBuffer | string);
|
|
579
|
+
readonly originalBytes: Uint8Array;
|
|
580
|
+
readonly originalBuffer: Uint8Array;
|
|
581
|
+
readonly entries: Map<string, Uint8Array>;
|
|
582
|
+
inspect(options?: DocumentInspectionOptions): DocumentInspectionResult;
|
|
583
|
+
getRevisionToken(): RevisionToken;
|
|
584
|
+
readonly revisionToken: RevisionToken;
|
|
585
|
+
preflight(operations: DocumentOperation[], author?: string, options?: StandaloneRunnerOptions): OperationPreflightResult;
|
|
586
|
+
applyOperations(operations: DocumentOperation[], options?: DocxApplyOptions): Promise<DocxApplyResult>;
|
|
587
|
+
resolveRevisions(action: 'accept' | 'reject', options?: { author?: string; allAuthors?: boolean; validate?: boolean }): Promise<DocxApplyResult>;
|
|
588
|
+
deleteComments(options?: { author?: string; allAuthors?: boolean; ids?: Array<string | number>; validate?: boolean }): Promise<DocxApplyResult>;
|
|
589
|
+
/** Resolve (default) or reopen the comment thread containing `commentId`. Word resolves whole threads, so root and replies change together. */
|
|
590
|
+
resolveComment(commentId: string | number, options?: { resolved?: boolean; validate?: boolean }): Promise<DocxApplyResult & { resolved: boolean; threadRootId?: string; commentIds?: string[] }>;
|
|
591
|
+
toUint8Array(): Uint8Array;
|
|
592
|
+
toBuffer(): Uint8Array;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
export function computePackageRevisionToken(input: unknown): RevisionToken;
|
|
596
|
+
|
|
597
|
+
export function openDocx(input: Uint8Array | ArrayBuffer | string): DocxDocument;
|
|
598
|
+
|