fix: metering typos (#1754)

This commit is contained in:
Daniel Salazar
2025-10-15 10:39:18 -07:00
committed by GitHub
parent e51d0c4600
commit 24a51c59ae
5 changed files with 11 additions and 11 deletions

View File

@@ -13,8 +13,8 @@ extension.on('metering:registerAvailablePolicies', async (
console.warn('WARNING!!! unlimitedUsage is enabled, this is not recommended for production use');
event.availablePolicies.push({
id: 'unlimited',
monthUsageAllowence: 500_000_000 * 100_000_000, // unless you're like, jeff's, mark's and elon's illegitamate son, you probably won't hit $5m a month
monthlyStorageAllowence: 100_000 * 1024 * 1024, // 100MiB
monthUsageAllowance: 500_000_000 * 100_000_000, // unless you're like, jeff's, mark's and elon's illegitamate son, you probably won't hit $5m a month
monthlyStorageAllowance: 100_000 * 1024 * 1024, // 100MiB
});
}
});

View File

@@ -10,10 +10,10 @@ extension.get('/meteringAndBilling/usage', { subdomain: 'api' }, async (req, res
throw Error('actor not found in context');
}
const actorUsagePromise = meteringAndBillingService.getActorCurrentMonthUsageDetails(actor);
const actorAllowenceInfoPromise = meteringAndBillingService.getAllowedUsage(actor);
const actorAllowanceInfoPromise = meteringAndBillingService.getAllowedUsage(actor);
const [actorUsage, allowenceInfo] = await Promise.all([actorUsagePromise, actorAllowenceInfoPromise]);
res.status(200).json({ ...actorUsage, allowenceInfo });
const [actorUsage, alowanceInfo] = await Promise.all([actorUsagePromise, actorAllowanceInfoPromise]);
res.status(200).json({ ...actorUsage, alowanceInfo });
return;
});

View File

@@ -220,8 +220,8 @@ export class MeteringAndBillingService {
const [userSubscription, userPolicyAddons, currentMonthUsage] = await Promise.all([userSubscriptionPromise, userPolicyAddonsPromise, currentUsagePromise]);
return {
remaining: Math.max(0, userSubscription.monthUsageAllowence + (userPolicyAddons?.purchasedCredits || 0) - currentMonthUsage.usage.total),
monthUsageAllowence: userSubscription?.monthUsageAllowence,
remaining: Math.max(0, userSubscription.monthUsageAllowance + (userPolicyAddons?.purchasedCredits || 0) - currentMonthUsage.usage.total),
monthUsageAllowance: userSubscription?.monthUsageAllowance,
userPolicyAddons,
};
}

View File

@@ -2,6 +2,6 @@ import { toMicroCents } from "../utils";
export const REGISTERED_USER_FREE = {
id: 'user_free',
monthUsageAllowence: toMicroCents(0.50),
monthlyStorageAllowence: 100 * 1024 * 1024, // 100MiB
monthUsageAllowance: toMicroCents(0.50),
monthlyStorageAllowance: 100 * 1024 * 1024, // 100MiB
};

View File

@@ -2,6 +2,6 @@ import { toMicroCents } from "../utils";
export const TEMP_USER_FREE = {
id: 'temp_free',
monthUsageAllowence: toMicroCents(0.25),
monthlyStorageAllowence: 100 * 1024 * 1024, // 100MiB
monthUsageAllowance: toMicroCents(0.25),
monthlyStorageAllowance: 100 * 1024 * 1024, // 100MiB
};