rawsql-ts
Version:
[beta]High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.
74 lines (73 loc) • 3.02 kB
TypeScript
/**
* Represents a node in the SQL data flow diagram
*/
export interface DataFlowNode {
id: string;
label: string;
type: NodeType;
shape: NodeShape;
details?: string[];
}
export type NodeType = 'table' | 'cte' | 'subquery' | 'process' | 'operation' | 'output';
export type NodeShape = 'cylinder' | 'hexagon' | 'diamond' | 'rounded' | 'rectangle' | 'circle' | 'stadium';
/**
* Base class for all data flow nodes
*/
export declare abstract class BaseDataFlowNode implements DataFlowNode {
id: string;
label: string;
type: NodeType;
shape: NodeShape;
details?: string[] | undefined;
constructor(id: string, label: string, type: NodeType, shape: NodeShape, details?: string[] | undefined);
abstract getMermaidRepresentation(): string;
}
/**
* Represents a data source (table, CTE, subquery)
*/
export declare class DataSourceNode extends BaseDataFlowNode {
private annotations;
constructor(id: string, label: string, type: 'table' | 'cte' | 'subquery');
addAnnotation(annotation: string): void;
hasAnnotation(annotation: string): boolean;
getMermaidRepresentation(): string;
static createTable(tableName: string): DataSourceNode;
static createCTE(cteName: string): DataSourceNode;
static createSubquery(alias: string): DataSourceNode;
}
/**
* Represents a processing operation (WHERE, GROUP BY, SELECT, etc.)
*/
export declare class ProcessNode extends BaseDataFlowNode {
constructor(id: string, operation: string, context?: string);
getMermaidRepresentation(): string;
/** @deprecated Process nodes are no longer used in data flow diagrams */
static createWhere(context: string): ProcessNode;
/** @deprecated Process nodes are no longer used in data flow diagrams */
static createGroupBy(context: string): ProcessNode;
/** @deprecated Process nodes are no longer used in data flow diagrams */
static createHaving(context: string): ProcessNode;
/** @deprecated Process nodes are no longer used in data flow diagrams */
static createSelect(context: string): ProcessNode;
/** @deprecated Process nodes are no longer used in data flow diagrams */
static createOrderBy(context: string): ProcessNode;
/** @deprecated Process nodes are no longer used in data flow diagrams */
static createLimit(context: string, hasOffset?: boolean): ProcessNode;
}
/**
* Represents an operation (JOIN, UNION, etc.)
*/
export declare class OperationNode extends BaseDataFlowNode {
constructor(id: string, operation: string, shape?: NodeShape);
getMermaidRepresentation(): string;
static createJoin(joinId: string, joinType: string): OperationNode;
static createUnion(unionId: string, unionType?: string): OperationNode;
static createSetOperation(operationId: string, operation: string): OperationNode;
}
/**
* Represents the final output
*/
export declare class OutputNode extends BaseDataFlowNode {
constructor(context?: string);
getMermaidRepresentation(): string;
}