Files
supabase/apps/studio/data/table-rows/keys.ts
Alaister Young af462c0e57 chore: refactor role impersonation (#34827)
* chore: refactor role impersonation

* fix: handle undefined claims in role impersonation SQL generation
2025-04-11 08:17:13 +00:00

23 lines
761 B
TypeScript

import type { GetTableRowsArgs } from './table-rows-query'
type TableRowKeyArgs = Omit<GetTableRowsArgs, 'table'> & { table?: { id?: number } }
export const tableRowKeys = {
tableRows: (
projectRef?: string,
{ table, roleImpersonationState, ...args }: TableRowKeyArgs = {}
) =>
[
'projects',
projectRef,
'table-rows',
table?.id,
'rows',
{ roleImpersonation: roleImpersonationState?.role, ...args },
] as const,
tableRowsCount: (projectRef?: string, { table, ...args }: TableRowKeyArgs = {}) =>
['projects', projectRef, 'table-rows', table?.id, 'count', args] as const,
tableRowsAndCount: (projectRef?: string, tableId?: number) =>
['projects', projectRef, 'table-rows', tableId] as const,
}