/** @module @airtable/blocks/models: Table */ /** */
import Sdk from "../sdk";
import { TableData } from "../types/table";
import { ViewType, ViewId } from "../types/view";
import { FieldId, FieldType, FieldOptions } from "../types/field";
import { RecordId } from "../types/record";
import { PermissionCheckResult } from "../types/mutations";
import { ObjectValues, ObjectMap } from "../private_utils";
import AbstractModel from "./abstract_model";
import View from "./view";
import Field from "./field";
import Base, { ChangedPathsForType } from "./base";
import ObjectPool from "./object_pool";
import Record from "./record";
import { RecordQueryResultOpts } from "./record_query_result";
import TableOrViewQueryResult from "./table_or_view_query_result";
import RecordStore from "./record_store";
export declare const WatchableTableKeys: Readonly<{
    name: "name";
    description: "description";
    views: "views";
    fields: "fields";
}>;
/**
 * A key in {@link Table} that can be watched.
 * - `name`
 * - `description`
 * - `views`
 * - `fields`
 */
export declare type WatchableTableKey = ObjectValues<typeof WatchableTableKeys>;
/**
 * Model class representing a table. Every {@link Base} has one or more tables.
 *
 * @docsPath models/Table
 */
declare class Table extends AbstractModel<TableData, WatchableTableKey> {
    /** @internal */
    static _className: string;
    /** @internal */
    static _isWatchableKey(key: string): boolean;
    /** @internal */
    _parentBase: Base;
    /** @internal */
    _viewModelsById: {
        [key: string]: View;
    };
    /** @internal */
    _fieldModelsById: {
        [key: string]: Field;
    };
    /** @internal */
    _cachedFieldNamesById: {
        [key: string]: string;
    } | null;
    /** @internal */
    _recordStore: RecordStore;
    /** @internal */
    __tableOrViewQueryResultPool: ObjectPool<TableOrViewQueryResult, typeof TableOrViewQueryResult>;
    /**
     * @internal
     */
    constructor(parentBase: Base, recordStore: RecordStore, tableId: string, sdk: Sdk);
    /**
     * @internal
     */
    get _dataOrNullIfDeleted(): TableData | null;
    /**
     * The base that this table belongs to.
     *
     * @internal (since we may not be able to return parent model instances in the immutable models world)
     * @example
     * ```js
     * import {base} from '@airtable/blocks';
     * const table = base.getTableByName('Table 1');
     * console.log(table.parentBase.id === base.id);
     * // => true
     * ```
     */
    get parentBase(): Base;
    /**
     * The name of the table. Can be watched.
     *
     * @example
     * ```js
     * console.log(myTable.name);
     * // => 'Table 1'
     * ```
     */
    get name(): string;
    /**
     * The description of the table, if it has one. Can be watched.
     *
     * @example
     * ```js
     * console.log(myTable.description);
     * // => 'This is my table'
     * ```
     */
    get description(): string | null;
    /**
     * The URL for the table. You can visit this URL in the browser to be taken to the table in the Airtable UI.
     *
     * @example
     * ```js
     * console.log(myTable.url);
     * // => 'https://airtable.com/tblxxxxxxxxxxxxxx'
     * ```
     */
    get url(): string;
    /**
     * The table's primary field. Every table has exactly one primary
     * field. The primary field of a table will not change.
     *
     * @example
     * ```js
     * console.log(myTable.primaryField.name);
     * // => 'Name'
     * ```
     */
    get primaryField(): Field;
    /**
     * The fields in this table. The order is arbitrary, since fields are
     * only ordered in the context of a specific view.
     *
     * Can be watched to know when fields are created or deleted.
     *
     * @example
     * ```js
     * console.log(`This table has ${myTable.fields.length} fields`);
     * ```
     */
    get fields(): Array<Field>;
    /**
       * Gets the field matching the given ID, or `null` if that field does not exist in this table.
  
       * @param fieldId The ID of the field.
       * @example
       * ```js
       * const fieldId = 'fldxxxxxxxxxxxxxx';
       * const field = myTable.getFieldByIdIfExists(fieldId);
       * if (field !== null) {
       *     console.log(field.name);
       * } else {
       *     console.log('No field exists with that ID');
       * }
       * ```
       */
    getFieldByIdIfExists(fieldId: FieldId): Field | null;
    /**
     * Gets the field matching the given ID. Throws if that field does not exist in this table. Use
     * {@link getFieldByIdIfExists} instead if you are unsure whether a field exists with the given
     * ID.
     *
     * @param fieldId The ID of the field.
     * @example
     * ```js
     * const fieldId = 'fldxxxxxxxxxxxxxx';
     * const field = myTable.getFieldById(fieldId);
     * console.log(field.name);
     * // => 'Name'
     * ```
     */
    getFieldById(fieldId: FieldId): Field;
    /**
     * Gets the field matching the given name, or `null` if no field exists with that name in this
     * table.
     *
     * @param fieldName The name of the field you're looking for.
     * @example
     * ```js
     * const field = myTable.getFieldByNameIfExists('Name');
     * if (field !== null) {
     *     console.log(field.id);
     * } else {
     *     console.log('No field exists with that name');
     * }
     * ```
     */
    getFieldByNameIfExists(fieldName: string): Field | null;
    /**
     * Gets the field matching the given name. Throws if no field exists with that name in this
     * table. Use {@link getFieldByNameIfExists} instead if you are unsure whether a field exists
     * with the given name.
     *
     * @param fieldName The name of the field you're looking for.
     * @example
     * ```js
     * const field = myTable.getFieldByName('Name');
     * console.log(field.id);
     * // => 'fldxxxxxxxxxxxxxx'
     * ```
     */
    getFieldByName(fieldName: string): Field;
    /**
     * The field matching the given ID or name. Returns `null` if no matching field exists within
     * this table.
     *
     * This method is convenient when building an app for a specific base, but for more generic
     * apps the best practice is to use the {@link getFieldByIdIfExists} or
     * {@link getFieldByNameIfExists} methods instead.
     *
     * @param fieldIdOrName The ID or name of the field you're looking for.
     */
    getFieldIfExists(fieldIdOrName: FieldId | string): Field | null;
    /**
     * The field matching the given ID or name. Throws if no matching field exists within this table.
     * Use {@link getFieldIfExists} instead if you are unsure whether a field exists with the given
     * name/ID.
     *
     * This method is convenient when building an app for a specific base, but for more generic
     * apps the best practice is to use the {@link getFieldById} or {@link getFieldByName} methods
     * instead.
     *
     * @param fieldIdOrName The ID or name of the field you're looking for.
     */
    getField(fieldIdOrName: FieldId | string): Field;
    /**
     * The views in this table. Can be watched to know when views are created,
     * deleted, or reordered.
     *
     * @example
     * ```js
     * console.log(`This table has ${myTable.views.length} views`);
     * ```
     */
    get views(): Array<View>;
    /**
     * Gets the view matching the given ID, or `null` if that view does not exist in this table.
     *
     * @param viewId The ID of the view.
     * @example
     * ```js
     * const viewId = 'viwxxxxxxxxxxxxxx';
     * const view = myTable.getViewByIdIfExists(viewId);
     * if (view !== null) {
     *     console.log(view.name);
     * } else {
     *     console.log('No view exists with that ID');
     * }
     * ```
     */
    getViewByIdIfExists(viewId: ViewId): View | null;
    /**
     * Gets the view matching the given ID. Throws if that view does not exist in this table. Use
     * {@link getViewByIdIfExists} instead if you are unsure whether a view exists with the given
     * ID.
     *
     * @param viewId The ID of the view.
     * @example
     * ```js
     * const viewId = 'viwxxxxxxxxxxxxxx';
     * const view = myTable.getViewById(viewId);
     * console.log(view.name);
     * // => 'Grid view'
     * ```
     */
    getViewById(viewId: ViewId): View;
    /**
     * Gets the view matching the given name, or `null` if no view exists with that name in this
     * table.
     *
     * @param viewName The name of the view you're looking for.
     * @example
     * ```js
     * const view = myTable.getViewByNameIfExists('Name');
     * if (view !== null) {
     *     console.log(view.id);
     * } else {
     *     console.log('No view exists with that name');
     * }
     * ```
     */
    getViewByNameIfExists(viewName: string): View | null;
    /**
     * Gets the view matching the given name. Throws if no view exists with that name in this table.
     * Use {@link getViewByNameIfExists} instead if you are unsure whether a view exists with the
     * given name.
     *
     * @param viewName The name of the view you're looking for.
     * @example
     * ```js
     * const view = myTable.getViewByName('Name');
     * console.log(view.id);
     * // => 'viwxxxxxxxxxxxxxx'
     * ```
     */
    getViewByName(viewName: string): View;
    /**
     * The view matching the given ID or name. Returns `null` if no matching view exists within
     * this table.
     *
     * This method is convenient when building an app for a specific base, but for more generic
     * apps the best practice is to use the {@link getViewByIdIfExists} or
     * {@link getViewByNameIfExists} methods instead.
     *
     * @param viewIdOrName The ID or name of the view you're looking for.
     */
    getViewIfExists(viewIdOrName: ViewId | string): View | null;
    /**
     * The view matching the given ID or name. Throws if no matching view exists within this table.
     * Use {@link getViewIfExists} instead if you are unsure whether a view exists with the given
     * name/ID.
     *
     * This method is convenient when building an app for a specific base, but for more generic
     * apps the best practice is to use the {@link getViewById} or {@link getViewByName} methods
     * instead.
     *
     * @param viewIdOrName The ID or name of the view you're looking for.
     */
    getView(viewIdOrName: ViewId | string): View;
    /**
     * Select records from the table. Returns a {@link RecordQueryResult}.
     *
     * Consider using {@link useRecords} or {@link useRecordIds} instead, unless you need the
     * features of a QueryResult (e.g. `queryResult.getRecordById`). Record hooks handle
     * loading/unloading and updating your UI automatically, but manually `select`ing records is
     * useful for one-off data processing.
     *
     * @param opts Options for the query, such as sorts and fields.
     * @example
     * ```js
     * import {useBase, useRecords} from '@airtable/blocks/ui';
     * import React from 'react';
     *
     * function TodoList() {
     *     const base = useBase();
     *     const table = base.getTableByName('Tasks');
     *
     *     const queryResult = table.selectRecords();
     *     const records = useRecords(queryResult);
     *
     *     return (
     *         <ul>
     *             {records.map(record => (
     *                 <li key={record.id}>
     *                     {record.name || 'Unnamed record'}
     *                 </li>
     *             ))}
     *         </ul>
     *     );
     * }
     * ```
     */
    selectRecords(opts?: RecordQueryResultOpts): TableOrViewQueryResult;
    /**
     * Select and load records from the table. Returns a {@link RecordQueryResult} promise where
     * record data has been loaded.
     *
     * Consider using {@link useRecords} or {@link useRecordIds} instead, unless you need the
     * features of a QueryResult (e.g. `queryResult.getRecordById`). Record hooks handle
     * loading/unloading and updating your UI automatically, but manually `select`ing records is
     * useful for one-off data processing.
     *
     * Once you've finished with your query, remember to call `queryResult.unloadData()`.
     *
     * @param opts Options for the query, such as sorts and fields.
     * @example
     * ```js
     * async function logRecordCountAsync(table) {
     *     const query = await table.selectRecordsAsync();
     *     console.log(query.recordIds.length);
     *     query.unloadData();
     * }
     * ```
     */
    selectRecordsAsync(opts?: RecordQueryResultOpts): Promise<TableOrViewQueryResult>;
    /**
     * Returns the first view in the table where the type is one of `allowedViewTypes`, or `null` if
     * no such view exists in the table.
     *
     * @param allowedViewTypes An array of view types or a single view type to match against.
     * @param preferredViewOrViewId If a view or view ID is supplied and that view exists & has the
     * correct type, that view will be returned before checking the other views in the table.
     * @example
     * ```js
     * import {ViewType} from '@airtable/blocks/models';
     * const firstCalendarView = myTable.getFirstViewOfType(ViewType.CALENDAR);
     * if (firstCalendarView !== null) {
     *     console.log(firstCalendarView.name);
     * } else {
     *     console.log('No calendar views exist in the table');
     * }
     * ```
     */
    getFirstViewOfType(allowedViewTypes: Array<ViewType> | ViewType, preferredViewOrViewId?: View | ViewId | null): View | null;
    /**
     * @internal
     */
    getDefaultCellValuesByFieldIdAsync(opts?: {
        view?: View | null;
    }): Promise<{
        [key: string]: unknown;
    }>;
    /**
     * Updates cell values for a record.
     *
     * Throws an error if the user does not have permission to update the given cell values in
     * the record, or if invalid input is provided (eg. invalid cell values).
     *
     * Refer to {@link FieldType} for cell value write formats.
     *
     * This action is asynchronous: `await` the returned promise if you wish to wait for the updated
     * cell values to be persisted to Airtable servers.
     * Updates are applied optimistically locally, so your changes will be reflected in your app
     * before the promise resolves.
     *
     * @param recordOrRecordId the record to update
     * @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
     * @example
     * ```js
     * function updateRecord(record, recordFields) {
     *     if (table.hasPermissionToUpdateRecord(record, recordFields)) {
     *         table.updateRecordAsync(record, recordFields);
     *     }
     *     // The updated values will now show in your app (eg in
     *     // `table.selectRecords()` result) but are still being saved to Airtable
     *     // servers (e.g. other users may not be able to see them yet).
     * }
     *
     * async function updateRecordAsync(record, recordFields) {
     *     if (table.hasPermissionToUpdateRecord(record, recordFields)) {
     *         await table.updateRecordAsync(record, recordFields);
     *     }
     *     // New record has been saved to Airtable servers.
     *     alert(`record with ID ${record.id} has been updated`);
     * }
     *
     * // Fields can be specified by name or ID
     * updateRecord(record1, {
     *     'Post Title': 'How to make: orange-mango pound cake',
     *     'Publication Date': '2020-01-01',
     * });
     * updateRecord(record2, {
     *     [postTitleField.id]: 'Cake decorating tips & tricks',
     *     [publicationDateField.id]: '2020-02-02',
     * });
     *
     * // Cell values should generally have format matching the output of
     * // record.getCellValue() for the field being updated
     * updateRecord(record1, {
     *     'Category (single select)': {name: 'Recipe'},
     *     'Tags (multiple select)': [{name: 'Desserts'}, {id: 'someChoiceId'}],
     *     'Images (attachment)': [{url: 'http://mywebsite.com/cake.png'}],
     *     'Related posts (linked records)': [{id: 'someRecordId'}],
     * });
     * ```
     */
    updateRecordAsync(recordOrRecordId: Record | RecordId, fields: ObjectMap<FieldId | string, unknown>): Promise<void>;
    /**
     * Checks whether the current user has permission to perform the given record update.
     *
     * Accepts partial input, in the same format as {@link updateRecordAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * Returns `{hasPermission: true}` if the current user can update the specified record,
     * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
     * used to display an error message to the user.
     *
     * @param recordOrRecordId the record to update
     * @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
     * @example
     * ```js
     * // Check if user can update specific fields for a specific record.
     * const updateRecordCheckResult =
     *     table.checkPermissionsForUpdateRecord(record, {
     *         'Post Title': 'How to make: orange-mango pound cake',
     *         'Publication Date': '2020-01-01',
     *     });
     * if (!updateRecordCheckResult.hasPermission) {
     *     alert(updateRecordCheckResult.reasonDisplayString);
     * }
     *
     * // Like updateRecordAsync, you can use either field names or field IDs.
     * const updateRecordCheckResultWithFieldIds =
     *     table.checkPermissionsForUpdateRecord(record, {
     *         [postTitleField.id]: 'Cake decorating tips & tricks',
     *         [publicationDateField.id]: '2020-02-02',
     *     });
     *
     * // Check if user could update a given record, when you don't know the
     * // specific fields that will be updated yet (e.g. to check whether you should
     * // allow a user to select a certain record to update).
     * const updateUnknownFieldsCheckResult =
     *     table.checkPermissionsForUpdateRecord(record);
     *
     * // Check if user could update specific fields, when you don't know the
     * // specific record that will be updated yet. (for example, if the field is
     * // selected by the user and you want to check if your app can write to it).
     * const updateUnknownRecordCheckResult =
     *     table.checkPermissionsForUpdateRecord(undefined, {
     *         'My field name': 'updated value',
     *         // You can use undefined if you know you're going to update a field,
     *         // but don't know the new cell value yet.
     *         'Another field name': undefined,
     *     });
     *
     * // Check if user could perform updates within the table, without knowing the
     * // specific record or fields that will be updated yet (e.g., to render your
     * // app in "read only" mode).
     * const updateUnknownRecordAndFieldsCheckResult =
     *     table.checkPermissionsForUpdateRecord();
     * ```
     */
    checkPermissionsForUpdateRecord(recordOrRecordId?: Record | RecordId, fields?: ObjectMap<FieldId | string, unknown | void>): PermissionCheckResult;
    /**
     * An alias for `checkPermissionsForUpdateRecord(recordOrRecordId, fields).hasPermission`.
     *
     * Checks whether the current user has permission to perform the given record update.
     *
     * Accepts partial input, in the same format as {@link updateRecordAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * @param recordOrRecordId the record to update
     * @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
     * @example
     * ```js
     * // Check if user can update specific fields for a specific record.
     * const canUpdateRecord = table.hasPermissionToUpdateRecord(record, {
     *     'Post Title': 'How to make: orange-mango pound cake',
     *     'Publication Date': '2020-01-01',
     * });
     * if (!canUpdateRecord) {
     *     alert('not allowed!');
     * }
     *
     * // Like updateRecordAsync, you can use either field names or field IDs.
     * const canUpdateRecordWithFieldIds =
     *     table.hasPermissionToUpdateRecord(record, {
     *         [postTitleField.id]: 'Cake decorating tips & tricks',
     *         [publicationDateField.id]: '2020-02-02',
     *     });
     *
     * // Check if user could update a given record, when you don't know the
     * // specific fields that will be updated yet (e.g. to check whether you should
     * // allow a user to select a certain record to update).
     * const canUpdateUnknownFields = table.hasPermissionToUpdateRecord(record);
     *
     * // Check if user could update specific fields, when you don't know the
     * // specific record that will be updated yet (e.g. if the field is selected
     * // by the user and you want to check if your app can write to it).
     * const canUpdateUnknownRecord =
     *     table.hasPermissionToUpdateRecord(undefined, {
     *         'My field name': 'updated value',
     *         // You can use undefined if you know you're going to update a field,
     *         // but don't know the new cell value yet.
     *         'Another field name': undefined,
     *     });
     *
     * // Check if user could perform updates within the table, without knowing the
     * // specific record or fields that will be updated yet. (for example, to
     * // render your app in "read only" mode)
     * const canUpdateUnknownRecordAndFields = table.hasPermissionToUpdateRecord();
     * ```
     */
    hasPermissionToUpdateRecord(recordOrRecordId?: Record | RecordId, fields?: ObjectMap<FieldId | string, unknown | void>): boolean;
    /**
     * Updates cell values for records.
     *
     * Throws an error if the user does not have permission to update the given cell values in
     * the records, or if invalid input is provided (eg. invalid cell values).
     *
     * Refer to {@link FieldType} for cell value write formats.
     *
     * You may only update up to 50 records in one call to `updateRecordsAsync`.
     * See [Write back to Airtable](/guides/write-back-to-airtable) for more information
     * about write limits.
     *
     * This action is asynchronous: `await` the returned promise if you wish to wait for the
     * updates to be persisted to Airtable servers.
     * Updates are applied optimistically locally, so your changes will be reflected in your app
     * before the promise resolves.
     *
     * @param records Array of objects containing recordId and fields/cellValues to update for that record (specified as an object mapping `FieldId` or field name to cell value)
     * @example
     * ```js
     * const recordsToUpdate = [
     *     // Fields can be specified by name or ID
     *     {
     *         id: record1.id,
     *         fields: {
     *             'Post Title': 'How to make: orange-mango pound cake',
     *             'Publication Date': '2020-01-01',
     *         },
     *     },
     *     {
     *         id: record2.id,
     *         fields: {
     *             // Sets the cell values to be empty.
     *             'Post Title': '',
     *             'Publication Date': '',
     *         },
     *     },
     *     {
     *         id: record3.id,
     *         fields: {
     *             [postTitleField.id]: 'Cake decorating tips & tricks',
     *             [publicationDateField.id]: '2020-02-02',
     *         },
     *     },
     *     // Cell values should generally have format matching the output of
     *     // record.getCellValue() for the field being updated
     *     {
     *         id: record4.id,
     *         fields: {
     *             'Category (single select)': {name: 'Recipe'},
     *             'Tags (multiple select)': [{name: 'Desserts'}, {id: 'choiceId'}],
     *             'Images (attachment)': [{url: 'http://mywebsite.com/cake.png'}],
     *             'Related posts (linked records)': [{id: 'someRecordId'}],
     *         },
     *     },
     * ];
     *
     * function updateRecords() {
     *     if (table.hasPermissionToUpdateRecords(recordsToUpdate)) {
     *         table.updateRecordsAsync(recordsToUpdate);
     *     }
     *     // The records are now updated within your app (eg will be reflected in
     *     // `table.selectRecords()`) but are still being saved to Airtable servers
     *     // (e.g. they may not be updated for other users yet).
     * }
     *
     * async function updateRecordsAsync() {
     *     if (table.hasPermissionToUpdateRecords(recordsToUpdate)) {
     *         await table.updateRecordsAsync(recordsToUpdate);
     *     }
     *     // Record updates have been saved to Airtable servers.
     *     alert('records have been updated');
     * }
     * ```
     */
    updateRecordsAsync(records: ReadonlyArray<{
        readonly id: RecordId;
        readonly fields: ObjectMap<FieldId | string, unknown>;
    }>): Promise<void>;
    /**
     * Checks whether the current user has permission to perform the given record updates.
     *
     * Accepts partial input, in the same format as {@link updateRecordsAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * Returns `{hasPermission: true}` if the current user can update the specified records,
     * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
     * used to display an error message to the user.
     *
     * @param records Array of objects containing recordId and fields/cellValues to update for that record (specified as an object mapping `FieldId` or field name to cell value)
     * @example
     * ```js
     * const recordsToUpdate = [
     *     {
     *         // Validating a complete record update
     *         id: record1.id,
     *         fields: {
     *             'Post Title': 'How to make: orange-mango pound cake',
     *             'Publication Date': '2020-01-01',
     *         },
     *     },
     *     {
     *         // Like updateRecordsAsync, fields can be specified by name or ID
     *         id: record2.id,
     *         fields: {
     *             [postTitleField.id]: 'Cake decorating tips & tricks',
     *             [publicationDateField.id]: '2020-02-02',
     *         },
     *     },
     *     {
     *         // Validating an update to a specific record, not knowing what
     *         // fields will be updated
     *         id: record3.id,
     *     },
     *     {
     *         // Validating an update to specific cell values, not knowing what
     *         // record will be updated
     *         fields: {
     *             'My field name': 'updated value for unknown record',
     *             // You can use undefined if you know you're going to update a
     *             // field, but don't know the new cell value yet.
     *             'Another field name': undefined,
     *         },
     *     },
     * ];
     *
     * const updateRecordsCheckResult =
     *     table.checkPermissionsForUpdateRecords(recordsToUpdate);
     * if (!updateRecordsCheckResult.hasPermission) {
     *     alert(updateRecordsCheckResult.reasonDisplayString);
     * }
     *
     * // Check if user could potentially update records.
     * // Equivalent to table.checkPermissionsForUpdateRecord()
     * const updateUnknownRecordAndFieldsCheckResult =
     *     table.checkPermissionsForUpdateRecords();
     * ```
     */
    checkPermissionsForUpdateRecords(records?: ReadonlyArray<{
        readonly id?: RecordId | void;
        readonly fields?: ObjectMap<FieldId | string, unknown | void> | void;
    }>): PermissionCheckResult;
    /**
     * An alias for `checkPermissionsForUpdateRecords(records).hasPermission`.
     *
     * Checks whether the current user has permission to perform the given record updates.
     *
     * Accepts partial input, in the same format as {@link updateRecordsAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * @param records Array of objects containing recordId and fields/cellValues to update for that record (specified as an object mapping `FieldId` or field name to cell value)
     * @example
     * ```js
     * const recordsToUpdate = [
     *     {
     *         // Validating a complete record update
     *         id: record1.id,
     *         fields: {
     *             'Post Title': 'How to make: orange-mango pound cake',
     *             'Publication Date': '2020-01-01',
     *         },
     *     },
     *     {
     *         // Like updateRecordsAsync, fields can be specified by name or ID
     *         id: record2.id,
     *         fields: {
     *             [postTitleField.id]: 'Cake decorating tips & tricks',
     *             [publicationDateField.id]: '2020-02-02',
     *         },
     *     },
     *     {
     *         // Validating an update to a specific record, not knowing what
     *         // fields will be updated
     *         id: record3.id,
     *     },
     *     {
     *         // Validating an update to specific cell values, not knowing what
     *         // record will be updated
     *         fields: {
     *             'My field name': 'updated value for unknown record',
     *             // You can use undefined if you know you're going to update a
     *             // field, but don't know the new cell value yet.
     *             'Another field name': undefined,
     *         },
     *     },
     * ];
     *
     * const canUpdateRecords = table.hasPermissionToUpdateRecords(recordsToUpdate);
     * if (!canUpdateRecords) {
     *     alert('not allowed');
     * }
     *
     * // Check if user could potentially update records.
     * // Equivalent to table.hasPermissionToUpdateRecord()
     * const canUpdateUnknownRecordsAndFields =
     *     table.hasPermissionToUpdateRecords();
     * ```
     */
    hasPermissionToUpdateRecords(records?: ReadonlyArray<{
        readonly id?: RecordId | void;
        readonly fields?: ObjectMap<FieldId | string, unknown | void> | void;
    }>): boolean;
    /**
     * Delete the given record.
     *
     * Throws an error if the user does not have permission to delete the given record.
     *
     * This action is asynchronous: `await` the returned promise if you wish to wait for the
     * delete to be persisted to Airtable servers.
     * Updates are applied optimistically locally, so your changes will be reflected in your app
     * before the promise resolves.
     *
     * @param recordOrRecordId the record to be deleted
     * @example
     * ```js
     * function deleteRecord(record) {
     *     if (table.hasPermissionToDeleteRecord(record)) {
     *         table.deleteRecordAsync(record);
     *     }
     *     // The record is now deleted within your app (eg will not be returned
     *     // in `table.selectRecords`) but it is still being saved to Airtable
     *     // servers (e.g. it may not look deleted to other users yet).
     * }
     *
     * async function deleteRecordAsync(record) {
     *     if (table.hasPermissionToDeleteRecord(record)) {
     *         await table.deleteRecordAsync(record);
     *     }
     *     // Record deletion has been saved to Airtable servers.
     *     alert('record has been deleted');
     * }
     * ```
     */
    deleteRecordAsync(recordOrRecordId: Record | RecordId): Promise<void>;
    /**
     * Checks whether the current user has permission to delete the specified record.
     *
     * Accepts optional input, in the same format as {@link deleteRecordAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * Returns `{hasPermission: true}` if the current user can delete the specified record,
     * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
     * used to display an error message to the user.
     *
     * @param recordOrRecordId the record to be deleted
     * @example
     * ```js
     * // Check if user can delete a specific record
     * const deleteRecordCheckResult =
     *     table.checkPermissionsForDeleteRecord(record);
     * if (!deleteRecordCheckResult.hasPermission) {
     *     alert(deleteRecordCheckResult.reasonDisplayString);
     * }
     *
     * // Check if user could potentially delete a record.
     * // Use when you don't know the specific record you want to delete yet (for
     * // example, to show/hide UI controls that let you select a record to delete).
     * const deleteUnknownRecordCheckResult =
     *     table.checkPermissionsForDeleteRecord();
     * ```
     */
    checkPermissionsForDeleteRecord(recordOrRecordId?: Record | RecordId): PermissionCheckResult;
    /**
     * An alias for `checkPermissionsForDeleteRecord(recordOrRecordId).hasPermission`.
     *
     * Checks whether the current user has permission to delete the specified record.
     *
     * Accepts optional input, in the same format as {@link deleteRecordAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * @param recordOrRecordId the record to be deleted
     * @example
     * ```js
     * // Check if user can delete a specific record
     * const canDeleteRecord = table.hasPermissionToDeleteRecord(record);
     * if (!canDeleteRecord) {
     *     alert('not allowed');
     * }
     *
     * // Check if user could potentially delete a record.
     * // Use when you don't know the specific record you want to delete yet (for
     * // example, to show/hide UI controls that let you select a record to delete).
     * const canDeleteUnknownRecord = table.hasPermissionToDeleteRecord();
     * ```
     */
    hasPermissionToDeleteRecord(recordOrRecordId?: Record | RecordId): boolean;
    /**
     * Delete the given records.
     *
     * Throws an error if the user does not have permission to delete the given records.
     *
     * You may only delete up to 50 records in one call to `deleteRecordsAsync`.
     * See [Write back to Airtable](/guides/write-back-to-airtable#size-limits-rate-limits) for
     * more information about write limits.
     *
     * This action is asynchronous: `await` the returned promise if you wish to wait for the
     * delete to be persisted to Airtable servers.
     * Updates are applied optimistically locally, so your changes will be reflected in your app
     * before the promise resolves.
     *
     * @param recordsOrRecordIds Array of Records and RecordIds
     * @example
     * ```js
     *
     * function deleteRecords(records) {
     *     if (table.hasPermissionToDeleteRecords(records)) {
     *         table.deleteRecordsAsync(records);
     *     }
     *     // The records are now deleted within your app (eg will not be
     *     // returned in `table.selectRecords()`) but are still being saved to
     *     // Airtable servers (e.g. they may not look deleted to other users yet).
     * }
     *
     * async function deleteRecordsAsync(records) {
     *     if (table.hasPermissionToDeleteRecords(records)) {
     *         await table.deleteRecordsAsync(records);
     *     }
     *     // Record deletions have been saved to Airtable servers.
     *     alert('records have been deleted');
     * }
     * ```
     */
    deleteRecordsAsync(recordsOrRecordIds: ReadonlyArray<Record | RecordId>): Promise<void>;
    /**
     * Checks whether the current user has permission to delete the specified records.
     *
     * Accepts optional input, in the same format as {@link deleteRecordsAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * Returns `{hasPermission: true}` if the current user can delete the specified records,
     * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
     * used to display an error message to the user.
     *
     * @param recordsOrRecordIds the records to be deleted
     * @example
     * ```js
     * // Check if user can delete specific records
     * const deleteRecordsCheckResult =
     *     table.checkPermissionsForDeleteRecords([record1, record2]);
     * if (!deleteRecordsCheckResult.hasPermission) {
     *     alert(deleteRecordsCheckResult.reasonDisplayString);
     * }
     *
     * // Check if user could potentially delete records.
     * // Use when you don't know the specific records you want to delete yet (for
     * // example, to show/hide UI controls that let you select records to delete).
     * // Equivalent to table.hasPermissionToDeleteRecord()
     * const deleteUnknownRecordsCheckResult =
     *     table.checkPermissionsForDeleteRecords();
     * ```
     */
    checkPermissionsForDeleteRecords(recordsOrRecordIds?: ReadonlyArray<Record | RecordId>): PermissionCheckResult;
    /**
     * An alias for `checkPermissionsForDeleteRecords(recordsOrRecordIds).hasPermission`.
     *
     * Checks whether the current user has permission to delete the specified records.
     *
     * Accepts optional input, in the same format as {@link deleteRecordsAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * @param recordsOrRecordIds the records to be deleted
     * @example
     * ```js
     * // Check if user can delete specific records
     * const canDeleteRecords =
     *     table.hasPermissionToDeleteRecords([record1, record2]);
     * if (!canDeleteRecords) {
     *     alert('not allowed!');
     * }
     *
     * // Check if user could potentially delete records.
     * // Use when you don't know the specific records you want to delete yet (for
     * // example, to show/hide UI controls that let you select records to delete).
     * // Equivalent to table.hasPermissionToDeleteRecord()
     * const canDeleteUnknownRecords = table.hasPermissionToDeleteRecords();
     * ```
     */
    hasPermissionToDeleteRecords(recordsOrRecordIds?: ReadonlyArray<Record | RecordId>): boolean;
    /**
     * Creates a new record with the specified cell values.
     *
     * Throws an error if the user does not have permission to create the given records, or
     * if invalid input is provided (eg. invalid cell values).
     *
     * Refer to {@link FieldType} for cell value write formats.
     *
     * This action is asynchronous: `await` the returned promise if you wish to wait for the new
     * record to be persisted to Airtable servers.
     * Updates are applied optimistically locally, so your changes will be reflected in your app
     * before the promise resolves.
     *
     * The returned promise will resolve to the RecordId of the new record once it is persisted.
     *
     * @param fields object mapping `FieldId` or field name to value for that field.
     * @example
     * ```js
     * function createNewRecord(recordFields) {
     *     if (table.hasPermissionToCreateRecord(recordFields)) {
     *         table.createRecordAsync(recordFields);
     *     }
     *     // You can now access the new record in your app (eg
     *     // `table.selectRecords()`) but it is still being saved to Airtable
     *     // servers (e.g. other users may not be able to see it yet).
     * }
     *
     * async function createNewRecordAsync(recordFields) {
     *     if (table.hasPermissionToCreateRecord(recordFields)) {
     *         const newRecordId = await table.createRecordAsync(recordFields);
     *     }
     *     // New record has been saved to Airtable servers.
     *     alert(`new record with ID ${newRecordId} has been created`);
     * }
     *
     * // Fields can be specified by name or ID
     * createNewRecord({
     *     'Project Name': 'Advertising campaign',
     *     'Budget': 100,
     * });
     * createNewRecord({
     *     [projectNameField.id]: 'Cat video',
     *     [budgetField.id]: 200,
     * });
     *
     * // Cell values should generally have format matching the output of
     * // record.getCellValue() for the field being updated
     * createNewRecord({
     *     'Project Name': 'Cat video 2'
     *     'Category (single select)': {name: 'Video'},
     *     'Tags (multiple select)': [{name: 'Cats'}, {id: 'someChoiceId'}],
     *     'Assets (attachment)': [{url: 'http://mywebsite.com/cats.mp4'}],
     *     'Related projects (linked records)': [{id: 'someRecordId'}],
     * });
     * ```
     */
    createRecordAsync(fields?: ObjectMap<FieldId | string, unknown>): Promise<RecordId>;
    /**
     * Checks whether the current user has permission to create the specified record.
     *
     * Accepts partial input, in the same format as {@link createRecordAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * Returns `{hasPermission: true}` if the current user can create the specified record,
     * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
     * used to display an error message to the user.
     *
     * @param fields object mapping `FieldId` or field name to value for that field.
     * @example
     * ```js
     * // Check if user can create a specific record, when you already know what
     * // fields/cell values will be set for the record.
     * const createRecordCheckResult = table.checkPermissionsForCreateRecord({
     *     'Project Name': 'Advertising campaign',
     *     'Budget': 100,
     * });
     * if (!createRecordCheckResult.hasPermission) {
     *     alert(createRecordCheckResult.reasonDisplayString);
     * }
     *
     * // Like createRecordAsync, you can use either field names or field IDs.
     * const checkResultWithFieldIds = table.checkPermissionsForCreateRecord({
     *     [projectNameField.id]: 'Cat video',
     *     [budgetField.id]: 200,
     * });
     *
     * // Check if user could potentially create a record.
     * // Use when you don't know the specific fields/cell values yet (for example,
     * // to show or hide UI controls that let you start creating a record.)
     * const createUnknownRecordCheckResult =
     *     table.checkPermissionsForCreateRecord();
     * ```
     */
    checkPermissionsForCreateRecord(fields?: ObjectMap<FieldId | string, unknown | void>): PermissionCheckResult;
    /**
     * An alias for `checkPermissionsForCreateRecord(fields).hasPermission`.
     *
     * Checks whether the current user has permission to create the specified record.
     *
     * Accepts partial input, in the same format as {@link createRecordAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * @param fields object mapping `FieldId` or field name to value for that field.
     * @example
     * ```js
     * // Check if user can create a specific record, when you already know what
     * // fields/cell values will be set for the record.
     * const canCreateRecord = table.hasPermissionToCreateRecord({
     *     'Project Name': 'Advertising campaign',
     *     'Budget': 100,
     * });
     * if (!canCreateRecord) {
     *     alert('not allowed!');
     * }
     *
     * // Like createRecordAsync, you can use either field names or field IDs.
     * const canCreateRecordWithFieldIds = table.hasPermissionToCreateRecord({
     *     [projectNameField.id]: 'Cat video',
     *     [budgetField.id]: 200,
     * });
     *
     * // Check if user could potentially create a record.
     * // Use when you don't know the specific fields/cell values yet (for example,
     * // to show or hide UI controls that let you start creating a record.)
     * const canCreateUnknownRecord = table.hasPermissionToCreateRecord();
     * ```
     */
    hasPermissionToCreateRecord(fields?: ObjectMap<FieldId | string, unknown | void>): boolean;
    /**
     * Creates new records with the specified cell values.
     *
     * Throws an error if the user does not have permission to create the given records, or
     * if invalid input is provided (eg. invalid cell values).
     *
     * Refer to {@link FieldType} for cell value write formats.
     *
     * You may only create up to 50 records in one call to `createRecordsAsync`.
     * See [Write back to Airtable](/guides/write-back-to-airtable#size-limits-rate-limits) for
     * more information about write limits.
     *
     * This action is asynchronous: `await` the returned promise if you wish to wait for the new
     * record to be persisted to Airtable servers.
     * Updates are applied optimistically locally, so your changes will be reflected in your app
     * before the promise resolves.
     *
     * The returned promise will resolve to an array of RecordIds of the new records once the new
     * records are persisted.
     *
     * @param records Array of objects with a `fields` key mapping `FieldId` or field name to value for that field.
     * @example
     * ```js
     * const recordDefs = [
     *     // Fields can be specified by name or ID
     *     {
     *          fields: {
     *              'Project Name': 'Advertising campaign',
     *              'Budget': 100,
     *          },
     *     },
     *     {
     *          fields: {
     *              [projectNameField.id]: 'Cat video',
     *              [budgetField.id]: 200,
     *          },
     *     },
     *     // Specifying no fields will create a new record with no cell values set
     *     {
     *          fields: {},
     *     },
     *     // Cell values should generally have format matching the output of
     *     // record.getCellValue() for the field being updated
     *     {
     *          fields: {
     *              'Project Name': 'Cat video 2'
     *              'Category (single select)': {name: 'Video'},
     *              'Tags (multiple select)': [{name: 'Cats'}, {id: 'choiceId'}],
     *              'Assets (attachment)': [{url: 'http://mywebsite.com/cats.mp4'}],
     *              'Related projects (linked records)': [{id: 'someRecordId'}],
     *          },
     *     },
     * ];
     *
     * function createNewRecords() {
     *     if (table.hasPermissionToCreateRecords(recordDefs)) {
     *         table.createRecordsAsync(recordDefs);
     *     }
     *     // You can now access the new records in your app (e.g.
     *     // `table.selectRecords()`) but they are still being saved to Airtable
     *     // servers (e.g. other users may not be able to see them yet.)
     * }
     *
     * async function createNewRecordsAsync() {
     *     if (table.hasPermissionToCreateRecords(recordDefs)) {
     *         const newRecordIds = await table.createRecordsAsync(recordDefs);
     *     }
     *     // New records have been saved to Airtable servers.
     *     alert(`new records with IDs ${newRecordIds} have been created`);
     * }
     * ```
     */
    createRecordsAsync(records: ReadonlyArray<{
        fields: ObjectMap<FieldId | string, unknown>;
    }>): Promise<Array<RecordId>>;
    /**
     * Checks whether the current user has permission to create the specified records.
     *
     * Accepts partial input, in the same format as {@link createRecordsAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * Returns `{hasPermission: true}` if the current user can create the specified records,
     * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
     * used to display an error message to the user.
     *
     * @param records Array of objects mapping `FieldId` or field name to value for that field.
     * @example
     * ```js
     * // Check if user can create specific records, when you already know what
     * // fields/cell values will be set for the records.
     * const createRecordsCheckResult = table.checkPermissionsForCreateRecords([
     *     // Like createRecordsAsync, fields can be specified by name or ID
     *     {
     *          fields: {
     *              'Project Name': 'Advertising campaign',
     *              'Budget': 100,
     *          },
     *     },
     *     {
     *          fields: {
     *              [projectNameField.id]: 'Cat video',
     *              [budgetField.id]: 200,
     *          },
     *     },
     *     {},
     * ]);
     * if (!createRecordsCheckResult.hasPermission) {
     *     alert(createRecordsCheckResult.reasonDisplayString);
     * }
     *
     * // Check if user could potentially create records.
     * // Use when you don't know the specific fields/cell values yet (for example,
     * // to show or hide UI controls that let you start creating records.)
     * // Equivalent to table.checkPermissionsForCreateRecord()
     * const createUnknownRecordCheckResult =
     *     table.checkPermissionsForCreateRecords();
     * ```
     */
    checkPermissionsForCreateRecords(records?: ReadonlyArray<{
        readonly fields?: ObjectMap<FieldId | string, unknown | void> | void;
    }>): PermissionCheckResult;
    /**
     * An alias for `checkPermissionsForCreateRecords(records).hasPermission`.
     *
     * Checks whether the current user has permission to create the specified records.
     *
     * Accepts partial input, in the same format as {@link createRecordsAsync}.
     * The more information provided, the more accurate the permissions check will be.
     *
     * @param records Array of objects mapping `FieldId` or field name to value for that field.
     * @example
     * ```js
     * // Check if user can create specific records, when you already know what fields/cell values
     * // will be set for the records.
     * const canCreateRecords = table.hasPermissionToCreateRecords([
     *     // Like createRecordsAsync, fields can be specified by name or ID
     *     {
     *          fields: {
     *              'Project Name': 'Advertising campaign',
     *              'Budget': 100,
     *          }
     *     },
     *     {
     *          fields: {
     *              [projectNameField.id]: 'Cat video',
     *              [budgetField.id]: 200,
     *          }
     *     },
     *     {},
     * ]);
     * if (!canCreateRecords) {
     *     alert('not allowed');
     * }
     *
     * // Check if user could potentially create records.
     * // Use when you don't know the specific fields/cell values yet (for example,
     * // to show or hide UI controls that let you start creating records).
     * // Equivalent to table.hasPermissionToCreateRecord()
     * const canCreateUnknownRecords = table.hasPermissionToCreateRecords();
     * ```
     */
    hasPermissionToCreateRecords(records?: ReadonlyArray<{
        readonly fields?: ObjectMap<FieldId | string, unknown | void> | void;
    }>): boolean;
    /** @internal */
    _cellValuesByFieldIdOrNameToCellValuesByFieldId(cellValuesByFieldIdOrName: ObjectMap<FieldId | string, unknown>): ObjectMap<FieldId, unknown>;
    /**
     * Checks whether the current user has permission to create a field in this table.
     *
     * Accepts partial input, in the same format as {@link createFieldAsync}.
     *
     * Returns `{hasPermission: true}` if the current user can update the specified record,
     * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
     * used to display an error message to the user.
     *
     * @param name name for the field. must be case-insensitive unique for the table
     * @param type type for the field
     * @param options options for the field. omit for fields without writable options
     *
     * @example
     * ```js
     * const createFieldCheckResult = table.checkPermissionsForCreateField();
     *
     * if (!createFieldCheckResult.hasPermission) {
     *     alert(createFieldCheckResult.reasonDisplayString);
     * }
     * ```
     */
    checkPermissionsForCreateField(name?: string, type?: FieldType, options?: FieldOptions | null): PermissionCheckResult;
    /**
     * An alias for `checkPermissionsForCreateField(name, type, options).hasPermission`.
     *
     * Checks whether the current user has permission to create a field in this table.
     *
     * Accepts partial input, in the same format as {@link createFieldAsync}.
     *
     * @param name name for the field. must be case-insensitive unique for the table
     * @param type type for the field
     * @param options options for the field. omit for fields without writable options
     *
     * @example
     * ```js
     * const canCreateField = table.hasPermissionToCreateField();
     *
     * if (!canCreateField) {
     *     alert('not allowed!');
     * }
     * ```
     */
    hasPermissionToCreateField(name?: string, type?: FieldType, options?: FieldOptions | null): boolean;
    /**
     * Creates a new field.
     *
     * Similar to creating a field from the Airtable UI, the new field will not be visible
     * in views that have other hidden fields and views that are publicly shared.
     *
     * Throws an error if the user does not have permission to create a field, if invalid
     * name, type or options are provided, or if creating fields of this type is not supported.
     *
     * Refer to {@link FieldType} for supported field types, the write format for options, and
     * other specifics for certain field types.
     *
     * This action is asynchronous. Unlike new records, new fields are **not** created
     * optimistically locally. You must `await` the returned promise before using the new
     * field in your app.
     *
     * @param name name for the field. must be case-insensitive unique
     * @param type type for the field
     * @param options options for the field. omit for fields without writable options
     *
     * @example
     * ```js
     * async function createNewSingleLineTextField(table, name) {
     *     if (table.hasPermissionToCreateField(name, FieldType.SINGLE_LINE_TEXT)) {
     *         await table.createFieldAsync(name, FieldType.SINGLE_LINE_TEXT);
     *     }
     * }
     *
     * async function createNewCheckboxField(table, name) {
     *     const options = {
     *         icon: 'check',
     *         color: 'greenBright',
     *     };
     *     if (table.hasPermissionToCreateField(name, FieldType.CHECKBOX, options)) {
     *         await table.createFieldAsync(name, FieldType.CHECKBOX, options);
     *     }
     * }
     *
     * async function createNewDateField(table, name) {
     *     const options = {
     *         dateFormat: {
     *             name: 'iso',
     *         },
     *     };
     *     if (table.hasPermissionToCreateField(name, FieldType.DATE, options)) {
     *         await table.createFieldAsync(name, FieldType.DATE, options);
     *     }
     * }
     * ```
     */
    createFieldAsync(name: string, type: FieldType, options?: FieldOptions | null): Promise<Field>;
    /**
     * @internal
     */
    __getFieldMatching(fieldOrFieldIdOrFieldName: Field | string): Field;
    /**
     * @internal
     */
    __getViewMatching(viewOrViewIdOrViewName: View | string): View;
    /**
     * @internal
     */
    __triggerOnChangeForDirtyPaths(dirtyPaths: ChangedPathsForType<TableData>): boolean;
    /**
     * @internal
     */
    __getFieldNamesById(): {
        [key: string]: string;
    };
}
export default Table;
