/** @module @airtable/blocks/models: RecordQueryResult */ /** */ import { FieldId } from '../types/field'; import Sdk from '../sdk'; import { FlowAnyFunction, FlowAnyObject } from '../private_utils'; import { RecordId } from '../types/record'; import { GroupData } from '../types/view'; import { NormalizedGroupLevel } from '../types/airtable_interface'; import RecordQueryResult, { WatchableRecordQueryResultKey, NormalizedRecordQueryResultOpts } from './record_query_result'; import Table from './table'; import Field from './field'; import ObjectPool from './object_pool'; import TableOrViewQueryResult from './table_or_view_query_result'; /** @hidden */ interface GroupedRecordQueryResultData { groupData: GroupData; groupLevels: Array; } /** * Represents a group of records returned from a group query. See {@link RecordQueryResult} for main * documentation. * * Do not instantiate. You can get instances of this class by calling * `recordQueryResult.groups`. * * @docsPath models/query results/GroupedRecordQueryResult * @hidden */ declare class GroupedRecordQueryResult extends RecordQueryResult { /** @internal */ static _className: string; /** @internal */ _parentQueryResult: TableOrViewQueryResult | GroupedRecordQueryResult; /** @internal */ _groupData: GroupData; /** * This includes groupLevel for all children & parent grouped layers, the getter * returns only the groupLevels for this layer. * * @internal */ _groupLevels: Array; /** @internal */ _orderedChildrenGroups: Array | null; /** @internal */ _recordIdsSet: { [key: string]: true | void; } | null; _orderedRecordIds: Array | null; /** @internal */ __groupedRecordQueryResultPool: ObjectPool; /** @internal */ constructor(parentQueryResult: TableOrViewQueryResult | GroupedRecordQueryResult, groupData: GroupData, groupLevel: Array, normalizedOpts: NormalizedRecordQueryResultOpts, sdk: Sdk); /** * Gets children groups of this group (if any exist) */ get groups(): Array | null; /** @internal */ get groupLevel(): NormalizedGroupLevel; /** * Gets the fieldId that this group is grouped by */ get fieldId(): FieldId; /** * Gets the field that this group is grouped by */ get field(): Field; /** * @internal (since we may not be able to return parent model instances in the immutable models world) * The table that records in this RecordQueryResult are part of */ get parentTable(): Table; /** * Recursively gets all recordIds in the children groups, keeping recordIds in group order * * @internal */ _computeRecordIds(): Array; /** * Anytime the recordIds to return could have changed, we clear this so that * the next time the user requests recordIds it recomputes * * @internal */ _invalidateComputedRecordIds(): void; /** * Ordered array of all the record ids inside this group, in group order. * This returns all recordIds of all children groups (in grouped order). * Watchable. */ get recordIds(): Array; /** * The fields that were used to create the parent RecordQueryResult that created this GroupedRecordQueryResult. * This is separate from the field/fieldId property - which is the field this grouping is based upon. * Null if fields were not specified, which means the RecordQueryResult * will load all fields in the table. */ get fields(): Array | null; /** @inheritdoc */ watch(keys: WatchableRecordQueryResultKey | ReadonlyArray, callback: FlowAnyFunction, context?: FlowAnyObject | null): Array; /** @inheritdoc */ unwatch(keys: WatchableRecordQueryResultKey | ReadonlyArray, callback: FlowAnyFunction, context?: FlowAnyObject | null): Array; /** @inheritdoc */ loadDataAsync(): Promise; /** @internal */ _getChangedKeysOnLoad(): Array; /** @internal */ _loadDataAsync(): Promise>; /** @internal */ _unloadData(): void; /** @internal */ get __poolKey(): string; /** * This model doesn't actually load data, but it does use the `_data` * property so that checks for model deletion behave appropriately. * * This is considered deleted if the parent query result has been deleted. * * We return groupData, instead of precomputing all children groups because * we perform the computation+caching lazily on request * * @internal */ get _dataOrNullIfDeleted(): GroupedRecordQueryResultData | null; /** @inheritdoc */ get isDataLoaded(): boolean; /** @internal */ _unloadChildrenGroupsIfNeeded(): void; /** @internal */ _invalidateRecordIdsSet(): void; /** @internal */ _getOrGenerateRecordIdsSet(): { [key: string]: true | void; }; } export default GroupedRecordQueryResult;