export type WorkflowEditorHandleInput = { id: string; label?: string; name?: string; type?: string | string[]; subHandles?: WorkflowEditorHandleInput[]; }; export type WorkflowEditorHandleOutput = { id: string; name?: string; type?: string; isArray?: boolean; }; type NodeCommonData = { isInput?: boolean; isOutput?: boolean; inputHandles?: WorkflowEditorHandleInput[]; outputHandles?: WorkflowEditorHandleOutput[]; }; export type WorkflowEditorNode = { id: string; type: 'model'; data: NodeCommonData & { modelId?: string; type?: string; form?: Record; }; } | { id: string; type: 'llm'; data: NodeCommonData & { modelId?: string; form?: Record; }; } | { id: string; type: 'text'; data: NodeCommonData & { value?: string; }; } | { id: string; type: 'asset'; data: NodeCommonData & { type?: string; value?: string | string[]; isMultiple?: boolean; isRequired?: boolean; valueFirstFrame?: string; valueLastFrame?: string; }; } | { id: string; type: 'transformText'; data: NodeCommonData & { value?: string; }; } | { id: string; type: 'splitText'; data: NodeCommonData & { splitDelimiter?: string; }; } | { id: string; type: 'aspectRatio'; data: NodeCommonData & { output?: string; quality?: string; }; } | { id: string; type: 'groupItems'; data: NodeCommonData & { value?: string; }; } | { id: string; type: 'sliceAssets'; data: NodeCommonData & { from?: number | string; count?: number | string; isRandomize?: boolean; randomSeed?: string; isSeedLocked?: boolean; value?: string; }; } | { id: string; type: 'forEach'; data: NodeCommonData; } | { id: string; type: 'forEachEnd'; data: NodeCommonData & { parentNodeId?: string; }; } | { id: string; type: 'ifElse'; data: NodeCommonData & { conditionBlocks?: WorkflowEditorConditionBlock[]; }; } | { id: string; type: 'approval'; data: NodeCommonData & { message?: string; }; } | { id: string; type: 'modelInput'; data: NodeCommonData & { inputName: string; form?: Record; parentModelNodeId?: string; modelId?: string; }; }; export type WorkflowEditorEdge = { source: string; target: string; sourceHandle?: string | null; targetHandle?: string | null; data?: { isForEachEndEdge?: boolean; } | undefined; }; export type WorkflowEditorCondition = { field: string | undefined; operator: string; value?: string | string[]; }; export type WorkflowEditorConditionBlock = { conditions: WorkflowEditorCondition[]; logic: 'and' | 'or'; }; export type WorkflowEditorModelInput = { name: string; type: string; inputs?: Array<{ name: string; type: string; }>; min?: number; max?: number; step?: number; allowedValues?: string[]; }; export type WorkflowEditorResolutionPreset = { width?: number; height?: number; }; export type WorkflowEditorModel = { id?: string; inputs?: WorkflowEditorModelInput[]; tags?: string[]; uiConfig?: { resolutionComponent?: { widthInput?: string; heightInput?: string; presets?: WorkflowEditorResolutionPreset[]; }; }; }; export declare const ASPECT_RATIO_PRESETS: readonly ["21:9", "16:9", "3:2", "4:3", "5:4", "1:1", "4:5", "3:4", "2:3", "9:16", "9:21"]; export type AspectRatioBounds = { minWidth: number; maxWidth: number; minHeight: number; maxHeight: number; multipleOf: number; }; export type AspectRatioModelInputNames = { widthInputName?: string | undefined; heightInputName?: string | undefined; aspectRatioInputName?: string | undefined; }; export type WorkflowEditorFlowInputRef = { equal?: string | undefined; node?: string | undefined; conditional?: string[] | undefined; name?: string | undefined; }; export type WorkflowEditorFlowInput = { name: string; type: string; ref?: WorkflowEditorFlowInputRef | undefined; value?: string | number | string[] | boolean | undefined; items?: WorkflowEditorFlowInput[][] | undefined; }; export type WorkflowEditorFlowItem = { id: string; type: string; modelId?: string | undefined; inputs?: WorkflowEditorFlowInput[] | undefined; logic?: { transform?: string | undefined; cases?: { condition: string; value: string; }[] | undefined; default?: string | undefined; } | undefined; logicType?: 'if-else' | undefined; loopBodyNodeIds?: string[] | undefined; includeOutputsInWorkflowJob?: true | undefined; dependsOn?: string[] | undefined; label?: string | undefined; }; export declare function normalizeAspectRatio(aspectRatio: string | undefined): string | undefined; export declare function getAspectRatioModelInputNames(model: WorkflowEditorModel | undefined): AspectRatioModelInputNames; export declare function getAspectRatioBounds(model: WorkflowEditorModel | undefined, { widthInputName, heightInputName }: Pick): AspectRatioBounds | undefined; export declare function getDimensionsFromAspectRatio(args: { aspectRatio: string; bounds: AspectRatioBounds; }): { width: number; height: number; } | undefined; /** * Converts a workflow editor state (nodes, edges, inputKeys) into a flow array * ready to be passed to `client.workflows.update({ flow: ... })`. * * @example * ```ts * const flow = convertWorkflowEditorToFlow({ nodes, edges, inputKeys, getModel }); * await client.workflows.update(workflowId, { flow: flow as WorkflowUpdateParams.Flow[] }); * ``` */ export type ConvertWorkflowEditorToFlowParams = { nodes: WorkflowEditorNode[]; edges: WorkflowEditorEdge[]; inputKeys: string[]; /** Optional model resolver — return the model object, 'unknown', or undefined. */ getModel?: (modelId: string) => WorkflowEditorModel | 'unknown' | undefined; }; export declare function convertWorkflowEditorToFlow(params: ConvertWorkflowEditorToFlowParams): WorkflowEditorFlowItem[]; export {}; //# sourceMappingURL=workflow_converter.d.mts.map