/* * 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 { Flow, Flow$inboundSchema } from "./flow.js"; import { FlowAction, FlowAction$inboundSchema } from "./flowaction.js"; export type TransactionAction = { /** * Always `action`. */ type: "action"; id: FlowAction; flow: Flow; /** * The ID of the rule that triggered this action. */ ruleId: string; /** * The date this action was created at. */ createdAt: Date; /** * The outcome of the action. */ outcome: { [k: string]: any }; }; /** @internal */ export const TransactionAction$inboundSchema: z.ZodType< TransactionAction, z.ZodTypeDef, unknown > = z.object({ type: z.literal("action").default("action"), id: FlowAction$inboundSchema, flow: Flow$inboundSchema, rule_id: z.string(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), outcome: z.record(z.any()), }).transform((v) => { return remap$(v, { "rule_id": "ruleId", "created_at": "createdAt", }); }); export function transactionActionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TransactionAction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TransactionAction' from JSON`, ); }