/** * DevExtreme (common/data.d.ts) * Version: 25.1.7 * Build date: Mon Nov 10 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ /* eslint-disable max-classes-per-file */ import { DxExtendedPromise, DxPromise } from '../core/utils/deferred'; import AbstractStore, { AbstractStoreOptions } from '../data/abstract_store'; import type { Store as StoreBase, StoreOptions as StoreOptionsBase, } from '../data/store'; import type { SearchOperation as SearchOperationInternal, GroupingInterval as GroupingIntervalInternal, SortDescriptor as SortDescriptorInternal, GroupDescriptor as GroupDescriptorInternal, SelectDescriptor as SelectDescriptorInternal, FilterDescriptor as FilterDescriptorInternal, SummaryDescriptor as SummaryDescriptorInternal, LoadOptions as LoadOptionsInternal, } from './data.types'; export type SearchOperation = SearchOperationInternal; export type GroupingInterval = GroupingIntervalInternal; /** * */ export type SortDescriptor = SortDescriptorInternal; /** * */ export type GroupDescriptor = GroupDescriptorInternal; /** * */ export type SelectDescriptor = SelectDescriptorInternal; /** * */ export type FilterDescriptor = FilterDescriptorInternal; /** * This section describes the loadOptions object's fields. */ export type LoadOptions = LoadOptionsInternal; /** * A total summary expression for `loadOptions`. */ export type SummaryDescriptor = SummaryDescriptorInternal; /** * Applies an array of changes to a source data array. */ export function applyChanges(data: Array, changes: Array, options?: { keyExpr?: string | Array; immutable?: boolean }): Array; /** * */ export type ArrayStoreOptions< TItem = any, TKey = any, > = AbstractStoreOptions & { /** * Specifies the store's associated array. */ data?: Array; }; /** * The ArrayStore is a store that provides an interface for loading and editing an in-memory array and handling related events. */ export class ArrayStore< TItem = any, TKey = any, > extends AbstractStore { constructor(options?: ArrayStoreOptions); /** * Gets a data item with a specific key. */ byKey(key: TKey): DxPromise; /** * Clears all the ArrayStore's associated data. */ clear(): void; /** * Creates a Query for the underlying array. */ createQuery(): Query; } /** * An additional type for LoadResult. */ export type GroupItem< TItem = any, > = { /** * A key to group items by. */ key: any | string | number; /** * Contains an array of items or GroupItems, or nothing. */ items: Array | Array> | null; /** * A total number of items. */ count?: number; /** * A summary array that contains the resulting values in the same order as the summary definitions. */ summary?: Array; }; /** * @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution. */ type LoadResultArray = Array | Array>; /** * An additional type for LoadResult. */ export type LoadResultObject = { /** * Contains an array of items or GroupItems. */ data: Array | Array>; /** * A total number of items. */ totalCount?: number; /** * A summary array that contains the resulting values in the same order as the summary definitions. */ summary?: Array; /** * A number of groups. */ groupCount?: number; }; /** * Specifies returned data of the `load()` method in CustomStore. */ export type LoadResult< TItem = any, > = | Object | LoadResultArray | LoadResultObject; /** * A type guard function that checks whether LoadResult is a LoadResultObject. */ export function isLoadResultObject(res: LoadResult): res is LoadResultObject; /** * A type guard function that checks whether LoadResult is an array of GroupItems. */ export function isGroupItemsArray(res: LoadResult): res is Array>; /** * A type guard function that checks whether LoadResult is an array of items. */ export function isItemsArray(res: LoadResult): res is Array; /** * @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution. */ type LoadFunctionResult = T | DxPromise | PromiseLike; /** * Specifies returned data of the `load()` method in CustomStore. * @deprecated Use LoadResult instead. */ export type ResolvedData = LoadResult; /** * */ export type CustomStoreOptions< TItem = any, TKey = any, > = StoreOptionsBase & { /** * Specifies a custom implementation of the byKey(key) method. */ byKey?: ((key: TKey, extraOptions?: LoadOptions) => PromiseLike); /** * Specifies whether raw data should be saved in the cache. Applies only if loadMode is 'raw'. */ cacheRawData?: boolean; /** * Specifies a custom implementation of the insert(values) method. */ insert?: ((values: TItem) => PromiseLike); /** * Specifies a custom implementation of the load(options) method. */ load: (options: LoadOptions) => LoadFunctionResult>; /** * Specifies how data returned by the load function is treated. */ loadMode?: 'processed' | 'raw'; /** * A function that is executed after data is loaded to the store. */ onLoaded?: ((result: LoadResult, loadOptions: LoadOptions) => void); /** * Specifies a custom implementation of the remove(key) method. */ remove?: ((key: TKey) => PromiseLike); /** * Specifies a custom implementation of the totalCount(options) method. */ totalCount?: ((loadOptions: { filter?: FilterDescriptor | Array; group?: GroupDescriptor | Array> }) => PromiseLike); /** * Specifies a custom implementation of the update(key, values) method. */ update?: ((key: TKey, values: TItem) => PromiseLike); /** * Specifies whether the store combines the search and filter expressions. Defaults to true if the loadMode is 'raw' and false if it is 'processed'. */ useDefaultSearch?: boolean | undefined; }; /** * The CustomStore enables you to implement custom data access logic for consuming data from any source. */ export class CustomStore< TItem = any, TKey = any, > extends StoreBase { constructor(options?: CustomStoreOptions); /** * Gets a data item with a specific key. */ byKey(key: TKey, extraOptions?: LoadOptions): DxPromise; /** * Deletes data from the cache. Takes effect only if the cacheRawData property is true. */ clearRawDataCache(): void; /** * Starts loading data. */ load(): DxExtendedPromise>; /** * Starts loading data. */ load(options: LoadOptions): DxExtendedPromise>; } /** * @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution. */ type DataSourceEventName = 'changed' | 'loadError' | 'loadingChanged'; /** * */ export type DataSourceOptions< TStoreItem = any, TMappedItem = TStoreItem, TItem = TMappedItem, TKey = any, > = { /** * Custom parameters that should be passed to an OData service with the load query. Available only for the ODataStore. */ customQueryParams?: any; /** * Specifies the navigation properties to be loaded with the OData entity. Available only for the ODataStore. */ expand?: Array | string; /** * Specifies data filtering conditions. */ filter?: FilterDescriptor | Array; /** * Specifies data grouping properties. */ group?: GroupDescriptor | Array>; /** * Specifies parameters for language-specific sorting and filtering. */ langParams?: LangParams; /** * Specifies an item mapping function. */ map?: ((dataItem: TStoreItem) => TMappedItem); /** * A function that is executed after data is loaded. */ onChanged?: ((e: { readonly changes?: Array }) => void); /** * A function that is executed when data loading fails. */ onLoadError?: ((error: { readonly message?: string }) => void); /** * A function that is executed when the data loading status changes. */ onLoadingChanged?: ((isLoading: boolean) => void); /** * Specifies the maximum number of data items per page. Applies only if paginate is true. */ pageSize?: number; /** * Specifies whether the DataSource loads data items by pages or all at once. Defaults to false if group is set; otherwise, true. */ paginate?: boolean | undefined; /** * Specifies a post processing function. */ postProcess?: ((data: Array) => Array); /** * Specifies the period (in milliseconds) when changes are aggregated before pushing them to the DataSource. */ pushAggregationTimeout?: number | undefined; /** * Specifies whether the DataSource requests the total count of data items in the storage. */ requireTotalCount?: boolean; /** * Specifies whether to reapply sorting, filtering, grouping, and other data processing operations after receiving a push. */ reshapeOnPush?: boolean; /** * Specifies the fields to search. */ searchExpr?: string | Function | Array; /** * Specifies the comparison operation used in searching. */ searchOperation?: SearchOperation; /** * Specifies the value to which the search expression is compared. */ searchValue?: any; /** * Specifies the fields to select from data objects. */ select?: SelectDescriptor; /** * Specifies data sorting properties. */ sort?: SortDescriptor | Array>; /** * Configures the store underlying the DataSource. */ store?: Array | Store | StoreOptions; }; /** * The DataSource is an object that provides an API for processing data from an underlying store. */ export class DataSource< TItem = any, TKey = any, > { constructor(data: Array); constructor(options: CustomStoreOptions | DataSourceOptions); constructor(store: Store); constructor(url: string); /** * Cancels the load operation with a specific identifier. */ cancel(operationId: number): boolean; /** * Disposes of all the resources allocated to the DataSource instance. */ dispose(): void; /** * Gets the filter property's value. */ filter(): FilterDescriptor | Array; /** * Sets the filter property's value. */ filter(filterExpr: FilterDescriptor | Array): void; /** * Gets the group property's value. */ group(): GroupDescriptor | Array>; /** * Sets the group property's value. */ group(groupExpr: GroupDescriptor | Array>): void; /** * Checks whether the count of items on the current page is less than the pageSize. Takes effect only with enabled paging. */ isLastPage(): boolean; /** * Checks whether data is loaded in the DataSource. */ isLoaded(): boolean; /** * Checks whether data is being loaded in the DataSource. */ isLoading(): boolean; /** * Gets an array of data items on the current page. */ items(): Array; /** * Gets the value of the underlying store's key property. */ key(): string | Array; /** * Starts loading data. */ load(): DxExtendedPromise; /** * Gets an object with current data processing settings. */ loadOptions(): LoadOptions; /** * Detaches all event handlers from a single event. */ off(eventName: DataSourceEventName): this; /** * Detaches a particular event handler from a single event. */ off(eventName: DataSourceEventName, eventHandler: Function): this; /** * Subscribes to an event. */ on(eventName: DataSourceEventName, eventHandler: Function): this; /** * Subscribes to events. */ on(events: { [key in DataSourceEventName]?: Function }): this; /** * Gets the current page index. */ pageIndex(): number; /** * Sets the index of the page that should be loaded on the next load() method call. */ pageIndex(newIndex: number): void; /** * Gets the page size. */ pageSize(): number; /** * Sets the page size. */ pageSize(value: number): void; /** * Gets the paginate property's value. */ paginate(): boolean; /** * Sets the paginate property's value. */ paginate(value: boolean): void; /** * Clears currently loaded DataSource items and calls the load() method. */ reload(): DxExtendedPromise; /** * Gets the requireTotalCount property's value. */ requireTotalCount(): boolean; /** * Sets the requireTotalCount property's value. */ requireTotalCount(value: boolean): void; /** * Gets the searchExpr property's value. */ searchExpr(): string & Function & Array; /** * Sets the searchExpr property's value. */ searchExpr(expr: string | Function | Array): void; /** * Gets the searchOperation property's value. */ searchOperation(): string; /** * Sets the searchOperation property's value. */ searchOperation(op: string): void; /** * Gets the searchValue property's value. */ searchValue(): any; /** * Sets the searchValue property's value. */ searchValue(value: any): void; /** * Gets the select property's value. */ select(): SelectDescriptor; /** * Sets the select property's value. */ select(expr: SelectDescriptor): void; /** * Gets the sort property's value. */ sort(): SortDescriptor | Array>; /** * Sets the sort property's value. */ sort(sortExpr: SortDescriptor | Array>): void; /** * Gets the instance of the store underlying the DataSource. */ store(): Store; /** * Gets the number of data items in the store after the last load() operation without paging. Takes effect only if requireTotalCount is true */ totalCount(): number; } /** * Specifies parameters for language-specific sorting and filtering. */ export type LangParams = { /** * Specifies the locale whose features affect sorting and filtering. */ locale: string; /** * Specifies Intl.Collator options. */ collatorOptions?: Intl.CollatorOptions; }; export type Store = CustomStore | ArrayStore | LocalStore | ODataStore; export type StoreOptions = CustomStoreOptions | ArrayStoreOptions & { type: 'array' } | LocalStoreOptions & { type: 'local' } | ODataStoreOptions & { type: 'odata' }; /** * The EndpointSelector is an object for managing OData endpoints in your application. */ export class EndpointSelector { constructor(options: any); /** * Gets an endpoint with a specific key. */ urlFor(key: string): string; } /** * Specifies the function that is executed when a data layer object throws an error. * @deprecated Use setErrorHandler instead. */ export function errorHandler(e: Error): void; /** * A method that specifies a function to be executed when a Data Layer component throws an error. */ export function setErrorHandler(handler: (e: Error) => void): void; /** * */ export type LocalStoreOptions< TItem = any, TKey = any, > = ArrayStoreOptions & { /** * Specifies a delay in milliseconds between when data changes and the moment these changes are saved in the local storage. Applies only if immediate is false. */ flushInterval?: number; /** * Specifies whether the LocalStore saves changes in the local storage immediately. */ immediate?: boolean; /** * Specifies the name under which data should be saved in the local storage. The `dx-data-localStore-` prefix will be added to the name. */ name?: string; }; /** * The LocalStore is a store that provides an interface for loading and editing data from HTML Web Storage (also known as window.localStorage) and handling related events. */ export class LocalStore< TItem = any, TKey = any, > extends ArrayStore { constructor(options?: LocalStoreOptions); /** * Removes data from the local storage. */ clear(): void; } /** * The Query is an object that provides a chainable interface for making data queries. */ export type Query = { /** * Calculates a custom summary for all data items. */ aggregate(seed: any, step: Function, finalize: Function): DxPromise; /** * Calculates a custom summary for all data items. */ aggregate(step: Function): DxPromise; /** * Calculates the average of all values. Applies only to numeric arrays. */ avg(): DxPromise; /** * Calculates the average of all values found using a getter. */ avg(getter: any): DxPromise; /** * Calculates the number of data items. */ count(): DxPromise; /** * Executes the Query. This is an asynchronous alternative to the toArray() method. */ enumerate(): DxPromise; /** * Filters data items using a filter expression. */ filter(criteria: Array): Query; /** * Filters data items using a custom function. */ filter(predicate: Function): Query; /** * Groups data items by the specified getter. */ groupBy(getter: any): Query; /** * Calculates the maximum value. Applies only to numeric arrays. */ max(): DxPromise; /** * Calculates the maximum of all values found using a getter. */ max(getter: any): DxPromise; /** * Calculates the minimum value. Applies only to numeric arrays. */ min(): DxPromise; /** * Calculates the minumum of all values found using a getter. */ min(getter: any): DxPromise; /** * Selects individual fields from data objects. */ select(...getters: any[]): Query; /** * Gets a specified number of data items starting from a given index. */ slice(skip: number, take?: number): Query; /** * Sorts data items by the specified getter in ascending order. */ sortBy(getter: any): Query; /** * Sorts data items by the specified getter in the specified sorting order. */ sortBy(getter: any, desc: boolean): Query; /** * Calculates the sum of all values. */ sum(): DxPromise; /** * Calculates the sum of all values found using a getter. */ sum(getter: any): DxPromise; /** * Sorts data items by one more getter in ascending order. */ thenBy(getter: any): Query; /** * Sorts data items by one more getter in the specified sorting order. */ thenBy(getter: any, desc: boolean): Query; /** * Gets data items associated with the Query. This is a synchronous alternative to the enumerate() method. */ toArray(): Array; }; /** * Creates a Query instance. */ export function query(array: Array, queryOptions?: any): Query; /** * Creates a Query instance that accesses a remote data service using its URL. */ export function query(url: string, queryOptions: any): Query; /** * Encodes a string or array of bytes in Base64. */ export function base64_encode(input: string | Array): string; /** * Compiles a getter function from a getter expression. */ export function compileGetter(expr: string | Array): Function; /** * Compiles a setter function from a setter expression. */ export function compileSetter(expr: string | Array): Function; /** * @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution. */ export interface ODataRequestOptions { accepts: any; async: boolean; contentType: string | boolean; data: any; dataType: string; headers: any; jsonp?: boolean; method: string; timeout: number; url: string; xhrFields: any; } /** * @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution. */ export type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'MERGE'; /** * */ export type ODataContextOptions = { /** * Specifies a function that customizes the request before it is sent to the server. */ beforeSend?: ((options: { url: string; async: boolean; method: string; timeout: number; params: any; payload: any; headers: any }) => void); /** * Specifies whether stores in the ODataContext serialize/parse date-time values. */ deserializeDates?: boolean; /** * Specifies entity collections to be accessed. */ entities?: any; /** * Specifies a function that is executed when the ODataContext throws an error. */ errorHandler?: ((e: { httpStatus: number; errorDetails: any; requestOptions: ODataRequestOptions }) => void); /** * Specifies whether to convert string values to lowercase in filter and search requests. Applies to the following operations: 'startswith', 'endswith', 'contains', and 'notcontains'. */ filterToLower?: boolean; /** * Specifies whether data should be sent using JSONP. */ jsonp?: boolean; /** * Specifies the URL of an OData service. */ url?: string; /** * Specifies the OData version. */ version?: number; /** * Specifies whether to send cookies, authorization headers, and client certificates in a cross-origin request. */ withCredentials?: boolean; }; /** * The ODataContext is an object that provides access to an entire OData service. */ export class ODataContext { constructor(options?: ODataContextOptions); /** * Invokes an OData operation that returns a value. */ get(operationName: string, params: any): DxPromise; /** * Invokes an OData operation that returns nothing. */ invoke(operationName: string, params: any, httpMethod: HttpMethod): DxPromise; /** * Gets a link to an entity with a specific key. */ objectLink(entityAlias: string, key: any | string | number): any; } /** * */ export type ODataStoreOptions< TItem = any, TKey = any, > = AbstractStoreOptions & { /** * Specifies a function that customizes the request before it is sent to the server. */ beforeSend?: ((options: { url: string; async: boolean; method: string; timeout: number; params: any; payload: any; headers: any }) => void); /** * Specifies whether the store serializes/parses date-time values. */ deserializeDates?: boolean; /** * Specifies a function that is executed when the ODataStore throws an error. */ errorHandler?: ((e: { httpStatus: number; errorDetails: any; requestOptions: ODataRequestOptions }) => void); /** * Specifies the data field types. Accepts the following types: 'String', 'Int32', 'Int64', 'Boolean', 'Single', 'Decimal' and 'Guid'. */ fieldTypes?: any; /** * Specifies whether to convert string values to lowercase in filter and search requests. Applies to the following operations: 'startswith', 'endswith', 'contains', and 'notcontains'. */ filterToLower?: boolean; /** * Specifies whether data should be sent using JSONP. */ jsonp?: boolean; /** * Specifies the type of the key property or properties. */ keyType?: 'String' | 'Int32' | 'Int64' | 'Guid' | 'Boolean' | 'Single' | 'Decimal' | any; /** * Specifies the URL of an OData entity collection. */ url?: string; /** * Specifies the OData version. */ version?: number; /** * Specifies whether to send cookies, authorization headers, and client certificates in a cross-origin request. */ withCredentials?: boolean; }; /** * The ODataStore is a store that provides an interface for loading and editing data from an individual OData entity collection and handling related events. */ export class ODataStore< TItem = any, TKey = any, > extends AbstractStore { constructor(options?: ODataStoreOptions); /** * Gets an entity with a specific key. */ byKey(key: TKey, extraOptions?: { expand?: string | Array; select?: string | Array }): DxPromise; /** * Creates a Query for the OData endpoint. */ createQuery(loadOptions?: { expand?: string | Array; requireTotalCount?: boolean; customQueryParams?: any }): Query; } /** * The EdmLiteral is an object for working with primitive data types from the OData's Abstract Type System that are not supported in JavaScript. */ export class EdmLiteral { constructor(value: string); /** * Gets the EdmLiteral's value converted to a string. */ valueOf(): string; } /** * Contains built-in OData type converters (for String, Int32, Int64, Boolean, Single, Decimal, and Guid) and allows you to register a custom type converter. */ export var keyConverters: any;