import { Filepath } from '../../core/types/filepath'; import { default as Report } from '../../core/types/report'; import { NodeSymbol } from '../../core/types/symbol'; import { default as Compiler } from '..'; /** * Checks if an identifier is valid (can be used without quotes in DBML). * Valid identifiers must: * - Contain only alphanumeric characters and underscores * - Not start with a digit * * @param name - The identifier to check * @returns True if the identifier is valid and doesn't need quotes * * @example * isValidIdentifier('users') => true * isValidIdentifier('user_name') => true * isValidIdentifier('user name') => false (contains space) * isValidIdentifier('123users') => false (starts with digit) */ export declare function isValidIdentifier(name: string): boolean; /** * Adds double quotes around an identifier if needed. * Identifiers need quotes if they: * - Contain non-alphanumeric characters (except underscore) * - Start with a digit * - Are empty strings * * @param identifier - The identifier to potentially quote * @returns The identifier with double quotes if needed, otherwise unchanged * * @example * addDoubleQuoteIfNeeded('users') => 'users' * addDoubleQuoteIfNeeded('user name') => '"user name"' * addDoubleQuoteIfNeeded('123users') => '"123users"' * addDoubleQuoteIfNeeded('user-name') => '"user-name"' */ export declare function addDoubleQuoteIfNeeded(identifier: string): string; export declare function normalizeQualifiedName(...parts: string[]): string; /** * Unescapes a string by processing escape sequences. * Handles escaped quotes (\"), common escape sequences, unicode (\uHHHH), and arbitrary escapes. * * @param str - The string to unescape * @returns The unescaped string * * @example * unescapeString('table\\"name') => 'table"name' * unescapeString('line1\\nline2') => 'line1\nline2' * unescapeString('\\u0041BC') => 'ABC' * unescapeString('\\x') => 'x' */ export declare function unescapeString(str: string): string; /** * Escapes a string by adding backslashes before special characters. * Handles quotes and other characters that need escaping. * * @param str - The string to escape * @returns The escaped string * * @example * escapeString('table"name') => 'table\\"name' * escapeString('line1\nline2') => 'line1\\nline2' */ export declare function escapeString(str: string): string; /** * Formats a record value for DBML output. * Handles different data types and converts them to appropriate DBML syntax. * * @param recordValue - The record value with type information, or a primitive value * @returns The formatted string representation for DBML * * @example * formatRecordValue({ value: 1, type: 'integer' }) => '1' * formatRecordValue({ value: 'Alice', type: 'string' }) => "'Alice'" * formatRecordValue({ value: true, type: 'bool' }) => 'true' * formatRecordValue({ value: null, type: 'string' }) => 'null' * formatRecordValue(undefined) => 'null' * formatRecordValue(null) => 'null' * formatRecordValue('Alice') => "'Alice'" * formatRecordValue(42) => '42' * formatRecordValue(true) => 'true' */ export declare function formatRecordValue(recordValue: { value: any; type: string; } | string | number | boolean | null | undefined): string; /** * Splits a qualified identifier string into its components, handling quoted segments. * * Examples: * - "schema.table" => ["schema", "table"] * - '"schema name".table' => ["schema name", "table"] * - '"schema.with.dots"."table.with.dots".column' => ["schema.with.dots", "table.with.dots", "column"] * - 'schema."table name"."column name"' => ["schema", "table name", "column name"] * - 'schema . table' => ["schema", "table"] * * @param identifier - The qualified identifier string to split * @returns Array of unquoted identifier components */ export declare function splitQualifiedIdentifier(identifier: string): string[]; export declare function collectTransitiveDependencies(compiler: Compiler, entrypoints: Filepath[]): Filepath[]; export declare function allVisibleMembers(compiler: Compiler): Report; /** * Wraps a note value in the appropriate DBML quote style. * Uses triple quotes for multiline content, single quotes otherwise. */ export declare function quoteNoteValue(value: string): string;