UNPKG

2.25 kBTypeScriptView Raw
1import { Types } from '@graphql-codegen/plugin-helpers';
2import { GraphQLConfig } from 'graphql-config';
3import { GraphQLSchema } from 'graphql';
4export declare type YamlCliFlags = {
5 config: string;
6 watch: boolean | string | string[];
7 require: string[];
8 overwrite: boolean;
9 project: string;
10 silent: boolean;
11 errorsOnly: boolean;
12};
13export declare function loadContext(configFilePath?: string): Promise<CodegenContext> | never;
14export declare function buildOptions(): {
15 c: {
16 alias: string;
17 type: "string";
18 describe: string;
19 };
20 w: {
21 alias: string;
22 describe: string;
23 coerce: (watch: any) => string | boolean | any[];
24 };
25 r: {
26 alias: string;
27 describe: string;
28 type: "array";
29 default: any[];
30 };
31 o: {
32 alias: string;
33 describe: string;
34 type: "boolean";
35 };
36 s: {
37 alias: string;
38 describe: string;
39 type: "boolean";
40 };
41 e: {
42 alias: string;
43 describe: string;
44 type: "boolean";
45 };
46 p: {
47 alias: string;
48 describe: string;
49 type: "string";
50 };
51};
52export declare function parseArgv(argv?: string[]): YamlCliFlags;
53export declare function createContext(cliFlags?: YamlCliFlags): Promise<CodegenContext>;
54export declare function updateContextWithCliFlags(context: CodegenContext, cliFlags: YamlCliFlags): void;
55export declare class CodegenContext {
56 private _config;
57 private _graphqlConfig?;
58 private config;
59 private _project?;
60 private _pluginContext;
61 cwd: string;
62 filepath: string;
63 constructor({ config, graphqlConfig, filepath, }: {
64 config?: Types.Config;
65 graphqlConfig?: GraphQLConfig;
66 filepath?: string;
67 });
68 useProject(name?: string): void;
69 getConfig<T>(extraConfig?: T): T & Types.Config;
70 updateConfig(config: Partial<Types.Config>): void;
71 getPluginContext(): {
72 [key: string]: any;
73 };
74 loadSchema(pointer: Types.Schema): Promise<GraphQLSchema>;
75 loadDocuments(pointer: Types.OperationDocument[]): Promise<Types.DocumentFile[]>;
76}
77export declare function ensureContext(input: CodegenContext | Types.Config): CodegenContext;