import { GraphQLSchema } from "graphql"; import { H3Event } from "h3"; import { ApolloServerOptions } from "@apollo/server"; import { YogaServerOptions } from "graphql-yoga"; import { NPMConfig, Resolvers, ResolversTypes } from "#graphql/server"; import { StandardSchemaV1 } from "nitro-graphql"; //#region src/utils/define.d.ts type Flatten = T extends infer U ? { [K in keyof U]: U[K] } : never; declare function defineSchema>>(config: T): Flatten; declare function defineResolver(resolvers: Resolvers): Resolvers; type ResolverQuery = Resolvers extends { Query: infer Q; } ? Q : never; declare function defineQuery(resolvers?: Resolvers['Query']): Resolvers; declare function defineMutation(resolvers?: Resolvers['Mutation']): Resolvers; declare function defineSubscription(resolvers?: Resolvers['Subscription']): Resolvers; /** * @deprecated Use `defineField` instead. This function will be removed in a future version. */ declare function defineType(resolvers: Resolvers): Resolvers; declare function defineField(resolvers: Resolvers): Resolvers; type DefineServerConfig = T['framework'] extends 'graphql-yoga' ? Partial>> : T['framework'] extends 'apollo-server' ? Partial> : Partial>> | Partial>; declare function defineGraphQLConfig(config: Partial>): Partial>; type DirectiveLocationName = 'QUERY' | 'MUTATION' | 'SUBSCRIPTION' | 'FIELD' | 'FRAGMENT_DEFINITION' | 'FRAGMENT_SPREAD' | 'INLINE_FRAGMENT' | 'VARIABLE_DEFINITION' | 'SCHEMA' | 'SCALAR' | 'OBJECT' | 'FIELD_DEFINITION' | 'ARGUMENT_DEFINITION' | 'INTERFACE' | 'UNION' | 'ENUM' | 'ENUM_VALUE' | 'INPUT_OBJECT' | 'INPUT_FIELD_DEFINITION'; type GraphQLScalarType = 'String' | 'Int' | 'Float' | 'Boolean' | 'ID' | 'JSON' | 'DateTime'; type GraphQLBaseType = GraphQLScalarType | (string & {}); type GraphQLArgumentType = 'String' | 'Int' | 'Float' | 'Boolean' | 'ID' | 'JSON' | 'DateTime' | 'String!' | 'Int!' | 'Float!' | 'Boolean!' | 'ID!' | 'JSON!' | 'DateTime!' | '[String]' | '[String!]' | '[String]!' | '[String!]!' | '[Int]' | '[Int!]' | '[Int]!' | '[Int!]!' | '[Float]' | '[Float!]' | '[Float]!' | '[Float!]!' | '[Boolean]' | '[Boolean!]' | '[Boolean]!' | '[Boolean!]!' | '[ID]' | '[ID!]' | '[ID]!' | '[ID!]!' | '[JSON]' | '[JSON!]' | '[JSON]!' | '[JSON!]!' | '[DateTime]' | '[DateTime!]' | '[DateTime]!' | '[DateTime!]!' | (string & {}); interface DirectiveArgument { /** * GraphQL type for the argument * @example 'String', 'Int!', '[String!]!', 'DateTime', 'JSON' */ type: T; defaultValue?: any; description?: string; } interface DirectiveArg { type: GraphQLArgumentType; defaultValue?: any; description?: string; } interface DirectiveDefinition { name: string; locations: DirectiveLocationName[]; args?: Record; description?: string; isRepeatable?: boolean; transformer?: (schema: GraphQLSchema) => GraphQLSchema; } interface DefineDirectiveConfig { name: string; locations: ReadonlyArray; args?: Record; description?: string; isRepeatable?: boolean; transformer?: (schema: GraphQLSchema) => GraphQLSchema; } /** * Helper function to create directive arguments with proper type inference * @example * args: { * myArg: arg('String!', { defaultValue: 'hello' }) * } */ declare function arg(type: T, options?: { defaultValue?: any; description?: string; }): DirectiveArgument; declare function defineDirective(config: DefineDirectiveConfig): DirectiveDefinition; //#endregion export { DefineDirectiveConfig, DefineServerConfig, DirectiveArgument, DirectiveDefinition, GraphQLArgumentType, GraphQLBaseType, GraphQLScalarType, ResolverQuery, arg, defineDirective, defineField, defineGraphQLConfig, defineMutation, defineQuery, defineResolver, defineSchema, defineSubscription, defineType };