open-agreements
Version:
Open-source legal template filling CLI and library
50 lines • 1.86 kB
TypeScript
/**
* Checklist DOCX import/diff module.
*
* Parses a rendered closing-checklist DOCX and produces RFC 6902 patch
* operations representing human edits to the document.
*
* Processes 5-column Documents, 5-column Action Items, and 5-column Issues tables.
*/
import type { ClosingChecklist } from './schemas.js';
import type { ChecklistPatchEnvelope } from './patch-schemas.js';
export interface DocxImportOptions {
docxBuffer: Buffer;
canonicalChecklist: ClosingChecklist;
checklistId: string;
currentRevision: number;
}
export type DocxImportWarningCode = 'SUB_ROW_CHANGED' | 'ROW_REORDERED' | 'UNSUPPORTED_EDIT' | 'UNKNOWN_ID' | 'DUPLICATE_ID' | 'NEW_ROW_ADDED' | 'DISPLAY_ROW_SKIPPED';
export interface DocxImportWarning {
code: DocxImportWarningCode;
table: 'documents' | 'action_items' | 'issues';
message: string;
rowIndex?: number;
column?: string;
}
export interface DocxImportSummary {
documentsProcessed: number;
actionItemsProcessed: number;
issuesProcessed: number;
operationsGenerated: number;
warningsGenerated: number;
}
export interface DocxImportResult {
ok: true;
patch: ChecklistPatchEnvelope | null;
warnings: DocxImportWarning[];
summary: DocxImportSummary;
}
export type DocxImportErrorCode = 'TABLE_NOT_FOUND' | 'MERGED_CELLS' | 'PARSE_FAILED' | 'VERSION_MISMATCH' | 'ID_COLUMN_MISSING';
export interface DocxImportFailure {
ok: false;
error_code: DocxImportErrorCode;
message: string;
}
export type DocxImportOutcome = DocxImportResult | DocxImportFailure;
/**
* Import a rendered closing-checklist DOCX and produce a patch envelope
* representing the differences from the canonical checklist state.
*/
export declare function importChecklistFromDocx(options: DocxImportOptions): DocxImportOutcome;
//# sourceMappingURL=docx-import.d.ts.map