@dragon708/docmind-node 1.12.2 → 1.13.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/dist/index.d.ts +9 -1
- package/dist/index.js +8 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { AnalyzeDocxIncludeFlags, DocxToHtmlOptions, ExtractStructuredDataFromDo
|
|
|
6
6
|
export { AnalyzeDocxIncludeFlags, DocxEmbeddedImage, DocxEmbeddedImageConversionOptions, DocxEmbeddedImageConversionResult, DocxEmbeddedImageWebSlice, DocxImageExtractionMode, ExtractImagesFromDocxOptions, ExtractImagesFromDocxResult, ExtractStructuredDataFromDocxOptions, convertDocxEmbeddedImageToWeb, convertDocxImagesForWeb, docxImageIsBrowserRenderable, docxImageRequiresConversion, docxImageSuggestedTargetFormat, docxImageToDataUri, extractImagesFromDocx, extractStructuredDataFromDocx, isNodeJsRuntime } from '@dragon708/docmind-docx';
|
|
7
7
|
import { PdfAnalyzeOptions, ExtractStructuredDataFromPdfOptions } from '@dragon708/docmind-pdf';
|
|
8
8
|
export { ExtractStructuredDataFromPdfIncludeFlags, ExtractStructuredDataFromPdfOptions, extractStructuredDataFromPdf } from '@dragon708/docmind-pdf';
|
|
9
|
-
import { RenderLlmTextOptions, RenderMarkdownOptions, ConvertDocxToMarkdownOptions, ConvertPdfToMarkdownOptions, RenderMarkdownSectionsOptions, MarkdownSection } from '@dragon708/docmind-markdown';
|
|
9
|
+
import { RenderLlmTextOptions, RenderMarkdownOptions, ConvertDocxToMarkdownOptions, ConvertPdfToMarkdownOptions, ExtractMarkdownStrategy, RenderMarkdownSectionsOptions, MarkdownSection } from '@dragon708/docmind-markdown';
|
|
10
10
|
export { MarkdownSection } from '@dragon708/docmind-markdown';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -63,6 +63,14 @@ interface NodeExtractMarkdownOptions extends NodeExtractStructuredDataOptions {
|
|
|
63
63
|
readonly markdownDocx?: ConvertDocxToMarkdownOptions;
|
|
64
64
|
/** Forwarded to `extractMarkdown` → `convertPdfToMarkdown` when bytes are PDF. */
|
|
65
65
|
readonly markdownPdf?: ConvertPdfToMarkdownOptions;
|
|
66
|
+
/**
|
|
67
|
+
* Optional: receive `strategy` and merged `warnings` from `@dragon708/docmind-markdown` `extractMarkdown`
|
|
68
|
+
* (e.g. `pdf-opendataloader` vs `pdf-structured-fallback`) without changing the `Promise<string>` return type.
|
|
69
|
+
*/
|
|
70
|
+
readonly onMarkdownExtract?: (info: {
|
|
71
|
+
strategy: ExtractMarkdownStrategy;
|
|
72
|
+
warnings: readonly string[];
|
|
73
|
+
}) => void;
|
|
66
74
|
}
|
|
67
75
|
/**
|
|
68
76
|
* {@link extractLlmContent}: same structured fields; `llm` forwards to `renderLlmText`.
|
package/dist/index.js
CHANGED
|
@@ -620,7 +620,13 @@ async function runOcr(input, options) {
|
|
|
620
620
|
}
|
|
621
621
|
async function extractMarkdown(input, options) {
|
|
622
622
|
throwIfAborted(options?.signal);
|
|
623
|
-
const {
|
|
623
|
+
const {
|
|
624
|
+
markdown: markdownOpts,
|
|
625
|
+
markdownDocx,
|
|
626
|
+
markdownPdf,
|
|
627
|
+
onMarkdownExtract,
|
|
628
|
+
...structuredOpts
|
|
629
|
+
} = options ?? {};
|
|
624
630
|
const resolved = await resolveNodeAnalyzeInput(input);
|
|
625
631
|
const structured = await extractStructuredData(resolved, structuredOpts);
|
|
626
632
|
const data = await bytesFromDetectInput(resolved);
|
|
@@ -639,6 +645,7 @@ async function extractMarkdown(input, options) {
|
|
|
639
645
|
structuredFallback: structured
|
|
640
646
|
}
|
|
641
647
|
);
|
|
648
|
+
onMarkdownExtract?.({ strategy: r.strategy, warnings: r.warnings });
|
|
642
649
|
return r.markdown;
|
|
643
650
|
}
|
|
644
651
|
async function extractLlmContent(input, options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dragon708/docmind-node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Official DocMind Node facade: analyzeFile, intent APIs, PDF/DOCX/OCR, and fs helpers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@dragon708/docmind-docx": "^1.8.0",
|
|
36
|
-
"@dragon708/docmind-markdown": "^1.
|
|
36
|
+
"@dragon708/docmind-markdown": "^1.2.0",
|
|
37
37
|
"@dragon708/docmind-ocr": "^1.1.4",
|
|
38
38
|
"@dragon708/docmind-pdf": "^2.2.0",
|
|
39
39
|
"@dragon708/docmind-shared": "^1.2.0"
|