/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 2d81405640f8 */ 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 { CustomEntityMetadata, CustomEntityMetadata$inboundSchema, CustomEntityMetadata$Outbound, CustomEntityMetadata$outboundSchema, } from "./customentitymetadata.js"; import { ObjectPermissions, ObjectPermissions$inboundSchema, ObjectPermissions$Outbound, ObjectPermissions$outboundSchema, } from "./objectpermissions.js"; import { UserRoleSpecification, UserRoleSpecification$inboundSchema, UserRoleSpecification$Outbound, UserRoleSpecification$outboundSchema, } from "./userrolespecification.js"; export type CustomEntity = { permissions?: ObjectPermissions | undefined; /** * Unique identifier. */ id?: string | undefined; /** * Title or name of the custom entity. */ title?: string | undefined; /** * The datasource the custom entity is from. */ datasource?: string | undefined; /** * The type of the entity. Interpretation is specific to each datasource */ objectType?: string | undefined; metadata?: CustomEntityMetadata | undefined; /** * A list of user roles for the custom entity explicitly granted by the owner. */ roles?: Array | undefined; }; /** @internal */ export const CustomEntity$inboundSchema: z.ZodType< CustomEntity, z.ZodTypeDef, unknown > = z.object({ permissions: ObjectPermissions$inboundSchema.optional(), id: z.string().optional(), title: z.string().optional(), datasource: z.string().optional(), objectType: z.string().optional(), metadata: CustomEntityMetadata$inboundSchema.optional(), roles: z.array(z.lazy(() => UserRoleSpecification$inboundSchema)).optional(), }); /** @internal */ export type CustomEntity$Outbound = { permissions?: ObjectPermissions$Outbound | undefined; id?: string | undefined; title?: string | undefined; datasource?: string | undefined; objectType?: string | undefined; metadata?: CustomEntityMetadata$Outbound | undefined; roles?: Array | undefined; }; /** @internal */ export const CustomEntity$outboundSchema: z.ZodType< CustomEntity$Outbound, z.ZodTypeDef, CustomEntity > = z.object({ permissions: ObjectPermissions$outboundSchema.optional(), id: z.string().optional(), title: z.string().optional(), datasource: z.string().optional(), objectType: z.string().optional(), metadata: CustomEntityMetadata$outboundSchema.optional(), roles: z.array(z.lazy(() => UserRoleSpecification$outboundSchema)).optional(), }); export function customEntityToJSON(customEntity: CustomEntity): string { return JSON.stringify(CustomEntity$outboundSchema.parse(customEntity)); } export function customEntityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomEntity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomEntity' from JSON`, ); }