import type { Client } from "pg"; import type { BackupConfig } from "./config.js"; /** * Supabase egress 定价(2026-07-10 经核实,来源见 README「Egress & cost」)。 * 单价 = 超出计划包含额度后的每 GB 价;included = 各计划每月包含的 egress。 * 备份 = 把数据拉出 Supabase = egress,计入用户账单。这是 PRD §4.3 的上线否决项: * 让用户"我们帮你算过账"而不是收到意外账单。 */ export interface EgressPricing { pricePerGb: number; includedGb: number; planLabel: string; hardCap: boolean; spendCap?: boolean; } /** * 要转储的 schema 里所有表的磁盘占用。pg_total_relation_size 含索引+TOAST,是 egress * 上界(真实转储经压缩、不含索引,更小)。备份也拿它估转储体积来定分片大小。 * 直接传 relid 而不是按名字转 regclass:统计视图读出来之后表被并发删掉, * 按名字转会报错,按 oid 查只会得到 NULL。 */ export declare function relationBytes(client: Client, schemas: string[]): Promise; export interface EgressProjection { dbBytes: number; storageBytes: number; perRunGb: number; rows: Array<{ frequency: string; runsPerMonth: number; monthlyEgressGb: number; overageGb: number; monthlyCost: number; }>; } export declare function project(dbBytes: number, storageBytes: number, pricing: EgressPricing): EgressProjection; /** 付费计划超出 egress 额度时会怎样:Pro 看 Spend Cap(默认开,不计费但可能被限),Team 没有 Spend Cap、直接计费 */ export declare function overageNote(pricing: EgressPricing): string; export declare function runEstimate(config: BackupConfig, pricing: EgressPricing): Promise;