UNPKG

@seasketch/geoprocessing

Version:

Geoprocessing and reporting framework for SeaSketch 2.0

30 lines (29 loc) 1.13 kB
import { Metric } from "../../../src/types/index.js"; /** * Manage a metrics datasource */ /** * Reads metrics from disk, validates them * If metrics file not exist then start a new one and ensure directory exists */ export declare function readMetrics(filePath: string): { value: number; classId: string | null; metricId: string; geographyId: string | null; sketchId: string | null; groupId: string | null; extra?: Record<string, import("../../../src/types/base.js").JSONValue> | undefined; }[]; /** * Writes metrics to disk, sorting and rekeying before writing easier diffing */ export declare function writeMetrics(metrics: Metric[], filePath: string): void; /** * Creates or updates metrics on disk, sorting and rekeying before writing for easier diffing * @param inputMetrics - new metrics to add * @param matcher - old metrics to replace * @param filePath - path to metrics file * @returns - full set of updated metrics */ export declare function createOrUpdateMetrics(inputMetrics: Metric[], matcher: ((m: Metric) => boolean) | undefined, filePath: string): Promise<Metric[]>;