@stll/docx-core 0.0.1-placeholder.0 → 0.1.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.
@@ -0,0 +1,143 @@
1
+ import { A as DocumentBody, Bt as TableCell, Et as SectionProperties, S as BreakContent, Ut as TableRow, bt as Run, d as Style, ht as ParagraphContent, mt as Paragraph, qt as TextContent, r as DocxPackage, t as Document, v as BlockContent, xt as RunContent, zt as Table } from "./document-IR6XvC0O.js";
2
+
3
+ //#region src/legal-source/types.d.ts
4
+ type LegalDocumentKind = "agreement" | "letter" | "memo" | "checklist" | "pleading" | "other";
5
+ type LegalNumberingProfile = "legal" | "none" | "checklist";
6
+ type LegalPageSize = "A4" | "Letter";
7
+ type LegalPageOrientation = "portrait" | "landscape";
8
+ type LegalDraftMeta = {
9
+ kind: LegalDocumentKind;
10
+ locale: string;
11
+ numbering: LegalNumberingProfile;
12
+ page: {
13
+ size: LegalPageSize;
14
+ orientation: LegalPageOrientation;
15
+ };
16
+ title: string | null;
17
+ };
18
+ type LegalTable = {
19
+ headers: string[];
20
+ rows: string[][];
21
+ };
22
+ type LegalSignatureParty = {
23
+ name: string;
24
+ signatory?: string;
25
+ title?: string;
26
+ };
27
+ type LegalDraftBlock = {
28
+ type: "title";
29
+ text: string;
30
+ } | {
31
+ type: "recital";
32
+ paragraphs: string[];
33
+ } | {
34
+ type: "clause";
35
+ level: number;
36
+ heading: string;
37
+ paragraphs: string[];
38
+ } | {
39
+ type: "paragraph";
40
+ paragraphs: string[];
41
+ } | {
42
+ type: "list";
43
+ ordered: boolean;
44
+ items: string[];
45
+ } | {
46
+ type: "table";
47
+ table: LegalTable;
48
+ } | {
49
+ type: "schedule";
50
+ heading: string;
51
+ paragraphs: string[];
52
+ } | {
53
+ type: "signatures";
54
+ parties: LegalSignatureParty[];
55
+ } | {
56
+ type: "pageBreak";
57
+ };
58
+ type LegalDraft = {
59
+ meta: LegalDraftMeta;
60
+ blocks: LegalDraftBlock[];
61
+ };
62
+ type LegalDraftDiagnosticSeverity = "warning" | "error";
63
+ type LegalDraftDiagnostic = {
64
+ code: string;
65
+ message: string;
66
+ severity: LegalDraftDiagnosticSeverity;
67
+ line?: number;
68
+ };
69
+ type Autofix = {
70
+ code: string;
71
+ message: string;
72
+ line?: number;
73
+ };
74
+ type LegalSourceParseResult = {
75
+ draft: LegalDraft;
76
+ fixes: Autofix[];
77
+ diagnostics: LegalDraftDiagnostic[];
78
+ };
79
+ type LegalSourceCompileOptions = {
80
+ titleFallback?: string;
81
+ };
82
+ type CompiledLegalDocument = {
83
+ document: Document;
84
+ draft: LegalDraft;
85
+ fixes: Autofix[];
86
+ warnings: LegalDraftDiagnostic[];
87
+ };
88
+ type LegalSourceCompileResult = ({
89
+ status: "ok";
90
+ } & CompiledLegalDocument) | {
91
+ status: "needs_llm_repair";
92
+ draft: LegalDraft;
93
+ fixes: Autofix[];
94
+ errors: LegalDraftDiagnostic[];
95
+ };
96
+ type LegalSourceDocxCompileResult = ({
97
+ status: "ok";
98
+ buffer: Buffer;
99
+ } & CompiledLegalDocument) | Extract<LegalSourceCompileResult, {
100
+ status: "needs_llm_repair";
101
+ }>;
102
+ //#endregion
103
+ //#region src/legal-source/compile.d.ts
104
+ declare const compileLegalSourceToDocument: (source: string, options?: LegalSourceCompileOptions) => LegalSourceCompileResult;
105
+ //#endregion
106
+ //#region src/legal-source/parser.d.ts
107
+ declare const parseLegalSource: (source: string, options?: {
108
+ titleFallback?: string;
109
+ }) => LegalSourceParseResult;
110
+ //#endregion
111
+ //#region src/legal-source/validate.d.ts
112
+ declare const validateLegalDraft: (draft: LegalDraft) => LegalDraftDiagnostic[];
113
+ //#endregion
114
+ //#region src/legal-source/index.d.ts
115
+ declare const compileLegalSourceToDocx: (source: string, options?: LegalSourceCompileOptions) => Promise<LegalSourceDocxCompileResult>;
116
+ //#endregion
117
+ //#region src/serialize/docx.d.ts
118
+ type SerializeDocumentOptions = {
119
+ /** BCP-47 language tag (e.g. "en", "cs", "cs-CZ"); used for footer labels. */language?: string;
120
+ };
121
+ declare const serializeDocumentToDocx: (document: Document, options?: SerializeDocumentOptions) => Promise<ArrayBuffer>;
122
+ //#endregion
123
+ //#region src/validate/docx.d.ts
124
+ type ValidateDocxPackageResult = {
125
+ valid: true;
126
+ } | {
127
+ valid: false;
128
+ error: string;
129
+ };
130
+ type ValidateDocumentModelIssue = {
131
+ path: string;
132
+ message: string;
133
+ severity: "error" | "warning";
134
+ };
135
+ type ValidateDocumentModelResult = {
136
+ valid: boolean;
137
+ issues: ValidateDocumentModelIssue[];
138
+ };
139
+ declare const validateDocxPackage: (buffer: ArrayBuffer | Uint8Array) => Promise<ValidateDocxPackageResult>;
140
+ declare const validateDocumentModel: (document: Document) => ValidateDocumentModelResult;
141
+ declare const assertValidDocumentModel: (document: Document) => void;
142
+ //#endregion
143
+ export { type Autofix, type BlockContent, type BreakContent, type CompiledLegalDocument, type Document, type DocumentBody, type DocxPackage, type LegalDraft, type LegalDraftBlock, type LegalDraftDiagnostic, type LegalSourceCompileOptions, type LegalSourceCompileResult, type LegalSourceDocxCompileResult, type LegalSourceParseResult, type Paragraph, type ParagraphContent, type Run, type RunContent, type SectionProperties, type Style, type Table, type TableCell, type TableRow, type TextContent, type ValidateDocumentModelIssue, type ValidateDocumentModelResult, type ValidateDocxPackageResult, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, parseLegalSource, serializeDocumentToDocx, validateDocumentModel, validateDocxPackage, validateLegalDraft };