diff --git a/apps/docs/app/api/graphql/__snapshots__/route.test.ts.snap b/apps/docs/app/api/graphql/__snapshots__/route.test.ts.snap index 1e48c527862..4b8182a6b61 100644 --- a/apps/docs/app/api/graphql/__snapshots__/route.test.ts.snap +++ b/apps/docs/app/api/graphql/__snapshots__/route.test.ts.snap @@ -99,6 +99,18 @@ enum Language { PYTHON } +"""A document describing how to troubleshoot an issue when using Supabase""" +type TroubleshootingGuide implements SearchResult { + """The title of the troubleshooting guide""" + title: String + + """The URL of the troubleshooting guide""" + href: String + + """The full content of the troubleshooting guide""" + content: String +} + type RootQueryType { """Get the GraphQL schema for this endpoint""" schema: String! diff --git a/apps/docs/resources/globalSearch/globalSearchModel.ts b/apps/docs/resources/globalSearch/globalSearchModel.ts index 9c1c0936c57..7bdd18e72c3 100644 --- a/apps/docs/resources/globalSearch/globalSearchModel.ts +++ b/apps/docs/resources/globalSearch/globalSearchModel.ts @@ -6,6 +6,7 @@ import { supabase, type DatabaseCorrected } from '~/lib/supabase' import { GuideModel } from '../guide/guideModel' import { ReferenceSDKFunctionModel, SDKLanguageValues } from '../reference/referenceSDKModel' import { SearchResultInterface } from './globalSearchInterface' +import { TroubleshootingModel } from '../troubleshooting/troubleshootingModel' export abstract class SearchResultModel { static async search( @@ -59,6 +60,12 @@ function createModelFromMatch({ methodName: metadata.methodName, }) } + case 'github-discussions': + return new TroubleshootingModel({ + title: page_title, + href, + content, + }) default: return null } diff --git a/apps/docs/resources/rootSchema.ts b/apps/docs/resources/rootSchema.ts index 6cdf10bbd70..5d498515e3c 100644 --- a/apps/docs/resources/rootSchema.ts +++ b/apps/docs/resources/rootSchema.ts @@ -9,6 +9,7 @@ import { RootQueryTypeResolvers } from '~/__generated__/graphql' import { searchRoot } from './globalSearch/globalSearchResolver' import { GraphQLObjectTypeGuide } from './guide/guideSchema' import { GraphQLObjectTypeReferenceSDKFunction } from './reference/referenceSDKSchema' +import { GraphQLObjectTypeTroubleshooting } from './troubleshooting/troubleshootingSchema' const GRAPHQL_FIELD_INTROSPECT = 'schema' as const @@ -35,5 +36,9 @@ export const rootGraphQLSchema = new GraphQLSchema({ ...searchRoot, }, }), - types: [GraphQLObjectTypeGuide, GraphQLObjectTypeReferenceSDKFunction], + types: [ + GraphQLObjectTypeGuide, + GraphQLObjectTypeReferenceSDKFunction, + GraphQLObjectTypeTroubleshooting, + ], }) diff --git a/apps/docs/resources/troubleshooting/troubleshootingModel.ts b/apps/docs/resources/troubleshooting/troubleshootingModel.ts new file mode 100644 index 00000000000..e766a42f9ed --- /dev/null +++ b/apps/docs/resources/troubleshooting/troubleshootingModel.ts @@ -0,0 +1,13 @@ +import { type SearchResultInterface } from '../globalSearch/globalSearchInterface' + +export class TroubleshootingModel implements SearchResultInterface { + public title?: string + public href?: string + public content?: string + + constructor({ title, href, content }: { title?: string; href?: string; content?: string }) { + this.title = title + this.href = href + this.content = content + } +} diff --git a/apps/docs/resources/troubleshooting/troubleshootingSchema.ts b/apps/docs/resources/troubleshooting/troubleshootingSchema.ts new file mode 100644 index 00000000000..0e0fce8f358 --- /dev/null +++ b/apps/docs/resources/troubleshooting/troubleshootingSchema.ts @@ -0,0 +1,24 @@ +import { GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql' +import { GraphQLInterfaceTypeSearchResult } from '../globalSearch/globalSearchSchema' +import { TroubleshootingModel } from './troubleshootingModel' + +export const GraphQLObjectTypeTroubleshooting = new GraphQLObjectType({ + name: 'TroubleshootingGuide', + interfaces: [GraphQLInterfaceTypeSearchResult], + isTypeOf: (value: unknown) => value instanceof TroubleshootingModel, + description: 'A document describing how to troubleshoot an issue when using Supabase', + fields: { + title: { + type: GraphQLString, + description: 'The title of the troubleshooting guide', + }, + href: { + type: GraphQLString, + description: 'The URL of the troubleshooting guide', + }, + content: { + type: GraphQLString, + description: 'The full content of the troubleshooting guide', + }, + }, +})