@bernierllc/generic-workflow-ui
Version:
Generic, reusable workflow UI components with linear and graph visualization
120 lines • 3.29 kB
TypeScript
/**
* Complete workflow definition in JSON format (n8n-style)
*/
export interface WorkflowJSONDefinition<TNodeData = any, TConnectionData = any> {
/** Workflow metadata */
name: string;
nodes: WorkflowNode<TNodeData>[];
connections: WorkflowConnections<TConnectionData>;
settings?: WorkflowSettings;
staticData?: Record<string, any>;
tags?: string[];
pinData?: Record<string, any>;
versionId?: string;
meta?: WorkflowMeta;
}
/**
* Workflow node (equivalent to stage/step)
*/
export interface WorkflowNode<TNodeData = any> {
/** Unique node identifier */
id: string;
/** Node name */
name: string;
/** Node type (e.g., 'stage', 'action', 'condition', 'trigger') */
type: string;
/** Node type version */
typeVersion?: number;
/** Node position in UI (x, y coordinates) */
position: [number, number];
/** Node parameters/configuration */
parameters?: Record<string, any>;
/** Node-specific data */
data?: TNodeData;
/** Node notes/description */
notes?: string;
/** Node disabled state */
disabled?: boolean;
/** Node continue on failure */
continueOnFail?: boolean;
/** Node always output data */
alwaysOutputData?: boolean;
/** Node execute once */
executeOnce?: boolean;
/** Node retry configuration */
retryOnFail?: boolean;
maxTries?: number;
waitBetweenTries?: number;
/** Node webhook configuration */
webhookId?: string;
/** Node credentials */
credentials?: Record<string, any>;
/** Node metadata */
metadata?: Record<string, any>;
}
/**
* Workflow connections (edges between nodes)
*/
export interface WorkflowConnections<TConnectionData = any> {
/** Connections organized by node ID and output type */
[]: {
[]: WorkflowConnection<TConnectionData>[][];
};
}
/**
* Single connection between nodes
*/
export interface WorkflowConnection<TConnectionData = any> {
/** Target node ID */
node: string;
/** Target input type */
type: string;
/** Input index */
index: number;
/** Connection data */
data?: TConnectionData;
}
/**
* Workflow settings
*/
export interface WorkflowSettings {
/** Execution order */
executionOrder?: 'v1' | 'v2';
/** Save execution progress */
saveExecutionProgress?: boolean;
/** Save data error execution */
saveDataErrorExecution?: 'all' | 'none';
/** Save data success execution */
saveDataSuccessExecution?: 'all' | 'none';
/** Save manual executions */
saveManualExecutions?: boolean;
/** Timezone */
timezone?: string;
/** Error workflow */
errorWorkflow?: string;
/** Caller policy */
callerPolicy?: string;
/** Tags */
tags?: string[];
}
/**
* Workflow metadata
*/
export interface WorkflowMeta {
/** Template ID */
templateId?: string;
/** Template credentials */
templateCredsSetupCompleted?: boolean;
/** Instance ID */
instanceId?: string;
}
/**
* JSON schema type for validation
*/
export interface JSONSchema {
type: string;
properties?: Record<string, any>;
required?: string[];
additionalProperties?: boolean;
}
//# sourceMappingURL=workflow-json.d.ts.map