/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../../lib/primitives.js"; import { safeParse } from "../../../lib/schemas.js"; import { Result as SafeParseResult } from "../../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { SuccessfulPolicyResponse, SuccessfulPolicyResponse$inboundSchema, SuccessfulPolicyResponse$Outbound, SuccessfulPolicyResponse$outboundSchema, } from "./successfulpolicyresponse.js"; /** * All batched policy executions succeeded. * * @remarks * The server also returns 200 if the path refers to an undefined document. In this case, responses will be empty. */ export type BatchSuccessfulPolicyEvaluation = { batchDecisionId?: string | undefined; /** * If query metrics are enabled, this field contains query performance metrics collected during the parse, compile, and evaluation steps. */ metrics?: { [k: string]: any } | undefined; responses?: { [k: string]: SuccessfulPolicyResponse } | undefined; }; /** @internal */ export const BatchSuccessfulPolicyEvaluation$inboundSchema: z.ZodType< BatchSuccessfulPolicyEvaluation, z.ZodTypeDef, unknown > = z.object({ batch_decision_id: z.string().optional(), metrics: z.record(z.any()).optional(), responses: z.record(SuccessfulPolicyResponse$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "batch_decision_id": "batchDecisionId", }); }); /** @internal */ export type BatchSuccessfulPolicyEvaluation$Outbound = { batch_decision_id?: string | undefined; metrics?: { [k: string]: any } | undefined; responses?: { [k: string]: SuccessfulPolicyResponse$Outbound } | undefined; }; /** @internal */ export const BatchSuccessfulPolicyEvaluation$outboundSchema: z.ZodType< BatchSuccessfulPolicyEvaluation$Outbound, z.ZodTypeDef, BatchSuccessfulPolicyEvaluation > = z.object({ batchDecisionId: z.string().optional(), metrics: z.record(z.any()).optional(), responses: z.record(SuccessfulPolicyResponse$outboundSchema).optional(), }).transform((v) => { return remap$(v, { batchDecisionId: "batch_decision_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BatchSuccessfulPolicyEvaluation$ { /** @deprecated use `BatchSuccessfulPolicyEvaluation$inboundSchema` instead. */ export const inboundSchema = BatchSuccessfulPolicyEvaluation$inboundSchema; /** @deprecated use `BatchSuccessfulPolicyEvaluation$outboundSchema` instead. */ export const outboundSchema = BatchSuccessfulPolicyEvaluation$outboundSchema; /** @deprecated use `BatchSuccessfulPolicyEvaluation$Outbound` instead. */ export type Outbound = BatchSuccessfulPolicyEvaluation$Outbound; } export function batchSuccessfulPolicyEvaluationToJSON( batchSuccessfulPolicyEvaluation: BatchSuccessfulPolicyEvaluation, ): string { return JSON.stringify( BatchSuccessfulPolicyEvaluation$outboundSchema.parse( batchSuccessfulPolicyEvaluation, ), ); } export function batchSuccessfulPolicyEvaluationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BatchSuccessfulPolicyEvaluation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchSuccessfulPolicyEvaluation' from JSON`, ); }