mirror of
https://github.com/documenso/documenso.git
synced 2026-08-24 15:22:26 +10:00
Merge branch 'main' into feat/template-document-name-options
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { AppError } from '@documenso/lib/errors/app-error';
|
||||||
import { createEnvelopeFields } from '@documenso/lib/server-only/field/create-envelope-fields';
|
import { createEnvelopeFields } from '@documenso/lib/server-only/field/create-envelope-fields';
|
||||||
import { deleteDocumentField } from '@documenso/lib/server-only/field/delete-document-field';
|
import { deleteDocumentField } from '@documenso/lib/server-only/field/delete-document-field';
|
||||||
import { deleteTemplateField } from '@documenso/lib/server-only/field/delete-template-field';
|
import { deleteTemplateField } from '@documenso/lib/server-only/field/delete-template-field';
|
||||||
@@ -613,6 +614,7 @@ export const fieldRouter = router({
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
signFieldWithToken: procedure.input(ZSignFieldWithTokenMutationSchema).mutation(async ({ input, ctx }) => {
|
signFieldWithToken: procedure.input(ZSignFieldWithTokenMutationSchema).mutation(async ({ input, ctx }) => {
|
||||||
|
try {
|
||||||
const { token, fieldId, value, isBase64, authOptions } = input;
|
const { token, fieldId, value, isBase64, authOptions } = input;
|
||||||
|
|
||||||
ctx.logger.info({
|
ctx.logger.info({
|
||||||
@@ -630,6 +632,19 @@ export const fieldRouter = router({
|
|||||||
authOptions,
|
authOptions,
|
||||||
requestMetadata: ctx.metadata.requestMetadata,
|
requestMetadata: ctx.metadata.requestMetadata,
|
||||||
});
|
});
|
||||||
|
} catch (err) {
|
||||||
|
// Log the error for debugging purposes.
|
||||||
|
ctx.logger.error({
|
||||||
|
message: 'Error signing field with token',
|
||||||
|
error: err instanceof AppError ? `[${err.code}]: ${err.message}` : String(err),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Raw console.log incase we're somehow deailing with a funky error object that doesn't serialize well.
|
||||||
|
console.log('Error signing field with token', err);
|
||||||
|
|
||||||
|
// Rethrow the error so that the client receives the appropriate error response.
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -638,6 +653,7 @@ export const fieldRouter = router({
|
|||||||
removeSignedFieldWithToken: procedure
|
removeSignedFieldWithToken: procedure
|
||||||
.input(ZRemovedSignedFieldWithTokenMutationSchema)
|
.input(ZRemovedSignedFieldWithTokenMutationSchema)
|
||||||
.mutation(async ({ input, ctx }) => {
|
.mutation(async ({ input, ctx }) => {
|
||||||
|
try {
|
||||||
const { token, fieldId } = input;
|
const { token, fieldId } = input;
|
||||||
|
|
||||||
ctx.logger.info({
|
ctx.logger.info({
|
||||||
@@ -651,5 +667,17 @@ export const fieldRouter = router({
|
|||||||
fieldId,
|
fieldId,
|
||||||
requestMetadata: ctx.metadata.requestMetadata,
|
requestMetadata: ctx.metadata.requestMetadata,
|
||||||
});
|
});
|
||||||
|
} catch (err) {
|
||||||
|
// Log the error for debugging purposes.
|
||||||
|
ctx.logger.error({
|
||||||
|
message: 'Error removing signed field with token',
|
||||||
|
error: err instanceof AppError ? `[${err.code}]: ${err.message}` : String(err),
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Error removing signed field with token', err);
|
||||||
|
|
||||||
|
// Rethrow the error so that the client receives the appropriate error response.
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { prepareCscRecipientSigning } from '@documenso/ee/server-only/signing/csc/prepare-recipient-signing';
|
import { prepareCscRecipientSigning } from '@documenso/ee/server-only/signing/csc/prepare-recipient-signing';
|
||||||
|
import { AppError } from '@documenso/lib/errors/app-error';
|
||||||
import { completeDocumentWithToken } from '@documenso/lib/server-only/document/complete-document-with-token';
|
import { completeDocumentWithToken } from '@documenso/lib/server-only/document/complete-document-with-token';
|
||||||
import { rejectDocumentWithToken } from '@documenso/lib/server-only/document/reject-document-with-token';
|
import { rejectDocumentWithToken } from '@documenso/lib/server-only/document/reject-document-with-token';
|
||||||
import { createEnvelopeRecipients } from '@documenso/lib/server-only/recipient/create-envelope-recipients';
|
import { createEnvelopeRecipients } from '@documenso/lib/server-only/recipient/create-envelope-recipients';
|
||||||
@@ -11,7 +12,6 @@ import { isTspEnvelope } from '@documenso/lib/types/signature-level';
|
|||||||
import { unsafeBuildEnvelopeIdQuery } from '@documenso/lib/utils/envelope';
|
import { unsafeBuildEnvelopeIdQuery } from '@documenso/lib/utils/envelope';
|
||||||
import { prisma } from '@documenso/prisma';
|
import { prisma } from '@documenso/prisma';
|
||||||
import { EnvelopeType } from '@prisma/client';
|
import { EnvelopeType } from '@prisma/client';
|
||||||
|
|
||||||
import { ZGenericSuccessResponse, ZSuccessResponseSchema } from '../schema';
|
import { ZGenericSuccessResponse, ZSuccessResponseSchema } from '../schema';
|
||||||
import { authenticatedProcedure, procedure, router } from '../trpc';
|
import { authenticatedProcedure, procedure, router } from '../trpc';
|
||||||
import { findRecipientSuggestionsRoute } from './find-recipient-suggestions';
|
import { findRecipientSuggestionsRoute } from './find-recipient-suggestions';
|
||||||
@@ -590,6 +590,7 @@ export const recipientRouter = router({
|
|||||||
.input(ZCompleteDocumentWithTokenMutationSchema)
|
.input(ZCompleteDocumentWithTokenMutationSchema)
|
||||||
.output(ZCompleteDocumentWithTokenResponseSchema)
|
.output(ZCompleteDocumentWithTokenResponseSchema)
|
||||||
.mutation(async ({ input, ctx }) => {
|
.mutation(async ({ input, ctx }) => {
|
||||||
|
try {
|
||||||
const { token, documentId, accessAuthOptions, nextSigner, recipientOverride } = input;
|
const { token, documentId, accessAuthOptions, nextSigner, recipientOverride } = input;
|
||||||
|
|
||||||
ctx.logger.info({
|
ctx.logger.info({
|
||||||
@@ -631,6 +632,19 @@ export const recipientRouter = router({
|
|||||||
});
|
});
|
||||||
|
|
||||||
return { status: 'SIGNED' as const };
|
return { status: 'SIGNED' as const };
|
||||||
|
} catch (err) {
|
||||||
|
// Log the error for debugging purposes.
|
||||||
|
ctx.logger.error({
|
||||||
|
message: 'Error completing document with token',
|
||||||
|
error: err instanceof AppError ? `[${err.code}]: ${err.message}` : String(err),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Raw console.log incase we're somehow dealing with a funky error object that doesn't serialize well.
|
||||||
|
console.log('Error completing document with token', err);
|
||||||
|
|
||||||
|
// Rethrow the error so that the client receives the appropriate error response.
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user