import { ColumnMetadata as ColumnMetadata$1, Dialect, Kysely, MssqlDialect as MssqlDialect$1, MysqlDialect as MysqlDialect$1, SqliteDialect as SqliteDialect$1, TableMetadata as TableMetadata$1 } from "kysely"; import { z } from "zod"; //#region src/generator/ast/array-expression-node.d.ts declare class ArrayExpressionNode { readonly type = "ArrayExpression"; readonly values: ExpressionNode; constructor(values: ExpressionNode); } //#endregion //#region src/generator/ast/extends-clause-node.d.ts declare class ExtendsClauseNode { readonly checkType: ExpressionNode; readonly extendsType: ExpressionNode; readonly trueType: ExpressionNode; readonly falseType: ExpressionNode; readonly type = "ExtendsClause"; constructor(checkType: ExpressionNode, extendsType: ExpressionNode, trueType: ExpressionNode, falseType: ExpressionNode); } //#endregion //#region src/generator/ast/generic-expression-node.d.ts declare class GenericExpressionNode { readonly args: ExpressionNode[]; readonly name: string; readonly type = "GenericExpression"; constructor(name: string, args: ExpressionNode[]); } //#endregion //#region src/generator/ast/identifier-node.d.ts declare class IdentifierNode { readonly isTableIdentifier: boolean; name: string; readonly type = "Identifier"; constructor(name: string, options?: { isTableIdentifier?: boolean; }); } declare class TableIdentifierNode extends IdentifierNode { constructor(name: string); } //#endregion //#region src/generator/ast/infer-clause-node.d.ts declare class InferClauseNode { readonly name: string; readonly type = "InferClause"; constructor(name: string); } //#endregion //#region src/generator/ast/literal-node.d.ts type Literal = number | string; declare class LiteralNode { readonly type = "Literal"; readonly value: T; constructor(value: T); } //#endregion //#region src/generator/ast/mapped-type-node.d.ts declare class MappedTypeNode { readonly type = "MappedType"; readonly value: ExpressionNode; constructor(value: ExpressionNode); } //#endregion //#region src/generator/ast/property-node.d.ts declare class PropertyNode { readonly comment: string | null; readonly key: string; readonly type = "Property"; readonly value: ExpressionNode; constructor(key: string, value: ExpressionNode, comment?: string | null); } //#endregion //#region src/generator/ast/object-expression-node.d.ts declare class ObjectExpressionNode { readonly properties: PropertyNode[]; readonly type = "ObjectExpression"; constructor(properties: PropertyNode[]); } //#endregion //#region src/generator/ast/raw-expression-node.d.ts declare class RawExpressionNode { readonly expression: string; readonly type = "RawExpression"; constructor(expression: string); } //#endregion //#region src/generator/ast/union-expression-node.d.ts declare class UnionExpressionNode { readonly args: ExpressionNode[]; readonly type = "UnionExpression"; constructor(args: ExpressionNode[]); } //#endregion //#region src/generator/ast/expression-node.d.ts type ExpressionNode = ArrayExpressionNode | ExtendsClauseNode | GenericExpressionNode | IdentifierNode | InferClauseNode | LiteralNode | MappedTypeNode | ObjectExpressionNode | RawExpressionNode | UnionExpressionNode; //#endregion //#region src/generator/ast/template-node.d.ts declare class TemplateNode { readonly expression: ExpressionNode; readonly params: string[]; readonly type = "Template"; constructor(params: string[], expression: ExpressionNode); } //#endregion //#region src/generator/ast/definition-node.d.ts type DefinitionNode = ExpressionNode | TemplateNode; //#endregion //#region src/generator/ast/module-reference-node.d.ts declare class ModuleReferenceNode { readonly name: string; /** * The name of the export in the source module when using named imports. * For example, in `"MyType": "./types#OriginalType"`, the `sourceName` is * "OriginalType". This would generate the following: * * ```ts * import { OriginalType as MyType } from './types'; * ``` */ readonly sourceName?: string; readonly type = "ModuleReference"; constructor(name: string, sourceName?: string); } //#endregion //#region src/generator/adapter.d.ts type Definitions = Record; type Imports = Record; type Scalars = Record; /** * Specifies settings for how code should be generated for the given database library. */ declare abstract class Adapter { readonly defaultScalar: ExpressionNode; readonly defaultSchemas: string[]; readonly definitions: Definitions; readonly imports: Imports; readonly scalars: Scalars; } //#endregion //#region src/generator/ast/alias-declaration-node.d.ts declare class AliasDeclarationNode { readonly body: ExpressionNode | TemplateNode; readonly id: IdentifierNode; readonly type = "AliasDeclaration"; constructor(name: string, body: ExpressionNode | TemplateNode); } //#endregion //#region src/generator/ast/column-type-node.d.ts declare class ColumnTypeNode extends GenericExpressionNode { constructor(selectType: ExpressionNode, ...insertAndUpdateTypes: [] | [insertType: ExpressionNode] | [insertType: ExpressionNode, updateType: ExpressionNode]); } //#endregion //#region src/generator/ast/interface-declaration-node.d.ts declare class InterfaceDeclarationNode { readonly body: ObjectExpressionNode; readonly id: IdentifierNode; readonly type = "InterfaceDeclaration"; constructor(name: IdentifierNode, body: ObjectExpressionNode); } //#endregion //#region src/generator/transformer/identifier-style.d.ts type IdentifierStyle = 'kysely-pascal-case' | 'screaming-snake-case'; //#endregion //#region src/generator/ast/runtime-enum-declaration-node.d.ts type RuntimeEnumMember = [key: string, value: LiteralNode]; declare class RuntimeEnumDeclarationNode { readonly members: RuntimeEnumMember[]; id: IdentifierNode; readonly type = "RuntimeEnumDeclaration"; constructor(name: string, literals: string[], options?: { identifierStyle?: IdentifierStyle; }); } //#endregion //#region src/generator/ast/export-statement-node.d.ts type ExportStatementArgumentNode = AliasDeclarationNode | InterfaceDeclarationNode | RuntimeEnumDeclarationNode; declare class ExportStatementNode { readonly argument: T; readonly type = "ExportStatement"; constructor(argument: T); } //#endregion //#region src/generator/ast/import-clause-node.d.ts declare class ImportClauseNode { readonly alias: string | null; readonly name: string; readonly type = "ImportClause"; constructor(name: string, alias?: string | null); } //#endregion //#region src/generator/ast/import-statement-node.d.ts declare class ImportStatementNode { readonly imports: ImportClauseNode[]; readonly moduleName: string; readonly type = "ImportStatement"; constructor(moduleName: string, imports: ImportClauseNode[]); } //#endregion //#region src/generator/ast/json-column-type-node.d.ts declare class JsonColumnTypeNode extends GenericExpressionNode { constructor(selectType: ExpressionNode, ...args: [] | [insertType: ExpressionNode] | [insertType: ExpressionNode, updateType: ExpressionNode]); } //#endregion //#region src/generator/ast/statement-node.d.ts type StatementNode = ExportStatementNode | ImportStatementNode; //#endregion //#region src/generator/logger/log-level.d.ts type LogLevel = (typeof LOG_LEVELS)[number]; declare const DEFAULT_LOG_LEVEL: LogLevel; declare const LOG_LEVELS: readonly ["silent", "error", "warn", "info", "debug"]; declare const getLogLevelNumber: (logLevel: LogLevel) => number; declare const matchLogLevel: ({ actual, expected }: { actual: LogLevel; expected: LogLevel; }) => boolean; //#endregion //#region src/generator/logger/logger.d.ts declare class Logger { #private; readonly logLevel: LogLevel; constructor(logLevel?: LogLevel); debug(...values: unknown[]): void; error(...values: unknown[]): void; info(...values: unknown[]): void; log(...values: unknown[]): void; success(...values: unknown[]): void; warn(...values: unknown[]): void; } //#endregion //#region src/generator/connection-string-parser.d.ts /** * @see https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html */ type ParseConnectionStringOptions = { connectionString: string; dialect?: DialectName; envFile?: string; logger?: Logger; }; type ParsedConnectionString = { connectionString: string; dialect: DialectName; }; /** * Parses a connection string URL or loads it from an environment file. * Upon success, it also returns which dialect was inferred from the connection string. */ declare class ConnectionStringParser { #private; parse(options: ParseConnectionStringOptions): ParsedConnectionString; } //#endregion //#region src/generator/constants.d.ts declare const DEFAULT_OUT_FILE: string; //#endregion //#region src/introspector/enum-collection.d.ts type EnumMap = Record; declare class EnumCollection { readonly enums: EnumMap; constructor(enums?: EnumMap); add(key: string, value: string): void; get(key: string): string[] | null; has(key: string): boolean; set(key: string, values: string[]): void; } //#endregion //#region src/introspector/metadata/column-metadata.d.ts type ColumnMetadataOptions = { comment?: string | null; dataType: string; dataTypeSchema?: string; enumValues?: string[] | null; hasDefaultValue?: boolean; isArray?: boolean; isAutoIncrementing?: boolean; isNullable?: boolean; name: string; }; declare class ColumnMetadata { comment: string | null; dataType: string; dataTypeSchema: string | undefined; enumValues: string[] | null; hasDefaultValue: boolean; isArray: boolean; isAutoIncrementing: boolean; isNullable: boolean; name: string; constructor(options: ColumnMetadataOptions); } //#endregion //#region src/introspector/metadata/table-metadata.d.ts type TableMetadataOptions = { columns: ColumnMetadataOptions[]; isPartition?: boolean; isView?: boolean; name: string; schema?: string; }; declare class TableMetadata { columns: ColumnMetadata[]; isPartition: boolean; isView: boolean; name: string; schema: string | undefined; constructor(options: TableMetadataOptions); } //#endregion //#region src/introspector/metadata/database-metadata.d.ts type DatabaseMetadataOptions = { enums?: EnumCollection; tables: TableMetadataOptions[]; }; declare class DatabaseMetadata { enums: EnumCollection; tables: TableMetadata[]; constructor({ enums, tables }: DatabaseMetadataOptions); } //#endregion //#region src/introspector/introspector.d.ts type ConnectOptions = { connectionString: string; dialect: IntrospectorDialect; }; type IntrospectOptions = { db: Kysely; excludePattern?: string | null; includePattern?: string | null; partitions?: boolean; }; /** * Analyzes and returns metadata for a connected database. */ declare abstract class Introspector { private establishDatabaseConnection; connect(options: ConnectOptions): Promise>; protected getTables(options: IntrospectOptions): Promise; protected filterTables(tables: TableMetadata$1[], options: IntrospectOptions): TableMetadata$1[]; abstract introspect(options: IntrospectOptions): Promise; } //#endregion //#region src/introspector/dialect.d.ts type CreateKyselyDialectOptions = { connectionString: string; ssl?: boolean; }; /** * A Dialect is the glue between the codegen and the specified database. */ declare abstract class IntrospectorDialect { /** * The introspector for the dialect. */ abstract readonly introspector: Introspector; /** * Creates a Kysely dialect. */ abstract createKyselyDialect(options: CreateKyselyDialectOptions): Promise; } //#endregion //#region src/introspector/dialects/mysql/mysql-db.d.ts type MysqlDB = { 'information_schema.COLUMNS': { COLUMN_NAME: string; COLUMN_TYPE: string; TABLE_NAME: string; TABLE_SCHEMA: string; }; }; //#endregion //#region src/introspector/dialects/mysql/mysql-introspector.d.ts declare class MysqlIntrospector extends Introspector { createDatabaseMetadata({ enums, tables: rawTables }: { enums: EnumCollection; tables: TableMetadata$1[]; }): DatabaseMetadata; introspect(options: IntrospectOptions): Promise; introspectEnums(db: Kysely): Promise; } //#endregion //#region src/introspector/dialects/mysql/mysql-dialect.d.ts declare class MysqlIntrospectorDialect extends IntrospectorDialect { readonly introspector: MysqlIntrospector; createKyselyDialect(options: CreateKyselyDialectOptions): Promise; } //#endregion //#region src/generator/dialects/mysql/date-strings.d.ts declare const MYSQL_DATE_STRING_TYPES: readonly ["date", "datetime", "timestamp"]; type MysqlDateStringType = (typeof MYSQL_DATE_STRING_TYPES)[number]; type MysqlDateStrings = boolean | MysqlDateStringType[]; //#endregion //#region src/generator/dialects/mysql/mysql-adapter.d.ts type MysqlAdapterOptions = { dateStrings?: MysqlDateStrings; }; declare class MysqlAdapter extends Adapter { readonly definitions: { Decimal: ColumnTypeNode; Geometry: UnionExpressionNode; Json: ColumnTypeNode; JsonArray: DefinitionNode; JsonObject: DefinitionNode; JsonPrimitive: DefinitionNode; JsonValue: DefinitionNode; LineString: ArrayExpressionNode; Point: ObjectExpressionNode; Polygon: ArrayExpressionNode; }; readonly scalars: { bigint: IdentifierNode; binary: IdentifierNode; bit: IdentifierNode; blob: IdentifierNode; char: IdentifierNode; date: IdentifierNode; datetime: IdentifierNode; decimal: IdentifierNode; double: IdentifierNode; float: IdentifierNode; geomcollection: ArrayExpressionNode; geometry: IdentifierNode; int: IdentifierNode; json: IdentifierNode; linestring: IdentifierNode; longblob: IdentifierNode; longtext: IdentifierNode; mediumblob: IdentifierNode; mediumint: IdentifierNode; mediumtext: IdentifierNode; multilinestring: ArrayExpressionNode; multipoint: ArrayExpressionNode; multipolygon: ArrayExpressionNode; point: IdentifierNode; polygon: IdentifierNode; set: IdentifierNode; smallint: IdentifierNode; text: IdentifierNode; time: IdentifierNode; timestamp: IdentifierNode; tinyblob: IdentifierNode; tinyint: IdentifierNode; tinytext: IdentifierNode; varbinary: IdentifierNode; varchar: IdentifierNode; year: IdentifierNode; }; constructor(options?: MysqlAdapterOptions); } //#endregion //#region src/generator/dialects/mysql/mysql-dialect.d.ts type MysqlDialectOptions = { dateStrings?: MysqlDateStrings; }; declare class MysqlDialect extends MysqlIntrospectorDialect implements GeneratorDialect { readonly adapter: MysqlAdapter; constructor(options?: MysqlDialectOptions); } //#endregion //#region src/introspector/dialects/postgres/date-parser.d.ts type DateParser = 'string' | 'timestamp'; declare const DEFAULT_DATE_PARSER: DateParser; //#endregion //#region src/introspector/dialects/postgres/numeric-parser.d.ts type NumericParser = 'number' | 'number-or-string' | 'string'; declare const DEFAULT_NUMERIC_PARSER: NumericParser; //#endregion //#region src/introspector/dialects/postgres/postgres-db.d.ts type PostgresDB = { 'pg_catalog.pg_namespace': { nspname: string; oid: number; }; pg_enum: { enumlabel: string; enumtypid: number; }; pg_type: { oid: number; typname: string; typnamespace: number; }; }; //#endregion //#region src/introspector/dialects/postgres/postgres-introspector.d.ts type PostgresDomainInspector = { rootType: string; typeName: string; typeSchema: string; }; type TableReference = { schema?: string; name: string; }; type PostgresIntrospectorOptions = { defaultSchemas?: string[]; domains?: boolean; partitions?: boolean; }; declare class PostgresIntrospector extends Introspector { protected readonly options: PostgresIntrospectorOptions; constructor(options?: PostgresIntrospectorOptions); protected getTables(options: IntrospectOptions): Promise; private getMaterializedViews; private mergeTables; private parseTableMetadata; createDatabaseMetadata({ domains, enums, partitions, tables: rawTables }: { domains: PostgresDomainInspector[]; enums: EnumCollection; partitions: TableReference[]; tables: TableMetadata$1[]; }): DatabaseMetadata; getRootType(column: ColumnMetadata$1, domains: PostgresDomainInspector[]): string; introspect(options: IntrospectOptions): Promise; introspectDomains(db: Kysely): Promise; introspectEnums(db: Kysely): Promise; introspectPartitions(db: Kysely): Promise; } //#endregion //#region src/introspector/dialects/postgres/postgres-dialect.d.ts type PostgresDialectOptions$1 = { dateParser?: DateParser; defaultSchemas?: string[]; domains?: boolean; numericParser?: NumericParser; partitions?: boolean; }; declare class PostgresIntrospectorDialect extends IntrospectorDialect { protected readonly options: PostgresDialectOptions$1; readonly introspector: PostgresIntrospector; constructor(options?: PostgresDialectOptions$1); createKyselyDialect(options: CreateKyselyDialectOptions): Promise; } //#endregion //#region src/generator/dialects/postgres/postgres-adapter.d.ts type PostgresAdapterOptions = { dateParser?: DateParser; numericParser?: NumericParser; }; declare class PostgresAdapter extends Adapter { readonly defaultScalar: IdentifierNode; readonly defaultSchemas: string[]; readonly definitions: { Circle: ObjectExpressionNode; Int8: ColumnTypeNode; Interval: ColumnTypeNode; Json: DefinitionNode; JsonArray: DefinitionNode; JsonObject: DefinitionNode; JsonPrimitive: DefinitionNode; JsonValue: DefinitionNode; Numeric: ColumnTypeNode; Point: ObjectExpressionNode; Timestamp: ColumnTypeNode; }; readonly imports: { IPostgresInterval: ModuleReferenceNode; }; readonly scalars: { bit: IdentifierNode; bool: IdentifierNode; box: IdentifierNode; bpchar: IdentifierNode; bytea: IdentifierNode; cidr: IdentifierNode; circle: IdentifierNode; date: IdentifierNode; float4: IdentifierNode; float8: IdentifierNode; inet: IdentifierNode; int2: IdentifierNode; int4: IdentifierNode; int8: IdentifierNode; interval: IdentifierNode; json: IdentifierNode; jsonb: IdentifierNode; line: IdentifierNode; lseg: IdentifierNode; macaddr: IdentifierNode; money: IdentifierNode; numeric: IdentifierNode; oid: IdentifierNode; path: IdentifierNode; point: IdentifierNode; polygon: IdentifierNode; text: IdentifierNode; time: IdentifierNode; timestamp: IdentifierNode; timestamptz: IdentifierNode; tsquery: IdentifierNode; tsvector: IdentifierNode; txid_snapshot: IdentifierNode; uuid: IdentifierNode; varbit: IdentifierNode; varchar: IdentifierNode; xml: IdentifierNode; }; constructor(options?: PostgresAdapterOptions); } //#endregion //#region src/generator/dialects/postgres/postgres-dialect.d.ts type PostgresDialectOptions = { dateParser?: DateParser; defaultSchemas?: string[]; domains?: boolean; numericParser?: NumericParser; partitions?: boolean; }; declare class PostgresDialect extends PostgresIntrospectorDialect implements GeneratorDialect { readonly adapter: PostgresAdapter; constructor(options?: PostgresDialectOptions); } //#endregion //#region src/generator/dialect.d.ts /** * A Dialect is the glue between the codegen and the specified database. */ declare abstract class GeneratorDialect extends IntrospectorDialect { abstract readonly adapter: Adapter; } type GeneratorDialectOptions = PostgresDialectOptions & MysqlDialectOptions; declare const getDialect: (name: DialectName, options?: GeneratorDialectOptions) => GeneratorDialect; //#endregion //#region src/introspector/dialects/kysely-bun-sqlite/kysely-bun-sqlite-introspector.d.ts declare class KyselyBunSqliteIntrospector extends Introspector { introspect(options: IntrospectOptions): Promise; } //#endregion //#region src/introspector/dialects/kysely-bun-sqlite/kysely-bun-sqlite-dialect.d.ts declare class KyselyBunSqliteIntrospectorDialect extends IntrospectorDialect { readonly introspector: KyselyBunSqliteIntrospector; createKyselyDialect(options: CreateKyselyDialectOptions): Promise; } //#endregion //#region src/generator/dialects/sqlite/sqlite-adapter.d.ts declare class SqliteAdapter extends Adapter { readonly defaultScalar: IdentifierNode; readonly scalars: { any: IdentifierNode; blob: IdentifierNode; boolean: IdentifierNode; integer: IdentifierNode; numeric: IdentifierNode; real: IdentifierNode; text: IdentifierNode; }; } //#endregion //#region src/generator/dialects/kysely-bun-sqlite/kysely-bun-sqlite-adapter.d.ts declare class KyselyBunSqliteAdapter extends SqliteAdapter {} //#endregion //#region src/generator/dialects/kysely-bun-sqlite/kysely-bun-sqlite-dialect.d.ts declare class KyselyBunSqliteDialect extends KyselyBunSqliteIntrospectorDialect implements GeneratorDialect { readonly adapter: KyselyBunSqliteAdapter; } //#endregion //#region src/generator/dialects/libsql/libsql-adapter.d.ts declare class LibsqlAdapter extends SqliteAdapter {} //#endregion //#region src/introspector/dialects/libsql/libsql-introspector.d.ts declare class LibsqlIntrospector extends Introspector { introspect(options: IntrospectOptions): Promise; } //#endregion //#region src/introspector/dialects/libsql/libsql-dialect.d.ts declare class LibsqlIntrospectorDialect extends IntrospectorDialect { readonly introspector: LibsqlIntrospector; createKyselyDialect(options: CreateKyselyDialectOptions): Promise; } //#endregion //#region src/generator/dialects/libsql/libsql-dialect.d.ts declare class LibsqlDialect extends LibsqlIntrospectorDialect implements GeneratorDialect { readonly adapter: LibsqlAdapter; } //#endregion //#region src/generator/dialects/mssql/mssql-adapter.d.ts declare class MssqlAdapter extends Adapter { readonly scalars: { bigint: IdentifierNode; binary: IdentifierNode; bit: IdentifierNode; char: IdentifierNode; date: IdentifierNode; datetime: IdentifierNode; datetime2: IdentifierNode; datetimeoffset: IdentifierNode; decimal: IdentifierNode; double: IdentifierNode; float: IdentifierNode; image: IdentifierNode; int: IdentifierNode; money: IdentifierNode; nchar: IdentifierNode; ntext: IdentifierNode; number: IdentifierNode; numeric: IdentifierNode; nvarchar: IdentifierNode; real: IdentifierNode; smalldatetime: IdentifierNode; smallint: IdentifierNode; smallmoney: IdentifierNode; text: IdentifierNode; time: IdentifierNode; tinyint: IdentifierNode; tvp: IdentifierNode; uniqueidentifier: IdentifierNode; varbinary: IdentifierNode; varchar: IdentifierNode; }; } //#endregion //#region src/introspector/dialects/mssql/mssql-introspector.d.ts declare class MssqlIntrospector extends Introspector { introspect(options: IntrospectOptions): Promise; } //#endregion //#region src/introspector/dialects/mssql/mssql-dialect.d.ts declare class MssqlIntrospectorDialect extends IntrospectorDialect { readonly introspector: MssqlIntrospector; protected loadConnectionStringParser(): Promise; /** * @see https://www.connectionstrings.com/microsoft-data-sqlclient/using-a-non-standard-port/ * @internal */ protected parseConnectionString(connectionString: string): Promise<{ database: string; instanceName: string | undefined; password: string; port: number | undefined; server: string; userName: string; domain: string; authenticationType: string; }>; createKyselyDialect(options: CreateKyselyDialectOptions): Promise; } //#endregion //#region src/generator/dialects/mssql/mssql-dialect.d.ts declare class MssqlDialect extends MssqlIntrospectorDialect implements GeneratorDialect { readonly adapter: MssqlAdapter; } //#endregion //#region src/generator/dialects/postgres-js/postgres-js-adapter.d.ts type PostgresJSAdapterOptions = Pick; declare class PostgresJSAdapter extends PostgresAdapter { constructor(options?: PostgresJSAdapterOptions); } //#endregion //#region src/introspector/dialects/postgres-js/postgres-js-dialect.d.ts declare class PostgresJSIntrospectorDialect extends PostgresIntrospectorDialect { createKyselyDialect(options: CreateKyselyDialectOptions): Promise; } //#endregion //#region src/generator/dialects/postgres-js/postgres-js-dialect.d.ts type PostgresJSDialectOptions = PostgresDialectOptions; declare class PostgresJSDialect extends PostgresJSIntrospectorDialect implements GeneratorDialect { readonly adapter: PostgresJSAdapter; constructor(options?: PostgresJSDialectOptions); } //#endregion //#region src/introspector/dialects/sqlite/sqlite-introspector.d.ts declare class SqliteIntrospector extends Introspector { introspect(options: IntrospectOptions): Promise; } //#endregion //#region src/introspector/dialects/sqlite/sqlite-dialect.d.ts declare class SqliteIntrospectorDialect extends IntrospectorDialect { readonly introspector: SqliteIntrospector; createKyselyDialect(options: CreateKyselyDialectOptions): Promise; } //#endregion //#region src/generator/dialects/sqlite/sqlite-dialect.d.ts declare class SqliteDialect extends SqliteIntrospectorDialect implements GeneratorDialect { readonly adapter: SqliteAdapter; } //#endregion //#region src/generator/dialects/worker-bun-sqlite/worker-bun-sqlite-dialect.d.ts declare class WorkerBunSqliteDialect extends SqliteIntrospectorDialect implements GeneratorDialect { readonly adapter: SqliteAdapter; } //#endregion //#region src/generator/generator/diff-checker.d.ts declare class DiffChecker { #private; diff(oldTypes: string, newTypes: string): string | undefined; } //#endregion //#region src/introspector/dialects/mysql/mysql-parser.d.ts declare class MysqlParser { #private; data: string; index: number; constructor(data: string); parseEnum(): string[]; } //#endregion //#region src/introspector/table-matcher.d.ts declare class TableMatcher { isMatch: (string: string) => boolean; isSimpleGlob: boolean; constructor(pattern: string); match(schema: string | undefined, name: string): boolean; } //#endregion //#region src/generator/generator/runtime-enums-style.d.ts type RuntimeEnumsStyle = 'pascal-case' | 'screaming-snake-case'; //#endregion //#region src/generator/transformer/transformer.d.ts type Overrides = { /** * Specifies type overrides for columns. * * @example * ```ts * // Allows overriding of columns to be a type-safe JSON column: * { * columns: { * ".": new JsonColumnType( * new RawExpressionNode("{ postalCode: string; street: string; city: string }") * ), * } * } * ``` */ columns?: Record; }; type TransformOptions = { camelCase?: boolean; customImports?: Record; defaultSchemas?: string[]; dialect: GeneratorDialect; metadata: DatabaseMetadata; overrides?: Overrides; runtimeEnums?: boolean | RuntimeEnumsStyle; typeMapping?: Record; }; declare const transform: (options: TransformOptions) => (ImportStatementNode | ExportStatementNode)[]; //#endregion //#region src/generator/generator/serializer.d.ts type SerializeFileOptions = { camelCase?: boolean; customImports?: Record; defaultSchemas?: string[]; overrides?: Overrides; typeMapping?: Record; }; type TypeScriptSerializerOptions = { runtimeEnums?: boolean | RuntimeEnumsStyle; singularize?: boolean | Record; skipAutogeneratedFileComment?: boolean; typeOnlyImports?: boolean; }; declare abstract class Serializer { abstract serializeFile(metadata: DatabaseMetadata, dialect: GeneratorDialect, options?: SerializeFileOptions): string; } declare class TypeScriptSerializer implements Serializer { readonly runtimeEnums: boolean | RuntimeEnumsStyle; readonly singularize: ((word: string) => string) | undefined; readonly skipAutogeneratedFileComment: boolean; readonly typeOnlyImports: boolean; constructor(options?: TypeScriptSerializerOptions); serializeAliasDeclaration(node: AliasDeclarationNode): string; serializeArrayExpression(node: ArrayExpressionNode): string; serializeExportStatement(node: ExportStatementNode): string; serializeExpression(node: ExpressionNode): string; serializeExtendsClause(node: ExtendsClauseNode): string; serializeFile(metadata: DatabaseMetadata, dialect: GeneratorDialect, options?: SerializeFileOptions): string; serializeGenericExpression(node: GenericExpressionNode): string; serializeIdentifier(node: IdentifierNode): string; serializeImportClause(node: ImportClauseNode): string; serializeImportStatement(node: ImportStatementNode): string; serializeInferClause(node: InferClauseNode): string; serializeInterfaceDeclaration(node: InterfaceDeclarationNode): string; serializeLiteral(node: LiteralNode): string; serializeKey(key: string): string; serializeMappedType(node: MappedTypeNode): string; serializeObjectExpression(node: ObjectExpressionNode): string; serializeProperty(node: PropertyNode): string; serializeRawExpression(node: RawExpressionNode): string; serializeRuntimeEnum(node: RuntimeEnumDeclarationNode): string; serializeStatements(nodes: StatementNode[]): string; serializeUnionExpression(node: UnionExpressionNode): string; } //#endregion //#region src/generator/generator/generate.d.ts type GenerateOptions = { camelCase?: boolean; customImports?: Record; db: Kysely; defaultSchemas?: string[]; dialect: GeneratorDialect; excludePattern?: string | null; includePattern?: string | null; logger?: Logger; outFile?: string | null; overrides?: Overrides; partitions?: boolean; print?: boolean; runtimeEnums?: boolean | RuntimeEnumsStyle; serializer?: Serializer; singularize?: boolean | Record; skipAutogeneratedFileComment?: boolean; typeMapping?: Record; typeOnlyImports?: boolean; verify?: boolean; }; type SerializeFromMetadataOptions = Omit & { metadata: DatabaseMetadata; startTime?: number; }; declare const generate: (options: GenerateOptions) => Promise; declare const serializeFromMetadata: (options: SerializeFromMetadataOptions) => string; //#endregion //#region src/generator/transformer/definitions.d.ts declare const GLOBAL_DEFINITIONS: { /** * @see https://github.com/RobinBlomberg/kysely-codegen/issues/135 */ ArrayType: TemplateNode; /** * @see https://github.com/RobinBlomberg/kysely-codegen/issues/135 */ ArrayTypeImpl: TemplateNode; Generated: TemplateNode; }; declare const JSON_ARRAY_DEFINITION: DefinitionNode; declare const JSON_OBJECT_DEFINITION: DefinitionNode; declare const JSON_PRIMITIVE_DEFINITION: DefinitionNode; declare const JSON_VALUE_DEFINITION: DefinitionNode; declare const JSON_DEFINITION: DefinitionNode; //#endregion //#region src/generator/transformer/imports.d.ts declare const GLOBAL_IMPORTS: { ColumnType: ModuleReferenceNode; JSONColumnType: ModuleReferenceNode; }; //#endregion //#region src/generator/transformer/symbol-collection.d.ts type SymbolEntry = [id: string, symbol: SymbolNode]; type SymbolMap = Record; type SymbolNameMap = Record; type SymbolNode = { node: ExpressionNode | TemplateNode; type: 'Definition'; } | { node: ModuleReferenceNode; type: 'ModuleReference'; } | { node: RuntimeEnumDeclarationNode; type: 'RuntimeEnumDefinition'; } | { node: LiteralNode; type: 'RuntimeEnumMember'; } | { type: 'Table'; }; type SymbolType = 'Definition' | 'ModuleReference' | 'RuntimeEnumDefinition' | 'RuntimeEnumMember' | 'Table'; declare class SymbolCollection { readonly identifierStyle: IdentifierStyle; readonly symbolNames: SymbolNameMap; readonly symbols: SymbolMap; constructor(options?: { entries?: SymbolEntry[]; identifierStyle?: IdentifierStyle; }); entries(): { id: string; name: string; symbol: SymbolNode; }[]; get(id: string): SymbolNode | undefined; getName(id: string): string | undefined; has(id: string): boolean; set(id: string, symbol: SymbolNode): string; } //#endregion //#region src/generator/utils/case-converter.d.ts /** * @example * toKyselyCamelCase('foo_bar') * // => 'fooBar' */ declare const toKyselyCamelCase: (string: string) => string; /** * @example * toKyselyPascalCase('foo_bar') * // => 'FooBar' */ declare const toKyselyPascalCase: (string: string) => string; /** * @example * toPascalCase('foo_bar') * // => 'FooBar' */ declare const toPascalCase: (string: string) => string; /** * @example * pascalCase('foo_bar') * // => 'FOO_BAR' */ declare const toScreamingSnakeCase: (string: string) => string; /** * @example * toWords('FooBar') * // => ['Foo', 'Bar'] */ declare const toWords: (string: string) => string[]; //#endregion //#region src/cli/config.d.ts type Config = { camelCase?: boolean; customImports?: CustomImports; dateParser?: DateParser; dateStrings?: MysqlDateStrings; defaultSchemas?: string[]; dialect?: DialectName; domains?: boolean; envFile?: string; excludePattern?: string | null; includePattern?: string | null; logger?: Logger; logLevel?: LogLevel; numericParser?: NumericParser; outFile?: string | null; overrides?: Overrides; partitions?: boolean; print?: boolean; runtimeEnums?: boolean | RuntimeEnumsStyle; serializer?: Serializer; singularize?: boolean | Record; skipAutogeneratedFileComment?: boolean; typeMapping?: Record; typeOnlyImports?: boolean; url?: string; verify?: boolean; }; type CustomImports = Record; type DialectName = z.infer; declare const dialectNameSchema: z.ZodEnum<{ "bun-sqlite": "bun-sqlite"; "kysely-bun-sqlite": "kysely-bun-sqlite"; libsql: "libsql"; mssql: "mssql"; mysql: "mysql"; postgres: "postgres"; "postgres-js": "postgres-js"; sqlite: "sqlite"; "worker-bun-sqlite": "worker-bun-sqlite"; }>; declare const configSchema: z.ZodObject<{ camelCase: z.ZodOptional; customImports: z.ZodOptional>; dateParser: z.ZodOptional>; dateStrings: z.ZodOptional>>]>>; defaultSchemas: z.ZodOptional>; dialect: z.ZodOptional>; domains: z.ZodOptional; envFile: z.ZodOptional; excludePattern: z.ZodOptional>; includePattern: z.ZodOptional>; logger: z.ZodOptional>; logLevel: z.ZodOptional>; numericParser: z.ZodOptional>; outFile: z.ZodOptional>; overrides: z.ZodOptional, z.ZodCustom, z.ZodCustom, z.ZodCustom, z.ZodCustom, z.ZodCustom, LiteralNode>, z.ZodCustom, z.ZodCustom, z.ZodCustom, z.ZodCustom, z.ZodString]>>>; }, z.core.$strip>>>; partitions: z.ZodOptional; print: z.ZodOptional; runtimeEnums: z.ZodOptional]>>; serializer: z.ZodOptional, z.ZodCustom, z.ZodOptional; customImports: z.ZodOptional>; defaultSchemas: z.ZodOptional>; overrides: z.ZodOptional, z.ZodCustom, z.ZodCustom, z.ZodCustom, z.ZodCustom, z.ZodCustom, LiteralNode>, z.ZodCustom, z.ZodCustom, z.ZodCustom, z.ZodCustom, z.ZodString]>>>; }, z.core.$strip>>>; typeMapping: z.ZodOptional>; }, z.core.$strip>>], null>, z.ZodString>; }, z.core.$strip>>; singularize: z.ZodOptional]>>; skipAutogeneratedFileComment: z.ZodOptional; typeMapping: z.ZodOptional>; typeOnlyImports: z.ZodOptional; url: z.ZodOptional; verify: z.ZodOptional; }, z.core.$strip>; //#endregion //#region src/cli/cli.d.ts /** * Creates a kysely-generate command-line interface. */ declare class Cli { #private; logLevel: "silent" | "error" | "warn" | "info" | "debug"; generate(options: Config): Promise; parseOptions(args: string[], options?: { config?: Config; silent?: boolean; }): Config; run(options?: { argv?: string[]; config?: Config; }): Promise; } //#endregion //#region src/cli/constants.d.ts declare const DEFAULT_RUNTIME_ENUMS_STYLE: RuntimeEnumsStyle; declare const DEFAULT_URL = "env(DATABASE_URL)"; declare const LOG_LEVEL_NAMES: readonly ["debug", "info", "warn", "error", "silent"]; declare const VALID_DIALECTS: string[]; //#endregion //#region src/cli/flags.d.ts type Flag = { default?: string; description: string; example?: string; examples?: string[]; longName: string; shortName?: string; values?: readonly string[]; }; declare const FLAGS: ({ description: string; longName: string; example?: undefined; default?: undefined; values?: undefined; examples?: undefined; shortName?: undefined; } | { description: string; example: string; longName: string; default?: undefined; values?: undefined; examples?: undefined; shortName?: undefined; } | { default: string; description: string; longName: string; values: string[]; example?: undefined; examples?: undefined; shortName?: undefined; } | { default: string; description: string; longName: string; example?: undefined; values?: undefined; examples?: undefined; shortName?: undefined; } | { description: string; longName: string; values: string[]; example?: undefined; default?: undefined; examples?: undefined; shortName?: undefined; } | { description: string; examples: string[]; longName: string; example?: undefined; default?: undefined; values?: undefined; shortName?: undefined; } | { description: string; longName: string; shortName: string; example?: undefined; default?: undefined; values?: undefined; examples?: undefined; } | { default: string; description: string; longName: string; values: readonly ["debug", "info", "warn", "error", "silent"]; example?: undefined; examples?: undefined; shortName?: undefined; })[]; declare const serializeFlags: (flags: Flag[]) => string; //#endregion //#region src/db.d.ts type DB = {}; //#endregion export { Adapter, AliasDeclarationNode, ArrayExpressionNode, Cli, ColumnMetadata, ColumnMetadataOptions, ColumnTypeNode, Config, ConnectionStringParser, CreateKyselyDialectOptions, CustomImports, DB, DEFAULT_DATE_PARSER, DEFAULT_LOG_LEVEL, DEFAULT_NUMERIC_PARSER, DEFAULT_OUT_FILE, DEFAULT_RUNTIME_ENUMS_STYLE, DEFAULT_URL, DatabaseMetadata, DatabaseMetadataOptions, DateParser, DefinitionNode, Definitions, DialectName, DiffChecker, EnumCollection, ExportStatementNode, ExpressionNode, ExtendsClauseNode, FLAGS, GLOBAL_DEFINITIONS, GLOBAL_IMPORTS, GenerateOptions, GeneratorDialect, GeneratorDialectOptions, GenericExpressionNode, IdentifierNode, IdentifierStyle, ImportClauseNode, ImportStatementNode, Imports, InferClauseNode, InterfaceDeclarationNode, IntrospectOptions, Introspector, IntrospectorDialect, JSON_ARRAY_DEFINITION, JSON_DEFINITION, JSON_OBJECT_DEFINITION, JSON_PRIMITIVE_DEFINITION, JSON_VALUE_DEFINITION, JsonColumnTypeNode, KyselyBunSqliteDialect, KyselyBunSqliteIntrospector, KyselyBunSqliteIntrospectorDialect, LOG_LEVELS, LOG_LEVEL_NAMES, LibsqlAdapter, LibsqlDialect, LibsqlIntrospector, LibsqlIntrospectorDialect, LiteralNode, LogLevel, Logger, MYSQL_DATE_STRING_TYPES, MappedTypeNode, ModuleReferenceNode, MssqlAdapter, MssqlDialect, MssqlIntrospector, MssqlIntrospectorDialect, MysqlAdapter, MysqlDB, MysqlDateStringType, MysqlDateStrings, MysqlDialect, MysqlDialectOptions, MysqlIntrospector, MysqlIntrospectorDialect, MysqlParser, NumericParser, ObjectExpressionNode, Overrides, PostgresAdapter, PostgresDB, PostgresDialect, PostgresDialectOptions, PostgresDomainInspector, PostgresIntrospector, PostgresIntrospectorDialect, PostgresIntrospectorOptions, PostgresJSAdapter, PostgresJSAdapterOptions, PostgresJSDialect, PostgresJSDialectOptions, PostgresJSIntrospectorDialect, PropertyNode, RawExpressionNode, RuntimeEnumDeclarationNode, RuntimeEnumsStyle, Scalars, SerializeFileOptions, SerializeFromMetadataOptions, Serializer, SqliteAdapter, SqliteDialect, SqliteIntrospector, SqliteIntrospectorDialect, StatementNode, SymbolCollection, SymbolEntry, SymbolNode, SymbolType, TableIdentifierNode, TableMatcher, TableMetadata, TableMetadataOptions, TableReference, TemplateNode, TransformOptions, TypeScriptSerializer, UnionExpressionNode, VALID_DIALECTS, WorkerBunSqliteDialect, configSchema, dialectNameSchema, generate, getDialect, getLogLevelNumber, matchLogLevel, serializeFlags, serializeFromMetadata, toKyselyCamelCase, toKyselyPascalCase, toPascalCase, toScreamingSnakeCase, toWords, transform };