import type { ConditionalExpression } from "./conditional-logic"; import type { Connection, DynamicObjectInputField, InputCleanFunction, InputFieldCollection, Inputs, KeyValuePair, StructuredObjectInputField } from "./Inputs"; /** Resolves a single InputFieldDefinition's runtime value type. * - structuredObject: record of declared children's resolved value types. * - dynamicObject: discriminated union keyed by the selected configuration, * with the configuration's resolved inputs nested under `values` to avoid * collisions with the `configuration` discriminant key. * The depth caps (`LeafInputFieldDefinition`, `StructuredOrLeafInputFieldDefinition`) * prevent unbounded recursion. */ type InputValue = T extends StructuredObjectInputField ? { [K in keyof T["inputs"]]: InputValue; } : T extends DynamicObjectInputField ? { [C in keyof T["configurations"]]: { configuration: C; values: { [K in keyof T["configurations"][C]["inputs"]]: InputValue; }; }; }[keyof T["configurations"]] : T extends { clean: InputCleanFunction; } ? ReturnType : T extends { type: "connection"; collection?: InputFieldCollection; } ? ExtractValue : T extends { type: "conditional"; collection?: InputFieldCollection; } ? ExtractValue : T extends { default?: unknown; collection?: InputFieldCollection; } ? ExtractValue : unknown; /** * Collection of input parameters. * Inputs can be static values, references to config variables, or * references to previous steps' outputs. */ export type ActionInputParameters = { [Property in keyof TInputs]: InputValue; }; export type ExtractValue = TCollection extends "keyvaluelist" ? KeyValuePair[] : TCollection extends "valuelist" ? TType[] : TType; export {};