docling-serve-client 0.0.0-stage → 0.4.0
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/LICENSE +201 -0
- package/README.md +286 -2
- package/dist/client.d.ts +11 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/core/http.d.ts +12 -0
- package/dist/core/http.d.ts.map +1 -0
- package/dist/core/input.d.ts +18 -0
- package/dist/core/input.d.ts.map +1 -0
- package/dist/core/pdf.d.ts +11 -0
- package/dist/core/pdf.d.ts.map +1 -0
- package/dist/core/result.d.ts +54 -0
- package/dist/core/result.d.ts.map +1 -0
- package/dist/core/validate.d.ts +29 -0
- package/dist/core/validate.d.ts.map +1 -0
- package/dist/document.d.ts +412 -0
- package/dist/document.d.ts.map +1 -0
- package/dist/images.d.ts +67 -0
- package/dist/images.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +874 -0
- package/dist/index.js.map +18 -0
- package/dist/options.d.ts +54 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/response.d.ts +27 -0
- package/dist/response.d.ts.map +1 -0
- package/dist/types.d.ts +345 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +74 -4
- package/src/client.ts +413 -0
- package/src/core/http.ts +96 -0
- package/src/core/input.ts +75 -0
- package/src/core/pdf.ts +54 -0
- package/src/core/result.ts +54 -0
- package/src/core/validate.ts +85 -0
- package/src/document.ts +417 -0
- package/src/images.ts +337 -0
- package/src/index.ts +61 -0
- package/src/options.ts +334 -0
- package/src/response.ts +218 -0
- package/src/types.ts +387 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/core/validate.ts"],"names":[],"mappings":"AAOA,2CAA2C;AAC3C,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAMrD,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,wCAAwC,CAAC;AAM7E;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EACzC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,EAClC,UAAU,SAAK,GAChB,OAAO,CAAC,CAAC,CAAC,CAiBZ;AAED,uDAAuD;AACvD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM9E;AAED,mDAAmD;AACnD,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D;AAED,qEAAqE;AACrE,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC,CAE3F"}
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **DoclingDocument as sent by docling-serve in `json_content`**: schema `1.10.0`, docling-core 2.101.
|
|
3
|
+
*
|
|
4
|
+
* - items live in flat arrays (`texts`, `tables`, ...) and point to each other with `RefItem`s (`#/texts/12`)
|
|
5
|
+
* - reading order: walk `body.children` depth-first; `furniture` holds page headers and footers
|
|
6
|
+
* - the response is only checked for `schema_name` and `body`; deeper fields are typed, not validated
|
|
7
|
+
*/
|
|
8
|
+
export type DoclingDocument = {
|
|
9
|
+
schema_name: 'DoclingDocument';
|
|
10
|
+
/** Schema version, e.g. `'1.10.0'`. */
|
|
11
|
+
version: string;
|
|
12
|
+
name: string;
|
|
13
|
+
origin: DocumentOrigin | null;
|
|
14
|
+
/** Root of page headers and footers. */
|
|
15
|
+
furniture: GroupItem;
|
|
16
|
+
/** Root of the content in reading order. */
|
|
17
|
+
body: GroupItem;
|
|
18
|
+
groups: (ListGroup | InlineGroup | GroupItem)[];
|
|
19
|
+
texts: AnyTextItem[];
|
|
20
|
+
pictures: PictureItem[];
|
|
21
|
+
tables: TableItem[];
|
|
22
|
+
key_value_items: KeyValueItem[];
|
|
23
|
+
form_items: FormItem[];
|
|
24
|
+
/** Not sent by every docling version. */
|
|
25
|
+
field_regions?: FieldRegionItem[];
|
|
26
|
+
/** Not sent by every docling version. */
|
|
27
|
+
field_items?: FieldItem[];
|
|
28
|
+
/** PDF pages keyed by their 1-based number as string, e.g. `'1'`. */
|
|
29
|
+
pages: Record<string, PageItem>;
|
|
30
|
+
};
|
|
31
|
+
/** Source file of the document. */
|
|
32
|
+
export type DocumentOrigin = {
|
|
33
|
+
mimetype: string;
|
|
34
|
+
binary_hash: number;
|
|
35
|
+
filename: string;
|
|
36
|
+
uri?: string | null;
|
|
37
|
+
};
|
|
38
|
+
/** One PDF page. */
|
|
39
|
+
export type PageItem = {
|
|
40
|
+
size: Size;
|
|
41
|
+
/** Decoded page images become `null` (returned in `pageImages`); undecodable ones stay as sent. */
|
|
42
|
+
image: ImageRef | null;
|
|
43
|
+
page_no: number;
|
|
44
|
+
};
|
|
45
|
+
/** JSON pointer to another item, e.g. `{ $ref: '#/texts/12' }` or `{ $ref: '#/body' }`. */
|
|
46
|
+
export type RefItem = {
|
|
47
|
+
$ref: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* **Pointer to part of an item's text**.
|
|
51
|
+
*
|
|
52
|
+
* - `range`: `[start, end)` in Python code points; slice with `Array.from(text).slice(start, end).join('')`, not
|
|
53
|
+
* `text.slice` (characters outside the BMP count as 1)
|
|
54
|
+
*/
|
|
55
|
+
export type FineRef = {
|
|
56
|
+
$ref: string;
|
|
57
|
+
range?: [number, number] | null;
|
|
58
|
+
};
|
|
59
|
+
/** Layer of an item; only `body` is document content. */
|
|
60
|
+
export type ContentLayer = 'body' | 'furniture' | 'background' | 'invisible' | 'notes';
|
|
61
|
+
/** Width and height in points (pages) or pixels (images). */
|
|
62
|
+
export type Size = {
|
|
63
|
+
width: number;
|
|
64
|
+
height: number;
|
|
65
|
+
};
|
|
66
|
+
/** Rectangle in PDF points; `coord_origin` differs per item (`BOTTOMLEFT` for items, `TOPLEFT` for table cells). */
|
|
67
|
+
export type BoundingBox = {
|
|
68
|
+
l: number;
|
|
69
|
+
t: number;
|
|
70
|
+
r: number;
|
|
71
|
+
b: number;
|
|
72
|
+
coord_origin: 'TOPLEFT' | 'BOTTOMLEFT';
|
|
73
|
+
};
|
|
74
|
+
/** Where an item sits in the PDF; one entry per page an item covers. */
|
|
75
|
+
export type ProvenanceItem = {
|
|
76
|
+
/** 1-based PDF page. */
|
|
77
|
+
page_no: number;
|
|
78
|
+
bbox: BoundingBox;
|
|
79
|
+
/** `[start, end)` span within the item's text, in Python code points: slice via `Array.from(text)`, not `text.slice`. */
|
|
80
|
+
charspan: [number, number];
|
|
81
|
+
};
|
|
82
|
+
/** Image data; with `images: 'embedded'` `uri` is a `data:<mime>;base64,...` URI. */
|
|
83
|
+
export type ImageRef = {
|
|
84
|
+
mimetype: string;
|
|
85
|
+
dpi: number;
|
|
86
|
+
size: Size;
|
|
87
|
+
uri: string;
|
|
88
|
+
};
|
|
89
|
+
/** Inline text formatting. */
|
|
90
|
+
export type Formatting = {
|
|
91
|
+
bold: boolean;
|
|
92
|
+
italic: boolean;
|
|
93
|
+
underline: boolean;
|
|
94
|
+
strikethrough: boolean;
|
|
95
|
+
script: 'baseline' | 'sub' | 'super';
|
|
96
|
+
};
|
|
97
|
+
/** Media track span (audio/video sources); not used for PDFs. */
|
|
98
|
+
export type TrackSource = {
|
|
99
|
+
kind: 'track';
|
|
100
|
+
start_time: number;
|
|
101
|
+
end_time: number;
|
|
102
|
+
identifier?: string | null;
|
|
103
|
+
voice?: string | null;
|
|
104
|
+
};
|
|
105
|
+
/** Value set by an enrichment model, with its confidence and creator. */
|
|
106
|
+
type MetaField = {
|
|
107
|
+
confidence?: number | null;
|
|
108
|
+
created_by?: string | null;
|
|
109
|
+
};
|
|
110
|
+
/** Enrichment metadata of any item. */
|
|
111
|
+
export type BaseMeta = {
|
|
112
|
+
summary?: (MetaField & {
|
|
113
|
+
text: string;
|
|
114
|
+
}) | null;
|
|
115
|
+
/** ISO 639-1 code, e.g. `'de'`. */
|
|
116
|
+
language?: (MetaField & {
|
|
117
|
+
code: string;
|
|
118
|
+
}) | null;
|
|
119
|
+
entities?: {
|
|
120
|
+
mentions: (MetaField & {
|
|
121
|
+
text: string;
|
|
122
|
+
orig?: string | null;
|
|
123
|
+
label?: string | null;
|
|
124
|
+
/** `[start, end)` in Python code points: slice via `Array.from(text)`, not `text.slice`. */
|
|
125
|
+
charspan?: [number, number] | null;
|
|
126
|
+
})[];
|
|
127
|
+
} | null;
|
|
128
|
+
keywords?: {
|
|
129
|
+
values: string[];
|
|
130
|
+
} | null;
|
|
131
|
+
topics?: {
|
|
132
|
+
values: string[];
|
|
133
|
+
} | null;
|
|
134
|
+
};
|
|
135
|
+
/** Enrichment metadata of tables, code and other floating items. */
|
|
136
|
+
export type FloatingMeta = BaseMeta & {
|
|
137
|
+
description?: (MetaField & {
|
|
138
|
+
text: string;
|
|
139
|
+
}) | null;
|
|
140
|
+
};
|
|
141
|
+
/** Enrichment metadata of pictures. */
|
|
142
|
+
export type PictureMeta = FloatingMeta & {
|
|
143
|
+
classification?: {
|
|
144
|
+
predictions: (MetaField & {
|
|
145
|
+
class_name: string;
|
|
146
|
+
})[];
|
|
147
|
+
} | null;
|
|
148
|
+
molecule?: (MetaField & {
|
|
149
|
+
smi: string;
|
|
150
|
+
}) | null;
|
|
151
|
+
tabular_chart?: (MetaField & {
|
|
152
|
+
title?: string | null;
|
|
153
|
+
chart_data: TableData;
|
|
154
|
+
}) | null;
|
|
155
|
+
code?: (MetaField & {
|
|
156
|
+
text: string;
|
|
157
|
+
language?: string | null;
|
|
158
|
+
}) | null;
|
|
159
|
+
};
|
|
160
|
+
/** Fields every item has. */
|
|
161
|
+
type NodeItem = {
|
|
162
|
+
/** Pointer to this item, e.g. `'#/texts/12'`. */
|
|
163
|
+
self_ref: string;
|
|
164
|
+
/** `null` for `body` and `furniture`. */
|
|
165
|
+
parent: RefItem | null;
|
|
166
|
+
children: RefItem[];
|
|
167
|
+
content_layer: ContentLayer;
|
|
168
|
+
};
|
|
169
|
+
/** Fields of items placed on a page. */
|
|
170
|
+
type DocItem = NodeItem & {
|
|
171
|
+
prov: ProvenanceItem[];
|
|
172
|
+
/** Not sent by every docling version. */
|
|
173
|
+
source?: TrackSource[];
|
|
174
|
+
/** Not sent by every docling version. */
|
|
175
|
+
comments?: FineRef[];
|
|
176
|
+
};
|
|
177
|
+
/** Fields of items with captions, references and footnotes. */
|
|
178
|
+
type FloatingFields = {
|
|
179
|
+
/** Caption texts, also listed in `children`. */
|
|
180
|
+
captions: RefItem[];
|
|
181
|
+
references: RefItem[];
|
|
182
|
+
footnotes: RefItem[];
|
|
183
|
+
/** Rendered crop of the item; `null` unless requested. */
|
|
184
|
+
image: ImageRef | null;
|
|
185
|
+
};
|
|
186
|
+
/** Docling's group kinds. */
|
|
187
|
+
export type GroupLabel = 'unspecified' | 'list' | 'ordered_list' | 'chapter' | 'section' | 'sheet' | 'slide' | 'form_area' | 'key_value_area' | 'comment_section' | 'inline' | 'picture_area';
|
|
188
|
+
/** Container without own content, e.g. `body`, `furniture` or a key-value area. */
|
|
189
|
+
export type GroupItem = NodeItem & {
|
|
190
|
+
meta: BaseMeta | null;
|
|
191
|
+
name: string;
|
|
192
|
+
label: GroupLabel;
|
|
193
|
+
};
|
|
194
|
+
/** List whose `children` are `ListItem`s; a nested list is a `ListGroup` child of a `ListItem`. */
|
|
195
|
+
export type ListGroup = GroupItem & {
|
|
196
|
+
label: 'list';
|
|
197
|
+
};
|
|
198
|
+
/** Run of texts that belong to one line or paragraph, e.g. with mixed formatting. */
|
|
199
|
+
export type InlineGroup = GroupItem & {
|
|
200
|
+
label: 'inline';
|
|
201
|
+
};
|
|
202
|
+
/** Labels of plain `TextItem`s; other text labels have their own item type. */
|
|
203
|
+
export type TextLabel = 'caption' | 'checkbox_selected' | 'checkbox_unselected' | 'footnote' | 'page_footer' | 'page_header' | 'paragraph' | 'reference' | 'text' | 'empty_value' | 'field_key' | 'field_hint' | 'marker' | 'handwritten_text';
|
|
204
|
+
/**
|
|
205
|
+
* **Fields of every text item**.
|
|
206
|
+
*
|
|
207
|
+
* - `orig`: text as read from the PDF; `text`: after docling's processing (formulas: LaTeX or empty)
|
|
208
|
+
*/
|
|
209
|
+
type TextFields = DocItem & {
|
|
210
|
+
meta: BaseMeta | null;
|
|
211
|
+
orig: string;
|
|
212
|
+
text: string;
|
|
213
|
+
formatting: Formatting | null;
|
|
214
|
+
hyperlink: string | null;
|
|
215
|
+
};
|
|
216
|
+
/** Paragraph, caption, footnote, page header or footer and other plain text. */
|
|
217
|
+
export type TextItem = TextFields & {
|
|
218
|
+
label: TextLabel;
|
|
219
|
+
};
|
|
220
|
+
/** Document title. */
|
|
221
|
+
export type TitleItem = TextFields & {
|
|
222
|
+
label: 'title';
|
|
223
|
+
};
|
|
224
|
+
/** Heading; `level` starts at 1. */
|
|
225
|
+
export type SectionHeaderItem = TextFields & {
|
|
226
|
+
label: 'section_header';
|
|
227
|
+
level: number;
|
|
228
|
+
};
|
|
229
|
+
/** List entry; `marker` as printed (`'(1)'`, `'-'`, often `''`), `text` may still start with a bullet glyph. */
|
|
230
|
+
export type ListItem = TextFields & {
|
|
231
|
+
label: 'list_item';
|
|
232
|
+
enumerated: boolean;
|
|
233
|
+
marker: string;
|
|
234
|
+
};
|
|
235
|
+
/** Code listing; `code_language` is `'unknown'` without code enrichment. */
|
|
236
|
+
export type CodeItem = Omit<TextFields, 'meta'> & FloatingFields & {
|
|
237
|
+
label: 'code';
|
|
238
|
+
meta: FloatingMeta | null;
|
|
239
|
+
code_language: string;
|
|
240
|
+
};
|
|
241
|
+
/** Formula; `text` is LaTeX with formula enrichment, otherwise empty with the raw characters in `orig`. */
|
|
242
|
+
export type FormulaItem = TextFields & {
|
|
243
|
+
label: 'formula';
|
|
244
|
+
};
|
|
245
|
+
/** Heading of a form field. */
|
|
246
|
+
export type FieldHeadingItem = TextFields & {
|
|
247
|
+
label: 'field_heading';
|
|
248
|
+
level: number;
|
|
249
|
+
};
|
|
250
|
+
/** Value of a form field. */
|
|
251
|
+
export type FieldValueItem = TextFields & {
|
|
252
|
+
label: 'field_value';
|
|
253
|
+
kind: 'read_only' | 'fillable';
|
|
254
|
+
};
|
|
255
|
+
/** Every item of `texts`, told apart by `label`. */
|
|
256
|
+
export type AnyTextItem = TitleItem | SectionHeaderItem | ListItem | CodeItem | FormulaItem | FieldHeadingItem | FieldValueItem | TextItem;
|
|
257
|
+
/** Table cell; offsets are 0-based and end-exclusive, spans repeat the cell in `grid`. */
|
|
258
|
+
export type TableCell = {
|
|
259
|
+
bbox: BoundingBox | null;
|
|
260
|
+
row_span: number;
|
|
261
|
+
col_span: number;
|
|
262
|
+
start_row_offset_idx: number;
|
|
263
|
+
end_row_offset_idx: number;
|
|
264
|
+
start_col_offset_idx: number;
|
|
265
|
+
end_col_offset_idx: number;
|
|
266
|
+
text: string;
|
|
267
|
+
column_header: boolean;
|
|
268
|
+
row_header: boolean;
|
|
269
|
+
row_section: boolean;
|
|
270
|
+
fillable: boolean;
|
|
271
|
+
/** Set when the cell holds other items (rich cell); its `text` is then a summary. */
|
|
272
|
+
ref?: RefItem;
|
|
273
|
+
};
|
|
274
|
+
/** Cells of a table; `grid` is the same cells as rows x columns. */
|
|
275
|
+
export type TableData = {
|
|
276
|
+
table_cells: TableCell[];
|
|
277
|
+
num_rows: number;
|
|
278
|
+
num_cols: number;
|
|
279
|
+
orientation: 'rot_0' | 'rot_90' | 'rot_180' | 'rot_270';
|
|
280
|
+
/** Computed by docling on export; `num_rows` arrays of `num_cols` cells. */
|
|
281
|
+
grid: TableCell[][];
|
|
282
|
+
};
|
|
283
|
+
/** Free-text description of a picture or table by a model. */
|
|
284
|
+
export type DescriptionAnnotation = {
|
|
285
|
+
kind: 'description';
|
|
286
|
+
text: string;
|
|
287
|
+
provenance: string;
|
|
288
|
+
};
|
|
289
|
+
/** Annotation without a fixed shape. */
|
|
290
|
+
export type MiscAnnotation = {
|
|
291
|
+
kind: 'misc';
|
|
292
|
+
content: Record<string, unknown>;
|
|
293
|
+
};
|
|
294
|
+
/** Table or table of contents (`document_index`). */
|
|
295
|
+
export type TableItem = DocItem & FloatingFields & {
|
|
296
|
+
label: 'table' | 'document_index';
|
|
297
|
+
meta: FloatingMeta | null;
|
|
298
|
+
data: TableData;
|
|
299
|
+
annotations: (DescriptionAnnotation | MiscAnnotation)[];
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* **Model output on a picture**: description, classification, molecule or chart data.
|
|
303
|
+
*
|
|
304
|
+
* - chart kinds are filled with `chartExtraction`
|
|
305
|
+
*/
|
|
306
|
+
export type PictureAnnotation = DescriptionAnnotation | MiscAnnotation | {
|
|
307
|
+
kind: 'classification';
|
|
308
|
+
provenance: string;
|
|
309
|
+
predicted_classes: {
|
|
310
|
+
class_name: string;
|
|
311
|
+
confidence: number;
|
|
312
|
+
}[];
|
|
313
|
+
} | {
|
|
314
|
+
kind: 'molecule_data';
|
|
315
|
+
smi: string;
|
|
316
|
+
confidence: number;
|
|
317
|
+
class_name: string;
|
|
318
|
+
segmentation: [number, number][];
|
|
319
|
+
provenance: string;
|
|
320
|
+
} | {
|
|
321
|
+
kind: 'tabular_chart_data';
|
|
322
|
+
title: string;
|
|
323
|
+
chart_data: TableData;
|
|
324
|
+
} | (ChartAxes<'line_chart_data'> & {
|
|
325
|
+
lines: {
|
|
326
|
+
label: string;
|
|
327
|
+
values: [number, number][];
|
|
328
|
+
}[];
|
|
329
|
+
}) | (ChartAxes<'bar_chart_data'> & {
|
|
330
|
+
bars: {
|
|
331
|
+
label: string;
|
|
332
|
+
values: number;
|
|
333
|
+
}[];
|
|
334
|
+
}) | (ChartAxes<'stacked_bar_chart_data'> & {
|
|
335
|
+
stacked_bars: {
|
|
336
|
+
label: string[];
|
|
337
|
+
values: [string, number][];
|
|
338
|
+
}[];
|
|
339
|
+
}) | {
|
|
340
|
+
kind: 'pie_chart_data';
|
|
341
|
+
title: string;
|
|
342
|
+
slices: {
|
|
343
|
+
label: string;
|
|
344
|
+
value: number;
|
|
345
|
+
}[];
|
|
346
|
+
} | (ChartAxes<'scatter_chart_data'> & {
|
|
347
|
+
points: {
|
|
348
|
+
value: [number, number];
|
|
349
|
+
}[];
|
|
350
|
+
});
|
|
351
|
+
/** Title and axis labels of a chart annotation. */
|
|
352
|
+
type ChartAxes<K extends string> = {
|
|
353
|
+
kind: K;
|
|
354
|
+
title: string;
|
|
355
|
+
x_axis_label: string;
|
|
356
|
+
y_axis_label: string;
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* **Picture or chart**.
|
|
360
|
+
*
|
|
361
|
+
* - `image`: data URI with `images: 'embedded'`, `null` with `'placeholder'`
|
|
362
|
+
* - `children`: captions and texts docling found inside the picture
|
|
363
|
+
*/
|
|
364
|
+
export type PictureItem = DocItem & FloatingFields & {
|
|
365
|
+
label: 'picture' | 'chart';
|
|
366
|
+
meta: PictureMeta | null;
|
|
367
|
+
annotations: PictureAnnotation[];
|
|
368
|
+
};
|
|
369
|
+
/** Cell of a key-value or form graph. */
|
|
370
|
+
export type GraphCell = {
|
|
371
|
+
label: 'unspecified' | 'key' | 'value' | 'checkbox';
|
|
372
|
+
cell_id: number;
|
|
373
|
+
text: string;
|
|
374
|
+
orig: string;
|
|
375
|
+
prov: ProvenanceItem | null;
|
|
376
|
+
item_ref: RefItem | null;
|
|
377
|
+
};
|
|
378
|
+
/** Link between two graph cells. */
|
|
379
|
+
export type GraphLink = {
|
|
380
|
+
label: 'unspecified' | 'to_value' | 'to_key' | 'to_parent' | 'to_child';
|
|
381
|
+
source_cell_id: number;
|
|
382
|
+
target_cell_id: number;
|
|
383
|
+
};
|
|
384
|
+
/** Key-value pairs as a graph of cells and links. */
|
|
385
|
+
export type GraphData = {
|
|
386
|
+
cells: GraphCell[];
|
|
387
|
+
links: GraphLink[];
|
|
388
|
+
};
|
|
389
|
+
/** Region of key-value pairs. */
|
|
390
|
+
export type KeyValueItem = DocItem & FloatingFields & {
|
|
391
|
+
label: 'key_value_region';
|
|
392
|
+
meta: FloatingMeta | null;
|
|
393
|
+
graph: GraphData;
|
|
394
|
+
};
|
|
395
|
+
/** Form region. */
|
|
396
|
+
export type FormItem = DocItem & FloatingFields & {
|
|
397
|
+
label: 'form';
|
|
398
|
+
meta: FloatingMeta | null;
|
|
399
|
+
graph: GraphData;
|
|
400
|
+
};
|
|
401
|
+
/** Region holding form fields. */
|
|
402
|
+
export type FieldRegionItem = DocItem & {
|
|
403
|
+
label: 'field_region';
|
|
404
|
+
meta: BaseMeta | null;
|
|
405
|
+
};
|
|
406
|
+
/** One form field. */
|
|
407
|
+
export type FieldItem = DocItem & {
|
|
408
|
+
label: 'field_item';
|
|
409
|
+
meta: BaseMeta | null;
|
|
410
|
+
};
|
|
411
|
+
export {};
|
|
412
|
+
//# sourceMappingURL=document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,wCAAwC;IACxC,SAAS,EAAE,SAAS,CAAC;IACrB,4CAA4C;IAC5C,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,CAAC,S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IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEjH,kCAAkC;AAClC,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG;IAAE,KAAK,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAA;CAAE,CAAC;AAEzF,sBAAsB;AACtB,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAA;CAAE,CAAC"}
|
package/dist/images.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { DoclingDocument, ProvenanceItem } from './document.js';
|
|
2
|
+
import type { ExtractedImage, ImageOptions, ImageSize, ImageWarning, PageImage, PageImageBox, PageImageWarning } from './types.js';
|
|
3
|
+
/** Rewritten md, extracted image files, and `image_not_decoded` warnings. */
|
|
4
|
+
export type ExtractedMarkdown = {
|
|
5
|
+
markdown: string;
|
|
6
|
+
images: ExtractedImage[];
|
|
7
|
+
warnings: ImageWarning[];
|
|
8
|
+
};
|
|
9
|
+
/** Document with decoded `pages[].image` set to `null`, the decoded page images and `page_image_not_decoded` warnings. */
|
|
10
|
+
export type ExtractedPageImages = {
|
|
11
|
+
document: DoclingDocument;
|
|
12
|
+
pageImages: PageImage[];
|
|
13
|
+
warnings: PageImageWarning[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* **Pixels per PDF point of pictures and page images**: `images_scale` (144 dpi).
|
|
17
|
+
*
|
|
18
|
+
* - fixed, so page images and `toPageImageBox` always agree
|
|
19
|
+
* - docling-serve's default and its maximum (`max_images_scale`); OCR runs at its own scale and is not affected
|
|
20
|
+
*/
|
|
21
|
+
export declare const PAGE_IMAGE_SCALE = 2;
|
|
22
|
+
/**
|
|
23
|
+
* **Size heuristic behind `omitSmall`**: icons, bullets, small logos and thin rules count as small.
|
|
24
|
+
*
|
|
25
|
+
* - small: area below 15 000 px, longer side below 200 px, or shorter side below 24 px
|
|
26
|
+
* - works on `ExtractedImage` and on `pictures[].image.size` of a DoclingDocument
|
|
27
|
+
* - `false` when width or height is not a finite number
|
|
28
|
+
*/
|
|
29
|
+
export declare function isSmallImage(size: ImageSize): boolean;
|
|
30
|
+
/** Reads pixel size from PNG IHDR chunk; returns `undefined` for non-PNG or truncated data. */
|
|
31
|
+
export declare function readPngSize(bytes: Uint8Array): ImageSize | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* **Extracts base64 images into raw bytes and replaces them with file links**.
|
|
34
|
+
*
|
|
35
|
+
* - links: `<prefix><n>.<ext>`, numbered over kept images only; extension mapped from the MIME subtype
|
|
36
|
+
* - small images (with `omitSmall`) and undecodable images are removed like placeholders
|
|
37
|
+
* - undecodable image: `image_not_decoded` warning with its 1-based index among all embedded images
|
|
38
|
+
* - docling's own `<!-- image -->` placeholders (pictures sent without data) are kept
|
|
39
|
+
*/
|
|
40
|
+
export declare function extractImages(markdown: string, options: Required<ImageOptions>): ExtractedMarkdown;
|
|
41
|
+
/**
|
|
42
|
+
* **Moves page images out of the DoclingDocument into raw bytes**.
|
|
43
|
+
*
|
|
44
|
+
* - every decoded `pages[].image` becomes `null`; the input document is not changed
|
|
45
|
+
* - page number from `page_no`, else from the `pages` key; result sorted by page
|
|
46
|
+
* - a URI that is not a base64 image data URI, or has invalid or empty data: `page_image_not_decoded` warning,
|
|
47
|
+
* and the page keeps its `image` as sent
|
|
48
|
+
* - a document without a `pages` object is returned as it is
|
|
49
|
+
*/
|
|
50
|
+
export declare function extractPageImages(document: DoclingDocument): ExtractedPageImages;
|
|
51
|
+
/**
|
|
52
|
+
* **Maps a docling bounding box onto its page image, in pixels with a top-left origin**.
|
|
53
|
+
*
|
|
54
|
+
* - `prov`: any `prov[]` entry; for a table cell pass `{ page_no: table.prov[0].page_no, bbox: cell.bbox }`
|
|
55
|
+
* - flips `BOTTOMLEFT` boxes using the page height from `document.pages`, then scales points by `PAGE_IMAGE_SCALE`
|
|
56
|
+
* - works without `pageImages: true`; the boxes fit the page images of any conversion by this client
|
|
57
|
+
* - returns `undefined` when page_no or a coordinate is not a finite number, or page is missing from `document.pages`
|
|
58
|
+
*/
|
|
59
|
+
export declare function toPageImageBox(document: DoclingDocument, prov: Pick<ProvenanceItem, 'page_no' | 'bbox'>): PageImageBox | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* **Removes `<!-- image -->` placeholders**.
|
|
62
|
+
*
|
|
63
|
+
* - a placeholder line goes; blank lines separating the text around it stay, without leaving a blank-line run
|
|
64
|
+
* - a placeholder inside a line is cut out of it
|
|
65
|
+
*/
|
|
66
|
+
export declare function removeImagePlaceholders(markdown: string): string;
|
|
67
|
+
//# sourceMappingURL=images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../src/images.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAY,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,KAAK,EACR,cAAc,EACd,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,gBAAgB,EACnB,MAAM,YAAY,CAAC;AAMpB,6EAA6E;AAC7E,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC5B,CAAC;AAEF,0HAA0H;AAC1H,MAAM,MAAM,mBAAmB,GAAG;IAC9B,QAAQ,EAAE,eAAe,CAAC;IAC1B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAChC,CAAC;AAMF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAmDlC;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAOrD;AAED,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAYpE;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,iBAAiB,CAoClG;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,GAAG,mBAAmB,CAgChF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC1B,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,MAAM,CAAC,GAC/C,YAAY,GAAG,SAAS,CA2B1B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type * from './document.js';
|
|
2
|
+
export type { CallOptions, ClientOptions, ConversionFailure, ConvertError, ConvertedDocument, ConvertedMarkdown, ConvertInput, DoclingClient, DoclingConfig, DoclingOptions, DocumentImageMode, DocumentJob, DocumentOptions, DocumentWarning, ErrorCode, ExtractedImage, ImageOptions, ImageSize, ImageWarning, Job, JobState, MarkdownImageMode, MarkdownJob, MarkdownJobOutput, MarkdownOptions, MarkdownWarning, PageImage, PageImageBox, PageImageWarning, PdfBackend, PdfInput, Pipeline, Result, ServerDetails, ServerError, ServerVersions, ServerWarning, TaskFailure, } from './types.js';
|
|
3
|
+
export { PAGE_IMAGE_SCALE } from './images.js';
|
|
4
|
+
export { createDoclingClient } from './client.js';
|
|
5
|
+
export { isSmallImage, readPngSize, toPageImageBox } from './images.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,mBAAmB,eAAe,CAAC;AACnC,YAAY,EACR,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,eAAe,EACf,SAAS,EACT,cAAc,EACd,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,GAAG,EACH,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,aAAa,EACb,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,GACd,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAM/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|