mirror of
https://github.com/supabase/supabase.git
synced 2026-07-03 10:14:22 +08:00
* chore: refactor role impersonation * fix: handle undefined claims in role impersonation SQL generation
23 lines
761 B
TypeScript
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,
|
|
}
|