feat: add usage alerts schema and database support

This commit is contained in:
Owen Greenhalgh
2026-03-19 10:44:27 +00:00
parent acdec73cd2
commit 175cfb006d
11 changed files with 61 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ import {
} from "./entityBillingControls.js";
import { PurchaseLimitIntervalEnum } from "./purchaseLimitInterval.js";
import { type DbSpendLimit, DbSpendLimitSchema } from "./spendLimit.js";
import { type DbUsageAlert, DbUsageAlertSchema } from "./usageAlert.js";
export const AutoTopupPurchaseLimitSchema = z.object({
interval: PurchaseLimitIntervalEnum.meta({
@@ -45,6 +46,9 @@ export const CustomerBillingControlsSchema = z.object({
spend_limits: z.array(DbSpendLimitSchema).optional().meta({
description: "List of overage spend limits per feature.",
}),
usage_alerts: z.array(DbUsageAlertSchema).optional().meta({
description: "List of usage alert configurations per feature.",
}),
});
export const CustomerBillingControlsParamsSchema =
@@ -85,9 +89,10 @@ export type CustomerBillingControlsParams = z.input<
typeof CustomerBillingControlsParamsSchema
>;
export { EntityBillingControlsSchema, DbSpendLimitSchema };
export { EntityBillingControlsSchema, DbSpendLimitSchema, DbUsageAlertSchema };
export type {
EntityBillingControls,
EntityBillingControlsParams,
DbSpendLimit,
DbUsageAlert,
};