1 | import { Types } from '@graphql-codegen/plugin-helpers';
|
2 | import { FragmentDefinitionNode } from 'graphql';
|
3 | import { resolveDocumentImports, DocumentImportResolverOptions } from './resolve-document-imports';
|
4 | import { FragmentImport, ImportSource } from '@graphql-codegen/visitor-plugin-common';
|
5 | export { resolveDocumentImports, DocumentImportResolverOptions };
|
6 | export declare type FragmentImportFromFn = (source: ImportSource<FragmentImport>, sourceFilePath: string) => ImportSource<FragmentImport>;
|
7 | export declare type NearOperationFileConfig = {
|
8 | /**
|
9 | * @description Required, should point to the base schema types file.
|
10 | * The key of the output is used a the base path for this file.
|
11 | *
|
12 | * If you wish to use an NPM package or a local workspace package, make sure to prefix the package name with `~`.
|
13 | *
|
14 | * @exampleMarkdown
|
15 | * ```yml
|
16 | * generates:
|
17 | * src/:
|
18 | * preset: near-operation-file
|
19 | * presetConfig:
|
20 | * baseTypesPath: types.ts
|
21 | * plugins:
|
22 | * - typescript-operations
|
23 | * ```
|
24 | */
|
25 | baseTypesPath: string;
|
26 | /**
|
27 | * @description Overrides all external fragments import types by using a specific file path or a package name.
|
28 | *
|
29 | * If you wish to use an NPM package or a local workspace package, make sure to prefix the package name with `~`.
|
30 | *
|
31 | * @exampleMarkdown
|
32 | * ```yml
|
33 | * generates:
|
34 | * src/:
|
35 | * preset: near-operation-file
|
36 | * presetConfig:
|
37 | * baseTypesPath: types.ts
|
38 | * importAllFragmentsFrom: '@fragments'
|
39 | * plugins:
|
40 | * - typescript-operations
|
41 | * ```
|
42 | */
|
43 | importAllFragmentsFrom?: string | FragmentImportFromFn;
|
44 | /**
|
45 | * @description Optional, sets the extension for the generated files. Use this to override the extension if you are using plugins that requires a different type of extensions (such as `typescript-react-apollo`)
|
46 | * @default .generates.ts
|
47 | *
|
48 | * @exampleMarkdown
|
49 | * ```yml
|
50 | * generates:
|
51 | * src/:
|
52 | * preset: near-operation-file
|
53 | * presetConfig:
|
54 | * baseTypesPath: types.ts
|
55 | * extension: .generated.tsx
|
56 | * plugins:
|
57 | * - typescript-operations
|
58 | * - typescript-react-apollo
|
59 | * ```
|
60 | */
|
61 | extension?: string;
|
62 | /**
|
63 | * @description Optional, override the `cwd` of the execution. We are using `cwd` to figure out the imports between files. Use this if your execuion path is not your project root directory.
|
64 | * @default process.cwd()
|
65 | *
|
66 | * @exampleMarkdown
|
67 | * ```yml
|
68 | * generates:
|
69 | * src/:
|
70 | * preset: near-operation-file
|
71 | * presetConfig:
|
72 | * baseTypesPath: types.ts
|
73 | * cwd: /some/path
|
74 | * plugins:
|
75 | * - typescript-operations
|
76 | * ```
|
77 | */
|
78 | cwd?: string;
|
79 | /**
|
80 | * @description Optional, defines a folder, (Relative to the source files) where the generated files will be created.
|
81 | * @default ''
|
82 | *
|
83 | * @exampleMarkdown
|
84 | * ```yml
|
85 | * generates:
|
86 | * src/:
|
87 | * preset: near-operation-file
|
88 | * presetConfig:
|
89 | * baseTypesPath: types.ts
|
90 | * folder: __generated__
|
91 | * plugins:
|
92 | * - typescript-operations
|
93 | * ```
|
94 | */
|
95 | folder?: string;
|
96 | /**
|
97 | * @description Optional, override the name of the import namespace used to import from the `baseTypesPath` file.
|
98 | * @default Types
|
99 | *
|
100 | * @exampleMarkdown
|
101 | * ```yml
|
102 | * generates:
|
103 | * src/:
|
104 | * preset: near-operation-file
|
105 | * presetConfig:
|
106 | * baseTypesPath: types.ts
|
107 | * importTypesNamespace: SchemaTypes
|
108 | * plugins:
|
109 | * - typescript-operations
|
110 | * ```
|
111 | */
|
112 | importTypesNamespace?: string;
|
113 | };
|
114 | export declare type FragmentNameToFile = {
|
115 | [fragmentName: string]: {
|
116 | location: string;
|
117 | importsNames: string[];
|
118 | onType: string;
|
119 | node: FragmentDefinitionNode;
|
120 | };
|
121 | };
|
122 | export declare const preset: Types.OutputPreset<NearOperationFileConfig>;
|
123 | export default preset;
|