MCPcopy
hub / github.com/CodebuffAI/codebuff / ensureSubscriberBlockGrant

Function ensureSubscriberBlockGrant

packages/billing/src/subscription.ts:429–441  ·  view source on GitHub ↗
(params: {
  userId: string
  logger: Logger
})

Source from the content-addressed store, hash-verified

427 * Returns the block grant result if the user has an active subscription, null otherwise.
428 */
429export async function ensureSubscriberBlockGrant(params: {
430 userId: string
431 logger: Logger
432}): Promise<BlockGrantResult | null> {
433 const { userId, logger } = params
434
435 const subscription = await getActiveSubscription({ userId, logger })
436 if (!subscription) {
437 return null
438 }
439
440 return ensureActiveBlockGrant({ userId, subscription, logger })
441}
442
443// ---------------------------------------------------------------------------
444// Rate limiting

Callers 2

checkCreditsAndChargeFunction · 0.85
postChatCompletionsFunction · 0.85

Calls 2

getActiveSubscriptionFunction · 0.85
ensureActiveBlockGrantFunction · 0.85

Tested by

no test coverage detected