File tree Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ API_URL=http://localhost:4000/graphql
5656` .sgtsrc.js `
5757
5858``` javascript
59+ /**
60+ * @type { import("simple-graphql-to-typescript").SgtsConfig }
61+ */
5962module .exports = {
6063 endpoint: process .env .API_URL ,
6164 output: ' ./generated.ts' ,
Original file line number Diff line number Diff line change @@ -66,17 +66,20 @@ const commentFragment = gql`
6666 body
6767 }
6868`
69- // OR a simple string
69+ // Or a simple string
7070
7171const commentFragment = `
7272 id
7373 name
7474 body
7575`
7676
77- const commentsQuery = sgts .comments ().$fragment (commentFragment );
77+ const commentsQuery = sgts .comments (commentFragment );
78+ // Or
79+ const commentsQuery = sgts .comments (); // This will take the auto-generated fragment by default
7880
79- commentsQuery .$args ({postId: 5 }).$fetch ().then (data => console .log (data ))
81+
82+ const result = await commentsQuery .$args ({postId: 5 }).$fetch ();
8083
8184// You can cancel your request any time
8285
Original file line number Diff line number Diff line change 33### Type: ` boolean `
44
55::: warning
6- ** This option is still in alpha and still buggy, do not use in production **
6+ ** This option is still in alpha can still be buggy, use with care **
77:::
88
9- Enable fragment generation and queries/mutations auto-fragments so you don't have to pass any
9+ Enable fragment generation and queries/mutations auto-fragments so you don't have to pass any.
10+
11+ For classic GraphQL types, this will generate the fragment up to 2 levels deep to avoid circulars types.
12+ For Connection fragments, it will go to 4 levels deep.
Original file line number Diff line number Diff line change 11{
22 "name" : " simple-graphql-to-typescript" ,
3- "version" : " 0.10.10 " ,
3+ "version" : " 0.10.11 " ,
44 "description" : " Simple Typescript interface generator from GraphQL Schemas" ,
55 "main" : " dist/index.js" ,
66 "typings" : " types/index.d.ts" ,
8080 "eslint" : " ^7.21.0" ,
8181 "eslint-config-prettier" : " ^8.1.0" ,
8282 "eslint-plugin-prettier" : " ^3.3.1" ,
83- "inquirer" : " ^7.3.3" ,
8483 "jest" : " ^26.6.3" ,
8584 "lodash" : " ^4.17.21" ,
8685 "rimraf" : " ^3.0.2" ,
9493 "commander" : " ^6.2.0" ,
9594 "custom-env" : " ^2.0.1" ,
9695 "dotenv" : " ^8.2.0" ,
96+ "inquirer" : " ^7.3.3" ,
9797 "figlet" : " ^1.5.0" ,
9898 "graphql" : " ^15.5.0" ,
9999 "mkdirp" : " ^1.0.4" ,
You can’t perform that action at this time.
0 commit comments