import { DefinitionNode } from "graphql"; import { DiagnosticsResult } from "./utils/DiagnosticError.js"; import * as ts from "typescript"; import { DeclarationDefinition, NameDefinition } from "./TypeContext.js"; import { TsIdentifier } from "./utils/helpers.js"; export declare const LIBRARY_IMPORT_NAME = "grats"; export declare const LIBRARY_NAME = "Grats"; export declare const TYPE_TAG = "gqlType"; export declare const FIELD_TAG = "gqlField"; export declare const SCALAR_TAG = "gqlScalar"; export declare const INTERFACE_TAG = "gqlInterface"; export declare const ENUM_TAG = "gqlEnum"; export declare const UNION_TAG = "gqlUnion"; export declare const INPUT_TAG = "gqlInput"; export declare const DIRECTIVE_TAG = "gqlDirective"; export declare const ANNOTATE_TAG = "gqlAnnotate"; export declare const QUERY_FIELD_TAG = "gqlQueryField"; export declare const MUTATION_FIELD_TAG = "gqlMutationField"; export declare const SUBSCRIPTION_FIELD_TAG = "gqlSubscriptionField"; export declare const CONTEXT_TAG = "gqlContext"; export declare const INFO_TAG = "gqlInfo"; export declare const IMPLEMENTS_TAG_DEPRECATED = "gqlImplements"; export declare const KILLS_PARENT_ON_EXCEPTION_TAG = "killsParentOnException"; export declare const ALL_GQL_TAGS: readonly ["gqlType", "gqlField", "gqlScalar", "gqlInterface", "gqlEnum", "gqlUnion", "gqlInput", "gqlDirective", "gqlAnnotate", "gqlQueryField", "gqlMutationField", "gqlSubscriptionField"]; export declare const ONE_OF_TAG = "oneOf"; export declare const TAGS: readonly ["gqlType", "gqlField", "gqlScalar", "gqlInterface", "gqlEnum", "gqlUnion", "gqlInput", "gqlDirective", "gqlAnnotate", "gqlQueryField", "gqlMutationField", "gqlSubscriptionField", "killsParentOnException", "oneOf"]; export type TagName = (typeof TAGS)[number]; export declare const OPERATION_TYPES: Set; export type ExtractionSnapshot = { /** GraphQL definitions extracted from the TypeScript source file. */ readonly definitions: DefinitionNode[]; /** * Map from a TypeScript AST node that may reference a GraphQL type to a * GraphQL NameNode. Note that at extraction time we don't actually know the * GraphQL name that this references, or if it even references a valid Grats * type. So, the `NameNode` passed here will generally have a placeholder * name. This will be resolved in a later pass since it may reference a type * defined in another file and extraction is done on a per-file basis. */ readonly unresolvedNames: Map; /** Map from a TypeScript declaration to the extracted GraphQL name and kind. */ readonly nameDefinitions: Map; /** * Some declarations (notably derived context functions) are not actually the * declaration that will become a special GraphQL value, but rather they * _reference_ a type which will implicitly become a special type to Grats. */ readonly implicitNameDefinitions: Map; /** * Records which named GraphQL types define a `__typename` field. * This is used to ensure all types which are members of an abstract type * (union or interface) define a `__typename` field which is required to * determine their GraphQL type at runtime. */ readonly typesWithTypename: Set; /** * TypeScript interfaces which have been used to define GraphQL types. This is * used in a later validation pass to ensure we never use merged interfaces, * since merged interfaces have surprising behaviors which can lead to bugs. */ readonly interfaceDeclarations: Array; }; /** * Extracts GraphQL definitions from TypeScript source code. * * Note that we extract a GraphQL AST with the AST nodes' location information * populated with references to the TypeScript code from which the types were * derived. * * This ensures that we can apply GraphQL schema validation rules, and any reported * errors will point to the correct location in the TypeScript source code. */ export declare function extract(sourceFile: ts.SourceFile, config?: { tsClientEnums?: string | null; }): DiagnosticsResult;