(params: {
userId: string
logger: Logger
})
| 427 | * Returns the block grant result if the user has an active subscription, null otherwise. |
| 428 | */ |
| 429 | export 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 |
no test coverage detected