import { CollectionState, ComputedQuery, Filter, FiltersMap, } from '@wix/bex-core'; import { NestedOptimisticActionsState } from './createNestedOptimisticActions'; export interface NestedCollectionLevelDescriptor { readonly depth: number; /** * A function that accepts the item of the current level and returns the key of the parent item, for example: `(item) => item.parentId`. */ readonly parentKey: (item: T) => string | null | undefined; readonly setParent?: ( item: T, parentId: string | undefined, additionalInfo: { parentItem?: {}; }, ) => T; /** * A function that creates a collection for the current level (using [useCreateCollection](./?path=/story/common-hooks--usecreatecollection) hook), and returns the collection state and a reference to a filter object within this collection that filters the collection by the parent key. * @overrideType (state) => { collection: [CollectionState](./?path=/story/common-state--collectionstate); parentFilter?: [Filter](./?path=/story/features-filter-factories--stringsarrayfilter); } */ readonly createCollection: (params?: NestedOptimisticActionsState) => { collection: CollectionState; parentFilter?: Filter; }; readonly fetchAllThreshold?: number; readonly isSameEntityAsOtherLevels?: boolean; /** * A [predicate](./?path=/story/features-actions-updates--useoptimisticactions) function to pass to the internal [OptimisticActions](/?path=/story/features-actions-updates--collectionoptimisticactions) created by NestedTable */ readonly optimisticActionsPredicate?: ( query: ComputedQuery, ) => (item: T) => boolean; }