/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { ClosedEnum } from "../../types/enums.js"; import { FilterCondition, FilterCondition$Outbound, FilterCondition$outboundSchema, } from "./filter-condition.js"; import { SortCondition, SortCondition$Outbound, SortCondition$outboundSchema, } from "./sort-condition.js"; import { Status, Status$outboundSchema } from "./status.js"; export const WorkflowExecutionFilterOrder = { Asc: "asc", Desc: "desc", } as const; export type WorkflowExecutionFilterOrder = ClosedEnum< typeof WorkflowExecutionFilterOrder >; export type WorkflowExecutionFilter = { endTime?: Date | undefined; /** * e.g. plan, invoice, subscription */ entity?: string | undefined; /** * e.g. plan_01ABC123 */ entityId?: string | undefined; expand?: string | undefined; /** * filters allows complex filtering based on multiple fields (same as FeatureFilter) */ filters?: Array | undefined; limit?: number | undefined; offset?: number | undefined; order?: WorkflowExecutionFilterOrder | undefined; sort?: Array | undefined; startTime?: Date | undefined; status?: Status | undefined; taskQueue?: string | undefined; /** * Workflow-specific filters */ workflowId?: string | undefined; /** * e.g. Running, Completed, Failed */ workflowStatus?: string | undefined; workflowType?: string | undefined; }; /** @internal */ export const WorkflowExecutionFilterOrder$outboundSchema: z.ZodMiniEnum< typeof WorkflowExecutionFilterOrder > = z.enum(WorkflowExecutionFilterOrder); /** @internal */ export type WorkflowExecutionFilter$Outbound = { end_time?: string | undefined; entity?: string | undefined; entity_id?: string | undefined; expand?: string | undefined; filters?: Array | undefined; limit?: number | undefined; offset?: number | undefined; order?: string | undefined; sort?: Array | undefined; start_time?: string | undefined; status?: string | undefined; task_queue?: string | undefined; workflow_id?: string | undefined; workflow_status?: string | undefined; workflow_type?: string | undefined; }; /** @internal */ export const WorkflowExecutionFilter$outboundSchema: z.ZodMiniType< WorkflowExecutionFilter$Outbound, WorkflowExecutionFilter > = z.pipe( z.object({ endTime: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))), entity: z.optional(z.string()), entityId: z.optional(z.string()), expand: z.optional(z.string()), filters: z.optional(z.array(FilterCondition$outboundSchema)), limit: z.optional(z.int()), offset: z.optional(z.int()), order: z.optional(WorkflowExecutionFilterOrder$outboundSchema), sort: z.optional(z.array(SortCondition$outboundSchema)), startTime: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))), status: z.optional(Status$outboundSchema), taskQueue: z.optional(z.string()), workflowId: z.optional(z.string()), workflowStatus: z.optional(z.string()), workflowType: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { endTime: "end_time", entityId: "entity_id", startTime: "start_time", taskQueue: "task_queue", workflowId: "workflow_id", workflowStatus: "workflow_status", workflowType: "workflow_type", }); }), ); export function workflowExecutionFilterToJSON( workflowExecutionFilter: WorkflowExecutionFilter, ): string { return JSON.stringify( WorkflowExecutionFilter$outboundSchema.parse(workflowExecutionFilter), ); }