-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcodegen.ts
52 lines (49 loc) · 1.4 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
import type { CodegenConfig } from "@graphql-codegen/cli";
import { BLUE_API_GRAPHQL_URL } from "@morpho-org/morpho-ts";
const config: CodegenConfig = {
overwrite: true,
schema: BLUE_API_GRAPHQL_URL,
documents: ["graphql/*.{query,fragment}.gql"],
generates: {
"src/api/types.ts": {
plugins: ["typescript-operations"],
preset: "import-types",
presetConfig: {
typesPath: "@morpho-org/blue-api-sdk",
},
config: {
avoidOptionals: {
field: true,
inputValue: false,
defaultValue: true,
},
scalars: {
BigInt: {
input: `Types.Scalars["BigInt"]["input"]`,
output: `Types.Scalars["BigInt"]["output"]`,
},
HexString: {
input: `Types.Scalars["HexString"]["input"]`,
output: `Types.Scalars["HexString"]["output"]`,
},
Address: {
input: `Types.Scalars["Address"]["input"]`,
output: `Types.Scalars["Address"]["output"]`,
},
MarketId: {
input: `Types.Scalars["MarketId"]["input"]`,
output: `Types.Scalars["MarketId"]["output"]`,
},
},
},
},
"src/api/sdk.ts": {
plugins: ["typescript-graphql-request"],
preset: "import-types",
presetConfig: {
typesPath: "./types.js",
},
},
},
};
export default config;