import { TFunction } from "i18next"; import { ExternalRasterDatasource, ExternalVectorDatasource, InternalVectorDatasource, InternalRasterDatasource, Project, SupportedFormats, VectorDatasource, RasterDatasource, Objective, Objectives, MetricGroup, MetricGroups, Geography, Datasource, GeoprocessingJsonConfig, Metric, Package, ImportRasterDatasourceConfig, ImportVectorDatasourceConfig } from "../types/index.js"; export interface ProjectClientConfig { basic: any; datasources: any; metricGroups: any; geographies: any; objectives: any; package: any; geoprocessing: any; precalc: any; } interface DataBucketUrlOptions { local?: boolean; port?: number; subPath?: string; } export interface ProjectClientInterface { getDatasourceById(datasourceId: string): Datasource; getVectorDatasourceById(datasourceId: string): VectorDatasource; getRasterDatasourceById(datasourceId: string): RasterDatasource; dataBucketUrl(options: DataBucketUrlOptions): string; getDatasourceUrl(ds: Datasource | VectorDatasource | InternalVectorDatasource | ExternalVectorDatasource | RasterDatasource | ExternalRasterDatasource | InternalRasterDatasource | ImportRasterDatasourceConfig | ImportVectorDatasourceConfig): any; } /** * Client for reading project configuration/metadata. */ export declare class ProjectClientBase implements ProjectClientInterface { private _project; private _datasources; private _metricGroups; private _geographies; private _objectives; private _package; private _geoprocessing; private _precalc; constructor(config: ProjectClientConfig); /** Returns typed config from project.json */ get basic(): Project; /** Returns typed config from datasources.json */ get datasources(): Datasource[]; /** Returns internal datasources from datasources.json */ get internalDatasources(): Datasource[]; /** Return external datasources from datasources.json */ get externalDatasources(): Datasource[]; /** Returns typed config from geographies.json */ get geographies(): Geography[]; /** Returns typed config from metrics.json */ get metricGroups(): MetricGroups; /** Returns precalculated metrics from precalc.json */ get precalc(): Metric[]; /** Returns typed config from objectives.json */ get objectives(): Objectives; /** Returns typed config from package.json */ get package(): Package; /** Returns typed config from geoprocessing.json */ get geoprocessing(): GeoprocessingJsonConfig; /** * Returns URL to dataset bucket for project. In test environment or if local parameter is true, will * return local URL expected to serve up dist data folder */ dataBucketUrl(options?: DataBucketUrlOptions): string; getFgbPath(ds: Datasource | VectorDatasource | InternalVectorDatasource | ExternalVectorDatasource | RasterDatasource | ExternalRasterDatasource | InternalRasterDatasource | ImportRasterDatasourceConfig | ImportVectorDatasourceConfig): string; getDatasourceUrl(ds: Datasource | VectorDatasource | InternalVectorDatasource | ExternalVectorDatasource | RasterDatasource | ExternalRasterDatasource | InternalRasterDatasource | ImportRasterDatasourceConfig | ImportVectorDatasourceConfig, options?: { format?: SupportedFormats; local?: boolean; port?: number; subPath?: string; }): string; /** Returns Datasource given datasourceId */ getDatasourceById(datasourceId: string): Datasource; /** Returns VectorDatasource given datasourceId, throws if not found */ getVectorDatasourceById(datasourceId: string): VectorDatasource; /** Returns InternalVectorDatasource given datasourceId, throws if not found */ getInternalVectorDatasourceById(datasourceId: string): InternalVectorDatasource; /** Returns ExternalVectorDatasource given datasourceId, throws if not found */ getExternalVectorDatasourceById(datasourceId: string): ExternalVectorDatasource; /** Returns RasterDatasource given datasourceId, throws if not found */ getRasterDatasourceById(datasourceId: string): RasterDatasource; /** Returns InternalRasterDatasource given datasourceId, throws if not found */ getInternalRasterDatasourceById(datasourceId: string): InternalRasterDatasource; /** Returns ExternalRasterDatasource given datasourceId, throws if not found */ getExternalRasterDatasourceById(datasourceId: string): ExternalRasterDatasource; /** * Returns project geography matching the provided ID, with optional fallback geography using fallbackGroup parameter * @param geographyId The geography ID to search for * @param options * @param options.fallbackGroup The default group name to lookup if no geographyId is provided. expects there is only one geography with that group name * @returns * @throws if geography does not exist */ getGeographyById(geographyId?: string, options?: { fallbackGroup?: string; }): Geography; /** * @param group the name of the geography group * @returns geographies with group name assigned */ getGeographyByGroup(group: string): Geography[]; /** Returns Objective given objectiveId */ getObjectiveById(objectiveId: string): Objective; /** Returns MetricGroup given metricId, optional translating display name, given i18n t function */ getMetricGroup(metricId: string, t?: TFunction): MetricGroup; /** * Simple helper that given MetricGroup, returns a consistent ID string for a percent metric, defaults to metricId + 'Perc' added to the end * @param mg - the MetricGroup * @returns - ID string */ getMetricGroupPercId(mg: MetricGroup): string; /** * Returns Objectives for MetricGroup * If at least one class has an objective assigned, then it returns those, missing classes with no objective get the top-level objective * If no class-level objectives are found, then it returns the top-level objective * If no objectives are found, returns an empty array * Given i18n t function it will also translate the short description * @param metricGroup * @param t * @returns */ getMetricGroupObjectives(metricGroup: MetricGroup, t?: TFunction): Objective[]; /** * Returns datasource for given MetricGroup. * If classId is provided, returns class-level datasource if assigned, otherwise falls back to top-level metricGroup datasource * @param metricGroup - metricGroup to get datasource for * @param options.classId - metricGroup class to get datasource for * @returns the datasource object * @throws if class does not exist in metric group with given classId * @throws if datasourceId is missing for metricGroup and class */ getMetricGroupDatasource(metricGroup: MetricGroup, options?: { classId?: string; }): Datasource; /** * Returns classKey for given metric group, class-level if available, otherwise metricGroup level if not * @param metricGroup - metricGroup to search for class and classKey * @param options.classId - optional data class ID to specifically get classKey for * @returns the classKey name or undefined * @throws if class does not exist in metric group with given classId */ getMetricGroupClassKey(metricGroup: MetricGroup, options?: { classId?: string; }): string | undefined; /** * Returns precalc metrics from precalc.json. Optionally filters down to specific metricGroup and geographyId * @param mg MetricGroup to get precalculated metrics for * @param metricId string, "area", "count", or "sum" * @param geographyId string, geographyId to get precalculated metrics for * @returns Metric[] of precalculated metrics */ getPrecalcMetrics(mg?: MetricGroup, metricId?: string, geographyId?: string): Metric[]; } export default ProjectClientBase;