import * as z from "zod"; export declare const StrOrRegExpSchema: z.ZodUnion<[z.ZodString, z.ZodType]>; /** * Matching criteria specified as string or regex */ export type StrOrRegExp = z.TypeOf; export declare const ImportedItemSchema: z.ZodObject<{ /** Name of import */ name: z.ZodString; /** Path from which we should import */ importPath: z.ZodOptional>; /** * Whether this is a default import * * @default false */ isDefault: z.ZodOptional>; /** * Whether this is a relative import * * @default true */ isRelative: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }>; /** * Specifies options to construct an import * * Note that unless isRelative is specified as false, the import will be * resolved relative to the cwd from where generator is invoked and * then converted to a relative path relative to the generated file * * Examples: * When generated file is located at src/db/tables/some-table.ts and generator * is run from project root * * Config: `{ name: "FooAdapter", importPath: 'src/db/adapters/foo-adapter'}` * Generates: `import { FooAdapter } from '../adapters/foo-adapter'` * * Config: `{ name: "FooAdapter", isDefault: true, importPath: 'src/db/adapters/foo-adapter'}` * Generates: `import FooAdapter from '../adapters/foo-adapter'` * * Config: `{ name: "FooAdapter", isRelative: false, importPath: 'external-lib/foo-adapter'}` * Generates: `import { FooAdapter } from '../adapters';` * */ export interface ImportedItem extends z.TypeOf { } export declare const GeneratedFieldTypeSchema: z.ZodObject<{ /** * Specify that this field uses a custom database type or an enum type */ kind: z.ZodOptional>>; /** * This name is a database type identifier as expected by ts-sql-query * * These names are not database specific and may not match FieldMappingSchema.columnType eg. for database level type (which tbls outputs in the schema yaml) can be varchar but the columnType that ts-sql-query uses will be 'string' */ dbType: z.ZodOptional>>; /** * If present, used as a generic type argument to field factory. This is typically useful when * dealing with custom database types or enum types. * * If importPath is not present, then an import will not be added. This can result in a compile time error * if the type is not globally available. */ tsType: z.ZodOptional>; /** * Whether this is a default import * * @default false */ isDefault: z.ZodOptional>; /** * Whether this is a relative import * * @default true */ isRelative: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }>>>; /** * Specify a type adapter for the generated field. * * If not present, we will attempt to use GeneratorOpts.common.typeAdapter.importPath or throw if absent. */ adapter: z.ZodOptional>; /** * Whether this is a default import * * @default false */ isDefault: z.ZodOptional>; /** * Whether this is a relative import * * @default true */ isRelative: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }>>>; }, "strip", z.ZodTypeAny, { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; }, { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; }>; export interface GeneratedFieldType extends z.TypeOf { } export declare const GeneratedFieldSchema: z.ZodObject<{ type: z.ZodOptional>>; /** * This name is a database type identifier as expected by ts-sql-query * * These names are not database specific and may not match FieldMappingSchema.columnType eg. for database level type (which tbls outputs in the schema yaml) can be varchar but the columnType that ts-sql-query uses will be 'string' */ dbType: z.ZodOptional>>; /** * If present, used as a generic type argument to field factory. This is typically useful when * dealing with custom database types or enum types. * * If importPath is not present, then an import will not be added. This can result in a compile time error * if the type is not globally available. */ tsType: z.ZodOptional>; /** * Whether this is a default import * * @default false */ isDefault: z.ZodOptional>; /** * Whether this is a relative import * * @default true */ isRelative: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }>>>; /** * Specify a type adapter for the generated field. * * If not present, we will attempt to use GeneratorOpts.common.typeAdapter.importPath or throw if absent. */ adapter: z.ZodOptional>; /** * Whether this is a default import * * @default false */ isDefault: z.ZodOptional>; /** * Whether this is a relative import * * @default true */ isRelative: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }>>>; }, "strip", z.ZodTypeAny, { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; }, { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; }>>>; name: z.ZodOptional>; isComputed: z.ZodOptional>; isOptional: z.ZodOptional>; hasDefault: z.ZodOptional>; }, "strip", z.ZodTypeAny, { type?: { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; } | null | undefined; name?: string | null | undefined; isComputed?: boolean | null | undefined; isOptional?: boolean | null | undefined; hasDefault?: boolean | null | undefined; }, { type?: { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; } | null | undefined; name?: string | null | undefined; isComputed?: boolean | null | undefined; isOptional?: boolean | null | undefined; hasDefault?: boolean | null | undefined; }>; /** * Specifies options for the generated field mapping * * The options here are ts-sql-query specific */ export interface GeneratedField extends z.TypeOf { } export declare const FieldMappingSchema: z.ZodObject<{ /** Optional criteria (string or regex) to match column name */ columnName: z.ZodOptional]>>>; /** Optional criteria (string or regex) to match table name */ tableName: z.ZodOptional]>>>; /** * Optional criteria (string or regex) to match column type (in database) * * This will be used to match against the type name as * present in the tbls output schema yaml file. */ columnType: z.ZodOptional]>>>; /** * Can be used to customize the field name or type mapping * in the generated field. * * Set to false to omit mapping of this field */ generatedField: z.ZodUnion<[z.ZodObject<{ type: z.ZodOptional>>; /** * This name is a database type identifier as expected by ts-sql-query * * These names are not database specific and may not match FieldMappingSchema.columnType eg. for database level type (which tbls outputs in the schema yaml) can be varchar but the columnType that ts-sql-query uses will be 'string' */ dbType: z.ZodOptional>>; /** * If present, used as a generic type argument to field factory. This is typically useful when * dealing with custom database types or enum types. * * If importPath is not present, then an import will not be added. This can result in a compile time error * if the type is not globally available. */ tsType: z.ZodOptional>; /** * Whether this is a default import * * @default false */ isDefault: z.ZodOptional>; /** * Whether this is a relative import * * @default true */ isRelative: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }>>>; /** * Specify a type adapter for the generated field. * * If not present, we will attempt to use GeneratorOpts.common.typeAdapter.importPath or throw if absent. */ adapter: z.ZodOptional>; /** * Whether this is a default import * * @default false */ isDefault: z.ZodOptional>; /** * Whether this is a relative import * * @default true */ isRelative: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }, { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; }>>>; }, "strip", z.ZodTypeAny, { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; }, { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; }>>>; name: z.ZodOptional>; isComputed: z.ZodOptional>; isOptional: z.ZodOptional>; hasDefault: z.ZodOptional>; }, "strip", z.ZodTypeAny, { type?: { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; } | null | undefined; name?: string | null | undefined; isComputed?: boolean | null | undefined; isOptional?: boolean | null | undefined; hasDefault?: boolean | null | undefined; }, { type?: { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; } | null | undefined; name?: string | null | undefined; isComputed?: boolean | null | undefined; isOptional?: boolean | null | undefined; hasDefault?: boolean | null | undefined; }>, z.ZodLiteral]>; comment: z.ZodOptional>; }, "strip", z.ZodTypeAny, { generatedField: false | { type?: { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; } | null | undefined; name?: string | null | undefined; isComputed?: boolean | null | undefined; isOptional?: boolean | null | undefined; hasDefault?: boolean | null | undefined; }; columnName?: string | RegExp | null | undefined; tableName?: string | RegExp | null | undefined; columnType?: string | RegExp | null | undefined; comment?: string | null | undefined; }, { generatedField: false | { type?: { kind?: "custom" | "customComparable" | "enum" | "customInt" | "customDouble" | "customUuid" | "customLocalDate" | "customLocalTime" | "customLocalDateTime" | null | undefined; dbType?: { name: string; } | null | undefined; tsType?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; adapter?: { name: string; importPath?: string | null | undefined; isDefault?: boolean | null | undefined; isRelative?: boolean | null | undefined; } | null | undefined; } | null | undefined; name?: string | null | undefined; isComputed?: boolean | null | undefined; isOptional?: boolean | null | undefined; hasDefault?: boolean | null | undefined; }; columnName?: string | RegExp | null | undefined; tableName?: string | RegExp | null | undefined; columnType?: string | RegExp | null | undefined; comment?: string | null | undefined; }>; export interface FieldMapping extends z.TypeOf { } export declare const fieldMappings: FieldMapping[];