fix: additional backwards compat

This commit is contained in:
David Nguyen
2025-10-14 15:19:09 +11:00
parent bddaa5ec66
commit 0eef4cd7e6
32 changed files with 288 additions and 92 deletions

View File

@ -7,6 +7,14 @@ import {
} from '@documenso/lib/types/document-auth';
import { ZDocumentFormValuesSchema } from '@documenso/lib/types/document-form-values';
import { ZDocumentMetaCreateSchema } from '@documenso/lib/types/document-meta';
import {
ZFieldHeightSchema,
ZFieldPageNumberSchema,
ZFieldPageXSchema,
ZFieldPageYSchema,
ZFieldWidthSchema,
} from '@documenso/lib/types/field';
import { ZFieldAndMetaSchema } from '@documenso/lib/types/field-meta';
import {
ZDocumentExternalIdSchema,
@ -48,18 +56,22 @@ export const ZCreateEnvelopeRequestSchema = z.object({
recipients: z
.array(
ZCreateRecipientSchema.extend({
// Todo: Envelopes ?
// fields: ZFieldAndMetaSchema.and(
// z.object({
// pageNumber: ZFieldPageNumberSchema,
// pageX: ZFieldPageXSchema,
// pageY: ZFieldPageYSchema,
// width: ZFieldWidthSchema,
// height: ZFieldHeightSchema,
// }),
// )
// .array()
// .optional(),
fields: ZFieldAndMetaSchema.and(
z.object({
documentDataId: z
.string()
.describe(
'The ID of the document data to create the field on. If empty, the first document data will be used.',
),
page: ZFieldPageNumberSchema,
positionX: ZFieldPageXSchema,
positionY: ZFieldPageYSchema,
width: ZFieldWidthSchema,
height: ZFieldHeightSchema,
}),
)
.array()
.optional(),
}),
)
.optional(),

View File

@ -20,7 +20,10 @@ export const ZSetEnvelopeRecipientsRequestSchema = z.object({
});
export const ZSetEnvelopeRecipientsResponseSchema = z.object({
recipients: ZRecipientLiteSchema.array(),
recipients: ZRecipientLiteSchema.omit({
documentId: true,
templateId: true,
}).array(),
});
export type TSetEnvelopeRecipientsRequest = z.infer<typeof ZSetEnvelopeRecipientsRequestSchema>;

View File

@ -57,7 +57,10 @@ export const ZSignEnvelopeFieldRequestSchema = z.object({
});
export const ZSignEnvelopeFieldResponseSchema = z.object({
signedField: ZFieldSchema.extend({
signedField: ZFieldSchema.omit({
templateId: true,
documentId: true,
}).extend({
signature: SignatureSchema.nullish(),
}),
});