UsageStore: the mechanism UsageRepo implements.
API
@Interface()
export abstract class UsageStore {
abstract insert(r: UsageRecordInsert): void;
abstract bucketByModel(
projectId: string,
f?: UsageFilter,
tiers?: readonly PeakTier[],
): UsageModelSums[];
abstract groupsByModel(
projectId: string,
groupBy: UsageGroupBy,
f?: UsageFilter,
tiers?: readonly PeakTier[],
): UsageGroupModelSums[];
abstract seriesByModel(
projectId: string,
granularity: UsageSeriesGranularity,
f?: UsageFilter,
tiers?: readonly PeakTier[],
): UsageSeriesModelSums[];
abstract toolsByModel(
projectId: string,
f?: UsageFilter,
tiers?: readonly PeakTier[],
): UsageToolModelSums[];
abstract agentSeries(
projectId: string,
granularity: UsageSeriesGranularity,
f?: UsageFilter,
): UsageAgentBucketCount[];
abstract distinctAgentIds(projectId: string): string[];
abstract distinctModels(projectId: string): { provider: string; modelId: string }[];
abstract deleteByProject(projectId: string): void;
}Contract Topology
Static AST wiring across @Module / @Provide / @UseMembers (9)
insert
insert(r: UsageRecordInsert): void@paramr
UsageRecordInsert@returns
voidbucketByModel
bucketByModel(projectId: string, f?: UsageFilter, tiers?: readonly PeakTier[]): UsageModelSums[]@paramprojectId
string@paramf?
UsageFilter@paramtiers?
readonly PeakTier[]@returns
UsageModelSums[]groupsByModel
groupsByModel(projectId: string, groupBy: UsageGroupBy, f?: UsageFilter, tiers?: readonly PeakTier[]): UsageGroupModelSums[]@paramprojectId
string@paramgroupBy
UsageGroupBy@paramf?
UsageFilter@paramtiers?
readonly PeakTier[]@returns
UsageGroupModelSums[]seriesByModel
seriesByModel(projectId: string, granularity: UsageSeriesGranularity, f?: UsageFilter, tiers?: readonly PeakTier[]): UsageSeriesModelSums[]@paramprojectId
string@paramgranularity
UsageSeriesGranularity@paramf?
UsageFilter@paramtiers?
readonly PeakTier[]@returns
UsageSeriesModelSums[]toolsByModel
toolsByModel(projectId: string, f?: UsageFilter, tiers?: readonly PeakTier[]): UsageToolModelSums[]@paramprojectId
string@paramf?
UsageFilter@paramtiers?
readonly PeakTier[]@returns
UsageToolModelSums[]agentSeries
agentSeries(projectId: string, granularity: UsageSeriesGranularity, f?: UsageFilter): UsageAgentBucketCount[]@paramprojectId
string@paramgranularity
UsageSeriesGranularity@paramf?
UsageFilter@returns
UsageAgentBucketCount[]distinctAgentIds
distinctAgentIds(projectId: string): string[]@paramprojectId
string@returns
string[]distinctModels
distinctModels(projectId: string): { provider: string; modelId: string }[]@paramprojectId
string@returns
{ provider: string; modelId: string }[]deleteByProject
deleteByProject(projectId: string): void@paramprojectId
string@returns
void