import { type IAbsoluteDateFilter, type IAttributeElement, type IAttributeFilter, type IMeasure, type IRelativeDateFilter, type ObjRef, type SortDirection } from "@gooddata/sdk-model"; import { type ICancelable } from "../../../cancelation/index.js"; import { type IPagedResource } from "../../../common/paging.js"; /** * Specification of particular elements to load in {@link IElementsQueryOptions} using their values. * * @public */ export interface IElementsQueryOptionsElementsByValue { /** * The values to request. */ values: Array; } /** * Type guard checking whether the object is an instance of {@link IElementsQueryOptionsElementsByValue}. * * @public */ export declare function isElementsQueryOptionsElementsByValue(obj: unknown): obj is IElementsQueryOptionsElementsByValue; /** * Specification of particular elements to load in {@link IElementsQueryOptions} using the values of the primary * display form related to the attribute the requested display form is from. * * @public */ export interface IElementsQueryOptionsElementsByPrimaryDisplayFormValue { /** * The values to request. */ primaryValues: Array; } /** * Type guard checking whether the object is an instance of {@link IElementsQueryOptionsElementsByPrimaryDisplayFormValue}. * * @public */ export declare function isElementsQueryOptionsElementsByPrimaryDisplayFormValue(obj: unknown): obj is IElementsQueryOptionsElementsByPrimaryDisplayFormValue; /** * Type guard checking whether the object is an instance of {@link IElementsQueryOptionsElementsByValue} or {@link IElementsQueryOptionsElementsByPrimaryDisplayFormValue}. * * @public */ export declare function isValueBasedElementsQueryOptionsElements(obj: unknown): obj is IElementsQueryOptionsElementsByValue | IElementsQueryOptionsElementsByPrimaryDisplayFormValue; /** * Specification of particular elements to load in {@link IElementsQueryOptions} using their URIs. * * @remarks * This is not supported on backends without the supportsElementUris capability. * * @public */ export interface IElementsQueryOptionsElementsByUri { /** * The element URIs to request. */ uris: Array; } /** * Specification of particular elements to load in {@link IElementsQueryOptions}. * * @public */ export type ElementsQueryOptionsElementsSpecification = IElementsQueryOptionsElementsByValue | IElementsQueryOptionsElementsByPrimaryDisplayFormValue | IElementsQueryOptionsElementsByUri; /** * Configuration options for querying attribute elements * * @public */ export interface IElementsQueryOptions { /** * Ordering of the elements */ order?: SortDirection; /** * Filter elements by text value */ filter?: string; /** * If true, the `filter` prop will behave negatively - i.e. it will not include items matching the `filter` value. */ complement?: boolean; /** * Include the total count of all elements in the response (without filters applied) */ includeTotalCountWithoutFilters?: boolean; /** * Specify particular elements to load. * * @remarks * This is commonly used to preload selected elements in the attribute filter. */ elements?: ElementsQueryOptionsElementsSpecification; /** * Decides whether result will include also the primary label elements or only requested label ones. * It changes also the cardinality of result. * * If true, returned label values are in cardinality of primary label, i.e., result could contain * duplicated values. * * If false, returned label values are unique values and smaller amount of label values can be returned * than the number of primary label values. * * @remarks * This is used mainly in filters to not display duplicate values where each of them filter out the same * records from an insight when text value attribute filters are used. * * The value is applied only on backends without the supportsElementUris capability. */ excludePrimaryLabel?: boolean; /** * Provided filter uses values from primary label. * * @remarks * This is to allow getting elements of requested label corresponding to primary label values in filter. */ filterByPrimaryLabel?: boolean; /** * Cache ID to use when requesting subsequent elements from the backend. * * @remarks * This is to prevent inconsistent results when the underlying datasource is volatile. * If not specified, the backend will generate a value that the client should use in subsequent requests. * Note that not all backend types support this. */ cacheId?: string; } /** * Attribute filter limiting the elements. * * @remarks * To be able to filter elements, the current attribute * and the filter attribute must be connected in the data model. The property `overAttribute` identifies * the connecting table in the logical data model. * * Not all backends support overAttribute prop. * * For method providing all possible connecting attributes see {@link IWorkspaceAttributesService.getCommonAttributes}. * For method providing whether attributes have some connection in model * see {@link IWorkspaceAttributesService.getConnectedAttributesByDisplayForm}. * * @public */ export interface IElementsQueryAttributeFilter { attributeFilter: IAttributeFilter; overAttribute: ObjRef; } /** * Only for these filter types makes sense to resolve their elements * * @public */ export type FilterWithResolvableElements = IAttributeFilter | IRelativeDateFilter; /** * The attribute itself contains no view data, it's just a sequence of id's. * * @remarks * To get data that is useful to users, we need to represent these id's with specific values. * For this purpose, we pair the attribute with it's display form (specific representation of attribute values). * An attribute can have multiple display forms. * * @public */ export interface IElementsQueryFactory { /** * Query attribute elements represented by concrete display form * * @param ref - display form ref * @returns instance that can be used to query attribute elements */ forDisplayForm(ref: ObjRef): IElementsQuery; /** * Query attribute elements used by provided filter * * @param filter - resolvable filter * @param dateFilterDisplayForm - display form of resolvable filter if it is date filter * @returns instance that can be used to query attribute elements * */ forFilter(filter: FilterWithResolvableElements, dateFilterDisplayForm?: ObjRef): IFilterElementsQuery; } /** * Service to query valid attribute elements for particular display form. * * @public */ export interface IElementsQuery extends ICancelable { /** * Sets number of valid elements to return per page. * Default limit is specific per backend * * @param limit - desired max number of valid elements per page; must be a positive number * @returns element query */ withLimit(limit: number): IElementsQuery; /** * Sets starting point for the query. Backend WILL return no data if the offset is greater than * total number of valid elements. * Default offset: 0 * * @param offset - zero indexed, must be non-negative * @returns element query */ withOffset(offset: number): IElementsQuery; /** * Sets the attribute filters that will limit the available elements * * @param filters - attribute filters limiting the elements * @returns element query */ withAttributeFilters(filters: IElementsQueryAttributeFilter[]): IElementsQuery; /** * Sets the measures that will limit the available elements - only elements for which the measures * have data will be returned. * * @param measures - measures limiting the elements * @returns element query */ withMeasures(measures: IMeasure[]): IElementsQuery; /** * Sets the catalog objects based on which the elements are validated, i.e., if set, only the elements * that are available with these metrics, attributes, etc. are returned. * * Note that this functionality is not supported by every backend. * * @param validateBy - metric, attributes, or other objects the elements are validated by. * @returns element query */ withAvailableElementsOnly(validateBy: ObjRef[]): IElementsQuery; /** * Allows to specify advanced options for the elements query. * * @param options - advanced options * @returns element query */ withOptions(options: IElementsQueryOptions): IElementsQuery; /** * Starts the valid elements query. * * @returns promise of first page of the results */ query(): Promise; /** * Sets the date filters that will limit the available elements * * @param filters - date filters limiting the elements * @returns element query */ withDateFilters(filters: (IRelativeDateFilter | IAbsoluteDateFilter)[]): IElementsQuery; } /** * Service to query valid filter elements for particular filter. * * @public */ export interface IFilterElementsQuery { /** * Sets number of valid elements to return per page. * Default limit is specific per backend * * @param limit - desired max number of valid elements per page; must be a positive number * @returns element query */ withLimit(limit: number): IFilterElementsQuery; /** * Sets starting point for the query. Backend WILL return no data if the offset is greater than * total number of valid elements. * Default offset: 0 * * @param offset - zero indexed, must be non-negative * @returns element query */ withOffset(offset: number): IFilterElementsQuery; /** * Starts the valid elements query. * * @returns promise of first page of the results */ query(): Promise; } /** * Paged result of valid element query. Last page of data returns empty items. * * @public */ export type IElementsQueryResult = IPagedResource; //# sourceMappingURL=index.d.ts.map