/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Information about the user who last edited this policy version. * * @remarks * Undefined if the user information is not available. */ export type LastEditedBy = { email: string; name: string; }; /** * The uploaded policy file for this version. */ export type VantaPolicyEvidenceFile = { /** * The date when this policy version became effective, or when it was created. * * @remarks * Format: ISO 8601 UTC timestamp. */ effectiveOrCreationDate: Date; /** * The locale/language of the policy document. * * @remarks * Examples: "EN" for English, "ES" for Spanish, "FR" for French */ locale: string; /** * A presigned URL for downloading the policy document. * * @remarks * This URL is temporary and expires after a limited time. * Request a new evidence list to get a fresh URL if expired. */ url: string; /** * The MIME type of the policy document indicating its file format. * * @remarks * Common types: "application/pdf", "application/msword" */ mimeType: string; /** * The original filename of the uploaded policy document. * * @remarks * Undefined if the filename was not captured during upload. */ filename?: string | undefined; /** * The unique identifier for the uploaded policy file in Vanta's system. */ id: string; }; /** * Evidence in the form of a Vanta Policy. * * @remarks * Vanta Policies are compliance policies with metadata like locale, * effective dates, and versioning. Policies are always uploaded files * stored in Vanta's system. */ export type VantaPolicyEvidence = { /** * The title of the policy as displayed in Vanta. */ title: string; /** * Optional description providing additional context about the policy. */ description?: string | undefined; /** * The date when the policy version expires and should be renewed. * * @remarks * Undefined if no expiration is set. * Format: ISO 8601 UTC timestamp. */ expirationDate?: Date | undefined; /** * Information about the user who last edited this policy version. * * @remarks * Undefined if the user information is not available. */ lastEditedBy?: LastEditedBy | undefined; /** * The policy type this evidence belongs to (e.g. "information-security-policy-bsi"). * * @remarks * Policies prefixed with "custom-" are customer-defined; others are Vanta-provided templates. */ policyId: string; /** * The identifier of the approved policy version that was submitted as evidence. * * @remarks * A new version is created each time a policy is updated and approved. */ policyVersionId: string; /** * The identifier of the locale-specific file within the policy version. * * @remarks * Each policy version may contain multiple files, one per supported language. */ policyVersionFileId: string; /** * The uploaded policy file for this version. */ file: VantaPolicyEvidenceFile; }; /** @internal */ export const LastEditedBy$inboundSchema: z.ZodType< LastEditedBy, z.ZodTypeDef, unknown > = z.object({ email: z.string(), name: z.string(), }); export function lastEditedByFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LastEditedBy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LastEditedBy' from JSON`, ); } /** @internal */ export const VantaPolicyEvidenceFile$inboundSchema: z.ZodType< VantaPolicyEvidenceFile, z.ZodTypeDef, unknown > = z.object({ effectiveOrCreationDate: z.string().datetime({ offset: true }).transform(v => new Date(v) ), locale: z.string(), url: z.string(), mimeType: z.string(), filename: z.string().optional(), id: z.string(), }); export function vantaPolicyEvidenceFileFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => VantaPolicyEvidenceFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VantaPolicyEvidenceFile' from JSON`, ); } /** @internal */ export const VantaPolicyEvidence$inboundSchema: z.ZodType< VantaPolicyEvidence, z.ZodTypeDef, unknown > = z.object({ title: z.string(), description: z.string().optional(), expirationDate: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), lastEditedBy: z.lazy(() => LastEditedBy$inboundSchema).optional(), policyId: z.string(), policyVersionId: z.string(), policyVersionFileId: z.string(), file: z.lazy(() => VantaPolicyEvidenceFile$inboundSchema), }); export function vantaPolicyEvidenceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => VantaPolicyEvidence$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VantaPolicyEvidence' from JSON`, ); }