/** * Dynamic Schema Service * Handles fetching configuration schemas from REST endpoints at runtime. * Used for nodes where the config schema cannot be determined at workflow load time. * * @module services/dynamicSchemaService */ import type { ConfigSchema, DynamicSchemaEndpoint, ExternalEditLink, ConfigEditOptions, WorkflowNode } from '../types/index.js'; /** * Result of a dynamic schema fetch operation */ export interface DynamicSchemaResult { /** Whether the fetch was successful */ success: boolean; /** The fetched config schema (if successful) */ schema?: ConfigSchema; /** Error message (if failed) */ error?: string; /** Whether the schema was loaded from cache */ fromCache?: boolean; } /** * Fetches a dynamic configuration schema from a REST endpoint. * * @param endpoint - The dynamic schema endpoint configuration * @param node - The workflow node instance * @param workflowId - Optional workflow ID for context * @returns A promise that resolves to the schema result * * @example * ```typescript * const endpoint: DynamicSchemaEndpoint = { * url: "/api/nodes/{nodeTypeId}/schema", * method: "GET", * parameterMapping: { nodeTypeId: "metadata.id" } * }; * * const result = await fetchDynamicSchema(endpoint, node); * if (result.success && result.schema) { * // Use the fetched schema * } * ``` */ export declare function fetchDynamicSchema(endpoint: DynamicSchemaEndpoint, node: WorkflowNode, workflowId?: string): Promise; /** * Resolves an external edit link URL with template variables. * * @param link - The external edit link configuration * @param node - The workflow node instance * @param workflowId - Optional workflow ID for context * @param callbackUrl - Optional callback URL to append * @returns The resolved URL string * * @example * ```typescript * const link: ExternalEditLink = { * url: "https://admin.example.com/nodes/{nodeTypeId}/edit/{instanceId}", * parameterMapping: { nodeTypeId: "metadata.id", instanceId: "id" } * }; * * const url = resolveExternalEditUrl(link, node, workflowId); * // Returns "https://admin.example.com/nodes/llm-node/edit/node-1" * ``` */ export declare function resolveExternalEditUrl(link: ExternalEditLink, node: WorkflowNode, workflowId?: string, callbackUrl?: string): string; /** * Gets the effective config edit options for a node. * Merges node type defaults with instance-level overrides. * * @param node - The workflow node instance * @returns The merged config edit options, or undefined if not configured */ export declare function getEffectiveConfigEditOptions(node: WorkflowNode): ConfigEditOptions | undefined; /** * Clears the schema cache. * Can optionally clear only entries matching a specific pattern. * * @param pattern - Optional pattern to match cache keys (e.g., node type ID) */ export declare function clearSchemaCache(pattern?: string): void; /** * Invalidates a specific schema cache entry for a node. * * @param node - The workflow node to invalidate cache for * @param endpoint - The dynamic schema endpoint configuration */ export declare function invalidateSchemaCache(node: WorkflowNode, endpoint: DynamicSchemaEndpoint): void; /** * Checks if a node has config edit options configured. * * @param node - The workflow node to check * @returns True if the node has config edit options configured */ export declare function hasConfigEditOptions(node: WorkflowNode): boolean; /** * Determines if external edit should be shown for a node. * * @param node - The workflow node to check * @returns True if external edit link should be shown */ export declare function shouldShowExternalEdit(node: WorkflowNode): boolean; /** * Determines if dynamic schema should be used for a node. * * @param node - The workflow node to check * @returns True if dynamic schema should be fetched */ export declare function shouldUseDynamicSchema(node: WorkflowNode): boolean;