* Best-effort table row-limit email after an accepted insert. Resolves the * workspace's billed account, then delegates scope resolution + dedup + send to * maybeNotifyLimit. Never throws.
( workspaceId: string, projectedRowCount: number, limit: number )
| 28 | * {@link maybeNotifyLimit}. Never throws. |
| 29 | */ |
| 30 | async function maybeNotifyTableRowLimit( |
| 31 | workspaceId: string, |
| 32 | projectedRowCount: number, |
| 33 | limit: number |
| 34 | ): Promise<void> { |
| 35 | try { |
| 36 | const billedUserId = await getWorkspaceBilledAccountUserId(workspaceId) |
| 37 | if (!billedUserId) return |
| 38 | |
| 39 | await maybeNotifyLimit({ |
| 40 | category: 'tables', |
| 41 | billedUserId, |
| 42 | workspaceId, |
| 43 | currentUsage: projectedRowCount, |
| 44 | limit, |
| 45 | usageLabel: `${projectedRowCount.toLocaleString('en-US')} rows`, |
| 46 | limitLabel: `${limit.toLocaleString('en-US')} rows`, |
| 47 | }) |
| 48 | } catch (error) { |
| 49 | logger.error('Error evaluating table row-limit notification:', error) |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Fire-and-forget the table row-limit threshold email for an accepted insert. |
no test coverage detected