@ansonlai/docx-redline-js 0.7.0 → 0.7.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/AGENTS.md +17 -6
- package/CHANGELOG.md +16 -1
- package/README.md +15 -6
- package/dist/docx-redline-js.esm.js +3 -4
- package/dist/docx-redline-js.esm.js.map +2 -2
- package/dist/docx-redline-js.esm.min.js +51 -51
- package/dist/docx-redline-js.esm.min.js.map +2 -2
- package/docs/AGENT_FAST_START.md +6 -5
- package/docs/AGENT_KNOWLEDGE_BASE.md +17 -7
- package/docs/SKILL_AUTHORING.md +7 -6
- package/docs/releases/0.7.0.md +56 -36
- package/docs/schemas/document-operations.schema.json +1 -1
- package/node/cli-help.js +7 -5
- package/node/cli.js +45 -5
- package/package.json +1 -1
- package/services/document-inspection.js +2 -3
- package/services/document-operation-applier.js +12 -2
- package/services/document-operation-contract.js +49 -2
- package/services/document-operation-mutations.js +36 -36
- package/services/operation-batch-compiler.js +9 -0
- package/services/standalone-operation-runner.d.ts +24 -4
|
@@ -296,6 +296,15 @@ export function compileOperationBatch(xmlDoc, operations = [], options = {}) {
|
|
|
296
296
|
canonicalValidation.error
|
|
297
297
|
);
|
|
298
298
|
}
|
|
299
|
+
} else if (operation.operationKind === 'restore' && sourceOperation.modified === undefined) {
|
|
300
|
+
compiled.modified = start.metadata.text;
|
|
301
|
+
const canonicalValidation = validateDocumentOperation(compiled);
|
|
302
|
+
if (!canonicalValidation.valid) {
|
|
303
|
+
throw Object.assign(
|
|
304
|
+
new Error(canonicalValidation.error.message),
|
|
305
|
+
canonicalValidation.error
|
|
306
|
+
);
|
|
307
|
+
}
|
|
299
308
|
}
|
|
300
309
|
|
|
301
310
|
const targetEndDescriptor = operation.targetEndDescriptor
|
|
@@ -75,13 +75,32 @@ export type RedlineDocumentOperation =
|
|
|
75
75
|
replacements?: never;
|
|
76
76
|
});
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
interface RestoreDocumentOperationCommon extends DocumentOperationBase {
|
|
79
79
|
type: 'restore';
|
|
80
|
-
modified: string | string[];
|
|
81
|
-
targetEnd?: ParagraphTargetDescriptor;
|
|
82
|
-
targetEndRef?: number | string | null;
|
|
83
80
|
}
|
|
84
81
|
|
|
82
|
+
export type RestoreDocumentOperation =
|
|
83
|
+
| (RestoreDocumentOperationCommon & {
|
|
84
|
+
modified: string | string[];
|
|
85
|
+
replacements?: never;
|
|
86
|
+
targetEnd?: ParagraphTargetDescriptor;
|
|
87
|
+
targetEndRef?: number | string | null;
|
|
88
|
+
})
|
|
89
|
+
| (RestoreDocumentOperationCommon & {
|
|
90
|
+
modified?: never;
|
|
91
|
+
/** Exact, case-sensitive replacements in one strong rejected-view paragraph. */
|
|
92
|
+
replacements: LocalizedReplacement[];
|
|
93
|
+
targetEnd?: never;
|
|
94
|
+
targetEndRef?: never;
|
|
95
|
+
})
|
|
96
|
+
| (RestoreDocumentOperationCommon & {
|
|
97
|
+
/** Omit modified to restore one strong rejected-view paragraph verbatim. */
|
|
98
|
+
modified?: never;
|
|
99
|
+
replacements?: never;
|
|
100
|
+
targetEnd?: never;
|
|
101
|
+
targetEndRef?: never;
|
|
102
|
+
});
|
|
103
|
+
|
|
85
104
|
export interface DeleteDocumentOperation extends DocumentOperationBase {
|
|
86
105
|
type: 'delete';
|
|
87
106
|
modified?: '';
|
|
@@ -155,6 +174,7 @@ export interface ResolvedDocumentTarget {
|
|
|
155
174
|
paragraphId: string | null;
|
|
156
175
|
text: string;
|
|
157
176
|
fingerprint?: string;
|
|
177
|
+
revisionView?: 'accepted' | 'rejected';
|
|
158
178
|
inTable?: boolean;
|
|
159
179
|
targetTextMatch?: {
|
|
160
180
|
mode: 'exact' | 'space_equivalent' | 'normalized';
|