@heripo/pdf-parser 0.1.35 → 0.1.37
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.ko.md +1 -1
- package/README.md +1 -1
- package/dist/index.cjs +36 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/README.ko.md
CHANGED
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -624,6 +624,9 @@ var DoclingServer = class _DoclingServer {
|
|
|
624
624
|
this.venvPath = venvPath;
|
|
625
625
|
this.port = port;
|
|
626
626
|
}
|
|
627
|
+
logger;
|
|
628
|
+
venvPath;
|
|
629
|
+
port;
|
|
627
630
|
async isPortInUse() {
|
|
628
631
|
try {
|
|
629
632
|
const result = await spawnAsync("lsof", ["-ti", `:${this.port}`]);
|
|
@@ -770,6 +773,8 @@ var PythonEnvironment = class {
|
|
|
770
773
|
this.logger = logger;
|
|
771
774
|
this.venvPath = venvPath;
|
|
772
775
|
}
|
|
776
|
+
logger;
|
|
777
|
+
venvPath;
|
|
773
778
|
async setup() {
|
|
774
779
|
await this.checkPythonVersion();
|
|
775
780
|
await this.setupPythonEnvironment();
|
|
@@ -1023,6 +1028,7 @@ var PdfTextExtractor = class _PdfTextExtractor {
|
|
|
1023
1028
|
constructor(logger) {
|
|
1024
1029
|
this.logger = logger;
|
|
1025
1030
|
}
|
|
1031
|
+
logger;
|
|
1026
1032
|
/**
|
|
1027
1033
|
* Safely extract page texts: returns the map on success, `undefined` on
|
|
1028
1034
|
* failure. Failures are logged as a single warning and do not throw, so
|
|
@@ -1175,6 +1181,8 @@ var PdfLanguageDetector = class {
|
|
|
1175
1181
|
this.pageRenderer = pageRenderer;
|
|
1176
1182
|
this.textExtractor = textExtractor ?? new PdfTextExtractor(logger);
|
|
1177
1183
|
}
|
|
1184
|
+
logger;
|
|
1185
|
+
pageRenderer;
|
|
1178
1186
|
textExtractor;
|
|
1179
1187
|
async detect(pdfPath, outputDir, options) {
|
|
1180
1188
|
this.logger.info(
|
|
@@ -1391,6 +1399,8 @@ var ImagePdfFallbackError = class extends Error {
|
|
|
1391
1399
|
this.originalError = originalError;
|
|
1392
1400
|
this.fallbackError = fallbackError;
|
|
1393
1401
|
}
|
|
1402
|
+
originalError;
|
|
1403
|
+
fallbackError;
|
|
1394
1404
|
name = "ImagePdfFallbackError";
|
|
1395
1405
|
};
|
|
1396
1406
|
|
|
@@ -1402,6 +1412,7 @@ var PageRenderer = class {
|
|
|
1402
1412
|
constructor(logger) {
|
|
1403
1413
|
this.logger = logger;
|
|
1404
1414
|
}
|
|
1415
|
+
logger;
|
|
1405
1416
|
lastLoggedPercent = 0;
|
|
1406
1417
|
/**
|
|
1407
1418
|
* Render all pages of a PDF to individual PNG files.
|
|
@@ -1527,6 +1538,7 @@ var InvalidDocumentTypeError = class extends Error {
|
|
|
1527
1538
|
);
|
|
1528
1539
|
this.reason = reason;
|
|
1529
1540
|
}
|
|
1541
|
+
reason;
|
|
1530
1542
|
name = "InvalidDocumentTypeError";
|
|
1531
1543
|
code = "INVALID_DOCUMENT_TYPE";
|
|
1532
1544
|
};
|
|
@@ -2441,6 +2453,10 @@ var ChunkedPDFConverter = class {
|
|
|
2441
2453
|
this.config = config;
|
|
2442
2454
|
this.timeout = timeout;
|
|
2443
2455
|
}
|
|
2456
|
+
logger;
|
|
2457
|
+
client;
|
|
2458
|
+
config;
|
|
2459
|
+
timeout;
|
|
2444
2460
|
/**
|
|
2445
2461
|
* Convert a local PDF in chunks.
|
|
2446
2462
|
*
|
|
@@ -2787,6 +2803,9 @@ var DoclingConversionExecutor = class {
|
|
|
2787
2803
|
this.client = client;
|
|
2788
2804
|
this.timeout = timeout;
|
|
2789
2805
|
}
|
|
2806
|
+
logger;
|
|
2807
|
+
client;
|
|
2808
|
+
timeout;
|
|
2790
2809
|
/**
|
|
2791
2810
|
* Execute a full Docling conversion pipeline.
|
|
2792
2811
|
*
|
|
@@ -2949,6 +2968,7 @@ var ImagePdfConverter = class {
|
|
|
2949
2968
|
constructor(logger) {
|
|
2950
2969
|
this.logger = logger;
|
|
2951
2970
|
}
|
|
2971
|
+
logger;
|
|
2952
2972
|
/**
|
|
2953
2973
|
* Convert a PDF file to an image-based PDF.
|
|
2954
2974
|
* Downloads the PDF from URL, converts it using ImageMagick, and returns the path.
|
|
@@ -3433,6 +3453,7 @@ var PostDoclingPageProcessor = class {
|
|
|
3433
3453
|
constructor(logger) {
|
|
3434
3454
|
this.logger = logger;
|
|
3435
3455
|
}
|
|
3456
|
+
logger;
|
|
3436
3457
|
/**
|
|
3437
3458
|
* Read DoclingDocument from output directory, correct text via VLM,
|
|
3438
3459
|
* and save the corrected document back.
|
|
@@ -5239,6 +5260,8 @@ var ImageRegionSnapper = class {
|
|
|
5239
5260
|
this.logger = logger;
|
|
5240
5261
|
this.options = options;
|
|
5241
5262
|
}
|
|
5263
|
+
logger;
|
|
5264
|
+
options;
|
|
5242
5265
|
async snap(pageImagePath, pageSize, bbox) {
|
|
5243
5266
|
const warnings = [];
|
|
5244
5267
|
const dims = await this.getImageDimensions(pageImagePath);
|
|
@@ -5451,6 +5474,8 @@ var PictureSplitCandidateDetector = class {
|
|
|
5451
5474
|
this.options = options;
|
|
5452
5475
|
this.snapper = snapper ?? new ImageRegionSnapper(logger);
|
|
5453
5476
|
}
|
|
5477
|
+
logger;
|
|
5478
|
+
options;
|
|
5454
5479
|
snapper;
|
|
5455
5480
|
async detect(input) {
|
|
5456
5481
|
if (!this.isLargeEnoughForInspection(input.pictureBbox)) {
|
|
@@ -5752,6 +5777,9 @@ var ReviewAssistanceCheckpointStore = class _ReviewAssistanceCheckpointStore {
|
|
|
5752
5777
|
this.checkpoint = checkpoint;
|
|
5753
5778
|
this.now = now;
|
|
5754
5779
|
}
|
|
5780
|
+
path;
|
|
5781
|
+
checkpoint;
|
|
5782
|
+
now;
|
|
5755
5783
|
static open(outputDir, runId, now) {
|
|
5756
5784
|
const path = (0, import_node_path13.join)(outputDir, CHECKPOINT_FILE);
|
|
5757
5785
|
const checkpoint = this.read(path, runId, now?.() ?? /* @__PURE__ */ new Date());
|
|
@@ -6125,6 +6153,7 @@ var ImageCropWriter = class {
|
|
|
6125
6153
|
this.logger = logger;
|
|
6126
6154
|
this.snapper = snapper ?? new ImageRegionSnapper(logger);
|
|
6127
6155
|
}
|
|
6156
|
+
logger;
|
|
6128
6157
|
snapper;
|
|
6129
6158
|
async writeCrop(input) {
|
|
6130
6159
|
const imagesDir = (0, import_node_path14.join)(input.outputDir, "images");
|
|
@@ -6247,6 +6276,7 @@ var ReviewAssistancePatcher = class {
|
|
|
6247
6276
|
this.snapper = new ImageRegionSnapper(logger);
|
|
6248
6277
|
this.cropWriter = new ImageCropWriter(logger, this.snapper);
|
|
6249
6278
|
}
|
|
6279
|
+
logger;
|
|
6250
6280
|
snapper;
|
|
6251
6281
|
cropWriter;
|
|
6252
6282
|
captionResolver = new OrphanCaptionResolver();
|
|
@@ -8658,6 +8688,7 @@ var ReviewAssistanceRunner = class {
|
|
|
8658
8688
|
constructor(logger) {
|
|
8659
8689
|
this.logger = logger;
|
|
8660
8690
|
}
|
|
8691
|
+
logger;
|
|
8661
8692
|
async analyzeAndSave(outputDir, reportId, modelResolver, options) {
|
|
8662
8693
|
this.emitProgress(options, {
|
|
8663
8694
|
substage: "review-assistance:prepare",
|
|
@@ -10568,6 +10599,7 @@ var PostDoclingCorrectionPipeline = class {
|
|
|
10568
10599
|
constructor(logger) {
|
|
10569
10600
|
this.logger = logger;
|
|
10570
10601
|
}
|
|
10602
|
+
logger;
|
|
10571
10603
|
wrapCallback(pdfPath, reportId, options, originalCallback, abortSignal) {
|
|
10572
10604
|
const correction = normalizePDFCorrectionOptions(options.correction);
|
|
10573
10605
|
return async (outputDir) => {
|
|
@@ -10674,6 +10706,10 @@ var PDFConverter = class {
|
|
|
10674
10706
|
this.enableImagePdfFallback = enableImagePdfFallback;
|
|
10675
10707
|
this.timeout = timeout;
|
|
10676
10708
|
}
|
|
10709
|
+
logger;
|
|
10710
|
+
client;
|
|
10711
|
+
enableImagePdfFallback;
|
|
10712
|
+
timeout;
|
|
10677
10713
|
documentTypeValidated = false;
|
|
10678
10714
|
/**
|
|
10679
10715
|
* Validate that the PDF is an archaeological investigation report.
|