/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 0ee4a05a3fd1 */ import * as z from "zod/v4"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; import { ServiceAccountSubject, ServiceAccountSubject$inboundSchema, } from "./serviceaccountsubject.js"; import { UserSubject, UserSubject$inboundSchema } from "./usersubject.js"; /** * Authenticated principal that can be either a user (with workspace-scoped permissions) or a service account (with configurable scope and role) */ export type Subject = UserSubject | ServiceAccountSubject; /** @internal */ export const Subject$inboundSchema: z.ZodType = z.union([ UserSubject$inboundSchema, ServiceAccountSubject$inboundSchema, ]); export function subjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Subject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Subject' from JSON`, ); }