mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Problem `@graphql-codegen/cli` and related packages in `apps/studio` and `apps/docs` were pinned to old major versions (`cli` 5.0.5, `typescript` 4.1.6, `typescript-resolvers` 4.5.0). ## Solution - Bump `@graphql-codegen/cli` to `^7.0.0` and `@graphql-codegen/typescript-resolvers` to `^6.0.0`. Drop the explicit `@graphql-codegen/typescript` dependency from `apps/docs`. - Regenerate the Studio GraphQL output in `apps/studio/data/graphql/` with the new codegen. The generated files now include an `index.ts` export change, and `graphql.ts` is much smaller. - Refresh `apps/studio/scripts/schema.graphql`, which picks up the new `ManagementApiReference` search result type. - Update `.prettierignore` (ignore `apps/studio/.output`, `apps/studio/dist`, and all of `apps/ui-library/public`) and run Prettier on the regenerated files. ## Review instructions 1. Check the dependency bumps in `apps/studio/package.json` and `apps/docs/package.json`. 2. Re-run the Studio codegen and confirm it produces no diff in `apps/studio/data/graphql/`. 3. Run `pnpm typecheck` and confirm the GraphQL consumers in Studio still compile. ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
|
|
import { contentApiKeys } from './keys'
|
|
import { executeGraphQL } from '@/data/graphql/execute'
|
|
import { graphql } from '@/data/graphql/gql'
|
|
import type { Service } from '@/data/graphql/graphql'
|
|
import { UseCustomQueryOptions } from '@/types'
|
|
|
|
const ErrorCodeQuery = graphql(`
|
|
query ErrorCodeQuery($code: String!, $service: Service) {
|
|
errors(code: $code, service: $service) {
|
|
nodes {
|
|
code
|
|
service
|
|
message
|
|
}
|
|
}
|
|
}
|
|
`)
|
|
|
|
interface Variables {
|
|
code: string
|
|
service?: Service
|
|
}
|
|
|
|
async function getErrorCodeDescriptions({ code, service }: Variables, signal?: AbortSignal) {
|
|
return await executeGraphQL(ErrorCodeQuery, { variables: { code, service }, signal })
|
|
}
|
|
|
|
type ErrorCodeDescriptionsData = Awaited<ReturnType<typeof getErrorCodeDescriptions>>
|
|
type ErrorCodeDescriptionsError = unknown
|
|
|
|
export const useErrorCodesQuery = <TData = ErrorCodeDescriptionsData>(
|
|
variables: Variables,
|
|
{
|
|
enabled = true,
|
|
...options
|
|
}: UseCustomQueryOptions<ErrorCodeDescriptionsData, ErrorCodeDescriptionsError, TData> = {}
|
|
) => {
|
|
return useQuery<ErrorCodeDescriptionsData, ErrorCodeDescriptionsError, TData>({
|
|
queryKey: contentApiKeys.errorCodes(variables),
|
|
queryFn: ({ signal }) => getErrorCodeDescriptions(variables, signal),
|
|
enabled,
|
|
retry: false,
|
|
staleTime: Infinity,
|
|
...options,
|
|
})
|
|
}
|