1
0
Fork 0
mirror of synced 2024-06-30 20:10:54 +12:00
budibase/packages/types/src/documents/global/quotas.ts

59 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-09-28 20:56:45 +13:00
import { MonthlyQuotaName, StaticQuotaName } from "../../sdk"
export enum BreakdownQuotaName {
ROW_QUERIES = "rowQueries",
DATASOURCE_QUERIES = "datasourceQueries",
AUTOMATIONS = "automations",
}
export const StoredByAppQuotaNames = [
StaticQuotaName.ROWS,
MonthlyQuotaName.QUERIES,
MonthlyQuotaName.AUTOMATIONS,
]
export const NamesToBreakdown = [
MonthlyQuotaName.QUERIES,
MonthlyQuotaName.AUTOMATIONS,
]
export interface Breakdown {
parent: MonthlyQuotaName
values: {
[key: string]: number
}
}
export type Monthly = {
[MonthlyQuotaName.QUERIES]: number
[MonthlyQuotaName.AUTOMATIONS]: number
[MonthlyQuotaName.DAY_PASSES]: number
breakdown?: {
[key in BreakdownQuotaName]?: Breakdown
}
}
export interface UsageInternal {
usageQuota: {
[key in StaticQuotaName]: number
}
monthly: {
[key: string]: Monthly
}
}
export interface QuotaUsage extends UsageInternal {
_id: string
_rev?: string
quotaReset: string
apps?: {
[key: string]: UsageInternal
}
}
export type QuotaValues = {
total: number
app?: number
breakdown?: number
}