mirror of
https://github.com/documenso/documenso.git
synced 2025-11-23 21:21:37 +10:00
chore: extract shared audit log query logic
This commit is contained in:
110
packages/lib/server-only/document/audit-log-query.ts
Normal file
110
packages/lib/server-only/document/audit-log-query.ts
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
import type { DocumentAuditLog, Envelope, Prisma } from '@prisma/client';
|
||||||
|
|
||||||
|
import { prisma } from '@documenso/prisma';
|
||||||
|
|
||||||
|
import { DOCUMENT_AUDIT_LOG_TYPE } from '../../types/document-audit-logs';
|
||||||
|
import type { FindResultResponse } from '../../types/search-params';
|
||||||
|
import { parseDocumentAuditLogData } from '../../utils/document-audit-logs';
|
||||||
|
|
||||||
|
const RECENT_ACTIVITY_EVENT_TYPES = [
|
||||||
|
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_COMPLETED,
|
||||||
|
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_CREATED,
|
||||||
|
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_DELETED,
|
||||||
|
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_OPENED,
|
||||||
|
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_RECIPIENT_COMPLETED,
|
||||||
|
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_RECIPIENT_REJECTED,
|
||||||
|
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_SENT,
|
||||||
|
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_MOVED_TO_TEAM,
|
||||||
|
];
|
||||||
|
|
||||||
|
export interface AuditLogQueryOptions {
|
||||||
|
envelope: Envelope;
|
||||||
|
page?: number;
|
||||||
|
perPage?: number;
|
||||||
|
orderBy?: {
|
||||||
|
column: keyof DocumentAuditLog;
|
||||||
|
direction: 'asc' | 'desc';
|
||||||
|
};
|
||||||
|
cursor?: string;
|
||||||
|
filterForRecentActivity?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildAuditLogWhereClause(
|
||||||
|
envelope: Envelope,
|
||||||
|
filterForRecentActivity?: boolean,
|
||||||
|
): Prisma.DocumentAuditLogWhereInput {
|
||||||
|
const baseWhereClause: Prisma.DocumentAuditLogWhereInput = {
|
||||||
|
envelopeId: envelope.id,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!filterForRecentActivity) {
|
||||||
|
return baseWhereClause;
|
||||||
|
}
|
||||||
|
|
||||||
|
const recentActivityConditions: Prisma.DocumentAuditLogWhereInput['OR'] = [
|
||||||
|
{
|
||||||
|
type: {
|
||||||
|
in: RECENT_ACTIVITY_EVENT_TYPES,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: DOCUMENT_AUDIT_LOG_TYPE.EMAIL_SENT,
|
||||||
|
data: {
|
||||||
|
path: ['isResending'],
|
||||||
|
equals: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return {
|
||||||
|
...baseWhereClause,
|
||||||
|
OR: recentActivityConditions,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function queryAuditLogs({
|
||||||
|
envelope,
|
||||||
|
page = 1,
|
||||||
|
perPage = 30,
|
||||||
|
orderBy,
|
||||||
|
cursor,
|
||||||
|
filterForRecentActivity,
|
||||||
|
}: AuditLogQueryOptions) {
|
||||||
|
const orderByColumn = orderBy?.column ?? 'createdAt';
|
||||||
|
const orderByDirection = orderBy?.direction ?? 'desc';
|
||||||
|
|
||||||
|
const whereClause = buildAuditLogWhereClause(envelope, filterForRecentActivity);
|
||||||
|
|
||||||
|
const normalizedPage = Math.max(page, 1);
|
||||||
|
const skip = (normalizedPage - 1) * perPage;
|
||||||
|
|
||||||
|
const [data, count] = await Promise.all([
|
||||||
|
prisma.documentAuditLog.findMany({
|
||||||
|
where: whereClause,
|
||||||
|
skip,
|
||||||
|
take: perPage + 1,
|
||||||
|
orderBy: {
|
||||||
|
[orderByColumn]: orderByDirection,
|
||||||
|
},
|
||||||
|
cursor: cursor ? { id: cursor } : undefined,
|
||||||
|
}),
|
||||||
|
prisma.documentAuditLog.count({
|
||||||
|
where: whereClause,
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const allParsedData = data.map((auditLog) => parseDocumentAuditLogData(auditLog));
|
||||||
|
|
||||||
|
const hasNextPage = allParsedData.length > perPage;
|
||||||
|
const parsedData = hasNextPage ? allParsedData.slice(0, perPage) : allParsedData;
|
||||||
|
const nextCursor = hasNextPage ? allParsedData[perPage].id : undefined;
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: parsedData,
|
||||||
|
count,
|
||||||
|
currentPage: normalizedPage,
|
||||||
|
perPage,
|
||||||
|
totalPages: Math.ceil(count / perPage),
|
||||||
|
nextCursor,
|
||||||
|
} satisfies FindResultResponse<typeof parsedData> & { nextCursor?: string };
|
||||||
|
}
|
||||||
@ -1,17 +1,15 @@
|
|||||||
import { type DocumentAuditLog, EnvelopeType, type Prisma } from '@prisma/client';
|
import type { DocumentAuditLog } from '@prisma/client';
|
||||||
|
import { EnvelopeType } from '@prisma/client';
|
||||||
|
|
||||||
import { prisma } from '@documenso/prisma';
|
import { prisma } from '@documenso/prisma';
|
||||||
|
|
||||||
import { AppError, AppErrorCode } from '../../errors/app-error';
|
import { AppError, AppErrorCode } from '../../errors/app-error';
|
||||||
import { DOCUMENT_AUDIT_LOG_TYPE } from '../../types/document-audit-logs';
|
|
||||||
import type { FindResultResponse } from '../../types/search-params';
|
|
||||||
import { parseDocumentAuditLogData } from '../../utils/document-audit-logs';
|
|
||||||
import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';
|
import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';
|
||||||
|
import { queryAuditLogs } from './audit-log-query';
|
||||||
|
|
||||||
export interface FindDocumentAuditLogsOptions {
|
interface BaseAuditLogOptions {
|
||||||
userId: number;
|
userId: number;
|
||||||
teamId: number;
|
teamId: number;
|
||||||
documentId: number;
|
|
||||||
page?: number;
|
page?: number;
|
||||||
perPage?: number;
|
perPage?: number;
|
||||||
orderBy?: {
|
orderBy?: {
|
||||||
@ -20,23 +18,26 @@ export interface FindDocumentAuditLogsOptions {
|
|||||||
};
|
};
|
||||||
cursor?: string;
|
cursor?: string;
|
||||||
filterForRecentActivity?: boolean;
|
filterForRecentActivity?: boolean;
|
||||||
eventTypes?: string[];
|
}
|
||||||
|
|
||||||
|
export interface FindDocumentAuditLogsOptions extends BaseAuditLogOptions {
|
||||||
|
documentId: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FindEnvelopeAuditLogsOptions extends BaseAuditLogOptions {
|
||||||
|
envelopeId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const findDocumentAuditLogs = async ({
|
export const findDocumentAuditLogs = async ({
|
||||||
userId,
|
userId,
|
||||||
teamId,
|
teamId,
|
||||||
documentId,
|
documentId,
|
||||||
page = 1,
|
page,
|
||||||
perPage = 30,
|
perPage,
|
||||||
orderBy,
|
orderBy,
|
||||||
cursor,
|
cursor,
|
||||||
filterForRecentActivity,
|
filterForRecentActivity,
|
||||||
eventTypes,
|
|
||||||
}: FindDocumentAuditLogsOptions) => {
|
}: FindDocumentAuditLogsOptions) => {
|
||||||
const orderByColumn = orderBy?.column ?? 'createdAt';
|
|
||||||
const orderByDirection = orderBy?.direction ?? 'desc';
|
|
||||||
|
|
||||||
const { envelopeWhereInput } = await getEnvelopeWhereInput({
|
const { envelopeWhereInput } = await getEnvelopeWhereInput({
|
||||||
id: {
|
id: {
|
||||||
type: 'documentId',
|
type: 'documentId',
|
||||||
@ -55,118 +56,35 @@ export const findDocumentAuditLogs = async ({
|
|||||||
throw new AppError(AppErrorCode.NOT_FOUND);
|
throw new AppError(AppErrorCode.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
const whereClause: Prisma.DocumentAuditLogWhereInput = {
|
return queryAuditLogs({
|
||||||
envelopeId: envelope.id,
|
envelope,
|
||||||
};
|
page,
|
||||||
|
|
||||||
if (eventTypes && eventTypes.length > 0) {
|
|
||||||
whereClause.type = {
|
|
||||||
in: eventTypes,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filterForRecentActivity) {
|
|
||||||
whereClause.OR = [
|
|
||||||
{
|
|
||||||
type: {
|
|
||||||
in: [
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_COMPLETED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_CREATED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_DELETED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_OPENED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_RECIPIENT_COMPLETED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_RECIPIENT_REJECTED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_SENT,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_MOVED_TO_TEAM,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: DOCUMENT_AUDIT_LOG_TYPE.EMAIL_SENT,
|
|
||||||
data: {
|
|
||||||
path: ['isResending'],
|
|
||||||
equals: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
const [data, count] = await Promise.all([
|
|
||||||
prisma.documentAuditLog.findMany({
|
|
||||||
where: whereClause,
|
|
||||||
skip: Math.max(page - 1, 0) * perPage,
|
|
||||||
take: perPage + 1,
|
|
||||||
orderBy: {
|
|
||||||
[orderByColumn]: orderByDirection,
|
|
||||||
},
|
|
||||||
cursor: cursor ? { id: cursor } : undefined,
|
|
||||||
}),
|
|
||||||
prisma.documentAuditLog.count({
|
|
||||||
where: whereClause,
|
|
||||||
}),
|
|
||||||
]);
|
|
||||||
|
|
||||||
let nextCursor: string | undefined = undefined;
|
|
||||||
|
|
||||||
const parsedData = data.map((auditLog) => parseDocumentAuditLogData(auditLog));
|
|
||||||
|
|
||||||
if (parsedData.length > perPage) {
|
|
||||||
const nextItem = parsedData.pop();
|
|
||||||
nextCursor = nextItem!.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
data: parsedData,
|
|
||||||
count,
|
|
||||||
currentPage: Math.max(page, 1),
|
|
||||||
perPage,
|
perPage,
|
||||||
totalPages: Math.ceil(count / perPage),
|
orderBy,
|
||||||
nextCursor,
|
cursor,
|
||||||
} satisfies FindResultResponse<typeof parsedData> & { nextCursor?: string };
|
filterForRecentActivity,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface FindEnvelopeAuditLogsOptions {
|
|
||||||
userId: number;
|
|
||||||
teamId: number;
|
|
||||||
envelopeId: string;
|
|
||||||
page?: number;
|
|
||||||
perPage?: number;
|
|
||||||
orderBy?: {
|
|
||||||
column: keyof DocumentAuditLog;
|
|
||||||
direction: 'asc' | 'desc';
|
|
||||||
};
|
|
||||||
cursor?: string;
|
|
||||||
filterForRecentActivity?: boolean;
|
|
||||||
eventTypes?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export const findEnvelopeAuditLogs = async ({
|
export const findEnvelopeAuditLogs = async ({
|
||||||
userId,
|
userId,
|
||||||
teamId,
|
teamId,
|
||||||
envelopeId,
|
envelopeId,
|
||||||
page = 1,
|
page,
|
||||||
perPage = 30,
|
perPage,
|
||||||
orderBy,
|
orderBy,
|
||||||
cursor,
|
cursor,
|
||||||
filterForRecentActivity,
|
filterForRecentActivity,
|
||||||
eventTypes,
|
|
||||||
}: FindEnvelopeAuditLogsOptions) => {
|
}: FindEnvelopeAuditLogsOptions) => {
|
||||||
const orderByColumn = orderBy?.column ?? 'createdAt';
|
const isLegacyDocumentId = /^\d+$/.test(envelopeId);
|
||||||
const orderByDirection = orderBy?.direction ?? 'desc';
|
|
||||||
|
|
||||||
const isNumericId = /^\d+$/.test(envelopeId);
|
const idConfig = isLegacyDocumentId
|
||||||
|
? { type: 'documentId' as const, id: Number(envelopeId) }
|
||||||
|
: { type: 'envelopeId' as const, id: envelopeId };
|
||||||
|
|
||||||
const { envelopeWhereInput } = await getEnvelopeWhereInput({
|
const { envelopeWhereInput } = await getEnvelopeWhereInput({
|
||||||
id: isNumericId
|
id: idConfig,
|
||||||
? {
|
type: isLegacyDocumentId ? EnvelopeType.DOCUMENT : null,
|
||||||
type: 'documentId',
|
|
||||||
id: Number(envelopeId),
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
type: 'envelopeId',
|
|
||||||
id: envelopeId,
|
|
||||||
},
|
|
||||||
type: isNumericId ? EnvelopeType.DOCUMENT : null,
|
|
||||||
userId,
|
userId,
|
||||||
teamId,
|
teamId,
|
||||||
});
|
});
|
||||||
@ -179,72 +97,12 @@ export const findEnvelopeAuditLogs = async ({
|
|||||||
throw new AppError(AppErrorCode.NOT_FOUND);
|
throw new AppError(AppErrorCode.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
const whereClause: Prisma.DocumentAuditLogWhereInput = {
|
return queryAuditLogs({
|
||||||
envelopeId: envelope.id,
|
envelope,
|
||||||
};
|
page,
|
||||||
|
|
||||||
if (eventTypes && eventTypes.length > 0) {
|
|
||||||
whereClause.type = {
|
|
||||||
in: eventTypes,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filterForRecentActivity) {
|
|
||||||
whereClause.OR = [
|
|
||||||
{
|
|
||||||
type: {
|
|
||||||
in: [
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_COMPLETED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_CREATED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_DELETED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_OPENED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_RECIPIENT_COMPLETED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_RECIPIENT_REJECTED,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_SENT,
|
|
||||||
DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_MOVED_TO_TEAM,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: DOCUMENT_AUDIT_LOG_TYPE.EMAIL_SENT,
|
|
||||||
data: {
|
|
||||||
path: ['isResending'],
|
|
||||||
equals: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
const [data, count] = await Promise.all([
|
|
||||||
prisma.documentAuditLog.findMany({
|
|
||||||
where: whereClause,
|
|
||||||
skip: Math.max(page - 1, 0) * perPage,
|
|
||||||
take: perPage + 1,
|
|
||||||
orderBy: {
|
|
||||||
[orderByColumn]: orderByDirection,
|
|
||||||
},
|
|
||||||
cursor: cursor ? { id: cursor } : undefined,
|
|
||||||
}),
|
|
||||||
prisma.documentAuditLog.count({
|
|
||||||
where: whereClause,
|
|
||||||
}),
|
|
||||||
]);
|
|
||||||
|
|
||||||
let nextCursor: string | undefined = undefined;
|
|
||||||
|
|
||||||
const parsedData = data.map((auditLog) => parseDocumentAuditLogData(auditLog));
|
|
||||||
|
|
||||||
if (parsedData.length > perPage) {
|
|
||||||
const nextItem = parsedData.pop();
|
|
||||||
nextCursor = nextItem!.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
data: parsedData,
|
|
||||||
count,
|
|
||||||
currentPage: Math.max(page, 1),
|
|
||||||
perPage,
|
perPage,
|
||||||
totalPages: Math.ceil(count / perPage),
|
orderBy,
|
||||||
nextCursor,
|
cursor,
|
||||||
} satisfies FindResultResponse<typeof parsedData> & { nextCursor?: string };
|
filterForRecentActivity,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -10,34 +10,18 @@ export const findDocumentAuditLogsRoute = authenticatedProcedure
|
|||||||
.input(ZFindDocumentAuditLogsRequestSchema)
|
.input(ZFindDocumentAuditLogsRequestSchema)
|
||||||
.output(ZFindDocumentAuditLogsResponseSchema)
|
.output(ZFindDocumentAuditLogsResponseSchema)
|
||||||
.query(async ({ input, ctx }) => {
|
.query(async ({ input, ctx }) => {
|
||||||
const { teamId } = ctx;
|
const { orderByColumn, orderByDirection, ...auditLogParams } = input;
|
||||||
|
|
||||||
const {
|
|
||||||
page,
|
|
||||||
perPage,
|
|
||||||
documentId,
|
|
||||||
cursor,
|
|
||||||
filterForRecentActivity,
|
|
||||||
eventTypes,
|
|
||||||
orderByColumn,
|
|
||||||
orderByDirection,
|
|
||||||
} = input;
|
|
||||||
|
|
||||||
ctx.logger.info({
|
ctx.logger.info({
|
||||||
input: {
|
input: {
|
||||||
documentId,
|
documentId: input.documentId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return await findDocumentAuditLogs({
|
return await findDocumentAuditLogs({
|
||||||
|
...auditLogParams,
|
||||||
userId: ctx.user.id,
|
userId: ctx.user.id,
|
||||||
teamId,
|
teamId: ctx.teamId,
|
||||||
page,
|
|
||||||
perPage,
|
|
||||||
documentId,
|
|
||||||
cursor,
|
|
||||||
filterForRecentActivity,
|
|
||||||
eventTypes,
|
|
||||||
orderBy: orderByColumn ? { column: orderByColumn, direction: orderByDirection } : undefined,
|
orderBy: orderByColumn ? { column: orderByColumn, direction: orderByDirection } : undefined,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -7,7 +7,6 @@ export const ZFindDocumentAuditLogsRequestSchema = ZFindSearchParamsSchema.exten
|
|||||||
documentId: z.number().min(1),
|
documentId: z.number().min(1),
|
||||||
cursor: z.string().optional(),
|
cursor: z.string().optional(),
|
||||||
filterForRecentActivity: z.boolean().optional(),
|
filterForRecentActivity: z.boolean().optional(),
|
||||||
eventTypes: z.array(z.string()).optional(),
|
|
||||||
orderByColumn: z.enum(['createdAt', 'type']).optional(),
|
orderByColumn: z.enum(['createdAt', 'type']).optional(),
|
||||||
orderByDirection: z.enum(['asc', 'desc']).default('desc'),
|
orderByDirection: z.enum(['asc', 'desc']).default('desc'),
|
||||||
});
|
});
|
||||||
|
|||||||
@ -12,34 +12,18 @@ export const findEnvelopeAuditLogsRoute = authenticatedProcedure
|
|||||||
.input(ZFindEnvelopeAuditLogsRequestSchema)
|
.input(ZFindEnvelopeAuditLogsRequestSchema)
|
||||||
.output(ZFindEnvelopeAuditLogsResponseSchema)
|
.output(ZFindEnvelopeAuditLogsResponseSchema)
|
||||||
.query(async ({ input, ctx }) => {
|
.query(async ({ input, ctx }) => {
|
||||||
const { teamId } = ctx;
|
const { orderByColumn, orderByDirection, ...auditLogParams } = input;
|
||||||
|
|
||||||
const {
|
|
||||||
page,
|
|
||||||
perPage,
|
|
||||||
envelopeId,
|
|
||||||
cursor,
|
|
||||||
filterForRecentActivity,
|
|
||||||
eventTypes,
|
|
||||||
orderByColumn,
|
|
||||||
orderByDirection,
|
|
||||||
} = input;
|
|
||||||
|
|
||||||
ctx.logger.info({
|
ctx.logger.info({
|
||||||
input: {
|
input: {
|
||||||
envelopeId,
|
envelopeId: input.envelopeId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return await findEnvelopeAuditLogs({
|
return await findEnvelopeAuditLogs({
|
||||||
|
...auditLogParams,
|
||||||
userId: ctx.user.id,
|
userId: ctx.user.id,
|
||||||
teamId,
|
teamId: ctx.teamId,
|
||||||
page,
|
|
||||||
perPage,
|
|
||||||
envelopeId,
|
|
||||||
cursor,
|
|
||||||
filterForRecentActivity,
|
|
||||||
eventTypes,
|
|
||||||
orderBy: orderByColumn ? { column: orderByColumn, direction: orderByDirection } : undefined,
|
orderBy: orderByColumn ? { column: orderByColumn, direction: orderByDirection } : undefined,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -22,10 +22,6 @@ export const ZFindEnvelopeAuditLogsRequestSchema = ZFindSearchParamsSchema.exten
|
|||||||
.describe('Envelope ID (e.g., envelope_xxx) or legacy document ID (e.g., 12345)'),
|
.describe('Envelope ID (e.g., envelope_xxx) or legacy document ID (e.g., 12345)'),
|
||||||
cursor: z.string().optional(),
|
cursor: z.string().optional(),
|
||||||
filterForRecentActivity: z.boolean().optional(),
|
filterForRecentActivity: z.boolean().optional(),
|
||||||
eventTypes: z
|
|
||||||
.array(z.string())
|
|
||||||
.optional()
|
|
||||||
.describe('Filter by specific event types (e.g., ["DOCUMENT_CREATED", "DOCUMENT_SENT"])'),
|
|
||||||
orderByColumn: z.enum(['createdAt', 'type']).optional(),
|
orderByColumn: z.enum(['createdAt', 'type']).optional(),
|
||||||
orderByDirection: z.enum(['asc', 'desc']).default('desc'),
|
orderByDirection: z.enum(['asc', 'desc']).default('desc'),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user