UNPKG

@statezero/core

Version:

The type-safe frontend client for StateZero - connect directly to your backend models with zero boilerplate

56 lines (55 loc) 1.65 kB
/** * Store for managing a single metric with optimistic updates */ export class MetricStore { constructor(metricType: any, modelClass: any, queryset: any, field: null | undefined, ast: null | undefined, fetchFn: any); metricType: any; modelClass: any; queryset: any; field: any; ast: any; fetchFn: any; groundTruthValue: any; isSyncing: boolean; strategy: import("../metrics/metricOptCalcs").MetricCalculationStrategy; operations: any[]; confirmedOps: Set<any>; metricCache: Cache; _lastCalculatedValue: any; reset(): void; get cacheKey(): string; /** * Add an operation to this metric store * @param {Operation} operation - The operation to add */ addOperation(operation: Operation): void; /** * Update an operation in this metric store * @param {Operation} operation - The operation to update */ updateOperation(operation: Operation): void; /** * Confirm an operation in this metric store * @param {Operation} operation - The operation to confirm */ confirm(operation: Operation): void; /** * Reject an operation in this metric store * @param {Operation} operation - The operation to reject */ reject(operation: Operation): void; onHydrated(): void; setCache(): void; clearCache(): void; setGroundTruth(value: any): void; /** * Render the metric with current operations * @returns {any} Calculated metric value */ render(): any; /** * Sync metric with server */ sync(): Promise<any>; } import { Cache } from '../cache/cache.js';