import type { TableProps, Row, ColumnSchema, RowID, FullRow, Query, ToSQL, RowIdentifiable, NullableRow, NullableFullRow, APITableSchema } from "./types"; import { Glide } from "./Glide"; /** * Type alias for a row of a given table. */ export type RowOf> = T extends Table ? FullRow : never; export declare class Table { private props; private glide; private displayNameToName; /** * @returns The app id. */ get app(): string; /** * @returns The table id. */ get id(): string; /** * @returns The display name */ get name(): string | undefined; constructor(props: TableProps, glide: Glide); private renameOutgoing; private renameIncoming; /** * Add a row to the table. * * @param row A row to add. */ add(row: Row): Promise; /** * Adds rows to the table. * * @param rows An array of rows to add to the table. */ add(rows: Row[]): Promise; /** * Update a row in the table. * * @param id The row id to update. * @param row A row to update. */ update(id: RowID, row: NullableRow): Promise; /** * Update a row in the table. * * @param row A row to update. */ update(row: NullableFullRow): Promise; /** * Update multiple rows in the table. * * @param rows An array of rows to update. */ update(rows: NullableFullRow[]): Promise; /** * Update multiple rows in the table. * * @param rows An object of row ids to rows to update. */ update(rows: Record>): Promise; /** * Delete a single row from the table. * * @param row A row or row id to delete from the table. */ delete(row: RowIdentifiable): Promise; /** * Delete multiple rows from the table. * * @param rows An array of rows or identifiers to delete. */ delete(rows: RowIdentifiable[]): Promise; /** * Deletes all rows from the table. */ clear(): Promise; /** * Get all rows from the table. Requires Business+. */ get(): Promise[]>; /** * Get a single row from the table. Requires Business+. * * @param rowID The row id to retrieve. */ get(rowID: RowID): Promise | undefined>; /** * Query the table (Big Tables only). Requires Business+. * * @param query A query. */ get(query: (q: Query>) => ToSQL): Promise[]>; /** * Retrieves the schema of the table. * * @returns A promise that resolves to the schema of the table. */ getSchema(): Promise<{ data: APITableSchema; }>; /** * @deprecated Use `id` instead. */ get table(): string; /** * Adds rows to the table. * * @deprecated Use `add` instead. * * @param rows An array of rows to add to the table. */ addRows(rows: Row[]): Promise; /** * Adds rows to the table. * * @deprecated Use `add` instead. * * @param rows An array of rows to add to the table. */ addRow(row: Row): Promise; /** * Sets values in a single row in the table. * * @deprecated Use `update` instead. * * @param id The ID of the row to set. * @param row The row data to set. */ setRow(id: RowIdentifiable, row: Row): Promise; /** * Deletes multiple rows from the table. * * @deprecated Use `delete` instead. * * @param rows An array of row identifiers to delete from the table. */ deleteRows(rows: RowIdentifiable[]): Promise; /** * Deletes a single row from the table. * * @deprecated Use `delete` instead. * * @param row The identifier of the row to delete from the table. */ deleteRow(row: RowIdentifiable): Promise; /** * Retrieves all rows from the table. Requires Business or Enterprise. * * @deprecated Use `get` instead. */ getRows(): Promise[]>; /** * Retrieves a row from the table. Requires Business or Enterprise. * * @deprecated Use `get` instead. */ getRow(id: RowID): Promise | undefined>; }