/** * @fileoverview FBI Crime Data Explorer API service. * Wraps the CDE base URL under a single init/accessor pattern. * All methods accept a Context for correlated logging and respect ctx.signal. * * Backend status (verified 2026-05-25; agency directory, hate crime, arrest, NIBRS 2026-10-22; * police employees 2026-11-16): * - UCR base (api.usa.gov/crime/fbi/ucr): DECOMMISSIONED — Cloud Foundry route removed. * - CDE base (api.usa.gov/crime/fbi/cde): PARTIALLY ACTIVE. * Working: /leoka/ytd, /leoka/monthly, /summarized/{scope}/{offense}, /agency/byStateAbbr/{state}, * /hate-crime/{scope}/{bias}, /arrest/{scope}/{offense}, /nibrs/{scope}/{offense}, * /pe, /pe/{state}, /pe/agency/{ori} * Dead: agency profiles, estimates, participation, human trafficking, arson, code tables * @module services/fbi-api/fbi-api-service */ import { type Context } from '@cyanheads/mcp-ts-core'; import type { AppConfig } from '@cyanheads/mcp-ts-core/config'; import type { StorageService } from '@cyanheads/mcp-ts-core/storage'; import type { ServerConfig } from '../../config/server-config.js'; import { type CdeScopedWindow, type CdeYearWindow, type FbiArrestTotals, type FbiDirectoryAgency, type FbiHateCrimeTotals, type FbiLeokaChartData, type FbiMonthlyCounts, type FbiNibrsTotals, type FbiPoliceEmployees, type FbiSummarizedResponse } from './types.js'; export declare class FbiApiService { private readonly cdeBase; private readonly apiKey; private readonly timeoutMs; /** Takes the connection settings only; FBI_CLAMP_LIMITS belongs to fbi_search_agencies. */ constructor(_appConfig: AppConfig, _storage: StorageService, serverConfig: Omit); private buildUrl; /** * GET a CDE URL and parse its JSON body. An HTML page is retried as the upstream being * unavailable; any other body that is not JSON is malformed and fails once, unretried. * @throws SerializationError when the body is not JSON. */ private get; /** * Fetch one state's agency directory, flattened from its county-keyed groups. * Returns null when CDE has no directory for the code (HTTP 200 with `counties: null`). * CDE reads lowercase codes as unknown, so pass the code uppercased. * @throws SerializationError when the response matches neither documented shape. */ getAgencyDirectory(stateAbbr: string, ctx: Context): Promise; getLeokaYtd(params: { year: number; }, ctx: Context): Promise; getLeokaMonthly(params: { year: number; month: number; }, ctx: Context): Promise; private getSummarized; getSummarizedNational(offense: string, params: { from: string; to: string; }, ctx: Context): Promise; getSummarizedState(stateAbbr: string, offense: string, params: { from: string; to: string; }, ctx: Context): Promise; getSummarizedAgency(ori: string, offense: string, params: { from: string; to: string; }, ctx: Context): Promise; /** * Fetch the annual law enforcement employee series for one scope and whole-year window. * @throws SerializationError when the payload does not match the documented shape. */ getPoliceEmployees(window: CdeYearWindow, ctx: Context): Promise; /** * Fetch one `type=totals` breakdown and validate it against the endpoint's schema. * @throws SerializationError when the payload does not match `schema`. */ private getTotals; /** Hate crime incident and offense category totals; `bias` is `all` or a CDE bias code. */ getHateCrimeTotals(window: CdeScopedWindow, bias: string, ctx: Context): Promise; /** Arrest category totals; `offense` is `all` or a CDE numeric arrest offense code. */ getArrestTotals(window: CdeScopedWindow, offense: string, ctx: Context): Promise; /** NIBRS victim, offender, and offense category totals for one CDE NIBRS offense code. */ getNibrsTotals(window: CdeScopedWindow, offense: string, ctx: Context): Promise; /** * Fetch the `type=counts` month series for the path and selector of a totals call. `actuals` is * null when CDE does not recognize the state or ORI. * @throws SerializationError when the payload does not match the endpoint's shape. */ getCounts(endpoint: 'hate-crime' | 'arrest' | 'nibrs', window: CdeScopedWindow, selector: string, ctx: Context): Promise; } export declare function initFbiApiService(appConfig: AppConfig, storage: StorageService, serverConfig: Omit): void; export declare function getFbiApiService(): FbiApiService; //# sourceMappingURL=fbi-api-service.d.ts.map