Files
supabase/apps/studio/data/content/keys.ts
T
Joshen Lim 4425e05f04 Update SQL editor search to return a flat list (#33064)
* Update SQL editor search to return a flat list

* Open folder when clicking on a snippet from searching and snippet belongs to a folder

* Update snipet page limit

* Set keep previous data true for count

* Add hover card for SQL search list

* Fix issues from feedback

* Make count loader less jarring
2025-01-27 15:40:51 +08:00

50 lines
1.7 KiB
TypeScript

import type { ContentType } from './content-query'
import type { SqlSnippet } from './sql-snippets-query'
export const contentKeys = {
allContentLists: (projectRef: string | undefined) => ['projects', projectRef, 'content'] as const,
infiniteList: (
projectRef: string | undefined,
options: {
type: ContentType | undefined
name: string | undefined
limit?: number
sort?: string
}
) => ['projects', projectRef, 'content-infinite', options] as const,
list: (
projectRef: string | undefined,
options: { type?: ContentType; name?: string; limit?: number }
) => ['projects', projectRef, 'content', options] as const,
sqlSnippets: (
projectRef: string | undefined,
options?: {
sort?: 'inserted_at' | 'name'
name?: string
visibility?: SqlSnippet['visibility']
favorite?: boolean
}
) => ['projects', projectRef, 'content', 'sql', options].filter(Boolean),
folders: (
projectRef: string | undefined,
options?: { sort?: 'inserted_at' | 'name'; name?: string }
) => ['projects', projectRef, 'content', 'folders', options].filter(Boolean),
folderContents: (
projectRef: string | undefined,
id?: string,
options?: { sort?: 'inserted_at' | 'name'; name?: string }
) => ['projects', projectRef, 'content', 'folders', id, options].filter(Boolean),
resource: (projectRef: string | undefined, id?: string) =>
['projects', projectRef, 'content', id] as const,
count: (
projectRef: string | undefined,
type?: string,
options?: {
cumulative?: boolean
visibility?: SqlSnippet['visibility']
favorite?: boolean
name?: string
}
) => ['projects', projectRef, 'content', 'count', type, options].filter(Boolean),
}