import type { BuildColumns, BuildExtraConfigColumns } from "../column-builder.js"; import { entityKind } from "../entity.js"; import { Table, type TableConfig as TableConfigBase, type UpdateTableConfig } from "../table.js"; import type { CheckBuilder } from "./checks.js"; import { type GelColumnsBuilders } from "./columns/all.js"; import type { GelColumn, GelColumnBuilderBase } from "./columns/common.js"; import type { ForeignKeyBuilder } from "./foreign-keys.js"; import type { AnyIndexBuilder } from "./indexes.js"; import type { GelPolicy } from "./policies.js"; import type { PrimaryKeyBuilder } from "./primary-keys.js"; import type { UniqueConstraintBuilder } from "./unique-constraint.js"; export type GelTableExtraConfigValue = AnyIndexBuilder | CheckBuilder | ForeignKeyBuilder | PrimaryKeyBuilder | UniqueConstraintBuilder | GelPolicy; export type GelTableExtraConfig = Record; export type TableConfig = TableConfigBase; export declare class GelTable extends Table { static readonly [entityKind]: string; } export type AnyGelTable = {}> = GelTable>; export type GelTableWithColumns = GelTable & { [Key in keyof T['columns']]: T['columns'][Key]; } & { enableRLS: () => Omit, 'enableRLS'>; }; export interface GelTableFn { /** * @deprecated The third parameter of GelTable is changing and will only accept an array instead of an object * * @example * Deprecated version: * ```ts * export const users = gelTable("users", { * id: integer(), * }, (t) => ({ * idx: index('custom_name').on(t.id) * })); * ``` * * New API: * ```ts * export const users = gelTable("users", { * id: integer(), * }, (t) => [ * index('custom_name').on(t.id) * ]); * ``` */ >(name: TTableName, columns: TColumnsMap, extraConfig: (self: BuildExtraConfigColumns) => GelTableExtraConfig): GelTableWithColumns<{ name: TTableName; schema: TSchema; columns: BuildColumns; dialect: 'gel'; }>; /** * @deprecated The third parameter of gelTable is changing and will only accept an array instead of an object * * @example * Deprecated version: * ```ts * export const users = gelTable("users", { * id: integer(), * }, (t) => ({ * idx: index('custom_name').on(t.id) * })); * ``` * * New API: * ```ts * export const users = gelTable("users", { * id: integer(), * }, (t) => [ * index('custom_name').on(t.id) * ]); * ``` */ >(name: TTableName, columns: (columnTypes: GelColumnsBuilders) => TColumnsMap, extraConfig: (self: BuildExtraConfigColumns) => GelTableExtraConfig): GelTableWithColumns<{ name: TTableName; schema: TSchema; columns: BuildColumns; dialect: 'gel'; }>; >(name: TTableName, columns: TColumnsMap, extraConfig?: (self: BuildExtraConfigColumns) => GelTableExtraConfigValue[]): GelTableWithColumns<{ name: TTableName; schema: TSchema; columns: BuildColumns; dialect: 'gel'; }>; >(name: TTableName, columns: (columnTypes: GelColumnsBuilders) => TColumnsMap, extraConfig?: (self: BuildExtraConfigColumns) => GelTableExtraConfigValue[]): GelTableWithColumns<{ name: TTableName; schema: TSchema; columns: BuildColumns; dialect: 'gel'; }>; } export declare const gelTable: GelTableFn; export declare function gelTableCreator(customizeTableName: (name: string) => string): GelTableFn;