/* * 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"; import { ComputerStatus, ComputerStatus$inboundSchema, } from "./computerstatus.js"; import { OperatingSystemType, OperatingSystemType$inboundSchema, } from "./operatingsystemtype.js"; /** * The computer's operating system name and version. */ export type OperatingSystem = { /** * The possible types of the operating system. One of `mac_OS`, `linux`, or `windows`. */ type: OperatingSystemType; /** * The version of the operating system. */ version: string | null; }; /** * The name, unique identifier, and email address of the computer's owner. */ export type Owner = { /** * Unique identifier for the person. */ id: string; /** * Name of the person that is shown in product. */ displayName: string; /** * Email address of the person. */ emailAddress: string; }; export type MonitoredComputer = { /** * Unique identifier for the monitored computer. */ id: string; /** * Hard-coded enums for Vanta-built integrations or application IDs for 3rd-party-built integrations. */ integrationId: string; /** * Date of the computer's most recent report. */ lastCheckDate: Date | null; /** * The a status check for a computer. Representation for screenlock, diskEncryption, passwordManager, and antivirusInstallation. */ screenlock: ComputerStatus; /** * The a status check for a computer. Representation for screenlock, diskEncryption, passwordManager, and antivirusInstallation. */ diskEncryption: ComputerStatus; /** * The a status check for a computer. Representation for screenlock, diskEncryption, passwordManager, and antivirusInstallation. */ passwordManager: ComputerStatus; /** * The a status check for a computer. Representation for screenlock, diskEncryption, passwordManager, and antivirusInstallation. */ antivirusInstallation: ComputerStatus; /** * The computer's operating system name and version. */ operatingSystem: OperatingSystem | null; /** * The name, unique identifier, and email address of the computer's owner. */ owner: Owner | null; /** * The serial number of the computer. This value may be null if it is not reported by the device. */ serialNumber: string | null; /** * The universal device id of the computer. */ udid: string | null; }; /** @internal */ export const OperatingSystem$inboundSchema: z.ZodType< OperatingSystem, z.ZodTypeDef, unknown > = z.object({ type: OperatingSystemType$inboundSchema, version: z.nullable(z.string()), }); export function operatingSystemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OperatingSystem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OperatingSystem' from JSON`, ); } /** @internal */ export const Owner$inboundSchema: z.ZodType = z .object({ id: z.string(), displayName: z.string(), emailAddress: z.string(), }); export function ownerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Owner$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Owner' from JSON`, ); } /** @internal */ export const MonitoredComputer$inboundSchema: z.ZodType< MonitoredComputer, z.ZodTypeDef, unknown > = z.object({ id: z.string(), integrationId: z.string(), lastCheckDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), screenlock: ComputerStatus$inboundSchema, diskEncryption: ComputerStatus$inboundSchema, passwordManager: ComputerStatus$inboundSchema, antivirusInstallation: ComputerStatus$inboundSchema, operatingSystem: z.nullable(z.lazy(() => OperatingSystem$inboundSchema)), owner: z.nullable(z.lazy(() => Owner$inboundSchema)), serialNumber: z.nullable(z.string()), udid: z.nullable(z.string()), }); export function monitoredComputerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MonitoredComputer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MonitoredComputer' from JSON`, ); }