chore: review

This commit is contained in:
Ephraim Atta-Duncan
2025-11-19 10:57:54 +00:00
parent a0a3e7fb93
commit 654fc57639
12 changed files with 710 additions and 435 deletions

View File

@ -68,10 +68,13 @@ export const renderPdfToImage = async (pdfBytes: Uint8Array) => {
.map((result) => result.value);
if (results.some((result) => result.status === 'rejected')) {
console.error(
'Some pages failed to render:',
results.filter((result) => result.status === 'rejected').map((result) => result.reason),
);
const failedReasons = results
.filter((result): result is PromiseRejectedResult => result.status === 'rejected')
.map((result) => result.reason);
// Note: We don't have logger available in this package
// Errors are handled by the caller in document-analysis/index.ts
// which will use the proper logger for reporting failures
}
return pages;

View File

@ -2,9 +2,16 @@ import { z } from 'zod';
export const ZDetectedFormFieldSchema = z.object({
boundingBox: z
.array(z.number().min(0).max(1000))
.length(4)
.describe('Bounding box [ymin, xmin, ymax, xmax] in normalized 0-1000 range'),
.object({
ymin: z.number().min(0).max(1000),
xmin: z.number().min(0).max(1000),
ymax: z.number().min(0).max(1000),
xmax: z.number().min(0).max(1000),
})
.refine((box) => box.xmin < box.xmax && box.ymin < box.ymax, {
message: 'Bounding box must have min < max for both axes',
})
.describe('Bounding box {ymin, xmin, ymax, xmax} in normalized 0-1000 range'),
label: z
.enum([
'SIGNATURE',