@nodetool-ai/document-processing 0.0.0-stage → 0.8.9-beta.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/README.md +3 -2
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -4
package/README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# PDF processing
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared byte-to-text PDF parser used by the full document nodes and the optional
|
|
4
|
+
execution-server document feature. Uses LiteParse with OCR disabled.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2026-10-31T09:10:58.329Z
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ParseResult } from "@llamaindex/liteparse";
|
|
2
|
+
/** Load the explicitly installed PDF parser without launching it at import time. */
|
|
3
|
+
export declare function loadLiteParse(): Promise<typeof import("@llamaindex/liteparse")>;
|
|
4
|
+
/** Parse document bytes using the same parser as the full server. */
|
|
5
|
+
export declare function parsePdfBuffer(buffer: Buffer): Promise<ParseResult>;
|
|
6
|
+
export interface PdfTextResult {
|
|
7
|
+
readonly text: string;
|
|
8
|
+
readonly pages: number;
|
|
9
|
+
}
|
|
10
|
+
/** Extract the PDF text layer, leaving scanned pages empty. */
|
|
11
|
+
export declare function extractPdfText(buffer: Buffer): Promise<PdfTextResult>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIzD,oFAAoF;AACpF,wBAAsB,aAAa,IAAI,OAAO,CAAC,cAAc,uBAAuB,CAAC,CAAC,CAMrF;AAED,qEAAqE;AACrE,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAGzE;AAED,MAAM,WAAW,aAAa;IAAG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAEhF,+DAA+D;AAC/D,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAG3E"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { importOptionalModule } from "@nodetool-ai/config";
|
|
2
|
+
import { missingRuntimePackageError } from "@nodetool-ai/protocol";
|
|
3
|
+
/** Load the explicitly installed PDF parser without launching it at import time. */
|
|
4
|
+
export async function loadLiteParse() {
|
|
5
|
+
try {
|
|
6
|
+
return await importOptionalModule("@llamaindex/liteparse");
|
|
7
|
+
}
|
|
8
|
+
catch (cause) {
|
|
9
|
+
throw missingRuntimePackageError("@llamaindex/liteparse", "pdf-js", cause);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** Parse document bytes using the same parser as the full server. */
|
|
13
|
+
export async function parsePdfBuffer(buffer) {
|
|
14
|
+
const { LiteParse } = await loadLiteParse();
|
|
15
|
+
return new LiteParse({ ocrEnabled: false }).parse(buffer, true);
|
|
16
|
+
}
|
|
17
|
+
/** Extract the PDF text layer, leaving scanned pages empty. */
|
|
18
|
+
export async function extractPdfText(buffer) {
|
|
19
|
+
const result = await parsePdfBuffer(buffer);
|
|
20
|
+
return { text: result.pages.map((page) => page.text).join("\n\n").trim(), pages: result.pages.length };
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,oFAAoF;AACpF,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,IAAI,CAAC;QACH,OAAO,MAAM,oBAAoB,CAAyC,uBAAuB,CAAC,CAAC;IACrG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,0BAA0B,CAAC,uBAAuB,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED,qEAAqE;AACrE,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAc;IACjD,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,aAAa,EAAE,CAAC;IAC5C,OAAO,IAAI,SAAS,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC;AAID,+DAA+D;AAC/D,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAc;IACjD,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;AACzG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodetool-ai/document-processing",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.8.9-beta.1",
|
|
4
|
+
"description": "PDF processing for explicitly installed document features",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22.0.0"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"nodetool-dev": "./src/index.ts",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "node ../../scripts/build-typescript-workspace.mjs",
|
|
21
|
+
"test": "node ../../scripts/run-vitest.mjs run",
|
|
22
|
+
"lint": "node ../../scripts/run-tsc.mjs --noEmit"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@llamaindex/liteparse": "^1.5.2",
|
|
26
|
+
"@nodetool-ai/config": "0.8.9-beta.1",
|
|
27
|
+
"@nodetool-ai/protocol": "0.8.9-beta.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22.0.0",
|
|
31
|
+
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
32
|
+
"vitest": "^5.0.1",
|
|
33
|
+
"pdf-lib": "^1.17.1"
|
|
34
|
+
},
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/nodetool-ai/nodetool.git",
|
|
39
|
+
"directory": "packages/document-processing"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist",
|
|
46
|
+
"README.md"
|
|
47
|
+
]
|
|
48
|
+
}
|