chore: review

This commit is contained in:
Ephraim Atta-Duncan
2025-11-19 08:53:57 +00:00
parent 57c4c3fd48
commit a0a3e7fb93
4 changed files with 103 additions and 53 deletions

View File

@ -1,16 +1,35 @@
export type TDetectedFormField = {
boundingBox: number[];
label:
| 'SIGNATURE'
| 'INITIALS'
| 'NAME'
| 'EMAIL'
| 'DATE'
| 'TEXT'
| 'NUMBER'
| 'RADIO'
| 'CHECKBOX'
| 'DROPDOWN';
pageNumber: number;
recipientId: number;
};
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'),
label: z
.enum([
'SIGNATURE',
'INITIALS',
'NAME',
'EMAIL',
'DATE',
'TEXT',
'NUMBER',
'RADIO',
'CHECKBOX',
'DROPDOWN',
])
.describe('Documenso field type inferred from nearby label text or visual characteristics'),
pageNumber: z
.number()
.int()
.positive()
.describe('1-indexed page number where field was detected'),
recipientId: z
.number()
.int()
.describe(
'ID of the recipient (from the provided envelope recipients) who should own the field',
),
});
export type TDetectedFormField = z.infer<typeof ZDetectedFormFieldSchema>;