@statezero/core
Version:
The type-safe frontend client for StateZero - connect directly to your backend models with zero boilerplate
59 lines (58 loc) • 1.81 kB
TypeScript
/**
* LiveMetric, a simple wrapper that always returns the latest metric value
* using a getter for the value property
*/
export class LiveMetric {
constructor(queryset: any, metricType: any, field?: null);
queryset: any;
metricType: any;
field: any;
get lqs(): import("./querysetStoreRegistry").LiveQueryset;
/**
* Refresh the metric data from the database
* Delegates to the underlying store's sync method
*/
refreshFromDb(): any;
/**
* Getter that always returns the current value from the store
*/
get value(): any;
}
/**
* Registry to manage metric stores
*/
export class MetricRegistry {
_stores: Map<any, any>;
syncManager: any;
clear(): void;
setSyncManager(syncManager: any): void;
/**
* Get all metric stores that match a specific queryset
* @param {Queryset} queryset - The queryset to match
* @returns {Array} Array of metric stores
*/
getAllStoresForQueryset(queryset: Queryset): any[];
_makeKey(metricType: any, queryset: any, field?: null): string;
/**
* Get a metric store for a specific queryset and metric type
*/
getStore(metricType: any, queryset: any, field?: null): any;
/**
* Get a metric value for a specific queryset
*/
getEntity(metricType: any, queryset: any, field?: null): Object | null;
/**
* Set metric ground truth value
*/
setEntity(metricType: any, queryset: any, field: any, value: any): any;
/**
* Sync a specific metric with the server
*/
syncMetric(metricType: any, queryset: any, field?: null): any;
/**
* Get the queryset for a specific key
* Useful for debugging or auditing
*/
getQuerysetForKey(key: any): any;
}
export const metricRegistry: MetricRegistry;