Skip to main content

GeneratorOptions

Options for the Baeta Generator.

Properties

PropertyTypeDefault valueDescription

schemas

string[]

["src/∗∗/∗.gql", "src/∗∗/∗.graphql"];

Glob pattern(s) to locate GraphQL schema files.

baseTypesPath?

string

`${modulesDir}/../__generated__/types.ts`;

Output path for the generated base types file.

contextType?

string

undefined;

Path to the context type definition. Supports both named and default exports.

Examples

contextType: "src/types/context.ts#Context"; // for named export
contextType: "src/types/context.ts"; // for default export

cwd?

string

process.cwd();

Current working directory for resolving relative paths.

extensions?

string

undefined;

Path to Baeta Extensions (ex. auth-extension). Only default export is supported.

Example

extensions: "src/extensions.ts";

fileOptions?

FileOptions

undefined

Configuration options for generated files.

importExtension?

false | ".js" | ".ts"

".ts";

File extension to use in generated import statements. Set to false to omit extensions.

loaders?

Loader<any>[]

undefined

Custom schema loaders for processing schema files.

moduleDefinitionName?

string

"typedef.ts";

Filename for the generated module definition file. Contains type definitions and the GraphQL AST.

modulesDir?

string

"src/modules";

Root directory where GraphQL modules are defined.

scalars?

Record<string, string | { input: string; output: string; }>

undefined;

Custom scalar type mappings. Maps GraphQL scalar types to TypeScript types. Supports global types and imports.

Example

{ DateTime: 'Date', JSON: 'Record<string, unknown>' }	 *