UNPKG

3.53 kBTypeScriptView Raw
1import { ASTNode, FragmentDefinitionNode } from 'graphql';
2import { ParsedMapper } from './mappers';
3/**
4 * A map between the GraphQL directive name and the identifier that should be used
5 */
6export declare type DirectiveArgumentAndInputFieldMappings = {
7 [name: string]: string;
8};
9/**
10 * Parsed directives map - a mapping between GraphQL directive name and the parsed mapper object,
11 * including all required information for generating code for that mapping.
12 */
13export declare type ParsedDirectiveArgumentAndInputFieldMappings = {
14 [name: string]: ParsedMapper;
15};
16/**
17 * Scalars map or a string, a map between the GraphQL scalar name and the identifier that should be used
18 */
19export declare type ScalarsMap = string | {
20 [name: string]: string;
21};
22/**
23 * A normalized map between GraphQL scalar name and the identifier name
24 */
25export declare type NormalizedScalarsMap = {
26 [name: string]: string;
27};
28/**
29 * Parsed scalars map - a mapping between GraphQL scalar name and the parsed mapper object,
30 * including all required information for generting code for that mapping.
31 */
32export declare type ParsedScalarsMap = {
33 [name: string]: ParsedMapper;
34};
35/**
36 * A raw configuration for enumValues map - can be represented with a single string value for a file path,
37 * a map between enum name and a file path, or a map between enum name and an object with explicit enum values.
38 */
39export declare type EnumValuesMap<AdditionalProps = {}> = string | {
40 [enumName: string]: string | ({
41 [key: string]: string | number;
42 } & AdditionalProps);
43};
44export declare type ParsedEnumValuesMap = {
45 [enumName: string]: {
46 mappedValues?: {
47 [valueName: string]: string | number;
48 };
49 typeIdentifier: string;
50 sourceIdentifier?: string;
51 sourceFile?: string;
52 importIdentifier?: string;
53 isDefault?: boolean;
54 };
55};
56export declare type ConvertNameFn<T = {}> = ConvertFn<T>;
57export declare type GetFragmentSuffixFn = (node: FragmentDefinitionNode | string) => string;
58export interface ConvertOptions {
59 prefix?: string;
60 suffix?: string;
61 transformUnderscore?: boolean;
62}
63export declare type ConvertFn<T = {}> = (node: ASTNode | string, options?: ConvertOptions & T) => string;
64export declare type NamingConventionFn = (str: string) => string;
65export declare type NamingConventionResolvePath = string;
66export declare type NamingConvention = string | NamingConventionFn | NamingConventionMap;
67/**
68 * @additionalProperties false
69 */
70export interface NamingConventionMap {
71 enumValues?: 'keep' | NamingConventionResolvePath | NamingConventionFn;
72 typeNames?: 'keep' | NamingConventionResolvePath | NamingConventionFn;
73 transformUnderscore?: boolean;
74}
75export declare type LoadedFragment<AdditionalFields = {}> = {
76 name: string;
77 onType: string;
78 node: FragmentDefinitionNode;
79 isExternal: boolean;
80 importFrom?: string | null;
81} & AdditionalFields;
82export declare type DeclarationKind = 'type' | 'interface' | 'class' | 'abstract class';
83export interface DeclarationKindConfig {
84 directive?: DeclarationKind;
85 scalar?: DeclarationKind;
86 input?: DeclarationKind;
87 type?: DeclarationKind;
88 interface?: DeclarationKind;
89 arguments?: DeclarationKind;
90}
91export interface AvoidOptionalsConfig {
92 field?: boolean;
93 object?: boolean;
94 inputValue?: boolean;
95 defaultValue?: boolean;
96 resolvers?: boolean;
97}
98export interface ParsedImport {
99 moduleName: string | null;
100 propName: string;
101}