Config
Configuration for graphql.config.ts, exported with defineConfig.
The schema and documents keys are compatible with graphql-config, so
GraphQL editor extensions can share the file.
Example
import { defineConfig } from "@effect/graphql-generator/Config"
export default defineConfig({ schema: "./schema/github.graphql", documents: ["src/**\/*.graphql"], scalars: { GitObjectID: "effect/Schema#String" }})Constructors
Since v4.0.0 Source
Types a config file's default export. It returns its argument unchanged.
Signature
declare function defineConfig(config: { readonly documents: readonly Array<string>; readonly importExtension?: ".ts" | ".js"; readonly scalars?: { [key: string]: `${string}#${string}`; }; readonly schema: string; readonly shared?: string;}): { readonly documents: readonly Array<string>; readonly importExtension?: ".ts" | ".js"; readonly scalars?: { [key: string]: `${string}#${string}`; }; readonly schema: string; readonly shared?: string;}Models
Schemas
The configuration Schema, used to decode a config file's default export.
schema: the SDL (.graphql) or introspection JSON (.json) file, relative to the config file.documents: glob patterns (*,**,?,{a,b}) for the executable.graphqlor.gqldocuments, relative to the config file. Absolute patterns are aConfigError, and a{without a closing}is a literal character.node_modulesand dot-directories are skipped, and the schema file is never treated as a document.scalars: aSchemacodec per custom scalar, also able to override the built-inInt,FloatandID. Custom scalars namedDateTimeandURIdefault toSchema.DateTimeUtcFromStringandSchema.String;scalarscan override them too. Other unmapped custom scalars decode asSchema.Json.shared: where the shared module goes. Defaults to the schema's name and directory, e.g.github.graphqlorgithub.jsongivesgithub.graphql.ts. It can't be the schema, a document or a document's output.importExtension: the extension used in imports between generated files and to relative scalar modules. Accepts.ts(default) or.js. A relative scalar module's.ts,.jsor missing extension is replaced; any other extension, such as.mjs, is kept.
Signature
declare const Config: Struct<{ readonly documents: $Array<String>; readonly importExtension: optional<Literals<readonly [".ts", ".js"]>>; readonly scalars: optional<$Record<String, TemplateLiteral<readonly [String, "#", String]>>>; readonly schema: String; readonly shared: optional<String>;}> Since v4.0.0 Source
A "<module>#<export>" reference to a Schema codec for a custom scalar.
Relative modules resolve against the config file; bare modules are imported
as written.
Signature
declare const ScalarSpecifier: TemplateLiteral<readonly [String, "#", String]>