cs-element
Version:
Advanced reactive data management library with state machines, blueprints, persistence, compression, networking, and multithreading support
77 lines • 3.4 kB
TypeScript
/**
* Реализация менеджера Live queries (реактивных запросов)
*/
import { EventEmitter } from 'eventemitter3';
import { CSElement } from '../core/CSElement';
import { LiveQueryManager, LiveQuery, LiveQueryConfig, LiveQueryStats, LiveQueryBuilder, LiveQueryCallback, LiveQueryErrorCallback, LiveQueryFilter, LiveQueryTransform, LiveQuerySort, QueryOptions } from '../types/live-query-interfaces';
export declare class LiveQueryManagerImpl extends EventEmitter implements LiveQueryManager {
private queries;
private subscriptions;
private stats;
private debounceTimers;
private updateBatches;
private indexes;
private CSElementClass;
constructor();
setCSElementClass(cls: typeof CSElement): void;
createLiveQuery<T = any>(selector: string, options?: QueryOptions, config?: LiveQueryConfig): LiveQuery<T>;
start(queryId: string): void;
stop(queryId: string): void;
getLiveQuery(queryId: string): LiveQuery | undefined;
getAllLiveQueries(): LiveQuery[];
removeLiveQuery(queryId: string): boolean;
updateQuery(queryId: string): void;
updateAllQueries(): void;
addFilter<T>(queryId: string, filter: LiveQueryFilter<T>): void;
removeFilter(queryId: string, filterIndex: number): void;
addTransform<T, R>(queryId: string, transform: LiveQueryTransform<T, R>): void;
setSort<T>(queryId: string, sort: LiveQuerySort<T>): void;
subscribe<T>(queryId: string, callback: LiveQueryCallback<T>): string;
unsubscribe(queryId: string, subscriptionId: string): boolean;
getStats(): LiveQueryStats;
clear(): void;
notifyElementChange(element: CSElement, _changeType: 'create' | 'update' | 'delete'): void;
notifyDataChange(element: CSElement, key: string, _newValue: any, _oldValue: any): void;
private executeQuery;
private performQuery;
private setupQueryWatching;
private stopQueryWatching;
private findAffectedQueries;
private findQueriesUsingDataKey;
private queryAffectedByElement;
private queryUsesDataKey;
private notifySubscribers;
private calculateChangeCount;
private updateSelectorStats;
private updateExecutionTimeStats;
private updateStats;
private calculateMemoryUsage;
private createEmptyStats;
private emitEvent;
}
export declare class LiveQueryBuilderImpl<T = any> implements LiveQueryBuilder<T> {
private _selector;
private _options;
private _config;
private _filters;
private _transforms;
private _sort?;
private _onResults?;
private _onError?;
private manager;
constructor(manager: LiveQueryManager);
selector(selector: string): LiveQueryBuilder<T>;
options(options: QueryOptions): LiveQueryBuilder<T>;
config(config: LiveQueryConfig): LiveQueryBuilder<T>;
filter(filter: LiveQueryFilter<T>): LiveQueryBuilder<T>;
transform<R>(transform: LiveQueryTransform<T, R>): LiveQueryBuilder<R>;
sort(sort: LiveQuerySort<T>): LiveQueryBuilder<T>;
limit(limit: number): LiveQueryBuilder<T>;
debounce(ms: number): LiveQueryBuilder<T>;
cache(ttl?: number): LiveQueryBuilder<T>;
subscribe(callback: LiveQueryCallback<T>): LiveQueryBuilder<T>;
onError(callback: LiveQueryErrorCallback): LiveQueryBuilder<T>;
start(): LiveQuery<T>;
build(): LiveQuery<T>;
}
//# sourceMappingURL=LiveQueryManagerImpl.d.ts.map