-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.d.ts
More file actions
173 lines (148 loc) · 5.62 KB
/
Copy pathindex.d.ts
File metadata and controls
173 lines (148 loc) · 5.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
168
169
170
171
172
173
export type OoxmlSourceType = 'package' | 'document' | 'fragment';
export type RedlineStatus = 'ok' | 'no-op' | 'error';
export type ExistingRevisionsPolicy = 'reject-input' | 'accept-all-first';
export interface RedlineError {
code: 'PARSE_ERROR' | 'TARGET_NOT_FOUND' | 'EXISTING_REVISIONS' | string;
message: string;
}
export interface RedlineOptions {
generateRedlines?: boolean;
author?: string;
targetParagraphId?: string | null;
existingRevisions?: ExistingRevisionsPolicy;
removeFormatting?: boolean;
[key: string]: unknown;
}
export interface RedlineResult {
oxml: string;
hasChanges: boolean;
sourceType?: OoxmlSourceType;
status?: RedlineStatus;
error?: RedlineError;
warnings?: string[];
numberingXml?: string;
useNativeApi?: boolean;
[key: string]: unknown;
}
export interface TableReconciliationResult extends RedlineResult {
isMarkdownTable: boolean;
tableData?: {
headers?: string[];
rows?: string[][];
[key: string]: unknown;
};
}
export interface RevisionFilterOptions {
author?: string;
allAuthors?: boolean;
}
export interface AcceptTrackedChangesResult {
oxml: string;
hasChanges: boolean;
acceptedCount: number;
warnings: string[];
}
export interface RejectTrackedChangesResult {
oxml: string;
hasChanges: boolean;
rejectedCount: number;
warnings: string[];
}
export interface DeleteCommentsResult {
oxml: string;
hasChanges: boolean;
commentsRemoved: number;
referencesRemoved: number;
warnings: string[];
}
export interface XmlProvider {
DOMParser: typeof DOMParser;
XMLSerializer: typeof XMLSerializer;
}
export interface LoggerConfig {
log?: (...args: unknown[]) => void;
warn?: (...args: unknown[]) => void;
error?: (...args: unknown[]) => void;
}
export interface DocumentOperationResult {
documentXml: string;
hasChanges: boolean;
numberingXml?: string | null;
commentsXml?: string | null;
warnings?: string[];
status?: RedlineStatus;
error?: RedlineError;
}
export function configureXmlProvider(provider: XmlProvider): void;
export function configureLogger(logger: LoggerConfig): void;
export function setDefaultAuthor(name: string): void;
export function getDefaultAuthor(): string;
export function setPlatform(label: string): void;
export function getPlatform(): string;
export function applyRedlineToOxml(
oxml: string,
originalText: string,
modifiedText: string,
options?: RedlineOptions
): Promise<RedlineResult>;
export function applyRedlineToOxmlWithListFallback(
oxml: string,
originalText: string,
modifiedText: string,
options?: RedlineOptions
): Promise<RedlineResult>;
export function reconcileMarkdownTableOoxml(
oxml: string,
originalText: string,
markdownTable: string,
options?: RedlineOptions
): Promise<TableReconciliationResult>;
export function ingestWordOoxmlToPlainText(oxml: string): string;
export function ingestWordOoxmlToMarkdown(oxml: string): string;
export function ingestOoxml(oxml: string): unknown;
export function preprocessMarkdown(text: string): { cleanText: string; formatHints: unknown[] };
export function serializeToOoxml(runModel: unknown[], pPrXml?: string | null, formatHints?: unknown[], options?: Record<string, unknown>): string;
export function wrapInDocumentFragment(rawOoxml: string, options?: Record<string, unknown>): string;
export function injectCommentsIntoOoxml(oxml: string, comments: unknown[], options?: Record<string, unknown>): unknown;
export function injectCommentsIntoPackage(packageXml: string, comments: unknown[], options?: Record<string, unknown>): unknown;
export function acceptTrackedChangesInOoxml(oxml: string, options?: RevisionFilterOptions): AcceptTrackedChangesResult;
export function rejectTrackedChangesInOoxml(oxml: string, options?: RevisionFilterOptions): RejectTrackedChangesResult;
export function deleteCommentsByAuthorInOoxml(oxml: string, options?: RevisionFilterOptions): DeleteCommentsResult;
export function containsTrackedChanges(xmlDoc: Document | Element): boolean;
export type RedlineValidationSeverity = 'error' | 'warning';
export interface RedlineValidationIssue {
code:
| 'PARSE_ERROR'
| 'NESTED_REVISION'
| 'DEL_CONTAINS_T'
| 'MISSING_REVISION_METADATA'
| 'DUPLICATE_REVISION_ID'
| 'MISSING_SPACE_PRESERVE'
| 'EMPTY_TEXT_ELEMENT'
| 'EMPTY_REVISION_WRAPPER'
| string;
severity: RedlineValidationSeverity;
message: string;
}
export interface RedlineValidationResult {
valid: boolean;
issues: RedlineValidationIssue[];
}
export function validateRedlineOoxml(oxml: string): RedlineValidationResult;
export function applyHighlightToOoxml(oxml: string, targetText: string, color: string, options?: Record<string, unknown>): string;
export function generateTableOoxml(headersOrData: unknown, rowsOrOptions?: unknown, options?: Record<string, unknown>): string;
export function extractReplacementNodesFromOoxml(oxml: string): unknown;
export function validateDocxPackage(zip: unknown): Promise<unknown> | unknown;
export function ensureNumberingArtifactsInZip(zip: unknown, numberingXml: string): Promise<unknown> | unknown;
export function ensureCommentsArtifactsInZip(zip: unknown, commentsXml: string): Promise<unknown> | unknown;
export function createDynamicNumberingIdState(numberingXml?: string): unknown;
export function parseOoxml(ooxml: string): Document;
export function serializeOoxml(node: Node): string;
export function sanitizeAiResponse(text: string): string;
export class ReconciliationPipeline {
constructor(options?: Record<string, unknown>);
execute(oxml: string, modifiedText: string, options?: Record<string, unknown>): Promise<unknown>;
}
export class NumberingService {
constructor(...args: unknown[]);
}