Skip to main content

UsageRollup

@forge/monorepo


@forge/monorepo / backend/src / UsageRollup

Type Alias: UsageRollup

UsageRollup = UsageTotals & object

Defined in: backend/src/persistence/index.ts:486

One tenant's consumption in one bucket.

bucketStart is the ISO instant the bucket opens, truncated to the period — so a bucket is identified by its start rather than by a range, and two writers computing "the hour containing T" agree by construction.

Type Declaration

bucketStart

readonly bucketStart: string

computedAt

readonly computedAt: string

When this bucket was last recomputed. For spotting a rollup job that has stopped running.

currency

readonly currency: string

period

readonly period: RollupPeriod

principalId?

readonly optional principalId?: PrincipalId

Whose bucket this is — absent for the tenant's own total (#175).

On the row rather than only in the query, because a caller holding a mixed list otherwise cannot tell a tenant total from one person's, and adding them together double-counts everything.