/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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 { DiffSummaryDto, DiffSummaryDto$inboundSchema, } from "./diffsummarydto.js"; import { ResourceDependencyDto, ResourceDependencyDto$inboundSchema, } from "./resourcedependencydto.js"; import { ResourceDiffDto, ResourceDiffDto$inboundSchema, } from "./resourcediffdto.js"; import { ResourceTypeEnum, ResourceTypeEnum$inboundSchema, } from "./resourcetypeenum.js"; /** * User who last updated the resource */ export type ResourceDiffResultDtoSourceResourceUpdatedBy = { /** * User ID */ id: string; /** * User first name */ firstName: string; /** * User last name */ lastName?: string | null | undefined; /** * User external ID */ externalId?: string | undefined; }; /** * Source resource information */ export type SourceResource = { /** * Resource ID (workflow ID or step ID) */ id?: string | null | undefined; /** * Resource name (workflow name or step name) */ name?: string | null | undefined; /** * User who last updated the resource */ updatedBy?: ResourceDiffResultDtoSourceResourceUpdatedBy | null | undefined; /** * When the resource was last updated */ updatedAt?: Date | null | undefined; }; /** * User who last updated the resource */ export type ResourceDiffResultDtoUpdatedBy = { /** * User ID */ id: string; /** * User first name */ firstName: string; /** * User last name */ lastName?: string | null | undefined; /** * User external ID */ externalId?: string | undefined; }; /** * Target resource information */ export type TargetResource = { /** * Resource ID (workflow ID or step ID) */ id?: string | null | undefined; /** * Resource name (workflow name or step name) */ name?: string | null | undefined; /** * User who last updated the resource */ updatedBy?: ResourceDiffResultDtoUpdatedBy | null | undefined; /** * When the resource was last updated */ updatedAt?: Date | null | undefined; }; export type ResourceDiffResultDto = { /** * Type of the layout */ resourceType: ResourceTypeEnum; /** * Source resource information */ sourceResource?: SourceResource | null | undefined; /** * Target resource information */ targetResource?: TargetResource | null | undefined; /** * List of specific changes for this resource */ changes: Array; /** * Summary of changes for this resource */ summary: DiffSummaryDto; /** * Dependencies that affect this resource */ dependencies?: Array | undefined; }; /** @internal */ export const ResourceDiffResultDtoSourceResourceUpdatedBy$inboundSchema: z.ZodType< ResourceDiffResultDtoSourceResourceUpdatedBy, z.ZodTypeDef, unknown > = z.object({ _id: z.string(), firstName: z.string(), lastName: z.nullable(z.string()).optional(), externalId: z.string().optional(), }).transform((v) => { return remap$(v, { "_id": "id", }); }); export function resourceDiffResultDtoSourceResourceUpdatedByFromJSON( jsonString: string, ): SafeParseResult< ResourceDiffResultDtoSourceResourceUpdatedBy, SDKValidationError > { return safeParse( jsonString, (x) => ResourceDiffResultDtoSourceResourceUpdatedBy$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ResourceDiffResultDtoSourceResourceUpdatedBy' from JSON`, ); } /** @internal */ export const SourceResource$inboundSchema: z.ZodType< SourceResource, z.ZodTypeDef, unknown > = z.object({ id: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), updatedBy: z.nullable( z.lazy(() => ResourceDiffResultDtoSourceResourceUpdatedBy$inboundSchema), ).optional(), updatedAt: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), }); export function sourceResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SourceResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SourceResource' from JSON`, ); } /** @internal */ export const ResourceDiffResultDtoUpdatedBy$inboundSchema: z.ZodType< ResourceDiffResultDtoUpdatedBy, z.ZodTypeDef, unknown > = z.object({ _id: z.string(), firstName: z.string(), lastName: z.nullable(z.string()).optional(), externalId: z.string().optional(), }).transform((v) => { return remap$(v, { "_id": "id", }); }); export function resourceDiffResultDtoUpdatedByFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResourceDiffResultDtoUpdatedBy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResourceDiffResultDtoUpdatedBy' from JSON`, ); } /** @internal */ export const TargetResource$inboundSchema: z.ZodType< TargetResource, z.ZodTypeDef, unknown > = z.object({ id: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), updatedBy: z.nullable( z.lazy(() => ResourceDiffResultDtoUpdatedBy$inboundSchema), ).optional(), updatedAt: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), }); export function targetResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TargetResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TargetResource' from JSON`, ); } /** @internal */ export const ResourceDiffResultDto$inboundSchema: z.ZodType< ResourceDiffResultDto, z.ZodTypeDef, unknown > = z.object({ resourceType: ResourceTypeEnum$inboundSchema, sourceResource: z.nullable(z.lazy(() => SourceResource$inboundSchema)) .optional(), targetResource: z.nullable(z.lazy(() => TargetResource$inboundSchema)) .optional(), changes: z.array(ResourceDiffDto$inboundSchema), summary: DiffSummaryDto$inboundSchema, dependencies: z.array(ResourceDependencyDto$inboundSchema).optional(), }); export function resourceDiffResultDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResourceDiffResultDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResourceDiffResultDto' from JSON`, ); }