import { PrismaClientInput, PrismaSchemaConfig } from 'nexus-prisma/dist/types' import Express from 'express' import { Server as HttpServer } from 'http' export type MaybePromise = Promise | T export type DatamodelInfo = PrismaSchemaConfig['prisma']['datamodelInfo'] export type InputPrismaConfig = { /** * The default exported object generated by `nexus-prisma-generate` * * Import it from the output directory generated by `nexus-prisma-generate` */ datamodelInfoPath?: string /** * Instance of the prisma-client, either passed statically * or returned from the context defined in your GraphQL server * * @default ./.yoga/prisma-client/index.ts */ client?: PrismaClientInput } export type InputOutputFilesConfig = { /** * Path to the generated typings * @default ./.yoga/nexus.ts */ typegenPath?: string /** * Path to the generated schema * @default ./src/schema.graphql */ schemaPath?: string } export type InputConfig = { /** * Path to the resolvers directory. * **Path has to exist** * @default ./src/graphql/ */ resolversPath?: string /** * Path to the `context.ts` file to inject a context into your graphql resolvers. **If provided, path has to exist** * @default ./src/context.ts */ contextPath?: string /** * Path to the `types.ts` file to override nexus default types **If provided, path has to exist** * @default ./src/types.ts */ typesPath?: string /** * Path to the `server.ts` file to eject from default configuration file `yoga.config.ts`. * When provided, all other configuration properties are ignored and should be configured programatically. * **If provided, path has to exist** * @default ./src/server.ts */ ejectFilePath?: string /** * Path to the `express.ts` file. * This file gets injected the underlying express instance (to add routes, or middlewares etc...) * **If provided, path has to exist** * @default ./src/express.ts */ expressPath?: string /** * Config for the outputted files (schema, typings ..) */ output?: InputOutputFilesConfig /** * Config for the prisma integration */ prisma?: InputPrismaConfig } type RequiredProperty = Exclude< Required>, undefined > export type Config = { resolversPath: RequiredProperty<'resolversPath'> contextPath?: RequiredProperty<'contextPath'> ejectFilePath?: RequiredProperty<'ejectFilePath'> typesPath?: RequiredProperty<'typesPath'> output: RequiredProperty<'output'> prisma?: PrismaSchemaConfig['prisma'] expressPath?: RequiredProperty<'expressPath'> } export type ConfigWithInfo = { yogaConfigPath?: string yogaConfig: Config projectDir: string inputConfig: InputConfig datamodelInfoDir?: string prismaClientDir?: string } export interface Yoga { server: () => MaybePromise startServer: (params: T) => MaybePromise stopServer: (params: U) => any }