/* * 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 { AuditFocus, AuditFocus$inboundSchema } from "./auditfocus.js"; import { AuditSegment, AuditSegment$inboundSchema } from "./auditsegment.js"; import { AuditView, AuditView$inboundSchema } from "./auditview.js"; /** * Generation status of this audit's Vanta-generated information request list * * @remarks * (IRL). `PENDING`/`RUNNING` defer initial sync, `READY` permits a full sync, * and `FAILED` is terminal. Null means the audit has no generated IRL. */ export const IrlGenerationStatus = { Pending: "PENDING", Running: "RUNNING", Ready: "READY", Failed: "FAILED", } as const; /** * Generation status of this audit's Vanta-generated information request list * * @remarks * (IRL). `PENDING`/`RUNNING` defer initial sync, `READY` permits a full sync, * and `FAILED` is terminal. Null means the audit has no generated IRL. */ export type IrlGenerationStatus = ClosedEnum; /** * Metadata about the auditor request list. This field is only present for IRL (Information * * @remarks * Request List) based audits and will be undefined for standard audits. Use the presence * of this field to differentiate between IRL and non-IRL audits. */ export type AuditorRequestListMetadata = { /** * Timestamp when information requests were shared with the customer. Null if not shared. */ requestsSharedWithCustomer: Date | null; }; export type Audit = { /** * The unique identifier for the audit. */ id: string; /** * The domain name of the customer organization being audited (e.g. vanta.com) */ customerOrganizationName: string; /** * The human readable name of the customer organization being audited (e.g. Vanta) */ customerDisplayName: string | null; /** * The uuid of the customer organization being audited */ customerOrganizationId: string; /** * The start of the audit window. This is also when data collection for audit starts. */ auditStartDate: Date; /** * The end of the audit window. */ auditEndDate: Date; /** * Timestamp at which auditors gain access to the audit. Occurs before the audit window begins */ earlyAccessStartsAt: Date | null; /** * Legacy singular framework display name from the audit type. Incomplete for * * @remarks * a multi-framework audit — use `segments` instead. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ framework: string; /** * The display name for the audit. Returns the custom audit name if set, * * @remarks * otherwise returns the framework name. */ displayName: string; /** * Emails of auditors with access to audit */ allowAuditorEmails: Array; /** * Set to true if all auditors in audit firm have access */ allowAllAuditors: boolean; /** * Timestamp when the audit was deleted */ deletionDate: Date | null; /** * Timestamp when the audit was created */ creationDate: Date; /** * Timestamp when the audit was updated */ modificationDate: Date | null; /** * Timestamp when the audit was marked completed, and report was uploaded */ completionDate: Date | null; auditFocus: AuditFocus; auditView: AuditView; /** * Generation status of this audit's Vanta-generated information request list * * @remarks * (IRL). `PENDING`/`RUNNING` defer initial sync, `READY` permits a full sync, * and `FAILED` is terminal. Null means the audit has no generated IRL. */ irlGenerationStatus: IrlGenerationStatus | null; /** * Metadata about the auditor request list. This field is only present for IRL (Information * * @remarks * Request List) based audits and will be undefined for standard audits. Use the presence * of this field to differentiate between IRL and non-IRL audits. */ auditorRequestListMetadata?: AuditorRequestListMetadata | undefined; /** * The audit's scope as a list of segments. Always present. A live audit * * @remarks * returns every in-scope program and system segment; more than one segment * does not by itself imply more than one framework. Soft-deleted audits * return an empty list. Prefer this over the deprecated top-level `framework` * field. */ segments: Array; }; /** @internal */ export const IrlGenerationStatus$inboundSchema: z.ZodNativeEnum< typeof IrlGenerationStatus > = z.nativeEnum(IrlGenerationStatus); /** @internal */ export const AuditorRequestListMetadata$inboundSchema: z.ZodType< AuditorRequestListMetadata, z.ZodTypeDef, unknown > = z.object({ requestsSharedWithCustomer: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), }); export function auditorRequestListMetadataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuditorRequestListMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuditorRequestListMetadata' from JSON`, ); } /** @internal */ export const Audit$inboundSchema: z.ZodType = z .object({ id: z.string(), customerOrganizationName: z.string(), customerDisplayName: z.nullable(z.string()), customerOrganizationId: z.string(), auditStartDate: z.string().datetime({ offset: true }).transform(v => new Date(v) ), auditEndDate: z.string().datetime({ offset: true }).transform(v => new Date(v) ), earlyAccessStartsAt: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), framework: z.string(), displayName: z.string(), allowAuditorEmails: z.array(z.string()), allowAllAuditors: z.boolean(), deletionDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), creationDate: z.string().datetime({ offset: true }).transform(v => new Date(v) ), modificationDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), completionDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), auditFocus: AuditFocus$inboundSchema, auditView: AuditView$inboundSchema, irlGenerationStatus: z.nullable(IrlGenerationStatus$inboundSchema), auditorRequestListMetadata: z.lazy(() => AuditorRequestListMetadata$inboundSchema ).optional(), segments: z.array(AuditSegment$inboundSchema), }); export function auditFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Audit$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Audit' from JSON`, ); }