import { type InsightsCallsQuery, type InsightsCallsResponse, type InsightsUsageBucket, type InsightsUsageQuery, type InsightsUsageRange, type InsightsUsageResponse } from "@opengeni/contracts/insights-usage"; import { type Database } from "./database.js"; type Scope = { accountId: string; workspaceId: string | null; now: Date; /** Internal, authenticated sessions:read authority supplied by Core; not wire query fields. */ detailsWorkspaceIds?: readonly string[]; /** Only the existing account-scoped API-key authority proof may establish this. */ detailsSharedWorkspaces?: boolean; }; /** Read-only cache invalidation through committed session activity. * Every session write stamps sessions.activity_xid with its writer's xid, so the * (count, max, sum) fingerprint of the workspace's visible activity xids changes * whenever a session is created, written, or deleted, including a late commit of * a lower xid. The cluster-wide snapshot is not used: unrelated writes anywhere * would change it and the cache would never hit. * No cached authorization: callers must establish the normal scope on every read. * Missing/denied clock metadata disables caching rather than reusing an old result. */ export declare function readInsightsResponseCacheFence(db: Database, scope: Pick): Promise; /** The ranges this reader answers, advertised on every usage response. */ export declare const INSIGHTS_USAGE_SERVED_RANGES: readonly InsightsUsageRange[]; /** See resolveInsightsUsageWindow: one window rule for every Insights reader. */ export declare function insightsUsageWindow(selection: { range: InsightsUsageRange; from?: string | undefined; to?: string | undefined; }, now: Date): { since: Date; until: Date; priorSince: Date; priorUntil: Date; bucket: InsightsUsageBucket; }; /** One shared read shape for workspace and organization routes; writable primary only. */ export declare function readInsightsUsage(db: Database, input: Scope & { query: InsightsUsageQuery; }): Promise; export declare class InvalidInsightsCallsCursorError extends Error { constructor(); } /** Visible details only; cursor and all filters are inside the bounded raw read. */ export declare function readInsightsCalls(db: Database, input: Scope & { query: InsightsCallsQuery; }): Promise; export {};