import {z} from 'zod' export type UpdateComplianceFrameworkInput = {name?: string | undefined, standard?: ('aiact' | 'aiuc1' | 'aue8' | 'awsFTR' | 'bsic5' | 'ccpa' | 'cisv8' | 'cjis' | 'cmmc2' | 'cps234' | 'cri' | 'dora' | 'fedRAMPr5' | 'fedramp' | 'fedramp20x' | 'fedramp20x_2026' | 'gdpr' | 'hipaa' | 'hitruste1' | 'iso9001' | 'iso27001' | 'iso27001_2022' | 'iso27017' | 'iso27018' | 'iso27701' | 'iso27701_2025' | 'iso42001' | 'msftSSPA' | 'mvsp' | 'nis2d' | 'nist53' | 'nist171' | 'nist171r3' | 'nistAiRmf' | 'nistCSF' | 'nistcsf2' | 'ofdss' | 'pciDss4' | 'pciSaqA' | 'pciSaqAEP' | 'pciSaqDMerchant' | 'pciSaqDSP' | 'soc2' | 'soxITGC' | 't23nycrr500' | 'tisax' | 'iso22301' | 'trust' | 'ukCyberEssentials' | 'ukCyberEssentials33' | 'usDataPrivacy' | 'fedrampKSI' | 'null' | null) | undefined, description?: (string | null) | undefined}; export type PatchApiTrustCentersSlugIdComplianceFrameworksFrameworkIdArgs = {slugId: string, frameworkId: string, body: UpdateComplianceFrameworkInput}; export type PatchApiTrustCentersSlugIdComplianceFrameworksFrameworkIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; export const trustCenterComplianceFramework = z.object({id: z.string(), name: z.string(), standard: z.string().nullable(), description: z.string().nullable()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Update Trust Center compliance framework * * PATCH /trust-centers/{slugId}/compliance-frameworks/{frameworkId} */ export const patchApiTrustCentersSlugIdComplianceFrameworksFrameworkId = async (args: PatchApiTrustCentersSlugIdComplianceFrameworksFrameworkIdArgs, options?: PatchApiTrustCentersSlugIdComplianceFrameworksFrameworkIdOptions) => { const {baseUrl = "https://api.vanta.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/trust-centers/${encodeURIComponent(String(args.slugId))}/compliance-frameworks/${encodeURIComponent(String(args.frameworkId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(trustCenterComplianceFramework, await res.json()) };