1
0
Fork 0
mirror of synced 2024-06-28 02:50:50 +12:00
budibase/packages/types/src/documents/global/quotas.ts

81 lines
1.6 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",
}
2022-09-28 23:57:58 +13:00
export const APP_QUOTA_NAMES = [
2022-09-28 20:56:45 +13:00
StaticQuotaName.ROWS,
MonthlyQuotaName.QUERIES,
MonthlyQuotaName.AUTOMATIONS,
]
2022-09-28 23:57:58 +13:00
export const BREAKDOWN_QUOTA_NAMES = [
2022-09-28 20:56:45 +13:00
MonthlyQuotaName.QUERIES,
MonthlyQuotaName.AUTOMATIONS,
]
2022-09-28 23:57:58 +13:00
export interface UsageBreakdown {
2022-09-28 20:56:45 +13:00
parent: MonthlyQuotaName
values: {
[key: string]: number
}
}
2022-10-08 01:57:10 +13:00
export type QuotaTriggers = {
[key: string]: string | undefined
}
2022-10-07 04:03:47 +13:00
export interface StaticUsage {
[StaticQuotaName.APPS]: number
[StaticQuotaName.PLUGINS]: number
[StaticQuotaName.USER_GROUPS]: number
[StaticQuotaName.ROWS]: number
2022-10-08 01:57:10 +13:00
triggers: {
[key in StaticQuotaName]?: QuotaTriggers
}
2022-10-07 04:03:47 +13:00
}
export interface MonthlyUsage {
2022-09-28 20:56:45 +13:00
[MonthlyQuotaName.QUERIES]: number
[MonthlyQuotaName.AUTOMATIONS]: number
[MonthlyQuotaName.DAY_PASSES]: number
2022-10-08 01:57:10 +13:00
triggers: {
[key in MonthlyQuotaName]?: QuotaTriggers
}
2022-09-28 20:56:45 +13:00
breakdown?: {
2022-09-28 23:57:58 +13:00
[key in BreakdownQuotaName]?: UsageBreakdown
2022-09-28 20:56:45 +13:00
}
}
2022-09-28 23:57:58 +13:00
export interface BaseQuotaUsage {
2022-10-07 04:03:47 +13:00
usageQuota: StaticUsage
2022-09-28 20:56:45 +13:00
monthly: {
2022-09-28 23:57:58 +13:00
[key: string]: MonthlyUsage
2022-09-28 20:56:45 +13:00
}
}
2022-09-28 23:57:58 +13:00
export interface QuotaUsage extends BaseQuotaUsage {
2022-09-28 20:56:45 +13:00
_id: string
_rev?: string
quotaReset: string
apps?: {
2022-09-28 23:57:58 +13:00
[key: string]: BaseQuotaUsage
2022-09-28 20:56:45 +13:00
}
}
2022-10-08 01:57:10 +13:00
export type SetUsageValues = {
total: number
app?: number
breakdown?: number
triggers?: QuotaTriggers
}
2022-09-28 23:57:58 +13:00
export type UsageValues = {
2022-09-28 20:56:45 +13:00
total: number
app?: number
breakdown?: number
}