/* * 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 { CurrencyCode, CurrencyCode$inboundSchema } from "./currencycode.js"; import { CustomField, CustomField$inboundSchema } from "./customfield.js"; import { VendorDecisionStatus, VendorDecisionStatus$inboundSchema, } from "./vendordecisionstatus.js"; import { VendorRelationshipSummary, VendorRelationshipSummary$inboundSchema, } from "./vendorrelationshipsummary.js"; import { VendorRiskLevel, VendorRiskLevel$inboundSchema, } from "./vendorrisklevel.js"; import { VendorStatus, VendorStatus$inboundSchema } from "./vendorstatus.js"; /** * The vendor's category. * * @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible. */ export type Category = { displayName: string; }; /** * The vendor's authentication method. */ export const Method = { Auth0: "AUTH_0", AzureAd: "AZURE_AD", GoogleWorkspace: "GOOGLE_WORKSPACE", OAuth: "O_AUTH", O365: "O365", Okta: "OKTA", OneLogin: "ONE_LOGIN", Owa: "OWA", Sso: "SSO", UsernamePassword: "USERNAME_PASSWORD", Other: "OTHER", } as const; /** * The vendor's authentication method. */ export type Method = ClosedEnum; /** * The vendor's authentication details. */ export type AuthDetails = { /** * Minimum number for chacters required for passwords for this vendor. */ passwordMinimumLength: number | null; /** * Whether or not the vendor requires passwords to have a symbol. */ passwordRequiresSymbol: boolean | null; /** * Whether or not the vendor requires passwords to have a number. */ passwordRequiresNumber: boolean | null; /** * Whether or not the vendor requires passwords to have multi factor authentication. */ passwordMFA: boolean | null; /** * The vendor's authentication method. */ method: Method | null; }; /** * The vendor's headquarters. */ export const VendorHeadquarters = { Eue: "EUE", And: "AND", Are: "ARE", Afg: "AFG", Atg: "ATG", Aia: "AIA", Alb: "ALB", Arm: "ARM", Ago: "AGO", Ata: "ATA", Arg: "ARG", Asm: "ASM", Aut: "AUT", Aus: "AUS", Abw: "ABW", Ala: "ALA", Aze: "AZE", Bih: "BIH", Brb: "BRB", Bgd: "BGD", Bel: "BEL", Bfa: "BFA", Bgr: "BGR", Bhr: "BHR", Bdi: "BDI", Ben: "BEN", Blm: "BLM", Bmu: "BMU", Brn: "BRN", Bol: "BOL", Bes: "BES", Bra: "BRA", Bhs: "BHS", Btn: "BTN", Bvt: "BVT", Bwa: "BWA", Blr: "BLR", Blz: "BLZ", Can: "CAN", Cck: "CCK", Cod: "COD", Caf: "CAF", Cog: "COG", Che: "CHE", Civ: "CIV", Cok: "COK", Chl: "CHL", Cmr: "CMR", Chn: "CHN", Col: "COL", Cri: "CRI", Cub: "CUB", Cpv: "CPV", Cuw: "CUW", Cxr: "CXR", Cyp: "CYP", Cze: "CZE", Deu: "DEU", Dji: "DJI", Dnk: "DNK", Dma: "DMA", Dom: "DOM", Dza: "DZA", Ecu: "ECU", Est: "EST", Egy: "EGY", Esh: "ESH", Eri: "ERI", Esp: "ESP", Eth: "ETH", Fin: "FIN", Fji: "FJI", Flk: "FLK", Fsm: "FSM", Fro: "FRO", Fra: "FRA", Gab: "GAB", Eng: "ENG", Sct: "SCT", Gbr: "GBR", Wal: "WAL", Nir: "NIR", Grd: "GRD", Geo: "GEO", Guf: "GUF", Ggy: "GGY", Gha: "GHA", Gib: "GIB", Grl: "GRL", Gmb: "GMB", Gin: "GIN", Glp: "GLP", Gnq: "GNQ", Grc: "GRC", Sgs: "SGS", Gtm: "GTM", Gum: "GUM", Gnb: "GNB", Guy: "GUY", Hkg: "HKG", Hmd: "HMD", Hnd: "HND", Hrv: "HRV", Hti: "HTI", Hun: "HUN", Idn: "IDN", Irl: "IRL", Isr: "ISR", Imn: "IMN", Ind: "IND", Iot: "IOT", Irq: "IRQ", Irn: "IRN", Isl: "ISL", Ita: "ITA", Jey: "JEY", Jam: "JAM", Jor: "JOR", Jpn: "JPN", Ken: "KEN", Kgz: "KGZ", Khm: "KHM", Kir: "KIR", Com: "COM", Kna: "KNA", Prk: "PRK", Kor: "KOR", Kwt: "KWT", Cym: "CYM", Kaz: "KAZ", Lao: "LAO", Lbn: "LBN", Lca: "LCA", Lie: "LIE", Lka: "LKA", Lbr: "LBR", Lso: "LSO", Ltu: "LTU", Lux: "LUX", Lva: "LVA", Lby: "LBY", Mar: "MAR", Mco: "MCO", Mda: "MDA", Mne: "MNE", Maf: "MAF", Mdg: "MDG", Mhl: "MHL", Mkd: "MKD", Mli: "MLI", Mmr: "MMR", Mng: "MNG", Mac: "MAC", Mnp: "MNP", Mtq: "MTQ", Mrt: "MRT", Msr: "MSR", Mlt: "MLT", Mus: "MUS", Mdv: "MDV", Mwi: "MWI", Mex: "MEX", Mys: "MYS", Moz: "MOZ", Nam: "NAM", Ncl: "NCL", Ner: "NER", Nfk: "NFK", Nga: "NGA", Nic: "NIC", Nld: "NLD", Nor: "NOR", Npl: "NPL", Nru: "NRU", Niu: "NIU", Nzl: "NZL", Omn: "OMN", Pan: "PAN", Per: "PER", Pyf: "PYF", Png: "PNG", Phl: "PHL", Pak: "PAK", Pol: "POL", Spm: "SPM", Pcn: "PCN", Pri: "PRI", Pse: "PSE", Prt: "PRT", Plw: "PLW", Pry: "PRY", Qat: "QAT", Reu: "REU", Rou: "ROU", Srb: "SRB", Rus: "RUS", Rwa: "RWA", Sau: "SAU", Slb: "SLB", Syc: "SYC", Sdn: "SDN", Swe: "SWE", Sgp: "SGP", Shn: "SHN", Svn: "SVN", Sjm: "SJM", Svk: "SVK", Sle: "SLE", Smr: "SMR", Sen: "SEN", Som: "SOM", Sur: "SUR", Ssd: "SSD", Stp: "STP", Slv: "SLV", Sxm: "SXM", Syr: "SYR", Swz: "SWZ", Tca: "TCA", Tcd: "TCD", Atf: "ATF", Tgo: "TGO", Tha: "THA", Tjk: "TJK", Tkl: "TKL", Tls: "TLS", Tkm: "TKM", Tun: "TUN", Ton: "TON", Tur: "TUR", Tto: "TTO", Tuv: "TUV", Twn: "TWN", Tza: "TZA", Ukr: "UKR", Uga: "UGA", Umi: "UMI", Usa: "USA", Ury: "URY", Uzb: "UZB", Vat: "VAT", Vct: "VCT", Ven: "VEN", Vgb: "VGB", Vir: "VIR", Vnm: "VNM", Vut: "VUT", Wlf: "WLF", Wsm: "WSM", Yem: "YEM", Myt: "MYT", Zaf: "ZAF", Zmb: "ZMB", Zwe: "ZWE", } as const; /** * The vendor's headquarters. */ export type VendorHeadquarters = ClosedEnum; /** * The contract amount for the vendor. */ export type ContractAmount = { /** * The amount of the contract. */ amount: number; currency: CurrencyCode; }; /** * The vendor's latest decision status. Null means no decision has been made. */ export type LatestDecision = { status: VendorDecisionStatus; lastUpdatedAt: Date; }; /** * The task tracker procurement request associated with this vendor (if linked). */ export type LinkedTaskTrackerTaskProcurementRequest = { url: string; service: string; }; /** * The parent vendor of this engagement, or null when there is no accessible parent. */ export type ParentVendor = { /** * The vendor's unique ID. */ id: string; /** * The vendor's display name. */ name: string; /** * The current state of a vendor: * * @remarks * - MANAGED: The vendor is actively managed. * - ARCHIVED: The vendor has been archived * - IN_PROCUREMENT: The vendor is in the procurement process */ status: VendorStatus; /** * The vendor's website URL, or null when none is set. */ websiteUrl: string | null; }; export type Vendor = { /** * The vendor's unique ID. */ id: string; /** * The vendor's display name. */ name: string; /** * The vendor's website URL. */ websiteUrl: string | null; /** * The vendor's external account manager name. */ accountManagerName: string | null; /** * The vendor's external account manager email. */ accountManagerEmail: string | null; /** * Services provided by the vendor. */ servicesProvided: string | null; /** * Any additional notes about the vendor */ additionalNotes: string | null; /** * The vendor's security owner's Vanta user ID. */ securityOwnerUserId: string | null; /** * The vendor's business owner's Vanta user ID. */ businessOwnerUserId: string | null; /** * The date the contract with the vendor began. */ contractStartDate: Date | null; /** * The date the contract with the vendor is up for renewal. */ contractRenewalDate: Date | null; /** * The date the contract with the vendor was terminated. */ contractTerminationDate: Date | null; /** * The next due date for a security review. */ nextSecurityReviewDueDate: Date | null; /** * The most recent date a security review was completed. */ lastSecurityReviewCompletionDate: Date | null; /** * Whether or not auditors can view this vendor. */ isVisibleToAuditors: boolean | null; /** * Whether or not the vendor's risk is automatically scored. */ isRiskAutoScored: boolean | null; /** * The list of risk attribute IDs the vendor has been assigned to. */ riskAttributeIds: Array; /** * The ID of the vendor's category. */ categoryId: string | null; /** * The vendor's category. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ category: Category | null; /** * The vendor's authentication details. */ authDetails: AuthDetails; /** * The current state of a vendor: * * @remarks * - MANAGED: The vendor is actively managed. * - ARCHIVED: The vendor has been archived * - IN_PROCUREMENT: The vendor is in the procurement process */ status: VendorStatus; /** * The risk level of a vendor: * * @remarks * - CRITICAL: The vendor has a critical security risk * - HIGH: The vendor has a high security risk * - MEDIUM: The vendor has a medium security risk * - LOW: The vendor has a low security risk * - UNSCORED: The vendor has not been given a risk level */ inherentRiskLevel: VendorRiskLevel; /** * The risk level of a vendor: * * @remarks * - CRITICAL: The vendor has a critical security risk * - HIGH: The vendor has a high security risk * - MEDIUM: The vendor has a medium security risk * - LOW: The vendor has a low security risk * - UNSCORED: The vendor has not been given a risk level */ residualRiskLevel: VendorRiskLevel; /** * The vendor's headquarters. */ vendorHeadquarters: VendorHeadquarters | null; /** * The contract amount for the vendor. */ contractAmount: ContractAmount | null; /** * The vendor's custom fields. */ customFields: Array | null; /** * The vendor's latest decision status. Null means no decision has been made. */ latestDecision: LatestDecision | null; /** * The task tracker procurement request associated with this vendor (if linked). */ linkedTaskTrackerTaskProcurementRequest: | LinkedTaskTrackerTaskProcurementRequest | null; /** * A product, service, or subsidiary you use from a vendor. Each engagement * * @remarks * belongs to one parent vendor, has its own risk score and assessments, and * cannot have engagements of its own. Returned engagements are sorted by name. * Empty when there are none. */ engagements?: Array | undefined; /** * The parent vendor of this engagement, or null when there is no accessible parent. */ parentVendor?: ParentVendor | null | undefined; }; /** @internal */ export const Category$inboundSchema: z.ZodType< Category, z.ZodTypeDef, unknown > = z.object({ displayName: z.string(), }); export function categoryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Category$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Category' from JSON`, ); } /** @internal */ export const Method$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Method); /** @internal */ export const AuthDetails$inboundSchema: z.ZodType< AuthDetails, z.ZodTypeDef, unknown > = z.object({ passwordMinimumLength: z.nullable(z.number()), passwordRequiresSymbol: z.nullable(z.boolean()), passwordRequiresNumber: z.nullable(z.boolean()), passwordMFA: z.nullable(z.boolean()), method: z.nullable(Method$inboundSchema), }); export function authDetailsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuthDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuthDetails' from JSON`, ); } /** @internal */ export const VendorHeadquarters$inboundSchema: z.ZodNativeEnum< typeof VendorHeadquarters > = z.nativeEnum(VendorHeadquarters); /** @internal */ export const ContractAmount$inboundSchema: z.ZodType< ContractAmount, z.ZodTypeDef, unknown > = z.object({ amount: z.number(), currency: CurrencyCode$inboundSchema, }); export function contractAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractAmount' from JSON`, ); } /** @internal */ export const LatestDecision$inboundSchema: z.ZodType< LatestDecision, z.ZodTypeDef, unknown > = z.object({ status: VendorDecisionStatus$inboundSchema, lastUpdatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v) ), }); export function latestDecisionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LatestDecision$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LatestDecision' from JSON`, ); } /** @internal */ export const LinkedTaskTrackerTaskProcurementRequest$inboundSchema: z.ZodType< LinkedTaskTrackerTaskProcurementRequest, z.ZodTypeDef, unknown > = z.object({ url: z.string(), service: z.string(), }); export function linkedTaskTrackerTaskProcurementRequestFromJSON( jsonString: string, ): SafeParseResult< LinkedTaskTrackerTaskProcurementRequest, SDKValidationError > { return safeParse( jsonString, (x) => LinkedTaskTrackerTaskProcurementRequest$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'LinkedTaskTrackerTaskProcurementRequest' from JSON`, ); } /** @internal */ export const ParentVendor$inboundSchema: z.ZodType< ParentVendor, z.ZodTypeDef, unknown > = z.object({ id: z.string(), name: z.string(), status: VendorStatus$inboundSchema, websiteUrl: z.nullable(z.string()), }); export function parentVendorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ParentVendor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ParentVendor' from JSON`, ); } /** @internal */ export const Vendor$inboundSchema: z.ZodType = z .object({ id: z.string(), name: z.string(), websiteUrl: z.nullable(z.string()), accountManagerName: z.nullable(z.string()), accountManagerEmail: z.nullable(z.string()), servicesProvided: z.nullable(z.string()), additionalNotes: z.nullable(z.string()), securityOwnerUserId: z.nullable(z.string()), businessOwnerUserId: z.nullable(z.string()), contractStartDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), contractRenewalDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), contractTerminationDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), nextSecurityReviewDueDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), lastSecurityReviewCompletionDate: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), isVisibleToAuditors: z.nullable(z.boolean()), isRiskAutoScored: z.nullable(z.boolean()), riskAttributeIds: z.array(z.string()), categoryId: z.nullable(z.string()), category: z.nullable(z.lazy(() => Category$inboundSchema)), authDetails: z.lazy(() => AuthDetails$inboundSchema), status: VendorStatus$inboundSchema, inherentRiskLevel: VendorRiskLevel$inboundSchema, residualRiskLevel: VendorRiskLevel$inboundSchema, vendorHeadquarters: z.nullable(VendorHeadquarters$inboundSchema), contractAmount: z.nullable(z.lazy(() => ContractAmount$inboundSchema)), customFields: z.nullable(z.array(CustomField$inboundSchema)), latestDecision: z.nullable(z.lazy(() => LatestDecision$inboundSchema)), linkedTaskTrackerTaskProcurementRequest: z.nullable( z.lazy(() => LinkedTaskTrackerTaskProcurementRequest$inboundSchema), ), engagements: z.array(VendorRelationshipSummary$inboundSchema).optional(), parentVendor: z.nullable(z.lazy(() => ParentVendor$inboundSchema)) .optional(), }); export function vendorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Vendor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Vendor' from JSON`, ); }