mirror of
https://github.com/documenso/documenso.git
synced 2025-11-22 04:31:39 +10:00
chore: review
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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',
|
||||
|
||||
Reference in New Issue
Block a user