-
Notifications
You must be signed in to change notification settings - Fork 6
/
codegen.ts
40 lines (38 loc) · 955 Bytes
/
codegen.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
overwrite: true,
documents: [],
generates: {
'./src/services/protocol/types.ts': {
schema: {
[`${process.env.NEXT_PUBLIC_API_ENDPOINT}/graphql`]: {
headers: {
'x-api-key': process.env.NEXT_PUBLIC_API_KEY as string,
},
},
},
documents: 'src/services/protocol/**/*.gql',
plugins: [
'typescript',
'typescript-operations',
'typescript-graphql-request',
'typescript-resolvers',
],
config: {
scalars: {
_text: 'string',
},
skipTypename: true,
defaultMapper: 'Partial<{T}>',
avoidOptionals: {
field: true,
inputValue: false,
object: true,
defaultValue: true,
},
fetcher: 'graphql-request',
},
},
},
};
export default config;