/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { InformationRequestActivityType, InformationRequestActivityType$inboundSchema, } from "./informationrequestactivitytype.js"; /** * Previous approval status before the status change. * * @remarks * Only populated for status change activities. Null for all other activity types. */ export const OldStatus = { ReadyForAudit: "READY_FOR_AUDIT", NeedsEvidence: "NEEDS_EVIDENCE", AuditorApproved: "AUDITOR_APPROVED", AuditorFlagged: "AUDITOR_FLAGGED", ReadyForInternalReview: "READY_FOR_INTERNAL_REVIEW", } as const; /** * Previous approval status before the status change. * * @remarks * Only populated for status change activities. Null for all other activity types. */ export type OldStatus = ClosedEnum; /** * New approval status after the status change. * * @remarks * Only populated for status change activities. Null for all other activity types. */ export const NewStatus = { ReadyForAudit: "READY_FOR_AUDIT", NeedsEvidence: "NEEDS_EVIDENCE", AuditorApproved: "AUDITOR_APPROVED", AuditorFlagged: "AUDITOR_FLAGGED", ReadyForInternalReview: "READY_FOR_INTERNAL_REVIEW", } as const; /** * New approval status after the status change. * * @remarks * Only populated for status change activities. Null for all other activity types. */ export type NewStatus = ClosedEnum; /** * Result of an automated evidence fill. Always null: only evidence fill activities * * @remarks * could populate it, and those are never returned, so nothing can set it. Do not * branch on it. * * @deprecated enum: This will be removed in a future release, please migrate away from it as soon as possible. */ export const FillOutcome = { Success: "SUCCESS", Partial: "PARTIAL", Failed: "FAILED", } as const; /** * Result of an automated evidence fill. Always null: only evidence fill activities * * @remarks * could populate it, and those are never returned, so nothing can set it. Do not * branch on it. * * @deprecated enum: This will be removed in a future release, please migrate away from it as soon as possible. */ export type FillOutcome = ClosedEnum; /** * Activity log entry tracking changes and actions on an information request. * * @remarks * * The activity log provides an audit trail of operations performed on an * information request, including status changes, evidence uploads, edits, * and evidence sharing. This enables tracking compliance activities and understanding * the request's history. Which entries are visible depends on the endpoint returning * them; see the endpoint's own description. */ export type InformationRequestActivityLog = { /** * The unique identifier for the activity log entry within Vanta's system. * * @remarks * Format: ObjectId as a string (e.g., "6890e473dce1da5d8406f5e7"). */ id: string; activityType: InformationRequestActivityType; /** * Timestamp when the activity occurred. * * @remarks * Format: ISO 8601 UTC timestamp. */ timestamp: Date; /** * Email address of the user who performed the activity. * * @remarks * Null for system-generated activities (rare, such as automated status changes). * This email uniquely identifies users across systems. */ userEmail: string | null; /** * Previous approval status before the status change. * * @remarks * Only populated for status change activities. Null for all other activity types. */ oldStatus: OldStatus | null; /** * New approval status after the status change. * * @remarks * Only populated for status change activities. Null for all other activity types. */ newStatus: NewStatus | null; /** * Optional explanation for the status change. * * @remarks * Only populated for status change activities when a reason is provided * (e.g., when flagging evidence). Null for all other cases. */ reason: string | null; /** * Result of an automated evidence fill. Always null: only evidence fill activities * * @remarks * could populate it, and those are never returned, so nothing can set it. Do not * branch on it. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ fillOutcome: FillOutcome | null; /** * Identifier of the information request this one was copied from when its * * @remarks * audit was duplicated. * Only populated for audit-duplication trail activities. Null for all other activity types. * Format: ObjectId as a string. */ sourceInformationRequestId: string | null; /** * Identifier of the audit this request's audit was duplicated from. * * @remarks * Only populated for audit-duplication trail activities. Null for all other activity types. * Format: ObjectId as a string. */ sourceAuditId: string | null; }; /** @internal */ export const OldStatus$inboundSchema: z.ZodNativeEnum = z .nativeEnum(OldStatus); /** @internal */ export const NewStatus$inboundSchema: z.ZodNativeEnum = z .nativeEnum(NewStatus); /** @internal */ export const FillOutcome$inboundSchema: z.ZodNativeEnum = z .nativeEnum(FillOutcome); /** @internal */ export const InformationRequestActivityLog$inboundSchema: z.ZodType< InformationRequestActivityLog, z.ZodTypeDef, unknown > = z.object({ id: z.string(), activityType: InformationRequestActivityType$inboundSchema, timestamp: z.string().datetime({ offset: true }).transform(v => new Date(v)), userEmail: z.nullable(z.string()), oldStatus: z.nullable(OldStatus$inboundSchema), newStatus: z.nullable(NewStatus$inboundSchema), reason: z.nullable(z.string()), fillOutcome: z.nullable(FillOutcome$inboundSchema), sourceInformationRequestId: z.nullable(z.string()), sourceAuditId: z.nullable(z.string()), }); export function informationRequestActivityLogFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InformationRequestActivityLog$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InformationRequestActivityLog' from JSON`, ); }