MCPcopy Index your code
hub / github.com/simstudioai/sim / maybeNotifyTableRowLimit

Function maybeNotifyTableRowLimit

apps/sim/lib/table/billing.ts:30–51  ·  view source on GitHub ↗

* 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
)

Source from the content-addressed store, hash-verified

28 * {@link maybeNotifyLimit}. Never throws.
29 */
30async 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.

Callers 1

notifyTableRowUsageFunction · 0.85

Calls 3

maybeNotifyLimitFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected