Skip to content

Instantly share code, notes, and snippets.

@benjie
Last active February 8, 2023 13:06
Show Gist options
  • Save benjie/43143d21c985e9b47eb6204a109516e4 to your computer and use it in GitHub Desktop.
Save benjie/43143d21c985e9b47eb6204a109516e4 to your computer and use it in GitHub Desktop.

Custom GraphileConfig.Preset Reference

This reference was autogenerated by graphile config options using your local configuration file to determine the plugins and presets (and hence the configuration options) available. You should regenerate it from time to time (for example, when you upgrade a module, or add/remove modules).

{
  extends?: readonly GraphileConfig.Preset[]
  plugins?: GraphileConfig.Plugin[]
  disablePlugins?: readonly string[]
  gather?: GraphileBuild.GraphileBuildGatherOptions | undefined;
  grafast?: GrafastOptions | undefined;
  inflection?: GraphileBuild.GraphileBuildInflectionOptions | undefined;
  pgConfigs?: readonly GraphileConfig.PgDatabaseConfiguration<never>[]
  schema?: GraphileBuild.SchemaOptions | undefined;
  server?: ServerOptions | undefined;
}

gather

The gather phase is the second phase that occurs when building a schema with Graphile Build. It is responsible for looking at everything that can influence the shape of your schema, and turning that into an "input" for the schema phase.

{
  installWatchFixtures?: boolean;
  pgJwtType?: [string, string];
  pgStrictFunctions?: boolean;
}

gather.installWatchFixtures

Type: boolean | undefined

Should we attempt to install the watch fixtures into the database?

Default: true

gather.pgJwtType

Type: [string, string] | undefined

If you would like PostGraphile to automatically recognize a PostgreSQL type as a JWT, you should pass a tuple of the ["<schema name>", "<type name>"] so we can recognize it. This is case sensitive.

gather.pgStrictFunctions

Type: boolean | undefined

If true, we'll treat all arguments that don't have defaults as being required.

grafast

{
  context?: Record<string, any> | (<TContext extends Record<string, any>>(ctx: GraphileConfig.GraphQLRequestContext, currentContext?: Partial<TContext> | undefined) => PromiseOrValue<...>);
  explain?: boolean | string[];
}

grafast.context

Type: Record<string, any> | (<TContext extends Record<string, any>>(ctx: GraphileConfig.GraphQLRequestContext, currentContext?: Partial<TContext> | undefined) => PromiseOrValue<...>) | undefined

grafast.explain

Type: boolean | string[] | undefined

inflection

The inflection phase is the first phase that occurs when building a schema with Graphile Build. It is responsible for naming things - both things that are generated in the gather phase, and the ultimate types, fields, arguments, directives and so on in the GraphQL schema.

schema

The schema phase is the final phase that occurs when building a schema with Graphile Build. It is responsible for taking the inputs from the gather phase (and using the inflectors from the inflection phase) and generating a final GraphQL schema.

{
  dontSwallowErrors?: boolean;
  jsonScalarAsString?: boolean;
  nodeIdFieldName?: string;
  orderByNullsLast?: boolean;
  pgForbidSetofFunctionsToReturnNull?: boolean;
  pgJwtSecret?: any;
  pgJwtSignOptions?: any;
  pgUseCustomNetworkScalars?: boolean;
  pgV4UseTableNameForNodeIdentifier?: boolean;
  simpleCollections?: "only" | "both" | "omit";
  subscriptions?: boolean;
}

schema.dontSwallowErrors

Type: boolean | undefined

SwallowErrorsPlugin by default will "swallow" errors, allowing you to continue building your GraphQL schema even if errors (such as naming conflicts) occur. It is recommended that you set this option to true in your production configuration to disable this behavior.

schema.jsonScalarAsString

Type: boolean | undefined

Set 'true' if you want JSON values to be stringified.

schema.nodeIdFieldName

Type: string | undefined

If your schema includes compatibility with the GraphQL Global Object Identification Specification, typically this will be called 'id'. However the term 'id' often conflicts with databases which commonly use 'id' as their primary key name, so we give you the option to rename it.

schema.orderByNullsLast

Type: boolean | undefined

schema.pgForbidSetofFunctionsToReturnNull

Type: boolean | undefined

If true, setof functions cannot return null, so our list and connection types can use GraphQLNonNull in more places.

schema.pgJwtSecret

Type: any

schema.pgJwtSignOptions

Type: any

schema.pgUseCustomNetworkScalars

Type: boolean | undefined

schema.pgV4UseTableNameForNodeIdentifier

Type: boolean | undefined

schema.simpleCollections

Type: "only" | "both" | "omit" | undefined

  • 'only': connections will be avoided, preferring lists
  • 'omit': lists will be avoided, preferring connections
  • 'both': both lists and connections will be generated

schema.subscriptions

Type: boolean | undefined

Should we enable subscriptions in the schema?

server

Configuration options for Grafserv

{
  eventStreamRoute?: string;
  graphiql?: boolean;
  graphiqlOnGraphQLGET?: boolean;
  graphiqlPath?: string;
  graphqlOverGET?: boolean;
  graphqlPath?: string;
  host?: string;
  maxRequestLength?: number;
  outputDataAsString?: boolean;
  port?: number;
  schemaWaitTime?: number;
  watch?: boolean;
}

server.eventStreamRoute

Type: string | undefined

The path at which the GraphQL event stream would be made available; usually /graphql/stream

server.graphiql

Type: boolean | undefined

server.graphiqlOnGraphQLGET

Type: boolean | undefined

If true, then we will render GraphiQL on GET requests to the /graphql endpoint

server.graphiqlPath

Type: string | undefined

The path at which GraphiQL will be available; usually /

server.graphqlOverGET

Type: boolean | undefined

If true, allow GraphQL over GET requests. This has security ramifications, exercise caution.

server.graphqlPath

Type: string | undefined

The path at which GraphQL will be available; usually /graphql

server.host

Type: string | undefined

Host to listen on

server.maxRequestLength

Type: number | undefined

The length, in bytes, for the largest request body that the server will accept

server.outputDataAsString

Type: boolean | undefined

Use grafast 'string' optimization - response will be partially stringified already, use stringifyPayload before sending to the user

server.port

Type: number | undefined

Port number to listen on

server.schemaWaitTime

Type: number | undefined

How long should we wait for a schema promise to resolve before sending a failure to the client?

server.watch

Type: boolean | undefined

Set true to enable watch mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment