Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

chore(api): bump ACUC to v52 and drop credit fields from type (#3987)

firecrawl-spring[bot]47a7f16e8705
diff --git a/apps/api/src/__tests__/routes/check-credits-middleware.test.ts b/apps/api/src/__tests__/routes/check-credits-middleware.test.ts
index 2d74282e9..c716cf300 100644
--- a/apps/api/src/__tests__/routes/check-credits-middleware.test.ts
+++ b/apps/api/src/__tests__/routes/check-credits-middleware.test.ts
@@ -47,7 +47,7 @@ function buildReq(overrides: any = {}): any {
path: "/v1/crawl",
body: { limit: 100 },
auth: { team_id: "team_test", org_id: "org_test" },
- acuc: { adjusted_credits_used: 0 },
+ acuc: {},
...overrides,
};
}
@@ -116,7 +116,7 @@ describe("checkCreditsMiddleware – Autumn overage handling", () => {
checkCreditsMock.mockResolvedValue({ allowed: true, remaining: 100 });
const req = buildReq({
- acuc: { adjusted_credits_used: 0, api_key_id: 4242 },
+ acuc: { api_key_id: 4242 },
});
await runMiddleware(req);
@@ -149,7 +149,6 @@ describe("checkCreditsMiddleware – unverified agent-key 50-credit cap", () =>
function buildUnverifiedReq(overrides: any = {}) {
return buildReq({
acuc: {
- adjusted_credits_used: 0,
_agentSponsor: {
status: "pending",
verification_deadline: new Date(
diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts
index 629c65c9b..f9b4e05bc 100644
--- a/apps/api/src/controllers/auth.ts
+++ b/apps/api/src/controllers/auth.ts
@@ -97,14 +97,8 @@ const mockPreviewACUC: (
extractAgentPreview: 1,
scrapeAgentPreview: 5,
},
- price_credits: 99999999,
price_should_be_graceful: false,
price_associated_auto_recharge_price_id: null,
- credits_used: 0,
- coupon_credits: 99999999,
- adjusted_credits_used: 0,
- remaining_credits: 99999999,
- total_credits_sum: 99999999,
plan_priority: {
bucketLimit: 25,
planModifier: 0.1,
@@ -137,14 +131,8 @@ const mockACUC: () => AuthCreditUsageChunk = () => ({
extractAgentPreview: 99999999,
scrapeAgentPreview: 99999999,
},
- price_credits: 99999999,
price_should_be_graceful: false,
price_associated_auto_recharge_price_id: null,
- credits_used: 0,
- coupon_credits: 99999999,
- adjusted_credits_used: 0,
- remaining_credits: 99999999,
- total_credits_sum: 99999999,
plan_priority: {
bucketLimit: 25,
planModifier: 0.1,
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index 1d8543806..444b6adef 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -1262,14 +1262,8 @@ export type AuthCreditUsageChunk = {
sub_current_period_end: string | null;
sub_user_id: string | null;
price_id: string | null;
- price_credits: number; // credit limit with assoicated price, or free_credits (500) if free plan
price_should_be_graceful: boolean;
price_associated_auto_recharge_price_id: string | null;
- credits_used: number;
- coupon_credits: number; // do not rely on this number to be up to date after calling a billTeam
- adjusted_credits_used: number; // credits this period minus coupons used
- remaining_credits: number;
- total_credits_sum: number;
plan_priority: {
bucketLimit: number;
planModifier: number;
diff --git a/apps/api/src/db/rpc.ts b/apps/api/src/db/rpc.ts
index a8c578f61..59ed4284d 100644
--- a/apps/api/src/db/rpc.ts
+++ b/apps/api/src/db/rpc.ts
@@ -34,7 +34,7 @@ export async function authCreditUsageChunk(
): Promise<AuthCreditUsageChunkRow[]> {
const rows = await execRows<AuthCreditUsageChunkRow>(
database,
- sql`select * from auth_credit_usage_chunk_51(input_key => ${input_key})`,
+ sql`select * from auth_credit_usage_chunk_52(input_key => ${input_key})`,
);
// api_key_id is a bigint column, so the pg driver hands it back as a string.
for (const row of rows) {
@@ -51,7 +51,7 @@ export function authCreditUsageChunkFromTeam(
): Promise<AuthCreditUsageChunkRow[]> {
return execRows(
database,
- sql`select * from auth_credit_usage_chunk_51_from_team(input_team => ${input_team})`,
+ sql`select * from auth_credit_usage_chunk_52_from_team(input_team => ${input_team})`,
);
}